aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-04-13 18:49:43 +0000
committerErik Andersen <andersen@codepoet.org>2000-04-13 18:49:43 +0000
commit9cf3bfa7c1bf3ad959c61711c9a5ac1969149300 (patch)
tree61d03a8d473f2d253c80f5bb3acc13d488351250
parentb4f8606c05f8a256b515633e48df954ead1260ef (diff)
downloadbusybox-w32-9cf3bfa7c1bf3ad959c61711c9a5ac1969149300.tar.gz
busybox-w32-9cf3bfa7c1bf3ad959c61711c9a5ac1969149300.tar.bz2
busybox-w32-9cf3bfa7c1bf3ad959c61711c9a5ac1969149300.zip
More doc updates for BusyBox, with fixes to apps for bugs revealed
while trying to write docs . :-) -Erik
-rw-r--r--Changelog6
-rw-r--r--Makefile8
-rw-r--r--basename.c4
-rw-r--r--busybox.def.h2
-rw-r--r--coreutils/basename.c4
-rw-r--r--coreutils/dirname.c163
-rw-r--r--coreutils/echo.c11
-rw-r--r--coreutils/ls.c35
-rw-r--r--coreutils/mknod.c4
-rw-r--r--dirname.c163
-rw-r--r--docs/CommandList1025
-rw-r--r--docs/Makefile22
-rw-r--r--docs/busybox.pod711
-rw-r--r--dutmp.c7
-rw-r--r--echo.c11
-rw-r--r--fbset.c9
-rw-r--r--fdflush.c4
-rw-r--r--find.c6
-rw-r--r--findutils/find.c6
-rw-r--r--freeramdisk.c8
-rw-r--r--ls.c35
-rw-r--r--miscutils/dutmp.c7
-rw-r--r--mknod.c4
-rw-r--r--mount.c2
-rw-r--r--networking/ping.c12
-rw-r--r--ping.c12
-rw-r--r--util-linux/fbset.c9
-rw-r--r--util-linux/fdflush.c4
-rw-r--r--util-linux/freeramdisk.c8
-rw-r--r--util-linux/mount.c2
30 files changed, 663 insertions, 1641 deletions
diff --git a/Changelog b/Changelog
index 4227a7822..9496d5fbb 100644
--- a/Changelog
+++ b/Changelog
@@ -10,18 +10,18 @@
10 provides. To enable this, turn on BB_FEATURE_USE_DEVPS_PATCH and 10 provides. To enable this, turn on BB_FEATURE_USE_DEVPS_PATCH and
11 patch your kernel with the devps patch in the kernel-patches/ 11 patch your kernel with the devps patch in the kernel-patches/
12 directory. 12 directory.
13 * Wrote basename, killall, and uptime. 13 * Wrote basename, dirname, killall, and uptime.
14 * tar has been completely rewritten by me. Both tar creation and 14 * tar has been completely rewritten by me. Both tar creation and
15 extraction are now well behaved. Costs 7.6k with all optional 15 extraction are now well behaved. Costs 7.6k with all optional
16 tar features enabled, and 5k for just tar extraction support. 16 tar features enabled, and 5k for just tar extraction support.
17 * Added freeramdisk, which will free up all memory associated 17 * Added freeramdisk, which will free up all memory associated
18 with a ram disk. Contributed by Emanuele Caratti <wiz@iol.it> 18 with a ram disk. Contributed by Emanuele Caratti <wiz@iol.it>
19 and then adjusted a bit by me. 19 and then adjusted a bit by me.
20 * Added tr and dirname from John Lombardo <john@deltanet.com> 20 * Added tr from John Lombardo <john@deltanet.com>
21 * Added echo and test (from me). 21 * Added echo and test (from me).
22 * Added usleep contributed by Nicolas Pitre <nico@cam.org> 22 * Added usleep contributed by Nicolas Pitre <nico@cam.org>
23 * Several fixes from Pavel Roskin <pavel_roskin@geocities.com>: 23 * Several fixes from Pavel Roskin <pavel_roskin@geocities.com>:
24 - When `tail' fails to open a file it now exits. 24 - When `tail' fails to open a file it now exits.
25 - When `syslogd' is given the `-n' option it should still use 25 - When `syslogd' is given the `-n' option it should still use
26 fork() for running klogd. 26 fork() for running klogd.
27 * nslookup types are now changed to u_int32_t (instead of uint32_t) 27 * nslookup types are now changed to u_int32_t (instead of uint32_t)
diff --git a/Makefile b/Makefile
index 1f03754f9..e2d98549f 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,7 @@ BUILDTIME := $(shell TZ=UTC date --utc "+%Y.%m.%d-%H:%M%z")
25# Set the following to `true' to make a debuggable build. 25# Set the following to `true' to make a debuggable build.
26# Leave this set to `false' for production use. 26# Leave this set to `false' for production use.
27# eg: `make DODEBUG=true tests' 27# eg: `make DODEBUG=true tests'
28DODEBUG = false 28DODEBUG = true
29 29
30# If you want a static binary, turn this on. 30# If you want a static binary, turn this on.
31DOSTATIC = false 31DOSTATIC = false
@@ -94,7 +94,7 @@ ifdef BB_INIT_SCRIPT
94 CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"' 94 CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"'
95endif 95endif
96 96
97all: busybox busybox.links 97all: busybox busybox.links docs
98.PHONY: all 98.PHONY: all
99 99
100busybox: $(OBJECTS) 100busybox: $(OBJECTS)
@@ -104,6 +104,9 @@ busybox: $(OBJECTS)
104busybox.links: busybox.def.h 104busybox.links: busybox.def.h
105 - ./busybox.mkll | sort >$@ 105 - ./busybox.mkll | sort >$@
106 106
107docs: docs/busybox.pod
108 cd docs && $(MAKE) clean all
109
107regexp.o nfsmount.o: %.o: %.h 110regexp.o nfsmount.o: %.o: %.h
108$(OBJECTS): %.o: busybox.def.h internal.h %.c 111$(OBJECTS): %.o: busybox.def.h internal.h %.c
109 112
@@ -128,6 +131,7 @@ install: busybox busybox.links
128 131
129.PHONY: dist release 132.PHONY: dist release
130dist release: distclean 133dist release: distclean
134 cd docs && $(MAKE) clean all
131 cd ..; \ 135 cd ..; \
132 rm -rf busybox-$(VERSION); \ 136 rm -rf busybox-$(VERSION); \
133 cp -a busybox busybox-$(VERSION); \ 137 cp -a busybox busybox-$(VERSION); \
diff --git a/basename.c b/basename.c
index 06e27663f..5fe5e0f03 100644
--- a/basename.c
+++ b/basename.c
@@ -34,8 +34,10 @@ extern int basename_main(int argc, char **argv)
34 argv++; 34 argv++;
35 35
36 s1=*argv+strlen(*argv)-1; 36 s1=*argv+strlen(*argv)-1;
37 if (*s1 == '/') 37 while (s1 && *s1 == '/') {
38 *s1 = '\0'; 38 *s1 = '\0';
39 s1=*argv+strlen(*argv)-1;
40 }
39 s = strrchr(*argv, '/'); 41 s = strrchr(*argv, '/');
40 printf("%s\n", (s)? s + 1 : *argv); 42 printf("%s\n", (s)? s + 1 : *argv);
41 exit(TRUE); 43 exit(TRUE);
diff --git a/busybox.def.h b/busybox.def.h
index 647ed9ba4..1952dd377 100644
--- a/busybox.def.h
+++ b/busybox.def.h
@@ -194,7 +194,7 @@
194//#define BB_FEATURE_SH_TAB_COMPLETION 194//#define BB_FEATURE_SH_TAB_COMPLETION
195// 195//
196//Turn on extra fbset options 196//Turn on extra fbset options
197#define BB_FEATURE_FBSET_FANCY 197//#define BB_FEATURE_FBSET_FANCY
198// 198//
199// 199//
200// End of Features List 200// End of Features List
diff --git a/coreutils/basename.c b/coreutils/basename.c
index 06e27663f..5fe5e0f03 100644
--- a/coreutils/basename.c
+++ b/coreutils/basename.c
@@ -34,8 +34,10 @@ extern int basename_main(int argc, char **argv)
34 argv++; 34 argv++;
35 35
36 s1=*argv+strlen(*argv)-1; 36 s1=*argv+strlen(*argv)-1;
37 if (*s1 == '/') 37 while (s1 && *s1 == '/') {
38 *s1 = '\0'; 38 *s1 = '\0';
39 s1=*argv+strlen(*argv)-1;
40 }
39 s = strrchr(*argv, '/'); 41 s = strrchr(*argv, '/');
40 printf("%s\n", (s)? s + 1 : *argv); 42 printf("%s\n", (s)? s + 1 : *argv);
41 exit(TRUE); 43 exit(TRUE);
diff --git a/coreutils/dirname.c b/coreutils/dirname.c
index 77cb664ac..528b89a56 100644
--- a/coreutils/dirname.c
+++ b/coreutils/dirname.c
@@ -1,146 +1,45 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * This is temporary -- needs to be rewritten to be tighter */ 3 * Mini dirname implementation for busybox
4/* 4 *
5 * Copyright (c) 1991, 1993, 1994 5 * Copyright (C) 2000 by Lineo, inc.
6 * The Regents of the University of California. All rights reserved. 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
7 * 12 *
8 * Redistribution and use in source and binary forms, with or without 13 * This program is distributed in the hope that it will be useful,
9 * modification, are permitted provided that the following conditions 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * are met: 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * 1. Redistributions of source code must retain the above copyright 16 * General Public License for more details.
12 * notice, this list of conditions and the following disclaimer. 17 *
13 * 2. Redistributions in binary form must reproduce the above copyright 18 * You should have received a copy of the GNU General Public License
14 * notice, this list of conditions and the following disclaimer in the 19 * along with this program; if not, write to the Free Software
15 * documentation and/or other materials provided with the distribution. 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 * 21 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */ 22 */
36
37#if 0
38#ifndef lint
39static char copyright[] = "@(#) Copyright (c) 1991, 1993, 1994\n\
40 The Regents of the University of California. All rights reserved.\n";
41#endif /* not lint */
42
43#ifndef lint
44static char sccsid[] = "@(#)dirname.c 8.4 (Berkeley) 5/4/95";
45#endif /* not lint */
46#endif /* #if 0 */
47
48#include "internal.h" 23#include "internal.h"
49#include <stdio.h> 24#include <stdio.h>
50#include <stdlib.h>
51#include <unistd.h>
52 25
53void dirname_usage() 26extern int dirname_main(int argc, char **argv)
54{ 27{
28 char* s;
55 29
56 (void) fprintf(stderr, "usage: dirname path\n"); 30 if ((argc < 2) || (**(argv + 1) == '-')) {
57 exit(1); 31 usage("dirname [file ...]\n");
58}
59
60extern int dirname_main(argc, argv)
61int argc;
62char **argv;
63{
64 char *p;
65 int ch;
66
67 while ((ch = getopt(argc, argv, "")) != -1)
68 switch (ch) {
69 case '?':
70 default:
71 dirname_usage();
72 }
73 argc -= optind;
74 argv += optind;
75
76 if (argc != 1)
77 dirname_usage();
78
79 /*
80 * (1) If string is //, skip steps (2) through (5).
81 * (2) If string consists entirely of slash characters, string
82 * shall be set to a single slash character. In this case,
83 * skip steps (3) through (8).
84 */
85 for (p = *argv;; ++p) {
86 if (!*p) {
87 if (p > *argv)
88 (void) printf("/\n");
89 else
90 (void) printf(".\n");
91 exit(0);
92 }
93 if (*p != '/')
94 break;
95 } 32 }
33 argv++;
96 34
97 /* 35 s=*argv+strlen(*argv)-1;
98 * (3) If there are any trailing slash characters in string, they 36 while (s && *s == '/') {
99 * shall be removed. 37 *s = '\0';
100 */ 38 s=*argv+strlen(*argv)-1;
101 for (; *p; ++p);
102 while (*--p == '/')
103 continue;
104 *++p = '\0';
105
106 /*
107 * (4) If there are no slash characters remaining in string,
108 * string shall be set to a single period character. In this
109 * case skip steps (5) through (8).
110 *
111 * (5) If there are any trailing nonslash characters in string,
112 * they shall be removed.
113 */
114 while (--p >= *argv)
115 if (*p == '/')
116 break;
117 ++p;
118 if (p == *argv) {
119 (void) printf(".\n");
120 exit(0);
121 } 39 }
122 40 s = strrchr(*argv, '/');
123 /* 41 if (s && *s)
124 * (6) If the remaining string is //, it is implementation defined 42 *s = '\0';
125 * whether steps (7) and (8) are skipped or processed. 43 printf("%s\n", (s)? *argv : ".");
126 * 44 exit(TRUE);
127 * This case has already been handled, as part of steps (1) and (2).
128 */
129
130 /*
131 * (7) If there are any trailing slash characters in string, they
132 * shall be removed.
133 */
134 while (--p >= *argv)
135 if (*p != '/')
136 break;
137 ++p;
138
139 /*
140 * (8) If the remaining string is empty, string shall be set to
141 * a single slash character.
142 */
143 *p = '\0';
144 (void) printf("%s\n", p == *argv ? "/" : *argv);
145 exit(0);
146} 45}
diff --git a/coreutils/echo.c b/coreutils/echo.c
index 91f17aa0f..2405d0ae1 100644
--- a/coreutils/echo.c
+++ b/coreutils/echo.c
@@ -25,6 +25,14 @@
25#include "internal.h" 25#include "internal.h"
26#include <stdio.h> 26#include <stdio.h>
27 27
28static const char uname_usage[] =
29 "echo [-neE] [ARG ...]\n\n"
30 "Prints the specified ARGs to stdout\n\n"
31 "Options:\n"
32 "\t-n\tsuppress trailing newline\n"
33 "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n"
34 "\t-E\tdisable interpretation of backslash-escaped characters\n";
35
28extern int 36extern int
29echo_main(int argc, char** argv) 37echo_main(int argc, char** argv)
30{ 38{
@@ -45,6 +53,9 @@ echo_main(int argc, char** argv)
45 } else if (strcmp(p, "-E")==0) { 53 } else if (strcmp(p, "-E")==0) {
46 eflag = 0; 54 eflag = 0;
47 } 55 }
56 else if (strncmp(p, "--", 2)==0) {
57 usage( uname_usage);
58 }
48 else break; 59 else break;
49 ap++; 60 ap++;
50 } 61 }
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 3e010503c..0c7f6522c 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -88,7 +88,6 @@
88#define DISP_FULLTIME 32 /* show extended time display */ 88#define DISP_FULLTIME 32 /* show extended time display */
89#define DIR_NOLIST 64 /* show directory as itself, not contents */ 89#define DIR_NOLIST 64 /* show directory as itself, not contents */
90#define DISP_DIRNAME 128 /* show directory name (for internal use) */ 90#define DISP_DIRNAME 128 /* show directory name (for internal use) */
91#define DIR_RECURSE 256 /* -R (not yet implemented) */
92 91
93#ifndef MAJOR 92#ifndef MAJOR
94#define MAJOR(dev) (((dev)>>8)&0xff) 93#define MAJOR(dev) (((dev)>>8)&0xff)
@@ -450,10 +449,33 @@ static const char ls_usage[] = "ls [-1a"
450#ifdef BB_FEATURE_LS_FILETYPES 449#ifdef BB_FEATURE_LS_FILETYPES
451 "F" 450 "F"
452#endif 451#endif
453#ifdef FEATURE_RECURSIVE 452 "] [filenames...]\n\n"
454 "R" 453 "Options:\n"
454 "\t-a\tdo not hide entries starting with .\n"
455#ifdef BB_FEATURE_LS_TIMESTAMPS
456 "\t-c\twith -l: show ctime (the time of last\n"
457 "\t\tmodification of file status information)\n"
458#endif
459 "\t-d\tlist directory entries instead of contents\n"
460#ifdef BB_FEATURE_LS_TIMESTAMPS
461 "\t-e\tlist both full date and full time\n"
455#endif 462#endif
456 "] [filenames...]\n"; 463 "\t-l\tuse a long listing format\n"
464 "\t-n\tlist numeric UIDs and GIDs instead of names\n"
465#ifdef BB_FEATURE_LS_FILETYPES
466 "\t-p\tappend indicator (one of /=@|) to entries\n"
467#endif
468#ifdef BB_FEATURE_LS_TIMESTAMPS
469 "\t-u\twith -l: show access time (the time of last\n"
470 "\t\taccess of the file)\n"
471#endif
472 "\t-x\tlist entries by lines instead of by columns\n"
473 "\t-A\tdo not list implied . and ..\n"
474 "\t-C\tlist entries by columns\n"
475#ifdef BB_FEATURE_LS_FILETYPES
476 "\t-F\tappend indicator (one of */=@|) to entries\n"
477#endif
478 ;
457 479
458extern int ls_main(int argc, char **argv) 480extern int ls_main(int argc, char **argv)
459{ 481{
@@ -508,11 +530,6 @@ extern int ls_main(int argc, char **argv)
508 case 'd': 530 case 'd':
509 opts |= DIR_NOLIST; 531 opts |= DIR_NOLIST;
510 break; 532 break;
511#ifdef FEATURE_RECURSIVE
512 case 'R':
513 opts |= DIR_RECURSE;
514 break;
515#endif
516#ifdef BB_FEATURE_LS_TIMESTAMPS 533#ifdef BB_FEATURE_LS_TIMESTAMPS
517 case 'u': 534 case 'u':
518 time_fmt = TIME_ACCESS; 535 time_fmt = TIME_ACCESS;
diff --git a/coreutils/mknod.c b/coreutils/mknod.c
index b11a81f2a..40f508d33 100644
--- a/coreutils/mknod.c
+++ b/coreutils/mknod.c
@@ -70,7 +70,7 @@ int mknod_main(int argc, char **argv)
70 70
71 if (mknod(argv[1], mode, dev) != 0) { 71 if (mknod(argv[1], mode, dev) != 0) {
72 perror(argv[1]); 72 perror(argv[1]);
73 return (FALSE); 73 exit (FALSE);
74 } 74 }
75 return (TRUE); 75 exit (TRUE);
76} 76}
diff --git a/dirname.c b/dirname.c
index 77cb664ac..528b89a56 100644
--- a/dirname.c
+++ b/dirname.c
@@ -1,146 +1,45 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * This is temporary -- needs to be rewritten to be tighter */ 3 * Mini dirname implementation for busybox
4/* 4 *
5 * Copyright (c) 1991, 1993, 1994 5 * Copyright (C) 2000 by Lineo, inc.
6 * The Regents of the University of California. All rights reserved. 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
7 * 12 *
8 * Redistribution and use in source and binary forms, with or without 13 * This program is distributed in the hope that it will be useful,
9 * modification, are permitted provided that the following conditions 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * are met: 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * 1. Redistributions of source code must retain the above copyright 16 * General Public License for more details.
12 * notice, this list of conditions and the following disclaimer. 17 *
13 * 2. Redistributions in binary form must reproduce the above copyright 18 * You should have received a copy of the GNU General Public License
14 * notice, this list of conditions and the following disclaimer in the 19 * along with this program; if not, write to the Free Software
15 * documentation and/or other materials provided with the distribution. 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 * 21 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */ 22 */
36
37#if 0
38#ifndef lint
39static char copyright[] = "@(#) Copyright (c) 1991, 1993, 1994\n\
40 The Regents of the University of California. All rights reserved.\n";
41#endif /* not lint */
42
43#ifndef lint
44static char sccsid[] = "@(#)dirname.c 8.4 (Berkeley) 5/4/95";
45#endif /* not lint */
46#endif /* #if 0 */
47
48#include "internal.h" 23#include "internal.h"
49#include <stdio.h> 24#include <stdio.h>
50#include <stdlib.h>
51#include <unistd.h>
52 25
53void dirname_usage() 26extern int dirname_main(int argc, char **argv)
54{ 27{
28 char* s;
55 29
56 (void) fprintf(stderr, "usage: dirname path\n"); 30 if ((argc < 2) || (**(argv + 1) == '-')) {
57 exit(1); 31 usage("dirname [file ...]\n");
58}
59
60extern int dirname_main(argc, argv)
61int argc;
62char **argv;
63{
64 char *p;
65 int ch;
66
67 while ((ch = getopt(argc, argv, "")) != -1)
68 switch (ch) {
69 case '?':
70 default:
71 dirname_usage();
72 }
73 argc -= optind;
74 argv += optind;
75
76 if (argc != 1)
77 dirname_usage();
78
79 /*
80 * (1) If string is //, skip steps (2) through (5).
81 * (2) If string consists entirely of slash characters, string
82 * shall be set to a single slash character. In this case,
83 * skip steps (3) through (8).
84 */
85 for (p = *argv;; ++p) {
86 if (!*p) {
87 if (p > *argv)
88 (void) printf("/\n");
89 else
90 (void) printf(".\n");
91 exit(0);
92 }
93 if (*p != '/')
94 break;
95 } 32 }
33 argv++;
96 34
97 /* 35 s=*argv+strlen(*argv)-1;
98 * (3) If there are any trailing slash characters in string, they 36 while (s && *s == '/') {
99 * shall be removed. 37 *s = '\0';
100 */ 38 s=*argv+strlen(*argv)-1;
101 for (; *p; ++p);
102 while (*--p == '/')
103 continue;
104 *++p = '\0';
105
106 /*
107 * (4) If there are no slash characters remaining in string,
108 * string shall be set to a single period character. In this
109 * case skip steps (5) through (8).
110 *
111 * (5) If there are any trailing nonslash characters in string,
112 * they shall be removed.
113 */
114 while (--p >= *argv)
115 if (*p == '/')
116 break;
117 ++p;
118 if (p == *argv) {
119 (void) printf(".\n");
120 exit(0);
121 } 39 }
122 40 s = strrchr(*argv, '/');
123 /* 41 if (s && *s)
124 * (6) If the remaining string is //, it is implementation defined 42 *s = '\0';
125 * whether steps (7) and (8) are skipped or processed. 43 printf("%s\n", (s)? *argv : ".");
126 * 44 exit(TRUE);
127 * This case has already been handled, as part of steps (1) and (2).
128 */
129
130 /*
131 * (7) If there are any trailing slash characters in string, they
132 * shall be removed.
133 */
134 while (--p >= *argv)
135 if (*p != '/')
136 break;
137 ++p;
138
139 /*
140 * (8) If the remaining string is empty, string shall be set to
141 * a single slash character.
142 */
143 *p = '\0';
144 (void) printf("%s\n", p == *argv ? "/" : *argv);
145 exit(0);
146} 45}
diff --git a/docs/CommandList b/docs/CommandList
deleted file mode 100644
index 03c74bb87..000000000
--- a/docs/CommandList
+++ /dev/null
@@ -1,1025 +0,0 @@
1The following document includes a continuous description of the current
2commands, functions and utilities included in the busybox.
3
4John Cooper
5johnc@lineo.com
6
7_______________________________________________________________________________________________________
8
9
10
11
12 BusyBox 0.38, Functions and the Arguments they Support
13
14
15New Apps that have been added to BusyBox since this document was written:
16 ping, hostname, mkfifo, free, tail, du, tee, head, sort, uniq, lsmod, rmmod, fbset, and loadacm.
17
18
19
20______________________________________________________________________________________________________
21
22
23
24
25
26cat [file]
27 Display file contents to standard output.
28
29
30
31
32_______________________________________________________________________________________________________
33
34
35
36
37
38chmod [-R] Mode,[Mode] file
39
40 Change file access permissions (mode) of one or more files.
41
42 -R Follows the directory tree from the current location thru all sub-directories,
43
44 applying changes.
45
46 Mode = u User
47
48 g Group
49
50 o Other
51
52 a All
53
54 Permission = r Read
55
56 w Write
57
58 s Set user (or group) ID
59
60 t Sticky bit file cannot be removed by other
61
62 than the owner.
63
64
65
66
67________________________________________________________________________________________________________
68
69
70
71
72
73chown [option] owner[group]file
74
75 Change owner and (or) group of file to owner and (or) group.
76
77 Only the current owner or a priveleged user may change an owner.
78
79 -R Follows the directory tree from the current location thru all sub-directories, applying
80
81 changes.
82
83
84
85
86
87________________________________________________________________________________________________________
88
89
90
91
92
93
94chgrp [option] newgroup file
95
96 Change group of file or files to new group name or ID number located in /etc/group.
97
98 Only the current owner or a priveleged user may change the group name or ID
99
100 -R Follows the directory tree from the current location thru all sub-directories,
101
102 applying changes.
103
104
105
106
107
108
109________________________________________________________________________________________________________
110
111
112
113
114
115chroot NEWROOT [Command...] (System Admin Command)
116
117 Run command with root directory set to NEWROOT. Only the current owner or a priveleged
118
119 user may use this command.
120
121
122
123
124
125________________________________________________________________________________________________________
126
127
128
129
130
131clear
132
133 Clear screen.
134
135
136
137
138
139
140________________________________________________________________________________________________________
141
142
143
144
145
146cp [option] fileA fileB
147
148 Copy fileA to fileB or fileA to directory maintaining fileA name.
149
150 -a archive Maintain file attributes whenever possible. Same as -dpR
151
152 -d no dereference Maintain hard link relationships between fileA and fileB.
153
154 No dereference of symbolic links.
155
156 -p maintain file Maintain all file attributes and information including owner
157
158 attributes group permissions and time information.
159
160 -R recursive Copies directories recursively
161
162
163
164
165
166_________________________________________________________________________________________________________
167
168
169
170
171
172date [option [+format] [date]
173
174date [option] [MMDDhhmm[[CC]YY][.SS]]
175
176 Display the current system date and time.
177
178 -R RFC-822 string Output an RFC-822 compliant date string.
179
180 -s set DATE Set date where date is entered in MMDDhhmm etc. format.
181
182 -u universal Print or set Coordinated Universal Time.
183
184
185
186
187
188_______________________________________________________________________________________________________
189
190
191
192
193
194
195dd [if=name] [of=name] [bs=n] [count=n]
196
197
198 Copy a file, converting and formatting according to options. Most useful when copying from
199
200 physical input and output devices.
201
202 if=fileA (instead of standard input)
203
204 of=fileB (instead of standard output)
205
206 bs=n Read and write N Bytes at a time.
207
208 count=n Copy only n input blocks.
209
210 Bytes may be suffixed by k for x1024, b for x512 and w for x2.
211
212
213
214
215
216________________________________________________________________________________________________________
217
218
219
220
221
222df
223
224
225 Display filesystem, number of blocks used, number of blocks available, number of blocks in use,
226
227 and mount point.
228
229
230
231
232
233
234________________________________________________________________________________________________________
235
236
237
238
239
240
241dmesg [-c] [-n level] [-s bufsize] (System Admin Command)
242
243
244 Display system control messages. Stored in the kernel ring buffer are all messages since the
245
246 last system boot, or the most recent if the buffer had been full.
247
248
249 -c Clear buffer after printing messages.
250
251 -n level Set the level of system message to be displayed on the console.
252
253 -s bufsize Display the size of the kernel ring buffer.
254
255
256
257
258
259________________________________________________________________________________________________________
260
261
262
263
264
265
266find [PATH] [EXPRESSION]
267
268 Search for files in the current directory, and all subdirectories for patterns that match
269
270 expression. Expressions may consist of the following.
271
272 -follow Dereference symbolic links.
273
274 -name PATTERN Find files that match PATTERN. Metacharacters should be escaped or
275
276 quoted.
277
278 -print Print full file name, followed by a newline, to standard out.
279
280
281
282
283
284
285________________________________________________________________________________________________________
286
287
288
289
290
291chvt N
292
293 Change foreground virtual terminal to /dev/ttyN.
294
295
296
297
298
299________________________________________________________________________________________________________
300
301
302
303
304
305deallocvt N
306
307 Deallocate unused virtual terminal /dev/ttyN.
308
309
310
311
312
313________________________________________________________________________________________________________
314
315
316
317
318
319fsck.minix [-larvsmf] /dev/name
320
321 Perform a consistency check for minix filesystems.
322
323 -l List filenames.
324
325 -r Perform interactive repairs.
326
327 -a Perform automatic repairs
328
329 -v Verbose
330
331 -s Output superblock information
332
333 -m Activates minix-like "mode not cleared" warnings.
334
335 -f Force file system check.
336
337
338
339
340________________________________________________________________________________________________________
341
342
343
344
345
346mkfs.minix [-c | -l filename ] [-nXX] [-iXX] /dev/name [blocks]
347
348 Make a minix file system.
349
350 -c Check device for bad blocks.
351
352 -n [ 14|30 ] Specify max length of filenames.
353
354 -i Specify number of inodes for filesystem.
355
356 -l filename
357
358 Read the bad blocks list from filename.
359
360 -v Make a minix version 2 filesystem.
361
362
363
364
365
366________________________________________________________________________________________________________
367
368
369
370
371
372grep [OPTIONS] PATTERN [FILE]
373
374 Search for PATTERN in each FILE or from standard input.
375
376 -h Suppress prefixing filename on output.
377
378 -i Ignore case distinctions.
379
380 -n Print line number with output lines.
381
382
383
384
385
386________________________________________________________________________________________________________
387
388
389
390
391
392init
393
394 The parent of all processes. Only to be run by the kernel.
395
396
397
398
399
400________________________________________________________________________________________________________
401
402
403
404
405
406kill [ -s sigspec | -signum | -sigspec ] [pid | job ] or
407
408kill -l [ exitstatus ]
409
410 Currently no information help page for this command
411
412
413
414
415
416________________________________________________________________________________________________________
417
418
419
420
421
422ln [option] TARGET... LINK_NAME|DIRECTORY
423
424 Create a link named LINK_NAME or DIRECTORY to TARGET.
425
426 -s Make symbolic links instead of hard links.
427
428 -f Remove existing destination files.
429
430
431
432
433
434________________________________________________________________________________________________________
435
436
437
438
439
440ls [ -1acdelnpuxACF ] [FILENAMES]
441
442 List contents of directories.
443
444 -1 Single entry per column of output.
445
446 -a All files including hidden files beginning with a ..
447
448 -c Files are listed by status change time.
449
450 -d List directories, not there contents.
451
452 -e List both full date and full time
453
454 -l List in long format including permissions, owner, size
455
456 modification time etc.
457
458 -n Similar to -l, except use group ID and user ID instead
459
460 of owner and group names.
461
462 -p Directories are marked with a /.
463
464 -u Display files sorted by file access time.
465
466 -x Display files across the screen in rows.
467
468 -A Display hidden and all other files except . and ...
469
470 -C (Default, display files in columns)
471
472 -F Tag files by type by appending:
473
474 / to directories
475
476 * to executables
477
478 @ to symbolic links
479
480 | to fifo's
481
482 = to sockets
483
484
485
486
487
488
489________________________________________________________________________________________________________
490
491
492
493
494
495mkdir [OPTION] directory
496
497 Create directories if they do not already exist. You must have write permission to create
498
499 directories. Default mode can be modified by users umask.
500
501 -m Used to set permission mode. (See chmod description)
502
503 -p Make parent directories if they don't already exist. Return error code if
504
505 they already exist.
506
507
508
509
510
511
512________________________________________________________________________________________________________
513
514
515
516
517
518mknod NAME TYPE MAJOR MINOR
519
520Make block or character special files.
521
522TYPEs include:
523 b: Make a block (buffered) device.
524 c or u: Make a character (un-buffered) device.
525 p: Make a named pipe. Major and minor are ignored for named pipes.
526
527
528
529________________________________________________________________________________________________________
530
531
532
533
534
535
536mkswap [-c] [ -v0|-v1 ] device [block-count]
537
538 Prepare a disk partition to be used as a swap partition.
539
540 -c Check for read-ability.
541
542 -v0 Make version 0 swap [max 128 megs]
543
544 -v1 Make version 1 swap [big |] default for
545
546 kernels > 2.1.117.
547
548 block-count
549
550 Number of blocks to use. (Default is the entire
551
552 partition).
553
554
555
556
557
558
559________________________________________________________________________________________________________
560
561
562
563
564
565more [file]
566
567 Display file one screen page at a time.
568
569
570
571
572________________________________________________________________________________________________________
573
574
575
576
577
578mount [flags]
579
580mount [flags] device directory [-o options, more options ]
581
582 Mount a filesystem for file access.
583
584 -a Mount all file systems in fstab.
585
586 -o option
587
588 async/sync: Writes are asynchronous/synchronous.
589
590 dev/nodev: Allow use of special device files
591
592 /disallow them.
593
594 exec/noexec: Allow use of executable files
595
596 /disallow them.
597
598 suid/nosuid: Allow set-user-id-root programs
599
600 /disallow them.
601
602 remount: Remount a currently-mounted filesystem
603
604 changing it's flags.
605
606 ro/rw: Mount for read-only/read-write.
607
608 (There are more flags specific to each filesystem.
609
610 See the written documentation for those.)
611
612 -r Mount the filesystem read only.
613
614 -t FILESYSTEM TYPE
615
616 Specify the filesystem type.
617
618 -w Mount for reading and writing default
619
620
621
622
623
624
625________________________________________________________________________________________________________
626
627
628
629
630
631
632mv fileA fileB or
633
634mv fileA dirA
635
636 Move fileA to fileB. (Renames fileA to fileB)
637
638 Move fileA to dirA (Moves fileA into dirA)
639
640
641
642
643
644________________________________________________________________________________________________________
645
646
647
648
649
650ps
651
652 Report process status. No options are currently supported.
653
654
655
656
657
658________________________________________________________________________________________________________
659
660
661
662
663
664pwd
665
666 Print working directory
667
668
669
670
671
672________________________________________________________________________________________________________
673
674
675
676
677
678reboot
679
680 Reboot system. No options are currently supported.
681
682
683
684
685
686________________________________________________________________________________________________________
687
688
689
690
691
692rm [option] file
693
694 Remove or unlink the files.
695
696 -f Remove existing destinations. Never prompt.
697
698 -r or -R Remove contents of directories recursively.
699
700
701
702
703________________________________________________________________________________________________________
704
705
706
707
708
709rmdir [OPTION] ... directory
710
711 Remove directories if they are empty.
712
713
714
715
716________________________________________________________________________________________________________
717
718
719
720
721sed
722 Usage: sed [-n] -e script [file...]
723
724 Allowed sed scripts come in the following form:
725 'ADDR [!] COMMAND'
726
727 where address ADDR can be:
728 NUMBER Match specified line number
729 $ Match last line
730 /REGEXP/ Match specified regexp
731 (! inverts the meaning of the match)
732
733 and COMMAND can be:
734 s/regexp/replacement/[igp]
735 which attempt to match regexp against the pattern space
736 and if successful replaces the matched portion with replacement.
737
738 aTEXT
739 which appends TEXT after the pattern space
740 Options:
741 -e add the script to the commands to be executed
742 -n suppress automatic printing of pattern space
743
744 This version of sed matches full regular expresions.
745
746
747
748________________________________________________________________________________________________________
749
750
751
752
753
754sleep N
755
756 Pause for N seconds.
757
758
759
760
761
762________________________________________________________________________________________________________
763
764
765
766
767
768tar -[cxtvOf] [tarFileName] [file]
769
770 Create, extract or list files from a tar file.
771
772 c=create
773
774 x=extract
775
776 t=list contents
777
778 v=verbose
779
780 O=extract to stdout
781
782 f=tarfile or "-" for standard input
783
784
785
786
787
788________________________________________________________________________________________________________
789
790
791
792
793
794swapon device
795
796 Start swapping virtual memory pages on the given device.
797
798
799
800
801
802________________________________________________________________________________________________________
803
804
805
806
807
808swapoff device
809
810 Stop swapping virtual memory pages on the given device.
811
812
813
814
815
816________________________________________________________________________________________________________
817
818
819
820
821
822sync
823
824 Write all buffered filesystem blocks to disk.
825
826
827
828
829
830________________________________________________________________________________________________________
831
832
833
834
835
836touch [-c] file [file...]
837
838 Update the last modified date on given file(s).
839
840
841
842
843
844________________________________________________________________________________________________________
845
846
847
848
849
850true
851
852 A null command that returns a successful 0 exit status code. (See false)
853
854
855
856
857
858________________________________________________________________________________________________________
859
860
861
862
863
864false
865
866 A null command that returns an unsuccessful or non-zero exit status.
867
868
869
870
871
872________________________________________________________________________________________________________
873
874
875
876
877
878uname [option]
879
880 Print certain system information. With no option, same as -s.
881
882 -a Display all information
883
884 -m Display machine hardware type.
885
886 -n Display machine network node hostname.
887
888 -r Display OS release
889
890 -s Display OS Name.
891
892 -p Display Host processor type.
893
894 -v Display OS Version.
895
896
897
898
899
900________________________________________________________________________________________________________
901
902
903
904
905
906umount [flags] filesystem | directory
907
908 Unmounts designated filesystem previously mounted on device.
909
910 -a Unmount all file systems.
911
912
913
914
915
916________________________________________________________________________________________________________
917
918
919
920
921
922update
923
924cvs update [options] files
925
926 Incorporates recent changes from the repository into files in your working directory. No
927
928 options are currently supported.
929
930
931
932
933
934________________________________________________________________________________________________________
935
936
937
938
939
940zcat [options] files
941
942 Usage: zcat [OPTION]... FILE
943
944 Uncompress FILE (or standard input if FILE is '-').
945 (When invoked as zcat, defaults to having -c turned on)
946
947 Options:
948 -c Write output to standard output
949 -t Test compressed file integrity
950
951
952
953
954________________________________________________________________________________________________________
955
956
957
958
959
960gunzip (Same as zcat, but without the "-c" option.)
961
962
963
964
965
966________________________________________________________________________________________________________
967
968
969
970
971
972gzip [OPTION]... FILE
973
974 Compress FILE with maximum compression.
975 When FILE is -, reads standard input. Implies -c.
976
977 Options:
978 -c Write output to standard output instead of FILE.gz
979
980
981
982________________________________________________________________________________________________________
983
984
985
986
987
988
989loadfont
990
991 No information available with --help.
992
993
994
995
996________________________________________________________________________________________________________
997
998
999
1000
1001
1002loadkmap
1003
1004 No information available with --help
1005
1006
1007
1008
1009
1010________________________________________________________________________________________________________
1011
1012
1013
1014
1015
1016linuxrc
1017
1018 No information available with --help
1019
1020
1021
1022
1023
1024________________________________________________________________________________________________________
1025
diff --git a/docs/Makefile b/docs/Makefile
new file mode 100644
index 000000000..aebe8a847
--- /dev/null
+++ b/docs/Makefile
@@ -0,0 +1,22 @@
1# busybox/docs/Makefile - Create the documentation
2# ------------------------
3# Copyright (C) 2000 Erik Andersen <andersee@debian.org> GPL
4
5all:: clean doc
6
7doc:
8 @echo
9 @echo BusyBox Documentation
10 @echo
11 pod2html busybox.pod > ../BusyBox.html
12 @rm pod2html-*
13 pod2man --center=BusyBox --release="version $(VERSION)" busybox.pod > ../BusyBox.1
14 pod2text busybox.pod > ../BusyBox.txt
15
16clean::
17 @rm -f ../BusyBox.html ../BusyBox.1 ../BusyBox.txt pod2html*
18
19distclean: clean
20
21.PHONY: all clean distclean doc
22
diff --git a/docs/busybox.pod b/docs/busybox.pod
index 3aecf3cff..127cf89b5 100644
--- a/docs/busybox.pod
+++ b/docs/busybox.pod
@@ -1,4 +1,4 @@
1# pod2man --center=Lineo --release="version 0.43" busybox.pod > busybox.1 1# vi: set sw=4 ts=4:
2 2
3=head1 NAME 3=head1 NAME
4 4
@@ -36,20 +36,18 @@ 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, mv, date, 39basename, cat, chmod, chown, chgrp, chroot, clear, chvt, cp, date,
40dd, df, dirname, dmesg, du, dutmp, echo, fbset, fdflush, find, free, 40dd, df, dirname, dmesg, du, dutmp, echo, false, fbset, fdflush, find, free,
41freeramdisk, deallocvt, fsck.minix, mkfs.minix, grep, gunzip, gzip, 41freeramdisk, deallocvt, fsck.minix, mkfs.minix, grep, gunzip, gzip,
42halt, head, hostid, hostname, init, kill, killall, length, ln, loadacm, 42halt, head, hostid, hostname, init, kill, killall, length, ln, loadacm,
43loadfont, loadkmap, ls, lsmod, makedevs, math, mkdir, mkfifo, mknod, 43loadfont, loadkmap, ls, lsmod, makedevs, math, mkdir, mkfifo, mknod,
44mkswap, mnc, more, mount, mt, nslookup, poweroff, ping, printf, ps, 44mkswap, mnc, more, mount, mt, mv, nslookup, poweroff, ping, printf, ps,
45pwd, reboot, rm, rmdir, rmmod, sed, sh, fdisk, sfdisk, sleep, sort, 45pwd, reboot, rm, rmdir, rmmod, sed, sh, fdisk, sfdisk, sleep, sort,
46sync, syslogd, logger, logname, swapon, swapoff, tail, tar, [, test, 46sync, syslogd, logger, logname, swapon, swapoff, tail, tar, [, test,
47tee, touch, tr, true, false, tty, umount, uname, uptime, uniq, update, 47tee, touch, tr, true, tty, umount, uname, uptime, uniq, update,
48usleep, wc, whoami, yes, zcat 48usleep, wc, whoami, yes, zcat
49 49
50=head1 OPTIONS 50=head1 COMMON OPTIONS
51
52Common Options:
53 51
54Most BusyBox commands support the B<--help> option to provide a 52Most BusyBox commands support the B<--help> option to provide a
55terse runtime description of their behavior. 53terse runtime description of their behavior.
@@ -69,6 +67,8 @@ Example:
69 $ basename /usr/local/bin/ 67 $ basename /usr/local/bin/
70 bin 68 bin
71 69
70-------------------------------
71
72=item cat 72=item cat
73 73
74Usage: cat [file ...] 74Usage: cat [file ...]
@@ -80,6 +80,8 @@ Example:
80 $ cat /proc/uptime 80 $ cat /proc/uptime
81 110716.72 17.67 81 110716.72 17.67
82 82
83-------------------------------
84
83=item chmod 85=item chmod
84 86
85Usage: chmod [B<-R>] MODE[,MODE]... FILE... 87Usage: chmod [B<-R>] MODE[,MODE]... FILE...
@@ -112,20 +114,20 @@ PERMISSION may be chosen from:
112 114
113Alternately, permissions may be set numerically where the first three 115Alternately, permissions may be set numerically where the first three
114numbers are calculated by adding the octal values: 116numbers are calculated by adding the octal values:
115 117
116 4 Read 118 4 Read
117 2 Write 119 2 Write
118 1 eXecute 120 1 eXecute
119 121
120An optional fourth digit may also be used to specify 122An optional fourth digit may also be used to specify
121 123
122 4 Set user ID 124 4 Set user ID
123 2 Set group ID 125 2 Set group ID
124 1 sTickey bit 126 1 sTickey bit
125 127
126Options: 128Options:
127 129
128 -R change files and directories recursively. 130 -R change files and directories recursively.
129 131
130Example: 132Example:
131 133
@@ -138,6 +140,8 @@ Example:
138 $ ls -l /tmp/foo 140 $ ls -l /tmp/foo
139 -r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo 141 -r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo
140 142
143-------------------------------
144
141=item chown 145=item chown
142 146
143Usage: chown [OPTION]... OWNER[.[GROUP] FILE... 147Usage: chown [OPTION]... OWNER[.[GROUP] FILE...
@@ -146,7 +150,7 @@ Changes the owner and/or group of each FILE to OWNER and/or GROUP.
146 150
147Options: 151Options:
148 152
149 -R change files and directories recursively 153 -R change files and directories recursively
150 154
151Example: 155Example:
152 156
@@ -159,6 +163,8 @@ Example:
159 ls -l /tmp/foo 163 ls -l /tmp/foo
160 -r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo 164 -r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo
161 165
166-------------------------------
167
162=item chgrp 168=item chgrp
163 169
164Usage: chgrp [OPTION]... GROUP FILE... 170Usage: chgrp [OPTION]... GROUP FILE...
@@ -167,7 +173,7 @@ Change the group membership of each FILE to GROUP.
167 173
168Options: 174Options:
169 175
170 -R change files and directories recursively 176 -R change files and directories recursively
171 177
172Example: 178Example:
173 179
@@ -177,31 +183,38 @@ Example:
177 $ ls -l /tmp/foo 183 $ ls -l /tmp/foo
178 -r--r--r-- 1 andersen root 0 Apr 12 18:25 /tmp/foo 184 -r--r--r-- 1 andersen root 0 Apr 12 18:25 /tmp/foo
179 185
186-------------------------------
187
180=item chroot 188=item chroot
181 189
182Usage: chroot NEWROOT [COMMAND...] 190Usage: chroot NEWROOT [COMMAND...]
183 191
184Run COMMAND with root directory set to NEWROOT. 192Run COMMAND with root directory set to NEWROOT.
185 193
186Exmaple: 194Example:
187 195
188 $ ls -l /bin/ls 196 $ ls -l /bin/ls
189 lrwxrwxrwx 1 root root 12 Apr 13 00:46 /bin/ls -> /bin/busybox 197 lrwxrwxrwx 1 root root 12 Apr 13 00:46 /bin/ls -> /busybox
190 $ mount /dev/hdc1 /mnt -t minix 198 $ mount /dev/hdc1 /mnt -t minix
191 $ chroot /mnt 199 $ chroot /mnt
192 $ ls -l /bin/ls 200 $ ls -l /bin/ls
193 -rwxr-xr-x 1 root root 40816 Feb 5 07:45 /bin/ls* 201 -rwxr-xr-x 1 root root 40816 Feb 5 07:45 /bin/ls*
194 202
203-------------------------------
204
195=item clear 205=item clear
196 206
197Clears the screen. 207Clears the screen.
198 208
209-------------------------------
210
199=item chvt 211=item chvt
200 212
201Usage: chvt N 213Usage: chvt N
202 214
203Change foreground virtual terminal to /dev/ttyN 215Change foreground virtual terminal to /dev/ttyN
204 216
217-------------------------------
205 218
206=item cp 219=item cp
207 220
@@ -216,6 +229,8 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
216 -p preserve file attributes if possable 229 -p preserve file attributes if possable
217 -R copy directories recursively 230 -R copy directories recursively
218 231
232-------------------------------
233
219=item date 234=item date
220 235
221Usage: date [OPTION]... [+FORMAT] 236Usage: date [OPTION]... [+FORMAT]
@@ -226,44 +241,47 @@ Display the current time in the given FORMAT, or set the system date.
226 241
227Options: 242Options:
228 243
229 -R output RFC-822 compliant date string 244 -R output RFC-822 compliant date string
230 -s set time described by STRING 245 -s set time described by STRING
231 -u print or set Coordinated Universal Time 246 -u print or set Coordinated Universal Time
232 247
233Example: 248Example:
234 249
235 $ date 250 $ date
236 Wed Apr 12 18:52:41 MDT 2000 251 Wed Apr 12 18:52:41 MDT 2000
237 252
253-------------------------------
254
238=item dd 255=item dd
239 256
240Usage: dd [if=name] [of=name] [bs=n] [count=n] [skip=n] [seek=n] 257Usage: dd [if=name] [of=name] [bs=n] [count=n] [skip=n] [seek=n]
241 258
242Copy a file, converting and formatting according to options 259Copy a file, converting and formatting according to options
243 260
244 if=FILE read from FILE instead of stdin 261 if=FILE read from FILE instead of stdin
245 of=FILE write to FILE instead of stdout 262 of=FILE write to FILE instead of stdout
246 bs=n read and write n bytes at a time 263 bs=n read and write n bytes at a time
247 count=n copy only n input blocks 264 count=n copy only n input blocks
248 skip=n skip n input blocks 265 skip=n skip n input blocks
249 seek=n skip n output blocks 266 seek=n skip n output blocks
250 267
251Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2) 268Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2)
252 269
253
254Example: 270Example:
255 271
256 $ dd if=/dev/zero of=/dev/ram1 bs=1M count=4 272 $ dd if=/dev/zero of=/dev/ram1 bs=1M count=4
257 4+0 records in 273 4+0 records in
258 4+0 records out 274 4+0 records out
259 275
276-------------------------------
277
260=item df 278=item df
261 279
262Usage: df [filesystem ...] 280Usage: df [filesystem ...]
263 281
264Prints the filesystem space used and space available. 282Prints the filesystem space used and space available.
265 283
266Exmaple: 284Example:
267 285
268 $ df 286 $ df
269 Filesystem 1k-blocks Used Available Use% Mounted on 287 Filesystem 1k-blocks Used Available Use% Mounted on
@@ -273,12 +291,31 @@ Exmaple:
273 Filesystem 1k-blocks Used Available Use% Mounted on 291 Filesystem 1k-blocks Used Available Use% Mounted on
274 /dev/sda3 8690864 8553540 137324 98% / 292 /dev/sda3 8690864 8553540 137324 98% /
275 293
294-------------------------------
295
296=item dirname
297
298Usage: dirname NAME
299
300Strip non-directory suffix from file name
301
302Example:
303
304 $ dirname /tmp/foo
305 /tmp
306 $ dirname /tmp/foo/
307 /tmp
308
309-------------------------------
310
276=item dmesg 311=item dmesg
277 312
278Usage: dmesg [B<-c>] [B<-n> level] [B<-s> bufsize] 313Usage: dmesg [B<-c>] [B<-n> level] [B<-s> bufsize]
279 314
280Print or controls the kernel ring buffer. 315Print or controls the kernel ring buffer.
281 316
317-------------------------------
318
282=item du 319=item du
283 320
284Usage: du [OPTION]... [FILE]... 321Usage: du [OPTION]... [FILE]...
@@ -288,8 +325,8 @@ Disk space is printed in units of 1k (i.e. 1024 bytes).
288 325
289Options: 326Options:
290 327
291 -l count sizes many times if hard linked 328 -l count sizes many times if hard linked
292 -s display only a total for each argument 329 -s display only a total for each argument
293 330
294Example: 331Example:
295 332
@@ -305,6 +342,56 @@ Example:
305 104 ./docs 342 104 ./docs
306 2417 . 343 2417 .
307 344
345-------------------------------
346
347=item dutmp
348
349Usage: dutmp [FILE]
350
351Dump utmp file format (pipe delimited) from FILE
352or stdin to stdout.
353
354Example:
355
356 $ dutmp /var/run/utmp
357 8|7||si|||0|0|0|955637625|760097|0
358 2|0|~|~~|reboot||0|0|0|955637625|782235|0
359 1|20020|~|~~|runlevel||0|0|0|955637625|800089|0
360 8|125||l4|||0|0|0|955637629|998367|0
361 6|245|tty1|1|LOGIN||0|0|0|955637630|998974|0
362 6|246|tty2|2|LOGIN||0|0|0|955637630|999498|0
363 7|336|pts/0|vt00andersen|andersen|:0.0|0|0|0|955637763|0|0
364
365-------------------------------
366
367=item echo
368
369Usage: echo [-neE] [ARG ...]
370
371Prints the specified ARGs to stdout
372
373Options:
374
375 -n suppress trailing newline
376 -e interpret backslash-escaped characters (i.e. \t=tab etc)
377 -E disable interpretation of backslash-escaped characters
378
379Example:
380
381 $ echo "Erik is cool"
382 Erik is cool
383 $ echo -e "Erik\nis\ncool"
384 Erik
385 is
386 cool
387 $ echo "Erik\nis\ncool"
388 Erik\nis\ncool
389
390-------------------------------
391
392=item false
393
394-------------------------------
308 395
309=item fbset 396=item fbset
310 397
@@ -314,19 +401,39 @@ Show and modify frame buffer device settings
314 401
315Options: 402Options:
316 403
317 -h 404 -h
318 -fb 405 -fb
319 -db 406 -db
320 -a 407 -a
321 -i 408 -i
322 -g 409 -g
323 -t 410 -t
324 -accel 411 -accel
325 -hsync 412 -hsync
326 -vsync 413 -vsync
327 -laced 414 -laced
328 -double 415 -double
416
417Example:
418
419 $ fbset
420 mode "1024x768-76"
421 # D: 78.653 MHz, H: 59.949 kHz, V: 75.694 Hz
422 geometry 1024 768 1024 768 16
423 timings 12714 128 32 16 4 128 4
424 accel false
425 rgba 5/11,6/5,5/0,0/0
426 endmode
427
428-------------------------------
329 429
430=item fdflush
431
432Usage: fdflush device
433
434Force floppy disk drive to detect disk change
435
436-------------------------------
330 437
331=item find 438=item find
332 439
@@ -337,18 +444,18 @@ the current directory; default EXPRESSION is '-print'
337 444
338 445
339EXPRESSION may consist of: 446EXPRESSION may consist of:
340 -follow 447
341 Dereference symbolic links. 448 -follow Dereference symbolic links.
342 -name PATTERN 449 -name PATTERN File name (leading directories removed) matches PATTERN.
343 File name (with leading directories removed) matches PATTERN. 450 -print print the full file name followed by a newline to stdout.
344 -print
345 print the full file name followed by a newline to stdout.
346 451
347Example: 452Example:
348 453
349 $ find / -name /etc/passwd 454 $ find / -name /etc/passwd
350 /etc/passwd 455 /etc/passwd
351 456
457-------------------------------
458
352=item free 459=item free
353 460
354Usage: free 461Usage: free
@@ -363,6 +470,19 @@ Example:
363 Swap: 128516 8404 120112 470 Swap: 128516 8404 120112
364 Total: 386144 257128 129016 471 Total: 386144 257128 129016
365 472
473-------------------------------
474
475=item freeramdisk
476
477Usage: freeramdisk DEVICE
478
479Free all memory used by the specified ramdisk.
480
481Example:
482
483 $ freeramdisk /dev/ram2
484
485-------------------------------
366 486
367=item deallocvt 487=item deallocvt
368 488
@@ -370,6 +490,7 @@ Usage: deallocvt N
370 490
371Deallocates unused virtual terminal /dev/ttyN 491Deallocates unused virtual terminal /dev/ttyN
372 492
493-------------------------------
373 494
374=item fsck.minix 495=item fsck.minix
375 496
@@ -379,14 +500,15 @@ Performs a consistency check for MINIX filesystems.
379 500
380OPTIONS: 501OPTIONS:
381 502
382 -l Lists all filenames 503 -l Lists all filenames
383 -r Perform interactive repairs 504 -r Perform interactive repairs
384 -a Perform automatic repairs 505 -a Perform automatic repairs
385 -v verbose 506 -v verbose
386 -s Outputs super-block information 507 -s Outputs super-block information
387 -m Activates MINIX-like "mode not cleared" warnings 508 -m Activates MINIX-like "mode not cleared" warnings
388 -f Force file system check. 509 -f Force file system check.
389 510
511-------------------------------
390 512
391=item mkfs.minix 513=item mkfs.minix
392 514
@@ -396,12 +518,13 @@ Make a MINIX filesystem.
396 518
397OPTIONS: 519OPTIONS:
398 520
399 -c Check the device for bad blocks 521 -c Check the device for bad blocks
400 -n [14|30] Specify the maximum length of filenames 522 -n [14|30] Specify the maximum length of filenames
401 -i Specify the number of inodes for the filesystem 523 -i Specify the number of inodes for the filesystem
402 -l FILENAME Read the bad blocks list from FILENAME 524 -l FILENAME Read the bad blocks list from FILENAME
403 -v Make a Minix version 2 filesystem 525 -v Make a Minix version 2 filesystem
404 526
527-------------------------------
405 528
406=item grep 529=item grep
407 530
@@ -411,14 +534,13 @@ Search for PATTERN in each FILE or standard input.
411 534
412OPTIONS: 535OPTIONS:
413 536
414 -h suppress the prefixing filename on output 537 -h suppress the prefixing filename on output
415 -i ignore case distinctions 538 -i ignore case distinctions
416 -n print line number with output lines 539 -n print line number with output lines
417 -q be quiet. Returns 0 if result was found, 1 otherwise 540 -q be quiet. Returns 0 if result was found, 1 otherwise
418 541
419This version of grep matches full regular expresions. 542This version of grep matches full regular expresions.
420 543
421
422Example: 544Example:
423 545
424 $ grep root /etc/passwd 546 $ grep root /etc/passwd
@@ -426,6 +548,23 @@ Example:
426 $ grep ^[rR]oo. /etc/passwd 548 $ grep ^[rR]oo. /etc/passwd
427 root:x:0:0:root:/root:/bin/bash 549 root:x:0:0:root:/root:/bin/bash
428 550
551-------------------------------
552
553=item gunzip
554
555
556-------------------------------
557
558=item gzip
559
560
561-------------------------------
562
563=item halt
564
565
566-------------------------------
567
429=item head 568=item head
430 569
431Usage: head [OPTION] [FILE]... 570Usage: head [OPTION] [FILE]...
@@ -436,7 +575,7 @@ file name. With no FILE, or when FILE is -, read standard input.
436 575
437Options: 576Options:
438 577
439 -n NUM Print first NUM lines instead of first 10 578 -n NUM Print first NUM lines instead of first 10
440 579
441Example: 580Example:
442 581
@@ -444,6 +583,13 @@ Example:
444 root:x:0:0:root:/root:/bin/bash 583 root:x:0:0:root:/root:/bin/bash
445 daemon:x:1:1:daemon:/usr/sbin:/bin/sh 584 daemon:x:1:1:daemon:/usr/sbin:/bin/sh
446 585
586-------------------------------
587
588=item hostid
589
590
591-------------------------------
592
447=item hostname 593=item hostname
448 594
449Usage: hostname [OPTION] {hostname | B<-F> file} 595Usage: hostname [OPTION] {hostname | B<-F> file}
@@ -453,16 +599,23 @@ Get or set the hostname or DNS domain name. If a hostname is given
453 599
454Options: 600Options:
455 601
456 -s Short 602 -s Short
457 -i Addresses for the hostname 603 -i Addresses for the hostname
458 -d DNS domain name 604 -d DNS domain name
459 -F FILE Use the contents of FILE to specify the hostname 605 -F FILE Use the contents of FILE to specify the hostname
460 606
461Example: 607Example:
462 608
463 $ hostname 609 $ hostname
464 slag 610 slag
465 611
612-------------------------------
613
614=item init
615
616
617-------------------------------
618
466=item kill 619=item kill
467 620
468Usage: kill [B<-signal>] process-id [process-id ...] 621Usage: kill [B<-signal>] process-id [process-id ...]
@@ -471,7 +624,7 @@ Send a signal (default is SIGTERM) to the specified process(es).
471 624
472Options: 625Options:
473 626
474 -l List all signal names and numbers. 627 -l List all signal names and numbers.
475 628
476Example: 629Example:
477 630
@@ -484,6 +637,17 @@ Example:
484 267 www-data www-data S [apache] 637 267 www-data www-data S [apache]
485 $ kill 252 638 $ kill 252
486 639
640-------------------------------
641
642=item killall
643
644-------------------------------
645
646=item length
647
648
649-------------------------------
650
487=item ln 651=item ln
488 652
489Usage: ln [OPTION] TARGET... LINK_NAME|DIRECTORY 653Usage: ln [OPTION] TARGET... LINK_NAME|DIRECTORY
@@ -491,332 +655,339 @@ Create a link named LINK_NAME or DIRECTORY to the specified TARGET
491 655
492Options: 656Options:
493 657
494 -s make symbolic links instead of hard links 658 -s make symbolic links instead of hard links
495 -f remove existing destination files 659 -f remove existing destination files
496 660
661Example:
662
663 $ ln -s busybox /tmp/ls
664 [andersen@debian busybox]$ ls -l /tmp/ls
665 lrwxrwxrwx 1 root root 7 Apr 12 18:39 ls -> busybox*
666
667-------------------------------
668
669=item loadacm
670
671-------------------------------
672
673=item loadfont
674
675-------------------------------
676
677=item loadkmap
678
679-------------------------------
497 680
498=item ls 681=item ls
499 682
500Usage: ls [B<-1acdelnpuxACF>] [filenames...] 683Usage: ls [B<-1acdelnpuxACF>] [filenames...]
684
685Options:
686
687 -a do not hide entries starting with .
688 -c with -l: show ctime (the time of last
689 modification of file status information)
690 -d list directory entries instead of contents
691 -e list both full date and full time
692 -l use a long listing format
693 -n list numeric UIDs and GIDs instead of names
694 -p append indicator (one of /=@|) to entries
695 -u with -l: show access time (the time of last
696 access of the file)
697 -x list entries by lines instead of by columns
698 -A do not list implied . and ..
699 -C list entries by columns
700 -F append indicator (one of */=@|) to entries
501 701
702-------------------------------
502 703
503=item lsmod 704=item lsmod
504 705
706Usage: lsmod
707
708Shows information about all loaded modules.
709
710-------------------------------
711
712=item makedevs
505 713
714-------------------------------
715
716=item math
717
718-------------------------------
506 719
507=item mkdir 720=item mkdir
508 721
509Usage: Usage: mkdir [OPTION] DIRECTORY... 722Usage: mkdir [OPTION] DIRECTORY...
723
510Create the DIRECTORY(ies), if they do not already exist 724Create the DIRECTORY(ies), if they do not already exist
511 725
512Options: 726Options:
513 727
514 -m set permission mode (as in chmod), not rwxrwxrwx - umask 728 -m set permission mode (as in chmod), not rwxrwxrwx - umask
515 -p no error if existing, make parent directories as needed 729 -p no error if dir exists, make parent directories as needed
516 730
731Example:
732
733 $ mkdir /tmp/foo
734 $ mkdir /tmp/foo
735 /tmp/foo: File exists
736 $ mkdir /tmp/foo/bar/baz
737 /tmp/foo/bar/baz: No such file or directory
738 $ mkdir -p /tmp/foo/bar/baz
739
740-------------------------------
741
742=item mkfifo
743
744-------------------------------
517 745
518=item mknod 746=item mknod
519 747
520Usage: mknod NAME TYPE MAJOR MINOR 748Usage: mknod NAME TYPE MAJOR MINOR
749
521Make block or character special files. 750Make block or character special files.
522 751
523TYPEs include: 752TYPEs include:
524 753
525 b: Make a block (buffered) device. 754 b: Make a block (buffered) device.
526 c or u: Make a character (un-buffered) device. 755 c or u: Make a character (un-buffered) device.
527 p: Make a named pipe. Major and minor are ignored for named pipes. 756 p: Make a named pipe. Major and minor are ignored for named pipes.
528 757
758Example:
759
760 $ mknod /dev/fd0 b 2 0
761
762-------------------------------
529 763
530=item mkswap 764=item mkswap
531 765
532Usage: mkswap [B<-c>] [-v0|-v1] device [block-count] 766Usage: mkswap [B<-c>] [B<-v0>|B<-v1>] device [block-count]
767
533Prepare a disk partition to be used as a swap partition. 768Prepare a disk partition to be used as a swap partition.
534 769
535Options: 770Options:
536 771
537 -c Check for read-ability. 772 -c Check for read-ability.
538 -v0 Make version 0 swap [max 128 Megs]. 773 -v0 Make version 0 swap [max 128 Megs].
539 -v1 Make version 1 swap [big!] (default for kernels > 2.1.117). 774 -v1 Make version 1 swap [big!] (default for kernels > 2.1.117).
540 block-count Number of block to use (default is entire partition). 775 block-count Number of block to use (default is entire partition).
541 776
777-------------------------------
778
779=item mnc
780
781-------------------------------
542 782
543=item more 783=item more
544 784
545Usage: more [file ...] 785Usage: more [file ...]
786
787More is a filter for paging through text one screenful at a time.
788
789Example:
790
791 $ dmesg | more
546 792
793-------------------------------
547 794
548=item mount 795=item mount
549 796
550Usage: mount [flags] 797Usage: mount [flags]
551 798 mount [flags] device directory [B<-o> options,more-options]
552mount [flags] device directory [B<-o> options,more-options]
553
554 Flags:
555 -a: Mount all file systems in fstab.
556 -o option: One of many filesystem options, listed below.
557 -r: Mount the filesystem read-only.
558 -t filesystem-type: Specify the filesystem type.
559 -w: Mount for reading and writing (default).
560 Options for use with the "-o" flag:
561 async / sync: Writes are asynchronous / synchronous.
562 dev / nodev: Allow use of special device files / disallow them.
563 exec / noexec: Allow use of executable files / disallow them.
564 loop: Mounts a file via loop device.
565 suid / nosuid: Allow set-user-id-root programs / disallow them.
566 remount: Re-mount a currently-mounted filesystem, changing its flags.
567 ro / rw: Mount for read-only / read-write.
568
569There are EVEN MORE flags that are specific to each filesystem.
570You'll have to see the written documentation for those.
571
572 799
573=item mv 800Flags:
574 801
575Usage: mv SOURCE DEST 802 -a: Mount all file systems in fstab.
803 -o option: One of many filesystem options, listed below.
804 -r: Mount the filesystem read-only.
805 -t filesystem-type: Specify the filesystem type.
806 -w: Mount for reading and writing (default).
576 807
577or: mv SOURCE... DIRECTORY 808Options for use with the "B<-o>" flag:
578 809
579Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY. 810 async / sync: Writes are asynchronous / synchronous.
580 811 dev / nodev: Allow use of special device files / disallow them.
812 exec / noexec: Allow use of executable files / disallow them.
813 loop: Mounts a file via loop device.
814 suid / nosuid: Allow set-user-id-root programs / disallow them.
815 remount: Re-mount a currently-mounted filesystem, changing its flags.
816 ro / rw: Mount for read-only / read-write.
817 There are EVEN MORE flags that are specific to each filesystem.
818 You'll have to see the written documentation for those.
581 819
582=item ping 820Example:
583 821
822 $ mount
823 /dev/hda3 on / type minix (rw)
824 proc on /proc type proc (rw)
825 devpts on /dev/pts type devpts (rw)
826 $ mount /dev/fd0 /mnt -t msdos -o ro
827 $ mount /tmp/diskimage /opt -t ext2 -o loop
828
829-------------------------------
584 830
831=item mt
585 832
586=item poweroff 833-------------------------------
587 834
835=item mv
588 836
837Usage: mv SOURCE DEST
589 838
590=item ps 839 or: mv SOURCE... DIRECTORY
840
841Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
591 842
592Usage: ps 843Example:
593 844
594Report process status. 845 $ mv /tmp/foo /bin/bar
595This version of ps accepts no options.
596 846
847-------------------------------
597 848
598=item pwd 849=item nslookup
599 850
851-------------------------------
600 852
853=item poweroff
601 854
602=item reboot 855-------------------------------
603 856
857=item ping
604 858
859Usage: ping [OPTION]... host
605 860
606=item rm 861Send ICMP ECHO_REQUEST packets to network hosts.
607 862
608Usage: rm [OPTION]... FILE...
609Remove (unlink) the FILE(s).
610
611Options: 863Options:
612 864
613 -f remove existing destinations, never prompt 865 -c COUNT Send only COUNT pings.
614 -r or -R remove the contents of directories recursively 866 -q Quiet mode, only displays output at start
615 867 and when finished.
868Example:
616 869
617=item rmdir 870 $ ping localhost
871 PING slag (127.0.0.1): 56 data bytes
872 64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=20.1 ms
618 873
619Usage: rmdir [OPTION]... DIRECTORY... 874 --- debian ping statistics ---
620Remove the DIRECTORY(ies), if they are empty. 875 1 packets transmitted, 1 packets received, 0% packet loss
621 876 round-trip min/avg/max = 20.1/20.1/20.1 ms
622 877
623=item sed 878-------------------------------
624 879
625Usage: sed [B<-n>] B<-e> script [file...] 880=item printf
626Allowed sed scripts come in the following form:
627 881
628 'ADDR [!] COMMAND' 882-------------------------------
629 where address ADDR can be:
630 NUMBER Match specified line number
631 $ Match last line
632 /REGEXP/ Match specified regexp
633 (! inverts the meaning of the match)
634 and COMMAND can be:
635 s/regexp/replacement/[igp]
636 which attempt to match regexp against the pattern space
637 and if successful replaces the matched portion with replacement.
638 aTEXT
639 which appends TEXT after the pattern space
640 883
641Options: 884=item ps
642 885
643 -e add the script to the commands to be executed 886-------------------------------
644 -n suppress automatic printing of pattern space
645 887
646This version of sed matches full regular expresions. 888=item pwd
647
648
649=item sleep
650 889
651Usage: sleep N 890-------------------------------
652 891
653Pause for N seconds. 892=item reboot
654
655 893
656=item sort 894-------------------------------
657 895
658Usage: Usage: sort [OPTION]... [FILE]... 896=item rm
659
660 897
661=item sync 898-------------------------------
662 899
663Usage: sync 900=item syslogd
664 901
665Write all buffered filesystem blocks to disk. 902-------------------------------
666
667 903
668=item syslogd 904=item logger
669 905
670Usage: syslogd [OPTION]... 906-------------------------------
671 907
672Linux system and kernel (provides klogd) logging utility. 908=item logname
673Note that this version of syslogd/klogd ignores /etc/syslog.conf.
674
675Options:
676 909
677 -m Change the mark timestamp interval. default=20min. 0=off 910-------------------------------
678 -n Do not fork into the background (for when run by init)
679 -K Do not start up the klogd process (by default syslogd spawns klogd).
680 -O Specify an alternate log file. default=/var/log/messages
681
682 911
683=item swapon 912=item swapon
684 913
685Usage: swapon device 914-------------------------------
686
687Start swapping virtual memory pages on the given device.
688
689 915
690=item swapoff 916=item swapoff
691 917
692Usage: swapoff device 918-------------------------------
693
694Stop swapping virtual memory pages on the given device.
695
696 919
697=item tail 920=item tail
698 921
699Usage: tail [OPTION]... [FILE]... 922-------------------------------
700
701Print last 10 lines of each FILE to standard output.
702With more than one FILE, precede each with a header giving the file name.
703With no FILE, or when FILE is -, read standard input.
704
705 -c=N[kbm] output the last N bytes
706 -f output appended data as the file grows
707 -n=N output the last N lines, instead of last 10
708 -q never output headers giving file names
709 -v always output headers giving file names
710 --help display this help and exit
711
712If the first character of N (bytes or lines) is a `+', output begins with
713the Nth item from the start of each file, otherwise, print the last N items
714in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2).
715
716 923
717=item tar 924=item tar
718 925
926-------------------------------
719 927
928=item test, [
929
930-------------------------------
720 931
721=item tee 932=item tee
722 933
723Usage: tee [OPTION]... [FILE]... 934-------------------------------
724Copy standard input to each FILE, and also to standard output.
725
726Options:
727
728 -a append to the given FILEs, do not overwrite
729
730 935
731=item touch 936=item touch
732 937
733Usage: touch [B<-c>] file [file ...] 938-------------------------------
734 Update the last-modified date on the given file[s].
735
736
737=item true
738 939
940=item tr
739 941
942-------------------------------
740 943
741=item false 944=item true
742 945
946-------------------------------
743 947
948=item tty
744 949
745=item uname 950-------------------------------
746 951
747Usage: uname [OPTION]... 952=item umount
748
749Print certain system information. With no OPTION, same as B<-s>.
750
751Options:
752 953
753 -a print all information 954-------------------------------
754 -m the machine (hardware) type
755 -n print the machine's network node hostname
756 -r print the operating system release
757 -s print the operating system name
758 -p print the host processor type
759 -v print the operating system version
760
761 955
762=item umount 956=item uname
763 957
764Usage: Usage: umount [flags] filesystem|directory 958-------------------------------
765 959
766Flags: 960=item uptime
767 961
768 -a: Unmount all file systems 962-------------------------------
769
770 963
771=item uniq 964=item uniq
772 965
773Usage: Usage: uniq [OPTION]... [INPUT [OUTPUT]] 966-------------------------------
774 967
775Discard all but one of successive identical lines from INPUT (or 968=item update
776standard input), writing to OUTPUT (or standard output).
777 969
778 -h display this help and exit 970-------------------------------
779 971
780A field is a run of whitespace, then non-whitespace characters. 972=item usleep
781Fields are skipped before chars.
782
783 973
784=item zcat 974-------------------------------
785 975
786Usage: gunzip [OPTION]... FILE 976=item wc
787 977
788Uncompress FILE (or standard input if FILE is '-'). 978-------------------------------
789
790Options:
791 979
792 -c Write output to standard output 980=item whoami
793 -t Test compressed file integrity
794
795 981
796=item gunzip 982-------------------------------
797 983
798Usage: gunzip [OPTION]... FILE 984=item yes
799 985
800Uncompress FILE (or standard input if FILE is '-'). 986-------------------------------
801
802Options:
803 987
804 -c Write output to standard output 988=item zcat
805 -t Test compressed file integrity
806
807
808=item gzip
809
810Usage: gzip [OPTION]... FILE
811
812Compress FILE with maximum compression.
813When FILE is -, reads standard input. Implies B<-c>.
814
815Options:
816
817 -c Write output to standard output instead of FILE.gz
818
819 989
990-------------------------------
820 991
821=back 992=back
822 993
@@ -869,5 +1040,9 @@ Enrique Zanardi <ezanardi@ull.es>
869 1040
870=for html <br> 1041=for html <br>
871 1042
1043Karl M. Hegbloom <karlheg@debian.org>
1044
1045=for html <br>
1046
872=cut 1047=cut
873 1048
diff --git a/dutmp.c b/dutmp.c
index cf0d466ef..1629067a1 100644
--- a/dutmp.c
+++ b/dutmp.c
@@ -19,10 +19,9 @@
19#define bb_need_io_error 19#define bb_need_io_error
20#include "messages.c" 20#include "messages.c"
21 21
22static const char dutmp_usage[] = "dutmp\n" 22static const char dutmp_usage[] = "dutmp [FILE]\n\n"
23 "\n" 23 "Dump utmp file format (pipe delimited) from FILE\n"
24 "\tDump file or stdin utmp file format to stdout, pipe delimited.\n" 24 "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n";
25 "\tdutmp /var/run/utmp\n";
26 25
27extern int dutmp_main(int argc, char **argv) 26extern int dutmp_main(int argc, char **argv)
28{ 27{
diff --git a/echo.c b/echo.c
index 91f17aa0f..2405d0ae1 100644
--- a/echo.c
+++ b/echo.c
@@ -25,6 +25,14 @@
25#include "internal.h" 25#include "internal.h"
26#include <stdio.h> 26#include <stdio.h>
27 27
28static const char uname_usage[] =
29 "echo [-neE] [ARG ...]\n\n"
30 "Prints the specified ARGs to stdout\n\n"
31 "Options:\n"
32 "\t-n\tsuppress trailing newline\n"
33 "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n"
34 "\t-E\tdisable interpretation of backslash-escaped characters\n";
35
28extern int 36extern int
29echo_main(int argc, char** argv) 37echo_main(int argc, char** argv)
30{ 38{
@@ -45,6 +53,9 @@ echo_main(int argc, char** argv)
45 } else if (strcmp(p, "-E")==0) { 53 } else if (strcmp(p, "-E")==0) {
46 eflag = 0; 54 eflag = 0;
47 } 55 }
56 else if (strncmp(p, "--", 2)==0) {
57 usage( uname_usage);
58 }
48 else break; 59 else break;
49 ap++; 60 ap++;
50 } 61 }
diff --git a/fbset.c b/fbset.c
index 1f471dada..4e5609e41 100644
--- a/fbset.c
+++ b/fbset.c
@@ -104,9 +104,9 @@ struct cmdoptions_t {
104 "-hsync", 1, CMD_HSYNC}, { 104 "-hsync", 1, CMD_HSYNC}, {
105 "-vsync", 1, CMD_VSYNC}, { 105 "-vsync", 1, CMD_VSYNC}, {
106 "-laced", 1, CMD_LACED}, { 106 "-laced", 1, CMD_LACED}, {
107 "-double", 1, CMD_DOUBLE}, 107 "-double", 1, CMD_DOUBLE}, {
108 "--help", 0, CMD_HELP}, {
108#ifdef BB_FEATURE_FBSET_FANCY 109#ifdef BB_FEATURE_FBSET_FANCY
109 {
110 "--help", 0, CMD_HELP}, { 110 "--help", 0, CMD_HELP}, {
111 "-all", 0, CMD_ALL}, { 111 "-all", 0, CMD_ALL}, {
112 "-xres", 1, CMD_XRES}, { 112 "-xres", 1, CMD_XRES}, {
@@ -130,9 +130,8 @@ struct cmdoptions_t {
130 "-bcast", 1, CMD_BCAST}, { 130 "-bcast", 1, CMD_BCAST}, {
131 "-rgba", 1, CMD_RGBA}, { 131 "-rgba", 1, CMD_RGBA}, {
132 "-step", 1, CMD_STEP}, { 132 "-step", 1, CMD_STEP}, {
133 "-move", 1, CMD_MOVE}, 133 "-move", 1, CMD_MOVE}, {
134#endif 134#endif
135 {
136 0, 0, 0} 135 0, 0, 0}
137}; 136};
138 137
@@ -217,7 +216,7 @@ static void showmode(struct fb_var_screeninfo *v)
217 printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length, 216 printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length,
218 v->red.offset, v->green.length, v->green.offset, v->blue.length, 217 v->red.offset, v->green.length, v->green.offset, v->blue.length,
219 v->blue.offset, v->transp.length, v->transp.offset); 218 v->blue.offset, v->transp.length, v->transp.offset);
220 printf("endmode\n"); 219 printf("endmode\n\n");
221} 220}
222 221
223static void fbset_usage(void) 222static void fbset_usage(void)
diff --git a/fdflush.c b/fdflush.c
index 201cea898..56ea2244d 100644
--- a/fdflush.c
+++ b/fdflush.c
@@ -33,8 +33,8 @@ extern int fdflush_main(int argc, char **argv)
33 int value; 33 int value;
34 int fd; 34 int fd;
35 35
36 if (argc <= 1 || **(argv++) == '-') { 36 if (argc <= 1 || **(++argv) == '-') {
37 usage("fdflush device\n"); 37 usage("fdflush device\n\nForce floppy disk drive to detect disk change\n");
38 } 38 }
39 39
40 fd = open(*argv, 0); 40 fd = open(*argv, 0);
diff --git a/find.c b/find.c
index 8fdef2382..f6e63afb9 100644
--- a/find.c
+++ b/find.c
@@ -37,9 +37,9 @@ static const char find_usage[] = "find [PATH...] [EXPRESSION]\n\n"
37 "Search for files in a directory hierarchy. The default PATH is\n" 37 "Search for files in a directory hierarchy. The default PATH is\n"
38 "the current directory; default EXPRESSION is '-print'\n\n" 38 "the current directory; default EXPRESSION is '-print'\n\n"
39 "\nEXPRESSION may consist of:\n" 39 "\nEXPRESSION may consist of:\n"
40 "\t-follow\n\t\tDereference symbolic links.\n" 40 "\t-follow\t\tDereference symbolic links.\n"
41 "\t-name PATTERN\n\t\tFile name (with leading directories removed) matches PATTERN.\n" 41 "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN.\n"
42 "\t-print\n\t\tprint the full file name followed by a newline to stdout.\n"; 42 "\t-print\t\tprint the full file name followed by a newline to stdout.\n";
43 43
44 44
45static int fileAction(const char *fileName, struct stat *statbuf, void* junk) 45static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
diff --git a/findutils/find.c b/findutils/find.c
index 8fdef2382..f6e63afb9 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -37,9 +37,9 @@ static const char find_usage[] = "find [PATH...] [EXPRESSION]\n\n"
37 "Search for files in a directory hierarchy. The default PATH is\n" 37 "Search for files in a directory hierarchy. The default PATH is\n"
38 "the current directory; default EXPRESSION is '-print'\n\n" 38 "the current directory; default EXPRESSION is '-print'\n\n"
39 "\nEXPRESSION may consist of:\n" 39 "\nEXPRESSION may consist of:\n"
40 "\t-follow\n\t\tDereference symbolic links.\n" 40 "\t-follow\t\tDereference symbolic links.\n"
41 "\t-name PATTERN\n\t\tFile name (with leading directories removed) matches PATTERN.\n" 41 "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN.\n"
42 "\t-print\n\t\tprint the full file name followed by a newline to stdout.\n"; 42 "\t-print\t\tprint the full file name followed by a newline to stdout.\n";
43 43
44 44
45static int fileAction(const char *fileName, struct stat *statbuf, void* junk) 45static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
diff --git a/freeramdisk.c b/freeramdisk.c
index 06937a70f..9636dbdcf 100644
--- a/freeramdisk.c
+++ b/freeramdisk.c
@@ -34,7 +34,7 @@
34 34
35static const char freeramdisk_usage[] = 35static const char freeramdisk_usage[] =
36 "freeramdisk DEVICE\n\n" 36 "freeramdisk DEVICE\n\n"
37 "Frees all memory used by the specified ramdisk.\n"; 37 "Free all memory used by the specified ramdisk.\n";
38 38
39extern int 39extern int
40freeramdisk_main(int argc, char **argv) 40freeramdisk_main(int argc, char **argv)
@@ -42,7 +42,7 @@ freeramdisk_main(int argc, char **argv)
42 char rname[256] = "/dev/ram"; 42 char rname[256] = "/dev/ram";
43 int f; 43 int f;
44 44
45 if (argc > 2 || ( argv[1] && *argv[1] == '-')) { 45 if (argc < 2 || ( argv[1] && *argv[1] == '-')) {
46 usage(freeramdisk_usage); 46 usage(freeramdisk_usage);
47 } 47 }
48 48
@@ -50,10 +50,10 @@ freeramdisk_main(int argc, char **argv)
50 strcpy(rname, argv[1]); 50 strcpy(rname, argv[1]);
51 51
52 if ((f = open(rname, O_RDWR)) == -1) { 52 if ((f = open(rname, O_RDWR)) == -1) {
53 fatalError( "freeramdisk: cannot open %s: %s", rname, strerror(errno)); 53 fatalError( "freeramdisk: cannot open %s: %s\n", rname, strerror(errno));
54 } 54 }
55 if (ioctl(f, BLKFLSBUF) < 0) { 55 if (ioctl(f, BLKFLSBUF) < 0) {
56 fatalError( "freeramdisk: failed ioctl on %s: %s", rname, strerror(errno)); 56 fatalError( "freeramdisk: failed ioctl on %s: %s\n", rname, strerror(errno));
57 } 57 }
58 /* Don't bother closing. Exit does 58 /* Don't bother closing. Exit does
59 * that, so we can save a few bytes */ 59 * that, so we can save a few bytes */
diff --git a/ls.c b/ls.c
index 3e010503c..0c7f6522c 100644
--- a/ls.c
+++ b/ls.c
@@ -88,7 +88,6 @@
88#define DISP_FULLTIME 32 /* show extended time display */ 88#define DISP_FULLTIME 32 /* show extended time display */
89#define DIR_NOLIST 64 /* show directory as itself, not contents */ 89#define DIR_NOLIST 64 /* show directory as itself, not contents */
90#define DISP_DIRNAME 128 /* show directory name (for internal use) */ 90#define DISP_DIRNAME 128 /* show directory name (for internal use) */
91#define DIR_RECURSE 256 /* -R (not yet implemented) */
92 91
93#ifndef MAJOR 92#ifndef MAJOR
94#define MAJOR(dev) (((dev)>>8)&0xff) 93#define MAJOR(dev) (((dev)>>8)&0xff)
@@ -450,10 +449,33 @@ static const char ls_usage[] = "ls [-1a"
450#ifdef BB_FEATURE_LS_FILETYPES 449#ifdef BB_FEATURE_LS_FILETYPES
451 "F" 450 "F"
452#endif 451#endif
453#ifdef FEATURE_RECURSIVE 452 "] [filenames...]\n\n"
454 "R" 453 "Options:\n"
454 "\t-a\tdo not hide entries starting with .\n"
455#ifdef BB_FEATURE_LS_TIMESTAMPS
456 "\t-c\twith -l: show ctime (the time of last\n"
457 "\t\tmodification of file status information)\n"
458#endif
459 "\t-d\tlist directory entries instead of contents\n"
460#ifdef BB_FEATURE_LS_TIMESTAMPS
461 "\t-e\tlist both full date and full time\n"
455#endif 462#endif
456 "] [filenames...]\n"; 463 "\t-l\tuse a long listing format\n"
464 "\t-n\tlist numeric UIDs and GIDs instead of names\n"
465#ifdef BB_FEATURE_LS_FILETYPES
466 "\t-p\tappend indicator (one of /=@|) to entries\n"
467#endif
468#ifdef BB_FEATURE_LS_TIMESTAMPS
469 "\t-u\twith -l: show access time (the time of last\n"
470 "\t\taccess of the file)\n"
471#endif
472 "\t-x\tlist entries by lines instead of by columns\n"
473 "\t-A\tdo not list implied . and ..\n"
474 "\t-C\tlist entries by columns\n"
475#ifdef BB_FEATURE_LS_FILETYPES
476 "\t-F\tappend indicator (one of */=@|) to entries\n"
477#endif
478 ;
457 479
458extern int ls_main(int argc, char **argv) 480extern int ls_main(int argc, char **argv)
459{ 481{
@@ -508,11 +530,6 @@ extern int ls_main(int argc, char **argv)
508 case 'd': 530 case 'd':
509 opts |= DIR_NOLIST; 531 opts |= DIR_NOLIST;
510 break; 532 break;
511#ifdef FEATURE_RECURSIVE
512 case 'R':
513 opts |= DIR_RECURSE;
514 break;
515#endif
516#ifdef BB_FEATURE_LS_TIMESTAMPS 533#ifdef BB_FEATURE_LS_TIMESTAMPS
517 case 'u': 534 case 'u':
518 time_fmt = TIME_ACCESS; 535 time_fmt = TIME_ACCESS;
diff --git a/miscutils/dutmp.c b/miscutils/dutmp.c
index cf0d466ef..1629067a1 100644
--- a/miscutils/dutmp.c
+++ b/miscutils/dutmp.c
@@ -19,10 +19,9 @@
19#define bb_need_io_error 19#define bb_need_io_error
20#include "messages.c" 20#include "messages.c"
21 21
22static const char dutmp_usage[] = "dutmp\n" 22static const char dutmp_usage[] = "dutmp [FILE]\n\n"
23 "\n" 23 "Dump utmp file format (pipe delimited) from FILE\n"
24 "\tDump file or stdin utmp file format to stdout, pipe delimited.\n" 24 "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n";
25 "\tdutmp /var/run/utmp\n";
26 25
27extern int dutmp_main(int argc, char **argv) 26extern int dutmp_main(int argc, char **argv)
28{ 27{
diff --git a/mknod.c b/mknod.c
index b11a81f2a..40f508d33 100644
--- a/mknod.c
+++ b/mknod.c
@@ -70,7 +70,7 @@ int mknod_main(int argc, char **argv)
70 70
71 if (mknod(argv[1], mode, dev) != 0) { 71 if (mknod(argv[1], mode, dev) != 0) {
72 perror(argv[1]); 72 perror(argv[1]);
73 return (FALSE); 73 exit (FALSE);
74 } 74 }
75 return (TRUE); 75 exit (TRUE);
76} 76}
diff --git a/mount.c b/mount.c
index 329c07780..972e5066c 100644
--- a/mount.c
+++ b/mount.c
@@ -83,8 +83,6 @@ static const char mount_usage[] = "\tmount [flags]\n"
83 "\tsuid / nosuid:\tAllow set-user-id-root programs / disallow them.\n" 83 "\tsuid / nosuid:\tAllow set-user-id-root programs / disallow them.\n"
84 "\tremount: Re-mount a currently-mounted filesystem, changing its flags.\n" 84 "\tremount: Re-mount a currently-mounted filesystem, changing its flags.\n"
85 "\tro / rw: Mount for read-only / read-write.\n" 85 "\tro / rw: Mount for read-only / read-write.\n"
86 "\t"
87
88 "There are EVEN MORE flags that are specific to each filesystem.\n" 86 "There are EVEN MORE flags that are specific to each filesystem.\n"
89 "You'll have to see the written documentation for those.\n"; 87 "You'll have to see the written documentation for those.\n";
90 88
diff --git a/networking/ping.c b/networking/ping.c
index c9cf5ffb4..ef6503aeb 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * $Id: ping.c,v 1.11 2000/02/08 19:58:47 erik Exp $ 3 * $Id: ping.c,v 1.12 2000/04/13 18:49:43 erik Exp $
4 * Mini ping implementation for busybox 4 * Mini ping implementation for busybox
5 * 5 *
6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> 6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -182,9 +182,9 @@ extern int ping_main(int argc, char **argv)
182static const char *ping_usage = "ping [OPTION]... host\n\n" 182static const char *ping_usage = "ping [OPTION]... host\n\n"
183 "Send ICMP ECHO_REQUEST packets to network hosts.\n\n" 183 "Send ICMP ECHO_REQUEST packets to network hosts.\n\n"
184 "Options:\n" 184 "Options:\n"
185 "\t-q\t\tQuiet mode, only displays output at start" 185 "\t-c COUNT\tSend only COUNT pings.\n"
186 186 "\t-q\t\tQuiet mode, only displays output at start\n"
187 "\t\t\tand when finished.\n" "\t-c COUNT\tSend only COUNT pings.\n"; 187 "\t\t\tand when finished.\n";
188 188
189static char *hostname = NULL; 189static char *hostname = NULL;
190static struct sockaddr_in pingaddr; 190static struct sockaddr_in pingaddr;
@@ -418,9 +418,7 @@ extern int ping_main(int argc, char **argv)
418 argv++; 418 argv++;
419 options = 0; 419 options = 0;
420 /* Parse any options */ 420 /* Parse any options */
421 while (argc > 1) { 421 while (argc >= 1 && **argv == '-') {
422 if (**argv != '-')
423 usage(ping_usage);
424 thisarg = *argv; 422 thisarg = *argv;
425 thisarg++; 423 thisarg++;
426 switch (*thisarg) { 424 switch (*thisarg) {
diff --git a/ping.c b/ping.c
index c9cf5ffb4..ef6503aeb 100644
--- a/ping.c
+++ b/ping.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * $Id: ping.c,v 1.11 2000/02/08 19:58:47 erik Exp $ 3 * $Id: ping.c,v 1.12 2000/04/13 18:49:43 erik Exp $
4 * Mini ping implementation for busybox 4 * Mini ping implementation for busybox
5 * 5 *
6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> 6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -182,9 +182,9 @@ extern int ping_main(int argc, char **argv)
182static const char *ping_usage = "ping [OPTION]... host\n\n" 182static const char *ping_usage = "ping [OPTION]... host\n\n"
183 "Send ICMP ECHO_REQUEST packets to network hosts.\n\n" 183 "Send ICMP ECHO_REQUEST packets to network hosts.\n\n"
184 "Options:\n" 184 "Options:\n"
185 "\t-q\t\tQuiet mode, only displays output at start" 185 "\t-c COUNT\tSend only COUNT pings.\n"
186 186 "\t-q\t\tQuiet mode, only displays output at start\n"
187 "\t\t\tand when finished.\n" "\t-c COUNT\tSend only COUNT pings.\n"; 187 "\t\t\tand when finished.\n";
188 188
189static char *hostname = NULL; 189static char *hostname = NULL;
190static struct sockaddr_in pingaddr; 190static struct sockaddr_in pingaddr;
@@ -418,9 +418,7 @@ extern int ping_main(int argc, char **argv)
418 argv++; 418 argv++;
419 options = 0; 419 options = 0;
420 /* Parse any options */ 420 /* Parse any options */
421 while (argc > 1) { 421 while (argc >= 1 && **argv == '-') {
422 if (**argv != '-')
423 usage(ping_usage);
424 thisarg = *argv; 422 thisarg = *argv;
425 thisarg++; 423 thisarg++;
426 switch (*thisarg) { 424 switch (*thisarg) {
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index 1f471dada..4e5609e41 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -104,9 +104,9 @@ struct cmdoptions_t {
104 "-hsync", 1, CMD_HSYNC}, { 104 "-hsync", 1, CMD_HSYNC}, {
105 "-vsync", 1, CMD_VSYNC}, { 105 "-vsync", 1, CMD_VSYNC}, {
106 "-laced", 1, CMD_LACED}, { 106 "-laced", 1, CMD_LACED}, {
107 "-double", 1, CMD_DOUBLE}, 107 "-double", 1, CMD_DOUBLE}, {
108 "--help", 0, CMD_HELP}, {
108#ifdef BB_FEATURE_FBSET_FANCY 109#ifdef BB_FEATURE_FBSET_FANCY
109 {
110 "--help", 0, CMD_HELP}, { 110 "--help", 0, CMD_HELP}, {
111 "-all", 0, CMD_ALL}, { 111 "-all", 0, CMD_ALL}, {
112 "-xres", 1, CMD_XRES}, { 112 "-xres", 1, CMD_XRES}, {
@@ -130,9 +130,8 @@ struct cmdoptions_t {
130 "-bcast", 1, CMD_BCAST}, { 130 "-bcast", 1, CMD_BCAST}, {
131 "-rgba", 1, CMD_RGBA}, { 131 "-rgba", 1, CMD_RGBA}, {
132 "-step", 1, CMD_STEP}, { 132 "-step", 1, CMD_STEP}, {
133 "-move", 1, CMD_MOVE}, 133 "-move", 1, CMD_MOVE}, {
134#endif 134#endif
135 {
136 0, 0, 0} 135 0, 0, 0}
137}; 136};
138 137
@@ -217,7 +216,7 @@ static void showmode(struct fb_var_screeninfo *v)
217 printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length, 216 printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length,
218 v->red.offset, v->green.length, v->green.offset, v->blue.length, 217 v->red.offset, v->green.length, v->green.offset, v->blue.length,
219 v->blue.offset, v->transp.length, v->transp.offset); 218 v->blue.offset, v->transp.length, v->transp.offset);
220 printf("endmode\n"); 219 printf("endmode\n\n");
221} 220}
222 221
223static void fbset_usage(void) 222static void fbset_usage(void)
diff --git a/util-linux/fdflush.c b/util-linux/fdflush.c
index 201cea898..56ea2244d 100644
--- a/util-linux/fdflush.c
+++ b/util-linux/fdflush.c
@@ -33,8 +33,8 @@ extern int fdflush_main(int argc, char **argv)
33 int value; 33 int value;
34 int fd; 34 int fd;
35 35
36 if (argc <= 1 || **(argv++) == '-') { 36 if (argc <= 1 || **(++argv) == '-') {
37 usage("fdflush device\n"); 37 usage("fdflush device\n\nForce floppy disk drive to detect disk change\n");
38 } 38 }
39 39
40 fd = open(*argv, 0); 40 fd = open(*argv, 0);
diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c
index 06937a70f..9636dbdcf 100644
--- a/util-linux/freeramdisk.c
+++ b/util-linux/freeramdisk.c
@@ -34,7 +34,7 @@
34 34
35static const char freeramdisk_usage[] = 35static const char freeramdisk_usage[] =
36 "freeramdisk DEVICE\n\n" 36 "freeramdisk DEVICE\n\n"
37 "Frees all memory used by the specified ramdisk.\n"; 37 "Free all memory used by the specified ramdisk.\n";
38 38
39extern int 39extern int
40freeramdisk_main(int argc, char **argv) 40freeramdisk_main(int argc, char **argv)
@@ -42,7 +42,7 @@ freeramdisk_main(int argc, char **argv)
42 char rname[256] = "/dev/ram"; 42 char rname[256] = "/dev/ram";
43 int f; 43 int f;
44 44
45 if (argc > 2 || ( argv[1] && *argv[1] == '-')) { 45 if (argc < 2 || ( argv[1] && *argv[1] == '-')) {
46 usage(freeramdisk_usage); 46 usage(freeramdisk_usage);
47 } 47 }
48 48
@@ -50,10 +50,10 @@ freeramdisk_main(int argc, char **argv)
50 strcpy(rname, argv[1]); 50 strcpy(rname, argv[1]);
51 51
52 if ((f = open(rname, O_RDWR)) == -1) { 52 if ((f = open(rname, O_RDWR)) == -1) {
53 fatalError( "freeramdisk: cannot open %s: %s", rname, strerror(errno)); 53 fatalError( "freeramdisk: cannot open %s: %s\n", rname, strerror(errno));
54 } 54 }
55 if (ioctl(f, BLKFLSBUF) < 0) { 55 if (ioctl(f, BLKFLSBUF) < 0) {
56 fatalError( "freeramdisk: failed ioctl on %s: %s", rname, strerror(errno)); 56 fatalError( "freeramdisk: failed ioctl on %s: %s\n", rname, strerror(errno));
57 } 57 }
58 /* Don't bother closing. Exit does 58 /* Don't bother closing. Exit does
59 * that, so we can save a few bytes */ 59 * that, so we can save a few bytes */
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 329c07780..972e5066c 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -83,8 +83,6 @@ static const char mount_usage[] = "\tmount [flags]\n"
83 "\tsuid / nosuid:\tAllow set-user-id-root programs / disallow them.\n" 83 "\tsuid / nosuid:\tAllow set-user-id-root programs / disallow them.\n"
84 "\tremount: Re-mount a currently-mounted filesystem, changing its flags.\n" 84 "\tremount: Re-mount a currently-mounted filesystem, changing its flags.\n"
85 "\tro / rw: Mount for read-only / read-write.\n" 85 "\tro / rw: Mount for read-only / read-write.\n"
86 "\t"
87
88 "There are EVEN MORE flags that are specific to each filesystem.\n" 86 "There are EVEN MORE flags that are specific to each filesystem.\n"
89 "You'll have to see the written documentation for those.\n"; 87 "You'll have to see the written documentation for those.\n";
90 88