[Toybox] Put syslogd and logger into the same file?

Rob Landley rob at landley.net
Sat Aug 10 20:32:34 PDT 2013


On 08/10/2013 04:22:58 PM, Felix Janda wrote:
> Right now syslogd.c contains code from <sys/syslog.h> declaring the  
> arrays
> prioritynames and facilitynames, which map human readable strings to
> numerical ids. logger.c contains very similar array definitions.
> 
> <sys/syslog.h> declares these arrays only when SYSLOG_NAMES has been
> #defined. The structure with the descriptive name "CODE" used for the
> array members is also only defined conditionally. Something like
> 
> #ifndef SYSLOG_NAMES
> extern CODE prioritynames[];
> extern CODE facilitynames[];
> #endif
> 
> is also missing in <sys/syslog.h>.
> 
> IMO the least bad way to use the arrays from <sys/syslog.h> would be  
> to
> combine syslogd.c and logger.c into one file and there define
> SYSLOG_NAMES before including toys.h.

It's a good idea, but:

What I haven't figured out yet is how to do the argument parsing.  
syslogd and logger have very different option strings.

Right now there's only one GLOBALS block per file. That's easy enough  
to fix, and we can #undef TT and #define TT toys. But the FLAG_* macros  
are also defined based on FOR_command. And that's harder to clean up...

Rob
 1376191954.0


More information about the Toybox mailing list