diff --git a/Makefile b/Makefile index 61fe0ed8e..30fd718f1 100644 --- a/Makefile +++ b/Makefile @@ -101,12 +101,12 @@ busybox: $(OBJECTS) $(CC) $(LDFLAGS) -o $@ $^ $(LIBRARIES) $(STRIP) -docs: docs/busybox.pod - $(MAKE) -C docs clean all - busybox.links: busybox.def.h - ./busybox.mkll | sort >$@ +docs: + $(MAKE) -C docs + regexp.o nfsmount.o: %.o: %.h $(OBJECTS): %.o: busybox.def.h internal.h %.c @@ -126,7 +126,7 @@ install: busybox busybox.links ./install.sh $(PREFIX) dist release: distclean - $(MAKE) -C docs clean all + $(MAKE) -C docs cd ..; \ rm -rf busybox-$(VERSION); \ cp -a busybox busybox-$(VERSION); \ diff --git a/applets/busybox.c b/applets/busybox.c index 15d53eb05..73939c55f 100644 --- a/applets/busybox.c +++ b/applets/busybox.c @@ -303,7 +303,7 @@ static const struct Applet applets[] = { {"uname", uname_main, _BB_DIR_BIN}, #endif #ifdef BB_UNIQ - {"uniq", uniq_main, _BB_DIR_BIN}, + {"uniq", uniq_main, _BB_DIR_USR_BIN}, #endif #ifdef BB_UPDATE {"update", update_main, _BB_DIR_SBIN}, diff --git a/busybox.c b/busybox.c index 15d53eb05..73939c55f 100644 --- a/busybox.c +++ b/busybox.c @@ -303,7 +303,7 @@ static const struct Applet applets[] = { {"uname", uname_main, _BB_DIR_BIN}, #endif #ifdef BB_UNIQ - {"uniq", uniq_main, _BB_DIR_BIN}, + {"uniq", uniq_main, _BB_DIR_USR_BIN}, #endif #ifdef BB_UPDATE {"update", update_main, _BB_DIR_SBIN}, diff --git a/cmdedit.c b/cmdedit.c index 1434c36f6..ebc6b9696 100644 --- a/cmdedit.c +++ b/cmdedit.c @@ -83,6 +83,7 @@ cmdedit_setwidth(int w) void cmdedit_reset_term(void) { if (reset_term) + /* sparc and other have broken termios support: use old termio handling. */ ioctl(fileno(stdin), TCSETA, (void *) &old_term); } @@ -378,6 +379,7 @@ extern void cmdedit_read_input(char* prompt, char command[BUFSIZ]) memset(command, 0, sizeof(command)); if (!reset_term) { + /* sparc and other have broken termios support: use old termio handling. */ ioctl(inputFd, TCGETA, (void *) &old_term); memcpy(&new_term, &old_term, sizeof(struct termio)); @@ -589,6 +591,7 @@ extern void cmdedit_read_input(char* prompt, char command[BUFSIZ]) } nr = len + 1; + /* sparc and other have broken termios support: use old termio handling. */ ioctl(inputFd, TCSETA, (void *) &old_term); reset_term = 0; diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c index 64b725610..0f6afecd4 100644 --- a/console-tools/loadfont.c +++ b/console-tools/loadfont.c @@ -30,8 +30,8 @@ #define PSF_MAXMODE 0x03 #define PSF_SEPARATOR 0xFFFF -static const char loadfont_usage[] = "loadfont\n" - "\n" "\tLoad a console font from standard input.\n" "\n"; +static const char loadfont_usage[] = "loadfont\n\n" + "Loads a console font from standard input.\n"; struct psf_header { unsigned char magic1, magic2; /* Magic number */ @@ -47,6 +47,10 @@ extern int loadfont_main(int argc, char **argv) { int fd; + if (argc>=2 && *argv[1]=='-') { + usage(loadfont_usage); + } + fd = open("/dev/tty0", O_RDWR); if (fd < 0) { fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); diff --git a/docs/Makefile b/docs/Makefile index 10550f6df..472d29e84 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -2,7 +2,7 @@ # ------------------------ # Copyright (C) 2000 Erik Andersen GPL -all:: clean doc +all: clean doc doc: @echo @@ -14,10 +14,8 @@ doc: pod2text busybox.pod > ../BusyBox.txt @rm -f pod2html* -clean:: +clean: @rm -f ../BusyBox.html ../BusyBox.1 ../BusyBox.txt pod2html* distclean: clean -.PHONY: all clean distclean doc - diff --git a/docs/busybox.pod b/docs/busybox.pod index 06800c301..a946e2857 100644 --- a/docs/busybox.pod +++ b/docs/busybox.pod @@ -68,7 +68,7 @@ Example: ------------------------------- -=item cat +=item cat Usage: cat [file ...] @@ -807,19 +807,22 @@ Example: =item loadacm -FIXME +FIXME -- this command does not yet have proper documentation ------------------------------- =item loadfont -FIXME +Usage: loadfont + +Loads a console font from standard input. + ------------------------------- =item loadkmap -FIXME +FIXME -- this command does not yet have proper documentation ------------------------------- @@ -1294,7 +1297,7 @@ Usage: sh lash -- the BusyBox LAme SHell (command interpreter) -FIXME +FIXME -- this command does not yet have proper documentation ------------------------------- @@ -1778,4 +1781,4 @@ Enrique Zanardi =cut -# $Id: busybox.pod,v 1.15 2000/04/17 17:46:46 beppu Exp $ +# $Id: busybox.pod,v 1.16 2000/04/18 00:00:52 erik Exp $ diff --git a/kill.c b/kill.c index db4842457..765a3f683 100644 --- a/kill.c +++ b/kill.c @@ -230,6 +230,8 @@ extern int kill_main(int argc, char **argv) for(; pidList && pidList!=0; pidList++) { if (kill(*pidList, sig) != 0) fatalError( "Could not kill pid '%d': %s\n", *pidList, strerror(errno)); + else + printf("killed %d\n", *pidList); } /* Note that we don't bother to free the memory * allocated in findPidByName(). It will be freed diff --git a/lash.c b/lash.c index bbf57752b..97db8afaf 100644 --- a/lash.c +++ b/lash.c @@ -120,7 +120,6 @@ static struct builtInCommand bltins[] = { {"pwd", "Print current directory", "pwd", shell_pwd}, {"export", "Set environment variable", "export [VAR=value]", shell_export}, {"unset", "Unset environment variable", "unset VAR", shell_unset}, - {".", "Source-in and run commands in a file", ". filename", shell_source}, {"help", "List shell built-in commands", "help", shell_help}, {NULL, NULL, NULL, NULL} diff --git a/loadfont.c b/loadfont.c index 64b725610..0f6afecd4 100644 --- a/loadfont.c +++ b/loadfont.c @@ -30,8 +30,8 @@ #define PSF_MAXMODE 0x03 #define PSF_SEPARATOR 0xFFFF -static const char loadfont_usage[] = "loadfont\n" - "\n" "\tLoad a console font from standard input.\n" "\n"; +static const char loadfont_usage[] = "loadfont\n\n" + "Loads a console font from standard input.\n"; struct psf_header { unsigned char magic1, magic2; /* Magic number */ @@ -47,6 +47,10 @@ extern int loadfont_main(int argc, char **argv) { int fd; + if (argc>=2 && *argv[1]=='-') { + usage(loadfont_usage); + } + fd = open("/dev/tty0", O_RDWR); if (fd < 0) { fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); diff --git a/more.c b/more.c index d5711aa2f..f84214905 100644 --- a/more.c +++ b/more.c @@ -33,25 +33,17 @@ static const char more_usage[] = "more [file ...]\n"; -/* ED: sparc termios is broken: revert back to old termio handling. */ #ifdef BB_FEATURE_USE_TERMIOS -#if #cpu(sparc) -# define USE_OLD_TERMIO -# include -# define termios termio -# define stty(fd,argp) ioctl(fd,TCSETAF,argp) -#else -# include -# define stty(fd,argp) tcsetattr(fd,TCSANOW,argp) -#endif +#include FILE *cin; -struct termios initial_settings, new_settings; +/* sparc and other have broken termios support: use old termio handling. */ +struct termio initial_settings, new_settings; void gotsig(int sig) { - stty(fileno(cin), &initial_settings); + ioctl(fileno(cin), TCSETAF, &initial_settings); fprintf(stdout, "\n"); exit(TRUE); } @@ -106,15 +98,11 @@ extern int more_main(int argc, char **argv) cin = fopen("/dev/tty", "r"); if (!cin) cin = fopen("/dev/console", "r"); -#ifdef USE_OLD_TERMIO ioctl(fileno(cin), TCGETA, &initial_settings); -#else - tcgetattr(fileno(cin), &initial_settings); -#endif new_settings = initial_settings; new_settings.c_lflag &= ~ICANON; new_settings.c_lflag &= ~ECHO; - stty(fileno(cin), &new_settings); + ioctl(fileno(cin), TCSETAF, &new_settings); #ifdef BB_FEATURE_AUTOWIDTH ioctl(fileno(stdout), TIOCGWINSZ, &win); diff --git a/procps/kill.c b/procps/kill.c index db4842457..765a3f683 100644 --- a/procps/kill.c +++ b/procps/kill.c @@ -230,6 +230,8 @@ extern int kill_main(int argc, char **argv) for(; pidList && pidList!=0; pidList++) { if (kill(*pidList, sig) != 0) fatalError( "Could not kill pid '%d': %s\n", *pidList, strerror(errno)); + else + printf("killed %d\n", *pidList); } /* Note that we don't bother to free the memory * allocated in findPidByName(). It will be freed diff --git a/sh.c b/sh.c index bbf57752b..97db8afaf 100644 --- a/sh.c +++ b/sh.c @@ -120,7 +120,6 @@ static struct builtInCommand bltins[] = { {"pwd", "Print current directory", "pwd", shell_pwd}, {"export", "Set environment variable", "export [VAR=value]", shell_export}, {"unset", "Unset environment variable", "unset VAR", shell_unset}, - {".", "Source-in and run commands in a file", ". filename", shell_source}, {"help", "List shell built-in commands", "help", shell_help}, {NULL, NULL, NULL, NULL} diff --git a/shell/cmdedit.c b/shell/cmdedit.c index 1434c36f6..ebc6b9696 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c @@ -83,6 +83,7 @@ cmdedit_setwidth(int w) void cmdedit_reset_term(void) { if (reset_term) + /* sparc and other have broken termios support: use old termio handling. */ ioctl(fileno(stdin), TCSETA, (void *) &old_term); } @@ -378,6 +379,7 @@ extern void cmdedit_read_input(char* prompt, char command[BUFSIZ]) memset(command, 0, sizeof(command)); if (!reset_term) { + /* sparc and other have broken termios support: use old termio handling. */ ioctl(inputFd, TCGETA, (void *) &old_term); memcpy(&new_term, &old_term, sizeof(struct termio)); @@ -589,6 +591,7 @@ extern void cmdedit_read_input(char* prompt, char command[BUFSIZ]) } nr = len + 1; + /* sparc and other have broken termios support: use old termio handling. */ ioctl(inputFd, TCSETA, (void *) &old_term); reset_term = 0; diff --git a/shell/lash.c b/shell/lash.c index bbf57752b..97db8afaf 100644 --- a/shell/lash.c +++ b/shell/lash.c @@ -120,7 +120,6 @@ static struct builtInCommand bltins[] = { {"pwd", "Print current directory", "pwd", shell_pwd}, {"export", "Set environment variable", "export [VAR=value]", shell_export}, {"unset", "Unset environment variable", "unset VAR", shell_unset}, - {".", "Source-in and run commands in a file", ". filename", shell_source}, {"help", "List shell built-in commands", "help", shell_help}, {NULL, NULL, NULL, NULL} diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 8827265d5..228d0a17a 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c @@ -226,18 +226,20 @@ static void doSyslogd (void) } else { #define BUFSIZE 1024 + 1 - char buf[BUFSIZE]; + char buf; char *q, *p; int n_read; char line[BUFSIZE]; unsigned char c; + int pri; + + /* Get set to read in a line */ + memset (line, 0, sizeof(line)); + pri = (LOG_USER | LOG_NOTICE); /* Keep reading stuff till there is nothing else to read */ - while( (n_read = read (fd, buf, BUFSIZE)) > 0 && errno != EOF) { - int pri = (LOG_USER | LOG_NOTICE); - - memset (line, 0, sizeof(line)); - p = buf; + while( (n_read = read (fd, &buf, 1)) > 0) { + p = &buf; q = line; while (p && (c = *p) && q < &line[sizeof(line) - 1]) { if (c == '<') { @@ -262,6 +264,7 @@ static void doSyslogd (void) /* Now log it */ logMessage(pri, line); + break; } close (fd); FD_CLR (fd, &readfds); diff --git a/syslogd.c b/syslogd.c index 8827265d5..228d0a17a 100644 --- a/syslogd.c +++ b/syslogd.c @@ -226,18 +226,20 @@ static void doSyslogd (void) } else { #define BUFSIZE 1024 + 1 - char buf[BUFSIZE]; + char buf; char *q, *p; int n_read; char line[BUFSIZE]; unsigned char c; + int pri; + + /* Get set to read in a line */ + memset (line, 0, sizeof(line)); + pri = (LOG_USER | LOG_NOTICE); /* Keep reading stuff till there is nothing else to read */ - while( (n_read = read (fd, buf, BUFSIZE)) > 0 && errno != EOF) { - int pri = (LOG_USER | LOG_NOTICE); - - memset (line, 0, sizeof(line)); - p = buf; + while( (n_read = read (fd, &buf, 1)) > 0) { + p = &buf; q = line; while (p && (c = *p) && q < &line[sizeof(line) - 1]) { if (c == '<') { @@ -262,6 +264,7 @@ static void doSyslogd (void) /* Now log it */ logMessage(pri, line); + break; } close (fd); FD_CLR (fd, &readfds); diff --git a/util-linux/more.c b/util-linux/more.c index d5711aa2f..f84214905 100644 --- a/util-linux/more.c +++ b/util-linux/more.c @@ -33,25 +33,17 @@ static const char more_usage[] = "more [file ...]\n"; -/* ED: sparc termios is broken: revert back to old termio handling. */ #ifdef BB_FEATURE_USE_TERMIOS -#if #cpu(sparc) -# define USE_OLD_TERMIO -# include -# define termios termio -# define stty(fd,argp) ioctl(fd,TCSETAF,argp) -#else -# include -# define stty(fd,argp) tcsetattr(fd,TCSANOW,argp) -#endif +#include FILE *cin; -struct termios initial_settings, new_settings; +/* sparc and other have broken termios support: use old termio handling. */ +struct termio initial_settings, new_settings; void gotsig(int sig) { - stty(fileno(cin), &initial_settings); + ioctl(fileno(cin), TCSETAF, &initial_settings); fprintf(stdout, "\n"); exit(TRUE); } @@ -106,15 +98,11 @@ extern int more_main(int argc, char **argv) cin = fopen("/dev/tty", "r"); if (!cin) cin = fopen("/dev/console", "r"); -#ifdef USE_OLD_TERMIO ioctl(fileno(cin), TCGETA, &initial_settings); -#else - tcgetattr(fileno(cin), &initial_settings); -#endif new_settings = initial_settings; new_settings.c_lflag &= ~ICANON; new_settings.c_lflag &= ~ECHO; - stty(fileno(cin), &new_settings); + ioctl(fileno(cin), TCSETAF, &new_settings); #ifdef BB_FEATURE_AUTOWIDTH ioctl(fileno(stdout), TIOCGWINSZ, &win); diff --git a/utility.c b/utility.c index 42b8dc1e9..571d1f5e2 100644 --- a/utility.c +++ b/utility.c @@ -1364,7 +1364,8 @@ extern pid_t* findPidByName( char* pidName) pidList[i++]=strtol(next->d_name, NULL, 0); } } - pidList[i]=0; + if (pidList!=NULL) + pidList[i]=0; return pidList; } #endif /* BB_FEATURE_USE_DEVPS_PATCH */