OSDN Git Service

More stuff
authorEric Andersen <andersen@codepoet.org>
Sat, 23 Oct 1999 05:42:08 +0000 (05:42 -0000)
committerEric Andersen <andersen@codepoet.org>
Sat, 23 Oct 1999 05:42:08 +0000 (05:42 -0000)
Changelog
Makefile
busybox.spec
examples/busybox.spec
kill.c
procps/kill.c

index fe2c6b1..9714b46 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,10 @@
        * usage() now printf the BusyBox version.  This will help folks
            realize that they are not in Kansas anymore.
        * Fixed mkdir -m option so that it works.
+       * kill segfaulted w/o any arguments.  Now it doesn't do that.
+       * kill wasn't properly accepting signal names.  It does now.
+
+        -Erik Andersen
 
 0.31
        * I added a changelog for version 0.30. 
@@ -16,6 +20,7 @@
            it wasn't supported before GNU libc 2.1, and some folks use
            glibc 2.0.7 since it is much smaller than that latest and greatest.
 
+        -Erik Andersen
 
 0.30
        Major changes -- lots of stuff rewritten. Many thanks to Lineo for
index d1d0426..0d8d3fb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,11 @@ 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...
+DOSTATIC=false
 
 #This will choke on a non-debian system
 ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'`
@@ -37,6 +41,11 @@ else
     CFLAGS=-Wall -Os -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
     LDFLAGS= -s
     STRIP= strip --remove-section=.note --remove-section=.comment $(PROG)
+    #Only staticly link when _not_ debugging 
+    ifeq ($(DOSTATIC),true)
+       LDFLAGS+= --static
+    endif
+    
 endif
 
 ifndef $(prefix)
index 46bd7f4..281a381 100644 (file)
@@ -11,11 +11,11 @@ Source: busybox-0.29a1.tar.gz
 
 %Description
 BusyBox is a suite of "tiny" Unix utilities in a multi-call binary. It
-provides a pretty complete environment that fits on a floppy or in a
-ROM. Just add "ash" (Keith Almquists tiny Bourne shell clone) and "ae",
-and a kernel and you have a full system. This is used on the Debian
-install disk and in an internet router, and it makes a good environment
-for a "rescue" disk or any small or embedded system.
+provides a pretty complete POSIX environment in a very small package.
+Just add a kernel, "ash" (Keith Almquists tiny Bourne shell clone), and
+an editor such as "elvis-tiny" or "ae", and you have a full system. This
+is makes an excellent environment for a "rescue" disk or any small or
+embedded system.
 
 %Prep
 %setup -q -n busybox
index 46bd7f4..281a381 100644 (file)
@@ -11,11 +11,11 @@ Source: busybox-0.29a1.tar.gz
 
 %Description
 BusyBox is a suite of "tiny" Unix utilities in a multi-call binary. It
-provides a pretty complete environment that fits on a floppy or in a
-ROM. Just add "ash" (Keith Almquists tiny Bourne shell clone) and "ae",
-and a kernel and you have a full system. This is used on the Debian
-install disk and in an internet router, and it makes a good environment
-for a "rescue" disk or any small or embedded system.
+provides a pretty complete POSIX environment in a very small package.
+Just add a kernel, "ash" (Keith Almquists tiny Bourne shell clone), and
+an editor such as "elvis-tiny" or "ae", and you have a full system. This
+is makes an excellent environment for a "rescue" disk or any small or
+embedded system.
 
 %Prep
 %setup -q -n busybox
diff --git a/kill.c b/kill.c
index 2fabf56..8cc2b04 100644 (file)
--- a/kill.c
+++ b/kill.c
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <signal.h>
+#include <ctype.h>
 
 const char kill_usage[] = "kill [-signal] process-id [process-id ...]\n";
 
@@ -112,47 +113,47 @@ const struct signal_name signames[] = {
 
 extern int kill_main (int argc, char **argv)
 {
-    int had_error = 0;
     int sig = SIGTERM;
 
+    if ( argc < 2 )
+       usage (kill_usage);
 
-
-    if (argv[1][0] == '-') {
-       if (argv[1][1] >= '0' && argv[1][1] <= '9') {
-           sig = atoi (&argv[1][1]);
+    if ( **(argv+1) == '-' ) {
+       if (isdigit( *(*(++argv)+1) )) {
+           sig = atoi (*argv);
            if (sig < 0 || sig >= NSIG)
                goto end;
-       } else {
+       }
+       else {
            const struct signal_name *s = signames;
-           for (;;) {
-               if (strcmp (s->name, &argv[1][1]) == 0) {
+           while (s->name != 0) {
+               if (strcasecmp (s->name, *argv+1) == 0) {
                    sig = s->number;
                    break;
                }
                s++;
-               if (s->name == 0)
-                   goto end;
            }
+           if (s->name == 0)
+               goto end;
        }
-       argv++;
-       argc--;
-
     }
-    while (argc > 1) {
+
+    while (--argc > 1) {
        int pid;
-       if (argv[1][0] < '0' || argv[1][0] > '9')
-           goto end;
-       pid = atoi (argv[1]);
+       if (! isdigit( **(++argv))) {
+           fprintf(stderr, "bad PID: %s\n", *argv);
+           exit( FALSE);
+       }
+       pid = atoi (*argv);
        if (kill (pid, sig) != 0) {
-           had_error = 1;
-           perror (argv[1]);
+           perror (*argv);
+           exit ( FALSE);
        }
-       argv++;
-       argc--;
     }
-    if (had_error) {
+
 end:
-       usage (kill_usage);
-    }
+    fprintf(stderr, "bad signal name: %s\n", *argv);
     exit (TRUE);
 }
+
+
index 2fabf56..8cc2b04 100644 (file)
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <signal.h>
+#include <ctype.h>
 
 const char kill_usage[] = "kill [-signal] process-id [process-id ...]\n";
 
@@ -112,47 +113,47 @@ const struct signal_name signames[] = {
 
 extern int kill_main (int argc, char **argv)
 {
-    int had_error = 0;
     int sig = SIGTERM;
 
+    if ( argc < 2 )
+       usage (kill_usage);
 
-
-    if (argv[1][0] == '-') {
-       if (argv[1][1] >= '0' && argv[1][1] <= '9') {
-           sig = atoi (&argv[1][1]);
+    if ( **(argv+1) == '-' ) {
+       if (isdigit( *(*(++argv)+1) )) {
+           sig = atoi (*argv);
            if (sig < 0 || sig >= NSIG)
                goto end;
-       } else {
+       }
+       else {
            const struct signal_name *s = signames;
-           for (;;) {
-               if (strcmp (s->name, &argv[1][1]) == 0) {
+           while (s->name != 0) {
+               if (strcasecmp (s->name, *argv+1) == 0) {
                    sig = s->number;
                    break;
                }
                s++;
-               if (s->name == 0)
-                   goto end;
            }
+           if (s->name == 0)
+               goto end;
        }
-       argv++;
-       argc--;
-
     }
-    while (argc > 1) {
+
+    while (--argc > 1) {
        int pid;
-       if (argv[1][0] < '0' || argv[1][0] > '9')
-           goto end;
-       pid = atoi (argv[1]);
+       if (! isdigit( **(++argv))) {
+           fprintf(stderr, "bad PID: %s\n", *argv);
+           exit( FALSE);
+       }
+       pid = atoi (*argv);
        if (kill (pid, sig) != 0) {
-           had_error = 1;
-           perror (argv[1]);
+           perror (*argv);
+           exit ( FALSE);
        }
-       argv++;
-       argc--;
     }
-    if (had_error) {
+
 end:
-       usage (kill_usage);
-    }
+    fprintf(stderr, "bad signal name: %s\n", *argv);
     exit (TRUE);
 }
+
+