bb_opt_complementaly '+'

Bernhard Fischer rep.nop at aon.at
Sun Aug 28 20:37:23 UTC 2005


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?



More information about the busybox mailing list