summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-04-18 00:00:52 +0000
committerErik Andersen <andersen@codepoet.org>2000-04-18 00:00:52 +0000
commita6c752201e9031b51a6d89349f1cec1f690f56ef (patch)
tree808a54e0dc112d8b32326ccdb411e4300dc65d76
parent91e581fa0438b39ceb0ffb4ddcb90ee4d260ae81 (diff)
downloadbusybox-w32-a6c752201e9031b51a6d89349f1cec1f690f56ef.tar.gz
busybox-w32-a6c752201e9031b51a6d89349f1cec1f690f56ef.tar.bz2
busybox-w32-a6c752201e9031b51a6d89349f1cec1f690f56ef.zip
Updates
-Erik
-rw-r--r--Makefile8
-rw-r--r--applets/busybox.c2
-rw-r--r--busybox.c2
-rw-r--r--cmdedit.c3
-rw-r--r--console-tools/loadfont.c8
-rw-r--r--docs/Makefile6
-rw-r--r--docs/busybox.pod15
-rw-r--r--kill.c2
-rw-r--r--lash.c1
-rw-r--r--loadfont.c8
-rw-r--r--more.c22
-rw-r--r--procps/kill.c2
-rw-r--r--sh.c1
-rw-r--r--shell/cmdedit.c3
-rw-r--r--shell/lash.c1
-rw-r--r--sysklogd/syslogd.c15
-rw-r--r--syslogd.c15
-rw-r--r--util-linux/more.c22
-rw-r--r--utility.c3
19 files changed, 69 insertions, 70 deletions
diff --git a/Makefile b/Makefile
index 61fe0ed8e..30fd718f1 100644
--- a/Makefile
+++ b/Makefile
@@ -101,12 +101,12 @@ busybox: $(OBJECTS)
101 $(CC) $(LDFLAGS) -o $@ $^ $(LIBRARIES) 101 $(CC) $(LDFLAGS) -o $@ $^ $(LIBRARIES)
102 $(STRIP) 102 $(STRIP)
103 103
104docs: docs/busybox.pod
105 $(MAKE) -C docs clean all
106
107busybox.links: busybox.def.h 104busybox.links: busybox.def.h
108 - ./busybox.mkll | sort >$@ 105 - ./busybox.mkll | sort >$@
109 106
107docs:
108 $(MAKE) -C docs
109
110regexp.o nfsmount.o: %.o: %.h 110regexp.o nfsmount.o: %.o: %.h
111$(OBJECTS): %.o: busybox.def.h internal.h %.c 111$(OBJECTS): %.o: busybox.def.h internal.h %.c
112 112
@@ -126,7 +126,7 @@ install: busybox busybox.links
126 ./install.sh $(PREFIX) 126 ./install.sh $(PREFIX)
127 127
128dist release: distclean 128dist release: distclean
129 $(MAKE) -C docs clean all 129 $(MAKE) -C docs
130 cd ..; \ 130 cd ..; \
131 rm -rf busybox-$(VERSION); \ 131 rm -rf busybox-$(VERSION); \
132 cp -a busybox busybox-$(VERSION); \ 132 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[] = {
303 {"uname", uname_main, _BB_DIR_BIN}, 303 {"uname", uname_main, _BB_DIR_BIN},
304#endif 304#endif
305#ifdef BB_UNIQ 305#ifdef BB_UNIQ
306 {"uniq", uniq_main, _BB_DIR_BIN}, 306 {"uniq", uniq_main, _BB_DIR_USR_BIN},
307#endif 307#endif
308#ifdef BB_UPDATE 308#ifdef BB_UPDATE
309 {"update", update_main, _BB_DIR_SBIN}, 309 {"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[] = {
303 {"uname", uname_main, _BB_DIR_BIN}, 303 {"uname", uname_main, _BB_DIR_BIN},
304#endif 304#endif
305#ifdef BB_UNIQ 305#ifdef BB_UNIQ
306 {"uniq", uniq_main, _BB_DIR_BIN}, 306 {"uniq", uniq_main, _BB_DIR_USR_BIN},
307#endif 307#endif
308#ifdef BB_UPDATE 308#ifdef BB_UPDATE
309 {"update", update_main, _BB_DIR_SBIN}, 309 {"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)
83void cmdedit_reset_term(void) 83void cmdedit_reset_term(void)
84{ 84{
85 if (reset_term) 85 if (reset_term)
86 /* sparc and other have broken termios support: use old termio handling. */
86 ioctl(fileno(stdin), TCSETA, (void *) &old_term); 87 ioctl(fileno(stdin), TCSETA, (void *) &old_term);
87} 88}
88 89
@@ -378,6 +379,7 @@ extern void cmdedit_read_input(char* prompt, char command[BUFSIZ])
378 379
379 memset(command, 0, sizeof(command)); 380 memset(command, 0, sizeof(command));
380 if (!reset_term) { 381 if (!reset_term) {
382 /* sparc and other have broken termios support: use old termio handling. */
381 ioctl(inputFd, TCGETA, (void *) &old_term); 383 ioctl(inputFd, TCGETA, (void *) &old_term);
382 memcpy(&new_term, &old_term, sizeof(struct termio)); 384 memcpy(&new_term, &old_term, sizeof(struct termio));
383 385
@@ -589,6 +591,7 @@ extern void cmdedit_read_input(char* prompt, char command[BUFSIZ])
589 } 591 }
590 592
591 nr = len + 1; 593 nr = len + 1;
594 /* sparc and other have broken termios support: use old termio handling. */
592 ioctl(inputFd, TCSETA, (void *) &old_term); 595 ioctl(inputFd, TCSETA, (void *) &old_term);
593 reset_term = 0; 596 reset_term = 0;
594 597
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 @@
30#define PSF_MAXMODE 0x03 30#define PSF_MAXMODE 0x03
31#define PSF_SEPARATOR 0xFFFF 31#define PSF_SEPARATOR 0xFFFF
32 32
33static const char loadfont_usage[] = "loadfont\n" 33static const char loadfont_usage[] = "loadfont\n\n"
34 "\n" "\tLoad a console font from standard input.\n" "\n"; 34 "Loads a console font from standard input.\n";
35 35
36struct psf_header { 36struct psf_header {
37 unsigned char magic1, magic2; /* Magic number */ 37 unsigned char magic1, magic2; /* Magic number */
@@ -47,6 +47,10 @@ extern int loadfont_main(int argc, char **argv)
47{ 47{
48 int fd; 48 int fd;
49 49
50 if (argc>=2 && *argv[1]=='-') {
51 usage(loadfont_usage);
52 }
53
50 fd = open("/dev/tty0", O_RDWR); 54 fd = open("/dev/tty0", O_RDWR);
51 if (fd < 0) { 55 if (fd < 0) {
52 fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); 56 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 @@
2# ------------------------ 2# ------------------------
3# Copyright (C) 2000 Erik Andersen <andersee@debian.org> GPL 3# Copyright (C) 2000 Erik Andersen <andersee@debian.org> GPL
4 4
5all:: clean doc 5all: clean doc
6 6
7doc: 7doc:
8 @echo 8 @echo
@@ -14,10 +14,8 @@ doc:
14 pod2text busybox.pod > ../BusyBox.txt 14 pod2text busybox.pod > ../BusyBox.txt
15 @rm -f pod2html* 15 @rm -f pod2html*
16 16
17clean:: 17clean:
18 @rm -f ../BusyBox.html ../BusyBox.1 ../BusyBox.txt pod2html* 18 @rm -f ../BusyBox.html ../BusyBox.1 ../BusyBox.txt pod2html*
19 19
20distclean: clean 20distclean: clean
21 21
22.PHONY: all clean distclean doc
23
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:
68 68
69------------------------------- 69-------------------------------
70 70
71=item cat 71=item cat
72 72
73Usage: cat [file ...] 73Usage: cat [file ...]
74 74
@@ -807,19 +807,22 @@ Example:
807 807
808=item loadacm 808=item loadacm
809 809
810FIXME 810FIXME -- this command does not yet have proper documentation
811 811
812------------------------------- 812-------------------------------
813 813
814=item loadfont 814=item loadfont
815 815
816FIXME 816Usage: loadfont
817
818Loads a console font from standard input.
819
817 820
818------------------------------- 821-------------------------------
819 822
820=item loadkmap 823=item loadkmap
821 824
822FIXME 825FIXME -- this command does not yet have proper documentation
823 826
824------------------------------- 827-------------------------------
825 828
@@ -1294,7 +1297,7 @@ Usage: sh
1294 1297
1295lash -- the BusyBox LAme SHell (command interpreter) 1298lash -- the BusyBox LAme SHell (command interpreter)
1296 1299
1297FIXME 1300FIXME -- this command does not yet have proper documentation
1298 1301
1299------------------------------- 1302-------------------------------
1300 1303
@@ -1778,4 +1781,4 @@ Enrique Zanardi <ezanardi@ull.es>
1778 1781
1779=cut 1782=cut
1780 1783
1781# $Id: busybox.pod,v 1.15 2000/04/17 17:46:46 beppu Exp $ 1784# $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)
230 for(; pidList && pidList!=0; pidList++) { 230 for(; pidList && pidList!=0; pidList++) {
231 if (kill(*pidList, sig) != 0) 231 if (kill(*pidList, sig) != 0)
232 fatalError( "Could not kill pid '%d': %s\n", *pidList, strerror(errno)); 232 fatalError( "Could not kill pid '%d': %s\n", *pidList, strerror(errno));
233 else
234 printf("killed %d\n", *pidList);
233 } 235 }
234 /* Note that we don't bother to free the memory 236 /* Note that we don't bother to free the memory
235 * allocated in findPidByName(). It will be freed 237 * 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[] = {
120 {"pwd", "Print current directory", "pwd", shell_pwd}, 120 {"pwd", "Print current directory", "pwd", shell_pwd},
121 {"export", "Set environment variable", "export [VAR=value]", shell_export}, 121 {"export", "Set environment variable", "export [VAR=value]", shell_export},
122 {"unset", "Unset environment variable", "unset VAR", shell_unset}, 122 {"unset", "Unset environment variable", "unset VAR", shell_unset},
123
124 {".", "Source-in and run commands in a file", ". filename", shell_source}, 123 {".", "Source-in and run commands in a file", ". filename", shell_source},
125 {"help", "List shell built-in commands", "help", shell_help}, 124 {"help", "List shell built-in commands", "help", shell_help},
126 {NULL, NULL, NULL, NULL} 125 {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 @@
30#define PSF_MAXMODE 0x03 30#define PSF_MAXMODE 0x03
31#define PSF_SEPARATOR 0xFFFF 31#define PSF_SEPARATOR 0xFFFF
32 32
33static const char loadfont_usage[] = "loadfont\n" 33static const char loadfont_usage[] = "loadfont\n\n"
34 "\n" "\tLoad a console font from standard input.\n" "\n"; 34 "Loads a console font from standard input.\n";
35 35
36struct psf_header { 36struct psf_header {
37 unsigned char magic1, magic2; /* Magic number */ 37 unsigned char magic1, magic2; /* Magic number */
@@ -47,6 +47,10 @@ extern int loadfont_main(int argc, char **argv)
47{ 47{
48 int fd; 48 int fd;
49 49
50 if (argc>=2 && *argv[1]=='-') {
51 usage(loadfont_usage);
52 }
53
50 fd = open("/dev/tty0", O_RDWR); 54 fd = open("/dev/tty0", O_RDWR);
51 if (fd < 0) { 55 if (fd < 0) {
52 fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); 56 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 @@
33 33
34static const char more_usage[] = "more [file ...]\n"; 34static const char more_usage[] = "more [file ...]\n";
35 35
36/* ED: sparc termios is broken: revert back to old termio handling. */
37#ifdef BB_FEATURE_USE_TERMIOS 36#ifdef BB_FEATURE_USE_TERMIOS
38 37
39#if #cpu(sparc) 38#include <termio.h>
40# define USE_OLD_TERMIO
41# include <termio.h>
42# define termios termio
43# define stty(fd,argp) ioctl(fd,TCSETAF,argp)
44#else
45# include <termios.h>
46# define stty(fd,argp) tcsetattr(fd,TCSANOW,argp)
47#endif
48 39
49FILE *cin; 40FILE *cin;
50struct termios initial_settings, new_settings; 41/* sparc and other have broken termios support: use old termio handling. */
42struct termio initial_settings, new_settings;
51 43
52void gotsig(int sig) 44void gotsig(int sig)
53{ 45{
54 stty(fileno(cin), &initial_settings); 46 ioctl(fileno(cin), TCSETAF, &initial_settings);
55 fprintf(stdout, "\n"); 47 fprintf(stdout, "\n");
56 exit(TRUE); 48 exit(TRUE);
57} 49}
@@ -106,15 +98,11 @@ extern int more_main(int argc, char **argv)
106 cin = fopen("/dev/tty", "r"); 98 cin = fopen("/dev/tty", "r");
107 if (!cin) 99 if (!cin)
108 cin = fopen("/dev/console", "r"); 100 cin = fopen("/dev/console", "r");
109#ifdef USE_OLD_TERMIO
110 ioctl(fileno(cin), TCGETA, &initial_settings); 101 ioctl(fileno(cin), TCGETA, &initial_settings);
111#else
112 tcgetattr(fileno(cin), &initial_settings);
113#endif
114 new_settings = initial_settings; 102 new_settings = initial_settings;
115 new_settings.c_lflag &= ~ICANON; 103 new_settings.c_lflag &= ~ICANON;
116 new_settings.c_lflag &= ~ECHO; 104 new_settings.c_lflag &= ~ECHO;
117 stty(fileno(cin), &new_settings); 105 ioctl(fileno(cin), TCSETAF, &new_settings);
118 106
119#ifdef BB_FEATURE_AUTOWIDTH 107#ifdef BB_FEATURE_AUTOWIDTH
120 ioctl(fileno(stdout), TIOCGWINSZ, &win); 108 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)
230 for(; pidList && pidList!=0; pidList++) { 230 for(; pidList && pidList!=0; pidList++) {
231 if (kill(*pidList, sig) != 0) 231 if (kill(*pidList, sig) != 0)
232 fatalError( "Could not kill pid '%d': %s\n", *pidList, strerror(errno)); 232 fatalError( "Could not kill pid '%d': %s\n", *pidList, strerror(errno));
233 else
234 printf("killed %d\n", *pidList);
233 } 235 }
234 /* Note that we don't bother to free the memory 236 /* Note that we don't bother to free the memory
235 * allocated in findPidByName(). It will be freed 237 * 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[] = {
120 {"pwd", "Print current directory", "pwd", shell_pwd}, 120 {"pwd", "Print current directory", "pwd", shell_pwd},
121 {"export", "Set environment variable", "export [VAR=value]", shell_export}, 121 {"export", "Set environment variable", "export [VAR=value]", shell_export},
122 {"unset", "Unset environment variable", "unset VAR", shell_unset}, 122 {"unset", "Unset environment variable", "unset VAR", shell_unset},
123
124 {".", "Source-in and run commands in a file", ". filename", shell_source}, 123 {".", "Source-in and run commands in a file", ". filename", shell_source},
125 {"help", "List shell built-in commands", "help", shell_help}, 124 {"help", "List shell built-in commands", "help", shell_help},
126 {NULL, NULL, NULL, NULL} 125 {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)
83void cmdedit_reset_term(void) 83void cmdedit_reset_term(void)
84{ 84{
85 if (reset_term) 85 if (reset_term)
86 /* sparc and other have broken termios support: use old termio handling. */
86 ioctl(fileno(stdin), TCSETA, (void *) &old_term); 87 ioctl(fileno(stdin), TCSETA, (void *) &old_term);
87} 88}
88 89
@@ -378,6 +379,7 @@ extern void cmdedit_read_input(char* prompt, char command[BUFSIZ])
378 379
379 memset(command, 0, sizeof(command)); 380 memset(command, 0, sizeof(command));
380 if (!reset_term) { 381 if (!reset_term) {
382 /* sparc and other have broken termios support: use old termio handling. */
381 ioctl(inputFd, TCGETA, (void *) &old_term); 383 ioctl(inputFd, TCGETA, (void *) &old_term);
382 memcpy(&new_term, &old_term, sizeof(struct termio)); 384 memcpy(&new_term, &old_term, sizeof(struct termio));
383 385
@@ -589,6 +591,7 @@ extern void cmdedit_read_input(char* prompt, char command[BUFSIZ])
589 } 591 }
590 592
591 nr = len + 1; 593 nr = len + 1;
594 /* sparc and other have broken termios support: use old termio handling. */
592 ioctl(inputFd, TCSETA, (void *) &old_term); 595 ioctl(inputFd, TCSETA, (void *) &old_term);
593 reset_term = 0; 596 reset_term = 0;
594 597
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[] = {
120 {"pwd", "Print current directory", "pwd", shell_pwd}, 120 {"pwd", "Print current directory", "pwd", shell_pwd},
121 {"export", "Set environment variable", "export [VAR=value]", shell_export}, 121 {"export", "Set environment variable", "export [VAR=value]", shell_export},
122 {"unset", "Unset environment variable", "unset VAR", shell_unset}, 122 {"unset", "Unset environment variable", "unset VAR", shell_unset},
123
124 {".", "Source-in and run commands in a file", ". filename", shell_source}, 123 {".", "Source-in and run commands in a file", ". filename", shell_source},
125 {"help", "List shell built-in commands", "help", shell_help}, 124 {"help", "List shell built-in commands", "help", shell_help},
126 {NULL, NULL, NULL, NULL} 125 {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)
226 } 226 }
227 else { 227 else {
228#define BUFSIZE 1024 + 1 228#define BUFSIZE 1024 + 1
229 char buf[BUFSIZE]; 229 char buf;
230 char *q, *p; 230 char *q, *p;
231 int n_read; 231 int n_read;
232 char line[BUFSIZE]; 232 char line[BUFSIZE];
233 unsigned char c; 233 unsigned char c;
234 int pri;
234 235
235 /* Keep reading stuff till there is nothing else to read */ 236 /* Get set to read in a line */
236 while( (n_read = read (fd, buf, BUFSIZE)) > 0 && errno != EOF) { 237 memset (line, 0, sizeof(line));
237 int pri = (LOG_USER | LOG_NOTICE); 238 pri = (LOG_USER | LOG_NOTICE);
238 239
239 memset (line, 0, sizeof(line)); 240 /* Keep reading stuff till there is nothing else to read */
240 p = buf; 241 while( (n_read = read (fd, &buf, 1)) > 0) {
242 p = &buf;
241 q = line; 243 q = line;
242 while (p && (c = *p) && q < &line[sizeof(line) - 1]) { 244 while (p && (c = *p) && q < &line[sizeof(line) - 1]) {
243 if (c == '<') { 245 if (c == '<') {
@@ -262,6 +264,7 @@ static void doSyslogd (void)
262 264
263 /* Now log it */ 265 /* Now log it */
264 logMessage(pri, line); 266 logMessage(pri, line);
267 break;
265 } 268 }
266 close (fd); 269 close (fd);
267 FD_CLR (fd, &readfds); 270 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)
226 } 226 }
227 else { 227 else {
228#define BUFSIZE 1024 + 1 228#define BUFSIZE 1024 + 1
229 char buf[BUFSIZE]; 229 char buf;
230 char *q, *p; 230 char *q, *p;
231 int n_read; 231 int n_read;
232 char line[BUFSIZE]; 232 char line[BUFSIZE];
233 unsigned char c; 233 unsigned char c;
234 int pri;
234 235
235 /* Keep reading stuff till there is nothing else to read */ 236 /* Get set to read in a line */
236 while( (n_read = read (fd, buf, BUFSIZE)) > 0 && errno != EOF) { 237 memset (line, 0, sizeof(line));
237 int pri = (LOG_USER | LOG_NOTICE); 238 pri = (LOG_USER | LOG_NOTICE);
238 239
239 memset (line, 0, sizeof(line)); 240 /* Keep reading stuff till there is nothing else to read */
240 p = buf; 241 while( (n_read = read (fd, &buf, 1)) > 0) {
242 p = &buf;
241 q = line; 243 q = line;
242 while (p && (c = *p) && q < &line[sizeof(line) - 1]) { 244 while (p && (c = *p) && q < &line[sizeof(line) - 1]) {
243 if (c == '<') { 245 if (c == '<') {
@@ -262,6 +264,7 @@ static void doSyslogd (void)
262 264
263 /* Now log it */ 265 /* Now log it */
264 logMessage(pri, line); 266 logMessage(pri, line);
267 break;
265 } 268 }
266 close (fd); 269 close (fd);
267 FD_CLR (fd, &readfds); 270 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 @@
33 33
34static const char more_usage[] = "more [file ...]\n"; 34static const char more_usage[] = "more [file ...]\n";
35 35
36/* ED: sparc termios is broken: revert back to old termio handling. */
37#ifdef BB_FEATURE_USE_TERMIOS 36#ifdef BB_FEATURE_USE_TERMIOS
38 37
39#if #cpu(sparc) 38#include <termio.h>
40# define USE_OLD_TERMIO
41# include <termio.h>
42# define termios termio
43# define stty(fd,argp) ioctl(fd,TCSETAF,argp)
44#else
45# include <termios.h>
46# define stty(fd,argp) tcsetattr(fd,TCSANOW,argp)
47#endif
48 39
49FILE *cin; 40FILE *cin;
50struct termios initial_settings, new_settings; 41/* sparc and other have broken termios support: use old termio handling. */
42struct termio initial_settings, new_settings;
51 43
52void gotsig(int sig) 44void gotsig(int sig)
53{ 45{
54 stty(fileno(cin), &initial_settings); 46 ioctl(fileno(cin), TCSETAF, &initial_settings);
55 fprintf(stdout, "\n"); 47 fprintf(stdout, "\n");
56 exit(TRUE); 48 exit(TRUE);
57} 49}
@@ -106,15 +98,11 @@ extern int more_main(int argc, char **argv)
106 cin = fopen("/dev/tty", "r"); 98 cin = fopen("/dev/tty", "r");
107 if (!cin) 99 if (!cin)
108 cin = fopen("/dev/console", "r"); 100 cin = fopen("/dev/console", "r");
109#ifdef USE_OLD_TERMIO
110 ioctl(fileno(cin), TCGETA, &initial_settings); 101 ioctl(fileno(cin), TCGETA, &initial_settings);
111#else
112 tcgetattr(fileno(cin), &initial_settings);
113#endif
114 new_settings = initial_settings; 102 new_settings = initial_settings;
115 new_settings.c_lflag &= ~ICANON; 103 new_settings.c_lflag &= ~ICANON;
116 new_settings.c_lflag &= ~ECHO; 104 new_settings.c_lflag &= ~ECHO;
117 stty(fileno(cin), &new_settings); 105 ioctl(fileno(cin), TCSETAF, &new_settings);
118 106
119#ifdef BB_FEATURE_AUTOWIDTH 107#ifdef BB_FEATURE_AUTOWIDTH
120 ioctl(fileno(stdout), TIOCGWINSZ, &win); 108 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)
1364 pidList[i++]=strtol(next->d_name, NULL, 0); 1364 pidList[i++]=strtol(next->d_name, NULL, 0);
1365 } 1365 }
1366 } 1366 }
1367 pidList[i]=0; 1367 if (pidList!=NULL)
1368 pidList[i]=0;
1368 return pidList; 1369 return pidList;
1369} 1370}
1370#endif /* BB_FEATURE_USE_DEVPS_PATCH */ 1371#endif /* BB_FEATURE_USE_DEVPS_PATCH */