+/* We are using bb_common_bufsiz1 for buffering: */
+enum { MAX_READ = (BUFSIZ/6) & ~0xf };
+/* We recv into RECVBUF... (size: MAX_READ ~== BUFSIZ/6) */
+#define RECVBUF bb_common_bufsiz1
+/* ...then copy to PARSEBUF, escaping control chars */
+/* (can grow x2 max ~== BUFSIZ/3) */
+#define PARSEBUF (bb_common_bufsiz1 + MAX_READ)
+/* ...then sprintf into PRINTBUF, adding timestamp (15 chars),
+ * host (64), fac.prio (20) to the message */
+/* (growth by: 15 + 64 + 20 + delims = ~110) */
+#define PRINTBUF (bb_common_bufsiz1 + 3*MAX_READ)
+/* totals: BUFSIZ == BUFSIZ/6 + BUFSIZ/3 + (BUFSIZ/3+BUFSIZ/6)
+ * -- we have BUFSIZ/6 extra at the ent of PRINTBUF
+ * which covers needed ~110 extra bytes (and much more) */
+
+
+/* Options */
+enum {
+ OPTBIT_mark = 0, // -m
+ OPTBIT_nofork, // -n
+ OPTBIT_outfile, // -O
+ OPTBIT_loglevel, // -l
+ OPTBIT_small, // -S
+ USE_FEATURE_ROTATE_LOGFILE(OPTBIT_filesize ,) // -s
+ USE_FEATURE_ROTATE_LOGFILE(OPTBIT_rotatecnt ,) // -b
+ USE_FEATURE_REMOTE_LOG( OPTBIT_remote ,) // -R
+ USE_FEATURE_REMOTE_LOG( OPTBIT_localtoo ,) // -L
+ USE_FEATURE_IPC_SYSLOG( OPTBIT_circularlog,) // -C
+
+ OPT_mark = 1 << OPTBIT_mark ,
+ OPT_nofork = 1 << OPTBIT_nofork ,
+ OPT_outfile = 1 << OPTBIT_outfile ,
+ OPT_loglevel = 1 << OPTBIT_loglevel,
+ OPT_small = 1 << OPTBIT_small ,
+ OPT_filesize = USE_FEATURE_ROTATE_LOGFILE((1 << OPTBIT_filesize )) + 0,
+ OPT_rotatecnt = USE_FEATURE_ROTATE_LOGFILE((1 << OPTBIT_rotatecnt )) + 0,
+ OPT_remotelog = USE_FEATURE_REMOTE_LOG( (1 << OPTBIT_remote )) + 0,
+ OPT_locallog = USE_FEATURE_REMOTE_LOG( (1 << OPTBIT_localtoo )) + 0,
+ OPT_circularlog = USE_FEATURE_IPC_SYSLOG( (1 << OPTBIT_circularlog)) + 0,
+};
+#define OPTION_STR "m:nO:l:S" \
+ USE_FEATURE_ROTATE_LOGFILE("s:" ) \
+ USE_FEATURE_ROTATE_LOGFILE("b:" ) \
+ USE_FEATURE_REMOTE_LOG( "R:" ) \
+ USE_FEATURE_REMOTE_LOG( "L" ) \
+ USE_FEATURE_IPC_SYSLOG( "C::")
+#define OPTION_DECL *opt_m, *opt_l \
+ USE_FEATURE_ROTATE_LOGFILE(,*opt_s) \
+ USE_FEATURE_ROTATE_LOGFILE(,*opt_b) \
+ USE_FEATURE_REMOTE_LOG( ,*opt_R) \
+ USE_FEATURE_IPC_SYSLOG( ,*opt_C = NULL)
+#define OPTION_PARAM &opt_m, &logFilePath, &opt_l \
+ USE_FEATURE_ROTATE_LOGFILE(,&opt_s) \
+ USE_FEATURE_ROTATE_LOGFILE(,&opt_b) \
+ USE_FEATURE_REMOTE_LOG( ,&opt_R) \
+ USE_FEATURE_IPC_SYSLOG( ,&opt_C)