diff options
author | Eric Andersen <andersen@codepoet.org> | 1999-10-23 05:42:08 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 1999-10-23 05:42:08 +0000 |
commit | a709317cea0180772616152d2f1af195a95703fd (patch) | |
tree | c9b53fa236820a0bdb28cb3f531b0710f9807546 | |
parent | a07f0b040808c7b1a3b81cbbe3a580f023450817 (diff) | |
download | busybox-w32-a709317cea0180772616152d2f1af195a95703fd.tar.gz busybox-w32-a709317cea0180772616152d2f1af195a95703fd.tar.bz2 busybox-w32-a709317cea0180772616152d2f1af195a95703fd.zip |
More stuff
-rw-r--r-- | Changelog | 5 | ||||
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | busybox.spec | 10 | ||||
-rw-r--r-- | examples/busybox.spec | 10 | ||||
-rw-r--r-- | kill.c | 49 | ||||
-rw-r--r-- | procps/kill.c | 49 |
6 files changed, 75 insertions, 59 deletions
@@ -2,6 +2,10 @@ | |||
2 | * usage() now printf the BusyBox version. This will help folks | 2 | * usage() now printf the BusyBox version. This will help folks |
3 | realize that they are not in Kansas anymore. | 3 | realize that they are not in Kansas anymore. |
4 | * Fixed mkdir -m option so that it works. | 4 | * Fixed mkdir -m option so that it works. |
5 | * kill segfaulted w/o any arguments. Now it doesn't do that. | ||
6 | * kill wasn't properly accepting signal names. It does now. | ||
7 | |||
8 | -Erik Andersen | ||
5 | 9 | ||
6 | 0.31 | 10 | 0.31 |
7 | * I added a changelog for version 0.30. | 11 | * I added a changelog for version 0.30. |
@@ -16,6 +20,7 @@ | |||
16 | it wasn't supported before GNU libc 2.1, and some folks use | 20 | it wasn't supported before GNU libc 2.1, and some folks use |
17 | glibc 2.0.7 since it is much smaller than that latest and greatest. | 21 | glibc 2.0.7 since it is much smaller than that latest and greatest. |
18 | 22 | ||
23 | -Erik Andersen | ||
19 | 24 | ||
20 | 0.30 | 25 | 0.30 |
21 | Major changes -- lots of stuff rewritten. Many thanks to Lineo for | 26 | Major changes -- lots of stuff rewritten. Many thanks to Lineo for |
@@ -22,7 +22,11 @@ BUILDTIME=$(shell date "+%Y%m%d-%H%M") | |||
22 | 22 | ||
23 | # Comment out the following to make a debuggable build | 23 | # Comment out the following to make a debuggable build |
24 | # Leave this off for production use. | 24 | # Leave this off for production use. |
25 | #DODEBUG=true | 25 | DODEBUG=false |
26 | # If you want a static binary, turn this on. I can't think | ||
27 | # of many situations where anybody would ever want it static, | ||
28 | # but... | ||
29 | DOSTATIC=false | ||
26 | 30 | ||
27 | #This will choke on a non-debian system | 31 | #This will choke on a non-debian system |
28 | ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'` | 32 | ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'` |
@@ -37,6 +41,11 @@ else | |||
37 | CFLAGS=-Wall -Os -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE | 41 | CFLAGS=-Wall -Os -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE |
38 | LDFLAGS= -s | 42 | LDFLAGS= -s |
39 | STRIP= strip --remove-section=.note --remove-section=.comment $(PROG) | 43 | STRIP= strip --remove-section=.note --remove-section=.comment $(PROG) |
44 | #Only staticly link when _not_ debugging | ||
45 | ifeq ($(DOSTATIC),true) | ||
46 | LDFLAGS+= --static | ||
47 | endif | ||
48 | |||
40 | endif | 49 | endif |
41 | 50 | ||
42 | ifndef $(prefix) | 51 | ifndef $(prefix) |
diff --git a/busybox.spec b/busybox.spec index 46bd7f484..281a381a7 100644 --- a/busybox.spec +++ b/busybox.spec | |||
@@ -11,11 +11,11 @@ Source: busybox-0.29a1.tar.gz | |||
11 | 11 | ||
12 | %Description | 12 | %Description |
13 | BusyBox is a suite of "tiny" Unix utilities in a multi-call binary. It | 13 | BusyBox is a suite of "tiny" Unix utilities in a multi-call binary. It |
14 | provides a pretty complete environment that fits on a floppy or in a | 14 | provides a pretty complete POSIX environment in a very small package. |
15 | ROM. Just add "ash" (Keith Almquists tiny Bourne shell clone) and "ae", | 15 | Just add a kernel, "ash" (Keith Almquists tiny Bourne shell clone), and |
16 | and a kernel and you have a full system. This is used on the Debian | 16 | an editor such as "elvis-tiny" or "ae", and you have a full system. This |
17 | install disk and in an internet router, and it makes a good environment | 17 | is makes an excellent environment for a "rescue" disk or any small or |
18 | for a "rescue" disk or any small or embedded system. | 18 | embedded system. |
19 | 19 | ||
20 | %Prep | 20 | %Prep |
21 | %setup -q -n busybox | 21 | %setup -q -n busybox |
diff --git a/examples/busybox.spec b/examples/busybox.spec index 46bd7f484..281a381a7 100644 --- a/examples/busybox.spec +++ b/examples/busybox.spec | |||
@@ -11,11 +11,11 @@ Source: busybox-0.29a1.tar.gz | |||
11 | 11 | ||
12 | %Description | 12 | %Description |
13 | BusyBox is a suite of "tiny" Unix utilities in a multi-call binary. It | 13 | BusyBox is a suite of "tiny" Unix utilities in a multi-call binary. It |
14 | provides a pretty complete environment that fits on a floppy or in a | 14 | provides a pretty complete POSIX environment in a very small package. |
15 | ROM. Just add "ash" (Keith Almquists tiny Bourne shell clone) and "ae", | 15 | Just add a kernel, "ash" (Keith Almquists tiny Bourne shell clone), and |
16 | and a kernel and you have a full system. This is used on the Debian | 16 | an editor such as "elvis-tiny" or "ae", and you have a full system. This |
17 | install disk and in an internet router, and it makes a good environment | 17 | is makes an excellent environment for a "rescue" disk or any small or |
18 | for a "rescue" disk or any small or embedded system. | 18 | embedded system. |
19 | 19 | ||
20 | %Prep | 20 | %Prep |
21 | %setup -q -n busybox | 21 | %setup -q -n busybox |
@@ -25,6 +25,7 @@ | |||
25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #include <signal.h> | 27 | #include <signal.h> |
28 | #include <ctype.h> | ||
28 | 29 | ||
29 | const char kill_usage[] = "kill [-signal] process-id [process-id ...]\n"; | 30 | const char kill_usage[] = "kill [-signal] process-id [process-id ...]\n"; |
30 | 31 | ||
@@ -112,47 +113,47 @@ const struct signal_name signames[] = { | |||
112 | 113 | ||
113 | extern int kill_main (int argc, char **argv) | 114 | extern int kill_main (int argc, char **argv) |
114 | { | 115 | { |
115 | int had_error = 0; | ||
116 | int sig = SIGTERM; | 116 | int sig = SIGTERM; |
117 | 117 | ||
118 | if ( argc < 2 ) | ||
119 | usage (kill_usage); | ||
118 | 120 | ||
119 | 121 | if ( **(argv+1) == '-' ) { | |
120 | if (argv[1][0] == '-') { | 122 | if (isdigit( *(*(++argv)+1) )) { |
121 | if (argv[1][1] >= '0' && argv[1][1] <= '9') { | 123 | sig = atoi (*argv); |
122 | sig = atoi (&argv[1][1]); | ||
123 | if (sig < 0 || sig >= NSIG) | 124 | if (sig < 0 || sig >= NSIG) |
124 | goto end; | 125 | goto end; |
125 | } else { | 126 | } |
127 | else { | ||
126 | const struct signal_name *s = signames; | 128 | const struct signal_name *s = signames; |
127 | for (;;) { | 129 | while (s->name != 0) { |
128 | if (strcmp (s->name, &argv[1][1]) == 0) { | 130 | if (strcasecmp (s->name, *argv+1) == 0) { |
129 | sig = s->number; | 131 | sig = s->number; |
130 | break; | 132 | break; |
131 | } | 133 | } |
132 | s++; | 134 | s++; |
133 | if (s->name == 0) | ||
134 | goto end; | ||
135 | } | 135 | } |
136 | if (s->name == 0) | ||
137 | goto end; | ||
136 | } | 138 | } |
137 | argv++; | ||
138 | argc--; | ||
139 | |||
140 | } | 139 | } |
141 | while (argc > 1) { | 140 | |
141 | while (--argc > 1) { | ||
142 | int pid; | 142 | int pid; |
143 | if (argv[1][0] < '0' || argv[1][0] > '9') | 143 | if (! isdigit( **(++argv))) { |
144 | goto end; | 144 | fprintf(stderr, "bad PID: %s\n", *argv); |
145 | pid = atoi (argv[1]); | 145 | exit( FALSE); |
146 | } | ||
147 | pid = atoi (*argv); | ||
146 | if (kill (pid, sig) != 0) { | 148 | if (kill (pid, sig) != 0) { |
147 | had_error = 1; | 149 | perror (*argv); |
148 | perror (argv[1]); | 150 | exit ( FALSE); |
149 | } | 151 | } |
150 | argv++; | ||
151 | argc--; | ||
152 | } | 152 | } |
153 | if (had_error) { | 153 | |
154 | end: | 154 | end: |
155 | usage (kill_usage); | 155 | fprintf(stderr, "bad signal name: %s\n", *argv); |
156 | } | ||
157 | exit (TRUE); | 156 | exit (TRUE); |
158 | } | 157 | } |
158 | |||
159 | |||
diff --git a/procps/kill.c b/procps/kill.c index 2fabf56d2..8cc2b044e 100644 --- a/procps/kill.c +++ b/procps/kill.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #include <signal.h> | 27 | #include <signal.h> |
28 | #include <ctype.h> | ||
28 | 29 | ||
29 | const char kill_usage[] = "kill [-signal] process-id [process-id ...]\n"; | 30 | const char kill_usage[] = "kill [-signal] process-id [process-id ...]\n"; |
30 | 31 | ||
@@ -112,47 +113,47 @@ const struct signal_name signames[] = { | |||
112 | 113 | ||
113 | extern int kill_main (int argc, char **argv) | 114 | extern int kill_main (int argc, char **argv) |
114 | { | 115 | { |
115 | int had_error = 0; | ||
116 | int sig = SIGTERM; | 116 | int sig = SIGTERM; |
117 | 117 | ||
118 | if ( argc < 2 ) | ||
119 | usage (kill_usage); | ||
118 | 120 | ||
119 | 121 | if ( **(argv+1) == '-' ) { | |
120 | if (argv[1][0] == '-') { | 122 | if (isdigit( *(*(++argv)+1) )) { |
121 | if (argv[1][1] >= '0' && argv[1][1] <= '9') { | 123 | sig = atoi (*argv); |
122 | sig = atoi (&argv[1][1]); | ||
123 | if (sig < 0 || sig >= NSIG) | 124 | if (sig < 0 || sig >= NSIG) |
124 | goto end; | 125 | goto end; |
125 | } else { | 126 | } |
127 | else { | ||
126 | const struct signal_name *s = signames; | 128 | const struct signal_name *s = signames; |
127 | for (;;) { | 129 | while (s->name != 0) { |
128 | if (strcmp (s->name, &argv[1][1]) == 0) { | 130 | if (strcasecmp (s->name, *argv+1) == 0) { |
129 | sig = s->number; | 131 | sig = s->number; |
130 | break; | 132 | break; |
131 | } | 133 | } |
132 | s++; | 134 | s++; |
133 | if (s->name == 0) | ||
134 | goto end; | ||
135 | } | 135 | } |
136 | if (s->name == 0) | ||
137 | goto end; | ||
136 | } | 138 | } |
137 | argv++; | ||
138 | argc--; | ||
139 | |||
140 | } | 139 | } |
141 | while (argc > 1) { | 140 | |
141 | while (--argc > 1) { | ||
142 | int pid; | 142 | int pid; |
143 | if (argv[1][0] < '0' || argv[1][0] > '9') | 143 | if (! isdigit( **(++argv))) { |
144 | goto end; | 144 | fprintf(stderr, "bad PID: %s\n", *argv); |
145 | pid = atoi (argv[1]); | 145 | exit( FALSE); |
146 | } | ||
147 | pid = atoi (*argv); | ||
146 | if (kill (pid, sig) != 0) { | 148 | if (kill (pid, sig) != 0) { |
147 | had_error = 1; | 149 | perror (*argv); |
148 | perror (argv[1]); | 150 | exit ( FALSE); |
149 | } | 151 | } |
150 | argv++; | ||
151 | argc--; | ||
152 | } | 152 | } |
153 | if (had_error) { | 153 | |
154 | end: | 154 | end: |
155 | usage (kill_usage); | 155 | fprintf(stderr, "bad signal name: %s\n", *argv); |
156 | } | ||
157 | exit (TRUE); | 156 | exit (TRUE); |
158 | } | 157 | } |
158 | |||
159 | |||