More doc updates for BusyBox, with fixes to apps for bugs revealed

while trying to write docs . :-)
 -Erik
This commit is contained in:
Erik Andersen 2000-04-13 18:49:43 +00:00
parent b4f8606c05
commit 9cf3bfa7c1
30 changed files with 680 additions and 1658 deletions

View File

@ -10,18 +10,18 @@
provides. To enable this, turn on BB_FEATURE_USE_DEVPS_PATCH and
patch your kernel with the devps patch in the kernel-patches/
directory.
* Wrote basename, killall, and uptime.
* Wrote basename, dirname, killall, and uptime.
* tar has been completely rewritten by me. Both tar creation and
extraction are now well behaved. Costs 7.6k with all optional
tar features enabled, and 5k for just tar extraction support.
* Added freeramdisk, which will free up all memory associated
with a ram disk. Contributed by Emanuele Caratti <wiz@iol.it>
and then adjusted a bit by me.
* Added tr and dirname from John Lombardo <john@deltanet.com>
* Added tr from John Lombardo <john@deltanet.com>
* Added echo and test (from me).
* Added usleep contributed by Nicolas Pitre <nico@cam.org>
* Several fixes from Pavel Roskin <pavel_roskin@geocities.com>:
- When `tail' fails to open a file it now exits.
- When `tail' fails to open a file it now exits.
- When `syslogd' is given the `-n' option it should still use
fork() for running klogd.
* nslookup types are now changed to u_int32_t (instead of uint32_t)

View File

@ -25,7 +25,7 @@ BUILDTIME := $(shell TZ=UTC date --utc "+%Y.%m.%d-%H:%M%z")
# Set the following to `true' to make a debuggable build.
# Leave this set to `false' for production use.
# eg: `make DODEBUG=true tests'
DODEBUG = false
DODEBUG = true
# If you want a static binary, turn this on.
DOSTATIC = false
@ -94,7 +94,7 @@ ifdef BB_INIT_SCRIPT
CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"'
endif
all: busybox busybox.links
all: busybox busybox.links docs
.PHONY: all
busybox: $(OBJECTS)
@ -104,6 +104,9 @@ busybox: $(OBJECTS)
busybox.links: busybox.def.h
- ./busybox.mkll | sort >$@
docs: docs/busybox.pod
cd docs && $(MAKE) clean all
regexp.o nfsmount.o: %.o: %.h
$(OBJECTS): %.o: busybox.def.h internal.h %.c
@ -128,6 +131,7 @@ install: busybox busybox.links
.PHONY: dist release
dist release: distclean
cd docs && $(MAKE) clean all
cd ..; \
rm -rf busybox-$(VERSION); \
cp -a busybox busybox-$(VERSION); \

View File

@ -34,8 +34,10 @@ extern int basename_main(int argc, char **argv)
argv++;
s1=*argv+strlen(*argv)-1;
if (*s1 == '/')
while (s1 && *s1 == '/') {
*s1 = '\0';
s1=*argv+strlen(*argv)-1;
}
s = strrchr(*argv, '/');
printf("%s\n", (s)? s + 1 : *argv);
exit(TRUE);

View File

@ -194,7 +194,7 @@
//#define BB_FEATURE_SH_TAB_COMPLETION
//
//Turn on extra fbset options
#define BB_FEATURE_FBSET_FANCY
//#define BB_FEATURE_FBSET_FANCY
//
//
// End of Features List

View File

@ -34,8 +34,10 @@ extern int basename_main(int argc, char **argv)
argv++;
s1=*argv+strlen(*argv)-1;
if (*s1 == '/')
while (s1 && *s1 == '/') {
*s1 = '\0';
s1=*argv+strlen(*argv)-1;
}
s = strrchr(*argv, '/');
printf("%s\n", (s)? s + 1 : *argv);
exit(TRUE);

View File

@ -1,146 +1,45 @@
/* vi: set sw=4 ts=4: */
/*
* This is temporary -- needs to be rewritten to be tighter */
/*
* Copyright (c) 1991, 1993, 1994
* The Regents of the University of California. All rights reserved.
* Mini dirname implementation for busybox
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* Copyright (C) 2000 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if 0
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1991, 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
static char sccsid[] = "@(#)dirname.c 8.4 (Berkeley) 5/4/95";
#endif /* not lint */
#endif /* #if 0 */
#include "internal.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void dirname_usage()
extern int dirname_main(int argc, char **argv)
{
char* s;
(void) fprintf(stderr, "usage: dirname path\n");
exit(1);
}
extern int dirname_main(argc, argv)
int argc;
char **argv;
{
char *p;
int ch;
while ((ch = getopt(argc, argv, "")) != -1)
switch (ch) {
case '?':
default:
dirname_usage();
}
argc -= optind;
argv += optind;
if (argc != 1)
dirname_usage();
/*
* (1) If string is //, skip steps (2) through (5).
* (2) If string consists entirely of slash characters, string
* shall be set to a single slash character. In this case,
* skip steps (3) through (8).
*/
for (p = *argv;; ++p) {
if (!*p) {
if (p > *argv)
(void) printf("/\n");
else
(void) printf(".\n");
exit(0);
}
if (*p != '/')
break;
if ((argc < 2) || (**(argv + 1) == '-')) {
usage("dirname [file ...]\n");
}
argv++;
/*
* (3) If there are any trailing slash characters in string, they
* shall be removed.
*/
for (; *p; ++p);
while (*--p == '/')
continue;
*++p = '\0';
/*
* (4) If there are no slash characters remaining in string,
* string shall be set to a single period character. In this
* case skip steps (5) through (8).
*
* (5) If there are any trailing nonslash characters in string,
* they shall be removed.
*/
while (--p >= *argv)
if (*p == '/')
break;
++p;
if (p == *argv) {
(void) printf(".\n");
exit(0);
s=*argv+strlen(*argv)-1;
while (s && *s == '/') {
*s = '\0';
s=*argv+strlen(*argv)-1;
}
/*
* (6) If the remaining string is //, it is implementation defined
* whether steps (7) and (8) are skipped or processed.
*
* This case has already been handled, as part of steps (1) and (2).
*/
/*
* (7) If there are any trailing slash characters in string, they
* shall be removed.
*/
while (--p >= *argv)
if (*p != '/')
break;
++p;
/*
* (8) If the remaining string is empty, string shall be set to
* a single slash character.
*/
*p = '\0';
(void) printf("%s\n", p == *argv ? "/" : *argv);
exit(0);
s = strrchr(*argv, '/');
if (s && *s)
*s = '\0';
printf("%s\n", (s)? *argv : ".");
exit(TRUE);
}

View File

@ -25,6 +25,14 @@
#include "internal.h"
#include <stdio.h>
static const char uname_usage[] =
"echo [-neE] [ARG ...]\n\n"
"Prints the specified ARGs to stdout\n\n"
"Options:\n"
"\t-n\tsuppress trailing newline\n"
"\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n"
"\t-E\tdisable interpretation of backslash-escaped characters\n";
extern int
echo_main(int argc, char** argv)
{
@ -45,6 +53,9 @@ echo_main(int argc, char** argv)
} else if (strcmp(p, "-E")==0) {
eflag = 0;
}
else if (strncmp(p, "--", 2)==0) {
usage( uname_usage);
}
else break;
ap++;
}

View File

@ -88,7 +88,6 @@
#define DISP_FULLTIME 32 /* show extended time display */
#define DIR_NOLIST 64 /* show directory as itself, not contents */
#define DISP_DIRNAME 128 /* show directory name (for internal use) */
#define DIR_RECURSE 256 /* -R (not yet implemented) */
#ifndef MAJOR
#define MAJOR(dev) (((dev)>>8)&0xff)
@ -450,10 +449,33 @@ static const char ls_usage[] = "ls [-1a"
#ifdef BB_FEATURE_LS_FILETYPES
"F"
#endif
#ifdef FEATURE_RECURSIVE
"R"
"] [filenames...]\n\n"
"Options:\n"
"\t-a\tdo not hide entries starting with .\n"
#ifdef BB_FEATURE_LS_TIMESTAMPS
"\t-c\twith -l: show ctime (the time of last\n"
"\t\tmodification of file status information)\n"
#endif
"] [filenames...]\n";
"\t-d\tlist directory entries instead of contents\n"
#ifdef BB_FEATURE_LS_TIMESTAMPS
"\t-e\tlist both full date and full time\n"
#endif
"\t-l\tuse a long listing format\n"
"\t-n\tlist numeric UIDs and GIDs instead of names\n"
#ifdef BB_FEATURE_LS_FILETYPES
"\t-p\tappend indicator (one of /=@|) to entries\n"
#endif
#ifdef BB_FEATURE_LS_TIMESTAMPS
"\t-u\twith -l: show access time (the time of last\n"
"\t\taccess of the file)\n"
#endif
"\t-x\tlist entries by lines instead of by columns\n"
"\t-A\tdo not list implied . and ..\n"
"\t-C\tlist entries by columns\n"
#ifdef BB_FEATURE_LS_FILETYPES
"\t-F\tappend indicator (one of */=@|) to entries\n"
#endif
;
extern int ls_main(int argc, char **argv)
{
@ -508,11 +530,6 @@ extern int ls_main(int argc, char **argv)
case 'd':
opts |= DIR_NOLIST;
break;
#ifdef FEATURE_RECURSIVE
case 'R':
opts |= DIR_RECURSE;
break;
#endif
#ifdef BB_FEATURE_LS_TIMESTAMPS
case 'u':
time_fmt = TIME_ACCESS;

View File

@ -70,7 +70,7 @@ int mknod_main(int argc, char **argv)
if (mknod(argv[1], mode, dev) != 0) {
perror(argv[1]);
return (FALSE);
exit (FALSE);
}
return (TRUE);
exit (TRUE);
}

163
dirname.c
View File

@ -1,146 +1,45 @@
/* vi: set sw=4 ts=4: */
/*
* This is temporary -- needs to be rewritten to be tighter */
/*
* Copyright (c) 1991, 1993, 1994
* The Regents of the University of California. All rights reserved.
* Mini dirname implementation for busybox
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* Copyright (C) 2000 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if 0
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1991, 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
static char sccsid[] = "@(#)dirname.c 8.4 (Berkeley) 5/4/95";
#endif /* not lint */
#endif /* #if 0 */
#include "internal.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void dirname_usage()
extern int dirname_main(int argc, char **argv)
{
char* s;
(void) fprintf(stderr, "usage: dirname path\n");
exit(1);
}
extern int dirname_main(argc, argv)
int argc;
char **argv;
{
char *p;
int ch;
while ((ch = getopt(argc, argv, "")) != -1)
switch (ch) {
case '?':
default:
dirname_usage();
}
argc -= optind;
argv += optind;
if (argc != 1)
dirname_usage();
/*
* (1) If string is //, skip steps (2) through (5).
* (2) If string consists entirely of slash characters, string
* shall be set to a single slash character. In this case,
* skip steps (3) through (8).
*/
for (p = *argv;; ++p) {
if (!*p) {
if (p > *argv)
(void) printf("/\n");
else
(void) printf(".\n");
exit(0);
}
if (*p != '/')
break;
if ((argc < 2) || (**(argv + 1) == '-')) {
usage("dirname [file ...]\n");
}
argv++;
/*
* (3) If there are any trailing slash characters in string, they
* shall be removed.
*/
for (; *p; ++p);
while (*--p == '/')
continue;
*++p = '\0';
/*
* (4) If there are no slash characters remaining in string,
* string shall be set to a single period character. In this
* case skip steps (5) through (8).
*
* (5) If there are any trailing nonslash characters in string,
* they shall be removed.
*/
while (--p >= *argv)
if (*p == '/')
break;
++p;
if (p == *argv) {
(void) printf(".\n");
exit(0);
s=*argv+strlen(*argv)-1;
while (s && *s == '/') {
*s = '\0';
s=*argv+strlen(*argv)-1;
}
/*
* (6) If the remaining string is //, it is implementation defined
* whether steps (7) and (8) are skipped or processed.
*
* This case has already been handled, as part of steps (1) and (2).
*/
/*
* (7) If there are any trailing slash characters in string, they
* shall be removed.
*/
while (--p >= *argv)
if (*p != '/')
break;
++p;
/*
* (8) If the remaining string is empty, string shall be set to
* a single slash character.
*/
*p = '\0';
(void) printf("%s\n", p == *argv ? "/" : *argv);
exit(0);
s = strrchr(*argv, '/');
if (s && *s)
*s = '\0';
printf("%s\n", (s)? *argv : ".");
exit(TRUE);
}

File diff suppressed because it is too large Load Diff

22
docs/Makefile Normal file
View File

@ -0,0 +1,22 @@
# busybox/docs/Makefile - Create the documentation
# ------------------------
# Copyright (C) 2000 Erik Andersen <andersee@debian.org> GPL
all:: clean doc
doc:
@echo
@echo BusyBox Documentation
@echo
pod2html busybox.pod > ../BusyBox.html
@rm pod2html-*
pod2man --center=BusyBox --release="version $(VERSION)" busybox.pod > ../BusyBox.1
pod2text busybox.pod > ../BusyBox.txt
clean::
@rm -f ../BusyBox.html ../BusyBox.1 ../BusyBox.txt pod2html*
distclean: clean
.PHONY: all clean distclean doc

File diff suppressed because it is too large Load Diff

View File

@ -19,10 +19,9 @@
#define bb_need_io_error
#include "messages.c"
static const char dutmp_usage[] = "dutmp\n"
"\n"
"\tDump file or stdin utmp file format to stdout, pipe delimited.\n"
"\tdutmp /var/run/utmp\n";
static const char dutmp_usage[] = "dutmp [FILE]\n\n"
"Dump utmp file format (pipe delimited) from FILE\n"
"or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n";
extern int dutmp_main(int argc, char **argv)
{

11
echo.c
View File

@ -25,6 +25,14 @@
#include "internal.h"
#include <stdio.h>
static const char uname_usage[] =
"echo [-neE] [ARG ...]\n\n"
"Prints the specified ARGs to stdout\n\n"
"Options:\n"
"\t-n\tsuppress trailing newline\n"
"\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n"
"\t-E\tdisable interpretation of backslash-escaped characters\n";
extern int
echo_main(int argc, char** argv)
{
@ -45,6 +53,9 @@ echo_main(int argc, char** argv)
} else if (strcmp(p, "-E")==0) {
eflag = 0;
}
else if (strncmp(p, "--", 2)==0) {
usage( uname_usage);
}
else break;
ap++;
}

View File

@ -104,9 +104,9 @@ struct cmdoptions_t {
"-hsync", 1, CMD_HSYNC}, {
"-vsync", 1, CMD_VSYNC}, {
"-laced", 1, CMD_LACED}, {
"-double", 1, CMD_DOUBLE},
"-double", 1, CMD_DOUBLE}, {
"--help", 0, CMD_HELP}, {
#ifdef BB_FEATURE_FBSET_FANCY
{
"--help", 0, CMD_HELP}, {
"-all", 0, CMD_ALL}, {
"-xres", 1, CMD_XRES}, {
@ -130,9 +130,8 @@ struct cmdoptions_t {
"-bcast", 1, CMD_BCAST}, {
"-rgba", 1, CMD_RGBA}, {
"-step", 1, CMD_STEP}, {
"-move", 1, CMD_MOVE},
"-move", 1, CMD_MOVE}, {
#endif
{
0, 0, 0}
};
@ -217,7 +216,7 @@ static void showmode(struct fb_var_screeninfo *v)
printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length,
v->red.offset, v->green.length, v->green.offset, v->blue.length,
v->blue.offset, v->transp.length, v->transp.offset);
printf("endmode\n");
printf("endmode\n\n");
}
static void fbset_usage(void)

View File

@ -33,8 +33,8 @@ extern int fdflush_main(int argc, char **argv)
int value;
int fd;
if (argc <= 1 || **(argv++) == '-') {
usage("fdflush device\n");
if (argc <= 1 || **(++argv) == '-') {
usage("fdflush device\n\nForce floppy disk drive to detect disk change\n");
}
fd = open(*argv, 0);

6
find.c
View File

@ -37,9 +37,9 @@ static const char find_usage[] = "find [PATH...] [EXPRESSION]\n\n"
"Search for files in a directory hierarchy. The default PATH is\n"
"the current directory; default EXPRESSION is '-print'\n\n"
"\nEXPRESSION may consist of:\n"
"\t-follow\n\t\tDereference symbolic links.\n"
"\t-name PATTERN\n\t\tFile name (with leading directories removed) matches PATTERN.\n"
"\t-print\n\t\tprint the full file name followed by a newline to stdout.\n";
"\t-follow\t\tDereference symbolic links.\n"
"\t-name PATTERN\tFile name (leading directories removed) matches PATTERN.\n"
"\t-print\t\tprint the full file name followed by a newline to stdout.\n";
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)

View File

@ -37,9 +37,9 @@ static const char find_usage[] = "find [PATH...] [EXPRESSION]\n\n"
"Search for files in a directory hierarchy. The default PATH is\n"
"the current directory; default EXPRESSION is '-print'\n\n"
"\nEXPRESSION may consist of:\n"
"\t-follow\n\t\tDereference symbolic links.\n"
"\t-name PATTERN\n\t\tFile name (with leading directories removed) matches PATTERN.\n"
"\t-print\n\t\tprint the full file name followed by a newline to stdout.\n";
"\t-follow\t\tDereference symbolic links.\n"
"\t-name PATTERN\tFile name (leading directories removed) matches PATTERN.\n"
"\t-print\t\tprint the full file name followed by a newline to stdout.\n";
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)

View File

@ -34,7 +34,7 @@
static const char freeramdisk_usage[] =
"freeramdisk DEVICE\n\n"
"Frees all memory used by the specified ramdisk.\n";
"Free all memory used by the specified ramdisk.\n";
extern int
freeramdisk_main(int argc, char **argv)
@ -42,7 +42,7 @@ freeramdisk_main(int argc, char **argv)
char rname[256] = "/dev/ram";
int f;
if (argc > 2 || ( argv[1] && *argv[1] == '-')) {
if (argc < 2 || ( argv[1] && *argv[1] == '-')) {
usage(freeramdisk_usage);
}
@ -50,10 +50,10 @@ freeramdisk_main(int argc, char **argv)
strcpy(rname, argv[1]);
if ((f = open(rname, O_RDWR)) == -1) {
fatalError( "freeramdisk: cannot open %s: %s", rname, strerror(errno));
fatalError( "freeramdisk: cannot open %s: %s\n", rname, strerror(errno));
}
if (ioctl(f, BLKFLSBUF) < 0) {
fatalError( "freeramdisk: failed ioctl on %s: %s", rname, strerror(errno));
fatalError( "freeramdisk: failed ioctl on %s: %s\n", rname, strerror(errno));
}
/* Don't bother closing. Exit does
* that, so we can save a few bytes */

35
ls.c
View File

@ -88,7 +88,6 @@
#define DISP_FULLTIME 32 /* show extended time display */
#define DIR_NOLIST 64 /* show directory as itself, not contents */
#define DISP_DIRNAME 128 /* show directory name (for internal use) */
#define DIR_RECURSE 256 /* -R (not yet implemented) */
#ifndef MAJOR
#define MAJOR(dev) (((dev)>>8)&0xff)
@ -450,10 +449,33 @@ static const char ls_usage[] = "ls [-1a"
#ifdef BB_FEATURE_LS_FILETYPES
"F"
#endif
#ifdef FEATURE_RECURSIVE
"R"
"] [filenames...]\n\n"
"Options:\n"
"\t-a\tdo not hide entries starting with .\n"
#ifdef BB_FEATURE_LS_TIMESTAMPS
"\t-c\twith -l: show ctime (the time of last\n"
"\t\tmodification of file status information)\n"
#endif
"] [filenames...]\n";
"\t-d\tlist directory entries instead of contents\n"
#ifdef BB_FEATURE_LS_TIMESTAMPS
"\t-e\tlist both full date and full time\n"
#endif
"\t-l\tuse a long listing format\n"
"\t-n\tlist numeric UIDs and GIDs instead of names\n"
#ifdef BB_FEATURE_LS_FILETYPES
"\t-p\tappend indicator (one of /=@|) to entries\n"
#endif
#ifdef BB_FEATURE_LS_TIMESTAMPS
"\t-u\twith -l: show access time (the time of last\n"
"\t\taccess of the file)\n"
#endif
"\t-x\tlist entries by lines instead of by columns\n"
"\t-A\tdo not list implied . and ..\n"
"\t-C\tlist entries by columns\n"
#ifdef BB_FEATURE_LS_FILETYPES
"\t-F\tappend indicator (one of */=@|) to entries\n"
#endif
;
extern int ls_main(int argc, char **argv)
{
@ -508,11 +530,6 @@ extern int ls_main(int argc, char **argv)
case 'd':
opts |= DIR_NOLIST;
break;
#ifdef FEATURE_RECURSIVE
case 'R':
opts |= DIR_RECURSE;
break;
#endif
#ifdef BB_FEATURE_LS_TIMESTAMPS
case 'u':
time_fmt = TIME_ACCESS;

View File

@ -19,10 +19,9 @@
#define bb_need_io_error
#include "messages.c"
static const char dutmp_usage[] = "dutmp\n"
"\n"
"\tDump file or stdin utmp file format to stdout, pipe delimited.\n"
"\tdutmp /var/run/utmp\n";
static const char dutmp_usage[] = "dutmp [FILE]\n\n"
"Dump utmp file format (pipe delimited) from FILE\n"
"or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n";
extern int dutmp_main(int argc, char **argv)
{

View File

@ -70,7 +70,7 @@ int mknod_main(int argc, char **argv)
if (mknod(argv[1], mode, dev) != 0) {
perror(argv[1]);
return (FALSE);
exit (FALSE);
}
return (TRUE);
exit (TRUE);
}

View File

@ -83,8 +83,6 @@ static const char mount_usage[] = "\tmount [flags]\n"
"\tsuid / nosuid:\tAllow set-user-id-root programs / disallow them.\n"
"\tremount: Re-mount a currently-mounted filesystem, changing its flags.\n"
"\tro / rw: Mount for read-only / read-write.\n"
"\t"
"There are EVEN MORE flags that are specific to each filesystem.\n"
"You'll have to see the written documentation for those.\n";

View File

@ -1,6 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
* $Id: ping.c,v 1.11 2000/02/08 19:58:47 erik Exp $
* $Id: ping.c,v 1.12 2000/04/13 18:49:43 erik Exp $
* Mini ping implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@ -182,9 +182,9 @@ extern int ping_main(int argc, char **argv)
static const char *ping_usage = "ping [OPTION]... host\n\n"
"Send ICMP ECHO_REQUEST packets to network hosts.\n\n"
"Options:\n"
"\t-q\t\tQuiet mode, only displays output at start"
"\t\t\tand when finished.\n" "\t-c COUNT\tSend only COUNT pings.\n";
"\t-c COUNT\tSend only COUNT pings.\n"
"\t-q\t\tQuiet mode, only displays output at start\n"
"\t\t\tand when finished.\n";
static char *hostname = NULL;
static struct sockaddr_in pingaddr;
@ -418,9 +418,7 @@ extern int ping_main(int argc, char **argv)
argv++;
options = 0;
/* Parse any options */
while (argc > 1) {
if (**argv != '-')
usage(ping_usage);
while (argc >= 1 && **argv == '-') {
thisarg = *argv;
thisarg++;
switch (*thisarg) {

12
ping.c
View File

@ -1,6 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
* $Id: ping.c,v 1.11 2000/02/08 19:58:47 erik Exp $
* $Id: ping.c,v 1.12 2000/04/13 18:49:43 erik Exp $
* Mini ping implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@ -182,9 +182,9 @@ extern int ping_main(int argc, char **argv)
static const char *ping_usage = "ping [OPTION]... host\n\n"
"Send ICMP ECHO_REQUEST packets to network hosts.\n\n"
"Options:\n"
"\t-q\t\tQuiet mode, only displays output at start"
"\t\t\tand when finished.\n" "\t-c COUNT\tSend only COUNT pings.\n";
"\t-c COUNT\tSend only COUNT pings.\n"
"\t-q\t\tQuiet mode, only displays output at start\n"
"\t\t\tand when finished.\n";
static char *hostname = NULL;
static struct sockaddr_in pingaddr;
@ -418,9 +418,7 @@ extern int ping_main(int argc, char **argv)
argv++;
options = 0;
/* Parse any options */
while (argc > 1) {
if (**argv != '-')
usage(ping_usage);
while (argc >= 1 && **argv == '-') {
thisarg = *argv;
thisarg++;
switch (*thisarg) {

View File

@ -104,9 +104,9 @@ struct cmdoptions_t {
"-hsync", 1, CMD_HSYNC}, {
"-vsync", 1, CMD_VSYNC}, {
"-laced", 1, CMD_LACED}, {
"-double", 1, CMD_DOUBLE},
"-double", 1, CMD_DOUBLE}, {
"--help", 0, CMD_HELP}, {
#ifdef BB_FEATURE_FBSET_FANCY
{
"--help", 0, CMD_HELP}, {
"-all", 0, CMD_ALL}, {
"-xres", 1, CMD_XRES}, {
@ -130,9 +130,8 @@ struct cmdoptions_t {
"-bcast", 1, CMD_BCAST}, {
"-rgba", 1, CMD_RGBA}, {
"-step", 1, CMD_STEP}, {
"-move", 1, CMD_MOVE},
"-move", 1, CMD_MOVE}, {
#endif
{
0, 0, 0}
};
@ -217,7 +216,7 @@ static void showmode(struct fb_var_screeninfo *v)
printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length,
v->red.offset, v->green.length, v->green.offset, v->blue.length,
v->blue.offset, v->transp.length, v->transp.offset);
printf("endmode\n");
printf("endmode\n\n");
}
static void fbset_usage(void)

View File

@ -33,8 +33,8 @@ extern int fdflush_main(int argc, char **argv)
int value;
int fd;
if (argc <= 1 || **(argv++) == '-') {
usage("fdflush device\n");
if (argc <= 1 || **(++argv) == '-') {
usage("fdflush device\n\nForce floppy disk drive to detect disk change\n");
}
fd = open(*argv, 0);

View File

@ -34,7 +34,7 @@
static const char freeramdisk_usage[] =
"freeramdisk DEVICE\n\n"
"Frees all memory used by the specified ramdisk.\n";
"Free all memory used by the specified ramdisk.\n";
extern int
freeramdisk_main(int argc, char **argv)
@ -42,7 +42,7 @@ freeramdisk_main(int argc, char **argv)
char rname[256] = "/dev/ram";
int f;
if (argc > 2 || ( argv[1] && *argv[1] == '-')) {
if (argc < 2 || ( argv[1] && *argv[1] == '-')) {
usage(freeramdisk_usage);
}
@ -50,10 +50,10 @@ freeramdisk_main(int argc, char **argv)
strcpy(rname, argv[1]);
if ((f = open(rname, O_RDWR)) == -1) {
fatalError( "freeramdisk: cannot open %s: %s", rname, strerror(errno));
fatalError( "freeramdisk: cannot open %s: %s\n", rname, strerror(errno));
}
if (ioctl(f, BLKFLSBUF) < 0) {
fatalError( "freeramdisk: failed ioctl on %s: %s", rname, strerror(errno));
fatalError( "freeramdisk: failed ioctl on %s: %s\n", rname, strerror(errno));
}
/* Don't bother closing. Exit does
* that, so we can save a few bytes */

View File

@ -83,8 +83,6 @@ static const char mount_usage[] = "\tmount [flags]\n"
"\tsuid / nosuid:\tAllow set-user-id-root programs / disallow them.\n"
"\tremount: Re-mount a currently-mounted filesystem, changing its flags.\n"
"\tro / rw: Mount for read-only / read-write.\n"
"\t"
"There are EVEN MORE flags that are specific to each filesystem.\n"
"You'll have to see the written documentation for those.\n";