Compare commits

...
626 Commits
Author SHA1 Message Date
Rob Landley f86a5ba510 Remove unnecessary consts. 2006-07-19 21:45:30 +00:00
Rob Landley 53702e53ba Replace the previous checkin with the correct fix. 2006-07-19 21:43:53 +00:00
Rob Landley 3b0cfb40a5 Patch from Yann Morin to look for modules.conf in the right place on 2.6.
Fixes http://bugs.busybox.net/view.php?id=942
2006-07-19 21:33:42 +00:00
"Robert P. J. Day" 3e4da920bd For now, get around the error that "child" might be uninitialized. 2006-07-18 12:05:43 +00:00
"Robert P. J. Day" fc2aea1a76 Rearrange order of type qualifiers. 2006-07-18 11:33:44 +00:00
Rob Landley f0623a2c98 Patch from Thaddeus Ternes, adding chuid to start-stop-daemon. 2006-07-17 00:35:07 +00:00
Rob Landley 62103757ef Bugfix from Tito to make sure /etc/group gets updated. 2006-07-16 18:58:18 +00:00
Rob Landley d893b120ba New mkswap. Small and simple. Might even work. :) 2006-07-16 08:17:03 +00:00
Rob Landley 534374755d Cleaup read() and write() variants, plus a couple of new functions like
xlseek and fdlength() for the new mkswap.
2006-07-16 08:14:35 +00:00
Rob Landley afb94ecf2b Convert setuid/setgid users to xsetuid/xsetgid. 2006-07-16 08:06:34 +00:00
Rob Landley 25c194fd19 Add -Werror. 2006-07-16 08:03:29 +00:00
Rob Landley df822f2606 We need xsetuid() and xsetgid() because per-user process resource limits can
prevent a process from switching to a user that has too many processes, and
when that happens WE'RE STILL ROOT.  See http://lwn.net/Articles/190331/
2006-07-15 23:00:46 +00:00
Rob Landley 1870737480 Comment tweak from tito. 2006-07-15 19:46:46 +00:00
Mike Frysinger 83169c607b Tito writes: If the gecos field of an user is empty, obscure reports a false "similar to gecos" error. 2006-07-15 03:59:00 +00:00
Rob Landley 91ed1a4a41 Patch from Suresh Rajashekara moving comments and #includes and such around. 2006-07-14 17:59:36 +00:00
Eric Andersen a4622324dd mention osuosl 2006-07-13 00:52:29 +00:00
Rob Landley 3a9cceb092 Add the two busybox developers' home pages that have busybox related stuff
on them.
2006-07-13 00:10:33 +00:00
Rob Landley 1f9145c5c3 More minor tweaks. 2006-07-12 21:31:16 +00:00
Mike Frysinger 58dda84ecc decuddle () from for/if/while 2006-07-12 20:04:00 +00:00
Rob Landley c9c1a41c58 A couple things that got tangled up in my tree, easier to check in both than
untangle them:

Rewrite u_signal_names() into get_signum() and get_signame(), plus trim the
signal list to that required by posix (they can specify the numbers for
the rest if they really need them).  (This is preparatory cleanup for adding
a timeout applet like Roberto Foglietta wants.)

Export the itoa (added due to Denis Vlasenko, although it's not quite his
preferred implementation) from xfuncs.c so it's actually used, and remove
several other redundant implementations of itoa and utoa() in the tree.
2006-07-12 19:17:55 +00:00
"Robert P. J. Day" 801ab14013 Add one-line GPL boilerplate to numerous (but not all yet) source files. 2006-07-12 07:56:04 +00:00
Rob Landley ab7d9be17c Patch from Tito to remove pwd_to_spwd (which we don't actually need), with
some #ifdef removal from me.
2006-07-11 16:19:17 +00:00
"Robert P. J. Day" 2819f757ca Add one-line GPL boilerplate to these source files. 2006-07-11 11:32:31 +00:00
Rob Landley 22d3958d76 Denis Vlasenko spotted the lack of bounds checking in my first attempt at
itoa/utoa.
2006-07-11 00:44:36 +00:00
Rob Landley 1cca9484db Upgrade netcat a lot. Make -e able to take the rest of the command line as
what to exec.  Add -f mode and a brief explanation of how to use it to replace
minicom.  Add -l -l mode so you can turn any command into a server.  And group
all of netcat's command line options under two CONFIG entries, so if you
disable both it doesn't use getopt at all.
2006-07-10 19:45:20 +00:00
"Robert P. J. Day" 5d8843e451 Replace current verbose GPL stuff in libbb/*.c with one-line GPL boilerplate. 2006-07-10 11:41:19 +00:00
Rob Landley 5b88a38157 Add itoa and utoa to see what Denis Vlasenko thinks. 2006-07-10 07:41:34 +00:00
Rob Landley 3bfcf3cccc Patch from Tito to make syslog configurable and remove #ifdefs. Further
cleanups by me.
2006-07-10 03:05:46 +00:00
Rob Landley cba1b96735 Patch from Shaun Jackman to set environment variable RUNLEVEL equal to
init's argv[1], so if you append "single" to your kernel command line and
the kernel doesn't parse it, RUNLELEL=single.

Plus a few unrelated header cleanups while I was in the area...
2006-07-09 17:28:17 +00:00
Rob Landley acf448d4f6 Bugfix from Shaun Jackman (check that argv[optind] isn't null before
dereferencing it) plus a bunch of tweaks from me.
2006-07-09 17:03:07 +00:00
Rob Landley 1df45cf8e7 Point at fixes.patch for 1.2.1. 2006-07-08 18:11:00 +00:00
Rob Landley ff6e21c2ce Fix tar so it can extract git-generated tarballs, based on a suggestion
from Erik Frederiksen.
2006-07-06 20:30:19 +00:00
Rob Landley 9ebd1bd468 Attempt to address Shaun Jackman's problem adding "busybox: busybox.bflt" to
.config.mak.
2006-07-06 20:02:47 +00:00
Paul Fox e3324502a5 fix dependencies so that compressed usage gets rebuilt if
a) include/usage.h is changed, and 
    b) after "make clean".
2006-07-06 20:00:43 +00:00
Rob Landley 4ae905a31c Minor build tweaks that save 1100 bytes building busybox on Ubuntu 6.06. 2006-07-06 17:22:54 +00:00
Rob Landley aa516a61b9 Fix three embarassing thinkos in the new dmesg.c:
1) the c argument shouldn't have had a : after that, dunno how that got there.
2) the xgetlarg for level was using size
3) because xgetlarg's error message _SUCKS_ (it does a show_usage() rather than giving any specific info about the range that was violated) I dropped the range down to 2 bytes.  (Which works fine, I dunno why we were nit-picking about that...)
2006-07-06 16:41:56 +00:00
Rob Landley f296f0b77d Bug fix from Vladimir Oleynic via Paul Fox for:
echo "+bond0" > /sys/class/net/bonding_masters
while true; do
  echo hello
done
2006-07-06 01:09:21 +00:00
Mike Frysinger 434ccd9739 fixes from ldoolitt@recycle.lbl.gov to use proper tab escaping and fix a typo 2006-07-05 22:19:21 +00:00
"Robert P. J. Day" cf5b80ba32 This file doesn't appear to be used anywhere. 2006-07-05 12:47:26 +00:00
Bernhard Reutner-Fischer 273430aa8d - Pull r15593:
Rename to CROSS_COMPILE and move its configuration to .config.mak. (Shaun Jackman)
2006-07-04 08:26:55 +00:00
"Robert P. J. Day" c773ac8a79 Delete unused version.c file and corresponding function prototypes
from blkid.h.  If this file needs to be resurrected, it can be
based on ext2fs/version.c.
2006-07-03 18:11:39 +00:00
Mike Frysinger 259472e741 remove duplicate CONFIG_TASKSET option 2006-07-03 05:22:36 +00:00
Mike Frysinger 441bfbf143 make the -0 xargs option a little more clear 2006-07-03 05:19:44 +00:00
"Robert P. J. Day" 4eddb42bbc Remove the silly redundancy from that header file include. 2006-07-03 00:46:47 +00:00
"Robert P. J. Day" c9f423a93d Correct the comment to match the code. 2006-07-02 19:52:52 +00:00
"Robert P. J. Day" 63fc1a9e08 Standardize on the vi editing directives being on the first line. 2006-07-02 19:47:05 +00:00
"Robert P. J. Day" 087b9d640e Allow a user-configurable minimum password length. 2006-07-02 18:35:39 +00:00
Bernhard Reutner-Fischer e02706fe45 - note that get_hz potentially needs cleanup. 2006-07-02 10:33:10 +00:00
Rob Landley 7a8e491dff Patch from Shaun Jackman moving the var=value logic to here it can do some good. 2006-07-01 17:19:02 +00:00
"Robert P. J. Day" 7ccb65f3a4 Yet more "#if 0" content removed. 2006-07-01 15:09:17 +00:00
"Robert P. J. Day" d35ef0f666 More removal of "#if 0" content. 2006-07-01 14:59:54 +00:00
"Robert P. J. Day" edd9ca5743 More removal of "#if 0" content. 2006-07-01 14:52:12 +00:00
"Robert P. J. Day" 53f21e34a7 Remove "#if 0" content. 2006-07-01 14:34:33 +00:00
"Robert P. J. Day" 177c9f3128 Get rid of all "#if 0" content. 2006-07-01 14:30:28 +00:00
"Robert P. J. Day" 68229837ff Remove all usage of the "register" storage class specifier. 2006-07-01 13:08:46 +00:00
"Robert P. J. Day" f350160963 Remove "#if 1" directives. 2006-07-01 12:19:39 +00:00
Rob Landley 01772aea33 Annoint 1.2.0. 2006-06-30 22:40:13 +00:00
Rob Landley 12d9419273 Revert taskset for 1.2.0. It emits a warning, breaks building under RH9,
and nobody seemed interested in fixing it despite repeated complaints.
I'll worry about it in the 1.3 timeframe...
2006-06-30 22:20:43 +00:00
Ned Ludd 5df6d9f777 - Give Rob Landley things TODO like depmod 2006-06-30 21:48:38 +00:00
Rob Landley a526c30cc5 Make another warning go away. 2006-06-30 20:30:10 +00:00
Rob Landley ab58d5cf8a Make warnings go away. 2006-06-30 19:04:09 +00:00
Rob Landley 9c0e4f03d9 More random todo items... 2006-06-30 16:38:09 +00:00
Rob Landley 8bbdb8732f This kind of paranoia is a debug option at best. 2006-06-30 16:36:56 +00:00
Rob Landley cd545287c5 Fix bug 744 by moving the flushing logic into the exhausted read buffer test.
(Also some other minor cleanups while I was there, shouldn't affect the
resulting binary.)
2006-06-30 16:35:40 +00:00
Rob Landley 00c051e42d Bug http://bugs.busybox.net/view.php?id=723 - initialize tv1 the first time
through the loop.
2006-06-30 14:05:19 +00:00
Mike Frysinger c340ea191a fix from Kolbjørn Barmen for building for m68k targets 2006-06-30 02:53:56 +00:00
Rob Landley 7077ea30f5 Some old kernel headers don't #include BLKSSZGET in sys/mount.h. 2006-06-29 19:00:12 +00:00
Rob Landley c5e4ab7fe6 Minor update on init not working. 2006-06-29 04:59:11 +00:00
Rob Landley a6e6037219 Fix bug http://bugs.busybox.net/view.php?id=874 where hexdump -C got its
spacing wrong.
2006-06-28 14:36:50 +00:00
Rob Landley db1ab1aeb3 Top was catching sigterm (and fumbling sigint) so it could reset the terminal
type on the way out, but the signal handler didn't exit.  Plus it did
unnecessary things with sigaction.  This code is overgrown and needs a serious
weed-whacking...
2006-06-28 14:11:25 +00:00
Rob Landley ea7c18514b Fix http://bugs.busybox.net/view.php?id=826 in which "(echo; echo) | sed x"
crashes because the empty state of the hold space is NULL but the empty
state of the pattern space is "".
2006-06-28 13:50:59 +00:00
Mike Frysinger cc826d74e4 cleanup patch usage 2006-06-28 00:22:32 +00:00
Rob Landley 1979d3ccbc More website cleanup. 2006-06-27 22:33:22 +00:00
Rob Landley d879ffb79e Move 2005 and earlier to oldnews. 2006-06-27 21:29:56 +00:00
Rob Landley ed9aec908b Redo the license section completely, and update the header to group the tabs. 2006-06-27 20:47:08 +00:00
Rob Landley cddba6c61f Move documentation links into the index so they're more visible. 2006-06-27 18:59:57 +00:00
Rob Landley af12cb39d1 Patch from Geoff Baker to fix bug http://bugs.busybox.net/view.php?id=905 by
changing wget's ftp code not to chdir but to use the complete path each time.
2006-06-27 18:41:03 +00:00
Rob Landley 22f383e695 Fix http://bugs.busybox.net/view.php?id=906 which could cause failures in top. 2006-06-27 18:14:12 +00:00
"Robert P. J. Day" 21302c2b78 Properly print the output for a sit (IPv6-in-IPv4) interface. 2006-06-26 22:03:43 +00:00
"Robert P. J. Day" 4137dd783b Aesthetic fix to use newer structure initialization format. 2006-06-26 21:54:57 +00:00
Mike Frysinger cd68a2e1a8 fix watchdog on no-mmu systems by adding -F option for rexec 2006-06-26 21:31:17 +00:00
Mike Frysinger 42705abc28 dont setpgrp() for now as it breaks system() and that is more important than ctrl+c handling of background processes 2006-06-26 20:42:36 +00:00
Rob Landley ef10d52745 Upgrade mdev to allow commands to be run on create/delete.
Both Jason Schoon and Giuseppe Ciotta deserve credit for this, I used elements
of both.  It's been upgraded so that you can specify that a given command
should run at create, at delete, or at both using different special characters
(@, $, and * respectively).  It uses the system() method of running command
lines which means you can use environment variables on the command line (it
sets $MDEV to the name of the current device being created/deleted, which is
useful if you matched it via regex), and the documentation warns that you need
a /bin/sh to make that work, so you probably want to pick a default shell.
2006-06-26 14:11:33 +00:00
Rob Landley cf7577d417 Missed one. Based on suggestions from Erik Hovland. 2006-06-25 22:59:31 +00:00
Rob Landley 11c7a7bed6 Various cleanups I made while going through Erik Hovland's patch submissions,
some of which are even from him. :)
2006-06-25 22:39:24 +00:00
Bernhard Reutner-Fischer f087798e8b - convert old-style parameter declarations (K&R) to modern style. 2006-06-25 22:08:53 +00:00
Rob Landley a892bf8284 Whitespace. (Vim's auto-indent is kind of annoying at times, like "daytime"
and "nighttime"...)
2006-06-25 15:37:28 +00:00
Rob Landley 934da82913 Fix a possible race condition if two processes try to claim the same loop
device at the same time.  We should only CLR_FD if the set status fails,
not if the SET_FD fails.
2006-06-25 15:29:12 +00:00
Rob Landley 768945b762 A few patches from Erik Hovland, turning strncpy() into safe_strncpy() and
removing some unnecessary code.
2006-06-25 00:34:52 +00:00
Rob Landley 641c3537c0 Add a test from Glenn. 2006-06-24 22:55:13 +00:00
Rob Landley e1ee482684 Document mount's new error return conventions. 2006-06-24 22:39:19 +00:00
Rob Landley c983274565 The logic to make cp -d or -P treat things like regular files should only
trigger for symlinks, not for device nodes.  This should fix "cp -a /dev ."
to work as expected (when run by root, anyway).

While I was there, cleanup headers and make an #ifdef go away...
2006-06-24 21:27:36 +00:00
Rob Landley 5d9c42aadc Slowly pulling more common headers into libbb.h. Andre pointed out that
older uClibc didn't include sys/socket.h from netinet/in.h, so add an
explicit #include for that too...
2006-06-24 17:55:02 +00:00
Rob Landley 53433b3ca1 Clean up. 2006-06-22 22:28:29 +00:00
Rob Landley 1fa4a9448b Patch from Shaun Jackman to replace CFLAGS_EXTRA with .config.mak 2006-06-22 22:05:00 +00:00
Rob Landley 67d4943393 CONFIG_DHCP -> CONFIG_APP_DHCP. 2006-06-22 18:48:34 +00:00
Mike Frysinger 135cee3741 Jean Wolter writes: modprobe checks, whether a module is already loaded. The function used for this currently always returns 0. 2006-06-21 23:03:37 +00:00
Bernhard Reutner-Fischer 35492137f8 - add note about strict ordering 2006-06-21 18:19:53 +00:00
Mike Frysinger c2ad4f5d27 Jean Wolter writes: ash uses bsearch to search in the list of built-in commands, therefore the list of built-in commands has to be ordered. Revision 15077 introduced the source built-in and destroyed this order. And now ash doesn't find the shift command anymore. 2006-06-21 18:04:49 +00:00
Rob Landley 0cc2c2c289 Patch from Paul Fox to improve mount's error handling behavior, which I beat
on a bit.
2006-06-21 03:53:33 +00:00
Rob Landley dbfb5a3cb7 Andre (armcc2200@yahoo) patched a bug where successful mounts could sometimes
produce an error, due to a missing rc assignment.
2006-06-21 02:39:57 +00:00
Rob Landley 399d45f1c6 Aurelien Jacobs pointed out inline functions that could be removed. Doing so
shrank the code a bit.
2006-06-21 01:49:17 +00:00
Rob Landley e5e1a10cd3 Remove pointless "inline" wrapper around get_terminal_width_height(). 2006-06-21 01:15:36 +00:00
Rob Landley 2d6af16035 Zubicaray reported a bug in vi that causes it to eat 100% cpu when you close
an xterm it's running in.  The vi signal behavior would catch and restarts lots
of signals, like SIGHUP, that should just kill the thing.  (Leftover behavior
from when it would segfault all the time.)  Filtered out the more obviously
bad ones.  If it segfaults, we should find and fix the problem.
2006-06-21 00:52:31 +00:00
Mike Frysinger b049c0ec19 only enable count_bit functions when actually needed to fix warning reported by Bernhard Fischer 2006-06-20 23:03:27 +00:00
Rob Landley b13fee4cbb Since rangecoder is just a bunch of C functions, move it into the one user
(decompress_unlzma.c).  Also a slight #include cleanup, and I've been meaning
to put #include <unistd.h> into libbb.h since it's so darn common...
2006-06-20 22:38:00 +00:00
Rob Landley 5483de1cb7 Cleanup patch from Shaun Jackman converting %m to perror. 2006-06-20 21:35:26 +00:00
Rob Landley 9fe801e0d2 Patch by Robert P. Day to remove obsolete alias code that the 2.4 and 2.6
Linux kernels don't do anymore.
2006-06-20 21:13:29 +00:00
Mike Frysinger 14ff19b28a assign default debug level to the MSHDEBUG define 2006-06-20 20:37:01 +00:00
Rob Landley 2b8a05a775 I broke allbareconfig with half-finished cleanups I'd forgotten weren't done.
Got both to a decent stopping point.  (There's a lot more cleanup to do on ls.c
but now is not the time...)
2006-06-20 17:43:01 +00:00
Rob Landley 8437ede6c2 The type changed too. 2006-06-20 16:43:05 +00:00
Peter Kjellerstedt 5ab8f7de4f Use the new names for tty_baud_to_value() and tty_value_to_baud() again. 2006-06-20 16:35:37 +00:00
Rob Landley 57c1f73dd5 Revert the last two patches to go back to a state before this file was
controversial.
2006-06-20 16:17:24 +00:00
Rob Landley 2818b292fb Patch by Robert P. Day to make structs use c99 initializers. 2006-06-20 15:52:52 +00:00
Rob Landley 2a613d7360 Patch from Robert P. J. Day cleaning up some unnecessary preprocessor
directives.
2006-06-20 14:57:00 +00:00
Rob Landley 352e117c6b Amrein-Marie Christophe pointed out that Mandrake changed its name. 2006-06-20 14:09:20 +00:00
Rob Landley 7a260f01ce Make some 64 bit warnings go away on x86-64. 2006-06-19 03:20:03 +00:00
Rob Landley 290fcb4213 Undo all of the ugliness and some of the bloat from 15412. 2006-06-18 23:59:03 +00:00
Rob Landley ea224be6aa skip_whitespace() shouldn't claim its return value is const, it doesn't know
that and callers wind up typecasting it back.
2006-06-18 20:20:07 +00:00
Rob Landley 14d7065ef1 Make this slightly more readable, and expose the hypocrasy of a comment that
says "our implementation makes it impossible to use blocksizes smaller than
22 octets" right above a check for blocksize < 8.
2006-06-18 15:23:13 +00:00
Mike Frysinger b000586d02 danf writes: stty doesn't support baud rates > 460800 bps, the attached patch adds support for all baud rates supported by Linux 2.6.16 on x86. 2006-06-17 22:41:28 +00:00
Rob Landley fe3d844bb1 Make it so Erik has to forward me less email. 2006-06-16 22:29:03 +00:00
Bernhard Reutner-Fischer fa61ca7591 - add cross-reference generation target.
Experimental.
2006-06-16 17:19:39 +00:00
Bernhard Reutner-Fischer 6d82f94681 - do away with the fwd-decls of functions. Should not contain any code changes
AFAICT.
2006-06-16 16:37:07 +00:00
Rob Landley d9a761d9c3 Revert svn 15333. If you vfork, you must either exec or exit. (The parent is
blocked until you do so.)
2006-06-16 16:35:53 +00:00
Rob Landley 1449a2014a This directory was fallout from the great feature freeze of 2003, which led
up to the 1.00 release.  I just moved what was left of it to
http://busybox.net/~landley/pending because it does _not_ belong in the
tree anymore.
2006-06-16 15:08:59 +00:00
Bernhard Reutner-Fischer 747041955e - hide CONFIG_GETOPT_LONG for the 1.2.0 release. Turned on per default.
I will revisit this and make sure that run-parts and ifupdown are fixed; hdparm needs treatment too..
2006-06-16 14:03:23 +00:00
Bernhard Reutner-Fischer f5efa7bfeb - add patch to provide a target 'html' to build a cross-reference of the source 2006-06-16 12:45:29 +00:00
Bernhard Reutner-Fischer fd4b61d5f3 - add needed includes and include busybox.h needed for the ATTRIBUTE define. 2006-06-16 12:28:39 +00:00
Rob Landley bc8c50351f Remove warnings caused by #include <sys/mount.h> in platform.h. Apparently
we redefine a lot of stuff from standard header files...
2006-06-16 04:25:19 +00:00
Rob Landley 9947a244d4 Patch from Rich Felker:
- duplicated format bit 14 forced LIST_EXEC always-on
- -p option was behaving just like -F (SUSv3 says -p only shows / for
  dirs, not other special symbols)
- tests for LIST_EXEC in color functions were nonsense (constant
  tests). i assume they were supposed to be (all_fmt & LIST_EXEC)
  however having coloring of executable files depend on -F seems
  undesirable.
2006-06-15 22:11:10 +00:00
Bernhard Reutner-Fischer 1761b9dabe - use shorter boilerplate, more accurate header guard
- don't use multi-line string literals
2006-06-15 21:56:28 +00:00
Bernhard Reutner-Fischer 7011dd0e06 - drats. 2006-06-15 21:39:34 +00:00
Bernhard Reutner-Fischer 42f091a761 - let the scripts be prerequisites of the files the generate
- make sure that bbconfig isn't too stupid
2006-06-15 21:35:35 +00:00
Rob Landley 39218932b1 Fix bug found by Joey Hess and forwarded by Bastian Bunk. Add Joey Hess's
test case to the testsuite, plus another one that would have been broken by
the first attempt at a fix.
2006-06-15 20:50:38 +00:00
Rob Landley cd82c3c041 Don't do workarounds for broken shells. Busybox is about to grow a shell that
we can run our own testsuite under, and I want it to handle the full range of
strange and peverted behavior you can find in real world shell scripts.
In the meantime, I'll just say #!/bin/bash in places that may care.
2006-06-15 20:07:57 +00:00
Rob Landley 04b7ef967b Jens Michaelsen pointed out that Linksys' firmware download side moved. 2006-06-15 17:34:57 +00:00
Rob Landley 148734df99 We came up with our own names for ATTRIBUTE_*, so why check if they're already
#defined?  Also remove a check for a gcc version older than RH9 (if non-linux
needs that #define they can put it in their section.)
2006-06-15 16:00:42 +00:00
Rob Landley 22d26fc6ae Patch from Yann Morin to put BLKGETSIZE64 in platform.h had rather a lot of
fallout due to the #include <sys/mount.h>.  Removed that #include from various
applets and fixed up those that were unhappy when that #include was made
because they'd block copied stuff out of it.  (Sigh.)
2006-06-15 15:49:36 +00:00
Rob Landley d6e5083d16 Help text update for libbb, talking about make standalone. 2006-06-15 15:04:53 +00:00
Bernhard Reutner-Fischer e2c7d34051 - there is no "CONFIG_STANDALONE" in the repository. Also iff there was a
CONFIG_STANDALONE, we'd need to toggle this on per default.
2006-06-14 17:33:57 +00:00
Bernhard Reutner-Fischer 597e70e9e4 - rename CONFIG_FEATURE_TFTP_DEBUG to CONFIG_DEBUG_TFTP 2006-06-14 17:32:11 +00:00
Bernhard Reutner-Fischer 32bf1f9d42 - rename CONFIG_FEATURE_TFTP_DEBUG to CONFIG_DEBUG_TFTP so it's off in defconfig
- expand the cmd_get/cmd_put macros
- Jason Schoon writes: unlink only if non-stdio
2006-06-14 17:29:10 +00:00
Bernhard Reutner-Fischer f1bd42a305 - correct typo 2006-06-14 16:51:50 +00:00
Bernhard Reutner-Fischer df798b7f58 - minor size tweak
text    data     bss     dec     hex filename
    613       0       0     613     265 loginutils/su.o.orig
    605       0       0     605     25d loginutils/su.o
2006-06-14 16:36:45 +00:00
Bernhard Reutner-Fischer 66e3a222cd - minor shrinkage 2006-06-14 16:17:50 +00:00
Rob Landley d760560c52 Attempt at fixing bug 836, vaguely based on patch from somebody named
clausmuus, forwarded to me by Yann E. Morin.
2006-06-14 01:51:16 +00:00
Rob Landley a34b48abe5 Upgrade the standalone shell code to use CONFIG_BUSYBOX_EXEC_PATH. 2006-06-14 01:27:01 +00:00
Rob Landley c7ddefc062 Attempt at fixing bug 815 by upgrading bb_spawn() so that builtins are at
the start of the path.  (This should be under the same config option as
the standalone shell, but right now that's buried in the shell menu.)

Also add the ability to specify CONFIG_BUSYBOX_EXEC_PATH with /proc/self/exe
as an overrideable default.
2006-06-14 01:24:33 +00:00
Rob Landley 575c8bacda Don't break allbareconfig. 2006-06-13 21:30:09 +00:00
Rob Landley 68286770b6 Patch from Shaun Jackman to detect "name=value" variable assignments. Random
cleanup at the end by me to make some unrelated #ifdefs go away...
2006-06-13 19:01:30 +00:00
Rob Landley f946379599 Make lash smaller. (Use llist_t for file closing, and different allocation
functions.)
2006-06-13 18:50:20 +00:00
Rob Landley 7c7b0d7437 Rewrite of dmesg, smaller and simpler. 2006-06-13 18:31:04 +00:00
Rob Landley 18958e9309 Random cleanup of platform.h. 2006-06-13 18:28:33 +00:00
Rob Landley 0960ca7383 Work around a persistent uClibc bug, since 0.9.29 still hasn't shipped.
Poked to do this by Jason Schoon.
2006-06-13 18:27:16 +00:00
Rob Landley 19a3940f15 Patch from Denis Vlasenko:
* Rename a var: statbytes -> transferred
* cursize == transferred, always. Nuke cursize.
* Make progressmeter() a nop if !CONFIG_FEATURE_WGET_STATUSBAR
  (reduces #ifdef forest)
* double elapsed -> int elapsed
* Do not sprintf to buf first and then write(STDERR) it,
  just fprintf directly to stderr
* Progress bar printing code made smaller
* Style fixes
2006-06-13 17:10:26 +00:00
Rob Landley 76ef08c5e3 Whitespace cleanup from Denis Vlasenko. 2006-06-13 16:44:26 +00:00
Rob Landley 7900b7b9b9 Use -ffunction-sections -fdata-sections --gc-sections if the compiler supports
it.  If nothing else, this gives us better granularity in bloatcheck.
2006-06-13 16:17:16 +00:00
Rob Landley c4b673994e Use xstat() instead of if(stat()) die() 2006-06-13 16:09:16 +00:00
Rob Landley fd8409f8c5 Patch from Denis Vlasenko, tweak error messages. 2006-06-13 15:31:39 +00:00
Rob Landley 9a1a9de49f Minor size shrinkage. 2006-06-13 15:12:14 +00:00
Rob Landley 9a202c9daa Patch from Denis Vlasenko: unlzma was make files with mode 777. Tweak
everything to do stat() and use xopen3().
2006-06-13 14:54:42 +00:00
Rob Landley 1dea55d577 Fix from Paul Fox to make compressed help text notice config changes. 2006-06-13 14:37:14 +00:00
Bernhard Reutner-Fischer 7b8ff22685 - make VERBOSE= and V= work equally; use BUILD_VERBOSE internally.
- move the link flags to cmd_link* so they are printed when requesting verbose output
2006-06-13 14:20:17 +00:00
Bernhard Reutner-Fischer 2f6a317944 - fix stupid typo from last checkin 2006-06-12 14:34:01 +00:00
Bernhard Reutner-Fischer f81ac42689 - remove superfluous CONFIG_BEGIN and CONFIG_END 2006-06-11 18:04:23 +00:00
Bernhard Reutner-Fischer a926f8e50a - add fancy mode to start-stop-daemon to support --oknodo and --verbose 2006-06-11 17:24:01 +00:00
Bernhard Reutner-Fischer 081b1ac6b4 - invert logic for nocheck_targets to exclude the empty default target. 2006-06-11 16:41:10 +00:00
Bernhard Reutner-Fischer e5de38497a - don't check for toolchain-setting for make targets that don't need them
- we already depend on sed, so do away with tr. Avoids pulling in yet another
  dependency.
2006-06-10 14:58:33 +00:00
Bernhard Reutner-Fischer 62f9856f54 - revert incorrect select change 2006-06-10 14:32:56 +00:00
Bernhard Reutner-Fischer b25f98a417 - fix two segfaults (reported by Horst Kronstorfer)
- remove dangling file if get fails (spotted and fixed by Jason Schoon)
- shrink it (Bernhard Fischer)
Thanks, all!
   text	   data	    bss	    dec	    hex	filename
   2684	      0	      0	   2684	    a7c	networking/tftp.o.orig
   2748	      0	      0	   2748	    abc	networking/tftp.o.allfixed
   2666	      0	      0	   2666	    a6a	networking/tftp.o.+shrink
2006-06-10 14:15:03 +00:00
Bernhard Reutner-Fischer 3b1936dcf9 - use bb_xbind
Thanks Erik Hovland
2006-06-10 11:39:09 +00:00
Bernhard Reutner-Fischer 44e216f264 - use bb_xchdir instead of ignoring eventual errors of chdir
Thanks to Erik Hovland
2006-06-10 11:29:44 +00:00
Bernhard Reutner-Fischer 2d1a6e7c1f - fix bug #887, in bb_get_chomped_line_from_file(), the last char was removed
unconditionally, even if it was not a newline.
  This was apparently broken by r14254
- whitespace while at it.
2006-06-10 11:04:43 +00:00
Paul Fox 6ba8bbe88a add ordering warning on enum Location 2006-06-09 12:25:10 +00:00
Bernhard Reutner-Fischer 1e23b6fdb5 - make sure that we see string_insert only if we need it. 2006-06-09 07:12:27 +00:00
Paul Fox 7ba12c6957 remove leading "Enable" from the config option text. not only is it
redundant, but it made the menuconfig shortcut mechanism mostly
useless, since so many of the entries started with 'E'.
2006-06-08 21:48:47 +00:00
Paul Fox 6ab037872f made "test" an ash built-in.
moved the contents of libbb/bb_echo.c back into coreutils/echo.c,
which is a more reasonable place for them than libbb.  this
forces anyone who wants echo and test to be builtin to ash to
also have them available as applets.  their cost is very small,
and the number of people who wouldn't want them as applets is
also very small.

added warning about shell builtins vs. CONFIG_FEATURE_SH_STANDALONE_SHELL,
which conflicts with their use.

thanks to nathanael copa for debugging help.

some string size optimization in test.c may have been lost with
this commit, but this is a good new baseline.
2006-06-08 21:37:26 +00:00
Rob Landley 176f2df69b Patch from Erik Hovland, via Tito. 2006-06-08 14:19:48 +00:00
Rob Landley 9c6f9552ec Some day, maybe gcc will be able to optimize out static functions that are
never used so we don't have to #ifdef them.  Wouldn't that be nice?
2006-06-08 14:11:36 +00:00
Mike Frysinger 2e7dfc179c need prototype for new vfork_daemon() 2006-06-07 21:58:57 +00:00
Mike Frysinger 9be7435203 initial support for no-mmu systems 2006-06-07 21:48:43 +00:00
Mike Frysinger 6fb5847faf sometimes daemonizing and vfork()/exit() is ok 2006-06-07 21:48:30 +00:00
Mike Frysinger ca70774293 bb_xdaemon() isnt available on no-mmu systems 2006-06-07 21:47:34 +00:00
Mike Frysinger 373af43bb0 comment all fields 2006-06-07 21:37:59 +00:00
Mike Frysinger 2fc534f3f1 hint at where the Magic comes from 2006-06-07 21:37:49 +00:00
Bernhard Reutner-Fischer f915a77386 - do away with the comment that noted that the current implementation
unly supports linux.
2006-06-07 21:26:09 +00:00
Rob Landley 6d8ce170b0 Fix from Tito to read from stdin only when it's not a tty. 2006-06-07 21:22:42 +00:00
Bernhard Reutner-Fischer 5929edc1fa - spelling 2006-06-07 20:30:01 +00:00
Mike Frysinger 301ad67912 add reference to proc(5) 2006-06-07 20:24:34 +00:00
Bernhard Reutner-Fischer 19008b8373 - reuse strings and messages. Saves about 600B 2006-06-07 20:17:41 +00:00
Rob Landley 4c5ad2fc90 Consolidate devfs garbage and mark it as obsolete. 2006-06-07 20:11:53 +00:00
Mike Frysinger 830d258dee use bb_xbind/bb_xlisten 2006-06-07 20:06:24 +00:00
Mike Frysinger 828d6bb3bc whitespace 2006-06-07 20:04:13 +00:00
Mike Frysinger 62a2c15376 whitespace 2006-06-07 20:03:13 +00:00
Mike Frysinger e3fdf2431a add a --noclobber flag 2006-06-07 18:12:27 +00:00
Mike Frysinger 81514ecca3 add support for cleaning out previous busybox install 2006-06-07 18:08:25 +00:00
Mike Frysinger 74b29a107f dont install emtpy libdirs 2006-06-07 17:27:46 +00:00
Mike Frysinger 55b12105b5 dont mix tabs and spaces, kthx 2006-06-07 17:24:29 +00:00
Mike Frysinger bc6584977a remove cvs $Id tag 2006-06-07 16:31:05 +00:00
Bernhard Reutner-Fischer 16d3e4e0af - add applet taskset to set/retrieve the CPU affinity of a process
text    data     bss     dec     hex filename
    584       0       0     584     248 taskset.o.gcc-2.95
    509       0       0     509     1fd taskset.o.gcc-3.3
    505       0       0     505     1f9 taskset.o.gcc-3.4
    506       0       0     506     1fa taskset.o.gcc-4.0
    498       0       0     498     1f2 taskset.o.gcc-4.1
    495       0       0     495     1ef taskset.o.gcc-4.2-HEAD
2006-06-07 15:44:59 +00:00
Mike Frysinger ea93f8a397 Tito writes: this patch fixes two potential bugs with the -i -I flags that could be reset during option parsing 2006-06-07 14:25:22 +00:00
Bernhard Reutner-Fischer e0387a6ee8 - fix the build if we have ftpput without ftpget (speeling reeoe)
Thanks to Stephane Billiart
2006-06-07 13:31:59 +00:00
Rob Landley 0753f4a15e Callers to identify() converted the endianness of the buffer. So did
identify().  This meant big endian systems had a NUXI problem.  Removed
the redundant conversion from the callers, and made some in-passing cleanups
while I was there.
2006-06-07 00:27:25 +00:00
Rob Landley eb29d6ce6a Remove a config entry that leaked in from my tree before I decided to
implement cat -v as a separate applet.
2006-06-06 22:59:37 +00:00
Rob Landley c44ab02f15 Whack the one last warning in make allbareconfig... 2006-06-06 19:50:16 +00:00
Mike Frysinger 280dae74b0 import support for microblaze relocations from uClinux-dist 2006-06-06 06:30:32 +00:00
Mike Frysinger 2a13175440 make the default prompt suck less when using fancy prompts 2006-06-06 06:26:12 +00:00
Mike Frysinger 75c6b7962d fix from uClinux-dist for proper exit status if reading /proc/modules failed 2006-06-06 06:19:19 +00:00
Mike Frysinger b306cb767f merge blackfin/microblaze from uClinux-dist 2006-06-06 06:15:52 +00:00
Mike Frysinger 8e640a1043 use vfork() instead of vork() since the only thing we do is execve() an app after fork (allows time to work on no-mmu) 2006-06-06 06:08:34 +00:00
Mike Frysinger b16b5bb08f only check __GNU_LIBRARY__ if it is actually defined 2006-06-06 06:00:20 +00:00
Rob Landley 362dc2bf33 Header cleanup on two more networking files (move libbb.h to the top and
remove #includes that libbb.h already does), plus a minor cleanup of
libbb.h to move #includes towards the top of the file where we can see 'em.
2006-06-05 17:35:24 +00:00
Rob Landley 12d87550a3 Confirming it's not needed. 2006-06-05 17:32:44 +00:00
Bernhard Reutner-Fischer bc291dc731 - add note about need to unify the 4 itoa() implementations. 2006-06-05 16:00:12 +00:00
Bernhard Reutner-Fischer 1e34731a6a - add testcase for grep bug (http://busybox.net/bugs/view.php?id=887)
The patch for bug #887 seems to work for me..
2006-06-04 18:40:48 +00:00
Bernhard Reutner-Fischer 213cc00445 - add note about ingroup and is_a_group_member 2006-06-04 17:58:19 +00:00
Bernhard Reutner-Fischer 863073da08 - add note about removing superfluous fmt specifiers 2006-06-04 16:05:02 +00:00
Bernhard Reutner-Fischer 395010b1f0 - note to cleanup fprintf(2,...) -> bb_error_msg(...) and
perror("bar") -> bb_perror_msg("bar");
2006-06-04 15:37:59 +00:00
Bernhard Reutner-Fischer 1b9d7c9aa9 - use bb_msg_{read,write}_error where appropriate.
text	   data	    bss	    dec	    hex	filename
 825015	   9100	 645216	1479331	 1692a3	busybox.old
 824919	   9100	 645216	1479235	 169243	busybox
2006-06-03 22:45:37 +00:00
Bernhard Reutner-Fischer a3d4bf38b0 - use bb functions instead of handrolling stuff.
- add XXX question about supposedly superfluous else clause
   text	   data	    bss	    dec	    hex	filename
   5918	      0	      0	   5918	   171e	editors/sed.o.orig
   5901	      0	      0	   5901	   170d	editors/sed.o
2006-06-03 21:40:11 +00:00
Rob Landley e84f4343b2 Remove #ifdeffed out code, both KEEP_UNUSED and #if 0. 2006-06-03 21:23:20 +00:00
Bernhard Reutner-Fischer 5084c78cbe - remove superfluous call of stack_machine(0) upon exit. 2006-06-03 21:19:09 +00:00
Bernhard Reutner-Fischer 5f6d67b7d6 - no need to have timer_duration in the data section.
- cleanup a little bit while at it.
2006-06-03 20:53:18 +00:00
Bernhard Reutner-Fischer b1312c9125 - use bb_msg_write_error in 3 places
- whitespace
2006-06-03 20:09:02 +00:00
Bernhard Reutner-Fischer c89982dcd7 - move #include busybox.h to the very top so we pull in the config
and eventual platform specific includes in early.
2006-06-03 19:49:21 +00:00
Bernhard Reutner-Fischer deda6a5c0d - move #include busybox.h to the very top so we pull in the config
and eventual platform specific includes in early.
- remove two supposedly superfluous newlines from ...error_msg() in modprobe
  and use shorter boilerplate while at it.
2006-06-03 19:35:15 +00:00
Bernhard Reutner-Fischer 2c351a8f98 - patch from Yann E. Morin: makes modprobe understand shell patterns
(especially '*') in module aliases, such as:
  "alias usb:v0582p0075d*dc*dsc*dp*ic*isc*ip* snd_usb_audio"

Fixes bug #889

 842162	  10244	 645924	1498330	 16dcda	busybox.old-4.1.20060603-1948
 842178	  10244	 645924	1498346	 16dcea	busybox.new-4.1.20060603-1948
2006-06-03 19:08:49 +00:00
Bernhard Reutner-Fischer 62558765b9 2006-06-02 Shaun Jackman <sjackman@gmail.com>
* shell/lash.c (pseudo_exec) [_NEWLIB_VERSION]: Remove the
	__getopt_initialized hackery.
2006-06-03 10:28:25 +00:00
Bernhard Reutner-Fischer 5c0ae06ef1 - No options should set the current system time.
Shaun Jackman writes:
A bug introduced in svn 11946 broke rdate. It no longer sets the
current system time when no options are specified. The options have
the opposite sense from what one might think, and, oddly enough, -ps
is intentionally a no-op.

Quoth rdate(8) from the BSD System Manager's Manual:

    -p      Do not set, just print the remote time
    -s      Do not print the time.
2006-06-03 10:24:20 +00:00
Rob Landley 9a990aaba8 Patch from Atsushi Nemoto:
This patch make depmod.pl more robust in cross environment.  If native
nm did not recognize target's object, you can override it with NM
environment variable.
2006-06-02 21:30:40 +00:00
Bernhard Reutner-Fischer e15d7573a1 - move #include busybox.h to the very top so we pull in the config
and eventual platform specific includes in early.
2006-06-02 20:56:16 +00:00
Rob Landley ecae66ac16 Header cleanup: don't #include headers that libbb.h already includes. 2006-06-02 20:53:38 +00:00
Rob Landley ff97ee9abd #ifdef reduction. 2006-06-02 19:03:01 +00:00
Bernhard Reutner-Fischer cf1f2ace39 - fix CONFIG_DEBUG_INIT compile failure 2006-06-02 10:43:17 +00:00
Mike Frysinger 3132e9d830 use xmalloc() 2006-06-02 06:30:30 +00:00
Paul Fox f0327f8e98 fix fdflish typo (reported by erik hovland) 2006-06-02 03:37:16 +00:00
Bernhard Reutner-Fischer b5353a20f3 - look at bb_applet_name. Should close bugs #892 and #893
also restructure code a bit so the fix only adds 1 byte..
2006-06-01 18:30:42 +00:00
Bernhard Reutner-Fischer d04e9b8130 - shrink logread a bit.
text    data     bss     dec     hex filename
    862      26     188    1076     434 logread.o.orig
    825      26     188    1039     40f logread.o
2006-06-01 14:36:14 +00:00
Paul Fox d112f8fa5e make halt and poweroff messages more accurate (i.e., claim "we're about to",
rather than "it's done", and combine with reboot handler to save space.
2006-06-01 13:17:49 +00:00
Rob Landley 8fc32d9326 Shaun Jackman pointed out that KERNEL_VERSION() is used without guards, so
defining it in a guard is silly.
2006-06-01 00:52:30 +00:00
Rob Landley 317a45cb62 The common case APPLET() macro only needs three arguments. 2006-06-01 00:51:38 +00:00
Rob Landley 9b1857f79f Bugfix from Shaun Jackman: don't attempt to write 64 bytes and then fail if
the write wasn't 192 bytes long.
2006-05-31 23:54:50 +00:00
Rob Landley d5b9b60fa5 Add CONFIG_NITPICK. (And tweak a couple other help entries while I'm there.)
Nothing's actually using it yet, but we need it.
2006-05-31 23:23:42 +00:00
Rob Landley 0620841758 Patch from Tito to remove long options from hdparm. 2006-05-31 22:52:57 +00:00
Rob Landley c8b360ebb7 Use BB endianness macro. 2006-05-31 22:24:33 +00:00
Rob Landley b623a542df Header file cleanup. platform.h apparently needs to be included early on so it
can figure out what header files to include, and override stuff that comes
later.  But applets shouldn't include platform.h directly, they should include
busybox.h or libbb.h.  Since busybox.h already includes libbb.h, move libbb.h
to the top of busybox.h and platform.h near the top of libbb.h (right after
bbconfig.h, which is something platform.h also needs access to).

While we're at it, move some stuff from busybox.h to libbb.h so we have one
big file to audit/clean up/try to make sense of instead of many.
2006-05-31 22:09:03 +00:00
Rob Landley 8abbee474c Add catv (separate applet instead of cat -v). Also cleanup cat.c comments,
the following of which (from cat.c) belongs in svn history instead of the
source code:

/* Mar 16, 2003      Manuel Novoa III   (mjn3@codepoet.org)
 *
 * This is a new implementation of 'cat' which aims to be SUSv3 compliant.
 *
 * Changes from the previous implementation include:
 * 1) Multiple '-' args are accepted as required by SUSv3.  The previous
 *    implementation would close stdin and segfault on a subsequent '-'.
 * 2) The '-u' options is required by SUSv3.  Note that the specified
 *    behavior for '-u' is done by default, so all we need do is accept
 *    the option.
 */
2006-05-31 19:36:04 +00:00
Bernhard Reutner-Fischer 9a5686b605 - fix IMA compile error i introduced when adding this untested snippet. 2006-05-31 18:57:56 +00:00
Bernhard Reutner-Fischer dac033e98c ha! a scratch-buffer! ;)
put the isdigit hack into it to help landley out..
2006-05-31 15:36:20 +00:00
Bernhard Reutner-Fischer f9437aaf5b - make getopt_ulflags aware of CONFIG_GETOPT_LONG 2006-05-31 14:12:51 +00:00
Bernhard Reutner-Fischer 8d3a6f7aaf - add CONFIG_FEATURE_WGET_LONG_OPTIONS 2006-05-31 14:11:38 +00:00
Bernhard Reutner-Fischer f3ac9ebc8e - convert xcalloc(1,x) to xzalloc 2006-05-31 13:31:16 +00:00
Bernhard Reutner-Fischer 595159f38c - shrink klogd a bit
text    data     bss     dec     hex filename
    569       0       0     569     239 sysklogd/klogd.o.orig
    537       0       0     537     219 sysklogd/klogd.o
2006-05-31 12:22:13 +00:00
Bernhard Reutner-Fischer c418d482ba - s/defined(__uClinux__)/BB_NOMMU/
This needs a second pass to:
+ add bb_daemon(unsigned char no_chdir, unsigned char no_close, const char*flag)
+ eventually globally export argc and argv, so we don't need to pass it to
  bb_daemon().
2006-05-31 10:19:51 +00:00
Bernhard Reutner-Fischer 507cd755a4 - conditionally define BB_NOMMU 2006-05-31 10:04:03 +00:00
Rob Landley 3252b625b7 Since we have less than 100k of usage.h data anyway, using bzip -9 is silly.
That says use 900k chunks when compressing, which needs about 4 megs of data
structures to undo the Burrows-Wheeler transform.  Switching it down to
bzip -1 (100k chunks) should have no impact on the compression (since it
still all fits in one chunk) but should reduce runtime decompression memory
requirements to something like 500k.  Still larger than gunzip, but not
egregiously so.
2006-05-30 19:19:45 +00:00
Rob Landley b2d42fa6d1 Test to see if I can rename a file without blanking its history... 2006-05-30 18:49:05 +00:00
Rob Landley 4b146e65ad Note about BB_NOMMU. 2006-05-30 18:31:37 +00:00
Bernhard Reutner-Fischer 7ae1553980 - consolidate "Sending SIG%s to all processes"; untested..
text    data     bss     dec     hex filename
   5379      32       8    5419    152b init/init.o.oorig
   5358      32       8    5398    1516 init/init.o
2006-05-30 18:17:21 +00:00
Bernhard Reutner-Fischer a8622e049d - this could use a brother which deals with glibc based systems.. 2006-05-30 15:49:10 +00:00
Bernhard Reutner-Fischer c58dbf28e0 - remove useless variable "status" from init_main.
http://www.opengroup.org/onlinepubs/009695399/functions/waitpid.html suggests
that we need not specify a status if we don't want, and we don't.
"If wait() or waitpid() return because the status of a child process is available, these functions shall return a value equal to the process ID of the child process. In this case, if the value of the argument stat_loc is not a null pointer, information shall be stored in the location pointed to by stat_loc.  "
   text    data     bss     dec     hex filename
   5391      32       8    5431    1537 init/init.o.06
   5379      32       8    5419    152b init/init.o
2006-05-30 12:16:54 +00:00
Bernhard Reutner-Fischer 3ab3080bc2 - use config_buffer for message()
- add second argument to waitfor(*action,pid); if action==NULL then use pid tor
  wait for. If an action was given, we wait for the action to finish just as
  before. In run() remove second and third occurance of the same functionality
  the waitfor() call now provides.
  Adjust the former only caller of waitfor accordingly.

PS: Not using waitfor but creating a second function used a few bytes more than
simply extending and reusing waitfor.
   text    data     bss     dec     hex filename
   5426      32       8    5466    155a init/init.o.orig
   5391      32       8    5431    1537 init/init.o
2006-05-30 12:10:29 +00:00
Rob Landley 752f0a6001 Put parentheses around some of the SWAP() macros, as pointed out by Peter
Kjellerstedt.
2006-05-30 06:28:03 +00:00
Rob Landley f14f7fc5ca Teach bloatometer about .rodata, and tweak the display into something that
has a better chance of getting merged.
2006-05-29 20:56:27 +00:00
Bernhard Reutner-Fischer 077368194c - cleanup conftest temporary files. 2006-05-29 20:01:52 +00:00
Bernhard Reutner-Fischer 35e1a077d6 - DEBUG_INIT -> config CONFIG_DEBUG_INIT 2006-05-29 13:08:35 +00:00
Bernhard Reutner-Fischer 76bb97c995 - landley, remove this? 2006-05-29 13:01:37 +00:00
Bernhard Reutner-Fischer 49e60b9788 - set_term() doesn't need an argument. (Like r15220 this is just compile-tested)
text    data     bss     dec     hex filename
   5432      32       8    5472    1560 init/init.o.r15220
   5426      32       8    5466    155a init/init.o
2006-05-29 12:57:52 +00:00
Bernhard Reutner-Fischer 0da069d382 - move common code into new open_new_terminal() function;
text    data     bss     dec     hex filename
 864434   10244  645892 1520570  1733ba busybox_old
 864386   10244  645892 1520522  17338a busybox_unstripped

add/remove: 1/0 grow/shrink: 0/2 up/down: 92/-143 (-51)
function                                     old     new   delta
open_new_terminal                              -      92     +92
exec_signal                                  345     276     -69
run                                         1527    1453     -74
Again, 48 != 51 so let's trust the former..
2006-05-29 12:54:16 +00:00
Bernhard Reutner-Fischer bbc225e13d - just whitespace 2006-05-29 12:12:45 +00:00
Bernhard Reutner-Fischer d2c306e862 - ls: remove unused variable
- dpkg.c, diff: use xstat
   text    data     bss     dec     hex filename
 848823    9100  645216 1503139  16efa3 busybox_old
 848679    9100  645216 1502995  16ef13 busybox_unstripped
bloatcheck is completely useless as it sees -79 for this, which is bogus.
2006-05-29 12:10:23 +00:00
Rob Landley 1ec5b29054 More size shrinkage. 2006-05-29 07:42:02 +00:00
Rob Landley a6e131dab3 Size reductions, mostly switching things to use libbb functions. 2006-05-29 06:43:55 +00:00
Rob Landley bba7f08d27 Add SWAP_LE?? and SWAP_BE?? macros, and make things use them. Converts values
to/from little endian or big endian, which is a NOP if that's what the current
platform already is.
2006-05-29 05:51:12 +00:00
Rob Landley 9755197448 This is not C++. 2006-05-29 05:21:29 +00:00
Rob Landley 0582ee0826 A few new todo items from email with Bernhard. 2006-05-29 05:06:06 +00:00
Rob Landley 15d20a03d6 Remove _() and N_() from platform.h. #define them as NOP macros in the two
files still using them.  I didn't remove them from e2fsck.c to avoid stomping
pending cleanup patches from Garrett, and I didn't bother to remove them from
fdisk.c because that entire file needs to be rewritten from scratch.
2006-05-29 05:00:44 +00:00
Rob Landley 8394729ddf Remove _(). 2006-05-29 04:49:55 +00:00
Rob Landley 4e3aff3425 Remove _(). 2006-05-29 04:37:28 +00:00
Rob Landley 267a0ed9e6 I changed last10 to last25, and just bumped it up to 50 so I renamed it
"recent.html".  There's a symlink from each of the old names for the moment,
I'll zap those eventually...
2006-05-28 02:10:21 +00:00
Rob Landley 81dab2cf83 Fix hdparm to use PRIu64 instead of typecasting to long long (which is 128 bits
on 64 bit platforms), and move #include <inttypes.h> to libbb.h.
2006-05-28 01:56:08 +00:00
Rob Landley 0fbe7ddbdd Put the ending quote on the help entry... 2006-05-28 01:40:26 +00:00
Rob Landley c44bc986b7 Fix some warnings in allbareconfig. 2006-05-28 01:19:06 +00:00
Rob Landley 3f78561d63 My first bout of untangling udhcp. Make lots of gratuitous #defines go
away, substitutie BB_VER for an external VERSION, use busybox CONFIG symbols
rather than checking for them then defining others, etc.  Lots more cleanup
to do...
2006-05-28 01:06:36 +00:00
Rob Landley 8fba99f35e Move portability stuff to platform.h, and clean up adjtimex.c a bit while
I'm in the area.
2006-05-27 22:08:01 +00:00
Rob Landley 299a6b4d7b Consolidate #include <sys/time.h> so libbb.h does it. 2006-05-27 21:42:58 +00:00
Rob Landley d244bc1a57 Update FAQ to mention make baseline when talking about make bloatcheck. 2006-05-27 21:30:34 +00:00
Rob Landley d9872aa0d7 Consolidate the .PHONY targets and add "make baseline" for bloatcheck. 2006-05-27 21:24:16 +00:00
Bernhard Reutner-Fischer 95a040fac8 - use the defines CURRENT_TTY and VC_1; also shrink xargs a tiny bit:
add/remove: 0/0 grow/shrink: 2/6 up/down: 5/-37 (-32)
function                                     old     new   delta
static.add_interface                         271     274      +3
static.glob3                                  36      38      +2
static.renice_main                           409     408      -1
static.readcmd                              1083    1081      -2
static.changepath                            176     174      -2
static.parse_opts                             56      51      -5
static.rx_main                              1095    1088      -7
static.xargs_main                            759     739     -20
----------------------------------------------------------------
Result                                                :-)    -32
2006-05-27 09:36:43 +00:00
Rob Landley 8bb50782a5 Change llist_add_* to take the address of the list rather than returning the new
head, and change all the callers.
2006-05-26 23:44:51 +00:00
Rob Landley 5edc10275e Slight sanity fix: data is void *, not char *. And it's called data
almost everywhere, so be consistent.
2006-05-26 23:00:10 +00:00
Bernhard Reutner-Fischer d765ee5d0f - provide fallback defines for non-linux 2006-05-26 20:34:02 +00:00
Bernhard Reutner-Fischer b21d23bd46 - provide fallback defines for non-linux 2006-05-26 20:33:12 +00:00
Bernhard Reutner-Fischer 01d23ade57 - add central knob to turn off getopt_long everywhere. EXPERIMENTAL!
Adds "Enable getopt long" under "General options", default y.
  Send patches to fix getopt_ulflags and run_parts.c if you turn this off..
  See http://busybox.net/lists/busybox/2006-May/021828.html for a start to run-parts
2006-05-26 20:19:22 +00:00
Bernhard Reutner-Fischer d29337580e - use strtol instead of strtoll if the latter does not exist
- add and use wrapper for attribute
- add and use replacement for vasprintf if it is unavailable
2006-05-26 19:58:58 +00:00
Bernhard Reutner-Fischer 781e42d66c - introduce and use bb_path_wtmp_file for portability (saves 11 Bytes).
- fix last.c to also look at the double-underscore UT_ defines.
2006-05-26 14:41:40 +00:00
Bernhard Reutner-Fischer b180e5a766 - use portability wrapper define bb_setpgrp. 2006-05-26 14:24:56 +00:00
Bernhard Reutner-Fischer 08421e1d0c - work around bug in gcc-3.4.x on ARM 2006-05-26 14:05:48 +00:00
Bernhard Reutner-Fischer 8379053b11 - move llist to top of file so we can potentially use it in all prototypes easily 2006-05-26 13:54:07 +00:00
Bernhard Reutner-Fischer 76b82cfd6f - make find_mount_point conditional on df and eject; Fixes `make hosttools´ on
hosts where mntent.h does not exist.
2006-05-26 13:38:43 +00:00
Bernhard Reutner-Fischer 4ed1f1d99d - add workaround for tar being broken since it uses a non-portable constant. 2006-05-26 13:34:25 +00:00
Bernhard Reutner-Fischer 7fca7e3378 - use the SED given by the user
- use the portable `` instead of $(). There is no bbsh, so this is needed.
2006-05-26 13:28:39 +00:00
Bernhard Reutner-Fischer e28d1d6fdc - add target hosttools (see make help)
- rename check_gcc to check_cc and pass the CC to use as arg#1; peruse check_cc for HOSTCFLAGS
- add and use check_strip
- add checks for {,no-}whole-archive and {start,end}-group LD flags
2006-05-26 13:22:57 +00:00
Bernhard Reutner-Fischer 6d0dbeb550 - use ATTRIBUTE_ALWAYS_INLINE if requested
- use shorter boilerplate while at it
2006-05-26 13:13:11 +00:00
Bernhard Reutner-Fischer e00fc16aaa - move libc checks from busybox.h to platform.h
- add ATTRIBUTE_ALWAYS_INLINE, endian handling for DEC UNIX, some more
  compiler dependent defines to platform.h
- add conditional bb_setpgrp define to platform.h
- remove superfluous specifying args from "#define fdprintf dprintf"
2006-05-26 13:10:10 +00:00
Bernhard Reutner-Fischer 7fd9983c56 - patch from Tito to pretty print the overall delta 2006-05-26 10:29:40 +00:00
Mike Frysinger 314c739b07 Yann E. MORIN. writes:
hdparm has a uint64_t passed to printf with a %llu format (which is ok, because
it's the same size), but without first being casted(?) to unsigned long long int.
Which is kinda funny because it's done OK on a few lines above...
2006-05-26 02:05:19 +00:00
Mike Frysinger 4f93a63467 errno and h_errno values are not the same #876 by rfelker 2006-05-26 01:56:42 +00:00
Mike Frysinger fa6c4844b2 fix spelling mistakes 2006-05-26 01:48:17 +00:00
Mike Frysinger 9c03cb920a check for queueing dependancy dependancies typos 2006-05-26 01:41:04 +00:00
Mike Frysinger 3354487393 queuing is spelled correctly 2006-05-26 01:38:19 +00:00
Rob Landley 399d2b5c24 Rich Felker suggested removing dprintf() from watch, and one thing led to
another... This adds bb_xspawn() support, which does vfork/exec.  (I don't
know why using a static instead of a local adds ~40 bytes, but using
the local doesn't work...)
2006-05-25 23:02:40 +00:00
Rob Landley 69d863b6c6 And fix the error I just introduced. :) 2006-05-25 21:13:30 +00:00
Rob Landley 5a2997de72 Remove pointless #define. 2006-05-25 21:12:40 +00:00
Rob Landley ade7f95bd1 Patch from Tito:
Remove -v verbose -V version -q quiet flags
Remove parse_opt_v2();
Rename parse_opt_v3() to parse_xfermode()
Remove if_strcat()
Rearrange code in  dump_identity() to reduce size
Modify some strings so that they could be optimized by the compiler
Minor code clean up
Remove unneeded #define <shm.h>

#if BB_BIG_ENDIAN && !defined(__USE_XOPEN)
# define __USE_XOPEN
#endif    
Must be before #include <unistd.h> and #include "busybox.h"
(noticed by Bernhard Fischer <rep.nop@aon.at>)

Remove duplicate code in do_time()
2006-05-25 18:53:06 +00:00
Rob Landley 6cd2250953 Remove a pointless #define. 2006-05-25 18:31:11 +00:00
Bernhard Reutner-Fischer 89a22ea5d9 make the testsuite a little less brittle:
- 'function fn_name\n{' breaks on older FreeBSD default shells, so use the more
  widely supported 'fn_name () {'. This needs more fixing..
- test for integers ought to use the proper operators
- test for strings ought to use quoting of the strings to be fair to strange
  implementations of test(1)
- make sure not to ignore return-codes != 0 from commands; Some shells exit
  immediately on this (much like explicitely requesting set -e in e.g. bash)

TODO:
*) Some older shells do not allow a space after the test-condition in an "if"
statement. This doesn't work:
if [ $status -ne 0 ] ; then
as opposed to this:
if [ $status -ne 0 ]; then
or this
if [ $status -ne 0 ]
then

*) strict spacing between commands. In some shells you have to say:
foo ; bar ; baz
The affected shells barf on stuff like ommitting the space, so this doesn't
work:
foo; bar   ;baz

*) $() vs. ``
The former isn't really portable as opposed to the latter.

*) fix frong assumption that the testsuite is run from the source-dir.
This is a complete misconception and renders the testsuite completely useless.


That said, i note that IMO a test-harness ought to do it's best to work in
a wide variety of environments, everything else defeats it's purpose.
2006-05-25 13:24:02 +00:00
Rob Landley 027ea1aeac Two more issues pointed out by Bernhard. 2006-05-24 17:58:00 +00:00
Rob Landley 5fc467e758 Yann Morin spotted some leftover flotsam from halfway through the recent
llist.c interface change that accidentally got checked in.  My bad.
2006-05-24 17:45:47 +00:00
Rob Landley fa6b5e62c2 It takes _talent_ to implement a version of nohup that does everything except
the actual blocking of HUP.
2006-05-23 00:28:06 +00:00
Bernhard Reutner-Fischer a81cec9192 - set x bit 2006-05-21 22:06:59 +00:00
Rob Landley 5cd1ccd995 Convert to a global struct, the way sed was. Now I have two, I can work out
the infrastructure to merge global structs into a union...
2006-05-21 18:33:27 +00:00
Rob Landley 9ffd42317b Minor cleanups: Convert a few calloc() calls to xzalloc, remove unnecessary
memset, collate variable declarations...
2006-05-21 18:30:35 +00:00
Rob Landley c020f5f518 New version of nohup that's much smaller, less paranoid, consistent,
vaguely portable, and licensed GPLv2 "or later".
2006-05-21 18:28:13 +00:00
Bernhard Reutner-Fischer 4148afe049 - fix wrong path to scripts/usage; It is in the builddir and not in the srcdir.
- flag .depend as .NOTPARALLEL to workaround bug in make-3.80 and make-3.81
Some more details on the second workaround (i.e. kludge):
make-3.80 silently fails, while make-3.81 is at least self-conscious enough to
admit:
include/usage_compressed.h: .config scripts/usage
#  Implicit rule search has not been done.
#  File does not exist.
#  File has not been updated.
#  Dependencies commands running (THIS IS A BUG).
#  commands to execute (from `/home/cow/src/bb2/Makefile', line 430):
        $(Q)$(SHELL) $(top_srcdir)/scripts/usage_compressed "$(top_builddir)/scripts" > $@

I'm giving up on trying to run the rest of the prerequisites of .depend in
parallel and just (try to) indicate that the prerequisites of .depend are
not to be run in parallel.

While this makes `make distclean defconfig;make -j´ work for me, it is not a
real -- longterm -- solution; FIXME
2006-05-21 15:05:49 +00:00
Bernhard Reutner-Fischer a1e130f122 - check for existing usage binary, so it get's more obvious that the toplevel
Makefile uses the wrong path to the binary (it's in top_builddir and not in top_srcdir)
2006-05-21 10:45:01 +00:00
Bernhard Reutner-Fischer 3c8c0690fd - there is no _usage.h anymore, so don't rm it in distclean. 2006-05-21 10:04:46 +00:00
Bernhard Reutner-Fischer 30ead9a9b9 - do not create usage_compressed.h if CONFIG_FEATURE_COMPRESS_USAGE is not set 2006-05-21 09:02:12 +00:00
Bernhard Reutner-Fischer 1a5eb46820 - there is no "sh". Use $(SHELL) 2006-05-21 08:25:45 +00:00
Bernhard Reutner-Fischer ef21629a6b - silence warning about no return in function returning non-void
- put CONFIG_DEBUG_CROND_OPTION into config
no changes in size when debugging is disabled.
2006-05-20 14:14:05 +00:00
Rob Landley 9b5a99ad21 Patch from Robert P. Day to remove #ifdefed out SLIP support code that we
have no CONFIG option to enable, and which existing SLIP users don't seem
to miss.
2006-05-19 22:54:42 +00:00
Rob Landley 206f75784b Remove unused function parameter, from Garrett. 2006-05-19 22:42:23 +00:00
Rob Landley 19d42df206 Add diffutils and dhcp to list of packages we provide replacements for. 2006-05-19 22:14:19 +00:00
Bernhard Reutner-Fischer 35017fb4fc - backout erroneously checked in snippet.. 2006-05-19 20:48:22 +00:00
Rob Landley df4cdaf341 First quick stab at organizing TODO under whose TODO item it is. 2006-05-19 20:47:55 +00:00
Rob Landley 80b8ff07ca A pending item in my tree I might as well check in: I plan to migrate calloc()
and bb_calloc() calls to bb_xzalloc() which allocates prezeroed memory but
only takes one argument (the size).
2006-05-19 20:36:49 +00:00
Bernhard Reutner-Fischer b1629b1b2a - remove emacs layout block as suggested by Robert P.J. Day
- use shorter boilerplate while at it
2006-05-19 19:29:19 +00:00
Bernhard Reutner-Fischer d8e87a09d1 - forgot to make busybox_unstripped depend on the applets in IMA mode. 2006-05-19 18:37:34 +00:00
Bernhard Reutner-Fischer c7801c4634 - use shorter boilerplate. 2006-05-19 18:35:03 +00:00
Bernhard Reutner-Fischer 351c832d75 - redirect stdout of scripts/config/conf to /nil for
allyesconfig, allnoconfig, defconfig, allbareconfig
- fix invalid call to "make"; use $(MAKE) instead.
2006-05-19 18:33:34 +00:00
Bernhard Reutner-Fischer a254065e63 - remove SIGIOT as suggested by landley. 2006-05-19 17:54:05 +00:00
Rob Landley 4ae2f511cf Patch from tito to replace shared memory usage with mlock(), slightly tweaked
by me.
2006-05-19 17:24:26 +00:00
Mike Frysinger cf89c37d08 fix indenting in help output for ifconfig 2006-05-19 16:14:31 +00:00
Bernhard Reutner-Fischer 14b1d2930a - typo s/allbaseconfig/allbareconfig/
I thought Robert Day pointed this out, but i cannot find the mail in the archives..
2006-05-19 14:02:51 +00:00
Bernhard Reutner-Fischer 0a8812bdc5 - replace _PATH_DEVNULL with bb_dev_null 2006-05-19 13:12:21 +00:00
Bernhard Reutner-Fischer 14aa06f29c - do not use non-standard u_int.
- do not use _PATH_DEVNULL gnuism but bb_dev_null.
Thanks to Rich Felker.
2006-05-19 13:02:27 +00:00
Bernhard Reutner-Fischer e2922e42a0 - make it C89 compatible; Declarations in the middle of a function is of course
fine in C99, but it really serves no purpose other than breaking compilation
  on C89 compilers.
  Thanks to Rich Felker for pointing this out.
2006-05-19 12:48:56 +00:00
Bernhard Reutner-Fischer 38583fd6f2 - use uint32_t instead of __u32
Thanks to Rich Felker for pointing this out.
2006-05-19 12:44:16 +00:00
Bernhard Reutner-Fischer 4009ed91f7 - Rich Felker writes:
SIGIOT is not defined in any standard i can find and it seems to be
useless (alias for SIGABRT) on linux. i put it in #ifdef but it's
probably best just to remove it and cut down the size a bit.
2006-05-19 12:41:13 +00:00
Bernhard Reutner-Fischer d9ed35c8b9 - remove superfluous legacy includes.
This applet should be converted to use llist; __NEED_DLLIST
2006-05-19 12:38:30 +00:00
Bernhard Reutner-Fischer a2a647dfc1 - include strings.h
Thanks to Rich Felker for pointing this out.
2006-05-19 12:30:00 +00:00
Bernhard Reutner-Fischer a85a63f6ee - fix invalid mode 2006-05-19 12:22:11 +00:00
Bernhard Reutner-Fischer e2e56c7c41 - single KERNEL_VERSION(a,b,c) macro in platform.h
- rename get_kernel_revision() to get_linux_version_code
from Robert P. J. Day
2006-05-19 11:54:02 +00:00
Bernhard Reutner-Fischer e3c150bc67 - cleanup memory if opening aliases failed and cleanup was requested. 2006-05-19 11:24:28 +00:00
Rob Landley 42c4259f68 Fluff out info on morris accounts. 2006-05-18 21:53:51 +00:00
Rob Landley 3afb070e6d Avoid a memory leak pointed out by Lucas C. Villa Real. 2006-05-18 20:41:43 +00:00
Rob Landley d2ccc2ba26 Typo fix. 2006-05-17 21:04:53 +00:00
Rob Landley 7723019c6b Patch from Bernhard Fischer to remove some useless bits. 2006-05-17 20:24:53 +00:00
Rob Landley c27c04c16e Announce 1.1.3. 2006-05-17 19:59:24 +00:00
Rob Landley 81369a8b2f Typo that hits big endian systems. 2006-05-17 19:47:58 +00:00
Rob Landley 5371a953ca The gnu extension to have realpath() malloc its buffer when handed a NULL
isn't implemented in uClibc, so we can't use it.
2006-05-17 04:09:14 +00:00
Rob Landley 2686d3bc38 Rob Sullivan cleaned up the longstanding patch from Hideki IWAMOTO to add
ibs and obs support to dd, and made it configurable.  I cleaned it up a bit
further and moved conv= into the same config option.
2006-05-16 16:52:12 +00:00
Rob Landley adde79883f Largeish cleanup patch from Tito, mostly if statement therapy. 2006-05-16 15:32:30 +00:00
Rob Landley 34b5319d86 Make md5 calculation always go through an the buffer so that A) we don't
handle packets out of sequence if some data goes through the buffer and
some doesn't, B) it works on systems that can't handle aligned access,
C) we just have one code path to worry about.

While we're at it, sizeof() and RESERVE_CONFIG_BUFFER() really don't combine
well, which is why md5sum has been reading and processing data 4 bytes at a
time.  I suspect that the existence of CONFIG_MD5_SIZE_VS_SPEED to do loop
unrolling and such in the algorithm was an attempt to work around that bug.
2006-05-16 02:38:26 +00:00
Rob Landley d272dc7cb3 Remove some out of date bits. 2006-05-15 21:02:36 +00:00
Rob Landley 282a26b8ba The one line fix to Bernhard Fischer's "profoundly". 2006-05-15 18:38:11 +00:00
Bernhard Reutner-Fischer 2f38f27b42 - patch from Robert P. J. Day to use filter instead of findstring. 2006-05-15 10:04:50 +00:00
Mike Frysinger d9b6b844e5 pull Rules.mak from top_srcdir as pointed out by Robert P. J. Day on the mailing list 2006-05-13 02:33:41 +00:00
Mike Frysinger 39440e520c pull Rules.mak from top_srcdir as pointed out by Robert P. J. Day on the mailing list 2006-05-13 02:33:09 +00:00
Mike Frysinger 2f4d91da75 fix whitespace 2006-05-13 02:27:52 +00:00
Rob Landley 47b1838957 Patch from Lucas C. Villa Real adding "source" as a synonym for the "." command. 2006-05-12 20:44:16 +00:00
Paul Fox d7384296f6 implement -print0 for find 2006-05-12 14:47:20 +00:00
Rob Landley f7897ec47b Autodetect parts of a multipart file, from Robert P. Day's suggestion. 2006-05-12 01:42:33 +00:00
Rob Landley 525d74badb Busybox is licensed under GPLv2 or later. Shipping another license with the
project would confuse the issue.

Some of these files are available elsewhere under other license terms,
but that's not directly relevant to busybox.
2006-05-11 21:19:22 +00:00
Rob Landley cc848ddbf8 Bug fix from Vladimir Oleynik, and suggestion I add my copyright notice
to the file.
2006-05-11 18:25:24 +00:00
Rob Landley 0690d1591f Tabs weren't lining up in the help text. 2006-05-11 17:33:10 +00:00
Rob Landley ac4c92da3b More about configuring busybox. 2006-05-11 17:21:13 +00:00
Rob Landley 9b70093714 Rename the devfs device names option so it doesn't bite people so often. 2006-05-11 16:39:52 +00:00
Rob Landley 2ad1e7ce44 Patch from Vladamir Oleynik, reducing memory consumption. 2006-05-11 15:23:23 +00:00
Rob Landley 983d751bc0 Remove reference to programming.html, update description of FAQ. 2006-05-11 15:02:32 +00:00
Rob Landley b73d2bf4bf Reorganize FAQ, update a few entries, and consolidate with programming.html. 2006-05-11 15:00:32 +00:00
Mike Frysinger 8d2cb8be3b back out default implicit %.o rule for now 2006-05-11 05:33:31 +00:00
Mike Frysinger d148a94a2a move the dir related rules to the end so the E2FSPROGS_AR rule is the default 2006-05-11 04:39:09 +00:00
Mike Frysinger be7c539b7a dont use tabs people 2006-05-11 04:37:25 +00:00
Mike Frysinger e135a5d746 fix no previous prototype warning 2006-05-11 02:36:51 +00:00
Mike Frysinger b5547fb0b3 fix no previous prototype warning 2006-05-11 02:35:55 +00:00
Mike Frysinger e92923862e typecast bbig to kill format warnings 2006-05-11 02:31:45 +00:00
Mike Frysinger 49f6afc0a0 rename 2006-05-11 02:10:13 +00:00
Mike Frysinger e3412d8331 remove files not related to busybox 2006-05-11 02:09:39 +00:00
Mike Frysinger 6143c0719b add implicit rule for %.a to help debugging in subdirs 2006-05-10 18:12:16 +00:00
Rob Landley 094b9f7e1d Shut up the warning "implicit declaration of strlen". 2006-05-10 17:41:21 +00:00
Mike Frysinger 06b00e8ba7 accept() takes a socklen_t, not an int 2006-05-10 17:18:11 +00:00
Mike Frysinger d2c8fd6360 fix whitespace in comment example 2006-05-10 17:17:09 +00:00
Mike Frysinger 772a3467ba some more useful debug info from Jason Holden 2006-05-10 17:14:32 +00:00
Mike Frysinger 673c9443ba add a default .o rule for easier debug 2006-05-10 17:12:12 +00:00
Bernhard Reutner-Fischer 72c4d64d20 - add helptext for --retries 2006-05-10 16:11:02 +00:00
Mike Frysinger 62ec21d0cf touchup whitespace/english a bit more 2006-05-10 15:59:07 +00:00
Mike Frysinger 731f81cbed whitespace between if and ( 2006-05-10 15:23:12 +00:00
Bernhard Reutner-Fischer eba32f429b - typo in error-message: s/algotithm/algorithm
- whitespace cleanup
2006-05-10 07:59:32 +00:00
Mike Frysinger 59e46117b1 clean more files 2006-05-10 05:19:27 +00:00
Rob Landley f893250a3b Replace isnan() and isinf() with inline tests so uClibc doesn't want us to
link sort against libm.  This adds 22 bytes for glibc but is a win for uClibc,
and since glibc is bigger than all of busybox it seems kind of silly to worry
about it.
2006-05-09 23:14:39 +00:00
Rob Landley c503df5bdd Split CONFIG_DEBUG from CONFIG_DEBUG_PESSIMIZE, and consolidate some Rules.mak
stuff along the way.
2006-05-09 22:08:56 +00:00
Bernhard Reutner-Fischer 2431830018 - fix bug in make help introduced by landley in r15022:
Development:
  bloatcheck             - show size difference between busybox_unstripped
  /bin/sh: -c: line 0: unexpected EOF while looking for matching `''
  /bin/sh: -c: line 1: syntax error: unexpected end of file
  make[1]: *** [help] Error 2
  make: *** [help] Error 2
2006-05-09 11:29:56 +00:00
Rob Landley e3f5a3fd82 Convert sed's static variables to a single global structure. 2006-05-09 03:53:55 +00:00
Rob Landley 0b65628395 Move sed over to the generic llist_t for append. Saves about 90 bytes. 2006-05-08 22:17:23 +00:00
Rob Landley 92d8b35594 Make bloatcheck work when building out of tree. 2006-05-08 20:48:12 +00:00
Bernhard Reutner-Fischer 45d545890f - fix build 2006-05-08 20:20:32 +00:00
Rob Landley a6b5b60942 Fiddling with llist to make memory management easier. Specifically, the
option to delete the contents of the list when we delete the list is a
good thing.
2006-05-08 19:03:07 +00:00
Rob Landley 712ba85b30 Tweak suggested by Matt Mackall when I submitted the bloat-o-meter changes
back to linux-kernel...
2006-05-08 18:30:33 +00:00
Rob Landley d61b8d8f9b The changes svn 14960 made to Rules.mak broke building out of tree
(with O=directory), and reverting them fixes building out of tree.  I'd be
happy to fix them up instead of reverting them if I had the foggiest idea
what they were trying to do, but I don't, and this at least gets building
out of tree working again...
2006-05-08 18:18:02 +00:00
Rob Landley 19802563ed The if() is cheaper than the extra function parameter. According to make
bloatcheck, this saves 112 bytes on x86...
2006-05-08 15:35:46 +00:00
Rob Landley 0ea0aefcb5 Remove a link that leaked in from the pending llist_t changes. 2006-05-08 15:08:25 +00:00
Mike Frysinger 1b4e1dae71 re-enable udhcp in a few more places 2006-05-08 03:24:36 +00:00
Mike Frysinger 7031f62d9b add back in udhcp support 2006-05-08 03:20:50 +00:00
Rob Landley 15fe2e11d7 Shrink the code about 50 bytes, allocate less run-time memory, and add a
comment that null terminating the string we sscanf() shouldn't be required
since the kernel adds \n to the end of it and sscanf will stop there.
2006-05-08 02:53:23 +00:00
Rob Landley 17507fa4c5 More busting on legacy mtab support in the help text. 2006-05-08 02:22:24 +00:00
Rob Landley 20deab0537 Cleanup patch from tito. 2006-05-07 23:34:15 +00:00
Rob Landley 63e4c637cb The udhcp was deleted from busybox in 14634. Bolting an external project to
the side of the tree doesn't _COUNT_, and I will not ship it.

Udhcp was deleted shortly after I posted my philosophy for what should and
shouldn't go into busybox:

http://www.busybox.net/lists/busybox/2006-March/019484.html

I complained about the change t the time.  I've complained repeatedly since.
But nobody felt like fixing it.  External dependencies are something to be
minimized.  I don't care about the ability for packages to build outside
busybox: something is either part of busybox, or it isn't.  If I convert any
part of the external udhcp repository to use libbb, I've broken the external
package.  Any random cleanups that touch that directory suddenly have to worry
about external dependencies that are NOT OUR PROBLEM.  Therefore, that
directory is not and cannot be part of busybox.  Wishful thinking isn't going
to change that.  I will not ship something I can't maintain.

I'll try to get a new dhcp client and server in before the ship window closes,
but I have a half-dozen other projects pending.  I'm sorry this happened, but
I'm not the one who removed it, and I'm not the one who ignored the project
maintainer's repeated complaints about the situation for the next month and a
half.
2006-05-07 23:19:20 +00:00
Rob Landley baa89b398d Patch to fix bug 868, and some related cleanup while I was in the area.
A tab is now taken as the end of filename if it's there, but if it isn't
(because the timestamp isn't there) we continue with the existing untruncated
line as the filename.
2006-05-07 21:10:06 +00:00
Rob Landley a336e7cc25 Script to easily get an assembly dump of a single function. 2006-05-07 20:58:55 +00:00
Rob Landley a389651115 Remove bb_strlen() in favor of -fno-builtin-strlen. Saves as many bytes
as the old optimization did (actually does slightly better under gcc 4.0), and
simplifies the code.
2006-05-07 20:20:34 +00:00
Rob Landley f8a8084267 Add "make bloatcheck" to run Matt Mackall's bloat-o-meter. Copy an old
busybox_unstripped to busybox_old, build a new version, and "make bloatcheck"
to see a detailed breakdown of the size difference.
2006-05-07 19:26:53 +00:00
Rob Landley 9fb272a222 Dennis Vlasenko pointed out that run_applet_by_name sets bb_applet_name already. 2006-05-07 01:44:23 +00:00
Mike Frysinger 89ede3f586 fix udhcp again 2006-05-06 05:30:46 +00:00
Mike Frysinger 96087332e7 make sure script is executable 2006-05-06 05:27:19 +00:00
Rob Landley 42bd987e22 Add an "optional" line for FEATURE_READLINK_FOLLOW. 2006-05-05 22:22:30 +00:00
Rob Landley c008c7440d New test from Natanael Copa. 2006-05-05 21:07:41 +00:00
Mike Frysinger 1781188a9d didnt mean to commit debug enable 2006-05-05 20:33:07 +00:00
Mike Frysinger 02d8fa48ad use %p when printing pointers, not %x 2006-05-05 20:32:31 +00:00
Mike Frysinger 4e512f1062 fix Bug 659 as reported by Robin Getz 2006-05-05 18:38:07 +00:00
Rob Landley 3958e0a151 Busybox's udhcp was deleted a while ago. Bolting an external project onto the
tree doesn't change that.
2006-05-05 18:20:42 +00:00
Rob Landley d8f6601502 Another patch from Garrett: remove bad block bitmap checking code. Everything
produced in the list ten years has some variant of internal error correction
(disks, cdrom, flash), so if it has user-visible bad blocks on it the
hardware has exhausted its remapping reserve and is dying, and you need to get
your data off pronto.  (The one exception I can think of is floppies, and I
don't care.)
2006-05-05 17:29:09 +00:00
Rob Landley 2c39eee805 Migrate endianness macros. 2006-05-05 16:54:40 +00:00
Rob Landley 39cf645ce0 Patch from Dennis Vlasenko resetting values that get reused. 2006-05-05 16:52:28 +00:00
Rob Landley 2381f702c9 Patch from Dennis Vlasenko simplifying the APPLET macros. 2006-05-05 15:55:06 +00:00
Rob Landley 49159c7f94 Patch from Jason Schoon to make mount -a not abort on the first failure. 2006-05-05 15:01:38 +00:00
Bernhard Reutner-Fischer 0e413e53e9 - ignore missing helptext for options which are not selectable. 2006-05-05 14:05:21 +00:00
Bernhard Reutner-Fischer 4f7953cc3c - add helptext for CONFIG_UNIX2DOS 2006-05-05 11:55:53 +00:00
Rob Landley 552b56dfd1 Not quite compiler independent, but we've never tried to be gcc independent
anyway.  This is at least less ugly than what was there before, and fixes
building all sources at once.
2006-05-04 21:22:27 +00:00
Rob Landley 3b89039c25 It was sitting there, in the patches directory, for years. It was delete it
or apply it.  It's small, simple, evil, part of SUSv3, and we can switch it
off.
2006-05-04 20:56:43 +00:00
Rob Landley 846fe0c045 There aren't any bzip2 based RPMs. If people want to experiment with new
packaging formats, there's ipkg and such...
2006-05-04 19:57:34 +00:00
Rob Landley b1c3fbc677 CONFIG->ENABLE migration. 2006-05-04 19:52:28 +00:00
Rob Landley 0c43046fde Fix allbareconfig. 2006-05-04 19:51:22 +00:00
Bernhard Reutner-Fischer 3916b2a560 - add script to check for missing help entries of config options
Currently we have these errors:

./modutils/Config.in: No helptext for 'CONFIG_FEATURE_QUERY_MODULE_INTERFACE'
./networking/Config.in: No helptext for 'CONFIG_IPADDR'
./networking/Config.in: No helptext for 'CONFIG_IPLINK'
./networking/Config.in: No helptext for 'CONFIG_IPROUTE'
./networking/Config.in: No helptext for 'CONFIG_IPTUNNEL'
./coreutils/Config.in: No helptext for 'CONFIG_UNIX2DOS'
2006-05-04 11:38:33 +00:00
Rob Landley 7c94bed234 Big dead code elimination pass from Garrett. 2006-05-03 21:58:45 +00:00
Rob Landley db2ab89b7c Build break fix from Bernhard fischer, fixing fallout from svn 14974. (My bad.) 2006-05-03 21:39:28 +00:00
Rob Landley f76cd964ec Whitespace and documentation cleanup from Dennis Vlasenko. 2006-05-03 21:23:15 +00:00
Rob Landley 425e7584a4 Patch from Rich Felker to make ls use libc's qsort. 2006-05-03 20:22:03 +00:00
Rob Landley 1801e9cde7 Rich Felker writes:
mistake in a macro caused statement before declaration.
2006-05-03 20:19:14 +00:00
Rob Landley 035ef5659e Patch from Garrett Kajmowicz to move a lot of #defines into the
header file.
2006-05-03 20:05:18 +00:00
Rob Landley 2584e9b39f Remove HDIO_GETGEO_BIG which is dead (removed from 2.6) and was pointless back
in 2.4 (it fetched the same hd_geometry struct only with uint cylinders instead
of ushort cylinders: nothing that big has ever accurately reported gemoetry,
it's all LBA.

Also stop declaring the hd_geometry struct static: it's two chars, a short, and
a long for a grand total of 8 bytes.  That can go on the stack.
2006-05-03 20:00:00 +00:00
Rob Landley 0f0b645f73 Use ATTRIBUTE_NORETURN as suggested by tito, plus a few in-passing cleanups. 2006-05-03 18:28:06 +00:00
Rob Landley c5598177bc Patch from Jason Schoon to add optional SIGUSR1 support to dd. 2006-05-02 22:44:04 +00:00
Rob Landley 67d5b8b5b1 Minor tweaks: remove traces of old $COMMAND environment variable. 2006-05-02 21:39:04 +00:00
Rob Landley 2631486f1b Patch from Shaun Jackman:
ls has an ugly bug. ls uses an array of pointers, the elements of
which are all in a linked list. To free the elements, instead of
freeing all the elements in the array, array[0..nelements], it frees
by iterating the linked list starting at array[0], which it assumes is
the head of the list. Unfortunately, ls also sorts the array! So,
array[0] is no longer the head, but somewhere in the middle of the
linked list. This patch fixes this bug, and also adds an
ENABLE_FEATURE_CLEAN_UP stanza.
2006-05-02 19:46:52 +00:00
Rob Landley 6389ff1115 Patch from tito removing obsolete code. 2006-05-01 19:28:53 +00:00
Rob Landley c488f87953 Notes on portability, and on when #include <linux/blah> is appropriate. 2006-05-01 05:26:01 +00:00
Rob Landley 73f54702bc Fixup a build break if ENABLE_SHOW_USAGE switched off. (Fallout from the
compressed usage messages patch).
2006-05-01 00:53:40 +00:00
Rob Landley 3ea66a805d Patches from Denis Vlasenko to rework "current_name" handling and remove
print_current_name().
2006-04-29 20:08:40 +00:00
Rob Landley 8a6254994c Patch from Denis Vlasenko:
* Do not initialize globals to 0, it is done automatically
* unsigned short -> uint16_t,  unsigned int -> uint32_t
  where appropriate (did it ever work on Alphas?)
* triple sync() is silly - removed
* check_zone_nr uses check_zone_nr2 now
* remove trailing periods from messages, uppercase first letter
2006-04-29 20:05:17 +00:00
Rob Landley 9950cab8e0 Patch from Denis Vlasenko:
ix bug (inode_map and zone_map are char* pointers,
sizeof() on them gives 4 or 8)
2006-04-29 20:03:54 +00:00
Rob Landley 5bc3f05a23 Remove some unused code pointed out by Tito, plus a slightly more graceful
way of handling endianness.
2006-04-29 19:11:24 +00:00
Rob Landley a3e4f38f7b Style fixes from Denis Vlasenko. 2006-04-29 16:06:31 +00:00
Rob Landley 5f8b5ecda2 Another patch from Denis Vlasenko:
Make hdparm smaller:
* Make bb_ioctl return the status
* Replace ioctl with bb_ioctl in a few places
* Add bb_ioctl_alt, use where appropriate (four places)
* unsigned char args1[4+512] = {WIN_IDENTIFY,0,0,1,};
  ate 0.5k of rodata, fix that
2006-04-29 16:03:40 +00:00
Rob Landley e5b281f89e From Dennis Vlasenko, Make hdparm smaller:
* Use combined no_scsi_no_xt()
 * Have common unsigned char args[4] = {WIN_SETFEATURES,0,0,0};
2006-04-29 15:49:18 +00:00
Rob Landley 2e2d752d49 Cleanup to hdparm by tito. 2006-04-29 15:23:33 +00:00
Mike Frysinger 2514042661 termios.h is already included so dont include sys/termios.h as well 2006-04-29 04:45:22 +00:00
Mike Frysinger 02fe81033f detect more obsolete headers 2006-04-29 04:44:08 +00:00
Mike Frysinger 59c6baedf7 just include fcntl.h not sys/fcntl.h 2006-04-29 04:43:50 +00:00
Mike Frysinger 706f8f6de5 just include fcntl.h not sys/fcntl.h 2006-04-29 04:43:31 +00:00
Mike Frysinger f054be12de Rob Sullivan writes: rewrite the regex handling to improve stability 2006-04-29 04:21:10 +00:00
Mike Frysinger 12ef09b818 compile.h is incorrect; create a new do_link.h and use that for bb_mkdep and usage 2006-04-29 04:19:10 +00:00
Mike Frysinger fe6bb3853c use pretty output for scripts/bb_mkdep and scripts/usage 2006-04-29 04:12:36 +00:00
Bernhard Reutner-Fischer 3737c03630 - rerun gcse pass after reload, enable whole-program iff we are not building
the lib (due to bug in gcc; see comment.)
I would have run the testsuite to check if everything is still behaving, but
unfortunately i cannot run the testsuite anymore: it just sits there and does
nothing even with a pristine checkout and an old gcc.
srcdir=/tmp/busybox/testsuite /tmp/busybox/testsuite/runtest 
PASS: Applet order
FAIL: Common typos
PASS: Obsolete function usage
PASS: Obsolete function usage
<spins, ^C>
make[1]: *** [check] Interrupt
make: *** [check] Interrupt

I've just corrected that wrong double-printing.

Anyway. with gcc-4.1-HEAD from earlier today, we now have for
defconfig+ COMPILE_AT_ONCE:


880 -rwxr-xr-x  1 433 433 893476 Apr 28 21:41 busybox.oorig-4.0
860 -rwxr-xr-x  1 433 433 874560 Apr 28 21:36 busybox.oorig
844 -rwxr-xr-x  1 433 433 858752 Apr 28 21:49 busybox

   text    data     bss     dec     hex filename
 879920   11568 1039148 1930636  1d758c busybox.oorig-4.0
 862802   10192 1038796 1911790  1d2bee busybox.oorig
 848066    9100 1037536 1894702  1ce92e busybox

values for 4.0.2 just added for reference..
2006-04-28 20:02:29 +00:00
Bernhard Reutner-Fischer 15545b1db9 - print "Obsolet headers" instead of "Obsolete function usage" when checking
for obsolet includes.
2006-04-28 19:53:48 +00:00
Rob Landley a2d9a1752c More usage.h cleanups, with collateral changes to httpd. Specifically,
most of our CONFIG entries switch stuff on instead of off when enabled, so fix
the gratuitously reversed INETD thing.
2006-04-28 19:38:04 +00:00
Rob Landley 0e6a3e14e4 Patch from tito to update output of hdparm. 2006-04-28 01:33:30 +00:00
Rob Landley 7e21d5f6b1 Patch from Dennis Vlasenko to add the option to compress help text. 2006-04-27 23:34:46 +00:00
Rob Landley d5b9428bb6 Re-wordwrap the new tests, and fix seq.c to pass them. 2006-04-27 22:36:32 +00:00
Bernhard Reutner-Fischer a345dc855f - add two regression tests for seq.
"seq two arguments equal, arbitrary negative step" fails but should pass..
2006-04-27 13:46:56 +00:00
Bernhard Reutner-Fischer fc477f4bc6 - add note about crond 2006-04-26 19:40:15 +00:00
Bernhard Reutner-Fischer 06a81d368e - patch from Denis Vlasenko to make sizes PHONY and to add objsizes which prints
the sizes of the individual object files.
2006-04-26 10:10:25 +00:00
Rob Landley 5fe8d5b9c5 Convert a chunk of usage.h to USE_ and SKIP_ (more to do there), and fix a
DEFALT typo in du while I was there.
2006-04-25 22:40:53 +00:00
Rob Landley 7818a422bc Portability tweak from Shaun Jackman, don't include asm/page.h directly. 2006-04-25 18:42:23 +00:00
Rob Landley 997650b972 From Denis Vlasenko:
* CPU% = process[i].ticks/sum(process[i].ticks) * busy_cpu_ticks/total_cpu_ticks
* got rid of empty line under "Load average" line
  and used last line - +2 visible processes
* do not do float conversion of loadavg, just read it as string from /proc
* fix display on small screens
* dropped unused .stime, .utime fields
* a few variables were renamed
* style fixes
2006-04-24 23:13:46 +00:00
Bernhard Reutner-Fischer 56fbd21fa7 - return ret so we return something meaningful. 2006-04-24 17:41:29 +00:00
Mike Frysinger 70cbb6e026 Jason Schoon writes: Attached is a patch to display the usage message if fuser is called with no arguments, rather than doing no work and failing silently. 2006-04-21 22:04:05 +00:00
Mike Frysinger 10f55b1dae Jason Schoon writes: This makes the case where LFS is not defined, but fdisk is configured with large disk support use the pretty build rules. 2006-04-21 21:59:22 +00:00
Mike Frysinger 586ea61284 2006-04-20 Shaun Jackman <sjackman@gmail.com>
* Makefile: Build a bFLT binary.
        * Rules.mak: Ditto.
2006-04-21 01:18:07 +00:00
Ned Ludd 791976490b - passwd doesnt use salt with md5 passwords; bug #604 thanks taviso 2006-04-21 00:40:35 +00:00
Mike Frysinger f162183527 kill signed warnings 2006-04-20 04:00:11 +00:00
Rob Landley 998dbee6d9 Patch from Jean Wolter:
it looks like the introduced support for character classes and
equivalence classes is not correct. The attached patch tries to fix
some symptoms and tries to make tr behave like gnu tr for the added
test cases. The patch

 - removes if clauses with side effects
 - fixes handling of buffer pointer (strcat added characters to the
   buffer without increasing the buffer pointer)
 - re-arranges character classes to match ASCII order

regards,
Jean
2006-04-19 22:22:06 +00:00
Rob Landley 5076eb4af9 svn 14824 broke -funsigned-char and possibly building out of tree, because
$(srcdir) can't bind early since it's set to a different value in each subdir.
If it binds early, it's blank, hence an empty -I which eats the next option
as a directory to look for #include files in.

So CFLAGS has to bind late, but the check_gcc stuff should only get run once.
I added a "make V=2" mode to show when check_gcc gets run, and turned WARNINGS
into a CFLAGS line since it was always getting added anyway.
2006-04-19 20:32:27 +00:00
Rob Landley 856489b63c New applet cksum, from Rob Sullivan. 2006-04-18 20:57:28 +00:00
Rob Landley bbd50b58ea Remove some #if 0 code. 2006-04-18 20:42:39 +00:00
Rob Landley e4386342b4 Simplify the GPL boilerplate. 2006-04-18 20:41:51 +00:00
Bernhard Reutner-Fischer 18260d5099 - typo: s/derefernce/dereference/g
Thanks to P.J. Day.
2006-04-18 14:17:49 +00:00
Bernhard Reutner-Fischer 0c013f5fc7 - commentary typo and superfluous whitespace removal in weird messages. 2006-04-18 12:46:56 +00:00
Bernhard Reutner-Fischer 38fc692e38 - improve wording in some help texts a little bit. 2006-04-18 11:21:07 +00:00
Bernhard Reutner-Fischer 074fe347b7 - add typo s/deamon/daemon/g 2006-04-18 11:15:19 +00:00
Bernhard Reutner-Fischer ea46f456d4 - patch from P.J. Day to rely on the automatic indenting provided by depends. 2006-04-18 11:11:40 +00:00
Bernhard Reutner-Fischer ba31d27249 - enable dumpleases applet again; bad rob 2006-04-18 10:04:08 +00:00
Bernhard Reutner-Fischer 9b68dbd878 - add grep for typo s/algorithic/algorithmic/g 2006-04-18 08:44:19 +00:00
Bernhard Reutner-Fischer 54f75ee300 - BusyBox is under GPL.
in http://www.busybox.net/lists/busybox/2006-April/020364.html Denis Vlasenko
  said when asked which license to use for these files:
  "Sure. LGPL or GPL is fine with me."
  Adjusting accordingly.
2006-04-18 08:24:13 +00:00
Bernhard Reutner-Fischer 2949577981 - simplify config options of the ip applet. 2006-04-18 08:11:37 +00:00
Rob Landley a2e98043d5 From Rob Sullivan: Fix a segfault with searching, plus some cleanups. 2006-04-18 01:53:41 +00:00
Rob Landley 29ba9796be Robert Eggers noticed that nfsmount would sometimes incorrectly return success. 2006-04-17 23:02:57 +00:00
Rob Landley 0edbad1a7c Glenn gave permission for GPLv2 "or later". 2006-04-17 22:49:30 +00:00
Rob Landley 026147a48f Patch from Tito to fix printing null and make output look like hdparm 6.3. 2006-04-17 22:29:13 +00:00
Rob Landley 8b1f11da52 Remove a superfluous quote and more non-generic standalone code. 2006-04-17 21:49:34 +00:00
Rob Landley 559f7d8e92 Elf dynamic linker stuff from Rich Felker. 2006-04-17 21:47:03 +00:00
Mike Frysinger 5c16988910 enable udhcp applets again; bad rob 2006-04-17 02:00:49 +00:00
Mike Frysinger 20c22e0883 just use the stack to kill memleak and return if user didnt give us anything to match 2006-04-16 21:41:00 +00:00
Mike Frysinger bf2d9905ca use xmalloc, dont hardcode length of string, and get rid of pointless call to memset 2006-04-16 21:30:47 +00:00
Mike Frysinger f8346038e9 kill off pointless malloc.h include 2006-04-16 21:17:00 +00:00
Mike Frysinger b66c931fad kill pointless memory.h includes 2006-04-16 21:15:42 +00:00
Mike Frysinger d017d73399 add a check for obsolete headers 2006-04-16 21:14:59 +00:00
Bernhard Reutner-Fischer af07a00082 - fix typo. Thanks to David Moberg for pointing this out. 2006-04-16 20:56:03 +00:00
Mike Frysinger 00d10a94f3 uncuddle if statements 2006-04-16 20:54:19 +00:00
Mike Frysinger f284c767e5 use more boiler plate GPL notices 2006-04-16 20:38:26 +00:00
Mike Frysinger 3a2b103eea uncuddle brackets 2006-04-16 20:34:26 +00:00
Mike Frysinger dbd8c3b295 add some tests for common typos and for obsolete functions 2006-04-16 06:09:46 +00:00
Mike Frysinger 1a54030445 use memmove() instead of bcopy() 2006-04-16 05:58:21 +00:00
Mike Frysinger 4b7b8a58a1 touchup comment 2006-04-16 05:55:15 +00:00
Mike Frysinger 0436b9f482 use strchr() not index() 2006-04-16 05:54:31 +00:00
Mike Frysinger 78bd504947 use memcmp() not bcmp() 2006-04-16 05:51:47 +00:00
Rob Landley b0a2d6c19d Remove code for protocols we don't properly support. (Most of this could
never be selected via menuconfig anyway.)  If somebody wants one of these
protocols, ask on the list for us to support it _properly_.
2006-04-14 20:07:33 +00:00
Rob Landley da0dcd1050 Patch from Robert P Day to remove standalone code from httpd. (Busybox has
its own make standalone planned as a general solution to this for all
applets.)
2006-04-14 19:46:19 +00:00
Rob Landley e66c7efc31 Busybox is under the GPL. 2006-04-14 19:25:01 +00:00
Rob Landley d086b504c3 Hard wiring configuration symbol values into the code defeats the purpose
of _having_ configuration symbol values.

Also, changing #ifdef CONFIG to #if ENABLE isn't nearly as useful as changing
them to if (ENABLE) or USE()/SKIP()...
2006-04-14 02:32:29 +00:00
Rob Landley 346d6d9af2 The link to Bernhard's subversion branch belongs in subversion.html (where
it already is).
2006-04-14 00:55:46 +00:00
Rob Landley 2ec922eed5 Patch from Robert P Day: let menuconfig indent stuff for us, we don't have
to do it in Config.in.
2006-04-13 23:22:16 +00:00
Bernhard Reutner-Fischer 6b4377f333 - remove unneeded include, use shorter boilerplate while at it and also
shrink filter_accept_reject_list() a tiny bit while at it.
   text    data     bss     dec     hex filename
     59       0       0      59      3b filter_accept_reject_list.o
     62       0       0      62      3e filter_accept_reject_list.o.orig
2006-04-13 13:32:16 +00:00
Bernhard Reutner-Fischer c2cb0f32b4 - patch from Denis Vlasenko to add and use bb_xopen3() 2006-04-13 12:45:04 +00:00
Bernhard Reutner-Fischer 4f3d2deaa4 - better wording.
Closes bug #656.
2006-04-12 19:14:35 +00:00
Bernhard Reutner-Fischer 34fc71f5a3 - note to think about eventually ditching vdprintf() 2006-04-12 18:50:19 +00:00
Bernhard Reutner-Fischer d9cf7ac781 - patch from Denis Vlasenko to add and use bb_xchdir() 2006-04-12 18:39:58 +00:00
Bernhard Reutner-Fischer 67f641e75b - patch from Denis Vlasenko to add bb_xbind() and bb_xlisten() 2006-04-12 18:24:37 +00:00
Bernhard Reutner-Fischer 2c99851181 - patch from Denis Vlasenko to add and use bb_xdaemon() 2006-04-12 18:09:26 +00:00
Bernhard Reutner-Fischer dac7ff15b7 - patch from Denis Vlasenko to add and use bb_xsocket() and to use
bb_xopen some more while at it.
  Also use shorter boilerplate while at it.
2006-04-12 17:55:51 +00:00
Bernhard Reutner-Fischer 79865bc507 - add verbatim cp of http://www.gnu.org/copyleft/lesser.txt 2006-04-12 17:46:18 +00:00
Bernhard Reutner-Fischer fc5f318896 - use C99 %j format to print intmax.
Closes bugs #802 and #743
2006-04-12 08:03:11 +00:00
Bernhard Reutner-Fischer cb44816ba3 - add and use bb_opendir(), bb_xopendir().
text    data     bss     dec     hex filename
 889445    9392 1035784 1934621  1d851d busybox.gcc-4.2.orig
 889297    9392 1035784 1934473  1d8489 busybox.gcc-4.2
 889009    9820 1037860 1936689  1d8d31 busybox.gcc-4.1.orig
 888817    9820 1037860 1936497  1d8c71 busybox.gcc-4.1
2006-04-12 07:35:12 +00:00
Bernhard Reutner-Fischer d0ea52ee04 - pin the CFLAGS to make sure that we don't have to re-evaluate the
check_gcc over and over again. Makes make -j work for me..
2006-04-11 20:48:24 +00:00
Bernhard Reutner-Fischer a23a6d7819 - include netinet/in.h for struct sockaddr_in.
Closes bug #735
2006-04-11 18:15:17 +00:00
Bernhard Reutner-Fischer e7f8a32929 - httpd in inetd mode: POST from IE (6) ends up in 'cannot display page'
Closes #827
2006-04-11 13:51:50 +00:00
Bernhard Reutner-Fischer cc295fb261 - comment out the check-referer lines. 2006-04-11 08:55:19 +00:00
Bernhard Reutner-Fischer e0e9886c19 - we seem to use h3, so make it consistent. 2006-04-11 08:49:01 +00:00
Bernhard Reutner-Fischer 91f604771b - update screenshot to reflect the busybox-1.1.2 stable release. 2006-04-11 08:42:58 +00:00
Bernhard Reutner-Fischer 9460f66e4e - tweak visibility of label expected_hwif_error as it's only needed for
CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF or CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF
2006-04-11 08:01:29 +00:00
Bernhard Reutner-Fischer 0b257d411d - remove implied closing paragraph
- add (improper but pretty) border='0'
2006-04-11 07:52:20 +00:00
Mike Frysinger f785255a44 Robert P. J. Day writes: even in the header file, make it clear that the routine depends on __uClinux__ 2006-04-11 04:04:40 +00:00
Bernhard Reutner-Fischer 776fe22756 - add note pointing to the stable branch, so users can pickup the current
stable version with fixes via svn.
2006-04-10 20:15:46 +00:00
Rob Landley bb5b2ffbc5 Announce 1.1.2. 2006-04-10 20:04:32 +00:00
Bernhard Reutner-Fischer 905a58a303 - poke bot 2006-04-10 19:47:46 +00:00
Bernhard Reutner-Fischer 8326d5e31b - add a colorful "valid HTML 4.01 Transitional" button to be able to check the referer easily.
Just rip it out if this is not considered generally useful.. TIA.
2006-04-10 19:40:51 +00:00
Bernhard Reutner-Fischer 3515f6e043 - make it resemble html. 2006-04-10 19:16:50 +00:00
Bernhard Reutner-Fischer fdf2b50316 - make it resemble english and fix typo s/interperet/interpret/g; 2006-04-10 18:40:27 +00:00
Rob Landley 81c40b39cb Patch from Tito to unify deluser and delgroup, and generally shrink code. 2006-04-10 18:03:17 +00:00
Bernhard Reutner-Fischer ca7166fe9d - put udhcp back in (Rob, you removed this in r14787 by accident..). 2006-04-10 18:02:12 +00:00
Rob Landley 4a8d9effca Notes about pic, static linking, and debugging dynamic linking. 2006-04-10 17:54:23 +00:00
Rob Landley 0ebecac02e Second verse, same as the first. 2006-04-10 17:34:12 +00:00
Rob Landley ea4c53ca43 Missing dependency spotted by Robert P Day. 2006-04-10 17:32:05 +00:00
Rob Landley 8ad70871b5 I forgot to re-enable shared library build after 1.1.1. (Undo svn 14590.) 2006-04-10 17:28:27 +00:00
Rob Landley c57ec37959 Patch from Rob Sullivan to consolidate crc32 table generation. 2006-04-10 17:07:15 +00:00
Rob Landley 998f449375 We use -funsigned-char now, so having a separate RESERVE_CONFIG_UBUFFER is
a bit silly.  Wean of that where it currently makes no difference...
2006-04-10 16:40:47 +00:00
Rob Landley 72615752db Modprobe update from Ignacio García Pérez, updating support for modprobe.conf. 2006-04-10 16:09:52 +00:00
Bernhard Reutner-Fischer 6554de06fe - fix typo introduced in the last commit. 2006-04-10 12:32:52 +00:00
Bernhard Reutner-Fischer a4acf669f4 - typo: s/biltin/builtin/g 2006-04-10 12:26:47 +00:00
Rob Landley 3e72c5931c Another size reduction patch from Garrett. 2006-04-06 22:49:04 +00:00
Bernhard Reutner-Fischer bc14214018 - patch from Rob Sullivan to add support for -L 2006-04-06 16:07:08 +00:00
Bernhard Reutner-Fischer 5fb0fecc1f - shrink it a little bit and make it buildable with gcc-2.95
text    data     bss     dec     hex filename
   7332       4      92    7428    1d04 diff.o-gcc-4.2-HEAD.orig
   7185       4      92    7281    1c71 diff.o-gcc-4.2-HEAD.new
   7336       4      92    7432    1d08 diff.o-gcc-4.1-HEAD.orig
   7148       4      92    7244    1c4c diff.o-gcc-4.1-HEAD.new
   7485       4      92    7581    1d9d diff.o-gcc-4.0.orig
   7318       4      92    7414    1cf6 diff.o-gcc-4.0.new
   7511       4      92    7607    1db7 diff.o-gcc-3.4.orig
   7252       4      92    7348    1cb4 diff.o-gcc-3.4.new
   8214       4      92    8310    2076 diff.o-gcc-3.3.orig
   7882       4      92    7978    1f2a diff.o-gcc-3.3.new
      -       -       -       -       - diff.o-gcc-2.95.orig
   8238       8      88    8334    208e diff.o-gcc-2.95.new
2006-04-06 11:28:19 +00:00
Bernhard Reutner-Fischer cc4003f778 - remove unused args.
text    data     bss     dec     hex filename
   7353       4      92    7449    1d19 coreutils/diff.o-gcc-4.2.oorig
   7332       4      92    7428    1d04 coreutils/diff.o
2006-04-06 08:23:11 +00:00
Bernhard Reutner-Fischer 693a93608a - move code around to avoid the need for the prototypes. 2006-04-06 08:15:24 +00:00
Bernhard Reutner-Fischer 8f7d389700 - new applet diff. Rob Sullivan writes:
Here's my attempt at a mini diff applet - it's adapted from the code at
http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/diff/, and only supports
unified diffs.

I've busyboxified everything to a reasonable degree, so I think the code is
suitable enough to be included, but there's still a fair bit of cleaning up
to be done.
2006-04-06 08:11:08 +00:00
Bernhard Reutner-Fischer e11a01cc34 - include inttypes.h as pointed out by Jason Schoon.
- use shorter boilerplate and switch to USE_FEATURE_STAT_FORMAT while at it.
2006-04-05 17:19:37 +00:00
Bernhard Reutner-Fischer 886f6afc8a - this applet should peruse USE_FEATURE_TFTP_... 2006-04-05 16:47:02 +00:00
Bernhard Reutner-Fischer 061fd0a353 - make sure that the label expected_hwif_error is visible even when
CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF isn't set.
2006-04-05 16:37:25 +00:00
Bernhard Reutner-Fischer fa939aae81 - include proper headers. 2006-04-05 16:21:37 +00:00
Bernhard Reutner-Fischer 465874f3a3 - use proper macros to print intmax_t.
PRIuMAX and PRIxMAX are defined in inttypes depending on the wordsize.
2006-04-05 14:57:59 +00:00
Paul Fox b7b24d61e0 adjust ifdefs for inclusion of string_insert() routine 2006-04-05 14:17:24 +00:00
Rob Landley 19af279d16 Kumar spotted another bug: if we autodetect nfs and they haven't specified the
fstype, it should be set to nfs.
2006-04-05 01:43:39 +00:00
Rob Landley e104d5fdcb Some tests were always true. We need comm.tests... 2006-04-04 19:26:37 +00:00
Rob Landley 9a2dd51237 Rewrite/shrink by tito. 2006-04-04 19:19:53 +00:00
Rob Landley ab8736064b You'd think there'd be a compiler warning for "pointless if", wouldn't you? 2006-04-04 16:56:04 +00:00
Rob Landley 3b84dfc2a8 Avoid spurious error message. (Technically applet order should be "SKIPPED"
when you move the testsuite directory outside of busybox and run it, but as
long as the test doesn't fail we're ok.)
2006-04-04 15:39:23 +00:00
Bernhard Reutner-Fischer dee811a53d - remove unused ext2fs_find_first_bit_set() and ext2fs_find_next_bit_set() 2006-04-04 12:17:24 +00:00
Bernhard Reutner-Fischer 89aaf4e249 - pull in prototype for e2fsck_main. 2006-04-04 12:10:28 +00:00
Bernhard Reutner-Fischer 2b398bec9c - make sure that we see all lib*/.c in IMA-mode even when not building the .so 2006-04-03 21:16:52 +00:00
Bernhard Reutner-Fischer 421d9e5941 - move buffer allocation schemes to libbb.h
- include the correct headers: applets need busybox.h while lib* need libbb.h
2006-04-03 16:39:31 +00:00
Bernhard Reutner-Fischer 101a470068 - make append_option and multiconvert static. 2006-04-03 15:46:14 +00:00
Bernhard Reutner-Fischer ebd1355828 - coalesce printf calls.
text    data     bss     dec     hex filename
   3474       4      96    3574     df6 networking/arping.o.orig
   3424       4      96    3524     dc4 networking/arping.o
2006-04-03 12:29:12 +00:00
Bernhard Reutner-Fischer a0f75e2bba - use bb_opt_complementally; Saves another 14 bytes. (thanks again, vodz) 2006-04-03 11:52:01 +00:00
Bernhard Reutner-Fischer a38330c366 - do away with useless fwd-decls, redundant bb_printf calls, silence warning
about comparing signed and unsigned and make stuff static.
   text    data     bss     dec     hex filename
   6944       0       0    6944    1b20 util-linux/ipcs.o.oorig
   6509       0       0    6509    196d util-linux/ipcs.o

TODO: bb_getopt_ulflags, and further simplifications
2006-04-03 11:25:48 +00:00
Bernhard Reutner-Fischer 6153629097 - set flags in a more reasonable manner. Thanks, vodz.
text    data     bss     dec     hex filename
   3520       4      96    3620     e24 networking/arping.o.oorig
   3488       4      96    3588     e04 networking/arping.o
2006-04-03 09:46:29 +00:00
Bernhard Reutner-Fischer cfb53dfd5e - include proper prototypes in libunarchive. 2006-04-02 21:50:01 +00:00
Bernhard Reutner-Fischer 7ab5f4d03d - janitorial: huft_build is never used outside of decompress_unzip.c and has no
prototype (which suggests that it's of no general use) so make it static for now.
2006-04-02 21:23:40 +00:00
Bernhard Reutner-Fischer 9a67ca309c - janitorial: include proper prototypes in libiproute. 2006-04-02 21:14:19 +00:00
Bernhard Reutner-Fischer 7f77810633 - switch Warning Of the Week to wrong or missing prototypes.
e.g. archival/uncompress.c wrongly includes libbb.h instead of busybox.h
  decompress_bunzip2.c,open_transformer.c don't include the proper "unarchive.h"
  etc, etc.
2006-04-02 20:41:55 +00:00
Bernhard Reutner-Fischer a1bccc0ba8 - typos: s/compatability/compatibility/g;s/compatable/compatible/g; 2006-04-02 20:17:55 +00:00
Bernhard Reutner-Fischer 9457e70357 - typo: s/compenent/component/g
add a bit of documentation.
2006-04-02 20:12:31 +00:00
Rob Landley a13cca9cf4 New version from Tito. 2006-04-02 18:57:20 +00:00
Mike Frysinger 819b56b64a work outside of the srctree 2006-04-01 20:38:22 +00:00
Rob Landley 03e78e75f3 The build broke for me on gcc 4.0.3 due to an #include having the wrong patch. 2006-04-01 17:36:31 +00:00
Rob Landley 20fef96dd8 Bug spotted by Kumar Gala. Hopefully this fixes it... 2006-04-01 17:32:52 +00:00
Rob Landley 07a637df47 Patch from KRONSTORFER Horst to Fix a size mismatch in ping, such as the 56/84
mismatch inthe following example:
  # ping -c 1 172.16.2.1
  PING 172.16.2.1 (172.16.2.1): 56 data bytes
  84 bytes from 172.16.2.1: icmp_seq=0 ttl=64 time=0.2 ms
2006-04-01 17:28:11 +00:00
Mike Frysinger b0c5445bf5 new test for source code sanity 2006-04-01 01:36:32 +00:00
Mike Frysinger 5dd1236f49 move source code tests out into a sep file rather than just disabling/breaking them 2006-04-01 01:36:13 +00:00
Mike Frysinger 81834531aa remove bogus " 2006-04-01 01:35:52 +00:00
Mike Frysinger 2cf38523a1 silence error if busybox.links doesnt exist and run tests that begin with "all_" 2006-04-01 01:35:33 +00:00
Rob Landley 43ac88849b Ext2fs cleanup from Garrett Kajmowicz. 2006-04-01 00:40:33 +00:00
Bernhard Reutner-Fischer 5cf905a871 - use RESERVE_CONFIG_BUFFER and a bit of whitespace-cleanup. defconfig:
text	   data	    bss	    dec	    hex	filename
   1307	      0	      0	   1307	    51b	util-linux/hwclock.o.oorig
   1255	      0	      0	   1255	    4e7	util-linux/hwclock.o
2006-03-31 22:36:15 +00:00
Bernhard Reutner-Fischer 81901a096c - add option to suppress the terse usage messages. Saves 6.8k for defconfig:
text	   data	    bss	    dec	    hex	filename
 861791	  11264	1039140	1912195	 1d2d83	busybox.have-terse-usage
 854799	  11264	1039140	1905203	 1d1233	busybox.no-terse
2006-03-31 18:43:55 +00:00
Bernhard Reutner-Fischer 2766eedde8 - use RESERVE_CONFIG_BUFFER. For defconfig this gives:
text	   data	    bss	    dec	    hex	filename
   3627	      4	    120	   3751	    ea7	networking/arping.o.oorig
   3548	      4	     96	   3648	    e40	networking/arping.o.r14710
   3520	      4	     96	   3620	    e24	networking/arping.o
2006-03-31 18:13:42 +00:00
Bernhard Reutner-Fischer e47c4cbd4d - update help text.
the interface argument is now a lowercase 'i' to match the big arping
  commandline-syntax.
2006-03-31 18:10:31 +00:00
Bernhard Reutner-Fischer 137669449a - shrink it a bit further.
text	   data	    bss	    dec	    hex	filename
   3627	      4	    120	   3751	    ea7	networking/arping.o.oorig
   3548	      4	     96	   3648	    e40	networking/arping.o
2006-03-31 18:02:46 +00:00
Rob Landley 8ea5205726 Shrink patch from Bernhard Fischer. 2006-03-30 21:50:57 +00:00
Bernhard Reutner-Fischer 1f6dc6d358 - rename clean_up in tune2fs and mke2fs to be prefixed with their applet names.
Purely cosmetic to ease readability.
2006-03-30 13:54:30 +00:00
Bernhard Reutner-Fischer 214744dba1 - fix paste'o which i overlooked when applying dalias' fmt stuff. 2006-03-30 13:38:19 +00:00
Rob Landley a8e2760924 Clarify. 2006-03-30 02:01:48 +00:00
Rob Landley daa4a6dcbd Update ipaddr help to match reality. 2006-03-30 01:59:30 +00:00
Paul Fox ef81ce620c fix from David Daney, on busybox mailing list:
> The problem is that if the zcip protocol times out at about the same 
 > time another ARP packet is being received, the newly calculated timeout 
 > may be set to wait forever.  This prevents the protocol from progressing 
 > through its various states.
 > 
 > The Fix is to set the timeout to zero if it used to be a positive 
 > number, but it has already expired.  This causes the next protocol state 
 > to be entered immediately instead of never.
 > 
 > If OK please commit.
 > 
 > Also note that if you may have to apply the patch on this page:
 > 
 > http://www.science.uva.nl/research/air/wiki/LinkLocalARPMeasurements
 > 
 > To the linux kernel to get proper zcip behavior.
 >
2006-03-29 23:01:33 +00:00
Bernhard Reutner-Fischer d409c3a2f7 - Rich Felker writes: fix invalid printf format strings
http://busybox.net/lists/busybox/2006-March/019568.html

   text	   data	    bss	    dec	    hex	filename
 900619	  10316	1038724	1949659	 1dbfdb	busybox.oorig
 900603	  10316	1038724	1949643	 1dbfcb	busybox
2006-03-29 22:34:47 +00:00
Bernhard Reutner-Fischer abaef6565e - warn a bit more verbosely about fmt stuff for non-release versions 2006-03-29 22:28:27 +00:00
Bernhard Reutner-Fischer 6018225238 - mark trunk as 1.2.0-pre0 2006-03-29 22:22:37 +00:00
676 changed files with 19098 additions and 24519 deletions

No files matched your search

+98 -53
View File
@@ -13,9 +13,26 @@ menu "Busybox Settings"
menu "General Configuration"
config CONFIG_NITPICK
bool "See lots more (probably unnecessary) configuration options."
default n
help
Some BusyBox applets have more configuration options than anyone
will ever care about. To avoid drowining people in complexity, most
of the applet features that can be set to a sane default value are
hidden, unless you hit the above switch.
This is better than to telling people to edit the busybox source
code, but not by much.
See http://en.wikipedia.org/wiki/Fibber_McGee_and_Molly#The_Closet
You have been warned.
choice
prompt "Buffer allocation policy"
default CONFIG_FEATURE_BUFFERS_USE_MALLOC
depends on CONFIG_NITPICK
help
There are 3 ways BusyBox can handle buffer allocations:
- Use malloc. This costs code size for the call to xmalloc.
@@ -37,15 +54,39 @@ config CONFIG_FEATURE_BUFFERS_GO_IN_BSS
endchoice
config CONFIG_SHOW_USAGE
bool "Show terse applet usage messages"
default y
help
All BusyBox applets will show help messages when invoked with
wrong arguments. You can turn off printing these terse usage
messages if you say no here.
This will save you up to 7k.
config CONFIG_FEATURE_VERBOSE_USAGE
bool "Show verbose applet usage messages"
default n
select CONFIG_SHOW_USAGE
help
All BusyBox applets will show more verbose help messages when
busybox is invoked with --help. This will add a lot of text to the
busybox binary. In the default configuration, this will add about
13k, but it can add much more depending on your configuration.
config CONFIG_FEATURE_COMPRESS_USAGE
bool "Store applet usage messages in compressed form"
default y
depends on CONFIG_SHOW_USAGE && CONFIG_NITPICK
help
Store usage messages in compressed form, uncompress them on-the-fly
when <applet> --help is called.
If you have a really tiny busybox with few applets enabled (and
bunzip2 isn't one of them), the overhead of the decompressor might
be noticeable. Also, if you run executables directly from ROM
and have very little memory, this might not be a win. Otherwise,
you probably want this.
config CONFIG_FEATURE_INSTALLER
bool "Support --install [-s] to install applet links at runtime"
default n
@@ -62,25 +103,29 @@ config CONFIG_LOCALE_SUPPORT
Enable this if your system has locale support and you would like
busybox to support locale settings.
config CONFIG_FEATURE_DEVFS
bool "Support for devfs"
default n
help
Enable if you want BusyBox to work with devfs.
config CONFIG_GETOPT_LONG
bool
default y
# bool "Enable support for --long-options"
# default n
# help
# Enable this if you want busybox applets to use the gnu --long-option
# style, in addition to single character -a -b -c style options.
config CONFIG_FEATURE_DEVPTS
bool "Use the devpts filesystem for Unix98 PTYs"
default y if CONFIG_FEATURE_DEVFS
default y
help
Enable if you want BusyBox to use Unix98 PTY support. If enabled,
busybox will use /dev/ptmx for the master side of the pseudoterminal
and /dev/pts/<number> for the slave side. Otherwise, BSD style
/dev/ttyp<number> will be used. To use this option, you should have
devpts or devfs mounted.
devpts mounted.
config CONFIG_FEATURE_CLEAN_UP
bool "Clean up all memory before exiting (usually not needed)"
default n
depends on CONFIG_NITPICK
help
As a size optimization, busybox normally exits without explicitly
freeing dynamically allocated memory or closing files. This saves
@@ -94,15 +139,25 @@ config CONFIG_FEATURE_SUID
bool "Support for SUID/SGID handling"
default n
help
Support SUID and SGID binaries.
With this option you can install the busybox binary belonging
to root with the suid bit set, and it'll and it'll automatically drop
priviledges for applets that don't need root access.
If you're really paranoid and don't want to do this, build two
busybox binaries with different applets in them (and the appropriate
symlinks pointing to each binary), and only set the suid bit on the
one that needs it. The applets currently marked to need the suid bit
are login, passwd, su, ping, traceroute, crontab, dnsd, ipcrm, ipcs,
and vlock.
config CONFIG_FEATURE_SUID_CONFIG
bool "Runtime SUID/SGID configuration via /etc/busybox.conf"
default n if CONFIG_FEATURE_SUID
depends on CONFIG_FEATURE_SUID
help
Allow the SUID / SGID state of an applet to be determined runtime by
checking /etc/busybox.conf. The format of this file is as follows:
Allow the SUID / SGID state of an applet to be determined at runtime
by checking /etc/busybox.conf. (This is sort of a poor man's sudo.)
The format of this file is as follows:
<applet> = [Ssx-][Ssx-][x-] (<username>|<uid>).(<groupname>|<gid>)
@@ -129,7 +184,7 @@ config CONFIG_FEATURE_SUID_CONFIG
config CONFIG_FEATURE_SUID_CONFIG_QUIET
bool "Suppress warning message if /etc/busybox.conf is not readable"
default n
default y
depends on CONFIG_FEATURE_SUID_CONFIG
help
/etc/busybox.conf should be readable by the user needing the SUID, check
@@ -155,6 +210,16 @@ config CONFIG_SELINUX
Most people will leave this set to 'N'.
config CONFIG_BUSYBOX_EXEC_PATH
string "Path to BusyBox executable"
default "/proc/self/exe"
help
When Busybox applets need to run other busybox applets, BusyBox
sometimes needs to exec() itself. When the /proc filesystem is
mounted, /proc/self/exe always points to the currently running
executable. If you haven't got /proc, set this to wherever you
want to run BusyBox from.
endmenu
menu 'Build Options'
@@ -173,21 +238,18 @@ config CONFIG_STATIC
Most people will leave this set to 'N'.
# The busybox shared library feature is there so make standalone can produce
# smaller applets. Since make standalone isn't in yet, there's nothing using
# this yet, and so it's disabled.
config CONFIG_DISABLE_SHARED
bool
default n
config CONFIG_BUILD_LIBBUSYBOX
bool "Build shared libbusybox"
default n
depends on CONFIG_DISABLE_SHARED
help
Build a shared library libbusybox.so which contains all
libraries used inside busybox.
This is an experimental feature intended to support the upcoming
"make standalone" mode. Enabling it against the one big busybox
binary serves no purpose (and increases the size). You should
almost certainly say "no" to this right now.
config CONFIG_FEATURE_FULL_LIBBUSYBOX
bool "Feature-complete libbusybox"
default n if !CONFIG_FEATURE_SHARED_BUSYBOX
@@ -227,33 +289,6 @@ config CONFIG_LFS
cp, mount, tar, and many others. If you want to access files larger
than 2 Gigabytes, enable this option. Otherwise, leave it set to 'N'.
config USING_CROSS_COMPILER
bool "Do you want to build BusyBox with a Cross Compiler?"
default n
help
Do you want to build BusyBox with a Cross Compiler? If so,
then enable this option. Otherwise leave it set to 'N'.
config CROSS_COMPILER_PREFIX
string "Cross Compiler prefix"
default "/usr/i386-linux-uclibc/bin/i386-uclibc-"
depends on USING_CROSS_COMPILER
help
If you want to build BusyBox with a cross compiler, then you
will need to set this to the cross-compiler prefix. For example,
if my cross-compiler is /usr/i386-linux-uclibc/bin/i386-uclibc-gcc
then I would enter '/usr/i386-linux-uclibc/bin/i386-uclibc-' here,
which will ensure the correct compiler is used.
config EXTRA_CFLAGS_OPTIONS
string "Any extra CFLAGS options for the compiler?"
default ""
help
Do you want to pass any extra CFLAGS options to the compiler as
you build BusyBox? If so, this is the option for you... For example,
if you want to add some simple compiler switches (like -march=i686),
or check for warnings using -Werror, just those options here.
config CONFIG_BUILD_AT_ONCE
bool "Compile all sources at once"
default n
@@ -278,17 +313,27 @@ endmenu
menu 'Debugging Options'
config CONFIG_DEBUG
bool "Build BusyBox with Debugging symbols"
bool "Build BusyBox with extra Debugging symbols"
default n
help
Say Y here if you wish to compile BusyBox with debugging symbols.
This will allow you to use a debugger to examine BusyBox internals
while applets are running. This increases the size of the binary
considerably and should only be used when doing development.
If you are doing development and want to debug BusyBox, answer Y.
Say Y here if you wish to examine BusyBox internals while applets are
running. This increases the size of the binary considerably, and
should only be used when doing development. If you are doing
development and want to debug BusyBox, answer Y.
Most people should answer N.
config CONFIG_DEBUG_PESSIMIZE
bool "Disable compiler optimizations."
default n
depends on CONFIG_DEBUG
help
The compiler's optimization of source code can eliminate and reorder
code, resulting in an executable that's hard to understand when
stepping through it with a debugger. This switches it off, resulting
in a much bigger executable that more closely matches the source
code.
choice
prompt "Additional debugging library"
default CONFIG_NO_DEBUG_LIB
@@ -335,7 +380,7 @@ config CONFIG_DEBUG_YANK_SUSv2
bool "Disable obsolete features removed before SUSv3?"
default y
help
This option will disable backwards compatability with SuSv2,
This option will disable backwards compatibility with SuSv2,
specifically, old-style numeric options ('command -1 <file>')
will not be supported in head, tail, and fold. (Note: should
yank from renice too.)
+1 -1
View File
@@ -53,7 +53,7 @@ is run without an existing configuration, make defconfig will run first to
create a known starting point.
Other starting configurations (mostly used for testing purposes) include
"make allbaseconfig" (enables all applets but disables all optional features),
"make allbareconfig" (enables all applets but disables all optional features),
"make allyesconfig" (enables absolutely everything including debug features),
and "make randconfig" (produce a random configuration).
+141 -74
View File
@@ -5,14 +5,20 @@
# Licensed under GPLv2, see the file LICENSE in this tarball for details.
#
#--------------------------------------------------------------
# You shouldn't need to mess with anything beyond this point...
#--------------------------------------------------------------
noconfig_targets := menuconfig config oldconfig randconfig \
# You shouldn't have to edit anything in this file for configuration
# purposes, try "make help" or read http://busybox.net/FAQ.html.
.PHONY: dummy subdirs release distclean clean config oldconfig menuconfig \
tags check test depend dep buildtree hosttools _all checkhelp \
sizes bloatcheck baseline objsizes
noconfig_targets := menuconfig config oldconfig randconfig hosttools \
defconfig allyesconfig allnoconfig allbareconfig \
clean distclean help \
release tags
nocheck_targets := clean distclean help release tags
# the toplevel sourcedir
ifndef top_srcdir
top_srcdir=$(CURDIR)
@@ -33,27 +39,44 @@ DIRS:=applets archival archival/libunarchive coreutils console-tools \
SRC_DIRS:=$(patsubst %,$(top_srcdir)/%,$(DIRS))
# That's our default target when none is given on the command line
.PHONY: _all
_all:
CONFIG_CONFIG_IN = $(top_srcdir)/Config.in
ifeq ($(KBUILD_SRC),)
ifeq ($(BUILD_SRC),)
ifdef O
ifeq ("$(origin O)", "command line")
KBUILD_OUTPUT := $(O)
BUILD_OUTPUT := $(O)
top_builddir := $(O)
endif
else
# If no alternate output-dir was specified, we build in cwd
# We are using KBUILD_OUTPUT nevertheless to make sure that we create
# We are using BUILD_OUTPUT nevertheless to make sure that we create
# Rules.mak and the toplevel Makefile, in case they don't exist.
KBUILD_OUTPUT := $(top_builddir)
BUILD_OUTPUT := $(top_builddir)
endif
# see if we are in verbose mode
BUILD_VERBOSE :=
ifdef V
ifeq ("$(origin V)", "command line")
BUILD_VERBOSE := $(V)
endif
endif
ifdef VERBOSE
ifeq ("$(origin VERBOSE)", "command line")
BUILD_VERBOSE := $(VERBOSE)
endif
endif
ifneq ($(strip $(BUILD_VERBOSE)),)
export BUILD_VERBOSE
CHECK_VERBOSE := -v
# ARFLAGS+=v
endif
ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
# pull in OS specific commands like cp, mkdir, etc. early
# pull in settings early
-include $(top_srcdir)/Rules.mak
endif
@@ -64,40 +87,40 @@ all_tree: $(all_tree)
$(all_tree):
@mkdir -p "$@"
ifneq ($(KBUILD_OUTPUT),)
ifneq ($(BUILD_OUTPUT),)
# Invoke a second make in the output directory, passing relevant variables
# Check that the output directory actually exists
saved-output := $(KBUILD_OUTPUT)
KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
$(if $(wildcard $(KBUILD_OUTPUT)),, \
saved-output := $(BUILD_OUTPUT)
BUILD_OUTPUT := $(shell cd $(BUILD_OUTPUT) && /bin/pwd)
$(if $(wildcard $(BUILD_OUTPUT)),, \
$(error output directory "$(saved-output)" does not exist))
.PHONY: $(MAKECMDGOALS)
$(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile all_tree
$(Q)$(MAKE) -C $(KBUILD_OUTPUT) \
$(filter-out _all,$(MAKECMDGOALS)) _all: $(BUILD_OUTPUT)/Rules.mak $(BUILD_OUTPUT)/Makefile all_tree
$(Q)$(MAKE) -C $(BUILD_OUTPUT) \
top_srcdir=$(top_srcdir) \
top_builddir=$(top_builddir) \
KBUILD_SRC=$(top_srcdir) \
BUILD_SRC=$(top_srcdir) \
-f $(CURDIR)/Makefile $@
$(KBUILD_OUTPUT)/Rules.mak:
$(BUILD_OUTPUT)/Rules.mak:
@echo > $@
@echo top_srcdir=$(top_srcdir) >> $@
@echo top_builddir=$(KBUILD_OUTPUT) >> $@
@echo top_builddir=$(BUILD_OUTPUT) >> $@
@echo include $(top_srcdir)/Rules.mak >> $@
$(KBUILD_OUTPUT)/Makefile:
$(BUILD_OUTPUT)/Makefile:
@echo > $@
@echo top_srcdir=$(top_srcdir) >> $@
@echo top_builddir=$(KBUILD_OUTPUT) >> $@
@echo KBUILD_SRC='$$(top_srcdir)' >> $@
@echo include '$$(KBUILD_SRC)'/Makefile >> $@
@echo top_builddir=$(BUILD_OUTPUT) >> $@
@echo BUILD_SRC='$$(top_srcdir)' >> $@
@echo include '$$(BUILD_SRC)'/Makefile >> $@
# Leave processing to above invocation of make
skip-makefile := 1
endif # ifneq ($(KBUILD_OUTPUT),)
endif # ifeq ($(KBUILD_SRC),)
endif # ifneq ($(BUILD_OUTPUT),)
endif # ifeq ($(BUILD_SRC),)
ifeq ($(skip-makefile),)
@@ -117,6 +140,7 @@ help:
@echo ' all - Executable and documentation'
@echo ' busybox - the swiss-army executable'
@echo ' doc - docs/BusyBox.{txt,html,1}'
@echo ' html - create html-based cross-reference'
@echo
@echo 'Configuration:'
@echo ' allnoconfig - disable all symbols in .config'
@@ -126,16 +150,24 @@ help:
@echo ' defconfig - set .config to largest generic configuration'
@echo ' menuconfig - interactive curses-based configurator'
@echo ' oldconfig - resolve any unresolved symbols in .config'
@echo ' hosttools - build sed for the host.'
@echo ' You can use these commands if the commands on the host'
@echo ' is unusable. Afterwards use it like:'
@echo ' make SED="$(top_builddir)/sed"'
@echo
@echo 'Installation:'
@echo ' install - install busybox into $(PREFIX)'
@echo ' uninstall'
@echo
@echo 'Development:'
@echo ' baseline - create busybox_old for bloatcheck.'
@echo ' bloatcheck - show size difference between old and new versions'
@echo ' check - run the test suite for all applets'
@echo ' checkhelp - check for missing help-entries in Config.in'
@echo ' randconfig - generate a random configuration'
@echo ' release - create a distribution tarball'
@echo ' sizes - show size of all enabled busybox symbols'
@echo ' objsizes - show size of each .o object built'
@echo
@@ -170,7 +202,7 @@ scripts/config/mconf: scripts/config/Makefile
fi
menuconfig: scripts/config/mconf
@[ -f .config ] || make $(MAKEFLAGS) defconfig
@[ -f .config ] || $(MAKE) $(MAKEFLAGS) defconfig
@./scripts/config/mconf $(CONFIG_CONFIG_IN)
config: scripts/config/conf
@@ -183,29 +215,39 @@ randconfig: scripts/config/conf
@./scripts/config/conf -r $(CONFIG_CONFIG_IN)
allyesconfig: scripts/config/conf
@./scripts/config/conf -y $(CONFIG_CONFIG_IN)
@$(SED) -i -r -e "s/^(USING_CROSS_COMPILER)=.*/# \1 is not set/" .config
@./scripts/config/conf -o $(CONFIG_CONFIG_IN)
@./scripts/config/conf -y $(CONFIG_CONFIG_IN) > /dev/null
allnoconfig: scripts/config/conf
@./scripts/config/conf -n $(CONFIG_CONFIG_IN)
@./scripts/config/conf -n $(CONFIG_CONFIG_IN) > /dev/null
# defconfig is allyesconfig minus any features that are specialized enough
# or cause enough behavior change that the user really should switch them on
# manually if that's what they want. Sort of "maximum sane config".
defconfig: scripts/config/conf
@./scripts/config/conf -y $(CONFIG_CONFIG_IN)
@$(SED) -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG.*|STATIC|SELINUX|BUILD_(AT_ONCE|LIBBUSYBOX)|FEATURE_(DEVFS|FULL_LIBBUSYBOX|SHARED_BUSYBOX|MTAB_SUPPORT|CLEAN_UP|UDHCP_DEBUG)|INSTALL_NO_USR))=.*/# \1 is not set/" .config
@./scripts/config/conf -o $(CONFIG_CONFIG_IN)
@./scripts/config/conf -y $(CONFIG_CONFIG_IN) > /dev/null
@$(SED) -i -r -e "s/^(CONFIG_(DEBUG.*|STATIC|SELINUX|BUILD_(AT_ONCE|LIBBUSYBOX)|FEATURE_(DEVFS|FULL_LIBBUSYBOX|SHARED_BUSYBOX|MTAB_SUPPORT|CLEAN_UP|UDHCP_DEBUG)|INSTALL_NO_USR))=.*/# \1 is not set/" .config
@./scripts/config/conf -o $(CONFIG_CONFIG_IN) > /dev/null
allbareconfig: scripts/config/conf
@./scripts/config/conf -y $(CONFIG_CONFIG_IN)
@$(SED) -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG|STATIC|SELINUX|DEVFSD|NC_GAPING_SECURITY_HOLE|BUILD_AT_ONCE)).*/# \1 is not set/" .config
@./scripts/config/conf -y $(CONFIG_CONFIG_IN) > /dev/null
@$(SED) -i -r -e "s/^(CONFIG_(DEBUG|STATIC|SELINUX|DEVFSD|NC_GAPING_SECURITY_HOLE|BUILD_AT_ONCE)).*/# \1 is not set/" .config
@$(SED) -i -e "/FEATURE/s/=.*//;/^[^#]/s/.*FEATURE.*/# \0 is not set/;" .config
@echo "CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y" >> .config
@yes n | ./scripts/config/conf -o $(CONFIG_CONFIG_IN)
@yes n | ./scripts/config/conf -o $(CONFIG_CONFIG_IN) > /dev/null
hosttools:
$(Q)cp .config .config.bak || noold=yea
$(Q)$(MAKE) CC="$(HOSTCC)" CFLAGS="$(HOSTCFLAGS) $(INCS)" allnoconfig
$(Q)mv .config .config.in
$(Q)(grep -v CONFIG_SED .config.in ; \
echo "CONFIG_SED=y" ; ) > .config
$(Q)$(MAKE) CC="$(HOSTCC)" CFLAGS="$(HOSTCFLAGS) $(INCS)" oldconfig include/bb_config.h
$(Q)$(MAKE) CC="$(HOSTCC)" CFLAGS="$(HOSTCFLAGS) $(INCS)" busybox
$(Q)[ -f .config.bak ] && mv .config.bak .config || rm .config
mv busybox sed
@echo "Now do: $(MAKE) SED=$(top_builddir)/sed <target>"
else # ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
@@ -258,6 +300,7 @@ LIBBUSYBOX_SONAME:=$(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL
DO_INSTALL_LIBS:=$(LD_LIBBUSYBOX) \
$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
$(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION)
endif # CONFIG_BUILD_LIBBUSYBOX
ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y)
ifneq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
@@ -269,7 +312,6 @@ $(LIBBUSYBOX_SONAME): $(LIBRARY_SRC)
else # CONFIG_BUILD_AT_ONCE
$(LIBBUSYBOX_SONAME): $(libbusybox-obj)
endif # CONFIG_BUILD_AT_ONCE
endif # CONFIG_BUILD_LIBBUSYBOX
ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
LDBUSYBOX:=-L$(top_builddir) -lbusybox
@@ -280,31 +322,25 @@ $(LIBBUSYBOX_SONAME):
ifndef MAJOR_VERSION
$(error MAJOR_VERSION needed for $@ is not defined)
endif
$(do_link) $(LIB_CFLAGS) $(CFLAGS_COMBINE) \
$(do_link.so) \
-Wl,-soname=$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
-Wl,-z,combreloc $(LIB_LDFLAGS) \
-o $(@) \
-Wl,--start-group -Wl,--whole-archive \
$(LIBRARY_DEFINE) $(^) \
-Wl,--no-whole-archive -Wl,--end-group
-Wl,-z,combreloc
@rm -f $(DO_INSTALL_LIBS)
@for i in $(DO_INSTALL_LIBS); do ln -s $(@) $$i ; done
$(do_strip)
endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
busybox_unstripped: .depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(libraries-y)
$(do_link) $(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) \
-o $@ -Wl,--start-group \
$(APPLETS_DEFINE) $(APPLET_SRC) \
$(BUSYBOX_DEFINE) $(BUSYBOX_SRC) $(libraries-y) \
$(LDBUSYBOX) $(LIBRARIES) \
-Wl,--end-group
busybox_unstripped: .depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(APPLET_SRC) $(libraries-y)
$(do_link)
busybox: busybox_unstripped
$(Q)cp busybox_unstripped busybox
$(do_strip)
%.bflt: %_unstripped
$(do_elf2flt)
busybox.links: $(top_srcdir)/applets/busybox.mkll include/bb_config.h $(top_srcdir)/include/applets.h
$(Q)-$(SHELL) $^ >$@
@@ -331,24 +367,26 @@ ifneq ($(strip $(DO_INSTALL_LIBS)),n)
done
endif
# see if we are in verbose mode
KBUILD_VERBOSE :=
ifdef V
ifeq ("$(origin V)", "command line")
KBUILD_VERBOSE := $(V)
endif
endif
ifneq ($(strip $(KBUILD_VERBOSE)),)
CHECK_VERBOSE := -v
# ARFLAGS+=v
endif
check test: busybox
bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite \
$(top_srcdir)/testsuite/runtest $(CHECK_VERBOSE)
bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite SED="$(SED)" \
$(SHELL) $(top_srcdir)/testsuite/runtest $(CHECK_VERBOSE)
checkhelp:
$(Q)$(top_srcdir)/scripts/checkhelp.awk \
$(wildcard $(patsubst %,%/Config.in,$(SRC_DIRS) ./))
sizes: busybox_unstripped
$(NM) --size-sort $(<)
bloatcheck: busybox_old busybox_unstripped
@$(top_srcdir)/scripts/bloat-o-meter busybox_old busybox_unstripped
baseline: busybox_unstripped
@mv busybox_unstripped busybox_old
objsizes: busybox_unstripped
$(SHELL) $(top_srcdir)/scripts/objsizes
# Documentation Targets
doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
@@ -384,20 +422,37 @@ docs/busybox.net/BusyBox.html: docs/busybox.pod
# The nifty new dependency stuff
scripts/bb_mkdep: $(top_srcdir)/scripts/bb_mkdep.c
$(Q)$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
$(do_link.h)
DEP_INCLUDES := include/bb_config.h
ifeq ($(strip $(CONFIG_BBCONFIG)),y)
DEP_INCLUDES += include/bbconfigopts.h
include/bbconfigopts.h: .config
include/bbconfigopts.h: .config $(top_srcdir)/scripts/config/mkconfigs
$(disp_gen)
$(Q)$(top_srcdir)/scripts/config/mkconfigs > $@
endif
ifeq ($(strip $(CONFIG_FEATURE_COMPRESS_USAGE)),y)
USAGE_BIN:=scripts/usage
$(USAGE_BIN): $(top_srcdir)/scripts/usage.c .config \
$(top_srcdir)/include/usage.h
$(do_link.h)
DEP_INCLUDES += include/usage_compressed.h
include/usage_compressed.h: .config $(USAGE_BIN) \
$(top_srcdir)/scripts/usage_compressed
$(Q)SED="$(SED)" $(SHELL) $(top_srcdir)/scripts/usage_compressed \
"$(top_builddir)/scripts" > $@
endif # CONFIG_FEATURE_COMPRESS_USAGE
# workaround alleged bug in make-3.80, make-3.81
.NOTPARALLEL: .depend
depend dep: .depend
.depend: scripts/bb_mkdep $(DEP_INCLUDES)
.depend: scripts/bb_mkdep $(USAGE_BIN) $(DEP_INCLUDES)
$(disp_gen)
$(Q)rm -f .depend
$(Q)mkdir -p include/config
@@ -418,15 +473,18 @@ clean:
docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
docs/busybox.net/BusyBox.html busybox.links \
libbusybox.so* \
.config.old busybox busybox_unstripped
.config.old busybox busybox_unstripped \
include/usage_compressed.h scripts/usage
- rm -r -f _install testsuite/links
- find . -name .\*.flags -o -name \*.o -o -name \*.om \
- find . -name .\*.flags -o -name \*.o -o -name \*.om -o -name \*.syn \
-o -name \*.os -o -name \*.osm -o -name \*.a | xargs rm -f
distclean: clean
- rm -f scripts/bb_mkdep
- rm -r -f include/config $(DEP_INCLUDES)
- find . -name .depend'*' | xargs rm -f
rm -f scripts/bb_mkdep scripts/usage
rm -r -f include/config include/config.h $(DEP_INCLUDES)
find . -name .depend'*' -print0 | xargs -0 rm -f
find . -name '*.rej' -print0 | xargs -0 rm -f
rm -f .hdepend
rm -f .config .config.old .config.cmd
release: distclean #doc
@@ -449,8 +507,17 @@ release: distclean #doc
tags:
ctags -R .
# documentation, cross-reference
# Modern distributions already ship synopsis packages (e.g. debian)
# If you have an old distribution go to http://synopsis.fresco.org/
syn_tgt := $(wildcard $(patsubst %,%/*.c,$(SRC_DIRS)))
syn := $(patsubst %.c, %.syn, $(syn_tgt))
%.syn: %.c
synopsis -p C -l Comments.SSDFilter,Comments.Previous $(INCS) -Wp,verbose,debug,preprocess,cppflags="'$(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) $(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) $(APPLETS_DEFINE) $(BUSYBOX_DEFINE)'" -o $@ $<
html: $(syn)
synopsis -f HTML -Wf,title="'BusyBox Documentation'" -o $@ $^
endif # ifeq ($(skip-makefile),)
.PHONY: dummy subdirs release distclean clean config oldconfig \
menuconfig tags check test depend dep buildtree
+8 -13
View File
@@ -5,12 +5,12 @@ What is busybox:
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 bzip2, coreutils, e2fsprogs, file, findutils,
gawk, grep, inetutils, less, modutils, net-tools, procps, sed, shadow,
sysklogd, sysvinit, tar, util-linux, and vim. The utilities in BusyBox
often have fewer options than their full-featured cousins; however, the
options that are included provide the expected functionality and behave
very much like their larger counterparts.
utilities you usually find in bzip2, coreutils, dhcp, diffutils, e2fsprogs,
file, findutils, gawk, grep, inetutils, less, modutils, net-tools, procps,
sed, shadow, sysklogd, sysvinit, tar, util-linux, and vim. The utilities
in BusyBox often have fewer options than their full-featured cousins;
however, the options that are included provide the expected functionality
and behave very much like their larger counterparts.
BusyBox has been written with size-optimization and limited resources in
mind, both to produce small binaries and to reduce run-time memory usage.
@@ -65,11 +65,6 @@ Downloading the current source code:
http://busybox.net/downloads/
You can browse the up to the minute source code and change history online.
The "stable" series is at:
http://www.busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_00_stable/busybox/
And the development series is at:
http://www.busybox.net/cgi-bin/viewcvs.cgi/trunk/busybox/
@@ -199,5 +194,5 @@ Supported hardware:
Please feed suggestions, bug reports, insults, and bribes back to the busybox
maintainer:
Erik Andersen
<andersen@codepoet.org>
Rob Landley
<rob@landley.net>
+203 -80
View File
@@ -13,8 +13,8 @@ endif
#--------------------------------------------------------
PROG := busybox
MAJOR_VERSION :=1
MINOR_VERSION :=1
SUBLEVEL_VERSION:=1
MINOR_VERSION :=2
SUBLEVEL_VERSION:=0
EXTRAVERSION :=
VERSION :=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION)$(EXTRAVERSION)
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
@@ -24,69 +24,47 @@ BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
# 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- top_srcdir="$HOME/busybox" PREFIX=/mnt/app
# make CROSS_COMPILE=powerpc-linux- top_srcdir="$HOME/busybox" PREFIX=/mnt/app
#--------------------------------------------------------
# If you are running a cross compiler, you will want to set 'CROSS'
# If you are running a cross compiler, you will want to set CROSS_COMPILE
# to something more interesting... Target architecture is determined
# by asking the CC compiler what arch it compiles things for, so unless
# your compiler is broken, you should not need to specify TARGET_ARCH
CROSS =$(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
CC = $(CROSS)gcc
AR = $(CROSS)ar
AS = $(CROSS)as
LD = $(CROSS)ld
NM = $(CROSS)nm
STRIP = $(CROSS)strip
CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar
AS = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)ld
NM = $(CROSS_COMPILE)nm
STRIP = $(CROSS_COMPILE)strip
ELF2FLT = $(CROSS_COMPILE)elf2flt
CPP = $(CC) -E
SED ?= sed
BZIP2 ?= bzip2
# What OS are you compiling busybox for? This allows you to include
# OS specific things, syscall overrides, etc.
TARGET_OS=linux
# Select the compiler needed to build binaries for your development system
HOSTCC = gcc
HOSTCFLAGS= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
LC_ALL:= C
# 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=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS)))
# 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
#
# For other libraries, you are on your own. But these may (or may not) help...
#LDFLAGS+=-nostdlib
#LIBRARIES:=$(LIBCDIR)/lib/libc.a -lgcc
#CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR) -funsigned-char
#GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
WARNINGS=-Wall -Wstrict-prototypes -Wshadow
CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)
# This must bind late because srcdir is reset for every source subdirectory.
INCS:=-I$(top_builddir)/include -I$(top_srcdir)/include
CFLAGS=$(INCS) -I$(srcdir) -D_GNU_SOURCE
CFLAGS+=$(CHECKED_CFLAGS)
ARFLAGS=cru
# gcc centric. Perhaps fiddle with findstring gcc,$(CC) for the rest
# get the CC MAJOR/MINOR version
CC_MAJOR:=$(shell printf "%02d" $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1))
CC_MINOR:=$(shell printf "%02d" $(shell echo __GNUC_MINOR__ | $(CC) -E -xc - | tail -n 1))
#--------------------------------------------------------
export VERSION BUILDTIME HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
export VERSION BUILDTIME HOSTCC HOSTCFLAGS CROSS_COMPILE CC AR AS LD NM STRIP CPP
ifeq ($(strip $(TARGET_ARCH)),)
TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
TARGET_ARCH:=$(shell $(CC) -dumpmachine | $(SED) -e s'/-.*//' \
-e 's/i.86/i386/' \
-e 's/sparc.*/sparc/' \
-e 's/arm.*/arm/g' \
@@ -100,22 +78,108 @@ TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
)
endif
# A nifty macro to make testing gcc features easier
check_gcc=$(shell \
if [ "$(1)" != "" ]; then \
if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
then echo "$(1)"; else echo "$(2)"; fi \
# A nifty macro to make testing gcc features easier, but note that everything
# that uses this _must_ use := or it will be re-evaluated everytime it is
# referenced.
ifeq ($(strip $(BUILD_VERBOSE)),2)
VERBOSE_CHECK_CC=echo CC=\"$(1)\" check_cc $(2) >&2;
endif
check_cc=$(shell \
$(VERBOSE_CHECK_CC) \
if [ "x$(1)" != "x" ] && [ "x$(2)" != "x" ]; then \
echo "int i;" > ./conftest.c; \
if $(1) $(2) -c -o conftest.o conftest.c > /dev/null 2>&1; \
then echo "$(2)"; else echo "$(3)"; fi ; \
rm -f conftest.c conftest.o; \
fi)
ifneq ($(filter $(nocheck_targets),$(MAKECMDGOALS)),)
check_cc:=
endif
# A not very robust macro to check for available ld flags
ifeq ($(strip $(BUILD_VERBOSE)),2)
VERBOSE_CHECK_LD=echo LD=\"$(1)\" check_ld $(2) >&2;
endif
check_ld=$(shell \
if [ "x$(1)" != "x" ]; then \
$(LD) --help | grep -q "\$(1)" && echo "-Wl,$(1)" ; \
$(VERBOSE_CHECK_LD) \
if [ "x$(1)" != "x" ] && [ "x$(2)" != "x" ]; then \
$(1) -o /dev/null -b binary /dev/null > /dev/null 2>&1 && \
echo "-Wl,$(2)" ; \
fi)
CFLAGS+=$(call check_gcc,-funsigned-char,)
ifneq ($(filter $(nocheck_targets),$(MAKECMDGOALS)),)
check_ld:=
endif
# A not very robust macro to check for available strip flags
ifeq ($(strip $(BUILD_VERBOSE)),2)
VERBOSE_CHECK_STRIP=echo STRIPCMD=\"$(1)\" check_strip $(2) >&2;
endif
check_strip=$(shell \
$(VERBOSE_CHECK_STRIP) \
if [ "x$(1)" != "x" ] && [ "x$(2)" != "x" ]; then \
echo "int i;" > ./conftest.c ; \
$(CC) -c -o conftest.o conftest.c > /dev/null 2>&1 ; \
$(1) $(2) conftest.o > /dev/null 2>&1 && \
echo "$(1) $(2)" || echo "$(3)"; \
rm -f conftest.c conftest.o > /dev/null 2>&1 ; \
fi)
ifneq ($(filter $(nocheck_targets),$(MAKECMDGOALS)),)
check_strip:=
endif
# Select the compiler needed to build binaries for your development system
HOSTCC = gcc
HOSTCFLAGS:=$(call check_cc,$(HOSTCC),-Wall,)
HOSTCFLAGS+=$(call check_cc,$(HOSTCC),-Wstrict-prototypes,)
HOSTCFLAGS+=$(call check_cc,$(HOSTCC),-O2,)
HOSTCFLAGS+=$(call check_cc,$(HOSTCC),-fomit-frame-pointer,)
LD_WHOLE_ARCHIVE:=$(shell echo "int i;" > conftest.c ; \
$(CC) -c -o conftest.o conftest.c ; \
echo "int main(void){return 0;}" > conftest_main.c ; \
$(CC) -c -o conftest_main.o conftest_main.c ; \
$(AR) $(ARFLAGS) conftest.a conftest.o ; \
$(CC) -Wl,--whole-archive conftest.a -Wl,--no-whole-archive \
conftest_main.o -o conftest > /dev/null 2>&1 \
&& echo "-Wl,--whole-archive" ; \
rm conftest_main.o conftest_main.c conftest.o conftest.c \
conftest.a conftest > /dev/null 2>&1 ; )
ifneq ($(findstring whole-archive,$(LD_WHOLE_ARCHIVE)),)
LD_NO_WHOLE_ARCHIVE:= -Wl,--no-whole-archive
endif
LD_START_GROUP:=$(shell echo "int bar(void){return 0;}" > conftest.c ; \
$(CC) -c -o conftest.o conftest.c ; \
echo "int main(void){return bar();}" > conftest_main.c ; \
$(CC) -c -o conftest_main.o conftest_main.c ; \
$(AR) $(ARFLAGS) conftest.a conftest.o ; \
$(CC) -Wl,--start-group conftest.a conftest_main.o -Wl,--end-group \
-o conftest > /dev/null 2>&1 && echo "-Wl,--start-group" ; \
rm conftest_main.o conftest_main.c conftest.o conftest.c \
conftest.a conftest > /dev/null 2>&1 ; )
ifneq ($(findstring start-group,$(LD_START_GROUP)),)
LD_END_GROUP:= -Wl,--end-group
endif
CHECKED_LDFLAGS := $(call check_ld,$(LD),--warn-common,)
# Pin CHECKED_CFLAGS with := so it's only evaluated once.
CHECKED_CFLAGS:=$(call check_cc,$(CC),-Wall,)
CHECKED_CFLAGS+=$(call check_cc,$(HOSTCC),-Werror,)
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wstrict-prototypes,)
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wshadow,)
CHECKED_CFLAGS+=$(call check_cc,$(CC),-funsigned-char,)
CHECKED_CFLAGS+=$(call check_cc,$(CC),-mmax-stack-frame=256,)
CHECKED_CFLAGS+=$(call check_cc,$(CC),-fno-builtin-strlen)
CHECKED_CFLAGS+=$(call check_cc,$(CC),-finline-limit=0)
# Preemptively pin this too.
PROG_CFLAGS:=
CFLAGS+=$(call check_gcc,-mmax-stack-frame=256,)
#--------------------------------------------------------
# Arch specific compiler optimization stuff should go here.
@@ -123,22 +187,26 @@ CFLAGS+=$(call check_gcc,-mmax-stack-frame=256,)
# for OPTIMIZATION...
# use '-Os' optimization if available, else use -O2
OPTIMIZATION:=$(call check_gcc,-Os,-O2)
OPTIMIZATION:=$(call check_cc,$(CC),-Os,-O2)
ifeq ($(CONFIG_BUILD_AT_ONCE),y)
# gcc 2.95 exits with 0 for "unrecognized option"
ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 3 ] ; echo $$?)),0)
CFLAGS_COMBINE:=$(call check_gcc,--combine,)
CFLAGS_COMBINE:=$(call check_cc,$(CC),--combine,)
endif
OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,)
OPTIMIZATION+=$(call check_cc,$(CC),-funit-at-a-time,)
OPTIMIZATION+=$(call check_cc,$(CC),-fgcse-after-reload,)
ifneq ($(CONFIG_BUILD_LIBBUSYBOX),y)
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25795
#PROG_CFLAGS+=$(call check_gcc,-fwhole-program,)
# This prevents us from using -fwhole-program when we build the lib
PROG_CFLAGS+=$(call check_cc,$(CC),-fwhole-program,)
endif # CONFIG_BUILD_LIBBUSYBOX
endif # CONFIG_BUILD_AT_ONCE
LIB_LDFLAGS:=$(call check_ld,--enable-new-dtags,)
#LIB_LDFLAGS+=$(call check_ld,--reduce-memory-overheads,)
#LIB_LDFLAGS+=$(call check_ld,--as-needed,)
#LIB_LDFLAGS+=$(call check_ld,--warn-shared-textrel,)
LIB_LDFLAGS:=$(call check_ld,$(LD),--enable-new-dtags,)
#LIB_LDFLAGS+=$(call check_ld,$(LD),--reduce-memory-overheads,)
#LIB_LDFLAGS+=$(call check_ld,$(LD),--as-needed,)
#LIB_LDFLAGS+=$(call check_ld,$(LD),--warn-shared-textrel,)
# Some nice architecture specific optimizations
@@ -146,25 +214,26 @@ ifeq ($(strip $(TARGET_ARCH)),arm)
OPTIMIZATION+=-fstrict-aliasing
endif
ifeq ($(strip $(TARGET_ARCH)),i386)
OPTIMIZATION+=$(call check_gcc,-march=i386,)
OPTIMIZATION+=$(call check_cc,$(CC),-march=i386,)
# gcc-4.0 and older seem to benefit from these
#ifneq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0)
OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=2,)
OPTIMIZATION+=$(call check_gcc,-falign-functions=1 -falign-jumps=1 -falign-loops=1,\
OPTIMIZATION+=$(call check_cc,$(CC),-mpreferred-stack-boundary=2,)
OPTIMIZATION+=$(call check_cc,$(CC),-falign-functions=1 -falign-jumps=1 -falign-loops=1,\
-malign-functions=0 -malign-jumps=0 -malign-loops=0)
#endif # gcc-4.0 and older
# gcc-4.1 and beyond seem to benefit from these
ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0)
# turn off flags which hurt -Os
OPTIMIZATION+=$(call check_gcc,-fno-tree-loop-optimize,)
OPTIMIZATION+=$(call check_gcc,-fno-tree-dominator-opts,)
OPTIMIZATION+=$(call check_gcc,-fno-strength-reduce,)
OPTIMIZATION+=$(call check_cc,$(CC),-fno-tree-loop-optimize,)
OPTIMIZATION+=$(call check_cc,$(CC),-fno-tree-dominator-opts,)
OPTIMIZATION+=$(call check_cc,$(CC),-fno-strength-reduce,)
OPTIMIZATION+=$(call check_gcc,-fno-branch-count-reg,)
OPTIMIZATION+=$(call check_cc,$(CC),-fno-branch-count-reg,)
endif # gcc-4.1 and beyond
endif
OPTIMIZATIONS:=$(OPTIMIZATION) $(call check_gcc,-fomit-frame-pointer,)
OPTIMIZATION+=$(call check_cc,$(CC),-fomit-frame-pointer,)
OPTIMIZATION+=$(call check_cc,$(CC),-ffunction-sections -fdata-sections,)
#
#--------------------------------------------------------
@@ -188,27 +257,43 @@ else
LIBRARIES:=-lefence
endif
endif
# Debugging info
ifeq ($(strip $(CONFIG_DEBUG)),y)
CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE
LDFLAGS += $(call check_ld,--warn-common,)
CFLAGS +=-g
else
CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG
LDFLAGS += $(call check_ld,--warn-common,)
LDFLAGS += $(call check_ld,--sort-common,)
CFLAGS +=-DNDEBUG
CHECKED_LDFLAGS += $(call check_ld,$(LD),--sort-common,)
CHECKED_LDFLAGS += $(call check_ld,--gc-sections,)
endif
STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment
ifneq ($(strip $(CONFIG_DEBUG_PESSIMIZE)),y)
CFLAGS += $(OPTIMIZATION)
endif
# warn a bit more verbosely for non-release versions
ifneq ($(EXTRAVERSION),)
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wstrict-prototypes,)
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wmissing-prototypes,)
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wmissing-declarations,)
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wunused,)
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Winit-self,)
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wshadow,)
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wcast-align,)
endif
STRIPCMD:=$(call check_strip,$(STRIP),-s --remove-section=.note --remove-section=.comment,$(STRIP))
ifeq ($(strip $(CONFIG_STATIC)),y)
PROG_CFLAGS += $(call check_gcc,-static,)
PROG_CFLAGS += $(call check_cc,$(CC),-static,)
endif
CFLAGS_SHARED += $(call check_gcc,-shared,)
CFLAGS_SHARED := $(call check_cc,$(CC),-shared,)
LIB_CFLAGS+=$(CFLAGS_SHARED)
ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
CFLAGS_PIC:= $(call check_gcc,-fPIC,)
CFLAGS_PIC:= $(call check_cc,$(CC),-fPIC,)
LIB_CFLAGS+=$(CFLAGS_PIC)
endif
ifeq ($(strip $(CONFIG_SELINUX)),y)
LIBRARIES += -lselinux
endif
@@ -217,6 +302,10 @@ ifeq ($(strip $(PREFIX)),)
PREFIX:=`pwd`/_install
endif
ifneq ($(strip $(CONFIG_GETOPT_LONG)),y)
CFLAGS += -D__need_getopt
endif
# Additional complications due to support for pristine source dir.
# Include files in the build directory should take precedence over
# the copy in top_srcdir, both during the compilation phase and the
@@ -225,14 +314,16 @@ endif
OBJECTS:=$(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o
CFLAGS += $(CROSS_CFLAGS)
CFLAGS += $(CHECKED_CFLAGS) $(CROSS_CFLAGS)
LDFLAGS += $(CHECKED_LDFLAGS)
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)
-include $(top_builddir)/.config.mak
#------------------------------------------------------------
# Installation options
@@ -256,7 +347,7 @@ SECHO := @-false
DISP := sil
Q := @
else
ifneq ($(V)$(VERBOSE),)
ifneq ($(BUILD_VERBOSE),)
SECHO := @-false
DISP := ver
Q :=
@@ -272,33 +363,65 @@ pur_disp_compile.c = echo " "CC $(show_objs)
pur_disp_compile.h = echo " "HOSTCC $(show_objs)
pur_disp_strip = echo " "STRIP $(show_objs)
pur_disp_link = echo " "LINK $(show_objs)
pur_disp_link.h = echo " "HOSTLINK $(show_objs)
pur_disp_ar = echo " "AR $(ARFLAGS) $(show_objs)
pur_disp_elf2flt = echo " "ELF2FLT $(ELF2FLTFLAGS) $(show_objs)
sil_disp_compile.c = true
sil_disp_compile.h = true
sil_disp_strip = true
sil_disp_link = true
sil_disp_link.h = true
sil_disp_ar = true
sil_disp_elf2flt = true
ver_disp_compile.c = echo $(cmd_compile.c)
ver_disp_compile.h = echo $(cmd_compile.h)
ver_disp_strip = echo $(cmd_strip)
ver_disp_link = echo $(cmd_link)
ver_disp_link.h = echo $(cmd_link.h)
ver_disp_ar = echo $(cmd_ar)
ver_disp_elf2flt = echo $(cmd_elf2flt)
disp_compile.c = $($(DISP)_disp_compile.c)
disp_compile.h = $($(DISP)_disp_compile.h)
disp_strip = $($(DISP)_disp_strip)
disp_link = $($(DISP)_disp_link)
disp_link.h = $($(DISP)_disp_link.h)
disp_ar = $($(DISP)_disp_ar)
disp_gen = $(SECHO) " "GEN $@ ; true
disp_doc = $(SECHO) " "DOC $(subst docs/,,$@) ; true
disp_elf2flt = $($(DISP)_disp_elf2flt)
cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) $(INCS) -c -o $@ $<
cmd_strip = $(STRIPCMD) $@
cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS)
cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) \
$(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) \
-o $@ $(LD_START_GROUP) \
$(APPLETS_DEFINE) $(APPLET_SRC) \
$(BUSYBOX_DEFINE) $(BUSYBOX_SRC) $(libraries-y) \
$(LDBUSYBOX) $(LIBRARIES) \
$(LD_END_GROUP)
cmd_link.so = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) \
$(LIB_CFLAGS) $(CFLAGS_COMBINE) $(LIB_LDFLAGS) \
-o $(@) $(LD_START_GROUP) $(LD_WHOLE_ARCHIVE) \
$(LIBRARY_DEFINE) $(^) \
$(LD_NO_WHOLE_ARCHIVE) $(LD_END_GROUP)
cmd_link.h = $(HOSTCC) $(HOSTCFLAGS) $(INCS) $< -o $@
cmd_ar = $(AR) $(ARFLAGS) $@ $^
cmd_elf2flt = $(ELF2FLT) $(ELF2FLTFLAGS) $< -o $@
compile.c = @$(disp_compile.c) ; $(cmd_compile.c)
compile.h = @$(disp_compile.h) ; $(cmd_compile.h)
do_strip = @$(disp_strip) ; $(cmd_strip)
do_link = @$(disp_link) ; $(cmd_link)
do_link.so = @$(disp_link) ; $(cmd_link.so)
do_link.h = @$(disp_link.h) ; $(cmd_link.h)
do_ar = @$(disp_ar) ; $(cmd_ar)
do_elf2flt = @$(disp_elf2flt) ; $(cmd_elf2flt)
uppercase = $(shell echo $1 | $(SED) -e "y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/")
%.a:
@if test -z "$($(call uppercase,$*)_DIR)" ; then \
echo "Invalid target $@" ; \
exit 1 ; \
fi
$(Q)$(MAKE) $($(call uppercase,$*)_DIR)$@
.PHONY: dummy
+150 -102
View File
@@ -1,31 +1,138 @@
Busybox TODO
Stuff that needs to be done. All of this is fair game for 1.2.
Stuff that needs to be done. This is organized by who plans to get around to
doing it eventually, but that doesn't mean they "own" the item. If you want to
do one of these bounce an email off the person it's listed under to see if they
have any suggestions how they plan to go about it, and to minimize conflicts
between your work and theirs. But otherwise, all of these are fair game.
Rob Landley <rob@landley.net>:
Add BB_NOMMU to platform.h and migrate __uClinux__ tests to that.
#if defined __UCLIBC__ && !defined __ARCH_USE_MMU__
Add a libbb/platform.c
Implement fdprintf() for platforms that haven't got one.
Implement bb_realpath() that can handle NULL on non-glibc.
Cleanup bb_asprintf()
Migrate calloc() and bb_calloc() occurrences to bb_xzalloc().
Remove obsolete _() wrapper crud for internationalization we don't do.
Figure out where we need utf8 support, and add it.
sh
The command shell situation is a big mess. We have three or four different
shells that don't really share any code, and the "standalone shell" doesn't
work all that well (especially not in a chroot environment), due to apps not
being reentrant. I'm writing a new shell (bbsh) to unify the various
shells and configurably add the minimal set of bash features people
actually use. The hardest part is it has to configure down as small as
lash while providing lash's features. The rest is easy in comparison.
bzip2
Compression-side support.
init
General cleanup (should use ENABLE_FEATURE_INIT_SYSLOG and ENABLE_FEATURE_INIT_DEBUG).
depmod
busybox lacks a way to update module deps when running from firmware without the
use of the depmod.pl (perl is to bloated for most embedded setups) and or orig
modutils. The orig depmod is rather pointless to have to add to a firmware image
in when we already have a insmod/rmmod and friends.
Unify base64 handling.
There's base64 encoding and decoding going on in:
networking/wget.c:base64enc()
coreutils/uudecode.c:read_base64()
coreutils/uuencode.c:tbl_base64[]
networking/httpd.c:decodeBase64()
And probably elsewhere. That needs to be unified into libbb functions.
Do a SUSv3 audit
Look at the full Single Unix Specification version 3 (available online at
"http://www.opengroup.org/onlinepubs/009695399/nfindex.html") and
figure out which of our apps are compliant, and what we're missing that
we might actually care about.
Even better would be some kind of automated compliance test harness that
exercises each command line option and the various corner cases.
Internationalization
How much internationalization should we do?
The low hanging fruit is UTF-8 character set support. We should do this.
(Vodz pointed out the shell's cmdedit as needing work here. What else?)
We also have lots of hardwired english text messages. Consolidating this
into some kind of message table not only makes translation easier, but
also allows us to consolidate redundant (or close) strings.
We probably don't want to be bloated with locale support. (Not unless we
can cleanly export it from our underlying C library without having to
concern ourselves with it directly. Perhaps a few specific things like a
config option for "date" are low hanging fruit here?)
What level should things happen at? How much do we care about
internationalizing the text console when X11 and xterms are so much better
at it? (There's some infrastructure here we don't implement: The
"unicode_start" and "unicode_stop" shell scripts need "vt-is-UTF8" and a
--unicode option to loadkeys. That implies a real loadkeys/dumpkeys
implementation to replace loadkmap/dumpkmap. Plus messing with console font
loading. Is it worth it, or do we just say "use X"?)
Individual compilation of applets.
It would be nice if busybox had the option to compile to individual applets,
for people who want an alternate implementation less bloated than the gnu
utils (or simply with less political baggage), but without it being one big
executable.
Turning libbb into a real dll is another possibility, especially if libbb
could export some of the other library interfaces we've already more or less
got the code for (like zlib).
buildroot - Make a "dogfood" option
Busybox 1.1 will be capable of replacing most gnu packages for real world
use, such as developing software or in a live CD. It needs wider testing.
Busybox should now be able to replace bzip2, coreutils, e2fsprogs, file,
findutils, gawk, grep, inetutils, less, modutils, net-tools, patch, procps,
sed, shadow, sysklogd, sysvinit, tar, util-linux, and vim. The resulting
system should be self-hosting (I.E. able to rebuild itself from source
code). This means it would need (at least) binutils, gcc, and make, or
equivalents.
It would be a good "eating our own dogfood" test if buildroot had the option
of using a "make allyesconfig" busybox instead of the all of the above
packages. Anything that's wrong with the resulting system, we can fix. (It
would be nice to be able to upgrade busybox to be able to replace bash and
diffutils as well, but we're not there yet.)
One example of an existing system that does this already is Firmware Linux:
http://www.landley.net/code/firmware
initramfs
Busybox should have a sample initramfs build script. This depends on
bbsh, mdev, and switch_root.
mkdep
Write a mkdep that doesn't segfault if there's a directory it doesn't
have permission to read, isn't based on manually editing the output of
lexx and yacc, doesn't make such a mess under include/config, etc.
Group globals into unions of structures.
Go through and turn all the global and static variables into structures,
and have all those structures be in a big union shared between processes,
so busybox uses less bss. (This is a big win on nommu machines.) See
sed.c and mdev.c for examples.
Go through bugs.busybox.net and close out all of that somehow.
This one's open to everybody, but I'll wind up doing it...
Bernhard Fischer <rep.nop@anon.at>:
Makefile stuff:
make -j is broken, -j1 is forced atm
New debug options:
-Wlarger-than-127
Collate BUFSIZ IOBUF_SIZE MY_BUF_SIZE PIPE_PROGRESS_SIZE BUFSIZE PIPESIZE
Use bb_common_bufsiz1?
As yet unclaimed:
build system
make -j is broken, -j1 is forced atm
Make sure that the flags get pinned in e.g. Rules.mak so when expanding them
later on you get the cached result without the need to re-evaluate them.
----
find
doesn't understand (), lots of susv3 stuff.
----
sh
The command shell situation is a big mess. We have three or four different
shells that don't really share any code, and the "standalone shell" doesn't
work all that well (especially not in a chroot environment), due to apps not
being reentrant. Unifying the various shells and figuring out a configurable
way of adding the minimal set of bash features a given script uses is a big
job, but it would be a big improvement.
Note: Rob Landley (rob@landley.net) is working on a new unified shell called
bbsh, but it's a low priority...
---
diff
We should have a diff -u command. We have patch, we should have diff
(we only need to support unified diffs though).
Also, make sure we handle empty files properly:
Make sure we handle empty files properly:
From the patch man page:
   you can remove a file by sending out a context diff that compares
@@ -48,17 +155,11 @@ man
(How doclifter might work into this is anybody's guess.)
---
bzip2
Compression-side support.
---
init
General cleanup.
---
ar
Write support?
---
mdev
Micro-udev.
crond
turn FEATURE_DEBUG_OPT into ENABLE_FEATURE_CROND_DEBUG_OPT
Architectural issues:
@@ -74,46 +175,6 @@ bb_close() with fsync()
You need to call fsync() if you care about errors that occur after write(),
but that can have a big performance impact. So make it a config option.
---
Unify base64 handling.
There's base64 encoding and decoding going on in:
networking/wget.c:base64enc()
coreutils/uudecode.c:read_base64()
coreutils/uuencode.c:tbl_base64[]
networking/httpd.c:decodeBase64()
And probably elsewhere. That needs to be unified into libbb functions.
---
Do a SUSv3 audit
Look at the full Single Unix Specification version 3 (available online at
"http://www.opengroup.org/onlinepubs/009695399/nfindex.html") and
figure out which of our apps are compliant, and what we're missing that
we might actually care about.
Even better would be some kind of automated compliance test harness that
exercises each command line option and the various corner cases.
---
Internationalization
How much internationalization should we do?
The low hanging fruit is UTF-8 character set support. We should do this.
(Vodz pointed out the shell's cmdedit as needing work here. What else?)
We also have lots of hardwired english text messages. Consolidating this
into some kind of message table not only makes translation easier, but
also allows us to consolidate redundant (or close) strings.
We probably don't want to be bloated with locale support. (Not unless we can
cleanly export it from our underlying C library without having to concern
ourselves with it directly. Perhaps a few specific things like a config
option for "date" are low hanging fruit here?)
What level should things happen at? How much do we care about
internationalizing the text console when X11 and xterms are so much better
at it? (There's some infrastructure here we don't implement: The
"unicode_start" and "unicode_stop" shell scripts need "vt-is-UTF8" and a
--unicode option to loadkeys. That implies a real loadkeys/dumpkeys
implementation to replace loadkmap/dumpkmap. Plus messing with console font
loading. Is it worth it, or do we just say "use X"?)
---
Unify archivers
Lots of archivers have the same general infrastructure. The directory
traversal code should be factored out, and the guts of each archiver could
@@ -129,45 +190,12 @@ Text buffer support.
a whole file into memory and act on it. There might be an opportunity
for shared code in there that could be moved into libbb...
---
Individual compilation of applets.
It would be nice if busybox had the option to compile to individual applets,
for people who want an alternate implementation less bloated than the gnu
utils (or simply with less political baggage), but without it being one big
executable.
Turning libbb into a real dll is another possibility, especially if libbb
could export some of the other library interfaces we've already more or less
got the code for (like zlib).
---
buildroot - Make a "dogfood" option
Busybox 1.1 will be capable of replacing most gnu packages for real world use,
such as developing software or in a live CD. It needs wider testing.
Busybox should now be able to replace bzip2, coreutils, e2fsprogs, file,
findutils, gawk, grep, inetutils, less, modutils, net-tools, patch, procps,
sed, shadow, sysklogd, sysvinit, tar, util-linux, and vim. The resulting
system should be self-hosting (I.E. able to rebuild itself from source code).
This means it would need (at least) binutils, gcc, and make, or equivalents.
It would be a good "eating our own dogfood" test if buildroot had the option
of using a "make allyesconfig" busybox instead of the all of the above
packages. Anything that's wrong with the resulting system, we can fix. (It
would be nice to be able to upgrade busybox to be able to replace bash and
diffutils as well, but we're not there yet.)
One example of an existing system that does this already is Firmware Linux:
http://www.landley.net/code/firmware
---
initramfs
Busybox should have a sample initramfs build script. This depends on
bbsh, mdev, and switch_root.
---
Memory Allocation
We have a CONFIG_BUFFER mechanism that lets us select whether to do memory
allocation on the stack or the heap. Unfortunately, we're not using it much.
We need to audit our memory allocations and turn a lot of malloc/free calls
into RESERVE_CONFIG_BUFFER/RELEASE_CONFIG_BUFFER.
For a start, see e.g. make CFLAGS_EXTRA=-Wlarger-than-64
For a start, see e.g. make EXTRA_CFLAGS=-Wlarger-than-64
And while we're at it, many of the CONFIG_FEATURE_CLEAN_UP #ifdefs will be
optimized out by the compiler in the stack allocation case (since there's no
@@ -247,6 +275,24 @@ Minor stuff:
if(!ioctl (fd, WDIOC_GETTIMEOUT, &tmo)) timer_duration = 1 + (tmo / 2);
Unfortunately, that needs linux/watchdog.h and that contains unfiltered
kernel types on some distros, which breaks the build.
---
use bb_error_msg where appropriate: See
egrep "(printf.*\([[:space:]]*(stderr|2)|[^_]write.*\([[:space:]]*(stderr|2))"
---
use bb_perror_msg where appropriate: See
egrep "[^_]perror"
---
Remove superfluous fmt occurances: e.g.
fprintf(stderr, "%s: %s not found\n", "unalias", *argptr);
-> fprintf(stderr, "unalias: %s not found\n", *argptr);
---
possible code duplication ingroup() and is_a_group_member()
---
unify itoa: netstat.c, hush.c, lash.c, msh.c
Put one single, robust version into e.g. safe_strtol.c
---
Move __get_hz() to a better place and (re)use it in route.c, ash.c, msh.c
---
Code cleanup:
@@ -257,4 +303,6 @@ bzero() -> memset()
---
sigblock(), siggetmask(), sigsetmask(), sigmask() -> sigprocmask et al
---
vdprintf() -> similar sized functionality
---
+1 -1
View File
@@ -12,7 +12,7 @@ top_builddir=..
endif
srcdir=$(top_srcdir)/applets
APPLETS_DIR:=./
include $(top_builddir)/Rules.mak
include $(top_srcdir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
+89 -80
View File
@@ -6,48 +6,33 @@
* isn't something I'm going to worry about... If you wrote something
* here, please feel free to acknowledge your work.
*
* 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
*
* Based in part on code from sash, Copyright (c) 1999 by David I. Bell
* Permission has been granted to redistribute this code under the GPL.
*
* Licensed under GPLv2 or later, see file License in this tarball for details.
*/
#include "busybox.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "busybox.h"
const char usage_messages[] =
#if ENABLE_SHOW_USAGE && !ENABLE_FEATURE_COMPRESS_USAGE
static const char usage_messages[] =
#define MAKE_USAGE
#include "usage.h"
#include "applets.h"
;
#undef MAKE_USAGE
#else
#define usage_messages 0
#endif /* ENABLE_SHOW_USAGE */
#undef APPLET
#undef APPLET_NOUSAGE
#undef PROTOTYPES
#include "applets.h"
static struct BB_applet *applet_using;
/* The -1 arises because of the {0,NULL,0,-1} entry above. */
@@ -56,7 +41,6 @@ const size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1);
#ifdef CONFIG_FEATURE_SUID_CONFIG
#include <sys/stat.h>
#include <ctype.h>
#include "pwd_.h"
#include "grp_.h"
@@ -112,7 +96,7 @@ static char *get_trimmed_slice(char *s, char *e)
/* Next, advance past all leading space and return a ptr to the
* first non-space char; possibly the terminating nul. */
return (char *) bb_skip_whitespace(s);
return skip_whitespace(s);
}
@@ -253,7 +237,7 @@ static void parse_config_file(void)
/* Get the specified mode. */
e = (char *) bb_skip_whitespace(e+1);
e = skip_whitespace(e+1);
for (i=0 ; i < 3 ; i++) {
const char *q;
@@ -266,7 +250,7 @@ static void parse_config_file(void)
/* Now get the the user/group info. */
s = (char *) bb_skip_whitespace(e);
s = skip_whitespace(e);
/* Note: We require whitespace between the mode and the
* user/group info. */
@@ -359,22 +343,15 @@ static void check_suid (struct BB_applet *applet)
bb_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))
bb_error_msg_and_die
("BusyBox binary has insufficient rights to set proper GID for applet!");
} else
setgid (rgid); /* no sgid -> drop */
xsetgid(sct->m_gid);
} else xsetgid(rgid); /* no sgid -> drop */
if (sct->m_mode & S_ISUID) {
if (seteuid (sct->m_uid))
bb_error_msg_and_die
("BusyBox binary has insufficient rights to set proper UID for applet!");
} else
setuid (ruid); /* no suid -> drop */
if (sct->m_mode & S_ISUID) xsetuid(sct->m_uid);
else xsetuid(ruid); /* no suid -> drop */
} else {
/* default: drop all privileges */
setgid (rgid);
setuid (ruid);
xsetgid(rgid);
xsetuid(ruid);
}
return;
} else {
@@ -390,11 +367,10 @@ static void check_suid (struct BB_applet *applet)
#endif
if (applet->need_suid == _BB_SUID_ALWAYS) {
if (geteuid () != 0)
bb_error_msg_and_die ("This applet requires root privileges!");
if (geteuid()) bb_error_msg_and_die("Applet requires root privileges!");
} else if (applet->need_suid == _BB_SUID_NEVER) {
setgid (rgid); /* drop all privileges */
setuid (ruid);
xsetgid(rgid); /* drop all privileges */
xsetuid(ruid);
}
}
#else
@@ -403,66 +379,99 @@ static void check_suid (struct BB_applet *applet)
#if ENABLE_FEATURE_COMPRESS_USAGE
#include "usage_compressed.h"
#include "unarchive.h"
static const char *unpack_usage_messages(void)
{
int input[2], output[2], pid;
char *buf;
if(pipe(input) < 0 || pipe(output) < 0)
exit(1);
pid = fork();
switch (pid) {
case -1: /* error */
exit(1);
case 0: /* child */
close(input[1]);
close(output[0]);
uncompressStream(input[0], output[1]);
exit(0);
}
/* parent */
close(input[0]);
close(output[1]);
pid = fork();
switch (pid) {
case -1: /* error */
exit(1);
case 0: /* child */
full_write(input[1], packed_usage, sizeof(packed_usage));
exit(0);
}
/* parent */
close(input[1]);
buf = xmalloc(SIZEOF_usage_messages);
full_read(output[0], buf, SIZEOF_usage_messages);
return buf;
}
#else
#define unpack_usage_messages() usage_messages
#endif /* ENABLE_FEATURE_COMPRESS_USAGE */
void bb_show_usage (void)
{
const char *format_string;
const char *usage_string = usage_messages;
int i;
if (ENABLE_SHOW_USAGE) {
const char *format_string;
const char *usage_string = unpack_usage_messages();
int i;
for (i = applet_using - applets; i > 0;) {
if (!*usage_string++) {
--i;
for (i = applet_using - applets; i > 0;)
if (!*usage_string++) --i;
format_string = "%s\n\nUsage: %s %s\n\n";
if (*usage_string == '\b')
format_string = "%s\n\nNo help available.\n\n";
fprintf (stderr, format_string, bb_msg_full_version,
applet_using->name, usage_string);
}
}
format_string = "%s\n\nUsage: %s %s\n\n";
if (*usage_string == '\b')
format_string = "%s\n\nNo help available.\n\n";
fprintf (stderr, format_string, bb_msg_full_version, applet_using->name,
usage_string);
exit (bb_default_error_retval);
}
static int applet_name_compare (const void *x, const void *y)
static int applet_name_compare(const void *name, const void *vapplet)
{
const char *name = x;
const struct BB_applet *applet = y;
const struct BB_applet *applet = vapplet;
return strcmp (name, applet->name);
return strcmp(name, applet->name);
}
extern const size_t NUM_APPLETS;
struct BB_applet *find_applet_by_name (const char *name)
struct BB_applet *find_applet_by_name(const char *name)
{
return bsearch (name, applets, NUM_APPLETS, sizeof (struct BB_applet),
return bsearch(name, applets, NUM_APPLETS, sizeof(struct BB_applet),
applet_name_compare);
}
void run_applet_by_name (const char *name, int argc, char **argv)
void run_applet_by_name(const char *name, int argc, char **argv)
{
if(ENABLE_FEATURE_SUID_CONFIG) parse_config_file ();
if (ENABLE_FEATURE_SUID_CONFIG) parse_config_file();
if(!strncmp(name, "busybox", 7)) busybox_main(argc, argv);
if (!strncmp(name, "busybox", 7)) busybox_main(argc, argv);
/* Do a binary search to find the applet entry given the name. */
applet_using = find_applet_by_name(name);
if(applet_using) {
if (applet_using) {
bb_applet_name = applet_using->name;
if(argc==2 && !strcmp(argv[1], "--help")) bb_show_usage ();
if(ENABLE_FEATURE_SUID) check_suid (applet_using);
exit ((*(applet_using->main)) (argc, argv));
if(argc==2 && !strcmp(argv[1], "--help")) bb_show_usage();
if(ENABLE_FEATURE_SUID) check_suid(applet_using);
exit((*(applet_using->main))(argc, argv));
}
}
/* END CODE */
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
+7 -10
View File
@@ -1,10 +1,15 @@
/* vi: set sw=4 ts=4: */
/*
* BusyBox' main applet dispatcher.
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include "busybox.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include "busybox.h"
#if ENABLE_LOCALE_SUPPORT
#include <locale.h>
#else
@@ -143,15 +148,7 @@ int busybox_main(int argc, char **argv)
printf("\n\n");
exit(0);
}
} else run_applet_by_name(bb_applet_name=argv[1], argc-1, argv+1);
} else run_applet_by_name(argv[1], argc-1, argv+1);
bb_error_msg_and_die("applet not found");
}
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
+40 -16
View File
@@ -5,18 +5,22 @@ export LC_CTYPE=POSIX
prefix=${1}
if [ -z "$prefix" ]; then
echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks]"
exit 1;
echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks]"
exit 1;
fi
h=`sort busybox.links | uniq`
cleanup="0"
noclobber="0"
case "$2" in
--hardlinks) linkopts="-f";;
--symlinks) linkopts="-fs";;
"") h="";;
*) echo "Unknown install option: $2"; exit 1;;
--hardlinks) linkopts="-f";;
--symlinks) linkopts="-fs";;
--cleanup) cleanup="1";;
--noclobber) noclobber="1";;
"") h="";;
*) echo "Unknown install option: $2"; exit 1;;
esac
if [ "$DO_INSTALL_LIBS" != "n" ]; then
if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_INSTALL_LIBS" != "n" ]; then
# get the target dir for the libs
# assume it starts with lib
libdir=$($CC -print-file-name=libc.so | \
@@ -34,6 +38,22 @@ if [ "$DO_INSTALL_LIBS" != "n" ]; then
fi
done
fi
if [ "$cleanup" = "1" ] && [ -e "$prefix/bin/busybox" ]; then
inode=`ls -i "$prefix/bin/busybox" | awk '{print $1}'`
sub_shell_it=`
cd "$prefix"
for d in usr/sbin usr/bin sbin bin ; do
pd=$PWD
if [ -d "$d" ]; then
cd $d
ls -iL . | grep "^ *$inode" | awk '{print $2}' | env -i xargs rm -f
fi
cd "$pd"
done
`
fi
rm -f $prefix/bin/busybox || exit 1
mkdir -p $prefix/bin || exit 1
install -m 755 busybox $prefix/bin/busybox || exit 1
@@ -42,29 +62,33 @@ for i in $h ; do
appdir=`dirname $i`
mkdir -p $prefix/$appdir || exit 1
if [ "$2" = "--hardlinks" ]; then
bb_path="$prefix/bin/busybox"
bb_path="$prefix/bin/busybox"
else
case "$appdir" in
case "$appdir" in
/)
bb_path="bin/busybox"
bb_path="bin/busybox"
;;
/bin)
bb_path="busybox"
bb_path="busybox"
;;
/sbin)
bb_path="../bin/busybox"
bb_path="../bin/busybox"
;;
/usr/bin|/usr/sbin)
bb_path="../../bin/busybox"
bb_path="../../bin/busybox"
;;
*)
echo "Unknown installation directory: $appdir"
exit 1
;;
esac
esac
fi
if [ "$noclobber" = "0" ] || [ ! -e "$prefix$i" ]; then
echo " $prefix$i -> $bb_path"
ln $linkopts $bb_path $prefix$i || exit 1
else
echo " $prefix$i already exists"
fi
echo " $prefix$i -> $bb_path"
ln $linkopts $bb_path $prefix$i || exit 1
done
exit 0
+7
View File
@@ -1,3 +1,10 @@
/* vi: set sw=4 ts=4: */
/*
* Version stuff.
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include "busybox.h"
#ifndef BB_EXTRA_VERSION
+20 -20
View File
@@ -29,7 +29,7 @@ config CONFIG_AR
probably say N here.
config CONFIG_FEATURE_AR_LONG_FILENAMES
bool " Enable support for long filenames (not need for debs)"
bool "Enable support for long filenames (not need for debs)"
default n
depends on CONFIG_AR
help
@@ -89,7 +89,7 @@ config CONFIG_DPKG_DEB
probably say N here.
config CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
bool " extract only (-x)"
bool "extract only (-x)"
default n
depends on CONFIG_DPKG_DEB
help
@@ -106,7 +106,7 @@ config CONFIG_GUNZIP
an archive, without decompressing it.
config CONFIG_FEATURE_GUNZIP_UNCOMPRESS
bool " Uncompress support"
bool "Uncompress support"
default n
depends on CONFIG_GUNZIP
help
@@ -142,7 +142,7 @@ config CONFIG_TAR
UNIX archive program.
config CONFIG_FEATURE_TAR_CREATE
bool " Enable archive creation"
bool "Enable archive creation"
default y
depends on CONFIG_TAR
help
@@ -150,7 +150,7 @@ config CONFIG_FEATURE_TAR_CREATE
tar archives using the `-c' option.
config CONFIG_FEATURE_TAR_BZIP2
bool " Enable -j option to handle .tar.bz2 files"
bool "Enable -j option to handle .tar.bz2 files"
default n
depends on CONFIG_TAR
help
@@ -158,7 +158,7 @@ config CONFIG_FEATURE_TAR_BZIP2
archives compressed with bzip2.
config CONFIG_FEATURE_TAR_LZMA
bool " Enable -a option to handle .tar.lzma files"
bool "Enable -a option to handle .tar.lzma files"
default n
depends on CONFIG_TAR
help
@@ -166,7 +166,7 @@ config CONFIG_FEATURE_TAR_LZMA
archives compressed with lzma.
config CONFIG_FEATURE_TAR_FROM
bool " Enable -X (exclude from) and -T (include from) options)"
bool "Enable -X (exclude from) and -T (include from) options)"
default n
depends on CONFIG_TAR
help
@@ -174,7 +174,7 @@ config CONFIG_FEATURE_TAR_FROM
a list of files to include or exclude from an archive.
config CONFIG_FEATURE_TAR_GZIP
bool " Enable -z option"
bool "Enable -z option"
default y
depends on CONFIG_TAR
help
@@ -182,15 +182,15 @@ config CONFIG_FEATURE_TAR_GZIP
when creating or extracting tar gziped archives.
config CONFIG_FEATURE_TAR_COMPRESS
bool " Enable -Z option"
bool "Enable -Z option"
default n
depends on CONFIG_TAR
help
If you enable this option tar will be able to call uncompress,
when extracting .tar.Z archives.
config CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
bool " Enable support for old tar header format"
config CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY
bool "Enable support for old tar header format"
default N
depends on CONFIG_TAR
help
@@ -199,7 +199,7 @@ config CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
repacking your ancient archives with the new format.
config CONFIG_FEATURE_TAR_GNU_EXTENSIONS
bool " Enable support for some GNU tar extensions"
bool "Enable support for some GNU tar extensions"
default y
depends on CONFIG_TAR
help
@@ -207,9 +207,9 @@ config CONFIG_FEATURE_TAR_GNU_EXTENSIONS
linknames.
config CONFIG_FEATURE_TAR_LONG_OPTIONS
bool " Enable long options"
bool "Enable long options"
default n
depends on CONFIG_TAR
depends on CONFIG_TAR && CONFIG_GETOPT_LONG
help
Enable use of long options, increases size by about 400 Bytes
@@ -236,11 +236,11 @@ config CONFIG_UNLZMA
should probably say N here.
config CONFIG_FEATURE_LZMA_FAST
bool " Optimze unlzma for speed"
bool "Optimze unlzma for speed"
default n
depends on CONFIG_UNLZMA
help
This option reduce decompression time by about 33% at the cost of
This option reduces decompression time by about 33% at the cost of
a 2K bigger binary.
config CONFIG_UNZIP
@@ -257,7 +257,7 @@ comment "Common options for cpio and tar"
depends on CONFIG_CPIO || CONFIG_TAR
config CONFIG_FEATURE_UNARCHIVE_TAPE
bool " Enable tape drive support"
bool "Enable tape drive support"
default n
depends on CONFIG_CPIO || CONFIG_TAR
help
@@ -267,7 +267,7 @@ comment "Common options for dpkg and dpkg_deb"
depends on CONFIG_DPKG || CONFIG_DPKG_DEB
config CONFIG_FEATURE_DEB_TAR_GZ
bool " gzip debian packages (normal)"
bool "gzip debian packages (normal)"
default y if CONFIG_DPKG || CONFIG_DPKG_DEB
depends on CONFIG_DPKG || CONFIG_DPKG_DEB
help
@@ -276,7 +276,7 @@ config CONFIG_FEATURE_DEB_TAR_GZ
If you want compatibility with standard .deb's you should say yes here.
config CONFIG_FEATURE_DEB_TAR_BZ2
bool " bzip2 debian packages"
bool "bzip2 debian packages"
default n
depends on CONFIG_DPKG || CONFIG_DPKG_DEB
help
@@ -287,7 +287,7 @@ config CONFIG_FEATURE_DEB_TAR_BZ2
use an internal control.tar.bz2 or data.tar.bz2.
config CONFIG_FEATURE_DEB_TAR_LZMA
bool " lzma debian packages"
bool "lzma debian packages"
default n
depends on CONFIG_DPKG || CONFIG_DPKG_DEB
help
+1 -1
View File
@@ -12,7 +12,7 @@ top_builddir=..
endif
ARCHIVAL_DIR:=./
srcdir=$(top_srcdir)/archival
include $(top_builddir)/Rules.mak
include $(top_srcdir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
+3 -15
View File
@@ -7,19 +7,7 @@
*
* Based in part on BusyBox tar, Debian dpkg-deb and GNU ar.
*
* 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
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*
* There is no single standard to adhere to so ar may not portable
* between different systems
@@ -97,10 +85,10 @@ int ar_main(int argc, char **argv)
while (optind < argc) {
archive_handle->filter = filter_accept_list;
archive_handle->accept = llist_add_to(archive_handle->accept, argv[optind++]);
llist_add_to(&(archive_handle->accept), argv[optind++]);
}
archive_xread_all(archive_handle, magic, 7);
xread(archive_handle->src_fd, magic, 7);
if (strncmp(magic, "!<arch>", 7) != 0) {
bb_error_msg_and_die("Invalid ar magic");
}
+6 -4
View File
@@ -1,8 +1,9 @@
/* vi: set sw=4 ts=4: */
/*
* Modified for busybox by Glenn McGrath <bug1@iinet.net.au>
* Added support output to stdout by Thomas Lundquist <thomasez@zelow.no>
*
* Licensed under GPL v2, see file LICENSE in this tarball for details.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <fcntl.h>
@@ -41,16 +42,18 @@ int bunzip2_main(int argc, char **argv)
/* Check that the input is sane. */
if (isatty(src_fd) && (opt & BUNZIP2_OPT_FORCE) == 0) {
bb_error_msg_and_die("compressed data not read from terminal. Use -f to force it.");
bb_error_msg_and_die("Compressed data not read from terminal. Use -f to force it.");
}
if (filename) {
struct stat stat_buf;
char *extension=filename+strlen(filename)-4;
if (strcmp(extension, ".bz2") != 0) {
bb_error_msg_and_die("Invalid extension");
}
xstat(filename, &stat_buf);
*extension=0;
dst_fd = bb_xopen(filename, O_WRONLY | O_CREAT);
dst_fd = bb_xopen3(filename, O_WRONLY | O_CREAT, stat_buf.st_mode);
} else dst_fd = STDOUT_FILENO;
status = uncompressStream(src_fd, dst_fd);
if(filename) {
@@ -62,4 +65,3 @@ int bunzip2_main(int argc, char **argv)
return status;
}
/* vi:set ts=4: */
+2 -14
View File
@@ -4,19 +4,7 @@
*
* Copyright (C) 2001 by Glenn McGrath
*
* 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
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*
* Limitations:
* Doesn't check CRC's
@@ -88,7 +76,7 @@ int cpio_main(int argc, char **argv)
while (optind < argc) {
archive_handle->filter = filter_accept_list;
archive_handle->accept = llist_add_to(archive_handle->accept, argv[optind]);
llist_add_to(&(archive_handle->accept), argv[optind]);
optind++;
}
+23 -137
View File
@@ -1,3 +1,4 @@
/* vi: set sw=4 ts=4: */
/*
* Mini dpkg implementation for busybox.
* This is not meant as a replacement for dpkg
@@ -7,19 +8,7 @@
*
* Started life as a busybox implementation of udpkg
*
* 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 Library 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/*
@@ -556,7 +545,7 @@ static unsigned int fill_package_struct(char *control_buffer)
"Conflicts", "Suggests", "Recommends", "Enhances", 0
};
common_node_t *new_node = (common_node_t *) xcalloc(1, sizeof(common_node_t));
common_node_t *new_node = (common_node_t *) xzalloc(sizeof(common_node_t));
char *field_name;
char *field_value;
int field_start = 0;
@@ -677,8 +666,7 @@ static void set_status(const unsigned int status_node_num, const char *new_value
bb_error_msg_and_die("DEBUG ONLY: this shouldnt happen");
}
new_status = (char *) xmalloc(want_len + flag_len + status_len + 3);
sprintf(new_status, "%s %s %s", name_hashtable[want], name_hashtable[flag], name_hashtable[status]);
new_status = bb_xasprintf("%s %s %s", name_hashtable[want], name_hashtable[flag], name_hashtable[status]);
status_hashtable[status_node_num]->status = search_name_hashtable(new_status);
free(new_status);
return;
@@ -741,79 +729,6 @@ static void index_status_file(const char *filename)
return;
}
#if 0 /* this code is no longer used */
char *get_depends_field(common_node_t *package, const int depends_type)
{
char *depends = NULL;
char *old_sep = (char *)xcalloc(1, 3);
char *new_sep = (char *)xcalloc(1, 3);
int line_size = 0;
int depends_size;
int i;
for (i = 0; i < package->num_of_edges; i++) {
if ((package->edge[i]->type == EDGE_OR_PRE_DEPENDS) ||
(package->edge[i]->type == EDGE_OR_DEPENDS)) {
}
if ((package->edge[i]->type == depends_type) ||
(package->edge[i]->type == depends_type + 1)) {
/* Check if its the first time through */
depends_size = 8 + strlen(name_hashtable[package->edge[i]->name])
+ strlen(name_hashtable[package->edge[i]->version]);
line_size += depends_size;
depends = (char *) xrealloc(depends, line_size + 1);
/* Check to see if this dependency is the type we are looking for
* +1 to check for 'extra' types, e.g. ored dependecies */
strcpy(old_sep, new_sep);
if (package->edge[i]->type == depends_type) {
strcpy(new_sep, ", ");
}
else if (package->edge[i]->type == depends_type + 1) {
strcpy(new_sep, "| ");
}
if (depends_size == line_size) {
strcpy(depends, "");
} else {
if ((strcmp(old_sep, "| ") == 0) && (strcmp(new_sep, "| ") == 0)) {
strcat(depends, " | ");
} else {
strcat(depends, ", ");
}
}
strcat(depends, name_hashtable[package->edge[i]->name]);
if (strcmp(name_hashtable[package->edge[i]->version], "NULL") != 0) {
if (package->edge[i]->operator == VER_EQUAL) {
strcat(depends, " (= ");
}
else if (package->edge[i]->operator == VER_LESS) {
strcat(depends, " (<< ");
}
else if (package->edge[i]->operator == VER_LESS_EQUAL) {
strcat(depends, " (<= ");
}
else if (package->edge[i]->operator == VER_MORE) {
strcat(depends, " (>> ");
}
else if (package->edge[i]->operator == VER_MORE_EQUAL) {
strcat(depends, " (>= ");
} else {
strcat(depends, " (");
}
strcat(depends, name_hashtable[package->edge[i]->version]);
strcat(depends, ")");
}
}
}
return(depends);
}
#endif
static void write_buffer_no_status(FILE *new_status_file, const char *control_buffer)
{
char *name;
@@ -960,9 +875,7 @@ static void write_status_file(deb_file_t **deb_file)
/* Create a separate backfile to dpkg */
if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) {
struct stat stat_buf;
if (stat("/var/lib/dpkg/status", &stat_buf) == 0) {
bb_error_msg_and_die("Couldnt create backup status file");
}
xstat("/var/lib/dpkg/status", &stat_buf);
/* Its ok if renaming the status file fails because status
* file doesnt exist, maybe we are starting from scratch */
bb_error_msg("No status file found, creating new one");
@@ -1027,11 +940,9 @@ static int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
package_hashtable[package_num]->edge[j]->operator);
if (package_hashtable[conflicts_package_num] == NULL) {
/* create a new package */
common_node_t *new_node = (common_node_t *) xmalloc(sizeof(common_node_t));
common_node_t *new_node = (common_node_t *) xzalloc(sizeof(common_node_t));
new_node->name = package_hashtable[package_num]->edge[j]->name;
new_node->version = package_hashtable[package_num]->edge[j]->version;
new_node->num_of_edges = 0;
new_node->edge = NULL;
package_hashtable[conflicts_package_num] = new_node;
}
conflicts = xrealloc(conflicts, sizeof(int) * (conflicts_num + 1));
@@ -1111,15 +1022,6 @@ static int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
continue;
}
#if 0
/* This might be needed so we don't complain about
* things which are broken but unrelated to the
* packages that are currently being installed
*/
if (state_status == search_name_hashtable("installed"))
continue;
#endif
/* This code is tested only for EDGE_DEPENDS, since I
* have no suitable pre-depends available. There is no
* reason that it shouldn't work though :-)
@@ -1279,15 +1181,10 @@ static int run_package_script(const char *package_name, const char *script_type)
char *script_path;
int result;
script_path = xmalloc(strlen(package_name) + strlen(script_type) + 21);
sprintf(script_path, "/var/lib/dpkg/info/%s.%s", package_name, script_type);
script_path = bb_xasprintf("/var/lib/dpkg/info/%s.%s", package_name, script_type);
/* If the file doesnt exist is isnt a fatal */
if (lstat(script_path, &path_stat) < 0) {
result = EXIT_SUCCESS;
} else {
result = system(script_path);
}
result = lstat(script_path, &path_stat) < 0 ? EXIT_SUCCESS : system(script_path);
free(script_path);
return(result);
}
@@ -1301,13 +1198,11 @@ static char **all_control_list(const char *package_name)
char **remove_files;
/* Create a list of all /var/lib/dpkg/info/<package> files */
remove_files = xmalloc(sizeof(all_control_files));
remove_files = xzalloc(sizeof(all_control_files));
while (all_control_files[i]) {
remove_files[i] = xmalloc(strlen(package_name) + strlen(all_control_files[i]) + 21);
sprintf(remove_files[i], "/var/lib/dpkg/info/%s.%s", package_name, all_control_files[i]);
remove_files[i] = bb_xasprintf("/var/lib/dpkg/info/%s.%s", package_name, all_control_files[i]);
i++;
}
remove_files[sizeof(all_control_files)/sizeof(char*) - 1] = NULL;
return(remove_files);
}
@@ -1400,11 +1295,9 @@ static void remove_package(const unsigned int package_num, int noisy)
free_array(remove_files);
/* Create a list of files in /var/lib/dpkg/info/<package>.* to keep */
exclude_files = xmalloc(sizeof(char*) * 3);
exclude_files = xzalloc(sizeof(char*) * 3);
exclude_files[0] = bb_xstrdup(conffile_name);
exclude_files[1] = xmalloc(package_name_length + 27);
sprintf(exclude_files[1], "/var/lib/dpkg/info/%s.postrm", package_name);
exclude_files[2] = NULL;
exclude_files[1] = bb_xasprintf("/var/lib/dpkg/info/%s.postrm", package_name);
/* Create a list of all /var/lib/dpkg/info/<package> files */
remove_files = all_control_list(package_name);
@@ -1440,8 +1333,7 @@ static 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(sizeof(char*));
exclude_files[0] = NULL;
exclude_files = xzalloc(sizeof(char*));
/* Some directories cant be removed straight away, so do multiple passes */
while (remove_file_array(remove_files, exclude_files));
@@ -1484,10 +1376,10 @@ static void init_archive_deb_control(archive_handle_t *ar_handle)
/* We don't care about data.tar.* or debian-binary, just control.tar.* */
#ifdef CONFIG_FEATURE_DEB_TAR_GZ
ar_handle->accept = llist_add_to(NULL, "control.tar.gz");
llist_add_to(&(ar_handle->accept), "control.tar.gz");
#endif
#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
ar_handle->accept = llist_add_to(ar_handle->accept, "control.tar.bz2");
llist_add_to(&(ar_handle->accept), "control.tar.bz2");
#endif
/* Assign the tar handle as a subarchive of the ar handle */
@@ -1506,10 +1398,10 @@ static void init_archive_deb_data(archive_handle_t *ar_handle)
/* We don't care about control.tar.* or debian-binary, just data.tar.* */
#ifdef CONFIG_FEATURE_DEB_TAR_GZ
ar_handle->accept = llist_add_to(NULL, "data.tar.gz");
llist_add_to(&(ar_handle->accept), "data.tar.gz");
#endif
#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
ar_handle->accept = llist_add_to(ar_handle->accept, "data.tar.bz2");
llist_add_to(&(ar_handle->accept), "data.tar.bz2");
#endif
/* Assign the tar handle as a subarchive of the ar handle */
@@ -1536,9 +1428,7 @@ static void data_extract_all_prefix(archive_handle_t *archive_handle)
name_ptr += strspn(name_ptr, "./");
if (name_ptr[0] != '\0') {
archive_handle->file_header->name = xmalloc(strlen(archive_handle->buffer) + 2 + strlen(name_ptr));
strcpy(archive_handle->file_header->name, archive_handle->buffer);
strcat(archive_handle->file_header->name, name_ptr);
archive_handle->file_header->name = bb_xasprintf("%s%s", archive_handle->buffer, name_ptr);
data_extract_all(archive_handle);
}
return;
@@ -1567,15 +1457,13 @@ static void unpack_package(deb_file_t *deb_file)
}
/* Extract control.tar.gz to /var/lib/dpkg/info/<package>.filename */
info_prefix = (char *) xmalloc(strlen(package_name) + 20 + 4 + 2);
sprintf(info_prefix, "/var/lib/dpkg/info/%s.", package_name);
info_prefix = bb_xasprintf("/var/lib/dpkg/info/%s.", package_name);
archive_handle = init_archive_deb_ar(deb_file->filename);
init_archive_deb_control(archive_handle);
while(all_control_files[i]) {
char *c = (char *) xmalloc(3 + bb_strlen(all_control_files[i]));
sprintf(c, "./%s", all_control_files[i]);
accept_list= llist_add_to(accept_list, c);
char *c = bb_xasprintf("./%s", all_control_files[i]);
llist_add_to(&accept_list, c);
i++;
}
archive_handle->sub_archive->accept = accept_list;
@@ -1699,13 +1587,13 @@ int dpkg_main(int argc, char **argv)
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));
deb_file[deb_count] = (deb_file_t *) xzalloc(sizeof(deb_file_t));
if (dpkg_opt & dpkg_opt_filename) {
archive_handle_t *archive_handle;
llist_t *control_list = NULL;
/* Extract the control file */
control_list = llist_add_to(NULL, "./control");
llist_add_to(&control_list, "./control");
archive_handle = init_archive_deb_ar(argv[optind]);
init_archive_deb_control(archive_handle);
deb_file[deb_count]->control_file = deb_extract_control_file_to_buffer(archive_handle, control_list);
@@ -1742,8 +1630,6 @@ int dpkg_main(int argc, char **argv)
}
}
else if (dpkg_opt & dpkg_opt_package_name) {
deb_file[deb_count]->filename = NULL;
deb_file[deb_count]->control_file = NULL;
deb_file[deb_count]->package = search_package_hashtable(
search_name_hashtable(argv[optind]),
search_name_hashtable("ANY"), VER_ANY);
+10 -20
View File
@@ -1,18 +1,8 @@
/* vi: set sw=4 ts=4: */
/*
* 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 Library 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.
* dpkg-deb packs, unpacks and provides information about Debian archives.
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <fcntl.h>
#include <stdlib.h>
@@ -46,13 +36,13 @@ int dpkg_deb_main(int argc, char **argv)
ar_archive->filter = filter_accept_list_reassign;
#ifdef CONFIG_FEATURE_DEB_TAR_GZ
ar_archive->accept = llist_add_to(NULL, "data.tar.gz");
control_tar_llist = llist_add_to(NULL, "control.tar.gz");
llist_add_to(&(ar_archive->accept), "data.tar.gz");
llist_add_to(&control_tar_llist, "control.tar.gz");
#endif
#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
ar_archive->accept = llist_add_to(ar_archive->accept, "data.tar.bz2");
control_tar_llist = llist_add_to(control_tar_llist, "control.tar.bz2");
llist_add_to(&(ar_archive->accept), "data.tar.bz2");
llist_add_to(&control_tar_llist, "control.tar.bz2");
#endif
bb_opt_complementally = "?c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX";
@@ -75,7 +65,7 @@ int dpkg_deb_main(int argc, char **argv)
* it should accept a second argument which specifies a
* specific field to print */
ar_archive->accept = control_tar_llist;
tar_archive->accept = llist_add_to(NULL, "./control");
llist_add_to(&(tar_archive->accept), "./control");
tar_archive->filter = filter_accept_list;
tar_archive->action_data = data_extract_to_stdout;
}
@@ -99,8 +89,8 @@ int dpkg_deb_main(int argc, char **argv)
extract_dir = argv[optind];
}
if (extract_dir) {
mkdir(extract_dir, 0777);
chdir(extract_dir);
mkdir(extract_dir, 0777); /* bb_make_directory(extract_dir, 0777, 0) */
bb_xchdir(extract_dir);
}
unpack_ar_archive(ar_archive);
+5 -41
View File
@@ -14,20 +14,7 @@
* General cleanup to better adhere to the style guide and make use of standard
* busybox functions by Glenn McGrath <bug1@iinet.net.au>
*
* 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
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*
* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
* Copyright (C) 1992-1993 Jean-loup Gailly
@@ -40,26 +27,6 @@
* See the file algorithm.doc for the compression algorithms and file formats.
*/
#if 0
static char *license_msg[] = {
" Copyright (C) 1992-1993 Jean-loup Gailly",
" 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.",
0
};
#endif
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -137,21 +104,18 @@ int gunzip_main(int argc, char **argv)
bb_error_msg_and_die("Invalid extension");
}
/* Open output file */
dst_fd = bb_xopen(new_path, O_WRONLY | O_CREAT);
/* Set permissions on the file */
chmod(new_path, stat_buf.st_mode);
/* Open output file (with correct permissions) */
dst_fd = bb_xopen3(new_path, O_WRONLY | O_CREAT, stat_buf.st_mode);
/* If unzip succeeds remove the old file */
delete_path = old_path;
}
/* do the decompression, and cleanup */
if (bb_xread_char(src_fd) == 0x1f) {
if (xread_char(src_fd) == 0x1f) {
unsigned char magic2;
magic2 = bb_xread_char(src_fd);
magic2 = xread_char(src_fd);
#ifdef CONFIG_FEATURE_GUNZIP_UNCOMPRESS
if (magic2 == 0x9d) {
status = uncompress(src_fd, dst_fd);
+24 -58
View File
@@ -16,11 +16,7 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/* These defines are very important for BusyBox. Without these,
* huge chunks of ram are pre-allocated making the BusyBox bss
* size Freaking Huge(tm), which is a bad thing.*/
#define SMALL_MEM
#define DYN_ALLOC
#include <stdlib.h>
#include <stdio.h>
@@ -87,17 +83,11 @@ typedef unsigned long ulg;
# endif
#endif
#ifdef DYN_ALLOC
# define DECLARE(type, array, size) static type * array
# define ALLOC(type, array, size) { \
array = (type*)xcalloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
array = (type*)xzalloc((size_t)(((size)+1L)/2) * 2*sizeof(type)); \
}
# define FREE(array) {free(array), array=NULL;}
#else
# define DECLARE(type, array, size) static type array[size]
# define ALLOC(type, array, size)
# define FREE(array)
#endif
#define tab_suffix window
#define tab_prefix prev /* hash link (see deflate.c) */
@@ -154,15 +144,6 @@ typedef int file_t; /* Do not use stdio */
#define put_byte(c) {outbuf[outcnt++]=(uch)(c); if (outcnt==OUTBUFSIZ)\
flush_outbuf();}
/* Output a 32 bit value to the bit stream, lsb first */
#if 0
#define put_long(n) { \
put_short((n) & 0xffff); \
put_short(((ulg)(n)) >> 16); \
}
#endif
#define seekable() 0 /* force sequential output */
#define translate_eol 0 /* no option -a yet */
@@ -293,6 +274,7 @@ static int ofd; /* output file descriptor */
static unsigned insize; /* valid bytes in inbuf */
static unsigned outcnt; /* bytes in output buffer */
static uint32_t *crc_32_tab;
/* Output a 16 bit value, lsb first */
static void put_short(ush w)
@@ -333,7 +315,7 @@ static void write_buf(int fd, void *buf, unsigned cnt)
unsigned n;
while ((n = write(fd, buf, cnt)) != cnt) {
if (n == (unsigned) (-1)) bb_error_msg_and_die("can't write");
if (n == (unsigned) (-1)) bb_error_msg_and_die(bb_msg_write_error);
cnt -= n;
buf = (void *) ((char *) buf + n);
}
@@ -344,32 +326,13 @@ static void write_buf(int fd, void *buf, unsigned cnt)
* pointer, then initialize the crc shift register contents instead.
* Return the current crc in either case.
*/
static ulg updcrc(uch * s, unsigned n)
static uint32_t updcrc(uch * s, unsigned n)
{
static ulg crc = (ulg) 0xffffffffL; /* shift register contents */
register ulg c; /* temporary variable */
static unsigned long crc_32_tab[256];
if (crc_32_tab[1] == 0x00000000L) {
unsigned long csr; /* crc shift register */
const unsigned long e = 0xedb88320L; /* polynomial exclusive-or pattern */
int i; /* counter for all possible eight bit values */
int k; /* byte being shifted into crc apparatus */
/* Compute table of CRC's. */
for (i = 1; i < 256; i++) {
csr = i;
/* The idea to initialize the register with the byte instead of
* zero was stolen from Haruhiko Okumura's ar002
*/
for (k = 8; k; k--)
csr = csr & 1 ? (csr >> 1) ^ e : csr >> 1;
crc_32_tab[i] = csr;
}
}
static uint32_t crc = ~0; /* shift register contents */
uint32_t c; /* temporary variable */
if (s == NULL) {
c = 0xffffffffL;
c = ~0;
} else {
c = crc;
if (n)
@@ -378,7 +341,7 @@ static ulg updcrc(uch * s, unsigned n)
} while (--n);
}
crc = c;
return c ^ 0xffffffffL; /* (instead of ~c for 64-bit machines) */
return ~c;
}
/* bits.c -- output variable-length bit strings
@@ -512,7 +475,7 @@ static void send_bits(int value, int length)
*/
static unsigned bi_reverse(unsigned code, int len)
{
register unsigned res = 0;
unsigned res = 0;
do {
res |= code & 1;
@@ -810,7 +773,7 @@ static void check_match(IPos start, IPos match, int length);
*/
static void lm_init(ush * flags)
{
register unsigned j;
unsigned j;
/* Initialize the hash table. */
memset(head, 0, HASH_SIZE * sizeof(*head));
@@ -860,9 +823,9 @@ static void lm_init(ush * flags)
static int longest_match(IPos cur_match)
{
unsigned chain_length = max_chain_length; /* max hash chain length */
register uch *scan = window + strstart; /* current string */
register uch *match; /* matched string */
register int len; /* length of current match */
uch *scan = window + strstart; /* current string */
uch *match; /* matched string */
int len; /* length of current match */
int best_len = prev_length; /* best match length so far */
IPos limit =
strstart > (IPos) MAX_DIST ? strstart - (IPos) MAX_DIST : NIL;
@@ -876,9 +839,9 @@ static int longest_match(IPos cur_match)
#if HASH_BITS < 8 || MAX_MATCH != 258
# error Code too clever
#endif
register uch *strend = window + strstart + MAX_MATCH;
register uch scan_end1 = scan[best_len - 1];
register uch scan_end = scan[best_len];
uch *strend = window + strstart + MAX_MATCH;
uch scan_end1 = scan[best_len - 1];
uch scan_end = scan[best_len];
/* Do not waste too much time if we already have a good match: */
if (prev_length >= good_match) {
@@ -965,7 +928,7 @@ static void check_match(IPos start, IPos match, int length)
*/
static void fill_window(void)
{
register unsigned n, m;
unsigned n, m;
unsigned more =
(unsigned) (window_size - (ulg) lookahead - (ulg) strstart);
/* Amount of free space at the end of the window. */
@@ -1033,7 +996,7 @@ static ulg deflate(void)
IPos prev_match; /* previous match */
int flush; /* set if current block must be flushed */
int match_available = 0; /* set if previous match exists */
register unsigned match_length = MIN_MATCH - 1; /* length of best match */
unsigned match_length = MIN_MATCH - 1; /* length of best match */
/* Process the input block. */
while (lookahead != 0) {
@@ -1223,6 +1186,9 @@ int gzip_main(int argc, char **argv)
ALLOC(uch, window, 2L * WSIZE);
ALLOC(ush, tab_prefix, 1L << BITS);
/* Initialise the CRC32 table */
crc_32_tab = bb_crc32_filltable(0);
clear_bufs();
part_nb = 0;
@@ -1243,8 +1209,8 @@ int gzip_main(int argc, char **argv)
inFileNum = STDIN_FILENO;
outFileNum = STDOUT_FILENO;
} else {
inFileNum = open(argv[i], O_RDONLY);
if (inFileNum < 0 || fstat(inFileNum, &statBuf) < 0)
inFileNum = bb_xopen3(argv[i], O_RDONLY, 0);
if (fstat(inFileNum, &statBuf) < 0)
bb_perror_msg_and_die("%s", argv[i]);
time_stamp = statBuf.st_ctime;
ifile_size = statBuf.st_size;
@@ -2416,7 +2382,7 @@ static void set_file_type(void)
*/
static ulg crc; /* crc on uncompressed file data */
static uint32_t crc; /* crc on uncompressed file data */
static long header_bytes; /* number of bytes in gzip header */
static void put_long(ulg n)
+1 -1
View File
@@ -25,7 +25,7 @@ top_builddir=../..
endif
srcdir=$(top_srcdir)/archival/libunarchive
LIBUNARCHIVE_DIR:=./
include $(top_builddir)/Rules.mak
include $(top_srcdir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
+1 -1
View File
@@ -29,7 +29,6 @@ LIBUNARCHIVE-y:= \
header_list.o \
header_verbose_list.o \
\
archive_xread_all.o \
archive_xread_all_eof.o \
\
seek_by_char.o \
@@ -67,6 +66,7 @@ LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_GZIP) += $(GUNZIP_FILES) get_header_tar_gz.o
LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_COMPRESS) += decompress_uncompress.o
LIBUNARCHIVE-$(CONFIG_UNCOMPRESS) += decompress_uncompress.o
LIBUNARCHIVE-$(CONFIG_UNZIP) += $(GUNZIP_FILES)
LIBUNARCHIVE-$(CONFIG_FEATURE_COMPRESS_USAGE) += decompress_bunzip2.o
LIBUNARCHIVE-y:=$(sort $(LIBUNARCHIVE-y))
-32
View File
@@ -1,32 +0,0 @@
/*
* 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 Library 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "unarchive.h"
#include "libbb.h"
void archive_xread_all(const archive_handle_t *archive_handle, void *buf, const size_t count)
{
ssize_t size;
size = bb_full_read(archive_handle->src_fd, buf, count);
if (size != count) {
bb_error_msg_and_die("Short read");
}
return;
}
+3 -14
View File
@@ -1,17 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
* 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 Library 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdio.h>
@@ -24,7 +13,7 @@ ssize_t archive_xread_all_eof(archive_handle_t *archive_handle, unsigned char *b
{
ssize_t size;
size = bb_full_read(archive_handle->src_fd, buf, count);
size = full_read(archive_handle->src_fd, buf, count);
if ((size != 0) && (size != count)) {
bb_perror_msg_and_die("Short read, read %ld of %ld", (long)size, (long)count);
}
+11 -7
View File
@@ -1,3 +1,7 @@
/* vi: set sw=4 ts=4: */
/*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdlib.h>
#include <unistd.h>
#include "libbb.h"
@@ -16,7 +20,7 @@ void check_header_gzip(int src_fd)
} formated;
} header;
bb_xread_all(src_fd, header.raw, 8);
xread(src_fd, header.raw, 8);
/* Check the compression method */
if (header.formated.method != 8) {
@@ -28,10 +32,10 @@ void check_header_gzip(int src_fd)
/* bit 2 set: extra field present */
unsigned char extra_short;
extra_short = bb_xread_char(src_fd) + (bb_xread_char(src_fd) << 8);
extra_short = xread_char(src_fd) + (xread_char(src_fd) << 8);
while (extra_short > 0) {
/* Ignore extra field */
bb_xread_char(src_fd);
xread_char(src_fd);
extra_short--;
}
}
@@ -39,19 +43,19 @@ void check_header_gzip(int src_fd)
/* Discard original name if any */
if (header.formated.flags & 0x08) {
/* bit 3 set: original file name present */
while(bb_xread_char(src_fd) != 0);
while(xread_char(src_fd) != 0);
}
/* Discard file comment if any */
if (header.formated.flags & 0x10) {
/* bit 4 set: file comment present */
while(bb_xread_char(src_fd) != 0);
while(xread_char(src_fd) != 0);
}
/* Read the header checksum */
if (header.formated.flags & 0x02) {
bb_xread_char(src_fd);
bb_xread_char(src_fd);
xread_char(src_fd);
xread_char(src_fd);
}
return;
+2 -13
View File
@@ -1,17 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
* 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <sys/types.h>
+2 -13
View File
@@ -1,17 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
* 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <sys/types.h>
+5 -15
View File
@@ -1,17 +1,8 @@
/* vi: set sw=4 ts=4: */
/*
* 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.
* Copyright 2002 Glenn McGrath
*
* 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include "libbb.h"
@@ -21,8 +12,7 @@ void data_extract_to_buffer(archive_handle_t *archive_handle)
{
const unsigned int size = archive_handle->file_header->size;
archive_handle->buffer = xmalloc(size + 1);
archive_handle->buffer = xzalloc(size + 1);
archive_xread_all(archive_handle, archive_handle->buffer, size);
archive_handle->buffer[size] = '\0';
xread(archive_handle->src_fd, archive_handle->buffer, size);
}
+2 -13
View File
@@ -1,17 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
* 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include "unarchive.h"
+2 -13
View File
@@ -1,17 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
* 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <sys/types.h>
+15 -20
View File
@@ -1,13 +1,12 @@
/* vi: set sw=4 ts=4: */
/* Small bzip2 deflate implementation, by Rob Landley (rob@landley.net).
/* Small bzip2 deflate implementation, by Rob Landley (rob@landley.net).
Based on bzip2 decompression code by Julian R Seward (jseward@acm.org),
which also acknowledges contributions by Mike Burrows, David Wheeler,
Peter Fenwick, Alistair Moffat, Radford Neal, Ian H. Witten,
Robert Sedgewick, and Jon L. Bentley.
Based on bzip2 decompression code by Julian R Seward (jseward@acm.org),
which also acknowledges contributions by Mike Burrows, David Wheeler,
Peter Fenwick, Alistair Moffat, Radford Neal, Ian H. Witten,
Robert Sedgewick, and Jon L. Bentley.
This code is licensed under the LGPLv2:
LGPL http://www.gnu.org/copyleft/lgpl.html
Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/*
@@ -24,7 +23,7 @@
I would ask that anyone benefiting from this work, especially those
using it in commercial products, consider making a donation to my local
non-profit hospice organization (www.hospiceacadiana.com) in the name of
the woman I loved, Toni W. Hagan, who passed away Feb. 12, 2003.
the woman I loved, Toni W. Hagan, who passed away Feb. 12, 2003.
Manuel
*/
@@ -38,6 +37,8 @@
#include "libbb.h"
#include "unarchive.h"
/* Constants for Huffman coding */
#define MAX_GROUPS 6
#define GROUP_SIZE 50 /* 64 would have been more efficient */
@@ -82,8 +83,8 @@ typedef struct {
/* The CRC values stored in the block header and calculated from the data */
unsigned int crc32Table[256],headerCRC, totalCRC, writeCRC;
uint32_t headerCRC, totalCRC, writeCRC;
uint32_t *crc32Table;
/* Intermediate buffer and its size (in bytes) */
unsigned int *dbuf, dbufSize;
@@ -618,7 +619,7 @@ decode_next_byte:
bd->writeCount=previous;
return (previous!=RETVAL_LAST_BLOCK) ? previous : gotcount;
}
bd->writeCRC=0xffffffffUL;
bd->writeCRC=~0;
pos=bd->writePos;
current=bd->writeCurrent;
goto decode_next_byte;
@@ -632,7 +633,7 @@ static int start_bunzip(bunzip_data **bdp, int in_fd, unsigned char *inbuf,
int len)
{
bunzip_data *bd;
unsigned int i,j,c;
unsigned int i;
const unsigned int BZh0=(((unsigned int)'B')<<24)+(((unsigned int)'Z')<<16)
+(((unsigned int)'h')<<8)+(unsigned int)'0';
@@ -643,8 +644,7 @@ static int start_bunzip(bunzip_data **bdp, int in_fd, unsigned char *inbuf,
/* Allocate bunzip_data. Most fields initialize to zero. */
bd=*bdp=xmalloc(i);
memset(bd,0,sizeof(bunzip_data));
bd=*bdp=xzalloc(i);
/* Setup input buffer */
@@ -655,12 +655,7 @@ static int start_bunzip(bunzip_data **bdp, int in_fd, unsigned char *inbuf,
/* Init the CRC32 table (big endian) */
for(i=0;i<256;i++) {
c=i<<24;
for(j=8;j;j--)
c=c&0x80000000 ? (c<<1)^0x04c11db7 : (c<<1);
bd->crc32Table[i]=c;
}
bd->crc32Table = bb_crc32_filltable(1);
/* Setup for I/O error handling via longjmp */
@@ -1,3 +1,4 @@
/* vi: set sw=4 ts=4: */
#include "libbb.h"
/* uncompress for busybox -- (c) 2002 Robert Griebl
@@ -76,7 +77,7 @@ static unsigned char inbuf[IBUFSIZ + 64];
static unsigned char outbuf[OBUFSIZ + 2048];
static long int htab[HSIZE];
static unsigned char htab[HSIZE];
static unsigned short codetab[HSIZE];
#define htabof(i) htab[i]
@@ -115,7 +116,7 @@ int uncompress(int fd_in, int fd_out)
insize = 0;
inbuf[0] = bb_xread_char(fd_in);
inbuf[0] = xread_char(fd_in);
maxbits = inbuf[0] & BIT_MASK;
block_mode = inbuf[0] & BLOCK_MODE;
+147 -24
View File
@@ -1,3 +1,4 @@
/* vi: set sw=4 ts=4: */
/*
* Small lzma deflate implementation.
* Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
@@ -5,29 +6,154 @@
* Based on LzmaDecode.c from the LZMA SDK 4.22 (http://www.7-zip.org/)
* Copyright (C) 1999-2005 Igor Pavlov
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <byteswap.h>
#include "libbb.h"
#include "unarchive.h"
#include "rangecoder.h"
#ifdef CONFIG_FEATURE_LZMA_FAST
# define speed_inline ATTRIBUTE_ALWAYS_INLINE
#else
# define speed_inline
#endif
typedef struct {
int fd;
uint8_t *ptr;
uint8_t *buffer;
uint8_t *buffer_end;
int buffer_size;
uint32_t code;
uint32_t range;
uint32_t bound;
} rc_t;
#define RC_TOP_BITS 24
#define RC_MOVE_BITS 5
#define RC_MODEL_TOTAL_BITS 11
/* Called twice: once at startup and once in rc_normalize() */
static void rc_read(rc_t * rc)
{
rc->buffer_size = read(rc->fd, rc->buffer, rc->buffer_size);
if (rc->buffer_size <= 0)
bb_error_msg_and_die("unexpected EOF");
rc->ptr = rc->buffer;
rc->buffer_end = rc->buffer + rc->buffer_size;
}
/* Called once */
static void rc_init(rc_t * rc, int fd, int buffer_size)
{
int i;
rc->fd = fd;
rc->buffer = xmalloc(buffer_size);
rc->buffer_size = buffer_size;
rc->buffer_end = rc->buffer + rc->buffer_size;
rc->ptr = rc->buffer_end;
rc->code = 0;
rc->range = 0xFFFFFFFF;
for (i = 0; i < 5; i++) {
if (rc->ptr >= rc->buffer_end)
rc_read(rc);
rc->code = (rc->code << 8) | *rc->ptr++;
}
}
/* Called once. TODO: bb_maybe_free() */
static ATTRIBUTE_ALWAYS_INLINE void rc_free(rc_t * rc)
{
if (ENABLE_FEATURE_CLEAN_UP)
free(rc->buffer);
}
/* Called twice, but one callsite is in speed_inline'd rc_is_bit_0_helper() */
static void rc_do_normalize(rc_t * rc)
{
if (rc->ptr >= rc->buffer_end)
rc_read(rc);
rc->range <<= 8;
rc->code = (rc->code << 8) | *rc->ptr++;
}
static ATTRIBUTE_ALWAYS_INLINE void rc_normalize(rc_t * rc)
{
if (rc->range < (1 << RC_TOP_BITS)) {
rc_do_normalize(rc);
}
}
/* Called 9 times */
/* Why rc_is_bit_0_helper exists?
* Because we want to always expose (rc->code < rc->bound) to optimizer
*/
static speed_inline uint32_t rc_is_bit_0_helper(rc_t * rc, uint16_t * p)
{
rc_normalize(rc);
rc->bound = *p * (rc->range >> RC_MODEL_TOTAL_BITS);
return rc->bound;
}
static ATTRIBUTE_ALWAYS_INLINE int rc_is_bit_0(rc_t * rc, uint16_t * p)
{
uint32_t t = rc_is_bit_0_helper(rc, p);
return rc->code < t;
}
/* Called ~10 times, but very small, thus inlined */
static speed_inline void rc_update_bit_0(rc_t * rc, uint16_t * p)
{
rc->range = rc->bound;
*p += ((1 << RC_MODEL_TOTAL_BITS) - *p) >> RC_MOVE_BITS;
}
static speed_inline void rc_update_bit_1(rc_t * rc, uint16_t * p)
{
rc->range -= rc->bound;
rc->code -= rc->bound;
*p -= *p >> RC_MOVE_BITS;
}
/* Called 4 times in unlzma loop */
static int rc_get_bit(rc_t * rc, uint16_t * p, int *symbol)
{
if (rc_is_bit_0(rc, p)) {
rc_update_bit_0(rc, p);
*symbol *= 2;
return 0;
} else {
rc_update_bit_1(rc, p);
*symbol = *symbol * 2 + 1;
return 1;
}
}
/* Called once */
static ATTRIBUTE_ALWAYS_INLINE int rc_direct_bit(rc_t * rc)
{
rc_normalize(rc);
rc->range >>= 1;
if (rc->code >= rc->range) {
rc->code -= rc->range;
return 1;
}
return 0;
}
/* Called twice */
static speed_inline void
rc_bit_tree_decode(rc_t * rc, uint16_t * p, int num_levels, int *symbol)
{
int i = num_levels;
*symbol = 1;
while (i--)
rc_get_bit(rc, p + *symbol, symbol);
*symbol -= 1 << num_levels;
}
typedef struct {
@@ -119,10 +245,8 @@ int unlzma(int src_fd, int dst_fd)
pos_state_mask = (1 << pb) - 1;
literal_pos_mask = (1 << lp) - 1;
#if BB_BIG_ENDIAN
header.dict_size = bswap_32(header.dict_size);
header.dst_size = bswap_64(header.dst_size);
#endif
header.dict_size = SWAP_LE32(header.dict_size);
header.dst_size = SWAP_LE64(header.dst_size);
if (header.dict_size == 0)
header.dict_size = 1;
@@ -344,4 +468,3 @@ int unlzma(int src_fd, int dst_fd)
return 0;
}
/* vi:set ts=4: */
+36 -103
View File
@@ -21,21 +21,6 @@
* to free leaked bytebuffer memory (used in unzip.c), and some minor style
* guide cleanups by Ed Clark
*
* 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
*
*
* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
* Copyright (C) 1992-1993 Jean-loup Gailly
* The unzip code was written and put in the public domain by Mark Adler.
@@ -43,38 +28,14 @@
* written by Spencer Thomas, Joe Orost, James Woods, Jim McKie, Steve Davies,
* Ken Turkowski, Dave Mack and Peter Jannesen.
*
* See the license_msg below and the file COPYING for the software license.
* See the file algorithm.doc for the compression algorithms and file formats.
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#if 0
static char *license_msg[] = {
" Copyright (C) 1992-1993 Jean-loup Gailly",
" 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.",
0
};
#endif
#include <sys/types.h>
#include "libbb.h"
#include <sys/wait.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include "libbb.h"
#include "unarchive.h"
typedef struct huft_s {
@@ -95,8 +56,8 @@ static unsigned int gunzip_outbuf_count; /* bytes in output buffer */
enum { gunzip_wsize = 0x8000 };
static unsigned char *gunzip_window;
static unsigned int *gunzip_crc_table;
unsigned int gunzip_crc;
static uint32_t *gunzip_crc_table;
uint32_t gunzip_crc;
/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
#define BMAX 16 /* maximum bit length of any code (16 for explode) */
@@ -155,9 +116,8 @@ static unsigned int fill_bitbuffer(unsigned int bitbuffer, unsigned int *current
/* Leave the first 4 bytes empty so we can always unwind the bitbuffer
* to the front of the bytebuffer, leave 4 bytes free at end of tail
* so we can easily top up buffer in check_trailer_gzip() */
if (!(bytebuffer_size = bb_xread(gunzip_src_fd, &bytebuffer[4], bytebuffer_max - 8))) {
if (1 > (bytebuffer_size = safe_read(gunzip_src_fd, &bytebuffer[4], bytebuffer_max - 8)))
bb_error_msg_and_die("unexpected end of file");
}
bytebuffer_size += 4;
bytebuffer_offset = 4;
}
@@ -168,35 +128,6 @@ static unsigned int fill_bitbuffer(unsigned int bitbuffer, unsigned int *current
return(bitbuffer);
}
static void make_gunzip_crc_table(void)
{
const unsigned int poly = 0xedb88320; /* polynomial exclusive-or pattern */
unsigned short i; /* counter for all possible eight bit values */
/* initial shift register value */
gunzip_crc = 0xffffffffL;
gunzip_crc_table = (unsigned int *) xmalloc(256 * sizeof(unsigned int));
/* Compute and print table of CRC's, five per line */
for (i = 0; i < 256; i++) {
unsigned int table_entry; /* crc shift register */
unsigned char k; /* byte being shifted into crc apparatus */
table_entry = i;
/* The idea to initialize the register with the byte instead of
* zero was stolen from Haruhiko Okumura's ar002
*/
for (k = 8; k; k--) {
if (table_entry & 1) {
table_entry = (table_entry >> 1) ^ poly;
} else {
table_entry >>= 1;
}
}
gunzip_crc_table[i] = table_entry;
}
}
/*
* Free the malloc'ed tables built by huft_build(), which makes a linked
* list of the tables it made, with the links in a dummy first entry of
@@ -232,6 +163,7 @@ static int huft_free(huft_t * t)
* t: result: starting table
* m: maximum lookup bits, returns actual
*/
static
int huft_build(unsigned int *b, const unsigned int n,
const unsigned int s, const unsigned short *d,
const unsigned char *e, huft_t ** t, unsigned int *m)
@@ -241,17 +173,17 @@ int huft_build(unsigned int *b, const unsigned int n,
unsigned eob_len; /* length of end-of-block code (value 256) */
unsigned f; /* i repeats in table every f entries */
int g; /* maximum code length */
int h; /* table level */
register unsigned i; /* counter, current code */
register unsigned j; /* counter */
register int k; /* number of bits in current code */
register unsigned *p; /* pointer into c[], b[], or v[] */
register huft_t *q; /* points to current table */
int htl; /* table level */
unsigned i; /* counter, current code */
unsigned j; /* counter */
int k; /* number of bits in current code */
unsigned *p; /* pointer into c[], b[], or v[] */
huft_t *q; /* points to current table */
huft_t r; /* table entry for structure assignment */
huft_t *u[BMAX]; /* table stack */
unsigned v[N_MAX]; /* values in order of bit length */
int ws[BMAX+1]; /* bits decoded stack */
register int w; /* bits decoded */
int w; /* bits decoded */
unsigned x[BMAX + 1]; /* bit offsets, then code stack */
unsigned *xp; /* pointer into x */
int y; /* number of dummy codes added */
@@ -312,7 +244,7 @@ int huft_build(unsigned int *b, const unsigned int n,
/* Generate the Huffman codes and for each, make the table entries */
x[0] = i = 0; /* first Huffman code is zero */
p = v; /* grab values in bit order */
h = -1; /* no tables yet--level -1 */
htl = -1; /* no tables yet--level -1 */
w = ws[0] = 0; /* bits decoded */
u[0] = (huft_t *) NULL; /* just to keep compilers happy */
q = (huft_t *) NULL; /* ditto */
@@ -324,8 +256,8 @@ int huft_build(unsigned int *b, const unsigned int n,
while (a--) {
/* here i is the Huffman code of length k bits for value *p */
/* make tables up to required level */
while (k > ws[h + 1]) {
w = ws[++h];
while (k > ws[htl + 1]) {
w = ws[++htl];
/* compute minimum size table less than or equal to *m bits */
z = (z = g - w) > *m ? *m : z; /* upper limit on table size */
@@ -342,22 +274,22 @@ int huft_build(unsigned int *b, const unsigned int n,
}
j = (w + j > eob_len && w < eob_len) ? eob_len - w : j; /* make EOB code end at table */
z = 1 << j; /* table entries for j-bit table */
ws[h+1] = w + j; /* set bits decoded in stack */
ws[htl+1] = w + j; /* set bits decoded in stack */
/* allocate and link in new table */
q = (huft_t *) xmalloc((z + 1) * sizeof(huft_t));
q = (huft_t *) xzalloc((z + 1) * sizeof(huft_t));
*t = q + 1; /* link to list for huft_free() */
*(t = &(q->v.t)) = NULL;
u[h] = ++q; /* table starts after link */
t = &(q->v.t);
u[htl] = ++q; /* table starts after link */
/* connect to last table, if there is one */
if (h) {
x[h] = i; /* save pattern for backing up */
r.b = (unsigned char) (w - ws[h - 1]); /* bits to dump before this table */
if (htl) {
x[htl] = i; /* save pattern for backing up */
r.b = (unsigned char) (w - ws[htl - 1]); /* bits to dump before this table */
r.e = (unsigned char) (16 + j); /* bits in this table */
r.v.t = q; /* pointer to this table */
j = (i & ((1 << w) - 1)) >> ws[h - 1];
u[h - 1][j] = r; /* connect to last table */
j = (i & ((1 << w) - 1)) >> ws[htl - 1];
u[htl - 1][j] = r; /* connect to last table */
}
}
@@ -386,8 +318,8 @@ int huft_build(unsigned int *b, const unsigned int n,
i ^= j;
/* backup over finished tables */
while ((i & ((1 << w) - 1)) != x[h]) {
w = ws[--h];
while ((i & ((1 << w) - 1)) != x[htl]) {
w = ws[--htl];
}
}
}
@@ -581,7 +513,7 @@ static int inflate_stored(int my_n, int my_b_stored, int my_k_stored, int setup)
static int inflate_block(int *e)
{
unsigned t; /* block type */
register unsigned int b; /* bit buffer */
unsigned int b; /* bit buffer */
unsigned int k; /* number of bits in bit buffer */
/* make local bit buffer */
@@ -921,14 +853,15 @@ int inflate_unzip(int in, int out)
gunzip_bb = 0;
/* Create the crc table */
make_gunzip_crc_table();
gunzip_crc_table = bb_crc32_filltable(0);
gunzip_crc = ~0;
/* Allocate space for buffer */
bytebuffer = xmalloc(bytebuffer_max);
while(1) {
int ret = inflate_get_next_window();
nwrote = bb_full_write(out, gunzip_window, gunzip_outbuf_count);
nwrote = full_write(out, gunzip_window, gunzip_outbuf_count);
if (nwrote == -1) {
bb_perror_msg("write");
return -1;
@@ -954,7 +887,7 @@ int inflate_unzip(int in, int out)
int inflate_gunzip(int in, int out)
{
unsigned int stored_crc = 0;
uint32_t stored_crc = 0;
unsigned int count;
inflate_unzip(in, out);
@@ -962,7 +895,7 @@ int inflate_gunzip(int in, int out)
/* top up the input buffer with the rest of the trailer */
count = bytebuffer_size - bytebuffer_offset;
if (count < 8) {
bb_xread_all(in, &bytebuffer[bytebuffer_size], 8 - count);
xread(in, &bytebuffer[bytebuffer_size], 8 - count);
bytebuffer_size += 8 - count;
}
for (count = 0; count != 4; count++) {
@@ -971,7 +904,7 @@ int inflate_gunzip(int in, int out)
}
/* Validate decompression - crc */
if (stored_crc != (gunzip_crc ^ 0xffffffffL)) {
if (stored_crc != (~gunzip_crc)) {
bb_error_msg("crc error");
return -1;
}
+3 -16
View File
@@ -1,24 +1,11 @@
/* vi: set sw=4 ts=4: */
/*
* Copyright (C) 2002 by Glenn McGrath
* Copyright (C) 2002 by Glenn McGrath
*
* 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <fnmatch.h>
#include <stdlib.h>
#include "unarchive.h"
/* Accept any non-null name, its not really a filter at all */
+3 -16
View File
@@ -1,24 +1,11 @@
/* vi: set sw=4 ts=4: */
/*
* Copyright (C) 2002 by Glenn McGrath
* Copyright (C) 2002 by Glenn McGrath
*
* 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <fnmatch.h>
#include <stdlib.h>
#include "unarchive.h"
/*
@@ -1,19 +1,8 @@
/* vi: set sw=4 ts=4: */
/*
* Copyright (C) 2002 by Glenn McGrath
*
* 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdlib.h>
@@ -1,24 +1,11 @@
/* vi: set sw=4 ts=4: */
/*
* Copyright (C) 2002 by Glenn McGrath
* Copyright (C) 2002 by Glenn McGrath
*
* 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <fnmatch.h>
#include <stdlib.h>
#include "unarchive.h"
/*
@@ -27,16 +14,17 @@
char filter_accept_reject_list(archive_handle_t *archive_handle)
{
const char *key = archive_handle->file_header->name;
const llist_t *accept_entry = find_list_entry(archive_handle->accept, key);
const llist_t *reject_entry = find_list_entry(archive_handle->reject, key);
const llist_t *accept_entry;
/* If the key is in a reject list fail */
if (reject_entry) {
return(EXIT_FAILURE);
}
accept_entry = find_list_entry(archive_handle->accept, key);
/* Fail if an accept list was specified and the key wasnt in there */
if (archive_handle->accept && (accept_entry == NULL)) {
if ((accept_entry == NULL) && archive_handle->accept) {
return(EXIT_FAILURE);
}
+5 -13
View File
@@ -1,28 +1,20 @@
/* vi: set sw=4 ts=4: */
/*
* 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.
* Copyright (C) 2002 by Glenn McGrath
*
* 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <fnmatch.h>
#include <stdlib.h>
#include "unarchive.h"
/* Find a string in a list */
const llist_t *find_list_entry(const llist_t *list, const char *filename)
{
while (list) {
if (fnmatch(list->data, filename, 0) == 0) {
return(list);
return (list);
}
list = list->link;
}
+5 -15
View File
@@ -1,17 +1,7 @@
/*
* 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.
/* vi: set sw=4 ts=4: */
/* Copyright 2001 Glenn McGrath.
*
* 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 Library 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdio.h>
@@ -53,7 +43,7 @@ char get_header_ar(archive_handle_t *archive_handle)
if (ar.raw[0] == '\n') {
/* fix up the header, we started reading 1 byte too early */
memmove(ar.raw, &ar.raw[1], 59);
ar.raw[59] = bb_xread_char(archive_handle->src_fd);
ar.raw[59] = xread_char(archive_handle->src_fd);
archive_handle->offset++;
}
archive_handle->offset += 60;
@@ -78,7 +68,7 @@ char get_header_ar(archive_handle_t *archive_handle)
* in static variable long_names for use in future entries */
ar_long_name_size = typed->size;
ar_long_names = xmalloc(ar_long_name_size);
bb_xread_all(archive_handle->src_fd, ar_long_names, ar_long_name_size);
xread(archive_handle->src_fd, ar_long_names, ar_long_name_size);
archive_handle->offset += ar_long_name_size;
/* This ar entries data section only contained filenames for other records
* they are stored in the static ar_long_names for future reference */
+8 -19
View File
@@ -1,17 +1,7 @@
/*
* 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.
/* vi: set sw=4 ts=4: */
/* Copyright 2002 Laurence Anderson
*
* 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 Library 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdio.h>
@@ -85,9 +75,9 @@ char get_header_cpio(archive_handle_t *archive_handle)
file_header->size = tmpsize;
}
file_header->name = (char *) xmalloc(namesize + 1);
archive_xread_all(archive_handle, file_header->name, namesize); /* Read in filename */
file_header->name[namesize] = '\0';
file_header->name = (char *) xzalloc(namesize + 1);
/* Read in filename */
xread(archive_handle->src_fd, file_header->name, namesize);
archive_handle->offset += namesize;
/* Update offset amount and skip padding before file contents */
@@ -113,9 +103,8 @@ char get_header_cpio(archive_handle_t *archive_handle)
}
if (S_ISLNK(file_header->mode)) {
file_header->link_name = (char *) xmalloc(file_header->size + 1);
archive_xread_all(archive_handle, file_header->link_name, file_header->size);
file_header->link_name[file_header->size] = '\0';
file_header->link_name = (char *) xzalloc(file_header->size + 1);
xread(archive_handle->src_fd, file_header->link_name, file_header->size);
archive_handle->offset += file_header->size;
file_header->size = 0; /* Stop possible seeks in future */
} else {
+14 -20
View File
@@ -1,3 +1,4 @@
/* vi: set sw=4 ts=4: */
/* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*
* FIXME:
@@ -55,11 +56,7 @@ char get_header_tar(archive_handle_t *archive_handle)
/* Align header */
data_align(archive_handle, 512);
if (bb_full_read(archive_handle->src_fd, tar.raw, 512) != 512) {
/* Assume end of file */
bb_error_msg_and_die("Short header");
//return(EXIT_FAILURE);
}
xread(archive_handle->src_fd, tar.raw, 512);
archive_handle->offset += 512;
/* If there is no filename its an empty header */
@@ -68,7 +65,7 @@ char get_header_tar(archive_handle_t *archive_handle)
/* This is the second consecutive empty header! End of archive!
* Read until the end to empty the pipe from gz or bz2
*/
while (bb_full_read(archive_handle->src_fd, tar.raw, 512) == 512);
while (full_read(archive_handle->src_fd, tar.raw, 512) == 512);
return(EXIT_FAILURE);
}
end = 1;
@@ -80,7 +77,7 @@ char get_header_tar(archive_handle_t *archive_handle)
* 0's are for the old tar format
*/
if (strncmp(tar.formated.magic, "ustar", 5) != 0) {
#ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
#ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY
if (strncmp(tar.formated.magic, "\0\0\0\0\0", 5) != 0)
#endif
bb_error_msg_and_die("Invalid tar magic");
@@ -136,15 +133,11 @@ char get_header_tar(archive_handle_t *archive_handle)
case '1':
file_header->mode |= S_IFREG;
break;
case 'x':
case 'g':
bb_error_msg_and_die("pax is not tar");
break;
case '7':
/* Reserved for high performance files, treat as normal file */
case 0:
case '0':
#ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
#ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY
if (last_char_is(file_header->name, '/')) {
file_header->mode |= S_IFDIR;
} else
@@ -168,17 +161,15 @@ char get_header_tar(archive_handle_t *archive_handle)
break;
#ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS
case 'L': {
longname = xmalloc(file_header->size + 1);
archive_xread_all(archive_handle, longname, file_header->size);
longname[file_header->size] = '\0';
longname = xzalloc(file_header->size + 1);
xread(archive_handle->src_fd, longname, file_header->size);
archive_handle->offset += file_header->size;
return(get_header_tar(archive_handle));
}
case 'K': {
linkname = xmalloc(file_header->size + 1);
archive_xread_all(archive_handle, linkname, file_header->size);
linkname[file_header->size] = '\0';
linkname = xzalloc(file_header->size + 1);
xread(archive_handle->src_fd, linkname, file_header->size);
archive_handle->offset += file_header->size;
file_header->name = linkname;
@@ -189,8 +180,11 @@ char get_header_tar(archive_handle_t *archive_handle)
case 'N': /* Old GNU for names > 100 characters */
case 'S': /* Sparse file */
case 'V': /* Volume header */
bb_error_msg("Ignoring GNU extension type %c", tar.formated.typeflag);
#endif
case 'g': /* pax global header */
case 'x': /* pax extended header */
bb_error_msg("Ignoring extension type %c", tar.formated.typeflag);
break;
default:
bb_error_msg("Unknown typeflag: 0x%x", tar.formated.typeflag);
}
@@ -206,7 +200,7 @@ char get_header_tar(archive_handle_t *archive_handle)
archive_handle->action_header(archive_handle->file_header);
archive_handle->flags |= ARCHIVE_EXTRACT_QUIET;
archive_handle->action_data(archive_handle);
archive_handle->passed = llist_add_to(archive_handle->passed, file_header->name);
llist_add_to(&(archive_handle->passed), file_header->name);
} else {
data_skip(archive_handle);
}
+2 -13
View File
@@ -1,17 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
* 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 Library 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <sys/types.h>
+3 -14
View File
@@ -1,17 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
* 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 Library 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdlib.h>
@@ -26,7 +15,7 @@ char get_header_tar_gz(archive_handle_t *archive_handle)
/* Cant lseek over pipe's */
archive_handle->seek = seek_by_char;
archive_xread_all(archive_handle, &magic, 2);
xread(archive_handle->src_fd, &magic, 2);
if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
bb_error_msg_and_die("Invalid gzip magic");
}
+1 -1
View File
@@ -1,3 +1,4 @@
/* vi: set sw=4 ts=4: */
/*
* Small lzma deflate implementation.
* Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
@@ -20,4 +21,3 @@ char get_header_tar_lzma(archive_handle_t * archive_handle)
return EXIT_FAILURE;
}
/* vi:set ts=4: */
+4
View File
@@ -1,3 +1,7 @@
/* vi: set sw=4 ts=4: */
/*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdio.h>
#include "unarchive.h"
+4
View File
@@ -1,3 +1,7 @@
/* vi: set sw=4 ts=4: */
/*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdio.h>
#include "unarchive.h"
@@ -1,3 +1,8 @@
/* vi: set sw=4 ts=4: */
/*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdio.h>
#include <string.h>
#include <time.h>
+3 -15
View File
@@ -1,17 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
* 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <unistd.h>
@@ -24,8 +13,7 @@ archive_handle_t *init_handle(void)
archive_handle_t *archive_handle;
/* Initialise default values */
archive_handle = xmalloc(sizeof(archive_handle_t));
memset(archive_handle, 0, sizeof(archive_handle_t));
archive_handle = xzalloc(sizeof(archive_handle_t));
archive_handle->file_header = xmalloc(sizeof(file_header_t));
archive_handle->action_header = header_skip;
archive_handle->action_data = data_skip;
+4 -13
View File
@@ -1,17 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
* 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 Library 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdlib.h>
@@ -19,6 +8,8 @@
#include "libbb.h"
#include "unarchive.h"
/* transformer(), more than meets the eye */
int open_transformer(int src_fd, int (*transformer)(int src_fd, int dst_fd))
{
-178
View File
@@ -1,178 +0,0 @@
/*
* Small range coder implementation for lzma.
* Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
*
* Based on LzmaDecode.c from the LZMA SDK 4.22 (http://www.7-zip.org/)
* Copyright (c) 1999-2005 Igor Pavlov
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdint.h>
#include "libbb.h"
#ifndef always_inline
# if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >0)
# define always_inline __attribute__((always_inline)) inline
# else
# define always_inline inline
# endif
#endif
#ifdef CONFIG_FEATURE_LZMA_FAST
# define speed_inline always_inline
#else
# define speed_inline
#endif
typedef struct {
int fd;
uint8_t *ptr;
uint8_t *buffer;
uint8_t *buffer_end;
int buffer_size;
uint32_t code;
uint32_t range;
uint32_t bound;
} rc_t;
#define RC_TOP_BITS 24
#define RC_MOVE_BITS 5
#define RC_MODEL_TOTAL_BITS 11
/* Called twice: once at startup and once in rc_normalize() */
static void rc_read(rc_t * rc)
{
rc->buffer_size = read(rc->fd, rc->buffer, rc->buffer_size);
if (rc->buffer_size <= 0)
bb_error_msg_and_die("unexpected EOF");
rc->ptr = rc->buffer;
rc->buffer_end = rc->buffer + rc->buffer_size;
}
/* Called once */
static always_inline void rc_init(rc_t * rc, int fd, int buffer_size)
{
int i;
rc->fd = fd;
rc->buffer = malloc(buffer_size);
rc->buffer_size = buffer_size;
rc->buffer_end = rc->buffer + rc->buffer_size;
rc->ptr = rc->buffer_end;
rc->code = 0;
rc->range = 0xFFFFFFFF;
for (i = 0; i < 5; i++) {
if (rc->ptr >= rc->buffer_end)
rc_read(rc);
rc->code = (rc->code << 8) | *rc->ptr++;
}
}
/* Called once. TODO: bb_maybe_free() */
static always_inline void rc_free(rc_t * rc)
{
if (ENABLE_FEATURE_CLEAN_UP)
free(rc->buffer);
}
/* Called twice, but one callsite is in speed_inline'd rc_is_bit_0_helper() */
static void rc_do_normalize(rc_t * rc)
{
if (rc->ptr >= rc->buffer_end)
rc_read(rc);
rc->range <<= 8;
rc->code = (rc->code << 8) | *rc->ptr++;
}
static always_inline void rc_normalize(rc_t * rc)
{
if (rc->range < (1 << RC_TOP_BITS)) {
rc_do_normalize(rc);
}
}
/* Called 9 times */
/* Why rc_is_bit_0_helper exists?
* Because we want to always expose (rc->code < rc->bound) to optimizer
*/
static speed_inline uint32_t rc_is_bit_0_helper(rc_t * rc, uint16_t * p)
{
rc_normalize(rc);
rc->bound = *p * (rc->range >> RC_MODEL_TOTAL_BITS);
return rc->bound;
}
static always_inline int rc_is_bit_0(rc_t * rc, uint16_t * p)
{
uint32_t t = rc_is_bit_0_helper(rc, p);
return rc->code < t;
}
/* Called ~10 times, but very small, thus inlined */
static speed_inline void rc_update_bit_0(rc_t * rc, uint16_t * p)
{
rc->range = rc->bound;
*p += ((1 << RC_MODEL_TOTAL_BITS) - *p) >> RC_MOVE_BITS;
}
static speed_inline void rc_update_bit_1(rc_t * rc, uint16_t * p)
{
rc->range -= rc->bound;
rc->code -= rc->bound;
*p -= *p >> RC_MOVE_BITS;
}
/* Called 4 times in unlzma loop */
static int rc_get_bit(rc_t * rc, uint16_t * p, int *symbol)
{
if (rc_is_bit_0(rc, p)) {
rc_update_bit_0(rc, p);
*symbol *= 2;
return 0;
} else {
rc_update_bit_1(rc, p);
*symbol = *symbol * 2 + 1;
return 1;
}
}
/* Called once */
static always_inline int rc_direct_bit(rc_t * rc)
{
rc_normalize(rc);
rc->range >>= 1;
if (rc->code >= rc->range) {
rc->code -= rc->range;
return 1;
}
return 0;
}
/* Called twice */
static speed_inline void
rc_bit_tree_decode(rc_t * rc, uint16_t * p, int num_levels, int *symbol)
{
int i = num_levels;
*symbol = 1;
while (i--)
rc_get_bit(rc, p + *symbol, symbol);
*symbol -= 1 << num_levels;
}
/* vi:set ts=4: */
+5 -14
View File
@@ -1,23 +1,14 @@
/* vi: set sw=4 ts=4: */
/*
* 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 Library 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdlib.h>
#include "unarchive.h"
#include "busybox.h"
#include "libbb.h"
/* If we are reading through a pipe(), or from stdin then we cant lseek,
* we must read and discard the data to skip over it.
+2 -13
View File
@@ -1,17 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
* 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 Library 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <sys/types.h>
+4 -15
View File
@@ -1,29 +1,18 @@
/* vi: set sw=4 ts=4: */
/*
* 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 Library 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include "unarchive.h"
#include "busybox.h"
#include "libbb.h"
void unpack_ar_archive(archive_handle_t *ar_archive)
{
char magic[7];
archive_xread_all(ar_archive, magic, 7);
xread(ar_archive->src_fd, magic, 7);
if (strncmp(magic, "!<arch>", 7) != 0) {
bb_error_msg_and_die("Invalid ar magic");
}
+6 -9
View File
@@ -193,12 +193,12 @@ void extract_cpio_gz(int fd) {
archive_handle->src_fd = fd;
archive_handle->offset = 0;
bb_xread_all(archive_handle->src_fd, &magic, 2);
xread(archive_handle->src_fd, &magic, 2);
if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
bb_error_msg_and_die("Invalid gzip magic");
}
check_header_gzip(archive_handle->src_fd);
chdir("/"); // Install RPM's to root
bb_xchdir("/"); // Install RPM's to root
archive_handle->src_fd = open_transformer(archive_handle->src_fd, inflate_gunzip);
archive_handle->offset = 0;
@@ -208,7 +208,7 @@ void extract_cpio_gz(int fd) {
rpm_index **rpm_gettags(int fd, int *num_tags)
{
rpm_index **tags = calloc(200, sizeof(struct rpmtag *)); /* We should never need mode than 200, and realloc later */
rpm_index **tags = xzalloc(200 * sizeof(struct rpmtag *)); /* We should never need mode than 200, and realloc later */
int pass, tagindex = 0;
lseek(fd, 96, SEEK_CUR); /* Seek past the unused lead */
@@ -327,13 +327,10 @@ void fileaction_list(char *filename, int ATTRIBUTE_UNUSED fileref)
void loop_through_files(int filetag, void (*fileaction)(char *filename, int fileref))
{
int count = 0;
char *filename, *tmp_dirname, *tmp_basename;
while (rpm_getstring(filetag, count)) {
tmp_dirname = rpm_getstring(RPMTAG_DIRNAMES, rpm_getint(RPMTAG_DIRINDEXES, count)); /* 1st put on the directory */
tmp_basename = rpm_getstring(RPMTAG_BASENAMES, count);
filename = xmalloc(strlen(tmp_basename) + strlen(tmp_dirname) + 1);
strcpy(filename, tmp_dirname); /* First the directory name */
strcat(filename, tmp_basename); /* then the filename */
char * filename = bb_xasprintf("%s%s",
rpm_getstring(RPMTAG_DIRNAMES, rpm_getint(RPMTAG_DIRINDEXES,
count)), rpm_getstring(RPMTAG_BASENAMES, count));
fileaction(filename, count++);
free(filename);
}
+4 -16
View File
@@ -4,19 +4,7 @@
*
* 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
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <sys/types.h>
#include <netinet/in.h> /* For ntohl & htonl function */
@@ -52,7 +40,7 @@ static void skip_header(int rpm_fd)
{
struct rpm_header header;
bb_xread_all(rpm_fd, &header, sizeof(struct rpm_header));
xread(rpm_fd, &header, sizeof(struct rpm_header));
if (strncmp((char *) &header.magic, RPM_HEADER_MAGIC, 3) != 0) {
bb_error_msg_and_die("Invalid RPM header magic"); /* Invalid magic */
}
@@ -78,7 +66,7 @@ int rpm2cpio_main(int argc, char **argv)
rpm_fd = bb_xopen(argv[1], O_RDONLY);
}
bb_xread_all(rpm_fd, &lead, sizeof(struct rpm_lead));
xread(rpm_fd, &lead, sizeof(struct rpm_lead));
if (strncmp((char *) &lead.magic, RPM_MAGIC, 4) != 0) {
bb_error_msg_and_die("Invalid RPM magic"); /* Just check the magic, the rest is irrelevant */
}
@@ -90,7 +78,7 @@ int rpm2cpio_main(int argc, char **argv)
/* Skip the main header */
skip_header(rpm_fd);
bb_xread_all(rpm_fd, &magic, 2);
xread(rpm_fd, &magic, 2);
if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
bb_error_msg_and_die("Invalid gzip magic");
}
+16 -21
View File
@@ -19,9 +19,8 @@
*
* Based in part on the tar implementation from busybox-0.28
* Copyright (C) 1995 Bruce Perens
* This is free software under the GNU General Public License.
*
* Licensed under GPL v2 (or later), see file LICENSE in this tarball.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <fcntl.h>
@@ -43,12 +42,8 @@
#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_BLOCK_SIZE 512
#define TAR_MAGIC_LEN 6
#define TAR_VERSION_LEN 2
/* POSIX tar Header Block, from POSIX 1003.1-1990 */
#define NAME_SIZE 100
@@ -209,15 +204,14 @@ static inline int writeTarHeader(struct TarBallInfo *tbInfo,
memset(&header, 0, size);
strncpy(header.name, header_name, sizeof(header.name));
safe_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.mtime, sizeof(header.mtime), statbuf->st_mtime);
strncpy(header.magic, TAR_MAGIC TAR_VERSION,
TAR_MAGIC_LEN + TAR_VERSION_LEN);
strcpy(header.magic, "ustar ");
/* Enter the user and group names (default to root if it fails) */
if (bb_getpwuid(header.uname, statbuf->st_uid, sizeof(header.uname)) == NULL)
@@ -275,9 +269,9 @@ static inline int writeTarHeader(struct TarBallInfo *tbInfo,
putOctal(header.chksum, 7, chksum);
/* Now write the header out to disk */
if ((size =
bb_full_write(tbInfo->tarFd, (char *) &header,
sizeof(struct TarHeader))) < 0) {
if ((size = full_write(tbInfo->tarFd, (char *) &header,
sizeof(struct TarHeader))) < 0)
{
bb_error_msg(bb_msg_io_error, real_name);
return (FALSE);
}
@@ -481,7 +475,7 @@ static inline int writeTarFile(const int tar_fd, const int verboseFlag,
while (1) {
char buf;
int n = bb_full_read(gzipStatusPipe[0], &buf, 1);
int n = full_read(gzipStatusPipe[0], &buf, 1);
if (n == 0 && vfork_exec_errno != 0) {
errno = vfork_exec_errno;
@@ -552,7 +546,7 @@ static llist_t *append_file_list_to_list(llist_t *list)
cur = cur->link;
free(tmp);
while ((line = bb_get_chomped_line_from_file(src_stream)) != NULL)
newlist = llist_add_to(newlist, line);
llist_add_to(&newlist, line);
fclose(src_stream);
}
return newlist;
@@ -568,8 +562,8 @@ static char get_header_tar_Z(archive_handle_t *archive_handle)
archive_handle->seek = seek_by_char;
/* do the decompression, and cleanup */
if (bb_xread_char(archive_handle->src_fd) != 0x1f ||
bb_xread_char(archive_handle->src_fd) != 0x9d)
if (xread_char(archive_handle->src_fd) != 0x1f ||
xread_char(archive_handle->src_fd) != 0x9d)
{
bb_error_msg_and_die("Invalid magic");
}
@@ -597,7 +591,7 @@ static char get_header_tar_Z(archive_handle_t *archive_handle)
#define TAR_OPT_AFTER_START 8
#define CTX_CREATE (1 << (TAR_OPT_AFTER_START))
#define TAR_OPT_DEREFERNCE (1 << (TAR_OPT_AFTER_START + 1))
#define TAR_OPT_DEREFERENCE (1 << (TAR_OPT_AFTER_START + 1))
#ifdef CONFIG_FEATURE_TAR_CREATE
# define TAR_OPT_STR_CREATE "ch"
# define TAR_OPT_AFTER_CREATE TAR_OPT_AFTER_START + 2
@@ -801,7 +795,7 @@ int tar_main(int argc, char **argv)
if (filename_ptr > argv[optind])
*filename_ptr = '\0';
tar_handle->accept = llist_add_to(tar_handle->accept, argv[optind]);
llist_add_to(&(tar_handle->accept), argv[optind]);
optind++;
}
@@ -834,8 +828,8 @@ int tar_main(int argc, char **argv)
}
}
if ((base_dir) && (chdir(base_dir)))
bb_perror_msg_and_die("Couldnt chdir to %s", base_dir);
if (base_dir)
bb_xchdir(base_dir);
/* create an archive */
if (ENABLE_FEATURE_TAR_CREATE && (opt & CTX_CREATE)) {
@@ -852,7 +846,8 @@ int tar_main(int argc, char **argv)
{
verboseFlag = TRUE;
}
writeTarFile(tar_handle->src_fd, verboseFlag, opt & TAR_OPT_DEREFERNCE, tar_handle->accept,
writeTarFile(tar_handle->src_fd, verboseFlag, opt & TAR_OPT_DEREFERENCE,
tar_handle->accept,
tar_handle->reject, zipMode);
} else {
while (get_header_ptr(tar_handle) == EXIT_SUCCESS);
+6 -20
View File
@@ -2,19 +2,7 @@
/*
* Uncompress applet for busybox (c) 2002 Glenn McGrath
*
* 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdlib.h>
@@ -24,7 +12,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include "libbb.h"
#include "busybox.h"
#include "unarchive.h"
#define GUNZIP_TO_STDOUT 1
@@ -73,18 +61,16 @@ int uncompress_main(int argc, char **argv)
*extension = '\0';
/* Open output file */
dst_fd = bb_xopen(uncompressed_file, O_WRONLY | O_CREAT);
/* Set permissions on the file */
stat(compressed_file, &stat_buf);
chmod(uncompressed_file, stat_buf.st_mode);
xstat(compressed_file, &stat_buf);
dst_fd = bb_xopen3(uncompressed_file, O_WRONLY | O_CREAT,
stat_buf.st_mode);
/* If unzip succeeds remove the old file */
delete_path = compressed_file;
}
/* do the decompression, and cleanup */
if ((bb_xread_char(src_fd) != 0x1f) || (bb_xread_char(src_fd) != 0x9d)) {
if ((xread_char(src_fd) != 0x1f) || (xread_char(src_fd) != 0x9d)) {
bb_error_msg_and_die("Invalid magic");
}
+4 -2
View File
@@ -1,3 +1,4 @@
/* vi: set sw=4 ts=4: */
/*
* Small lzma deflate implementation.
* Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
@@ -41,13 +42,15 @@ int unlzma_main(int argc, char **argv)
filename = 0;
if (filename) {
struct stat stat_buf;
char *extension = filename + strlen(filename) - 5;
if (strcmp(extension, ".lzma") != 0) {
bb_error_msg_and_die("Invalid extension");
}
xstat(filename, &stat_buf);
*extension = 0;
dst_fd = bb_xopen(filename, O_WRONLY | O_CREAT);
dst_fd = bb_xopen3(filename, O_WRONLY | O_CREAT, stat_buf.st_mode);
} else
dst_fd = STDOUT_FILENO;
status = unlzma(src_fd, dst_fd);
@@ -62,4 +65,3 @@ int unlzma_main(int argc, char **argv)
return status;
}
/* vi:set ts=4: */
+26 -64
View File
@@ -32,28 +32,10 @@
#include "unarchive.h"
#include "busybox.h"
#if BB_BIG_ENDIAN
static inline unsigned short
__swap16(unsigned short x) {
return (((uint16_t)(x) & 0xFF) << 8) | (((uint16_t)(x) & 0xFF00) >> 8);
}
static inline uint32_t
__swap32(uint32_t x) {
return (((x & 0xFF) << 24) |
((x & 0xFF00) << 8) |
((x & 0xFF0000) >> 8) |
((x & 0xFF000000) >> 24));
}
#else /* it's little-endian */
# define __swap16(x) (x)
# define __swap32(x) (x)
#endif /* BB_BIG_ENDIAN */
#define ZIP_FILEHEADER_MAGIC __swap32(0x04034b50)
#define ZIP_CDS_MAGIC __swap32(0x02014b50)
#define ZIP_CDS_END_MAGIC __swap32(0x06054b50)
#define ZIP_DD_MAGIC __swap32(0x08074b50)
#define ZIP_FILEHEADER_MAGIC SWAP_LE32(0x04034b50)
#define ZIP_CDS_MAGIC SWAP_LE32(0x02014b50)
#define ZIP_CDS_END_MAGIC SWAP_LE32(0x06054b50)
#define ZIP_DD_MAGIC SWAP_LE32(0x08074b50)
extern unsigned int gunzip_crc;
extern unsigned int gunzip_bytes_out;
@@ -83,19 +65,12 @@ static void unzip_skip(int fd, off_t skip)
}
}
static void unzip_read(int fd, void *buf, size_t count)
{
if (bb_xread(fd, buf, count) != count) {
bb_error_msg_and_die("Read failure");
}
}
static void unzip_create_leading_dirs(char *fn)
{
/* Create all leading directories */
char *name = bb_xstrdup(fn);
if (bb_make_directory(dirname(name), 0777, FILEUTILS_RECUR)) {
bb_error_msg_and_die("Failed to create directory");
bb_error_msg_and_die("Exiting"); /* bb_make_directory is noisy */
}
free(name);
}
@@ -180,7 +155,7 @@ int unzip_main(int argc, char **argv)
case 1: /* Include files */
if (opt == 1) {
zaccept = llist_add_to(zaccept, optarg);
llist_add_to(&zaccept, optarg);
} else if (opt == 'd') {
base_dir = optarg;
@@ -196,7 +171,7 @@ int unzip_main(int argc, char **argv)
case 2 : /* Exclude files */
if (opt == 1) {
zreject = llist_add_to(zreject, optarg);
llist_add_to(&zreject, optarg);
} else if (opt == 'd') { /* Extract to base directory */
base_dir = optarg;
@@ -236,9 +211,8 @@ int unzip_main(int argc, char **argv)
}
/* Change dir if necessary */
if (base_dir && chdir(base_dir)) {
bb_perror_msg_and_die("Cannot chdir");
}
if (base_dir)
bb_xchdir(base_dir);
if (verbosity != v_silent)
printf("Archive: %s\n", src_fn);
@@ -249,7 +223,7 @@ int unzip_main(int argc, char **argv)
unsigned int magic;
/* Check magic number */
unzip_read(src_fd, &magic, 4);
xread(src_fd, &magic, 4);
if (magic == ZIP_CDS_MAGIC) {
break;
} else if (magic != ZIP_FILEHEADER_MAGIC) {
@@ -257,35 +231,32 @@ int unzip_main(int argc, char **argv)
}
/* Read the file header */
unzip_read(src_fd, zip_header.raw, 26);
#if BB_BIG_ENDIAN
zip_header.formated.version = __swap16(zip_header.formated.version);
zip_header.formated.flags = __swap16(zip_header.formated.flags);
zip_header.formated.method = __swap16(zip_header.formated.method);
zip_header.formated.modtime = __swap16(zip_header.formated.modtime);
zip_header.formated.moddate = __swap16(zip_header.formated.moddate);
zip_header.formated.crc32 = __swap32(zip_header.formated.crc32);
zip_header.formated.cmpsize = __swap32(zip_header.formated.cmpsize);
zip_header.formated.ucmpsize = __swap32(zip_header.formated.ucmpsize);
zip_header.formated.filename_len = __swap16(zip_header.formated.filename_len);
zip_header.formated.extra_len = __swap16(zip_header.formated.extra_len);
#endif /* BB_BIG_ENDIAN */
xread(src_fd, zip_header.raw, 26);
zip_header.formated.version = SWAP_LE32(zip_header.formated.version);
zip_header.formated.flags = SWAP_LE32(zip_header.formated.flags);
zip_header.formated.method = SWAP_LE32(zip_header.formated.method);
zip_header.formated.modtime = SWAP_LE32(zip_header.formated.modtime);
zip_header.formated.moddate = SWAP_LE32(zip_header.formated.moddate);
zip_header.formated.crc32 = SWAP_LE32(zip_header.formated.crc32);
zip_header.formated.cmpsize = SWAP_LE32(zip_header.formated.cmpsize);
zip_header.formated.ucmpsize = SWAP_LE32(zip_header.formated.ucmpsize);
zip_header.formated.filename_len = SWAP_LE32(zip_header.formated.filename_len);
zip_header.formated.extra_len = SWAP_LE32(zip_header.formated.extra_len);
if ((zip_header.formated.method != 0) && (zip_header.formated.method != 8)) {
bb_error_msg_and_die("Unsupported compression method %d", zip_header.formated.method);
}
/* Read filename */
free(dst_fn);
dst_fn = xmalloc(zip_header.formated.filename_len + 1);
unzip_read(src_fd, dst_fn, zip_header.formated.filename_len);
dst_fn[zip_header.formated.filename_len] = 0;
dst_fn = xzalloc(zip_header.formated.filename_len + 1);
xread(src_fd, dst_fn, zip_header.formated.filename_len);
/* Skip extra header bytes */
unzip_skip(src_fd, zip_header.formated.extra_len);
if ((verbosity == v_list) && !list_header_done){
printf(" Length Date Time Name\n");
printf(" -------- ---- ---- ----\n");
printf(" Length Date Time Name\n"
" -------- ---- ---- ----\n");
list_header_done = 1;
}
@@ -323,7 +294,7 @@ int unzip_main(int argc, char **argv)
}
unzip_create_leading_dirs(dst_fn);
if (bb_make_directory(dst_fn, 0777, 0)) {
bb_error_msg_and_die("Failed to create directory");
bb_error_msg_and_die("Exiting");
}
} else {
if (!S_ISDIR(stat_buf.st_mode)) {
@@ -418,12 +389,3 @@ int unzip_main(int argc, char **argv)
return failed;
}
/* END CODE */
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
+7
View File
@@ -65,6 +65,13 @@ config CONFIG_SETCONSOLE
This program redirects the system console to another device,
like the current tty while logged in via telnet.
config CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS
bool "Enable long options"
default n
depends on CONFIG_SET_CONSOLE && CONFIG_GETOPT_LONG
help
Support long options for the setconsole applet.
config CONFIG_SETKEYCODES
bool "setkeycodes"
default n
+1 -1
View File
@@ -12,7 +12,7 @@ top_builddir=..
endif
srcdir=$(top_srcdir)/console/tools
CONSOLETOOLS_DIR:=./
include $(top_builddir)/Rules.mak
include $(top_srcdir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
+1 -24
View File
@@ -4,23 +4,9 @@
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.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
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/* no options, no getopt */
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
@@ -50,12 +36,3 @@ int chvt_main(int argc, char **argv)
}
return EXIT_SUCCESS;
}
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
+1 -13
View File
@@ -4,19 +4,7 @@
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.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
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*
*/
+1 -13
View File
@@ -5,19 +5,7 @@
* Copyright (C) 2003 by Tito Ragusa <farmatito@tiscali.it>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.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
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/* no options, no getopt */
+1 -13
View File
@@ -4,19 +4,7 @@
*
* Copyright (C) Arne Bernin <arne@matrix.loopback.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
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*
*/
-6
View File
@@ -10,7 +10,6 @@
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <memory.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
@@ -128,11 +127,6 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
ud.entry_ct = ct;
ud.entries = up;
if (ioctl(fd, PIO_UNIMAP, &ud)) {
#if 0
if (errno == ENOMEM) {
/* change advice parameters */
}
#endif
bb_perror_msg_and_die("PIO_UNIMAP");
}
}
+7 -21
View File
@@ -4,19 +4,7 @@
*
* Copyright (C) 1998 Enrique Zanardi <ezanardi@ull.es>
*
* 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
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*
*/
@@ -57,15 +45,15 @@ int loadkmap_main(int argc, char **argv)
fd = bb_xopen(CURRENT_VC, O_RDWR);
if ((bb_full_read(0, buff, 7) != 7) || (strncmp(buff, BINARY_KEYMAP_MAGIC, 7) != 0))
xread(0, buff, 7);
if (strncmp(buff, BINARY_KEYMAP_MAGIC, 7))
bb_error_msg_and_die("This is not a valid binary keymap.");
if (bb_full_read(0, flags, MAX_NR_KEYMAPS) != MAX_NR_KEYMAPS)
bb_perror_msg_and_die("Error reading keymap flags");
xread(0, flags, MAX_NR_KEYMAPS);
for (i = 0; i < MAX_NR_KEYMAPS; i++) {
if (flags[i] == 1) {
bb_full_read(0, ibuff, NR_KEYS * sizeof(u_short));
xread(0, ibuff, NR_KEYS * sizeof(u_short));
for (j = 0; j < NR_KEYS; j++) {
ke.kb_index = j;
ke.kb_table = i;
@@ -75,8 +63,6 @@ int loadkmap_main(int argc, char **argv)
}
}
/* Don't bother to close files. Exit does that
* automagically, so we can save a few bytes */
/* close(fd); */
return EXIT_SUCCESS;
if (ENABLE_FEATURE_CLEAN_UP) close(fd);
return 0;
}
+1 -21
View File
@@ -5,19 +5,7 @@
* busyboxed by Quy Tonthat <quy@signal3.com>
* hacked by Tito <farmatito@tiscali.it>
*
* 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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/* getopt not needed */
@@ -63,11 +51,3 @@ int openvt_main(int argc, char **argv)
}
return EXIT_SUCCESS;
}
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
+1 -14
View File
@@ -5,20 +5,7 @@
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
* Written by Erik Andersen and Kent Robotti <robotti@metconnect.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
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/* no options, no getopt */
+5 -21
View File
@@ -4,19 +4,7 @@
*
* Copyright (C) 2004,2005 Enrik Berkhan <Enrik.Berkhan@inka.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.
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <sys/ioctl.h>
@@ -28,10 +16,12 @@
#include "busybox.h"
#if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS
static const struct option setconsole_long_options[] = {
{ "reset", 0, NULL, 'r' },
{ 0, 0, 0, 0 }
};
#endif
#define OPT_SETCONS_RESET 1
@@ -40,7 +30,9 @@ int setconsole_main(int argc, char **argv)
unsigned long flags;
const char *device = CURRENT_TTY;
#if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS
bb_applet_long_options = setconsole_long_options;
#endif
flags = bb_getopt_ulflags(argc, argv, "r");
if (argc - optind > 1)
@@ -60,11 +52,3 @@ int setconsole_main(int argc, char **argv)
}
return EXIT_SUCCESS;
}
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
+1 -14
View File
@@ -6,20 +6,7 @@
*
* Adjusted for BusyBox by Erik Andersen <andersen@codepoet.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
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdio.h>
+2 -1
View File
@@ -1,3 +1,4 @@
/* vi: set sw=4 ts=4: */
/*
* setlogcons: Send kernel messages to the current console or to console N
*
@@ -27,7 +28,7 @@ extern int setlogcons_main(int argc, char **argv)
if (argc == 2)
arg.subarg = atoi(argv[1]);
if (ioctl(bb_xopen("/dev/tty1", O_RDONLY), TIOCLINUX, &arg))
if (ioctl(bb_xopen(VC_1, O_RDONLY), TIOCLINUX, &arg))
bb_perror_msg_and_die("TIOCLINUX");;
return 0;
+125 -29
View File
@@ -26,6 +26,13 @@ config CONFIG_CAT
cat is used to concatenate files and print them to the standard
output. Enable this option if you wish to enable the 'cat' utility.
config CONFIG_CATV
bool "catv"
default n
help
Display nonprinting characters as escape sequences (like some
implementations' cat -v option).
config CONFIG_CHGRP
bool "chgrp"
default n
@@ -52,6 +59,12 @@ config CONFIG_CHROOT
chroot is used to change the root directory and run a command.
The default command is `/bin/sh'.
config CONFIG_CKSUM
bool "cksum"
default n
help
cksum is used to calculate the CRC32 checksum of a file.
config CONFIG_CMP
bool "cmp"
default n
@@ -87,7 +100,7 @@ config CONFIG_DATE
current time in the given format.
config CONFIG_FEATURE_DATE_ISOFMT
bool " Enable ISO date format output (-I)"
bool "Enable ISO date format output (-I)"
default y
depends on CONFIG_DATE
help
@@ -102,6 +115,26 @@ config CONFIG_DD
by default) using specific input and output blocksizes,
while optionally performing conversions on it.
config CONFIG_FEATURE_DD_SIGNAL_HANDLING
bool "Enable DD signal handling for status reporting"
default y
depends on CONFIG_DD
help
sending a SIGUSR1 signal to a running `dd' process makes it
print to standard error the number of records read and written
so far, then to resume copying.
$ dd if=/dev/zero of=/dev/null& pid=$! $ kill -USR1 $pid; sleep 1; kill $pid
10899206+0 records in 10899206+0 records out
config CONFIG_FEATURE_DD_IBS_OBS
bool "Enable ibs, obs and conv options"
default n
depends on CONFIG_DD
help
Enables support for writing a certain number of bytes in and out,
at a time, and performing conversions on the data stream.
config CONFIG_DF
bool "df"
default n
@@ -109,6 +142,38 @@ config CONFIG_DF
df reports the amount of disk space used and available
on filesystems.
config CONFIG_DIFF
bool "diff"
default n
help
diff compares two files or directories and outputs the
differences between them in a form that can be given to
the patch command.
config CONFIG_FEATURE_DIFF_BINARY
bool "Enable checks for binary files"
default y
depends on CONFIG_DIFF
help
This option enables support for checking for binary files
before a comparison is carried out.
config CONFIG_FEATURE_DIFF_DIR
bool "Enable directory support"
default y
depends on CONFIG_DIFF
help
This option enables support for directory and subdirectory
comparison.
config CONFIG_FEATURE_DIFF_MINIMAL
bool "Enable -d option to find smaller sets of changes"
default n
depends on CONFIG_DIFF
help
Enabling this option allows the use of -d to make diff
try hard to find the smallest possible set of changes.
config CONFIG_DIRNAME
bool "dirname"
default n
@@ -127,6 +192,9 @@ config CONFIG_UNIX2DOS
bool
default y
depends on CONFIG_DOS2UNIX
help
unix2dos is used to convert a text file from UNIX format to
DOS format, and vice versa.
config CONFIG_DU
bool "du (default blocksize of 512 bytes)"
@@ -135,8 +203,8 @@ config CONFIG_DU
du is used to report the amount of disk space used
for specified files.
config CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K
bool " Use a default blocksize of 1024 bytes (1K)"
config CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K
bool "Use a default blocksize of 1024 bytes (1K)"
default y
depends on CONFIG_DU
help
@@ -150,7 +218,7 @@ config CONFIG_ECHO
# this entry also appears in shell/Config.in, next to the echo builtin
config CONFIG_FEATURE_FANCY_ECHO
bool " Enable echo options (-n and -e)"
bool "Enable echo options (-n and -e)"
default y
depends on CONFIG_ECHO
help
@@ -164,6 +232,13 @@ config CONFIG_ENV
a command; without options it displays the current
environment.
config CONFIG_FEATURE_ENV_LONG_OPTIONS
bool "Enable long options"
default n
depends on CONFIG_ENV && CONFIG_GETOPT_LONG
help
Support long options for the env applet.
config CONFIG_EXPR
bool "expr"
default n
@@ -172,7 +247,7 @@ config CONFIG_EXPR
to standard output.
config CONFIG_EXPR_MATH_SUPPORT_64
bool " Extend Posix numbers support to 64 bit"
bool "Extend Posix numbers support to 64 bit"
default n
depends on CONFIG_EXPR
help
@@ -200,7 +275,7 @@ config CONFIG_HEAD
from files.
config CONFIG_FEATURE_FANCY_HEAD
bool " Enable head options (-c, -q, and -v)"
bool "Enable head options (-c, -q, and -v)"
default n
depends on CONFIG_HEAD
help
@@ -225,6 +300,13 @@ config CONFIG_INSTALL
help
Copy files and set attributes.
config CONFIG_FEATURE_INSTALL_LONG_OPTIONS
bool "Enable long options"
default n
depends on CONFIG_INSTALL && CONFIG_GETOPT_LONG
help
Support long options for the install applet.
config CONFIG_LENGTH
bool "length"
default n
@@ -250,56 +332,56 @@ config CONFIG_LS
ls is used to list the contents of directories.
config CONFIG_FEATURE_LS_FILETYPES
bool " Enable filetyping options (-p and -F)"
bool "Enable filetyping options (-p and -F)"
default y
depends on CONFIG_LS
help
Enable the ls options (-p and -F).
config CONFIG_FEATURE_LS_FOLLOWLINKS
bool " Enable symlinks dereferencing (-L)"
bool "Enable symlinks dereferencing (-L)"
default y
depends on CONFIG_LS
help
Enable the ls option (-L).
config CONFIG_FEATURE_LS_RECURSIVE
bool " Enable recursion (-R)"
bool "Enable recursion (-R)"
default y
depends on CONFIG_LS
help
Enable the ls option (-R).
config CONFIG_FEATURE_LS_SORTFILES
bool " Sort the file names"
bool "Sort the file names"
default y
depends on CONFIG_LS
help
Allow ls to sort file names alphabetically.
config CONFIG_FEATURE_LS_TIMESTAMPS
bool " Show file timestamps"
bool "Show file timestamps"
default y
depends on CONFIG_LS
help
Allow ls to display timestamps for files.
config CONFIG_FEATURE_LS_USERNAME
bool " Show username/groupnames"
bool "Show username/groupnames"
default y
depends on CONFIG_LS
help
Allow ls to display username/groupname for files.
config CONFIG_FEATURE_LS_COLOR
bool " Allow use of color to identify file types"
bool "Allow use of color to identify file types"
default y
depends on CONFIG_LS
depends on CONFIG_LS && CONFIG_GETOPT_LONG
help
This enables the --color option to ls.
config CONFIG_FEATURE_LS_COLOR_IS_DEFAULT
bool " Produce colored ls output by default"
bool "Produce colored ls output by default"
default n
depends on CONFIG_FEATURE_LS_COLOR
help
@@ -321,6 +403,13 @@ config CONFIG_MKDIR
help
mkdir is used to create directories with the specified names.
config CONFIG_FEATURE_MKDIR_LONG_OPTIONS
bool "Enable long options"
default n
depends on CONFIG_MKDIR && CONFIG_GETOPT_LONG
help
Support long options for the mkdir applet.
config CONFIG_MKFIFO
bool "mkfifo"
default n
@@ -341,6 +430,13 @@ config CONFIG_MV
help
mv is used to move or rename files or directories.
config CONFIG_FEATURE_MV_LONG_OPTIONS
bool "Enable long options"
default n
depends on CONFIG_MV && CONFIG_GETOPT_LONG
help
Support long options for the mv applet.
config CONFIG_NICE
bool "nice"
default n
@@ -416,7 +512,7 @@ config CONFIG_SLEEP
sleep is used to pause for a specified number of seconds,
config CONFIG_FEATURE_FANCY_SLEEP
bool " Enable multiple integer args and optional time suffixes"
bool "Enable multiple integer args and optional time suffixes"
default n
depends on CONFIG_SLEEP
help
@@ -429,7 +525,7 @@ config CONFIG_SORT
sort is used to sort lines of text in specified files.
config CONFIG_FEATURE_SORT_BIG
bool " full SuSv3 compliant sort (Support -ktcsbdfiozgM)"
bool "full SuSv3 compliant sort (Support -ktcsbdfiozgM)"
default y
depends on CONFIG_SORT
help
@@ -447,7 +543,7 @@ config CONFIG_STAT
display file or filesystem status.
config CONFIG_FEATURE_STAT_FORMAT
bool " Enable custom formats (-c)"
bool "Enable custom formats (-c)"
default n
depends on CONFIG_STAT
help
@@ -481,7 +577,7 @@ config CONFIG_TAIL
from files.
config CONFIG_FEATURE_FANCY_TAIL
bool " Enable extra tail options (-q, -s, and -v)"
bool "Enable extra tail options (-q, -s, and -v)"
default y
depends on CONFIG_TAIL
help
@@ -496,7 +592,7 @@ config CONFIG_TEE
to standard output and files.
config CONFIG_FEATURE_TEE_USE_BLOCK_IO
bool " Enable block i/o (larger/faster) instead of byte i/o."
bool "Enable block i/o (larger/faster) instead of byte i/o."
default n
depends on CONFIG_TEE
help
@@ -507,11 +603,11 @@ config CONFIG_TEST
default n
help
test is used to check file types and compare values,
returning an appropriate exit code. The shells (ash
and bash) have test builtin.
returning an appropriate exit code. The bash shell
has test built in, ash can build it in optionally.
config CONFIG_FEATURE_TEST_64
bool " Extend test to 64 bit"
bool "Extend test to 64 bit"
default n
depends on CONFIG_TEST
help
@@ -532,7 +628,7 @@ config CONFIG_TR
input, writing to standard output.
config CONFIG_FEATURE_TR_CLASSES
bool " Enable character classes (such as [:upper:])"
bool "Enable character classes (such as [:upper:])"
default n
depends on CONFIG_TR
help
@@ -540,7 +636,7 @@ config CONFIG_FEATURE_TR_CLASSES
tr [:upper:] [:lower:] to convert input into lowercase.
config CONFIG_FEATURE_TR_EQUIV
bool " Enable equivalence classes"
bool "Enable equivalence classes"
default n
depends on CONFIG_TR
help
@@ -633,7 +729,7 @@ comment "Common options for cp and mv"
depends on CONFIG_CP || CONFIG_MV
config CONFIG_FEATURE_PRESERVE_HARDLINKS
bool " Preserve hard links"
bool "Preserve hard links"
default n
depends on CONFIG_CP || CONFIG_MV
help
@@ -643,7 +739,7 @@ comment "Common options for ls, more and telnet"
depends on CONFIG_LS || CONFIG_MORE || CONFIG_TELNET
config CONFIG_FEATURE_AUTOWIDTH
bool " Calculate terminal & column widths"
bool "Calculate terminal & column widths"
default y
depends on CONFIG_LS || CONFIG_MORE || CONFIG_TELNET
help
@@ -657,7 +753,7 @@ comment "Common options for df, du, ls"
depends on CONFIG_DF || CONFIG_DU || CONFIG_LS
config CONFIG_FEATURE_HUMAN_READABLE
bool " Support for human readable output (example 13k, 23M, 235G)"
bool "Support for human readable output (example 13k, 23M, 235G)"
default n
depends on CONFIG_DF || CONFIG_DU || CONFIG_LS
help
@@ -667,7 +763,7 @@ comment "Common options for md5sum, sha1sum"
depends on CONFIG_MD5SUM || CONFIG_SHA1SUM
config CONFIG_FEATURE_MD5_SHA1_SUM_CHECK
bool " Enable -c, -s and -w options"
bool "Enable -c, -s and -w options"
default n
depends on CONFIG_MD5SUM || CONFIG_SHA1SUM
help
+1 -1
View File
@@ -12,7 +12,7 @@ top_builddir=..
endif
srcdir=$(top_srcdir)/coreutils
SHELLUTILS_DIR:=./
include $(top_builddir)/Rules.mak
include $(top_srcdir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
+3
View File
@@ -14,10 +14,12 @@ COREUTILS-y:=
COREUTILS-$(CONFIG_BASENAME) += basename.o
COREUTILS-$(CONFIG_CAL) += cal.o
COREUTILS-$(CONFIG_CAT) += cat.o
COREUTILS-$(CONFIG_CATV) += catv.o
COREUTILS-$(CONFIG_CHGRP) += chgrp.o
COREUTILS-$(CONFIG_CHMOD) += chmod.o
COREUTILS-$(CONFIG_CHOWN) += chown.o
COREUTILS-$(CONFIG_CHROOT) += chroot.o
COREUTILS-$(CONFIG_CKSUM) += cksum.o
COREUTILS-$(CONFIG_CMP) += cmp.o
COREUTILS-$(CONFIG_COMM) += comm.o
COREUTILS-$(CONFIG_CP) += cp.o
@@ -25,6 +27,7 @@ COREUTILS-$(CONFIG_CUT) += cut.o
COREUTILS-$(CONFIG_DATE) += date.o
COREUTILS-$(CONFIG_DD) += dd.o
COREUTILS-$(CONFIG_DF) += df.o
COREUTILS-$(CONFIG_DIFF) += diff.o
COREUTILS-$(CONFIG_DIRNAME) += dirname.o
COREUTILS-$(CONFIG_DOS2UNIX) += dos2unix.o
COREUTILS-$(CONFIG_DU) += du.o
+1 -13
View File
@@ -4,19 +4,7 @@
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.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
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*
*/
+3 -15
View File
@@ -1,23 +1,11 @@
/* vi: set sw=4 ts=4: */
/*
* Calendar implementation for busybox
*
* 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
*
*/
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/* BB_AUDIT SUSv3 compliant with -j and -y extensions (from util-linux). */
/* BB_AUDIT BUG: The output of 'cal -j 1752' is incorrect. The upstream
+2 -29
View File
@@ -4,41 +4,14 @@
*
* Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.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
*
* Licensed under GPLv2 or later, see file License in this tarball for details.
*/
/* BB_AUDIT SUSv3 compliant */
/* http://www.opengroup.org/onlinepubs/007904975/utilities/cat.html */
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* This is a new implementation of 'cat' which aims to be SUSv3 compliant.
*
* Changes from the previous implementation include:
* 1) Multiple '-' args are accepted as required by SUSv3. The previous
* implementation would close stdin and segfault on a subsequent '-'.
* 2) The '-u' options is required by SUSv3. Note that the specified
* behavior for '-u' is done by default, so all we need do is accept
* the option.
*/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include "busybox.h"
#include <unistd.h>
int cat_main(int argc, char **argv)
{
+65
View File
@@ -0,0 +1,65 @@
/* vi: set sw=4 ts=4: */
/*
* cat -v implementation for busybox
*
* Copyright (C) 2006 Rob Landley <rob@landley.net>
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/* See "Cat -v considered harmful" at
* http://cm.bell-labs.com/cm/cs/doc/84/kp.ps.gz */
#include "busybox.h"
#include <unistd.h>
#include <fcntl.h>
int catv_main(int argc, char **argv)
{
int retval = EXIT_SUCCESS, fd, flags;
flags = bb_getopt_ulflags(argc, argv, "etv");
flags ^= 4;
// Loop through files.
argv += optind;
do {
// Read from stdin if there's nothing else to do.
fd = 0;
if (*argv && 0>(fd = bb_xopen(*argv, O_RDONLY))) retval = EXIT_FAILURE;
else for(;;) {
int i, res;
res = read(fd, bb_common_bufsiz1, sizeof(bb_common_bufsiz1));
if (res < 0) retval = EXIT_FAILURE;
if (res <1) break;
for (i=0; i<res; i++) {
char c=bb_common_bufsiz1[i];
if (c > 126 && (flags & 4)) {
if (c == 127) {
printf("^?");
continue;
} else {
printf("M-");
c -= 128;
}
}
if (c < 32) {
if (c == 10) {
if (flags & 1) putchar('$');
} else if (flags & (c==9 ? 2 : 4)) {
printf("^%c", c+'@');
continue;
}
}
putchar(c);
}
}
if (ENABLE_FEATURE_CLEAN_UP && fd) close(fd);
} while (*++argv);
return retval;
}
+1 -22
View File
@@ -4,20 +4,7 @@
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.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
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/* BB_AUDIT SUSv3 defects - unsupported options -h, -H, -L, and -P. */
@@ -71,11 +58,3 @@ int chgrp_main(int argc, char **argv)
return retval;
}
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
-8
View File
@@ -89,11 +89,3 @@ int chmod_main(int ATTRIBUTE_UNUSED argc, char **argv)
return retval;
}
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
-8
View File
@@ -76,11 +76,3 @@ int chown_main(int argc, char **argv)
return retval;
}
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
+3 -15
View File
@@ -4,20 +4,7 @@
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.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
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
@@ -35,9 +22,10 @@ int chroot_main(int argc, char **argv)
}
++argv;
if (chroot(*argv) || (chdir("/"))) {
if (chroot(*argv)) {
bb_perror_msg_and_die("cannot change root directory to %s", *argv);
}
bb_xchdir("/");
++argv;
if (argc == 2) {
+55
View File
@@ -0,0 +1,55 @@
/* vi: set sw=4 ts=4: */
/*
* cksum - calculate the CRC32 checksum of a file
*
* Copyright (C) 2006 by Rob Sullivan, with ideas from code by Walter Harms
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include "busybox.h"
int cksum_main(int argc, char **argv) {
uint32_t *crc32_table = bb_crc32_filltable(1);
FILE *fp;
uint32_t crc;
long length, filesize;
int bytes_read;
char *cp;
RESERVE_CONFIG_BUFFER(buf, BUFSIZ);
int inp_stdin = (argc == optind) ? 1 : 0;
do {
fp = bb_wfopen_input((inp_stdin) ? bb_msg_standard_input : *++argv);
crc = 0;
length = 0;
while ((bytes_read = fread(buf, 1, BUFSIZ, fp)) > 0) {
cp = buf;
length += bytes_read;
while (bytes_read--)
crc = (crc << 8) ^ crc32_table[((crc >> 24) ^ (*cp++)) & 0xffL];
}
filesize = length;
for (; length; length >>= 8)
crc = (crc << 8) ^ crc32_table[((crc >> 24) ^ length) & 0xffL];
crc ^= 0xffffffffL;
if (inp_stdin) {
printf("%"PRIu32" %li\n", crc, filesize);
break;
}
printf("%"PRIu32" %li %s\n", crc, filesize, *argv);
fclose(fp);
} while (*(argv+1));
return EXIT_SUCCESS;
}
+1 -14
View File
@@ -4,20 +4,7 @@
*
* Copyright (C) 2000,2001 by Matt Kraai <kraai@alumni.carnegiemellon.edu>
*
* 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
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/* BB_AUDIT SUSv3 (virtually) compliant -- uses nicer GNU format for -l. */
+4 -18
View File
@@ -4,21 +4,7 @@
*
* Copyright (C) 2005 by Robert Sullivan <cogito.ergo.cogito@gmail.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
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdio.h>
@@ -75,16 +61,16 @@ static void cmp_files(char **infiles)
fgets(thisline[i], LINE_LEN, streams[i]);
}
while (thisline[0] || thisline[1]) {
while (*thisline[0] || *thisline[1]) {
int order = 0;
i = 0;
if (feof(streams[0])) i |= BB_EOF_0;
if (feof(streams[1])) i |= BB_EOF_1;
if (!thisline[0])
if (!*thisline[0])
order = 1;
else if (!thisline[1])
else if (!*thisline[1])
order = -1;
else {
int tl0_len, tl1_len;
+1 -1
View File
@@ -46,7 +46,7 @@ int cp_main(int argc, char **argv)
}
if (flags & 64) {
/* Make -r a synonym for -R,
* -r was marked as obsolete in SUSv3, but is included for compatability
* -r was marked as obsolete in SUSv3, but is included for compatibility
*/
flags |= FILEUTILS_RECUR;
}
+2 -15
View File
@@ -1,24 +1,11 @@
/* vi: set sw=8 ts=8: */
/* vi: set sw=4 ts=4: */
/*
* cut.c - minimalist version of cut
*
* Copyright (C) 1999,2000,2001 by Lineo, inc.
* Written by Mark Whitley <markw@codepoet.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
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdio.h>
+17 -17
View File
@@ -9,15 +9,6 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdlib.h>
#include <errno.h>
#include <sys/time.h>
#include <unistd.h>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include "busybox.h"
/* This 'date' command supports only 2 time setting formats,
all the GNU strftime stuff (its in libc, lets use it),
setting time using UTC and displaying int, as well as
@@ -29,6 +20,23 @@
/* Default input handling to save surprising some people */
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include "busybox.h"
#define DATE_OPT_RFC2822 0x01
#define DATE_OPT_SET 0x02
#define DATE_OPT_UTC 0x04
#define DATE_OPT_DATE 0x08
#define DATE_OPT_REFERENCE 0x10
#define DATE_OPT_TIMESPEC 0x20
#define DATE_OPT_HINT 0x40
static struct tm *date_conv_time(struct tm *tm_time, const char *t_string)
{
int nr;
@@ -104,14 +112,6 @@ static struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string)
return (tm_time);
}
#define DATE_OPT_RFC2822 0x01
#define DATE_OPT_SET 0x02
#define DATE_OPT_UTC 0x04
#define DATE_OPT_DATE 0x08
#define DATE_OPT_REFERENCE 0x10
#define DATE_OPT_TIMESPEC 0x20
#define DATE_OPT_HINT 0x40
int date_main(int argc, char **argv)
{
char *date_str = NULL;
+106 -83
View File
@@ -5,20 +5,7 @@
*
* 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
* 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
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <sys/types.h>
@@ -28,9 +15,9 @@
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <signal.h> // For FEATURE_DD_SIGNAL_HANDLING
#include "busybox.h"
static const struct suffix_mult dd_suffixes[] = {
{ "c", 1 },
{ "w", 2 },
@@ -44,66 +31,83 @@ static const struct suffix_mult dd_suffixes[] = {
{ NULL, 0 }
};
static size_t out_full;
static size_t out_part;
static size_t in_full;
static size_t in_part;
static void dd_output_status(int cur_signal)
{
fprintf(stderr, "%ld+%ld records in\n%ld+%ld records out\n",
(long)in_full, (long)in_part,
(long)out_full, (long)out_part);
}
int dd_main(int argc, char **argv)
{
size_t out_full = 0;
size_t out_part = 0;
size_t in_full = 0;
size_t in_part = 0;
size_t count = -1;
size_t bs = 512;
size_t count = -1, oc = 0, ibs = 512, obs = 512;
ssize_t n;
off_t seek = 0;
off_t skip = 0;
int sync_flag = FALSE;
int noerror = FALSE;
int trunc_flag = TRUE;
int oflag;
int ifd;
int ofd;
int i;
const char *infile = NULL;
const char *outfile = NULL;
char *buf;
off_t seek = 0, skip = 0;
int sync_flag = FALSE, noerror = FALSE, trunc_flag = TRUE, twobufs_flag = 0,
oflag, ifd, ofd, i;
const char *infile = NULL, *outfile = NULL;
char *ibuf, *obuf;
if (ENABLE_FEATURE_DD_SIGNAL_HANDLING)
{
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_handler = dd_output_status;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGUSR1, &sa, 0);
}
for (i = 1; i < argc; i++) {
if (strncmp("bs=", argv[i], 3) == 0)
bs = bb_xparse_number(argv[i]+3, dd_suffixes);
else if (strncmp("count=", argv[i], 6) == 0)
if (ENABLE_FEATURE_DD_IBS_OBS && !strncmp("ibs=", argv[i], 4)) {
ibs = bb_xparse_number(argv[i]+4, dd_suffixes);
twobufs_flag++;
} else if (ENABLE_FEATURE_DD_IBS_OBS && !strncmp("obs=", argv[i], 4)) {
obs = bb_xparse_number(argv[i]+4, dd_suffixes);
twobufs_flag++;
} else if (!strncmp("bs=", argv[i], 3)) {
ibs = obs = bb_xparse_number(argv[i]+3, dd_suffixes);
} else if (!strncmp("count=", argv[i], 6))
count = bb_xparse_number(argv[i]+6, dd_suffixes);
else if (strncmp("seek=", argv[i], 5) == 0)
else if (!strncmp("seek=", argv[i], 5))
seek = bb_xparse_number(argv[i]+5, dd_suffixes);
else if (strncmp("skip=", argv[i], 5) == 0)
else if (!strncmp("skip=", argv[i], 5))
skip = bb_xparse_number(argv[i]+5, dd_suffixes);
else if (strncmp("if=", argv[i], 3) == 0)
else if (!strncmp("if=", argv[i], 3))
infile = argv[i]+3;
else if (strncmp("of=", argv[i], 3) == 0)
else if (!strncmp("of=", argv[i], 3))
outfile = argv[i]+3;
else if (strncmp("conv=", argv[i], 5) == 0) {
buf = argv[i]+5;
else if (ENABLE_FEATURE_DD_IBS_OBS && !strncmp("conv=", argv[i], 5)) {
ibuf = argv[i]+5;
while (1) {
if (strncmp("notrunc", buf, 7) == 0) {
if (!strncmp("notrunc", ibuf, 7)) {
trunc_flag = FALSE;
buf += 7;
} else if (strncmp("sync", buf, 4) == 0) {
ibuf += 7;
} else if (!strncmp("sync", ibuf, 4)) {
sync_flag = TRUE;
buf += 4;
} else if (strncmp("noerror", buf, 7) == 0) {
ibuf += 4;
} else if (!strncmp("noerror", ibuf, 7)) {
noerror = TRUE;
buf += 7;
ibuf += 7;
} else {
bb_error_msg_and_die("invalid conversion `%s'", argv[i]+5);
bb_error_msg_and_die(bb_msg_invalid_arg, argv[i]+5, "conv");
}
if (buf[0] == '\0')
break;
if (buf[0] == ',')
buf++;
if (ibuf[0] == '\0') break;
if (ibuf[0] == ',') ibuf++;
}
} else
bb_show_usage();
}
ibuf = xmalloc(ibs);
buf = xmalloc(bs);
if (twobufs_flag) obuf = xmalloc(obs);
else obuf = ibuf;
if (infile != NULL) {
ifd = bb_xopen(infile, O_RDONLY);
@@ -119,12 +123,10 @@ int dd_main(int argc, char **argv)
oflag |= O_TRUNC;
}
if ((ofd = open(outfile, oflag, 0666)) < 0) {
bb_perror_msg_and_die("%s", outfile);
}
ofd = bb_xopen3(outfile, oflag, 0666);
if (seek && trunc_flag) {
if (ftruncate(ofd, seek * bs) < 0) {
if (ftruncate(ofd, seek * obs) < 0) {
struct stat st;
if (fstat (ofd, &st) < 0 || S_ISREG (st.st_mode) ||
@@ -139,13 +141,19 @@ int dd_main(int argc, char **argv)
}
if (skip) {
if (lseek(ifd, skip * bs, SEEK_CUR) < 0) {
bb_perror_msg_and_die("%s", infile);
if (lseek(ifd, skip * ibs, SEEK_CUR) < 0) {
while (skip-- > 0) {
n = safe_read(ifd, ibuf, ibs);
if (n < 0)
bb_perror_msg_and_die("%s", infile);
if (n == 0)
break;
}
}
}
if (seek) {
if (lseek(ofd, seek * bs, SEEK_CUR) < 0) {
if (lseek(ofd, seek * obs, SEEK_CUR) < 0) {
bb_perror_msg_and_die("%s", outfile);
}
}
@@ -153,40 +161,57 @@ 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);
memset(ibuf, '\0', ibs);
}
n = safe_read(ifd, ibuf, ibs);
if (n == 0) {
break;
}
n = safe_read(ifd, buf, bs);
if (n < 0) {
if (noerror) {
n = bs;
n = ibs;
bb_perror_msg("%s", infile);
} else {
bb_perror_msg_and_die("%s", infile);
}
}
if (n == 0) {
break;
}
if ((size_t)n == bs) {
if ((size_t)n == ibs) {
in_full++;
} else {
in_part++;
if (sync_flag) {
memset(ibuf + n, '\0', ibs - n);
n = ibs;
}
}
if (sync_flag) {
memset(buf + n, '\0', bs - n);
n = bs;
}
n = bb_full_write(ofd, buf, n);
if (n < 0) {
bb_perror_msg_and_die("%s", outfile);
}
if ((size_t)n == bs) {
out_full++;
if (twobufs_flag) {
char *tmp = ibuf;
while (n) {
size_t d = obs - oc;
if (d > n) d = n;
memcpy(obuf + oc, tmp, d);
n -= d;
tmp += d;
oc += d;
if (oc == obs) {
xwrite(ofd, obuf, obs);
out_full++;
oc = 0;
}
}
} else {
out_part++;
xwrite(ofd, ibuf, n);
if (n == ibs) out_full++;
else out_part++;
}
}
if (ENABLE_FEATURE_DD_IBS_OBS && oc) {
xwrite(ofd, obuf, oc);
out_part++;
}
if (close (ifd) < 0) {
bb_perror_msg_and_die("%s", infile);
}
@@ -195,9 +220,7 @@ int dd_main(int argc, char **argv)
bb_perror_msg_and_die("%s", outfile);
}
fprintf(stderr, "%ld+%ld records in\n%ld+%ld records out\n",
(long)in_full, (long)in_part,
(long)out_full, (long)out_part);
dd_output_status(0);
return EXIT_SUCCESS;
}
+1 -22
View File
@@ -5,20 +5,7 @@
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
* based on original code by (I think) Bruce Perens <bruce@pixar.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
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/* BB_AUDIT SUSv3 _NOT_ compliant -- options -P and -t missing. Also blocksize. */
@@ -160,11 +147,3 @@ int df_main(int argc, char **argv)
bb_fflush_stdout_and_exit(status);
}
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
+1256
View File
File diff suppressed because it is too large. Load diff
+1 -14
View File
@@ -4,20 +4,7 @@
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.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
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/* BB_AUDIT SUSv3 compliant */
+40 -41
View File
@@ -1,3 +1,4 @@
/* vi: set sw=4 ts=4: */
/*
* dos2unix for BusyBox
*
@@ -8,78 +9,78 @@
*
* dos2unix filters reading input from stdin and writing output to stdout.
*
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <fcntl.h>
#include <sys/time.h>
#include "busybox.h"
#define CT_UNIX2DOS 1
#define CT_DOS2UNIX 2
#define tempFn bb_common_bufsiz1
enum ConvType {
CT_UNIX2DOS = 1,
CT_DOS2UNIX
} ConvType;
/* if fn is NULL then input is stdin and output is stdout */
static int convert(char *fn, int ConvType)
static int convert(char *fn)
{
int c, fd;
FILE *in, *out;
int i;
if (fn != NULL) {
in = bb_xfopen(fn, "rw");
/*
The file is then created with mode read/write and
permissions 0666 for glibc 2.0.6 and earlier or
0600 for glibc 2.0.7 and later.
*/
snprintf(tempFn, sizeof(tempFn), "%sXXXXXX", fn);
The file is then created with mode read/write and
permissions 0666 for glibc 2.0.6 and earlier or
0600 for glibc 2.0.7 and later.
*/
snprintf(bb_common_bufsiz1, sizeof(bb_common_bufsiz1), "%sXXXXXX", fn);
/*
sizeof tempFn is 4096, so it should be big enough to hold the full
path. however if the output is truncated the subsequent call to
mkstemp would fail.
*/
if ((fd = mkstemp(&tempFn[0])) == -1 || chmod(tempFn, 0600) == -1) {
sizeof bb_common_bufsiz1 is 4096, so it should be big enough to
hold the full path. However if the output is truncated the
subsequent call to mkstemp would fail.
*/
if ((i = mkstemp(&bb_common_bufsiz1[0])) == -1
|| chmod(bb_common_bufsiz1, 0600) == -1) {
bb_perror_nomsg_and_die();
}
out = fdopen(fd, "w+");
out = fdopen(i, "w+");
if (!out) {
close(fd);
remove(tempFn);
close(i);
remove(bb_common_bufsiz1);
}
} else {
in = stdin;
out = stdout;
}
while ((c = fgetc(in)) != EOF) {
if (c == '\r')
while ((i = fgetc(in)) != EOF) {
if (i == '\r')
continue;
if (c == '\n') {
if (i == '\n') {
if (ConvType == CT_UNIX2DOS)
fputc('\r', out);
fputc('\n', out);
continue;
}
fputc(c, out);
fputc(i, out);
}
if (fn != NULL) {
if (fclose(in) < 0 || fclose(out) < 0) {
bb_perror_nomsg();
remove(tempFn);
remove(bb_common_bufsiz1);
return -2;
}
}
/* Assume they are both on the same filesystem (which
* should be true since we put them into the same directory
* so we _should_ be ok, but you never know... */
if (rename(tempFn, fn) < 0) {
bb_perror_msg("cannot rename '%s' as '%s'", tempFn, fn);
* should be true since we put them into the same directory
* so we _should_ be ok, but you never know... */
if (rename(bb_common_bufsiz1, fn) < 0) {
bb_perror_msg("cannot rename '%s' as '%s'", bb_common_bufsiz1, fn);
return -1;
}
}
}
return 0;
@@ -87,14 +88,13 @@ static int convert(char *fn, int ConvType)
int dos2unix_main(int argc, char *argv[])
{
int ConvType;
int o;
/* See if we are supposed to be doing dos2unix or unix2dos */
if (argv[0][0]=='d') {
ConvType = CT_DOS2UNIX; /*2*/
if (bb_applet_name[0] == 'd') {
ConvType = CT_DOS2UNIX; /*2 */
} else {
ConvType = CT_UNIX2DOS; /*1*/
ConvType = CT_UNIX2DOS; /*1 */
}
/* -u and -d are mutally exclusive */
bb_opt_complementally = "?:u--d:d--u";
@@ -109,12 +109,11 @@ int dos2unix_main(int argc, char *argv[])
ConvType = o;
if (optind < argc) {
while(optind < argc)
if ((o = convert(argv[optind++], ConvType)) < 0)
while (optind < argc)
if ((o = convert(argv[optind++])) < 0)
break;
}
else
o = convert(NULL, ConvType);
} else
o = convert(NULL);
return o;
}
+6 -20
View File
@@ -6,20 +6,7 @@
* 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
* 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
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/* BB_AUDIT SUSv3 compliant (unless default blocksize set to 1k) */
@@ -44,12 +31,12 @@
#include "busybox.h"
#ifdef CONFIG_FEATURE_HUMAN_READABLE
# ifdef CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K
# ifdef CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K
static unsigned long disp_hr = KILOBYTE;
# else
static unsigned long disp_hr = 512;
# endif
#elif defined CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K
#elif defined CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K
static unsigned int disp_k = 1;
#else
static unsigned int disp_k; /* bss inits to 0 */
@@ -134,9 +121,8 @@ static long du(char *filename)
struct dirent *entry;
char *newfile;
dir = opendir(filename);
dir = bb_opendir(filename);
if (!dir) {
bb_perror_msg("%s", filename);
status = EXIT_FAILURE;
return sum;
}
@@ -174,7 +160,7 @@ int du_main(int argc, char **argv)
char *smax_print_depth;
unsigned long opt;
#ifdef CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K
#ifdef CONFIG_FEATURE_DU_DEFUALT_BLOCKSIZE_1K
if (getenv("POSIXLY_CORRECT")) { /* TODO - a new libbb function? */
#ifdef CONFIG_FEATURE_HUMAN_READABLE
disp_hr = 512;
@@ -208,7 +194,7 @@ int du_main(int argc, char **argv)
#else
bb_opt_complementally = "H-L:L-H:s-d:d-s";
opt = bb_getopt_ulflags(argc, argv, "aHkLsx" "d:" "lc", &smax_print_depth);
#if !defined CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K
#if !defined CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K
if((opt & (1 << 2))) {
/* -k opt */
disp_k = 1;
+142 -13
View File
@@ -1,29 +1,158 @@
/* vi: set sw=4 ts=4: */
/*
* echo applet implementation for busybox
* echo implementation for busybox
*
* 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.
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* 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
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*
* Original copyright notice is retained at the end of this file.
*/
/* BB_AUDIT SUSv3 compliant -- unless configured as fancy echo. */
/* http://www.opengroup.org/onlinepubs/007904975/utilities/echo.html */
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Because of behavioral differences, implemented configurable SUSv3
* or 'fancy' gnu-ish behaviors. Also, reduced size and fixed bugs.
* 1) In handling '\c' escape, the previous version only suppressed the
* trailing newline. SUSv3 specifies _no_ output after '\c'.
* 2) SUSv3 specifies that octal escapes are of the form \0{#{#{#}}}.
* The previous version version did not allow 4-digit octals.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "busybox.h"
int bb_echo(int ATTRIBUTE_UNUSED argc, char **argv)
{
#ifndef CONFIG_FEATURE_FANCY_ECHO
#define eflag '\\'
++argv;
#else
const char *p;
int nflag = 1;
int eflag = 0;
while (*++argv && (**argv == '-')) {
/* If it appears that we are handling options, then make sure
* that all of the options specified are actually valid.
* Otherwise, the string should just be echoed.
*/
if (!*(p = *argv + 1)) { /* A single '-', so echo it. */
goto just_echo;
}
do {
if (strrchr("neE", *p) == 0) {
goto just_echo;
}
} while (*++p);
/* All of the options in this arg are valid, so handle them. */
p = *argv + 1;
do {
if (*p == 'n') {
nflag = 0;
} else if (*p == 'e') {
eflag = '\\';
} else {
eflag = 0;
}
} while (*++p);
}
just_echo:
#endif
while (*argv) {
int c;
while ((c = *(*argv)++)) {
if (c == eflag) { /* Check for escape seq. */
if (**argv == 'c') {
/* '\c' means cancel newline and
* ignore all subsequent chars. */
return 0;
}
#ifndef CONFIG_FEATURE_FANCY_ECHO
/* SUSv3 specifies that octal escapes must begin with '0'. */
if (((unsigned int)(**argv - '1')) >= 7)
#endif
{
/* Since SUSv3 mandates a first digit of 0, 4-digit octals
* of the form \0### are accepted. */
if ((**argv == '0') && (((unsigned int)(argv[0][1] - '0')) < 8)) {
(*argv)++;
}
/* bb_process_escape_sequence can handle nul correctly */
c = bb_process_escape_sequence((const char **) argv);
}
}
putchar(c);
}
if (*++argv) {
putchar(' ');
}
}
#ifdef CONFIG_FEATURE_FANCY_ECHO
if (nflag) {
putchar('\n');
}
#else
putchar('\n');
#endif
return 0;
}
int echo_main(int argc, char** argv)
{
(void)bb_echo(argc, argv);
bb_fflush_stdout_and_exit(EXIT_SUCCESS);
}
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Kenneth Almquist.
*
* 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. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
* ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
*
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* 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.
*
* @(#)echo.c 8.1 (Berkeley) 5/31/93
*/
+5 -14
View File
@@ -5,19 +5,7 @@
* Copyright (c) 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* 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
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*
* Original copyright notice is retained at the end of this file.
*
@@ -50,12 +38,13 @@
#include <getopt.h> /* struct option */
#include "busybox.h"
#if ENABLE_FEATURE_ENV_LONG_OPTIONS
static const struct option env_long_options[] = {
{ "ignore-environment", 0, NULL, 'i' },
{ "unset", 1, NULL, 'u' },
{ 0, 0, 0, 0 }
};
#endif
int env_main(int argc, char** argv)
{
@@ -67,7 +56,9 @@ int env_main(int argc, char** argv)
extern char **environ;
bb_opt_complementally = "u::";
#if ENABLE_FEATURE_ENV_LONG_OPTIONS
bb_applet_long_options = env_long_options;
#endif
opt = bb_getopt_ulflags(argc, argv, "+iu:", &unset_env);
+1 -14
View File
@@ -11,20 +11,7 @@
* - reduced 464 bytes.
* - 64 math support
*
* 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
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/* This program evaluates expressions. Each token (operator, operand,
+1 -1
View File
@@ -1,3 +1,4 @@
/* vi: set sw=4 ts=4: */
/* fold -- wrap each input line to fit in specified width.
Written by David MacKenzie, djm@gnu.ai.mit.edu.
@@ -158,4 +159,3 @@ rescan:
bb_fflush_stdout_and_exit(errs);
}
/* vi: set sw=4 ts=4: */
Loaded 100 of 676 files, more files were not shown because too many files have changed in this diff. Show more