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