delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/10/10/17:32:43

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <01aa01c03300$0816c360$c4acb018@home.com>
From: "Erik Nolte" <enolte AT campuspipeline DOT com>
To: <cygwin AT sources DOT redhat DOT com>
References: <1001010201259 DOT AA89692 DOT SM AT nike DOT ins DOT cwru DOT edu> <20001010162948 DOT D5706 AT cygnus DOT com>
Subject: Re: getopts missing with latest cygwin
Date: Tue, 10 Oct 2000 15:21:15 -0600
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400

> >> -rwxr-xr-x   1 bin      bin         1518 Jul 25  1995 /usr/bin/getopts
> >>
> >> I have no idea how it actually is used with sh on this system, though.
> >
> >It's not.  It simply exists to satisfy a POSIX.2 requirement.  It need
> >not be (and is not) useful.
>
> It's not completely useless, though.

It's worse than useless :-) ... it looks like a functional command, but no
matter how hard you try, you can't get the thing to work.

> % /usr/bin/getopts "a:" foo -a
> /usr/bin/getopts[7]: getopts: a argument expected

Another interesting problem: "foo" (the variable holding the next parsed
argument) will be set in the environment of *getopts* which will be lost
when getopts exits.  The shell will never see "foo" change.

So, the external getopts can't communicate the parsed options to the shell,
nor the option argument (OPTARG) or option index (OPTIND).  I'll bet the
external getopts doesn't even work for parsing beyond the first argument.
If it does work past the first argument (i.e. the first invocation of
getopts), then getopts is dropping temp file garbage somewhere.

Worse than useless :-)

- Erik


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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