From befda6e4ed06697f20fc114718ef0c92c5c6e56a Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 25 Nov 1999 08:06:22 +0000 Subject: [PATCH] Stuf --- Changelog | 2 ++ Makefile | 4 ++-- TODO | 5 +++-- busybox.def.h | 4 ++-- busybox.spec | 2 +- examples/busybox.spec | 2 +- logger.c | 26 ++++++++++++++++++-------- sysklogd/logger.c | 26 ++++++++++++++++++-------- 8 files changed, 47 insertions(+), 24 deletions(-) diff --git a/Changelog b/Changelog index cef86ec..60bb73c 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,6 @@ 0.37 + * Wrote a micro syslogd, and a logger util (to log things to the syslog + from the command line or scripts) With both compiled in, costs 4k. * Fixed 'make install' so symlinks are installed in their proper locations. * Changed the build system slightly so that features can now be enabled or disabled from the busybox.defs.h header file, without trying to diff --git a/Makefile b/Makefile index 1413ea0..a754c20 100644 --- a/Makefile +++ b/Makefile @@ -17,12 +17,12 @@ PROG=busybox -VERSION=0.36 +VERSION=0.37 BUILDTIME=$(shell date "+%Y%m%d-%H%M") # Comment out the following to make a debuggable build # Leave this off for production use. -DODEBUG=true +DODEBUG=false # If you want a static binary, turn this on. I can't think # of many situations where anybody would ever want it static, # but... diff --git a/TODO b/TODO index 20cd41e..44525cf 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,10 @@ TODO list for busybox in no particular order -* Add in a mini syslogd +If you have any good ideas, please let me know. + * Allow tar to create archives with sockets, devices, and other special files * Add in a mini modprobe, insmod, rmmod * poweroff * Change init so halt, reboot (and poweroff) work with an initrd when init is not PID 1 -* +* diff --git a/busybox.def.h b/busybox.def.h index bf8f545..0e7f349 100644 --- a/busybox.def.h +++ b/busybox.def.h @@ -28,7 +28,7 @@ #define BB_LN #define BB_LOADFONT #define BB_LOADKMAP -#define BB_LOGGER +//#define BB_LOGGER #define BB_LS //#define BB_MAKEDEVS //#define BB_MATH @@ -54,7 +54,7 @@ #define BB_SLEEP #define BB_SWAPONOFF #define BB_SYNC -#define BB_SYSLOGD +//#define BB_SYSLOGD #define BB_TAR #define BB_TOUCH #define BB_TRUE_FALSE diff --git a/busybox.spec b/busybox.spec index 4a3ef65..92000e7 100644 --- a/busybox.spec +++ b/busybox.spec @@ -1,5 +1,5 @@ Name: busybox -Version: 0.36 +Version: 0.37 Release: 1 Group: System/Utilities Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary. diff --git a/examples/busybox.spec b/examples/busybox.spec index 4a3ef65..92000e7 100644 --- a/examples/busybox.spec +++ b/examples/busybox.spec @@ -1,5 +1,5 @@ Name: busybox -Version: 0.36 +Version: 0.37 Release: 1 Group: System/Utilities Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary. diff --git a/logger.c b/logger.c index 0683838..dfbc557 100644 --- a/logger.c +++ b/logger.c @@ -118,13 +118,17 @@ extern int logger_main(int argc, char **argv) { struct sockaddr_un sunx; int fd, pri = LOG_USER|LOG_NOTICE; + int fromStdinFlag=FALSE; int toStdErrFlag=FALSE; - char *message, buf[1024]; + char *message, buf[1024], buf1[1024]; time_t now; size_t addrLength; /* Parse any options */ while (--argc > 0 && **(++argv) == '-') { + if (*((*argv)+1) == '\0') { + fromStdinFlag=TRUE; + } while (*(++(*argv))) { switch (**argv) { case 's': @@ -146,15 +150,21 @@ extern int logger_main(int argc, char **argv) } } - if (argc>=1) - if (**argv=='-') { - /* read from stdin */ + if (fromStdinFlag==TRUE) { + /* read from stdin */ + int i=0; + char c; + while ((c = getc(stdin)) != EOF && i=1) { + message=*argv; } else { - message=*argv; + fprintf(stderr, "No message\n"); + exit( FALSE); } - else { - fprintf(stderr, "No message\n"); - exit( FALSE); } memset(&sunx, 0, sizeof(sunx)); diff --git a/sysklogd/logger.c b/sysklogd/logger.c index 0683838..dfbc557 100644 --- a/sysklogd/logger.c +++ b/sysklogd/logger.c @@ -118,13 +118,17 @@ extern int logger_main(int argc, char **argv) { struct sockaddr_un sunx; int fd, pri = LOG_USER|LOG_NOTICE; + int fromStdinFlag=FALSE; int toStdErrFlag=FALSE; - char *message, buf[1024]; + char *message, buf[1024], buf1[1024]; time_t now; size_t addrLength; /* Parse any options */ while (--argc > 0 && **(++argv) == '-') { + if (*((*argv)+1) == '\0') { + fromStdinFlag=TRUE; + } while (*(++(*argv))) { switch (**argv) { case 's': @@ -146,15 +150,21 @@ extern int logger_main(int argc, char **argv) } } - if (argc>=1) - if (**argv=='-') { - /* read from stdin */ + if (fromStdinFlag==TRUE) { + /* read from stdin */ + int i=0; + char c; + while ((c = getc(stdin)) != EOF && i=1) { + message=*argv; } else { - message=*argv; + fprintf(stderr, "No message\n"); + exit( FALSE); } - else { - fprintf(stderr, "No message\n"); - exit( FALSE); } memset(&sunx, 0, sizeof(sunx)); -- 2.7.4