[pacman-dev] [PATCH] Fix command line argument parsing in makepkg

Xavier shiningxc at gmail.com
Thu May 22 02:01:31 EDT 2008


Sebastian Nowicki wrote:
> On 22/05/2008, at 7:13 AM, Xavier wrote:
>
>> Because you need to use -- to separate the getopt options from the
>> argument, this is all in the manpage actually, I just figured that :)
>> getopt -o abc -- $@"
>> That is what makepkg does.
>>
>
> Yes, in GNU's getopt it works like that, but not in the BSD getopt.
> Even if "getopt -o abc -- $@" is used, you still get something like
> "-- abc -- -a -b -c", because it thinks that "-o abc -- $@" is what it
> has to process. BSD's getopt only takes the valid short options as the
> first parameter, and then the arguments to be processed [1].
>
>> Actually I am confused. If we want to use that compatible format,
>> getopt
>> abc $@, then we can't use long options anymore?
>
> It appears so, which is very bad.
>
> [1] http://fuse4bsd.creo.hu/localcgi/man-cgi.cgi?getopt+1
>

Ah I see.. As I said earlier, we were using getopts before getopt :
http://projects.archlinux.org/?p=pacman.git;a=commitdiff;h=54b71f0427e87e6d525423df06f8a06f2b71c518

So it basically means we need to revert that commit for portability?
The new way looks much nicer...
I would like to have Aaron and Dan inputs here :P




More information about the pacman-dev mailing list