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-w32-61677feff7f549a48267c2c0c50a7420de6e2599.tar.gz
busybox-w32-61677feff7f549a48267c2c0c50a7420de6e2599.tar.bz2
busybox-w32-61677feff7f549a48267c2c0c50a7420de6e2599.zip
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 @@
1List of the authors of code contained in busybox. 1List of the authors of code contained in BusyBox.
2 2
3If you should be listed here, or the description of 3If you have code in BusyBox, you should be listed here. If you should be
4what you have done needs more detail, or is incorect, 4listed, or the description of what you have done needs more detail, or is
5_please_ let me know. 5incorect, _please_ let me know.
6 6
7 -Erik 7 -Erik
8 8
@@ -16,7 +16,7 @@ Bruce Perens <bruce@pixar.com>
16 Original author of BusyBox. His code is still in many apps. 16 Original author of BusyBox. His code is still in many apps.
17 17
18John Beppu <beppu@lineo.com> 18John Beppu <beppu@lineo.com>
19 du, head, tee 19 du, head, nslookup, sort, tee, uniq
20 20
21Brian Candler <B.Candler@pobox.com> 21Brian Candler <B.Candler@pobox.com>
22 tiny-ls(ls) 22 tiny-ls(ls)
diff --git a/Changelog b/Changelog
index 4a9fb6fc0..4227a7822 100644
--- a/Changelog
+++ b/Changelog
@@ -59,7 +59,7 @@
59 the common error handling saves a few bytes. Thanks to 59 the common error handling saves a few bytes. Thanks to
60 Bob Tinsley <bob@earthrise.demon.co.uk> for the patch. 60 Bob Tinsley <bob@earthrise.demon.co.uk> for the patch.
61 * Fix "+" parsing bug in date, from "Merle F. McClelland" <mfm@cts.com>. 61 * Fix "+" parsing bug in date, from "Merle F. McClelland" <mfm@cts.com>.
62 62 * BusyBox's bss size has been majorly reduced (was 384668, is now 28740).
63 63
64 64
65 -Erik Andersen 65 -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.
7Busybox was begun to support the Debian Rescue/Install disks, but it 7Busybox was begun to support the Debian Rescue/Install disks, but it
8also makes an excellent environment for any small or embedded system. 8also makes an excellent environment for any small or embedded system.
9 9
10As of version 0.20 there is a version number. : ) Also as of version 10As of version 0.20 there is a version number. : ) Also as of version 0.20, BB
110.20, BB is now modularized to easily allow you to build of only the 11is now modularized to easily allow you to build only the BB parts you need,
12BB parts you need, thereby reducing binary size. To turn off unwanted 12thereby reducing binary size. To turn off unwanted Busybox components, simply
13Busybox components, simply edit the file busybox.def.h and comment out 13edit the file busybox.def.h and comment out the parts you do not need using C++
14the parts you do not need using C++ style (//) comments. 14style (//) comments.
15 15
16After the build is complete a busybox.links file is generated which is 16After the build is complete a busybox.links file is generated which is
17then used by 'make install' to create symlinks to the busybox binary 17then used by 'make install' to create symlinks to the busybox binary
18for all compiled in functions. By default, 'make install' will place 18for all compiled in functions. By default, 'make install' will place
19the symlink forest into `pwd`/_install unless you have defined the 19the symlink forest into `pwd`/_install unless you have defined the
20PREFIX environment variable. 20PREFIX environment variable (i.e. make PREFIX="/tmp/foo" install)
21 21
22Please feed suggestions, bug reports, insults, and bribes back to: 22Please feed suggestions, bug reports, insults, and bribes back to:
23 Erik Andersen 23 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[] = {
234 {"sh", shell_main, _BB_DIR_BIN}, 234 {"sh", shell_main, _BB_DIR_BIN},
235#endif 235#endif
236#ifdef BB_SFDISK 236#ifdef BB_SFDISK
237 {"fdisk", sfdisk_main, _BB_DIR_SBIN},
238#ifdef BB_SFDISK
239#endif
240 {"sfdisk", sfdisk_main, _BB_DIR_SBIN}, 237 {"sfdisk", sfdisk_main, _BB_DIR_SBIN},
241#endif 238#endif
242#ifdef BB_SLEEP 239#ifdef BB_SLEEP
@@ -382,8 +379,9 @@ int busybox_main(int argc, char **argv)
382 fprintf(stderr, "Usage: busybox [function] [arguments]...\n"); 379 fprintf(stderr, "Usage: busybox [function] [arguments]...\n");
383 fprintf(stderr, " or: [function] [arguments]...\n\n"); 380 fprintf(stderr, " or: [function] [arguments]...\n\n");
384 fprintf(stderr, 381 fprintf(stderr,
385 "\tMost people will create a link to busybox for each function\n" 382 "\tBusyBox is a multi-call binary that combines many common Unix utilities into a\n"
386 "\tname, and busybox will act like whatever you invoke it as.\n"); 383 "\tsingle executable. Most people will create a link to busybox for each function\n"
384 "\tthey wish to use, and BusyBox will act like whatever it was invoked as.\n");
387 fprintf(stderr, "\nCurrently defined functions:\n"); 385 fprintf(stderr, "\nCurrently defined functions:\n");
388 386
389 while (a->name != 0) { 387 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 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* zcat : stripped version based on gzip sources 2/*
3 Sven Rudolph <sr1@inf.tu-dresden.de> 3 * Gzip implementation for busybox
4 */ 4 *
5 * Based on GNU gzip Copyright (C) 1992-1993 Jean-loup Gailly.
6 *
7 * Originally adjusted for busybox by Sven Rudolph <sr1@inf.tu-dresden.de>
8 * based on gzip sources
9 *
10 * Adjusted further by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
11 * to support files as well as stdin/stdout, and to generally behave itself wrt
12 * command line handling.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 *
28 */
5 29
6#include "internal.h" 30#include "internal.h"
7#define bb_need_name_too_long
8#define BB_DECLARE_EXTERN
9#include "messages.c"
10
11static const char gunzip_usage[] = 31static const char gunzip_usage[] =
12 "gunzip [OPTION]... FILE\n\n" 32 "gunzip [OPTION]... FILE\n\n"
13 "Uncompress FILE (or standard input if FILE is '-').\n\n" 33 "Uncompress FILE (or standard input if FILE is '-').\n\n"
@@ -16,6 +36,18 @@ static const char gunzip_usage[] =
16 "\t-c\tWrite output to standard output\n" 36 "\t-c\tWrite output to standard output\n"
17 "\t-t\tTest compressed file integrity\n"; 37 "\t-t\tTest compressed file integrity\n";
18 38
39
40 /* These defines are very important for BusyBox. Without these,
41 * huge chunks of ram are pre-allocated making the BusyBox bss
42 * size Freaking Huge(tm), which is a bad thing.*/
43#define SMALL_MEM
44#define DYN_ALLOC
45
46#define bb_need_name_too_long
47#define BB_DECLARE_EXTERN
48#include "messages.c"
49
50
19/* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface 51/* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
20 * Copyright (C) 1992-1993 Jean-loup Gailly 52 * Copyright (C) 1992-1993 Jean-loup Gailly
21 * The unzip code was written and put in the public domain by Mark Adler. 53 * The unzip code was written and put in the public domain by Mark Adler.
@@ -89,25 +121,6 @@ static char *license_msg[] = {
89#define get_char() get_byte() 121#define get_char() get_byte()
90#define put_char(c) put_byte(c) 122#define put_char(c) put_byte(c)
91 123
92/* #include "gzip.h" */
93
94/* gzip.h -- common declarations for all gzip modules
95 * Copyright (C) 1992-1993 Jean-loup Gailly.
96 * This is free software; you can redistribute it and/or modify it under the
97 * terms of the GNU General Public License, see the file COPYING.
98 */
99
100#if defined(__STDC__) || defined(PROTO)
101# define OF(args) args
102#else
103# define OF(args) ()
104#endif
105
106#ifdef __STDC__
107typedef void *voidp;
108#else
109typedef char *voidp;
110#endif
111 124
112/* I don't like nested includes, but the string and io functions are used 125/* I don't like nested includes, but the string and io functions are used
113 * too often 126 * too often
@@ -118,7 +131,7 @@ typedef char *voidp;
118# if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__) 131# if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__)
119# include <memory.h> 132# include <memory.h>
120# endif 133# endif
121# define memzero(s, n) memset ((voidp)(s), 0, (n)) 134# define memzero(s, n) memset ((void *)(s), 0, (n))
122#else 135#else
123# include <strings.h> 136# include <strings.h>
124# define strchr index 137# define strchr index
@@ -329,49 +342,46 @@ extern int save_orig_name; /* set if original name must be saved */
329#define WARN(msg) {fprintf msg ; \ 342#define WARN(msg) {fprintf msg ; \
330 if (exit_code == OK) exit_code = WARNING;} 343 if (exit_code == OK) exit_code = WARNING;}
331 344
332#define do_exit(c) exit(c)
333
334
335 /* in unzip.c */ 345 /* in unzip.c */
336extern int unzip OF((int in, int out)); 346extern int unzip (int in, int out);
337 347
338 /* in gzip.c */ 348 /* in gzip.c */
339RETSIGTYPE abort_gzip OF((void)); 349RETSIGTYPE abort_gzip (void);
340 350
341 /* in deflate.c */ 351 /* in deflate.c */
342void lm_init OF((int pack_level, ush * flags)); 352void lm_init (int pack_level, ush * flags);
343ulg deflate OF((void)); 353ulg deflate (void);
344 354
345 /* in trees.c */ 355 /* in trees.c */
346void ct_init OF((ush * attr, int *method)); 356void ct_init (ush * attr, int *method);
347int ct_tally OF((int dist, int lc)); 357int ct_tally (int dist, int lc);
348ulg flush_block OF((char *buf, ulg stored_len, int eof)); 358ulg flush_block (char *buf, ulg stored_len, int eof);
349 359
350 /* in bits.c */ 360 /* in bits.c */
351void bi_init OF((file_t zipfile)); 361void bi_init (file_t zipfile);
352void send_bits OF((int value, int length)); 362void send_bits (int value, int length);
353unsigned bi_reverse OF((unsigned value, int length)); 363unsigned bi_reverse (unsigned value, int length);
354void bi_windup OF((void)); 364void bi_windup (void);
355void copy_block OF((char *buf, unsigned len, int header)); 365void copy_block (char *buf, unsigned len, int header);
356extern int (*read_buf) OF((char *buf, unsigned size)); 366extern int (*read_buf) (char *buf, unsigned size);
357 367
358 /* in util.c: */ 368 /* in util.c: */
359extern int copy OF((int in, int out)); 369extern int copy (int in, int out);
360extern ulg updcrc OF((uch * s, unsigned n)); 370extern ulg updcrc (uch * s, unsigned n);
361extern void clear_bufs OF((void)); 371extern void clear_bufs (void);
362extern int fill_inbuf OF((int eof_ok)); 372extern int fill_inbuf (int eof_ok);
363extern void flush_outbuf OF((void)); 373extern void flush_outbuf (void);
364extern void flush_window OF((void)); 374extern void flush_window (void);
365extern void write_buf OF((int fd, voidp buf, unsigned cnt)); 375extern void write_buf (int fd, void * buf, unsigned cnt);
366 376
367#ifndef __linux__ 377#ifndef __linux__
368extern char *basename OF((char *fname)); 378extern char *basename (char *fname);
369#endif /* not __linux__ */ 379#endif /* not __linux__ */
370extern void read_error OF((void)); 380extern void read_error (void);
371extern void write_error OF((void)); 381extern void write_error (void);
372 382
373 /* in inflate.c */ 383 /* in inflate.c */
374extern int inflate OF((void)); 384extern int inflate (void);
375 385
376/* #include "lzw.h" */ 386/* #include "lzw.h" */
377 387
@@ -415,8 +425,8 @@ extern int inflate OF((void));
415extern int maxbits; /* max bits per code for LZW */ 425extern int maxbits; /* max bits per code for LZW */
416extern int block_mode; /* block compress mode -C compatible with 2.0 */ 426extern int block_mode; /* block compress mode -C compatible with 2.0 */
417 427
418extern int lzw OF((int in, int out)); 428extern int lzw (int in, int out);
419extern int unlzw OF((int in, int out)); 429extern int unlzw (int in, int out);
420 430
421 431
422/* #include "revision.h" */ 432/* #include "revision.h" */
@@ -605,7 +615,7 @@ typedef struct direct dir_type;
605#if !defined(S_ISREG) && defined(S_IFREG) 615#if !defined(S_ISREG) && defined(S_IFREG)
606# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 616# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
607#endif 617#endif
608typedef RETSIGTYPE(*sig_type) OF((int)); 618typedef RETSIGTYPE(*sig_type) (int);
609 619
610#ifndef O_BINARY 620#ifndef O_BINARY
611# define O_BINARY 0 /* creation mode for open() */ 621# define O_BINARY 0 /* creation mode for open() */
@@ -644,7 +654,7 @@ typedef RETSIGTYPE(*sig_type) OF((int));
644 654
645#ifdef NO_OFF_T 655#ifdef NO_OFF_T
646typedef long off_t; 656typedef long off_t;
647off_t lseek OF((int fd, off_t offset, int whence)); 657off_t lseek (int fd, off_t offset, int whence);
648#endif 658#endif
649 659
650 660
@@ -687,7 +697,7 @@ long header_bytes; /* number of bytes in gzip header */
687 697
688/* local functions */ 698/* local functions */
689 699
690local int get_method OF((int in)); 700local int get_method (int in);
691 701
692#define strequ(s1, s2) (strcmp((s1),(s2)) == 0) 702#define strequ(s1, s2) (strcmp((s1),(s2)) == 0)
693 703
@@ -773,7 +783,7 @@ int gunzip_main(int argc, char **argv)
773 usage(gunzip_usage); 783 usage(gunzip_usage);
774 if (strlen(*argv) > MAX_PATH_LEN) { 784 if (strlen(*argv) > MAX_PATH_LEN) {
775 fprintf(stderr, name_too_long, "gunzip"); 785 fprintf(stderr, name_too_long, "gunzip");
776 do_exit(WARNING); 786 exit(WARNING);
777 } 787 }
778 strcpy(ifname, *argv); 788 strcpy(ifname, *argv);
779 789
@@ -781,13 +791,13 @@ int gunzip_main(int argc, char **argv)
781 inFileNum = open(ifname, O_RDONLY); 791 inFileNum = open(ifname, O_RDONLY);
782 if (inFileNum < 0) { 792 if (inFileNum < 0) {
783 perror(ifname); 793 perror(ifname);
784 do_exit(WARNING); 794 exit(WARNING);
785 } 795 }
786 /* Get the time stamp on the input file. */ 796 /* Get the time stamp on the input file. */
787 result = stat(ifname, &statBuf); 797 result = stat(ifname, &statBuf);
788 if (result < 0) { 798 if (result < 0) {
789 perror(ifname); 799 perror(ifname);
790 do_exit(WARNING); 800 exit(WARNING);
791 } 801 }
792 ifile_size = statBuf.st_size; 802 ifile_size = statBuf.st_size;
793 } 803 }
@@ -812,7 +822,7 @@ int gunzip_main(int argc, char **argv)
812 /* And get to work */ 822 /* And get to work */
813 if (strlen(ifname) > MAX_PATH_LEN - 4) { 823 if (strlen(ifname) > MAX_PATH_LEN - 4) {
814 fprintf(stderr, name_too_long, "gunzip"); 824 fprintf(stderr, name_too_long, "gunzip");
815 do_exit(WARNING); 825 exit(WARNING);
816 } 826 }
817 strcpy(ofname, ifname); 827 strcpy(ofname, ifname);
818 pos = strstr(ofname, ".gz"); 828 pos = strstr(ofname, ".gz");
@@ -836,7 +846,7 @@ int gunzip_main(int argc, char **argv)
836#endif 846#endif
837 if (outFileNum < 0) { 847 if (outFileNum < 0) {
838 perror(ofname); 848 perror(ofname);
839 do_exit(WARNING); 849 exit(WARNING);
840 } 850 }
841 /* Set permissions on the file */ 851 /* Set permissions on the file */
842 fchmod(outFileNum, statBuf.st_mode); 852 fchmod(outFileNum, statBuf.st_mode);
@@ -860,7 +870,7 @@ int gunzip_main(int argc, char **argv)
860 exit(FALSE); 870 exit(FALSE);
861 } 871 }
862 } 872 }
863 do_exit(exit_code); 873 exit(exit_code);
864} 874}
865 875
866 876
@@ -953,7 +963,7 @@ int in; /* input file descriptor */
953 */ 963 */
954RETSIGTYPE abort_gzip() 964RETSIGTYPE abort_gzip()
955{ 965{
956 do_exit(ERROR); 966 exit(ERROR);
957} 967}
958 968
959/* unzip.c -- decompress files in gzip or pkzip format. 969/* unzip.c -- decompress files in gzip or pkzip format.
@@ -1027,7 +1037,7 @@ int in, out; /* input and output file descriptors */
1027 ofd = out; 1037 ofd = out;
1028 method = get_method(ifd); 1038 method = get_method(ifd);
1029 if (method < 0) { 1039 if (method < 0) {
1030 do_exit(exit_code); /* error message already emitted */ 1040 exit(exit_code); /* error message already emitted */
1031 } 1041 }
1032 1042
1033 updcrc(NULL, 0); /* initialize crc */ 1043 updcrc(NULL, 0); /* initialize crc */
@@ -1218,7 +1228,7 @@ void flush_window()
1218 */ 1228 */
1219void write_buf(fd, buf, cnt) 1229void write_buf(fd, buf, cnt)
1220int fd; 1230int fd;
1221voidp buf; 1231void * buf;
1222unsigned cnt; 1232unsigned cnt;
1223{ 1233{
1224 unsigned n; 1234 unsigned n;
@@ -1228,7 +1238,7 @@ unsigned cnt;
1228 write_error(); 1238 write_error();
1229 } 1239 }
1230 cnt -= n; 1240 cnt -= n;
1231 buf = (voidp) ((char *) buf + n); 1241 buf = (void *) ((char *) buf + n);
1232 } 1242 }
1233} 1243}
1234 1244
@@ -1240,8 +1250,8 @@ unsigned cnt;
1240# define const 1250# define const
1241# endif 1251# endif
1242 1252
1243int strspn OF((const char *s, const char *accept)); 1253int strspn (const char *s, const char *accept);
1244int strcspn OF((const char *s, const char *reject)); 1254int strcspn (const char *s, const char *reject);
1245 1255
1246/* ======================================================================== 1256/* ========================================================================
1247 * Return the length of the maximum initial segment 1257 * Return the length of the maximum initial segment
@@ -1493,15 +1503,15 @@ struct huft {
1493 1503
1494 1504
1495/* Function prototypes */ 1505/* Function prototypes */
1496int huft_build OF((unsigned *, unsigned, unsigned, ush *, ush *, 1506int huft_build (unsigned *, unsigned, unsigned, ush *, ush *,
1497 struct huft **, int *)); 1507 struct huft **, int *);
1498int huft_free OF((struct huft *)); 1508int huft_free (struct huft *);
1499int inflate_codes OF((struct huft *, struct huft *, int, int)); 1509int inflate_codes (struct huft *, struct huft *, int, int);
1500int inflate_stored OF((void)); 1510int inflate_stored (void);
1501int inflate_fixed OF((void)); 1511int inflate_fixed (void);
1502int inflate_dynamic OF((void)); 1512int inflate_dynamic (void);
1503int inflate_block OF((int *)); 1513int inflate_block (int *);
1504int inflate OF((void)); 1514int inflate (void);
1505 1515
1506 1516
1507/* The inflate algorithm uses a sliding 32K byte window on the uncompressed 1517/* 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 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* gzip.c -- this is a stripped down version of gzip I put into busybox, it does 2/*
3 * only standard in to standard out with -9 compression. It also requires the 3 * Gzip implementation for busybox
4 * zcat module for some important functions. 4 *
5 * Based on GNU gzip Copyright (C) 1992-1993 Jean-loup Gailly.
6 *
7 * Originally adjusted for busybox by Charles P. Wright <cpw@unix.asb.com>
8 * "this is a stripped down version of gzip I put into busybox, it does
9 * only standard in to standard out with -9 compression. It also requires
10 * the zcat module for some important functions."
11 *
12 * Adjusted further by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
13 * to support files as well as stdin/stdout, and to generally behave itself wrt
14 * command line handling.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5 * 29 *
6 * Charles P. Wright <cpw@unix.asb.com>
7 */ 30 */
31
8#include "internal.h" 32#include "internal.h"
9#ifdef BB_GZIP
10 33
11//#ifndef BB_ZCAT 34/* These defines are very important for BusyBox. Without these,
12//#error you need zcat to have gzip support! 35 * huge chunks of ram are pre-allocated making the BusyBox bss
13//#endif 36 * size Freaking Huge(tm), which is a bad thing.*/
37#define SMALL_MEM
38#define DYN_ALLOC
39
14 40
15static const char gzip_usage[] = 41static const char gzip_usage[] =
16 "gzip [OPTION]... FILE\n\n" 42 "gzip [OPTION]... FILE\n\n"
@@ -21,42 +47,12 @@ static const char gzip_usage[] =
21 "\t-c\tWrite output to standard output instead of FILE.gz\n"; 47 "\t-c\tWrite output to standard output instead of FILE.gz\n";
22 48
23 49
24/* gzip.h -- common declarations for all gzip modules
25 * Copyright (C) 1992-1993 Jean-loup Gailly.
26 * This is free software; you can redistribute it and/or modify it under the
27 * terms of the GNU General Public License, see the file COPYING.
28 */
29
30#if defined(__STDC__) || defined(PROTO)
31# define OF(args) args
32#else
33# define OF(args) ()
34#endif
35
36#ifdef __STDC__
37typedef void *voidp;
38#else
39typedef char *voidp;
40#endif
41
42/* I don't like nested includes, but the string and io functions are used 50/* I don't like nested includes, but the string and io functions are used
43 * too often 51 * too often
44 */ 52 */
45#include <stdio.h> 53#include <stdio.h>
46#if !defined(NO_STRING_H) || defined(STDC_HEADERS) 54#include <string.h>
47# include <string.h> 55#define memzero(s, n) memset ((void *)(s), 0, (n))
48# if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__)
49# include <memory.h>
50# endif
51# define memzero(s, n) memset ((voidp)(s), 0, (n))
52#else
53# include <strings.h>
54# define strchr index
55# define strrchr rindex
56# define memcpy(d, s, n) bcopy((s), (d), (n))
57# define memcmp(s1, s2, n) bcmp((s1), (s2), (n))
58# define memzero(s, n) bzero((s), (n))
59#endif
60 56
61#ifndef RETSIGTYPE 57#ifndef RETSIGTYPE
62# define RETSIGTYPE void 58# define RETSIGTYPE void
@@ -121,13 +117,13 @@ extern int method; /* compression method */
121#endif 117#endif
122 118
123#ifdef DYN_ALLOC 119#ifdef DYN_ALLOC
124# define EXTERN(type, array) extern type * near array 120# define EXTERN(type, array) extern type * array
125# define DECLARE(type, array, size) type * near array 121# define DECLARE(type, array, size) type * array
126# define ALLOC(type, array, size) { \ 122# define ALLOC(type, array, size) { \
127 array = (type*)fcalloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ 123 array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
128 if (array == NULL) errorMsg("insufficient memory"); \ 124 if (array == NULL) errorMsg("insufficient memory"); \
129 } 125 }
130# define FREE(array) {if (array != NULL) fcfree(array), array=NULL;} 126# define FREE(array) {if (array != NULL) free(array), array=NULL;}
131#else 127#else
132# define EXTERN(type, array) extern type array[] 128# define EXTERN(type, array) extern type array[]
133# define DECLARE(type, array, size) type array[size] 129# define DECLARE(type, array, size) type array[size]
@@ -284,55 +280,55 @@ extern int save_orig_name; /* set if original name must be saved */
284 280
285 281
286 /* in zip.c: */ 282 /* in zip.c: */
287extern int zip OF((int in, int out)); 283extern int zip (int in, int out);
288extern int file_read OF((char *buf, unsigned size)); 284extern int file_read (char *buf, unsigned size);
289 285
290 /* in unzip.c */ 286 /* in unzip.c */
291extern int unzip OF((int in, int out)); 287extern int unzip (int in, int out);
292extern int check_zipfile OF((int in)); 288extern int check_zipfile (int in);
293 289
294 /* in unpack.c */ 290 /* in unpack.c */
295extern int unpack OF((int in, int out)); 291extern int unpack (int in, int out);
296 292
297 /* in unlzh.c */ 293 /* in unlzh.c */
298extern int unlzh OF((int in, int out)); 294extern int unlzh (int in, int out);
299 295
300 /* in gzip.c */ 296 /* in gzip.c */
301RETSIGTYPE abort_gzip OF((void)); 297RETSIGTYPE abort_gzip (void);
302 298
303 /* in deflate.c */ 299 /* in deflate.c */
304void lm_init OF((ush * flags)); 300void lm_init (ush * flags);
305ulg deflate OF((void)); 301ulg deflate (void);
306 302
307 /* in trees.c */ 303 /* in trees.c */
308void ct_init OF((ush * attr, int *method)); 304void ct_init (ush * attr, int *method);
309int ct_tally OF((int dist, int lc)); 305int ct_tally (int dist, int lc);
310ulg flush_block OF((char *buf, ulg stored_len, int eof)); 306ulg flush_block (char *buf, ulg stored_len, int eof);
311 307
312 /* in bits.c */ 308 /* in bits.c */
313void bi_init OF((file_t zipfile)); 309void bi_init (file_t zipfile);
314void send_bits OF((int value, int length)); 310void send_bits (int value, int length);
315unsigned bi_reverse OF((unsigned value, int length)); 311unsigned bi_reverse (unsigned value, int length);
316void bi_windup OF((void)); 312void bi_windup (void);
317void copy_block OF((char *buf, unsigned len, int header)); 313void copy_block (char *buf, unsigned len, int header);
318extern int (*read_buf) OF((char *buf, unsigned size)); 314extern int (*read_buf) (char *buf, unsigned size);
319 315
320 /* in util.c: */ 316 /* in util.c: */
321extern int copy OF((int in, int out)); 317extern int copy (int in, int out);
322extern ulg updcrc OF((uch * s, unsigned n)); 318extern ulg updcrc (uch * s, unsigned n);
323extern void clear_bufs OF((void)); 319extern void clear_bufs (void);
324extern int fill_inbuf OF((int eof_ok)); 320extern int fill_inbuf (int eof_ok);
325extern void flush_outbuf OF((void)); 321extern void flush_outbuf (void);
326extern void flush_window OF((void)); 322extern void flush_window (void);
327extern void write_buf OF((int fd, voidp buf, unsigned cnt)); 323extern void write_buf (int fd, void * buf, unsigned cnt);
328extern char *strlwr OF((char *s)); 324extern char *strlwr (char *s);
329extern char *add_envopt OF((int *argcp, char ***argvp, char *env)); 325extern char *add_envopt (int *argcp, char ***argvp, char *env);
330extern void read_error OF((void)); 326extern void read_error (void);
331extern void write_error OF((void)); 327extern void write_error (void);
332extern void display_ratio OF((long num, long den, FILE * file)); 328extern void display_ratio (long num, long den, FILE * file);
333 329
334 /* in inflate.c */ 330 /* in inflate.c */
335extern int inflate OF((void)); 331extern int inflate (void);
336 332
337/* lzw.h -- define the lzw functions. 333/* lzw.h -- define the lzw functions.
338 * Copyright (C) 1992-1993 Jean-loup Gailly. 334 * Copyright (C) 1992-1993 Jean-loup Gailly.
@@ -795,7 +791,7 @@ local int bi_valid;
795 * are always zero. 791 * are always zero.
796 */ 792 */
797 793
798int (*read_buf) OF((char *buf, unsigned size)); 794int (*read_buf) (char *buf, unsigned size);
799 795
800/* Current input function. Set to mem_read for in-memory compression */ 796/* Current input function. Set to mem_read for in-memory compression */
801 797
@@ -1148,16 +1144,16 @@ local config configuration_table =
1148/* =========================================================================== 1144/* ===========================================================================
1149 * Prototypes for local functions. 1145 * Prototypes for local functions.
1150 */ 1146 */
1151local void fill_window OF((void)); 1147local void fill_window (void);
1152 1148
1153int longest_match OF((IPos cur_match)); 1149int longest_match (IPos cur_match);
1154 1150
1155#ifdef ASMV 1151#ifdef ASMV
1156void match_init OF((void)); /* asm code initialization */ 1152void match_init (void); /* asm code initialization */
1157#endif 1153#endif
1158 1154
1159#ifdef DEBUG 1155#ifdef DEBUG
1160local void check_match OF((IPos start, IPos match, int length)); 1156local void check_match (IPos start, IPos match, int length);
1161#endif 1157#endif
1162 1158
1163/* =========================================================================== 1159/* ===========================================================================
@@ -1708,7 +1704,7 @@ struct utimbuf {
1708# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 1704# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
1709#endif 1705#endif
1710 1706
1711typedef RETSIGTYPE(*sig_type) OF((int)); 1707typedef RETSIGTYPE(*sig_type) (int);
1712 1708
1713#ifndef O_BINARY 1709#ifndef O_BINARY
1714# define O_BINARY 0 /* creation mode for open() */ 1710# define O_BINARY 0 /* creation mode for open() */
@@ -1743,7 +1739,7 @@ typedef RETSIGTYPE(*sig_type) OF((int));
1743 1739
1744#ifdef NO_OFF_T 1740#ifdef NO_OFF_T
1745typedef long off_t; 1741typedef long off_t;
1746off_t lseek OF((int fd, off_t offset, int whence)); 1742off_t lseek (int fd, off_t offset, int whence);
1747#endif 1743#endif
1748 1744
1749/* Separator for file name parts (see shorten_name()) */ 1745/* Separator for file name parts (see shorten_name()) */
@@ -2246,17 +2242,17 @@ extern unsigned near strstart; /* window offset of current string */
2246 * Local (static) routines in this file. 2242 * Local (static) routines in this file.
2247 */ 2243 */
2248 2244
2249local void init_block OF((void)); 2245local void init_block (void);
2250local void pqdownheap OF((ct_data near * tree, int k)); 2246local void pqdownheap (ct_data near * tree, int k);
2251local void gen_bitlen OF((tree_desc near * desc)); 2247local void gen_bitlen (tree_desc near * desc);
2252local void gen_codes OF((ct_data near * tree, int max_code)); 2248local void gen_codes (ct_data near * tree, int max_code);
2253local void build_tree OF((tree_desc near * desc)); 2249local void build_tree (tree_desc near * desc);
2254local void scan_tree OF((ct_data near * tree, int max_code)); 2250local void scan_tree (ct_data near * tree, int max_code);
2255local void send_tree OF((ct_data near * tree, int max_code)); 2251local void send_tree (ct_data near * tree, int max_code);
2256local int build_bl_tree OF((void)); 2252local int build_bl_tree (void);
2257local void send_all_trees OF((int lcodes, int dcodes, int blcodes)); 2253local void send_all_trees (int lcodes, int dcodes, int blcodes);
2258local void compress_block OF((ct_data near * ltree, ct_data near * dtree)); 2254local void compress_block (ct_data near * ltree, ct_data near * dtree);
2259local void set_file_type OF((void)); 2255local void set_file_type (void);
2260 2256
2261 2257
2262#ifndef DEBUG 2258#ifndef DEBUG
@@ -3161,12 +3157,8 @@ char *s;
3161 3157
3162/* Provide missing strspn and strcspn functions. */ 3158/* Provide missing strspn and strcspn functions. */
3163 3159
3164# ifndef __STDC__ 3160int strspn (const char *s, const char *accept);
3165# define const 3161int strcspn (const char *s, const char *reject);
3166# endif
3167
3168int strspn OF((const char *s, const char *accept));
3169int strcspn OF((const char *s, const char *reject));
3170 3162
3171/* ======================================================================== 3163/* ========================================================================
3172 * Return the length of the maximum initial segment 3164 * Return the length of the maximum initial segment
@@ -3398,4 +3390,3 @@ unsigned size;
3398 isize += (ulg) len; 3390 isize += (ulg) len;
3399 return (int) len; 3391 return (int) len;
3400} 3392}
3401#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 @@
2/* 2/*
3 * Mini tar implementation for busybox 3 * Mini tar implementation for busybox
4 * 4 *
5 * Note, that as of BusyBox 0.43 tar has been completely rewritten from the 5 * Note, that as of BusyBox-0.43, tar has been completely rewritten from the
6 * ground up. It still has remnents of the old code lying about, but it pretty 6 * ground up. It still has remnents of the old code lying about, but it is
7 * different (i.e. cleaner, less global variables, etc) 7 * very different now (i.e. cleaner, less global variables, etc)
8 * 8 *
9 * Copyright (C) 2000 by Lineo, inc. 9 * Copyright (C) 2000 by Lineo, inc.
10 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 10 * 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 @@
2/* 2/*
3 * Mini basename implementation for busybox 3 * Mini basename implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
@@ -26,13 +26,16 @@
26 26
27extern int basename_main(int argc, char **argv) 27extern int basename_main(int argc, char **argv)
28{ 28{
29 char* s; 29 char* s, *s1;
30 30
31 if ((argc < 2) || (**(argv + 1) == '-')) { 31 if ((argc < 2) || (**(argv + 1) == '-')) {
32 usage("basename [file ...]\n"); 32 usage("basename [file ...]\n");
33 } 33 }
34 argv++; 34 argv++;
35 35
36 s1=*argv+strlen(*argv)-1;
37 if (*s1 == '/')
38 *s1 = '\0';
36 s = strrchr(*argv, '/'); 39 s = strrchr(*argv, '/');
37 printf("%s\n", (s)? s + 1 : *argv); 40 printf("%s\n", (s)? s + 1 : *argv);
38 exit(TRUE); 41 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[] = {
234 {"sh", shell_main, _BB_DIR_BIN}, 234 {"sh", shell_main, _BB_DIR_BIN},
235#endif 235#endif
236#ifdef BB_SFDISK 236#ifdef BB_SFDISK
237 {"fdisk", sfdisk_main, _BB_DIR_SBIN},
238#ifdef BB_SFDISK
239#endif
240 {"sfdisk", sfdisk_main, _BB_DIR_SBIN}, 237 {"sfdisk", sfdisk_main, _BB_DIR_SBIN},
241#endif 238#endif
242#ifdef BB_SLEEP 239#ifdef BB_SLEEP
@@ -382,8 +379,9 @@ int busybox_main(int argc, char **argv)
382 fprintf(stderr, "Usage: busybox [function] [arguments]...\n"); 379 fprintf(stderr, "Usage: busybox [function] [arguments]...\n");
383 fprintf(stderr, " or: [function] [arguments]...\n\n"); 380 fprintf(stderr, " or: [function] [arguments]...\n\n");
384 fprintf(stderr, 381 fprintf(stderr,
385 "\tMost people will create a link to busybox for each function\n" 382 "\tBusyBox is a multi-call binary that combines many common Unix utilities into a\n"
386 "\tname, and busybox will act like whatever you invoke it as.\n"); 383 "\tsingle executable. Most people will create a link to busybox for each function\n"
384 "\tthey wish to use, and BusyBox will act like whatever it was invoked as.\n");
387 fprintf(stderr, "\nCurrently defined functions:\n"); 385 fprintf(stderr, "\nCurrently defined functions:\n");
388 386
389 while (a->name != 0) { 387 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 @@
7// 7//
8// 8//
9// BusyBox Applications 9// BusyBox Applications
10//#define BB_BASENAME 10#define BB_BASENAME
11#define BB_CAT 11#define BB_CAT
12#define BB_CHMOD_CHOWN_CHGRP 12#define BB_CHMOD_CHOWN_CHGRP
13#define BB_CHROOT 13#define BB_CHROOT
@@ -20,21 +20,21 @@
20#define BB_DF 20#define BB_DF
21#define BB_DIRNAME 21#define BB_DIRNAME
22#define BB_DMESG 22#define BB_DMESG
23//#define BB_DUTMP 23#define BB_DUTMP
24#define BB_DU 24#define BB_DU
25#define BB_ECHO 25#define BB_ECHO
26//#define BB_FBSET 26#define BB_FBSET
27//#define BB_FDFLUSH 27#define BB_FDFLUSH
28#define BB_FIND 28#define BB_FIND
29#define BB_FREE 29#define BB_FREE
30//#define BB_FREERAMDISK 30#define BB_FREERAMDISK
31//#define BB_FSCK_MINIX 31#define BB_FSCK_MINIX
32#define BB_GREP 32#define BB_GREP
33#define BB_GUNZIP 33#define BB_GUNZIP
34#define BB_GZIP 34#define BB_GZIP
35//#define BB_HALT 35//#define BB_HALT
36#define BB_HEAD 36#define BB_HEAD
37//#define BB_HOSTID 37#define BB_HOSTID
38#define BB_HOSTNAME 38#define BB_HOSTNAME
39#define BB_INIT 39#define BB_INIT
40// Don't bother turning BB_INSMOD on. It doesn't work. 40// Don't bother turning BB_INSMOD on. It doesn't work.
@@ -42,39 +42,39 @@
42#define BB_KILL 42#define BB_KILL
43#define BB_KILLALL 43#define BB_KILLALL
44#define BB_KLOGD 44#define BB_KLOGD
45//#define BB_LENGTH 45#define BB_LENGTH
46#define BB_LN 46#define BB_LN
47//#define BB_LOADACM 47#define BB_LOADACM
48//#define BB_LOADFONT 48#define BB_LOADFONT
49//#define BB_LOADKMAP 49#define BB_LOADKMAP
50//#define BB_LOGGER 50#define BB_LOGGER
51#define BB_LOGNAME 51#define BB_LOGNAME
52#define BB_LS 52#define BB_LS
53//#define BB_LSMOD 53#define BB_LSMOD
54//#define BB_MAKEDEVS 54#define BB_MAKEDEVS
55//#define BB_MKFS_MINIX 55#define BB_MKFS_MINIX
56//#define BB_MATH 56#define BB_MATH
57#define BB_MKDIR 57#define BB_MKDIR
58//#define BB_MKFIFO 58#define BB_MKFIFO
59#define BB_MKNOD 59#define BB_MKNOD
60#define BB_MKSWAP 60#define BB_MKSWAP
61//#define BB_MNC 61#define BB_MNC
62#define BB_MORE 62#define BB_MORE
63#define BB_MOUNT 63#define BB_MOUNT
64//#define BB_NFSMOUNT 64#define BB_NFSMOUNT
65//#define BB_MT 65#define BB_MT
66#define BB_NSLOOKUP 66#define BB_NSLOOKUP
67#define BB_PING 67#define BB_PING
68#define BB_POWEROFF 68//#define BB_POWEROFF
69//#define BB_PRINTF 69#define BB_PRINTF
70#define BB_PS 70#define BB_PS
71#define BB_PWD 71#define BB_PWD
72#define BB_REBOOT 72//#define BB_REBOOT
73#define BB_RM 73#define BB_RM
74#define BB_RMDIR 74#define BB_RMDIR
75//#define BB_RMMOD 75#define BB_RMMOD
76#define BB_SED 76#define BB_SED
77//#define BB_SFDISK 77#define BB_SFDISK
78#define BB_SH 78#define BB_SH
79#define BB_SLEEP 79#define BB_SLEEP
80#define BB_SORT 80#define BB_SORT
@@ -86,7 +86,7 @@
86#define BB_TEE 86#define BB_TEE
87#define BB_TEST 87#define BB_TEST
88// Don't turn BB_TELNET on. It doesn't work. 88// Don't turn BB_TELNET on. It doesn't work.
89#define BB_TELNET 89//#define BB_TELNET
90#define BB_TOUCH 90#define BB_TOUCH
91#define BB_TR 91#define BB_TR
92#define BB_TRUE_FALSE 92#define BB_TRUE_FALSE
@@ -111,7 +111,7 @@
111// 111//
112// 112//
113// Turn this on to use Erik's very cool devps, devmtab, 113// Turn this on to use Erik's very cool devps, devmtab,
114// etc. kernel drivers, thereby eliminating the need for 114// etc kernel drivers, thereby eliminating the need for
115// the /proc filesystem and thereby saving lots and lots 115// the /proc filesystem and thereby saving lots and lots
116// memory for more important things. 116// memory for more important things.
117// You can't use this and USE_PROCFS at the same time... 117// You can't use this and USE_PROCFS at the same time...
@@ -153,7 +153,7 @@
153//Enable init being called as /linuxrc 153//Enable init being called as /linuxrc
154//#define BB_FEATURE_LINUXRC 154//#define BB_FEATURE_LINUXRC
155// 155//
156//Have init enable core dumping for child processed (for debugging only) 156//Have init enable core dumping for child processes (for debugging only)
157//#define BB_FEATURE_INIT_COREDUMPS 157//#define BB_FEATURE_INIT_COREDUMPS
158// 158//
159// Allow init to permenently chroot, and umount the old root fs 159// Allow init to permenently chroot, and umount the old root fs
@@ -181,19 +181,20 @@
181#define BB_FEATURE_TAR_CREATE 181#define BB_FEATURE_TAR_CREATE
182// 182//
183// Enable support for "--exclude" for excluding files 183// Enable support for "--exclude" for excluding files
184//#define BB_FEATURE_TAR_EXCLUDE 184#define BB_FEATURE_TAR_EXCLUDE
185// 185//
186//// Enable reverse sort 186//// Enable reverse sort
187//#define BB_FEATURE_SORT_REVERSE 187#define BB_FEATURE_SORT_REVERSE
188// 188//
189// Enable command line editing in the shell 189// Enable command line editing in the shell
190//#define BB_FEATURE_SH_COMMAND_EDITING 190#define BB_FEATURE_SH_COMMAND_EDITING
191// 191//
192// Enable tab completion in the shell (not yet working very well) 192// Enable tab completion in the shell (not yet
193// working very well -- so don't turn this on)
193//#define BB_FEATURE_SH_TAB_COMPLETION 194//#define BB_FEATURE_SH_TAB_COMPLETION
194// 195//
195//Turn on extra fbset options 196//Turn on extra fbset options
196//#define BB_FEATURE_FBSET_FANCY 197#define BB_FEATURE_FBSET_FANCY
197// 198//
198// 199//
199// End of Features List 200// 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 @@
2/* 2/*
3 * Mini Cat implementation for busybox 3 * Mini Cat implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * 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 @@
3 * Mini chown/chmod/chgrp implementation for busybox 3 * Mini chown/chmod/chgrp implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
3 * Mini chroot implementation for busybox 3 * Mini chroot implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
3 * Mini clear implementation for busybox 3 * Mini clear implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Termios command line History and Editting for NetBSD sh (ash) 3 * Termios command line History and Editting, originally
4 * intended for NetBSD sh (ash)
4 * Copyright (c) 1999 5 * Copyright (c) 1999
5 * Main code: Adam Rogoyski <rogoyski@cs.utexas.edu> 6 * Main code: Adam Rogoyski <rogoyski@cs.utexas.edu>
6 * Etc: Dave Cinege <dcinege@psychosis.com> 7 * Etc: Dave Cinege <dcinege@psychosis.com>
7 * Adjusted for busybox: Erik Andersen <andersee@debian.org> 8 * Majorly adjusted/re-written for busybox:
9 * Erik Andersen <andersee@debian.org>
8 * 10 *
9 * You may use this code as you wish, so long as the original author(s) 11 * You may use this code as you wish, so long as the original author(s)
10 * are attributed in any redistributions of the source code. 12 * are attributed in any redistributions of the source code.
@@ -69,14 +71,15 @@ struct history {
69void 71void
70cmdedit_setwidth(int w) 72cmdedit_setwidth(int w)
71{ 73{
72 if (w > 20) { 74 if (w > 20) {
73 cmdedit_termw = w; 75 cmdedit_termw = w;
74 cmdedit_scroll = w / 3; 76 cmdedit_scroll = w / 3;
75 } else { 77 } else {
76 errorMsg("\n*** Error: minimum screen width is 21\n"); 78 errorMsg("\n*** Error: minimum screen width is 21\n");
77 } 79 }
78} 80}
79 81
82
80void cmdedit_reset_term(void) 83void cmdedit_reset_term(void)
81{ 84{
82 if (reset_term) 85 if (reset_term)
@@ -339,60 +342,7 @@ void get_next_history(struct history **hp, char* command)
339 free((*hp)->s); 342 free((*hp)->s);
340 (*hp)->s = strdup(command); 343 (*hp)->s = strdup(command);
341 *hp = (*hp)->n; 344 *hp = (*hp)->n;
342
343 cmdedit_redraw( NULL, hp->s, -2, -2);
344}
345
346#if 0
347/* prompt : if !=NULL, print the prompt
348 * command: the command line to be displayed
349 * where : where to display changes from.
350 * -1 for no change, -2 for new line
351 * cursor : desired location for the cursor.
352 * -1 for Beginning of line.
353 * -2 for End of Line,
354 */
355static void
356cmdedit_redraw(char* prompt, char* command, int where, int cursor)
357{
358 static char* last_command;
359 int cmdedit_width;
360
361 if (where == -2) {
362 /* Rewrite the prompt and clean up static variables */
363 xwrite(outputFd, "\n", 1);
364 if (prompt) {
365 strcpy(last_command, prompt);
366 xwrite(outputFd, prompt, strlen(prompt));
367 } else {
368 last_command[0] = '\0';
369 xwrite(outputFd, "# ", 2);
370 }
371 cmdedit_width = cmdedit_termw - cmdedit_strlen(prompt);
372 } else if (strcmp(command, last_command) != 0) {
373 strcpy(last_command, prompt);
374 }
375
376 /* erase old command from command line */
377 len = strlen(command)-strlen(last_command);
378 while (len>0)
379 input_backspace(command, outputFd, &cursor, &len);
380 input_home(outputFd, &cursor);
381
382 /* Rewrite the command */
383 xwrite(outputFd, command+where, len);
384
385 /* Put the where it is supposed to be */
386 for (cursor=len; cursor > where; cursor--)
387 xwrite(outputFd, "\b", 1);
388
389 /* write new command */
390 strcpy(command, hp->s);
391 len = strlen(hp->s);
392 xwrite(outputFd, command+where, len);
393 cursor = len;
394} 345}
395#endif
396 346
397/* 347/*
398 * This function is used to grab a character buffer 348 * 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 @@
3 * Mini clear implementation for busybox 3 * Mini clear implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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)
353unicode utf8_to_ucs2(char *buf) 353unicode utf8_to_ucs2(char *buf)
354{ 354{
355 int utf_count = 0; 355 int utf_count = 0;
356 long utf_char; 356 long utf_char = 0;
357 unicode tc; 357 unicode tc = 0;
358 unsigned char c; 358 unsigned char c;
359 359
360 do { 360 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 @@
2/* 2/*
3 * Mini basename implementation for busybox 3 * Mini basename implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
@@ -26,13 +26,16 @@
26 26
27extern int basename_main(int argc, char **argv) 27extern int basename_main(int argc, char **argv)
28{ 28{
29 char* s; 29 char* s, *s1;
30 30
31 if ((argc < 2) || (**(argv + 1) == '-')) { 31 if ((argc < 2) || (**(argv + 1) == '-')) {
32 usage("basename [file ...]\n"); 32 usage("basename [file ...]\n");
33 } 33 }
34 argv++; 34 argv++;
35 35
36 s1=*argv+strlen(*argv)-1;
37 if (*s1 == '/')
38 *s1 = '\0';
36 s = strrchr(*argv, '/'); 39 s = strrchr(*argv, '/');
37 printf("%s\n", (s)? s + 1 : *argv); 40 printf("%s\n", (s)? s + 1 : *argv);
38 exit(TRUE); 41 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 @@
2/* 2/*
3 * Mini Cat implementation for busybox 3 * Mini Cat implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * 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 @@
3 * Mini chroot implementation for busybox 3 * Mini chroot implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
2/* 2/*
3 * Mini dd implementation for busybox 3 * Mini dd implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999, 2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * based in part on code taken from sash.
8 * 7 *
9 * Copyright (c) 1999 by David I. Bell 8 * Based in part on code taken from sash.
10 * Permission is granted to use, distribute, or modify this source, 9 * Copyright (c) 1999 by David I. Bell
11 * provided that this copyright notice remains intact. 10 * Permission is granted to use, distribute, or modify this source,
11 * provided that this copyright notice remains intact.
12 * 12 *
13 * Permission to distribute this code under the GPL has been granted. 13 * Permission to distribute this code under the GPL has been granted.
14 * 14 *
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 @@
2/* 2/*
3 * Mini df implementation for busybox 3 * Mini df implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * based on original code by (I think) Bruce Perens <bruce@pixar.com>. 7 * based on original code by (I think) Bruce Perens <bruce@pixar.com>.
8 * 8 *
@@ -28,9 +28,8 @@
28#include <sys/stat.h> 28#include <sys/stat.h>
29#include <sys/vfs.h> 29#include <sys/vfs.h>
30 30
31static const char df_usage[] = "df [filesystem ...]\n" 31static const char df_usage[] = "df [filesystem ...]\n\n"
32 32 "Print the filesystem space used and space available.\n";
33 "\n" "\tPrint the filesystem space used and space available.\n";
34 33
35extern const char mtab_file[]; /* Defined in utility.c */ 34extern const char mtab_file[]; /* Defined in utility.c */
36 35
@@ -76,6 +75,9 @@ extern int df_main(int argc, char **argv)
76 struct mntent *mountEntry; 75 struct mntent *mountEntry;
77 int status; 76 int status;
78 77
78 if (**(argv + 1) == '-') {
79 usage(df_usage);
80 }
79 while (argc > 1) { 81 while (argc > 1) {
80 if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) { 82 if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) {
81 fprintf(stderr, "%s: can't find mount point.\n", argv[1]); 83 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 @@
3 * Mini du implementation for busybox 3 * Mini du implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by John Beppu <beppu@lineo.com> 7 * Written by John Beppu <beppu@lineo.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -182,7 +182,7 @@ int du_main(int argc, char **argv)
182 exit(0); 182 exit(0);
183} 183}
184 184
185/* $Id: du.c,v 1.16 2000/03/04 21:19:32 erik Exp $ */ 185/* $Id: du.c,v 1.17 2000/04/13 01:18:56 erik Exp $ */
186/* 186/*
187Local Variables: 187Local Variables:
188c-file-style: "linux" 188c-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 @@
3 * Mini head implementation for busybox 3 * Mini head implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by John Beppu <beppu@lineo.com> 7 * Written by John Beppu <beppu@lineo.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -109,4 +109,4 @@ int head_main(int argc, char **argv)
109 exit(0); 109 exit(0);
110} 110}
111 111
112/* $Id: head.c,v 1.8 2000/02/08 19:58:47 erik Exp $ */ 112/* $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 @@
2/* 2/*
3 * Mini ln implementation for busybox 3 * Mini ln implementation for busybox
4 * 4 *
5 * 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Copyright (C) 1999 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify 8 * 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 @@
2/* 2/*
3 * Mini mkdir implementation for busybox 3 * Mini mkdir implementation for busybox
4 * 4 *
5 * 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Copyright (C) 1999 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify 8 * 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 @@
3 * Mini rm implementation for busybox 3 * Mini rm implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
3 * Mini rmdir implementation for busybox 3 * Mini rmdir implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
3 * Mini sort implementation for busybox 3 * Mini sort implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by John Beppu <beppu@lineo.com> 7 * Written by John Beppu <beppu@lineo.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -320,4 +320,4 @@ int sort_main(int argc, char **argv)
320 exit(0); 320 exit(0);
321} 321}
322 322
323/* $Id: sort.c,v 1.12 2000/03/04 21:19:32 erik Exp $ */ 323/* $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 @@
3 * Mini tee implementation for busybox 3 * Mini tee implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by John Beppu <beppu@lineo.com> 7 * Written by John Beppu <beppu@lineo.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -131,4 +131,4 @@ int tee_main(int argc, char **argv)
131 exit(0); 131 exit(0);
132} 132}
133 133
134/* $Id: tee.c,v 1.8 2000/03/23 01:09:18 erik Exp $ */ 134/* $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 @@
3 * Mini touch implementation for busybox 3 * Mini touch implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
3 * Mini uniq implementation for busybox 3 * Mini uniq implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by John Beppu <beppu@lineo.com> 7 * Written by John Beppu <beppu@lineo.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -190,4 +190,4 @@ int uniq_main(int argc, char **argv)
190 exit(0); 190 exit(0);
191} 191}
192 192
193/* $Id: uniq.c,v 1.7 2000/02/08 19:58:47 erik Exp $ */ 193/* $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 @@
37#include <utime.h> 37#include <utime.h>
38#include <dirent.h> 38#include <dirent.h>
39#include <sys/param.h> 39#include <sys/param.h>
40#include <setjmp.h> /* Ok to use this since `ash' does, therefore it's in the libc subset already. */ 40#include <setjmp.h>
41#include <string.h> 41#include <string.h>
42#include <unistd.h> 42#include <unistd.h>
43#include <errno.h> 43#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 @@
2/* 2/*
3 * Mini dd implementation for busybox 3 * Mini dd implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999, 2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * based in part on code taken from sash.
8 * 7 *
9 * Copyright (c) 1999 by David I. Bell 8 * Based in part on code taken from sash.
10 * Permission is granted to use, distribute, or modify this source, 9 * Copyright (c) 1999 by David I. Bell
11 * provided that this copyright notice remains intact. 10 * Permission is granted to use, distribute, or modify this source,
11 * provided that this copyright notice remains intact.
12 * 12 *
13 * Permission to distribute this code under the GPL has been granted. 13 * Permission to distribute this code under the GPL has been granted.
14 * 14 *
diff --git a/df.c b/df.c
index 331ef2d49..c38720454 100644
--- a/df.c
+++ b/df.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Mini df implementation for busybox 3 * Mini df implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * based on original code by (I think) Bruce Perens <bruce@pixar.com>. 7 * based on original code by (I think) Bruce Perens <bruce@pixar.com>.
8 * 8 *
@@ -28,9 +28,8 @@
28#include <sys/stat.h> 28#include <sys/stat.h>
29#include <sys/vfs.h> 29#include <sys/vfs.h>
30 30
31static const char df_usage[] = "df [filesystem ...]\n" 31static const char df_usage[] = "df [filesystem ...]\n\n"
32 32 "Print the filesystem space used and space available.\n";
33 "\n" "\tPrint the filesystem space used and space available.\n";
34 33
35extern const char mtab_file[]; /* Defined in utility.c */ 34extern const char mtab_file[]; /* Defined in utility.c */
36 35
@@ -76,6 +75,9 @@ extern int df_main(int argc, char **argv)
76 struct mntent *mountEntry; 75 struct mntent *mountEntry;
77 int status; 76 int status;
78 77
78 if (**(argv + 1) == '-') {
79 usage(df_usage);
80 }
79 while (argc > 1) { 81 while (argc > 1) {
80 if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) { 82 if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) {
81 fprintf(stderr, "%s: can't find mount point.\n", argv[1]); 83 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 @@
3 * Mini du implementation for busybox 3 * Mini du implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by John Beppu <beppu@lineo.com> 7 * Written by John Beppu <beppu@lineo.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -182,7 +182,7 @@ int du_main(int argc, char **argv)
182 exit(0); 182 exit(0);
183} 183}
184 184
185/* $Id: du.c,v 1.16 2000/03/04 21:19:32 erik Exp $ */ 185/* $Id: du.c,v 1.17 2000/04/13 01:18:56 erik Exp $ */
186/* 186/*
187Local Variables: 187Local Variables:
188c-file-style: "linux" 188c-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 @@
13 13
14#include "internal.h" 14#include "internal.h"
15#include <stdio.h> 15#include <stdio.h>
16#include <errno.h>
16#include <utmp.h> 17#include <utmp.h>
18#define BB_DECLARE_EXTERN
19#define bb_need_io_error
20#include "messages.c"
17 21
18static const char dutmp_usage[] = "dutmp\n" 22static const char dutmp_usage[] = "dutmp\n"
19 "\n" 23 "\n"
20
21 "\tDump file or stdin utmp file format to stdout, pipe delimited.\n" 24 "\tDump file or stdin utmp file format to stdout, pipe delimited.\n"
22 "\tdutmp /var/run/utmp\n"; 25 "\tdutmp /var/run/utmp\n";
23 26
24extern int dutmp_main(int argc, char **argv) 27extern int dutmp_main(int argc, char **argv)
25{ 28{
26 29
27 FILE *f = stdin; 30 FILE *f;
28 struct utmp ut; 31 struct utmp ut;
29 32
30 if ((argc < 2) || (**(argv + 1) == '-')) { 33 if (argc<2) {
34 f = stdin;
35 } else if (*argv[1] == '-' ) {
31 usage(dutmp_usage); 36 usage(dutmp_usage);
32 } 37 } else {
33 38 f = fopen(argv[1], "r");
34 if (**(++argv) == 0) { 39 if (f == NULL) {
35 f = fopen(*(++argv), "r"); 40 fatalError(io_error, argv[1], strerror(errno));
36 if (f < 0) {
37 perror(*argv);
38 exit(FALSE);
39 } 41 }
40 } 42 }
41 43
42 while (fread(&ut, 1, sizeof(struct utmp), f)) { 44 while (fread(&ut, sizeof(struct utmp), 1, f)) {
43 // printf("%d:%d:%s:%s:%s:%s:%d:%d:%ld:%ld:%ld:%x\n",
44 printf("%d|%d|%s|%s|%s|%s|%d|%d|%ld|%ld|%ld|%x\n", 45 printf("%d|%d|%s|%s|%s|%s|%d|%d|%ld|%ld|%ld|%x\n",
45 ut.ut_type, ut.ut_pid, ut.ut_line, 46 ut.ut_type, ut.ut_pid, ut.ut_line,
46 ut.ut_id, ut.ut_user, ut.ut_host, 47 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 @@
3 * Mini sed implementation for busybox 3 * Mini sed implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * Modifications for addresses and append command have been 9 * 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)
228 fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", 228 fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n",
229 BB_VER, BB_BT); 229 BB_VER, BB_BT);
230#endif 230#endif
231 fprintf(stderr, "Usage: fbset [options] [mode]\n"); 231 fprintf(stderr, "Usage: fbset [options] [mode]\n\n");
232 fprintf(stderr, "\tThe following options are recognized:\n"); 232 fprintf(stderr, "Show and modify frame buffer device settings\n\n");
233 fprintf(stderr, "The following options are recognized:\n");
233 for (i = 0; g_cmdoptions[i].name; i++) 234 for (i = 0; g_cmdoptions[i].name; i++)
234 fprintf(stderr, "\t\t%s\n", g_cmdoptions[i].name); 235 fprintf(stderr, "\t%s\n", g_cmdoptions[i].name);
235 exit(-1); 236 exit(-1);
236} 237}
237 238
diff --git a/find.c b/find.c
index c23ac5f46..8fdef2382 100644
--- a/find.c
+++ b/find.c
@@ -3,7 +3,7 @@
3 * Mini find implementation for busybox 3 * Mini find implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
3 * Mini find implementation for busybox 3 * Mini find implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
3 * Mini grep implementation for busybox 3 * Mini grep implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
2/* 2/*
3 * Mini free implementation for busybox 3 * Mini free implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * 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 @@
3 * Mini grep implementation for busybox 3 * Mini grep implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* zcat : stripped version based on gzip sources 2/*
3 Sven Rudolph <sr1@inf.tu-dresden.de> 3 * Gzip implementation for busybox
4 */ 4 *
5 * Based on GNU gzip Copyright (C) 1992-1993 Jean-loup Gailly.
6 *
7 * Originally adjusted for busybox by Sven Rudolph <sr1@inf.tu-dresden.de>
8 * based on gzip sources
9 *
10 * Adjusted further by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
11 * to support files as well as stdin/stdout, and to generally behave itself wrt
12 * command line handling.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 *
28 */
5 29
6#include "internal.h" 30#include "internal.h"
7#define bb_need_name_too_long
8#define BB_DECLARE_EXTERN
9#include "messages.c"
10
11static const char gunzip_usage[] = 31static const char gunzip_usage[] =
12 "gunzip [OPTION]... FILE\n\n" 32 "gunzip [OPTION]... FILE\n\n"
13 "Uncompress FILE (or standard input if FILE is '-').\n\n" 33 "Uncompress FILE (or standard input if FILE is '-').\n\n"
@@ -16,6 +36,18 @@ static const char gunzip_usage[] =
16 "\t-c\tWrite output to standard output\n" 36 "\t-c\tWrite output to standard output\n"
17 "\t-t\tTest compressed file integrity\n"; 37 "\t-t\tTest compressed file integrity\n";
18 38
39
40 /* These defines are very important for BusyBox. Without these,
41 * huge chunks of ram are pre-allocated making the BusyBox bss
42 * size Freaking Huge(tm), which is a bad thing.*/
43#define SMALL_MEM
44#define DYN_ALLOC
45
46#define bb_need_name_too_long
47#define BB_DECLARE_EXTERN
48#include "messages.c"
49
50
19/* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface 51/* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
20 * Copyright (C) 1992-1993 Jean-loup Gailly 52 * Copyright (C) 1992-1993 Jean-loup Gailly
21 * The unzip code was written and put in the public domain by Mark Adler. 53 * The unzip code was written and put in the public domain by Mark Adler.
@@ -89,25 +121,6 @@ static char *license_msg[] = {
89#define get_char() get_byte() 121#define get_char() get_byte()
90#define put_char(c) put_byte(c) 122#define put_char(c) put_byte(c)
91 123
92/* #include "gzip.h" */
93
94/* gzip.h -- common declarations for all gzip modules
95 * Copyright (C) 1992-1993 Jean-loup Gailly.
96 * This is free software; you can redistribute it and/or modify it under the
97 * terms of the GNU General Public License, see the file COPYING.
98 */
99
100#if defined(__STDC__) || defined(PROTO)
101# define OF(args) args
102#else
103# define OF(args) ()
104#endif
105
106#ifdef __STDC__
107typedef void *voidp;
108#else
109typedef char *voidp;
110#endif
111 124
112/* I don't like nested includes, but the string and io functions are used 125/* I don't like nested includes, but the string and io functions are used
113 * too often 126 * too often
@@ -118,7 +131,7 @@ typedef char *voidp;
118# if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__) 131# if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__)
119# include <memory.h> 132# include <memory.h>
120# endif 133# endif
121# define memzero(s, n) memset ((voidp)(s), 0, (n)) 134# define memzero(s, n) memset ((void *)(s), 0, (n))
122#else 135#else
123# include <strings.h> 136# include <strings.h>
124# define strchr index 137# define strchr index
@@ -329,49 +342,46 @@ extern int save_orig_name; /* set if original name must be saved */
329#define WARN(msg) {fprintf msg ; \ 342#define WARN(msg) {fprintf msg ; \
330 if (exit_code == OK) exit_code = WARNING;} 343 if (exit_code == OK) exit_code = WARNING;}
331 344
332#define do_exit(c) exit(c)
333
334
335 /* in unzip.c */ 345 /* in unzip.c */
336extern int unzip OF((int in, int out)); 346extern int unzip (int in, int out);
337 347
338 /* in gzip.c */ 348 /* in gzip.c */
339RETSIGTYPE abort_gzip OF((void)); 349RETSIGTYPE abort_gzip (void);
340 350
341 /* in deflate.c */ 351 /* in deflate.c */
342void lm_init OF((int pack_level, ush * flags)); 352void lm_init (int pack_level, ush * flags);
343ulg deflate OF((void)); 353ulg deflate (void);
344 354
345 /* in trees.c */ 355 /* in trees.c */
346void ct_init OF((ush * attr, int *method)); 356void ct_init (ush * attr, int *method);
347int ct_tally OF((int dist, int lc)); 357int ct_tally (int dist, int lc);
348ulg flush_block OF((char *buf, ulg stored_len, int eof)); 358ulg flush_block (char *buf, ulg stored_len, int eof);
349 359
350 /* in bits.c */ 360 /* in bits.c */
351void bi_init OF((file_t zipfile)); 361void bi_init (file_t zipfile);
352void send_bits OF((int value, int length)); 362void send_bits (int value, int length);
353unsigned bi_reverse OF((unsigned value, int length)); 363unsigned bi_reverse (unsigned value, int length);
354void bi_windup OF((void)); 364void bi_windup (void);
355void copy_block OF((char *buf, unsigned len, int header)); 365void copy_block (char *buf, unsigned len, int header);
356extern int (*read_buf) OF((char *buf, unsigned size)); 366extern int (*read_buf) (char *buf, unsigned size);
357 367
358 /* in util.c: */ 368 /* in util.c: */
359extern int copy OF((int in, int out)); 369extern int copy (int in, int out);
360extern ulg updcrc OF((uch * s, unsigned n)); 370extern ulg updcrc (uch * s, unsigned n);
361extern void clear_bufs OF((void)); 371extern void clear_bufs (void);
362extern int fill_inbuf OF((int eof_ok)); 372extern int fill_inbuf (int eof_ok);
363extern void flush_outbuf OF((void)); 373extern void flush_outbuf (void);
364extern void flush_window OF((void)); 374extern void flush_window (void);
365extern void write_buf OF((int fd, voidp buf, unsigned cnt)); 375extern void write_buf (int fd, void * buf, unsigned cnt);
366 376
367#ifndef __linux__ 377#ifndef __linux__
368extern char *basename OF((char *fname)); 378extern char *basename (char *fname);
369#endif /* not __linux__ */ 379#endif /* not __linux__ */
370extern void read_error OF((void)); 380extern void read_error (void);
371extern void write_error OF((void)); 381extern void write_error (void);
372 382
373 /* in inflate.c */ 383 /* in inflate.c */
374extern int inflate OF((void)); 384extern int inflate (void);
375 385
376/* #include "lzw.h" */ 386/* #include "lzw.h" */
377 387
@@ -415,8 +425,8 @@ extern int inflate OF((void));
415extern int maxbits; /* max bits per code for LZW */ 425extern int maxbits; /* max bits per code for LZW */
416extern int block_mode; /* block compress mode -C compatible with 2.0 */ 426extern int block_mode; /* block compress mode -C compatible with 2.0 */
417 427
418extern int lzw OF((int in, int out)); 428extern int lzw (int in, int out);
419extern int unlzw OF((int in, int out)); 429extern int unlzw (int in, int out);
420 430
421 431
422/* #include "revision.h" */ 432/* #include "revision.h" */
@@ -605,7 +615,7 @@ typedef struct direct dir_type;
605#if !defined(S_ISREG) && defined(S_IFREG) 615#if !defined(S_ISREG) && defined(S_IFREG)
606# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 616# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
607#endif 617#endif
608typedef RETSIGTYPE(*sig_type) OF((int)); 618typedef RETSIGTYPE(*sig_type) (int);
609 619
610#ifndef O_BINARY 620#ifndef O_BINARY
611# define O_BINARY 0 /* creation mode for open() */ 621# define O_BINARY 0 /* creation mode for open() */
@@ -644,7 +654,7 @@ typedef RETSIGTYPE(*sig_type) OF((int));
644 654
645#ifdef NO_OFF_T 655#ifdef NO_OFF_T
646typedef long off_t; 656typedef long off_t;
647off_t lseek OF((int fd, off_t offset, int whence)); 657off_t lseek (int fd, off_t offset, int whence);
648#endif 658#endif
649 659
650 660
@@ -687,7 +697,7 @@ long header_bytes; /* number of bytes in gzip header */
687 697
688/* local functions */ 698/* local functions */
689 699
690local int get_method OF((int in)); 700local int get_method (int in);
691 701
692#define strequ(s1, s2) (strcmp((s1),(s2)) == 0) 702#define strequ(s1, s2) (strcmp((s1),(s2)) == 0)
693 703
@@ -773,7 +783,7 @@ int gunzip_main(int argc, char **argv)
773 usage(gunzip_usage); 783 usage(gunzip_usage);
774 if (strlen(*argv) > MAX_PATH_LEN) { 784 if (strlen(*argv) > MAX_PATH_LEN) {
775 fprintf(stderr, name_too_long, "gunzip"); 785 fprintf(stderr, name_too_long, "gunzip");
776 do_exit(WARNING); 786 exit(WARNING);
777 } 787 }
778 strcpy(ifname, *argv); 788 strcpy(ifname, *argv);
779 789
@@ -781,13 +791,13 @@ int gunzip_main(int argc, char **argv)
781 inFileNum = open(ifname, O_RDONLY); 791 inFileNum = open(ifname, O_RDONLY);
782 if (inFileNum < 0) { 792 if (inFileNum < 0) {
783 perror(ifname); 793 perror(ifname);
784 do_exit(WARNING); 794 exit(WARNING);
785 } 795 }
786 /* Get the time stamp on the input file. */ 796 /* Get the time stamp on the input file. */
787 result = stat(ifname, &statBuf); 797 result = stat(ifname, &statBuf);
788 if (result < 0) { 798 if (result < 0) {
789 perror(ifname); 799 perror(ifname);
790 do_exit(WARNING); 800 exit(WARNING);
791 } 801 }
792 ifile_size = statBuf.st_size; 802 ifile_size = statBuf.st_size;
793 } 803 }
@@ -812,7 +822,7 @@ int gunzip_main(int argc, char **argv)
812 /* And get to work */ 822 /* And get to work */
813 if (strlen(ifname) > MAX_PATH_LEN - 4) { 823 if (strlen(ifname) > MAX_PATH_LEN - 4) {
814 fprintf(stderr, name_too_long, "gunzip"); 824 fprintf(stderr, name_too_long, "gunzip");
815 do_exit(WARNING); 825 exit(WARNING);
816 } 826 }
817 strcpy(ofname, ifname); 827 strcpy(ofname, ifname);
818 pos = strstr(ofname, ".gz"); 828 pos = strstr(ofname, ".gz");
@@ -836,7 +846,7 @@ int gunzip_main(int argc, char **argv)
836#endif 846#endif
837 if (outFileNum < 0) { 847 if (outFileNum < 0) {
838 perror(ofname); 848 perror(ofname);
839 do_exit(WARNING); 849 exit(WARNING);
840 } 850 }
841 /* Set permissions on the file */ 851 /* Set permissions on the file */
842 fchmod(outFileNum, statBuf.st_mode); 852 fchmod(outFileNum, statBuf.st_mode);
@@ -860,7 +870,7 @@ int gunzip_main(int argc, char **argv)
860 exit(FALSE); 870 exit(FALSE);
861 } 871 }
862 } 872 }
863 do_exit(exit_code); 873 exit(exit_code);
864} 874}
865 875
866 876
@@ -953,7 +963,7 @@ int in; /* input file descriptor */
953 */ 963 */
954RETSIGTYPE abort_gzip() 964RETSIGTYPE abort_gzip()
955{ 965{
956 do_exit(ERROR); 966 exit(ERROR);
957} 967}
958 968
959/* unzip.c -- decompress files in gzip or pkzip format. 969/* unzip.c -- decompress files in gzip or pkzip format.
@@ -1027,7 +1037,7 @@ int in, out; /* input and output file descriptors */
1027 ofd = out; 1037 ofd = out;
1028 method = get_method(ifd); 1038 method = get_method(ifd);
1029 if (method < 0) { 1039 if (method < 0) {
1030 do_exit(exit_code); /* error message already emitted */ 1040 exit(exit_code); /* error message already emitted */
1031 } 1041 }
1032 1042
1033 updcrc(NULL, 0); /* initialize crc */ 1043 updcrc(NULL, 0); /* initialize crc */
@@ -1218,7 +1228,7 @@ void flush_window()
1218 */ 1228 */
1219void write_buf(fd, buf, cnt) 1229void write_buf(fd, buf, cnt)
1220int fd; 1230int fd;
1221voidp buf; 1231void * buf;
1222unsigned cnt; 1232unsigned cnt;
1223{ 1233{
1224 unsigned n; 1234 unsigned n;
@@ -1228,7 +1238,7 @@ unsigned cnt;
1228 write_error(); 1238 write_error();
1229 } 1239 }
1230 cnt -= n; 1240 cnt -= n;
1231 buf = (voidp) ((char *) buf + n); 1241 buf = (void *) ((char *) buf + n);
1232 } 1242 }
1233} 1243}
1234 1244
@@ -1240,8 +1250,8 @@ unsigned cnt;
1240# define const 1250# define const
1241# endif 1251# endif
1242 1252
1243int strspn OF((const char *s, const char *accept)); 1253int strspn (const char *s, const char *accept);
1244int strcspn OF((const char *s, const char *reject)); 1254int strcspn (const char *s, const char *reject);
1245 1255
1246/* ======================================================================== 1256/* ========================================================================
1247 * Return the length of the maximum initial segment 1257 * Return the length of the maximum initial segment
@@ -1493,15 +1503,15 @@ struct huft {
1493 1503
1494 1504
1495/* Function prototypes */ 1505/* Function prototypes */
1496int huft_build OF((unsigned *, unsigned, unsigned, ush *, ush *, 1506int huft_build (unsigned *, unsigned, unsigned, ush *, ush *,
1497 struct huft **, int *)); 1507 struct huft **, int *);
1498int huft_free OF((struct huft *)); 1508int huft_free (struct huft *);
1499int inflate_codes OF((struct huft *, struct huft *, int, int)); 1509int inflate_codes (struct huft *, struct huft *, int, int);
1500int inflate_stored OF((void)); 1510int inflate_stored (void);
1501int inflate_fixed OF((void)); 1511int inflate_fixed (void);
1502int inflate_dynamic OF((void)); 1512int inflate_dynamic (void);
1503int inflate_block OF((int *)); 1513int inflate_block (int *);
1504int inflate OF((void)); 1514int inflate (void);
1505 1515
1506 1516
1507/* The inflate algorithm uses a sliding 32K byte window on the uncompressed 1517/* 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 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* gzip.c -- this is a stripped down version of gzip I put into busybox, it does 2/*
3 * only standard in to standard out with -9 compression. It also requires the 3 * Gzip implementation for busybox
4 * zcat module for some important functions. 4 *
5 * Based on GNU gzip Copyright (C) 1992-1993 Jean-loup Gailly.
6 *
7 * Originally adjusted for busybox by Charles P. Wright <cpw@unix.asb.com>
8 * "this is a stripped down version of gzip I put into busybox, it does
9 * only standard in to standard out with -9 compression. It also requires
10 * the zcat module for some important functions."
11 *
12 * Adjusted further by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
13 * to support files as well as stdin/stdout, and to generally behave itself wrt
14 * command line handling.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5 * 29 *
6 * Charles P. Wright <cpw@unix.asb.com>
7 */ 30 */
31
8#include "internal.h" 32#include "internal.h"
9#ifdef BB_GZIP
10 33
11//#ifndef BB_ZCAT 34/* These defines are very important for BusyBox. Without these,
12//#error you need zcat to have gzip support! 35 * huge chunks of ram are pre-allocated making the BusyBox bss
13//#endif 36 * size Freaking Huge(tm), which is a bad thing.*/
37#define SMALL_MEM
38#define DYN_ALLOC
39
14 40
15static const char gzip_usage[] = 41static const char gzip_usage[] =
16 "gzip [OPTION]... FILE\n\n" 42 "gzip [OPTION]... FILE\n\n"
@@ -21,42 +47,12 @@ static const char gzip_usage[] =
21 "\t-c\tWrite output to standard output instead of FILE.gz\n"; 47 "\t-c\tWrite output to standard output instead of FILE.gz\n";
22 48
23 49
24/* gzip.h -- common declarations for all gzip modules
25 * Copyright (C) 1992-1993 Jean-loup Gailly.
26 * This is free software; you can redistribute it and/or modify it under the
27 * terms of the GNU General Public License, see the file COPYING.
28 */
29
30#if defined(__STDC__) || defined(PROTO)
31# define OF(args) args
32#else
33# define OF(args) ()
34#endif
35
36#ifdef __STDC__
37typedef void *voidp;
38#else
39typedef char *voidp;
40#endif
41
42/* I don't like nested includes, but the string and io functions are used 50/* I don't like nested includes, but the string and io functions are used
43 * too often 51 * too often
44 */ 52 */
45#include <stdio.h> 53#include <stdio.h>
46#if !defined(NO_STRING_H) || defined(STDC_HEADERS) 54#include <string.h>
47# include <string.h> 55#define memzero(s, n) memset ((void *)(s), 0, (n))
48# if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__)
49# include <memory.h>
50# endif
51# define memzero(s, n) memset ((voidp)(s), 0, (n))
52#else
53# include <strings.h>
54# define strchr index
55# define strrchr rindex
56# define memcpy(d, s, n) bcopy((s), (d), (n))
57# define memcmp(s1, s2, n) bcmp((s1), (s2), (n))
58# define memzero(s, n) bzero((s), (n))
59#endif
60 56
61#ifndef RETSIGTYPE 57#ifndef RETSIGTYPE
62# define RETSIGTYPE void 58# define RETSIGTYPE void
@@ -121,13 +117,13 @@ extern int method; /* compression method */
121#endif 117#endif
122 118
123#ifdef DYN_ALLOC 119#ifdef DYN_ALLOC
124# define EXTERN(type, array) extern type * near array 120# define EXTERN(type, array) extern type * array
125# define DECLARE(type, array, size) type * near array 121# define DECLARE(type, array, size) type * array
126# define ALLOC(type, array, size) { \ 122# define ALLOC(type, array, size) { \
127 array = (type*)fcalloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ 123 array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
128 if (array == NULL) errorMsg("insufficient memory"); \ 124 if (array == NULL) errorMsg("insufficient memory"); \
129 } 125 }
130# define FREE(array) {if (array != NULL) fcfree(array), array=NULL;} 126# define FREE(array) {if (array != NULL) free(array), array=NULL;}
131#else 127#else
132# define EXTERN(type, array) extern type array[] 128# define EXTERN(type, array) extern type array[]
133# define DECLARE(type, array, size) type array[size] 129# define DECLARE(type, array, size) type array[size]
@@ -284,55 +280,55 @@ extern int save_orig_name; /* set if original name must be saved */
284 280
285 281
286 /* in zip.c: */ 282 /* in zip.c: */
287extern int zip OF((int in, int out)); 283extern int zip (int in, int out);
288extern int file_read OF((char *buf, unsigned size)); 284extern int file_read (char *buf, unsigned size);
289 285
290 /* in unzip.c */ 286 /* in unzip.c */
291extern int unzip OF((int in, int out)); 287extern int unzip (int in, int out);
292extern int check_zipfile OF((int in)); 288extern int check_zipfile (int in);
293 289
294 /* in unpack.c */ 290 /* in unpack.c */
295extern int unpack OF((int in, int out)); 291extern int unpack (int in, int out);
296 292
297 /* in unlzh.c */ 293 /* in unlzh.c */
298extern int unlzh OF((int in, int out)); 294extern int unlzh (int in, int out);
299 295
300 /* in gzip.c */ 296 /* in gzip.c */
301RETSIGTYPE abort_gzip OF((void)); 297RETSIGTYPE abort_gzip (void);
302 298
303 /* in deflate.c */ 299 /* in deflate.c */
304void lm_init OF((ush * flags)); 300void lm_init (ush * flags);
305ulg deflate OF((void)); 301ulg deflate (void);
306 302
307 /* in trees.c */ 303 /* in trees.c */
308void ct_init OF((ush * attr, int *method)); 304void ct_init (ush * attr, int *method);
309int ct_tally OF((int dist, int lc)); 305int ct_tally (int dist, int lc);
310ulg flush_block OF((char *buf, ulg stored_len, int eof)); 306ulg flush_block (char *buf, ulg stored_len, int eof);
311 307
312 /* in bits.c */ 308 /* in bits.c */
313void bi_init OF((file_t zipfile)); 309void bi_init (file_t zipfile);
314void send_bits OF((int value, int length)); 310void send_bits (int value, int length);
315unsigned bi_reverse OF((unsigned value, int length)); 311unsigned bi_reverse (unsigned value, int length);
316void bi_windup OF((void)); 312void bi_windup (void);
317void copy_block OF((char *buf, unsigned len, int header)); 313void copy_block (char *buf, unsigned len, int header);
318extern int (*read_buf) OF((char *buf, unsigned size)); 314extern int (*read_buf) (char *buf, unsigned size);
319 315
320 /* in util.c: */ 316 /* in util.c: */
321extern int copy OF((int in, int out)); 317extern int copy (int in, int out);
322extern ulg updcrc OF((uch * s, unsigned n)); 318extern ulg updcrc (uch * s, unsigned n);
323extern void clear_bufs OF((void)); 319extern void clear_bufs (void);
324extern int fill_inbuf OF((int eof_ok)); 320extern int fill_inbuf (int eof_ok);
325extern void flush_outbuf OF((void)); 321extern void flush_outbuf (void);
326extern void flush_window OF((void)); 322extern void flush_window (void);
327extern void write_buf OF((int fd, voidp buf, unsigned cnt)); 323extern void write_buf (int fd, void * buf, unsigned cnt);
328extern char *strlwr OF((char *s)); 324extern char *strlwr (char *s);
329extern char *add_envopt OF((int *argcp, char ***argvp, char *env)); 325extern char *add_envopt (int *argcp, char ***argvp, char *env);
330extern void read_error OF((void)); 326extern void read_error (void);
331extern void write_error OF((void)); 327extern void write_error (void);
332extern void display_ratio OF((long num, long den, FILE * file)); 328extern void display_ratio (long num, long den, FILE * file);
333 329
334 /* in inflate.c */ 330 /* in inflate.c */
335extern int inflate OF((void)); 331extern int inflate (void);
336 332
337/* lzw.h -- define the lzw functions. 333/* lzw.h -- define the lzw functions.
338 * Copyright (C) 1992-1993 Jean-loup Gailly. 334 * Copyright (C) 1992-1993 Jean-loup Gailly.
@@ -795,7 +791,7 @@ local int bi_valid;
795 * are always zero. 791 * are always zero.
796 */ 792 */
797 793
798int (*read_buf) OF((char *buf, unsigned size)); 794int (*read_buf) (char *buf, unsigned size);
799 795
800/* Current input function. Set to mem_read for in-memory compression */ 796/* Current input function. Set to mem_read for in-memory compression */
801 797
@@ -1148,16 +1144,16 @@ local config configuration_table =
1148/* =========================================================================== 1144/* ===========================================================================
1149 * Prototypes for local functions. 1145 * Prototypes for local functions.
1150 */ 1146 */
1151local void fill_window OF((void)); 1147local void fill_window (void);
1152 1148
1153int longest_match OF((IPos cur_match)); 1149int longest_match (IPos cur_match);
1154 1150
1155#ifdef ASMV 1151#ifdef ASMV
1156void match_init OF((void)); /* asm code initialization */ 1152void match_init (void); /* asm code initialization */
1157#endif 1153#endif
1158 1154
1159#ifdef DEBUG 1155#ifdef DEBUG
1160local void check_match OF((IPos start, IPos match, int length)); 1156local void check_match (IPos start, IPos match, int length);
1161#endif 1157#endif
1162 1158
1163/* =========================================================================== 1159/* ===========================================================================
@@ -1708,7 +1704,7 @@ struct utimbuf {
1708# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 1704# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
1709#endif 1705#endif
1710 1706
1711typedef RETSIGTYPE(*sig_type) OF((int)); 1707typedef RETSIGTYPE(*sig_type) (int);
1712 1708
1713#ifndef O_BINARY 1709#ifndef O_BINARY
1714# define O_BINARY 0 /* creation mode for open() */ 1710# define O_BINARY 0 /* creation mode for open() */
@@ -1743,7 +1739,7 @@ typedef RETSIGTYPE(*sig_type) OF((int));
1743 1739
1744#ifdef NO_OFF_T 1740#ifdef NO_OFF_T
1745typedef long off_t; 1741typedef long off_t;
1746off_t lseek OF((int fd, off_t offset, int whence)); 1742off_t lseek (int fd, off_t offset, int whence);
1747#endif 1743#endif
1748 1744
1749/* Separator for file name parts (see shorten_name()) */ 1745/* Separator for file name parts (see shorten_name()) */
@@ -2246,17 +2242,17 @@ extern unsigned near strstart; /* window offset of current string */
2246 * Local (static) routines in this file. 2242 * Local (static) routines in this file.
2247 */ 2243 */
2248 2244
2249local void init_block OF((void)); 2245local void init_block (void);
2250local void pqdownheap OF((ct_data near * tree, int k)); 2246local void pqdownheap (ct_data near * tree, int k);
2251local void gen_bitlen OF((tree_desc near * desc)); 2247local void gen_bitlen (tree_desc near * desc);
2252local void gen_codes OF((ct_data near * tree, int max_code)); 2248local void gen_codes (ct_data near * tree, int max_code);
2253local void build_tree OF((tree_desc near * desc)); 2249local void build_tree (tree_desc near * desc);
2254local void scan_tree OF((ct_data near * tree, int max_code)); 2250local void scan_tree (ct_data near * tree, int max_code);
2255local void send_tree OF((ct_data near * tree, int max_code)); 2251local void send_tree (ct_data near * tree, int max_code);
2256local int build_bl_tree OF((void)); 2252local int build_bl_tree (void);
2257local void send_all_trees OF((int lcodes, int dcodes, int blcodes)); 2253local void send_all_trees (int lcodes, int dcodes, int blcodes);
2258local void compress_block OF((ct_data near * ltree, ct_data near * dtree)); 2254local void compress_block (ct_data near * ltree, ct_data near * dtree);
2259local void set_file_type OF((void)); 2255local void set_file_type (void);
2260 2256
2261 2257
2262#ifndef DEBUG 2258#ifndef DEBUG
@@ -3161,12 +3157,8 @@ char *s;
3161 3157
3162/* Provide missing strspn and strcspn functions. */ 3158/* Provide missing strspn and strcspn functions. */
3163 3159
3164# ifndef __STDC__ 3160int strspn (const char *s, const char *accept);
3165# define const 3161int strcspn (const char *s, const char *reject);
3166# endif
3167
3168int strspn OF((const char *s, const char *accept));
3169int strcspn OF((const char *s, const char *reject));
3170 3162
3171/* ======================================================================== 3163/* ========================================================================
3172 * Return the length of the maximum initial segment 3164 * Return the length of the maximum initial segment
@@ -3398,4 +3390,3 @@ unsigned size;
3398 isize += (ulg) len; 3390 isize += (ulg) len;
3399 return (int) len; 3391 return (int) len;
3400} 3392}
3401#endif
diff --git a/head.c b/head.c
index 82a73de2a..3db64b3bc 100644
--- a/head.c
+++ b/head.c
@@ -3,7 +3,7 @@
3 * Mini head implementation for busybox 3 * Mini head implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by John Beppu <beppu@lineo.com> 7 * Written by John Beppu <beppu@lineo.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -109,4 +109,4 @@ int head_main(int argc, char **argv)
109 exit(0); 109 exit(0);
110} 110}
111 111
112/* $Id: head.c,v 1.8 2000/02/08 19:58:47 erik Exp $ */ 112/* $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()
471 return; 471 return;
472 472
473 if (stat("/etc/fstab", &statBuf) == 0) { 473 if (stat("/etc/fstab", &statBuf) == 0) {
474 /* swapon -a requires /proc typically */
475 waitfor("mount proc /proc -t proc", console, FALSE);
474 /* Try to turn on swap */ 476 /* Try to turn on swap */
475 system("/sbin/swapon -a"); 477 waitfor("swapon -a", console, FALSE);
476 if (check_free_memory() < 1000) 478 if (check_free_memory() < 1000)
477 goto goodnight; 479 goto goodnight;
478 } else 480 } 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()
471 return; 471 return;
472 472
473 if (stat("/etc/fstab", &statBuf) == 0) { 473 if (stat("/etc/fstab", &statBuf) == 0) {
474 /* swapon -a requires /proc typically */
475 waitfor("mount proc /proc -t proc", console, FALSE);
474 /* Try to turn on swap */ 476 /* Try to turn on swap */
475 system("/sbin/swapon -a"); 477 waitfor("swapon -a", console, FALSE);
476 if (check_free_memory() < 1000) 478 if (check_free_memory() < 1000)
477 goto goodnight; 479 goto goodnight;
478 } else 480 } else
diff --git a/insmod.c b/insmod.c
index 7cbbed441..1ee96f1c8 100644
--- a/insmod.c
+++ b/insmod.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Mini insmod implementation for busybox 3 * Mini insmod implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * 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 @@
2/* 2/*
3 * Mini ln implementation for busybox 3 * Mini ln implementation for busybox
4 * 4 *
5 * 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Copyright (C) 1999 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify 8 * 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)
353unicode utf8_to_ucs2(char *buf) 353unicode utf8_to_ucs2(char *buf)
354{ 354{
355 int utf_count = 0; 355 int utf_count = 0;
356 long utf_char; 356 long utf_char = 0;
357 unicode tc; 357 unicode tc = 0;
358 unsigned char c; 358 unsigned char c;
359 359
360 do { 360 do {
diff --git a/logger.c b/logger.c
index a9e0afcc8..db6d9bfc5 100644
--- a/logger.c
+++ b/logger.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Mini logger implementation for busybox 3 * Mini logger implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * 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 @@
2/* 2/*
3 * Mini lsmod implementation for busybox 3 * Mini lsmod implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * 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 @@
13 13
14#include "internal.h" 14#include "internal.h"
15#include <stdio.h> 15#include <stdio.h>
16#include <errno.h>
16#include <utmp.h> 17#include <utmp.h>
18#define BB_DECLARE_EXTERN
19#define bb_need_io_error
20#include "messages.c"
17 21
18static const char dutmp_usage[] = "dutmp\n" 22static const char dutmp_usage[] = "dutmp\n"
19 "\n" 23 "\n"
20
21 "\tDump file or stdin utmp file format to stdout, pipe delimited.\n" 24 "\tDump file or stdin utmp file format to stdout, pipe delimited.\n"
22 "\tdutmp /var/run/utmp\n"; 25 "\tdutmp /var/run/utmp\n";
23 26
24extern int dutmp_main(int argc, char **argv) 27extern int dutmp_main(int argc, char **argv)
25{ 28{
26 29
27 FILE *f = stdin; 30 FILE *f;
28 struct utmp ut; 31 struct utmp ut;
29 32
30 if ((argc < 2) || (**(argv + 1) == '-')) { 33 if (argc<2) {
34 f = stdin;
35 } else if (*argv[1] == '-' ) {
31 usage(dutmp_usage); 36 usage(dutmp_usage);
32 } 37 } else {
33 38 f = fopen(argv[1], "r");
34 if (**(++argv) == 0) { 39 if (f == NULL) {
35 f = fopen(*(++argv), "r"); 40 fatalError(io_error, argv[1], strerror(errno));
36 if (f < 0) {
37 perror(*argv);
38 exit(FALSE);
39 } 41 }
40 } 42 }
41 43
42 while (fread(&ut, 1, sizeof(struct utmp), f)) { 44 while (fread(&ut, sizeof(struct utmp), 1, f)) {
43 // printf("%d:%d:%s:%s:%s:%s:%d:%d:%ld:%ld:%ld:%x\n",
44 printf("%d|%d|%s|%s|%s|%s|%d|%d|%ld|%ld|%ld|%x\n", 45 printf("%d|%d|%s|%s|%s|%s|%d|%d|%ld|%ld|%ld|%x\n",
45 ut.ut_type, ut.ut_pid, ut.ut_line, 46 ut.ut_type, ut.ut_pid, ut.ut_line,
46 ut.ut_id, ut.ut_user, ut.ut_host, 47 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 @@
2/* 2/*
3 * Mini mkdir implementation for busybox 3 * Mini mkdir implementation for busybox
4 * 4 *
5 * 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Copyright (C) 1999 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify 8 * 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 @@
2/* 2/*
3 * Mini insmod implementation for busybox 3 * Mini insmod implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * 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 @@
2/* 2/*
3 * Mini lsmod implementation for busybox 3 * Mini lsmod implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * 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 @@
2/* 2/*
3 * Mini rmmod implementation for busybox 3 * Mini rmmod implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * 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 @@
2/* 2/*
3 * Mini nslookup implementation for busybox 3 * Mini nslookup implementation for busybox
4 * 4 *
5 *
6 * Copyright (C) 2000 by Lineo, inc. 5 * Copyright (C) 2000 by Lineo, inc.
7 * Written by John Beppu <beppu@lineo.com> 6 * Written by John Beppu <beppu@lineo.com>
8 * 7 *
@@ -174,4 +173,4 @@ int nslookup_main(int argc, char **argv)
174 return 0; 173 return 0;
175} 174}
176 175
177/* $Id: nslookup.c,v 1.5 2000/02/18 21:34:17 erik Exp $ */ 176/* $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 @@
2/* 2/*
3 * Mini nslookup implementation for busybox 3 * Mini nslookup implementation for busybox
4 * 4 *
5 *
6 * Copyright (C) 2000 by Lineo, inc. 5 * Copyright (C) 2000 by Lineo, inc.
7 * Written by John Beppu <beppu@lineo.com> 6 * Written by John Beppu <beppu@lineo.com>
8 * 7 *
@@ -174,4 +173,4 @@ int nslookup_main(int argc, char **argv)
174 return 0; 173 return 0;
175} 174}
176 175
177/* $Id: nslookup.c,v 1.5 2000/02/18 21:34:17 erik Exp $ */ 176/* $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 @@
2/* 2/*
3 * Mini free implementation for busybox 3 * Mini free implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * 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 @@
2/* 2/*
3 * Mini ps implementation(s) for busybox 3 * Mini ps implementation(s) for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. Written by Erik Andersen 5 * Copyright (C) 1999,2000 by Lineo, inc. Written by Erik Andersen
6 * <andersen@lineo.com>, <andersee@debian.org> 6 * <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * 8 *
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 @@
2/* 2/*
3 * Mini uptime implementation for busybox 3 * Mini uptime implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * 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 @@
2/* 2/*
3 * Mini ps implementation(s) for busybox 3 * Mini ps implementation(s) for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. Written by Erik Andersen 5 * Copyright (C) 1999,2000 by Lineo, inc. Written by Erik Andersen
6 * <andersen@lineo.com>, <andersee@debian.org> 6 * <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * 8 *
diff --git a/rm.c b/rm.c
index 683bf8bdf..0cd795661 100644
--- a/rm.c
+++ b/rm.c
@@ -3,7 +3,7 @@
3 * Mini rm implementation for busybox 3 * Mini rm implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
3 * Mini rmdir implementation for busybox 3 * Mini rmdir implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
2/* 2/*
3 * Mini rmmod implementation for busybox 3 * Mini rmmod implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * 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 @@
3 * Mini sed implementation for busybox 3 * Mini sed implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * Modifications for addresses and append command have been 9 * 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 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Termios command line History and Editting for NetBSD sh (ash) 3 * Termios command line History and Editting, originally
4 * intended for NetBSD sh (ash)
4 * Copyright (c) 1999 5 * Copyright (c) 1999
5 * Main code: Adam Rogoyski <rogoyski@cs.utexas.edu> 6 * Main code: Adam Rogoyski <rogoyski@cs.utexas.edu>
6 * Etc: Dave Cinege <dcinege@psychosis.com> 7 * Etc: Dave Cinege <dcinege@psychosis.com>
7 * Adjusted for busybox: Erik Andersen <andersee@debian.org> 8 * Majorly adjusted/re-written for busybox:
9 * Erik Andersen <andersee@debian.org>
8 * 10 *
9 * You may use this code as you wish, so long as the original author(s) 11 * You may use this code as you wish, so long as the original author(s)
10 * are attributed in any redistributions of the source code. 12 * are attributed in any redistributions of the source code.
@@ -69,14 +71,15 @@ struct history {
69void 71void
70cmdedit_setwidth(int w) 72cmdedit_setwidth(int w)
71{ 73{
72 if (w > 20) { 74 if (w > 20) {
73 cmdedit_termw = w; 75 cmdedit_termw = w;
74 cmdedit_scroll = w / 3; 76 cmdedit_scroll = w / 3;
75 } else { 77 } else {
76 errorMsg("\n*** Error: minimum screen width is 21\n"); 78 errorMsg("\n*** Error: minimum screen width is 21\n");
77 } 79 }
78} 80}
79 81
82
80void cmdedit_reset_term(void) 83void cmdedit_reset_term(void)
81{ 84{
82 if (reset_term) 85 if (reset_term)
@@ -339,60 +342,7 @@ void get_next_history(struct history **hp, char* command)
339 free((*hp)->s); 342 free((*hp)->s);
340 (*hp)->s = strdup(command); 343 (*hp)->s = strdup(command);
341 *hp = (*hp)->n; 344 *hp = (*hp)->n;
342
343 cmdedit_redraw( NULL, hp->s, -2, -2);
344}
345
346#if 0
347/* prompt : if !=NULL, print the prompt
348 * command: the command line to be displayed
349 * where : where to display changes from.
350 * -1 for no change, -2 for new line
351 * cursor : desired location for the cursor.
352 * -1 for Beginning of line.
353 * -2 for End of Line,
354 */
355static void
356cmdedit_redraw(char* prompt, char* command, int where, int cursor)
357{
358 static char* last_command;
359 int cmdedit_width;
360
361 if (where == -2) {
362 /* Rewrite the prompt and clean up static variables */
363 xwrite(outputFd, "\n", 1);
364 if (prompt) {
365 strcpy(last_command, prompt);
366 xwrite(outputFd, prompt, strlen(prompt));
367 } else {
368 last_command[0] = '\0';
369 xwrite(outputFd, "# ", 2);
370 }
371 cmdedit_width = cmdedit_termw - cmdedit_strlen(prompt);
372 } else if (strcmp(command, last_command) != 0) {
373 strcpy(last_command, prompt);
374 }
375
376 /* erase old command from command line */
377 len = strlen(command)-strlen(last_command);
378 while (len>0)
379 input_backspace(command, outputFd, &cursor, &len);
380 input_home(outputFd, &cursor);
381
382 /* Rewrite the command */
383 xwrite(outputFd, command+where, len);
384
385 /* Put the where it is supposed to be */
386 for (cursor=len; cursor > where; cursor--)
387 xwrite(outputFd, "\b", 1);
388
389 /* write new command */
390 strcpy(command, hp->s);
391 len = strlen(hp->s);
392 xwrite(outputFd, command+where, len);
393 cursor = len;
394} 345}
395#endif
396 346
397/* 347/*
398 * This function is used to grab a character buffer 348 * 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 @@
3 * Mini sort implementation for busybox 3 * Mini sort implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by John Beppu <beppu@lineo.com> 7 * Written by John Beppu <beppu@lineo.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -320,4 +320,4 @@ int sort_main(int argc, char **argv)
320 exit(0); 320 exit(0);
321} 321}
322 322
323/* $Id: sort.c,v 1.12 2000/03/04 21:19:32 erik Exp $ */ 323/* $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 @@
3 * Mini swapon/swapoff implementation for busybox 3 * Mini swapon/swapoff implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
2/* 2/*
3 * Mini logger implementation for busybox 3 * Mini logger implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * 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 @@
2/* 2/*
3 * Mini syslogd implementation for busybox 3 * Mini syslogd implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
@@ -37,6 +37,7 @@
37#include <sys/un.h> 37#include <sys/un.h>
38#include <time.h> 38#include <time.h>
39#include <unistd.h> 39#include <unistd.h>
40#include <limits.h>
40 41
41#define ksyslog klogctl 42#define ksyslog klogctl
42extern int ksyslog(int type, char *buf, int len); 43extern 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 @@
2/* 2/*
3 * Mini syslogd implementation for busybox 3 * Mini syslogd implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
@@ -37,6 +37,7 @@
37#include <sys/un.h> 37#include <sys/un.h>
38#include <time.h> 38#include <time.h>
39#include <unistd.h> 39#include <unistd.h>
40#include <limits.h>
40 41
41#define ksyslog klogctl 42#define ksyslog klogctl
42extern int ksyslog(int type, char *buf, int len); 43extern 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 @@
2/* 2/*
3 * Mini tar implementation for busybox 3 * Mini tar implementation for busybox
4 * 4 *
5 * Note, that as of BusyBox 0.43 tar has been completely rewritten from the 5 * Note, that as of BusyBox-0.43, tar has been completely rewritten from the
6 * ground up. It still has remnents of the old code lying about, but it pretty 6 * ground up. It still has remnents of the old code lying about, but it is
7 * different (i.e. cleaner, less global variables, etc) 7 * very different now (i.e. cleaner, less global variables, etc)
8 * 8 *
9 * Copyright (C) 2000 by Lineo, inc. 9 * Copyright (C) 2000 by Lineo, inc.
10 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 10 * 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 @@
3 * Mini tee implementation for busybox 3 * Mini tee implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by John Beppu <beppu@lineo.com> 7 * Written by John Beppu <beppu@lineo.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -131,4 +131,4 @@ int tee_main(int argc, char **argv)
131 exit(0); 131 exit(0);
132} 132}
133 133
134/* $Id: tee.c,v 1.8 2000/03/23 01:09:18 erik Exp $ */ 134/* $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 @@
3 * Mini touch implementation for busybox 3 * Mini touch implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
3 * Mini true/false implementation for busybox 3 * Mini true/false implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
3 * Mini umount implementation for busybox 3 * Mini umount implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
3 * Mini uniq implementation for busybox 3 * Mini uniq implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by John Beppu <beppu@lineo.com> 7 * Written by John Beppu <beppu@lineo.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -190,4 +190,4 @@ int uniq_main(int argc, char **argv)
190 exit(0); 190 exit(0);
191} 191}
192 192
193/* $Id: uniq.c,v 1.7 2000/02/08 19:58:47 erik Exp $ */ 193/* $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 @@
2/* 2/*
3 * Mini uptime implementation for busybox 3 * Mini uptime implementation for busybox
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * 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)
228 fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", 228 fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n",
229 BB_VER, BB_BT); 229 BB_VER, BB_BT);
230#endif 230#endif
231 fprintf(stderr, "Usage: fbset [options] [mode]\n"); 231 fprintf(stderr, "Usage: fbset [options] [mode]\n\n");
232 fprintf(stderr, "\tThe following options are recognized:\n"); 232 fprintf(stderr, "Show and modify frame buffer device settings\n\n");
233 fprintf(stderr, "The following options are recognized:\n");
233 for (i = 0; g_cmdoptions[i].name; i++) 234 for (i = 0; g_cmdoptions[i].name; i++)
234 fprintf(stderr, "\t\t%s\n", g_cmdoptions[i].name); 235 fprintf(stderr, "\t%s\n", g_cmdoptions[i].name);
235 exit(-1); 236 exit(-1);
236} 237}
237 238
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 @@
3 * Mini swapon/swapoff implementation for busybox 3 * Mini swapon/swapoff implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * 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 @@
3 * Mini umount implementation for busybox 3 * Mini umount implementation for busybox
4 * 4 *
5 * 5 *
6 * Copyright (C) 1999 by Lineo, inc. 6 * Copyright (C) 1999,2000 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify