Patch from Matt Kraai to make logger log all arguments.
authorEric Andersen <andersen@codepoet.org>
Fri, 8 Dec 2000 19:35:51 +0000 (19:35 -0000)
committerEric Andersen <andersen@codepoet.org>
Fri, 8 Dec 2000 19:35:51 +0000 (19:35 -0000)
Changelog
logger.c
sysklogd/logger.c

index 90212119fabb2b4357dad2858148ce61947760eb..3095c95cb5b1846c84eb239221c2f8b695116e2e 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -45,6 +45,7 @@
        * 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
index 1ed6dc639289076bc0dadd3691a53fd515a65089..1c454e5af8594ed70bb9b892be482ad4cbd5f3d5 100644 (file)
--- a/logger.c
+++ b/logger.c
@@ -149,10 +149,19 @@ extern int logger_main(int argc, char **argv)
                }
                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));
index 1ed6dc639289076bc0dadd3691a53fd515a65089..1c454e5af8594ed70bb9b892be482ad4cbd5f3d5 100644 (file)
@@ -149,10 +149,19 @@ extern int logger_main(int argc, char **argv)
                }
                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));