Patch from Matt Kraai to make logger log all arguments.
This commit is contained in:
parent
5e09b6e3a8
commit
9cff4fbac9
@ -45,6 +45,7 @@
|
|||||||
* Mark Whitley -- remix of xargs
|
* Mark Whitley -- remix of xargs
|
||||||
* Jim Gleason <jimg@lineo.com> -- fixed tar so it no longer breaks
|
* Jim Gleason <jimg@lineo.com> -- fixed tar so it no longer breaks
|
||||||
hard links.
|
hard links.
|
||||||
|
* Matt Kraai -- logger now logs all arguments, not just the first
|
||||||
|
|
||||||
|
|
||||||
-Erik Andersen
|
-Erik Andersen
|
||||||
|
15
logger.c
15
logger.c
@ -149,10 +149,19 @@ extern int logger_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
message = buf;
|
message = buf;
|
||||||
} else {
|
} else {
|
||||||
if (argc >= 1)
|
if (argc >= 1) {
|
||||||
message = *argv;
|
int len = 1; /* for the '\0' */
|
||||||
else
|
for (; *argv != NULL; argv++) {
|
||||||
|
len += strlen(*argv);
|
||||||
|
len += 1; /* for the space between the args */
|
||||||
|
message = xrealloc(message, len);
|
||||||
|
strcat(message, *argv);
|
||||||
|
strcat(message, " ");
|
||||||
|
}
|
||||||
|
message[strlen(message)-1] = '\0';
|
||||||
|
} else {
|
||||||
error_msg_and_die("No message\n");
|
error_msg_and_die("No message\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openlog(name, option, (pri | LOG_FACMASK));
|
openlog(name, option, (pri | LOG_FACMASK));
|
||||||
|
@ -149,10 +149,19 @@ extern int logger_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
message = buf;
|
message = buf;
|
||||||
} else {
|
} else {
|
||||||
if (argc >= 1)
|
if (argc >= 1) {
|
||||||
message = *argv;
|
int len = 1; /* for the '\0' */
|
||||||
else
|
for (; *argv != NULL; argv++) {
|
||||||
|
len += strlen(*argv);
|
||||||
|
len += 1; /* for the space between the args */
|
||||||
|
message = xrealloc(message, len);
|
||||||
|
strcat(message, *argv);
|
||||||
|
strcat(message, " ");
|
||||||
|
}
|
||||||
|
message[strlen(message)-1] = '\0';
|
||||||
|
} else {
|
||||||
error_msg_and_die("No message\n");
|
error_msg_and_die("No message\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openlog(name, option, (pri | LOG_FACMASK));
|
openlog(name, option, (pri | LOG_FACMASK));
|
||||||
|
Loading…
Reference in New Issue
Block a user