Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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" To: 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 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit 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