[BusyBox] make logger log all arguments

Matt Kraai kraai at alumni.carnegiemellon.edu
Thu Dec 7 16:32:27 UTC 2000


Howdy,

The attached patch makes logger log the string containing all of the
arguments, not just the first.  Is this a desirable feature or just
bloat?

Matt
-------------- next part --------------
Index: logger.c
===================================================================
RCS file: /var/cvs/busybox/logger.c,v
retrieving revision 1.19
diff -u -r1.19 logger.c
--- logger.c	2000/12/07 16:22:04	1.19
+++ logger.c	2000/12/07 16:30:15
@@ -149,10 +149,19 @@
 		}
 		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 {
 			fatalError("No message\n");
+		}
 	}
 
 	openlog(name, option, (pri | LOG_FACMASK));


More information about the busybox mailing list