syslogd_main & getopt

Rob Landley rob at landley.net
Sun Oct 16 23:00:19 UTC 2005


On Sunday 16 October 2005 16:25, Cristian Ionescu-Idbohrn wrote:
> Given the ifdefs below this line:
>
>   while ((opt = getopt(argc, argv, "m:nO:s:Sb:R:LC::")) > 0) {
>
> shouldn't it be rewritten similar to:
>
>   while ((opt = getopt(argc, argv, "m:nO:S"
> #ifdef CONFIG_FEATURE_ROTATE_LOGFILE
>                                    "s:b:"
> #endif
> #ifdef CONFIG_FEATURE_REMOTE_LOG
>                                    "R:L"
> #endif
> #ifdef CONFIG_FEATURE_IPC_SYSLOG
>                                    "C::"
> #endif
>           )) > 0) {
>
> The way it currently behaves is confusing :( Options depending on ifdefs
> are accepted, although they do nothing useful.

Accepting but ignoring features that are configured out doesn't bother me 
much.  (It runs about even with having the extra config #ifdefs.  No really 
strong opinion one way or the other.)

> usage.h needs some attention too. CONFIG_FEATURE_...LOG defines should be
> moved below the 'sysctl_trivial_usage' block.

The usage definitely needs to be correct, though.

Any word on the status of the proposed #include rework to automate generation 
of the usage config macros?  (Say _that_ five times fast...)

> Cheers,
> Cristian

Rob



More information about the busybox mailing list