* 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.
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
# 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/'`
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)
%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
%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
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
+#include <ctype.h>
const char kill_usage[] = "kill [-signal] process-id [process-id ...]\n";
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);
}
+
+
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
+#include <ctype.h>
const char kill_usage[] = "kill [-signal] process-id [process-id ...]\n";
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);
}
+
+