Compare commits

...
431 Commits
Author SHA1 Message Date
Manuel Novoa III d499330e9e Commit vodz's patch, plus a tweak to change TracePid to TracerPid. Now
works on i386 (2.4.19) and arm (2.4.6).
2002-09-18 19:27:10 +00:00
Eric Andersen 06c35da6af patch from John Hall <john.hall@optionexist.co.uk> to change the
klogd specific messages to facility LOG_SYSLOG and tidies up some
of the priorities.
2002-09-18 14:23:06 +00:00
Eric Andersen 420b208a45 Add a new top applet
-Erik
2002-09-17 22:14:58 +00:00
Eric Andersen 793c3b4a7d Clear screen too. 2002-09-17 21:21:27 +00:00
Eric Andersen dc180d1442 re-enable the cursor, in case it got disabled
-Erik
2002-09-17 21:17:35 +00:00
Manuel Novoa III 6c32a8add4 Modified so that it "works" for archs other than i386... arm in particular.
Also tried to clean up the logic a little, and ensure that read errors
or invalid archives resulted in error returns.  This could use a lot more
work... Volunteers?
2002-09-17 21:02:16 +00:00
Eric Andersen 60943c5d5c Sane-ify the screen clearing stuff.
-Erik
2002-09-17 20:53:41 +00:00
Eric Andersen 39ad2833c0 hehe. 2002-09-17 20:35:58 +00:00
Eric Andersen 871d93c462 Vodz' last_patch57:
Ok. Patch with reduce size ready.
    Notes: syslogd imposible close logsocket,
    the real programm write logmessages (hmm, cycle loop?)

    (Excuse me - this have small tab-formats rewroting also)

       text    data     bss     dec     hex filename
       2913     332   12388   15633    3d11 syslogd.o
       3109     332    9252   12693    3195 syslogd_old.o
2002-09-17 20:06:29 +00:00
Eric Andersen 927c3bdc18 Support setting depth 2002-09-17 08:44:56 +00:00
Eric Andersen a9a220b92a last_patch56 from vodz to simplify copy_file logic 2002-09-17 08:42:21 +00:00
Eric Andersen bf8bf105fb Patch from "Joe.C" <joe@numa.com.tw> 2002-09-17 08:41:08 +00:00
Eric Andersen 34fd00af5f Patch from David McCullough <davidm@snapgear.com> 2002-09-17 08:40:12 +00:00
Eric Andersen 7365c58783 Use "MiB" not "Mb"
-Erik
2002-09-17 06:36:56 +00:00
Eric Andersen bdff6a4c59 Typo fix from Steven Merrifield 2002-09-17 05:43:26 +00:00
Eric Andersen d4ee98940b last_patch55 from vodz:
I found overflow problem in xargs applet
    (allocated not space for trailing '\0').
    Last patch also reduce 22 bytes size. ;)
2002-09-16 10:44:24 +00:00
Eric Andersen 02b8dfc524 Let people force overwrite links
-Erik
2002-09-16 10:23:38 +00:00
Eric Andersen 403a73a351 Properly honor FILEUTILS_INTERACTIVE and FILEUTILS_FORCE for
file all file types (not just regular files and dirs).  Unlink
destination files when needed.
 -Erik
2002-09-16 09:23:22 +00:00
Glenn L McGrath 18b76e6f80 Watch applet by Michael Habermann 2002-09-16 09:10:04 +00:00
Eric Andersen 8fede28c74 Patch from Matthias Lang <matthias@corelatus.se> to fix gunzip
error handling and prevent gunzip from hanging.
2002-09-16 07:25:41 +00:00
Eric Andersen a9cc8961ed Let people run SHUTDOWN actions prior to killing everything
-Erik
2002-09-16 06:49:06 +00:00
Eric Andersen e18cb71e0c Fix stupid typo noticed by John Mullin <john.mullin@homenetcomm.com> 2002-09-16 06:32:16 +00:00
Eric Andersen c38678d14b Apply vodz' last_patch52 2002-09-16 06:22:25 +00:00
Eric Andersen 166fa4684f Support module tainting
-Erik
2002-09-16 05:30:24 +00:00
Glenn L McGrath 061c900176 mesg applet by Manuel Novoa III 2002-09-16 04:21:46 +00:00
Glenn L McGrath ebdc8b48a5 Put in GPL v2 or later copyright notice 2002-09-16 03:47:48 +00:00
Glenn L McGrath ec0c48cb29 openvt applet by Quy Tonthat 2002-09-16 03:16:06 +00:00
Glenn L McGrath 6714862bdd Use busybox's show_usage function for help 2002-09-15 17:20:45 +00:00
Glenn L McGrath 7a32aaacd0 Awk applet written from scratch by Dmitry Zakharov 2002-09-15 17:03:48 +00:00
Glenn L McGrath b3c4e9add5 Support for GNU style long filename and linknames 2002-09-15 16:54:49 +00:00
Eric Andersen 186685d46f Patch from Thomas Gleixner <tglx@linutronix.de> to do
automatic child reaping to avoid zombies
2002-09-12 15:44:53 +00:00
Manuel Novoa III 4d0884a1ea Apply vodz's last_patch53.gz (bb_asprintf.c) and last_patch54.gz
(arith.c).
2002-09-12 14:52:26 +00:00
Eric Andersen 7829b8d067 Fix for handling of "tftp -l -" from Jean Wolter <jw5@os.inf.tu-dresden.de> 2002-09-10 06:03:31 +00:00
Eric Andersen 2a1eb31f18 Yipe. uid and gid were reversed.
-Erik
2002-09-10 05:23:29 +00:00
Eric Andersen 2bec97c076 Some CML1 grammar fixes
-Erik
2002-09-01 06:45:55 +00:00
Eric Andersen 1130976f8e Eliminate use of obsolete sys_errlist[]
-Erik
2002-08-26 21:36:32 +00:00
Glenn L McGrath c3b7f7d6e7 chmod on the NEW file 2002-08-26 17:17:27 +00:00
Glenn L McGrath 193697db4e Dont return an error if the directory already existed 2002-08-24 20:11:38 +00:00
Glenn L McGrath 210aa14916 Fix warning 2002-08-24 20:00:52 +00:00
Glenn L McGrath abac53b33c Reorganise, make it just one function, remove -v option it didnt work properly anyway, dont setvbuf it doesnt make any difference in performance. 2002-08-24 14:32:17 +00:00
Glenn L McGrath 1ee52e8b14 Run through indent, use braces 2002-08-24 10:30:36 +00:00
Aaron Lehmann 933d10d308 Remove extrangeous backslashes that were probably introduced by
someone joining lines and forgetting to remove the backslash escaping
the newline.
2002-08-23 22:09:50 +00:00
Glenn L McGrath fbef225c4b Rewrite, its smaller 2002-08-23 17:19:26 +00:00
Glenn L McGrath 192ff35d9c Remove empty loops 2002-08-23 14:36:59 +00:00
Glenn L McGrath 0be933b505 Use static instead of extern, braces around if's, run through indent 2002-08-23 14:31:28 +00:00
Glenn L McGrath 50812fff21 Apply vodz last_path_51-2 2002-08-23 13:14:48 +00:00
Glenn L McGrath de9e803149 Apply vodz last_patch51_2 and run through indent 2002-08-23 12:04:23 +00:00
Aaron Lehmann e599b6d96e Don't #ifdef __linux__. this is linux. 2002-08-23 07:56:21 +00:00
Aaron Lehmann 7dd2cec2fd ansify 2002-08-23 07:52:58 +00:00
Aaron Lehmann 84878fe20e remove duplicate definition of G
caught by tinycc
2002-08-23 07:51:01 +00:00
Aaron Lehmann 0df910af49 for some baffling reason tinycc insists that i change this 0 to NULL 2002-08-23 07:45:26 +00:00
Aaron Lehmann 5d3cb7cc1f move some globals to bss 2002-08-23 07:28:45 +00:00
Glenn L McGrath 8042f65398 Run through indent, style 2002-08-23 06:17:46 +00:00
Glenn L McGrath acfc0d872e Run through indent, fix comments 2002-08-23 06:05:11 +00:00
Glenn L McGrath 03195fc16f Run through indent, fix comments 2002-08-23 05:58:38 +00:00
Glenn L McGrath a199b17253 Run through indent, specify cast 2002-08-23 03:37:07 +00:00
Glenn L McGrath 14dad7028b Run through indent 2002-08-23 03:25:22 +00:00
Glenn L McGrath 1ed9dd9d06 Remove duplicate definitions, run through indent 2002-08-22 19:35:36 +00:00
Glenn L McGrath 4534af2763 replace some global const ints with defines 2002-08-22 19:31:35 +00:00
Glenn L McGrath 0775a07d87 Specify cast 2002-08-22 19:22:32 +00:00
Glenn L McGrath 4cc2e5e944 Remove duplicate variable definition 2002-08-22 19:15:26 +00:00
Glenn L McGrath 9fef17dec3 Run through indent, fix comments 2002-08-22 18:41:20 +00:00
Glenn L McGrath 7c58e9be69 Run through indent, fix comment 2002-08-22 18:24:43 +00:00
Glenn L McGrath baf55a85fc Run through indent, fix comments 2002-08-22 18:22:10 +00:00
Glenn L McGrath e3906fcd94 Run through indent, fix BB_ define 2002-08-22 18:13:54 +00:00
Glenn L McGrath 99b12543cf Run through ident, fix comments 2002-08-22 17:47:09 +00:00
Glenn L McGrath 242e3b6bde define inline if needed for ANSI C compatability 2002-08-22 15:59:18 +00:00
Glenn L McGrath 60a22addea Remove unwanted comments, run through indent 2002-08-22 15:54:22 +00:00
Glenn L McGrath a0ee881ba4 Run through indent, use /* */ style comments, change extern to static 2002-08-22 13:44:08 +00:00
Glenn L McGrath 4176972db5 Run through indent, use /* */ style comments 2002-08-22 13:25:12 +00:00
Glenn L McGrath d827e8b665 Run through indent 2002-08-22 13:21:26 +00:00
Glenn L McGrath b37367aa77 Run through indent, use /* */ style comments instead of // 2002-08-22 13:12:40 +00:00
Glenn L McGrath f853db54f9 Remove definition of is_octal and is_decimal, they arent used 2002-08-22 12:55:26 +00:00
Glenn L McGrath 75762705a3 Honour the USTAR prefix field, this enables a 155 byte path length plus the normal 100 byte filename.
The catch is gnu tar cannot create archives that use the prefix field, you need to use s-tar.
2002-08-22 11:50:31 +00:00
Glenn L McGrath 419eed7501 udhcpc sample scripts 2002-08-21 14:24:38 +00:00
Aaron Lehmann 5f8f32a41c Inline functions with only one reference in mkfs_minix. I don't know
why these efforts aren't making the binary smaller.
2002-08-21 13:21:20 +00:00
Aaron Lehmann 8fc5d6d2da Tar inlining, #if 0 out unused function 2002-08-21 13:11:34 +00:00
Aaron Lehmann 6fdacc74f0 vi inlining 2002-08-21 13:02:24 +00:00
Aaron Lehmann a95e99e6f3 Cleanups. These SHOULD make the binary a lot smaller. But they don't.
CURSE GCC
2002-08-21 12:44:54 +00:00
Glenn L McGrath d9768d7cb9 Disable debugging 2002-08-21 11:44:31 +00:00
Aaron Lehmann 1ff58b6570 Clean up udhcpd a bit. Constify. Staticize. Remove these functions and
inline their contents: print_usage, pidfile_delete, and background.
2002-08-21 11:21:19 +00:00
Glenn L McGrath 8eb0dc1d10 New applet, udhcp client 2002-08-21 10:27:58 +00:00
Glenn L McGrath 3d184586a7 Fix dietlibc test condition 2002-08-15 03:29:56 +00:00
Eric Andersen 938e982c4d Try to be a bit more dietlibc friendly 2002-08-13 09:57:44 +00:00
Glenn L McGrath 1d23f3a492 Enable support for the old tar header format, enable via menu's 2002-08-13 05:06:43 +00:00
Aaron Lehmann 6069441bd2 minor fixes for fbset bloat
<mjn3>         printf("\tgeometry %u %u %u %u %u\n", v->xres, v->yres,
<mjn3>                    v->xres_virtual, v->yres_virtual, v->bits_per_pixel);
<mjn3>         printf("\ttimings %u %u %u %u %u %u %u\n", v->pixclock, v->left_margin,
<mjn3>                    v->right_margin, v->upper_margin, v->lower_margin, v->hsync_l
<mjn3> en,
<mjn3>                    v->vsync_len);
<mjn3>         printf("\taccel %s\n", (v->accel_flags > 0 ? "true" : "false"));
<mjn3>         printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length,
<mjn3>                    v->red.offset, v->green.length, v->green.offset, v->blue.leng
<mjn3> th,
<mjn3>                    v->blue.offset, v->transp.length, v->transp.offset);
<mjn3>         printf("endmode\n\n");
<mjn3> whay have multiple printf calls when one would do?

<mjn3> and this:
<mjn3> static struct cmdoptions_t {
<mjn3>         char *name;
<mjn3>         unsigned char param_count;
<mjn3>         unsigned char code;
<mjn3> } g_cmdoptions[] = {
<mjn3>         {
<mjn3>         "-fb", 1, CMD_FB}, {
<mjn3> (repeated entries)
<mjn3> why isn't this constant?  what about struct packing?

inline the helper functions that are only referenced once.
2002-08-13 04:19:23 +00:00
Robert Griebl 91a0aac110 Added Familiar Linux to the projects list 2002-08-09 22:54:39 +00:00
Robert Griebl 2ab6ff95e0 Patch from Rusell Nelson to document the -C switch for syslogd 2002-08-07 21:24:33 +00:00
Robert Griebl 65d415d847 Added a help text for the -C option to syslogd 2002-08-07 21:10:19 +00:00
Robert Griebl 00f5ecb141 Somehow I applied an old patch for the last commit - this one works now:
- Added \CregexC support to sed (sed testsuite reported no errors, btw)
2002-08-06 23:13:31 +00:00
Robert Griebl 7940147e25 Added the \CregexpC syntax as an alternative for /regexp/ (like GNU sed) 2002-08-06 21:07:17 +00:00
Manuel Novoa III edcac5572f Fix silly typo. addgroup was using /etc/shadow for /etc/gshadow. 2002-08-06 20:39:23 +00:00
Manuel Novoa III f8277ca992 Move #define MAXLINE so this compiles without circ buffers. 2002-08-06 20:12:56 +00:00
Eric Andersen 74b007f7cc Oops. Code things so it actually works this time around...
-Erik
2002-08-05 11:56:25 +00:00
Eric Andersen c59716ff4c Joel Coltoff <joel@wmi.com> noticed that following a recent
change in uClibc that changed opening the /dev/log socket as
SOCK_STREAM to SOCK_DGRAM, busybox syslogd no longer worked
since it needed a matching change.  This fixes it so it
works once again.
2002-08-05 11:14:30 +00:00
Robert Griebl 6859d761d3 - updated a few copyright/left file headers
- documented most of my 0.61 changes in the ChangeLog
2002-08-05 02:57:12 +00:00
Robert Griebl 0d833ca7fd Fixed a bug in xarg: string data was strcat'ed to a malloc'ed buffer - and
malloc does not clear memory by default (somehow this worked on x86, but
not on arm)
2002-08-03 14:49:03 +00:00
Aaron Lehmann 49c024addd Remove ckfree, and replace all references with free. Remove freefunc,
which is also equivilent to free. Remove some if(x)free(x)
redundancies.
2002-08-02 06:39:47 +00:00
Eric Andersen e85dbfdd80 Joseph Chiu <josephc@idealab.com> found an off-by-one bug. oops! 2002-08-01 01:31:17 +00:00
Robert Griebl a71389bfe8 Applied a patch from Philip Blundell <pb@nexus.co.uk>:
Added support for ":x" as an alias for ":wq" to vi
2002-07-31 21:22:21 +00:00
Eric Andersen 7373e485d3 A couple of small bugfixes from Marshall M. Midden <m4@brecis.com> 2002-07-31 04:04:47 +00:00
Eric Andersen 87715170cc Be more portable with 'find' for those that prefer programming
on *BSD, etc.  Formatting fixes, etc.
2002-07-31 03:45:05 +00:00
Robert Griebl b230159958 Fixed a timing bug which occured when bb ash is run in a rxvt on the
HP iPAQ. Sometimes we get a SIGWINCH and want to print the prompt, although
the prompt is not yet initialised (0) .. so just don't print a prompt
as long as the prompt string is 0
2002-07-30 23:13:51 +00:00
Robert Griebl df03932b7e Added the -I (isofmt) options to date, which comes in handy for scripts
(this is a confiureable option)
2002-07-30 23:11:00 +00:00
Robert Griebl 70112da81a Fixed a bug that I had introduced with the new "options" handling. 2002-07-29 20:28:38 +00:00
Eric Andersen e707806894 Kill a silly warning 2002-07-29 08:00:16 +00:00
Eric Andersen 3bc2b206b0 Patch from Tim Riker to allow tty* in inittab if the tty
actually exists -- serial console is not the issue...
2002-07-29 06:39:58 +00:00
Robert Griebl aead70b4d1 modprobe now also uses "options" from /etc/modules.conf 2002-07-26 15:54:20 +00:00
Robert Griebl d0dd3d31e2 Fix for bug #1255 -- support for mount -t <type> 2002-07-25 14:17:19 +00:00
Robert Griebl 2a4a8d8ffb Add support for /etc/filesystem when searching for an "auto" filesystem
This is bug #1246
2002-07-24 01:41:30 +00:00
Robert Griebl 31a2e20bd3 Commited patch from bug #1182
Although ssrat@mailbag.com says this is not GNU behaviour, it really *is*
(man nslookup)
2002-07-24 00:56:56 +00:00
Robert Griebl 41369af3f2 Patch for bug #1183: Added a -xdev option to find (configurable) 2002-07-24 00:34:48 +00:00
Eric Andersen 80cd3cfdbc Fix indentation. Support killall -q, for pcmcia-cs
-Erik
2002-07-23 23:45:11 +00:00
Robert Griebl f2f26e7fdd Added tar -cz support (creating gzipped tar files without a gzip pipe) 2002-07-23 22:05:47 +00:00
Robert Griebl 967c3d4406 Fixed two compiler warnings 2002-07-21 17:33:27 +00:00
Robert Griebl 1cd0445495 Initial checkin of a very primitive hwclock replacement 2002-07-21 16:50:49 +00:00
Robert Griebl fc78b79575 Applied syslogd fix submitted by Bart Visscher:
I am using BB 0.60.2 in a floppy distro, and the syslog (and logger) is
unable to log the "<" char.  This shows up in ppp logfiles.  [...]
#logger "<pcomp>" results in "comp>" arriving at the log.
2002-07-19 20:52:21 +00:00
Robert Griebl efd4983eb1 - Forgot to cvs add bb_asprintf.c (from vodz' patch #50)
- Applied Joel Coltoff's xconnect patch:
On both my host system and with mipsel-linux for my embedded systems
the function getservbyname() gives the port number already in host order.
In fact, this is how it was used by rdate in version 0.60.3. The snapshot
I have of the development tree from July 12, 2002 takes the port number
and stuffs it into htons() before it uses it. This causes bugs in rdate,
telnet and wget. This patch fixes that.
2002-07-19 20:27:11 +00:00
Robert Griebl d378c3149c Applied vodz' patches #49 and #50 (with a small correction in runshell.c)
#49: I found one memory overflow and memory leak in "ln" applet.
Last patch reduced also 54 bytes. ;)

#50: I found bug in loginutils/Makefile.in.
New patch have also new function to libbb and
aplied this to applets and other cosmetic changes.
2002-07-19 00:05:54 +00:00
Robert Griebl 88947dd05e Added a compile time option to suppress the "Using fallback.." message
if no busybox.conf file is existant.
2002-07-18 23:59:17 +00:00
Robert Griebl 2c0d0f0051 Fix for the totally broken adduser applet (parts/ideas from vodz and tito) 2002-07-16 23:50:05 +00:00
Robert Griebl e4f9f3a960 Don't treat a non-existant/-readable config file as an empty config, but
use the compiled in _BB_SUID_* flags (same as for parse errors)
2002-07-16 21:53:59 +00:00
Eric Andersen 0fe3e62e2c Doh! 2002-07-14 15:39:05 +00:00
Eric Andersen d2fd0d5869 Better clarify the CVS tree situation
-Erik
2002-07-13 06:24:58 +00:00
Eric Andersen acc257e994 Try to be more clear about the current two-CVS-trees
situation.
 -Erik
2002-07-13 06:08:39 +00:00
Robert Griebl e8fcf4bd69 Accept the --passive-ftp cmd.line option. We always use passive ftp mode,
so it doesn't hurt (adds compatibility though)
2002-07-12 00:04:46 +00:00
Eric Andersen 2276d83639 Fixup warnings and undefined operations that show up in gcc-3.1
-Erik
2002-07-11 11:11:56 +00:00
Eric Andersen cafc103230 Brad Campbell <brad@seme.com.au> notes that
xconnect.c needs #include <netinet/in.h>
to compile if CONFIG_FEATURE_IPV6 is not defined
2002-07-11 10:40:43 +00:00
Eric Andersen 1785ddcae2 Some minor bits of scrubbing 2002-07-08 01:40:02 +00:00
Eric Andersen 8e139871fe Patch from Stewart Brodie <stewart.brodie@pace.co.uk> to fix ash:
When alias support is not configured, ash believes that command parameters
that look like dd's "if=/dev/zero" are requests to set a temporary
environment variable whilst dd is running, even though it appears after the
command name.  This is caused by the re-use of the checkalias global variable
to indicate when both alias checking and environment variable checking.  The
failure to reset this flag is due to the reset action being performed only
inside the feature check CHECK_ASH_ALIAS.  Hence ash works as expected when
aliases are configured in, and fails when not.

Example script using 'date' with different settings of TZ:

# TZ=Europe/London
# export TZ
# date
Thu May 30 17:18:49 BST 2002
# TZ=America/New_York date
Thu May 30 12:19:10 EDT 2002
# date
Thu May 30 17:19:12 BST 2002
# date TZ=America/New_York
Thu May 30 12:19:30 EDT 2002    <----- wrong, should be BST time (or error!)
# date
Thu May 30 17:19:35 BST 2002

Attached is a patch against revision 1.52 of ash.c which moves the checks so
that checkalias is updated regardless of whether CONFIG_ASH_ALIAS is set.
With this patch applied, the command shown above which should generate an
error does generate an error.

I have tested this patch with the 'dd' command too and that now works
correctly.
2002-07-04 00:19:46 +00:00
Eric Andersen 0826b6b0b3 This is last_patch48 from vodz. More cleanups, kills a bit
of dead code, fixes one blatent bug.
2002-07-03 23:50:16 +00:00
Eric Andersen 887ca79f04 Scrub pwd.h and grp.h handling so we don't have to play any
silly games.
 -Erik
2002-07-03 23:19:26 +00:00
Eric Andersen 360e254954 tito <farmatito@tiscali.it> noticed that delgroup was actually
setting CONFIG_DELUSER.  Oops.
2002-07-03 19:50:23 +00:00
Eric Andersen 0b31586c71 A patch from Bart Visscher <magick@linux-fan.com> to add an
xconnect helper routine which does:
        -address and port resolving
	-tries to connect to all resolved addresses until connected
	-uses getaddrinfo, so works for IPv6 too
This patch also ports rdate, telnet, and wget to use the new
xconnect function.  Thanks Bart!
2002-07-03 11:51:44 +00:00
Eric Andersen 51b8bd68bb This patch from Bart Visscher <magick@linux-fan.com> adds
IPV6 support to busybox.  This patch does the following:
    * Add IPv6 support to libbb
    * Enable IPv6 interface address display
    * Add IPv6 config option
    * Adds ping6, an adaptation of the ping applet for IPv6
    * Adds support routines for ping6:
	- xgethostbyname2
	- create_icmp6_socket
    * Adds ifconfig support for IPv6
    * Add support IPv6 to netstat
    * Add IPv6 support to route
Thanks Bart!
2002-07-03 11:46:38 +00:00
Eric Andersen 599e3ce163 Apply last_patch47 from vodz to fix several problems, such as the ash "job
control turned off" bug, console_setup() was called with a closed file
descriptor, setsid() inconsistancy, and silly string handling bugs.   I have
modified his patch to allow the askfirst init actions to have a controlling
terminal.
2002-07-03 11:08:10 +00:00
Eric Andersen 935daf2d0d hide shadow using stuff when CONFIG_FEATURE_SHADOWPASSWDS
is not set
 -Erik
2002-07-03 09:13:21 +00:00
Eric Andersen 7f90ed4460 Patch from Martin Volf <volf@dragon.cz> to fix where I had
screwed up the usage messages
2002-07-03 05:55:14 +00:00
Eric Andersen 796446718d Fix from vodz so that complex init commands actually work 2002-07-03 05:44:18 +00:00
Eric Andersen 8c4025e708 Patch from Danny Lepage <danny.lepage@cognicase.com> to fix
dutmp for uClibc.
2002-07-03 05:32:02 +00:00
Eric Andersen 5222d31a15 Patch from till busch <buti@gmx.at> -- unblock all signals
in exec_signal() before calling exec()
2002-07-03 05:15:23 +00:00
Eric Andersen 549df2ebc3 Fix text alignment, thanks to Sander Klein <s.klein@quicknet.nl> 2002-07-03 04:54:52 +00:00
Eric Andersen 7234c3a0b6 Cleanup shadow.h stuff so it behaves as intended
-Erik
2002-07-03 04:47:43 +00:00
Eric Andersen 009ae1f17d Little fix to avoid overflow 2002-07-03 04:24:08 +00:00
Eric Andersen abc9568690 Silly spelling fix
-Erik
2002-07-03 02:52:35 +00:00
Eric Andersen b493dec91e David Frascone <dave@frascone.com> noticed two problems. First, modprobe was
trying to call 'insmod -q', which wasn't supported.  Secondly, when modprobe
was fed blank lines from modules.dep, we ended up calling xstrndup(ptr, -1),
which with suitably bad results.  David provided a patch to catch the blank
lines, and I have added insmod -q support.  So modprobe should work again.
 -Erik
2002-07-02 19:14:23 +00:00
Aaron Lehmann 69d4178708 Remove advertising clauses in accordance with
ftp://ftp.cs.berkeley.edu/ucb/4bsd/README.Impt.License.Change
2002-06-23 22:25:24 +00:00
Aaron Lehmann 9031481ac3 inline many functions that are only called once. saves about 300 bytes
on i386. also staticify most functions.
2002-06-23 22:13:22 +00:00
Aaron Lehmann ed11993900 Needs shadow.h; otherwise wont compile without CONFIG_USE_BB_SHADOW 2002-06-23 22:00:41 +00:00
Aaron Lehmann 8c26fbe537 remove cleanUpAndFail, and replace it with exit(). because that's what
it does unless srcMode was set, and srcMode is never set.
2002-06-23 21:56:13 +00:00
Eric Andersen 5b0f9e417e Rework optimization code. Be more compiler aware.
-Erik
2002-06-23 04:50:49 +00:00
Eric Andersen 27f64e1f4e Port over the last of the tinylogin applets
-Erik
2002-06-23 04:24:25 +00:00
Eric Andersen 0fbff134f4 Several login cleanups from vodz 2002-06-22 17:49:29 +00:00
Eric Andersen b0c39a8a8d Apply vodz' last_patch44 -- cleanup several chars to be const, fix
rotten error handling, kill spare \n's, etc
2002-06-22 17:32:58 +00:00
Eric Andersen 3ece93ba0f Kill dead email address
-Erik
2002-06-22 17:23:45 +00:00
Eric Andersen 8b1aa4d749 Apply last_patch46 from vodz, to fix buffer overflows noted by
Gerardo Puga, and to optimize for size a little bit.  Thanks vodz
2002-06-22 17:20:50 +00:00
Eric Andersen 61f83059c1 Apply vodz' cleanup for insmod buffer overflows, which was cleaner
than my first effort.
2002-06-22 17:15:42 +00:00
Aaron Lehmann 9f92d5f2a2 Major revamp. I've been trying to clean up the code. the bzerror stuff
still needs major attention (i.e. removal).

Removed references to uninitialized variables like progName,
smallMode, noisy, etc. Remove functions and code for handling "small"
decompression mode, since it is all unreachable. Remove
total_{in,out}* counters - they are never used. Remove panic()
function and assert_h and their uses because they are all for "should
never happen" circumstances. Replace internal malloc/free wrappers
with xmalloc and free. Remove conditional in if(foo)free(foo);
situations. Remove bogus
	if (sizeof(int) != 4) {
		return BZ_CONFIG_ERROR;
	}
(...etc...) code and code for handling BZ_CONFIG_ERROR. Someone should
go through and change the applet to use well-defined types when
appropriate - it expects sizeof(short)==2 && sizeof(int)==4. Until
this commit these were explicitly checked for, and the applet would
exit if these types were not the right size. (I think this is wrong
even as an interim solution.)

With gcc 3.1 reduces size of binary on i386-linux by about 700 bytes.

Lightly tested.
2002-06-22 06:35:29 +00:00
Eric Andersen 2d34215456 As noted by Yves Lavoie ing. <yves.lavoie.ing@sympatico.ca>, don't
lose the last letter of the module name.
2002-06-18 05:16:25 +00:00
Eric Andersen b0fd2b06a3 Fix a potential macro expansion problem... isspace can be
a macro causing a double decrement...
2002-06-15 14:37:46 +00:00
Eric Andersen a7d0b41c08 Don't use pointless GNU-isms 2002-06-15 14:33:06 +00:00
Robert Griebl 47abc49c4a Patch from Simon Krahnke:
I wrote a patch for busybox for our company's (www.lisa.de)
private use. [...] To sed it adds the '!'-inversion of addresses.
2002-06-11 23:43:27 +00:00
Matt Kraai 3ad88ccf2d * testsuite/sed/sed-recurses-properly: Mark XFAIL. 2002-06-11 13:29:08 +00:00
Matt Kraai 9ef2ea27d4 * libbb/copy_file.c (copy_file): Check st_dev instead of st_rdev. 2002-06-11 13:25:26 +00:00
Eric Andersen 360060252a vodz' last_patch42_2, which is an updated fix for buffer overflows
noted by Gerardo Puga
2002-06-08 12:44:17 +00:00
Robert Griebl 0c789a4255 If config file can not be parsed, use compiled in BB_SUID_... values as a
fallback method
2002-06-06 17:30:16 +00:00
Eric Andersen fe1ef2bc62 Fix buffer overflows noted by Gerardo Puga
-Erik
2002-06-06 14:36:07 +00:00
Eric Andersen 6fb4e4877a Fix buffer overflows noted by Gerardo Puga
-Erik
2002-06-06 14:24:57 +00:00
Eric Andersen 0d2d1eb599 Fix a buffer overflow found by Gerardo Puga <gpuga@gioia.ing.unlp.edu.ar>
-Erik
2002-06-06 13:33:01 +00:00
Eric Andersen 8610f91ebf Lets give this a try... 2002-06-06 13:00:47 +00:00
Eric Andersen 27d3766e0d Email addr fix 2002-06-06 12:59:13 +00:00
Eric Andersen ad79c0b629 Patch from Gyepi SAM <gyepi@praxis-sw.com>:
Fixed up domain removal for local domains. GNU traceroute does not do this. I
don't know why we do.  Fixed incorrect argument for reverse resolution.  Clean
up cruft that appears when CONFIG_FEATURE_TRACEROUTE_VERBOSE is defined
2002-06-06 12:24:51 +00:00
Eric Andersen 77d22c4abd Patch from Gyepi SAM <gyepi@praxis-sw.com>:
When DEBUG is defined
    1. need to include resolv.h (for _resinit())
    2. remove _() call around string. It appears to be a remnant of i18n or some such notion
2002-06-06 12:11:55 +00:00
Eric Andersen 1a92376f00 Patch from vodz to only setenv PATH when PATH changes, which is much
smarter than my quick fix.
2002-06-06 12:07:28 +00:00
Eric Andersen e90e741b1e Per discussion with vodz, Tim's changes do not seem to make sense.
Revert them.
 -Erik
2002-06-06 11:47:00 +00:00
Eric Andersen fc059090b6 last_patch41 from vodz to fix stty -F and similar 2002-06-06 11:35:29 +00:00
Eric Andersen ff7661d9de plug fd leak noticed by Russ Dill
-Erik
2002-06-05 07:11:32 +00:00
Robert Griebl 1fca558799 Bigger patch for (partial) tinylogin integration
- Made a new dir loginutils
- Moved all applets from pwd_grp to loginutils
- Added new applets su.c login.c to loginutils
- Made a new dir libpwdgrp
- Moved everything from pwd_grp/libpwd_grp there
- Added shadow.c to libpwdgrp
- Removed dir pwd_grp
- Added usage strings for login and su to usage.h
- Changed main Makefile to reflect the dir rearrangements
[Parts of this patch may overlap with my other two patches]
2002-06-04 20:45:46 +00:00
Robert Griebl ea1a63a201 Fix for broken handling off BusyBox's own pwd/grp implementations
[Parts of this patch may overlap with my other two patches]
2002-06-04 20:10:23 +00:00
Robert Griebl c9aca4561d Implement two types of suid/sgid support for BusyBox:
1) tinylogin like with compile time selection and a chown root.root
2) Runtime configurable via /etc/busybox.conf (docu is in the works)
[Parts of this patch may overlap with my other two patches]
2002-06-04 20:06:25 +00:00
Robert Griebl bc28f7a1e1 Cleaned up Erik's fgets -> read patch and fixed a buffer overflow 2002-06-04 19:33:58 +00:00
Eric Andersen c06391be0d Avoid stack munching stdio implementations.
-Erik
2002-06-04 13:28:43 +00:00
Robert Griebl 3b79370a7d Fixed a realloc bug found by Martin Volf 2002-06-02 09:36:12 +00:00
Manuel Novoa III b99cb64b80 Include busybox.h before testing CONFIG_LOCALE_SUPPORT. 2002-05-29 19:08:41 +00:00
Glenn L McGrath a94a06a38e Patch from Randolfe Averty to fixup package conflict checks, cleanup some memory leaks and reorganise dependency checking.
Some further memory leaks fixed by me.
2002-05-29 13:45:34 +00:00
Robert Griebl 1d4ef2a9e9 Added support for /etc/modules.conf parsing
for now only the 'alias' entries are evaluated
2002-05-28 21:32:10 +00:00
Robert Griebl 53146cc9ec Added include for isdigit(); simplified -<num> detection 2002-05-27 22:24:53 +00:00
Eric Andersen 8302c43265 Ensure that insmod supports at least one MODULE_INTERFACE
-Erik
2002-05-24 06:59:22 +00:00
Eric Andersen cffd5022c5 Patch from Magnus Damm <damm@opensource.se> to rework things
greatly, and keep the arch specific relocations together,
fixes R_PPC_ADDR32 handling so powerpc can work, and changes the
tlb tables to be linked lists (again so powerpc can work).
2002-05-24 06:50:15 +00:00
Robert Griebl d11edf9809 Made exit code SysV compliant. Also added -s (single pid) flag. 2002-05-22 23:38:12 +00:00
Robert Griebl 236abbfd71 Some cleanups, some size reductions and some buffer overflow checks
Most of it based on ideas from vodz
2002-05-22 23:34:35 +00:00
Robert Griebl 94a6a956f0 Support old-style compress (.Z) files via libbb / unzip( ) calls
(configurable) - When enabled an applet "uncompress" is also made
available (oddname to gunzip)
[the cvs add for this file got lost somehow...]
2002-05-19 19:00:14 +00:00
Tim Riker c6def44cfc ping return 1 if can't ping 2002-05-18 09:16:04 +00:00
Robert Griebl 13c26fc1a5 SUpport old style -[::digit::] options for head and tail
Also make head behave like GNU head (-0/-n 0 is valid)
2002-05-17 22:18:04 +00:00
Robert Griebl c30c5e89cf Reduced code size for new -e flag (suggested by vodz) 2002-05-16 19:14:15 +00:00
Eric Andersen d8636cad4d Doh! Remember to close /etc/inittab 2002-05-15 22:19:09 +00:00
Robert Griebl f6495eb767 Support old-style compress (.Z) files via libbb / unzip( ) calls
(configurable) - When enabled an applet "uncompress" is also made
available (oddname to gunzip)
2002-05-15 22:13:47 +00:00
Robert Griebl 7ac868460a gunzip'ing many files to stdout works now
Fixed a missing initialisation and made a for loop more readable.
2002-05-15 21:57:42 +00:00
Robert Griebl 081df62b92 Don't delete source file when decompressing to stdout
This is the normal GNU gunzip behaviour
2002-05-15 21:45:52 +00:00
Robert Griebl 52e8d060a9 Complete rewrite to support stack loading/unloading with proper
handling of duplicates in the dependencies list.
2002-05-14 23:42:08 +00:00
Robert Griebl d77601178d Added support for -Y|--proxy=on/off to wget 2002-05-14 23:36:45 +00:00
Robert Griebl 64f70cc755 Add --login support. This is the bash way of starting a shell that should
parse the profile files.
2002-05-14 23:22:06 +00:00
Robert Griebl 8187bb4394 This patch adds -e (extended information) to route and -r/-e (show routing
tables/extended information) to netstat.
This makes them behave (more) like their GNU counterparts.
2002-05-14 23:10:58 +00:00
Robert Griebl 820098fd61 This patch adds -e (extended information) to route and -r/-e (show routing
tables/extended information) to netstat.
This makes them behave (more) like their GNU counterparts.
2002-05-14 23:03:23 +00:00
Robert Griebl aa385d4015 Entries with "noauto" options are ignored correctly when mounting all
("mount -a"), but mount fails when these entries are specified explicitly
In these cases the "noauto" option has to be simply ignored.
2002-05-14 22:56:29 +00:00
Eric Andersen f63a20ad7b Tom Oehser noticed that we were lacking the SO_REUSEADDR flag. 2002-05-05 03:40:14 +00:00
Eric Andersen 864b79791a Patch from Robert Griebl <griebl@gmx.de> to support modprobe -r properly,
merged in with the latest and greatest.
2002-05-03 15:48:26 +00:00
Eric Andersen 26920c6c94 Make verbose and show_only work as expected
-Erik
2002-05-03 15:22:42 +00:00
Eric Andersen c088c582bf Patch from Robert Griebl <griebl@gmx.de> to ignore the -s flag 2002-05-03 10:34:35 +00:00
Tim Riker 95bf6da637 fix and shrink uuencode 2002-05-01 05:57:16 +00:00
Matt Kraai a4a65e7f99 * archival/gunzip.c (gunzip_file): New.
(gunzip_main): Handle no arguments correctly.
2002-04-29 15:32:32 +00:00
Eric Andersen 051e4c15db Update website 2002-04-27 12:16:48 +00:00
Eric Andersen d598d41110 Fix silly combinitorial oversight 2002-04-27 09:19:39 +00:00
Eric Andersen 1372780662 Patch from Cliff L. Biffle <cbiffle@safety.net> to display memory
usage in the ps listing
2002-04-27 06:06:11 +00:00
Eric Andersen 3a01f8cae2 uClibc supports struct _res these days... 2002-04-27 04:06:55 +00:00
Eric Andersen ef38b39262 Support noerror option 2002-04-27 01:31:43 +00:00
Eric Andersen aba75460e4 When the .config file is missing, supply a default one
and run menuconfig
2002-04-27 00:06:47 +00:00
Eric Andersen 1323c940fd Add netcat -i option, per patch from Cristian Ionescu-Idbohrn
<cristian.ionescu-idbohrn@axis.com>
2002-04-26 23:59:12 +00:00
Eric Andersen 00a6a75035 Add the who applet, supplied by Da Chen <dchen@ayrnetworks.com> 2002-04-26 23:53:10 +00:00
Eric Andersen 1c31501b1b Ensure that getenv("PATH") stays current, since otherwise cmdedit
(which calls getenv("PATH")) would not operate upon the current
PATH settings, which was really quite iritating.
 -Erik
2002-04-26 23:40:09 +00:00
Eric Andersen 416340642d Fix bugs 2002-04-26 08:44:17 +00:00
Eric Andersen 8db361b3e5 Minor formatting 2002-04-26 08:00:33 +00:00
Tim Riker ed8e036360 add missing void, still has issues though 2002-04-26 07:53:39 +00:00
Tim Riker 86c76a9c2a fix from kergoth 2002-04-26 07:41:22 +00:00
Eric Andersen 0e28e1fa05 Forward port patch from Przemyslaw Czerpak <druzus@polbox.com>:
1. busybox-telnet dosn't inform server about the size of terminal screen.
    In the world of xterminals and frame buffers it's rather horrible
    to use fixed 80x24 region in upper-left corner of screen/window.

 2. If client sends character 0x0d to the server then sends character 0x0a
   the server eat the second byte (0x0a) - it's described in telnet RFC.
    Client should send two bytes ( 0x0d + 0x0a or 0x0d + 0x00 ) insted of
    one 0x0d byte.

 3. busybox telnet implementation wasn't 8bit clean (look at 0xff byte).
    I need it because I have to use binray transfer like rz/sz. So when
    I resloved the problem (2) I corrected this one two.

This also contains a small cleanup patch from vodz, and some minor editing
by me.
2002-04-26 07:20:47 +00:00
Eric Andersen 60e56f5292 Reworked by Robert Griebl <griebl@gmx.de> to support proper
module dependancies.
2002-04-26 06:04:01 +00:00
Eric Andersen 54c14d7850 vodz noted this line (as imported from Debian) is wrong, and has since
been fixed upstream.
2002-04-24 23:14:06 +00:00
Eric Andersen ae1036185e Apply last_patch37 from vodz 2002-04-24 23:08:23 +00:00
Eric Andersen 5f6873621d ls could mis-color certain entries when previous commands
had failed.  Explicitly 0 out errno to prevent that.
2002-04-17 20:21:45 +00:00
Matt Kraai 272a95524f * networking/wget.c (wget_main): Check return value of safe_fwrite. 2002-04-17 15:33:24 +00:00
Matt Kraai a0782684fd * archival/bunzip2.c (bunzip2_main): Do not remove files if writing to standard
output.
* testsuite/bunzip2/bzcat-does-not-remove-compressed-file: New.
2002-04-15 15:01:37 +00:00
Eric Andersen 744ec1d549 Patch from Ben Low <ben@titr.uow.edu.au> to allow tftp to work
with stdin as well as stdout.
2002-04-15 07:40:27 +00:00
Eric Andersen 9fe5f98de4 Patch from Jim Treadway -- fix a missing "\" in usage.h 2002-04-13 14:48:51 +00:00
Eric Andersen c8459a5a8f Silly me 2002-04-13 14:44:42 +00:00
Eric Andersen 19732c6226 Teach makedevs to not segfault quite so much 2002-04-13 14:26:44 +00:00
Eric Andersen 4e116823f4 Patch from Larry Doolittle to teach syslogd to not give up when errno is EINTR 2002-04-13 14:07:32 +00:00
Eric Andersen fb24eb4f47 Cleanup make clean 2002-04-13 13:52:13 +00:00
Eric Andersen defd998c42 Patch from Kevin Hilman <khilman@equator.com> to fix potential
memory corruption from long pathnames in /etc/fstab.
2002-04-13 13:47:39 +00:00
Eric Andersen 1f30a41abe Add a 'make uninstall' target 2002-04-13 13:39:48 +00:00
Eric Andersen 5d8d4a674b Patch from Jim Treadway <jim@stardot-tech.com> to teach
pidof to not add trailing spaces when not needed.
2002-04-13 13:32:30 +00:00
Eric Andersen 65a0730c9f Patch from Jim Treadway and Vladimir Oleynik to Add CTRL-K
and fix CTRL-L support for cmdedit.c
2002-04-13 13:26:49 +00:00
Eric Andersen 3e6908b586 Sed can go into an infinite loop 2002-04-13 13:18:15 +00:00
Eric Andersen db7d5fca5f Stupid gcc always includes its own builtin strlen()... 2002-04-13 13:02:03 +00:00
Eric Andersen 4c9b68f0e0 Nice patch from Wolfgang Denk <wd@denx.de> to provide hush with
shell loops (for, while, until) and control operators (||, &&)
2002-04-13 12:33:41 +00:00
Eric Andersen a66a43e8ef Teach tftp to direct the fetched file to stdout when the
user specifies "-l -"
 -Erik
2002-04-13 09:30:25 +00:00
Eric Andersen d75ac02a4f Rework per how I did things in version in 0.60.3 so it can
properly uncompress multiple files now.
 -Erik
2002-04-13 09:10:34 +00:00
Eric Andersen 114de55668 Patch from Laurence Anderson <L.D.Anderson@warwick.ac.uk> for
better tape drive support in tar/cpio by using an intervening
pipe...
2002-04-13 08:43:01 +00:00
Eric Andersen 1d1d2f9b18 Update some missing copyright notices 2002-04-13 08:31:59 +00:00
Tim Riker 497a88506e make ash prompt the same as other shells if cmdedit and fancyprompt 2002-04-13 05:37:10 +00:00
Eric Andersen 85208e2ab9 Completely rework the config system so that it no longer annoys me to work on
the busybox development tree.  This eliminates the use of recursive make, and
once again allows us to run 'make' in a subdirectory with the expected result.
And things are now much faster too.  Greatly improved IMHO...
 -Erik
2002-04-12 12:05:57 +00:00
Eric Andersen b1591d1f8b Fix handling of endianness.
-Erik
2002-04-12 00:28:59 +00:00
Eric Andersen a3603e845e Oldnews 2002-04-11 20:40:00 +00:00
Eric Andersen 265d229427 Patch from Edward Betts <edward@debian.org> to add -x switch to du.c 2002-04-06 23:16:44 +00:00
Eric Andersen fcffa2cc1a Apply lash_patch35 from vodz, which brings several nice size_optimizations. 2002-04-06 05:17:57 +00:00
Eric Andersen 50e4d660ac Fix email addr 2002-04-06 05:15:46 +00:00
Eric Andersen 45673d2cc0 Add fli4l 2002-04-03 14:30:58 +00:00
Matt Kraai 5c69cd84ff * editors/sed.c (process_file): Stop processing deleted lines.
* testsuite/sed/sed-does-not-substitute-in-delete-line: New.
2002-04-01 16:17:37 +00:00
Miles Bader 75ce8d7c88 Tweak my credit (ah, vanity...) 2002-04-01 14:25:51 +00:00
Miles Bader 130bec5ad8 Add insmod support for the NEC v850e processor. 2002-04-01 09:37:27 +00:00
Miles Bader ae28b04ff2 Add support for the NEC v850e processor. 2002-04-01 09:34:25 +00:00
Eric Andersen c57e42b8f0 Provide a controlling tty to askfirst processes as well
-Erik
2002-03-29 00:59:44 +00:00
Matt Kraai 8a8308f129 * testsuite/which/which-uses-default-path: Remove extra echo. 2002-03-27 23:19:17 +00:00
Matt Kraai 66388f89a5 * testsuite/grep/egrep-supports-extended-regexps: Check exit status instead
of output.
2002-03-27 22:56:19 +00:00
Matt Kraai 50aec98e1c * testsuite/bunzip2/bunzip2-reads-from-standard-input: Remove -c flags.
* testsuite/gunzip/gunzip-reads-from-standard-input: Likewise.
2002-03-27 22:48:39 +00:00
Matt Kraai 6feaeace86 * testsuite/COPYING: Remove. 2002-03-27 22:43:47 +00:00
Matt Kraai cf32ac543c * archival/bunzip2.c (bunzip2_main): Remove compressed file.
* testsuite/bunzip2/bunzip2-removes-compressed-file: New.
2002-03-27 17:46:44 +00:00
Matt Kraai 35d60421b4 * testsuite/runtest (run_applet_testcase): Return test case status, not
process ID.
2002-03-27 17:33:31 +00:00
Matt Kraai 9cdb0601eb * archival/bunzip2.c: Include <unistd.h>.
(bunzip2_main): Read data from standard input if FILE argument is `-' or
  omitted.
* include/usage.h (bunzip2_trivial_usage, bunzip2_full_usage): Rewrite.
* testsuite/bunzip2/bunzip2-reads-from-standard-input: New.
2002-03-27 17:31:01 +00:00
Manuel Novoa III fa15f702d2 Work around compiler/assembler problem and reduce code size at the same time. 2002-03-25 02:37:20 +00:00
Matt Kraai ef8b112d77 * archival/gzip.c (gzip_main): Ensure that the output is a terminal and use
error_msg to display the error message.
2002-03-22 22:55:51 +00:00
Eric Andersen b88868276c Doh! I broke ping when removing the nested function.
This patch from vodz fixes it again.
2002-03-21 14:04:43 +00:00
Matt Kraai 83788da250 * include/applets.h (CONFIG_LOSETUP): New.
* include/usage.h (losetup_trivial_usage, losetup_full_usage): New.
* util-linux/Makefile: Add losetup.o.
* util-linux/config.in: Add losetup prompt.
* util-linux/losetup.c: New.
2002-03-20 17:38:37 +00:00
Eric Andersen 27eff033d2 Eliminate extra trailing space 2002-03-20 16:10:54 +00:00
Eric Andersen c7a3fb96d0 Fix devfs loop device support 2002-03-20 15:25:25 +00:00
Eric Andersen b0cc0a6ca8 Rewind messages to avoid weird formatting, and fix a bug with
CONFIG_FEATURE_EXTRA_QUIET, which was broken
2002-03-20 14:57:50 +00:00
Eric Andersen 889a301a0c Patch from vodz to fix a potential segfault 2002-03-20 14:31:15 +00:00
Eric Andersen 900c24dc4e Patch from Jeff Studer <jstuder@aquilagroup.com> to supply a defaults for
localfilename from remotefilename, and for remotefilename from localfilename
when the other one is not supplied.
2002-03-20 14:25:27 +00:00
Eric Andersen 5a40651046 Update dmalloc options per suggestion from Glenn 2002-03-20 14:16:31 +00:00
Eric Andersen 89de1e7930 Reinitialize initial shift register value for on each pass.
-Erik
2002-03-20 13:30:40 +00:00
Eric Andersen b5474c48b1 Cave to pressure (2 months later). Eliminate using a
nested function, which is a purely unremovable gcc-ism...
 -Erik
2002-03-20 11:59:28 +00:00
Eric Andersen b159146fa6 Add missing " " after the word on, as reported by Jason Luther
back in mid-december.
 -Erik
2002-03-20 09:52:45 +00:00
Eric Andersen 3ad0bd9563 Patch from J.W.Janssen <JanWillem.Janssen@lxtreme.nl> to provide
color ls support, modifed by me to behave properly when not running
output to a terminal (i.e. 'ls | more')
 -Erik
2002-03-20 09:13:48 +00:00
Eric Andersen 3ec5c692ec Bart Visscher noticed some spurious search and replace silliness
-Erik
2002-03-20 01:32:25 +00:00
Matt Kraai aee53f4604 * testsuite/grep/egrep-is-not-case-insensitive: Require
CONFIG_FEATURE_GREP_EGREP_ALIAS.
2002-03-19 23:47:49 +00:00
Matt Kraai b3de66869b * testsuite/grep/grep-handles-binary-files: Read input from a pipe.
* testsuite/grep/grep-matches-NUL: Likewise.
2002-03-19 23:46:16 +00:00
Matt Kraai 0efab3319d * networking/wget.c (parse_url): Allocate a string for the empty path.
* testsuite/wget/wget-handles-empty-path: New.
2002-03-19 15:22:42 +00:00
Matt Kraai 3b1cbd7bec Thomas Lundquist
* docs/new-applet-HOWTO.txt: Update for new directory structure.
2002-03-18 16:03:00 +00:00
Eric Andersen 38ddbed4c1 Try to pull in PATH_MAX properly 2002-03-16 02:12:30 +00:00
Eric Andersen 08ed1a73f1 Don't mention ldconfig 2002-03-13 17:26:39 +00:00
Eric Andersen 806c74fe19 Cleanup a libc5 compatibility hack 2002-03-12 00:35:40 +00:00
Eric Andersen f64c1cd26d Fix broken link 2002-03-10 22:01:51 +00:00
Matt Kraai a1bbde71bf list_single: Declare scratch iff CONFIG_FEATURE_LS_USERNAME is defined. 2002-03-08 16:25:33 +00:00
Matt Kraai 3bd31ebc9a * fileutils/ls.c (showfiles): Display multiple short names on a line. 2002-03-08 16:16:38 +00:00
Eric Andersen 372f91f07c Update 2002-03-06 11:13:51 +00:00
Eric Andersen bc12fb79fd Update webpage to note new mirrors 2002-03-06 10:28:55 +00:00
Eric Andersen 1b17b01584 Now that we are mirrored, remove absolute links 2002-03-05 15:55:59 +00:00
Eric Andersen 0298be88ae Update init.c per my changes in the stable branch
-Erik
2002-03-05 15:12:19 +00:00
Eric Andersen 684d745bf3 Update robots.txt 2002-03-02 16:43:30 +00:00
Eric Andersen 02a4ed9264 A few more little cleanups to simplify mirroring 2002-03-02 16:42:46 +00:00
Eric Andersen 49da8a83ad Update the cvs commit info. Remove the old busybox.lineo.com stuff. 2002-03-02 15:39:06 +00:00
Matt Kraai a99b194336 * libbb/xfuncs.c (xmalloc, xcalloc): Do not exit if a zero-length buffer is
requested.
  (xrealloc): Simplify.
2002-02-26 15:28:22 +00:00
Matt Kraai eed9451cf6 * findutils/grep.c (grep_main): Remove unnecessary use of junk. 2002-02-22 22:08:16 +00:00
Matt Kraai fa144713b8 * testsuite/runtest (show_result): Change UPASS to XPASS.
(run_applet_testcase): Likewise.
2002-02-19 23:54:42 +00:00
Matt Kraai 6b140ea5a9 * testsuite/README: Change "UNSUPPORTED" tag to "FEATURE".
* testsuite/runtest (run_applet_testcase): Likewise.
* testsuite/cp/cp-preserves-hard-links: Likewise.
* testsuite/grep/egrep-supports-extended-regexps: Likewise.
* testsuite/grep/grep-is-also-egrep: Likewise.
* testsuite/tar/tar-archives-multiple-files: Likewise.
* testsuite/tar/tar-handles-empty-include-and-non-empty-exclude-list:
  Likewise.
* testsuite/tar/tar-handles-exclude-and-extract-lists: Likewise.
* testsuite/tar/tar-handles-nested-exclude: Likewise.
2002-02-19 23:43:08 +00:00
Matt Kraai 7c71822809 * testsuite/runtest (run_applet_testcase): Return UNTESTED instead of
UNSUPPORTED for missing applets and features.
2002-02-19 23:38:08 +00:00
Matt Kraai b5b757eb8d * testsuite/README: Fill to 80 columns. 2002-02-19 23:20:52 +00:00
Matt Kraai 6be2319873 * testsuite/README: Update copyright date. 2002-02-19 23:19:46 +00:00
Matt Kraai ad6faf6497 * testsuite/tar/tar-archives-multiple-files: Require
CONFIG_FEATURE_TAR_CREATE.
2002-02-19 23:15:41 +00:00
Matt Kraai 4271d438e2 * docs/busybox.net/index.html (Products/Projects Using BusyBox): Added
Tinfoil Hat Linux.
2002-02-19 22:58:26 +00:00
Eric Andersen d4574f1b61 fix name 2002-02-17 22:42:30 +00:00
Matt Kraai c00e4ff8e5 * testsuite/tar/tar-archives-multiple-files: New. 2002-02-17 18:42:52 +00:00
Eric Andersen 3b7767abe6 Add in tuxscreen 2002-02-16 22:17:33 +00:00
Eric Andersen 796245b554 Update sponsor section 2002-02-16 22:08:28 +00:00
Eric Andersen 8fd6e1fb0f Add in a sponsors link, and update the screenshot. 2002-02-16 21:50:34 +00:00
Eric Andersen d7f7bd0445 Add Partition Image 2002-02-16 18:48:55 +00:00
Glenn L McGrath 02a415606c Parse the include list to writeTarFile rather than argv, fixes a bug where tar files wernt being created. 2002-02-15 05:15:03 +00:00
Glenn L McGrath 8833a51781 Fix condition that prevented creation of compressed files 2002-02-13 03:32:11 +00:00
Matt Kraai 9bd49d6a22 * archival/gzip.c (ifname, ofname): Delete.
(gzip_main): Handle multiple files.
* include/usage.h (gzip_trivial_usage): Allow multiple FILEs.
  (gzip_full_usage): Ditto.
* testsuite/gzip/gzip-accepts-multiple-files: New.
* testsuite/gzip/gzip-removes-original-file: New.
2002-02-05 22:31:48 +00:00
Matt Kraai 592a3e63ee * archival/gzip.c (gzip_main): Display usage if given multiple files. 2002-02-05 19:34:53 +00:00
Matt Kraai 273af73317 * include/usage.h (gzip_trivial_usage): Make FILE optional.
(gzip_full_usage): Note behavior when FILE is unspecified.
2002-02-05 19:25:29 +00:00
Matt Kraai eb83478528 * fileutils/dd.c (dd_main): Ignore ftruncate error if the output is not a
file or directory.
2002-02-05 15:28:54 +00:00
Matt Kraai 369da77d5e 2002-01-30 Neal H Walfield <neal@cs.uml.edu>
* networking/ping.c (hostname): Removed.

        [CONFIG_FEATURE_FANCY_PING] (noresp): Moved from here . . .
        [CONFIG_FEATURE_FANCY_PING] (ping:noresp): . . . to here.
        Use H->h_name, not hostname.
        [CONFIG_FEATURE_FANCY_PING] (ping): Do not copy H->h_name into
        hostname.
        Use H->h_name directly.

        [!CONFIG_FEATURE_FANCY_PING] (hostent): New global variable.
        [!CONFIG_FEATURE_FANCY_PING] (pingstats): Use hostent in favor
        of the now obsolete hostname global variable.
        [!CONFIG_FEATURE_FANCY_PING] (ping): Likewise.
        No need to copy H; use hostent instead.

        [!CONFIG_FEATURE_FANCY_PING] (ntransmitted, nreceived,
        nrepeats, pingcount, myid, options, tmax, tsum): Removed
        superfluous zero initializers.
2002-02-01 16:54:00 +00:00
Eric Andersen 20d739adf7 If PATH_MAX isn't defined, define it outselves 2002-01-26 23:58:22 +00:00
Eric Andersen 53a2299230 Patch from Russ Dill <Russ.Dill@asu.edu>. From the
start-stop-daemon man page:

-b|--background
        Typically used with programs that don't detach on their own.
        This option will force start-stop-daemon to fork before starting
        the process, and force it into the background. WARNING:
        start-stop-daemon cannot check the exit status if the process
        fails to execute for any reason. This is a last resort, and is
        only meant for programs that either make no sense forking on
        their own, or where it's not feasible to add the code for it to
        do this itself.

This is usefull for applets like watchdog
2002-01-26 09:04:45 +00:00
Eric Andersen 467a18b1d9 Teach 'init -q' that init's pid may not equal 1 2002-01-25 23:13:06 +00:00
Matt Kraai a3181dd833 Do not segfault if PATH is unset. 2002-01-14 18:30:10 +00:00
Eric Andersen ba552523fa Remove broken "Other cool embedded software" link 2002-01-13 03:01:02 +00:00
Eric Andersen d35c5df08c Make private ash config options be public 2002-01-09 15:37:36 +00:00
Matt Kraai b75b6e2c35 * archival/tar.c (tar_main): Remove unused variable. 2002-01-08 16:03:41 +00:00
Eric Andersen 038cbc7442 Oops. 2002-01-06 01:10:25 +00:00
Eric Andersen c94e89d81f Do not depend on PATH or getopt arg reordering 2002-01-06 01:08:28 +00:00
Eric Andersen db2b9f37d4 Somehow ttylinux got lost. Put it back.
-Erik
2002-01-05 16:56:43 +00:00
Eric Andersen 8ec99dfa05 Update links to avoid possible lingering DNS problems
(and thereby test if I have the Reply-to thing really
fixed this time)...
 -Erik
2002-01-05 05:34:31 +00:00
Matt Kraai d402f971a5 * docs/busybox.net/index.html: Fix misspelling of `Unfortunately'. 2002-01-04 16:54:39 +00:00
Eric Andersen eeba178d3a More updates 2002-01-04 05:12:14 +00:00
Eric Andersen 7d957c6573 More pics 2002-01-04 05:11:49 +00:00
Eric Andersen 665b4e69ed Update text once again 2002-01-04 05:04:15 +00:00
Eric Andersen 7875f5b72a Fix grammar (thanks to my wife for proof reading) 2002-01-04 04:24:27 +00:00
Eric Andersen 55ed17747f Fix link 2002-01-04 00:34:22 +00:00
Eric Andersen 4fa2bb5e95 Update busybox.net info and donation noise 2002-01-04 00:32:15 +00:00
Matt Kraai 9eaf059d28 * editors/sed.c (parse_cmd_str): Remove redundant code to skip initial
whitespace.
2002-01-03 21:19:19 +00:00
Matt Kraai 5ed78adca5 * editors/sed.c (parse_edit_cmd): Rewrite.
* testsuite/sed/sed-splits-edit-commands-on-command-line: New.
2002-01-03 21:12:34 +00:00
Matt Kraai d299563257 * AUTHORS (Matt Kraai): Update e-mail address. 2002-01-03 18:29:37 +00:00
Matt Kraai 9758e7d58d * include/usage.h: Fix route and unzip usage messages (patch from
Laurence Anderson).
2002-01-03 17:32:29 +00:00
Matt Kraai f3fbe20c35 * cmp/cmp-detects-difference: Simplify return code negation.
* false/false-returns-failure: Likewise.
* tar/tar-demands-at-least-one-ctx: Likewise.
* tar/tar-demands-at-most-one-ctx: Likewise.
2002-01-02 20:45:42 +00:00
Matt Kraai 01d2ea908b * testsuite/README: Document -v option.
* testsuite/runtest: Handle -v option.
  (show_result): New.
  (run_applet_testcase): Call it.
2002-01-02 20:37:59 +00:00
Matt Kraai 39fcb5a750 * archival/dpkg.c (create_list): Use chomp.
* archival/tar.c (append_file_list_to_list): Likewise.
2002-01-02 19:01:41 +00:00
Matt Kraai 0733e840bd chomp should only remove the newline if it occurs at the end of the input.
This was caught by the test suite (in sed/sed-aic-commands).

* libbb/chomp.c: Revert to revision 1.5.
2002-01-02 18:51:23 +00:00
Matt Kraai d21735de2d * editors/sed.c (parse_edit_command): Require a newline after the backslash
after an edit command.
* testsuite/sed/sed-requires-newline-after-edit-command: New.
2002-01-02 17:56:38 +00:00
Glenn L McGrath 87ac7028e0 unzip applet by Laurence Anderson
----------------------------------------------------------------------
2002-01-02 13:52:26 +00:00
Aaron Lehmann 438803311b ash patch: errname-diff 2001-12-31 06:16:54 +00:00
Aaron Lehmann 9a218bf979 ash patch: initvar-diff 2001-12-31 06:13:38 +00:00
Aaron Lehmann 1a6986699f ash patch: forkshell-diff 2001-12-31 06:12:48 +00:00
Aaron Lehmann eec2bbb9bf ash patch: fgcmd-diff 2001-12-31 06:07:57 +00:00
Aaron Lehmann 2aef3a6bb9 ash patch: breakcmd-diff 2001-12-31 06:03:12 +00:00
Aaron Lehmann 95877b6756 ash patch: addfname-diff 2001-12-31 06:00:57 +00:00
Eric Andersen 79a466f128 optimize this a little bit. 2001-12-29 07:26:33 +00:00
Eric Andersen 6d13964714 Silence some silly warnings
-Erik
2001-12-29 04:15:13 +00:00
Eric Andersen e7dd383f67 Link to udhcp 2001-12-22 19:28:24 +00:00
Eric Andersen b9c0b99e51 Update URLs and email addresses 2001-12-22 00:37:54 +00:00
Matt Kraai 70624846fd Ignore blanks before the first address and before the command. 2001-12-21 16:04:12 +00:00
Matt Kraai 1fcc66e685 New. 2001-12-21 15:54:25 +00:00
Eric Andersen ceef50b280 Patch from vodz to fix broken function prototype 2001-12-21 11:22:26 +00:00
Eric Andersen f1f2bd0b0a Patch from vodz to implement ^L (clear screen) 2001-12-21 11:20:15 +00:00
Eric Andersen 9910cd2869 Update TODO. vodz has implemented ^L. Reverse policy on tinylogin.
-Erik
2001-12-21 11:18:36 +00:00
Matt Kraai 1f0c43668a Remove == TRUE' tests and convert != TRUE' and `== FALSE' tests to use !. 2001-12-20 23:13:26 +00:00
Matt Kraai 31c73af656 Perform clean up only if CONFIG_FEATURE_CLEAN_UP is defined. 2001-12-20 22:30:14 +00:00
Matt Kraai 2b1effdbbc Write files when extracting an archive from standard input. 2001-12-20 22:09:31 +00:00
Matt Kraai c5b5cab37d Remove dependence on CONFIG_FEATURE_CLEAN_UP. 2001-12-20 21:13:18 +00:00
Matt Kraai 38c15becf6 Avoid printing a trailing blank character. 2001-12-20 21:11:59 +00:00
Eric Andersen 5a841adf5d Switch from FTP to HTTP for downloads 2001-12-20 08:04:56 +00:00
Eric Andersen fb74a45088 Vodz' last_patch31
Very minimal last corrections:

    1) busybox.c: fix warining
    2) docs/: add applets for list from pwd_grp
    3) usage.h: add -n option for route
    4) run_parts.c: many todo fix for busybox style
    5) addgroup.c: add #ifdef CONFIG_FEATURE_SHADOWPASSWDS, reduce one
    perror_msg
    6) adduser.c: fix bug "variable i not initialize" and
       add #ifdef CONFIG_FEATURE_SHADOWPASSWDS
2001-12-18 14:06:03 +00:00
Eric Andersen f3f9062ecf Things like 'tar -c /tmp/*' and 'tar -cO /tmp/*' where the output
filename was not explicitly specified were segfaulting.
 -Erik
2001-12-18 00:57:55 +00:00
Eric Andersen 730f826f25 Add in a new restart init target, triggered by SIGHUP. Patch from
Russ Dill, with adjustments by me.
 -Erik
2001-12-17 23:13:08 +00:00
Matt Kraai ace02dc9cd Make cp and mv optionally preserve hard links. 2001-12-17 15:26:36 +00:00
Eric Andersen 46ea0e4696 * Add ^L clear to shell 2001-12-16 09:25:57 +00:00
Eric Andersen 6925d50176 Some minor usage cleanups from David Douthitt <ssrat@mailbag.com> 2001-12-16 09:23:09 +00:00
Eric Andersen de2a342289 Add a more verbose non-strip command. 2001-12-16 09:20:08 +00:00
Matt Kraai e62dc86bc7 Add support for big-endian ARM (initial patch by Mike Voytovich). 2001-12-14 16:08:17 +00:00
Matt Kraai 04ae328851 Update uClibc URL. 2001-12-12 19:09:51 +00:00
Matt Kraai 14b7c5d12b Open the source before creating the destination. 2001-12-11 16:43:48 +00:00
Matt Kraai 741f40b58e Use an int to hold the result of fgetc (bug noted by David Kimdon). 2001-12-11 16:06:02 +00:00
Eric Andersen 72812d3143 And a bit more 2001-12-08 02:14:02 +00:00
Eric Andersen a2e6908165 More polish 2001-12-08 02:13:05 +00:00
Eric Andersen 90c2abd212 Oops 2001-12-08 02:10:37 +00:00
Eric Andersen dec43433e5 Add in cvs info 2001-12-08 02:08:31 +00:00
Eric Andersen 2423b12dae Begin moving things to busybox.net
-Erik
2001-12-08 01:56:15 +00:00
Eric Andersen 05b5addcaa Use a local image, not an offsite one. 2001-12-08 00:18:20 +00:00
Matt Kraai 07a37aebf5 New. 2001-12-07 21:27:57 +00:00
Matt Kraai dba11452cb Continue processing files if we are asked to touch, but not create, a file
which doesn't exist.
2001-12-07 21:27:38 +00:00
Matt Kraai 1a781a499f Enable test only if CONFIG_FEATURE_GREP_EGREP_ALIAS is defined. 2001-12-07 21:24:25 +00:00
Eric Andersen 603557b466 Fix link name 2001-12-07 19:01:31 +00:00
Eric Andersen 089db51fbe Fix broken link 2001-12-07 19:00:30 +00:00
Matt Kraai 3eeab3b23f Update copyright and close file descriptors (noted by Axel Kittenberger). 2001-12-07 16:27:37 +00:00
Eric Andersen 6834ee941a Avoid NULL pointer problems. Patch from "Frank P. MacLachlan"
<fpm-plutus@tgs.indyme.com>
2001-12-06 21:33:55 +00:00
Matt Kraai 54805af092 Remove documentation for the --file option to hostname (noted by
David Douthitt).
2001-12-06 17:37:51 +00:00
Eric Andersen c98c06233e Merge in the cal applet from Steve Merrifield <steve@labyrinth.net.au> 2001-12-06 15:16:43 +00:00
Eric Andersen b24d65659f If find_pid_by_name() had an error, it was returning -1, but storing
that into a pid_t, which is unsigned on a number archs.  Furthermore,
find_pid_by_name() would _never_ return an error if the intended proces
was "init", but instead would return 1, meaning we would fail to work
on 2.4.x kernels running an initrd...
 -Erik
2001-12-06 14:52:32 +00:00
Eric Andersen 06656f363d Minor adjustment to the strip command 2001-12-06 14:44:11 +00:00
Eric Andersen db930948a9 More copyright and email addr cleanups 2001-12-06 08:20:14 +00:00
Eric Andersen 463304edfd Silly cosmetic problem in the comment 2001-12-06 08:04:45 +00:00
Eric Andersen 356b6dbf86 Patch from Steve Merrifield <steve@labyrinth.net.au> to
fixup the merge of the time applet, which I messed up.
 -Erik
2001-12-06 07:42:04 +00:00
Eric Andersen 0ee0a8d539 Fix running more on files in the (broken) procfs that claim 0 length
when that isn't actually true.
 -Erik
2001-12-06 07:24:29 +00:00
Aaron Lehmann b6ecbdc07d The ash ansification diff!
Please tell me if you notice any problems resulting from this.
2001-12-06 03:37:38 +00:00
Aaron Lehmann ebd8065f38 Trying to commit Changelog and TODO. cvs is being weird :/ 2001-12-06 03:32:12 +00:00
Aaron Lehmann 2dd2d7a37d Patch to avoid warnings 2001-12-06 03:29:37 +00:00
Aaron Lehmann b9df470c4d Commit my improvement on Rodney Brown's patch to g(un)zip, decreasing
binary size.
2001-12-06 03:22:43 +00:00
Glenn L McGrath 249f39a265 Simplify unzip(), remove unused checks and unneccessary variables 2001-12-05 16:01:02 +00:00
Glenn L McGrath ef03dbcd4d Simplify CRC table generation 2001-12-05 13:08:03 +00:00
Glenn L McGrath aad44fb37a Fix some fegfaults and picket fence 2001-12-05 04:40:52 +00:00
Manuel Novoa III 3280f9a3fc New version to cut size. Includes optional basename() compatibility, but
enabling that would break the basename applet at least for one corner case.
2001-12-05 04:35:32 +00:00
Manuel Novoa III 6509f92a3b Combined size reduction changes by Glenn and myself. Added back in "unknown"
for -p to match normal uname behavior (at a cost of 30-40 bytes).
2001-12-05 04:21:30 +00:00
Glenn L McGrath 1dbbd2fe34 Fail gracefully if package depends on a virtual package. 2001-12-05 04:10:14 +00:00
Eric Andersen ed8a9be287 Patch from Dan Langlois <dan@somanetworks.com> Support SIGSTOP/SIGCONT
for wierd situations when people want init to actualy stop doing
anything for a while...
2001-11-30 19:10:58 +00:00
Eric Andersen c3657428d3 Add in a 'time' applet. Adds 4.5k.
-Erik
2001-11-30 07:54:32 +00:00
Glenn L McGrath 38288bbf4c gunzip was incorrectly reporting a failed crc and length (discovered by
Chang, Shu-Hao).  The bitbuffer needs to be unwound after decompression,
as it was eating into the crc/size field.
2001-11-29 06:36:56 +00:00
Matt Kraai 8a35c9a557 Add space before module name (noted by Ron Yorston). 2001-11-27 17:28:01 +00:00
Glenn L McGrath 9e6c9f7311 Minor space saving improvments 2001-11-21 12:46:36 +00:00
Glenn L McGrath 74afa9aed1 When just counting chars of a file stat file instead of reading the whole file (Fixes Debian bug #103302) 2001-11-21 10:26:28 +00:00
Glenn L McGrath c29ab97094 woops. dotn pass NULL 2001-11-21 10:01:29 +00:00
Glenn L McGrath 1477ad8e83 Simplify print function, prints an extra space if no filename, but saves 4 bytes 2001-11-21 09:58:29 +00:00
Glenn L McGrath 02d090d3d2 Use enums for selected functionality, Reduce the size by nearly 100 Bytes 2001-11-21 09:17:00 +00:00
Eric Andersen 2480e3a30a Fix dangling comma 2001-11-21 09:05:31 +00:00
Matt Kraai 1dbd6ff80f New. 2001-11-20 16:04:22 +00:00
Matt Kraai 585f657e2d Fix undeclared variable error. 2001-11-20 16:00:44 +00:00
Matt Kraai 0c390a76fe Eliminate warning. 2001-11-20 16:00:19 +00:00
Matt Kraai fd3f1be57f New. 2001-11-20 15:49:55 +00:00
Matt Kraai 355a61b56f Treat NUL as the end-of-line. 2001-11-20 15:49:50 +00:00
Eric Andersen 66c22051f9 More grammar fixes 2001-11-20 12:40:37 +00:00
Eric Andersen dbdc0d5da9 grammer error 2001-11-20 12:36:28 +00:00
Eric Andersen 4d7f9c3d99 Update the website 2001-11-20 11:56:51 +00:00
303 changed files with 27321 additions and 13554 deletions

No files matched your search

+1 -1
View File
@@ -45,7 +45,7 @@ Karl M. Hegbloom <karlheg@debian.org>
Daniel Jacobowitz <dan@debian.org>
mktemp.c
Matt Kraai <kraai@alumni.carnegiemellon.edu>
Matt Kraai <kraai@alumni.cmu.edu>
documentation, bugfixes, test suite
John Lombardo <john@deltanet.com>
+33 -2
View File
@@ -7,7 +7,10 @@
New Applets:
* Erik Andersen -- Merged several applets from tinylogin,
namely adduser, addgroup, deluser, delgroup, getty.
* Robert Griebl <sandman@handhelds.org>
-- reimplemented tinylogin applets: su, login
-- added hwclock
-- added uncompress
Other Changes:
@@ -15,7 +18,7 @@
-- a whole bunch of ash size optimizations
-- Fix for ash leading redirections (i.e. '2>/dev/null ls rubbish')
* Rodney Brown <RDBrown@mira.net>
-- Optimized gzip.c, shrinking it be ~1.5k
-- Optimized gzip.c, shrinking it by ~1.5k
* Matt Kraai
-- Fix sed s/[/]// handling (closes: #1208).
-- Fix `-/bin/sh' invocation (closes: #1209).
@@ -32,7 +35,35 @@
applets, fix print nslookup server name if compile without
uClibc, fix route crashe 'route add', fix warnings compile
networking and pwd_grp applets
* Tim Riker <Tim@Rikers.org>
-- fix and shrink uuencode
-- allow tty* in inittab if exist, serial console is not the issue
* Robert Griebl <sandman@handhelds.org>
-- added suid/sgid handling with 3 modes to busybox:
1) completly disabled
2) tinylogin like
3) runtime configureable via /etc/busybox.conf
-- modprobe: complete rewrite, supports modules.dep, parses
modules.conf for alias and options and can be called
from the kernel.
-- tar: support for -z when creating archives
-- wget: support for -Y|--proxy=on/off and --passive-ftp
-- vi: support for ":x"
-- date: support for -I (ISO format)
-- find: support for -xdev
-- mount: support for -t in list mode, parsing of /etc/filesystems
-- ash: support for --login (bash like)
-- route: support for -e
-- netstat: support for -e and -r
-- head/tail: support for old style -[0-9] options
-- sed: support for ! and \CregexpC
-- pidof: support for -s
-- nslookup: support for user specified name server
-- logger: fixed logging of '<' characters
-- ash: fixed crash when run in a rxvt window
-Erik Andersen, --not yet released--
+69 -221
View File
@@ -1,6 +1,6 @@
# Makefile for busybox
#
# Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
# Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,171 +17,13 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
PROG := busybox
VERSION := 0.61.pre
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
TOPDIR := ${shell /bin/pwd}
HOSTCC := gcc
HOSTCFLAGS:= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
# What OS are you compiling busybox for? This allows you to include
# OS specific things, syscall overrides, etc.
TARGET_OS := linux
# With a modern GNU make(1) (highly recommended, that's what all the
# developers use), all of the following configuration values can be
# overridden at the command line. For example:
# make CROSS=powerpc-linux- CONFIG_SRC_DIR=$HOME/busybox PREFIX=/mnt/app
# If you want to add some simple compiler switches (like -march=i686),
# especially from the command line, use this instead of CFLAGS directly.
# For optimization overrides, it's better still to set OPTIMIZATION.
CFLAGS_EXTRA =
# If you want a static binary, turn this on.
DOSTATIC = false
# Set the following to `true' to make a debuggable build.
# Leave this set to `false' for production use.
DODEBUG = false
# This enables compiling with dmalloc ( http://dmalloc.com/ )
# which is an excellent public domain mem leak and malloc problem
# detector. To enable dmalloc, before running busybox you will
# want to first set up your environment.
# eg: `export DMALLOC_OPTIONS=debug=0x14f47d83,inter=100,log=logfile`
# Do not enable this for production builds...
DODMALLOC = false
# Electric-fence is another very useful malloc debugging library.
# Do not enable this for production builds...
DOEFENCE = false
# If you want large file summit support, turn this on.
# This has no effect if you don't have a kernel with lfs
# support, and a system with libc-2.1.3 or later.
# Some of the programs that can benefit from lfs support
# are dd, gzip, mount, tar, and mkfs_minix.
# LFS allows you to use the above programs for files
# larger than 2GB!
DOLFS = false
# If you have a "pristine" source directory, point CONFIG_SRC_DIR to it.
# Experimental and incomplete; tell the mailing list
# <busybox@opensource.lineo.com> if you do or don't like it so far.
CONFIG_SRC_DIR =
# If you are running a cross compiler, you may want to set CROSS
# to something more interesting, like "arm-linux-".
CROSS =
CC = $(CROSS)gcc
AR = $(CROSS)ar
AS = $(CROSS)as
LD = $(CROSS)ld
NM = $(CROSS)nm
STRIP = $(CROSS)strip
CPP = $(CC) -E
MAKEFILES = $(TOPDIR)/.config
export VERSION BUILDTIME TOPDIR HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
# To compile vs uClibc, just use the compiler wrapper built by uClibc...
# Everything should compile and work as expected these days...
#CC = /usr/i386-linux-uclibc/usr/bin/i386-uclibc-gcc
# To compile vs some other alternative libc, you may need to use/adjust
# the following lines to meet your needs...
#
# If you are using Red Hat 6.x with the compatible RPMs (for developing under
# Red Hat 5.x and glibc 2.0) uncomment the following. Be sure to read about
# using the compatible RPMs (compat-*) at http://www.redhat.com !
#LIBCDIR=/usr/i386-glibc20-linux
#
# The following is used for libc5 (if you install altgcc and libc5-altdev
# on a Debian system).
#LIBCDIR=/usr/i486-linuxlibc1
#
# For other libraries, you are on your own...
#LDFLAGS+=-nostdlib
#LIBRARIES = $(LIBCDIR)/lib/libc.a -lgcc
#CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR)
#GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
# use '-Os' optimization if available, else use -O2
OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null \
>/dev/null 2>&1; then echo "-Os"; else echo "-O2" ; fi}
GCC_STACK_BOUNDRY := ${shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc /dev/null \
>/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; else echo "" ; fi}
OPTIMIZATIONS=$(OPTIMIZATION) -fomit-frame-pointer $(GCC_STACK_BOUNDRY)
WARNINGS=-Wall -Wstrict-prototypes -Wshadow
CFLAGS = -I$(TOPDIR)/include
ARFLAGS = -r
#
#--------------------------------------------------------
# If you're going to do a lot of builds with a non-vanilla configuration,
# it makes sense to adjust parameters above, so you can type "make"
# by itself, instead of following it by the same half-dozen overrides
# every time. The stuff below, on the other hand, is probably less
# prone to casual user adjustment.
#
ifeq ($(strip $(DOLFS)),true)
# For large file summit support
CFLAGS+=-D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64
endif
ifeq ($(strip $(DODMALLOC)),true)
# For testing mem leaks with dmalloc
CFLAGS+=-DDMALLOC
LIBRARIES = -ldmalloc
# Force debug=true, since this is useless when not debugging...
DODEBUG = true
else
ifeq ($(strip $(DOEFENCE)),true)
LIBRARIES = -lefence
# Force debug=true, since this is useless when not debugging...
DODEBUG = true
endif
endif
ifeq ($(strip $(DODEBUG)),true)
CFLAGS += $(WARNINGS) -g -D_GNU_SOURCE
LDFLAGS += -Wl,-warn-common
STRIPCMD =
else
CFLAGS += $(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE
LDFLAGS += -s -Wl,-warn-common
STRIPCMD = $(STRIP) --remove-section=.note --remove-section=.comment $(PROG)
endif
ifeq ($(strip $(DOSTATIC)),true)
LDFLAGS += --static
endif
ifndef $(PREFIX)
PREFIX = `pwd`/_install
endif
# Additional complications due to support for pristine source dir.
# Include files in the build directory should take precedence over
# the copy in CONFIG_SRC_DIR, both during the compilation phase and the
# shell script that finds the list of object files.
# Work in progress by <ldoolitt@recycle.lbl.gov>.
#
ifneq ($(strip $(CONFIG_SRC_DIR)),)
VPATH = $(CONFIG_SRC_DIR)
endif
OBJECTS = $(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o
CFLAGS += $(CROSS_CFLAGS)
ifdef CONFIG_INIT_SCRIPT
CFLAGS += -DINIT_SCRIPT='"$(CONFIG_INIT_SCRIPT)"'
endif
# Put user-supplied flags at the end, where they
# have a chance of winning.
CFLAGS += $(CFLAGS_EXTRA)
.EXPORT_ALL_VARIABLES:
TOPDIR:= $(shell /bin/pwd)/
include $(TOPDIR).config
include $(TOPDIR)Rules.mak
SUBDIRS:=applets archival archival/libunarchive console-tools \
editors fileutils findutils init miscutils modutils networking \
procps loginutils shell shellutils sysklogd \
textutils util-linux libbb libpwdgrp
all: do-it-all
@@ -192,7 +34,8 @@ ifeq (.config,$(wildcard .config))
include .config
ifeq (.depend,$(wildcard .depend))
include .depend
do-it-all: busybox busybox.links doc
do-it-all: busybox busybox.links #doc
include $(patsubst %,%/Makefile.in, $(SUBDIRS))
else
CONFIGURATION = depend
do-it-all: depend
@@ -203,18 +46,9 @@ do-it-all: menuconfig
endif
SUBDIRS =applets archival archival/libunarchive console-tools editors \
fileutils findutils init miscutils modutils networking procps \
pwd_grp shell shellutils sysklogd textutils util-linux libbb
bbsubdirs: $(patsubst %, _dir_%, $(SUBDIRS))
$(patsubst %, _dir_%, $(SUBDIRS)) : dummy include/config/MARKER
$(MAKE) CFLAGS="$(CFLAGS)" -C $(patsubst _dir_%, %, $@)
busybox: config.h dep-files bbsubdirs
$(CC) $(LDFLAGS) -o $@ applets/busybox.o $(shell find $(SUBDIRS) -name \*.a) $(LIBCONFIG_LIB) $(LIBRARIES)
$(STRIPCMD)
busybox: depend $(libraries-y)
$(CC) $(LDFLAGS) -o $@ $(libraries-y) $(LIBRARIES)
$(STRIPCMD) $@
busybox.links: applets/busybox.mkll
- $(SHELL) $^ >$@
@@ -222,6 +56,9 @@ busybox.links: applets/busybox.mkll
install: applets/install.sh busybox busybox.links
$(SHELL) $< $(PREFIX)
uninstall: busybox busybox.links
for i in `cat busybox.links` ; do rm -f $$PREFIX$$i; done
install-hardlinks: applets/install.sh busybox busybox.links
$(SHELL) $< $(PREFIX) --hardlinks
@@ -249,15 +86,15 @@ docs/BusyBox.1: docs/busybox.pod
- pod2man --center=BusyBox --release="version $(VERSION)" \
$< > $@
docs/BusyBox.html: docs/busybox.lineo.com/BusyBox.html
docs/BusyBox.html: docs/busybox.net/BusyBox.html
- mkdir -p docs
-@ rm -f docs/BusyBox.html
-@ ln -s busybox.lineo.com/BusyBox.html docs/BusyBox.html
-@ ln -s busybox.net/BusyBox.html docs/BusyBox.html
docs/busybox.lineo.com/BusyBox.html: docs/busybox.pod
-@ mkdir -p docs/busybox.lineo.com
docs/busybox.net/BusyBox.html: docs/busybox.pod
-@ mkdir -p docs/busybox.net
- pod2html --noindex $< > \
docs/busybox.lineo.com/BusyBox.html
docs/busybox.net/BusyBox.html
-@ rm -f pod2htm*
@@ -285,55 +122,60 @@ docs/busybox.pdf: docs/busybox.ps
docs/busybox/busyboxdocumentation.html: docs/busybox.sgml
- mkdir -p docs
(cd docs/busybox.lineo.com; sgmltools -b html ../busybox.sgml)
(cd docs/busybox.net; sgmltools -b html ../busybox.sgml)
# The nifty new buildsystem stuff
scripts/mkdep: scripts/mkdep.c
$(TOPDIR)scripts/mkdep: scripts/mkdep.c
$(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
scripts/split-include: scripts/split-include.c
$(TOPDIR)scripts/split-include: scripts/split-include.c
$(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c
dep-files: scripts/mkdep
@if [ ! -f .depend ] ; then \
rm -f .depend .hdepend; \
mkdir -p $(TOPDIR)/include/config; \
scripts/mkdep -I $(TOPDIR)/include -- \
`find $(TOPDIR) -name \*.c -print` >> .depend; \
scripts/mkdep -I $(TOPDIR)/include -- \
`find $(TOPDIR) -name \*.h -print` >> .hdepend; \
$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)" ; \
fi;
depend dep: config.h dep-files
$(TOPDIR).depend: $(TOPDIR)scripts/mkdep
rm -f .depend .hdepend;
mkdir -p $(TOPDIR)include/config;
$(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
scripts/mkdep -I $(TOPDIR)include -- \
`find $(TOPDIR) -name \*.c -print` >> .depend;
scripts/mkdep -I $(TOPDIR)include -- \
`find $(TOPDIR) -name \*.h -print` >> .hdepend;
$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)" ;
@ echo -e "\n\nNow run 'make' to build BusyBox\n\n"
CONFIG_SHELL := ${shell if [ -x "$$BASH" ]; then echo $$BASH; \
depend dep: $(TOPDIR)include/config.h $(TOPDIR).depend
BB_SHELL := ${shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \
else echo sh; fi ; fi}
include/config/MARKER: scripts/split-include include/config.h
include/config/MARKER: depend $(TOPDIR)scripts/split-include
scripts/split-include include/config.h include/config
@ touch include/config/MARKER
config.h:
@if [ ! -f include/config.h ] ; then \
$(TOPDIR)include/config.h:
@if [ ! -f $(TOPDIR)include/config.h ] ; then \
make oldconfig; \
fi;
menuconfig:
mkdir -p $(TOPDIR)/include/config
$(TOPDIR).config:
@if [ ! -f $(TOPDIR).config ] ; then \
cp $(TOPDIR)sysdeps/$(TARGET_OS)/defconfig $(TOPDIR).config; \
fi;
menuconfig: $(TOPDIR).config
mkdir -p $(TOPDIR)include/config
$(MAKE) -C scripts/lxdialog all
$(CONFIG_SHELL) scripts/Menuconfig sysdeps/$(TARGET_OS)/config.in
$(BB_SHELL) scripts/Menuconfig sysdeps/$(TARGET_OS)/config.in
config:
mkdir -p $(TOPDIR)/include/config
$(CONFIG_SHELL) scripts/Configure sysdeps/$(TARGET_OS)/config.in
config: $(TOPDIR).config
mkdir -p $(TOPDIR)include/config
$(BB_SHELL) scripts/Configure sysdeps/$(TARGET_OS)/config.in
oldconfig:
mkdir -p $(TOPDIR)/include/config
$(CONFIG_SHELL) scripts/Configure -d sysdeps/$(TARGET_OS)/config.in
oldconfig: $(TOPDIR).config
mkdir -p $(TOPDIR)include/config
$(BB_SHELL) scripts/Configure -d sysdeps/$(TARGET_OS)/config.in
ifdef CONFIGURATION
@@ -355,7 +197,10 @@ dummy:
endif
include Rules.mak
%.o: %.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
# Testing...
test tests:
@@ -369,16 +214,17 @@ clean:
- $(MAKE) -C tests clean
- $(MAKE) -C scripts/lxdialog clean
- rm -f docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
docs/busybox.lineo.com/BusyBox.html
docs/busybox.net/BusyBox.html
- rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \
docs/busybox.pdf docs/busybox.lineo.com/busybox.html \
docs/busybox.pdf docs/busybox.net/busybox.html \
docs/busybox _install pod2htm* *.gdb *.elf *~ core
- rm -f busybox.links libbb/loop.h .config.old .hdepend
- rm -f busybox busybox.links libbb/loop.h .config.old .hdepend
- rm -f scripts/split-include scripts/mkdep .*config.log
- rm -rf include/config include/config.h
- find -name .\*.flags -o -name .depend -exec rm -f {} \;
- find -name \*.o -exec rm -f {} \;
- find -name \*.a -exec rm -f {} \;
- find . -name .\*.flags -exec rm -f {} \;
- find . -name .depend -exec rm -f {} \;
- find . -name \*.o -exec rm -f {} \;
- find . -name \*.a -exec rm -f {} \;
distclean: clean
- rm -f busybox
@@ -403,9 +249,11 @@ dist release: distclean doc
.PHONY: tags check
.PHONY: tags check depend
tags:
ctags -R .
check: busybox
cd testsuite && ./runtest
+11 -10
View File
@@ -35,7 +35,7 @@ Supported architectures:
Busybox in general will build on any architecture supported by gcc. It has
a few specialized features added for __sparc__ and __alpha__. insmod
functionality is currently limited to x86, ARM, SH3/4, powerpc, m68k,
and MIPS.
MIPS, and v850e.
Supported libcs:
@@ -83,7 +83,7 @@ top of ash.c as well, so check those out if you want to tweak things.
Getting help:
When you find you need help, you can check out the BusyBox mailing list
archives at http://oss.lineo.com/lists/busybox/ or even join
archives at http://busybox.net/lists/busybox/ or even join
the mailing list if you are interested.
----------------
@@ -91,12 +91,12 @@ the mailing list if you are interested.
Bugs:
If you find bugs, please submit a bug report. Full instructions on how to
report a bug are found at http://bugs.lineo.com/Reporting.html.
report a bug are found at http://bugs.busybox.net/Reporting.html.
For the impatient: To submit a bug, simply send an email describing the problem
to submit@bugs.lineo.com. Bug reports should look something like this:
to submit@bugs.busybox.net. Bug reports should look something like this:
To: submit@bugs.lineo.com
To: submit@bugs.busybox.net
From: diligent@testing.linux.org
Subject: /bin/true doesn't work
@@ -123,21 +123,22 @@ understanding.
FTP:
Source for the latest released version can always be downloaded from
ftp://ftp.lineo.com/pub/busybox.
Source for the latest released version, as well as daily snapshots, can always
be downloaded from
http://busybox.net/downloads/
----------------
CVS:
BusyBox now has its own publicly browsable CVS tree at:
http://oss.lineo.com/cgi-bin/cvsweb/busybox/
http://busybox.net/cgi-bin/cvsweb/busybox/
Anonymous CVS access is available. For instructions, check out:
http://oss.lineo.com/cvs_anon.html
http://busybox.net/cvs_anon.html
For those that are actively contributing there is even CVS write access:
http://oss.lineo.com/cvs_write.html
http://busybox.net/cvs_write.html
----------------
+215 -172
View File
@@ -1,195 +1,238 @@
# Rules.make for busybox
#
# This file contains rules which are shared between multiple Makefiles.
# Copyright (C) 2002 Erik Andersen <andersee@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# False targets.
#
.PHONY: dummy
#
# Special variables which should not be exported
#
unexport EXTRA_AFLAGS
unexport EXTRA_CFLAGS
unexport EXTRA_LDFLAGS
unexport EXTRA_ARFLAGS
unexport SUBDIRS
unexport SUB_DIRS
unexport ALL_SUB_DIRS
unexport O_TARGET
unexport obj-y
unexport obj-n
unexport obj-
unexport export-objs
unexport subdir-y
unexport subdir-n
unexport subdir-
#
# Get things started.
#
first_rule: sub_dirs
$(MAKE) all_targets
SUB_DIRS := $(subdir-y)
ALL_SUB_DIRS := $(sort $(subdir-y) $(subdir-n) $(subdir-))
PROG := busybox
VERSION := 0.61.pre
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
HOSTCC := gcc
HOSTCFLAGS:= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
#
# Common rules
#
# What OS are you compiling busybox for? This allows you to include
# OS specific things, syscall overrides, etc.
TARGET_OS:=linux
%.s: %.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -S $< -o $@
# With a modern GNU make(1) (highly recommended, that's what all the
# developers use), all of the following configuration values can be
# overridden at the command line. For example:
# make CROSS=powerpc-linux- BB_SRC_DIR=$HOME/busybox PREFIX=/mnt/app
%.i: %.c
$(CPP) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) $< > $@
# If you want to add some simple compiler switches (like -march=i686),
# especially from the command line, use this instead of CFLAGS directly.
# For optimization overrides, it's better still to set OPTIMIZATION.
CFLAGS_EXTRA:=#-Werror
# If you want a static binary, turn this on.
DOSTATIC:=false
# Set the following to `true' to make a debuggable build.
# Leave this set to `false' for production use.
DODEBUG:=false
# This enables compiling with dmalloc ( http://dmalloc.com/ )
# which is an excellent public domain mem leak and malloc problem
# detector. To enable dmalloc, before running busybox you will
# want to first set up your environment.
# eg: `export DMALLOC_OPTIONS=debug=0x34f47d83,inter=100,log=logfile`
# The debug= value is generated using the following command
# dmalloc -p log-stats -p log-non-free -p log-bad-space -p log-elapsed-time \
# -p check-fence -p check-heap -p check-lists -p check-blank \
# -p check-funcs -p realloc-copy -p allow-free-null
# Do not enable this for production builds...
DODMALLOC:=false
# Electric-fence is another very useful malloc debugging library.
# Do not enable this for production builds...
DOEFENCE:=false
# If you want large file summit support, turn this on.
# This has no effect if you don't have a kernel with lfs
# support, and a system with libc-2.1.3 or later.
# Some of the programs that can benefit from lfs support
# are dd, gzip, mount, tar, and mkfs_minix.
# LFS allows you to use the above programs for files
# larger than 2GB!
DOLFS:=false
# If you have a "pristine" source directory, point BB_SRC_DIR to it.
# Experimental and incomplete; tell the mailing list
# <busybox@busybox.net> if you do or don't like it so far.
BB_SRC_DIR:=
# If you are running a cross compiler, you may want to set CROSS
# to something more interesting, like "arm-linux-".
CROSS:=
CC := $(CROSS)gcc
AR := $(CROSS)ar
AS := $(CROSS)as
LD := $(CROSS)ld
NM := $(CROSS)nm
STRIP := $(CROSS)strip
CPP := $(CC) -E
MAKEFILES := $(TOPDIR).config
export VERSION BUILDTIME TOPDIR HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
# To compile vs uClibc, just use the compiler wrapper built by uClibc...
# Everything should compile and work as expected these days...
#CC:=/usr/i386-linux-uclibc/bin/i386-uclibc-gcc
# To compile vs some other alternative libc, you may need to use/adjust
# the following lines to meet your needs...
#
# If you are using Red Hat 6.x with the compatible RPMs (for developing under
# Red Hat 5.x and glibc 2.0) uncomment the following. Be sure to read about
# using the compatible RPMs (compat-*) at http://www.redhat.com !
#LIBCDIR:=/usr/i386-glibc20-linux
#
# The following is used for libc5 (if you install altgcc and libc5-altdev
# on a Debian system).
#LIBCDIR:=/usr/i486-linuxlibc1
#
# For other libraries, you are on your own...
#LDFLAGS+=-nostdlib
#LIBRARIES:=$(LIBCDIR)/lib/libc.a -lgcc
#CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR)
#GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
WARNINGS:=-Wall -Wstrict-prototypes -Wshadow
CFLAGS:=-I$(TOPDIR)include
ARFLAGS:=-r
TARGET_ARCH:=${shell $(CC) -dumpmachine | sed -e s'/-.*//' \
-e 's/i.86/i386/' \
-e 's/sparc.*/sparc/' \
-e 's/arm.*/arm/g' \
-e 's/m68k.*/m68k/' \
-e 's/ppc/powerpc/g' \
-e 's/v850.*/v850/g' \
-e 's/sh[234]/sh/' \
-e 's/mips.*/mips/' \
}
#--------------------------------------------------------
# Arch specific compiler optimization stuff should go here.
# Unless you want to override the defaults, do not set anything
# for OPTIMIZATION...
# use '-Os' optimization if available, else use -O2
OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null \
>/dev/null 2>&1; then echo "-Os"; else echo "-O2" ; fi}
# Some nice architecture specific optimizations
ifeq ($(strip $(TARGET_ARCH)),arm)
OPTIMIZATION+=-fstrict-aliasing
endif
ifeq ($(strip $(TARGET_ARCH)),i386)
OPTIMIZATION+=-march=i386
OPTIMIZATION+=${shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc \
/dev/null >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; fi}
OPTIMIZATION+=${shell if $(CC) -falign-functions=1 -falign-jumps=0 -falign-loops=0 \
-S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo \
"-falign-functions=1 -falign-jumps=0 -falign-loops=0"; else \
if $(CC) -malign-functions=0 -malign-jumps=0 -S -o /dev/null -xc \
/dev/null >/dev/null 2>&1; then echo "-malign-functions=0 -malign-jumps=0"; fi; fi}
endif
OPTIMIZATIONS:=$(OPTIMIZATION) -fomit-frame-pointer
#
#--------------------------------------------------------
# If you're going to do a lot of builds with a non-vanilla configuration,
# it makes sense to adjust parameters above, so you can type "make"
# by itself, instead of following it by the same half-dozen overrides
# every time. The stuff below, on the other hand, is probably less
# prone to casual user adjustment.
#
ifeq ($(strip $(DOLFS)),true)
# For large file summit support
CFLAGS+=-D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64
endif
ifeq ($(strip $(DODMALLOC)),true)
# For testing mem leaks with dmalloc
CFLAGS+=-DDMALLOC
LIBRARIES:=-ldmalloc
# Force debug=true, since this is useless when not debugging...
DODEBUG:=true
else
ifeq ($(strip $(DOEFENCE)),true)
LIBRARIES:=-lefence
# Force debug=true, since this is useless when not debugging...
DODEBUG:=true
endif
endif
ifeq ($(strip $(DODEBUG)),true)
CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE
LDFLAGS +=-Wl,-warn-common
STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging
else
CFLAGS += $(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE
LDFLAGS += -s -Wl,-warn-common
STRIPCMD:=$(STRIP) --remove-section=.note --remove-section=.comment
endif
ifeq ($(strip $(DOSTATIC)),true)
LDFLAGS += --static
endif
ifndef $(PREFIX)
PREFIX:=`pwd`/_install
endif
# Additional complications due to support for pristine source dir.
# Include files in the build directory should take precedence over
# the copy in BB_SRC_DIR, both during the compilation phase and the
# shell script that finds the list of object files.
# Work in progress by <ldoolitt@recycle.lbl.gov>.
#
ifneq ($(strip $(BB_SRC_DIR)),)
VPATH:=$(BB_SRC_DIR)
endif
CFLAGS += -DBB_VER='"$(VERSION)"'
CFLAGS += -DBB_BT='"$(BUILDTIME)"'
OBJECTS:=$(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o
CFLAGS += $(CROSS_CFLAGS)
ifdef BB_INIT_SCRIPT
CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"'
endif
# Put user-supplied flags at the end, where they
# have a chance of winning.
CFLAGS += $(CFLAGS_EXTRA)
%.o: %.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -c -o $@ $<
@ ( \
echo 'ifeq ($(strip $(subst $(comma),:,$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@))),$$(strip $$(subst $$(comma),:,$$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@))))' ; \
echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \
echo 'endif' \
) > $(dir $@)/.$(notdir $@).flags
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
%.o: %.s
$(AS) $(AFLAGS) $(EXTRA_CFLAGS) -o $@ $<
# Old makefiles define their own rules for compiling .S files,
# but these standard rules are available for any Makefile that
# wants to use them. Our plan is to incrementally convert all
# the Makefiles to these standard rules. -- rmk, mec
ifdef USE_STANDARD_AS_RULE
%.s: %.S
$(CPP) $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$@) $< > $@
%.o: %.S
$(CC) $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$@) -c -o $@ $<
endif
%.lst: %.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -g -c -o $*.o $<
$(TOPDIR)/scripts/makelst $* $(TOPDIR) $(OBJDUMP)
#
#
#
all_targets: $(O_TARGET) $(L_TARGET)
#
# Rule to compile a set of .o files into one .o file
#
ifdef O_TARGET
$(O_TARGET): $(obj-y)
rm -f $@
ifneq "$(strip $(obj-y))" ""
$(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(obj-y), $^)
else
$(AR) rcs $@
endif
@ ( \
echo 'ifeq ($(strip $(subst $(comma),:,$(EXTRA_LDFLAGS) $(obj-y))),$$(strip $$(subst $$(comma),:,$$(EXTRA_LDFLAGS) $$(obj-y))))' ; \
echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \
echo 'endif' \
) > $(dir $@)/.$(notdir $@).flags
endif # O_TARGET
#
# Rule to compile a set of .o files into one .a file
#
ifdef L_TARGET
$(L_TARGET): $(obj-y)
rm -f $@
$(AR) $(EXTRA_ARFLAGS) rcs $@ $(obj-y)
@ ( \
echo 'ifeq ($(strip $(subst $(comma),:,$(EXTRA_ARFLAGS) $(obj-y))),$$(strip $$(subst $$(comma),:,$$(EXTRA_ARFLAGS) $$(obj-y))))' ; \
echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \
echo 'endif' \
) > $(dir $@)/.$(notdir $@).flags
endif
#
# This make dependencies quickly
#
ifdef _FASTDEP_ALL_SUB_DIRS
fastdep: dummy
$(TOPDIR)/scripts/mkdep $(CFLAGS) $(EXTRA_CFLAGS) -- $(wildcard *.[chS]) > .depend
$(TOPDIR)scripts/mkdep $(CFLAGS) $(EXTRA_CFLAGS_nostdinc) -- $(wildcard *.[chS]) > .depend
ifdef ALL_SUB_DIRS
$(MAKE) $(patsubst %,_sfdep_%,$(ALL_SUB_DIRS)) _FASTDEP_ALL_SUB_DIRS="$(ALL_SUB_DIRS)"
endif
ifdef _FASTDEP_ALL_SUB_DIRS
$(patsubst %,_sfdep_%,$(_FASTDEP_ALL_SUB_DIRS)):
$(MAKE) -C $(patsubst _sfdep_%,%,$@) fastdep
endif
#
# A rule to make subdirectories
#
subdir-list = $(sort $(patsubst %,_subdir_%,$(SUB_DIRS)))
sub_dirs: dummy $(subdir-list)
.PHONY: dummy
ifdef SUB_DIRS
$(subdir-list) : dummy
$(MAKE) -C $(patsubst _subdir_%,%,$@)
endif
#
# A rule to do nothing
#
dummy:
#
# This is useful for testing
#
script:
$(SCRIPT)
.EXPORT_ALL_VARIABLES:
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif
ifneq ($(wildcard $(TOPDIR)/.hdepend),)
include $(TOPDIR)/.hdepend
endif
#
# Find files whose flags have changed and force recompilation.
# For safety, this works in the converse direction:
# every file is forced, except those whose flags are positively up-to-date.
#
FILES_FLAGS_UP_TO_DATE :=
# For use in expunging commas from flags, which mung our checking.
comma = ,
FILES_FLAGS_EXIST := $(wildcard .*.flags)
ifneq ($(FILES_FLAGS_EXIST),)
include $(FILES_FLAGS_EXIST)
endif
FILES_FLAGS_CHANGED := $(strip \
$(filter-out $(FILES_FLAGS_UP_TO_DATE), \
$(O_TARGET) $(L_TARGET) $(active-objs) \
))
# A kludge: .S files don't get flag dependencies (yet),
# because that will involve changing a lot of Makefiles. Also
# suppress object files explicitly listed in $(IGNORE_FLAGS_OBJS).
# This allows handling of assembly files that get translated into
# multiple object files (see arch/ia64/lib/idiv.S, for example).
FILES_FLAGS_CHANGED := $(strip \
$(filter-out $(patsubst %.S, %.o, $(wildcard *.S) $(IGNORE_FLAGS_OBJS)), \
$(FILES_FLAGS_CHANGED)))
ifneq ($(FILES_FLAGS_CHANGED),)
$(FILES_FLAGS_CHANGED): dummy
endif
+9 -3
View File
@@ -3,14 +3,15 @@ is listed here doesn't mean that it is going to be added to busybox,
or that doing so is even a good idea. It just means that I _might_ get
around to it some time. If you have any good ideas, please let me know.
* login/sulogin/passwd/getty/etc are part of tinylogin, and so are not
needed or wanted in busybox (or else I'd have to link to libcrypt).
* login/sulogin/passwd/etc are part of tinylogin. We are in the
process of merging these applications into busybox, since the
new build system allows us to add Libraries (i.e. libcrypt),
when certain applets are enabled.
* We _were_ going to split networking apps into a new package called
netkit-tiny. Per discussions on the mailing list, this isn't going
to happen. False alarm. Sorry about the confusion.
-Erik
-----------
@@ -56,3 +57,8 @@ and then start with the biggest things and make them smaller...
xargs could use a -l option
------------------------------------------------------------------
libbb/unzip.c and archival/gzip.c have common constant static arrays and
code for initializing the CRC array. Both use CRC-32 and could use
common code for CRC calculation. Within archival/gzip.c, the CRC
array should be malloc-ed as it is in libbb/unzip.c .
+9 -13
View File
@@ -1,6 +1,6 @@
# Makefile for busybox
#
# Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
# Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,18 +17,14 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
TOPDIR :=..
L_TARGET := applets.a
obj-y :=
obj-n :=
obj- :=
obj-y += applets.o busybox.o usage.o
# Hand off to toplevel Rules.mak
include $(TOPDIR)/Rules.mak
TOPDIR:= ../
APPLETS_DIR:=./
include $(TOPDIR).config
include $(TOPDIR)Rules.mak
include Makefile.in
all: $(libraries-y)
-include $(TOPDIR).depend
clean:
rm -f $(L_TARGET) *.o core
rm -f *.o *.a $(AR_TARGET)
+32
View File
@@ -0,0 +1,32 @@
# Makefile for busybox
#
# Copyright (C) 1999-2002 by Erik Andersen <andersee@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
APPLETS_AR:=applets.a
ifndef $(APPLETS_DIR)
APPLETS_DIR:=$(TOPDIR)applets/
endif
APPLET_SRC:=applets.c busybox.c usage.c
APPLET_OBJ:= $(patsubst %.c,$(APPLETS_DIR)%.o, $(APPLET_SRC))
libraries-y+=$(APPLETS_DIR)$(APPLETS_AR)
$(APPLETS_DIR)$(APPLETS_AR): $(APPLET_OBJ)
$(AR) -ro $@ $(APPLET_OBJ)
+307 -1
View File
@@ -25,6 +25,7 @@
*
*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -40,6 +41,43 @@ struct BB_applet *applet_using;
/* The -1 arises because of the {0,NULL,0,-1} entry above. */
const size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1);
#ifdef CONFIG_FEATURE_SUID
static void check_suid ( struct BB_applet *app );
#ifdef CONFIG_FEATURE_SUID_CONFIG
#include <sys/stat.h>
#include <ctype.h>
#include "pwd_.h"
#include "grp_.h"
static int parse_config_file ( void );
static int config_ok;
#define CONFIG_FILE "/etc/busybox.conf"
/* applets [] is const, so we have to define this "override" structure */
struct BB_suid_config {
struct BB_applet *m_applet;
uid_t m_uid;
gid_t m_gid;
mode_t m_mode;
struct BB_suid_config *m_next;
};
static struct BB_suid_config *suid_config;
#endif /* CONFIG_FEATURE_SUID_CONFIG */
#endif /* CONFIG_FEATURE_SUID */
extern void show_usage(void)
{
const char *format_string;
@@ -52,7 +90,7 @@ extern void show_usage(void)
}
}
format_string = "%s\n\nUsage: %s %s\n\n";
if(*usage_string == 0)
if(*usage_string == '\b')
format_string = "%s\n\nNo help available.\n\n";
fprintf(stderr, format_string,
full_version, applet_using->name, usage_string);
@@ -80,6 +118,11 @@ void run_applet_by_name(const char *name, int argc, char **argv)
static int recurse_level = 0;
extern int been_there_done_that; /* From busybox.c */
#ifdef CONFIG_FEATURE_SUID_CONFIG
if ( recurse_level == 0 )
config_ok = parse_config_file ( );
#endif
recurse_level++;
/* Do a binary search to find the applet entry given the name. */
if ((applet_using = find_applet_by_name(name)) != NULL) {
@@ -96,6 +139,10 @@ void run_applet_by_name(const char *name, int argc, char **argv)
been_there_done_that=1;
busybox_main(0, NULL);
}
#ifdef CONFIG_FEATURE_SUID
check_suid ( applet_using );
#endif
exit((*(applet_using->main)) (argc, argv));
}
/* Just in case they have renamed busybox - Check argv[1] */
@@ -106,6 +153,265 @@ void run_applet_by_name(const char *name, int argc, char **argv)
}
#ifdef CONFIG_FEATURE_SUID
#ifdef CONFIG_FEATURE_SUID_CONFIG
/* check if u is member of group g */
static int ingroup ( uid_t u, gid_t g )
{
struct group *grp = getgrgid ( g );
if ( grp ) {
char **mem;
for ( mem = grp-> gr_mem; *mem; mem++ ) {
struct passwd *pwd = getpwnam ( *mem );
if ( pwd && ( pwd-> pw_uid == u ))
return 1;
}
}
return 0;
}
#endif
void check_suid ( struct BB_applet *applet )
{
uid_t ruid = getuid ( ); /* real [ug]id */
uid_t rgid = getgid ( );
#ifdef CONFIG_FEATURE_SUID_CONFIG
if ( config_ok ) {
struct BB_suid_config *sct;
for ( sct = suid_config; sct; sct = sct-> m_next ) {
if ( sct-> m_applet == applet )
break;
}
if ( sct ) {
mode_t m = sct-> m_mode;
if ( sct-> m_uid == ruid ) /* same uid */
m >>= 6;
else if (( sct-> m_gid == rgid ) || ingroup ( ruid, sct-> m_gid )) /* same group / in group */
m >>= 3;
if (!( m & S_IXOTH )) /* is x bit not set ? */
error_msg_and_die ( "You have no permission to run this applet!" );
if (( sct-> m_mode & ( S_ISGID | S_IXGRP )) == ( S_ISGID | S_IXGRP )) { /* *both* have to be set for sgid */
if ( setegid ( sct-> m_gid ))
error_msg_and_die ( "BusyBox binary has insufficient rights to set proper GID for applet!" );
}
else
setgid ( rgid ); /* no sgid -> drop */
if ( sct-> m_mode & S_ISUID ) {
if ( seteuid ( sct-> m_uid ))
error_msg_and_die ( "BusyBox binary has insufficient rights to set proper UID for applet!" );
}
else
setuid ( ruid ); /* no suid -> drop */
}
else { /* default: drop all priviledges */
setgid ( rgid );
setuid ( ruid );
}
return;
}
else {
#ifndef CONFIG_FEATURE_SUID_CONFIG_QUIET
static int onetime = 0;
if ( !onetime ) {
onetime = 1;
fprintf ( stderr, "Using fallback suid method\n" );
}
#endif
}
#endif
if ( applet-> need_suid == _BB_SUID_ALWAYS ) {
if ( geteuid ( ) != 0 )
error_msg_and_die ( "This applet requires root priviledges!" );
}
else if ( applet-> need_suid == _BB_SUID_NEVER ) {
setgid ( rgid ); /* drop all priviledges */
setuid ( ruid );
}
}
#ifdef CONFIG_FEATURE_SUID_CONFIG
#define parse_error(x) { err=x; goto pe_label; }
int parse_config_file ( void )
{
struct stat st;
char *err = 0;
FILE *f = 0;
int lc = 0;
suid_config = 0;
/* is there a config file ? */
if ( stat ( CONFIG_FILE, &st ) == 0 ) {
/* is it owned by root with no write perm. for group and others ? */
if ( S_ISREG( st. st_mode ) && ( st. st_uid == 0 ) && (!( st. st_mode & ( S_IWGRP | S_IWOTH )))) {
/* that's ok .. then try to open it */
f = fopen ( CONFIG_FILE, "r" );
if ( f ) {
char buffer [256];
int section = 0;
while ( fgets ( buffer, sizeof( buffer ) - 1, f )) {
char c = buffer [0];
char *p;
lc++;
p = strchr ( buffer, '#' );
if ( p )
*p = 0;
p = buffer + xstrlen ( buffer );
while (( p > buffer ) && isspace ( *--p ))
*p = 0;
if ( p == buffer )
continue;
if ( c == '[' ) {
p = strchr ( buffer, ']' );
if ( !p || ( p == ( buffer + 1 ))) /* no matching ] or empty [] */
parse_error ( "malformed section header" );
*p = 0;
if ( strcasecmp ( buffer + 1, "SUID" ) == 0 )
section = 1;
else
section = -1; /* unknown section - just skip */
}
else if ( section ) {
switch ( section ) {
case 1: { /* SUID */
int l;
struct BB_applet *applet;
p = strchr ( buffer, '=' ); /* <key>[::space::]*=[::space::]*<value> */
if ( !p || ( p == ( buffer + 1 ))) /* no = or key is empty */
parse_error ( "malformed keyword" );
l = p - buffer;
while ( isspace ( buffer [--l] )) { } /* skip whitespace */
buffer [l+1] = 0;
if (( applet = find_applet_by_name ( buffer ))) {
struct BB_suid_config *sct = xmalloc ( sizeof( struct BB_suid_config ));
sct-> m_applet = applet;
sct-> m_next = suid_config;
suid_config = sct;
while ( isspace ( *++p )) { } /* skip whitespace */
sct-> m_mode = 0;
switch ( *p++ ) {
case 'S': sct-> m_mode |= S_ISUID; break;
case 's': sct-> m_mode |= S_ISUID; /* no break */
case 'x': sct-> m_mode |= S_IXUSR; break;
case '-': break;
default : parse_error ( "invalid user mode" );
}
switch ( *p++ ) {
case 's': sct-> m_mode |= S_ISGID; /* no break */
case 'x': sct-> m_mode |= S_IXGRP; break;
case 'S': break;
case '-': break;
default : parse_error ( "invalid group mode" );
}
switch ( *p ) {
case 't':
case 'x': sct-> m_mode |= S_IXOTH; break;
case 'T':
case '-': break;
default : parse_error ( "invalid other mode" );
}
while ( isspace ( *++p )) { } /* skip whitespace */
if ( isdigit ( *p )) {
sct-> m_uid = strtol ( p, &p, 10 );
if ( *p++ != '.' )
parse_error ( "parsing <uid>.<gid>" );
}
else {
struct passwd *pwd;
char *p2 = strchr ( p, '.' );
if ( !p2 )
parse_error ( "parsing <uid>.<gid>" );
*p2 = 0;
pwd = getpwnam ( p );
if ( !pwd )
parse_error ( "invalid user name" );
sct-> m_uid = pwd-> pw_uid;
p = p2 + 1;
}
if ( isdigit ( *p ))
sct-> m_gid = strtol ( p, &p, 10 );
else {
struct group *grp = getgrnam ( p );
if ( !grp )
parse_error ( "invalid group name" );
sct-> m_gid = grp-> gr_gid;
}
}
break;
}
default: /* unknown - skip */
break;
}
}
else
parse_error ( "keyword not within section" );
}
fclose ( f );
return 1;
}
}
}
return 0; /* no config file or not readable (not an error) */
pe_label:
fprintf ( stderr, "Parse error in %s, line %d: %s\n", CONFIG_FILE, lc, err );
if ( f )
fclose ( f );
return 0;
}
#endif
#endif
/* END CODE */
/*
Local Variables:
+10 -7
View File
@@ -18,12 +18,15 @@ const char *applet_name;
* this should be consistent w/ the enum, busybox.h::Location,
* or else...
*/
static char* install_dir[] = {
"/",
"/bin",
"/sbin",
"/usr/bin",
"/usr/sbin",
static const char usr_bin [] ="/usr/bin";
static const char usr_sbin[] ="/usr/sbin";
static const char* const install_dir[] = {
&usr_bin [8], /* "", equivalent to "/" for concat_path_file() */
&usr_bin [4], /* "/bin" */
&usr_sbin[4], /* "/sbin" */
usr_bin,
usr_sbin
};
/* abstract link() */
@@ -35,7 +38,7 @@ typedef int (*__link_f)(const char *, const char *);
* malloc'd string w/ full pathname of busybox's location
* NULL on failure
*/
static char *busybox_fullpath()
static inline char *busybox_fullpath(void)
{
return xreadlink("/proc/self/exe");
}
+9 -23
View File
@@ -1,6 +1,6 @@
# Makefile for busybox
#
# Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
# Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,28 +17,14 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
TOPDIR :=..
L_TARGET := archival.a
obj-y :=
obj-n :=
obj- :=
subdir-y := libunarchive
obj-$(CONFIG_AR) += ar.o
obj-$(CONFIG_BUNZIP2) += bunzip2.o
obj-$(CONFIG_CPIO) += cpio.o
obj-$(CONFIG_DPKG) += dpkg.o
obj-$(CONFIG_DPKG_DEB) += dpkg_deb.o
obj-$(CONFIG_GUNZIP) += gunzip.o
obj-$(CONFIG_GZIP) += gzip.o
obj-$(CONFIG_RPM2CPIO) += rpm2cpio.o
obj-$(CONFIG_TAR) += tar.o
# Hand off to toplevel Rules.mak
include $(TOPDIR)/Rules.mak
TOPDIR:= ../
ARCHIVAL_DIR:=./
include $(TOPDIR).config
include $(TOPDIR)Rules.mak
include Makefile.in
all: $(libraries-y)
-include $(TOPDIR).depend
clean:
rm -f $(L_TARGET) *.o core
rm -f *.o *.a $(AR_TARGET)
+41
View File
@@ -0,0 +1,41 @@
# Makefile for busybox
#
# Copyright (C) 1999-2002 by Erik Andersen <andersee@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
ARCHIVAL_AR:=archival.a
ifndef $(ARCHIVAL_DIR)
ARCHIVAL_DIR:=$(TOPDIR)archival/
endif
ARCHIVAL-y:=
ARCHIVAL-$(CONFIG_AR) += ar.o
ARCHIVAL-$(CONFIG_BUNZIP2) += bunzip2.o
ARCHIVAL-$(CONFIG_CPIO) += cpio.o
ARCHIVAL-$(CONFIG_DPKG) += dpkg.o
ARCHIVAL-$(CONFIG_DPKG_DEB) += dpkg_deb.o
ARCHIVAL-$(CONFIG_GUNZIP) += gunzip.o
ARCHIVAL-$(CONFIG_GZIP) += gzip.o
ARCHIVAL-$(CONFIG_RPM2CPIO) += rpm2cpio.o
ARCHIVAL-$(CONFIG_TAR) += tar.o
ARCHIVAL-$(CONFIG_UNZIP) += unzip.o
libraries-y+=$(ARCHIVAL_DIR)$(ARCHIVAL_AR)
$(ARCHIVAL_DIR)$(ARCHIVAL_AR): $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
$(AR) -ro $@ $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
+150 -655
View File
File diff suppressed because it is too large. Load diff
+7 -1
View File
@@ -18,6 +18,12 @@ bool 'tar' CONFIG_TAR
if [ "$CONFIG_TAR" = "y" ] ; then
bool ' Enable archive creation' CONFIG_FEATURE_TAR_CREATE
bool ' Enable -X and --exclude options (exclude files)' CONFIG_FEATURE_TAR_EXCLUDE
bool ' Enable -z option (currently only for extracting)' CONFIG_FEATURE_TAR_GZIP
bool ' Enable -z option' CONFIG_FEATURE_TAR_GZIP
bool ' Enable support for old tar header format' CONFIG_FEATURE_TAR_OLD_FORMAT
bool ' Enable support for GNU long filenames' CONFIG_FEATURE_GNUTAR_LONG_FILENAME
fi
if [ "$CONFIG_CPIO" = "y" -o "$CONFIG_TAR" = "y" ] ; then
bool ' Enable tape drive support' CONFIG_FEATURE_UNARCHIVE_TAPE
fi
bool 'unzip' CONFIG_UNZIP
endmenu
+131 -81
View File
@@ -487,19 +487,17 @@ void add_split_dependencies(common_node_t *parent_node, const char *whole_line,
void free_package(common_node_t *node)
{
int i;
if (node != NULL) {
unsigned short i;
if (node) {
for (i = 0; i < node->num_of_edges; i++) {
if (node->edge[i] != NULL) {
if (node->edge[i]) {
free(node->edge[i]);
}
}
if (node->edge != NULL) {
if (node->edge) {
free(node->edge);
}
if (node != NULL) {
free(node);
}
free(node);
}
}
@@ -858,7 +856,7 @@ void write_status_file(deb_file_t **deb_file)
}
}
/* If the package from the status file wasnt handle above, do it now*/
if (write_flag == FALSE) {
if (! write_flag) {
fprintf(new_status_file, "%s\n\n", control_buffer);
}
@@ -905,9 +903,8 @@ int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
int state_status;
int state_flag;
int state_want;
unsigned int status_package_num;
int i = deb_start;
int j, k;
int j;
/* Check for conflicts
* TODO: TEST if conflicts with other packages to be installed
@@ -948,38 +945,49 @@ int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
}
/* Check conflicts */
for (i = 0; i < conflicts_num; i++) {
/* Check for conflicts */
for (j = 0; j < STATUS_HASH_PRIME; j++) {
if (status_hashtable[j] == NULL) {
continue;
}
state_flag = get_status(j, 2);
state_status = get_status(j, 3);
if ((state_status != search_name_hashtable("installed"))
&& (state_flag != search_name_hashtable("want-install"))) {
continue;
}
status_package_num = status_hashtable[j]->package;
for (k = 0; k < package_hashtable[status_package_num]->num_of_edges; k++) {
const edge_t *package_edge = package_hashtable[status_package_num]->edge[k];
if (package_edge->type != EDGE_CONFLICTS) {
continue;
i = 0;
while (deb_file[i] != NULL) {
const common_node_t *package_node = package_hashtable[deb_file[i]->package];
int status_num = 0;
status_num = search_status_hashtable(name_hashtable[package_node->name]);
if (get_status(status_num, 3) == search_name_hashtable("installed")) {
i++;
continue;
}
for (j = 0; j < package_node->num_of_edges; j++) {
const edge_t *package_edge = package_node->edge[j];
const unsigned int package_num =
search_package_hashtable(package_edge->name,
package_edge->version, package_edge->operator);
if (package_edge->type == EDGE_CONFLICTS) {
int result = 0;
if (package_hashtable[package_num] != NULL) {
status_num = search_status_hashtable(name_hashtable[package_hashtable[package_num]->name]);
state_status = get_status(status_num, 3);
state_flag = get_status(status_num, 1);
result = (state_status == search_name_hashtable("installed")) ||
(state_flag == search_name_hashtable("want-install"));
if (result) {
result = test_version(package_hashtable[deb_file[i]->package]->version,
package_edge->version, package_edge->operator);
}
}
if (package_edge->name != package_hashtable[conflicts[i]]->name) {
continue;
}
/* There is a conflict against the package name
* check if version conflict as well */
if (test_version(package_hashtable[deb_file[i]->package]->version,
package_edge->version, package_edge->operator)) {
error_msg_and_die("Package %s conflict with %s",
name_hashtable[package_hashtable[deb_file[i]->package]->name],
name_hashtable[package_hashtable[status_package_num]->name]);
if (result) {
error_msg_and_die("Package %s conflicts with %s",
name_hashtable[package_node->name],
name_hashtable[package_edge->name]);
}
}
}
}
i++;
}
/* Check dependendcies */
i = 0;
@@ -987,36 +995,58 @@ int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
const common_node_t *package_node = package_hashtable[deb_file[i]->package];
int status_num = 0;
status_num = search_status_hashtable(name_hashtable[package_node->name]);
state_status = get_status(status_num, 3);
state_want = get_status(status_num, 1);
if (state_status == search_name_hashtable("installed")) {
i++;
continue;
}
for (j = 0; j < package_hashtable[deb_file[i]->package]->num_of_edges; j++) {
const edge_t *package_edge = package_node->edge[j];
const unsigned int package_num = search_package_hashtable(package_edge->name,
package_edge->version, package_edge->operator);
unsigned int package_num;
package_num = search_package_hashtable(package_edge->name, package_edge->version, package_edge->operator);
status_num = search_status_hashtable(name_hashtable[package_hashtable[package_num]->name]);
state_status = get_status(status_num, 3);
state_want = get_status(status_num, 1);
switch (package_edge->type) {
case(EDGE_PRE_DEPENDS):
case(EDGE_OR_PRE_DEPENDS):
case(EDGE_OR_PRE_DEPENDS): {
int result=1;
/* It must be already installed */
/* NOTE: This is untested, nothing apropriate in my status file */
if ((package_hashtable[package_num] == NULL) || (state_status != search_name_hashtable("installed"))) {
if (package_hashtable[package_num] != NULL) {
status_num = search_status_hashtable(name_hashtable[package_hashtable[package_num]->name]);
state_status = get_status(status_num, 3);
state_want = get_status(status_num, 1);
result = (state_status != search_name_hashtable("installed"));
}
if (result) {
error_msg_and_die("Package %s pre-depends on %s, but it is not installed",
name_hashtable[package_node->name],
name_hashtable[package_edge->name]);
}
break;
}
case(EDGE_DEPENDS):
case(EDGE_OR_DEPENDS):
case(EDGE_OR_DEPENDS): {
int result=1;
if (package_hashtable[package_num] != NULL) {
status_num = search_status_hashtable(name_hashtable[package_hashtable[package_num]->name]);
state_status = get_status(status_num, 3);
state_want = get_status(status_num, 1);
result=(state_status != search_name_hashtable("installed")) && (state_want != search_name_hashtable("want-install"));
}
/* It must be already installed, or to be installed */
if ((package_hashtable[package_num] == NULL) ||
((state_status != search_name_hashtable("installed")) &&
(state_want != search_name_hashtable("want_install")))) {
if (result) {
error_msg_and_die("Package %s depends on %s, but it is not installed, or flaged to be installed",
name_hashtable[package_node->name],
name_hashtable[package_edge->name]);
}
break;
}
}
}
i++;
@@ -1028,25 +1058,20 @@ int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
char **create_list(const char *filename)
{
FILE *list_stream;
char **file_list = xmalloc(sizeof(char *));
char **file_list = NULL;
char *line = NULL;
char *last_char;
int length = 0;
int count = 0;
/* dont use [xw]fopen here, handle error ourself */
list_stream = fopen(filename, "r");
if (list_stream == NULL) {
*file_list = NULL;
return(file_list);
return(NULL);
}
while (getline(&line, &length, list_stream) != -1) {
/* +2 as we need to include space for the terminating NULL pointer */
file_list = xrealloc(file_list, sizeof(char *) * (length + 2));
last_char = last_char_is(line, '\n');
if (last_char) {
*last_char = '\0';
}
file_list = xrealloc(file_list, sizeof(char *) * (count + 2));
chomp(line);
file_list[count] = xstrdup(line);
count++;
}
@@ -1119,20 +1144,37 @@ int run_package_script(const char *package_name, const char *script_type)
return(result);
}
void all_control_list(char **remove_files, const char *package_name)
char **all_control_list(const char *package_name)
{
const char *all_extensions[11] = {"preinst", "postinst", "prerm", "postrm",
const char *extensions[11] = {"preinst", "postinst", "prerm", "postrm",
"list", "md5sums", "shlibs", "conffiles", "config", "templates", NULL };
int i;
unsigned short i = 0;
char **remove_files;
/* Create a list of all /var/lib/dpkg/info/<package> files */
for(i = 0; i < 10; i++) {
remove_files[i] = xmalloc(strlen(package_name) + strlen(all_extensions[i]) + 21);
sprintf(remove_files[i], "/var/lib/dpkg/info/%s.%s", package_name, all_extensions[i]);
remove_files = malloc(sizeof(char *) * 11);
while (extensions[i]) {
remove_files[i] = xmalloc(strlen(package_name) + strlen(extensions[i]) + 21);
sprintf(remove_files[i], "/var/lib/dpkg/info/%s.%s", package_name, extensions[i]);
i++;
}
remove_files[10] = NULL;
return(remove_files);
}
void free_array(char **array)
{
if (array) {
unsigned short i = 0;
while (array[i]) {
free(array[i]);
i++;
}
free(array);
}
}
/* This function lists information on the installed packages. It loops through
* the status_hashtable to retrieve the info. This results in smaller code than
@@ -1202,11 +1244,9 @@ void remove_package(const unsigned int package_num)
exclude_files = create_list(conffile_name);
/* Some directories cant be removed straight away, so do multiple passes */
while (remove_file_array(remove_files, exclude_files) == TRUE);
/* Create a list of all /var/lib/dpkg/info/<package> files */
remove_files = xmalloc(11);
all_control_list(remove_files, package_name);
while (remove_file_array(remove_files, exclude_files));
free_array(exclude_files);
free_array(remove_files);
/* Create a list of files in /var/lib/dpkg/info/<package>.* to keep */
exclude_files = xmalloc(sizeof(char*) * 3);
@@ -1215,7 +1255,12 @@ void remove_package(const unsigned int package_num)
sprintf(exclude_files[1], "/var/lib/dpkg/info/%s.postrm", package_name);
exclude_files[2] = NULL;
/* Create a list of all /var/lib/dpkg/info/<package> files */
remove_files = all_control_list(package_name);
remove_file_array(remove_files, exclude_files);
free_array(remove_files);
free_array(exclude_files);
/* rename <package>.conffile to <package>.list */
rename(conffile_name, list_name);
@@ -1242,16 +1287,18 @@ void purge_package(const unsigned int package_num)
sprintf(list_name, "/var/lib/dpkg/info/%s.list", package_name);
remove_files = create_list(list_name);
exclude_files = xmalloc(1);
exclude_files = xmalloc(sizeof(char*));
exclude_files[0] = NULL;
/* Some directories cant be removed straight away, so do multiple passes */
while (remove_file_array(remove_files, exclude_files) == TRUE);
while (remove_file_array(remove_files, exclude_files));
free_array(remove_files);
/* Create a list of all /var/lib/dpkg/info/<package> files */
remove_files = xmalloc(11);
all_control_list(remove_files, package_name);
remove_files = all_control_list(package_name);
remove_file_array(remove_files, exclude_files);
free_array(remove_files);
free(exclude_files);
/* run postrm script */
if (run_package_script(package_name, "postrm") == -1) {
@@ -1284,7 +1331,7 @@ void unpack_package(deb_file_t *deb_file)
}
/* Extract control.tar.gz to /var/lib/dpkg/info/<package>.filename */
info_prefix = (char *) xmalloc(sizeof(package_name) + 20 + 4 + 1);
info_prefix = (char *) xmalloc(strlen(package_name) + 20 + 4 + 2);
sprintf(info_prefix, "/var/lib/dpkg/info/%s.", package_name);
deb_extract(deb_file->filename, stdout, (extract_quiet | extract_control_tar_gz | extract_all_to_fs | extract_unconditional), info_prefix, NULL);
@@ -1328,7 +1375,7 @@ void configure_package(deb_file_t *deb_file)
set_status(status_num, "installed", 3);
}
extern int dpkg_main(int argc, char **argv)
int dpkg_main(int argc, char **argv)
{
deb_file_t **deb_file = NULL;
status_node_t *status_node;
@@ -1388,8 +1435,9 @@ extern int dpkg_main(int argc, char **argv)
}
/* Read arguments and store relevant info in structs */
deb_file = xmalloc(sizeof(deb_file_t));
while (optind < argc) {
/* deb_count = nb_elem - 1 and we need nb_elem + 1 to allocate terminal node [NULL pointer] */
deb_file = xrealloc(deb_file, sizeof(deb_file_t *) * (deb_count + 2));
deb_file[deb_count] = (deb_file_t *) xmalloc(sizeof(deb_file_t));
if (dpkg_opt & dpkg_opt_filename) {
deb_file[deb_count]->filename = xstrdup(argv[optind]);
@@ -1408,7 +1456,6 @@ extern int dpkg_main(int argc, char **argv)
if ((dpkg_opt & dpkg_opt_unpack) || (dpkg_opt & dpkg_opt_install)) {
status_node = (status_node_t *) xmalloc(sizeof(status_node_t));
status_node->package = deb_file[deb_count]->package;
/* Try and find a currently installed version of this package */
status_num = search_status_hashtable(name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]);
/* If no previous entry was found initialise a new entry */
@@ -1416,10 +1463,10 @@ extern int dpkg_main(int argc, char **argv)
(status_hashtable[status_num]->status == 0)) {
/* reinstreq isnt changed to "ok" until the package control info
* is written to the status file*/
status_node->status = search_name_hashtable("install reinstreq not-installed");
status_node->status = search_name_hashtable("want-install reinstreq not-installed");
status_hashtable[status_num] = status_node;
} else {
status_hashtable[status_num]->status = search_name_hashtable("install reinstreq installed");
status_hashtable[status_num]->status = search_name_hashtable("want-install reinstreq not-installed");
}
}
}
@@ -1488,6 +1535,7 @@ extern int dpkg_main(int argc, char **argv)
free(deb_file[i]->filename);
free(deb_file[i]);
}
free(deb_file);
for (i = 0; i < NAME_HASH_PRIME; i++) {
@@ -1497,7 +1545,9 @@ extern int dpkg_main(int argc, char **argv)
}
for (i = 0; i < PACKAGE_HASH_PRIME; i++) {
free_package(package_hashtable[i]);
if (package_hashtable[i] != NULL) {
free_package(package_hashtable[i]);
}
}
for (i = 0; i < STATUS_HASH_PRIME; i++) {
+91 -88
View File
@@ -7,9 +7,9 @@
* 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.
* Adjusted further by Erik Andersen <andersee@debian.org> to support files as
* well as stdin/stdout, and to generally behave itself wrt command line
* handling.
*
* General cleanup to better adhere to the style guide and make use of standard
* busybox functions by Glenn McGrath <bug1@optushome.com.au>
@@ -66,29 +66,22 @@ static char *license_msg[] = {
#include <getopt.h>
#include "busybox.h"
const char gunzip_to_stdout = 1;
const char gunzip_force = 2;
const char gunzip_test = 4;
extern int gunzip_main(int argc, char **argv)
{
FILE *in_file = stdin;
FILE *out_file = NULL;
struct stat stat_buf;
char *if_name = NULL;
char *of_name = NULL;
char *delete_file_name = NULL;
const int gunzip_to_stdout = 1;
const int gunzip_force = 2;
const int gunzip_test = 4;
int flags = 0;
int opt = 0;
int delete_old_file = FALSE;
char status = EXIT_SUCCESS;
char flags = 0;
int opt;
/* if called as zcat */
if (strcmp(applet_name, "zcat") == 0)
if (strcmp(applet_name, "zcat") == 0) {
flags |= gunzip_to_stdout;
}
while ((opt = getopt(argc, argv, "ctfhdq")) != -1) {
while ((opt = getopt(argc, argv, "ctfhd")) != -1) {
switch (opt) {
case 'c':
flags |= gunzip_to_stdout;
@@ -99,85 +92,95 @@ extern int gunzip_main(int argc, char **argv)
case 't':
flags |= gunzip_test;
break;
case 'd': /* Used to convert gzip to gunzip. */
case 'd': /* Used to convert gzip to gunzip. */
break;
case 'q':
error_msg("-q option not supported, ignored");
break;
case 'h':
default:
show_usage(); /* exit's inside usage */
show_usage(); /* exit's inside usage */
}
}
/* Set input filename and number */
if (argv[optind] == NULL || strcmp(argv[optind], "-") == 0) {
flags |= gunzip_to_stdout;
} else {
if_name = xstrdup(argv[optind]);
/* Open input file */
in_file = xfopen(if_name, "r");
do {
FILE *in_file, *out_file;
struct stat stat_buf;
const char *old_path = argv[optind];
const char *delete_path = NULL;
char *new_path = NULL;
/* set the buffer size */
setvbuf(in_file, NULL, _IOFBF, 0x8000);
optind++;
/* Get the time stamp on the input file. */
if (stat(if_name, &stat_buf) < 0) {
error_msg_and_die("Couldn't stat file %s", if_name);
}
}
/* Check that the input is sane. */
if (isatty(fileno(in_file)) && (flags & gunzip_force) == 0)
error_msg_and_die("compressed data not read from terminal. Use -f to force it.");
/* Set output filename and number */
if (flags & gunzip_test) {
out_file = xfopen("/dev/null", "w"); /* why does test use filenum 2 ? */
} else if (flags & gunzip_to_stdout) {
out_file = stdout;
} else {
char *extension;
int length = strlen(if_name);
delete_old_file = TRUE;
extension = strrchr(if_name, '.');
if (extension && strcmp(extension, ".gz") == 0) {
length -= 3;
} else if (extension && strcmp(extension, ".tgz") == 0) {
length -= 4;
if (old_path == NULL || strcmp(old_path, "-") == 0) {
in_file = stdin;
flags |= gunzip_to_stdout;
} else {
error_msg_and_die("Invalid extension");
in_file = wfopen(old_path, "r");
if (in_file == NULL) {
status = EXIT_FAILURE;
break;
}
/* Get the time stamp on the input file. */
if (stat(old_path, &stat_buf) < 0) {
error_msg_and_die("Couldn't stat file %s", old_path);
}
}
of_name = (char *) xcalloc(sizeof(char), length + 1);
strncpy(of_name, if_name, length);
/* Open output file */
out_file = xfopen(of_name, "w");
/* Set permissions on the file */
chmod(of_name, stat_buf.st_mode);
}
/* do the decompression, and cleanup */
if (unzip(in_file, out_file) == 0) {
/* Success, remove .gz file */
delete_file_name = if_name;
} else {
/* remove failed attempt */
delete_file_name = of_name;
}
fclose(out_file);
fclose(in_file);
if (delete_old_file == TRUE) {
if (unlink(delete_file_name) < 0) {
error_msg_and_die("Couldnt remove %s", delete_file_name);
/* Check that the input is sane. */
if (isatty(fileno(in_file)) && ((flags & gunzip_force) == 0)) {
error_msg_and_die
("compressed data not read from terminal. Use -f to force it.");
}
}
free(of_name);
/* Set output filename and number */
if (flags & gunzip_test) {
out_file = xfopen("/dev/null", "w"); /* why does test use filenum 2 ? */
} else if (flags & gunzip_to_stdout) {
out_file = stdout;
} else {
char *extension;
return(EXIT_SUCCESS);
new_path = xstrdup(old_path);
extension = strrchr(new_path, '.');
if (extension && (strcmp(extension, ".gz") == 0)) {
*extension = '\0';
} else if (extension && (strcmp(extension, ".tgz") == 0)) {
extension[2] = 'a';
extension[3] = 'r';
} else {
error_msg_and_die("Invalid extension");
}
/* Open output file */
out_file = xfopen(new_path, "w");
/* Set permissions on the file */
chmod(new_path, stat_buf.st_mode);
/* If unzip succeeds remove the old file */
delete_path = old_path;
}
/* do the decompression, and cleanup */
if ((unzip(in_file, out_file) != 0) && (new_path)) {
/* Unzip failed, remove new path instead of old path */
delete_path = new_path;
}
if (out_file != stdout) {
fclose(out_file);
}
if (in_file != stdin) {
fclose(in_file);
}
/* delete_path will be NULL if in test mode or from stdin */
if (delete_path && (unlink(delete_path) == -1)) {
error_msg_and_die("Couldn't remove %s", delete_path);
}
free(new_path);
} while (optind < argc);
return status;
}
+300 -316
View File
File diff suppressed because it is too large. Load diff
+9 -36
View File
@@ -1,6 +1,6 @@
# Makefile for busybox
#
# Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
# Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,41 +17,14 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
TOPDIR :=../..
L_TARGET := libunarchive.a
obj-y := unarchive.o seek_sub_file.o
obj-n :=
obj- :=
ifeq ($(CONFIG_DPKG),y)
obj-y += deb_extract.o get_header_ar.o get_header_tar.o
endif
ifeq ($(CONFIG_DPKG_DEB),y)
obj-y += deb_extract.o get_header_ar.o get_header_tar.o
endif
ifeq ($(CONFIG_AR),y)
obj-y += get_header_ar.o
endif
ifeq ($(CONFIG_CPIO),y)
obj-y += get_header_cpio.o
endif
ifeq ($(CONFIG_RPM2CPIO),y)
obj-y += get_header_cpio.o
endif
ifeq ($(CONFIG_TAR),y)
obj-y += get_header_tar.o
endif
# Hand off to toplevel Rules.mak
include $(TOPDIR)/Rules.mak
TOPDIR:= ../../
LIBUNARCHIVE_DIR:=./
include $(TOPDIR).config
include $(TOPDIR)Rules.mak
include Makefile.in
all: $(libraries-y)
-include $(TOPDIR).depend
clean:
rm -f $(L_TARGET) *.o core
rm -f *.o *.a $(AR_TARGET)
+38
View File
@@ -0,0 +1,38 @@
# Makefile for busybox
#
# Copyright (C) 1999-2002 by Erik Andersen <andersee@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
LIBUNARCHIVE_AR:=libunarchive.a
ifndef $(LIBUNARCHIVE_DIR)
LIBUNARCHIVE_DIR:=$(TOPDIR)archival/libunarchive/
endif
LIBUNARCHIVE-y:=unarchive.o seek_sub_file.o
LIBUNARCHIVE-$(CONFIG_DPKG) += deb_extract.o get_header_ar.o get_header_tar.o
LIBUNARCHIVE-$(CONFIG_DPKG_DEB) += deb_extract.o get_header_ar.o get_header_tar.o
LIBUNARCHIVE-$(CONFIG_AR) += get_header_ar.o
LIBUNARCHIVE-$(CONFIG_CPIO) += get_header_cpio.o
LIBUNARCHIVE-$(CONFIG_RPM2CPIO) += get_header_cpio.o
LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar.o
LIBUNARCHIVE-$(CONFIG_UNZIP) += get_header_zip.o
libraries-y+=$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR)
$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR): $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
$(AR) -ro $@ $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
+2 -1
View File
@@ -80,4 +80,5 @@ char *deb_extract(const char *package_filename, FILE *out_stream,
free(file_list);
}
return(output_buffer);
}
}
@@ -0,0 +1,313 @@
#include "config.h"
#include "libbb.h"
#ifdef CONFIG_FEATURE_UNCOMPRESS
/* uncompress for busybox -- (c) 2002 Robert Griebl
*
* based on the original compress42.c source
* (see disclaimer below)
*/
/* (N)compress42.c - File compression ala IEEE Computer, Mar 1992.
*
* Authors:
* Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas)
* Jim McKie (decvax!mcvax!jim)
* Steve Davies (decvax!vax135!petsd!peora!srd)
* Ken Turkowski (decvax!decwrl!turtlevax!ken)
* James A. Woods (decvax!ihnp4!ames!jaw)
* Joe Orost (decvax!vax135!petsd!joe)
* Dave Mack (csu@alembic.acs.com)
* Peter Jannesen, Network Communication Systems
* (peter@ncs.nl)
*
* marc@suse.de : a small security fix for a buffer overflow
*
* [... History snipped ...]
*
*/
#include <stdio.h>
#define IBUFSIZ 2048 /* Defailt input buffer size */
#define OBUFSIZ 2048 /* Default output buffer size */
/* Defines for third byte of header */
#define MAGIC_1 (char_type)'\037'/* First byte of compressed file */
#define MAGIC_2 (char_type)'\235'/* Second byte of compressed file */
#define BIT_MASK 0x1f /* Mask for 'number of compresssion bits' */
/* Masks 0x20 and 0x40 are free. */
/* I think 0x20 should mean that there is */
/* a fourth header byte (for expansion). */
#define BLOCK_MODE 0x80 /* Block compresssion if table is full and */
/* compression rate is dropping flush tables */
/* the next two codes should not be changed lightly, as they must not */
/* lie within the contiguous general code space. */
#define FIRST 257 /* first free entry */
#define CLEAR 256 /* table clear output code */
#define INIT_BITS 9 /* initial number of bits/code */
/*
* machine variants which require cc -Dmachine: pdp11, z8000, DOS
*/
#define FAST
#define HBITS 17 /* 50% occupancy */
#define HSIZE (1<<HBITS)
#define HMASK (HSIZE-1)
#define HPRIME 9941
#define BITS 16
#undef MAXSEG_64K
typedef long int code_int;
typedef long int count_int;
typedef long int cmp_code_int;
typedef unsigned char char_type;
#define MAXCODE(n) (1L << (n))
int block_mode = BLOCK_MODE;/* Block compress mode -C compatible with 2.0*/
int maxbits = BITS; /* user settable max # bits/code */
int exit_code = -1; /* Exitcode of compress (-1 no file compressed) */
char_type inbuf[IBUFSIZ+64]; /* Input buffer */
char_type outbuf[OBUFSIZ+2048];/* Output buffer */
count_int htab[HSIZE];
unsigned short codetab[HSIZE];
#define htabof(i) htab[i]
#define codetabof(i) codetab[i]
#define tab_prefixof(i) codetabof(i)
#define tab_suffixof(i) ((char_type *)(htab))[i]
#define de_stack ((char_type *)&(htab[HSIZE-1]))
#define clear_htab() memset(htab, -1, sizeof(htab))
#define clear_tab_prefixof() memset(codetab, 0, 256);
extern int uncompress ( FILE *, FILE * );
/*
* Decompress stdin to stdout. This routine adapts to the codes in the
* file building the "string" table on-the-fly; requiring no table to
* be stored in the compressed file. The tables used herein are shared
* with those of the compress() routine. See the definitions above.
*/
int uncompress ( FILE * fdin, FILE * fdout )
{
char_type *stackp;
code_int code;
int finchar;
code_int oldcode;
code_int incode;
int inbits;
int posbits;
int outpos;
int insize;
int bitmask;
code_int free_ent;
code_int maxcode;
code_int maxmaxcode;
int n_bits;
int rsize = 0;
insize = 0;
inbuf [0] = fgetc(fdin);
maxbits = inbuf[0] & BIT_MASK;
block_mode = inbuf[0] & BLOCK_MODE;
maxmaxcode = MAXCODE(maxbits);
if (maxbits > BITS)
{
fprintf(stderr, "compressed with %d bits, can only handle %d bits\n", maxbits, BITS);
return -1;
}
//fprintf(stderr, "Bits: %d, block_mode: %d\n", maxbits, block_mode );
maxcode = MAXCODE(n_bits = INIT_BITS)-1;
bitmask = (1<<n_bits)-1;
oldcode = -1;
finchar = 0;
outpos = 0;
posbits = 0<<3;
free_ent = ((block_mode) ? FIRST : 256);
clear_tab_prefixof(); /* As above, initialize the first
256 entries in the table. */
for (code = 255 ; code >= 0 ; --code)
tab_suffixof(code) = (char_type)code;
do
{
resetbuf: ;
{
int i;
int e;
int o;
e = insize-(o = (posbits>>3));
for (i = 0 ; i < e ; ++i)
inbuf[i] = inbuf[i+o];
insize = e;
posbits = 0;
}
if (insize < (int) sizeof(inbuf)-IBUFSIZ)
{
rsize = fread(inbuf+insize, 1,IBUFSIZ,fdin);
if ( !rsize && ferror(fdin))
return -1;
insize += rsize;
}
inbits = ((rsize > 0) ? (insize - insize%n_bits)<<3 :
(insize<<3)-(n_bits-1));
while (inbits > posbits)
{
if (free_ent > maxcode)
{
posbits = ((posbits-1) + ((n_bits<<3) -
(posbits-1+(n_bits<<3))%(n_bits<<3)));
++n_bits;
if (n_bits == maxbits)
maxcode = maxmaxcode;
else
maxcode = MAXCODE(n_bits)-1;
bitmask = (1<<n_bits)-1;
goto resetbuf;
}
{
char_type *p = &inbuf[posbits>>3];
code = ((((long)(p[0]))|((long)(p[1])<<8)|((long)(p[2])<<16))>>(posbits&0x7))&bitmask;
}
posbits += n_bits;
if (oldcode == -1)
{
outbuf[outpos++] = (char_type)(finchar = (int)(oldcode = code));
continue;
}
if (code == CLEAR && block_mode)
{
clear_tab_prefixof();
free_ent = FIRST - 1;
posbits = ((posbits-1) + ((n_bits<<3) -
(posbits-1+(n_bits<<3))%(n_bits<<3)));
maxcode = MAXCODE(n_bits = INIT_BITS)-1;
bitmask = (1<<n_bits)-1;
goto resetbuf;
}
incode = code;
stackp = de_stack;
if (code >= free_ent) /* Special case for KwKwK string. */
{
if (code > free_ent)
{
char_type *p;
posbits -= n_bits;
p = &inbuf[posbits>>3];
fprintf(stderr, "insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)\n", insize, posbits,
p[-1],p[0],p[1],p[2],p[3], (posbits&07));
fprintf(stderr, "uncompress: corrupt input\n");
return -1;
}
*--stackp = (char_type)finchar;
code = oldcode;
}
while ((cmp_code_int)code >= (cmp_code_int)256)
{ /* Generate output characters in reverse order */
*--stackp = tab_suffixof(code);
code = tab_prefixof(code);
}
*--stackp = (char_type)(finchar = tab_suffixof(code));
/* And put them out in forward order */
{
int i;
if (outpos+(i = (de_stack-stackp)) >= OBUFSIZ)
{
do
{
if (i > OBUFSIZ-outpos) i = OBUFSIZ-outpos;
if (i > 0)
{
memcpy(outbuf+outpos, stackp, i);
outpos += i;
}
if (outpos >= OBUFSIZ)
{
fwrite(outbuf, 1,outpos,fdout);
outpos = 0;
}
stackp+= i;
}
while ((i = (de_stack-stackp)) > 0);
}
else
{
memcpy(outbuf+outpos, stackp, i);
outpos += i;
}
}
if ((code = free_ent) < maxmaxcode) /* Generate the new entry. */
{
tab_prefixof(code) = (unsigned short)oldcode;
tab_suffixof(code) = (char_type)finchar;
free_ent = code+1;
}
oldcode = incode; /* Remember previous code. */
}
}
while (rsize > 0);
if (outpos > 0)
fwrite(outbuf, outpos,1, fdout);
return 0;
}
#endif
File diff suppressed because it is too large. Load diff
+3 -3
View File
@@ -91,8 +91,7 @@ file_header_t *get_header_ar(FILE *src_stream)
}
} else {
/* short filenames */
typed->name = xcalloc(1, 16);
strncpy(typed->name, ar.formated.name, 16);
typed->name = xstrndup(ar.formated.name, 16);
}
typed->name[strcspn(typed->name, " /")]='\0';
@@ -103,4 +102,5 @@ file_header_t *get_header_ar(FILE *src_stream)
typed->gid = atoi(ar.formated.gid);
return(typed);
}
}
+2 -1
View File
@@ -133,4 +133,5 @@ file_header_t *get_header_cpio(FILE *src_stream)
}
}
return(cpio_entry);
}
}
+98 -32
View File
@@ -20,24 +20,24 @@
#include "unarchive.h"
#include "libbb.h"
file_header_t *get_header_tar(FILE *tar_stream)
file_header_t *get_header_tar(FILE * tar_stream)
{
union {
unsigned char raw[512];
struct {
char name[100]; /* 0-99 */
char mode[8]; /* 100-107 */
char uid[8]; /* 108-115 */
char gid[8]; /* 116-123 */
char size[12]; /* 124-135 */
char mtime[12]; /* 136-147 */
char chksum[8]; /* 148-155 */
char typeflag; /* 156-156 */
char name[100]; /* 0-99 */
char mode[8]; /* 100-107 */
char uid[8]; /* 108-115 */
char gid[8]; /* 116-123 */
char size[12]; /* 124-135 */
char mtime[12]; /* 136-147 */
char chksum[8]; /* 148-155 */
char typeflag; /* 156-156 */
char linkname[100]; /* 157-256 */
char magic[6]; /* 257-262 */
char magic[6]; /* 257-262 */
char version[2]; /* 263-264 */
char uname[32]; /* 265-296 */
char gname[32]; /* 297-328 */
char uname[32]; /* 265-296 */
char gname[32]; /* 297-328 */
char devmajor[8]; /* 329-336 */
char devminor[8]; /* 337-344 */
char prefix[155]; /* 345-499 */
@@ -55,45 +55,111 @@ file_header_t *get_header_tar(FILE *tar_stream)
if (fread(tar.raw, 1, 512, tar_stream) != 512) {
/* Unfortunatly its common for tar files to have all sorts of
* trailing garbage, fail silently */
// error_msg("Couldnt read header");
return(NULL);
return (NULL);
}
archive_offset += 512;
/* Check header has valid magic, unfortunately some tar files
* have empty (0'ed) tar entries at the end, which will
* cause this to fail, so fail silently for now
/* Check header has valid magic, "ustar" is for the proper tar
* 0's are for the old tar format
*/
if (strncmp(tar.formated.magic, "ustar", 5) != 0) {
return(NULL);
#ifdef CONFIG_FEATURE_TAR_OLD_FORMAT
if (strncmp(tar.formated.magic, "\0\0\0\0\0", 5) != 0)
#endif
return (NULL);
}
/* If there is no filename its an empty header, skip it */
if (tar.formated.name[0] == 0) {
return (NULL);
}
/* Do checksum on headers */
for (i = 0; i < 148 ; i++) {
for (i = 0; i < 148; i++) {
sum += tar.raw[i];
}
sum += ' ' * 8;
for (i = 156; i < 512 ; i++) {
for (i = 156; i < 512; i++) {
sum += tar.raw[i];
}
if (sum != strtol(tar.formated.chksum, NULL, 8)) {
error_msg("Invalid tar header checksum");
return(NULL);
return (NULL);
}
/* convert to type'ed variables */
tar_entry = xcalloc(1, sizeof(file_header_t));
tar_entry->name = xstrdup(tar.formated.name);
if (tar.formated.prefix[0] == 0) {
tar_entry->name = xstrdup(tar.formated.name);
} else {
tar_entry->name =
concat_path_file(tar.formated.prefix, tar.formated.name);
}
parse_mode(tar.formated.mode, &tar_entry->mode);
tar_entry->uid = strtol(tar.formated.uid, NULL, 8);
tar_entry->gid = strtol(tar.formated.gid, NULL, 8);
tar_entry->size = strtol(tar.formated.size, NULL, 8);
tar_entry->mode = strtol(tar.formated.mode, NULL, 8);
tar_entry->uid = strtol(tar.formated.uid, NULL, 8);
tar_entry->gid = strtol(tar.formated.gid, NULL, 8);
tar_entry->size = strtol(tar.formated.size, NULL, 8);
tar_entry->mtime = strtol(tar.formated.mtime, NULL, 8);
tar_entry->link_name = strlen(tar.formated.linkname) ?
xstrdup(tar.formated.linkname) : NULL;
tar_entry->device = (strtol(tar.formated.devmajor, NULL, 8) << 8) +
strtol(tar.formated.devminor, NULL, 8);
tar_entry->link_name =
strlen(tar.formated.linkname) ? xstrdup(tar.formated.linkname) : NULL;
tar_entry->device =
(dev_t) ((strtol(tar.formated.devmajor, NULL, 8) << 8) +
strtol(tar.formated.devminor, NULL, 8));
return(tar_entry);
}
#if defined CONFIG_FEATURE_TAR_OLD_FORMAT || defined CONFIG_FEATURE_GNUTAR_LONG_FILENAME
switch (tar.formated.typeflag) {
# ifdef CONFIG_FEATURE_TAR_OLD_FORMAT
case 0:
tar_entry->mode |= S_IFREG;
break;
case 1:
error_msg("internal hard link not handled\n");
break;
case 2:
tar_entry->mode |= S_IFLNK;
break;
case 3:
tar_entry->mode |= S_IFCHR;
break;
case 4:
tar_entry->mode |= S_IFBLK;
break;
case 5:
tar_entry->mode |= S_IFDIR;
break;
case 6:
tar_entry->mode |= S_IFIFO;
break;
# endif
# ifdef CONFIG_FEATURE_GNUTAR_LONG_FILENAME
case 'L': {
char *longname;
longname = xmalloc(tar_entry->size + 1);
fread(longname, 1, tar_entry->size, tar_stream);
archive_offset += tar_entry->size;
longname[tar_entry->size] = '\0';
tar_entry = get_header_tar(tar_stream);
tar_entry->name = longname;
break;
}
case 'K': {
char *longname;
longname = xmalloc(tar_entry->size + 1);
fread(longname, 1, tar_entry->size, tar_stream);
archive_offset += tar_entry->size;
longname[tar_entry->size] = '\0';
tar_entry = get_header_tar(tar_stream);
tar_entry->link_name = longname;
break;
}
# endif
}
#endif
return (tar_entry);
}
+171
View File
@@ -0,0 +1,171 @@
/* vi: set sw=4 ts=4: */
/*
* get_header_zip for busybox
*
* Copyright (C) 2001 by Laurence Anderson
*
* 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 <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "unarchive.h"
#include "libbb.h"
#define ZIP_FILEHEADER_MAGIC 0x04034b50
#define ZIP_CDS_MAGIC 0x02014b50
#define ZIP_CDS_END_MAGIC 0x06054b50
#define ZIP_DD_MAGIC 0x08074b50
enum {
zh_version,
zh_flags,
zh_method,
zh_modtime,
zh_moddate,
zh_crc32,
zh_cmpsize,
zh_ucmpsize,
zh_filename_len,
zh_extra_len
};
static const char fail_msg[] = "Invalid file or read error";
static int le_read_int(FILE *fp, int n)
{
int r = 0;
int s = 1;
int c;
archive_offset += n;
do {
if ((c = fgetc(fp)) == EOF) {
error_msg_and_die(fail_msg);
}
r += s * c;
s <<= 8;
} while (--n);
return r;
}
static void read_header(FILE *fp, int *zh)
{
static const char s[] = { 2, 2, 2, 2, 2, 4, 4, 4, 2, 2, 0 };
int i = 0;
do {
zh[i] = le_read_int(fp, s[i]);
} while (s[++i]);
}
file_header_t *get_header_zip(FILE *zip_stream)
{
int zip_header[10];
file_header_t *zip_entry = NULL;
int magic, tmpmagic;
/* If dd_ahead is true, we didn't know the last extracted file's length. */
static int dd_ahead = 0;
magic = le_read_int(zip_stream, 4);
checkmagic:
switch (magic) {
case ZIP_FILEHEADER_MAGIC:
zip_entry = xcalloc(1, sizeof(file_header_t));
read_header(zip_stream, zip_header);
if (zip_header[zh_method] == 8) {
zip_entry->extract_func = &inflate;
} else if (zip_header[zh_method] != 0) {
error_msg_and_die("Unsupported compression method %d\n",
zip_header[zh_method]);
}
zip_entry->name = xmalloc(zip_header[zh_filename_len] + 1);
if (!fread(zip_entry->name, zip_header[zh_filename_len], 1, zip_stream)) {
error_msg_and_die(fail_msg);
}
archive_offset += zip_header[zh_filename_len];
seek_sub_file(zip_stream, zip_header[zh_extra_len]);
zip_entry->size = zip_header[zh_cmpsize];
zip_entry->mode = S_IFREG | 0777;
/* Time/Date? */
zip_entry->name[zip_header[zh_filename_len]] = 0;
if (*(zip_entry->name + zip_header[zh_filename_len] - 1) == '/') {
/* Files that end in a / are directories */
/* Remove trailing / so unarchive doesn't get confused */
*(zip_entry->name + zip_header[zh_filename_len] - 1) = '\0';
zip_entry->mode ^= S_IFREG;
zip_entry->mode |= S_IFDIR;
}
if (zip_header[zh_flags] & 0x8) {
/* crc32, and sizes are in the data description _after_ the file */
if (zip_header[zh_cmpsize] == 0) {
/* As we don't know how long this file it is difficult to skip!
* but it is compressed, so normally its ok */
dd_ahead = 1;
}
if (zip_header[zh_ucmpsize] != 0) {
/* Humm... we would otherwise skip this twice - not good! */
dd_ahead = 2;
}
}
break;
case ZIP_CDS_MAGIC: /* FALLTHRU */
case ZIP_CDS_END_MAGIC:
return(NULL);
break;
case ZIP_DD_MAGIC: {
int cmpsize;
seek_sub_file(zip_stream, 4); // Skip crc32
cmpsize = le_read_int(zip_stream, 4);
if (dd_ahead == 1) archive_offset += cmpsize;
seek_sub_file(zip_stream, 4); // Skip uncompressed size
dd_ahead = 0;
return (get_header_zip(zip_stream));
break; }
default:
if (!dd_ahead) error_msg("Invalid magic (%#x): Trying to skip junk", magic);
dd_ahead = 0;
while ((tmpmagic = fgetc(zip_stream)) != EOF) {
archive_offset++;
magic = ((magic >> 8) & 0x00ffffff) | ((tmpmagic << 24) & 0xff000000);
if (magic == ZIP_FILEHEADER_MAGIC
|| magic == ZIP_CDS_MAGIC
|| magic == ZIP_CDS_END_MAGIC) {
goto checkmagic;
}
}
error_msg_and_die(fail_msg);
}
return(zip_entry);
}
+2 -1
View File
@@ -32,4 +32,5 @@ void seek_sub_file(FILE *src_stream, const int count)
}
}
return;
}
}
+30 -8
View File
@@ -21,8 +21,10 @@
#include <string.h>
#include <unistd.h>
#include <utime.h>
#include <sys/wait.h>
#include <signal.h>
#include "unarchive.h"
#include "libbb.h"
#include "busybox.h"
/* Extract the data postioned at src_stream to either filesystem, stdout or
* buffer depending on the value of 'function' which is defined in libbb.h
@@ -56,9 +58,7 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f
return(NULL);
}
}
full_name = xmalloc(strlen(prefix) + strlen(path) + 1);
strcpy(full_name, prefix);
strcat(full_name, path);
bb_asprintf(&full_name, "%s%s", prefix, path);
} else {
full_name = file_entry->name;
}
@@ -120,7 +120,8 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f
return NULL;
}
archive_offset += file_entry->size;
copy_file_chunk(src_stream, dst_stream, file_entry->size);
if (file_entry->extract_func) file_entry->extract_func(src_stream, dst_stream);
else copy_file_chunk(src_stream, dst_stream, file_entry->size);
fclose(dst_stream);
}
break;
@@ -189,7 +190,9 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f
fprintf(out_stream, "%s\n", full_name);
}
free(full_name);
if (prefix != NULL) {
free(full_name);
}
return(NULL); /* Maybe we should say if failed */
}
@@ -201,7 +204,22 @@ char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_headers
int extract_flag = TRUE;
int i;
char *buffer = NULL;
#ifdef CONFIG_FEATURE_UNARCHIVE_TAPE
int pid, tape_pipe[2];
if (pipe(tape_pipe) != 0) error_msg_and_die("Can't create pipe\n");
if ((pid = fork()) == -1) error_msg_and_die("Fork failed\n");
if (pid==0) { /* child process */
close(tape_pipe[0]); /* We don't wan't to read from the pipe */
copyfd(fileno(src_stream), tape_pipe[1]);
close(tape_pipe[1]); /* Send EOF */
exit(0);
/* notreached */
}
close(tape_pipe[1]); /* Don't want to write down the pipe */
fclose(src_stream);
src_stream = fdopen(tape_pipe[0], "r");
#endif
archive_offset = 0;
while ((file_entry = get_headers(src_stream)) != NULL) {
@@ -227,7 +245,7 @@ char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_headers
}
}
if (extract_flag == TRUE) {
if (extract_flag) {
buffer = extract_archive(src_stream, out_stream, file_entry, extract_function, prefix);
} else {
/* seek past the data entry */
@@ -237,5 +255,9 @@ char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_headers
free(file_entry->link_name);
free(file_entry);
}
#ifdef CONFIG_FEATURE_UNARCHIVE_TAPE
kill(pid, SIGTERM);
waitpid(pid, NULL, 0);
#endif
return(buffer);
}
}
+313
View File
@@ -0,0 +1,313 @@
#include "config.h"
#include "libbb.h"
#ifdef CONFIG_FEATURE_UNCOMPRESS
/* uncompress for busybox -- (c) 2002 Robert Griebl
*
* based on the original compress42.c source
* (see disclaimer below)
*/
/* (N)compress42.c - File compression ala IEEE Computer, Mar 1992.
*
* Authors:
* Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas)
* Jim McKie (decvax!mcvax!jim)
* Steve Davies (decvax!vax135!petsd!peora!srd)
* Ken Turkowski (decvax!decwrl!turtlevax!ken)
* James A. Woods (decvax!ihnp4!ames!jaw)
* Joe Orost (decvax!vax135!petsd!joe)
* Dave Mack (csu@alembic.acs.com)
* Peter Jannesen, Network Communication Systems
* (peter@ncs.nl)
*
* marc@suse.de : a small security fix for a buffer overflow
*
* [... History snipped ...]
*
*/
#include <stdio.h>
#define IBUFSIZ 2048 /* Defailt input buffer size */
#define OBUFSIZ 2048 /* Default output buffer size */
/* Defines for third byte of header */
#define MAGIC_1 (char_type)'\037'/* First byte of compressed file */
#define MAGIC_2 (char_type)'\235'/* Second byte of compressed file */
#define BIT_MASK 0x1f /* Mask for 'number of compresssion bits' */
/* Masks 0x20 and 0x40 are free. */
/* I think 0x20 should mean that there is */
/* a fourth header byte (for expansion). */
#define BLOCK_MODE 0x80 /* Block compresssion if table is full and */
/* compression rate is dropping flush tables */
/* the next two codes should not be changed lightly, as they must not */
/* lie within the contiguous general code space. */
#define FIRST 257 /* first free entry */
#define CLEAR 256 /* table clear output code */
#define INIT_BITS 9 /* initial number of bits/code */
/*
* machine variants which require cc -Dmachine: pdp11, z8000, DOS
*/
#define FAST
#define HBITS 17 /* 50% occupancy */
#define HSIZE (1<<HBITS)
#define HMASK (HSIZE-1)
#define HPRIME 9941
#define BITS 16
#undef MAXSEG_64K
typedef long int code_int;
typedef long int count_int;
typedef long int cmp_code_int;
typedef unsigned char char_type;
#define MAXCODE(n) (1L << (n))
int block_mode = BLOCK_MODE;/* Block compress mode -C compatible with 2.0*/
int maxbits = BITS; /* user settable max # bits/code */
int exit_code = -1; /* Exitcode of compress (-1 no file compressed) */
char_type inbuf[IBUFSIZ+64]; /* Input buffer */
char_type outbuf[OBUFSIZ+2048];/* Output buffer */
count_int htab[HSIZE];
unsigned short codetab[HSIZE];
#define htabof(i) htab[i]
#define codetabof(i) codetab[i]
#define tab_prefixof(i) codetabof(i)
#define tab_suffixof(i) ((char_type *)(htab))[i]
#define de_stack ((char_type *)&(htab[HSIZE-1]))
#define clear_htab() memset(htab, -1, sizeof(htab))
#define clear_tab_prefixof() memset(codetab, 0, 256);
extern int uncompress ( FILE *, FILE * );
/*
* Decompress stdin to stdout. This routine adapts to the codes in the
* file building the "string" table on-the-fly; requiring no table to
* be stored in the compressed file. The tables used herein are shared
* with those of the compress() routine. See the definitions above.
*/
int uncompress ( FILE * fdin, FILE * fdout )
{
char_type *stackp;
code_int code;
int finchar;
code_int oldcode;
code_int incode;
int inbits;
int posbits;
int outpos;
int insize;
int bitmask;
code_int free_ent;
code_int maxcode;
code_int maxmaxcode;
int n_bits;
int rsize = 0;
insize = 0;
inbuf [0] = fgetc(fdin);
maxbits = inbuf[0] & BIT_MASK;
block_mode = inbuf[0] & BLOCK_MODE;
maxmaxcode = MAXCODE(maxbits);
if (maxbits > BITS)
{
fprintf(stderr, "compressed with %d bits, can only handle %d bits\n", maxbits, BITS);
return -1;
}
//fprintf(stderr, "Bits: %d, block_mode: %d\n", maxbits, block_mode );
maxcode = MAXCODE(n_bits = INIT_BITS)-1;
bitmask = (1<<n_bits)-1;
oldcode = -1;
finchar = 0;
outpos = 0;
posbits = 0<<3;
free_ent = ((block_mode) ? FIRST : 256);
clear_tab_prefixof(); /* As above, initialize the first
256 entries in the table. */
for (code = 255 ; code >= 0 ; --code)
tab_suffixof(code) = (char_type)code;
do
{
resetbuf: ;
{
int i;
int e;
int o;
e = insize-(o = (posbits>>3));
for (i = 0 ; i < e ; ++i)
inbuf[i] = inbuf[i+o];
insize = e;
posbits = 0;
}
if (insize < (int) sizeof(inbuf)-IBUFSIZ)
{
rsize = fread(inbuf+insize, 1,IBUFSIZ,fdin);
if ( !rsize && ferror(fdin))
return -1;
insize += rsize;
}
inbits = ((rsize > 0) ? (insize - insize%n_bits)<<3 :
(insize<<3)-(n_bits-1));
while (inbits > posbits)
{
if (free_ent > maxcode)
{
posbits = ((posbits-1) + ((n_bits<<3) -
(posbits-1+(n_bits<<3))%(n_bits<<3)));
++n_bits;
if (n_bits == maxbits)
maxcode = maxmaxcode;
else
maxcode = MAXCODE(n_bits)-1;
bitmask = (1<<n_bits)-1;
goto resetbuf;
}
{
char_type *p = &inbuf[posbits>>3];
code = ((((long)(p[0]))|((long)(p[1])<<8)|((long)(p[2])<<16))>>(posbits&0x7))&bitmask;
}
posbits += n_bits;
if (oldcode == -1)
{
outbuf[outpos++] = (char_type)(finchar = (int)(oldcode = code));
continue;
}
if (code == CLEAR && block_mode)
{
clear_tab_prefixof();
free_ent = FIRST - 1;
posbits = ((posbits-1) + ((n_bits<<3) -
(posbits-1+(n_bits<<3))%(n_bits<<3)));
maxcode = MAXCODE(n_bits = INIT_BITS)-1;
bitmask = (1<<n_bits)-1;
goto resetbuf;
}
incode = code;
stackp = de_stack;
if (code >= free_ent) /* Special case for KwKwK string. */
{
if (code > free_ent)
{
char_type *p;
posbits -= n_bits;
p = &inbuf[posbits>>3];
fprintf(stderr, "insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)\n", insize, posbits,
p[-1],p[0],p[1],p[2],p[3], (posbits&07));
fprintf(stderr, "uncompress: corrupt input\n");
return -1;
}
*--stackp = (char_type)finchar;
code = oldcode;
}
while ((cmp_code_int)code >= (cmp_code_int)256)
{ /* Generate output characters in reverse order */
*--stackp = tab_suffixof(code);
code = tab_prefixof(code);
}
*--stackp = (char_type)(finchar = tab_suffixof(code));
/* And put them out in forward order */
{
int i;
if (outpos+(i = (de_stack-stackp)) >= OBUFSIZ)
{
do
{
if (i > OBUFSIZ-outpos) i = OBUFSIZ-outpos;
if (i > 0)
{
memcpy(outbuf+outpos, stackp, i);
outpos += i;
}
if (outpos >= OBUFSIZ)
{
fwrite(outbuf, 1,outpos,fdout);
outpos = 0;
}
stackp+= i;
}
while ((i = (de_stack-stackp)) > 0);
}
else
{
memcpy(outbuf+outpos, stackp, i);
outpos += i;
}
}
if ((code = free_ent) < maxmaxcode) /* Generate the new entry. */
{
tab_prefixof(code) = (unsigned short)oldcode;
tab_suffixof(code) = (char_type)finchar;
free_ent = code+1;
}
oldcode = incode; /* Remember previous code. */
}
}
while (rsize > 0);
if (outpos > 0)
fwrite(outbuf, outpos,1, fdout);
return 0;
}
#endif
File diff suppressed because it is too large. Load diff
+300 -266
View File
@@ -10,7 +10,7 @@
* very different now (i.e., cleaner, less global variables, etc.)
*
* Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
* Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
* Copyright (C) 1999-2002 by Erik Andersen <andersee@debian.org>
*
* Based in part in the tar implementation in sash
* Copyright (c) 1999 by David I. Bell
@@ -47,14 +47,17 @@
#include <fnmatch.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include "unarchive.h"
#include "busybox.h"
#ifdef CONFIG_FEATURE_TAR_CREATE
/* Tar file constants */
# define TAR_MAGIC "ustar" /* ustar and a null */
# define TAR_VERSION " " /* Be compatable with GNU tar format */
# define TAR_MAGIC "ustar" /* ustar and a null */
# define TAR_VERSION " " /* Be compatable with GNU tar format */
# ifndef MAJOR
# define MAJOR(dev) (((dev)>>8)&0xff)
@@ -66,26 +69,25 @@ static const int TAR_MAGIC_LEN = 6;
static const int TAR_VERSION_LEN = 2;
/* POSIX tar Header Block, from POSIX 1003.1-1990 */
enum { NAME_SIZE = 100 }; /* because gcc won't let me use 'static const int' */
struct TarHeader
{ /* byte offset */
char name[NAME_SIZE]; /* 0-99 */
char mode[8]; /* 100-107 */
char uid[8]; /* 108-115 */
char gid[8]; /* 116-123 */
char size[12]; /* 124-135 */
char mtime[12]; /* 136-147 */
char chksum[8]; /* 148-155 */
char typeflag; /* 156-156 */
char linkname[NAME_SIZE]; /* 157-256 */
char magic[6]; /* 257-262 */
char version[2]; /* 263-264 */
char uname[32]; /* 265-296 */
char gname[32]; /* 297-328 */
char devmajor[8]; /* 329-336 */
char devminor[8]; /* 337-344 */
char prefix[155]; /* 345-499 */
char padding[12]; /* 500-512 (pad to exactly the TAR_BLOCK_SIZE) */
enum { NAME_SIZE = 100 }; /* because gcc won't let me use 'static const int' */
struct TarHeader { /* byte offset */
char name[NAME_SIZE]; /* 0-99 */
char mode[8]; /* 100-107 */
char uid[8]; /* 108-115 */
char gid[8]; /* 116-123 */
char size[12]; /* 124-135 */
char mtime[12]; /* 136-147 */
char chksum[8]; /* 148-155 */
char typeflag; /* 156-156 */
char linkname[NAME_SIZE]; /* 157-256 */
char magic[6]; /* 257-262 */
char version[2]; /* 263-264 */
char uname[32]; /* 265-296 */
char gname[32]; /* 297-328 */
char devmajor[8]; /* 329-336 */
char devminor[8]; /* 337-344 */
char prefix[155]; /* 345-499 */
char padding[12]; /* 500-512 (pad to exactly the TAR_BLOCK_SIZE) */
};
typedef struct TarHeader TarHeader;
@@ -95,58 +97,56 @@ typedef struct TarHeader TarHeader;
** Even these functions use the xxxHardLinkInfo() functions.
*/
typedef struct HardLinkInfo HardLinkInfo;
struct HardLinkInfo
{
HardLinkInfo *next; /* Next entry in list */
dev_t dev; /* Device number */
ino_t ino; /* Inode number */
short linkCount; /* (Hard) Link Count */
char name[1]; /* Start of filename (must be last) */
struct HardLinkInfo {
HardLinkInfo *next; /* Next entry in list */
dev_t dev; /* Device number */
ino_t ino; /* Inode number */
short linkCount; /* (Hard) Link Count */
char name[1]; /* Start of filename (must be last) */
};
/* Some info to be carried along when creating a new tarball */
struct TarBallInfo
{
char* fileName; /* File name of the tarball */
int tarFd; /* Open-for-write file descriptor
for the tarball */
struct stat statBuf; /* Stat info for the tarball, letting
us know the inode and device that the
tarball lives, so we can avoid trying
to include the tarball into itself */
int verboseFlag; /* Whether to print extra stuff or not */
char** excludeList; /* List of files to not include */
HardLinkInfo *hlInfoHead; /* Hard Link Tracking Information */
HardLinkInfo *hlInfo; /* Hard Link Info for the current file */
struct TarBallInfo {
char *fileName; /* File name of the tarball */
int tarFd; /* Open-for-write file descriptor
for the tarball */
struct stat statBuf; /* Stat info for the tarball, letting
us know the inode and device that the
tarball lives, so we can avoid trying
to include the tarball into itself */
int verboseFlag; /* Whether to print extra stuff or not */
char **excludeList; /* List of files to not include */
HardLinkInfo *hlInfoHead; /* Hard Link Tracking Information */
HardLinkInfo *hlInfo; /* Hard Link Info for the current file */
};
typedef struct TarBallInfo TarBallInfo;
/* A nice enum with all the possible tar file content types */
enum TarFileType
{
REGTYPE = '0', /* regular file */
REGTYPE0 = '\0', /* regular file (ancient bug compat)*/
LNKTYPE = '1', /* hard link */
SYMTYPE = '2', /* symbolic link */
CHRTYPE = '3', /* character special */
BLKTYPE = '4', /* block special */
DIRTYPE = '5', /* directory */
FIFOTYPE = '6', /* FIFO special */
CONTTYPE = '7', /* reserved */
GNULONGLINK = 'K', /* GNU long (>100 chars) link name */
GNULONGNAME = 'L', /* GNU long (>100 chars) file name */
enum TarFileType {
REGTYPE = '0', /* regular file */
REGTYPE0 = '\0', /* regular file (ancient bug compat) */
LNKTYPE = '1', /* hard link */
SYMTYPE = '2', /* symbolic link */
CHRTYPE = '3', /* character special */
BLKTYPE = '4', /* block special */
DIRTYPE = '5', /* directory */
FIFOTYPE = '6', /* FIFO special */
CONTTYPE = '7', /* reserved */
GNULONGLINK = 'K', /* GNU long (>100 chars) link name */
GNULONGNAME = 'L', /* GNU long (>100 chars) file name */
};
typedef enum TarFileType TarFileType;
/* Might be faster (and bigger) if the dev/ino were stored in numeric order;) */
static void
addHardLinkInfo (HardLinkInfo **hlInfoHeadPtr, dev_t dev, ino_t ino,
short linkCount, const char *name)
static inline void addHardLinkInfo(HardLinkInfo ** hlInfoHeadPtr, dev_t dev,
ino_t ino, short linkCount,
const char *name)
{
/* Note: hlInfoHeadPtr can never be NULL! */
HardLinkInfo *hlInfo;
hlInfo = (HardLinkInfo *)xmalloc(sizeof(HardLinkInfo)+strlen(name)+1);
hlInfo =
(HardLinkInfo *) xmalloc(sizeof(HardLinkInfo) + strlen(name) + 1);
if (hlInfo) {
hlInfo->next = *hlInfoHeadPtr;
*hlInfoHeadPtr = hlInfo;
@@ -158,8 +158,7 @@ addHardLinkInfo (HardLinkInfo **hlInfoHeadPtr, dev_t dev, ino_t ino,
return;
}
static void
freeHardLinkInfo (HardLinkInfo **hlInfoHeadPtr)
static void freeHardLinkInfo(HardLinkInfo ** hlInfoHeadPtr)
{
HardLinkInfo *hlInfo = NULL;
HardLinkInfo *hlInfoNext = NULL;
@@ -177,21 +176,21 @@ freeHardLinkInfo (HardLinkInfo **hlInfoHeadPtr)
}
/* Might be faster (and bigger) if the dev/ino were stored in numeric order;) */
static HardLinkInfo *
findHardLinkInfo (HardLinkInfo *hlInfo, dev_t dev, ino_t ino)
static inline HardLinkInfo *findHardLinkInfo(HardLinkInfo * hlInfo, dev_t dev,
ino_t ino)
{
while(hlInfo) {
while (hlInfo) {
if ((ino == hlInfo->ino) && (dev == hlInfo->dev))
break;
hlInfo = hlInfo->next;
}
return(hlInfo);
return (hlInfo);
}
/* Put an octal string into the specified buffer.
* The number is zero and space padded and possibly null padded.
* Returns TRUE if successful. */
static int putOctal (char *cp, int len, long value)
* Returns TRUE if successful. */
static int putOctal(char *cp, int len, long value)
{
int tempLength;
char tempBuffer[32];
@@ -199,10 +198,10 @@ static int putOctal (char *cp, int len, long value)
/* Create a string of the specified length with an initial space,
* leading zeroes and the octal number, and a trailing null. */
sprintf (tempString, "%0*lo", len - 1, value);
sprintf(tempString, "%0*lo", len - 1, value);
/* If the string is too large, suppress the leading space. */
tempLength = strlen (tempString) + 1;
tempLength = strlen(tempString) + 1;
if (tempLength > len) {
tempLength--;
tempString++;
@@ -217,71 +216,77 @@ static int putOctal (char *cp, int len, long value)
return FALSE;
/* Copy the string to the field. */
memcpy (cp, tempString, len);
memcpy(cp, tempString, len);
return TRUE;
}
/* Write out a tar header for the specified file/directory/whatever */
static int
writeTarHeader(struct TarBallInfo *tbInfo, const char *header_name,
const char *real_name, struct stat *statbuf)
static inline int writeTarHeader(struct TarBallInfo *tbInfo,
const char *header_name,
const char *real_name, struct stat *statbuf)
{
long chksum=0;
long chksum = 0;
struct TarHeader header;
const unsigned char *cp = (const unsigned char *) &header;
ssize_t size = sizeof(struct TarHeader);
memset( &header, 0, size);
strncpy(header.name, header_name, sizeof(header.name));
memset(&header, 0, size);
strncpy(header.name, header_name, sizeof(header.name));
putOctal(header.mode, sizeof(header.mode), statbuf->st_mode);
putOctal(header.uid, sizeof(header.uid), statbuf->st_uid);
putOctal(header.gid, sizeof(header.gid), statbuf->st_gid);
putOctal(header.size, sizeof(header.size), 0); /* Regular file size is handled later */
putOctal(header.size, sizeof(header.size), 0); /* Regular file size is handled later */
putOctal(header.mtime, sizeof(header.mtime), statbuf->st_mtime);
strncpy(header.magic, TAR_MAGIC TAR_VERSION,
TAR_MAGIC_LEN + TAR_VERSION_LEN );
strncpy(header.magic, TAR_MAGIC TAR_VERSION,
TAR_MAGIC_LEN + TAR_VERSION_LEN);
/* Enter the user and group names (default to root if it fails) */
my_getpwuid(header.uname, statbuf->st_uid);
if (! *header.uname)
if (!*header.uname)
strcpy(header.uname, "root");
my_getgrgid(header.gname, statbuf->st_gid);
if (! *header.uname)
if (!*header.uname)
strcpy(header.uname, "root");
if (tbInfo->hlInfo) {
/* This is a hard link */
header.typeflag = LNKTYPE;
strncpy(header.linkname, tbInfo->hlInfo->name, sizeof(header.linkname));
strncpy(header.linkname, tbInfo->hlInfo->name,
sizeof(header.linkname));
} else if (S_ISLNK(statbuf->st_mode)) {
char *lpath = xreadlink(real_name);
if (!lpath) /* Already printed err msg inside xreadlink() */
return ( FALSE);
header.typeflag = SYMTYPE;
strncpy(header.linkname, lpath, sizeof(header.linkname));
if (!lpath) /* Already printed err msg inside xreadlink() */
return (FALSE);
header.typeflag = SYMTYPE;
strncpy(header.linkname, lpath, sizeof(header.linkname));
free(lpath);
} else if (S_ISDIR(statbuf->st_mode)) {
header.typeflag = DIRTYPE;
strncat(header.name, "/", sizeof(header.name));
header.typeflag = DIRTYPE;
strncat(header.name, "/", sizeof(header.name));
} else if (S_ISCHR(statbuf->st_mode)) {
header.typeflag = CHRTYPE;
putOctal(header.devmajor, sizeof(header.devmajor), MAJOR(statbuf->st_rdev));
putOctal(header.devminor, sizeof(header.devminor), MINOR(statbuf->st_rdev));
header.typeflag = CHRTYPE;
putOctal(header.devmajor, sizeof(header.devmajor),
MAJOR(statbuf->st_rdev));
putOctal(header.devminor, sizeof(header.devminor),
MINOR(statbuf->st_rdev));
} else if (S_ISBLK(statbuf->st_mode)) {
header.typeflag = BLKTYPE;
putOctal(header.devmajor, sizeof(header.devmajor), MAJOR(statbuf->st_rdev));
putOctal(header.devminor, sizeof(header.devminor), MINOR(statbuf->st_rdev));
header.typeflag = BLKTYPE;
putOctal(header.devmajor, sizeof(header.devmajor),
MAJOR(statbuf->st_rdev));
putOctal(header.devminor, sizeof(header.devminor),
MINOR(statbuf->st_rdev));
} else if (S_ISFIFO(statbuf->st_mode)) {
header.typeflag = FIFOTYPE;
header.typeflag = FIFOTYPE;
} else if (S_ISREG(statbuf->st_mode)) {
header.typeflag = REGTYPE;
header.typeflag = REGTYPE;
putOctal(header.size, sizeof(header.size), statbuf->st_size);
} else {
error_msg("%s: Unknown file type", real_name);
return ( FALSE);
return (FALSE);
}
/* Calculate and store the checksum (i.e., the sum of all of the bytes of
@@ -294,29 +299,33 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *header_name,
while (size-- > 0)
chksum += *cp++;
putOctal(header.chksum, 7, chksum);
/* Now write the header out to disk */
if ((size=full_write(tbInfo->tarFd, (char*)&header, sizeof(struct TarHeader))) < 0) {
error_msg(io_error, real_name, strerror(errno));
return ( FALSE);
if ((size =
full_write(tbInfo->tarFd, (char *) &header,
sizeof(struct TarHeader))) < 0) {
error_msg(io_error, real_name, strerror(errno));
return (FALSE);
}
/* Pad the header up to the tar block size */
for (; size<TAR_BLOCK_SIZE; size++) {
for (; size < TAR_BLOCK_SIZE; size++) {
write(tbInfo->tarFd, "\0", 1);
}
/* Now do the verbose thing (or not) */
if (tbInfo->verboseFlag==TRUE) {
if (tbInfo->verboseFlag) {
FILE *vbFd = stdout;
if (tbInfo->tarFd == fileno(stdout)) // If the archive goes to stdout, verbose to stderr
if (tbInfo->verboseFlag == 2) /* If the archive goes to stdout, verbose to stderr */
vbFd = stderr;
fprintf(vbFd, "%s\n", header.name);
}
return ( TRUE);
return (TRUE);
}
# if defined CONFIG_FEATURE_TAR_EXCLUDE
static int exclude_file(char **excluded_files, const char *file)
static inline int exclude_file(char **excluded_files, const char *file)
{
int i;
@@ -333,7 +342,7 @@ static int exclude_file(char **excluded_files, const char *file)
for (p = file; p[0] != '\0'; p++) {
if ((p == file || p[-1] == '/') && p[0] != '/' &&
fnmatch(excluded_files[i], p,
fnmatch(excluded_files[i], p,
FNM_PATHNAME | FNM_LEADING_DIR) == 0)
return 1;
}
@@ -344,55 +353,57 @@ static int exclude_file(char **excluded_files, const char *file)
}
#endif
static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* userData)
static int writeFileToTarball(const char *fileName, struct stat *statbuf,
void *userData)
{
struct TarBallInfo *tbInfo = (struct TarBallInfo *)userData;
struct TarBallInfo *tbInfo = (struct TarBallInfo *) userData;
const char *header_name;
/*
** Check to see if we are dealing with a hard link.
** If so -
** Treat the first occurance of a given dev/inode as a file while
** treating any additional occurances as hard links. This is done
** by adding the file information to the HardLinkInfo linked list.
*/
** Check to see if we are dealing with a hard link.
** If so -
** Treat the first occurance of a given dev/inode as a file while
** treating any additional occurances as hard links. This is done
** by adding the file information to the HardLinkInfo linked list.
*/
tbInfo->hlInfo = NULL;
if (statbuf->st_nlink > 1) {
tbInfo->hlInfo = findHardLinkInfo(tbInfo->hlInfoHead, statbuf->st_dev,
statbuf->st_ino);
tbInfo->hlInfo = findHardLinkInfo(tbInfo->hlInfoHead, statbuf->st_dev,
statbuf->st_ino);
if (tbInfo->hlInfo == NULL)
addHardLinkInfo (&tbInfo->hlInfoHead, statbuf->st_dev,
statbuf->st_ino, statbuf->st_nlink, fileName);
addHardLinkInfo(&tbInfo->hlInfoHead, statbuf->st_dev,
statbuf->st_ino, statbuf->st_nlink, fileName);
}
/* It is against the rules to archive a socket */
if (S_ISSOCK(statbuf->st_mode)) {
error_msg("%s: socket ignored", fileName);
return( TRUE);
return (TRUE);
}
/* It is a bad idea to store the archive we are in the process of creating,
* so check the device and inode to be sure that this particular file isn't
* the new tarball */
if (tbInfo->statBuf.st_dev == statbuf->st_dev &&
tbInfo->statBuf.st_ino == statbuf->st_ino) {
tbInfo->statBuf.st_ino == statbuf->st_ino) {
error_msg("%s: file is the archive; skipping", fileName);
return( TRUE);
return (TRUE);
}
header_name = fileName;
while (header_name[0] == '/') {
static int alreadyWarned=FALSE;
if (alreadyWarned==FALSE) {
static int alreadyWarned = FALSE;
if (alreadyWarned == FALSE) {
error_msg("Removing leading '/' from member names");
alreadyWarned=TRUE;
alreadyWarned = TRUE;
}
header_name++;
}
if (strlen(fileName) >= NAME_SIZE) {
error_msg(name_longer_than_foo, NAME_SIZE);
return ( TRUE);
return (TRUE);
}
if (header_name[0] == '\0')
@@ -402,56 +413,61 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
if (exclude_file(tbInfo->excludeList, header_name)) {
return SKIP;
}
# endif //CONFIG_FEATURE_TAR_EXCLUDE
# endif /* CONFIG_FEATURE_TAR_EXCLUDE */
if (writeTarHeader(tbInfo, header_name, fileName, statbuf)==FALSE) {
return( FALSE);
}
if (writeTarHeader(tbInfo, header_name, fileName, statbuf) == FALSE) {
return (FALSE);
}
/* Now, if the file is a regular file, copy it out to the tarball */
if ((tbInfo->hlInfo == NULL)
&& (S_ISREG(statbuf->st_mode))) {
int inputFileFd;
&& (S_ISREG(statbuf->st_mode))) {
int inputFileFd;
char buffer[BUFSIZ];
ssize_t size=0, readSize=0;
ssize_t size = 0, readSize = 0;
/* open the file we want to archive, and make sure all is well */
if ((inputFileFd = open(fileName, O_RDONLY)) < 0) {
error_msg("%s: Cannot open: %s", fileName, strerror(errno));
return( FALSE);
return (FALSE);
}
/* write the file to the archive */
while ( (size = full_read(inputFileFd, buffer, sizeof(buffer))) > 0 ) {
if (full_write(tbInfo->tarFd, buffer, size) != size ) {
while ((size = full_read(inputFileFd, buffer, sizeof(buffer))) > 0) {
if (full_write(tbInfo->tarFd, buffer, size) != size) {
/* Output file seems to have a problem */
error_msg(io_error, fileName, strerror(errno));
return( FALSE);
error_msg(io_error, fileName, strerror(errno));
return (FALSE);
}
readSize+=size;
readSize += size;
}
if (size == -1) {
error_msg(io_error, fileName, strerror(errno));
return( FALSE);
error_msg(io_error, fileName, strerror(errno));
return (FALSE);
}
/* Pad the file up to the tar block size */
for (; (readSize%TAR_BLOCK_SIZE) != 0; readSize++) {
for (; (readSize % TAR_BLOCK_SIZE) != 0; readSize++) {
write(tbInfo->tarFd, "\0", 1);
}
close( inputFileFd);
close(inputFileFd);
}
return( TRUE);
return (TRUE);
}
static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
char** excludeList)
static inline int writeTarFile(const char *tarName, int verboseFlag,
char **argv, char **excludeList, int gzip)
{
int tarFd=-1;
int errorFlag=FALSE;
#ifdef CONFIG_FEATURE_TAR_GZIP
int gzipDataPipe[2] = { -1, -1 };
int gzipStatusPipe[2] = { -1, -1 };
pid_t gzipPid = 0;
#endif
int errorFlag = FALSE;
ssize_t size;
struct TarBallInfo tbInfo;
tbInfo.verboseFlag = verboseFlag;
tbInfo.hlInfoHead = NULL;
/* Make sure there is at least one file to tar up. */
@@ -459,31 +475,87 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
error_msg_and_die("Cowardly refusing to create an empty archive");
/* Open the tar file for writing. */
if (!strcmp(tarName, "-"))
if (tarName == NULL) {
tbInfo.tarFd = fileno(stdout);
else
tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (tbInfo.tarFd < 0) {
perror_msg( "Error opening '%s'", tarName);
freeHardLinkInfo(&tbInfo.hlInfoHead);
return ( FALSE);
tbInfo.verboseFlag = verboseFlag ? 2 : 0;
} else {
tbInfo.tarFd = open(tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
tbInfo.verboseFlag = verboseFlag ? 1 : 0;
}
tbInfo.excludeList=excludeList;
if (tbInfo.tarFd < 0) {
perror_msg("Error opening '%s'", tarName);
freeHardLinkInfo(&tbInfo.hlInfoHead);
return (FALSE);
}
/* Store the stat info for the tarball's file, so
* can avoid including the tarball into itself.... */
if (fstat(tbInfo.tarFd, &tbInfo.statBuf) < 0)
error_msg_and_die(io_error, tarName, strerror(errno));
error_msg_and_die(io_error, tarName, strerror(errno));
#ifdef CONFIG_FEATURE_TAR_GZIP
if (gzip) {
if (socketpair(AF_UNIX, SOCK_STREAM, 0, gzipDataPipe) < 0
|| pipe(gzipStatusPipe) < 0)
perror_msg_and_die("Failed to create gzip pipe");
signal(SIGPIPE, SIG_IGN); /* we only want EPIPE on errors */
gzipPid = fork();
if (gzipPid == 0) {
dup2(gzipDataPipe[0], 0);
close(gzipDataPipe[1]);
if (tbInfo.tarFd != 1);
dup2(tbInfo.tarFd, 1);
close(gzipStatusPipe[0]);
fcntl(gzipStatusPipe[1], F_SETFD, FD_CLOEXEC); /* close on exec shows sucess */
execl("/bin/gzip", "gzip", "-f", 0);
write(gzipStatusPipe[1], "", 1);
close(gzipStatusPipe[1]);
exit(-1);
} else if (gzipPid > 0) {
close(gzipDataPipe[0]);
close(gzipStatusPipe[1]);
while (1) {
char buf;
int n = read(gzipStatusPipe[0], &buf, 1);
if (n == 1)
error_msg_and_die("Could not exec gzip process"); /* socket was not closed => error */
else if ((n < 0) && (errno == EAGAIN || errno == EINTR))
continue; /* try it again */
break;
}
close(gzipStatusPipe[0]);
tbInfo.tarFd = gzipDataPipe[1];
} else {
perror_msg_and_die("Failed to fork gzip process");
}
}
#endif
tbInfo.excludeList = excludeList;
/* Read the directory/files and iterate over them one at a time */
while (*argv != NULL) {
if (recursive_action(*argv++, TRUE, FALSE, FALSE,
writeFileToTarball, writeFileToTarball,
(void*) &tbInfo) == FALSE) {
if (!recursive_action(*argv++, TRUE, FALSE, FALSE,
writeFileToTarball, writeFileToTarball,
(void *) &tbInfo)) {
errorFlag = TRUE;
}
}
/* Write two empty blocks to the end of the archive */
for (size=0; size<(2*TAR_BLOCK_SIZE); size++) {
for (size = 0; size < (2 * TAR_BLOCK_SIZE); size++) {
write(tbInfo.tarFd, "\0", 1);
}
@@ -493,16 +565,22 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
* so is considered a waste of space */
/* Hang up the tools, close up shop, head home */
close(tarFd);
if (errorFlag == TRUE) {
close(tbInfo.tarFd);
if (errorFlag)
error_msg("Error exit delayed from previous errors");
freeHardLinkInfo(&tbInfo.hlInfoHead);
return(FALSE);
}
freeHardLinkInfo(&tbInfo.hlInfoHead);
return( TRUE);
#ifdef CONFIG_FEATURE_TAR_GZIP
if (gzip && gzipPid) {
if (waitpid(gzipPid, NULL, 0) == -1)
printf("Couldnt wait ?");
}
#endif
return !errorFlag;
}
#endif //tar_create
#endif /* tar_create */
void append_file_to_list(const char *new_name, char ***list, int *list_count)
{
@@ -512,75 +590,30 @@ void append_file_to_list(const char *new_name, char ***list, int *list_count)
(*list)[*list_count] = NULL;
}
void append_file_list_to_list(char *filename, char ***name_list, int *num_of_entries)
void append_file_list_to_list(char *filename, char ***name_list,
int *num_of_entries)
{
FILE *src_stream;
char *line;
char *line_ptr;
src_stream = xfopen(filename, "r");
while ((line = get_line_from_file(src_stream)) != NULL) {
line_ptr = last_char_is(line, '\n');
if (line_ptr) {
*line_ptr = '\0';
}
chomp(line);
append_file_to_list(line, name_list, num_of_entries);
free(line);
}
fclose(src_stream);
}
#ifdef CONFIG_FEATURE_TAR_EXCLUDE
/*
* Create a list of names that are in the include list AND NOT in the exclude lists
*/
char **list_and_not_list(char **include_list, char **exclude_list)
{
char **new_include_list = NULL;
int new_include_count = 0;
int include_count = 0;
int exclude_count;
if (include_list == NULL) {
return(NULL);
}
while (include_list[include_count] != NULL) {
int found = FALSE;
exclude_count = 0;
while (exclude_list[exclude_count] != NULL) {
if (strcmp(include_list[include_count], exclude_list[exclude_count]) == 0) {
found = TRUE;
break;
}
exclude_count++;
}
if (found == FALSE) {
new_include_list = realloc(new_include_list, sizeof(char *) * (include_count + 2));
new_include_list[new_include_count] = include_list[include_count];
new_include_count++;
} else {
free(include_list[include_count]);
}
include_count++;
}
new_include_list[new_include_count] = NULL;
return(new_include_list);
}
#endif
int tar_main(int argc, char **argv)
{
enum untar_funct_e {
/* These are optional */
untar_from_file = 1,
untar_from_stdin = 2,
untar_unzip = 4,
/* This is optional */
untar_unzip = 1,
/* Require one and only one of these */
untar_list = 8,
untar_create = 16,
untar_extract = 32
untar_list = 2,
untar_create = 4,
untar_extract = 8
};
FILE *src_stream = NULL;
@@ -589,12 +622,12 @@ int tar_main(int argc, char **argv)
char **exclude_list = NULL;
char *src_filename = NULL;
char *dst_prefix = NULL;
char *file_list_name = NULL;
int opt;
unsigned short untar_funct = 0;
unsigned short untar_funct_required = 0;
unsigned short extract_function = 0;
int include_list_count = 0;
#ifdef CONFIG_FEATURE_TAR_EXCLUDE
int exclude_list_count = 0;
#endif
@@ -610,6 +643,7 @@ int tar_main(int argc, char **argv)
/* Prepend '-' to the first argument if required */
if (argv[1][0] != '-') {
char *tmp = xmalloc(strlen(argv[1]) + 2);
tmp[0] = '-';
strcpy(tmp + 1, argv[1]);
argv[1] = tmp;
@@ -618,41 +652,43 @@ int tar_main(int argc, char **argv)
while ((opt = getopt(argc, argv, "ctxT:X:C:f:Opvz")) != -1) {
switch (opt) {
/* One and only one of these is required */
/* One and only one of these is required */
case 'c':
untar_funct_required |= untar_create;
break;
case 't':
untar_funct_required |= untar_list;
extract_function |= extract_list |extract_unconditional;
extract_function |= extract_list | extract_unconditional;
break;
case 'x':
untar_funct_required |= untar_extract;
extract_function |= (extract_all_to_fs | extract_unconditional | extract_create_leading_dirs);
extract_function |=
(extract_all_to_fs | extract_unconditional |
extract_create_leading_dirs);
break;
/* These are optional */
/* Exclude or Include files listed in <filename>*/
/* These are optional */
/* Exclude or Include files listed in <filename> */
#ifdef CONFIG_FEATURE_TAR_EXCLUDE
case 'X':
append_file_list_to_list(optarg, &exclude_list, &exclude_list_count);
append_file_list_to_list(optarg, &exclude_list,
&exclude_list_count);
break;
#endif
case 'T':
// by default a list is an include list
append_file_list_to_list(optarg, &include_list, &include_list_count);
/* by default a list is an include list */
append_file_list_to_list(optarg, &include_list,
&include_list_count);
break;
case 'C': // Change to dir <optarg>
case 'C': /* Change to dir <optarg> */
/* Make sure dst_prefix ends in a '/' */
dst_prefix = concat_path_file(optarg, "/");
break;
case 'f': // archive filename
case 'f': /* archive filename */
if (strcmp(optarg, "-") == 0) {
// Untar from stdin to stdout
untar_funct |= untar_from_stdin;
src_filename = NULL;
} else {
untar_funct |= untar_from_file;
src_filename = xstrdup(optarg);
}
break;
@@ -662,10 +698,7 @@ int tar_main(int argc, char **argv)
case 'p':
break;
case 'v':
if (extract_function & extract_list) {
extract_function |= extract_verbose_list;
}
extract_function |= extract_list;
extract_function |= extract_verbose_list;
break;
#ifdef CONFIG_FEATURE_TAR_GZIP
case 'z':
@@ -681,9 +714,9 @@ int tar_main(int argc, char **argv)
if (untar_funct_required == 0) {
error_msg_and_die("You must specify one of the `-ctx' options");
}
if ((untar_funct_required != untar_create) &&
(untar_funct_required != untar_extract) &&
(untar_funct_required != untar_list)) {
if ((untar_funct_required != untar_create) &&
(untar_funct_required != untar_extract) &&
(untar_funct_required != untar_list)) {
error_msg_and_die("You may not specify more than one `ctx' option.");
}
untar_funct |= untar_funct_required;
@@ -693,14 +726,13 @@ int tar_main(int argc, char **argv)
append_file_to_list(argv[optind], &include_list, &include_list_count);
optind++;
}
if (extract_function & (extract_list | extract_all_to_fs)) {
if (dst_prefix == NULL) {
dst_prefix = xstrdup("./");
}
/* Setup the source of the tar data */
if (untar_funct & untar_from_file) {
if (src_filename != NULL) {
src_stream = xfopen(src_filename, "r");
} else {
src_stream = stdin;
@@ -710,43 +742,45 @@ int tar_main(int argc, char **argv)
if (untar_funct & untar_unzip) {
uncompressed_stream = gz_open(src_stream, &gunzip_pid);
} else
#endif // CONFIG_FEATURE_TAR_GZIP
#endif /* CONFIG_FEATURE_TAR_GZIP */
uncompressed_stream = src_stream;
/* extract or list archive */
unarchive(uncompressed_stream, stdout, &get_header_tar, extract_function, dst_prefix, include_list, exclude_list);
unarchive(uncompressed_stream, stdout, &get_header_tar,
extract_function, dst_prefix, include_list, exclude_list);
fclose(uncompressed_stream);
}
#ifdef CONFIG_FEATURE_TAR_CREATE
/* create an archive */
else if (untar_funct & untar_create) {
int verboseFlag = FALSE;
int gzipFlag = FALSE;
#ifdef CONFIG_FEATURE_TAR_GZIP
if (untar_funct && untar_unzip) {
error_msg_and_die("Creation of compressed tarfile not internally support by tar, pipe to busybox gunzip");
}
#endif // CONFIG_FEATURE_TAR_GZIP
if (extract_function & extract_verbose_list) {
if (untar_funct & untar_unzip)
gzipFlag = TRUE;
#endif /* CONFIG_FEATURE_TAR_GZIP */
if (extract_function & extract_verbose_list)
verboseFlag = TRUE;
}
writeTarFile(src_filename, verboseFlag, &argv[argc - 1], include_list);
writeTarFile(src_filename, verboseFlag, include_list, exclude_list,
gzipFlag);
}
#endif // CONFIG_FEATURE_TAR_CREATE
#endif /* CONFIG_FEATURE_TAR_CREATE */
/* Cleanups */
#ifdef CONFIG_FEATURE_TAR_GZIP
if (untar_funct & untar_unzip) {
if (!(untar_funct & untar_create) && (untar_funct & untar_unzip)) {
fclose(src_stream);
close(gz_fd);
gz_close(gunzip_pid);
}
#endif // CONFIG_FEATURE_TAR_GZIP
#endif /* CONFIG_FEATURE_TAR_GZIP */
#ifdef CONFIG_FEATURE_CLEAN_UP
if (src_filename) {
free(src_filename);
}
if (file_list_name) {
free(file_list_name);
}
return(EXIT_SUCCESS);
#endif
return (EXIT_SUCCESS);
}
+94
View File
@@ -0,0 +1,94 @@
/* vi: set sw=4 ts=4: */
/*
* Mini unzip implementation for busybox
*
* Copyright (C) 2001 by Laurence Anderson
*
* 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 <fcntl.h>
#include <getopt.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "unarchive.h"
#include "busybox.h"
extern int unzip_main(int argc, char **argv)
{
FILE *src_stream;
int extract_function = extract_all_to_fs | extract_create_leading_dirs;
char **extract_names = NULL;
char **exclude_names = NULL;
int opt = 0;
int num_of_entries = 0;
int exclude = 0;
char *outdir = "./";
FILE *msgout = stdout;
while ((opt = getopt(argc, argv, "lnopqxd:")) != -1) {
switch (opt) {
case 'l':
extract_function |= extract_verbose_list;
extract_function ^= extract_all_to_fs;
break;
case 'n':
break;
case 'o':
extract_function |= extract_unconditional;
break;
case 'p':
extract_function |= extract_to_stdout;
extract_function ^= extract_all_to_fs;
/* FALLTHROUGH */
case 'q':
msgout = xfopen("/dev/null", "w");
break;
case 'd':
outdir = xstrdup(optarg);
strcat(outdir, "/");
break;
case 'x':
exclude = 1;
break;
}
}
if (optind == argc) {
show_usage();
}
if (*argv[optind] == '-') src_stream = stdin;
else src_stream = xfopen(argv[optind++], "r");
while (optind < argc) {
if (exclude) {
exclude_names = xrealloc(exclude_names, sizeof(char *) * (num_of_entries + 2));
exclude_names[num_of_entries] = xstrdup(argv[optind]);
} else {
extract_names = xrealloc(extract_names, sizeof(char *) * (num_of_entries + 2));
extract_names[num_of_entries] = xstrdup(argv[optind]);
}
num_of_entries++;
if (exclude) exclude_names[num_of_entries] = NULL;
else extract_names[num_of_entries] = NULL;
optind++;
}
unarchive(src_stream, msgout, &get_header_zip, extract_function, outdir, extract_names, exclude_names);
return EXIT_SUCCESS;
}
+9 -22
View File
@@ -1,6 +1,6 @@
# Makefile for busybox
#
# Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
# Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,27 +17,14 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
TOPDIR :=..
L_TARGET := console-tools.a
obj-y :=
obj-n :=
obj- :=
obj-$(CONFIG_CHVT) += chvt.o
obj-$(CONFIG_CLEAR) += clear.o
obj-$(CONFIG_DEALLOCVT) += deallocvt.o
obj-$(CONFIG_DUMPKMAP) += dumpkmap.o
obj-$(CONFIG_LOADACM) += loadacm.o
obj-$(CONFIG_LOADFONT) += loadfont.o
obj-$(CONFIG_LOADKMAP) += loadkmap.o
obj-$(CONFIG_RESET) += reset.o
obj-$(CONFIG_SETKEYCODES) += setkeycodes.o
# Hand off to toplevel Rules.mak
include $(TOPDIR)/Rules.mak
TOPDIR:= ../
CONSOLETOOLS_DIR:=./
include $(TOPDIR).config
include $(TOPDIR)Rules.mak
include Makefile.in
all: $(libraries-y)
-include $(TOPDIR).depend
clean:
rm -f $(L_TARGET) *.o core
rm -f *.o *.a $(AR_TARGET)
+41
View File
@@ -0,0 +1,41 @@
# Makefile for busybox
#
# Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
CONSOLETOOLS_AR:=console-tools.a
ifndef $(CONSOLETOOLS_DIR)
CONSOLETOOLS_DIR:=$(TOPDIR)console-tools/
endif
CONSOLETOOLS_DIR-y:=
CONSOLETOOLS_DIR-$(CONFIG_CHVT) += chvt.o
CONSOLETOOLS_DIR-$(CONFIG_CLEAR) += clear.o
CONSOLETOOLS_DIR-$(CONFIG_DEALLOCVT) += deallocvt.o
CONSOLETOOLS_DIR-$(CONFIG_DUMPKMAP) += dumpkmap.o
CONSOLETOOLS_DIR-$(CONFIG_LOADACM) += loadacm.o
CONSOLETOOLS_DIR-$(CONFIG_LOADFONT) += loadfont.o
CONSOLETOOLS_DIR-$(CONFIG_LOADKMAP) += loadkmap.o
CONSOLETOOLS_DIR-$(CONFIG_OPENVT) += openvt.o
CONSOLETOOLS_DIR-$(CONFIG_RESET) += reset.o
CONSOLETOOLS_DIR-$(CONFIG_SETKEYCODES) += setkeycodes.o
libraries-y+=$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR)
$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR): $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
$(AR) -ro $@ $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
+1 -1
View File
@@ -24,7 +24,7 @@ int chvt_main(int argc, char **argv)
if ((argc != 2) || (**(argv + 1) == '-'))
show_usage();
fd = get_console_fd("/dev/console");
fd = get_console_fd();
num = atoi(argv[1]);
if (ioctl(fd, VT_ACTIVATE, num))
perror_msg_and_die("VT_ACTIVATE");
+1
View File
@@ -12,6 +12,7 @@ bool 'dumpkmap' CONFIG_DUMPKMAP
bool 'loadacm' CONFIG_LOADACM
bool 'loadfont' CONFIG_LOADFONT
bool 'loadkmap' CONFIG_LOADKMAP
bool 'openvt' CONFIG_OPENVT
bool 'reset' CONFIG_RESET
bool 'setkeycodes' CONFIG_SETKEYCODES
+1 -1
View File
@@ -21,7 +21,7 @@ int deallocvt_main(int argc, char *argv[])
if (argc > 2)
show_usage();
fd = get_console_fd("/dev/console");
fd = get_console_fd();
if (argc == 1) {
/* deallocate all unused consoles */
+97
View File
@@ -0,0 +1,97 @@
/* vi: set sw=4 ts=4: */
/*
* openvt.c - open a vt to run a command.
*
* busyboxed by Quy Tonthat <quy@signal3.com>
*
* 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.
*/
/* getopt not needed */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
#include "busybox.h"
#define VTNAME "/dev/tty%d"
int openvt_main(int argc, char **argv)
{
int pid;
int fd;
int vtno;
char vtname[sizeof VTNAME + 2];
char * cmd = NULL;
char * cmd_args = NULL;
if (argc < 3)
show_usage();
if (!isdigit(argv[1][0]))
show_usage();
vtno = (int) atol(argv[1]);
/* if (vtno <= 0 || vtno > 63) */
if (vtno <= 0 || vtno > 12)
error_msg_and_die("Illegal vt number (%d)", vtno);
sprintf(vtname, VTNAME, vtno);
cmd = argv[2];
cmd_args = xmalloc(80);
cmd_args[0] = '\0';
if((pid = fork()) == 0) {
/* leave current vt */
#ifdef ESIX_5_3_2_D
if (setpgrp() < 0) {
#else
if (setsid() < 0) {
#endif
perror_msg_and_die("Unable to set new session");
}
close(0); /* so that new vt becomes stdin */
/* and grab new one */
if ((fd = open(vtname, O_RDWR)) == -1)
perror_msg_and_die("could not open %s", vtname);
/* Reassign stdout and sterr */
close(1);
close(2);
dup(fd);
dup(fd);
execvp(cmd, &argv[2]);
/*execlp(cmd, cmd_args);*/
_exit(1);
}
return EXIT_SUCCESS;
}
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
+2 -2
View File
@@ -3,7 +3,7 @@
* Mini reset implementation for busybox
*
* Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
* Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
* Copyright (C) 1999-2002 by Erik Andersen <andersee@debian.org>
* Written by Erik Andersen and Kent Robotti <robotti@metconnect.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -28,7 +28,7 @@
extern int reset_main(int argc, char **argv)
{
printf("\033c");
printf("\033[?25h\033c\033[J");
return EXIT_SUCCESS;
}
+1 -1
View File
@@ -46,7 +46,7 @@ setkeycodes_main(int argc, char** argv)
show_usage();
}
fd = get_console_fd("/dev/console");
fd = get_console_fd();
while (argc > 2) {
a.keycode = atoi(argv[2]);
+424
View File
@@ -0,0 +1,424 @@
/*
* Calendar implementation for busybox
*
* Copyright (C) 2001 by Steven J. Merrifield <steve@labyrinth.net.au>
*
* See original copyright at the end of this file
*
* 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 <sys/types.h>
#include <ctype.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include "busybox.h"
#ifdef CONFIG_LOCALE_SUPPORT
#include <locale.h>
#endif
#define THURSDAY 4 /* for reformation */
#define SATURDAY 6 /* 1 Jan 1 was a Saturday */
#define FIRST_MISSING_DAY 639787 /* 3 Sep 1752 */
#define NUMBER_MISSING_DAYS 11 /* 11 day correction */
#define MAXDAYS 42 /* max slots in a month array */
#define SPACE -1 /* used in day array */
static int days_in_month[2][13] = {
{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
};
int sep1752[MAXDAYS] = {
SPACE, SPACE, 1, 2, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
}, j_sep1752[MAXDAYS] = {
SPACE, SPACE, 245, 246, 258, 259, 260,
261, 262, 263, 264, 265, 266, 267,
268, 269, 270, 271, 272, 273, 274,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
}, empty[MAXDAYS] = {
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
};
char *month_names[12];
char day_headings[] = " ";
char j_day_headings[] = " ";
/* leap year -- account for gregorian reformation in 1752 */
#define leap_year(yr) \
((yr) <= 1752 ? !((yr) % 4) : \
(!((yr) % 4) && ((yr) % 100)) || !((yr) % 400))
/* number of centuries since 1700, not inclusive */
#define centuries_since_1700(yr) \
((yr) > 1700 ? (yr) / 100 - 17 : 0)
/* number of centuries since 1700 whose modulo of 400 is 0 */
#define quad_centuries_since_1700(yr) \
((yr) > 1600 ? ((yr) - 1600) / 400 : 0)
/* number of leap years between year 1 and this year, not inclusive */
#define leap_years_since_year_1(yr) \
((yr) / 4 - centuries_since_1700(yr) + quad_centuries_since_1700(yr))
int julian;
void ascii_day __P((char *, int));
void center __P((char *, int, int));
void day_array __P((int, int, int *));
int day_in_week __P((int, int, int));
int day_in_year __P((int, int, int));
void j_yearly __P((int));
void monthly __P((int, int));
void trim_trailing_spaces __P((char *));
void yearly __P((int));
int cal_main(int argc, char **argv)
{
struct tm *local_time;
static struct tm zero_tm;
time_t now;
int ch, month, year, yflag, i;
char buf[40];
#ifdef CONFIG_LOCALE_SUPPORT
setlocale(LC_TIME, "");
#endif
yflag = 0;
while ((ch = getopt(argc, argv, "jy")) != -1)
switch(ch) {
case 'j':
julian = 1;
break;
case 'y':
yflag = 1;
break;
default:
show_usage();
}
argc -= optind;
argv += optind;
month = 0;
switch(argc) {
case 2:
if ((month = atoi(*argv++)) < 1 || month > 12)
error_msg_and_die("Illegal month value: use 1-12");
/* FALLTHROUGH */
case 1:
if ((year = atoi(*argv)) < 1 || year > 9999)
error_msg_and_die("Illegal year value: use 1-9999");
break;
case 0:
time(&now);
local_time = localtime(&now);
year = local_time->tm_year + 1900;
if (!yflag)
month = local_time->tm_mon + 1;
break;
default:
show_usage();
}
for (i = 0; i < 12; i++) {
zero_tm.tm_mon = i;
strftime(buf, sizeof(buf), "%B", &zero_tm);
month_names[i] = xstrdup(buf);
}
for (i = 0; i < 7; i++) {
zero_tm.tm_wday = i;
strftime(buf, sizeof(buf), "%a", &zero_tm);
strncpy(day_headings + i * 3, buf, 2);
strncpy(j_day_headings + i * 4 + 1, buf, 2);
}
if (month)
monthly(month, year);
else if (julian)
j_yearly(year);
else
yearly(year);
exit(0);
}
#define DAY_LEN 3 /* 3 spaces per day */
#define J_DAY_LEN 4 /* 4 spaces per day */
#define WEEK_LEN 20 /* 7 * 3 - one space at the end */
#define J_WEEK_LEN 27 /* 7 * 4 - one space at the end */
#define HEAD_SEP 2 /* spaces between day headings */
#define J_HEAD_SEP 2
void monthly(int month, int year)
{
int col, row, len, days[MAXDAYS];
char *p, lineout[30];
day_array(month, year, days);
len = sprintf(lineout, "%s %d", month_names[month - 1], year);
printf("%*s%s\n%s\n",
((julian ? J_WEEK_LEN : WEEK_LEN) - len) / 2, "",
lineout, julian ? j_day_headings : day_headings);
for (row = 0; row < 6; row++) {
for (col = 0, p = lineout; col < 7; col++,
p += julian ? J_DAY_LEN : DAY_LEN)
ascii_day(p, days[row * 7 + col]);
*p = '\0';
trim_trailing_spaces(lineout);
printf("%s\n", lineout);
}
}
void j_yearly(int year)
{
int col, *dp, i, month, row, which_cal;
int days[12][MAXDAYS];
char *p, lineout[80];
sprintf(lineout, "%d", year);
center(lineout, J_WEEK_LEN * 2 + J_HEAD_SEP, 0);
printf("\n\n");
for (i = 0; i < 12; i++)
day_array(i + 1, year, days[i]);
memset(lineout, ' ', sizeof(lineout) - 1);
lineout[sizeof(lineout) - 1] = '\0';
for (month = 0; month < 12; month += 2) {
center(month_names[month], J_WEEK_LEN, J_HEAD_SEP);
center(month_names[month + 1], J_WEEK_LEN, 0);
printf("\n%s%*s%s\n", j_day_headings, J_HEAD_SEP, "",
j_day_headings);
for (row = 0; row < 6; row++) {
for (which_cal = 0; which_cal < 2; which_cal++) {
p = lineout + which_cal * (J_WEEK_LEN + 2);
dp = &days[month + which_cal][row * 7];
for (col = 0; col < 7; col++, p += J_DAY_LEN)
ascii_day(p, *dp++);
}
*p = '\0';
trim_trailing_spaces(lineout);
printf("%s\n", lineout);
}
}
printf("\n");
}
void yearly(int year)
{
int col, *dp, i, month, row, which_cal;
int days[12][MAXDAYS];
char *p, lineout[80];
sprintf(lineout, "%d", year);
center(lineout, WEEK_LEN * 3 + HEAD_SEP * 2, 0);
printf("\n\n");
for (i = 0; i < 12; i++)
day_array(i + 1, year, days[i]);
memset(lineout, ' ', sizeof(lineout) - 1);
lineout[sizeof(lineout) - 1] = '\0';
for (month = 0; month < 12; month += 3) {
center(month_names[month], WEEK_LEN, HEAD_SEP);
center(month_names[month + 1], WEEK_LEN, HEAD_SEP);
center(month_names[month + 2], WEEK_LEN, 0);
printf("\n%s%*s%s%*s%s\n", day_headings, HEAD_SEP,
"", day_headings, HEAD_SEP, "", day_headings);
for (row = 0; row < 6; row++) {
for (which_cal = 0; which_cal < 3; which_cal++) {
p = lineout + which_cal * (WEEK_LEN + 2);
dp = &days[month + which_cal][row * 7];
for (col = 0; col < 7; col++, p += DAY_LEN)
ascii_day(p, *dp++);
}
*p = '\0';
trim_trailing_spaces(lineout);
printf("%s\n", lineout);
}
}
printf("\n");
}
/*
* day_array --
* Fill in an array of 42 integers with a calendar. Assume for a moment
* that you took the (maximum) 6 rows in a calendar and stretched them
* out end to end. You would have 42 numbers or spaces. This routine
* builds that array for any month from Jan. 1 through Dec. 9999.
*/
void day_array(int month, int year, int *days)
{
int day, dw, dm;
if ((month == 9) && (year == 1752)) {
memmove(days,
julian ? j_sep1752 : sep1752, MAXDAYS * sizeof(int));
return;
}
memmove(days, empty, MAXDAYS * sizeof(int));
dm = days_in_month[leap_year(year)][month];
dw = day_in_week(1, month, year);
day = julian ? day_in_year(1, month, year) : 1;
while (dm--)
days[dw++] = day++;
}
/*
* day_in_year --
* return the 1 based day number within the year
*/
int day_in_year(int day, int month, int year)
{
int i, leap;
leap = leap_year(year);
for (i = 1; i < month; i++)
day += days_in_month[leap][i];
return (day);
}
/*
* day_in_week
* return the 0 based day number for any date from 1 Jan. 1 to
* 31 Dec. 9999. Assumes the Gregorian reformation eliminates
* 3 Sep. 1752 through 13 Sep. 1752. Returns Thursday for all
* missing days.
*/
int day_in_week(int day, int month, int year)
{
long temp;
temp = (long)(year - 1) * 365 + leap_years_since_year_1(year - 1)
+ day_in_year(day, month, year);
if (temp < FIRST_MISSING_DAY)
return ((temp - 1 + SATURDAY) % 7);
if (temp >= (FIRST_MISSING_DAY + NUMBER_MISSING_DAYS))
return (((temp - 1 + SATURDAY) - NUMBER_MISSING_DAYS) % 7);
return (THURSDAY);
}
void ascii_day(char *p, int day)
{
int display, val;
static char *aday[] = {
"",
" 1", " 2", " 3", " 4", " 5", " 6", " 7",
" 8", " 9", "10", "11", "12", "13", "14",
"15", "16", "17", "18", "19", "20", "21",
"22", "23", "24", "25", "26", "27", "28",
"29", "30", "31",
};
if (day == SPACE) {
memset(p, ' ', julian ? J_DAY_LEN : DAY_LEN);
return;
}
if (julian) {
if ((val = day / 100) != 0) {
day %= 100;
*p++ = val + '0';
display = 1;
} else {
*p++ = ' ';
display = 0;
}
val = day / 10;
if (val || display)
*p++ = val + '0';
else
*p++ = ' ';
*p++ = day % 10 + '0';
} else {
*p++ = aday[day][0];
*p++ = aday[day][1];
}
*p = ' ';
}
void trim_trailing_spaces(char *s)
{
char *p;
for (p = s; *p; ++p)
continue;
while (p > s && (--p, isspace(*p)))
continue;
if (p > s)
++p;
*p = '\0';
}
void center(char *str, int len, int separate)
{
len -= strlen(str);
printf("%*s%s%*s", len / 2, "", str, len / 2 + len % 2, "");
if (separate)
printf("%*s", separate, "");
}
/*
* Copyright (c) 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Kim Letkeman.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+1 -1
View File
@@ -37,7 +37,7 @@ extern int cat_main(int argc, char **argv)
while (--argc > 0) {
if(!(strcmp(*++argv, "-"))) {
print_file(stdin);
} else if (print_file_by_name(*argv) == FALSE) {
} else if (! print_file_by_name(*argv)) {
status = EXIT_FAILURE;
}
}
+2 -2
View File
@@ -72,8 +72,8 @@ int chgrp_main(int argc, char **argv)
/* Ok, ready to do the deed now */
while (++optind < argc) {
if (recursive_action (argv[optind], recursiveFlag, FALSE, FALSE,
fileAction, fileAction, NULL) == FALSE) {
if (! recursive_action (argv[optind], recursiveFlag, FALSE, FALSE,
fileAction, fileAction, NULL)) {
return EXIT_FAILURE;
}
}
+3 -3
View File
@@ -58,7 +58,7 @@ int chmod_main(int argc, char **argv)
if (argc > optind && argc > 2 && argv[optind]) {
/* Parse the specified mode */
mode_t mode;
if (parse_mode(argv[optind], &mode) == FALSE) {
if (! parse_mode(argv[optind], &mode)) {
error_msg_and_die( "unknown mode: %s", argv[optind]);
}
} else {
@@ -67,8 +67,8 @@ int chmod_main(int argc, char **argv)
/* Ok, ready to do the deed now */
for (i = optind + 1; i < argc; i++) {
if (recursive_action (argv[i], recursiveFlag, FALSE, FALSE, fileAction,
fileAction, argv[optind]) == FALSE) {
if (! recursive_action (argv[i], recursiveFlag, FALSE, FALSE, fileAction,
fileAction, argv[optind])) {
return EXIT_FAILURE;
}
}
+2 -2
View File
@@ -94,8 +94,8 @@ int chown_main(int argc, char **argv)
/* Ok, ready to do the deed now */
while (++optind < argc) {
if (recursive_action (argv[optind], recursiveFlag, FALSE, FALSE,
fileAction, fileAction, NULL) == FALSE) {
if (! recursive_action (argv[optind], recursiveFlag, FALSE, FALSE,
fileAction, fileAction, NULL)) {
return EXIT_FAILURE;
}
}
+126 -90
View File
@@ -3,6 +3,8 @@
* Mini date implementation for busybox
*
* by Matthew Grant <grantma@anathoth.gen.nz>
*
* iso-format handling added by Robert Griebl <griebl@gmx.de>
*
* 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
@@ -46,19 +48,18 @@ static struct tm *date_conv_time(struct tm *tm_time, const char *t_string)
{
int nr;
nr = sscanf(t_string, "%2d%2d%2d%2d%d",
&(tm_time->tm_mon),
&(tm_time->tm_mday),
&(tm_time->tm_hour),
&(tm_time->tm_min), &(tm_time->tm_year));
nr = sscanf(t_string, "%2d%2d%2d%2d%d", &(tm_time->tm_mon),
&(tm_time->tm_mday), &(tm_time->tm_hour), &(tm_time->tm_min),
&(tm_time->tm_year));
if (nr < 4 || nr > 5) {
error_msg_and_die(invalid_date, t_string);
error_msg_and_die(invalid_date, t_string);
}
/* correct for century - minor Y2K problem here? */
if (tm_time->tm_year >= 1900)
if (tm_time->tm_year >= 1900) {
tm_time->tm_year -= 1900;
}
/* adjust date */
tm_time->tm_mon -= 1;
@@ -75,50 +76,39 @@ static struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string)
/* Parse input and assign appropriately to tm_time */
if (t=*tm_time,sscanf(t_string, "%d:%d:%d",
&t.tm_hour, &t.tm_min, &t.tm_sec) == 3) {
/* no adjustments needed */
} else if (t=*tm_time,sscanf(t_string, "%d:%d",
&t.tm_hour, &t.tm_min) == 2) {
/* no adjustments needed */
} else if (t=*tm_time,sscanf(t_string, "%d.%d-%d:%d:%d",
&t.tm_mon,
&t.tm_mday,
&t.tm_hour,
&t.tm_min, &t.tm_sec) == 5) {
t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
} else if (t=*tm_time,sscanf(t_string, "%d.%d-%d:%d",
&t.tm_mon,
&t.tm_mday,
&t.tm_hour, &t.tm_min) == 4) {
t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
} else if (t=*tm_time,sscanf(t_string, "%d.%d.%d-%d:%d:%d",
&t.tm_year,
&t.tm_mon,
&t.tm_mday,
&t.tm_hour,
&t.tm_min, &t.tm_sec) == 6) {
if (t =
*tm_time, sscanf(t_string, "%d:%d:%d", &t.tm_hour, &t.tm_min,
&t.tm_sec) == 3) {
/* no adjustments needed */
} else if (t =
*tm_time, sscanf(t_string, "%d:%d", &t.tm_hour,
&t.tm_min) == 2) {
/* no adjustments needed */
} else if (t =
*tm_time, sscanf(t_string, "%d.%d-%d:%d:%d", &t.tm_mon,
&t.tm_mday, &t.tm_hour, &t.tm_min,
&t.tm_sec) == 5) {
/* Adjust dates from 1-12 to 0-11 */
t.tm_mon -= 1;
} else if (t =
*tm_time, sscanf(t_string, "%d.%d-%d:%d", &t.tm_mon,
&t.tm_mday, &t.tm_hour, &t.tm_min) == 4) {
/* Adjust dates from 1-12 to 0-11 */
t.tm_mon -= 1;
} else if (t =
*tm_time, sscanf(t_string, "%d.%d.%d-%d:%d:%d", &t.tm_year,
&t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min,
&t.tm_sec) == 6) {
t.tm_year -= 1900; /* Adjust years */
t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
} else if (t=*tm_time,sscanf(t_string, "%d.%d.%d-%d:%d",
&t.tm_year,
&t.tm_mon,
&t.tm_mday,
&t.tm_hour, &t.tm_min) == 5) {
} else if (t =
*tm_time, sscanf(t_string, "%d.%d.%d-%d:%d", &t.tm_year,
&t.tm_mon, &t.tm_mday, &t.tm_hour,
&t.tm_min) == 5) {
t.tm_year -= 1900; /* Adjust years */
t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
} else {
error_msg_and_die(invalid_date, t_string);
error_msg_and_die(invalid_date, t_string);
}
*tm_time = t;
return (tm_time);
@@ -138,45 +128,73 @@ int date_main(int argc, char **argv)
time_t tm;
struct tm tm_time;
#ifdef CONFIG_FEATURE_DATE_ISOFMT
int ifmt = 0;
# define GETOPT_ISOFMT "I::"
#else
# define GETOPT_ISOFMT
#endif
/* Interpret command line args */
while ((c = getopt(argc, argv, "Rs:ud:")) != EOF) {
while ((c = getopt(argc, argv, "Rs:ud:" GETOPT_ISOFMT)) != EOF) {
switch (c) {
case 'R':
rfc822 = 1;
break;
case 's':
set_time = 1;
if ((date_str != NULL) || ((date_str = optarg) == NULL)) {
show_usage();
}
break;
case 'u':
utc = 1;
if (putenv("TZ=UTC0") != 0)
error_msg_and_die(memory_exhausted);
break;
case 'd':
use_arg = 1;
if ((date_str != NULL) || ((date_str = optarg) == NULL))
show_usage();
break;
default:
case 'R':
rfc822 = 1;
break;
case 's':
set_time = 1;
if ((date_str != NULL) || ((date_str = optarg) == NULL)) {
show_usage();
}
break;
case 'u':
utc = 1;
if (putenv("TZ=UTC0") != 0)
error_msg_and_die(memory_exhausted);
break;
case 'd':
use_arg = 1;
if ((date_str != NULL) || ((date_str = optarg) == NULL))
show_usage();
break;
#ifdef CONFIG_FEATURE_DATE_ISOFMT
case 'I':
if (!optarg)
ifmt = 1;
else {
int ifmt_len = xstrlen(optarg);
if ((ifmt_len <= 4)
&& (strncmp(optarg, "date", ifmt_len) == 0)) {
ifmt = 1;
} else if ((ifmt_len <= 5)
&& (strncmp(optarg, "hours", ifmt_len) == 0)) {
ifmt = 2;
} else if ((ifmt_len <= 7)
&& (strncmp(optarg, "minutes", ifmt_len) == 0)) {
ifmt = 3;
} else if ((ifmt_len <= 7)
&& (strncmp(optarg, "seconds", ifmt_len) == 0)) {
ifmt = 4;
}
}
if (ifmt) {
break; /* else show_usage(); */
}
#endif
default:
show_usage();
}
}
if ((date_fmt == NULL) && (optind < argc) && (argv[optind][0] == '+'))
date_fmt = &argv[optind][1]; /* Skip over the '+' */
else if (date_str == NULL) {
if ((date_fmt == NULL) && (optind < argc) && (argv[optind][0] == '+')) {
date_fmt = &argv[optind][1]; /* Skip over the '+' */
} else if (date_str == NULL) {
set_time = 1;
date_str = argv[optind];
}
#if 0
else {
error_msg("date_str='%s' date_fmt='%s'\n", date_str, date_fmt);
show_usage();
}
#endif
/* Now we have parsed all the information except the date format
which depends on whether the clock is being set or read */
@@ -201,18 +219,16 @@ int date_main(int argc, char **argv)
/* Correct any day of week and day of year etc. fields */
tm = mktime(&tm_time);
if (tm < 0)
error_msg_and_die(invalid_date, date_str);
if ( utc ) {
if (putenv("TZ=UTC0") != 0)
error_msg_and_die(memory_exhausted);
if (tm < 0) {
error_msg_and_die(invalid_date, date_str);
}
if (utc && (putenv("TZ=UTC0") != 0)) {
error_msg_and_die(memory_exhausted);
}
/* if setting time, set it */
if (set_time) {
if (stime(&tm) < 0) {
perror_msg("cannot set date");
}
if (set_time && (stime(&tm) < 0)) {
perror_msg("cannot set date");
}
}
@@ -220,12 +236,32 @@ int date_main(int argc, char **argv)
/* Deal with format string */
if (date_fmt == NULL) {
date_fmt = (rfc822
? (utc
? "%a, %_d %b %Y %H:%M:%S GMT"
: "%a, %_d %b %Y %H:%M:%S %z")
: "%a %b %e %H:%M:%S %Z %Y");
#ifdef CONFIG_FEATURE_DATE_ISOFMT
switch (ifmt) {
case 4:
date_fmt = utc ? "%Y-%m-%dT%H:%M:%SZ" : "%Y-%m-%dT%H:%M:%S%z";
break;
case 3:
date_fmt = utc ? "%Y-%m-%dT%H:%MZ" : "%Y-%m-%dT%H:%M%z";
break;
case 2:
date_fmt = utc ? "%Y-%m-%dT%HZ" : "%Y-%m-%dT%H%z";
break;
case 1:
date_fmt = "%Y-%m-%d";
break;
case 0:
default:
#endif
date_fmt =
(rfc822
? (utc ? "%a, %e %b %Y %H:%M:%S GMT" :
"%a, %e %b %Y %H:%M:%S %z") : "%a %b %e %H:%M:%S %Z %Y");
#ifdef CONFIG_FEATURE_DATE_ISOFMT
break;
}
#endif
} else if (*date_fmt == '\0') {
/* Imitate what GNU 'date' does with NO format string! */
printf("\n");
+31 -6
View File
@@ -3,7 +3,7 @@
* Mini dd implementation for busybox
*
*
* Copyright (C) 2000 by Matt Kraai <kraai@alumni.carnegiemellon.edu>
* Copyright (C) 2000,2001 Matt Kraai
*
* 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
@@ -22,6 +22,7 @@
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
@@ -45,7 +46,7 @@ static const struct suffix_mult dd_suffixes[] = {
int dd_main(int argc, char **argv)
{
int i, ifd, ofd, oflag, sync_flag = FALSE, trunc = TRUE;
int i, ifd, ofd, oflag, sync_flag = FALSE, trunc = TRUE, noerror = FALSE;
size_t in_full = 0, in_part = 0, out_full = 0, out_part = 0;
size_t bs = 512, count = -1;
ssize_t n;
@@ -74,6 +75,9 @@ int dd_main(int argc, char **argv)
} else if (strncmp("sync", buf, 4) == 0) {
sync_flag = TRUE;
buf += 4;
} else if (strncmp("noerror", buf, 7) == 0) {
noerror = TRUE;
buf += 7;
} else {
error_msg_and_die("invalid conversion `%s'", argv[i]+5);
}
@@ -106,8 +110,13 @@ int dd_main(int argc, char **argv)
perror_msg_and_die("%s", outfile);
if (seek && trunc) {
if (ftruncate(ofd, seek * bs) < 0)
perror_msg_and_die("%s", outfile);
if (ftruncate(ofd, seek * bs) < 0) {
struct stat st;
if (fstat (ofd, &st) < 0 || S_ISREG (st.st_mode) ||
S_ISDIR (st.st_mode))
perror_msg_and_die("%s", outfile);
}
}
} else {
ofd = STDOUT_FILENO;
@@ -125,9 +134,19 @@ int dd_main(int argc, char **argv)
}
while (in_full + in_part != count) {
if (noerror) {
/* Pre-zero the buffer when doing the noerror thing */
memset(buf, '\0', bs);
}
n = safe_read(ifd, buf, bs);
if (n < 0)
perror_msg_and_die("%s", infile);
if (n < 0) {
if (noerror) {
n = bs;
perror_msg("%s", infile);
} else {
perror_msg_and_die("%s", infile);
}
}
if (n == 0)
break;
if (n == bs)
@@ -147,6 +166,12 @@ int dd_main(int argc, char **argv)
out_part++;
}
if (close (ifd) < 0)
perror_msg_and_die("%s", infile);
if (close (ofd) < 0)
perror_msg_and_die("%s", outfile);
fprintf(stderr, "%ld+%ld records in\n", (long)in_full, (long)in_part);
fprintf(stderr, "%ld+%ld records out\n", (long)out_full, (long)out_part);
+1 -1
View File
@@ -58,7 +58,7 @@ static int convert(char *fn, int ConvType)
if ((in = wfopen(fn, "rw")) == NULL) {
return -1;
}
strcpy(tempFn, fn);
safe_strncpy(tempFn, fn, sizeof(tempFn));
c = strlen(tempFn);
tempFn[c] = '.';
while(1) {
+41 -101
View File
@@ -4,6 +4,7 @@
*
* Copyright (C) 1999,2000,2001 by Lineo, inc. and John Beppu
* Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org>
* Copyright (C) 2002 Edward Betts <edward@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,17 +37,18 @@
static unsigned long disp_hr = KILOBYTE;
#endif
typedef void (Display) (long, char *);
static int du_depth /*= 0*/;
static int count_hardlinks /*= 0*/;
static int one_file_system /*= 0*/;
static dev_t dir_dev;
static int du_depth = 0;
static int count_hardlinks = 0;
static Display *print;
static void (*print) (long, char *);
static void print_normal(long size, char *filename)
{
#ifdef CONFIG_FEATURE_HUMAN_READABLE
printf("%s\t%s\n", make_human_readable_str(size<<10, 1, disp_hr), filename);
printf("%s\t%s\n", make_human_readable_str(size << 10, 1, disp_hr),
filename);
#else
printf("%ld\t%s\n", size, filename);
#endif
@@ -59,78 +61,6 @@ static void print_summary(long size, char *filename)
}
}
#define HASH_SIZE 311 /* Should be prime */
#define hash_inode(i) ((i) % HASH_SIZE)
typedef struct ino_dev_hash_bucket_struct {
struct ino_dev_hash_bucket_struct *next;
ino_t ino;
dev_t dev;
char name[1];
} ino_dev_hashtable_bucket_t;
static ino_dev_hashtable_bucket_t *ino_dev_hashtable[HASH_SIZE];
/*
* Return 1 if statbuf->st_ino && statbuf->st_dev are recorded in
* `ino_dev_hashtable', else return 0
*
* If NAME is a non-NULL pointer to a character pointer, and there is
* a match, then set *NAME to the value of the name slot in that
* bucket.
*/
static int is_in_ino_dev_hashtable(const struct stat *statbuf, char **name)
{
ino_dev_hashtable_bucket_t *bucket;
bucket = ino_dev_hashtable[hash_inode(statbuf->st_ino)];
while (bucket != NULL) {
if ((bucket->ino == statbuf->st_ino) &&
(bucket->dev == statbuf->st_dev))
{
if (name) *name = bucket->name;
return 1;
}
bucket = bucket->next;
}
return 0;
}
/* Add statbuf to statbuf hash table */
static void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name)
{
int i;
size_t s;
ino_dev_hashtable_bucket_t *bucket;
i = hash_inode(statbuf->st_ino);
s = name ? strlen(name) : 0;
bucket = xmalloc(sizeof(ino_dev_hashtable_bucket_t) + s);
bucket->ino = statbuf->st_ino;
bucket->dev = statbuf->st_dev;
if (name)
strcpy(bucket->name, name);
else
bucket->name[0] = '\0';
bucket->next = ino_dev_hashtable[i];
ino_dev_hashtable[i] = bucket;
}
/* Clear statbuf hash table */
static void reset_ino_dev_hashtable(void)
{
int i;
ino_dev_hashtable_bucket_t *bucket;
for (i = 0; i < HASH_SIZE; i++) {
while (ino_dev_hashtable[i] != NULL) {
bucket = ino_dev_hashtable[i]->next;
free(ino_dev_hashtable[i]);
ino_dev_hashtable[i] = bucket;
}
}
}
/* tiny recursive du */
static long du(char *filename)
{
@@ -141,6 +71,10 @@ static long du(char *filename)
perror_msg("%s", filename);
return 0;
}
if (du_depth == 0)
dir_dev = statbuf.st_dev;
else if (one_file_system && dir_dev != statbuf.st_dev)
return 0;
du_depth++;
sum = (statbuf.st_blocks >> 1);
@@ -179,15 +113,13 @@ static long du(char *filename)
}
closedir(dir);
print(sum, filename);
}
else if (statbuf.st_nlink > 1 && !count_hardlinks) {
} else if (statbuf.st_nlink > 1 && !count_hardlinks) {
/* Add files with hard links only once */
if (is_in_ino_dev_hashtable(&statbuf, NULL)) {
sum = 0L;
if (du_depth == 1)
print(sum, filename);
}
else {
} else {
add_to_ino_dev_hashtable(&statbuf, NULL);
}
}
@@ -205,26 +137,34 @@ int du_main(int argc, char **argv)
print = print_normal;
/* parse argv[] */
while ((c = getopt(argc, argv, "sl"
while ((c = getopt(argc, argv, "slx"
#ifdef CONFIG_FEATURE_HUMAN_READABLE
"hm"
"hm"
#endif
"k")) != EOF) {
switch (c) {
case 's':
print = print_summary;
break;
case 'l':
count_hardlinks = 1;
break;
"k")) != EOF) {
switch (c) {
case 's':
print = print_summary;
break;
case 'l':
count_hardlinks = 1;
break;
case 'x':
one_file_system = 1;
break;
#ifdef CONFIG_FEATURE_HUMAN_READABLE
case 'h': disp_hr = 0; break;
case 'm': disp_hr = MEGABYTE; break;
case 'h':
disp_hr = 0;
break;
case 'm':
disp_hr = MEGABYTE;
break;
#endif
case 'k': break;
default:
show_usage();
}
case 'k':
break;
default:
show_usage();
}
}
/* go through remaining args (if any) */
@@ -234,9 +174,9 @@ int du_main(int argc, char **argv)
} else {
long sum;
for (i=optind; i < argc; i++) {
for (i = optind; i < argc; i++) {
sum = du(argv[i]);
if(is_directory(argv[i], FALSE, NULL)==FALSE) {
if (is_directory(argv[i], FALSE, NULL) == FALSE) {
print_normal(sum, argv[i]);
}
reset_ino_dev_hashtable();
@@ -246,7 +186,7 @@ int du_main(int argc, char **argv)
return status;
}
/* $Id: du.c,v 1.51 2001/10/24 04:59:27 andersen Exp $ */
/* $Id: du.c,v 1.55 2002/08/23 07:28:45 aaronl Exp $ */
/*
Local Variables:
c-file-style: "linux"
+2 -8
View File
@@ -146,12 +146,8 @@ static int null (VALUE *v)
static void tostring (VALUE *v)
{
char *temp;
if (v->type == integer) {
temp = xmalloc (4 * (sizeof (int) / sizeof (char)));
sprintf (temp, "%d", v->u.i);
v->u.s = temp;
bb_asprintf (&(v->u.s), "%d", v->u.i);
v->type = string;
}
}
@@ -377,9 +373,7 @@ static VALUE *eval6 (void)
else {
v = xmalloc (sizeof(VALUE));
v->type = string;
v->u.s = strncpy ((char *) xmalloc (i2->u.i + 1),
l->u.s + i1->u.i - 1, i2->u.i);
v->u.s[i2->u.i] = 0;
v->u.s = xstrndup(l->u.s + i1->u.i - 1, i2->u.i);
}
freev (l);
freev (i1);
+7 -1
View File
@@ -25,6 +25,7 @@
#include <getopt.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "busybox.h"
static int head(int len, FILE *fp)
@@ -47,12 +48,17 @@ int head_main(int argc, char **argv)
FILE *fp;
int need_headers, opt, len = 10, status = EXIT_SUCCESS;
if (( argc >= 2 ) && ( argv [1][0] == '-' ) && isdigit ( argv [1][1] )) {
len = atoi ( &argv [1][1] );
optind = 2;
}
/* parse argv[] */
while ((opt = getopt(argc, argv, "n:")) > 0) {
switch (opt) {
case 'n':
len = atoi(optarg);
if (len >= 1)
if (len >= 0)
break;
/* fallthrough */
default:
+18 -16
View File
@@ -43,45 +43,47 @@ static int fs_link(const char *link_destname, const char *link_srcname,
{
int status;
int src_is_dir;
char *src_name;
char *src_name = 0;
const char *src;
if (link_destname==NULL)
return(FALSE);
src_name = (char *) xmalloc(strlen(link_srcname)+strlen(link_destname)+1);
if (link_srcname==NULL)
strcpy(src_name, link_destname);
src = link_destname;
else
strcpy(src_name, link_srcname);
src = link_srcname;
if (flag&LN_NODEREFERENCE)
src_is_dir = is_directory(src_name, TRUE, NULL);
src_is_dir = is_directory(src, TRUE, NULL);
else
src_is_dir = is_directory(src_name, FALSE, NULL);
src_is_dir = is_directory(src, FALSE, NULL);
if ((src_is_dir==TRUE)&&((flag&LN_NODEREFERENCE)==0)) {
char* srcdir_name;
srcdir_name = xstrdup(link_destname);
strcat(src_name, "/");
strcat(src_name, get_last_path_component(srcdir_name));
src_name = concat_path_file(src, get_last_path_component(srcdir_name));
src = src_name;
free(srcdir_name);
}
if (flag&LN_FORCE)
unlink(src_name);
unlink(src);
if (flag&LN_SYMLINK)
status = symlink(link_destname, src_name);
status = symlink(link_destname, src);
else
status = link(link_destname, src_name);
status = link(link_destname, src);
if (status != 0) {
perror_msg(src_name);
return(FALSE);
perror_msg(src);
status = FALSE;
} else {
status = TRUE;
}
return(TRUE);
free(src_name);
return status;
}
extern int ln_main(int argc, char **argv)
@@ -119,7 +121,7 @@ extern int ln_main(int argc, char **argv)
status = EXIT_FAILURE;
optind++;
}
exit(status);
return status;
}
/*
+484 -340
View File
File diff suppressed because it is too large. Load diff
+5 -5
View File
@@ -434,7 +434,7 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct
temp += FI(B,C,D);
}
temp += cwp[(int)(*pp++)] + *pc++;
temp = CYCLIC (temp, ps[i&3]);
CYCLIC (temp, ps[i&3]);
temp += B;
A = D; D = C; C = B; B = temp;
}
@@ -443,7 +443,7 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct
for ( i = 0 ; i < 16 ; i++ ) {
temp = A + FF(B,C,D) + cwp[(int)(*pp++)] + *pc++;
temp = CYCLIC (temp, ps[i&3]);
CYCLIC (temp, ps[i&3]);
temp += B;
A = D; D = C; C = B; B = temp;
}
@@ -451,21 +451,21 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct
ps += 4;
for ( i = 0 ; i < 16 ; i++ ) {
temp = A + FG(B,C,D) + cwp[(int)(*pp++)] + *pc++;
temp = CYCLIC (temp, ps[i&3]);
CYCLIC (temp, ps[i&3]);
temp += B;
A = D; D = C; C = B; B = temp;
}
ps += 4;
for ( i = 0 ; i < 16 ; i++ ) {
temp = A + FH(B,C,D) + cwp[(int)(*pp++)] + *pc++;
temp = CYCLIC (temp, ps[i&3]);
CYCLIC (temp, ps[i&3]);
temp += B;
A = D; D = C; C = B; B = temp;
}
ps += 4;
for ( i = 0 ; i < 16 ; i++ ) {
temp = A + FI(B,C,D) + cwp[(int)(*pp++)] + *pc++;
temp = CYCLIC (temp, ps[i&3]);
CYCLIC (temp, ps[i&3]);
temp += B;
A = D; D = C; C = B; B = temp;
}
+5 -4
View File
@@ -3,6 +3,7 @@
* Mini mknod implementation for busybox
*
* Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
* Copyright (C) 1999-2002 by Erik Andersen <andersee@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,6 +28,7 @@
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "busybox.h"
int mknod_main(int argc, char **argv)
@@ -34,7 +36,7 @@ int mknod_main(int argc, char **argv)
char *thisarg;
mode_t mode = 0;
mode_t perm = 0666;
dev_t dev = 0;
dev_t dev = (dev_t) 0;
argc--;
argv++;
@@ -71,7 +73,7 @@ int mknod_main(int argc, char **argv)
break;
case 'p':
mode = S_IFIFO;
if (argc!=2) {
if (argc != 2) {
show_usage();
}
break;
@@ -80,7 +82,7 @@ int mknod_main(int argc, char **argv)
}
if (mode == S_IFCHR || mode == S_IFBLK) {
dev = (atoi(argv[2]) << 8) | atoi(argv[3]);
dev = (dev_t) ((atoi(argv[2]) << 8) | atoi(argv[3]));
}
mode |= perm;
@@ -89,4 +91,3 @@ int mknod_main(int argc, char **argv)
perror_msg_and_die("%s", argv[0]);
return EXIT_SUCCESS;
}
+1 -5
View File
@@ -248,11 +248,7 @@ int od_main(int argc, char **argv)
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
-1
View File
@@ -2,7 +2,6 @@
/*
* Mini pwd implementation for busybox
*
*
* Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
*
* This program is free software; you can redistribute it and/or modify
-1
View File
@@ -2,7 +2,6 @@
/*
* Mini sleep implementation for busybox
*
*
* Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
*
* This program is free software; you can redistribute it and/or modify
+22 -3
View File
@@ -572,14 +572,34 @@ extern int main(int argc, char **argv)
speed_was_set = 0;
require_set_attr = 0;
k = optind;
while (k < argc) {
k = 0;
while (++k < argc) {
int match_found = 0;
int reversed = 0;
int i;
if (argv[k][0] == '-') {
char *find_dev_opt;
++argv[k];
/* Handle "-a", "-ag", "-aF/dev/foo", "-aF /dev/foo", etc.
Find the options that have been parsed. This is really
gross, but it's needed because stty SETTINGS look like options to
getopt(), so we need to work around things in a really horrible
way. If any new options are ever added to stty, the short option
MUST NOT be a letter which is the first letter of one of the
possible stty settings.
*/
find_dev_opt = strchr(argv[k], 'F'); /* find -*F* */
if(find_dev_opt) {
if(find_dev_opt[1]==0) /* -*F /dev/foo */
k++; /* skip /dev/foo */
continue; /* else -*F/dev/foo - no skip */
}
if(argv[k][0]=='a' || argv[k][0]=='g')
continue;
/* Is not options - is reverse params */
reversed = 1;
}
for (i = 0; i < NUM_mode_info; ++i)
@@ -661,7 +681,6 @@ extern int main(int argc, char **argv)
} else
error_msg_and_die("invalid argument `%s'", argv[k]);
}
k++;
}
if (require_set_attr) {
-1
View File
@@ -2,7 +2,6 @@
/*
* Mini sync implementation for busybox
*
*
* Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
*
* This program is free software; you can redistribute it and/or modify
+6
View File
@@ -25,6 +25,7 @@
#include <fcntl.h>
#include <getopt.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
@@ -68,6 +69,11 @@ int tail_main(int argc, char **argv)
char *s, *start, *end, buf[BUFSIZ];
int i, opt;
if (( argc >= 2 ) && ( argv [1][0] == '-' ) && isdigit ( argv [1][1] )) {
count = atoi ( &argv [1][1] );
optind = 2;
}
while ((opt = getopt(argc, argv, "c:fhn:q:s:v")) > 0) {
switch (opt) {
case 'f':
+103 -135
View File
@@ -110,47 +110,49 @@ enum token_types {
static const struct t_op {
const char *op_text;
short op_num, op_type;
} ops [] = {
{"-r", FILRD, UNOP},
{"-w", FILWR, UNOP},
{"-x", FILEX, UNOP},
{"-e", FILEXIST,UNOP},
{"-f", FILREG, UNOP},
{"-d", FILDIR, UNOP},
{"-c", FILCDEV,UNOP},
{"-b", FILBDEV,UNOP},
{"-p", FILFIFO,UNOP},
{"-u", FILSUID,UNOP},
{"-g", FILSGID,UNOP},
{"-k", FILSTCK,UNOP},
{"-s", FILGZ, UNOP},
{"-t", FILTT, UNOP},
{"-z", STREZ, UNOP},
{"-n", STRNZ, UNOP},
{"-h", FILSYM, UNOP}, /* for backwards compat */
{"-O", FILUID, UNOP},
{"-G", FILGID, UNOP},
{"-L", FILSYM, UNOP},
{"-S", FILSOCK,UNOP},
{"=", STREQ, BINOP},
{"!=", STRNE, BINOP},
{"<", STRLT, BINOP},
{">", STRGT, BINOP},
{"-eq", INTEQ, BINOP},
{"-ne", INTNE, BINOP},
{"-ge", INTGE, BINOP},
{"-gt", INTGT, BINOP},
{"-le", INTLE, BINOP},
{"-lt", INTLT, BINOP},
{"-nt", FILNT, BINOP},
{"-ot", FILOT, BINOP},
{"-ef", FILEQ, BINOP},
{"!", UNOT, BUNOP},
{"-a", BAND, BBINOP},
{"-o", BOR, BBINOP},
{"(", LPAREN, PAREN},
{")", RPAREN, PAREN},
{0, 0, 0}
} ops[] = {
{
"-r", FILRD, UNOP}, {
"-w", FILWR, UNOP}, {
"-x", FILEX, UNOP}, {
"-e", FILEXIST, UNOP}, {
"-f", FILREG, UNOP}, {
"-d", FILDIR, UNOP}, {
"-c", FILCDEV, UNOP}, {
"-b", FILBDEV, UNOP}, {
"-p", FILFIFO, UNOP}, {
"-u", FILSUID, UNOP}, {
"-g", FILSGID, UNOP}, {
"-k", FILSTCK, UNOP}, {
"-s", FILGZ, UNOP}, {
"-t", FILTT, UNOP}, {
"-z", STREZ, UNOP}, {
"-n", STRNZ, UNOP}, {
"-h", FILSYM, UNOP}, /* for backwards compat */
{
"-O", FILUID, UNOP}, {
"-G", FILGID, UNOP}, {
"-L", FILSYM, UNOP}, {
"-S", FILSOCK, UNOP}, {
"=", STREQ, BINOP}, {
"!=", STRNE, BINOP}, {
"<", STRLT, BINOP}, {
">", STRGT, BINOP}, {
"-eq", INTEQ, BINOP}, {
"-ne", INTNE, BINOP}, {
"-ge", INTGE, BINOP}, {
"-gt", INTGT, BINOP}, {
"-le", INTLE, BINOP}, {
"-lt", INTLT, BINOP}, {
"-nt", FILNT, BINOP}, {
"-ot", FILOT, BINOP}, {
"-ef", FILEQ, BINOP}, {
"!", UNOT, BUNOP}, {
"-a", BAND, BBINOP}, {
"-o", BOR, BBINOP}, {
"(", LPAREN, PAREN}, {
")", RPAREN, PAREN}, {
0, 0, 0}
};
static char **t_wp;
@@ -158,7 +160,7 @@ static struct t_op const *t_wp_op;
static gid_t *group_array = NULL;
static int ngroups;
static enum token t_lex(char* s);
static enum token t_lex(char *s);
static int oexpr(enum token n);
static int aexpr(enum token n);
static int nexpr(enum token n);
@@ -174,10 +176,9 @@ static int test_eaccess(char *path, int mode);
static int is_a_group_member(gid_t gid);
static void initialize_group_array(void);
extern int
test_main(int argc, char** argv)
extern int test_main(int argc, char **argv)
{
int res;
int res;
if (strcmp(applet_name, "[") == 0) {
if (strcmp(argv[--argc], "]"))
@@ -187,29 +188,27 @@ test_main(int argc, char** argv)
/* Implement special cases from POSIX.2, section 4.62.4 */
switch (argc) {
case 1:
exit( 1);
exit(1);
case 2:
exit (*argv[1] == '\0');
exit(*argv[1] == '\0');
case 3:
if (argv[1][0] == '!' && argv[1][1] == '\0') {
exit (!(*argv[2] == '\0'));
exit(!(*argv[2] == '\0'));
}
break;
case 4:
if (argv[1][0] != '!' || argv[1][1] != '\0') {
if (t_lex(argv[2]),
t_wp_op && t_wp_op->op_type == BINOP) {
if (t_lex(argv[2]), t_wp_op && t_wp_op->op_type == BINOP) {
t_wp = &argv[1];
exit (binop() == 0);
exit(binop() == 0);
}
}
break;
case 5:
if (argv[1][0] == '!' && argv[1][1] == '\0') {
if (t_lex(argv[3]),
t_wp_op && t_wp_op->op_type == BINOP) {
if (t_lex(argv[3]), t_wp_op && t_wp_op->op_type == BINOP) {
t_wp = &argv[2];
exit (!(binop() == 0));
exit(!(binop() == 0));
}
}
break;
@@ -221,36 +220,31 @@ test_main(int argc, char** argv)
if (*t_wp != NULL && *++t_wp != NULL)
syntax(*t_wp, "unknown operand");
return( res);
return (res);
}
static void
syntax(op, msg)
const char *op;
const char *msg;
static void syntax(const char *op, const char *msg)
{
if (op && *op)
if (op && *op) {
error_msg_and_die("%s: %s", op, msg);
else
} else {
error_msg_and_die("%s", msg);
}
}
static int
oexpr(n)
enum token n;
static int oexpr(enum token n)
{
int res;
res = aexpr(n);
if (t_lex(*++t_wp) == BOR)
if (t_lex(*++t_wp) == BOR) {
return oexpr(t_lex(*++t_wp)) || res;
}
t_wp--;
return res;
}
static int
aexpr(n)
enum token n;
static int aexpr(enum token n)
{
int res;
@@ -261,23 +255,20 @@ aexpr(n)
return res;
}
static int
nexpr(n)
enum token n; /* token */
static int nexpr(enum token n)
{
if (n == UNOT)
return !nexpr(t_lex(*++t_wp));
return primary(n);
}
static int
primary(n)
enum token n;
static int primary(enum token n)
{
int res;
if (n == EOI)
if (n == EOI) {
syntax(NULL, "argument expected");
}
if (n == LPAREN) {
res = oexpr(t_lex(*++t_wp));
if (t_lex(*++t_wp) != RPAREN)
@@ -302,13 +293,12 @@ primary(n)
if (t_lex(t_wp[1]), t_wp_op && t_wp_op->op_type == BINOP) {
return binop();
}
}
return strlen(*t_wp) > 0;
}
static int
binop()
static int binop()
{
const char *opnd1, *opnd2;
struct t_op const *op;
@@ -317,9 +307,9 @@ binop()
(void) t_lex(*++t_wp);
op = t_wp_op;
if ((opnd2 = *++t_wp) == (char *)0)
if ((opnd2 = *++t_wp) == (char *) 0)
syntax(op->op_text, "argument expected");
switch (op->op_num) {
case STREQ:
return strcmp(opnd1, opnd2) == 0;
@@ -342,20 +332,17 @@ binop()
case INTLT:
return getn(opnd1) < getn(opnd2);
case FILNT:
return newerf (opnd1, opnd2);
return newerf(opnd1, opnd2);
case FILOT:
return olderf (opnd1, opnd2);
return olderf(opnd1, opnd2);
case FILEQ:
return equalf (opnd1, opnd2);
return equalf(opnd1, opnd2);
}
/* NOTREACHED */
return 1;
}
static int
filstat(nm, mode)
char *nm;
enum token mode;
static int filstat(char *nm, enum token mode)
{
struct stat s;
unsigned int i;
@@ -370,7 +357,7 @@ filstat(nm, mode)
return 0;
}
if (stat(nm, &s) != 0)
if (stat(nm, &s) != 0)
return 0;
switch (mode) {
@@ -427,21 +414,19 @@ filstat(nm, mode)
return 1;
}
filetype:
filetype:
return ((s.st_mode & S_IFMT) == i);
filebit:
filebit:
return ((s.st_mode & i) != 0);
}
static enum token
t_lex(s)
char *s;
static enum token t_lex(char *s)
{
struct t_op const *op = ops;
if (s == 0) {
t_wp_op = (struct t_op *)0;
t_wp_op = (struct t_op *) 0;
return EOI;
}
while (op->op_text) {
@@ -451,14 +436,12 @@ t_lex(s)
}
op++;
}
t_wp_op = (struct t_op *)0;
t_wp_op = (struct t_op *) 0;
return OPERAND;
}
/* atoi with error detection */
static int
getn(s)
const char *s;
static int getn(const char *s)
{
char *p;
long r;
@@ -467,69 +450,57 @@ getn(s)
r = strtol(s, &p, 10);
if (errno != 0)
error_msg_and_die("%s: out of range", s);
error_msg_and_die("%s: out of range", s);
while (isspace(*p))
p++;
p++;
if (*p)
error_msg_and_die("%s: bad number", s);
error_msg_and_die("%s: bad number", s);
return (int) r;
}
static int
newerf (f1, f2)
const char *f1, *f2;
static int newerf(const char *f1, const char *f2)
{
struct stat b1, b2;
return (stat (f1, &b1) == 0 &&
stat (f2, &b2) == 0 &&
b1.st_mtime > b2.st_mtime);
return (stat(f1, &b1) == 0 &&
stat(f2, &b2) == 0 && b1.st_mtime > b2.st_mtime);
}
static int
olderf (f1, f2)
const char *f1, *f2;
static int olderf(const char *f1, const char *f2)
{
struct stat b1, b2;
return (stat (f1, &b1) == 0 &&
stat (f2, &b2) == 0 &&
b1.st_mtime < b2.st_mtime);
return (stat(f1, &b1) == 0 &&
stat(f2, &b2) == 0 && b1.st_mtime < b2.st_mtime);
}
static int
equalf (f1, f2)
const char *f1, *f2;
static int equalf(const char *f1, const char *f2)
{
struct stat b1, b2;
return (stat (f1, &b1) == 0 &&
stat (f2, &b2) == 0 &&
b1.st_dev == b2.st_dev &&
b1.st_ino == b2.st_ino);
return (stat(f1, &b1) == 0 &&
stat(f2, &b2) == 0 &&
b1.st_dev == b2.st_dev && b1.st_ino == b2.st_ino);
}
/* Do the same thing access(2) does, but use the effective uid and gid,
and don't make the mistake of telling root that any file is
executable. */
static int
test_eaccess (path, mode)
char *path;
int mode;
static int test_eaccess(char *path, int mode)
{
struct stat st;
unsigned int euid = geteuid();
if (stat (path, &st) < 0)
if (stat(path, &st) < 0)
return (-1);
if (euid == 0) {
/* Root can read or write any file. */
if (mode != X_OK)
return (0);
return (0);
/* Root can execute any file that has any one of the execute
bits set. */
@@ -537,9 +508,9 @@ int mode;
return (0);
}
if (st.st_uid == euid) /* owner */
if (st.st_uid == euid) /* owner */
mode <<= 6;
else if (is_a_group_member (st.st_gid))
else if (is_a_group_member(st.st_gid))
mode <<= 3;
if (st.st_mode & mode)
@@ -548,8 +519,7 @@ int mode;
return (-1);
}
static void
initialize_group_array ()
static void initialize_group_array()
{
ngroups = getgroups(0, NULL);
group_array = xrealloc(group_array, ngroups * sizeof(gid_t));
@@ -557,9 +527,7 @@ initialize_group_array ()
}
/* Return non-zero if GID is one that we have in our groups list. */
static int
is_a_group_member (gid)
gid_t gid;
static int is_a_group_member(gid_t gid)
{
register int i;
@@ -568,7 +536,7 @@ gid_t gid;
return (1);
if (ngroups == 0)
initialize_group_array ();
initialize_group_array();
/* Search through the list looking for GID. */
for (i = 0; i < ngroups; i++)
+6 -4
View File
@@ -53,12 +53,14 @@ extern int touch_main(int argc, char **argv)
}
while (argc > 0) {
fd = open(*argv, (create == FALSE) ? O_RDWR : O_RDWR | O_CREAT,
fd = open(*argv, create ? O_RDWR | O_CREAT : O_RDWR,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
if (fd < 0) {
if (create == FALSE && errno == ENOENT)
return EXIT_SUCCESS;
else {
if (! create && errno == ENOENT) {
argc--;
argv++;
continue;
} else {
perror_msg_and_die("%s", *argv);
}
}
+51 -95
View File
@@ -31,126 +31,82 @@
/* Busyboxed by Erik Andersen */
/* Further size reductions by Glenn McGrath and Manuel Novoa III. */
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <sys/types.h>
#include <sys/utsname.h>
#if defined (HAVE_SYSINFO) && defined (HAVE_SYS_SYSTEMINFO_H)
# include <sys/systeminfo.h>
#endif
#include <getopt.h>
#include "busybox.h"
static void print_element(unsigned int mask, char *element);
/* Values that are bitwise or'd into `toprint'. */
/* Operating system name. */
static const int PRINT_SYSNAME = 1;
/* Node name on a communications network. */
static const int PRINT_NODENAME = 2;
/* Operating system release. */
static const int PRINT_RELEASE = 4;
/* Operating system version. */
static const int PRINT_VERSION = 8;
/* Machine hardware name. */
static const int PRINT_MACHINE = 16;
/* Host processor type. */
static const int PRINT_PROCESSOR = 32;
/* Mask indicating which elements of the name to print. */
static unsigned char toprint;
typedef struct {
struct utsname name;
char processor[8]; /* for "unknown" */
} uname_info_t;
static const char options[] = "snrvmpa";
static const char flags[] = "\x01\x02\x04\x08\x10\x20\x3f";
static const unsigned short int utsname_offset[] = {
offsetof(uname_info_t,name.sysname),
offsetof(uname_info_t,name.nodename),
offsetof(uname_info_t,name.release),
offsetof(uname_info_t,name.version),
offsetof(uname_info_t,name.machine),
offsetof(uname_info_t,processor)
};
int uname_main(int argc, char **argv)
{
struct utsname name;
char processor[256];
uname_info_t uname_info;
#if defined(__sparc__) && defined(__linux__)
char *fake_sparc = getenv("FAKE_SPARC");
#endif
toprint = 0;
const unsigned short int *delta;
int opt;
char toprint = 0;
/* Parse any options */
//fprintf(stderr, "argc=%d, argv=%s\n", argc, *argv);
while (--argc > 0 && **(++argv) == '-') {
while (*(++(*argv))) {
switch (**argv) {
case 's':
toprint |= PRINT_SYSNAME;
break;
case 'n':
toprint |= PRINT_NODENAME;
break;
case 'r':
toprint |= PRINT_RELEASE;
break;
case 'v':
toprint |= PRINT_VERSION;
break;
case 'm':
toprint |= PRINT_MACHINE;
break;
case 'p':
toprint |= PRINT_PROCESSOR;
break;
case 'a':
toprint = (PRINT_SYSNAME | PRINT_NODENAME | PRINT_RELEASE |
PRINT_PROCESSOR | PRINT_VERSION |
PRINT_MACHINE);
break;
default:
show_usage();
}
while ((opt = getopt(argc, argv, options)) != -1) {
const char *p = strchr(options,opt);
if (p == NULL) {
show_usage();
}
toprint |= flags[(int)(p-options)];
}
if (toprint == 0)
toprint = PRINT_SYSNAME;
if (toprint == 0) {
toprint = flags[0]; /* sysname */
}
if (uname(&name) == -1)
perror_msg("cannot get system name");
#if defined (HAVE_SYSINFO) && defined (SI_ARCHITECTURE)
if (sysinfo(SI_ARCHITECTURE, processor, sizeof(processor)) == -1)
perror_msg("cannot get processor type");
}
#else
strcpy(processor, "unknown");
#endif
if (uname(&uname_info.name) == -1) {
error_msg_and_die("cannot get system name");
}
#if defined(__sparc__) && defined(__linux__)
if (fake_sparc != NULL
&& (fake_sparc[0] == 'y'
|| fake_sparc[0] == 'Y')) strcpy(name.machine, "sparc");
if ((fake_sparc != NULL)
&& ((fake_sparc[0] == 'y')
|| (fake_sparc[0] == 'Y'))) {
strcpy(uname_info.name.machine, "sparc");
}
#endif
print_element(PRINT_SYSNAME, name.sysname);
print_element(PRINT_NODENAME, name.nodename);
print_element(PRINT_RELEASE, name.release);
print_element(PRINT_VERSION, name.version);
print_element(PRINT_MACHINE, name.machine);
print_element(PRINT_PROCESSOR, processor);
strcpy(uname_info.processor, "unknown");
delta=utsname_offset;
do {
if (toprint & 1) {
printf(((char *)(&uname_info)) + *delta);
if (toprint > 1) {
putchar(' ');
}
}
++delta;
} while (toprint >>= 1);
putchar('\n');
return EXIT_SUCCESS;
}
/* If the name element set in MASK is selected for printing in `toprint',
print ELEMENT; then print a space unless it is the last element to
be printed, in which case print a newline. */
static void print_element(unsigned int mask, char *element)
{
if (toprint & mask) {
toprint &= ~mask;
printf("%s%c", element, toprint ? ' ' : '\n');
}
}
-1
View File
@@ -2,7 +2,6 @@
/*
* Mini usleep implementation for busybox
*
*
* Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
*
* This program is free software; you can redistribute it and/or modify
+2 -2
View File
@@ -29,8 +29,8 @@
#include <string.h>
#include <stdlib.h>
#include "busybox.h"
#include "pwd.h"
#include "grp.h"
#include "pwd_.h"
#include "grp_.h"
/*struct passwd *getpwnam();*/
+24 -55
View File
@@ -21,6 +21,7 @@
*/
#include <getopt.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -28,7 +29,7 @@
#include "busybox.h"
/* Conversion table. for base 64 */
static char tbl_base64[64] = {
static char tbl_base64[65] = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
@@ -36,10 +37,11 @@ static char tbl_base64[64] = {
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', '+', '/'
'4', '5', '6', '7', '8', '9', '+', '/',
'=' /* termination character */
};
static char tbl_std[64] = {
static char tbl_std[65] = {
'`', '!', '"', '#', '$', '%', '&', '\'',
'(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7',
@@ -47,7 +49,8 @@ static char tbl_std[64] = {
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '[', '\\', ']', '^', '_'
'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
'`' /* termination character */
};
/*
@@ -71,10 +74,10 @@ static void uuencode (const char *s, const char *store, const int length, const
}
/* Pad the result if necessary... */
if (i == length + 1) {
*(p - 1) = '=';
*(p - 1) = tbl[64];
}
else if (i == length + 2) {
*(p - 1) = *(p - 2) = '=';
*(p - 1) = *(p - 2) = tbl[64];
}
/* ...and zero-terminate it. */
*p = '\0';
@@ -82,8 +85,9 @@ static void uuencode (const char *s, const char *store, const int length, const
int uuencode_main(int argc, char **argv)
{
const int src_buf_size = 60; // This *MUST* be a multiple of 3
const int src_buf_size = 45;// This *MUST* be a multiple of 3
const int dst_buf_size = 4 * ((src_buf_size + 2) / 3);
int write_size = dst_buf_size;
RESERVE_CONFIG_BUFFER(src_buf, src_buf_size + 1);
RESERVE_CONFIG_BUFFER(dst_buf, dst_buf_size + 1);
struct stat stat_buf;
@@ -92,10 +96,6 @@ int uuencode_main(int argc, char **argv)
size_t size;
mode_t mode;
int opt;
int column = 0;
int write_size = 0;
int remaining;
int buffer_offset = 0;
while ((opt = getopt(argc, argv, "m")) != -1) {
switch (opt) {
@@ -126,53 +126,22 @@ int uuencode_main(int argc, char **argv)
printf("begin%s %o %s", tbl == tbl_std ? "" : "-base64", mode, argv[argc - 1]);
while ((size = fread(src_buf, 1, src_buf_size, src_stream)) > 0) {
if (size != src_buf_size) {
/* write_size is always 60 until the last line */
write_size=(4 * ((size + 2) / 3));
/* pad with 0s so we can just encode extra bits */
memset(&src_buf[size], 0, src_buf_size - size);
}
/* Encode the buffer we just read in */
uuencode(src_buf, dst_buf, size, tbl);
/* Write the buffer to stdout, wrapping at 60 chars.
* This looks overly complex, but it gets tricky as
* the line has to continue to wrap correctly if we
* have to refill the buffer
*
* Improvments most welcome
*/
/* Initialise values for the new buffer */
remaining = 4 * ((size + 2) / 3);
buffer_offset = 0;
/* Write the buffer to stdout, wrapping at 60 chars
* starting from the column the last buffer ran out
*/
do {
if (remaining > (60 - column)) {
write_size = 60 - column;
}
else if (remaining < 60) {
write_size = remaining;
} else {
write_size = 60;
}
/* Setup a new row if required */
if (column == 0) {
putchar('\n');
if (tbl == tbl_std) {
putchar('M');
}
}
/* Write to the 60th column */
if (fwrite(&dst_buf[buffer_offset], 1, write_size, stdout) != write_size) {
perror("Couldnt finish writing");
}
/* Update variables based on last write */
buffer_offset += write_size;
remaining -= write_size;
column += write_size;
if (column % 60 == 0) {
column = 0;
}
} while (remaining > 0);
putchar('\n');
if (tbl == tbl_std) {
putchar(tbl[size]);
}
if (fwrite(dst_buf, 1, write_size, stdout) != write_size) {
perror("Couldnt finish writing");
}
}
printf(tbl == tbl_std ? "\n`\nend\n" : "\n====\n");
+102
View File
@@ -0,0 +1,102 @@
/* vi: set sw=4 ts=4: */
/*
* Mini watch implementation for busybox
*
* Copyright (C) 2001 by Michael Habermann <mhabermann@gmx.de>
*
* 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
*
*/
/* getopt not needed */
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include "busybox.h"
extern int watch_main(int argc, char **argv)
{
const char date_argv[2][10] = { "date", "" };
const int header_len = 40;
char header[header_len + 1];
int period = 2;
char **cargv;
int cargc;
pid_t pid;
int old_stdout;
int i;
if (argc < 2) {
show_usage();
} else {
cargv = argv + 1;
cargc = argc - 1;
/* don't use getopt, because it permutes the arguments */
if (argc >= 3 && !strcmp(argv[1], "-n")) {
period = strtol(argv[2], NULL, 10);
if (period < 1)
show_usage();
cargv += 2;
cargc -= 2;
}
}
/* create header */
snprintf(header, header_len, "Every %ds: ", period);
for (i = 0; i < cargc && (strlen(header) + strlen(cargv[i]) < header_len);
i++) {
strcat(header, cargv[i]);
strcat(header, " ");
}
/* fill with blanks */
for (i = strlen(header); i < header_len; i++)
header[i] = ' ';
header[header_len - 1] = '\0';
/* thanks to lye, who showed me how to redirect stdin/stdout */
old_stdout = dup(1);
while (1) {
printf("\033[H\033[J%s", header);
date_main(1, (char **) date_argv);
printf("\n");
pid = vfork(); /* vfork, because of ucLinux */
if (pid > 0) {
//parent
wait(0);
sleep(period);
} else if (0 == pid) {
//child
close(1);
dup(old_stdout);
if (execvp(*cargv, cargv))
error_msg_and_die("Couldn't run command\n");
} else {
error_msg_and_die("Couldn't vfork\n");
}
}
return EXIT_SUCCESS;
}
+79 -57
View File
@@ -26,40 +26,59 @@
#include <stdlib.h>
#include "busybox.h"
static int total_lines, total_words, total_chars, max_length;
static int print_lines, print_words, print_chars, print_length;
enum print_e {
print_lines = 1,
print_words = 2,
print_chars = 4,
print_length = 8
};
static void print_counts(int lines, int words, int chars, int length,
const char *name)
static unsigned int total_lines = 0;
static unsigned int total_words = 0;
static unsigned int total_chars = 0;
static unsigned int max_length = 0;
static char print_type = 0;
static void print_counts(const unsigned int lines, const unsigned int words,
const unsigned int chars, const unsigned int length, const char *name)
{
char const *space = "";
int output = 0;
if (print_lines) {
if (print_type & print_lines) {
printf("%7d", lines);
space = " ";
output++;
}
if (print_words) {
printf("%s%7d", space, words);
space = " ";
if (print_type & print_words) {
if (output++)
putchar(' ');
printf("%7d", words);
}
if (print_chars) {
printf("%s%7d", space, chars);
space = " ";
if (print_type & print_chars) {
if (output++)
putchar(' ');
printf("%7d", chars);
}
if (print_length)
printf("%s%7d", space, length);
if (*name)
if (print_type & print_length) {
if (output++)
putchar(' ');
printf("%7d", length);
}
if (*name) {
printf(" %s", name);
}
putchar('\n');
}
static void wc_file(FILE * file, const char *name)
{
int lines, words, chars, length;
int in_word = 0, linepos = 0;
unsigned int lines = 0;
unsigned int words = 0;
unsigned int chars = 0;
unsigned int length = 0;
unsigned int linepos = 0;
char in_word = 0;
int c;
lines = words = chars = length = 0;
while ((c = getc(file)) != EOF) {
chars++;
switch (c) {
@@ -77,7 +96,7 @@ static void wc_file(FILE * file, const char *name)
case ' ':
linepos++;
case '\v':
word_separator:
word_separator:
if (in_word) {
in_word = 0;
words++;
@@ -89,68 +108,71 @@ static void wc_file(FILE * file, const char *name)
break;
}
}
if (linepos > length)
if (linepos > length) {
length = linepos;
if (in_word)
}
if (in_word) {
words++;
}
print_counts(lines, words, chars, length, name);
total_lines += lines;
total_words += words;
total_chars += chars;
if (length > max_length)
if (length > max_length) {
max_length = length;
fclose(file);
fflush(stdout);
}
}
int wc_main(int argc, char **argv)
{
FILE *file;
unsigned int num_files_counted = 0;
int opt, status = EXIT_SUCCESS;
total_lines = total_words = total_chars = max_length = 0;
print_lines = print_words = print_chars = print_length = 0;
int opt;
while ((opt = getopt(argc, argv, "clLw")) > 0) {
switch (opt) {
switch (opt) {
case 'c':
print_chars = 1;
print_type |= print_chars;
break;
case 'l':
print_lines = 1;
print_type |= print_lines;
break;
case 'L':
print_length = 1;
print_type |= print_length;
break;
case 'w':
print_words = 1;
print_type |= print_words;
break;
default:
show_usage();
}
}
if (!print_lines && !print_words && !print_chars && !print_length)
print_lines = print_words = print_chars = 1;
if (argv[optind] == NULL || strcmp(argv[optind], "-") == 0) {
wc_file(stdin, "");
return EXIT_SUCCESS;
} else {
while (optind < argc) {
if ((file = wfopen(argv[optind], "r")) != NULL)
wc_file(file, argv[optind]);
else
status = EXIT_FAILURE;
num_files_counted++;
optind++;
}
}
if (num_files_counted > 1)
print_counts(total_lines, total_words, total_chars,
max_length, "total");
if (print_type == 0) {
print_type = print_lines | print_words | print_chars;
}
return status;
if (argv[optind] == NULL || strcmp(argv[optind], "-") == 0) {
wc_file(stdin, "");
} else {
unsigned short num_files_counted = 0;
while (optind < argc) {
if (print_type == print_chars) {
struct stat statbuf;
stat(argv[optind], &statbuf);
print_counts(0, 0, statbuf.st_size, 0, argv[optind]);
total_chars += statbuf.st_size;
} else {
FILE *file;
file = xfopen(argv[optind], "r");
wc_file(file, argv[optind]);
fclose(file);
}
optind++;
num_files_counted++;
}
if (num_files_counted > 1) {
print_counts(total_lines, total_words, total_chars, max_length, "total");
}
}
return(EXIT_SUCCESS);
}
+85
View File
@@ -0,0 +1,85 @@
/* vi: set sw=4 ts=4: */
/*----------------------------------------------------------------------
* Mini who is used to display user name, login time,
* idle time and host name.
*
* Author: Da Chen <dchen@ayrnetworks.com>
*
* This is a free document; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation:
* http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2002 AYR Networks, Inc.
*----------------------------------------------------------------------
*/
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <utmp.h>
#include <sys/stat.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <busybox.h>
extern int who_main(int argc, char **argv)
{
struct utmp *ut;
struct stat st;
int devlen, len;
time_t now, idle;
if (argc > 1)
show_usage();
setutent();
devlen = sizeof("/dev/") - 1;
printf("USER TTY IDLE FROM HOST\n");
while ((ut = getutent()) != NULL) {
char name[40];
if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) {
len = strlen(ut->ut_line);
if (ut->ut_line[0] == '/') {
strncpy(name, ut->ut_line, len);
name[len] = '\0';
strcpy(ut->ut_line, ut->ut_line + devlen);
} else {
strcpy(name, "/dev/");
strncpy(name+devlen, ut->ut_line, len);
name[devlen+len] = '\0';
}
printf("%-10s %-8s ", ut->ut_user, ut->ut_line);
if (stat(name, &st) == 0) {
now = time(NULL);
idle = now - st.st_atime;
if (idle < 60)
printf("00:00m ");
else if (idle < (60 * 60))
printf("00:%02dm ", (int)(idle / 60));
else if (idle < (24 * 60 * 60))
printf("%02d:%02dm ", (int)(idle / (60 * 60)),
(int)(idle % (60 * 60)) / 60);
else if (idle < (24 * 60 * 60 * 365))
printf("%03ddays ", (int)(idle / (24 * 60 * 60)));
else
printf("%02dyears ", (int) (idle / (24 * 60 * 60 * 365)));
} else
printf("%-8s ", "?");
printf("%-12.12s %s\n", ctime(&(ut->ut_tv.tv_sec)) + 4, ut->ut_host);
}
}
endutent();
return 0;
}
+2 -2
View File
@@ -1,7 +1,7 @@
This package was debianized by Erik Andersen <andersee@debian.org> on
Sun, 18 Jun 2000 23:31:02 -0600
It was downloaded from ftp://ftp.lineo.com/pub/busybox
HomePage is at: http://busybox.lineo.com/
It was downloaded from ftp://ftp.busybox.net/busybox
HomePage is at: http://busybox.net/
Copyright: GPL
+6 -6
View File
@@ -42,8 +42,8 @@ install: build
#(cd $(bbbd); $(MAKE) "CONFIG_SRC_DIR=../../" "PREFIX=../../$(bb)" install)
mkdir -p $(bb)/bin/
cp $(bbbd)/busybox $(bb)/bin/busybox
mkdir -p $(bb)/usr/share/doc/busybox/busybox.lineo.com
cp $(bbbd)/docs/busybox.lineo.com/BusyBox.html $(bb)/usr/share/doc/busybox/busybox.lineo.com/
mkdir -p $(bb)/usr/share/doc/busybox/busybox.net
cp $(bbbd)/docs/busybox.net/BusyBox.html $(bb)/usr/share/doc/busybox/busybox.net/
mkdir -p $(bb)/usr/share/man/man1
cp $(bbbd)/docs/BusyBox.1 $(bb)/usr/share/man/man1/busybox.1
@@ -67,8 +67,8 @@ install-static: build
#(cd $(bbsbd); $(MAKE) "CONFIG_SRC_DIR=../../" "PREFIX=../../$(bbs)" install)
mkdir -p $(bbs)/bin/
cp $(bbsbd)/busybox $(bbs)/bin/busybox
mkdir -p $(bbs)/usr/share/doc/busybox-static/busybox.lineo.com
cp $(bbsbd)/docs/busybox.lineo.com/BusyBox.html $(bbs)/usr/share/doc/busybox-static/busybox.lineo.com/
mkdir -p $(bbs)/usr/share/doc/busybox-static/busybox.net
cp $(bbsbd)/docs/busybox.net/BusyBox.html $(bbs)/usr/share/doc/busybox-static/busybox.net/
mkdir -p $(bbs)/usr/share/man/man1/
cp $(bbsbd)/docs/BusyBox.1 $(bbs)/usr/share/man/man1/busybox.1
@@ -130,7 +130,7 @@ busybox: install
dh_installdirs
dh_installdocs -p$@ $(bbbd)/docs/BusyBox.txt \
$(bbbd)/docs/BusyBox.html docs/style-guide.txt \
docs/busybox.lineo.com AUTHORS README TODO
docs/busybox.net AUTHORS README TODO
rm -rf `find $(bb) -name CVS`
rm -f `find $(bb) -name .cvsignore`
dh_installchangelogs -p$@ Changelog
@@ -152,7 +152,7 @@ busybox-static: do_static
dh_installdirs
dh_installdocs -p$@ $(bbsbd)/docs/BusyBox.txt \
$(bbsbd)/docs/BusyBox.html docs/style-guide.txt \
docs/busybox.lineo.com AUTHORS README TODO
docs/busybox.net AUTHORS README TODO
rm -rf `find $(bbs) -name CVS`
rm -f `find $(bbs) -name .cvsignore`
dh_installchangelogs -p$@ Changelog
+12 -2
View File
@@ -16,12 +16,13 @@
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
#include "pwd.h"
#include "busybox.h"
#include "pwd_.h"
static int start = 0;
static int stop = 0;
static int fork_before_exec = 0;
static int signal_nr = 15;
static int user_id = -1;
static const char *userspec = NULL;
@@ -55,7 +56,7 @@ parse_options(int argc, char * const *argv)
int c;
for (;;) {
c = getopt (argc, argv, "a:n:s:u:x:KS");
c = getopt (argc, argv, "a:n:s:u:x:KSb");
if (c == EOF)
break;
switch (c) {
@@ -81,6 +82,9 @@ parse_options(int argc, char * const *argv)
case 'x':
execname = optarg;
break;
case 'b':
fork_before_exec = 1;
break;
default:
show_usage();
}
@@ -109,6 +113,7 @@ pid_is_exec(int pid, const char *exec)
sprintf(buf, "/proc/%d/cmdline", pid);
fp = fopen(buf, "r");
if (fp && fgets (buf, sizeof (buf), fp) ) {
fclose(fp);
if (strncmp (buf, exec, strlen(exec)) == 0)
return 1;
}
@@ -255,6 +260,11 @@ start_stop_daemon_main(int argc, char **argv)
return EXIT_SUCCESS;
}
*--argv = startas;
if (fork_before_exec) {
if (daemon(0, 0) == -1)
perror_msg_and_die ("unable to fork");
}
setsid();
execv(startas, argv);
perror_msg_and_die ("unable to start %s", startas);
}
+1
View File
@@ -1 +1,2 @@
BusyBox.html
busybox.tar.gz
+136
View File
@@ -0,0 +1,136 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<title>BusyBox Anonymous CVS Instructions</title>
</HEAD>
<body text="#000000" alink="#660000" link="#660000" bgcolor="#dee2de" vlink="#660000">
<basefont face="lucida, helvetica, arial" size="3">
<H3>Accessing the Busybox CVS Repository</H3>
<CENTER>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2>
<TR>
<td bgcolor="#000000">
<FONT FACE="lucida, helvetica" COLOR="#ccccc0">
<B>B&nbsp;u&nbsp;s&nbsp;y&nbsp;B&nbsp;o&nbsp;x</B>
</FONT>
</TD>
</TR>
</TABLE>
<a href="/"><IMG SRC="images/busybox2.jpg" alt="BusyBox" border="0" width="360" height="230"></a><BR>
</CENTER>
<TABLE WIDTH="95%" CELLSPACING=1 CELLPADDING=4 BORDER=1>
<TR><TD BGCOLOR="#ccccc0" ALIGN=center>
<A NAME="intro"> <BIG><B>
Anonymous CVS
</B></BIG></A>
</TD></TR>
<TR><TD BGCOLOR="#eeeee0">
We allow anonymous (read-only) CVS access to everyone. The first command you
need to run for anonymous CVS access is:
<pre>
cvs -d:pserver:anonymous@busybox.net:/var/cvs login</pre>
<p>
CVS will prompt you for a password. Just press the Enter key (there is no
password for anonymous access). This step only needs to be done once, the first
time you attempt to access CVS.
<p>
Once the login is complete, you can then check the list of available
CVS modules by running the following command (all on one line):
<pre>
cvs -z3 -d:pserver:anonymous@busybox.net:/var/cvs co -c </pre>
<p>
If you wish, you can then check out a local copy of any of the
available modules. The following is an example of how to grab
a copy of busybox and tinylogin:
<pre>
cvs -z3 -d:pserver:anonymous@busybox.net:/var/cvs co -P busybox tinylogin</pre>
This will create a directory called <b>busybox</b> and a directory called
<b>tinylogin</b> in the current directory. These directories contain the
latest and greatest source code for busybox and tinylogin.
<p>
I usually create a ~/.cvsrc file with the following things in it, and I
recommend you should use the same:
<pre>
-z3
update -dP
rdiff -u
diff -ubBwpN
checkout -P</pre>
<p>
Once you've checked out a copy of the source tree, you can update your
source tree at any time so it is in sync with the latest and greatest by
running the command:
<pre>
cvs update</pre>
Because you've only been granted anonymous access to the tree, you won't be
able to commit any changes. Changes can be submitted for inclusion by posting
them to the appropriate <a href="http://busybox.net/mailman/listinfo">mailing list</a>.
<!-- End of Table -->
</TD></TR>
</TABLE>
<!-- Footer -->
<HR>
<TABLE WIDTH="100%">
<TR>
<TD>
<font size="-1" face="arial, helvetica, sans-serif">
Mail all comments, insults, suggestions and bribes to
<a href="mailto:andersen@codepoet.org">Erik Andersen</a><BR>
The Busybox logo is copyright 1999-2002, Erik Andersen.
</font>
</TD>
<TD>
<a href="http://www.vim.org"><img border=0 width=90 height=36
src="images/written.in.vi.png"
alt="This site created with the vi editor"></a>
</TD>
<TD>
<a href="http://www.gimp.org/"><img border=0 width=90 height=36
src="images/gfx_by_gimp.png" alt="Graphics by GIMP"></a>
</TD>
<TD>
<a href="http://www.linuxtoday.com"><img width=90 height=36
src="images/ltbutton2.png" alt="Linux Today"></a>
</TD>
<TD>
<p><a href="http://slashdot.org"><img width=90 height=36
src="images/sdsmall.png" alt="Slashdot"></a>
</TD>
<TD>
<a href="http://freshmeat.net"><img width=90 height=36
src="images/fm.mini.png" alt="Freshmeat"></a>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
+117
View File
@@ -0,0 +1,117 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<title>BusyBox CVS Read/Write Instructions</title>
</HEAD>
<body text="#000000" alink="#660000" link="#660000" bgcolor="#dee2de" vlink="#660000">
<basefont face="lucida, helvetica, arial" size="3">
<H3>Accessing the Busybox CVS Repository</H3>
<CENTER>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2>
<TR>
<td bgcolor="#000000">
<FONT FACE="lucida, helvetica" COLOR="#ccccc0">
<B>B&nbsp;u&nbsp;s&nbsp;y&nbsp;B&nbsp;o&nbsp;x</B>
</FONT>
</TD>
</TR>
</TABLE>
<a href="/"><IMG SRC="images/busybox2.jpg" alt="BusyBox" border="0" width="360" height="230"></a><BR>
</CENTER>
<TABLE WIDTH="95%" CELLSPACING=1 CELLPADDING=4 BORDER=1>
<TR><TD BGCOLOR="#ccccc0" ALIGN=center>
<A NAME="intro"> <BIG><B>
CVS Read/Write Access
</B></BIG></A>
</TD></TR>
<TR><TD BGCOLOR="#eeeee0">
If you want to be able to commit things to CVS, first contribute some
stuff to show you are serious. Then, very nicely ask
<a href="mailto:andersen@codepoet.org">Erik Andersen</a> if he will set you up with
an account. To access CVS, you will want to add the following to set up your environment:
<pre>
$ export CVS_RSH=/usr/bin/ssh
$ export CVSROOT='username@cvs.busybox.net:/var/cvs'</pre>
<br>
It goes without saying you must change <em>username</em> to your own
username...
<p>
To obtain commit access, you will need to demonstrate you are
serious by submitting a few good patches first. Then, you will need to
select a user-name to use when committing stuff, and finally, you will
need to send me the username you have selected, an ssh key, and the email
address where you prefer email to be sent (I will forward any email sent
to you, but not store it).
<p>
Note that if you would prefer to keep your communications with me
private, you can encrypt your email using my
<a href="http://www.codepoet.org/~andersen/erik/gpg.asc">public key</a>.
<!-- End of Table -->
</TD></TR>
</TABLE>
<!-- Footer -->
<HR>
<TABLE WIDTH="100%">
<TR>
<TD>
<font size="-1" face="arial, helvetica, sans-serif">
Mail all comments, insults, suggestions and bribes to
<a href="mailto:andersen@codepoet.org">Erik Andersen</a><BR>
The Busybox logo is copyright 1999-2002, Erik Andersen.
</font>
</TD>
<TD>
<a href="http://www.vim.org"><img border=0 width=90 height=36
src="images/written.in.vi.png"
alt="This site created with the vi editor"></a>
</TD>
<TD>
<a href="http://www.gimp.org/"><img border=0 width=90 height=36
src="images/gfx_by_gimp.png" alt="Graphics by GIMP"></a>
</TD>
<TD>
<a href="http://www.linuxtoday.com"><img width=90 height=36
src="images/ltbutton2.png" alt="Linux Today"></a>
</TD>
<TD>
<p><a href="http://slashdot.org"><img width=90 height=36
src="images/sdsmall.png" alt="Slashdot"></a>
</TD>
<TD>
<a href="http://freshmeat.net"><img width=90 height=36
src="images/fm.mini.png" alt="Freshmeat"></a>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

+451 -438
View File
@@ -1,439 +1,452 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>BusyBox</TITLE>
</HEAD>
<body text="#000000" alink="#660000" link="#660000" bgcolor="#dee2de" vlink="#660000">
<basefont face="lucida, helvetica, arial" size="3">
<CENTER>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2>
<TR>
<td bgcolor="#000000">
<FONT FACE="lucida, helvetica" COLOR="#ccccc0">
<B>B&nbsp;u&nbsp;s&nbsp;y&nbsp;B&nbsp;o&nbsp;x</B>
</FONT>
</TD>
</TR>
</TABLE>
<a href="/"><IMG SRC="images/busybox2.jpg" alt="BusyBox" border="0" width="360" height="230"></a><BR>
<!-- Begin Introduction section -->
<TABLE WIDTH="95%" CELLSPACING=1 CELLPADDING=4 BORDER=1>
<TR><TD BGCOLOR="#ccccc0" ALIGN=center>
<A NAME="intro"> <BIG><B>
The Swiss Army Knife of Embedded Linux
</B></BIG></A>
</TD></TR>
<TR><TD BGCOLOR="#eeeee0">
BusyBox combines tiny versions of many common UNIX utilities into a single
small executable. It provides minimalist replacements for most of the utilities
you usually find in fileutils, shellutils, findutils, textutils, grep, gzip,
tar, etc. BusyBox provides a fairly complete POSIX environment for any small or
embedded system. The utilities in BusyBox generally have fewer options than
their full featured GNU cousins; however, the options that are included provide
the expected functionality and behave very much like their GNU counterparts.
<p>
BusyBox has been written with size-optimization and limited resources in mind.
It is also extremely modular so you can easily include or exclude commands (or
features) at compile time. This makes it easy to customize your embedded
systems. To create a working system, just add /dev, /etc, and a kernel.
<p>
BusyBox is maintained by
<a href="http://codepoet.org/andersen/erik/erik.html">
Erik Andersen</a>, and licensed under the
<a href="http://www.gnu.org/copyleft/gpl.html">GNU GENERAL PUBLIC LICENSE</a>.
<p>
<h3> Screenshot </h3>
<p> Because everybody loves screenshots, a screenshot of BusyBox
is now available <a href="screenshot.html">right here</a>.
<H3>Mailing List Information</h3>
BusyBox now has a <a href="http://opensource.lineo.com/lists/busybox/">mailing list</a>!
To subscribe, go and visit <a href="http://opensource.lineo.com/mailman/listinfo/busybox">this page</a>.
<!-- Begin Latest News section -->
<TR><TD BGCOLOR="#ccccc0" ALIGN=center>
<A NAME="news">
<BIG><B>
Latest News
</B></BIG>
</A>
</TD></TR>
<TR><TD BGCOLOR="#eeeee0">
<ul>
<li> <b>18 November 2001 -- Help us buy busybox.net!</b>
<!-- Begin PayPal Logo -->
<center>
Click here to help buy busybox.net!
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="andersen@codepoet.org">
<input type="hidden" name="item_name" value="Support Busybox/Buy busybox.net">
<input type="hidden" name="image_url" value="https://https://busybox.lineo.com/images/busybox2.jpg">
<input type="hidden" name="no_shipping" value="1">
<input type="image" src="http://images.paypal.com/images/x-click-butcc-donate.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
</center>
<!-- End PayPal Logo -->
I've contacted the current owner of busybox.net and he is willing
to sell the domain name -- for $250. He also owns busybox.org
but will not part with it... I will then need to pay the
registry fee, so this will initially cost about $300. I would
also like to host busybox.net on my home machine (codepoet.org)
so I have full control over the system, but I would need to
increase the level of bandwidth I am paying for (there have been
over 1 Gigabyte of busybox source downloads for the month of
November alone -- other months have had more).
<p>
I was going to pay it all myself, but my wife didn't like that
idea at all (big surprise). It turns out, she has better ideas
about what we should spend our money on that don't involve
busybox. She suggested I should ask for contributions on the
mailing list and web page. So...
<p>
I am hoping that if everyone could contribute a bit we could pick
up the busybox.net domain name, and cover the bandwidth costs. I
know that busybox is being used by a lot of companies as well as
individuals -- hopefully companies willing to contribute back a
bit. So if everyone could please help out, that would be
wonderful!
<p>
p.s. I plan on updating the Changelog later this evening, and
releasing busybox 0.60.2 later tonight. I will probably just merge
in vodz' msh since it fixes known problems, and since I haven't had
time to make it uClinux safe. Changelog entries for busybox.stable
are welcome.
<p>
<li> <b>23 August 2001 -- BusyBox 0.60.1 released</b>
<br>
This is a relatively minor bug fixing release that fixes
up the bugs that have shown up in the stable release in
the last few weeks. Fortunately, nothing <em>too</em>
serious has shown up. This release only fixes bugs -- no
new features, no new applets. So without further ado,
here it is. Come and get it.
<p>
The
<a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a> has all
the details. As usual BusyBox 0.60.1 can be downloaded from
<a href="ftp://oss.lineo.com/busybox">ftp://oss.lineo.com/busybox</a>.
<p>Have Fun!
<p>
<li> <b>2 August 2001 -- BusyBox 0.60.0 released</b>
<br>
I am very pleased to announce the immediate availability of
BusyBox 0.60.0. I have personally tested this release with libc5, glibc,
and <a href="http://cvs.uclinux.org/uClibc.html">uClibc</a> on
x86, ARM, and powerpc using linux 2.2 and 2.4, and I know a number
of people using it on everything from ia64 to m68k with great success.
Everything seems to be working very nicely now, so getting a nice
stable bug-free(tm) release out seems to be in order. This releases fixes
a memory leak in syslogd, a number of bugs in the ash and msh shells, and
cleans up a number of things.
<p>
Those wanting an easy way to test the 0.60.0 release with uClibc can
use <a href="http://user-mode-linux.sourceforge.net/">User-Mode Linux</a>
to give it a try by downloading and compiling
<a href="ftp://oss.lineo.com/buildroot.tar.gz">buildroot.tar.gz</a>.
You don't have to be root or reboot your machine to run test this way.
Preconfigured User-Mode Linux kernel source is also on oss.lineo.com.
<p>
Another cool thing is the nifty <a href="ftp://oss.lineo.com/busybox/tutorial/index.html">
BusyBox Tutorial</a> contributed by K Computing. This requires
a ShockWave plugin (or standalone viewer), so you may want to grab the
the GPLed shockwave viewer from <a href="http://www.swift-tools.com/Flash/flash-0.4.10.tgz">here</a>
to view the tutorial.
<p>
Finally, In case you didn't notice anything odd about the
version number of this release, let me point out that this release
is <em>not</em> 0.53, because I bumped the version number up a
bit. This reflects the fact that this release is intended to form
a new stable BusyBox release series. If you need to rely on a
stable version of BusyBox, you should plan on using the stable
0.60.x series. If bugs show up then I will release 0.60.1, then
0.60.2, etc... This is also intended to deal with the fact that
the BusyBox build system will be getting a major overhaul for the
next release and I don't want that to break products that people
are shipping. To avoid that, the new build system will be
released as part of a new BusyBox development series that will
have some not-yet-decided-on odd version number. Once things
stabilize and the new build system is working for everyone, then
I will release that as a new stable release series.
<p>
The
<a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a> has all
the details. As usual BusyBox 0.60.0 can be downloaded from
<a href="ftp://oss.lineo.com/busybox">ftp://oss.lineo.com/busybox</a>.
<p>Have Fun!
<p>
<li> <b>7 July 2001 -- BusyBox 0.52 released</b>
<br>
I am very pleased to announce the immediate availability of
BusyBox 0.52 (the "new-and-improved rock-solid release"). This
release is the result of <em>many</em> hours of work and has tons
of bugfixes, optimizations, and cleanups. This release adds
several new applets, including several new shells (such as hush, msh,
and ash).
<p>
The
<a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a> covers
some of the more obvious details, but there are many many things that
are not mentioned, but have been improved in subtle ways. As usual,
BusyBox 0.52 can be downloaded from
<a href="ftp://oss.lineo.com/busybox">ftp://oss.lineo.com/busybox</a>.
<p>Have Fun!
<p>
<li> <b>10 April 2001 - Graph of Busybox Growth </b>
<br>
The illustrious Larry Doolittle has made a PostScript chart of the growth
of the Busybox tarball size over time. It is available for downloading /
viewing <a href= "busybox-growth.ps"> right here</a>.
<p> (Note that while the number of applets in Busybox has increased, you
can still configure Busybox to be as small as you want by selectively
turning off whichever applets you don't need.)
<p>
<li> <b>Old News</b>
<br>
For the old news, visit <a href="http://busybox.lineo.com/oldnews.html">the old news page</a>.
</ul>
<!-- Begin Download section -->
<TR><TD BGCOLOR="#ccccc0" ALIGN=center>
<A NAME="download"><BIG><B>
Download
</B></BIG></A>
</TD></TR>
<TR><TD BGCOLOR="#eeeee0">
<ul>
<li> Source for the latest release can always be downloaded from
<a href="ftp://oss.lineo.com/busybox">ftp://oss.lineo.com/busybox</a>.
<li> A new snapshot of the source is made daily and is available as a GNU
gzipped tarball <a href="busybox.tar.gz"> right here</a>.
<li> BusyBox now has its own publically browsable
<a href="http://opensource.lineo.com/cgi-bin/cvsweb/busybox/">CVS tree</a>,
anonymous
<a href="http://opensource.lineo.com/cvs_anon.html">CVS access</a>, and
for those that are actively contributing there is even
<a href="http://opensource.lineo.com/cvs_write.html">CVS write access</a>.
</ul>
<!-- Begin Docs section -->
<TR><TD BGCOLOR="#ccccc0" ALIGN=center>
<A NAME="docs"><BIG><B>
Documentation
</B></BIG></A>
</TD></TR>
<TR><TD BGCOLOR="#eeeee0">
Current documentation for BusyBox includes:
<ul>
<li> <a href="ftp://oss.lineo.com/busybox/BusyBox.html">BusyBox.html</a>.
This is a list of the all the available commands in BusyBox with
complete usage information and examples of how to use each app. I
have spent a <em>lot</em> of time updating these docs and trying to
make them fairly comprehensive. If you find any errors (factual,
grammatical, whatever) please let me know.
<li> <a href="ftp://oss.lineo.com/busybox/README">README</a>.
This is the README file included in the busybox source release.
<li> <a href="http://bugs.lineo.com/db/pa/lbusybox.html">BusyBox Bugs</a>.
Need to report a bug? Need to check if a bug has been filed?
<li> If you need more help, the BusyBox
<a href="http://opensource.lineo.com/lists/busybox/">mailing list</a> is
a good place to start.
</ul>
<!-- Begin Links section -->
<TR><TD BGCOLOR="#ccccc0" ALIGN=center>
<A NAME="links">
<BIG><B>
Important Links
</B></BIG>
</A>
</TD></TR>
<TR><TD BGCOLOR="#eeeee0">
<ul>
<li> <A HREF="http://perens.com/FreeSoftware/">
Free Software from Bruce Perens</A><br>
The original idea for BusyBox, and all versions up to 0.26 were written
by <A HREF="mailto:bruce@perens.com">Bruce Perens</a>. This is his BusyBox website.
<p>
<li> <A HREF="http://freshmeat.net/projects/busybox/">
Freshmeat AppIndex record for BusyBox</A>
<p>
<li><a href="http://tinylogin.lineo.com/">TinyLogin</a>
is a nice embedded tool for handling authentication, changing passwords,
and similar tasks which nicely complements BusyBox.
<p>
<li><a href="http://cvs.uclinux.org/uClibc.html">uClibc</a>
is a C library for embedded systems. You can actually statically link
a "Hello World" application under x86 that only takes 4k (as opposed to
200k under GNU libc). It can do dynamic linking too and works nicely with
BusyBox to create very small embedded systems.
<p>
<li> <a href="http://opensource.lineo.com/software.html">Other cool embedded software</a>.
<p>
</ul>
<!-- Begin Projects section -->
<TR><TD BGCOLOR="#ccccc0" ALIGN=center>
<A NAME="projects"><BIG><B>
Products/Projects Using BusyBox
</B></BIG></A>
</TD></TR>
<TR><TD BGCOLOR="#eeeee0">
<p> I know of the following products and/or projects that use BusyBox --
listed in the order I happen to add them to the web page:
<ul>
<li> <a href="http://cvs.debian.org/boot-floppies/">Debian installer (boot floppies) project</a>
<li> <a href="http://redhat.com/">Red Hat 7.2 installer</a>
<li> <a
href="http://distro.ibiblio.org/pub/Linux/distributions/slackware/source/rootdsks/">Slackware Installer</a>
<li> <a href="http://www.linuxrouter.org/">Linux Router Project </a>
<li> <a href="http://linux-embedded.org/">LEM</a>
<li> <a href="http://www.toms.net/rb/">tomsrtbt</a>
<li> <a href="http://www.stormix.com/">Stormix Installer</a>
<li> <a href="http://www.emacinc.com/linux2_sbc.htm">EMAC Linux 2.0 SBC</a>
<li> <a href="http://www.trinux.org/">Trinux</a>
<li> <a href="http://oddas.sourceforge.net/">ODDAS project</a>
<li> <a href="http://www.kerbango.com/">The Kerbango Internet Radio</a>
<li> <a href="http://www.linuxmagic.com/vpn/">LinuxMagic VPN Firewall</a>
<li> <a href="http://byld.sourceforge.net/">Build Your Linux Disk</a>
<li> <a href="http://homepages.ihug.co.nz/~ichi/baslinux.html">BasicLinux</a>
<li> <a href="http://ibiblio.org/pub/Linux/system/recovery">Zdisk</a>
<li> <a href="http://www.adtran.com">AdTran - VPN/firewall VPN Linux Distribution</a>
<li> <a href="http://mkcdrec.ota.be/">mkCDrec - make CD-ROM recovery</a>
<li> <a href="http://recycle.lbl.gov/~ldoolitt/bse/">Linux on nanoEngine</a>
<li> <a href="http://www.zelow.no/floppyfw/"> Floppyfw</a>
<li> <a href="http://midori.transmeta.com/"> Midori Linux</a> - <a href=
"http://www.wired.com/news/technology/0,1282,42399,00.html"> Article on
Midori Linux</a> on <a href= "http://www.wired.com"> Wired</a>. Quote from
Erik at the top of <a href=
"http://www.wired.com/news/technology/0,1282,42399-2,00.html"> this
page</a>
<li> <a href="http://www.ltsp.org/">Linux Terminal Server Project</a>
<li> <a href="http://www.devil-linux.org/">Devil-Linux</a>
<li> <a href="http://dutnux.sourceforge.net/">DutNux</a>
<li> <a href="http://www.cachier.com/">Cachier</a>
<li> <a href="http://www.microwerks.net/~hugo/mindi/">Mindi</a>
</ul>
<p> Do you use BusyBox? I'd love to know about it and I'd be happy to link to
you.
<!-- End of Table -->
</TD></TR>
</TABLE>
<!-- Footer -->
<HR>
<TABLE WIDTH="100%">
<TR>
<TD>
<font size="-1" face="arial, helvetica, sans-serif">
Mail all comments, insults, suggestions and bribes to
<a href="mailto:andersen@codepoet.org">Erik Andersen</a><BR>
The Busybox logo is copyright 1999,2000,2001, Erik Andersen.
</font>
</TD>
<TD>
<a href="http://www.vim.org"><img border=0 width=90 height=36
src="images/written.in.vi.png"
alt="This site created with the vi editor"></a>
</TD>
<TD>
<a href="http://www.gimp.org/"><img border=0 width=90 height=36
src="images/gfx_by_gimp.png" alt="Graphics by GIMP"></a>
</TD>
<TD>
<a href="http://www.linuxtoday.com"><img width=90 height=36
src="images/ltbutton2.png" alt="Linux Today"></a>
</TD>
<TD>
<p><a href="http://slashdot.org"><img width=90 height=36
src="images/sdsmall.png" alt="Slashdot"></a>
</TD>
<TD>
<a href="http://freshmeat.net"><img width=90 height=36
src="images/fm.mini.png" alt="Freshmeat"></a>
</TD>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta name="generator" content=
"HTML Tidy for Linux/x86 (vers 1st February 2002), see www.w3.org">
<title>BusyBox</title>
<style type="text/css">
body {
background-color: #DEE2DE;
color: #000000;
}
:link { color: #660000 }
:visited { color: #660000 }
:active { color: #660000 }
div.c3 {text-align: center}
td.c2 {font-family: arial, helvetica, sans-serif; font-size: 80%}
td.c1 {font-family: lucida, helvetica; font-size: 248%}
</style>
</head>
<body>
<basefont face="lucida, helvetica, arial" size="3">
<div class="c3">
<table border="0" cellspacing="1" cellpadding="2">
<tr>
<td class="c1">BUSYBOX</td>
</tr>
</table>
<a href="/"><img src="images/busybox1.png" alt="BusyBox"
border="0" width="164" height="116"></a><br>
<!-- Begin Introduction section -->
<table width="95%" cellspacing="1" cellpadding="4" border=
"1">
<tr>
<td bgcolor="#CCCCC0" align="center"><a name= "intro"><big>
<b>The Swiss Army Knife of Embedded Linux</b>
</big></a></td>
</tr>
<tr>
<td bgcolor="#EEEEE0">
BusyBox combines tiny versions of many common UNIX utilities
into a single small executable. It provides minimalist
replacements for most of the utilities you usually find in GNU
fileutils, shellutils, etc. The utilities in BusyBox generally
have fewer options than their full-featured GNU cousins;
however, the options that are included provide the expected
functionality and behave very much like their GNU counterparts.
BusyBox provides a fairly complete POSIX environment for any
small or embedded system.
<p>BusyBox has been written with size-optimization and
limited resources in mind. It is also extremely modular
so you can easily include or exclude commands (or
features) at compile time. This makes it easy to
customize your embedded systems. To create a working
system, just add /dev, /etc, and a kernel.</p>
<p>BusyBox is maintained by <a href=
"http://codepoet.org/andersen/erik/erik.html">Erik
Andersen</a>, and licensed under the <a href=
"http://www.gnu.org/copyleft/gpl.html">GNU GENERAL
PUBLIC LICENSE</a>.</p>
<h3>Screenshot</h3>
<p>Because everybody loves screenshots, a screenshot of
BusyBox is now available <a href=
"screenshot.html">right here</a>.</p>
<h3>Mailing List Information</h3>
BusyBox now has a <a href="/lists/busybox/">mailing
list</a>!<br>
To subscribe, go and visit <a href=
"/mailman/listinfo/busybox">this page</a>.
<!-- Begin Latest News section -->
</td>
</tr>
<tr>
<td bgcolor="#CCCCC0" align="center"><a name=
"news"><big><b>Latest News</b></big></a></td>
</tr>
<tr>
<td bgcolor="#EEEEE0">
<ul>
<p>
<li><b>27 April 2002 -- BusyBox 0.60.3 released</b>
I am very pleased to announce that the BusyBox 0.60.3 (stable) is
now available for download. This is primarily a bugfix release
for the stable series. A number of problems have turned up since
the last release, and this should address most of those problems.
This should be the last release for the 0.60.x series. The
development busybox tree has been progressing nicely, and will
hopefully be ready to become the next stable release.
<p>
The <a href="downloads/Changelog">changelog</a> has all
the details. As usual you can <a href="downloads">download busybox here</a>.
<p>Have Fun!
<p>
<p>
<li><b>6 March 2002 -- busybox.net now has mirrors!</b>
<p>Busybox.net is now much more available, thanks to
the fine folks at <a href= "http://i-netinnovations.com/">http://i-netinnovations.com/</a>
who are providing hosting for busybox.net and
uclibc.org. In addition, we now have two mirrors:
<a href= "http://busybox.linuxmagic.com/">http://busybox.linuxmagic.com/</a>
in Canada and
<a href= "http://busybox.csservers.de/">http://busybox.csservers.de/</a>
in Germany. I hope this makes things much more
accessible for everyone!
<p>
<li><b>Old News</b><br>
For the old news, visit <a href="oldnews.html">the
old news page</a>.</li>
</ul>
</td>
</tr>
<!-- Begin Sponsors section -->
<tr>
<td bgcolor="#CCCCC0" align="center"><a name=
"sponsors"><big><b>Sponsors</b></big></a></td>
</tr>
<tr>
<td bgcolor="#EEEEE0">
Please visit our sponsors and thank them for their
support! They have provided money for equipment and
bandwidth. Next time you need help with a project,
consider these fine companies!
<ul>
<li><a href="http://opensource.se/">opensource.se</a><br>
Embedded open source consulting in Europe.
</li>
<li><a href="http://i-netinnovations.com/">http://i-netinnovations.com/</a><br>
Web hosting (currently hosting busybox.net and uclibc.org)
</li>
<li><a href="http://www.lineo.com">Lineo</a><br>
Embedded Linux development and services.
</li>
<li><a href="http://www.codepoet-consulting.com">Codepoet Consulting</a><br>
Custom Linux, embedded Linux, BusyBox, and uClibc
development.
</li>
</ul>
Several individuals have also contributed. If you have
already contributed and would like your name added
here, just let me know. If you would like to be a
BusyBox sponsor, email <a href=
"mailto:andersen@codepoet.org">Erik</a>.
</td>
</tr>
<!-- Begin Download section -->
<p>
<tr>
<td bgcolor="#CCCCC0" align="center"><a name=
"download"><big><b>Download</b></big></a></td>
</tr>
<tr>
<td bgcolor="#EEEEE0">
Source for the latest release can always be
downloaded from <a href="downloads">http://www.busybox.net/downloads</a>.
<p>
BusyBox now has <b>two</b> CVS trees. The "busybox-stable"
tree contains the latest updates to the 0.60.x stable series.
The "busybox" tree contains the latest development version
of busybox.<br>
<ul>
<li><a href= "downloads/snapshots/">Daily Snapshots of the the latest
stable, and the latest development CVS source trees can be found right here</a>.
<br>
</li><li><a href="/cgi-bin/cvsweb/busybox/">Click here to browse the CVS
tree for the development version of BusyBox</a>
</li><li><a href="/cgi-bin/cvsweb/busybox.stable/">Click here to browse
the CVS tree for the stable 0.60.x version of BusyBox</a>.
</li><li>Anonymous <a href="cvs_anon.html">CVS
access</a> is available.
</li><li>For those that are actively contributing there is
even <a href="cvs_write.html">CVS write access</a>.</li>
</ul>
</td>
</tr>
<!-- Begin Docs section -->
<tr>
<td bgcolor="#CCCCC0" align="center"><a name=
"docs"><big><b>Documentation</b></big></a></td>
</tr>
<tr>
<td bgcolor="#EEEEE0">
Current documentation for BusyBox includes:
<ul>
<li><a href=
"downloads/BusyBox.html">BusyBox.html</a>. This is a
list of the all the available commands in BusyBox
with complete usage information and examples of how
to use each app. I have spent a <em>lot</em> of time
updating these docs and trying to make them fairly
comprehensive. If you find any errors (factual,
grammatical, whatever) please let me know.</li>
<li><a href="downloads/README">README</a>. This is
the README file included in the busybox source
release.</li>
<li><a href=
"http://bugs.busybox.net/db/pa/lbusybox.html">BusyBox
Bugs</a>. Need to report a bug? Need to check if a
bug has been filed?</li>
<li>If you need more help, the BusyBox <a href=
"lists/busybox/">mailing list</a> is a good place to
start.</li>
</ul>
</td>
</tr>
<!-- Begin Links section -->
<tr>
<td bgcolor="#CCCCC0" align="center"><a name=
"links"><big><b>Important Links</b></big></a></td>
</tr>
<tr>
<td bgcolor="#EEEEE0">
<ul>
<li><a href="http://perens.com/FreeSoftware/">Free
Software from Bruce Perens</a><br>
The original idea for BusyBox, and all versions up
to 0.26 were written by <a href=
"mailto:bruce@perens.com">Bruce Perens</a>. This is
his BusyBox website.</li>
<li><a href=
"http://freshmeat.net/projects/busybox/">Freshmeat
AppIndex record for BusyBox</a></li>
<li><a href=
"http://tinylogin.busybox.net/">TinyLogin</a> is a
nice embedded tool for handling authentication,
changing passwords, and similar tasks which nicely
complements BusyBox.</li>
<li><a href="http://udhcp.busybox.net/">udhcp</a> is
a tiny dhcp client and/or server which is ideal for
embedded systems.</li>
<li><a href="http://www.uclibc.org/">uClibc</a> is a
C library for embedded systems. You can actually
statically link a "Hello World" application under x86
that only takes 4k (as opposed to 200k under GNU
libc). It can do dynamic linking too and works nicely
with BusyBox to create very small embedded
systems.</li>
</ul>
</td>
</tr>
<!-- Begin Projects section -->
<tr>
<td bgcolor="#CCCCC0" align="center"><a name=
"projects"><big><b>Products/Projects Using
BusyBox</b></big></a></td>
</tr>
<tr>
<td bgcolor="#EEEEE0">
<p>I know of the following products and/or projects
that use BusyBox -- listed in the order I happen to add
them to the web page:</p>
<ul>
<li><a href=
"http://cvs.debian.org/boot-floppies/">Debian
installer (boot floppies) project</a></li>
<li><a href="http://redhat.com/">Red Hat 7.2
installer</a></li>
<li><a href=
"http://distro.ibiblio.org/pub/Linux/distributions/slackware/source/rootdsks/">
Slackware Installer</a></li>
<li><a href="http://www.linuxrouter.org/">Linux
Router Project</a></li>
<li><a href="http://linux-embedded.org/">LEM</a></li>
<li><a href=
"http://www.toms.net/rb/">tomsrtbt</a></li>
<li><a href="http://www.stormix.com/">Stormix
Installer</a></li>
<li><a href=
"http://www.emacinc.com/linux2_sbc.htm">EMAC Linux
2.0 SBC</a></li>
<li><a href="http://www.trinux.org/">Trinux</a></li>
<li><a href="http://oddas.sourceforge.net/">ODDAS
project</a></li>
<li><a href="http://www.kerbango.com/">The Kerbango
Internet Radio</a></li>
<li><a href=
"http://www.linuxmagic.com/vpn/">LinuxMagic VPN
Firewall</a></li>
<li><a href="http://byld.sourceforge.net/">Build Your
Linux Disk</a></li>
<li><a href=
"http://homepages.ihug.co.nz/~ichi/baslinux.html">BasicLinux</a></li>
<li><a href=
"http://ibiblio.org/pub/Linux/system/recovery">Zdisk</a></li>
<li><a href="http://www.adtran.com">AdTran -
VPN/firewall VPN Linux Distribution</a></li>
<li><a href="http://mkcdrec.ota.be/">mkCDrec - make
CD-ROM recovery</a></li>
<li><a href=
"http://recycle.lbl.gov/~ldoolitt/bse/">Linux on
nanoEngine</a></li>
<li><a href=
"http://www.zelow.no/floppyfw/">Floppyfw</a></li>
<li><a href="http://midori.transmeta.com/">Midori
Linux</a> - <a href=
"http://www.wired.com/news/technology/0,1282,42399,00.html">
Article on Midori Linux</a> on <a href=
"http://www.wired.com">Wired</a>. Quote from Erik at
the top of <a href=
"http://www.wired.com/news/technology/0,1282,42399-2,00.html">
this page</a></li>
<li><a href="http://www.ltsp.org/">Linux Terminal
Server Project</a></li>
<li><a href=
"http://www.devil-linux.org/">Devil-Linux</a></li>
<li><a href=
"http://dutnux.sourceforge.net/">DutNux</a></li>
<li><a href=
"http://www.cachier.com/">Cachier</a></li>
<li><a href=
"http://www.microwerks.net/~hugo/mindi/">Mindi</a></li>
<li><a href=
"http://www.tzi.de/~pharao90/ttylinux">ttylinux</a></li>
<li><a href="http://www.coyotelinux.com/">Coyote Linux</a></li>
<li><a href="http://www.partimage.org/">Partition
Image</a></li>
<li><a href="http://www.fli4l.de/">fli4l the on(e)-disk-router</a></li>
<li><a href="http://tuxscreen.net">Tuxscreen Linux
Phone</a></li>
<li><a href="http://tinfoilhat.cultists.net/">Tinfoil
Hat Linux</a></li>
<li><a href="http://zaurus.sourceforge.net/">Sharp Zaurus
PDA</a></li>
<li><a href="http://familiar.handhelds.org/">Familiar Linux</a> - a linux distribution for handheld computers</li>
</ul>
<p>Do you use BusyBox? I'd love to know about it and
I'd be happy to link to you. <!-- End of Table -->
</p>
</td>
</tr>
</table>
<!-- Footer -->
<hr>
<table width="100%">
<tr>
<td class="c2">Mail all comments, insults, suggestions
and bribes to <a href="mailto:andersen@codepoet.org">Erik
Andersen</a><br>
The Busybox logo is copyright 1999-2002, Erik
Andersen.</td>
<td><a href="http://www.vim.org"><img border="0" width=
"90" height="36" src="images/written.in.vi.png" alt=
"This site created with the vi editor"></a></td>
<td><a href="http://www.gimp.org/"><img border="0" width=
"90" height="36" src="images/gfx_by_gimp.png" alt=
"Graphics by GIMP"></a></td>
<td><a href="http://www.linuxtoday.com"><img width="90"
height="36" src="images/ltbutton2.png" alt="Linux Today">
</a></td>
<td>
<p><a href="http://slashdot.org"><img width="90"
height="36" src="images/sdsmall.png" alt="Slashdot">
</a></p>
</td>
<td><a href="http://freshmeat.net"><img width="90"
height="36" src="images/fm.mini.png" alt="Freshmeat">
</a></td>
</tr>
</table>
</div>
</body>
</html>
+271 -32
View File
@@ -38,9 +38,255 @@
<ul>
<p> <li> <b>Take me back to the <a href="http://busybox.lineo.com/">BusyBox</a> web site.</b>
<p> <li> <b>Take me back to the <a href="/">BusyBox</a> web site.</b>
<hr>
<li>
<b>3 January 2002 -- Welcome to busybox.net!</b>
<p>Thanks to the generosity of a number of busybox
users, we have been able to purchase busybox.net
(which is where you are probably reading this).
Right now, busybox.net and uclibc.org are both
living on my home system (at the end of my DSL
line). I apologize for the abrupt move off of
busybox.lineo.com. Unfortunately, I no longer have
the access needed to keep that system updated (for
example, you might notice the daily snapshots there
stopped some time ago).</p>
<p>Busybox.net is currently hosted on my home
server, at the end of a DSL line. Unfortunately,
the load on them is quite heavy. To address this,
I'm trying to make arrangements to get busybox.net
co-located directly at an ISP. To assist in the
co-location effort, <a href=
"http://www.codepoet.org/~markw">Mark Whitley</a>
(author of busybox sed, cut, and grep) has donated
his <a href=
"http://www.netwinder.org/">NetWinder</a> computer
for hosting busybox.net and uclibc.org. Once this
system is co-located, the current speed problems
should be completely eliminated. Hopefully, too,
some of you will volunteer to set up some mirror
sites, to help to distribute the load a bit.</p>
<p><!--
<center>
Click here to help support busybox.net!
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="andersen@codepoet.org">
<input type="hidden" name="item_name" value="Support Busybox">
<input type="hidden" name="image_url" value="https://codepoet-consulting.com/images/busybox2.jpg">
<input type="hidden" name="no_shipping" value="1">
<input type="image" src="images/donate.png" border="0" name="submit" alt="Make donation using PayPal">
</form>
</center>
-->
Since some people expressed concern over BusyBox
donations, let me assure you that no one is getting
rich here. All BusyBox and uClibc donations will be
spent paying for bandwidth and needed hardware
upgrades. For example, Mark's NetWinder currently
has just 64Meg of memory. As demonstrated when
google spidered the site the other day, 64 Megs in
not enough, so I'm going to be ordering 256Megs of
ram and a larger hard drive for the box today. So
far, donations received have been sufficient to
cover almost all expenses. In the future, we may
have co-location fees to worry about, but for now
we are ok. A <b>HUGE thank-you</b> goes out to
everyone that has contributed!<br>
-Erik</p>
</li>
<li>
<b>20 November 2001 -- BusyBox 0.60.2 released</b>
<p>We am very pleased to announce that the BusyBox
0.60.2 (stable) is now released to the world. This
one is primarily a bugfix release for the stable
series, and it should take care of most everyone's
needs till we can get the nice new stuff we have
been working on in CVS ready to release (with the
wonderful new buildsystem). The biggest change in
this release (beyond bugfixes) is the fact that msh
(the minix shell) has been re-worked by Vladimir N.
Oleynik (vodz) and so it no longer crashes when
told to do complex things with backticks.</p>
<p>This release has been tested on x86, ARM, and
powerpc using glibc 2.2.4, libc5, and uClibc, so it
should work with just about any Linux system you
throw it at. See the <a href=
"downloads/Changelog">changelog</a> for <small>most
of</small> the details. The last release was
<em>very</em> solid for people, and this one should
be even better.</p>
<p>As usual BusyBox 0.60.2 can be downloaded from
<a href=
"downloads">http://www.busybox.net/downloads</a>.</p>
<p>Have Fun.<br>
-Erik</p>
</li>
<li> <b>18 November 2001 -- Help us buy busybox.net!</b>
<!-- Begin PayPal Logo -->
<center>
Click here to help buy busybox.net!
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="andersen@codepoet.org">
<input type="hidden" name="item_name" value="Support Busybox">
<input type="hidden" name="image_url" value="https://busybox.net/images/busybox2.jpg">
<input type="hidden" name="no_shipping" value="1">
<input type="image" src="images/donate.png" border="0" name="submit" alt="Make donation using PayPal">
</form>
</center>
<!-- End PayPal Logo -->
I've contacted the current owner of busybox.net and he is willing
to sell the domain name -- for $250. He also owns busybox.org but
will not part with it... I will then need to pay the registry fee
for a couple of years and start paying for bandwidth, so this will
initially cost about $300. I would like to host busybox.net on my
home machine (codepoet.org) so I have full control over the system,
but to do that would require that I increase the level of bandwidth
I am paying for. Did you know that so far this month, there
have been over 1.4 Gigabytes of busybox ftp downloads? I don't
even <em>know</em> how much CVS bandwidth it requires. For the
time being, Lineo has continued to graciously provide this
bandwidth, despite the fact that I no longer work for them. If I
start running this all on my home machine, paying for the needed bandwidth
will start costing some money.
<p>
I was going to pay it all myself, but my wife didn't like that
idea at all (big surprise). It turns out &lt;insert argument
where she wins and I don't&gt; she has better ideas
about what we should spend our money on that don't involve
busybox. She suggested I should ask for contributions on the
mailing list and web page. So...
<p>
I am hoping that if everyone could contribute a bit, we could pick
up the busybox.net domain name and cover the bandwidth costs. I
know that busybox is being used by a lot of companies as well as
individuals -- hopefully people and companies that are willing to
contribute back a bit. So if everyone could please help out, that
would be wonderful!
<p>
<li> <b>23 August 2001 -- BusyBox 0.60.1 released</b>
<br>
This is a relatively minor bug fixing release that fixes
up the bugs that have shown up in the stable release in
the last few weeks. Fortunately, nothing <em>too</em>
serious has shown up. This release only fixes bugs -- no
new features, no new applets. So without further ado,
here it is. Come and get it.
<p>
The
<a href="downloads/Changelog">changelog</a> has all
the details. As usual BusyBox 0.60.1 can be downloaded from
<a href="downloads">http://busybox.net/downloads</a>.
<p>Have Fun!
<p>
<li> <b>2 August 2001 -- BusyBox 0.60.0 released</b>
<br>
I am very pleased to announce the immediate availability of
BusyBox 0.60.0. I have personally tested this release with libc5, glibc,
and <a href="http://uclibc.org/">uClibc</a> on
x86, ARM, and powerpc using linux 2.2 and 2.4, and I know a number
of people using it on everything from ia64 to m68k with great success.
Everything seems to be working very nicely now, so getting a nice
stable bug-free(tm) release out seems to be in order. This releases fixes
a memory leak in syslogd, a number of bugs in the ash and msh shells, and
cleans up a number of things.
<p>
Those wanting an easy way to test the 0.60.0 release with uClibc can
use <a href="http://user-mode-linux.sourceforge.net/">User-Mode Linux</a>
to give it a try by downloading and compiling
<a href="ftp://busybox.net/buildroot.tar.gz">buildroot.tar.gz</a>.
You don't have to be root or reboot your machine to run test this way.
Preconfigured User-Mode Linux kernel source is also on busybox.net.
<p>
Another cool thing is the nifty <a href="downloads/tutorial/index.html">
BusyBox Tutorial</a> contributed by K Computing. This requires
a ShockWave plugin (or standalone viewer), so you may want to grab the
the GPLed shockwave viewer from <a href="http://www.swift-tools.com/Flash/flash-0.4.10.tgz">here</a>
to view the tutorial.
<p>
Finally, In case you didn't notice anything odd about the
version number of this release, let me point out that this release
is <em>not</em> 0.53, because I bumped the version number up a
bit. This reflects the fact that this release is intended to form
a new stable BusyBox release series. If you need to rely on a
stable version of BusyBox, you should plan on using the stable
0.60.x series. If bugs show up then I will release 0.60.1, then
0.60.2, etc... This is also intended to deal with the fact that
the BusyBox build system will be getting a major overhaul for the
next release and I don't want that to break products that people
are shipping. To avoid that, the new build system will be
released as part of a new BusyBox development series that will
have some not-yet-decided-on odd version number. Once things
stabilize and the new build system is working for everyone, then
I will release that as a new stable release series.
<p>
The
<a href="downloads/Changelog">changelog</a> has all
the details. As usual BusyBox 0.60.0 can be downloaded from
<a href="downloads">http://busybox.net/downloads</a>.
<p>Have Fun!
<p>
<li> <b>7 July 2001 -- BusyBox 0.52 released</b>
<br>
I am very pleased to announce the immediate availability of
BusyBox 0.52 (the "new-and-improved rock-solid release"). This
release is the result of <em>many</em> hours of work and has tons
of bugfixes, optimizations, and cleanups. This release adds
several new applets, including several new shells (such as hush, msh,
and ash).
<p>
The
<a href="downloads/Changelog">changelog</a> covers
some of the more obvious details, but there are many many things that
are not mentioned, but have been improved in subtle ways. As usual,
BusyBox 0.52 can be downloaded from
<a href="downloads">http://busybox.net/downloads</a>.
<p>Have Fun!
<p>
<li> <b>10 April 2001 - Graph of Busybox Growth </b>
<br>
The illustrious Larry Doolittle has made a PostScript chart of the growth
of the Busybox tarball size over time. It is available for downloading /
viewing <a href= "busybox-growth.ps"> right here</a>.
<p> (Note that while the number of applets in Busybox has increased, you
can still configure Busybox to be as small as you want by selectively
turning off whichever applets you don't need.)
<p>
<li> <b>10 April 2001 -- BusyBox 0.51 released</b>
<br>
@@ -65,21 +311,21 @@
for letting me use their system!).
<p>
You can read the
<a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a> for
<a href="downloads/Changelog">changelog</a> for
complete details. BusyBox 0.51 can be downloaded from
<a href="ftp://oss.lineo.com/busybox">ftp://oss.lineo.com/busybox</a>.
<a href="downloads">http://busybox.net/downloads</a>.
<p>Have Fun!
<p>
<li> <b>Busybox Boot-Floppy Image</b>
<p>Because you asked for it, we have made available a <a href=
"ftp://oss.lineo.com/busybox/busybox.floppy.img"> Busybox boot floppy
"downloads/busybox.floppy.img"> Busybox boot floppy
image</a>. Here's how you use it:
<ol>
<li> <a href= "ftp://oss.lineo.com/busybox/busybox.floppy.img">
<li> <a href= "downloads/busybox.floppy.img">
Download the image</a>
<li> dd it onto a floppy like so: <tt> dd if=busybox.floppy.img
@@ -108,7 +354,7 @@
shell is now working very well, and the shell's environment variable
expansion was fixed. Tons of other things were fixed or made
smaller. For a fairly complete overview, see the
<a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a>.
<a href="downloads/Changelog">changelog</a>.
<p>
lash (the busybox shell) is still with us, fixed up a bit so it
now behaves itself quite nicely. It really is quite usable as
@@ -129,7 +375,7 @@
Several new applets, lots of bug fixes, cleanups, and many smaller
things made nicer. Several cleanups and improvements to the shell.
For a list of the most interesting changes
you might want to look at the <a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a>.
you might want to look at the <a href="downloads/Changelog">changelog</a>.
<p>
Special thanks go out to Matt Kraai and Larry Doolittle for all their
work on this release, and for keeping on top of things while I've been
@@ -161,7 +407,7 @@
woody) a .udeb can now be generated.
<p>
The curious can get a list of some of the more interesting changes by reading
the <a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a>.
the <a href="downloads/Changelog">changelog</a>.
<p>
Many thanks go out to the many many people that have contributed to
this release, especially Matt Kraai, Larry Doolittle, and Kent Robotti.
@@ -175,7 +421,7 @@
renice, xargs, and expr. syslogd now supports network logging.
There are the usual tar updates. Most apps now use getopt for
more correct option parsing.
See the <a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a>
See the <a href="downloads/Changelog">changelog</a>
for complete details.
@@ -187,7 +433,7 @@
people to dump a binary keymaps for use with 'loadkmap', and a
completely reworked 'grep' and 'sed' which should behave better.
BusyBox shell can now also be used as a login shell.
See the <a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a>
See the <a href="downloads/Changelog">changelog</a>
for complete details.
@@ -199,17 +445,17 @@
release provides the following new apps: cut, tr, insmod, ar,
mktemp, setkeycodes, md5sum, uuencode, uudecode, which, and
telnet. There are bug fixes for just about every app as well (see
the <a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a> for
the <a href="downloads/Changelog">changelog</a> for
details).
<p>
Also, some exciting infrastructure news! Busybox now has its own
<a href="http://oss.lineo.com/lists/busybox/">mailing list</a>,
<a href="lists/busybox/">mailing list</a>,
publically browsable
<a href="http://oss.lineo.com/cgi-bin/cvsweb/busybox/">CVS tree</a>,
<a href="/cgi-bin/cvsweb/busybox/">CVS tree</a>,
anonymous
<a href="http://oss.lineo.com/cvs_anon.html">CVS access</a>, and
<a href="cvs_anon.html">CVS access</a>, and
for those that are actively contributing there is even
<a href="http://oss.lineo.com/cvs_write.html">CVS write access</a>.
<a href="cvs_write.html">CVS write access</a>.
I think this will be a huge help to the ongoing development of BusyBox.
<p>
Also, for the curious, there is no 0.44 release. Somehow 0.44 got announced
@@ -249,8 +495,7 @@
from "A" would have been logged. This means that if init tries to log something
while say ppp has the syslog open, init would block (which is bad, bad, bad).
<p>
Karl M. Hegbloom has created a
<a href="ftp://ftp.lineo.com/pub/busybox/busybox-0.43-syslog_patch">fix for the problem</a>.
Karl M. Hegbloom has created a fix for the problem.
Thanks Karl!
@@ -263,7 +508,7 @@
freeramdisk, tr, echo, test, and usleep. Tar has been completely
rewritten from scratch. Bss size has also been greatly reduced.
More details are available in the
<a href="ftp://ftp.lineo.com/pub/busybox/Changelog">changelog</a>.
<a href="downloads/Changelog">changelog</a>.
Oh, and as a special bonus, I wrote some fairly comprehensive
<em>documentation</em>, complete with examples and full usage information.
@@ -275,7 +520,7 @@
There were others so if I somehow forgot to mention you, I'm very sorry.
<p>
You can grab BusyBox 0.43 tarballs <a href="ftp://ftp.lineo.com/pub/busybox/">here</a>.
You can grab BusyBox 0.43 tarballs <a href="downloads">here</a>.
<p> <li> <b>9 April 2000 -- BusyBox 0.43 pre release</b>
<br>
@@ -290,7 +535,7 @@
enough for production use -- it just isn't a release since I have some structural
changes I still want to make.
<p>
The pre-release can be found <a href="ftp://ftp.lineo.com/pub/busybox/">here</a>.
The pre-release can be found <a href="downloads">here</a>.
Please let me know ASAP if you find <em>any</em> bugs.
<p> <li> <b>28 March 2000 -- Andersen Baby Boy release</b>
@@ -323,7 +568,7 @@
This is the most solid BusyBox release so far. Many, many
bugs have been fixed. See the
<a href="ftp://ftp.lineo.com/pub/busybox/Changelog">changelog</a> for details.
<a href="downloads/Changelog">changelog</a> for details.
Of particular interest, init will now cleanly unmount
filesystems on reboot, cp and mv have been rewritten and
@@ -340,7 +585,7 @@
mkdir, syslogd, and init. New apps include wc, hostid,
logname, tty, whoami, and yes. New features include loop device
support in mount and umount, and better TERM handling by init.
The changelog can be found <a href="ftp://ftp.lineo.com/pub/busybox/Changelog">here</a>.
The changelog can be found <a href="downloads/Changelog">here</a>.
<p> <li> <b>7 January 2000 -- BusyBox 0.40 released</b>
<br>
@@ -350,7 +595,7 @@
New apps include sort, uniq, lsmod, rmmod, fbset, and loadacm.
In particular, this release fixes an important bug in tar which
in some cases produced serious security problems.
As always, the changelog can be found <a href="ftp://ftp.lineo.com/pub/busybox/Changelog">here</a>.
As always, the changelog can be found <a href="downloads/Changelog">here</a>.
<p> <li> <b>11 December 1999 -- BusyBox Website</b>
<br>
@@ -364,7 +609,7 @@
<br>
This release includes fixes to init, reboot, halt, kill, and ls, and contains
the new apps ping, hostname, mkfifo, free, tail, du, tee, and head. A full
changelog can be found <a href="ftp://ftp.lineo.com/pub/busybox/Changelog">here</a>.
changelog can be found <a href="downloads/Changelog">here</a>.
<p> <li> <b>5 December 1999 -- BusyBox 0.38 released</b>
<br>
This release includes fixes to tar, cat, ls, dd, rm, umount, find, df,
@@ -385,7 +630,7 @@
<ul>
<li> <a href="http://busybox.lineo.com/">Take me back to http://busybox.lineo.com/</a>.
<li> <a href="/">Take me back to http://busybox.net/</a>.
<p>
<li> <A HREF="http://perens.com/FreeSoftware/">
@@ -398,12 +643,6 @@
Freshmeat AppIndex record for BusyBox</A>
<p>
<li> <a href="http://oss.lineo.com/software.html">Cool embedded software</a>.
<p>
<li> <a href="http://oss.lineo.com/">oss.lineo.com</a>.
<p>
</ul>
@@ -423,7 +662,7 @@
<font size="-1" face="arial, helvetica, sans-serif">
Mail all comments, insults, suggestions and bribes to
<a href="mailto:andersen@codepoet.org">Erik Andersen</a><BR>
The Busybox logo is copyright 1999,2000,2001 Erik Andersen.
The Busybox logo is copyright 1999-2002, Erik Andersen.
</font>
</TD>
+3
View File
@@ -0,0 +1,3 @@
# go away
User-agent: *
Disallow: /cgi-bin
+9 -8
View File
@@ -22,7 +22,7 @@ font-family: monospace; font-size: smaller;" width="80%">
$ ./busybox
BusyBox v0.49 (2001.01.30-17:35+0000) multi-call binary -- GPL2
BusyBox v0.60.3 (2002.04.27-10:33+0000) multi-call binary
Usage: busybox [function] [arguments]...
or: [function] [arguments]...
@@ -33,13 +33,14 @@ Usage: busybox [function] [arguments]...
will act like whatever it was invoked as.
Currently defined functions:
basename, busybox, cat, chgrp, chmod, chown, chroot, chvt, clear,
cp, cut, date, dd, df, dirname, dmesg, du, echo, false, find,
free, grep, gunzip, gzip, halt, head, id, init, kill, killall,
ln, logger, ls, lsmod, mkdir, mknod, mkswap, more, mount, mv,
poweroff, ps, pwd, reboot, reset, rm, rmdir, sed, sh, sleep, sort,
swapoff, swapon, sync, syslogd, tail, tar, touch, true, tty, umount,
uname, uniq, uptime, wc, which, whoami, xargs, yes, zcat
[, basename, busybox, cat, chgrp, chmod, chown, chroot, chvt,
clear, cp, cut, date, dd, df, dirname, dmesg, du, echo, env, false,
find, free, grep, gunzip, gzip, halt, head, id, init, kill, killall,
klogd, linuxrc, ln, logger, ls, lsmod, mkdir, mknod, mkswap, modprobe,
more, mount, msh, mv, pidof, poweroff, ps, pwd, reboot, reset,
rm, rmdir, sed, sh, sleep, sort, swapoff, swapon, sync, syslogd,
tail, tar, test, touch, true, tty, umount, uname, uniq, uptime,
wc, which, whoami, xargs, yes, zcat
$ <blink>_</blink>
+22 -13
View File
@@ -136,19 +136,23 @@
</para>
<para>
ar, basename, cat, chgrp, chmod, chown, chroot, chvt, clear,
cp, cut, date, dc, dd, deallocvt, df, dirname, dmesg, dpkg-deb,
du, dumpkmap, dutmp, echo, false, fbset, fdflush, find, free,
freeramdisk, fsck.minix, grep, gunzip, gzip, halt, head,
hostid, hostname, id, init, insmod, kill, killall, length, ln,
loadacm, loadfont, loadkmap, logger, logname, ls, lsmod,
makedevs, mkdir, mkfifo, mkfs.minix, mknod, mkswap, mktemp,
more, mount, mt, mv, nc, nslookup, ping, poweroff, printf, ps,
pwd, reboot, renice, reset, rm, rmdir, rmmod, run-parts, sed, setkeycodes, sh, sleep,
sort, swapoff, swapon, sync, syslogd, tail, tar, tee, telnet,
test, touch, tr, true, tty, umount, uname, uniq, update,
uptime, usleep, uudecode, uuencode, wc, which, whoami, yes,
zcat, [
addgroup, adduser, adjtimex, ar, basename, busybox, cat,
chgrp, chmod, chown, chroot, chvt, clear, cmp, cp, cpio, cut,
date, dc, dd, deallocvt, deluser, df, dirname, dmesg,
dos2unix, dpkg, dpkg-deb, du, dumpkmap, dutmp, echo, expr,
false, fbset, fdflush, find, free, freeramdisk, fsck.minix,
getopt, getty, grep, gunzip, gzip, halt, head, hostid,
hostname, id, ifconfig, init, insmod, kill, killall, klogd,
length, ln, loadacm, loadfont, loadkmap, logger, logname, ls,
lsmod, makedevs, md5sum, mkdir, mkfifo, mkfs.minix, mknod,
mkswap, mktemp, more, mount, mt, mv, nc, nslookup, ping,
pivot_root, poweroff, printf, ps, pwd, rdate, readlink,
reboot, renice, reset, rm, rmdir, rmmod, route, rpm2cpio,
sed, setkeycodes, sh, sleep, sort, stty, swapoff, swapon,
sync, syslogd, tail, tar, tee, telnet, test, tftp, touch, tr,
true, tty, umount, uname, uniq, unix2dos, update, uptime,
usleep, uudecode, uuencode, watchdog, wc, wget, which,
whoami, xargs, yes, zcat, [
</para>
</sect1>
@@ -3099,6 +3103,7 @@
-O FILE Use an alternate log file (default=/var/log/messages)
-R HOST[:PORT] Log remotely to IP or hostname on PORT (default PORT=514/UDP)
-L Log locally as well as network logging (default is network only)
-C Log to a circular buffer. Read this buffer using 'logread'
</screen>
</para>
@@ -3996,6 +4001,10 @@
Enrique Zanardi &lt;ezanardi@ull.es&gt;
</para>
<para>
Vladimir Oleynik &lt;dzo@simtreas.ru&gt;
</para>
</chapter>
</book> <!-- End of the book -->
+2 -2
View File
@@ -113,7 +113,7 @@ Glenn McGrath <bug1@netconnect.com.au>
Vladimir Oleynik <dzo@simtreas.ru>
cmdedit, stty-port, locale, various fixes
cmdedit; ports: ash, stty, traceroute; locale, various fixes
and irreconcilable critic of everything not perfect.
=for html <br>
@@ -166,4 +166,4 @@ Enrique Zanardi <ezanardi@ull.es>
=cut
# $Id: busybox_footer.pod,v 1.4 2001/04/17 17:09:34 beppu Exp $
# $Id: busybox_footer.pod,v 1.5 2001/12/18 14:06:01 andersen Exp $
+14 -13
View File
@@ -55,19 +55,20 @@ terse runtime description of their behavior.
Currently defined functions include:
adjtimex, ar, basename, busybox, cat, chgrp, chmod, chown, chroot, chvt, clear,
cmp, cp, cpio, cut, date, dc, dd, deallocvt, df, dirname, dmesg, dos2unix, dpkg,
dpkg-deb, du, dumpkmap, dutmp, echo, expr, false, fbset, fdflush, find, free,
freeramdisk, fsck.minix, getopt, grep, gunzip, gzip, halt, head, hostid,
hostname, id, ifconfig, init, insmod, kill, killall, klogd, length, ln,
loadacm, loadfont, loadkmap, logger, logname, ls, lsmod, makedevs, md5sum,
mkdir, mkfifo, mkfs.minix, mknod, mkswap, mktemp, more, mount, mt, mv, nc,
nslookup, ping, pivot_root, poweroff, printf, ps, pwd, rdate, readlink, reboot,
renice, reset, rm, rmdir, rmmod, route, rpm2cpio, sed, setkeycodes,
sh, sleep, sort, stty, swapoff, swapon, sync, syslogd, tail, tar, tee, telnet,
test, tftp, touch, tr, true, tty, umount, uname, uniq, unix2dos, update, uptime,
usleep, uudecode, uuencode, watchdog, wc, wget, which, whoami, xargs, yes, zcat,
[
addgroup, adduser, adjtimex, ar, basename, busybox, cat, chgrp, chmod,
chown, chroot, chvt, clear, cmp, cp, cpio, cut, date, dc, dd, deallocvt,
deluser, df, dirname, dmesg, dos2unix, dpkg, dpkg-deb, du, dumpkmap, dutmp,
echo, expr, false, fbset, fdflush, find, free, freeramdisk, fsck.minix,
getopt, getty, grep, gunzip, gzip, halt, head, hostid, hostname, id,
ifconfig, init, insmod, kill, killall, klogd, length, ln, loadacm,
loadfont, loadkmap, logger, logname, ls, lsmod, makedevs, md5sum, mkdir,
mkfifo, mkfs.minix, mknod, mkswap, mktemp, more, mount, mt, mv, nc,
nslookup, ping, pivot_root, poweroff, printf, ps, pwd, rdate, readlink,
reboot, renice, reset, rm, rmdir, rmmod, route, rpm2cpio, sed, setkeycodes,
sh, sleep, sort, stty, swapoff, swapon, sync, syslogd, tail, tar, tee,
telnet, test, tftp, touch, tr, true, tty, umount, uname, uniq, unix2dos,
update, uptime, usleep, uudecode, uuencode, watchdog, wc, wget, which,
whoami, xargs, yes, zcat, [
=over 4
+5 -5
View File
@@ -5,7 +5,7 @@ This document describes what you need to do to contribute to Busybox, where
you can help, guidelines on testing, and how to submit a well-formed patch
that is more likely to be accepted.
The Busybox home page is at: http://busybox.lineo.com
The Busybox home page is at: http://busybox.net/
@@ -28,8 +28,8 @@ Don't make your work obsolete before you start!
For information on how to check out Busybox from CVS, please look at the
following links:
http://oss.lineo.com/cvs_anon.html
http://oss.lineo.com/cvs_howto.html
http://busybox.net/cvs_anon.html
http://busybox.net/cvs_howto.html
Read the Mailing List
@@ -43,7 +43,7 @@ know.
Archives can be found here:
http://opensource.lineo.com/lists/busybox/
http://busybox.net/lists/busybox/
If you have a serious interest in Busybox, i.e., you are using it day-to-day or
as part of an embedded project, it would be a good idea to join the mailing
@@ -51,7 +51,7 @@ list.
A web-based sign-up form can be found here:
http://opensource.lineo.com/mailman/listinfo/busybox
http://busybox.net/mailman/listinfo/busybox
Coordinate with the Applet Maintainer
+23 -7
View File
@@ -6,7 +6,7 @@ This document details the steps you must take to add a new applet to BusyBox.
Credits:
Matt Kraai - initial writeup
Mark Whitley - the remix
Thomas Lundquist - Added stuff for the new directory layout.
Initial Write
-------------
@@ -81,11 +81,25 @@ program that could be useful in another program, consider putting them in
libbb.
Placement / Directory
---------------------
Find the appropriate directory for your new applet.
Add the applet to the applet directory Makefile:
obj-$(CONFIG_MU) += mu.o
Add the applet to the applet directory config.in:
bool 'mu' CONFIG_MU
Usage String(s)
---------------
Next, add usage information for you applet to usage.h. This should look like
the following:
Next, add usage information for you applet to include/usage.h.
This should look like the following:
#define mu_trivial_usage \
"-[abcde] FILES"
@@ -104,9 +118,9 @@ currently exist in usage.h.)
Header Files
------------
Next, add an entry to applets.h. Be *sure* to keep the list in alphabetical
order, or else it will break the binary-search lookup algorithm in busybox.c
and the Gods of BusyBox smite you. Yea, verily:
Next, add an entry to include/applets.h. Be *sure* to keep the list
in alphabetical order, or else it will break the binary-search lookup
algorithm in busybox.c and the Gods of BusyBox smite you. Yea, verily:
/* all programs above here are alphabetically "less than" 'mu' */
#ifdef CONFIG_MU
@@ -126,13 +140,15 @@ Documentation
If you're feeling especially nice, you should also document your applet in the
docs directory (but nobody ever does that).
Adding some text to docs/Configure.help is a nice start.
The Grand Announcement
----------------------
Then create a diff -urN of the files you added (<applet>.c, usage.c,
applets.h, Config.h) and send it to the mailing list:
busybox@opensource.lineo.com. Sending patches as attachments is preferred, but
busybox@busybox.net. Sending patches as attachments is preferred, but
not required.
+9 -15
View File
@@ -1,6 +1,6 @@
# Makefile for busybox
#
# Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
# Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,20 +17,14 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
TOPDIR :=..
L_TARGET := editors.a
obj-y :=
obj-n :=
obj- :=
obj-$(CONFIG_SED) += sed.o
obj-$(CONFIG_VI) += vi.o
# Hand off to toplevel Rules.mak
include $(TOPDIR)/Rules.mak
TOPDIR:= ../
EDITOR_DIR:=./
include $(TOPDIR).config
include $(TOPDIR)Rules.mak
include Makefile.in
all: $(libraries-y)
-include $(TOPDIR).depend
clean:
rm -f $(L_TARGET) *.o core
rm -f *.o *.a $(AR_TARGET)
+35
View File
@@ -0,0 +1,35 @@
# Makefile for busybox
#
# Copyright (C) 1999-2002 by Erik Andersen <andersee@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
EDITOR_AR:=editors.a
ifndef $(EDITOR_DIR)
EDITOR_DIR:=$(TOPDIR)editors/
endif
EDITOR-y:=
EDITOR-$(CONFIG_SED) += sed.o
EDITOR-$(CONFIG_VI) += vi.o
EDITOR_SRC:= $(EDITOR-y)
EDITOR_OBJ:= $(patsubst %.c,$(EDITOR_DIR)%.o, $(EDITOR_SRC))
libraries-y+=$(EDITOR_DIR)$(EDITOR_AR)
$(EDITOR_DIR)$(EDITOR_AR): $(patsubst %,$(EDITOR_DIR)%, $(EDITOR-y))
$(AR) -ro $@ $(patsubst %,$(EDITOR_DIR)%, $(EDITOR-y))
+60 -49
View File
@@ -3,6 +3,7 @@
*
* Copyright (C) 1999,2000,2001 by Lineo, inc. and Mark Whitley
* Copyright (C) 1999,2000,2001 by Mark Whitley <markw@codepoet.org>
* Copyright (C) 2002 Matt Kraai
*
* 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
@@ -95,6 +96,9 @@ struct sed_cmd {
/* the command */
char cmd; /* p,d,s (add more at your leisure :-) */
/* inversion flag */
int invert; /* the '!' after the address */
};
/* globals */
@@ -106,7 +110,7 @@ static int ncmds = 0; /* number of sed commands */
const char * const semicolon_whitespace = "; \n\r\t\v\0";
#ifdef CONFIG_FEATURE_CLEAN_UP
static void destroy_cmd_strs()
static void destroy_cmd_strs(void)
{
if (sed_cmds == NULL)
return;
@@ -174,7 +178,7 @@ static int index_of_next_unescaped_regexp_delim(const struct sed_cmd * const sed
static int get_address(struct sed_cmd *sed_cmd, const char *str, int *linenum, regex_t **regex)
{
char *my_str = xstrdup(str);
int idx = 0;
int idx = 0, idx_start = 1;
char olddelimiter;
olddelimiter = sed_cmd->delimiter;
sed_cmd->delimiter = '/';
@@ -190,13 +194,17 @@ static int get_address(struct sed_cmd *sed_cmd, const char *str, int *linenum, r
*linenum = -1;
idx++;
}
else if (my_str[idx] == '/') {
else if (my_str[idx] == '/' || my_str[idx] == '\\') {
if (my_str[idx] == '\\') {
idx_start++;
sed_cmd-> delimiter = my_str[++idx];
}
idx = index_of_next_unescaped_regexp_delim(sed_cmd, my_str, ++idx);
if (idx == -1)
error_msg_and_die("unterminated match expression");
my_str[idx] = '\0';
*regex = (regex_t *)xmalloc(sizeof(regex_t));
xregcomp(*regex, my_str+1, REG_NEWLINE);
xregcomp(*regex, my_str+idx_start, REG_NEWLINE);
idx++; /* so it points to the next character after the last '/' */
}
else {
@@ -296,9 +304,7 @@ static void move_back(char *str, int offset)
static int parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr)
{
int idx = 0;
int slashes_eaten = 0;
char *ptr; /* shorthand */
int i, j;
/*
* the string that gets passed to this function should look like this:
@@ -322,48 +328,28 @@ static int parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr)
*
*/
if (editstr[1] != '\\' && (editstr[2] != '\n' || editstr[2] != '\r'))
if (editstr[1] != '\\' || (editstr[2] != '\n' && editstr[2] != '\r'))
error_msg_and_die("bad format in edit expression");
/* store the edit line text */
/* make editline big enough to accomodate the extra '\n' we will tack on
* to the end */
sed_cmd->editline = xmalloc(strlen(&editstr[3]) + 2);
strcpy(sed_cmd->editline, &editstr[3]);
ptr = sed_cmd->editline;
/* now we need to go through * and: s/\\[\r\n]$/\n/g on the edit line */
while (ptr[idx]) {
while (ptr[idx] != '\\' || (ptr[idx+1] != '\n' && ptr[idx+1] != '\r')) {
idx++;
if (!ptr[idx]) {
goto out;
}
}
/* move the newline over the '\' before it (effectively eats the '\') */
move_back(&ptr[idx], 1);
slashes_eaten++;
/* substitue \r for \n if needed */
if (ptr[idx] == '\r')
ptr[idx] = '\n';
for (i = 3, j = 0; editstr[i] != '\0' && strchr("\r\n", editstr[i]) == NULL;
i++, j++) {
if (editstr[i] == '\\' && strchr("\n\r", editstr[i+1]) != NULL) {
sed_cmd->editline[j] = '\n';
i++;
} else
sed_cmd->editline[j] = editstr[i];
}
out:
/* figure out if we need to add a newline */
if (ptr[idx-1] != '\n') {
ptr[idx] = '\n';
idx++;
}
if (sed_cmd->editline[j-1] != '\n')
sed_cmd->editline[j++] = '\n';
/* terminate string */
ptr[idx]= 0;
sed_cmd->editline[j] = '\0';
/* this accounts for discrepancies between the modified string and the
* original string passed in to this function */
/* adjust for opening 2 chars [aic]\ */
return idx + slashes_eaten + 2;
return i;
}
@@ -415,12 +401,29 @@ static char *parse_cmd_str(struct sed_cmd * const sed_cmd, const char *const cmd
*/
/* first part (if present) is an address: either a number or a /regex/ */
if (isdigit(cmdstr[idx]) || cmdstr[idx] == '/')
if (isdigit(cmdstr[idx]) || cmdstr[idx] == '/' || ( cmdstr[idx] == '\\' && cmdstr[idx+1] != '\\'))
idx = get_address(sed_cmd, cmdstr, &sed_cmd->beg_line, &sed_cmd->beg_match);
/* second part (if present) will begin with a comma */
if (cmdstr[idx] == ',')
idx += get_address(sed_cmd, &cmdstr[++idx], &sed_cmd->end_line, &sed_cmd->end_match);
if (cmdstr[idx] == ',') {
idx++;
idx += get_address(sed_cmd, &cmdstr[idx], &sed_cmd->end_line, &sed_cmd->end_match);
}
/* skip whitespace before the command */
while (isspace(cmdstr[idx]))
idx++;
/* there my be the inversion flag between part2 and part3 */
sed_cmd->invert = 0;
if (cmdstr[idx] == '!') {
sed_cmd->invert = 1;
idx++;
/* skip whitespace before the command */
while (isspace(cmdstr[idx]))
idx++;
}
/* last part (mandatory) will be a command */
if (cmdstr[idx] == '\0')
@@ -659,12 +662,12 @@ static void process_file(FILE *file)
/* for every line, go through all the commands */
for (i = 0; i < ncmds; i++) {
struct sed_cmd *sed_cmd = &sed_cmds[i];
int deleted = 0;
/*
* entry point into sedding...
*/
if (
int matched = (
/* no range necessary */
(sed_cmd->beg_line == 0 && sed_cmd->end_line == 0 &&
sed_cmd->beg_match == NULL &&
@@ -675,7 +678,9 @@ static void process_file(FILE *file)
(sed_cmd->beg_match && (regexec(sed_cmd->beg_match, line, 0, NULL, 0) == 0)) ||
/* we are currently within the beginning & ending address range */
still_in_range
) {
);
if (sed_cmd->invert ^ matched) {
/*
* actual sedding
@@ -688,6 +693,7 @@ static void process_file(FILE *file)
case 'd':
altered++;
deleted = 1;
break;
case 's':
@@ -761,13 +767,15 @@ static void process_file(FILE *file)
/* else if we couldn't open the output file,
* no biggie, just don't print anything */
altered++;
}
}
break;
}
}
/*
* exit point from sedding...
*/
/*
* exit point from sedding...
*/
if (matched) {
if (
/* this is a single-address command or... */
(sed_cmd->end_line == 0 && sed_cmd->end_match == NULL) || (
@@ -790,6 +798,9 @@ static void process_file(FILE *file)
still_in_range = 1;
}
}
if (deleted)
break;
}
/* we will print the line unless we were told to be quiet or if the
+897 -895
View File
File diff suppressed because it is too large. Load diff
+1 -6
View File
@@ -6,7 +6,7 @@ components:
- Linux Kernel (http://www.kernel.org)
- uClibc: C library (http://cvs.uclinux.org/uClibc.html)
- Busybox: Unix utilities (http://busybox.lineo.com)
- Busybox: Unix utilities (http://busybox.net/)
- Syslinux: bootloader (http://syslinux.zytor.com)
It is based heavily on a paper presented by Erik Andersen at the 2001 Embedded
@@ -84,11 +84,6 @@ The following steps will create a root file system.
For this, just cp -a the etc/ directory onto rootfs. Again, if you want
all the details, you can just look at the files in the dir.
- Run ldconfig so busybox and other binaries can have access to the libraries
that they need:
(path to)uClibc/ld.so-1/util/ldconfig -r loop/
- Unmount the rootfs from the mountpoint:
umount loop
+2 -2
View File
@@ -12,8 +12,8 @@ Serial: %{serial}
Copyright: GPL
Group: System/Utilities
Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary.
URL: http://busybox.lineo.com/
Source: ftp://oss.lineo.com/busybox/%{name}-%{version}.tar.gz
URL: http://busybox.net/
Source: ftp://busybox.net/busybox/%{name}-%{version}.tar.gz
Buildroot: /var/tmp/%{name}-%{version}
Packager : Erik Andersen <andersen@codepoet.org>
+6 -1
View File
@@ -24,7 +24,7 @@
# <runlevels>: The runlevels field is completely ignored.
#
# <action>: Valid actions include: sysinit, respawn, askfirst, wait, once,
# ctrlaltdel, and shutdown.
# restart, ctrlaltdel, and shutdown.
#
# Note: askfirst acts just like respawn, but before running the specified
# process it displays the line "Please press Enter to activate this
@@ -43,6 +43,8 @@
# ::ctrlaltdel:/sbin/reboot
# ::shutdown:/sbin/swapoff -a
# ::shutdown:/bin/umount -a -r
# ::restart:/sbin/init
#
# if it detects that /dev/console is _not_ a serial console, it will
# also run:
# tty2::askfirst:/bin/sh
@@ -79,6 +81,9 @@ tty5::respawn:/sbin/getty 38400 tty6
# Example how to put a getty on a modem line.
#::respawn:/sbin/getty 57600 ttyS2
# Stuff to do when restarting the init process
::restart:/sbin/init
# Stuff to do before rebooting
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
+30
View File
@@ -0,0 +1,30 @@
#!/bin/sh
# Sample udhcpc renew script
RESOLV_CONF="/etc/resolv.conf"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
if [ -n "$router" ]
then
echo "deleting routers"
while /sbin/route del default gw 0.0.0.0 dev $interface
do :
done
for i in $router
do
/sbin/route add default gw $i dev $interface
done
fi
echo -n > $RESOLV_CONF
[ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
for i in $dns
do
echo adding dns $i
echo nameserver $i >> $RESOLV_CONF
done
Loaded 100 of 303 files, more files were not shown because too many files have changed in this diff. Show more