[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: bb_opt_complementaly '+'
From:       Tito <farmatito () tiscali ! it>
Date:       2005-08-29 11:36:50
Message-ID: 200508291336.50830.farmatito () tiscali ! it
[Download RAW message or body]

On Sunday 28 August 2005 22:37, Bernhard Fischer wrote:
> Hi,
> 
> What about adding the special character '+' to bb_opt_complementaly?
> 
>    "+"     A plus between two options, or between an option and a group
>            of options means that the options depend on each other. An
>            error will be forced if the options are not used together.
> 
>            For example:
>            The start-stop-daemon applet has the options "-m" and "-p".
>            Both options (makepid and pidfile) have to be given. If one
>            of the options are missing, bb_getopt_ulflags's return value
>            will have the error flag set (BB_GETOPT_ERROR).
> 
>            static char *pidfile = NULL;
>            static FILE *pidf = NULL;
>            bb_opt_complementaly = "m+p:p+m";
>            opt = bb_getopt_ulflags(argc, argv, "mp:", &pidfile);
>            if (opt & 1 && opt & 2) /* user wants _us_ to make the pidfile */
>              pidf = bb_xfopen(pidfile, "w");
> 
> What do you think?

Hi, 
isn't it easier to use this:

  "abc"   If groups of two or more chars are specified, the first char
           is the main option and the other chars are secondary options.
           Their flags will be turned on if the main option is found even
           if they are not specifed on the command line.  For example:

           bb_opt_complementaly = "abc";

           flags = bb_getopt_ulflags(argc, argv, "abcd")

           If getopt() finds "-a" on the command line, then
           bb_getopt_ulflags's return value will be as if "-a -b -c" were
           found.
in this case:
bb_opt_complementaly = "mp:pm";

Ciao,
Tito
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://codepoet.org/mailman/listinfo/busybox
> 
> 
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic