Subject: Re: Switching from old-style getopt to new-style one
To: None <greywolf@starwolf.com>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-userlevel
Date: 11/02/2000 17:12:04
Greywolf wrote:

> On Thu, 2 Nov 2000, Simon Burge wrote:
> 
> # > On Thu, 2 Nov 2000, Simon Burge wrote:
> # > 
> # > # Hmm
> # > # 
> # > # 	su root -c ls
> # > # 
> # > # login class "ls" ?
> # > 
> # > No, command.
> # 
> # If the fancy getopt replacement pulls "-c ls" by looking at su's getopt
> # string (which has a ":c" in it), then it will set su's -c parameter to
> # "ls", not pass it to the shell as it should be...
> 
> Odd, I'd read it as 'accept - as a parameter, and if there's a -c,
> do something else with it (presumably)'.
> 
> That "something else" happens to go to the shell.  Are you sure you're
> not thinking "c:"?

Right, it should be "c:" and not ":c" - braino.

The way that I understand the new getopt's behaviour (from the
description seen here) is that any valid options _anywhere_ in
the command line will be parsed.  If I've got that wrong, I'll
just crawl back into my shell (ahem!) and shut up :-)

simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD Sales, Support and Service:  http://www.wasabisystems.com/