Convert fmt_first and fmt_confd into macros.
This commit is contained in:
13
logging.c
13
logging.c
@@ -121,6 +121,9 @@ mysyslog(pri, fmt, va_alist)
|
||||
closelog();
|
||||
}
|
||||
|
||||
#define FMT_FIRST "%8s : %s"
|
||||
#define FMT_CONTD "%8s : (command continued) %s";
|
||||
|
||||
/*
|
||||
* Log a message to syslog, pre-pending the username and splitting the
|
||||
* message into parts if it is longer than MAXSYSLOGLEN.
|
||||
@@ -133,14 +136,12 @@ do_syslog(pri, msg)
|
||||
size_t len, maxlen;
|
||||
char *p, *tmp, save;
|
||||
const char *fmt;
|
||||
const char *fmt_first = "%8s : %s";
|
||||
const char *fmt_contd = "%8s : (command continued) %s";
|
||||
|
||||
/*
|
||||
* Log the full line, breaking into multiple syslog(3) calls if necessary
|
||||
*/
|
||||
fmt = fmt_first;
|
||||
maxlen = MAXSYSLOGLEN - (sizeof(fmt_first) - 6 + strlen(user_name));
|
||||
fmt = FMT_FIRST;
|
||||
maxlen = MAXSYSLOGLEN - (sizeof(FMT_FIRST) - 6 + strlen(user_name));
|
||||
for (p = msg; *p != '\0'; ) {
|
||||
len = strlen(p);
|
||||
if (len > maxlen) {
|
||||
@@ -167,8 +168,8 @@ do_syslog(pri, msg)
|
||||
mysyslog(pri, fmt, user_name, p);
|
||||
p += len;
|
||||
}
|
||||
fmt = fmt_contd;
|
||||
maxlen = MAXSYSLOGLEN - (sizeof(fmt_contd) - 6 + strlen(user_name));
|
||||
fmt = FMT_CONTD;
|
||||
maxlen = MAXSYSLOGLEN - (sizeof(FMT_CONTD) - 6 + strlen(user_name));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user