aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-04-15 16:34:54 +0000
committerErik Andersen <andersen@codepoet.org>2000-04-15 16:34:54 +0000
commit5e1189e187f6a7957dadb8eda2c271c4a0777a23 (patch)
tree140cd30d77342c730afbc1df863bec93c63978a8
parent95c1c1e05f290ccbcc2ff863a62bcee5d57bf5c8 (diff)
downloadbusybox-w32-5e1189e187f6a7957dadb8eda2c271c4a0777a23.tar.gz
busybox-w32-5e1189e187f6a7957dadb8eda2c271c4a0777a23.tar.bz2
busybox-w32-5e1189e187f6a7957dadb8eda2c271c4a0777a23.zip
More documentation updates, and minor fixes to make things sync
up with the docs. -Erik
-rw-r--r--TODO5
-rw-r--r--applets/busybox.c64
-rw-r--r--archival/gzip.c2
-rw-r--r--busybox.c64
-rw-r--r--busybox.def.h11
-rw-r--r--coreutils/mkfifo.c4
-rw-r--r--coreutils/mknod.c53
-rw-r--r--coreutils/printf.c2
-rw-r--r--coreutils/sort.c4
-rw-r--r--coreutils/test.c8
-rw-r--r--coreutils/tr.c14
-rw-r--r--docs/busybox.pod755
-rw-r--r--gzip.c2
-rw-r--r--makedevs.c19
-rw-r--r--math.c21
-rw-r--r--miscutils/makedevs.c19
-rw-r--r--miscutils/mt.c15
-rw-r--r--mkfifo.c4
-rw-r--r--mknod.c53
-rw-r--r--mnc.c6
-rw-r--r--mt.c15
-rw-r--r--networking/nslookup.c18
-rw-r--r--nslookup.c18
-rw-r--r--printf.c2
-rw-r--r--sort.c4
-rw-r--r--test.c8
-rw-r--r--tr.c14
27 files changed, 967 insertions, 237 deletions
diff --git a/TODO b/TODO
index 872de4677..4d1b82874 100644
--- a/TODO
+++ b/TODO
@@ -30,6 +30,11 @@ around to it some time. If you have any good ideas, please let me know.
30 30
31----------------------- 31-----------------------
32 32
33Add a compile option to turn off all the compiled in help
34andusage information. Some folks don't need or want it...
35
36-----------------------
37
33Compile with debugging on, run 'nm --size-sort ./busybox' 38Compile with debugging on, run 'nm --size-sort ./busybox'
34and then start with the biggest things and make them smaller... 39and then start with the biggest things and make them smaller...
35 40
diff --git a/applets/busybox.c b/applets/busybox.c
index a14711a67..15d53eb05 100644
--- a/applets/busybox.c
+++ b/applets/busybox.c
@@ -45,13 +45,13 @@ static const struct Applet applets[] = {
45 {"cat", cat_main, _BB_DIR_BIN}, 45 {"cat", cat_main, _BB_DIR_BIN},
46#endif 46#endif
47#ifdef BB_CHMOD_CHOWN_CHGRP 47#ifdef BB_CHMOD_CHOWN_CHGRP
48 {"chmod", chmod_chown_chgrp_main, _BB_DIR_BIN}, 48 {"chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN},
49#endif 49#endif
50#ifdef BB_CHMOD_CHOWN_CHGRP 50#ifdef BB_CHMOD_CHOWN_CHGRP
51 {"chown", chmod_chown_chgrp_main, _BB_DIR_BIN}, 51 {"chmod", chmod_chown_chgrp_main, _BB_DIR_BIN},
52#endif 52#endif
53#ifdef BB_CHMOD_CHOWN_CHGRP 53#ifdef BB_CHMOD_CHOWN_CHGRP
54 {"chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN}, 54 {"chown", chmod_chown_chgrp_main, _BB_DIR_BIN},
55#endif 55#endif
56#ifdef BB_CHROOT 56#ifdef BB_CHROOT
57 {"chroot", chroot_main, _BB_DIR_SBIN}, 57 {"chroot", chroot_main, _BB_DIR_SBIN},
@@ -65,9 +65,6 @@ static const struct Applet applets[] = {
65#ifdef BB_CP_MV 65#ifdef BB_CP_MV
66 {"cp", cp_mv_main, _BB_DIR_BIN}, 66 {"cp", cp_mv_main, _BB_DIR_BIN},
67#endif 67#endif
68#ifdef BB_CP_MV
69 {"mv", cp_mv_main, _BB_DIR_BIN},
70#endif
71#ifdef BB_DATE 68#ifdef BB_DATE
72 {"date", date_main, _BB_DIR_BIN}, 69 {"date", date_main, _BB_DIR_BIN},
73#endif 70#endif
@@ -92,6 +89,9 @@ static const struct Applet applets[] = {
92#ifdef BB_ECHO 89#ifdef BB_ECHO
93 {"echo", echo_main, _BB_DIR_BIN}, 90 {"echo", echo_main, _BB_DIR_BIN},
94#endif 91#endif
92#ifdef BB_TRUE_FALSE
93 {"false", false_main, _BB_DIR_BIN},
94#endif
95#ifdef BB_FBSET 95#ifdef BB_FBSET
96 {"fbset", fbset_main, _BB_DIR_USR_SBIN}, 96 {"fbset", fbset_main, _BB_DIR_USR_SBIN},
97#endif 97#endif
@@ -113,12 +113,15 @@ static const struct Applet applets[] = {
113#ifdef BB_FSCK_MINIX 113#ifdef BB_FSCK_MINIX
114 {"fsck.minix", fsck_minix_main, _BB_DIR_SBIN}, 114 {"fsck.minix", fsck_minix_main, _BB_DIR_SBIN},
115#endif 115#endif
116#ifdef BB_MKFS_MINIX
117 {"mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN},
118#endif
119#ifdef BB_GREP 116#ifdef BB_GREP
120 {"grep", grep_main, _BB_DIR_BIN}, 117 {"grep", grep_main, _BB_DIR_BIN},
121#endif 118#endif
119#ifdef BB_GUNZIP
120 {"gunzip", gunzip_main, _BB_DIR_BIN},
121#endif
122#ifdef BB_GZIP
123 {"gzip", gzip_main, _BB_DIR_BIN},
124#endif
122#ifdef BB_HALT 125#ifdef BB_HALT
123 {"halt", halt_main, _BB_DIR_SBIN}, 126 {"halt", halt_main, _BB_DIR_SBIN},
124#endif 127#endif
@@ -137,9 +140,6 @@ static const struct Applet applets[] = {
137#ifdef BB_INSMOD 140#ifdef BB_INSMOD
138 {"insmod", insmod_main, _BB_DIR_SBIN}, 141 {"insmod", insmod_main, _BB_DIR_SBIN},
139#endif 142#endif
140#ifdef BB_FEATURE_LINUXRC //
141 {"linuxrc", init_main, _BB_DIR_ROOT},
142#endif
143#ifdef BB_KILL 143#ifdef BB_KILL
144 {"kill", kill_main, _BB_DIR_BIN}, 144 {"kill", kill_main, _BB_DIR_BIN},
145#endif 145#endif
@@ -149,6 +149,9 @@ static const struct Applet applets[] = {
149#ifdef BB_LENGTH 149#ifdef BB_LENGTH
150 {"length", length_main, _BB_DIR_USR_BIN}, 150 {"length", length_main, _BB_DIR_USR_BIN},
151#endif 151#endif
152#ifdef BB_FEATURE_LINUXRC //
153 {"linuxrc", init_main, _BB_DIR_ROOT},
154#endif
152#ifdef BB_LN 155#ifdef BB_LN
153 {"ln", ln_main, _BB_DIR_BIN}, 156 {"ln", ln_main, _BB_DIR_BIN},
154#endif 157#endif
@@ -161,6 +164,12 @@ static const struct Applet applets[] = {
161#ifdef BB_LOADKMAP 164#ifdef BB_LOADKMAP
162 {"loadkmap", loadkmap_main, _BB_DIR_SBIN}, 165 {"loadkmap", loadkmap_main, _BB_DIR_SBIN},
163#endif 166#endif
167#ifdef BB_LOGGER
168 {"logger", logger_main, _BB_DIR_USR_BIN},
169#endif
170#ifdef BB_LOGNAME
171 {"logname", logname_main, _BB_DIR_USR_BIN},
172#endif
164#ifdef BB_LS 173#ifdef BB_LS
165 {"ls", ls_main, _BB_DIR_BIN}, 174 {"ls", ls_main, _BB_DIR_BIN},
166#endif 175#endif
@@ -179,6 +188,9 @@ static const struct Applet applets[] = {
179#ifdef BB_MKFIFO 188#ifdef BB_MKFIFO
180 {"mkfifo", mkfifo_main, _BB_DIR_USR_BIN}, 189 {"mkfifo", mkfifo_main, _BB_DIR_USR_BIN},
181#endif 190#endif
191#ifdef BB_MKFS_MINIX
192 {"mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN},
193#endif
182#ifdef BB_MKNOD 194#ifdef BB_MKNOD
183 {"mknod", mknod_main, _BB_DIR_BIN}, 195 {"mknod", mknod_main, _BB_DIR_BIN},
184#endif 196#endif
@@ -197,6 +209,9 @@ static const struct Applet applets[] = {
197#ifdef BB_MT 209#ifdef BB_MT
198 {"mt", mt_main, _BB_DIR_BIN}, 210 {"mt", mt_main, _BB_DIR_BIN},
199#endif 211#endif
212#ifdef BB_CP_MV
213 {"mv", cp_mv_main, _BB_DIR_BIN},
214#endif
200#ifdef BB_NSLOOKUP 215#ifdef BB_NSLOOKUP
201 {"nslookup", nslookup_main, _BB_DIR_USR_BIN}, 216 {"nslookup", nslookup_main, _BB_DIR_USR_BIN},
202#endif 217#endif
@@ -248,12 +263,6 @@ static const struct Applet applets[] = {
248#ifdef BB_SYSLOGD 263#ifdef BB_SYSLOGD
249 {"syslogd", syslogd_main, _BB_DIR_SBIN}, 264 {"syslogd", syslogd_main, _BB_DIR_SBIN},
250#endif 265#endif
251#ifdef BB_LOGGER
252 {"logger", logger_main, _BB_DIR_USR_BIN},
253#endif
254#ifdef BB_LOGNAME
255 {"logname", logname_main, _BB_DIR_USR_BIN},
256#endif
257#ifdef BB_SWAPONOFF 266#ifdef BB_SWAPONOFF
258 {"swapon", swap_on_off_main, _BB_DIR_SBIN}, 267 {"swapon", swap_on_off_main, _BB_DIR_SBIN},
259#endif 268#endif
@@ -270,9 +279,6 @@ static const struct Applet applets[] = {
270 {"telnet", telnet_main, _BB_DIR_USR_BIN}, 279 {"telnet", telnet_main, _BB_DIR_USR_BIN},
271#endif 280#endif
272#ifdef BB_TEST 281#ifdef BB_TEST
273 {"[", test_main, _BB_DIR_USR_BIN},
274#endif
275#ifdef BB_TEST
276 {"test", test_main, _BB_DIR_USR_BIN}, 282 {"test", test_main, _BB_DIR_USR_BIN},
277#endif 283#endif
278#ifdef BB_TEE 284#ifdef BB_TEE
@@ -287,9 +293,6 @@ static const struct Applet applets[] = {
287#ifdef BB_TRUE_FALSE 293#ifdef BB_TRUE_FALSE
288 {"true", true_main, _BB_DIR_BIN}, 294 {"true", true_main, _BB_DIR_BIN},
289#endif 295#endif
290#ifdef BB_TRUE_FALSE
291 {"false", false_main, _BB_DIR_BIN},
292#endif
293#ifdef BB_TTY 296#ifdef BB_TTY
294 {"tty", tty_main, _BB_DIR_USR_BIN}, 297 {"tty", tty_main, _BB_DIR_USR_BIN},
295#endif 298#endif
@@ -299,15 +302,15 @@ static const struct Applet applets[] = {
299#ifdef BB_UNAME 302#ifdef BB_UNAME
300 {"uname", uname_main, _BB_DIR_BIN}, 303 {"uname", uname_main, _BB_DIR_BIN},
301#endif 304#endif
302#ifdef BB_UPTIME
303 {"uptime", uptime_main, _BB_DIR_USR_BIN},
304#endif
305#ifdef BB_UNIQ 305#ifdef BB_UNIQ
306 {"uniq", uniq_main, _BB_DIR_BIN}, 306 {"uniq", uniq_main, _BB_DIR_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},
310#endif 310#endif
311#ifdef BB_UPTIME
312 {"uptime", uptime_main, _BB_DIR_USR_BIN},
313#endif
311#ifdef BB_USLEEP 314#ifdef BB_USLEEP
312 {"usleep", usleep_main, _BB_DIR_BIN}, 315 {"usleep", usleep_main, _BB_DIR_BIN},
313#endif 316#endif
@@ -323,11 +326,8 @@ static const struct Applet applets[] = {
323#ifdef BB_GUNZIP 326#ifdef BB_GUNZIP
324 {"zcat", gunzip_main, _BB_DIR_BIN}, 327 {"zcat", gunzip_main, _BB_DIR_BIN},
325#endif 328#endif
326#ifdef BB_GUNZIP 329#ifdef BB_TEST
327 {"gunzip", gunzip_main, _BB_DIR_BIN}, 330 {"[", test_main, _BB_DIR_USR_BIN},
328#endif
329#ifdef BB_GZIP
330 {"gzip", gzip_main, _BB_DIR_BIN},
331#endif 331#endif
332 {0} 332 {0}
333}; 333};
diff --git a/archival/gzip.c b/archival/gzip.c
index 55ec5bc4e..a9d34aeb1 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -41,7 +41,7 @@
41static const char gzip_usage[] = 41static const char gzip_usage[] =
42 "gzip [OPTION]... FILE\n\n" 42 "gzip [OPTION]... FILE\n\n"
43 "Compress FILE with maximum compression.\n" 43 "Compress FILE with maximum compression.\n"
44 "When FILE is -, reads standard input. Implies -c.\n\n" 44 "When FILE is '-', reads standard input. Implies -c.\n\n"
45 45
46 "Options:\n" 46 "Options:\n"
47 "\t-c\tWrite output to standard output instead of FILE.gz\n"; 47 "\t-c\tWrite output to standard output instead of FILE.gz\n";
diff --git a/busybox.c b/busybox.c
index a14711a67..15d53eb05 100644
--- a/busybox.c
+++ b/busybox.c
@@ -45,13 +45,13 @@ static const struct Applet applets[] = {
45 {"cat", cat_main, _BB_DIR_BIN}, 45 {"cat", cat_main, _BB_DIR_BIN},
46#endif 46#endif
47#ifdef BB_CHMOD_CHOWN_CHGRP 47#ifdef BB_CHMOD_CHOWN_CHGRP
48 {"chmod", chmod_chown_chgrp_main, _BB_DIR_BIN}, 48 {"chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN},
49#endif 49#endif
50#ifdef BB_CHMOD_CHOWN_CHGRP 50#ifdef BB_CHMOD_CHOWN_CHGRP
51 {"chown", chmod_chown_chgrp_main, _BB_DIR_BIN}, 51 {"chmod", chmod_chown_chgrp_main, _BB_DIR_BIN},
52#endif 52#endif
53#ifdef BB_CHMOD_CHOWN_CHGRP 53#ifdef BB_CHMOD_CHOWN_CHGRP
54 {"chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN}, 54 {"chown", chmod_chown_chgrp_main, _BB_DIR_BIN},
55#endif 55#endif
56#ifdef BB_CHROOT 56#ifdef BB_CHROOT
57 {"chroot", chroot_main, _BB_DIR_SBIN}, 57 {"chroot", chroot_main, _BB_DIR_SBIN},
@@ -65,9 +65,6 @@ static const struct Applet applets[] = {
65#ifdef BB_CP_MV 65#ifdef BB_CP_MV
66 {"cp", cp_mv_main, _BB_DIR_BIN}, 66 {"cp", cp_mv_main, _BB_DIR_BIN},
67#endif 67#endif
68#ifdef BB_CP_MV
69 {"mv", cp_mv_main, _BB_DIR_BIN},
70#endif
71#ifdef BB_DATE 68#ifdef BB_DATE
72 {"date", date_main, _BB_DIR_BIN}, 69 {"date", date_main, _BB_DIR_BIN},
73#endif 70#endif
@@ -92,6 +89,9 @@ static const struct Applet applets[] = {
92#ifdef BB_ECHO 89#ifdef BB_ECHO
93 {"echo", echo_main, _BB_DIR_BIN}, 90 {"echo", echo_main, _BB_DIR_BIN},
94#endif 91#endif
92#ifdef BB_TRUE_FALSE
93 {"false", false_main, _BB_DIR_BIN},
94#endif
95#ifdef BB_FBSET 95#ifdef BB_FBSET
96 {"fbset", fbset_main, _BB_DIR_USR_SBIN}, 96 {"fbset", fbset_main, _BB_DIR_USR_SBIN},
97#endif 97#endif
@@ -113,12 +113,15 @@ static const struct Applet applets[] = {
113#ifdef BB_FSCK_MINIX 113#ifdef BB_FSCK_MINIX
114 {"fsck.minix", fsck_minix_main, _BB_DIR_SBIN}, 114 {"fsck.minix", fsck_minix_main, _BB_DIR_SBIN},
115#endif 115#endif
116#ifdef BB_MKFS_MINIX
117 {"mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN},
118#endif
119#ifdef BB_GREP 116#ifdef BB_GREP
120 {"grep", grep_main, _BB_DIR_BIN}, 117 {"grep", grep_main, _BB_DIR_BIN},
121#endif 118#endif
119#ifdef BB_GUNZIP
120 {"gunzip", gunzip_main, _BB_DIR_BIN},
121#endif
122#ifdef BB_GZIP
123 {"gzip", gzip_main, _BB_DIR_BIN},
124#endif
122#ifdef BB_HALT 125#ifdef BB_HALT
123 {"halt", halt_main, _BB_DIR_SBIN}, 126 {"halt", halt_main, _BB_DIR_SBIN},
124#endif 127#endif
@@ -137,9 +140,6 @@ static const struct Applet applets[] = {
137#ifdef BB_INSMOD 140#ifdef BB_INSMOD
138 {"insmod", insmod_main, _BB_DIR_SBIN}, 141 {"insmod", insmod_main, _BB_DIR_SBIN},
139#endif 142#endif
140#ifdef BB_FEATURE_LINUXRC //
141 {"linuxrc", init_main, _BB_DIR_ROOT},
142#endif
143#ifdef BB_KILL 143#ifdef BB_KILL
144 {"kill", kill_main, _BB_DIR_BIN}, 144 {"kill", kill_main, _BB_DIR_BIN},
145#endif 145#endif
@@ -149,6 +149,9 @@ static const struct Applet applets[] = {
149#ifdef BB_LENGTH 149#ifdef BB_LENGTH
150 {"length", length_main, _BB_DIR_USR_BIN}, 150 {"length", length_main, _BB_DIR_USR_BIN},
151#endif 151#endif
152#ifdef BB_FEATURE_LINUXRC //
153 {"linuxrc", init_main, _BB_DIR_ROOT},
154#endif
152#ifdef BB_LN 155#ifdef BB_LN
153 {"ln", ln_main, _BB_DIR_BIN}, 156 {"ln", ln_main, _BB_DIR_BIN},
154#endif 157#endif
@@ -161,6 +164,12 @@ static const struct Applet applets[] = {
161#ifdef BB_LOADKMAP 164#ifdef BB_LOADKMAP
162 {"loadkmap", loadkmap_main, _BB_DIR_SBIN}, 165 {"loadkmap", loadkmap_main, _BB_DIR_SBIN},
163#endif 166#endif
167#ifdef BB_LOGGER
168 {"logger", logger_main, _BB_DIR_USR_BIN},
169#endif
170#ifdef BB_LOGNAME
171 {"logname", logname_main, _BB_DIR_USR_BIN},
172#endif
164#ifdef BB_LS 173#ifdef BB_LS
165 {"ls", ls_main, _BB_DIR_BIN}, 174 {"ls", ls_main, _BB_DIR_BIN},
166#endif 175#endif
@@ -179,6 +188,9 @@ static const struct Applet applets[] = {
179#ifdef BB_MKFIFO 188#ifdef BB_MKFIFO
180 {"mkfifo", mkfifo_main, _BB_DIR_USR_BIN}, 189 {"mkfifo", mkfifo_main, _BB_DIR_USR_BIN},
181#endif 190#endif
191#ifdef BB_MKFS_MINIX
192 {"mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN},
193#endif
182#ifdef BB_MKNOD 194#ifdef BB_MKNOD
183 {"mknod", mknod_main, _BB_DIR_BIN}, 195 {"mknod", mknod_main, _BB_DIR_BIN},
184#endif 196#endif
@@ -197,6 +209,9 @@ static const struct Applet applets[] = {
197#ifdef BB_MT 209#ifdef BB_MT
198 {"mt", mt_main, _BB_DIR_BIN}, 210 {"mt", mt_main, _BB_DIR_BIN},
199#endif 211#endif
212#ifdef BB_CP_MV
213 {"mv", cp_mv_main, _BB_DIR_BIN},
214#endif
200#ifdef BB_NSLOOKUP 215#ifdef BB_NSLOOKUP
201 {"nslookup", nslookup_main, _BB_DIR_USR_BIN}, 216 {"nslookup", nslookup_main, _BB_DIR_USR_BIN},
202#endif 217#endif
@@ -248,12 +263,6 @@ static const struct Applet applets[] = {
248#ifdef BB_SYSLOGD 263#ifdef BB_SYSLOGD
249 {"syslogd", syslogd_main, _BB_DIR_SBIN}, 264 {"syslogd", syslogd_main, _BB_DIR_SBIN},
250#endif 265#endif
251#ifdef BB_LOGGER
252 {"logger", logger_main, _BB_DIR_USR_BIN},
253#endif
254#ifdef BB_LOGNAME
255 {"logname", logname_main, _BB_DIR_USR_BIN},
256#endif
257#ifdef BB_SWAPONOFF 266#ifdef BB_SWAPONOFF
258 {"swapon", swap_on_off_main, _BB_DIR_SBIN}, 267 {"swapon", swap_on_off_main, _BB_DIR_SBIN},
259#endif 268#endif
@@ -270,9 +279,6 @@ static const struct Applet applets[] = {
270 {"telnet", telnet_main, _BB_DIR_USR_BIN}, 279 {"telnet", telnet_main, _BB_DIR_USR_BIN},
271#endif 280#endif
272#ifdef BB_TEST 281#ifdef BB_TEST
273 {"[", test_main, _BB_DIR_USR_BIN},
274#endif
275#ifdef BB_TEST
276 {"test", test_main, _BB_DIR_USR_BIN}, 282 {"test", test_main, _BB_DIR_USR_BIN},
277#endif 283#endif
278#ifdef BB_TEE 284#ifdef BB_TEE
@@ -287,9 +293,6 @@ static const struct Applet applets[] = {
287#ifdef BB_TRUE_FALSE 293#ifdef BB_TRUE_FALSE
288 {"true", true_main, _BB_DIR_BIN}, 294 {"true", true_main, _BB_DIR_BIN},
289#endif 295#endif
290#ifdef BB_TRUE_FALSE
291 {"false", false_main, _BB_DIR_BIN},
292#endif
293#ifdef BB_TTY 296#ifdef BB_TTY
294 {"tty", tty_main, _BB_DIR_USR_BIN}, 297 {"tty", tty_main, _BB_DIR_USR_BIN},
295#endif 298#endif
@@ -299,15 +302,15 @@ static const struct Applet applets[] = {
299#ifdef BB_UNAME 302#ifdef BB_UNAME
300 {"uname", uname_main, _BB_DIR_BIN}, 303 {"uname", uname_main, _BB_DIR_BIN},
301#endif 304#endif
302#ifdef BB_UPTIME
303 {"uptime", uptime_main, _BB_DIR_USR_BIN},
304#endif
305#ifdef BB_UNIQ 305#ifdef BB_UNIQ
306 {"uniq", uniq_main, _BB_DIR_BIN}, 306 {"uniq", uniq_main, _BB_DIR_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},
310#endif 310#endif
311#ifdef BB_UPTIME
312 {"uptime", uptime_main, _BB_DIR_USR_BIN},
313#endif
311#ifdef BB_USLEEP 314#ifdef BB_USLEEP
312 {"usleep", usleep_main, _BB_DIR_BIN}, 315 {"usleep", usleep_main, _BB_DIR_BIN},
313#endif 316#endif
@@ -323,11 +326,8 @@ static const struct Applet applets[] = {
323#ifdef BB_GUNZIP 326#ifdef BB_GUNZIP
324 {"zcat", gunzip_main, _BB_DIR_BIN}, 327 {"zcat", gunzip_main, _BB_DIR_BIN},
325#endif 328#endif
326#ifdef BB_GUNZIP 329#ifdef BB_TEST
327 {"gunzip", gunzip_main, _BB_DIR_BIN}, 330 {"[", test_main, _BB_DIR_USR_BIN},
328#endif
329#ifdef BB_GZIP
330 {"gzip", gzip_main, _BB_DIR_BIN},
331#endif 331#endif
332 {0} 332 {0}
333}; 333};
diff --git a/busybox.def.h b/busybox.def.h
index 1952dd377..1880884f9 100644
--- a/busybox.def.h
+++ b/busybox.def.h
@@ -32,12 +32,12 @@
32#define BB_GREP 32#define BB_GREP
33#define BB_GUNZIP 33#define BB_GUNZIP
34#define BB_GZIP 34#define BB_GZIP
35//#define BB_HALT 35#define BB_HALT
36#define BB_HEAD 36#define BB_HEAD
37#define BB_HOSTID 37#define BB_HOSTID
38#define BB_HOSTNAME 38#define BB_HOSTNAME
39#define BB_INIT 39#define BB_INIT
40// Don't bother turning BB_INSMOD on. It doesn't work. 40// Don't bother turning BB_INSMOD on. It doesn't work yet.
41//#define BB_INSMOD 41//#define BB_INSMOD
42#define BB_KILL 42#define BB_KILL
43#define BB_KILLALL 43#define BB_KILLALL
@@ -65,11 +65,11 @@
65#define BB_MT 65#define BB_MT
66#define BB_NSLOOKUP 66#define BB_NSLOOKUP
67#define BB_PING 67#define BB_PING
68//#define BB_POWEROFF 68#define BB_POWEROFF
69#define BB_PRINTF 69#define BB_PRINTF
70#define BB_PS 70#define BB_PS
71#define BB_PWD 71#define BB_PWD
72//#define BB_REBOOT 72#define BB_REBOOT
73#define BB_RM 73#define BB_RM
74#define BB_RMDIR 74#define BB_RMDIR
75#define BB_RMMOD 75#define BB_RMMOD
@@ -85,7 +85,7 @@
85#define BB_TAR 85#define BB_TAR
86#define BB_TEE 86#define BB_TEE
87#define BB_TEST 87#define BB_TEST
88// Don't turn BB_TELNET on. It doesn't work. 88// Don't bother turning BB_TELNET on. It doesn't work properly yet.
89//#define BB_TELNET 89//#define BB_TELNET
90#define BB_TOUCH 90#define BB_TOUCH
91#define BB_TR 91#define BB_TR
@@ -115,6 +115,7 @@
115// the /proc filesystem and thereby saving lots and lots 115// the /proc filesystem and thereby saving lots and lots
116// memory for more important things. 116// memory for more important things.
117// You can't use this and USE_PROCFS at the same time... 117// You can't use this and USE_PROCFS at the same time...
118// (BTW, I emailed Linus and this patch will not be going into the stock kernel)
118//#define BB_FEATURE_USE_DEVPS_PATCH 119//#define BB_FEATURE_USE_DEVPS_PATCH
119// 120//
120// enable features that use the /proc filesystem (apps that 121// enable features that use the /proc filesystem (apps that
diff --git a/coreutils/mkfifo.c b/coreutils/mkfifo.c
index c74402d4c..b273df046 100644
--- a/coreutils/mkfifo.c
+++ b/coreutils/mkfifo.c
@@ -27,10 +27,10 @@
27#include <errno.h> 27#include <errno.h>
28 28
29static const char mkfifo_usage[] = "mkfifo [OPTIONS] name\n\n" 29static const char mkfifo_usage[] = "mkfifo [OPTIONS] name\n\n"
30 "Create the named fifo\n\n" 30 "Creates a named pipe (identical to 'mknod name p')\n\n"
31 31
32 "Options:\n" 32 "Options:\n"
33 "\t-m\tcreate the fifo with the specified mode; default = a=rw-umask\n"; 33 "\t-m\tcreate the pipe using the specified mode (default a=rw)\n";
34 34
35extern int mkfifo_main(int argc, char **argv) 35extern int mkfifo_main(int argc, char **argv)
36{ 36{
diff --git a/coreutils/mknod.c b/coreutils/mknod.c
index 40f508d33..0c93df64d 100644
--- a/coreutils/mknod.c
+++ b/coreutils/mknod.c
@@ -28,23 +28,47 @@
28#include <fcntl.h> 28#include <fcntl.h>
29#include <unistd.h> 29#include <unistd.h>
30 30
31static const char mknod_usage[] = "mknod NAME TYPE MAJOR MINOR\n\n" 31static const char mknod_usage[] = "mknod [OPTIONS] NAME TYPE MAJOR MINOR\n\n"
32 "Make block or character special files.\n\n" 32 "Create a special file (block, character, or pipe).\n\n"
33 "Options:\n"
34 "\t-m\tcreate the special file using the specified mode (default a=rw)\n\n"
33 "TYPEs include:\n" 35 "TYPEs include:\n"
34 "\tb:\tMake a block (buffered) device.\n" 36 "\tb:\tMake a block (buffered) device.\n"
35
36 "\tc or u:\tMake a character (un-buffered) device.\n" 37 "\tc or u:\tMake a character (un-buffered) device.\n"
37 "\tp:\tMake a named pipe. Major and minor are ignored for named pipes.\n"; 38 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes.\n";
38 39
39int mknod_main(int argc, char **argv) 40int mknod_main(int argc, char **argv)
40{ 41{
42 char *thisarg;
41 mode_t mode = 0; 43 mode_t mode = 0;
44 mode_t perm = 0666;
42 dev_t dev = 0; 45 dev_t dev = 0;
43 46
44 if (argc != 5 || **(argv + 1) == '-') { 47 argc--;
48 argv++;
49
50 /* Parse any options */
51 while (argc > 1) {
52 if (**argv != '-')
53 break;
54 thisarg = *argv;
55 thisarg++;
56 switch (*thisarg) {
57 case 'm':
58 argc--;
59 argv++;
60 parse_mode(*argv, &perm);
61 break;
62 default:
63 usage(mknod_usage);
64 }
65 argc--;
66 argv++;
67 }
68 if (argc != 4 && argc != 2) {
45 usage(mknod_usage); 69 usage(mknod_usage);
46 } 70 }
47 switch (argv[2][0]) { 71 switch (argv[1][0]) {
48 case 'c': 72 case 'c':
49 case 'u': 73 case 'u':
50 mode = S_IFCHR; 74 mode = S_IFCHR;
@@ -54,23 +78,22 @@ int mknod_main(int argc, char **argv)
54 break; 78 break;
55 case 'p': 79 case 'p':
56 mode = S_IFIFO; 80 mode = S_IFIFO;
81 if (argc!=2) {
82 usage(mknod_usage);
83 }
57 break; 84 break;
58 default: 85 default:
59 usage(mknod_usage); 86 usage(mknod_usage);
60 } 87 }
61 88
62 if (mode == S_IFCHR || mode == S_IFBLK) { 89 if (mode == S_IFCHR || mode == S_IFBLK) {
63 dev = (atoi(argv[3]) << 8) | atoi(argv[4]); 90 dev = (atoi(argv[2]) << 8) | atoi(argv[1]);
64 if (argc != 5) {
65 usage(mknod_usage);
66 }
67 } 91 }
68 92
69 mode |= 0666; 93 mode |= perm;
70 94
71 if (mknod(argv[1], mode, dev) != 0) { 95 if (mknod(argv[0], mode, dev) != 0)
72 perror(argv[1]); 96 fatalError("%s: %s\n", argv[0], strerror(errno));
73 exit (FALSE);
74 }
75 exit (TRUE); 97 exit (TRUE);
76} 98}
99
diff --git a/coreutils/printf.c b/coreutils/printf.c
index 41ab2e442..bfe408175 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -139,7 +139,7 @@ static void verify __P((char *s, char *end));
139/* The value to return to the calling program. */ 139/* The value to return to the calling program. */
140static int exit_status; 140static int exit_status;
141 141
142static const char printf_usage[] = "printf format [argument...]\n"; 142static const char printf_usage[] = "printf format [argument...]\n\nFormats and prints the given data.\n";
143 143
144int printf_main(int argc, char **argv) 144int printf_main(int argc, char **argv)
145{ 145{
diff --git a/coreutils/sort.c b/coreutils/sort.c
index 6ee6f207e..4301f4303 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -33,7 +33,7 @@ static const char sort_usage[] = "sort [-n]"
33#ifdef BB_FEATURE_SORT_REVERSE 33#ifdef BB_FEATURE_SORT_REVERSE
34" [-r]" 34" [-r]"
35#endif 35#endif
36" [FILE]...\n\n"; 36" [FILE]...\n\nSorts lines of text in the specified files\n";
37 37
38#ifdef BB_FEATURE_SORT_REVERSE 38#ifdef BB_FEATURE_SORT_REVERSE
39#define APPLY_REVERSE(x) (reverse ? -(x) : (x)) 39#define APPLY_REVERSE(x) (reverse ? -(x) : (x))
@@ -320,4 +320,4 @@ int sort_main(int argc, char **argv)
320 exit(0); 320 exit(0);
321} 321}
322 322
323/* $Id: sort.c,v 1.13 2000/04/13 01:18:56 erik Exp $ */ 323/* $Id: sort.c,v 1.14 2000/04/15 16:34:54 erik Exp $ */
diff --git a/coreutils/test.c b/coreutils/test.c
index 85d06a83a..0ed777194 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * echo implementation for busybox 3 * test implementation for busybox
4 * 4 *
5 * Copyright (c) by a whole pile of folks: 5 * Copyright (c) by a whole pile of folks:
6 * 6 *
@@ -185,6 +185,12 @@ test_main(int argc, char** argv)
185 fatalError("missing ]"); 185 fatalError("missing ]");
186 argv[argc] = NULL; 186 argv[argc] = NULL;
187 } 187 }
188 if (strcmp(argv[1], "--help") == 0) {
189 usage("test EXPRESSION\n"
190 "or [ EXPRESSION ]\n\n"
191 "Checks file types and compares values returning an exit\n"
192 "code determined by the value of EXPRESSION.\n");
193 }
188 194
189 /* Implement special cases from POSIX.2, section 4.62.4 */ 195 /* Implement special cases from POSIX.2, section 4.62.4 */
190 switch (argc) { 196 switch (argc) {
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 3bfa48080..b631b0065 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -44,7 +44,7 @@ static char sccsid[] = "@(#)tr.c 8.2 (Berkeley) 5/4/95";
44#endif 44#endif
45static const char rcsid[] = 45static const char rcsid[] =
46 46
47 "$Id: tr.c,v 1.2 2000/03/21 22:32:57 erik Exp $"; 47 "$Id: tr.c,v 1.3 2000/04/15 16:34:54 erik Exp $";
48#endif /* not lint */ 48#endif /* not lint */
49#endif /* #if 0 */ 49#endif /* #if 0 */
50 50
@@ -138,12 +138,12 @@ int cflag;
138 138
139static void tr_usage() 139static void tr_usage()
140{ 140{
141 (void) fprintf(stderr, "%s\n%s\n%s\n%s\n", 141 usage( "\ttr [-csu] string1 string2\n"
142 "usage: tr [-csu] string1 string2", 142 "\ttr [-cu] -d string1\n"
143 " tr [-cu] -d string1", 143 "\ttr [-cu] -s string1\n"
144 " tr [-cu] -s string1", 144 "\ttr [-cu] -ds string1 string2\n\n"
145 " tr [-cu] -ds string1 string2"); 145 "Translate, squeeze, and/or delete characters from standard\n"
146 exit(1); 146 "input, writing to standard output.\n");
147} 147}
148 148
149 149
diff --git a/docs/busybox.pod b/docs/busybox.pod
index 0e36e3172..7d185fa15 100644
--- a/docs/busybox.pod
+++ b/docs/busybox.pod
@@ -36,16 +36,15 @@ tries to make itself useful to small systems with limited resources.
36 36
37Currently defined functions include: 37Currently defined functions include:
38 38
39basename, cat, chmod, chown, chgrp, chroot, clear, chvt, cp, date, 39basename, cat, chgrp, chmod, chown, chroot, clear, chvt, cp, date, dd, df,
40dd, df, dirname, dmesg, du, dutmp, echo, false, fbset, fdflush, find, free, 40dirname, dmesg, du, dutmp, echo, false, fbset, fdflush, find, free,
41freeramdisk, deallocvt, fsck.minix, mkfs.minix, grep, gunzip, gzip, 41freeramdisk, deallocvt, fsck.minix, grep, gunzip, gzip, halt, head, hostid,
42halt, head, hostid, hostname, init, kill, killall, length, ln, loadacm, 42hostname, init, kill, killall, length, ln, loadacm, loadfont, loadkmap, logger,
43loadfont, loadkmap, ls, lsmod, makedevs, math, mkdir, mkfifo, mknod, 43logname, ls, lsmod, makedevs, math, mkdir, mkfifo, mkfs.minix, mknod, mkswap,
44mkswap, mnc, more, mount, mt, mv, nslookup, poweroff, ping, printf, ps, 44mnc, more, mount, mt, mv, nslookup, ping, poweroff, printf, ps, pwd, reboot,
45pwd, reboot, rm, rmdir, rmmod, sed, sh, fdisk, sfdisk, sleep, sort, 45rm, rmdir, rmmod, sed, sh, sfdisk, sleep, sort, sync, syslogd, swapon, swapoff,
46sync, syslogd, logger, logname, swapon, swapoff, tail, tar, [, test, 46tail, tar, test, tee, touch, tr, true, tty, umount, uname, uniq, update,
47tee, touch, tr, true, tty, umount, uname, uptime, uniq, update, 47uptime, usleep, wc, whoami, yes, zcat, [
48usleep, wc, whoami, yes, zcat
49 48
50=head1 COMMON OPTIONS 49=head1 COMMON OPTIONS
51 50
@@ -82,6 +81,26 @@ Example:
82 81
83------------------------------- 82-------------------------------
84 83
84=item chgrp
85
86Usage: chgrp [OPTION]... GROUP FILE...
87
88Change the group membership of each FILE to GROUP.
89
90Options:
91
92 -R change files and directories recursively
93
94Example:
95
96 $ ls -l /tmp/foo
97 -r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo
98 $ chgrp root /tmp/foo
99 $ ls -l /tmp/foo
100 -r--r--r-- 1 andersen root 0 Apr 12 18:25 /tmp/foo
101
102-------------------------------
103
85=item chmod 104=item chmod
86 105
87Usage: chmod [B<-R>] MODE[,MODE]... FILE... 106Usage: chmod [B<-R>] MODE[,MODE]... FILE...
@@ -165,26 +184,6 @@ Example:
165 184
166------------------------------- 185-------------------------------
167 186
168=item chgrp
169
170Usage: chgrp [OPTION]... GROUP FILE...
171
172Change the group membership of each FILE to GROUP.
173
174Options:
175
176 -R change files and directories recursively
177
178Example:
179
180 $ ls -l /tmp/foo
181 -r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo
182 $ chgrp root /tmp/foo
183 $ ls -l /tmp/foo
184 -r--r--r-- 1 andersen root 0 Apr 12 18:25 /tmp/foo
185
186-------------------------------
187
188=item chroot 187=item chroot
189 188
190Usage: chroot NEWROOT [COMMAND...] 189Usage: chroot NEWROOT [COMMAND...]
@@ -391,6 +390,14 @@ Example:
391 390
392=item false 391=item false
393 392
393Returns an exit code of FALSE (1)
394
395Example:
396
397 $ false
398 $ echo $?
399 1
400
394------------------------------- 401-------------------------------
395 402
396=item fbset 403=item fbset
@@ -465,7 +472,7 @@ Displays the amount of free and used memory in the system.
465Example: 472Example:
466 473
467 $ free 474 $ free
468 total used free shared buffers 475 total used free shared buffers
469 Mem: 257628 248724 8904 59644 93124 476 Mem: 257628 248724 8904 59644 93124
470 Swap: 128516 8404 120112 477 Swap: 128516 8404 120112
471 Total: 386144 257128 129016 478 Total: 386144 257128 129016
@@ -510,22 +517,6 @@ OPTIONS:
510 517
511------------------------------- 518-------------------------------
512 519
513=item mkfs.minix
514
515Usage: mkfs.minix [B<-c> | B<-l> filename] [B<-nXX>] [B<-iXX>] /dev/name [blocks]
516
517Make a MINIX filesystem.
518
519OPTIONS:
520
521 -c Check the device for bad blocks
522 -n [14|30] Specify the maximum length of filenames
523 -i Specify the number of inodes for the filesystem
524 -l FILENAME Read the bad blocks list from FILENAME
525 -v Make a Minix version 2 filesystem
526
527-------------------------------
528
529=item grep 520=item grep
530 521
531Usage: grep [OPTIONS]... PATTERN [FILE]... 522Usage: grep [OPTIONS]... PATTERN [FILE]...
@@ -552,16 +543,52 @@ Example:
552 543
553=item gunzip 544=item gunzip
554 545
546Usage: gunzip [OPTION]... FILE
547
548Uncompress FILE (or standard input if FILE is '-').
549
550Options:
551
552 -c Write output to standard output
553 -t Test compressed file integrity
554
555Example:
556
557 $ ls -la /tmp/busybox*
558 -rw-rw-r-- 1 andersen andersen 557009 Apr 11 10:55 /tmp/busybox-0.43.tar.gz
559 $ gunzip /tmp/busybox-0.43.tar.gz
560 $ ls -la /tmp/busybox*
561 -rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/busybox-0.43.tar
555 562
556------------------------------- 563-------------------------------
557 564
558=item gzip 565=item gzip
559 566
567Usage: gzip [OPTION]... FILE
568
569Compress FILE with maximum compression.
570When FILE is '-', reads standard input. Implies -c.
571
572Options:
573
574 -c Write output to standard output instead of FILE.gz
575
576Example:
577
578 $ ls -la /tmp/busybox*
579 -rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/busybox-0.43.tar
580 $ gzip /tmp/busybox-0.43.tar
581 $ ls -la /tmp/busybox*
582 -rw-rw-r-- 1 andersen andersen 554058 Apr 14 17:49 /tmp/busybox-0.43.tar.gz
583
560 584
561------------------------------- 585-------------------------------
562 586
563=item halt 587=item halt
564 588
589Usage: halt
590
591This comand halts the system.
565 592
566------------------------------- 593-------------------------------
567 594
@@ -587,6 +614,11 @@ Example:
587 614
588=item hostid 615=item hostid
589 616
617Usage: hostid
618
619Prints out a unique 32-bit identifier for the current
620machine. The 32-bit identifier is intended to be unique
621among all UNIX systems in existence.
590 622
591------------------------------- 623-------------------------------
592 624
@@ -613,6 +645,94 @@ Example:
613 645
614=item init 646=item init
615 647
648Usage: init
649
650Init is the parent of all processes.
651
652This version of init is designed to be run only by the kernel.
653
654BusyBox init doesn't support multiple runlevels. The runlevels field of
655the /etc/inittab file is completely ignored by BusyBox init. If you want
656runlevels, use sysvinit.
657
658BusyBox init works just fine without an inittab. If no inittab is found,
659it has the following default behavior:
660
661 ::sysinit:/etc/init.d/rcS
662 ::askfirst:/bin/sh
663
664if it detects that /dev/console is _not_ a serial console, it will also run:
665
666 tty2::askfirst:/bin/sh
667
668If you choose to use an /etc/inittab file, the inittab entry format is as follows:
669
670 <id>:<runlevels>:<action>:<process>
671
672 <id>:
673
674 WARNING: This field has a non-traditional meaning for BusyBox init!
675 The id field is used by BusyBox init to specify the controlling tty for
676 the specified process to run on. The contents of this field are
677 appended to "/dev/" and used as-is. There is no need for this field to
678 be unique, although if it isn't you may have strange results. If this
679 field is left blank, it is completely ignored. Also note that if
680 BusyBox detects that a serial console is in use, then all entries
681 containing non-empty id fields will _not_ be run. BusyBox init does
682 nothing with utmp. We don't need no stinkin' utmp.
683
684 <runlevels>:
685
686 The runlevels field is completely ignored.
687
688 <action>:
689
690 Valid actions include: sysinit, respawn, askfirst, wait,
691 once, and ctrlaltdel.
692
693 askfirst acts just like respawn, but before running the specified
694 process it displays the line "Please press Enter to activate this
695 console." and then waits for the user to press enter before starting
696 the specified process.
697
698 Unrecognised actions (like initdefault) will cause init to emit
699 an error message, and then go along with its business.
700
701 <process>:
702
703 Specifies the process to be executed and it's command line.
704
705
706Example /etc/inittab file:
707
708 # This is run first except when booting in single-user mode.
709 #
710 ::sysinit:/etc/init.d/rcS
711
712 # /bin/sh invocations on selected ttys
713 #
714 # Start an "askfirst" shell on the console (whatever that may be)
715 ::askfirst:/bin/sh
716 # Start an "askfirst" shell on /dev/tty2
717 tty2::askfirst:/bin/sh
718
719 # /sbin/getty invocations for selected ttys
720 #
721 tty4::respawn:/sbin/getty 38400 tty4
722 tty5::respawn:/sbin/getty 38400 tty5
723
724
725 # Example of how to put a getty on a serial line (for a terminal)
726 #
727 #ttyS0::respawn:/sbin/getty -L ttyS0 9600 vt100
728 #ttyS1::respawn:/sbin/getty -L ttyS1 9600 vt100
729 #
730 # Example how to put a getty on a modem line.
731 #ttyS2::respawn:/sbin/getty -x0 -s 57600 ttyS2
732
733 # Stuff to do before rebooting
734 ::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1
735 ::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1
616 736
617------------------------------- 737-------------------------------
618 738
@@ -641,10 +761,28 @@ Example:
641 761
642=item killall 762=item killall
643 763
764Usage: killall [-signal] process-name [process-name ...]
765
766Send a signal (default is SIGTERM) to the specified process(es).
767
768Options:
769 -l List all signal names and numbers.
770
771Example:
772
773 $ killall apache
774
644------------------------------- 775-------------------------------
645 776
646=item length 777=item length
647 778
779Usage: length string
780
781Prints out the length of the specified string.
782
783Example:
784 $ length "Hello"
785 5
648 786
649------------------------------- 787-------------------------------
650 788
@@ -668,14 +806,52 @@ Example:
668 806
669=item loadacm 807=item loadacm
670 808
809FIXME
810
671------------------------------- 811-------------------------------
672 812
673=item loadfont 813=item loadfont
674 814
815FIXME
816
675------------------------------- 817-------------------------------
676 818
677=item loadkmap 819=item loadkmap
678 820
821FIXME
822
823-------------------------------
824
825=item logger
826
827Usage: logger [OPTION]... [MESSAGE]
828
829Write MESSAGE to the system log. If MESSAGE is '-', log stdin.
830
831Options:
832
833 -s Log to stderr as well as the system log.
834 -t Log using the specified tag (defaults to user name).
835 -p Enter the message with the specified priority.
836 This may be numerical or a ``facility.level'' pair.
837
838Example:
839
840 $ logger "hello"
841
842-------------------------------
843
844=item logname
845
846Usage: logname
847
848Print the name of the current user.
849
850Example:
851
852 $ logname
853 root
854
679------------------------------- 855-------------------------------
680 856
681=item ls 857=item ls
@@ -705,16 +881,53 @@ Options:
705 881
706Usage: lsmod 882Usage: lsmod
707 883
708Shows information about all loaded modules. 884Shows a list of all currently loaded kernel modules.
709 885
710------------------------------- 886-------------------------------
711 887
712=item makedevs 888=item makedevs
713 889
890Usage: makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]
891
892Creates a range of block or character special files
893
894TYPEs include:
895
896 b: Make a block (buffered) device.
897 c or u: Make a character (un-buffered) device.
898 p: Make a named pipe. MAJOR and MINOR are ignored for named pipes.
899
900FIRST specifies the number appended to NAME to create the first device.
901LAST specifies the number of the last item that should be created.
902If 's' is the last argument, the base device is created as well.
903
904Example:
905
906 $ makedevs /dev/ttyS c 4 66 2 63
907 [creates ttyS2-ttyS63]
908 $ makedevs /dev/hda b 3 0 0 8 s
909 [creates hda,hda1-hda8]
910
714------------------------------- 911-------------------------------
715 912
716=item math 913=item math
717 914
915Usage: math expression ...
916
917This is a Tiny RPN calculator that understands the
918following operations: +, -, /, *, and, or, not, eor.
919
920Example:
921
922 $ math 2 2 add
923 4
924 $ math 8 8 \* 2 2 + /
925 16
926 $ math 0 1 and
927 0
928 $ math 0 1 or
929 1
930
718------------------------------- 931-------------------------------
719 932
720=item mkdir 933=item mkdir
@@ -741,23 +954,49 @@ Example:
741 954
742=item mkfifo 955=item mkfifo
743 956
957Usage: mkfifo [OPTIONS] name
958
959Creates a named pipe (identical to 'mknod name p')
960
961Options:
962 -m create the pipe using the specified mode (default a=rw)
963
964-------------------------------
965
966=item mkfs.minix
967
968Usage: mkfs.minix [B<-c> | B<-l> filename] [B<-nXX>] [B<-iXX>] /dev/name [blocks]
969
970Make a MINIX filesystem.
971
972OPTIONS:
973
974 -c Check the device for bad blocks
975 -n [14|30] Specify the maximum length of filenames
976 -i Specify the number of inodes for the filesystem
977 -l FILENAME Read the bad blocks list from FILENAME
978 -v Make a Minix version 2 filesystem
979
744------------------------------- 980-------------------------------
745 981
746=item mknod 982=item mknod
747 983
748Usage: mknod NAME TYPE MAJOR MINOR 984Usage: mknod [OPTIONS] NAME TYPE MAJOR MINOR
749 985
750Make block or character special files. 986Create a special file (block, character, or pipe).
751 987
752TYPEs include: 988Options:
989 -m create the special file using the specified mode (default a=rw)
753 990
754 b: Make a block (buffered) device. 991TYPEs include:
755 c or u: Make a character (un-buffered) device. 992 b: Make a block (buffered) device.
756 p: Make a named pipe. Major and minor are ignored for named pipes. 993 c or u: Make a character (un-buffered) device.
994 p: Make a named pipe. MAJOR and MINOR are ignored for named pipes.
757 995
758Example: 996Example:
759 997
760 $ mknod /dev/fd0 b 2 0 998 $ mknod /dev/fd0 b 2 0
999 $ mknod -m 644 /tmp/pipe p
761 1000
762------------------------------- 1001-------------------------------
763 1002
@@ -778,6 +1017,21 @@ Options:
778 1017
779=item mnc 1018=item mnc
780 1019
1020Usage: mnc [IP] [port]
1021
1022mini-netcat opens a pipe to IP:port
1023
1024Example:
1025
1026 $ mnc foobar.somedomain.com 25
1027 220 foobar ESMTP Exim 3.12 #1 Sat, 15 Apr 2000 00:03:02 -0600
1028 help
1029 214-Commands supported:
1030 214- HELO EHLO MAIL RCPT DATA AUTH
1031 214 NOOP QUIT RSET HELP
1032 quit
1033 221 foobar closing connection
1034
781------------------------------- 1035-------------------------------
782 1036
783=item more 1037=item more
@@ -830,6 +1084,10 @@ Example:
830 1084
831=item mt 1085=item mt
832 1086
1087Usage: mt [-f device] opcode value
1088
1089Control magnetic tape drive operation
1090
833------------------------------- 1091-------------------------------
834 1092
835=item mv 1093=item mv
@@ -848,9 +1106,18 @@ Example:
848 1106
849=item nslookup 1107=item nslookup
850 1108
851------------------------------- 1109Usage: nslookup [HOST]
852 1110
853=item poweroff 1111Queries the nameserver for the IP address of the given HOST
1112
1113Example:
1114
1115 $ nslookup localhost
1116 Server: default
1117 Address: default
1118
1119 Name: debian
1120 Address: 127.0.0.1
854 1121
855------------------------------- 1122-------------------------------
856 1123
@@ -877,116 +1144,478 @@ Example:
877 1144
878------------------------------- 1145-------------------------------
879 1146
1147=item poweroff
1148
1149Shuts down the system, and requests that the kernel turn off power upon halting.
1150
1151-------------------------------
1152
880=item printf 1153=item printf
881 1154
1155Usage: printf format [argument...]
1156
1157Formats and prints the given data in a manner similar to the C printf command.
1158
1159Example:
1160
1161 $ printf "Val=%d\n" 5
1162 Val=5
1163
882------------------------------- 1164-------------------------------
883 1165
884=item ps 1166=item ps
885 1167
1168Usage: ps
1169
1170Report process status
1171
1172This version of ps accepts no options.
1173
1174Example:
1175
1176 $ ps
1177 PID Uid Gid State Command
1178 1 root root S init
1179 2 root root S [kflushd]
1180 3 root root S [kupdate]
1181 4 root root S [kpiod]
1182 5 root root S [kswapd]
1183 742 andersen andersen S [bash]
1184 743 andersen andersen S -bash
1185 745 root root S [getty]
1186 2990 andersen andersen R ps
1187
886------------------------------- 1188-------------------------------
887 1189
888=item pwd 1190=item pwd
889 1191
1192Prints the full filename of the current working directory.
1193
1194Example:
1195
1196 $ pwd
1197 /root
1198
890------------------------------- 1199-------------------------------
891 1200
892=item reboot 1201=item reboot
893 1202
1203Instructs the kernel to reboot the system.
1204
894------------------------------- 1205-------------------------------
895 1206
896=item rm 1207=item rm
897 1208
1209Usage: rm [OPTION]... FILE...
1210
1211Remove (unlink) the FILE(s).
1212
1213Options:
1214
1215 -f remove existing destinations, never prompt
1216 -r or -R remove the contents of directories recursively
1217
1218Example:
1219
1220 $ rm -rf /tmp/foo
1221
898------------------------------- 1222-------------------------------
899 1223
900=item syslogd 1224=item rmdir
1225
1226Usage: rmdir [OPTION]... DIRECTORY...
1227
1228Remove the DIRECTORY(ies), if they are empty.
1229
1230Example:
1231
1232 # rmdir /tmp/foo
901 1233
902------------------------------- 1234-------------------------------
903 1235
904=item logger 1236=item rmmod
1237
1238Usage: rmmod [OPTION]... [MODULE]...
1239
1240Unloads the specified kernel modules from the kernel.
1241
1242Options:
1243
1244 -a Try to remove all unused kernel modules.
1245
1246Example:
1247
1248 $ rmmod tulip
905 1249
906------------------------------- 1250-------------------------------
907 1251
908=item logname 1252=item sed
1253
1254Usage: sed [-n] -e script [file...]
1255
1256Allowed sed scripts come in the following form:
1257
1258 'ADDR [!] COMMAND'
1259
1260 where address ADDR can be:
1261 NUMBER Match specified line number
1262 $ Match last line
1263 /REGEXP/ Match specified regexp
1264 (! inverts the meaning of the match)
1265
1266 and COMMAND can be:
1267 s/regexp/replacement/[igp]
1268 which attempt to match regexp against the pattern space
1269 and if successful replaces the matched portion with replacement.
1270
1271 aTEXT
1272 which appends TEXT after the pattern space
1273
1274Options:
1275
1276 -e add the script to the commands to be executed
1277 -n suppress automatic printing of pattern space
1278
1279This version of sed matches full regular expresions.
1280
1281Example:
1282
1283 $ echo "foo" | sed -e 's/f[a-zA-Z]o/bar/g'
1284 bar
1285
1286-------------------------------
1287
1288=item sh
1289
1290FIXME
1291
1292-------------------------------
1293
1294=item sfdisk
1295
1296Usage: sfdisk [options] device ...
1297
1298device: something like /dev/hda or /dev/sda
1299
1300useful options:
1301
1302 -s [or --show-size]: list size of a partition
1303 -c [or --id]: print or change partition Id
1304 -l [or --list]: list partitions of each device
1305 -d [or --dump]: idem, but in a format suitable for later input
1306 -i [or --increment]: number cylinders etc. from 1 instead of from 0
1307 -uS, -uB, -uC, -uM: accept/report in units of sectors/blocks/cylinders/MB
1308 -T [or --list-types]:list the known partition types
1309 -D [or --DOS]: for DOS-compatibility: waste a little space
1310 -R [or --re-read]: make kernel reread partition table
1311 -N# : change only the partition with number #
1312 -n : do not actually write to disk
1313 -O file : save the sectors that will be overwritten to file
1314 -I file : restore these sectors again
1315 -v [or --version]: print version
1316 -? [or --help]: print this message
1317
1318dangerous options:
1319
1320 -g [or --show-geometry]: print the kernel's idea of the geometry
1321 -x [or --show-extended]: also list extended partitions on output
1322
1323 or expect descriptors for them on input
1324 -L [or --Linux]: do not complain about things irrelevant for Linux
1325 -q [or --quiet]: suppress warning messages
1326 You can override the detected geometry using:
1327 -C# [or --cylinders #]:set the number of cylinders to use
1328 -H# [or --heads #]: set the number of heads to use
1329 -S# [or --sectors #]: set the number of sectors to use
1330
1331You can disable all consistency checking with:
1332
1333 -f [or --force]: do what I say, even if it is stupid
1334
1335-------------------------------
1336
1337=item sleep
1338
1339Usage: sleep N
1340
1341Pause for N seconds.
1342
1343Example:
1344
1345 $ sleep 2
1346 [2 second delay results]
1347
1348-------------------------------
1349
1350=item sort
1351
1352Usage: sort [-n] [-r] [FILE]...
1353
1354Sorts lines of text in the specified files
1355
1356Example:
1357
1358 $ echo -e "e\nf\nb\nd\nc\na" | sort
1359 a
1360 b
1361 c
1362 d
1363 e
1364 f
1365
1366-------------------------------
1367
1368=item sync
1369
1370Usage: sync
1371
1372Write all buffered filesystem blocks to disk.
1373
1374-------------------------------
1375
1376=item syslogd
1377
1378Usage: syslogd [OPTION]...
1379
1380Linux system and kernel (provides klogd) logging utility.
1381Note that this version of syslogd/klogd ignores /etc/syslog.conf.
1382
1383Options:
1384
1385 -m Change the mark timestamp interval. default=20min. 0=off
1386 -n Do not fork into the background (for when run by init)
1387 -K Do not start up the klogd process (by default syslogd spawns klogd).
1388 -O Specify an alternate log file. default=/var/log/messages
909 1389
910------------------------------- 1390-------------------------------
911 1391
912=item swapon 1392=item swapon
913 1393
1394Usage: swapon [OPTION] [device]
1395
1396Start swapping virtual memory pages on the given device.
1397
1398Options:
1399
1400 -a Start swapping on all swap devices
1401
914------------------------------- 1402-------------------------------
915 1403
916=item swapoff 1404=item swapoff
917 1405
1406Usage: swapoff [OPTION] [device]
1407
1408Stop swapping virtual memory pages on the given device.
1409
1410Options:
1411
1412 -a Stop swapping on all swap devices
1413
918------------------------------- 1414-------------------------------
919 1415
920=item tail 1416=item tail
921 1417
1418Usage: tail [OPTION] [FILE]...
1419
1420Print last 10 lines of each FILE to standard output.
1421With more than one FILE, precede each with a header giving the
1422file name. With no FILE, or when FILE is -, read standard input.
1423
1424Options:
1425
1426 -n NUM Print last NUM lines instead of first 10
1427 -f Output data as the file grows. This version
1428 of 'tail -f' supports only one file at a time.
1429
1430Example:
1431
1432 $ tail -n 1 /etc/resolv.conf
1433 nameserver 10.0.0.1
1434
922------------------------------- 1435-------------------------------
923 1436
924=item tar 1437=item tar
925 1438
1439Usage: tar -[cxtvO] [--exclude File] [-f tarFile] [FILE] ...
1440
1441Create, extract, or list files from a tar file. Note that
1442this version of tar treats hard links as separate files.
1443
1444Main operation mode:
1445
1446 c create
1447 x extract
1448 t list
1449
1450File selection:
1451
1452 f name of tarfile or "-" for stdin
1453 O extract to stdout
1454 --exclude file to exclude
1455
1456Informative output:
1457
1458 v verbosely list files processed
1459
1460Example:
1461
1462 $ zcat /tmp/tarball.tar.gz | tar -xf -
1463 $ tar -cf /tmp/tarball.tar /usr/local
1464
926------------------------------- 1465-------------------------------
927 1466
928=item test, [ 1467=item test, [
929 1468
1469Usage: test EXPRESSION
1470or [ EXPRESSION ]
1471
1472Checks file types and compares values returning an exit
1473code determined by the value of EXPRESSION.
1474
1475Example:
1476
1477 $ test 1 -eq 2
1478 $ echo $?
1479 1
1480 $ test 1 -eq 1
1481 $ echo $?
1482 0
1483 $ [ -d /etc ]
1484 $ echo $?
1485 0
1486 $ [ -d /junk ]
1487 $ echo $?
1488 1
1489
930------------------------------- 1490-------------------------------
931 1491
932=item tee 1492=item tee
933 1493
1494Usage: tee [OPTION]... [FILE]...
1495
1496Copy standard input to each FILE, and also to standard output.
1497
1498Options:
1499
1500 -a append to the given FILEs, do not overwrite
1501
1502Example:
1503
1504 $ echo "Hello" | tee /tmp/foo
1505 $ cat /tmp/foo
1506 Hello
1507
934------------------------------- 1508-------------------------------
935 1509
936=item touch 1510=item touch
937 1511
1512Usage: touch [-c] file [file ...]
1513
1514Update the last-modified date on (or create) the selected file[s].
1515
1516Example:
1517
1518 $ ls -l /tmp/foo
1519 /bin/ls: /tmp/foo: No such file or directory
1520 $ touch /tmp/foo
1521 $ ls -l /tmp/foo
1522 -rw-rw-r-- 1 andersen andersen 0 Apr 15 01:11 /tmp/foo
1523
938------------------------------- 1524-------------------------------
939 1525
940=item tr 1526=item tr
941 1527
1528Usage: tr [-csu] string1 string2
1529 tr [-cu] -d string1
1530 tr [-cu] -s string1
1531 tr [-cu] -ds string1 string2
1532
1533Translate, squeeze, and/or delete characters from standard
1534input, writing to standard output.
1535
1536Example:
1537
1538 $ echo "gdkkn vnqkc" | tr [a-y] [b-z]
1539 hello world
1540
942------------------------------- 1541-------------------------------
943 1542
944=item true 1543=item true
945 1544
1545Returns an exit code of TRUE (0)
1546
1547Example:
1548
1549 $ true
1550 $ echo $?
1551 0
1552
946------------------------------- 1553-------------------------------
947 1554
948=item tty 1555=item tty
949 1556
1557FIXME
1558
950------------------------------- 1559-------------------------------
951 1560
952=item umount 1561=item umount
953 1562
1563FIXME
1564
954------------------------------- 1565-------------------------------
955 1566
956=item uname 1567=item uname
957 1568
958------------------------------- 1569FIXME
959
960=item uptime
961 1570
962------------------------------- 1571-------------------------------
963 1572
964=item uniq 1573=item uniq
965 1574
1575FIXME
1576
966------------------------------- 1577-------------------------------
967 1578
968=item update 1579=item update
969 1580
1581FIXME
1582
1583-------------------------------
1584
1585=item uptime
1586
1587FIXME
1588
970------------------------------- 1589-------------------------------
971 1590
972=item usleep 1591=item usleep
973 1592
1593FIXME
1594
974------------------------------- 1595-------------------------------
975 1596
976=item wc 1597=item wc
977 1598
1599FIXME
1600
978------------------------------- 1601-------------------------------
979 1602
980=item whoami 1603=item whoami
981 1604
1605FIXME
1606
982------------------------------- 1607-------------------------------
983 1608
984=item yes 1609=item yes
985 1610
1611FIXME
1612
986------------------------------- 1613-------------------------------
987 1614
988=item zcat 1615=item zcat
989 1616
1617FIXME
1618
990------------------------------- 1619-------------------------------
991 1620
992=back 1621=back
@@ -1046,4 +1675,4 @@ Enrique Zanardi <ezanardi@ull.es>
1046 1675
1047=cut 1676=cut
1048 1677
1049# $Id: busybox.pod,v 1.9 2000/04/13 23:44:04 beppu Exp $ 1678# $Id: busybox.pod,v 1.10 2000/04/15 16:34:54 erik Exp $
diff --git a/gzip.c b/gzip.c
index 55ec5bc4e..a9d34aeb1 100644
--- a/gzip.c
+++ b/gzip.c
@@ -41,7 +41,7 @@
41static const char gzip_usage[] = 41static const char gzip_usage[] =
42 "gzip [OPTION]... FILE\n\n" 42 "gzip [OPTION]... FILE\n\n"
43 "Compress FILE with maximum compression.\n" 43 "Compress FILE with maximum compression.\n"
44 "When FILE is -, reads standard input. Implies -c.\n\n" 44 "When FILE is '-', reads standard input. Implies -c.\n\n"
45 45
46 "Options:\n" 46 "Options:\n"
47 "\t-c\tWrite output to standard output instead of FILE.gz\n"; 47 "\t-c\tWrite output to standard output instead of FILE.gz\n";
diff --git a/makedevs.c b/makedevs.c
index 5948bacc8..c8206e020 100644
--- a/makedevs.c
+++ b/makedevs.c
@@ -17,10 +17,18 @@
17#include <sys/stat.h> 17#include <sys/stat.h>
18 18
19static const char makedevs_usage[] = 19static const char makedevs_usage[] =
20 "makedevs 0.01 -- Create an entire range of device files\n\n" 20 "makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]\n\n"
21 "\tmakedevs /dev/ttyS c 4 64 0 63 (ttyS0-ttyS63)\n" 21 "Creates a range of block or character special files\n\n"
22 22 "TYPEs include:\n"
23 "\tmakedevs /dev/hda b 3 0 0 8 s (hda,hda1-hda8)\n"; 23 "\tb:\tMake a block (buffered) device.\n"
24 "\tc or u:\tMake a character (un-buffered) device.\n"
25 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes.\n\n"
26 "FIRST specifies the number appended to NAME to create the first device.\n"
27 "LAST specifies the number of the last item that should be created.\n"
28 "If 's' is the last argument, the base device is created as well.\n\n"
29 "For example:\n"
30 "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n"
31 "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8\n";
24 32
25int makedevs_main(int argc, char **argv) 33int makedevs_main(int argc, char **argv)
26{ 34{
@@ -38,6 +46,9 @@ int makedevs_main(int argc, char **argv)
38 char devname[255]; 46 char devname[255];
39 char buf[255]; 47 char buf[255];
40 48
49 if (argc < 7 || *argv[1]=='-')
50 usage(makedevs_usage);
51
41 switch (type[0]) { 52 switch (type[0]) {
42 case 'c': 53 case 'c':
43 mode = S_IFCHR; 54 mode = S_IFCHR;
diff --git a/math.c b/math.c
index 75b4cdeb5..3b459f62e 100644
--- a/math.c
+++ b/math.c
@@ -7,7 +7,10 @@
7 7
8/* Tiny RPN calculator, because "expr" didn't give me bitwise operations. */ 8/* Tiny RPN calculator, because "expr" didn't give me bitwise operations. */
9 9
10static const char math_usage[] = "math expression ..."; 10static const char math_usage[] = "math expression ...\n\n"
11 "This is a Tiny RPN calculator that understands the\n"
12 "following operations: +, -, /, *, and, or, not, eor.\n"
13 "i.e. 'math 2 2 add' -> 4, and 'math 8 8 \\* 2 2 + /' -> 16\n";
11 14
12static double stack[100]; 15static double stack[100];
13static unsigned int pointer; 16static unsigned int pointer;
@@ -85,14 +88,14 @@ struct op {
85}; 88};
86 89
87static const struct op operators[] = { 90static const struct op operators[] = {
88 {"add", add}, 91 {"+", add},
92 {"-", sub},
93 {"*", mul},
94 {"/", divide},
89 {"and", and}, 95 {"and", and},
90 {"div", divide},
91 {"eor", eor},
92 {"mul", mul},
93 {"not", not},
94 {"or", or}, 96 {"or", or},
95 {"sub", sub}, 97 {"not", not},
98 {"eor", eor},
96 {0, 0} 99 {0, 0}
97}; 100};
98 101
@@ -127,11 +130,13 @@ static void stack_machine(const char *argument)
127 130
128int math_main(int argc, char **argv) 131int math_main(int argc, char **argv)
129{ 132{
133 if (argc < 1 || *argv[1]=='-')
134 usage(math_usage);
130 while (argc >= 2) { 135 while (argc >= 2) {
131 stack_machine(argv[1]); 136 stack_machine(argv[1]);
132 argv++; 137 argv++;
133 argc--; 138 argc--;
134 } 139 }
135 stack_machine(0); 140 stack_machine(0);
136 return 0; 141 exit( TRUE);
137} 142}
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index 5948bacc8..c8206e020 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -17,10 +17,18 @@
17#include <sys/stat.h> 17#include <sys/stat.h>
18 18
19static const char makedevs_usage[] = 19static const char makedevs_usage[] =
20 "makedevs 0.01 -- Create an entire range of device files\n\n" 20 "makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]\n\n"
21 "\tmakedevs /dev/ttyS c 4 64 0 63 (ttyS0-ttyS63)\n" 21 "Creates a range of block or character special files\n\n"
22 22 "TYPEs include:\n"
23 "\tmakedevs /dev/hda b 3 0 0 8 s (hda,hda1-hda8)\n"; 23 "\tb:\tMake a block (buffered) device.\n"
24 "\tc or u:\tMake a character (un-buffered) device.\n"
25 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes.\n\n"
26 "FIRST specifies the number appended to NAME to create the first device.\n"
27 "LAST specifies the number of the last item that should be created.\n"
28 "If 's' is the last argument, the base device is created as well.\n\n"
29 "For example:\n"
30 "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n"
31 "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8\n";
24 32
25int makedevs_main(int argc, char **argv) 33int makedevs_main(int argc, char **argv)
26{ 34{
@@ -38,6 +46,9 @@ int makedevs_main(int argc, char **argv)
38 char devname[255]; 46 char devname[255];
39 char buf[255]; 47 char buf[255];
40 48
49 if (argc < 7 || *argv[1]=='-')
50 usage(makedevs_usage);
51
41 switch (type[0]) { 52 switch (type[0]) {
42 case 'c': 53 case 'c':
43 mode = S_IFCHR; 54 mode = S_IFCHR;
diff --git a/miscutils/mt.c b/miscutils/mt.c
index 9791b64b2..cf20d1711 100644
--- a/miscutils/mt.c
+++ b/miscutils/mt.c
@@ -4,7 +4,8 @@
4#include <sys/mtio.h> 4#include <sys/mtio.h>
5#include <sys/fcntl.h> 5#include <sys/fcntl.h>
6 6
7static const char mt_usage[] = "mt [-f device] opcode value\n"; 7static const char mt_usage[] = "mt [-f device] opcode value\n\n"
8 "Control magnetic tape drive operation\n";
8 9
9struct mt_opcodes { 10struct mt_opcodes {
10 char *name; 11 char *name;
@@ -56,6 +57,10 @@ extern int mt_main(int argc, char **argv)
56 const struct mt_opcodes *code = opcodes; 57 const struct mt_opcodes *code = opcodes;
57 struct mtop op; 58 struct mtop op;
58 int fd; 59 int fd;
60
61 if ((argc != 2 && argc != 3) || **(argv + 1) == '-') {
62 usage(mt_usage);
63 }
59 64
60 if (strcmp(argv[1], "-f") == 0) { 65 if (strcmp(argv[1], "-f") == 0) {
61 if (argc < 4) { 66 if (argc < 4) {
@@ -74,7 +79,7 @@ extern int mt_main(int argc, char **argv)
74 79
75 if (code->name == 0) { 80 if (code->name == 0) {
76 fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]); 81 fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]);
77 return (FALSE); 82 exit (FALSE);
78 } 83 }
79 84
80 op.mt_op = code->value; 85 op.mt_op = code->value;
@@ -85,13 +90,13 @@ extern int mt_main(int argc, char **argv)
85 90
86 if ((fd = open(file, O_RDONLY, 0)) < 0) { 91 if ((fd = open(file, O_RDONLY, 0)) < 0) {
87 perror(file); 92 perror(file);
88 return (FALSE); 93 exit (FALSE);
89 } 94 }
90 95
91 if (ioctl(fd, MTIOCTOP, &op) != 0) { 96 if (ioctl(fd, MTIOCTOP, &op) != 0) {
92 perror(file); 97 perror(file);
93 return (FALSE); 98 exit (FALSE);
94 } 99 }
95 100
96 return (TRUE); 101 exit (TRUE);
97} 102}
diff --git a/mkfifo.c b/mkfifo.c
index c74402d4c..b273df046 100644
--- a/mkfifo.c
+++ b/mkfifo.c
@@ -27,10 +27,10 @@
27#include <errno.h> 27#include <errno.h>
28 28
29static const char mkfifo_usage[] = "mkfifo [OPTIONS] name\n\n" 29static const char mkfifo_usage[] = "mkfifo [OPTIONS] name\n\n"
30 "Create the named fifo\n\n" 30 "Creates a named pipe (identical to 'mknod name p')\n\n"
31 31
32 "Options:\n" 32 "Options:\n"
33 "\t-m\tcreate the fifo with the specified mode; default = a=rw-umask\n"; 33 "\t-m\tcreate the pipe using the specified mode (default a=rw)\n";
34 34
35extern int mkfifo_main(int argc, char **argv) 35extern int mkfifo_main(int argc, char **argv)
36{ 36{
diff --git a/mknod.c b/mknod.c
index 40f508d33..0c93df64d 100644
--- a/mknod.c
+++ b/mknod.c
@@ -28,23 +28,47 @@
28#include <fcntl.h> 28#include <fcntl.h>
29#include <unistd.h> 29#include <unistd.h>
30 30
31static const char mknod_usage[] = "mknod NAME TYPE MAJOR MINOR\n\n" 31static const char mknod_usage[] = "mknod [OPTIONS] NAME TYPE MAJOR MINOR\n\n"
32 "Make block or character special files.\n\n" 32 "Create a special file (block, character, or pipe).\n\n"
33 "Options:\n"
34 "\t-m\tcreate the special file using the specified mode (default a=rw)\n\n"
33 "TYPEs include:\n" 35 "TYPEs include:\n"
34 "\tb:\tMake a block (buffered) device.\n" 36 "\tb:\tMake a block (buffered) device.\n"
35
36 "\tc or u:\tMake a character (un-buffered) device.\n" 37 "\tc or u:\tMake a character (un-buffered) device.\n"
37 "\tp:\tMake a named pipe. Major and minor are ignored for named pipes.\n"; 38 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes.\n";
38 39
39int mknod_main(int argc, char **argv) 40int mknod_main(int argc, char **argv)
40{ 41{
42 char *thisarg;
41 mode_t mode = 0; 43 mode_t mode = 0;
44 mode_t perm = 0666;
42 dev_t dev = 0; 45 dev_t dev = 0;
43 46
44 if (argc != 5 || **(argv + 1) == '-') { 47 argc--;
48 argv++;
49
50 /* Parse any options */
51 while (argc > 1) {
52 if (**argv != '-')
53 break;
54 thisarg = *argv;
55 thisarg++;
56 switch (*thisarg) {
57 case 'm':
58 argc--;
59 argv++;
60 parse_mode(*argv, &perm);
61 break;
62 default:
63 usage(mknod_usage);
64 }
65 argc--;
66 argv++;
67 }
68 if (argc != 4 && argc != 2) {
45 usage(mknod_usage); 69 usage(mknod_usage);
46 } 70 }
47 switch (argv[2][0]) { 71 switch (argv[1][0]) {
48 case 'c': 72 case 'c':
49 case 'u': 73 case 'u':
50 mode = S_IFCHR; 74 mode = S_IFCHR;
@@ -54,23 +78,22 @@ int mknod_main(int argc, char **argv)
54 break; 78 break;
55 case 'p': 79 case 'p':
56 mode = S_IFIFO; 80 mode = S_IFIFO;
81 if (argc!=2) {
82 usage(mknod_usage);
83 }
57 break; 84 break;
58 default: 85 default:
59 usage(mknod_usage); 86 usage(mknod_usage);
60 } 87 }
61 88
62 if (mode == S_IFCHR || mode == S_IFBLK) { 89 if (mode == S_IFCHR || mode == S_IFBLK) {
63 dev = (atoi(argv[3]) << 8) | atoi(argv[4]); 90 dev = (atoi(argv[2]) << 8) | atoi(argv[1]);
64 if (argc != 5) {
65 usage(mknod_usage);
66 }
67 } 91 }
68 92
69 mode |= 0666; 93 mode |= perm;
70 94
71 if (mknod(argv[1], mode, dev) != 0) { 95 if (mknod(argv[0], mode, dev) != 0)
72 perror(argv[1]); 96 fatalError("%s: %s\n", argv[0], strerror(errno));
73 exit (FALSE);
74 }
75 exit (TRUE); 97 exit (TRUE);
76} 98}
99
diff --git a/mnc.c b/mnc.c
index 54cfdc602..60c18a91a 100644
--- a/mnc.c
+++ b/mnc.c
@@ -56,11 +56,11 @@ int mnc_main(int argc, char **argv)
56 56
57 fd_set readfds, testfds; 57 fd_set readfds, testfds;
58 58
59 if (argc <= 1 || **(argv + 1) == '-') {
60 usage(mnc_usage);
61 }
62 argc--; 59 argc--;
63 argv++; 60 argv++;
61 if (argc < 2 || **(argv + 1) == '-') {
62 usage(mnc_usage);
63 }
64 64
65 sfd = socket(AF_INET, SOCK_STREAM, 0); 65 sfd = socket(AF_INET, SOCK_STREAM, 0);
66 66
diff --git a/mt.c b/mt.c
index 9791b64b2..cf20d1711 100644
--- a/mt.c
+++ b/mt.c
@@ -4,7 +4,8 @@
4#include <sys/mtio.h> 4#include <sys/mtio.h>
5#include <sys/fcntl.h> 5#include <sys/fcntl.h>
6 6
7static const char mt_usage[] = "mt [-f device] opcode value\n"; 7static const char mt_usage[] = "mt [-f device] opcode value\n\n"
8 "Control magnetic tape drive operation\n";
8 9
9struct mt_opcodes { 10struct mt_opcodes {
10 char *name; 11 char *name;
@@ -56,6 +57,10 @@ extern int mt_main(int argc, char **argv)
56 const struct mt_opcodes *code = opcodes; 57 const struct mt_opcodes *code = opcodes;
57 struct mtop op; 58 struct mtop op;
58 int fd; 59 int fd;
60
61 if ((argc != 2 && argc != 3) || **(argv + 1) == '-') {
62 usage(mt_usage);
63 }
59 64
60 if (strcmp(argv[1], "-f") == 0) { 65 if (strcmp(argv[1], "-f") == 0) {
61 if (argc < 4) { 66 if (argc < 4) {
@@ -74,7 +79,7 @@ extern int mt_main(int argc, char **argv)
74 79
75 if (code->name == 0) { 80 if (code->name == 0) {
76 fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]); 81 fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]);
77 return (FALSE); 82 exit (FALSE);
78 } 83 }
79 84
80 op.mt_op = code->value; 85 op.mt_op = code->value;
@@ -85,13 +90,13 @@ extern int mt_main(int argc, char **argv)
85 90
86 if ((fd = open(file, O_RDONLY, 0)) < 0) { 91 if ((fd = open(file, O_RDONLY, 0)) < 0) {
87 perror(file); 92 perror(file);
88 return (FALSE); 93 exit (FALSE);
89 } 94 }
90 95
91 if (ioctl(fd, MTIOCTOP, &op) != 0) { 96 if (ioctl(fd, MTIOCTOP, &op) != 0) {
92 perror(file); 97 perror(file);
93 return (FALSE); 98 exit (FALSE);
94 } 99 }
95 100
96 return (TRUE); 101 exit (TRUE);
97} 102}
diff --git a/networking/nslookup.c b/networking/nslookup.c
index 15019e935..3223b3b63 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -41,7 +41,7 @@
41 | + find out how the real nslookup gets the default name server 41 | + find out how the real nslookup gets the default name server
42 */ 42 */
43 43
44static const char nslookup_usage[] = "nslookup [HOST]\n\n"; 44static const char nslookup_usage[] = "nslookup [HOST]\n\nQueries the nameserver for the IP address of the given HOST\n";
45 45
46 46
47/* I have to see how the real nslookup does this. 47/* I have to see how the real nslookup does this.
@@ -50,8 +50,8 @@ static const char nslookup_usage[] = "nslookup [HOST]\n\n";
50 */ 50 */
51static void server_fprint(FILE * dst) 51static void server_fprint(FILE * dst)
52{ 52{
53 fprintf(dst, "Server: %s\n", "something"); 53 fprintf(dst, "Server: %s\n", "default");
54 fprintf(dst, "Address: %s\n\n", "something"); 54 fprintf(dst, "Address: %s\n\n", "default");
55} 55}
56 56
57/* only works for IPv4 */ 57/* only works for IPv4 */
@@ -96,9 +96,9 @@ static int addr_list_fprint(char **h_addr_list, FILE * dst)
96{ 96{
97 int i, j; 97 int i, j;
98 char *addr_string = (h_addr_list[1]) 98 char *addr_string = (h_addr_list[1])
99 ? "Addresses" : "Address"; 99 ? "Addresses: " : "Address: ";
100 100
101 fprintf(dst, "%s: ", addr_string); 101 fprintf(dst, "%s ", addr_string);
102 for (i = 0, j = 0; h_addr_list[i]; i++, j++) { 102 for (i = 0, j = 0; h_addr_list[i]; i++, j++) {
103 addr_fprint(h_addr_list[i], dst); 103 addr_fprint(h_addr_list[i], dst);
104 104
@@ -132,7 +132,7 @@ static struct hostent *gethostbyaddr_wrapper(const char *address)
132static struct hostent *hostent_fprint(struct hostent *host, FILE * dst) 132static struct hostent *hostent_fprint(struct hostent *host, FILE * dst)
133{ 133{
134 if (host) { 134 if (host) {
135 fprintf(dst, "Name: %s\n", host->h_name); 135 fprintf(dst, "Name: %s\n", host->h_name);
136 addr_list_fprint(host->h_addr_list, dst); 136 addr_list_fprint(host->h_addr_list, dst);
137 } else { 137 } else {
138 fprintf(dst, "*** %s\n", hstrerror(h_errno)); 138 fprintf(dst, "*** %s\n", hstrerror(h_errno));
@@ -159,7 +159,7 @@ int nslookup_main(int argc, char **argv)
159{ 159{
160 struct hostent *host; 160 struct hostent *host;
161 161
162 if (argc < 2) { 162 if (argc < 2 || *argv[1]=='-') {
163 usage(nslookup_usage); 163 usage(nslookup_usage);
164 } 164 }
165 165
@@ -170,7 +170,7 @@ int nslookup_main(int argc, char **argv)
170 host = gethostbyname(argv[1]); 170 host = gethostbyname(argv[1]);
171 } 171 }
172 hostent_fprint(host, stdout); 172 hostent_fprint(host, stdout);
173 return 0; 173 exit( TRUE);
174} 174}
175 175
176/* $Id: nslookup.c,v 1.6 2000/04/13 01:18:56 erik Exp $ */ 176/* $Id: nslookup.c,v 1.7 2000/04/15 16:34:54 erik Exp $ */
diff --git a/nslookup.c b/nslookup.c
index 15019e935..3223b3b63 100644
--- a/nslookup.c
+++ b/nslookup.c
@@ -41,7 +41,7 @@
41 | + find out how the real nslookup gets the default name server 41 | + find out how the real nslookup gets the default name server
42 */ 42 */
43 43
44static const char nslookup_usage[] = "nslookup [HOST]\n\n"; 44static const char nslookup_usage[] = "nslookup [HOST]\n\nQueries the nameserver for the IP address of the given HOST\n";
45 45
46 46
47/* I have to see how the real nslookup does this. 47/* I have to see how the real nslookup does this.
@@ -50,8 +50,8 @@ static const char nslookup_usage[] = "nslookup [HOST]\n\n";
50 */ 50 */
51static void server_fprint(FILE * dst) 51static void server_fprint(FILE * dst)
52{ 52{
53 fprintf(dst, "Server: %s\n", "something"); 53 fprintf(dst, "Server: %s\n", "default");
54 fprintf(dst, "Address: %s\n\n", "something"); 54 fprintf(dst, "Address: %s\n\n", "default");
55} 55}
56 56
57/* only works for IPv4 */ 57/* only works for IPv4 */
@@ -96,9 +96,9 @@ static int addr_list_fprint(char **h_addr_list, FILE * dst)
96{ 96{
97 int i, j; 97 int i, j;
98 char *addr_string = (h_addr_list[1]) 98 char *addr_string = (h_addr_list[1])
99 ? "Addresses" : "Address"; 99 ? "Addresses: " : "Address: ";
100 100
101 fprintf(dst, "%s: ", addr_string); 101 fprintf(dst, "%s ", addr_string);
102 for (i = 0, j = 0; h_addr_list[i]; i++, j++) { 102 for (i = 0, j = 0; h_addr_list[i]; i++, j++) {
103 addr_fprint(h_addr_list[i], dst); 103 addr_fprint(h_addr_list[i], dst);
104 104
@@ -132,7 +132,7 @@ static struct hostent *gethostbyaddr_wrapper(const char *address)
132static struct hostent *hostent_fprint(struct hostent *host, FILE * dst) 132static struct hostent *hostent_fprint(struct hostent *host, FILE * dst)
133{ 133{
134 if (host) { 134 if (host) {
135 fprintf(dst, "Name: %s\n", host->h_name); 135 fprintf(dst, "Name: %s\n", host->h_name);
136 addr_list_fprint(host->h_addr_list, dst); 136 addr_list_fprint(host->h_addr_list, dst);
137 } else { 137 } else {
138 fprintf(dst, "*** %s\n", hstrerror(h_errno)); 138 fprintf(dst, "*** %s\n", hstrerror(h_errno));
@@ -159,7 +159,7 @@ int nslookup_main(int argc, char **argv)
159{ 159{
160 struct hostent *host; 160 struct hostent *host;
161 161
162 if (argc < 2) { 162 if (argc < 2 || *argv[1]=='-') {
163 usage(nslookup_usage); 163 usage(nslookup_usage);
164 } 164 }
165 165
@@ -170,7 +170,7 @@ int nslookup_main(int argc, char **argv)
170 host = gethostbyname(argv[1]); 170 host = gethostbyname(argv[1]);
171 } 171 }
172 hostent_fprint(host, stdout); 172 hostent_fprint(host, stdout);
173 return 0; 173 exit( TRUE);
174} 174}
175 175
176/* $Id: nslookup.c,v 1.6 2000/04/13 01:18:56 erik Exp $ */ 176/* $Id: nslookup.c,v 1.7 2000/04/15 16:34:54 erik Exp $ */
diff --git a/printf.c b/printf.c
index 41ab2e442..bfe408175 100644
--- a/printf.c
+++ b/printf.c
@@ -139,7 +139,7 @@ static void verify __P((char *s, char *end));
139/* The value to return to the calling program. */ 139/* The value to return to the calling program. */
140static int exit_status; 140static int exit_status;
141 141
142static const char printf_usage[] = "printf format [argument...]\n"; 142static const char printf_usage[] = "printf format [argument...]\n\nFormats and prints the given data.\n";
143 143
144int printf_main(int argc, char **argv) 144int printf_main(int argc, char **argv)
145{ 145{
diff --git a/sort.c b/sort.c
index 6ee6f207e..4301f4303 100644
--- a/sort.c
+++ b/sort.c
@@ -33,7 +33,7 @@ static const char sort_usage[] = "sort [-n]"
33#ifdef BB_FEATURE_SORT_REVERSE 33#ifdef BB_FEATURE_SORT_REVERSE
34" [-r]" 34" [-r]"
35#endif 35#endif
36" [FILE]...\n\n"; 36" [FILE]...\n\nSorts lines of text in the specified files\n";
37 37
38#ifdef BB_FEATURE_SORT_REVERSE 38#ifdef BB_FEATURE_SORT_REVERSE
39#define APPLY_REVERSE(x) (reverse ? -(x) : (x)) 39#define APPLY_REVERSE(x) (reverse ? -(x) : (x))
@@ -320,4 +320,4 @@ int sort_main(int argc, char **argv)
320 exit(0); 320 exit(0);
321} 321}
322 322
323/* $Id: sort.c,v 1.13 2000/04/13 01:18:56 erik Exp $ */ 323/* $Id: sort.c,v 1.14 2000/04/15 16:34:54 erik Exp $ */
diff --git a/test.c b/test.c
index 85d06a83a..0ed777194 100644
--- a/test.c
+++ b/test.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * echo implementation for busybox 3 * test implementation for busybox
4 * 4 *
5 * Copyright (c) by a whole pile of folks: 5 * Copyright (c) by a whole pile of folks:
6 * 6 *
@@ -185,6 +185,12 @@ test_main(int argc, char** argv)
185 fatalError("missing ]"); 185 fatalError("missing ]");
186 argv[argc] = NULL; 186 argv[argc] = NULL;
187 } 187 }
188 if (strcmp(argv[1], "--help") == 0) {
189 usage("test EXPRESSION\n"
190 "or [ EXPRESSION ]\n\n"
191 "Checks file types and compares values returning an exit\n"
192 "code determined by the value of EXPRESSION.\n");
193 }
188 194
189 /* Implement special cases from POSIX.2, section 4.62.4 */ 195 /* Implement special cases from POSIX.2, section 4.62.4 */
190 switch (argc) { 196 switch (argc) {
diff --git a/tr.c b/tr.c
index 3bfa48080..b631b0065 100644
--- a/tr.c
+++ b/tr.c
@@ -44,7 +44,7 @@ static char sccsid[] = "@(#)tr.c 8.2 (Berkeley) 5/4/95";
44#endif 44#endif
45static const char rcsid[] = 45static const char rcsid[] =
46 46
47 "$Id: tr.c,v 1.2 2000/03/21 22:32:57 erik Exp $"; 47 "$Id: tr.c,v 1.3 2000/04/15 16:34:54 erik Exp $";
48#endif /* not lint */ 48#endif /* not lint */
49#endif /* #if 0 */ 49#endif /* #if 0 */
50 50
@@ -138,12 +138,12 @@ int cflag;
138 138
139static void tr_usage() 139static void tr_usage()
140{ 140{
141 (void) fprintf(stderr, "%s\n%s\n%s\n%s\n", 141 usage( "\ttr [-csu] string1 string2\n"
142 "usage: tr [-csu] string1 string2", 142 "\ttr [-cu] -d string1\n"
143 " tr [-cu] -d string1", 143 "\ttr [-cu] -s string1\n"
144 " tr [-cu] -s string1", 144 "\ttr [-cu] -ds string1 string2\n\n"
145 " tr [-cu] -ds string1 string2"); 145 "Translate, squeeze, and/or delete characters from standard\n"
146 exit(1); 146 "input, writing to standard output.\n");
147} 147}
148 148
149 149