delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/12/29/14:01:00

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-Id: <200312291900.hBTJ0Gqd014331@guild.plethora.net>
From: seebs AT plethora DOT net (Peter Seebach)
Reply-To: seebs AT plethora DOT net (Peter Seebach)
To: cygwin AT cygwin DOT com
Subject: Re: Question about ash and getopts
In-reply-to: Your message of "Mon, 29 Dec 2003 11:10:23 MST." <DLEDLBGGCHGDFMMGKBHBAELBCDAA.blair@houghton.net>
Date: Mon, 29 Dec 2003 13:00:16 -0600
X-IsSubscribed: yes

In message <DLEDLBGGCHGDFMMGKBHBAELBCDAA DOT blair AT houghton DOT net>, "Blair P. Houghto
n" writes:
>So I take it this "idiom" is only supposed to work in newer cygwin versions?

I dunno.  It's a very, very, odd idiom, that leaves you stuck with a great
deal of manual parsing anyway.

>And I too am puzzled why someone would defeature a shell instead
>of letting it work with either method.  I don't see it as a
>portability issue unless you think a significant number of users
>will be porting their scripts from systems running cygwin to systems
>running atavistic variants of UNIX.

I did check; SunOS 4.1.3 had getopts too.  So, basically, it's portable
to everything except the 3b1 and 3b2, and possibly old versions of OSF/1.

But, most importantly, it's in POSIX.  I can see no reason for /bin/sh to not
be at least reasonably close to a POSIX shell, when the code is already
written.

The "it saves space" argument is implausible, and frankly counterproductive;
it should be obvious to the casual reader that calls to getopt are MUCH more
expensive than a shell with getopts in it, as is the other option, running
bash instead.  A shell without getopts may be marginally smaller, such that
scripts which don't use getopts are "faster"... But did anyone actually
measure this making a difference, or is this just Little Tin God optimization
at work?

-s

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019