* Mark Whitley -- remix of xargs
* Jim Gleason <jimg@lineo.com> -- fixed tar so it no longer breaks
hard links.
+ * Matt Kraai -- logger now logs all arguments, not just the first
-Erik Andersen
}
message = buf;
} else {
- if (argc >= 1)
- message = *argv;
- else
+ if (argc >= 1) {
+ int len = 1; /* for the '\0' */
+ 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");
+ }
}
openlog(name, option, (pri | LOG_FACMASK));
}
message = buf;
} else {
- if (argc >= 1)
- message = *argv;
- else
+ if (argc >= 1) {
+ int len = 1; /* for the '\0' */
+ 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");
+ }
}
openlog(name, option, (pri | LOG_FACMASK));