[pacman-dev] [PATCH] Added the function parse_options to replace getopt

Yun Zheng Hu yunzheng.hu at gmail.com
Wed Nov 19 18:33:54 EST 2008


On Wed, Nov 19, 2008 at 2:46 AM, Allan McRae <allan at archlinux.org> wrote:
>
> I need to go through this more fully but this seems OK to me.   One comment:
>  you should probably change the GETOPT GO BANG! stuff to something like
> "PARSE_OPTIONS FAILED", or preferably handle the error return properly.
>
> Allan
>

There are still some issues with this patch:
   - error reporting when an unrecognized option is used or an
required argument is not supplied
   - handling of long options that need parameters/argument. (for
example --config)
   - handling the end of options indicator: --

Proper handling of the error return is quite difficult as it is
currently handled by the exit trap.
I went for the "PARSE_OPTIONS FAILED" method.

I'm sending a new patch which corrects these issues in a few minutes.



More information about the pacman-dev mailing list