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

Felix Janda felix.janda at posteo.de
Sat Aug 10 14:22:58 PDT 2013


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.

Felix

 1376169778.0


More information about the Toybox mailing list