Updates
authorErik Andersen <andersen@codepoet.org>
Tue, 18 Apr 2000 00:00:52 +0000 (00:00 -0000)
committerErik Andersen <andersen@codepoet.org>
Tue, 18 Apr 2000 00:00:52 +0000 (00:00 -0000)
 -Erik

19 files changed:
Makefile
applets/busybox.c
busybox.c
cmdedit.c
console-tools/loadfont.c
docs/Makefile
docs/busybox.pod
kill.c
lash.c
loadfont.c
more.c
procps/kill.c
sh.c
shell/cmdedit.c
shell/lash.c
sysklogd/syslogd.c
syslogd.c
util-linux/more.c
utility.c

index 61fe0ed8e8090530ed5465c6f5f236591e7d54de..30fd718f104e62e2df692ce46e8ff57ba5b2bda1 100644 (file)
--- 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);       \
index 15d53eb054dadc4abc429a272333f482bb58f790..73939c55f07641618fb807fa62182877876b465b 100644 (file)
@@ -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},
index 15d53eb054dadc4abc429a272333f482bb58f790..73939c55f07641618fb807fa62182877876b465b 100644 (file)
--- 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},
index 1434c36f6298f631080298a8a14215b8e532f23c..ebc6b969653b89b5110dfc563c15eeed0ec098e7 100644 (file)
--- 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;
 
index 64b72561053f813cfcd4b07ff51616f5dd0c4d12..0f6afecd44b56cd856c330a784b64a0f2423f687 100644 (file)
@@ -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));
index 10550f6dfcb6588e0c74691374392a3bd8dcaa4c..472d29e840fef956d22cd120b1e427f6ed53a3b0 100644 (file)
@@ -2,7 +2,7 @@
 # ------------------------
 # Copyright (C) 2000  Erik Andersen <andersee@debian.org>  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
-
index 06800c3010dfd3837cc01aa80c4fa4261ac97f2f..a946e28579f132975c7a950a45a78980c3a1753a 100644 (file)
@@ -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 <ezanardi@ull.es>
 
 =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 db4842457595cfff0772840f74fd9aa50e1903ca..765a3f68319a50010a4b85bd31ce4899422061df 100644 (file)
--- 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 bbf57752be1f24025d2ed6cd6ec7abc1a5718a17..97db8afafad9e7b2850734cb66d556642dcca4b0 100644 (file)
--- 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}
index 64b72561053f813cfcd4b07ff51616f5dd0c4d12..0f6afecd44b56cd856c330a784b64a0f2423f687 100644 (file)
@@ -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 d5711aa2fd2e2ec039dadd8514cb71756d0bb915..f8421490588ad1c4a43727c1d6ba5d9ef7de6231 100644 (file)
--- a/more.c
+++ b/more.c
 
 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 <termio.h>
-#      define termios termio
-#      define stty(fd,argp) ioctl(fd,TCSETAF,argp)
-#else
-#      include <termios.h>
-#      define stty(fd,argp) tcsetattr(fd,TCSANOW,argp)
-#endif
+#include <termio.h>
 
 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);
index db4842457595cfff0772840f74fd9aa50e1903ca..765a3f68319a50010a4b85bd31ce4899422061df 100644 (file)
@@ -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 bbf57752be1f24025d2ed6cd6ec7abc1a5718a17..97db8afafad9e7b2850734cb66d556642dcca4b0 100644 (file)
--- 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}
index 1434c36f6298f631080298a8a14215b8e532f23c..ebc6b969653b89b5110dfc563c15eeed0ec098e7 100644 (file)
@@ -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;
 
index bbf57752be1f24025d2ed6cd6ec7abc1a5718a17..97db8afafad9e7b2850734cb66d556642dcca4b0 100644 (file)
@@ -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}
index 8827265d51808ef2b718c77e405643526de8cf1b..228d0a17a1644f42f6b9bd9a66f2c5c97c319a5d 100644 (file)
@@ -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;
 
-                                       /* 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);
+                                       /* Get set to read in a line */
+                                       memset (line, 0, sizeof(line));
+                                       pri = (LOG_USER | LOG_NOTICE);
 
-                                               memset (line, 0, sizeof(line));
-                                               p = buf;
+                                       /* Keep reading stuff till there is nothing else to read */
+                                       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);
index 8827265d51808ef2b718c77e405643526de8cf1b..228d0a17a1644f42f6b9bd9a66f2c5c97c319a5d 100644 (file)
--- 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;
 
-                                       /* 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);
+                                       /* Get set to read in a line */
+                                       memset (line, 0, sizeof(line));
+                                       pri = (LOG_USER | LOG_NOTICE);
 
-                                               memset (line, 0, sizeof(line));
-                                               p = buf;
+                                       /* Keep reading stuff till there is nothing else to read */
+                                       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);
index d5711aa2fd2e2ec039dadd8514cb71756d0bb915..f8421490588ad1c4a43727c1d6ba5d9ef7de6231 100644 (file)
 
 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 <termio.h>
-#      define termios termio
-#      define stty(fd,argp) ioctl(fd,TCSETAF,argp)
-#else
-#      include <termios.h>
-#      define stty(fd,argp) tcsetattr(fd,TCSANOW,argp)
-#endif
+#include <termio.h>
 
 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);
index 42b8dc1e96f28222ec4d7de2ed77fac9ed17b58b..571d1f5e20d57dbae854354f27f7666fefe55dc2 100644 (file)
--- 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 */