aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-04-13 01:18:56 +0000
committerErik Andersen <andersen@codepoet.org>2000-04-13 01:18:56 +0000
commit61677feff7f549a48267c2c0c50a7420de6e2599 (patch)
tree1ea829e51641647a35c552e289f4482ab9f5db27
parent62dc17a3b100496a5c7433cc598d674e244cb6f8 (diff)
downloadbusybox-61677feff7f549a48267c2c0c50a7420de6e2599.tar.gz
Upates to include copyright 2000 to everything
-Erik
-rw-r--r--AUTHORS10
-rw-r--r--Changelog2
-rw-r--r--README12
-rw-r--r--applets/busybox.c8
-rw-r--r--archival/gunzip.c170
-rw-r--r--archival/gzip.c191
-rw-r--r--archival/tar.c6
-rw-r--r--basename.c7
-rw-r--r--busybox.c8
-rw-r--r--busybox.def.h67
-rw-r--r--cat.c2
-rw-r--r--chmod_chown_chgrp.c2
-rw-r--r--chroot.c2
-rw-r--r--clear.c2
-rw-r--r--cmdedit.c66
-rw-r--r--console-tools/clear.c2
-rw-r--r--console-tools/loadacm.c4
-rw-r--r--coreutils/basename.c7
-rw-r--r--coreutils/cat.c2
-rw-r--r--coreutils/chroot.c2
-rw-r--r--coreutils/dd.c10
-rw-r--r--coreutils/df.c10
-rw-r--r--coreutils/du.c4
-rw-r--r--coreutils/head.c4
-rw-r--r--coreutils/ln.c3
-rw-r--r--coreutils/mkdir.c3
-rw-r--r--coreutils/rm.c2
-rw-r--r--coreutils/rmdir.c2
-rw-r--r--coreutils/sort.c4
-rw-r--r--coreutils/tee.c4
-rw-r--r--coreutils/touch.c2
-rw-r--r--coreutils/uniq.c4
-rw-r--r--cp_mv.c2
-rw-r--r--dd.c10
-rw-r--r--df.c10
-rw-r--r--du.c4
-rw-r--r--dutmp.c25
-rw-r--r--editors/sed.c2
-rw-r--r--fbset.c7
-rw-r--r--find.c2
-rw-r--r--findutils/find.c2
-rw-r--r--findutils/grep.c2
-rw-r--r--free.c2
-rw-r--r--grep.c2
-rw-r--r--gunzip.c170
-rw-r--r--gzip.c191
-rw-r--r--head.c4
-rw-r--r--init.c4
-rw-r--r--init/init.c4
-rw-r--r--insmod.c2
-rw-r--r--ln.c3
-rw-r--r--loadacm.c4
-rw-r--r--logger.c2
-rw-r--r--lsmod.c2
-rw-r--r--miscutils/dutmp.c25
-rw-r--r--mkdir.c3
-rw-r--r--modutils/insmod.c2
-rw-r--r--modutils/lsmod.c2
-rw-r--r--modutils/rmmod.c2
-rw-r--r--networking/nslookup.c3
-rw-r--r--nslookup.c3
-rw-r--r--procps/free.c2
-rw-r--r--procps/ps.c2
-rw-r--r--procps/uptime.c2
-rw-r--r--ps.c2
-rw-r--r--rm.c2
-rw-r--r--rmdir.c2
-rw-r--r--rmmod.c2
-rw-r--r--sed.c2
-rw-r--r--shell/cmdedit.c66
-rw-r--r--sort.c4
-rw-r--r--swaponoff.c2
-rw-r--r--sysklogd/logger.c2
-rw-r--r--sysklogd/syslogd.c3
-rw-r--r--syslogd.c3
-rw-r--r--tar.c6
-rw-r--r--tee.c4
-rw-r--r--touch.c2
-rw-r--r--true_false.c2
-rw-r--r--umount.c2
-rw-r--r--uniq.c4
-rw-r--r--uptime.c2
-rw-r--r--util-linux/fbset.c7
-rw-r--r--util-linux/swaponoff.c2
-rw-r--r--util-linux/umount.c2
85 files changed, 581 insertions, 668 deletions
diff --git a/AUTHORS b/AUTHORS
index 9d7cb0825..a5acec244 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,8 +1,8 @@
-List of the authors of code contained in busybox.
+List of the authors of code contained in BusyBox.
-If you should be listed here, or the description of
-what you have done needs more detail, or is incorect,
-_please_ let me know.
+If you have code in BusyBox, you should be listed here. If you should be
+listed, or the description of what you have done needs more detail, or is
+incorect, _please_ let me know.
-Erik
@@ -16,7 +16,7 @@ Bruce Perens <bruce@pixar.com>
Original author of BusyBox. His code is still in many apps.
John Beppu <beppu@lineo.com>
- du, head, tee
+ du, head, nslookup, sort, tee, uniq
Brian Candler <B.Candler@pobox.com>
tiny-ls(ls)
diff --git a/Changelog b/Changelog
index 4a9fb6fc0..4227a7822 100644
--- a/Changelog
+++ b/Changelog
@@ -59,7 +59,7 @@
the common error handling saves a few bytes. Thanks to
Bob Tinsley <bob@earthrise.demon.co.uk> for the patch.
* Fix "+" parsing bug in date, from "Merle F. McClelland" <mfm@cts.com>.
-
+ * BusyBox's bss size has been majorly reduced (was 384668, is now 28740).
-Erik Andersen
diff --git a/README b/README
index 27d5d152d..118e14590 100644
--- a/README
+++ b/README
@@ -7,17 +7,17 @@ an editor such as "elvis-tiny" or "ae", and you have a working system.
Busybox was begun to support the Debian Rescue/Install disks, but it
also makes an excellent environment for any small or embedded system.
-As of version 0.20 there is a version number. : ) Also as of version
-0.20, BB is now modularized to easily allow you to build of only the
-BB parts you need, thereby reducing binary size. To turn off unwanted
-Busybox components, simply edit the file busybox.def.h and comment out
-the parts you do not need using C++ style (//) comments.
+As of version 0.20 there is a version number. : ) Also as of version 0.20, BB
+is now modularized to easily allow you to build only the BB parts you need,
+thereby reducing binary size. To turn off unwanted Busybox components, simply
+edit the file busybox.def.h and comment out the parts you do not need using C++
+style (//) comments.
After the build is complete a busybox.links file is generated which is
then used by 'make install' to create symlinks to the busybox binary
for all compiled in functions. By default, 'make install' will place
the symlink forest into `pwd`/_install unless you have defined the
-PREFIX environment variable.
+PREFIX environment variable (i.e. make PREFIX="/tmp/foo" install)
Please feed suggestions, bug reports, insults, and bribes back to:
Erik Andersen
diff --git a/applets/busybox.c b/applets/busybox.c
index 9a48f4961..b65b13e65 100644
--- a/applets/busybox.c
+++ b/applets/busybox.c
@@ -234,9 +234,6 @@ static const struct Applet applets[] = {
{"sh", shell_main, _BB_DIR_BIN},
#endif
#ifdef BB_SFDISK
- {"fdisk", sfdisk_main, _BB_DIR_SBIN},
-#ifdef BB_SFDISK
-#endif
{"sfdisk", sfdisk_main, _BB_DIR_SBIN},
#endif
#ifdef BB_SLEEP
@@ -382,8 +379,9 @@ int busybox_main(int argc, char **argv)
fprintf(stderr, "Usage: busybox [function] [arguments]...\n");
fprintf(stderr, " or: [function] [arguments]...\n\n");
fprintf(stderr,
- "\tMost people will create a link to busybox for each function\n"
- "\tname, and busybox will act like whatever you invoke it as.\n");
+ "\tBusyBox is a multi-call binary that combines many common Unix utilities into a\n"
+ "\tsingle executable. Most people will create a link to busybox for each function\n"
+ "\tthey wish to use, and BusyBox will act like whatever it was invoked as.\n");
fprintf(stderr, "\nCurrently defined functions:\n");
while (a->name != 0) {
diff --git a/archival/gunzip.c b/archival/gunzip.c
index 7aa896469..1a5cdba88 100644
--- a/archival/gunzip.c
+++ b/archival/gunzip.c
@@ -1,13 +1,33 @@
/* vi: set sw=4 ts=4: */
-/* zcat : stripped version based on gzip sources
- Sven Rudolph <sr1@inf.tu-dresden.de>
- */
+/*
+ * Gzip implementation for busybox
+ *
+ * Based on GNU gzip Copyright (C) 1992-1993 Jean-loup Gailly.
+ *
+ * Originally adjusted for busybox by Sven Rudolph <sr1@inf.tu-dresden.de>
+ * based on gzip sources
+ *
+ * Adjusted further by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
+ * to support files as well as stdin/stdout, and to generally behave itself wrt
+ * command line handling.
+ *
+ * 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
+ *
+ */
#include "internal.h"
-#define bb_need_name_too_long
-#define BB_DECLARE_EXTERN
-#include "messages.c"
-
static const char gunzip_usage[] =
"gunzip [OPTION]... FILE\n\n"
"Uncompress FILE (or standard input if FILE is '-').\n\n"
@@ -16,6 +36,18 @@ static const char gunzip_usage[] =
"\t-c\tWrite output to standard output\n"
"\t-t\tTest compressed file integrity\n";
+
+ /* These defines are very important for BusyBox. Without these,
+ * huge chunks of ram are pre-allocated making the BusyBox bss
+ * size Freaking Huge(tm), which is a bad thing.*/
+#define SMALL_MEM
+#define DYN_ALLOC
+
+#define bb_need_name_too_long
+#define BB_DECLARE_EXTERN
+#include "messages.c"
+
+
/* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
* Copyright (C) 1992-1993 Jean-loup Gailly
* The unzip code was written and put in the public domain by Mark Adler.
@@ -89,25 +121,6 @@ static char *license_msg[] = {
#define get_char() get_byte()
#define put_char(c) put_byte(c)
-/* #include "gzip.h" */
-
-/* gzip.h -- common declarations for all gzip modules
- * Copyright (C) 1992-1993 Jean-loup Gailly.
- * This is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License, see the file COPYING.
- */
-
-#if defined(__STDC__) || defined(PROTO)
-# define OF(args) args
-#else
-# define OF(args) ()
-#endif
-
-#ifdef __STDC__
-typedef void *voidp;
-#else
-typedef char *voidp;
-#endif
/* I don't like nested includes, but the string and io functions are used
* too often
@@ -118,7 +131,7 @@ typedef char *voidp;
# if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__)
# include <memory.h>
# endif
-# define memzero(s, n) memset ((voidp)(s), 0, (n))
+# define memzero(s, n) memset ((void *)(s), 0, (n))
#else
# include <strings.h>
# define strchr index
@@ -329,49 +342,46 @@ extern int save_orig_name; /* set if original name must be saved */
#define WARN(msg) {fprintf msg ; \
if (exit_code == OK) exit_code = WARNING;}
-#define do_exit(c) exit(c)
-
-
/* in unzip.c */
-extern int unzip OF((int in, int out));
+extern int unzip (int in, int out);
/* in gzip.c */
-RETSIGTYPE abort_gzip OF((void));
+RETSIGTYPE abort_gzip (void);
/* in deflate.c */
-void lm_init OF((int pack_level, ush * flags));
-ulg deflate OF((void));
+void lm_init (int pack_level, ush * flags);
+ulg deflate (void);
/* in trees.c */
-void ct_init OF((ush * attr, int *method));
-int ct_tally OF((int dist, int lc));
-ulg flush_block OF((char *buf, ulg stored_len, int eof));
+void ct_init (ush * attr, int *method);
+int ct_tally (int dist, int lc);
+ulg flush_block (char *buf, ulg stored_len, int eof);
/* in bits.c */
-void bi_init OF((file_t zipfile));
-void send_bits OF((int value, int length));
-unsigned bi_reverse OF((unsigned value, int length));
-void bi_windup OF((void));
-void copy_block OF((char *buf, unsigned len, int header));
-extern int (*read_buf) OF((char *buf, unsigned size));
+void bi_init (file_t zipfile);
+void send_bits (int value, int length);
+unsigned bi_reverse (unsigned value, int length);
+void bi_windup (void);
+void copy_block (char *buf, unsigned len, int header);
+extern int (*read_buf) (char *buf, unsigned size);
/* in util.c: */
-extern int copy OF((int in, int out));
-extern ulg updcrc OF((uch * s, unsigned n));
-extern void clear_bufs OF((void));
-extern int fill_inbuf OF((int eof_ok));
-extern void flush_outbuf OF((void));
-extern void flush_window OF((void));
-extern void write_buf OF((int fd, voidp buf, unsigned cnt));
+extern int copy (int in, int out);
+extern ulg updcrc (uch * s, unsigned n);
+extern void clear_bufs (void);
+extern int fill_inbuf (int eof_ok);
+extern void flush_outbuf (void);
+extern void flush_window (void);
+extern void write_buf (int fd, void * buf, unsigned cnt);
#ifndef __linux__
-extern char *basename OF((char *fname));
+extern char *basename (char *fname);
#endif /* not __linux__ */
-extern void read_error OF((void));
-extern void write_error OF((void));
+extern void read_error (void);
+extern void write_error (void);
/* in inflate.c */
-extern int inflate OF((void));
+extern int inflate (void);
/* #include "lzw.h" */
@@ -415,8 +425,8 @@ extern int inflate OF((void));
extern int maxbits; /* max bits per code for LZW */
extern int block_mode; /* block compress mode -C compatible with 2.0 */
-extern int lzw OF((int in, int out));
-extern int unlzw OF((int in, int out));
+extern int lzw (int in, int out);
+extern int unlzw (int in, int out);
/* #include "revision.h" */
@@ -605,7 +615,7 @@ typedef struct direct dir_type;
#if !defined(S_ISREG) && defined(S_IFREG)
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
-typedef RETSIGTYPE(*sig_type) OF((int));
+typedef RETSIGTYPE(*sig_type) (int);
#ifndef O_BINARY
# define O_BINARY 0 /* creation mode for open() */
@@ -644,7 +654,7 @@ typedef RETSIGTYPE(*sig_type) OF((int));
#ifdef NO_OFF_T
typedef long off_t;
-off_t lseek OF((int fd, off_t offset, int whence));
+off_t lseek (int fd, off_t offset, int whence);
#endif
@@ -687,7 +697,7 @@ long header_bytes; /* number of bytes in gzip header */
/* local functions */
-local int get_method OF((int in));
+local int get_method (int in);
#define strequ(s1, s2) (strcmp((s1),(s2)) == 0)
@@ -773,7 +783,7 @@ int gunzip_main(int argc, char **argv)
usage(gunzip_usage);
if (strlen(*argv) > MAX_PATH_LEN) {
fprintf(stderr, name_too_long, "gunzip");
- do_exit(WARNING);
+ exit(WARNING);
}
strcpy(ifname, *argv);
@@ -781,13 +791,13 @@ int gunzip_main(int argc, char **argv)
inFileNum = open(ifname, O_RDONLY);
if (inFileNum < 0) {
perror(ifname);
- do_exit(WARNING);
+ exit(WARNING);
}
/* Get the time stamp on the input file. */
result = stat(ifname, &statBuf);
if (result < 0) {
perror(ifname);
- do_exit(WARNING);
+ exit(WARNING);
}
ifile_size = statBuf.st_size;
}
@@ -812,7 +822,7 @@ int gunzip_main(int argc, char **argv)
/* And get to work */
if (strlen(ifname) > MAX_PATH_LEN - 4) {
fprintf(stderr, name_too_long, "gunzip");
- do_exit(WARNING);
+ exit(WARNING);
}
strcpy(ofname, ifname);
pos = strstr(ofname, ".gz");
@@ -836,7 +846,7 @@ int gunzip_main(int argc, char **argv)
#endif
if (outFileNum < 0) {
perror(ofname);
- do_exit(WARNING);
+ exit(WARNING);
}
/* Set permissions on the file */
fchmod(outFileNum, statBuf.st_mode);
@@ -860,7 +870,7 @@ int gunzip_main(int argc, char **argv)
exit(FALSE);
}
}
- do_exit(exit_code);
+ exit(exit_code);
}
@@ -953,7 +963,7 @@ int in; /* input file descriptor */
*/
RETSIGTYPE abort_gzip()
{
- do_exit(ERROR);
+ exit(ERROR);
}
/* unzip.c -- decompress files in gzip or pkzip format.
@@ -1027,7 +1037,7 @@ int in, out; /* input and output file descriptors */
ofd = out;
method = get_method(ifd);
if (method < 0) {
- do_exit(exit_code); /* error message already emitted */
+ exit(exit_code); /* error message already emitted */
}
updcrc(NULL, 0); /* initialize crc */
@@ -1218,7 +1228,7 @@ void flush_window()
*/
void write_buf(fd, buf, cnt)
int fd;
-voidp buf;
+void * buf;
unsigned cnt;
{
unsigned n;
@@ -1228,7 +1238,7 @@ unsigned cnt;
write_error();
}
cnt -= n;
- buf = (voidp) ((char *) buf + n);
+ buf = (void *) ((char *) buf + n);
}
}
@@ -1240,8 +1250,8 @@ unsigned cnt;
# define const
# endif
-int strspn OF((const char *s, const char *accept));
-int strcspn OF((const char *s, const char *reject));
+int strspn (const char *s, const char *accept);
+int strcspn (const char *s, const char *reject);
/* ========================================================================
* Return the length of the maximum initial segment
@@ -1493,15 +1503,15 @@ struct huft {
/* Function prototypes */
-int huft_build OF((unsigned *, unsigned, unsigned, ush *, ush *,
- struct huft **, int *));
-int huft_free OF((struct huft *));
-int inflate_codes OF((struct huft *, struct huft *, int, int));
-int inflate_stored OF((void));
-int inflate_fixed OF((void));
-int inflate_dynamic OF((void));
-int inflate_block OF((int *));
-int inflate OF((void));
+int huft_build (unsigned *, unsigned, unsigned, ush *, ush *,
+ struct huft **, int *);
+int huft_free (struct huft *);
+int inflate_codes (struct huft *, struct huft *, int, int);
+int inflate_stored (void);
+int inflate_fixed (void);
+int inflate_dynamic (void);
+int inflate_block (int *);
+int inflate (void);
/* The inflate algorithm uses a sliding 32K byte window on the uncompressed
diff --git a/archival/gzip.c b/archival/gzip.c
index 0a969d8db..55ec5bc4e 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -1,16 +1,42 @@
/* vi: set sw=4 ts=4: */
-/* gzip.c -- this is a stripped down version of gzip I put into busybox, it does
- * only standard in to standard out with -9 compression. It also requires the
- * zcat module for some important functions.
+/*
+ * Gzip implementation for busybox
+ *
+ * Based on GNU gzip Copyright (C) 1992-1993 Jean-loup Gailly.
+ *
+ * Originally adjusted for busybox by Charles P. Wright <cpw@unix.asb.com>
+ * "this is a stripped down version of gzip I put into busybox, it does
+ * only standard in to standard out with -9 compression. It also requires
+ * the zcat module for some important functions."
+ *
+ * Adjusted further by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
+ * to support files as well as stdin/stdout, and to generally behave itself wrt
+ * command line handling.
+ *
+ * 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
*
- * Charles P. Wright <cpw@unix.asb.com>
*/
+
#include "internal.h"
-#ifdef BB_GZIP
-//#ifndef BB_ZCAT
-//#error you need zcat to have gzip support!
-//#endif
+/* These defines are very important for BusyBox. Without these,
+ * huge chunks of ram are pre-allocated making the BusyBox bss
+ * size Freaking Huge(tm), which is a bad thing.*/
+#define SMALL_MEM
+#define DYN_ALLOC
+
static const char gzip_usage[] =
"gzip [OPTION]... FILE\n\n"
@@ -21,42 +47,12 @@ static const char gzip_usage[] =
"\t-c\tWrite output to standard output instead of FILE.gz\n";
-/* gzip.h -- common declarations for all gzip modules
- * Copyright (C) 1992-1993 Jean-loup Gailly.
- * This is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License, see the file COPYING.
- */
-
-#if defined(__STDC__) || defined(PROTO)
-# define OF(args) args
-#else
-# define OF(args) ()
-#endif
-
-#ifdef __STDC__
-typedef void *voidp;
-#else
-typedef char *voidp;
-#endif
-
/* I don't like nested includes, but the string and io functions are used
* too often
*/
#include <stdio.h>
-#if !defined(NO_STRING_H) || defined(STDC_HEADERS)
-# include <string.h>
-# if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__)
-# include <memory.h>
-# endif
-# define memzero(s, n) memset ((voidp)(s), 0, (n))
-#else
-# include <strings.h>
-# define strchr index
-# define strrchr rindex
-# define memcpy(d, s, n) bcopy((s), (d), (n))
-# define memcmp(s1, s2, n) bcmp((s1), (s2), (n))
-# define memzero(s, n) bzero((s), (n))
-#endif
+#include <string.h>
+#define memzero(s, n) memset ((void *)(s), 0, (n))
#ifndef RETSIGTYPE
# define RETSIGTYPE void
@@ -121,13 +117,13 @@ extern int method; /* compression method */
#endif
#ifdef DYN_ALLOC
-# define EXTERN(type, array) extern type * near array
-# define DECLARE(type, array, size) type * near array
+# define EXTERN(type, array) extern type * array
+# define DECLARE(type, array, size) type * array
# define ALLOC(type, array, size) { \
- array = (type*)fcalloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
+ array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
if (array == NULL) errorMsg("insufficient memory"); \
}
-# define FREE(array) {if (array != NULL) fcfree(array), array=NULL;}
+# define FREE(array) {if (array != NULL) free(array), array=NULL;}
#else
# define EXTERN(type, array) extern type array[]
# define DECLARE(type, array, size) type array[size]
@@ -284,55 +280,55 @@ extern int save_orig_name; /* set if original name must be saved */
/* in zip.c: */
-extern int zip OF((int in, int out));
-extern int file_read OF((char *buf, unsigned size));
+extern int zip (int in, int out);
+extern int file_read (char *buf, unsigned size);
/* in unzip.c */
-extern int unzip OF((int in, int out));
-extern int check_zipfile OF((int in));
+extern int unzip (int in, int out);
+extern int check_zipfile (int in);
/* in unpack.c */
-extern int unpack OF((int in, int out));
+extern int unpack (int in, int out);
/* in unlzh.c */
-extern int unlzh OF((int in, int out));
+extern int unlzh (int in, int out);
/* in gzip.c */
-RETSIGTYPE abort_gzip OF((void));
+RETSIGTYPE abort_gzip (void);
/* in deflate.c */
-void lm_init OF((ush * flags));
-ulg deflate OF((void));
+void lm_init (ush * flags);
+ulg deflate (void);
/* in trees.c */
-void ct_init OF((ush * attr, int *method));
-int ct_tally OF((int dist, int lc));
-ulg flush_block OF((char *buf, ulg stored_len, int eof));
+void ct_init (ush * attr, int *method);
+int ct_tally (int dist, int lc);
+ulg flush_block (char *buf, ulg stored_len, int eof);
/* in bits.c */
-void bi_init OF((file_t zipfile));
-void send_bits OF((int value, int length));
-unsigned bi_reverse OF((unsigned value, int length));
-void bi_windup OF((void));
-void copy_block OF((char *buf, unsigned len, int header));
-extern int (*read_buf) OF((char *buf, unsigned size));
+void bi_init (file_t zipfile);
+void send_bits (int value, int length);
+unsigned bi_reverse (unsigned value, int length);
+void bi_windup (void);
+void copy_block (char *buf, unsigned len, int header);
+extern int (*read_buf) (char *buf, unsigned size);
/* in util.c: */
-extern int copy OF((int in, int out));
-extern ulg updcrc OF((uch * s, unsigned n));
-extern void clear_bufs OF((void));
-extern int fill_inbuf OF((int eof_ok));
-extern void flush_outbuf OF((void));
-extern void flush_window OF((void));
-extern void write_buf OF((int fd, voidp buf, unsigned cnt));
-extern char *strlwr OF((char *s));
-extern char *add_envopt OF((int *argcp, char ***argvp, char *env));
-extern void read_error OF((void));
-extern void write_error OF((void));
-extern void display_ratio OF((long num, long den, FILE * file));
+extern int copy (int in, int out);
+extern ulg updcrc (uch * s, unsigned n);
+extern void clear_bufs (void);
+extern int fill_inbuf (int eof_ok);
+extern void flush_outbuf (void);
+extern void flush_window (void);
+extern void write_buf (int fd, void * buf, unsigned cnt);
+extern char *strlwr (char *s);
+extern char *add_envopt (int *argcp, char ***argvp, char *env);
+extern void read_error (void);
+extern void write_error (void);
+extern void display_ratio (long num, long den, FILE * file);
/* in inflate.c */
-extern int inflate OF((void));
+extern int inflate (void);
/* lzw.h -- define the lzw functions.
* Copyright (C) 1992-1993 Jean-loup Gailly.
@@ -795,7 +791,7 @@ local int bi_valid;
* are always zero.
*/
-int (*read_buf) OF((char *buf, unsigned size));
+int (*read_buf) (char *buf, unsigned size);
/* Current input function. Set to mem_read for in-memory compression */
@@ -1148,16 +1144,16 @@ local config configuration_table =
/* ===========================================================================
* Prototypes for local functions.
*/
-local void fill_window OF((void));
+local void fill_window (void);
-int longest_match OF((IPos cur_match));
+int longest_match (IPos cur_match);
#ifdef ASMV
-void match_init OF((void)); /* asm code initialization */
+void match_init (void); /* asm code initialization */
#endif
#ifdef DEBUG
-local void check_match OF((IPos start, IPos match, int length));
+local void check_match (IPos start, IPos match, int length);
#endif
/* ===========================================================================
@@ -1708,7 +1704,7 @@ struct utimbuf {
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
-typedef RETSIGTYPE(*sig_type) OF((int));
+typedef RETSIGTYPE(*sig_type) (int);
#ifndef O_BINARY
# define O_BINARY 0 /* creation mode for open() */
@@ -1743,7 +1739,7 @@ typedef RETSIGTYPE(*sig_type) OF((int));
#ifdef NO_OFF_T
typedef long off_t;
-off_t lseek OF((int fd, off_t offset, int whence));
+off_t lseek (int fd, off_t offset, int whence);
#endif
/* Separator for file name parts (see shorten_name()) */
@@ -2246,17 +2242,17 @@ extern unsigned near strstart; /* window offset of current string */
* Local (static) routines in this file.
*/
-local void init_block OF((void));
-local void pqdownheap OF((ct_data near * tree, int k));
-local void gen_bitlen OF((tree_desc near * desc));
-local void gen_codes OF((ct_data near * tree, int max_code));
-local void build_tree OF((tree_desc near * desc));
-local void scan_tree OF((ct_data near * tree, int max_code));
-local void send_tree OF((ct_data near * tree, int max_code));
-local int build_bl_tree OF((void));
-local void send_all_trees OF((int lcodes, int dcodes, int blcodes));
-local void compress_block OF((ct_data near * ltree, ct_data near * dtree));
-local void set_file_type OF((void));
+local void init_block (void);
+local void pqdownheap (ct_data near * tree, int k);
+local void gen_bitlen (tree_desc near * desc);
+local void gen_codes (ct_data near * tree, int max_code);
+local void build_tree (tree_desc near * desc);
+local void scan_tree (ct_data near * tree, int max_code);
+local void send_tree (ct_data near * tree, int max_code);
+local int build_bl_tree (void);
+local void send_all_trees (int lcodes, int dcodes, int blcodes);
+local void compress_block (ct_data near * ltree, ct_data near * dtree);
+local void set_file_type (void);
#ifndef DEBUG
@@ -3161,12 +3157,8 @@ char *s;
/* Provide missing strspn and strcspn functions. */
-# ifndef __STDC__
-# define const
-# endif
-
-int strspn OF((const char *s, const char *accept));
-int strcspn OF((const char *s, const char *reject));
+int strspn (const char *s, const char *accept);
+int strcspn (const char *s, const char *reject);
/* ========================================================================
* Return the length of the maximum initial segment
@@ -3398,4 +3390,3 @@ unsigned size;
isize += (ulg) len;
return (int) len;
}
-#endif
diff --git a/archival/tar.c b/archival/tar.c
index 732f26ddc..4eda4c61a 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -2,9 +2,9 @@
/*
* Mini tar implementation for busybox
*
- * Note, that as of BusyBox 0.43 tar has been completely rewritten from the
- * ground up. It still has remnents of the old code lying about, but it pretty
- * different (i.e. cleaner, less global variables, etc)
+ * Note, that as of BusyBox-0.43, tar has been completely rewritten from the
+ * ground up. It still has remnents of the old code lying about, but it is
+ * very different now (i.e. cleaner, less global variables, etc)
*
* Copyright (C) 2000 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
diff --git a/basename.c b/basename.c
index 1db885f62..06e27663f 100644
--- a/basename.c
+++ b/basename.c
@@ -2,7 +2,7 @@
/*
* Mini basename implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
@@ -26,13 +26,16 @@
extern int basename_main(int argc, char **argv)
{
- char* s;
+ char* s, *s1;
if ((argc < 2) || (**(argv + 1) == '-')) {
usage("basename [file ...]\n");
}
argv++;
+ s1=*argv+strlen(*argv)-1;
+ if (*s1 == '/')
+ *s1 = '\0';
s = strrchr(*argv, '/');
printf("%s\n", (s)? s + 1 : *argv);
exit(TRUE);
diff --git a/busybox.c b/busybox.c
index 9a48f4961..b65b13e65 100644
--- a/busybox.c
+++ b/busybox.c
@@ -234,9 +234,6 @@ static const struct Applet applets[] = {
{"sh", shell_main, _BB_DIR_BIN},
#endif
#ifdef BB_SFDISK
- {"fdisk", sfdisk_main, _BB_DIR_SBIN},
-#ifdef BB_SFDISK
-#endif
{"sfdisk", sfdisk_main, _BB_DIR_SBIN},
#endif
#ifdef BB_SLEEP
@@ -382,8 +379,9 @@ int busybox_main(int argc, char **argv)
fprintf(stderr, "Usage: busybox [function] [arguments]...\n");
fprintf(stderr, " or: [function] [arguments]...\n\n");
fprintf(stderr,
- "\tMost people will create a link to busybox for each function\n"
- "\tname, and busybox will act like whatever you invoke it as.\n");
+ "\tBusyBox is a multi-call binary that combines many common Unix utilities into a\n"
+ "\tsingle executable. Most people will create a link to busybox for each function\n"
+ "\tthey wish to use, and BusyBox will act like whatever it was invoked as.\n");
fprintf(stderr, "\nCurrently defined functions:\n");
while (a->name != 0) {
diff --git a/busybox.def.h b/busybox.def.h
index 9a2ba3f69..647ed9ba4 100644
--- a/busybox.def.h
+++ b/busybox.def.h
@@ -7,7 +7,7 @@
//
//
// BusyBox Applications
-//#define BB_BASENAME
+#define BB_BASENAME
#define BB_CAT
#define BB_CHMOD_CHOWN_CHGRP
#define BB_CHROOT
@@ -20,21 +20,21 @@
#define BB_DF
#define BB_DIRNAME
#define BB_DMESG
-//#define BB_DUTMP
+#define BB_DUTMP
#define BB_DU
#define BB_ECHO
-//#define BB_FBSET
-//#define BB_FDFLUSH
+#define BB_FBSET
+#define BB_FDFLUSH
#define BB_FIND
#define BB_FREE
-//#define BB_FREERAMDISK
-//#define BB_FSCK_MINIX
+#define BB_FREERAMDISK
+#define BB_FSCK_MINIX
#define BB_GREP
#define BB_GUNZIP
#define BB_GZIP
//#define BB_HALT
#define BB_HEAD
-//#define BB_HOSTID
+#define BB_HOSTID
#define BB_HOSTNAME
#define BB_INIT
// Don't bother turning BB_INSMOD on. It doesn't work.
@@ -42,39 +42,39 @@
#define BB_KILL
#define BB_KILLALL
#define BB_KLOGD
-//#define BB_LENGTH
+#define BB_LENGTH
#define BB_LN
-//#define BB_LOADACM
-//#define BB_LOADFONT
-//#define BB_LOADKMAP
-//#define BB_LOGGER
+#define BB_LOADACM
+#define BB_LOADFONT
+#define BB_LOADKMAP
+#define BB_LOGGER
#define BB_LOGNAME
#define BB_LS
-//#define BB_LSMOD
-//#define BB_MAKEDEVS
-//#define BB_MKFS_MINIX
-//#define BB_MATH
+#define BB_LSMOD
+#define BB_MAKEDEVS
+#define BB_MKFS_MINIX
+#define BB_MATH
#define BB_MKDIR
-//#define BB_MKFIFO
+#define BB_MKFIFO
#define BB_MKNOD
#define BB_MKSWAP
-//#define BB_MNC
+#define BB_MNC
#define BB_MORE
#define BB_MOUNT
-//#define BB_NFSMOUNT
-//#define BB_MT
+#define BB_NFSMOUNT
+#define BB_MT
#define BB_NSLOOKUP
#define BB_PING
-#define BB_POWEROFF
-//#define BB_PRINTF
+//#define BB_POWEROFF
+#define BB_PRINTF
#define BB_PS
#define BB_PWD
-#define BB_REBOOT
+//#define BB_REBOOT
#define BB_RM
#define BB_RMDIR
-//#define BB_RMMOD
+#define BB_RMMOD
#define BB_SED
-//#define BB_SFDISK
+#define BB_SFDISK
#define BB_SH
#define BB_SLEEP
#define BB_SORT
@@ -86,7 +86,7 @@
#define BB_TEE
#define BB_TEST
// Don't turn BB_TELNET on. It doesn't work.
-#define BB_TELNET
+//#define BB_TELNET
#define BB_TOUCH
#define BB_TR
#define BB_TRUE_FALSE
@@ -111,7 +111,7 @@
//
//
// Turn this on to use Erik's very cool devps, devmtab,
-// etc. kernel drivers, thereby eliminating the need for
+// etc kernel drivers, thereby eliminating the need for
// the /proc filesystem and thereby saving lots and lots
// memory for more important things.
// You can't use this and USE_PROCFS at the same time...
@@ -153,7 +153,7 @@
//Enable init being called as /linuxrc
//#define BB_FEATURE_LINUXRC
//
-//Have init enable core dumping for child processed (for debugging only)
+//Have init enable core dumping for child processes (for debugging only)
//#define BB_FEATURE_INIT_COREDUMPS
//
// Allow init to permenently chroot, and umount the old root fs
@@ -181,19 +181,20 @@
#define BB_FEATURE_TAR_CREATE
//
// Enable support for "--exclude" for excluding files
-//#define BB_FEATURE_TAR_EXCLUDE
+#define BB_FEATURE_TAR_EXCLUDE
//
//// Enable reverse sort
-//#define BB_FEATURE_SORT_REVERSE
+#define BB_FEATURE_SORT_REVERSE
//
// Enable command line editing in the shell
-//#define BB_FEATURE_SH_COMMAND_EDITING
+#define BB_FEATURE_SH_COMMAND_EDITING
//
-// Enable tab completion in the shell (not yet working very well)
+// Enable tab completion in the shell (not yet
+// working very well -- so don't turn this on)
//#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
diff --git a/cat.c b/cat.c
index 58a1b0f54..f7a6bfa7b 100644
--- a/cat.c
+++ b/cat.c
@@ -2,7 +2,7 @@
/*
* Mini Cat implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/chmod_chown_chgrp.c b/chmod_chown_chgrp.c
index 00c6b349a..8dd767054 100644
--- a/chmod_chown_chgrp.c
+++ b/chmod_chown_chgrp.c
@@ -3,7 +3,7 @@
* Mini chown/chmod/chgrp implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/chroot.c b/chroot.c
index 3622c26dc..63fa4d146 100644
--- a/chroot.c
+++ b/chroot.c
@@ -3,7 +3,7 @@
* Mini chroot implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/clear.c b/clear.c
index 899840a8a..c27787ed3 100644
--- a/clear.c
+++ b/clear.c
@@ -3,7 +3,7 @@
* Mini clear implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/cmdedit.c b/cmdedit.c
index 9800dd1c6..1434c36f6 100644
--- a/cmdedit.c
+++ b/cmdedit.c
@@ -1,10 +1,12 @@
/* vi: set sw=4 ts=4: */
/*
- * Termios command line History and Editting for NetBSD sh (ash)
+ * Termios command line History and Editting, originally
+ * intended for NetBSD sh (ash)
* Copyright (c) 1999
* Main code: Adam Rogoyski <rogoyski@cs.utexas.edu>
* Etc: Dave Cinege <dcinege@psychosis.com>
- * Adjusted for busybox: Erik Andersen <andersee@debian.org>
+ * Majorly adjusted/re-written for busybox:
+ * Erik Andersen <andersee@debian.org>
*
* You may use this code as you wish, so long as the original author(s)
* are attributed in any redistributions of the source code.
@@ -69,14 +71,15 @@ struct history {
void
cmdedit_setwidth(int w)
{
- if (w > 20) {
+ if (w > 20) {
cmdedit_termw = w;
cmdedit_scroll = w / 3;
- } else {
+ } else {
errorMsg("\n*** Error: minimum screen width is 21\n");
- }
+ }
}
+
void cmdedit_reset_term(void)
{
if (reset_term)
@@ -339,60 +342,7 @@ void get_next_history(struct history **hp, char* command)
free((*hp)->s);
(*hp)->s = strdup(command);
*hp = (*hp)->n;
-
- cmdedit_redraw( NULL, hp->s, -2, -2);
-}
-
-#if 0
-/* prompt : if !=NULL, print the prompt
- * command: the command line to be displayed
- * where : where to display changes from.
- * -1 for no change, -2 for new line
- * cursor : desired location for the cursor.
- * -1 for Beginning of line.
- * -2 for End of Line,
- */
-static void
-cmdedit_redraw(char* prompt, char* command, int where, int cursor)
-{
- static char* last_command;
- int cmdedit_width;
-
- if (where == -2) {
- /* Rewrite the prompt and clean up static variables */
- xwrite(outputFd, "\n", 1);
- if (prompt) {
- strcpy(last_command, prompt);
- xwrite(outputFd, prompt, strlen(prompt));
- } else {
- last_command[0] = '\0';
- xwrite(outputFd, "# ", 2);
- }
- cmdedit_width = cmdedit_termw - cmdedit_strlen(prompt);
- } else if (strcmp(command, last_command) != 0) {
- strcpy(last_command, prompt);
- }
-
- /* erase old command from command line */
- len = strlen(command)-strlen(last_command);
- while (len>0)
- input_backspace(command, outputFd, &cursor, &len);
- input_home(outputFd, &cursor);
-
- /* Rewrite the command */
- xwrite(outputFd, command+where, len);
-
- /* Put the where it is supposed to be */
- for (cursor=len; cursor > where; cursor--)
- xwrite(outputFd, "\b", 1);
-
- /* write new command */
- strcpy(command, hp->s);
- len = strlen(hp->s);
- xwrite(outputFd, command+where, len);
- cursor = len;
}
-#endif
/*
* This function is used to grab a character buffer
diff --git a/console-tools/clear.c b/console-tools/clear.c
index 899840a8a..c27787ed3 100644
--- a/console-tools/clear.c
+++ b/console-tools/clear.c
@@ -3,7 +3,7 @@
* Mini clear implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/console-tools/loadacm.c b/console-tools/loadacm.c
index 072562f6b..66f79092c 100644
--- a/console-tools/loadacm.c
+++ b/console-tools/loadacm.c
@@ -353,8 +353,8 @@ void saveoldmap(int fd, char *omfil)
unicode utf8_to_ucs2(char *buf)
{
int utf_count = 0;
- long utf_char;
- unicode tc;
+ long utf_char = 0;
+ unicode tc = 0;
unsigned char c;
do {
diff --git a/coreutils/basename.c b/coreutils/basename.c
index 1db885f62..06e27663f 100644
--- a/coreutils/basename.c
+++ b/coreutils/basename.c
@@ -2,7 +2,7 @@
/*
* Mini basename implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
@@ -26,13 +26,16 @@
extern int basename_main(int argc, char **argv)
{
- char* s;
+ char* s, *s1;
if ((argc < 2) || (**(argv + 1) == '-')) {
usage("basename [file ...]\n");
}
argv++;
+ s1=*argv+strlen(*argv)-1;
+ if (*s1 == '/')
+ *s1 = '\0';
s = strrchr(*argv, '/');
printf("%s\n", (s)? s + 1 : *argv);
exit(TRUE);
diff --git a/coreutils/cat.c b/coreutils/cat.c
index 58a1b0f54..f7a6bfa7b 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -2,7 +2,7 @@
/*
* Mini Cat implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/coreutils/chroot.c b/coreutils/chroot.c
index 3622c26dc..63fa4d146 100644
--- a/coreutils/chroot.c
+++ b/coreutils/chroot.c
@@ -3,7 +3,7 @@
* Mini chroot implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 9c7d872b1..303500008 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -2,13 +2,13 @@
/*
* Mini dd implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999, 2000 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
- * based in part on code taken from sash.
*
- * Copyright (c) 1999 by David I. Bell
- * Permission is granted to use, distribute, or modify this source,
- * provided that this copyright notice remains intact.
+ * Based in part on code taken from sash.
+ * Copyright (c) 1999 by David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
*
* Permission to distribute this code under the GPL has been granted.
*
diff --git a/coreutils/df.c b/coreutils/df.c
index 331ef2d49..c38720454 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -2,7 +2,7 @@
/*
* Mini df implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
* based on original code by (I think) Bruce Perens <bruce@pixar.com>.
*
@@ -28,9 +28,8 @@
#include <sys/stat.h>
#include <sys/vfs.h>
-static const char df_usage[] = "df [filesystem ...]\n"
-
- "\n" "\tPrint the filesystem space used and space available.\n";
+static const char df_usage[] = "df [filesystem ...]\n\n"
+ "Print the filesystem space used and space available.\n";
extern const char mtab_file[]; /* Defined in utility.c */
@@ -76,6 +75,9 @@ extern int df_main(int argc, char **argv)
struct mntent *mountEntry;
int status;
+ if (**(argv + 1) == '-') {
+ usage(df_usage);
+ }
while (argc > 1) {
if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) {
fprintf(stderr, "%s: can't find mount point.\n", argv[1]);
diff --git a/coreutils/du.c b/coreutils/du.c
index b6ebaca7a..874538015 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -3,7 +3,7 @@
* Mini du implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000 by Lineo, inc.
* Written by John Beppu <beppu@lineo.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -182,7 +182,7 @@ int du_main(int argc, char **argv)
exit(0);
}
-/* $Id: du.c,v 1.16 2000/03/04 21:19:32 erik Exp $ */
+/* $Id: du.c,v 1.17 2000/04/13 01:18:56 erik Exp $ */
/*
Local Variables:
c-file-style: "linux"
diff --git a/coreutils/head.c b/coreutils/head.c
index 82a73de2a..3db64b3bc 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -3,7 +3,7 @@
* Mini head implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000 by Lineo, inc.
* Written by John Beppu <beppu@lineo.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -109,4 +109,4 @@ int head_main(int argc, char **argv)
exit(0);
}
-/* $Id: head.c,v 1.8 2000/02/08 19:58:47 erik Exp $ */
+/* $Id: head.c,v 1.9 2000/04/13 01:18:56 erik Exp $ */
diff --git a/coreutils/ln.c b/coreutils/ln.c
index c54026c62..4be60624e 100644
--- a/coreutils/ln.c
+++ b/coreutils/ln.c
@@ -2,8 +2,7 @@
/*
* Mini ln implementation for busybox
*
- *
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c
index 70fdbdfb5..b0a2d57d6 100644
--- a/coreutils/mkdir.c
+++ b/coreutils/mkdir.c
@@ -2,8 +2,7 @@
/*
* Mini mkdir implementation for busybox
*
- *
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/coreutils/rm.c b/coreutils/rm.c
index 683bf8bdf..0cd795661 100644
--- a/coreutils/rm.c
+++ b/coreutils/rm.c
@@ -3,7 +3,7 @@
* Mini rm implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c
index f49569749..1d88de322 100644
--- a/coreutils/rmdir.c
+++ b/coreutils/rmdir.c
@@ -3,7 +3,7 @@
* Mini rmdir implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/coreutils/sort.c b/coreutils/sort.c
index e6894f6c3..6ee6f207e 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -3,7 +3,7 @@
* Mini sort implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000 by Lineo, inc.
* Written by John Beppu <beppu@lineo.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -320,4 +320,4 @@ int sort_main(int argc, char **argv)
exit(0);
}
-/* $Id: sort.c,v 1.12 2000/03/04 21:19:32 erik Exp $ */
+/* $Id: sort.c,v 1.13 2000/04/13 01:18:56 erik Exp $ */
diff --git a/coreutils/tee.c b/coreutils/tee.c
index 018fe117b..95b75edd7 100644
--- a/coreutils/tee.c
+++ b/coreutils/tee.c
@@ -3,7 +3,7 @@
* Mini tee implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000 by Lineo, inc.
* Written by John Beppu <beppu@lineo.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -131,4 +131,4 @@ int tee_main(int argc, char **argv)
exit(0);
}
-/* $Id: tee.c,v 1.8 2000/03/23 01:09:18 erik Exp $ */
+/* $Id: tee.c,v 1.9 2000/04/13 01:18:56 erik Exp $ */
diff --git a/coreutils/touch.c b/coreutils/touch.c
index a0f21acdd..f8972dcf6 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -3,7 +3,7 @@
* Mini touch implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/coreutils/uniq.c b/coreutils/uniq.c
index 1e41eaacd..2eedb886d 100644
--- a/coreutils/uniq.c
+++ b/coreutils/uniq.c
@@ -3,7 +3,7 @@
* Mini uniq implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000 by Lineo, inc.
* Written by John Beppu <beppu@lineo.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -190,4 +190,4 @@ int uniq_main(int argc, char **argv)
exit(0);
}
-/* $Id: uniq.c,v 1.7 2000/02/08 19:58:47 erik Exp $ */
+/* $Id: uniq.c,v 1.8 2000/04/13 01:18:56 erik Exp $ */
diff --git a/cp_mv.c b/cp_mv.c
index 72b0791c2..9a3084935 100644
--- a/cp_mv.c
+++ b/cp_mv.c
@@ -37,7 +37,7 @@
#include <utime.h>
#include <dirent.h>
#include <sys/param.h>
-#include <setjmp.h> /* Ok to use this since `ash' does, therefore it's in the libc subset already. */
+#include <setjmp.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
diff --git a/dd.c b/dd.c
index 9c7d872b1..303500008 100644
--- a/dd.c
+++ b/dd.c
@@ -2,13 +2,13 @@
/*
* Mini dd implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999, 2000 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
- * based in part on code taken from sash.
*
- * Copyright (c) 1999 by David I. Bell
- * Permission is granted to use, distribute, or modify this source,
- * provided that this copyright notice remains intact.
+ * Based in part on code taken from sash.
+ * Copyright (c) 1999 by David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
*
* Permission to distribute this code under the GPL has been granted.
*
diff --git a/df.c b/df.c
index 331ef2d49..c38720454 100644
--- a/df.c
+++ b/df.c
@@ -2,7 +2,7 @@
/*
* Mini df implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
* based on original code by (I think) Bruce Perens <bruce@pixar.com>.
*
@@ -28,9 +28,8 @@
#include <sys/stat.h>
#include <sys/vfs.h>
-static const char df_usage[] = "df [filesystem ...]\n"
-
- "\n" "\tPrint the filesystem space used and space available.\n";
+static const char df_usage[] = "df [filesystem ...]\n\n"
+ "Print the filesystem space used and space available.\n";
extern const char mtab_file[]; /* Defined in utility.c */
@@ -76,6 +75,9 @@ extern int df_main(int argc, char **argv)
struct mntent *mountEntry;
int status;
+ if (**(argv + 1) == '-') {
+ usage(df_usage);
+ }
while (argc > 1) {
if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) {
fprintf(stderr, "%s: can't find mount point.\n", argv[1]);
diff --git a/du.c b/du.c
index b6ebaca7a..874538015 100644
--- a/du.c
+++ b/du.c
@@ -3,7 +3,7 @@
* Mini du implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000 by Lineo, inc.
* Written by John Beppu <beppu@lineo.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -182,7 +182,7 @@ int du_main(int argc, char **argv)
exit(0);
}
-/* $Id: du.c,v 1.16 2000/03/04 21:19:32 erik Exp $ */
+/* $Id: du.c,v 1.17 2000/04/13 01:18:56 erik Exp $ */
/*
Local Variables:
c-file-style: "linux"
diff --git a/dutmp.c b/dutmp.c
index 45eab8ae7..cf0d466ef 100644
--- a/dutmp.c
+++ b/dutmp.c
@@ -13,34 +13,35 @@
#include "internal.h"
#include <stdio.h>
+#include <errno.h>
#include <utmp.h>
+#define BB_DECLARE_EXTERN
+#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";
extern int dutmp_main(int argc, char **argv)
{
- FILE *f = stdin;
+ FILE *f;
struct utmp ut;
- if ((argc < 2) || (**(argv + 1) == '-')) {
+ if (argc<2) {
+ f = stdin;
+ } else if (*argv[1] == '-' ) {
usage(dutmp_usage);
- }
-
- if (**(++argv) == 0) {
- f = fopen(*(++argv), "r");
- if (f < 0) {
- perror(*argv);
- exit(FALSE);
+ } else {
+ f = fopen(argv[1], "r");
+ if (f == NULL) {
+ fatalError(io_error, argv[1], strerror(errno));
}
}
- while (fread(&ut, 1, sizeof(struct utmp), f)) {
- // printf("%d:%d:%s:%s:%s:%s:%d:%d:%ld:%ld:%ld:%x\n",
+ while (fread(&ut, sizeof(struct utmp), 1, f)) {
printf("%d|%d|%s|%s|%s|%s|%d|%d|%ld|%ld|%ld|%x\n",
ut.ut_type, ut.ut_pid, ut.ut_line,
ut.ut_id, ut.ut_user, ut.ut_host,
diff --git a/editors/sed.c b/editors/sed.c
index 2beb2a588..0d57a4a06 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -3,7 +3,7 @@
* Mini sed implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
*
* Modifications for addresses and append command have been
diff --git a/fbset.c b/fbset.c
index 7ca41733b..1f471dada 100644
--- a/fbset.c
+++ b/fbset.c
@@ -228,10 +228,11 @@ static void fbset_usage(void)
fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n",
BB_VER, BB_BT);
#endif
- fprintf(stderr, "Usage: fbset [options] [mode]\n");
- fprintf(stderr, "\tThe following options are recognized:\n");
+ fprintf(stderr, "Usage: fbset [options] [mode]\n\n");
+ fprintf(stderr, "Show and modify frame buffer device settings\n\n");
+ fprintf(stderr, "The following options are recognized:\n");
for (i = 0; g_cmdoptions[i].name; i++)
- fprintf(stderr, "\t\t%s\n", g_cmdoptions[i].name);
+ fprintf(stderr, "\t%s\n", g_cmdoptions[i].name);
exit(-1);
}
diff --git a/find.c b/find.c
index c23ac5f46..8fdef2382 100644
--- a/find.c
+++ b/find.c
@@ -3,7 +3,7 @@
* Mini find implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/findutils/find.c b/findutils/find.c
index c23ac5f46..8fdef2382 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -3,7 +3,7 @@
* Mini find implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/findutils/grep.c b/findutils/grep.c
index d8d2f1837..abdd44236 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -3,7 +3,7 @@
* Mini grep implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/free.c b/free.c
index 78a36fe9a..39594dbe5 100644
--- a/free.c
+++ b/free.c
@@ -2,7 +2,7 @@
/*
* Mini free implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/grep.c b/grep.c
index d8d2f1837..abdd44236 100644
--- a/grep.c
+++ b/grep.c
@@ -3,7 +3,7 @@
* Mini grep implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/gunzip.c b/gunzip.c
index 7aa896469..1a5cdba88 100644
--- a/gunzip.c
+++ b/gunzip.c
@@ -1,13 +1,33 @@
/* vi: set sw=4 ts=4: */
-/* zcat : stripped version based on gzip sources
- Sven Rudolph <sr1@inf.tu-dresden.de>
- */
+/*
+ * Gzip implementation for busybox
+ *
+ * Based on GNU gzip Copyright (C) 1992-1993 Jean-loup Gailly.
+ *
+ * Originally adjusted for busybox by Sven Rudolph <sr1@inf.tu-dresden.de>
+ * based on gzip sources
+ *
+ * Adjusted further by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
+ * to support files as well as stdin/stdout, and to generally behave itself wrt
+ * command line handling.
+ *
+ * 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
+ *
+ */
#include "internal.h"
-#define bb_need_name_too_long
-#define BB_DECLARE_EXTERN
-#include "messages.c"
-
static const char gunzip_usage[] =
"gunzip [OPTION]... FILE\n\n"
"Uncompress FILE (or standard input if FILE is '-').\n\n"
@@ -16,6 +36,18 @@ static const char gunzip_usage[] =
"\t-c\tWrite output to standard output\n"
"\t-t\tTest compressed file integrity\n";
+
+ /* These defines are very important for BusyBox. Without these,
+ * huge chunks of ram are pre-allocated making the BusyBox bss
+ * size Freaking Huge(tm), which is a bad thing.*/
+#define SMALL_MEM
+#define DYN_ALLOC
+
+#define bb_need_name_too_long
+#define BB_DECLARE_EXTERN
+#include "messages.c"
+
+
/* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
* Copyright (C) 1992-1993 Jean-loup Gailly
* The unzip code was written and put in the public domain by Mark Adler.
@@ -89,25 +121,6 @@ static char *license_msg[] = {
#define get_char() get_byte()
#define put_char(c) put_byte(c)
-/* #include "gzip.h" */
-
-/* gzip.h -- common declarations for all gzip modules
- * Copyright (C) 1992-1993 Jean-loup Gailly.
- * This is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License, see the file COPYING.
- */
-
-#if defined(__STDC__) || defined(PROTO)
-# define OF(args) args
-#else
-# define OF(args) ()
-#endif
-
-#ifdef __STDC__
-typedef void *voidp;
-#else
-typedef char *voidp;
-#endif
/* I don't like nested includes, but the string and io functions are used
* too often
@@ -118,7 +131,7 @@ typedef char *voidp;
# if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__)
# include <memory.h>
# endif
-# define memzero(s, n) memset ((voidp)(s), 0, (n))
+# define memzero(s, n) memset ((void *)(s), 0, (n))
#else
# include <strings.h>
# define strchr index
@@ -329,49 +342,46 @@ extern int save_orig_name; /* set if original name must be saved */
#define WARN(msg) {fprintf msg ; \
if (exit_code == OK) exit_code = WARNING;}
-#define do_exit(c) exit(c)
-
-
/* in unzip.c */
-extern int unzip OF((int in, int out));
+extern int unzip (int in, int out);
/* in gzip.c */
-RETSIGTYPE abort_gzip OF((void));
+RETSIGTYPE abort_gzip (void);
/* in deflate.c */
-void lm_init OF((int pack_level, ush * flags));
-ulg deflate OF((void));
+void lm_init (int pack_level, ush * flags);
+ulg deflate (void);
/* in trees.c */
-void ct_init OF((ush * attr, int *method));
-int ct_tally OF((int dist, int lc));
-ulg flush_block OF((char *buf, ulg stored_len, int eof));
+void ct_init (ush * attr, int *method);
+int ct_tally (int dist, int lc);
+ulg flush_block (char *buf, ulg stored_len, int eof);
/* in bits.c */
-void bi_init OF((file_t zipfile));
-void send_bits OF((int value, int length));
-unsigned bi_reverse OF((unsigned value, int length));
-void bi_windup OF((void));
-void copy_block OF((char *buf, unsigned len, int header));
-extern int (*read_buf) OF((char *buf, unsigned size));
+void bi_init (file_t zipfile);
+void send_bits (int value, int length);
+unsigned bi_reverse (unsigned value, int length);
+void bi_windup (void);
+void copy_block (char *buf, unsigned len, int header);
+extern int (*read_buf) (char *buf, unsigned size);
/* in util.c: */
-extern int copy OF((int in, int out));
-extern ulg updcrc OF((uch * s, unsigned n));
-extern void clear_bufs OF((void));
-extern int fill_inbuf OF((int eof_ok));
-extern void flush_outbuf OF((void));
-extern void flush_window OF((void));
-extern void write_buf OF((int fd, voidp buf, unsigned cnt));
+extern int copy (int in, int out);
+extern ulg updcrc (uch * s, unsigned n);
+extern void clear_bufs (void);
+extern int fill_inbuf (int eof_ok);
+extern void flush_outbuf (void);
+extern void flush_window (void);
+extern void write_buf (int fd, void * buf, unsigned cnt);
#ifndef __linux__
-extern char *basename OF((char *fname));
+extern char *basename (char *fname);
#endif /* not __linux__ */
-extern void read_error OF((void));
-extern void write_error OF((void));
+extern void read_error (void);
+extern void write_error (void);
/* in inflate.c */
-extern int inflate OF((void));
+extern int inflate (void);
/* #include "lzw.h" */
@@ -415,8 +425,8 @@ extern int inflate OF((void));
extern int maxbits; /* max bits per code for LZW */
extern int block_mode; /* block compress mode -C compatible with 2.0 */
-extern int lzw OF((int in, int out));
-extern int unlzw OF((int in, int out));
+extern int lzw (int in, int out);
+extern int unlzw (int in, int out);
/* #include "revision.h" */
@@ -605,7 +615,7 @@ typedef struct direct dir_type;
#if !defined(S_ISREG) && defined(S_IFREG)
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
-typedef RETSIGTYPE(*sig_type) OF((int));
+typedef RETSIGTYPE(*sig_type) (int);
#ifndef O_BINARY
# define O_BINARY 0 /* creation mode for open() */
@@ -644,7 +654,7 @@ typedef RETSIGTYPE(*sig_type) OF((int));
#ifdef NO_OFF_T
typedef long off_t;
-off_t lseek OF((int fd, off_t offset, int whence));
+off_t lseek (int fd, off_t offset, int whence);
#endif
@@ -687,7 +697,7 @@ long header_bytes; /* number of bytes in gzip header */
/* local functions */
-local int get_method OF((int in));
+local int get_method (int in);
#define strequ(s1, s2) (strcmp((s1),(s2)) == 0)
@@ -773,7 +783,7 @@ int gunzip_main(int argc, char **argv)
usage(gunzip_usage);
if (strlen(*argv) > MAX_PATH_LEN) {
fprintf(stderr, name_too_long, "gunzip");
- do_exit(WARNING);
+ exit(WARNING);
}
strcpy(ifname, *argv);
@@ -781,13 +791,13 @@ int gunzip_main(int argc, char **argv)
inFileNum = open(ifname, O_RDONLY);
if (inFileNum < 0) {
perror(ifname);
- do_exit(WARNING);
+ exit(WARNING);
}
/* Get the time stamp on the input file. */
result = stat(ifname, &statBuf);
if (result < 0) {
perror(ifname);
- do_exit(WARNING);
+ exit(WARNING);
}
ifile_size = statBuf.st_size;
}
@@ -812,7 +822,7 @@ int gunzip_main(int argc, char **argv)
/* And get to work */
if (strlen(ifname) > MAX_PATH_LEN - 4) {
fprintf(stderr, name_too_long, "gunzip");
- do_exit(WARNING);
+ exit(WARNING);
}
strcpy(ofname, ifname);
pos = strstr(ofname, ".gz");
@@ -836,7 +846,7 @@ int gunzip_main(int argc, char **argv)
#endif
if (outFileNum < 0) {
perror(ofname);
- do_exit(WARNING);
+ exit(WARNING);
}
/* Set permissions on the file */
fchmod(outFileNum, statBuf.st_mode);
@@ -860,7 +870,7 @@ int gunzip_main(int argc, char **argv)
exit(FALSE);
}
}
- do_exit(exit_code);
+ exit(exit_code);
}
@@ -953,7 +963,7 @@ int in; /* input file descriptor */
*/
RETSIGTYPE abort_gzip()
{
- do_exit(ERROR);
+ exit(ERROR);
}
/* unzip.c -- decompress files in gzip or pkzip format.
@@ -1027,7 +1037,7 @@ int in, out; /* input and output file descriptors */
ofd = out;
method = get_method(ifd);
if (method < 0) {
- do_exit(exit_code); /* error message already emitted */
+ exit(exit_code); /* error message already emitted */
}
updcrc(NULL, 0); /* initialize crc */
@@ -1218,7 +1228,7 @@ void flush_window()
*/
void write_buf(fd, buf, cnt)
int fd;
-voidp buf;
+void * buf;
unsigned cnt;
{
unsigned n;
@@ -1228,7 +1238,7 @@ unsigned cnt;
write_error();
}
cnt -= n;
- buf = (voidp) ((char *) buf + n);
+ buf = (void *) ((char *) buf + n);
}
}
@@ -1240,8 +1250,8 @@ unsigned cnt;
# define const
# endif
-int strspn OF((const char *s, const char *accept));
-int strcspn OF((const char *s, const char *reject));
+int strspn (const char *s, const char *accept);
+int strcspn (const char *s, const char *reject);
/* ========================================================================
* Return the length of the maximum initial segment
@@ -1493,15 +1503,15 @@ struct huft {
/* Function prototypes */
-int huft_build OF((unsigned *, unsigned, unsigned, ush *, ush *,
- struct huft **, int *));
-int huft_free OF((struct huft *));
-int inflate_codes OF((struct huft *, struct huft *, int, int));
-int inflate_stored OF((void));
-int inflate_fixed OF((void));
-int inflate_dynamic OF((void));
-int inflate_block OF((int *));
-int inflate OF((void));
+int huft_build (unsigned *, unsigned, unsigned, ush *, ush *,
+ struct huft **, int *);
+int huft_free (struct huft *);
+int inflate_codes (struct huft *, struct huft *, int, int);
+int inflate_stored (void);
+int inflate_fixed (void);
+int inflate_dynamic (void);
+int inflate_block (int *);
+int inflate (void);
/* The inflate algorithm uses a sliding 32K byte window on the uncompressed
diff --git a/gzip.c b/gzip.c
index 0a969d8db..55ec5bc4e 100644
--- a/gzip.c
+++ b/gzip.c
@@ -1,16 +1,42 @@
/* vi: set sw=4 ts=4: */
-/* gzip.c -- this is a stripped down version of gzip I put into busybox, it does
- * only standard in to standard out with -9 compression. It also requires the
- * zcat module for some important functions.
+/*
+ * Gzip implementation for busybox
+ *
+ * Based on GNU gzip Copyright (C) 1992-1993 Jean-loup Gailly.
+ *
+ * Originally adjusted for busybox by Charles P. Wright <cpw@unix.asb.com>
+ * "this is a stripped down version of gzip I put into busybox, it does
+ * only standard in to standard out with -9 compression. It also requires
+ * the zcat module for some important functions."
+ *
+ * Adjusted further by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
+ * to support files as well as stdin/stdout, and to generally behave itself wrt
+ * command line handling.
+ *
+ * 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
*
- * Charles P. Wright <cpw@unix.asb.com>
*/
+
#include "internal.h"
-#ifdef BB_GZIP
-//#ifndef BB_ZCAT
-//#error you need zcat to have gzip support!
-//#endif
+/* These defines are very important for BusyBox. Without these,
+ * huge chunks of ram are pre-allocated making the BusyBox bss
+ * size Freaking Huge(tm), which is a bad thing.*/
+#define SMALL_MEM
+#define DYN_ALLOC
+
static const char gzip_usage[] =
"gzip [OPTION]... FILE\n\n"
@@ -21,42 +47,12 @@ static const char gzip_usage[] =
"\t-c\tWrite output to standard output instead of FILE.gz\n";
-/* gzip.h -- common declarations for all gzip modules
- * Copyright (C) 1992-1993 Jean-loup Gailly.
- * This is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License, see the file COPYING.
- */
-
-#if defined(__STDC__) || defined(PROTO)
-# define OF(args) args
-#else
-# define OF(args) ()
-#endif
-
-#ifdef __STDC__
-typedef void *voidp;
-#else
-typedef char *voidp;
-#endif
-
/* I don't like nested includes, but the string and io functions are used
* too often
*/
#include <stdio.h>
-#if !defined(NO_STRING_H) || defined(STDC_HEADERS)
-# include <string.h>
-# if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__)
-# include <memory.h>
-# endif
-# define memzero(s, n) memset ((voidp)(s), 0, (n))
-#else
-# include <strings.h>
-# define strchr index
-# define strrchr rindex
-# define memcpy(d, s, n) bcopy((s), (d), (n))
-# define memcmp(s1, s2, n) bcmp((s1), (s2), (n))
-# define memzero(s, n) bzero((s), (n))
-#endif
+#include <string.h>
+#define memzero(s, n) memset ((void *)(s), 0, (n))
#ifndef RETSIGTYPE
# define RETSIGTYPE void
@@ -121,13 +117,13 @@ extern int method; /* compression method */
#endif
#ifdef DYN_ALLOC
-# define EXTERN(type, array) extern type * near array
-# define DECLARE(type, array, size) type * near array
+# define EXTERN(type, array) extern type * array
+# define DECLARE(type, array, size) type * array
# define ALLOC(type, array, size) { \
- array = (type*)fcalloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
+ array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
if (array == NULL) errorMsg("insufficient memory"); \
}
-# define FREE(array) {if (array != NULL) fcfree(array), array=NULL;}
+# define FREE(array) {if (array != NULL) free(array), array=NULL;}
#else
# define EXTERN(type, array) extern type array[]
# define DECLARE(type, array, size) type array[size]
@@ -284,55 +280,55 @@ extern int save_orig_name; /* set if original name must be saved */
/* in zip.c: */
-extern int zip OF((int in, int out));
-extern int file_read OF((char *buf, unsigned size));
+extern int zip (int in, int out);
+extern int file_read (char *buf, unsigned size);
/* in unzip.c */
-extern int unzip OF((int in, int out));
-extern int check_zipfile OF((int in));
+extern int unzip (int in, int out);
+extern int check_zipfile (int in);
/* in unpack.c */
-extern int unpack OF((int in, int out));
+extern int unpack (int in, int out);
/* in unlzh.c */
-extern int unlzh OF((int in, int out));
+extern int unlzh (int in, int out);
/* in gzip.c */
-RETSIGTYPE abort_gzip OF((void));
+RETSIGTYPE abort_gzip (void);
/* in deflate.c */
-void lm_init OF((ush * flags));
-ulg deflate OF((void));
+void lm_init (ush * flags);
+ulg deflate (void);
/* in trees.c */
-void ct_init OF((ush * attr, int *method));
-int ct_tally OF((int dist, int lc));
-ulg flush_block OF((char *buf, ulg stored_len, int eof));
+void ct_init (ush * attr, int *method);
+int ct_tally (int dist, int lc);
+ulg flush_block (char *buf, ulg stored_len, int eof);
/* in bits.c */
-void bi_init OF((file_t zipfile));
-void send_bits OF((int value, int length));
-unsigned bi_reverse OF((unsigned value, int length));
-void bi_windup OF((void));
-void copy_block OF((char *buf, unsigned len, int header));
-extern int (*read_buf) OF((char *buf, unsigned size));
+void bi_init (file_t zipfile);
+void send_bits (int value, int length);
+unsigned bi_reverse (unsigned value, int length);
+void bi_windup (void);
+void copy_block (char *buf, unsigned len, int header);
+extern int (*read_buf) (char *buf, unsigned size);
/* in util.c: */
-extern int copy OF((int in, int out));
-extern ulg updcrc OF((uch * s, unsigned n));
-extern void clear_bufs OF((void));
-extern int fill_inbuf OF((int eof_ok));
-extern void flush_outbuf OF((void));
-extern void flush_window OF((void));
-extern void write_buf OF((int fd, voidp buf, unsigned cnt));
-extern char *strlwr OF((char *s));
-extern char *add_envopt OF((int *argcp, char ***argvp, char *env));
-extern void read_error OF((void));
-extern void write_error OF((void));
-extern void display_ratio OF((long num, long den, FILE * file));
+extern int copy (int in, int out);
+extern ulg updcrc (uch * s, unsigned n);
+extern void clear_bufs (void);
+extern int fill_inbuf (int eof_ok);
+extern void flush_outbuf (void);
+extern void flush_window (void);
+extern void write_buf (int fd, void * buf, unsigned cnt);
+extern char *strlwr (char *s);
+extern char *add_envopt (int *argcp, char ***argvp, char *env);
+extern void read_error (void);
+extern void write_error (void);
+extern void display_ratio (long num, long den, FILE * file);
/* in inflate.c */
-extern int inflate OF((void));
+extern int inflate (void);
/* lzw.h -- define the lzw functions.
* Copyright (C) 1992-1993 Jean-loup Gailly.
@@ -795,7 +791,7 @@ local int bi_valid;
* are always zero.
*/
-int (*read_buf) OF((char *buf, unsigned size));
+int (*read_buf) (char *buf, unsigned size);
/* Current input function. Set to mem_read for in-memory compression */
@@ -1148,16 +1144,16 @@ local config configuration_table =
/* ===========================================================================
* Prototypes for local functions.
*/
-local void fill_window OF((void));
+local void fill_window (void);
-int longest_match OF((IPos cur_match));
+int longest_match (IPos cur_match);
#ifdef ASMV
-void match_init OF((void)); /* asm code initialization */
+void match_init (void); /* asm code initialization */
#endif
#ifdef DEBUG
-local void check_match OF((IPos start, IPos match, int length));
+local void check_match (IPos start, IPos match, int length);
#endif
/* ===========================================================================
@@ -1708,7 +1704,7 @@ struct utimbuf {
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
-typedef RETSIGTYPE(*sig_type) OF((int));
+typedef RETSIGTYPE(*sig_type) (int);
#ifndef O_BINARY
# define O_BINARY 0 /* creation mode for open() */
@@ -1743,7 +1739,7 @@ typedef RETSIGTYPE(*sig_type) OF((int));
#ifdef NO_OFF_T
typedef long off_t;
-off_t lseek OF((int fd, off_t offset, int whence));
+off_t lseek (int fd, off_t offset, int whence);
#endif
/* Separator for file name parts (see shorten_name()) */
@@ -2246,17 +2242,17 @@ extern unsigned near strstart; /* window offset of current string */
* Local (static) routines in this file.
*/
-local void init_block OF((void));
-local void pqdownheap OF((ct_data near * tree, int k));
-local void gen_bitlen OF((tree_desc near * desc));
-local void gen_codes OF((ct_data near * tree, int max_code));
-local void build_tree OF((tree_desc near * desc));
-local void scan_tree OF((ct_data near * tree, int max_code));
-local void send_tree OF((ct_data near * tree, int max_code));
-local int build_bl_tree OF((void));
-local void send_all_trees OF((int lcodes, int dcodes, int blcodes));
-local void compress_block OF((ct_data near * ltree, ct_data near * dtree));
-local void set_file_type OF((void));
+local void init_block (void);
+local void pqdownheap (ct_data near * tree, int k);
+local void gen_bitlen (tree_desc near * desc);
+local void gen_codes (ct_data near * tree, int max_code);
+local void build_tree (tree_desc near * desc);
+local void scan_tree (ct_data near * tree, int max_code);
+local void send_tree (ct_data near * tree, int max_code);
+local int build_bl_tree (void);
+local void send_all_trees (int lcodes, int dcodes, int blcodes);
+local void compress_block (ct_data near * ltree, ct_data near * dtree);
+local void set_file_type (void);
#ifndef DEBUG
@@ -3161,12 +3157,8 @@ char *s;
/* Provide missing strspn and strcspn functions. */
-# ifndef __STDC__
-# define const
-# endif
-
-int strspn OF((const char *s, const char *accept));
-int strcspn OF((const char *s, const char *reject));
+int strspn (const char *s, const char *accept);
+int strcspn (const char *s, const char *reject);
/* ========================================================================
* Return the length of the maximum initial segment
@@ -3398,4 +3390,3 @@ unsigned size;
isize += (ulg) len;
return (int) len;
}
-#endif
diff --git a/head.c b/head.c
index 82a73de2a..3db64b3bc 100644
--- a/head.c
+++ b/head.c
@@ -3,7 +3,7 @@
* Mini head implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000 by Lineo, inc.
* Written by John Beppu <beppu@lineo.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -109,4 +109,4 @@ int head_main(int argc, char **argv)
exit(0);
}
-/* $Id: head.c,v 1.8 2000/02/08 19:58:47 erik Exp $ */
+/* $Id: head.c,v 1.9 2000/04/13 01:18:56 erik Exp $ */
diff --git a/init.c b/init.c
index 033eb519f..e8a5f74d3 100644
--- a/init.c
+++ b/init.c
@@ -471,8 +471,10 @@ static void check_memory()
return;
if (stat("/etc/fstab", &statBuf) == 0) {
+ /* swapon -a requires /proc typically */
+ waitfor("mount proc /proc -t proc", console, FALSE);
/* Try to turn on swap */
- system("/sbin/swapon -a");
+ waitfor("swapon -a", console, FALSE);
if (check_free_memory() < 1000)
goto goodnight;
} else
diff --git a/init/init.c b/init/init.c
index 033eb519f..e8a5f74d3 100644
--- a/init/init.c
+++ b/init/init.c
@@ -471,8 +471,10 @@ static void check_memory()
return;
if (stat("/etc/fstab", &statBuf) == 0) {
+ /* swapon -a requires /proc typically */
+ waitfor("mount proc /proc -t proc", console, FALSE);
/* Try to turn on swap */
- system("/sbin/swapon -a");
+ waitfor("swapon -a", console, FALSE);
if (check_free_memory() < 1000)
goto goodnight;
} else
diff --git a/insmod.c b/insmod.c
index 7cbbed441..1ee96f1c8 100644
--- a/insmod.c
+++ b/insmod.c
@@ -2,7 +2,7 @@
/*
* Mini insmod implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/ln.c b/ln.c
index c54026c62..4be60624e 100644
--- a/ln.c
+++ b/ln.c
@@ -2,8 +2,7 @@
/*
* Mini ln implementation for busybox
*
- *
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/loadacm.c b/loadacm.c
index 072562f6b..66f79092c 100644
--- a/loadacm.c
+++ b/loadacm.c
@@ -353,8 +353,8 @@ void saveoldmap(int fd, char *omfil)
unicode utf8_to_ucs2(char *buf)
{
int utf_count = 0;
- long utf_char;
- unicode tc;
+ long utf_char = 0;
+ unicode tc = 0;
unsigned char c;
do {
diff --git a/logger.c b/logger.c
index a9e0afcc8..db6d9bfc5 100644
--- a/logger.c
+++ b/logger.c
@@ -2,7 +2,7 @@
/*
* Mini logger implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/lsmod.c b/lsmod.c
index 27fabc1fe..9b72275cd 100644
--- a/lsmod.c
+++ b/lsmod.c
@@ -2,7 +2,7 @@
/*
* Mini lsmod implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/miscutils/dutmp.c b/miscutils/dutmp.c
index 45eab8ae7..cf0d466ef 100644
--- a/miscutils/dutmp.c
+++ b/miscutils/dutmp.c
@@ -13,34 +13,35 @@
#include "internal.h"
#include <stdio.h>
+#include <errno.h>
#include <utmp.h>
+#define BB_DECLARE_EXTERN
+#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";
extern int dutmp_main(int argc, char **argv)
{
- FILE *f = stdin;
+ FILE *f;
struct utmp ut;
- if ((argc < 2) || (**(argv + 1) == '-')) {
+ if (argc<2) {
+ f = stdin;
+ } else if (*argv[1] == '-' ) {
usage(dutmp_usage);
- }
-
- if (**(++argv) == 0) {
- f = fopen(*(++argv), "r");
- if (f < 0) {
- perror(*argv);
- exit(FALSE);
+ } else {
+ f = fopen(argv[1], "r");
+ if (f == NULL) {
+ fatalError(io_error, argv[1], strerror(errno));
}
}
- while (fread(&ut, 1, sizeof(struct utmp), f)) {
- // printf("%d:%d:%s:%s:%s:%s:%d:%d:%ld:%ld:%ld:%x\n",
+ while (fread(&ut, sizeof(struct utmp), 1, f)) {
printf("%d|%d|%s|%s|%s|%s|%d|%d|%ld|%ld|%ld|%x\n",
ut.ut_type, ut.ut_pid, ut.ut_line,
ut.ut_id, ut.ut_user, ut.ut_host,
diff --git a/mkdir.c b/mkdir.c
index 70fdbdfb5..b0a2d57d6 100644
--- a/mkdir.c
+++ b/mkdir.c
@@ -2,8 +2,7 @@
/*
* Mini mkdir implementation for busybox
*
- *
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 7cbbed441..1ee96f1c8 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -2,7 +2,7 @@
/*
* Mini insmod implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/modutils/lsmod.c b/modutils/lsmod.c
index 27fabc1fe..9b72275cd 100644
--- a/modutils/lsmod.c
+++ b/modutils/lsmod.c
@@ -2,7 +2,7 @@
/*
* Mini lsmod implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/modutils/rmmod.c b/modutils/rmmod.c
index a0db4ae5c..d01725329 100644
--- a/modutils/rmmod.c
+++ b/modutils/rmmod.c
@@ -2,7 +2,7 @@
/*
* Mini rmmod implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/networking/nslookup.c b/networking/nslookup.c
index e2d8cea1f..15019e935 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -2,7 +2,6 @@
/*
* Mini nslookup implementation for busybox
*
- *
* Copyright (C) 2000 by Lineo, inc.
* Written by John Beppu <beppu@lineo.com>
*
@@ -174,4 +173,4 @@ int nslookup_main(int argc, char **argv)
return 0;
}
-/* $Id: nslookup.c,v 1.5 2000/02/18 21:34:17 erik Exp $ */
+/* $Id: nslookup.c,v 1.6 2000/04/13 01:18:56 erik Exp $ */
diff --git a/nslookup.c b/nslookup.c
index e2d8cea1f..15019e935 100644
--- a/nslookup.c
+++ b/nslookup.c
@@ -2,7 +2,6 @@
/*
* Mini nslookup implementation for busybox
*
- *
* Copyright (C) 2000 by Lineo, inc.
* Written by John Beppu <beppu@lineo.com>
*
@@ -174,4 +173,4 @@ int nslookup_main(int argc, char **argv)
return 0;
}
-/* $Id: nslookup.c,v 1.5 2000/02/18 21:34:17 erik Exp $ */
+/* $Id: nslookup.c,v 1.6 2000/04/13 01:18:56 erik Exp $ */
diff --git a/procps/free.c b/procps/free.c
index 78a36fe9a..39594dbe5 100644
--- a/procps/free.c
+++ b/procps/free.c
@@ -2,7 +2,7 @@
/*
* Mini free implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/procps/ps.c b/procps/ps.c
index f01cf99e4..1b3f4fb6c 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -2,7 +2,7 @@
/*
* Mini ps implementation(s) for busybox
*
- * Copyright (C) 1999 by Lineo, inc. Written by Erik Andersen
+ * Copyright (C) 1999,2000 by Lineo, inc. Written by Erik Andersen
* <andersen@lineo.com>, <andersee@debian.org>
*
*
diff --git a/procps/uptime.c b/procps/uptime.c
index 46797adb7..af54158c9 100644
--- a/procps/uptime.c
+++ b/procps/uptime.c
@@ -2,7 +2,7 @@
/*
* Mini uptime implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/ps.c b/ps.c
index f01cf99e4..1b3f4fb6c 100644
--- a/ps.c
+++ b/ps.c
@@ -2,7 +2,7 @@
/*
* Mini ps implementation(s) for busybox
*
- * Copyright (C) 1999 by Lineo, inc. Written by Erik Andersen
+ * Copyright (C) 1999,2000 by Lineo, inc. Written by Erik Andersen
* <andersen@lineo.com>, <andersee@debian.org>
*
*
diff --git a/rm.c b/rm.c
index 683bf8bdf..0cd795661 100644
--- a/rm.c
+++ b/rm.c
@@ -3,7 +3,7 @@
* Mini rm implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/rmdir.c b/rmdir.c
index f49569749..1d88de322 100644
--- a/rmdir.c
+++ b/rmdir.c
@@ -3,7 +3,7 @@
* Mini rmdir implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/rmmod.c b/rmmod.c
index a0db4ae5c..d01725329 100644
--- a/rmmod.c
+++ b/rmmod.c
@@ -2,7 +2,7 @@
/*
* Mini rmmod implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/sed.c b/sed.c
index 2beb2a588..0d57a4a06 100644
--- a/sed.c
+++ b/sed.c
@@ -3,7 +3,7 @@
* Mini sed implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
*
* Modifications for addresses and append command have been
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index 9800dd1c6..1434c36f6 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -1,10 +1,12 @@
/* vi: set sw=4 ts=4: */
/*
- * Termios command line History and Editting for NetBSD sh (ash)
+ * Termios command line History and Editting, originally
+ * intended for NetBSD sh (ash)
* Copyright (c) 1999
* Main code: Adam Rogoyski <rogoyski@cs.utexas.edu>
* Etc: Dave Cinege <dcinege@psychosis.com>
- * Adjusted for busybox: Erik Andersen <andersee@debian.org>
+ * Majorly adjusted/re-written for busybox:
+ * Erik Andersen <andersee@debian.org>
*
* You may use this code as you wish, so long as the original author(s)
* are attributed in any redistributions of the source code.
@@ -69,14 +71,15 @@ struct history {
void
cmdedit_setwidth(int w)
{
- if (w > 20) {
+ if (w > 20) {
cmdedit_termw = w;
cmdedit_scroll = w / 3;
- } else {
+ } else {
errorMsg("\n*** Error: minimum screen width is 21\n");
- }
+ }
}
+
void cmdedit_reset_term(void)
{
if (reset_term)
@@ -339,60 +342,7 @@ void get_next_history(struct history **hp, char* command)
free((*hp)->s);
(*hp)->s = strdup(command);
*hp = (*hp)->n;
-
- cmdedit_redraw( NULL, hp->s, -2, -2);
-}
-
-#if 0
-/* prompt : if !=NULL, print the prompt
- * command: the command line to be displayed
- * where : where to display changes from.
- * -1 for no change, -2 for new line
- * cursor : desired location for the cursor.
- * -1 for Beginning of line.
- * -2 for End of Line,
- */
-static void
-cmdedit_redraw(char* prompt, char* command, int where, int cursor)
-{
- static char* last_command;
- int cmdedit_width;
-
- if (where == -2) {
- /* Rewrite the prompt and clean up static variables */
- xwrite(outputFd, "\n", 1);
- if (prompt) {
- strcpy(last_command, prompt);
- xwrite(outputFd, prompt, strlen(prompt));
- } else {
- last_command[0] = '\0';
- xwrite(outputFd, "# ", 2);
- }
- cmdedit_width = cmdedit_termw - cmdedit_strlen(prompt);
- } else if (strcmp(command, last_command) != 0) {
- strcpy(last_command, prompt);
- }
-
- /* erase old command from command line */
- len = strlen(command)-strlen(last_command);
- while (len>0)
- input_backspace(command, outputFd, &cursor, &len);
- input_home(outputFd, &cursor);
-
- /* Rewrite the command */
- xwrite(outputFd, command+where, len);
-
- /* Put the where it is supposed to be */
- for (cursor=len; cursor > where; cursor--)
- xwrite(outputFd, "\b", 1);
-
- /* write new command */
- strcpy(command, hp->s);
- len = strlen(hp->s);
- xwrite(outputFd, command+where, len);
- cursor = len;
}
-#endif
/*
* This function is used to grab a character buffer
diff --git a/sort.c b/sort.c
index e6894f6c3..6ee6f207e 100644
--- a/sort.c
+++ b/sort.c
@@ -3,7 +3,7 @@
* Mini sort implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000 by Lineo, inc.
* Written by John Beppu <beppu@lineo.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -320,4 +320,4 @@ int sort_main(int argc, char **argv)
exit(0);
}
-/* $Id: sort.c,v 1.12 2000/03/04 21:19:32 erik Exp $ */
+/* $Id: sort.c,v 1.13 2000/04/13 01:18:56 erik Exp $ */
diff --git a/swaponoff.c b/swaponoff.c
index dca401966..aa961dac9 100644
--- a/swaponoff.c
+++ b/swaponoff.c
@@ -3,7 +3,7 @@
* Mini swapon/swapoff implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/sysklogd/logger.c b/sysklogd/logger.c
index a9e0afcc8..db6d9bfc5 100644
--- a/sysklogd/logger.c
+++ b/sysklogd/logger.c
@@ -2,7 +2,7 @@
/*
* Mini logger implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 5d6d2a0dd..357fa6d5e 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -2,7 +2,7 @@
/*
* Mini syslogd implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
@@ -37,6 +37,7 @@
#include <sys/un.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#define ksyslog klogctl
extern int ksyslog(int type, char *buf, int len);
diff --git a/syslogd.c b/syslogd.c
index 5d6d2a0dd..357fa6d5e 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -2,7 +2,7 @@
/*
* Mini syslogd implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
@@ -37,6 +37,7 @@
#include <sys/un.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#define ksyslog klogctl
extern int ksyslog(int type, char *buf, int len);
diff --git a/tar.c b/tar.c
index 732f26ddc..4eda4c61a 100644
--- a/tar.c
+++ b/tar.c
@@ -2,9 +2,9 @@
/*
* Mini tar implementation for busybox
*
- * Note, that as of BusyBox 0.43 tar has been completely rewritten from the
- * ground up. It still has remnents of the old code lying about, but it pretty
- * different (i.e. cleaner, less global variables, etc)
+ * Note, that as of BusyBox-0.43, tar has been completely rewritten from the
+ * ground up. It still has remnents of the old code lying about, but it is
+ * very different now (i.e. cleaner, less global variables, etc)
*
* Copyright (C) 2000 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
diff --git a/tee.c b/tee.c
index 018fe117b..95b75edd7 100644
--- a/tee.c
+++ b/tee.c
@@ -3,7 +3,7 @@
* Mini tee implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000 by Lineo, inc.
* Written by John Beppu <beppu@lineo.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -131,4 +131,4 @@ int tee_main(int argc, char **argv)
exit(0);
}
-/* $Id: tee.c,v 1.8 2000/03/23 01:09:18 erik Exp $ */
+/* $Id: tee.c,v 1.9 2000/04/13 01:18:56 erik Exp $ */
diff --git a/touch.c b/touch.c
index a0f21acdd..f8972dcf6 100644
--- a/touch.c
+++ b/touch.c
@@ -3,7 +3,7 @@
* Mini touch implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/true_false.c b/true_false.c
index 7829673e0..5ae221b3a 100644
--- a/true_false.c
+++ b/true_false.c
@@ -3,7 +3,7 @@
* Mini true/false implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/umount.c b/umount.c
index 3f84aa296..92eb0a61a 100644
--- a/umount.c
+++ b/umount.c
@@ -3,7 +3,7 @@
* Mini umount implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/uniq.c b/uniq.c
index 1e41eaacd..2eedb886d 100644
--- a/uniq.c
+++ b/uniq.c
@@ -3,7 +3,7 @@
* Mini uniq implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000 by Lineo, inc.
* Written by John Beppu <beppu@lineo.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -190,4 +190,4 @@ int uniq_main(int argc, char **argv)
exit(0);
}
-/* $Id: uniq.c,v 1.7 2000/02/08 19:58:47 erik Exp $ */
+/* $Id: uniq.c,v 1.8 2000/04/13 01:18:56 erik Exp $ */
diff --git a/uptime.c b/uptime.c
index 46797adb7..af54158c9 100644
--- a/uptime.c
+++ b/uptime.c
@@ -2,7 +2,7 @@
/*
* Mini uptime implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index 7ca41733b..1f471dada 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -228,10 +228,11 @@ static void fbset_usage(void)
fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n",
BB_VER, BB_BT);
#endif
- fprintf(stderr, "Usage: fbset [options] [mode]\n");
- fprintf(stderr, "\tThe following options are recognized:\n");
+ fprintf(stderr, "Usage: fbset [options] [mode]\n\n");
+ fprintf(stderr, "Show and modify frame buffer device settings\n\n");
+ fprintf(stderr, "The following options are recognized:\n");
for (i = 0; g_cmdoptions[i].name; i++)
- fprintf(stderr, "\t\t%s\n", g_cmdoptions[i].name);
+ fprintf(stderr, "\t%s\n", g_cmdoptions[i].name);
exit(-1);
}
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
index dca401966..aa961dac9 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -3,7 +3,7 @@
* Mini swapon/swapoff implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 3f84aa296..92eb0a61a 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -3,7 +3,7 @@
* Mini umount implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,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