Compare commits

...
462 Commits
Author SHA1 Message Date
Eric Andersen 7cce16cf21 Bump version number for release 2004-02-04 11:44:58 +00:00
Eric Andersen aeea32ca69 Richard Kojedzinszky writes:
Hi,

I've noticed the bug also, and here is another patch for it. I hope it'll
not introduce more bugs. Not too nice, but works for me.

Here it is for busybox-1.00-pre6
2004-02-04 11:19:44 +00:00
Eric Andersen ef43749e83 Joe.C writes:
Hi,

   When httpd connection is closed, bosybox httpd will
not stop reading from CGI program. This patch fix this
problem. It check the return value of bb_full_write and
stop reading from CGI if the connection is closed.
Please apply this patch.

Joe.C
2004-02-04 11:10:28 +00:00
Eric Andersen c71c18957d Jean Wolter writes:
Hello,

when calling seq with

    seq 1 1

it generates an "endless" list of numbers until the counter wraps and
reaches 1 again. The follwoing small patch should introduce the
expected behavior (output of 1 and termination):

regards,
Jean
2004-02-04 11:01:19 +00:00
Eric Andersen c06f568dda Rob Landley writes:
While building glibc with busybox as part of the development environment, I
found a bug in glibc's regexec can throw sed into an endless loop.  This
fixes it.  Should I put an #ifdef around it or something?  (Note, this patch
also contains the "this is not gnu sed 4.0" hack I posted earlier, which is
also needed to build glibc...)
2004-02-04 10:57:46 +00:00
Eric Andersen 4575bbf7b8 The variable 'complementaly' used to be allocated with calloc, which zeroed it
out during the allocation process.  When vodz changed it to be allocated on the
stack, he forgot to explicitly zero it, leaving its value filled with whatever
used to be sitting on the stack.  It would garbage values, depending on the
garbage that happened to be sitting on the stack when the function was called.
The result was that applets using bb_getopt_ulflags() were showing
unpredictable behavior (such as segfaults), which naturally broke many things.
2004-02-04 10:48:37 +00:00
Glenn L McGrath 5b0d7deb75 Bug fix from Tito. 2004-02-04 08:27:57 +00:00
Glenn L McGrath 16e45d7e29 Vodz last_patch_125_2, this patch have:
- synced with dash 0.4.21
- better handle trap "cmds..." SIGINT (strange, i make bad hack for ash 
  and cmdedit, but this work only with this...)
- may be haven`t problem with Ctrl-D
2004-02-04 08:24:39 +00:00
Manuel Novoa III 31b98dd097 Rewrite parse_config_file(). Among the old version's problems:
No checking for lines that were too long.
  No checking that fgets returning NULL was actually due to EOF.
  Various whitespace handling inconsistencies.
  Bloat (switches and multiple identical function calls).
  Failure to check for trailing characters in some cases.
  Dynamicly allocated memory was not free()d on error.
Given that this controls suid/sgid behavior, the sloppy coding was
really inexcusable.  :-(
2004-02-01 10:03:05 +00:00
Manuel Novoa III 083862228a Use bb_xstrdup() instead of strdup(). 2004-02-01 07:34:28 +00:00
Glenn L McGrath 24cb17f9be Fix http proxy use, bytes were swapped 2004-01-31 08:08:57 +00:00
Eric Andersen 35db2281b7 Mention changes to the daily snapshots 2004-01-31 06:11:39 +00:00
Eric Andersen a3212eb4cc Update docs for release 2004-01-31 05:44:07 +00:00
Eric Andersen dfe30032af Bump version for release 2004-01-31 05:27:17 +00:00
Eric Andersen ad95373efc Use standard C99 types 2004-01-30 23:45:53 +00:00
Eric Andersen 1a834be1ce Use proper C99 types 2004-01-30 22:59:50 +00:00
Eric Andersen d242079387 Fixup use of 'u_int' to instead use 'unsigned int' 2004-01-30 22:56:20 +00:00
Eric Andersen dfcb5b0412 s/u_int/uint/g 2004-01-30 22:54:20 +00:00
Eric Andersen 0f56de665c s/u_int/unsigned int/g
s/u_short/unsigned short/g
2004-01-30 22:52:27 +00:00
Eric Andersen 39cdf4e2ab Use proper C99 types 2004-01-30 22:40:05 +00:00
Eric Andersen ad84a516bb Use proper C99 types throughout. So not use silly typedefs. 2004-01-30 22:31:58 +00:00
Eric Andersen ab26cc3d8a Avoid symbol naming conflict with libm 2004-01-30 22:24:32 +00:00
Manuel Novoa III ebce2daa60 Support new uClibc stdio core. 2004-01-30 21:44:20 +00:00
Eric Andersen f88bb72f1f Apply a couple of optimizations 2004-01-29 22:33:28 +00:00
Eric Andersen 242ab83499 Teach busybox ps to get the correct uid when displaying stuff 2004-01-27 20:17:39 +00:00
Glenn L McGrath 82364bb591 New applet, seq. No options, just the basics. 2004-01-27 09:22:20 +00:00
Glenn L McGrath 43112b4b65 Align using spaces to furthurest character and then one tab, now they
should always be aligned.
2004-01-27 07:36:07 +00:00
Eric Andersen 13cf6626c8 A few little updates, mostly cosmetic 2004-01-26 08:23:36 +00:00
Eric Andersen 63bcf1a55f Sigh. TRENDware has released source -- only for busybox and udhcp.
So despite their not providing kernel source, they have compiled with
the requirements for busybox at least...
2004-01-26 07:59:42 +00:00
Eric Andersen f2ec37902a Pascal Brisset writes:
uuencode fails to encode binary data because it right-shifts
bytes as signed chars and keeps the duplicated sign bits.

The original base64_encode() from wget/http.c is broken as well,
but it is only used to encode ascii data.

-- Pascal
2004-01-26 07:17:30 +00:00
Manuel Novoa III 7018385fe7 Be stricter when converting strings to integers. Should fix the problem
reported by Rob.
2004-01-25 19:47:10 +00:00
Glenn L McGrath bbbe21d6b0 Fix compile error when tab completion disabled 2004-01-25 08:46:10 +00:00
Glenn L McGrath 4766a2d56c Add the -r option as a synonym of -R 2004-01-25 05:50:28 +00:00
Glenn L McGrath 303e989a11 Add the -h, --dereference option for archive creation. 2004-01-25 05:48:28 +00:00
Glenn L McGrath ca43b485de Enable long options, adds 150 bytes. 2004-01-23 21:57:16 +00:00
Glenn L McGrath 2d016a3715 Correct check for only one of K or S options 2004-01-23 21:43:49 +00:00
Glenn L McGrath 654a99b691 Check valid options were given 2004-01-23 21:40:19 +00:00
Glenn L McGrath 711bb92d7c Dont change ownership unless we created the directory. 2004-01-23 20:28:53 +00:00
Glenn L McGrath 578eff5066 Remove unneeded conditions and logic, fix bug where ownership didnt
change.
Dont use bb_make_directory it doesnt have the features, and its ugly to
work around it.
2004-01-23 10:57:00 +00:00
Glenn L McGrath 475820c9de last_patch_124 from Vodz, fix an ash bug when alt-1 was pressed, debian
bug #228915
2004-01-22 12:42:23 +00:00
Glenn L McGrath 8d44178381 Check one and only one of start, stop are given.
Remove some global variables.
#define some getopt values.
2004-01-22 09:04:58 +00:00
Glenn L McGrath 85c5152cb8 Vodz, last_patch_123, patch have new version getopt_ulflags.
- size reduced 34 bytes
- don`t use dynamic memory allocation
- small indent correction.
2004-01-22 07:10:13 +00:00
Glenn L McGrath a1e4a0ef67 Patch from Atsushi Nemoto, recent MIPS kernel headers
does not provide PAGE_SHIFT for userland (because now mips-linux kernel
supports PAGESIZE other than 4K).
2004-01-21 11:36:44 +00:00
Glenn L McGrath ee829065cb Patch by Richard Kojedzinszky, when using END at end of lines it was
skipping to next line, cw command was leaving one char in buffer
2004-01-21 10:59:45 +00:00
Glenn L McGrath eaf5bc0038 Redo getconfigent, save 150 bytes, still small memory leak when
parsing invalid entries.
2004-01-20 15:32:39 +00:00
Glenn L McGrath 348672d46d Patch from Tito, reduce size, merge functions that are only used once. 2004-01-20 12:57:18 +00:00
Eric Andersen 15eb39c25a Stephane Billiart writes:
bb_lookup_port now takes 3 parameters but rdate has not been modified
accordingly and fails to compile in the current CVS version.
The modification below fixes the problem.

Now, RFC868 allows both UDP and TCP implementations of the time protocol
so this may not work if someone defines a udp time service other than 37
but who would do that?
2004-01-18 18:18:33 +00:00
Glenn L McGrath 53766c4063 Fix up a couple of bugs i introduced in yesterdays cleanup. 2004-01-18 08:58:06 +00:00
Glenn L McGrath 65b6d8bdb6 Fix a bug where ls -le would print the time twice. 2004-01-18 05:41:30 +00:00
Glenn L McGrath 792cae5f2a Use bb_getopt_ulflags, save 200-300 bytes 2004-01-18 05:15:16 +00:00
Glenn L McGrath 58a2e0e262 Patch from Leif Lindholm (slightly modified by me), to fix http
redirection.
Example of incorrect behaviour was the following url, busybox wget didnt
get redirected to the busybox url as it should.
http://freshmeat.net/redir/busybox/953/url_homepage/www.busybox.net
2004-01-17 23:07:14 +00:00
Glenn L McGrath 036dbaa082 Modify bb_lookup_port to allow the protocol to be specified, allowing
/etc/services support for inetd, netcat and tftp.
2004-01-17 05:03:31 +00:00
Glenn L McGrath b03be7f567 Patch from Arthur Othieno, clarify common options between dpkg and dpkg-deb 2004-01-17 03:24:05 +00:00
Glenn L McGrath a277e02663 The functions setconfig, enter and bump_nofile were only called once, marge them into the calling
function.
2004-01-17 03:20:46 +00:00
Glenn L McGrath ff6ec8a2ae Use 1 line for function name and return value,
remove dofork define/variable,
dont check pid value is < or > than 0 if we know it is 0.
2004-01-17 02:47:45 +00:00
Glenn L McGrath 3e77b4e954 Remove some defined statements 2004-01-17 01:44:32 +00:00
Glenn L McGrath c3b134f3b7 Changed #define names for common features (superficial) 2004-01-17 01:26:53 +00:00
Glenn L McGrath 2faf306c73 Use bb_get_chomped_line_from_file 2004-01-17 00:34:31 +00:00
Eric Andersen 16f94a6722 Minor updates from linux 2.6.1 2004-01-16 12:49:06 +00:00
Glenn L McGrath 17b4a20a9c Patch by Tito, reduce size of deallocvt, also make the usage message
clearer (from N to [N]) and indirectly (through bb_xgetlarg) adds support
for  -h ;-)
2004-01-15 11:50:19 +00:00
Glenn L McGrath 67285965f3 Vodz last_patch_122, Check $PATH at runtime to fix tab completion 2004-01-14 09:34:51 +00:00
Glenn L McGrath 6a78631164 Patch by Tito, use bb_xgetlarg, reduce size 2004-01-14 07:34:37 +00:00
Eric Andersen 1cda715bbc Fix a bug where mount could check the wrong device. st_rdev is the correct
device ID iff the named file is a character or block special device.  Otherwise
it is meaningless junk, in which case st_dev should be used.  This was done
incorrectly, which could cause mount to display bogus mount info.
 -Erik
2004-01-13 11:39:22 +00:00
Glenn L McGrath 7c87b67c08 Patch from Bastian Blank, allow the buildtime to be overriden with a
different string, used by the debian busybox-cvs to specify the debian
date based version number.
2004-01-13 10:57:32 +00:00
Glenn L McGrath 76620620ec Vodz last_patch_121, syncing with dash_0.4.19, reduce code size. 2004-01-13 10:19:37 +00:00
Glenn L McGrath dfb6211df3 Patch by Tito, remove some unneeded variables to save some space. 2004-01-13 10:12:16 +00:00
Glenn L McGrath 447bc2d17f Patch from Matt Kraai to fix debian bug #227081
cp does not truncate existing destinations.  That is, after
running

 echo foo > foo
 echo fubar > fubar
 cp foo fubar

the contents of fubar are

 foo
 r

instead of

 foo
2004-01-11 05:20:59 +00:00
Eric Andersen 716ccb2635 whitespace cleanup 2004-01-10 11:29:31 +00:00
Eric Andersen 8e2f74f5a7 Woody Suwalski writes:
I have found the problem in modprobe, so here is the promised patch
At the current stage I can use it as modprobe while switching between
2.4 and 2.6 seemlesly...(that is good!)
2004-01-10 11:25:53 +00:00
Glenn L McGrath 95f75a3dcd Patch from Bastian Blank to fix debian bug #226722, test case:
mkdir foo
 touch foo/bar
 ln -s bar foo/baz
2004-01-08 10:51:09 +00:00
Glenn L McGrath 1f28b90a9c Use bb_getopt_ulflags, save 100 bytes and strict argument checking. 2004-01-07 09:24:06 +00:00
Eric Andersen 9d65ab2beb Woody Suwalski writes:
accept more then 1 dependency per modules.dep line. Also white space cleanup...
I think that parsing still breaks sometimes, but is mostly functional now.
2004-01-06 00:07:17 +00:00
Eric Andersen 66e21fd161 Fix broken #else 2004-01-05 23:49:37 +00:00
Glenn L McGrath ab7780655b Use bb_getopt_ulflags, save 150 bytes. 2004-01-05 12:35:05 +00:00
Glenn L McGrath 6cb3bc056c Use bb_getopt_ulflags, simplify some logic, saves some bytes. 2004-01-05 11:49:55 +00:00
Glenn L McGrath 08ca752c68 Fix usage with libraries, skip symbol table. 2004-01-04 11:06:34 +00:00
Glenn L McGrath 930453bdcf Use bb_getopt_ulflags, saves some space, better argument checking.
Remove ar specific extraction code, always use common extraction code.
2004-01-04 10:28:22 +00:00
Rob Landley 40ec4aeb8e Thinko in s//options. (Whitespace skipping in the wrong place.) 2004-01-04 06:42:14 +00:00
Glenn L McGrath 3b25185733 Declare dependencies of command line editing in the build system 2004-01-03 12:07:32 +00:00
Eric Andersen ffa28d1b46 fixes from Selwyn Tang 2004-01-02 10:07:40 +00:00
Eric Andersen 8f3eb1dbab Add some details on exactly how to comply with the GPL
-Erik
2004-01-02 09:08:45 +00:00
Glenn L McGrath a43faccbde Sync to waldi's subversion archive 2004-01-01 00:23:01 +00:00
Glenn L McGrath 5c9f0d05b3 Fix debian bug #215612, insmod should be silent on request 2003-12-31 23:20:10 +00:00
Glenn L McGrath cfc0ad4260 Batch from Bastian Blank to fix debian bug #216435;
When linking a non existing file busybox ln will report the target
missind and not the source:
2003-12-31 23:10:44 +00:00
Eric Andersen 7f48a959f5 Update example slightly 2003-12-28 05:06:56 +00:00
Tim Riker 7b253f8c72 ws, show date setting format 2003-12-28 05:02:40 +00:00
Glenn L McGrath f980bd5848 Fix a bug of mine, identified by Stephane Billiart 2003-12-27 00:21:47 +00:00
Russ Dill 6caa073760 it should work even if you don't assign a pidfile 2003-12-26 23:41:28 +00:00
Glenn L McGrath ce91c8ac2b Isolate code better for unused options, config option to enable long
options, add some conditions to the tar tests in testsuite.
2003-12-26 14:01:37 +00:00
Glenn L McGrath ab8215431f Vodz last_patch120, more busybox integration, saves 330 Bytes. Tested. 2003-12-26 02:19:34 +00:00
Eric Andersen 3b1a74467a re-indent 2003-12-24 20:30:45 +00:00
Russ Dill d242e49c89 fix a long standing underallocation bug 2003-12-24 19:57:13 +00:00
Russ Dill a8992635b1 move debugging to safe place (before vfork) 2003-12-24 19:31:08 +00:00
Eric Andersen b90502828c Patch from Ned Ludd, solar at gentoo dot org:
I had previously provided you with a patch to help complete busybox's
props suite, but have heard no word back. Sense then I've made use of as
many of busybox's native API settings as I could find and would really
love for you to include support for this. If there is something more I
need to do to get this supported added in please let me know.
2003-12-24 06:02:11 +00:00
Eric Andersen 5089534be0 match changes made to cmdedit 2003-12-23 20:47:22 +00:00
Eric Andersen d10f36fe2e Match changes made to cmdedit 2003-12-23 20:45:14 +00:00
Eric Andersen 3a5ed56803 fix broken formatting 2003-12-23 20:37:54 +00:00
Eric Andersen 9cccc18141 don't mess up errno 2003-12-23 20:37:23 +00:00
Eric Andersen 27bb79080d Cmdedit update from Vladimir N. Oleynik (vodz) 2003-12-23 20:24:51 +00:00
Eric Andersen a6beeb6a7e Show the news by default 2003-12-23 10:00:00 +00:00
Eric Andersen f0da28c91b Prepare for release 2003-12-23 09:12:09 +00:00
Eric Andersen 52a3c2726e Patch from Matt Kraai:
sed is broken:

 busybox sed -n '/^a/,/^a/p' >output <<EOF
 a
 b
 a
 b
 EOF
 cmp -s output - <<EOF
 a
 b
 a
 EOF

The attached patch fixes it.
2003-12-23 08:53:51 +00:00
Glenn L McGrath b89fcd4430 Fix compile error, the indenting really needs to be fixed here 2003-12-23 07:21:33 +00:00
Glenn L McGrath 334dc65c92 Fix a bug of mine where extracting files to stdout would extract to
much, modified patch from Bastian Blank
2003-12-22 21:02:41 +00:00
Eric Andersen a120c32cfa Bump version 2003-12-21 09:04:54 +00:00
Eric Andersen 67ff3a1ffd Don't hose up perms for files that happen to have symlinks
in the tarball that point to them.
 -Erik
2003-12-21 08:59:24 +00:00
Eric Andersen 0933a92f5a bother. It seems I can't read. 2003-12-20 10:23:28 +00:00
Eric Andersen f295b5a408 doh! 2003-12-20 09:17:50 +00:00
Glenn L McGrath 8f3bc4ce52 New applet, rx, by Christopher Hoover 2003-12-20 07:30:35 +00:00
Eric Andersen a8d82fe52e Try to accomodate systems that do not define PAGE_SHIFT 2003-12-20 07:26:10 +00:00
Eric Andersen b868f55c78 Eradicate all references to loadacm 2003-12-20 07:16:22 +00:00
Eric Andersen 08573e0ac4 Kill off the loadacm applet. It is unused, unmaintained
garbage leftover from before I started maintaining BusyBox.
As the Klingon's like to say, Today is a good day to die.
 -Erik
2003-12-20 07:07:22 +00:00
Glenn L McGrath 02e0355504 Use bb_xopen 2003-12-20 06:00:08 +00:00
Glenn L McGrath 236e93d133 Allow recieving file to stdout, sending files from stdin, use the '-'
filename. Save a variable.
2003-12-20 05:43:34 +00:00
Glenn L McGrath f62ea20aff Use low level file descriptors to match bb_copyfd_eof 2003-12-20 04:38:01 +00:00
Glenn L McGrath 266c1f5eff display the port number number correctly, other minor optimisations 2003-12-20 03:19:27 +00:00
Glenn L McGrath ffccf6eb5d Change interface to bb_lookup_host, dont try and set port inside this
function as there is no gracefull way of handling failures.
Rename bb_getport to bb_lookup_port, allow a default port to be
specified so it always returns a correct value.
Modify ftpgetput/rdate/wget to use the new interface.
wget/rdate now use etc/services with a falback default value.
2003-12-20 01:47:18 +00:00
Eric Andersen 03d8091859 Patch from Woody Suwalski:
Erik, I think we have met online some time ago when I was in Corel/Rebel
    Netwinder project....

Anyway, I would like to use BB on 2.6.0 initrd. 1.00-pre4 works OK, if
insmod is actually presented with a full path to the module. Otherwise -
problems (not to mention conflicts when 2.4 modutil is enabled)

Here are some patches for insmod and modprobe which try to walk around
the default ".o" module format for 2.2/2.4 modules (you have probably
noticed it is now .ko in 2.6 ;-)) Trying to steal as little space as
possible if 2.6 not enabled...

The modprobe is still not perfect on 2.6 - seems to be jamming on some
dependencies, but works with some (to be debugged). Anyway after the
patches it at least tries to work....

Will there be a 1.00-pre5 coming any time soon?

Thanks, Woody
2003-12-19 21:04:19 +00:00
Glenn L McGrath 514aeabc36 Use getopt_ulflags 2003-12-19 12:08:56 +00:00
Glenn L McGrath 28c111e1c5 Allow escaped 8 bit characters in bb_opt_complementaly 2003-12-19 12:03:18 +00:00
Eric Andersen d4a5e255c4 Patch from Fillod Stephane:
You will find in the attached file "syslog.patch" a patch which adds
  config options to set at compile time the size of the circular buffer,
  and some documentation update.
2003-12-19 11:32:14 +00:00
Eric Andersen 3752d337b3 Patch from Fillod Stephane:
* While I'm at it, there's also a "telnetd.patch" which maps CRLF to CR,
  like netkit-telnet does, required by the loosy Windows telnet clients.
2003-12-19 11:30:13 +00:00
Eric Andersen 89f10bcf37 Patch from Fillod Stephane:
* The "rdate.patch" file makes rdate to NOT settimeofday if the date to be
set equals current date. This prevents the system from experiencing nasty time
discontinuities caused by sub-second changes, with a protocol that has only
over second resolution. Depending on your taste, the "fprintf(stderr..." may be
removed.
2003-12-19 11:29:29 +00:00
Eric Andersen 769a3ef08d Patch from Stephane Billiart:
This removes references to config->remoteuser when
CONFIG_FEATURE_HTTPD_CGI=y but CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set
2003-12-19 11:23:47 +00:00
Eric Andersen f18bd8931d Tito writes:
Hi to all,
here is a new patch for bb's devfsd. The news are:

1) Size reduction for the basic setup with no options compiled in from :
     text        data     bss     dec       hex   filename
    10591     392      543    11526   2d06 devfsd.o
    rw-r--r--    1 root     root        18536 Dec 18 21:52 devfsd.o

    to:

    text        data     bss     dec        hex  filename
    9303      392      543    10238    27fe devfsd.o
    rw-r--r--    1 root     root        16528 Dec 18 22:02 devfsd.o

   With this setup you should not expect much output from devfsd
    ( just at start or with -v) and if some error occurs it only exits 1.
   To have more output enable:  " Increases logging (and size)" (+1568 b).

2) The option "Adds function names to program output" was removed from config menu
    and now to enable debug output you can use bb's standard option:
    "Build BusyBox with Debugging symbols".
    Be careful as with this option enabled a lot of data are outputted to /dev/log and/or to stderr.

3) A new option: "Enables the -fg and -np option" was added to config menu  (+128 b).

BTW: option "Adds support for MODLOAD keyword in devsfd.conf"  adds 268 b.

4) The following keywords in devsfd.conf are supported:
   "CLEAR_CONFIG", "INCLUDE", "OPTIONAL_INCLUDE", "RESTORE",
   "PERMISSIONS", "EXECUTE", "COPY", "IGNORE",  "MKOLDCOMPAT",
   "MKNEWCOMPAT","RMOLDCOMPAT", "RMNEWCOMPAT".

   But only if they are written UPPERCASE!!!!!!!!

5)Help text in usage.h was modified.

6)Something that I have forgotten..........

I've tested this for the last week on my box and it seems to work as expected.

Thanks in advance and please apply.

Ciao,

Tito
2003-12-19 11:07:59 +00:00
Eric Andersen 1a773a656e Manousaridis Angelos writes:
Another issue I found was with the iproute utility. While using another
program I found that it failed because the "ip route del" command was
not found. I looked at the full iproute implementation and this command
exists. The busybox version has the "ip route delete" command. I have
created a patch which makes the "ip route del" command an alias to the
"ip route delete" command.
2003-12-19 10:47:40 +00:00
Eric Andersen 658f8b1d1a Manousaridis Angelos writes:
Hello,

I have been using busybox for some time now, for an ARM based platform.
I was very pleased when I tried the 1.00preX series, with all the new
utilities and daemons.

I found out that the ifupdown in busybox does not behave exaclty like
the debian version. Then the pre-up script fails, the interface is
getting up. Also when the post-up script fails the return value is
ignored. Actually everything is always run and the return value is
always true. I looked at the original implementation from debian and
fixed the busybox version to do the same. A patch is attached if anyone
is interested.
2003-12-19 10:46:00 +00:00
Eric Andersen b8d2cd44a6 don't use kernel headers 2003-12-19 10:40:56 +00:00
Glenn L McGrath b51eb26568 Use getopt_ulflags 2003-12-19 10:37:52 +00:00
Eric Andersen 07d2f4052f vodz noticed we need to cast things back to an unsigned long
or the syscall will not get the proper arguments.
2003-12-19 10:34:36 +00:00
Glenn L McGrath 850b05fbde Fix a bug preventing use of escaped characters that use the signed bit 2003-12-19 10:13:10 +00:00
Russ Dill f796700cf0 rename __getgrent so that it doesn't conflict with some libc's 2003-12-18 22:40:58 +00:00
Russ Dill 4e864a36b6 Finish remerging busybox udhcp and udhcp. Some cleanups as well. 2003-12-18 22:25:38 +00:00
Russ Dill e30495654d clean up some bad, bad formatting 2003-12-16 22:46:33 +00:00
Russ Dill 76729b8c69 include headers with prototypes to make sure prototypes match 2003-12-16 20:44:15 +00:00
Eric Andersen 5f46f1c241 remove reference to missing header file which is breaking the build 2003-12-16 12:04:01 +00:00
Eric Andersen b627c54813 Using vlock also requires libcrypt 2003-12-16 07:43:20 +00:00
Russ Dill 6b3f757053 revert removal of define 2003-12-16 02:38:09 +00:00
Russ Dill 4040d3d712 forgotten include 2003-12-16 02:34:28 +00:00
Russ Dill 8b3845106a why the complication of a static string rather than a define? gcc isn't dumb 2003-12-16 02:30:53 +00:00
Russ Dill 4b77acafa6 start attempting to bring udhcp in busybox back to the state where it is (ideally) an exact copy of udhcp outside of busybox so that its easy to merge back and forth 2003-12-16 02:28:20 +00:00
Russ Dill 7becf5987a when compiled standalone, udhcp needs these headers 2003-12-16 01:42:18 +00:00
Russ Dill a3170d5aab whoops 2003-12-16 01:33:38 +00:00
Russ Dill 8f43126934 not sure who made this change, but it certainly mucks things up (note 'fwrite(leases, ...'), adds a bit more code, and some stack overhead. Anywho, this fixes it, and retains the spirit of what the submitter of this change was attempting to acheive (the entire lease is written at once in a struct) 2003-12-16 01:29:40 +00:00
Russ Dill 62419df95c make udhcp work under uclinux, to an extent 2003-12-15 22:11:26 +00:00
Russ Dill 4a9e34c148 options is a pretty common symbol, bad idea to use as a global in udhcp when compiling into busybox 2003-12-15 22:09:36 +00:00
Russ Dill a1fece2c70 Get vfork_daemon_rexec working under uclinux 2003-12-15 21:57:44 +00:00
Eric Andersen d4f7a5edad Be certain we use a correct entity when performing the
BLKGETSIZE64 ioctl -- don't just assume 8,
2003-12-12 19:05:15 +00:00
Eric Andersen c1893c5801 Doh! I broke automatic filesystem type guessing. Fix mount so
it will properly fall back to /proc/mounts when /etc/filesystems
is missing, allowing mount to guess the correct fs type when a
fs type is not explicitly specified.
 -Erik
2003-12-12 07:01:14 +00:00
Eric Andersen 416c24224d Fix compile when CONFIG_FEATURE_HDPARM_GET_IDENTITY is disabled 2003-12-12 00:08:57 +00:00
Eric Andersen 7dad86601a It appears the Netgear WG602 distributes source 2003-12-11 18:03:15 +00:00
Eric Andersen e06bea7767 Fixup some html bugs 2003-12-11 08:04:49 +00:00
Eric Andersen 5b8a59400c some minor website cleanups 2003-12-11 07:13:15 +00:00
Eric Andersen c181f34c87 prepare for release 2003-12-11 02:48:15 +00:00
Eric Andersen e7047887b0 Update modutils with 2.6 module support 2003-12-11 01:42:13 +00:00
Eric Andersen 37f4116ecb go directly to current cvs 2003-12-11 01:29:46 +00:00
Eric Andersen de4f07e56e remove some spaces that mess up autodocifier.pl 2003-12-11 01:18:07 +00:00
Eric Andersen 9f6c12a42e add missing copyright text 2003-12-10 20:50:14 +00:00
Eric Andersen 2e0455d82b some minor updates 2003-12-10 20:41:48 +00:00
Eric Andersen 539eef6f28 update website 2003-12-10 12:08:20 +00:00
Eric Andersen d5c746f3a8 Fix indenting.
Fix a bug noticed by Pete Flugstad.  Make certain we close what we open, and
don't try to close invalid files when /etc/filesystems exists and is used.
2003-12-09 23:50:24 +00:00
Eric Andersen 747f2f7d78 Bump version number 2003-12-09 17:31:48 +00:00
Glenn L McGrath f6bba3d689 Splitting statements with #define's can cause trouble for cross
compilers (and it looks a bit messy)
2003-12-08 20:31:25 +00:00
Glenn L McGrath 9adcf73152 Stop sending data to the client after the first failure.
Patch by Joe.C
2003-12-08 20:21:53 +00:00
Glenn L McGrath 5c0d84aaf0 Bring usage upto date, patch by Steven Scholz 2003-12-08 20:11:55 +00:00
Glenn L McGrath 142abc18ce Fix a compile error when only using ar, patch by Paul van Gool 2003-12-05 02:51:21 +00:00
Manuel Novoa III 22e1ca382b Add (untested) support for cris, based on the (old) busybox insmod
that axis distributes.
2003-12-04 15:02:57 +00:00
Glenn L McGrath c83e3a6406 Patch from Steven Scholz, make usage more consistent with actual
behaviour.
2003-12-04 13:06:44 +00:00
Eric Andersen 50547c0745 Do not use the _syscall5 macro -- use syscall(2) instead 2003-12-04 07:07:14 +00:00
Glenn L McGrath 3860b2ebd6 Patch from Tito, size optimisation, cleanup noise when in debugging
mode, adds support for MODLOAD keyword in devfsd.conf, provides a
cleaned up version of example/devfsd.conf
2003-11-30 23:46:06 +00:00
Glenn L McGrath 5be6a200f0 Correct Matteo's email address 2003-11-28 22:55:03 +00:00
Glenn L McGrath b8c3a54531 Patch from Ian Campbell, fix or'ed dependencies and handle virtual
dependencies.
2003-11-28 22:38:14 +00:00
Glenn L McGrath 11e69471be Fix a bug, ignore the source path when installing to a directory.
We may be installing symlinks, so use lstat/lchown.
Make use of bb_getopt_ulflags and cp_mv_stat2, save 100 bytes.
2003-11-27 22:40:08 +00:00
Glenn L McGrath e39ee01821 Fix tar hard links 2003-11-27 00:01:43 +00:00
Glenn L McGrath fea4b446df Important bugfixes from Ian Campbell.
init_archive_deb_data()
        We want to filter for data.tar.* in the AR file not the TAR
        file, else we get nothing.

all_control_list()
        Make the 'extensions' array of control file names a global so it
        can be used in unpack_package as well. Name the global
        all_control_files. Don't hard code the length of
        all_control_files but instead used sizeof.

unpack_package()
        Only unpack the control files we are interested in (from
        all_control_files). Extract the data.tar.gz into / rather than
        the current directory.

dpkg_main()
        Configure packages in a second pass so all the packages being
        installed are unpacked before configuring.

Some purely cosmetic changes:

header
        update list of differences since two of them are no longer true.
        The .control file is no longer stored as a result of this patch
        -- it was redundant since the info is in status. New packages
        appear to be added to the end of the status file now rather than
        the start.

remove_package()
        Make message printing optional, so we can avoid a redundant
        message when replacing/upgrading a package. When we do print
        stuff then include the version number.

purge_package()
        Print "Purging xxx (yyy) ..." message like the other actions.

configure_package()
        Add "..." to "Setting up" message to be consistent with other
        actions.
2003-11-26 21:53:37 +00:00
Glenn L McGrath 4ddddd180e Fix for "Broken pipe" issue, vodz last_patch116_3 2003-11-25 20:45:38 +00:00
Glenn L McGrath c3498f678a When a size of 0 is passed to copyfd_size, dont do anything, it was
reading untill eof which breaks tar
2003-11-24 23:50:07 +00:00
Glenn L McGrath f0515dad66 Fix warning 2003-11-22 02:13:41 +00:00
Glenn L McGrath 7ffe133864 As we no longer use function pointers for read in common archiving code
archive_xread can be replaced with bb_full_read, and archive_copy_file
with bb_copyfd*
bb_copyfd is split into two functions bb_copyfd_size and bb_copyfd_eof,
they share a common backend.
2003-11-21 22:24:57 +00:00
Glenn L McGrath 1a2d75fd72 Use safe read 2003-11-21 22:17:28 +00:00
Glenn L McGrath d0550d8fc9 Fix warning 2003-11-21 21:54:07 +00:00
Glenn L McGrath acbdc47aac Make use of libbb functions bb_xopen, bb_full_read, used #define's
instead of static consts, avoid xmalloc.
2003-11-21 09:27:02 +00:00
Glenn L McGrath 2cd1eb16ad Remove unused function 2003-11-20 22:36:57 +00:00
Glenn L McGrath 78cd84da8a Dont over-read fd, use function pointer for hash function. 2003-11-20 21:30:58 +00:00
Glenn L McGrath e857122c97 Fix tar-handles-nested-exclude testcase 2003-11-20 10:47:06 +00:00
Glenn L McGrath d9c8ab40a4 Update status of tests which should pass 2003-11-20 09:57:44 +00:00
Glenn L McGrath 3a2fcc63b8 remove controversial tests 2003-11-20 09:56:34 +00:00
Glenn L McGrath bebc40b406 Check at least one context is specified 2003-11-20 09:53:31 +00:00
Glenn L McGrath ba49651de9 Check there are files to add the archive before removing a specified
tar file.
2003-11-20 09:06:10 +00:00
Glenn L McGrath 90c9df93f3 Dont attempt to unlink directories 2003-11-20 08:00:38 +00:00
Glenn L McGrath 0413af0e27 Superficial changes 2003-11-20 06:27:33 +00:00
Glenn L McGrath 5c069aaf2f Fix up the -s option, and make usage consitent with behaviour,
patch by Steven Scholz
2003-11-20 05:58:26 +00:00
Glenn L McGrath d85421de22 Include stdint.h 2003-11-20 05:26:38 +00:00
Glenn L McGrath 931ae9d2f8 woops, we needed that function 2003-11-18 23:56:41 +00:00
Glenn L McGrath 0c5d9c27a5 COMPRESS, not UNCOMPRESS 2003-11-18 23:27:49 +00:00
Glenn L McGrath 7370f62493 Update usage for tar -Z 2003-11-18 21:49:23 +00:00
Glenn L McGrath 0b6539f7f9 Update md5sum, sha1sum options, patch by Steven Scholz 2003-11-18 21:40:30 +00:00
Glenn L McGrath 56f16b42c9 tar -Z, uncompress support 2003-11-18 21:37:52 +00:00
Glenn L McGrath 20872be9a4 Dont close original file handle, we may need it later. 2003-11-18 21:31:19 +00:00
Glenn L McGrath 3b9fc8fe2a Make unlink old files default behaviour and add a new option -k to
prevent overwritting existing files
2003-11-18 20:23:04 +00:00
Glenn L McGrath de3ea9f049 Only use getopt and associated flags if checking is enabled 2003-11-18 19:35:06 +00:00
Glenn L McGrath aee0fd8320 Replaced by md5_sha1_sum.c 2003-11-18 19:33:13 +00:00
Glenn L McGrath 303b7d83f0 Replaced by md5_sha1_sum.c 2003-11-18 18:56:25 +00:00
Glenn L McGrath f074afc2a0 Dont free filename, its needed in the extracted files list. 2003-11-17 21:58:00 +00:00
Glenn L McGrath cccf49fb0f This was made obsolete by config-udeb-linux-i386 2003-11-17 10:46:36 +00:00
Glenn L McGrath 7e4b3347b2 Remove net-udeb flavour, we dotn use it 2003-11-17 10:43:08 +00:00
Glenn L McGrath 0874a613d2 Use the PROG variable instead of 'busybox' in the release target 2003-11-17 10:26:43 +00:00
Glenn L McGrath 8dc8cb133c Fix a bug where cpio wouldnt work unless -u was specified 2003-11-15 23:44:31 +00:00
Glenn L McGrath 5699b8525e Move from read_gz to the pipe()+fork() method.
open_transformer(), common code for pipe+fork.
Function pointer for read() no longer needed.
Allow inflate to be initialised with a specified buffer size to avoid
over-reading.
Reset static variables in inflate_get_next_window to fix a bug where
only the first file in a .zip would be be extracted.
2003-11-15 23:19:05 +00:00
Glenn L McGrath 54ac057c00 Fix memory leaks 2003-11-15 00:24:43 +00:00
Glenn L McGrath 5c2c8eca4a Fix a "broken pipe" problem. vodz, last_patch_116-2 2003-11-14 21:01:26 +00:00
Glenn L McGrath e57feeb9e6 Keep trying to find a good header, if we exit it will cause .tar.gz
files to compute incorrect crc and length for gzip
2003-11-14 12:57:14 +00:00
Glenn L McGrath eba86e2adb Catch unsupported features 2003-11-14 12:53:42 +00:00
Glenn L McGrath e9080c9f41 NEW APPLET: pipe_progress, used by debian installer 2003-11-14 10:04:33 +00:00
Glenn L McGrath 7b215b99b2 Fix build error with tar -j 2003-11-14 09:22:24 +00:00
Glenn L McGrath 1a41db8eaf Remove some tar_gz stuff that get dragged in 2003-11-14 09:21:27 +00:00
Glenn L McGrath 94cf153c2b Remove debugging noise. 2003-11-14 08:30:46 +00:00
Glenn L McGrath d09bcecda8 Read in blocks rather than one char at a time, greatly improves speed 2003-11-14 08:26:25 +00:00
Eric Andersen 5f28455c6e Oskar Liljeblad writes:
Here's a fix for the hard-coded device name in fbset.
2003-11-14 03:11:29 +00:00
Eric Andersen b6e58d2b9a Michael Smith writes:
I noticed a problem with ifconfig in busybox 0.60.5. The matching code
seems to exist in busybox CVS as well, so I'll paste in the patch that
fixed it.

I was running:
 # ifconfig wan0 1.2.3.4 pointopoint 1.2.3.5 netmask 255.255.255.255

I was seeing the inet addr and P-t-P addr both being set to 1.2.3.5
(the pointopoint address).

wan0      Link encap:Point-Point Protocol
          inet addr:1.2.3.5  P-t-P:1.2.3.5  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
          ...

The patch below seems to fix it.
2003-11-14 03:04:08 +00:00
Eric Andersen c16686c1e2 Ulrich Marx writes:
hello

i had some trouble with the filedescriptor in udhcp.
Two things happened on my device:
1.) broken or not connected cable (no dhcp-server)
2.) daemonizing (starting with option -b)

i got a filedescriptor fd=0 from function raw_socket,
after daemonizing (daemon call) the fd is closed.
Client can't recieve data's anymore.

i fixed this problem (like pidfile handling):
2003-11-14 03:00:04 +00:00
Eric Andersen 61b038accc Steven Seeger writes:
Hey guys. I've found a bug in modprobe where it generates bad strings and
makes sytem calls with them. The following patch seems to have fixed the
problem. It is rather inherited elsewhere, as there seems to be incorrect
entries in the list which results in more dependencies than really exist for
a given call to mod_process. But, this patch prevents the bad text from
going to the screen. You will notice there are cases where lcmd goes
unmodified before calling system.

Please consider the following patch.

Thanks.

-Steve
2003-11-14 02:49:19 +00:00
Eric Andersen 8211db5af0 Vladimir N. Oleynik (vodz) writes:
Hi Glenn.

I analysed BSS size gzip applet and found may be mistake:
updcrc() checking  if (crc_table_empty) but not resetted this var.
This do make slow gzip applet ;-)


--w
vodz
2003-11-14 02:44:28 +00:00
Eric Andersen e0c83af4ce Marc Kleine-Budde noticed a missing semicolon 2003-11-14 02:40:08 +00:00
Glenn L McGrath d2a897aab0 Merge common parts of sha1sum and md5sum, which is everything except the
algorithms.
Move algorithms to hash_fd and make them available via a common
function.
2003-11-10 04:33:55 +00:00
Eric Andersen 0bdf41ad7e Add some basic cvs usage info 2003-11-08 00:33:02 +00:00
Eric Andersen bbce615c7e Rob Landley writes:
Remove three entries in defconfig that config no longer has.

Rob
2003-11-08 00:23:23 +00:00
Eric Andersen 2849209db2 Patch from Steven Scholz to send the output from 'time'
to stderr, rather than stdout, so that things like

~ # time bunzip2 -c /tmp/test.bz2 > /dev/null
real    0m 29.44s
user    0m 29.30s
sys     0m 0.12s

operate as expected.
2003-11-07 21:39:14 +00:00
Eric Andersen 28d4e16cd7 This appears to be the correct fix to make CONFIG_FEATURE_DEB_TAR_BZ2
support compile.  Glenn, you may want to verify this.
 -Erik
2003-11-07 21:31:58 +00:00
Eric Andersen d2160aaeab fix comment 2003-11-07 21:22:09 +00:00
Tim Riker b1ffba0401 wrap bb help output if CONFIG_FEATURE_AUTOWIDTH 2003-11-07 19:37:20 +00:00
Eric Andersen 1b1942f93d As vodz pointed out, setting unset_env to NULL is sufficient 2003-11-07 11:20:21 +00:00
Glenn L McGrath 7f9de02ca6 Rewrite, 800+ bytes smaller and more robust. 2003-11-06 03:17:23 +00:00
Eric Andersen 5912acb670 By popular demand, revert to version 1.21, since Rules.mak:1.22
causes the build to ignore CROSS_COMPILER_PREFIX set in .config
2003-11-05 11:34:26 +00:00
Glenn L McGrath 2685724e23 Fix tar -j support
Use the old fork() method of tar compression support, rather than
read_bz2....
 - (*uncompress)(int in, int out) seems like a more natural interface
for compression code.
 - it might improve performance by seperating the work into one cpu
bound and one io bound process.
 - There is extra code required to do read_[gz|bunzip] since (*uncompress)(int in,
int out) will normally be used by the standalone compression applet.

There have been problems with this method so if you see a "Short read"
error let me know.
2003-11-05 04:55:58 +00:00
Eric Andersen 6d687817a8 Fix oversight with CONFIG_FEATURE_AUTOWIDTH handling 2003-11-04 23:16:48 +00:00
Eric Andersen b7077a7316 Set unset_env pointing to a NULL item, to prevent us from walking
off the end of the list and segfaulting.
 -Erik
2003-11-03 22:46:14 +00:00
Eric Andersen 04d055f4e1 Fix rdate and ftpget/ftpput so they compile with the new xconnect.
I have checked rdate.  Someone should also check ftpget/ftpput to
be sure they still work.
2003-11-03 21:20:18 +00:00
Eric Andersen f6067beaa9 Avoid conflicts with the 2.6 kernel headers, which define
_IOR rather differently, thereby breaking the BLKGETSIZE64
ioctl.
 -Erik
2003-11-03 08:59:51 +00:00
Eric Andersen e6dc439b3a Rework wget, the xconnect interface, and its various clients
in order to fix the problems with round robin DNS reported
by Andrew Flegg:
    http://busybox.net/lists/busybox/2003-October/009579.html

This removes the ipv6 specific xconnect dns lookups.  I do
not see why that would need to be special cased for ipv6 as
was done, but that will just have to be tested.

So IPV6 people -- please test this change!

 -Erik
2003-10-31 09:31:46 +00:00
Eric Andersen 8179cf2b78 Put back the tar support stubs (and warnings) for now. 2003-10-31 08:52:57 +00:00
Eric Andersen 252183e3f5 Try to make indent formatting less horrible 2003-10-31 08:19:44 +00:00
Glenn L McGrath e64bf409dd Patch from David Meggy to make the swap default to the new version if no
version is specified and the kernel is relatively new.
2003-10-31 02:04:18 +00:00
Glenn L McGrath 4ef5a84583 Move the tail -c option from FANCY_TAIL to the default tail, this makes
the default tail options conform to SUSv3, with the non-SUS
option all in FANCY_TAIL
2003-10-31 00:35:59 +00:00
Eric Andersen 0120be94a0 Fix stupid typo 2003-10-31 00:21:28 +00:00
Glenn L McGrath 9716575f1a Remove config options for sort -u and sort -r, they are always enabled 2003-10-31 00:04:24 +00:00
Glenn L McGrath 40c9489d33 Add a comment with link to the SUSv3 standard for xargs 2003-10-30 22:51:33 +00:00
Glenn L McGrath 09c295a5bc run through indent 2003-10-30 22:47:16 +00:00
Glenn L McGrath 00ed36fd52 Patch from Dmitry Zakharov,
Fixes two bugs:
- END block didn't execute after an exit() call
- huge memory consumption and performance degradation on large input
(now performance is comparable to gawk)
2003-10-30 13:36:39 +00:00
Eric Andersen b8b6816f7b make certain values specified in the environment always win 2003-10-30 07:48:38 +00:00
Glenn L McGrath f4fd3a1331 Accept the -c option and do nothing 2003-10-29 11:10:02 +00:00
Glenn L McGrath 984b45142a fix a bug where `which' doesn't check whether the file passed as an argument
is a regular file, patch by Arthur Othieno
2003-10-29 04:50:35 +00:00
Glenn L McGrath 6530f0d3a1 make CONFIG_FEATURE_UNARCHIVE_TAPE common between itar and cpio, patch
by Arthur Othieno
2003-10-29 04:46:30 +00:00
Glenn L McGrath 4636aa9dcd "A few references to sourcefiles and URLs in docs/contributing.txt had
gone stale" - Peter Korsgaard
2003-10-29 03:40:47 +00:00
Glenn L McGrath f235d05773 Use the return value from uncompress_bunzip, fix some typo 2003-10-29 03:37:54 +00:00
Glenn L McGrath 1c834407e3 Add some error messages, use xmalloc instead of malloc 2003-10-28 23:32:12 +00:00
Glenn L McGrath debb21ece7 Fix a logic error, the old bunzip code returned non-zero for success,
new code returns 0 for success.
2003-10-28 23:04:50 +00:00
Glenn L McGrath e81fc5fb30 Conditionally compile some files.
This hides a bug related to the new bunzip code in the tar and dpkg[-deb]
applets.
It will also reduce compile time a little as some unused files wont be
compiled.
2003-10-28 10:44:58 +00:00
Eric Andersen 5fa4db29f7 Another bzip2 update and speedup from Manuel Novoa III, with some
additional changes (primarily lots of comments) from Rob Landley.
2003-10-23 06:52:01 +00:00
Eric Andersen 2053a8c747 the dc applet now needs libm
-Erik
2003-10-22 22:29:08 +00:00
Eric Andersen e78fe2414b sigh 2003-10-22 11:36:55 +00:00
Eric Andersen a92877403a Goetz Bock writes:
Dear list,

during my quest do pack busybox into an RPM, I've fixed a small bug
(missing \n) in dc's usage. And added two additional operations: mod and
exp/power.

Feel free to drop them.
2003-10-22 11:24:39 +00:00
Eric Andersen a48b0a3af7 last_patch116 from vodz:
Stephane,

>Using busybox+uclibc, crond syslog messages look like:
>
>Oct  9 09:04:46 soekris cron.notice crond[347]: ^Icrond 2.3.2 dillon,
>started, log level 8

Thanks for testing.

>The attached patch corrects the problem.

Your patch is not correct.
Correct patch attached.

Also. Last patch have
- add "Broken pipe" message to ash.c
- busybox ash synced with dash_0.4.18

--w
vodz
2003-10-22 10:56:47 +00:00
Eric Andersen 514633bf3f Tomasz Motylewski reported that the 'which' applet does not find
files when the full file PATH is specified.

This patch from Arthur Othieno fixes it.
2003-10-22 10:38:22 +00:00
Eric Andersen 7f6295f516 Patch from Arthur Othieno for style-guide.txt conformance 2003-10-22 10:34:15 +00:00
Eric Andersen 28672dd3b9 Patch from Arthur Othieno for docs/style-guide.txt conformance. 2003-10-22 10:30:53 +00:00
Eric Andersen 9ef6c93090 Patch from Arthur Othieno to fix a compiler warning 2003-10-22 10:26:38 +00:00
Eric Andersen 976a55e168 make this a little bit less messy 2003-10-22 10:23:04 +00:00
Eric Andersen f1d3ac429e Update mail location 2003-10-22 10:19:01 +00:00
Eric Andersen 637d2266e1 Disable any buffering to stdout 2003-10-22 10:18:24 +00:00
Eric Andersen 5289969f08 Tito writes:
Hi to all,
I'm sorry but  I didn't spot this big fat bug until now,
Matteo Croce emailed me about it.
Please apply this patch as the devfsd applet is broken
and works only on a system booted with a standard devfsd
( the test I mostly did :-(   ), but if used at boot time
it DOESN'T WORK.

Thanks in advance and please apply
Tito
2003-10-22 10:10:50 +00:00
Eric Andersen 88c916bdec Andreas Mohr writes:
the busybox menuconfig triggered my "inacceptable number of spelling mistakes"
upper level, so I decided to make a patch ;-)

I also improved some wording to describe some things in a better way.

Many thanks for an incredible piece of software!

Andreas Mohr, random OSS developer
2003-10-22 09:58:56 +00:00
Eric Andersen 951df20b7e Do a better job of dealing with screwy s390 abi changes 2003-10-21 06:45:29 +00:00
Eric Andersen acf6c917e2 ccording to this:
http://sources.redhat.com/ml/binutils/2003-01/msg00290.html
The name R_390_GOTOFF was changed to R_390_GOTOFF32.
 -Erik
2003-10-20 05:40:40 +00:00
Eric Andersen 1acfb72e71 Manuel Novoa III writes:
Hello Rob,

Here's a patch to your bunzip-3.c file.  Nice work btw.

One minor bug fix... checking for error return when read()ing.
Some size/performance optimizations as well.  One instance of
memset() seems unnecssary.  You might want to take a look.

Anyway, on my machine, decompressing linux-2.6.0-test7.tar.bz2
to /dev/null gave the following times:

        bunzip-3.c    bzcat (system)   bunzip-3.c (patched)
real    0m24.420s     0m22.725s        0m20.701s
user    0m23.930s     0m22.170s        0m20.180s
sys     0m0.070s      0m0.080s         0m0.140s

Size of the patched version is comparable (slightly larger or
smaller depending on compiler flags).

Manuel
2003-10-18 01:59:46 +00:00
Eric Andersen 0d6d88a205 Rob Landley's new micro-bunzip version 3. Rob writes:
The API for using partial writes, as described in my last message, sucked.

So here's a patch against my last patch that changes things so that
write_bunzip_data calls read_bunzip_data itself behind the scenes whenever
necessary.  So usage is now just start_bunzip(), write_bunzip_data() until it
returns a negative number, and then the cleanup at the end of
uncompressStream.

It adds 32 bytes to the executable, but it should allow the caller (tar) to be
simplified enough to compensate.  Total -Os stripped exe size now 6856 bytes.

Rob

P.S.  I attached the whole C file so you don't have to keep incremental
patches straight if you don't want to. :)

P.S.  In the version I'm banging on now, I've simplified the license to just
LGPL.  I read the OSL a bit more closely and the patent termination clause
would have bit IBM in their counter-suit of SCO if the code in question had
been OSL instead of GPL, and I've decided I just don't want to beta-test
legal code right now.
2003-10-18 01:58:35 +00:00
Tim Riker 6fe55ae939 old gcc 2003-10-17 18:54:55 +00:00
Eric Andersen 7857c03808 Paul Mundt (lethal) writes:
Erik,

The format for /proc/meminfo has changed between 2.4 and 2.6, quite considerably.
In addition to the removal of the two-line summary that was present in 2.4,
MemShared was also removed. Presently (at least in busybox CVS HEAD), top fails
to parse this correctly and spews forth a:

top: failed to read 'meminfo'

message. This patch switches around some of the semantics a little to do sane
parsing for both 2.4 and 2.6. Also, in the event that the summary gets yanked
from 2.4, this patch will deal with that as well. With this patch, I'm able
to run top correctly on 2.6.0-test7 (tested on sh).

Please apply.

 procps/top.c |   60 +++++++++++++++++++++++++++++++++++++++++++++++------------
  1 files changed, 48 insertions(+), 12 deletions(-)
2003-10-11 18:47:20 +00:00
Glenn L McGrath d12061b299 Vodz last_patch_117, update options for new xargs 2003-10-10 23:15:23 +00:00
Glenn L McGrath 61796945e3 Vods versions of xargs 2003-10-10 12:10:18 +00:00
Eric Andersen 75a5684793 I don't need to have my email adder listed twice 2003-10-09 21:19:21 +00:00
Eric Andersen 2af70005b9 Do not use kernel headers 2003-10-09 21:02:23 +00:00
Glenn L McGrath fe4704e948 Fix an ommision preventing building, patch by Tito. 2003-10-09 13:40:17 +00:00
Glenn L McGrath 12940e1ce0 example devfs config file, patch from Tito. 2003-10-09 13:25:00 +00:00
Glenn L McGrath 17d21fa519 New applet, devfsd, by Matteo Croce and Tito 2003-10-09 11:46:23 +00:00
Glenn L McGrath a55d72bbb4 Patch from Steven Scholz, fix some warnings 2003-10-09 11:38:45 +00:00
Glenn L McGrath 99825960c1 Bugfix for xargs 2003-10-09 11:06:45 +00:00
Eric Andersen 29c77f71ba Arnd Ben Otto writes:
Hi Eric

I have written a small patch for the Busybox syslogd. With this patch
one can limit the size of the messagfile. As soon as the limit is
reached the syslogd can rotate or purge the messagefile(s) on his own.
There is no necessity to use an external rotatescript.

Even if logread does something similar, its very handy to have some
messagefile after your box crash.

I wrote this patch initial vor BB 0.6x where no cron daemon was avail.
Now I adapted it for the new Version and i hope it is still useful. At
least I still use it :-)

bye
Arnd
2003-10-09 09:43:18 +00:00
Eric Andersen dae099b2f9 We did not have a safe_write, which is the analog to safe_read. Convert
full_write to use safe_write internally, which is needed to guarantee proper
behavior, i.e. when writing to a pipe.
2003-10-09 08:35:42 +00:00
Eric Andersen 638da75f4b Fix some warnings that have crept in recently 2003-10-09 08:18:36 +00:00
Glenn L McGrath 07085855ad Patch from Tito, size optimisation and fix error in exit code of -V
option
2003-10-09 07:28:22 +00:00
Glenn L McGrath 586d86cc8c Comaptability with gcc-2.95 2003-10-09 07:22:59 +00:00
Glenn L McGrath 9d1a33c690 Vodz last_patch_105 without his xargs patch which doenst apply cleanly 2003-10-06 13:23:06 +00:00
Glenn L McGrath add3eadc46 Add the x, n, s and E options, remove -r as its expected behaviour. 2003-10-04 14:44:27 +00:00
Glenn L McGrath 42c25735e6 Patch from Rob Landley;
Moving on to building diffutils, busybox sed needs this patch to get
past the first problem.  (Passing it a multi-line command line argument
with -e works, but if you don't use -e it doesn't break up the multiple
lines...)
2003-10-04 05:27:56 +00:00
Glenn L McGrath fd7bc13557 Woops, the previous patch reversal wasnt complete, breaking everything. 2003-10-04 00:05:47 +00:00
Glenn L McGrath f86bd9f2cd Reverse my previous changes and make a note about why its dont this way 2003-10-03 13:21:10 +00:00
Glenn L McGrath 07cf92676a Dont mix xarg options with utility option, fixes example of
`echo "README" | xargs ls -al`
Dont specify a path for the default behaviour of echo
args allocated space for an extra ptr
Use defines for the different options
2003-10-03 13:15:44 +00:00
Glenn L McGrath 1dc0ccafdd Vodz, last_patch_114
- env vars CONTENT_TYPE, CONTENT_LENGTH, HTTPD_REFERER, REMOTE_USER and
AUTH_TYPE(Basic always).
- POST data pipied now (previous version have loading into memory may be
big size data and reducing with hardcoded limit)
- removed $CGI_foo environment variables, else my have rubbish
enviroment if POST data have big binary file
2003-10-03 10:50:56 +00:00
Glenn L McGrath 8ac86e33a2 Patch by Rob Landley, fix warning 2003-10-03 08:28:59 +00:00
Glenn L McGrath 4a77c781ef argc has already been decremented 2003-10-03 07:51:30 +00:00
Glenn L McGrath cb920d9778 Patch from Rob Landley, Simplify organisation of arguments. 2003-10-03 03:25:30 +00:00
Glenn L McGrath 91b3d460c7 Fix -C option when creating tar files.
Need to chdir after the tar file is opened, so make common tar filename
parsing and send the file descriptor rather than filename to
writeTarFile.
Modify the verboseFlag operation to determine wether to display on
stderr or stdout at display time, simpler than doing it in tar_main.
2003-10-02 14:33:23 +00:00
Glenn L McGrath 9c91e4142d Thomas Lundquist, update for current structure 2003-10-01 11:33:46 +00:00
Glenn L McGrath 0ad4daa54e Patch from Rob Landley to fix backrefs 2003-10-01 10:26:23 +00:00
Glenn L McGrath 738fb33994 Patch by Rob Landley, fix "newline after edit command" 2003-10-01 06:45:11 +00:00
Glenn L McGrath aa5a602689 Patch by Rob Landley, work in progress update, fixes lots of bugs,
introduces a few others (but they are being worked on)
2003-10-01 03:06:16 +00:00
Glenn L McGrath e6ba16f830 Patch by Guillaume Morin
Fix two race conditions, as described at.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=212764
2003-09-26 10:45:55 +00:00
Glenn L McGrath f7dd10f67c Patch from Fillod Stephane
Add follow mode to logread, ala "tail -f /var/log/messages"
Note: output to a slow serial terminal can have side effects
on syslog because of the semaphore. In such case, define 
RC_LOGREAD.
2003-09-26 01:03:16 +00:00
Glenn L McGrath a79220db6e add size parameter to syslogd -C
Patch by Padraig, resubmitted by Fillod Stephane
2003-09-26 00:49:05 +00:00
Glenn L McGrath 6b0658f5c0 Patch by Fillod Stephane, declare variables as static to not clobber
busybox namespace
2003-09-26 00:33:18 +00:00
Glenn L McGrath 6376b583e2 Use a variable for the config files, makes it easier to syncronise with
debian builds
2003-09-24 15:48:29 +00:00
Glenn L McGrath c98c7d9a14 Syncronise with debian busybox-cvs package 2003-09-24 15:30:44 +00:00
Glenn L McGrath 761ec20f81 Fix some typo's, remove some extra free statements 2003-09-24 10:23:39 +00:00
Glenn L McGrath a406a9c853 Add the -d option 2003-09-24 05:00:29 +00:00
Glenn L McGrath eebcc1d98a Add the "install" applet, move get_ug_id to libbb as its used by chown,
chgrp and install.
2003-09-24 03:22:57 +00:00
Glenn L McGrath d72e34c752 Patch by Steinar H. Gunderson to fix debian bug #211675.
Linking to my_getgrnam from libpwdgrp wasnt working, instead it was
trying to use functionality from glibc, which pulled in libnss.
2003-09-20 00:59:35 +00:00
Glenn L McGrath d3612178b7 Patch by Junio C Hamano to workaround a gcc compiler bug.
The construct certain vintages of GCC (the one I have trouble
with is 3.2.3) have trouble with looks like the following:

    static struct st a;
    static struct st *p = &a;
    struct st { int foo; };
    static void init(void) { a.foo = 0; }

The problem disappears if we move the struct declaration up to
let the compiler know the shape of the struct before the first
definition uses it, like this:

    struct st { int foo; }; /* this has been moved up */
    static struct st a;
    static struct st *p = &a;
    static void init(void) { a.foo = 0; }
2003-09-17 00:22:26 +00:00
Glenn L McGrath 2570b43e82 Configuration option to define wether to follows GNU sed's behaviour
or the posix standard.
Put the cleanup code back the way it was.
2003-09-16 05:25:43 +00:00
Glenn L McGrath 204ff1cea4 Fix a bug that creapt in recently with substitution subprinting, and add
a test for it.
2003-09-16 01:46:36 +00:00
Glenn L McGrath 96fd1b98f1 Compile get_terminal_width_height 2003-09-16 00:50:36 +00:00
Glenn L McGrath baaa6e9e7d Patch from Stephane Billiart to fix an unused variable warning. 2003-09-15 15:00:43 +00:00
Glenn L McGrath a3822de23e Patch from Bastian Blank to fix a problem when runing find under ash.
"If the shell is compiled with -DJOBS, this is all fine -- find wasn't
stopped (it was killed), so it correctly uses WTERMSIG instead of WSTOPSIG.
However, if the shell _isn't_ compiled with -DJOBS (which it isn't in d-i),
only WSTOPSIG is used, which extracts the high byte instead of the low
byte from the status code.  Since the status code is 13 (SIGPIPE), "st"
suddenly gets the value 0, which is equivalent to SIGEXIT. Thus, ash prints
out "EXIT" on find's exit."
2003-09-15 14:42:39 +00:00
Glenn L McGrath e16ab475ad Patch from Tito, Reduces the size of busybox's strings applet from 1900 to
1788 bytes (for strings.o).
2003-09-15 14:22:37 +00:00
Glenn L McGrath 977451ef44 Fix a simple mistake with pattern space, and add a test for it 2003-09-15 12:07:48 +00:00
Glenn L McGrath 47e5ca1ecb Patch by Jean Wolter to fix a bug where a script wouldnt be executed
unless it had #!/bin/sh in the first line

"It correctly locates the script, tries to execute it via execve which
fails. After that it tries to hand it over to /bin/sh which fails too,
since ash

    - neither provides the absolute pathname to /bin/sh
    - nor tries to lookup the script via PATH if called as "sh script"
"
2003-09-15 12:00:19 +00:00
Glenn L McGrath e3e28d3bb6 Fix some memory allocation problems
----------------------------------------------------------------------
2003-09-15 09:22:04 +00:00
Eric Andersen 8efe967018 Be entirely consistant when using ioctl(0, TIOCGWINSZ, &winsize)
to ensure proper fallback behavior on, i.e. serial consoles.
 -Erik
2003-09-15 08:33:45 +00:00
Eric Andersen c4f72d1426 fix function prototype 2003-09-15 08:13:43 +00:00
Eric Andersen 45638df230 Needs prototype for close() 2003-09-15 08:12:53 +00:00
Eric Andersen 2205c84de4 comparison was always false due to limited range of data types.
Carefully cast to unsigned long long prior to multiply to get
the expected result.
2003-09-15 08:11:29 +00:00
Eric Andersen 1393a39df4 Do not shadow the global name 'accept' 2003-09-15 08:06:15 +00:00
Glenn L McGrath 2eed0e2d47 Add a test for the 'P' command and fix current implementation so it
doesnt permanently modify the pattern space.
2003-09-15 06:28:45 +00:00
Glenn L McGrath 6e5687abc3 A test and fix for the sed 'n' command 2003-09-15 06:12:53 +00:00
Glenn L McGrath 7b35121297 Test for use of newline in regex's, this feature is used by most
configure scripts.
2003-09-15 05:53:28 +00:00
Glenn L McGrath 73116311e5 Fix for the sed-append-next-line test 2003-09-15 05:42:05 +00:00
Glenn L McGrath 65f9dc01f3 Test the N command 2003-09-15 05:35:47 +00:00
Glenn L McGrath 640c1f547f Fix recursion problem 2003-09-15 04:55:29 +00:00
Glenn L McGrath ba5eb27ce3 Check sed doesnt go into an infinite loop (yes it does) 2003-09-15 04:41:17 +00:00
Glenn L McGrath c43f9edf88 Update Matteo Croce's email address 2003-09-15 03:37:32 +00:00
Glenn L McGrath 294d113adb Memory cleanups and fix for echo "foo" | sed 's/foo/bar/;H;q' 2003-09-14 16:28:08 +00:00
Glenn L McGrath 8417c8c38b Cleanup memory usage 2003-09-14 15:24:18 +00:00
Glenn L McGrath 7bf8f5bc5e Update sed branch tests 2003-09-14 11:10:08 +00:00
Glenn L McGrath 8a0b59fb82 Add two new tests, sed-recurses-properly should always work 2003-09-14 09:38:24 +00:00
Glenn L McGrath edc388cf4e The previous fix for 's/a/1/;s/b/2/;t one;p;:one;p' broke the case of
echo fooba | ./busybox sed -n 's/foo//;s/bar/found/p'

I really need to start adding these tests to the testsuite.

keep the substituted and altered flags seperate
2003-09-14 08:52:53 +00:00
Glenn L McGrath 3fe475677a Preserve substitution flag value within the current line.
Fixed the following testcase
# cat strings |./busybox sed -n -f test3.sed
1
1
2
c
c
# cat strings
a
b
c
2003-09-14 07:59:28 +00:00
Glenn L McGrath f4523562b6 Fix branching commands.
If a label isnt specified, jump to end of script, not the last command
in the script.

Print an error and exit if you try and jump to a non-existant label

Works for the following testcase
# cat strings
a
b
c
d
e
f
g
# cat strings | ./busybox sed -n '/d/b;p'
a
b
c
e
f
g
2003-09-14 06:01:14 +00:00
Glenn L McGrath 8aac05bfe5 Patch from Rob Landley
Fixed a memory leak in add_cmd/add_cmd_str by moving the allocation
of sed_cmd down to where it's actually first needed.
                                                                                
In get_address, if index_of_next_unescaped_regexp_delim ever failed, we
wouldn't notice because the return value was added to idx, which was 
already guaranteed to be > 0.  (This is buried in the changes made when 
I redid get_address to be based on pointer arithmetic, because all the tests 
were gratuitously dereferencing with a constant zero, which wasn't obvious.)
         
Comment in parse_regex_delim was wrong: 's' and 'y' both call it.
 
The reason "sed_cmd->num_backrefs = 0;" isn't needed is that sed_cmd was
allocated with cmalloc, which zeroes memory.

Different handling of space after \ in i...

Different handling of pattern "s/a/b s/c/d"

Cool, resursive reads don't cause a crash. :)

Fixed "sed -f blah filename - < filename" since GNU sed was handling 
both - and filenames on the same line.  (You can even list - more than 
once, although it's immediate EOF...)
2003-09-14 04:06:12 +00:00
Glenn L McGrath 7c59a83a77 Stupid typo 2003-09-14 02:37:46 +00:00
Glenn L McGrath 4dc1d25a30 Fix some memory allocation problems 2003-09-14 01:25:31 +00:00
Glenn L McGrath f36635cec6 Fix the following testcase by disabling global substitution if the regex
is anchored to the start of line, there can be only one subst.
echo "aah" | sed 's/^a/b/g'
2003-09-13 15:12:22 +00:00
Glenn L McGrath c18ce373a2 Fix the following testcase by storing the state of the adress match with
the command.
# cat strings
a
b
c
d
e
f
g
# ./busybox sed '1,2d;4,$d' <strings
c
# ./busybox sed '4,$d;1,2d' <strings
# sed '4,$d;1,2d' <strings
c
# sed '1,2d;4,$d' <strings
c
2003-09-13 06:57:39 +00:00
Glenn L McGrath c2b9186be1 Fix compile error, Vodz, last_path_113 2003-09-12 11:27:15 +00:00
Glenn L McGrath 2af30446f1 Typo. 2003-09-12 10:58:54 +00:00
Eric Andersen eb213bd2a2 As vodz just pointed out, I screwup up the call to bb_xasprintf! 2003-09-12 08:39:05 +00:00
Eric Andersen 7f2935ba0e Remove final \n 2003-09-12 08:32:24 +00:00
Eric Andersen 70af8834df Fix obligitory typos 2003-09-12 07:36:46 +00:00
Eric Andersen aa2afee922 Final changelog update 2003-09-12 07:03:52 +00:00
Eric Andersen 839bd4a73b Remove version # 2003-09-12 07:03:14 +00:00
Eric Andersen 3acfedfafe I suppose it is now Sept 12... 2003-09-12 06:59:52 +00:00
Eric Andersen 23bc836f42 Update webpage a bit 2003-09-12 06:59:17 +00:00
Glenn L McGrath beb3bbd991 Fix handling of hardlinks when OLDGNU and GNU extensions arent enabled. 2003-09-12 06:49:09 +00:00
Glenn L McGrath ef91bf67ed Use the typeflag to identify if its a hardlink on OLD and GNU posix
modes, fixes a bug extracting hardlinks to symlinks.
2003-09-12 06:31:28 +00:00
Eric Andersen 51ed242ad6 Invoke run-parts on /etc/network/if-*.d per the behavior of
the upstream ifupdown code...
2003-09-12 05:59:53 +00:00
Eric Andersen e15138a870 Teach rdate to timeout in 10 seconds to avoid blocking forever
with odd or broken networking setups
2003-09-12 05:50:51 +00:00
Eric Andersen f57a614db9 config option CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN must depend
on CONFIG_FEATURE_SH_STANDALONE_SHELL.
2003-09-12 04:49:21 +00:00
Eric Andersen a4389cfb51 Update changelog for release 2003-09-12 04:43:49 +00:00
Glenn L McGrath 14092a1ed2 Busybox CVS version ipcalc have problems:
- Can`t use 255.255.255.255 address
- typo: double check for valid ip address and uncheck for valid mask

httpd unseted SERVER_PORT (my bug from last_patch111).

last_patch_112 from Vladimir N. Oleynik
2003-09-12 00:44:50 +00:00
Eric Andersen 81155f8fa8 Update definition of struct serial_struct, per linux-2.6.0-test5,
to avoid stack corruption problems on some 64bit architectures
when sizeof(void*) != sizeof(int).  Thanks to Atsushi Nemoto
for finding this problem.
2003-09-11 08:52:22 +00:00
Eric Andersen 2fdba24620 Marc A. Lehmann writes:
The tar -x command in busybox does not restore the file mode correctly.

The reason is most probably this code in
archival/libunarachive/data_extract_all.c:

       chmod(file_header->name, file_header->mode);
       chown(file_header->name, file_header->uid, file_header->gid);

chown clears the set*id bits (on current versions of linux :). Flipping
the order around fixes the problem.

(tested with 1.00pre3 from cvs).
2003-09-11 08:32:40 +00:00
Eric Andersen 6231f092bd Patch from Philip Blundell:
On Thu, 2003-09-11 at 01:09, Glenn McGrath wrote:
> Applied

Thanks.  Unfortunately there was one small bug in that last patch.
Could you apply this one as well?

p.
2003-09-11 08:25:11 +00:00
Glenn L McGrath cc20ebc11e add ipv6 literal support to wget 2003-09-10 23:52:15 +00:00
Glenn L McGrath 1cb2622f9c Fix a bug where make clean complained about having both : and :: entries.
Remove tester.log on make clean
Patch by Arthur Othieno
2003-09-10 23:47:10 +00:00
Glenn L McGrath fe538ba5d6 Vodz, last_patch_104 2003-09-10 23:35:45 +00:00
Glenn L McGrath 87af49f26b If a tar entry is a regualr file ending in a '/' then its really a
directory.
From http://www.gnu.org/manual/tar/html_node/tar_123.html
REGTYPE
AREGTYPE
    These flags represent a regular file. In order to be compatible with
older versions of tar, a typeflag value of AREGTYPE should be silently
recognized as a regular file. New archives should be created using
REGTYPE. Also, for backward compatibility, tar treats a regular file
whose name ends with a slash as a directory.
2003-09-09 17:41:03 +00:00
Glenn L McGrath 640fb86b28 Update the config file by running it from menuconfig, get rid of some
unused entries.
2003-09-09 15:53:56 +00:00
Glenn L McGrath 07f6b95d8f Patch from Jean Wolter
expr currently always adds even if told to subtract
2003-09-08 23:19:12 +00:00
Glenn L McGrath 5875be406e Vodz, last_patch_110
no limit, no memory usage for env buffer, always call putenv().
remove small error for previous last_patch109.
2003-09-08 15:39:09 +00:00
Glenn L McGrath 55bf79f944 Preserve suid/sgid bits 2003-09-08 14:34:23 +00:00
Glenn L McGrath b65422cf65 last_patch_109 from Vladimir N. Oleynik
Busybox`s httpd have the defect (from born):
ip 1.2.3.1 have true comparing also with
1.2.3.10-1.2.3.19 and 1.2.3.100-1.2.3.199.
Last patch removed this bug and added feature:
allow/deny rule can support network/netmask
example: 1.2.3.0/255.255.255.128
  or
network/mask_bits
example: 1.2.3.0/25
now; old format
1
1.2
1.2.3
1.2.3.4
too support and converted to
1/8 1.2/16 1.2.3/24 1.2.3.4/32
automaticaly.

Also, current CVS have small problem: ignores
A:IP, (loses 'A', 'a' only work). Corrected.
2003-09-08 10:59:27 +00:00
Glenn L McGrath 350733abb8 Busybox modprobe has a couple of irritating quirks:
- attempting to modprobe a module that is already loaded yields "Failed
to load module", whereas modutils quietly ignores such a request.

 - if a module genuinely can't be loaded due to missing symbols or
similar problems, modprobe doesn't produce any useful diagnostics
because the output from insmod has been redirected to /dev/null.

Here's a patch to address these issue

Patch by Philip Blundell
2003-09-08 00:32:49 +00:00
Glenn L McGrath d6bdd5dc08 Small bug in silent option 2003-09-05 02:37:15 +00:00
Glenn L McGrath b77158a934 Set the default password to md5, patch by Joshua Jackson 2003-09-04 08:21:36 +00:00
Glenn L McGrath 99bd5adf99 more crond+crontab integrating with loginutil libbb functions and deleted
patch from Thomas Gleixner to init.
Viodz last_patch_108
2003-09-03 12:18:42 +00:00
Glenn L McGrath 759d7ececd To load GPLONLY symbols its is required that CHECK_TAINTED_MODULES be
enabled, if not GPLONLY symbols are ignored.
2003-09-03 00:42:58 +00:00
Glenn L McGrath 530ea42abc adds the ability to use and calculate network prefix specifications instead
of netmasks. It also fixes the parameters for network and netmask to match
that of the official Red Hat version (-n for network and -m for netmask).
Patch by Joshua Jackson
2003-09-02 06:59:57 +00:00
Glenn L McGrath dc4e75ef7c move all "-/bin/sh" "/bin/sh" and "sh" to libbb/messages.c file as one
constant.
Vodz last_patch_107
2003-09-02 02:36:18 +00:00
Glenn L McGrath 005f83adf5 Fix compile error and reducing size for libbb/get_console.c to previous size.
Vodz last_patch106
2003-09-01 08:53:32 +00:00
Glenn L McGrath d9461f887e Allow one to detect and handle the case where no lease could be obtained
via DHCP. (Just add a section "failed" to your script.)
Patch by Steven Scholz
2003-09-01 04:08:36 +00:00
Glenn L McGrath c2942f0904 "insmod caches the symbolname in a variable before modifying it and uses
the cached value afterwards." - Jean Wolter
2003-08-31 01:58:18 +00:00
Glenn L McGrath bb13624d8c save a couple of bytes 2003-08-30 12:38:13 +00:00
Glenn L McGrath 502907f5b3 The default behaviour for run-parts is corrected to continue if an error
is encountered in a script.
Patch by Philip Blundell
2003-08-30 12:27:36 +00:00
Glenn L McGrath 759515c26a handle GPLONLY symbols 2003-08-30 06:00:33 +00:00
Glenn L McGrath 29a05f56d5 "Without this patch, udhcpcd output may be buffered and delayed for
for minutes if stdout is not a tty." -vda@
2003-08-30 04:47:36 +00:00
Glenn L McGrath 9b04f1841e Fix the substitution print subcommand, it should only print if its
own substitution matched, not previous ones.
e.g
echo fooba | sed -n 's/foo//;s/bar/found/p'
shouldnt print anything
2003-08-30 04:35:07 +00:00
Glenn L McGrath 72f5f02184 Remove some unwanted code, patch from Holger Schurig, confirmed by vodz 2003-08-29 16:19:03 +00:00
Glenn L McGrath 5cd6461b6f "Due to a wrong format parameter in a printf httpd does not work when
compiled for with CONFIG_LFS (large file support).
The attached patch suggested by Vladimir fixes that." - Steven Scholz
2003-08-29 15:53:23 +00:00
Glenn L McGrath e01c550eab "A little patch for the strings applet of the busybox development tree
that substitutes two lines of code with a libbb function saving a couple
of bytes." - Tito
2003-08-29 15:48:37 +00:00
Glenn L McGrath 21aacba2b7 Logic error, patch by Matteo Croce 2003-08-29 15:39:07 +00:00
Glenn L McGrath 8ce8f9b482 Remove stray '\n' 2003-08-29 15:19:44 +00:00
Glenn L McGrath 2233685f00 Remove unused files 2003-08-29 15:03:12 +00:00
Glenn L McGrath 2ce002a732 Help for date -I when CONFIG_FEATURE_DATE_ISOFMT is enabled.
Patch by Steven Scholz
2003-08-29 14:18:26 +00:00
Glenn L McGrath b19c73dee6 Change make to $(MAKE), patch by Hideki IWAMOTO 2003-08-29 13:25:55 +00:00
Glenn L McGrath 3bff66617a Substitute busybox for uClibc, patch by Hideki IWAMOTO 2003-08-29 12:23:09 +00:00
Glenn L McGrath 87470def24 * Since busybox binary is unnecessary, deleted it from prerequisites.
* Changed so that not only links but /bin/busybox might be deleted.
* When double quoted PREFIX is defined by `.config' is used,
  `make uninstall' does not work correctly.
  When default PREFIX `pwd`/_install defined by Rules.mak is used,
  similarly it does not work correctly.
  Changed $$PREFIX into $(PREFIX) in order to fix this.
Patch by Hideki IWAMOTO
2003-08-29 12:20:31 +00:00
Glenn L McGrath b54a748621 Fix for compiling with ipv6 2003-08-29 11:34:08 +00:00
Glenn L McGrath 08dea3e5a7 "This function was not updating the argc and argv pointers to reflect
the arguments it consumed, which means the calling function encountered
them as well.  As a result, a command like "ip -6 addr" was yielding a usage
error." - Philip Blundell
2003-08-29 10:58:46 +00:00
Glenn L McGrath 62b031fb82 label's dont work in v4 tunnels, patch by Eric Spakman 2003-08-29 07:47:52 +00:00
Glenn L McGrath a6b7bdcf8c Vodz, last patch 105
Busybox "mount" applet unsupport "user" option and
result: must have _BB_SUID_NEVER applet option (my bug).
Last patch have reducing 216 bytes for "su" applet also.
2003-08-29 07:38:56 +00:00
Glenn L McGrath dc72f3ace2 Vodz, last patch 104 2003-08-29 07:35:08 +00:00
Glenn L McGrath 7b8765c808 vodz, last patch 103 2003-08-29 07:29:30 +00:00
Glenn L McGrath 23365976f8 Correct logic in determining size of block to download, as pointed out
by Junio C Hamano
2003-08-29 06:25:04 +00:00
Glenn L McGrath 523c1675a2 "Typo and/or thinko: scanning till the end of NUL terminated string
should check the byte pointed at not the pointer itself." -junkio@
2003-08-28 22:12:53 +00:00
Glenn L McGrath e7bdfccb3f "When the initial request by wget is responded by a 3XX redirect
response sent in chunked transfer encoding, the code path to
resubmit the request to the redirected URL forgets to reset
got_clen and chunked variables in the loop.  If the redirected
URL does not use chunked transfer encoding, this causes the code
that slurps the body of the response to incorrectly try to parse
out the chunk length which does not exist." - junkio@

----------------------------------------------------------------------
2003-08-28 22:03:19 +00:00
Glenn L McGrath 83e4a5bccf "When the filesize is known from content-length header, safe_fread is
always told to read sizeof(buf).  This waits until the underlying
fread() to time-out for the last part of the downloaded body.  Fix
this by sending the number of remaining bytes to read when known." -
junkio@
I reworked the logic in his patch
2003-08-28 21:55:22 +00:00
Glenn L McGrath 8b96b7169d *** empty log message *** 2003-08-28 19:54:16 +00:00
Glenn L McGrath 4cee66d5a8 Dont unlink when testing !
Always preserve creation date
Disable the -p option its for modification date
Remove some cpio header debugging noise
Syncronise file listing behaviour with upstream.
2003-08-28 19:12:23 +00:00
Robert Griebl 444566837c Removed some debug printfs 2003-08-26 11:06:39 +00:00
Glenn L McGrath b79db92a21 Syncronise some build files with busybox-cvs-20030819 2003-08-26 04:50:23 +00:00
Glenn L McGrath c3f2956cfa Woops, depend on SHA1 not the option 2003-08-26 04:28:05 +00:00
Glenn L McGrath 4d5e4685fe SHA1 options depend on SHA1 2003-08-26 04:25:59 +00:00
Glenn L McGrath ce6482eace Fix overflow for machines greater than 4GB, return unsigned int to avoid
a cast and for greater accuracy.
2003-08-26 02:14:58 +00:00
Eric Andersen 97e2426582 "staywithu" writes:
In BusyBox v1.00-pre2,
 commands like ls, df with -h option report a wrong file size for files larger than 4GBtye!!

For example,
   when I execute 'ls -l', it reports
      -rw-r--r--      1 root       root    5368709120    Aug    17  2003  large_stream.tp

   when I execute 'ls -lh', I expect that
      -rw-r--r--      1 root       root                5.0G    Aug    17  2003  large_stream.tp

  but it reports
      -rw-r--r--      1 root       root                1.0G    Aug    17  2003  large_stream.tp

I fixed this bug that...
 Line 31 in libbb/human_readable.c and line 275 include/libbb.h

     const char *make_human_readable_str(unsigned long size
      =>   const char *make_human_readable_str(unsigned long long size

It's OK!
2003-08-22 23:08:37 +00:00
Eric Andersen 6d3c7e7a9c trivial doc fix 2003-08-22 21:15:07 +00:00
Eric Andersen 24e098a77d Fixup 'make clean' to properly clean the _install directory 2003-08-22 20:53:38 +00:00
Glenn L McGrath d382c89467 Typo 2003-08-19 03:49:00 +00:00
Glenn L McGrath 3d5828fb6d Change hardlink handling for tar to work the same way as cpio 2003-08-14 02:55:15 +00:00
Manuel Novoa III 062913f662 Fix a bug reported by junkio@cox.net involving the mode_chars index. 2003-08-14 02:28:49 +00:00
Eric Andersen bf83355dda Patch from Paul Mundt (lethal) adding sh64 insmod support for busybox 2003-08-13 19:56:33 +00:00
Manuel Novoa III 4456f25e8f Rewrite timescmd() function to avoid the use of floating point and to
correct a bug in the seconds display where something like  65 seconds
would be output as "1m65.000000s".
2003-08-13 17:48:47 +00:00
Manuel Novoa III 5b3c05637d Remove unnecessary pointer dereference. 2003-08-13 12:11:33 +00:00
Eric Andersen 9a9f6777e9 fix style sheet so site doesn't look like crap with IE 2003-08-12 06:55:03 +00:00
Manuel Novoa III 96379b0d7d Adjust Erik's change, as I don't claim copyright of the applet. 2003-08-09 02:57:55 +00:00
Eric Andersen 8f4cdd516d Move shell descriptions to the config system 2003-08-08 23:41:50 +00:00
Eric Andersen b287e2e27a Use the new 'select' option to make the shell config
much less evil and far more obvious.
 -Erik
2003-08-08 23:40:12 +00:00
Eric Andersen c601ff149a Begin using the new "select" option. Good stuff! 2003-08-08 23:12:12 +00:00
Eric Andersen 2e9c257000 Implement a minimalist 'last' which allows the LEAF project to
no longer need dumtp.  Remove the 'dumtp' applet.
 -Erik
2003-08-08 22:26:06 +00:00
Eric Andersen f1c56a9306 quiet some noise 2003-08-08 22:13:41 +00:00
Eric Andersen 92fb9395f7 Kent Robotti noted that mt.c uses "rewind" not "rew" 2003-08-08 20:09:03 +00:00
Eric Andersen 99a75d1376 Patch from Kent Robotti to being fdisk in sync with v2.12 final. 2003-08-08 20:04:56 +00:00
Eric Andersen de6a6ae876 Remove unnecessary defamatory comment 2003-08-08 08:57:03 +00:00
Eric Andersen 6c0e0fb8ac Fix a stupid bug I introduced several months ago 2003-08-08 07:39:57 +00:00
Eric Andersen 3869f66eac Begin preparing for another release 2003-08-06 11:22:36 +00:00
Eric Andersen 9089844382 Latest dash update from vodz 2003-08-06 11:20:52 +00:00
Eric Andersen dc19af4179 Patch from Eric Spakman to update "run-parts" help text in Config.in. 2003-08-06 09:43:09 +00:00
Eric Andersen fdd2a0f318 Eric Spakman writes:
The attached patch adds "mtu" and "hwaddress" to the inet6 method and
"mtu", "hwaddr" and "pointopoint" to the inet4 method (just like in
the ifupdown part).
Note: "hwaddress" can't be used with the busybox ip applet (this
function isn't implemented in bb ip yet), but it can be of use with
an external "full blown" ip package.

The patch also removes "label" from the loopback configuration,
labels (subinterfaces) aren't used with loopback interfaces.

It further solves a problem in the bootp method, "ifconfig down
%interface%" should be "ifconfig %interface% down" and it's now also
possible to use ip with bootp.

The patch is fully tested with both busybox ip and "stand-alone" ip
and I didn't saw any problems.
2003-08-06 09:23:44 +00:00
Eric Andersen d3652bf334 Patch from vodz:
I wrote:
>>I think, fdisk have special ext2lseek special for:
>>disk can have size > 4Gb, but all any partitions have < 4Gb and lseek64
>>not require.
>>May be best create new configure option for set DOLFS for fdisk applet
>>if global DOLFS unset?
>


Erik Andersen wrote:
>Agreed.  Using an extra configure option when ! DOLFS
>would be a good idea.


Ok. Patch attached.
2003-08-06 09:07:37 +00:00
Eric Andersen 0a57a79e38 Patch from Steven Scholz:
should we rename the define into CONFIG_FEATURE_HDPARM_HDIO_DMA and
use it for "set" and "get" ???

Since although CONFIG_FEATURE_HDPARM_HDIO_GET_DMA is _not_ set I still
can use "hdparm -d 1 /dev/hda" to switch the DMA on.
Is this desireable or meant to be like that?

So how about the applied patch?
2003-08-06 08:57:35 +00:00
Eric Andersen 4b4e09854c Steven Scholz writes:
the output of lsmod (busybox-1.00-pre2) contains IMHO one "\n" too
    much when using CONFIG_FEATURE_CHECK_TAINTED_MODULE:

    ~ # lsmod
    Module                  Size  Used by    Tainted: P

    ds                      8364   1
    m8xx_pcmcia             5388   1
    pcmcia_core            40736   0 [ds m8xx_pcmcia]

and this patch from Steven fixes the problem
2003-08-06 08:53:13 +00:00
Eric Andersen 50af12dbd6 Sync hdparm -t and -T options with hdparm-5.3, which seems
to produce sensible results,
2003-08-06 08:47:59 +00:00
Eric Andersen 481772a4c2 Patch from vodz to cleanup libbb/obscure.c:password_check()
to not copy too much data.
2003-08-06 08:33:08 +00:00
Eric Andersen 5378fbcb33 Joe.C writes:
I've reported this bug in April and it still
    exists in 1.00-pre2. So I made patches for
    both 0.60.x and 1.00-pre2.  The patch is very
    simple, just use strncmp instead of strcmp.
    Please apply if it is OK.

   Here's the procedure to test this problem:
   Create a executable with very long name, say
   'test_1234567890123456' and execute it. Try
   using 'killall' or 'pidof' to find/kill this
   program.  Without this patch, you can't find
   the program.
2003-08-06 08:22:10 +00:00
Eric Andersen 8f4ef159f0 Fixup segfault on 'kill -q' 2003-08-06 07:43:58 +00:00
Eric Andersen c774efe317 extern inline is a bad bad thing. kill it (so mkfs_minix.c will
actually compile)
2003-08-06 07:34:19 +00:00
Eric Andersen 7001480a5e Seems I missed a spot 2003-08-05 05:59:48 +00:00
Eric Andersen 72d8e444f0 Merge/rework config system per the latest from linux-2.6.0-test2.
Fix the config bugs revealed by the updated config system.
 -Erik
2003-08-05 02:18:25 +00:00
Manuel Novoa III 461c279ac1 Might as well get my name in AUTHORS before 1.0... 2003-08-02 00:19:29 +00:00
Manuel Novoa III b1d5b741ac Save 0.5K. 2003-08-02 00:04:18 +00:00
Eric Andersen 546f21aa2d Remove code that too agressively disabled inlines 2003-08-01 22:27:57 +00:00
Eric Andersen e6b811583a Minor cleanup 2003-07-31 17:50:17 +00:00
Glenn L McGrath 91e464632b Fix bug when handling debian packages.
If we read the contents of compressed files within the ar archive,
e.g. control.tar.gz, then file position gets all out of whack, so
it has to be reset before reading thenext header.
2003-07-31 01:53:50 +00:00
Eric Andersen 6a9ca985b8 Remove LRP (now defunct) and replace it with leaf. 2003-07-30 17:17:33 +00:00
307 changed files with 22053 additions and 18022 deletions

No files matched your search

+19 -5
View File
@@ -11,7 +11,7 @@ incorect, _please_ let me know.
Emanuele Aina <emanuele.aina@tiscali.it>
run-parts
Erik Andersen <andersen@codepoet.org>, <andersen@codepoet.org>
Erik Andersen <andersen@codepoet.org>
Tons of new stuff, major rewrite of most of the
core apps, tons of new apps as noted in header files.
@@ -22,16 +22,16 @@ Jeff Angielski <jeff@theptrgroup.com>
ftpput, ftpget
Edward Betts <edward@debian.org>
expr, hostid, logname, tty, wc, whoami, yes
expr, hostid, logname, whoami
John Beppu <beppu@codepoet.org>
du, head, nslookup, sort, tee, uniq
du, nslookup, sort
Brian Candler <B.Candler@pobox.com>
tiny-ls(ls)
Randolph Chung <tausq@debian.org>
fbset, ping, hostname, and mkfifo
fbset, ping, hostname
Dave Cinege <dcinege@psychosis.com>
more(v2), makedevs, dutmp, modularization, auto links file,
@@ -67,11 +67,21 @@ Stephan Linz <linz@li-pro.net>
ipcalc, Red Hat equivalence
John Lombardo <john@deltanet.com>
dirname, tr
tr
Glenn McGrath <bug1@optushome.com.au>
ar, dpkg, dpkg-deb
Manuel Novoa III <mjn3@codepoet.org>
cat, head, mkfifo, mknod, rmdir, sleep, tee, tty, uniq, usleep, wc, yes,
mesg, vconfig, make_directory, parse_mode, dirname, mode_string,
get_last_path_component, simplify_path, and a number trivial libbb routines
also bug fixes, partial rewrites, and size optimizations in
ash, basename, cal, cmp, cp, df, du, echo, env, ln, logname, md5sum, mkdir,
mv, realpath, rm, sort, tail, touch, uname, watch, arith, human_readable,
interface, dutmp, ifconfig
Vladimir Oleynik <dzo@simtreas.ru>
cmdedit; xargs(current), httpd(current);
ports: ash, crond, fdisk, inetd, stty, traceroute, top;
@@ -109,3 +119,7 @@ Charles P. Wright <cpwright@villagenet.com>
Enrique Zanardi <ezanardi@ull.es>
tarcat (since removed), loadkmap, various fixes, Debian maintenance
Tito Ragusa <farmatito@tiscali.it>
devfsd and size optimizations in strings, openvt and deallocvt.
+131 -1028
View File
File diff suppressed because it is too large. Load diff
+30 -26
View File
@@ -36,6 +36,9 @@ CFLAGS += -I/usr/include/selinux
LIBRARIES += -lsecure
endif
CONFIG_CONFIG_IN = sysdeps/$(TARGET_OS)/Config.in
CONFIG_DEFCONFIG = sysdeps/$(TARGET_OS)/defconfig
ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
all: busybox busybox.links doc
@@ -45,7 +48,7 @@ all: busybox busybox.links doc
include $(patsubst %,%/Makefile.in, $(DIRS))
busybox: .depend include/config.h $(libraries-y)
$(CC) $(LDFLAGS) -o $@ $(libraries-y) $(LIBRARIES)
$(CC) $(LDFLAGS) -o $@ -Wl,--start-group $(libraries-y) $(LIBRARIES) -Wl,--end-group
$(STRIPCMD) $@
busybox.links: applets/busybox.mkll include/config.h
@@ -54,8 +57,9 @@ busybox.links: applets/busybox.mkll include/config.h
install: applets/install.sh busybox busybox.links
$(SHELL) $< $(PREFIX)
uninstall: busybox busybox.links
for i in `cat busybox.links` ; do rm -f $$PREFIX$$i; done
uninstall: busybox.links
rm -f $(PREFIX)/bin/busybox
for i in `cat busybox.links` ; do rm -f $(PREFIX)$$i; done
install-hardlinks: applets/install.sh busybox busybox.links
$(SHELL) $< $(PREFIX) --hardlinks
@@ -147,9 +151,9 @@ include/config/MARKER: depend scripts/split-include
include/config.h: .config
@if [ ! -x ./scripts/config/conf ] ; then \
make -C scripts/config conf; \
$(MAKE) -C scripts/config conf; \
fi;
@./scripts/config/conf -o sysdeps/$(TARGET_OS)/Config.in
@./scripts/config/conf -o $(CONFIG_CONFIG_IN)
%.o: %.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
@@ -167,36 +171,36 @@ all: menuconfig
# ---------------------------------------------------------------------------
scripts/config/conf:
make -C scripts/config conf
$(MAKE) -C scripts/config conf
-@if [ ! -f .config ] ; then \
cp sysdeps/$(TARGET_OS)/defconfig .config; \
cp $(CONFIG_DEFCONFIG) .config; \
fi
scripts/config/mconf:
make -C scripts/config ncurses conf mconf
$(MAKE) -C scripts/config ncurses conf mconf
-@if [ ! -f .config ] ; then \
cp sysdeps/$(TARGET_OS)/defconfig .config; \
cp $(CONFIG_DEFCONFIG) .config; \
fi
menuconfig: scripts/config/mconf
@./scripts/config/mconf sysdeps/$(TARGET_OS)/Config.in
@./scripts/config/mconf $(CONFIG_CONFIG_IN)
config: scripts/config/conf
@./scripts/config/conf sysdeps/$(TARGET_OS)/Config.in
@./scripts/config/conf $(CONFIG_CONFIG_IN)
oldconfig: scripts/config/conf
@./scripts/config/conf -o sysdeps/$(TARGET_OS)/Config.in
@./scripts/config/conf -o $(CONFIG_CONFIG_IN)
randconfig: scripts/config/conf
@./scripts/config/conf -r sysdeps/$(TARGET_OS)/Config.in
@./scripts/config/conf -r $(CONFIG_CONFIG_IN)
allyesconfig: scripts/config/conf
@./scripts/config/conf -y sysdeps/$(TARGET_OS)/Config.in
@./scripts/config/conf -y $(CONFIG_CONFIG_IN)
allnoconfig: scripts/config/conf
@./scripts/config/conf -n sysdeps/$(TARGET_OS)/Config.in
@./scripts/config/conf -n $(CONFIG_CONFIG_IN)
defconfig: scripts/config/conf
@./scripts/config/conf -d sysdeps/$(TARGET_OS)/Config.in
@./scripts/config/conf -d $(CONFIG_CONFIG_IN)
test tests: busybox
# Note that 'tests' is depricated. Use 'make check' instead
@@ -208,13 +212,13 @@ check: busybox
clean:
- $(MAKE) -C tests clean
- rm -f docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
docs/busybox.net/BusyBox.html
- rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \
docs/busybox.pdf docs/busybox.pod docs/busybox.net/busybox.html \
docs/busybox _install pod2htm* *.gdb *.elf *~ core
- rm -f busybox busybox.links libbb/loop.h .config.old .hdepend
- rm -f .*config.log
docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \
docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
docs/busybox.net/BusyBox.html busybox.links libbb/loop.h \
.config.old .hdepend busybox
- rm -rf _install
- find . -name .\*.flags -exec rm -f {} \;
- find . -name \*.o -exec rm -f {} \;
- find . -name \*.a -exec rm -f {} \;
@@ -228,20 +232,20 @@ distclean: clean
release: distclean #doc
cd ..; \
rm -rf busybox-$(VERSION); \
cp -a busybox busybox-$(VERSION); \
rm -rf $(PROG)-$(VERSION); \
cp -a busybox $(PROG)-$(VERSION); \
\
find busybox-$(VERSION)/ -type d \
find $(PROG)-$(VERSION)/ -type d \
-name CVS \
-print \
-exec rm -rf {} \; ; \
\
find busybox-$(VERSION)/ -type f \
find $(PROG)-$(VERSION)/ -type f \
-name .\#* \
-print \
-exec rm -f {} \; ; \
\
tar -cvzf busybox-$(VERSION).tar.gz busybox-$(VERSION)/;
tar -cvzf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)/;
tags:
ctags -R .
+3 -33
View File
@@ -37,7 +37,7 @@ Supported architectures:
Busybox in general will build on any architecture supported by gcc. It has
a few specialized features added for __sparc__ and __alpha__. insmod
functionality is currently limited to x86, ARM, SH3/4, powerpc, m68k,
MIPS, and v850e.
MIPS, cris, and v850e.
Supported libcs:
@@ -56,36 +56,6 @@ Supported kernels:
----------------
Shells:
lash is the very smallest shell (adds just 10k) and it is quite usable as
a command prompt, but it is not suitable for any but the most trivial
scripting (such as an initrd that calls insmod a few times) since it does
not understand Bourne shell grammer. It does handle pipes, redirects, and
job control though. Adding in command editing makes it a very nice
lightweight command prompt.
hush is also quite small (just 18k) and it has very complete Bourne shell
grammer. It handles if/then/else/fi just fine, but doesn't handle loops
like for/do/done or case/esac and such. It also currently has a problem
with job control. Using hush is not yet recommended.
msh: The minix shell (adds just 30k) is quite complete and handles things
like for/do/done, case/esac and all the things you expect a Bourne shell to
do. It is not always pedantically correct about Bourne shell grammer (try
running the shell testscript "tests/sh.testcases" on it and compare vs bash)
but for most things it works quite well. It also uses only vfork, so it can
be used on uClinux systems. This was only recently added, so there is still
room to shrink it further...
ash: This adds about 60k in the default configuration and is the most
complete and most pedantically correct shell included with busybox. This
shell was also recently added, and several people (mainly Vladimir and Erik)
have been working on it. There are a number of configurable things at the
top of ash.c as well, so check those out if you want to tweak things.
----------------
Getting help:
When you find you need help, you can check out the BusyBox mailing list
@@ -97,12 +67,12 @@ the mailing list if you are interested.
Bugs:
If you find bugs, please submit a detailed bug report to the busybox mailing
list at busybox@busybox.net. A well-written bug report should include a
list at busybox@mail.busybox.net. A well-written bug report should include a
transcript of a shell session that demonstrates the bad behavior and enables
anyone else to duplicate the bug on their own machine. The following is such
an example:
To: busybox@busybox.net
To: busybox@mail.busybox.net
From: diligent@testing.linux.org
Subject: /bin/date doesn't work
+2 -3
View File
@@ -19,7 +19,7 @@
#--------------------------------------------------------
PROG := busybox
VERSION := 1.00-pre2
VERSION := 1.00-pre7
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
@@ -35,7 +35,6 @@ BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
# 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)))
#CROSS =/usr/i386-linux-uclibc/bin/i386-uclibc-
CC = $(CROSS)gcc
AR = $(CROSS)ar
AS = $(CROSS)as
@@ -101,7 +100,7 @@ TARGET_ARCH=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
)
endif
# Pull in the user's uClibc configuration
# Pull in the user's busybox configuration
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
-include $(TOPDIR).config
endif
+229 -184
View File
@@ -29,6 +29,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "busybox.h"
#undef APPLET
@@ -53,9 +54,7 @@ static void check_suid (struct BB_applet *app);
#include "pwd_.h"
#include "grp_.h"
static int parse_config_file (void);
static int config_ok;
static void parse_config_file (void);
#define CONFIG_FILE "/etc/busybox.conf"
@@ -127,7 +126,7 @@ run_applet_by_name (const char *name, int argc, char **argv)
#ifdef CONFIG_FEATURE_SUID_CONFIG
if (recurse_level == 0)
config_ok = parse_config_file ();
parse_config_file ();
#endif
recurse_level++;
@@ -193,7 +192,7 @@ check_suid (struct BB_applet *applet)
uid_t rgid = getgid ();
#ifdef CONFIG_FEATURE_SUID_CONFIG
if (config_ok) {
if (suid_config) {
struct BB_suid_config *sct;
for (sct = suid_config; sct; sct = sct->m_next) {
@@ -253,191 +252,237 @@ check_suid (struct BB_applet *applet)
#ifdef CONFIG_FEATURE_SUID_CONFIG
/* This should probably be a libbb routine. In that case,
* I'd probably rename it to something like bb_trimmed_slice.
*/
static char *get_trimmed_slice(char *s, char *e)
{
/* First, consider the value at e to be nul and back up until we
* reach a non-space char. Set the char after that (possibly at
* the original e) to nul. */
while (e-- > s) {
if (!isspace(*e)) {
break;
}
}
e[1] = 0;
/* 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);
}
#define parse_error(x) { err=x; goto pe_label; }
/* Don't depend on the tools to combine strings. */
static const char config_file[] = CONFIG_FILE;
int
parse_config_file (void)
/* There are 4 chars + 1 nul for each of user/group/other. */
static const char mode_chars[] = "Ssx-\0Ssx-\0Ttx-";
/* We don't supply a value for the nul, so an index adjustment is
* necessary below. Also, we use unsigned short here to save some
* space even though these are really mode_t values. */
static const unsigned short mode_mask[] = {
/* SST sst xxx --- */
S_ISUID, S_ISUID|S_IXUSR, S_IXUSR, 0, /* user */
S_ISGID, S_ISGID|S_IXGRP, S_IXGRP, 0, /* group */
0, S_IXOTH, S_IXOTH, 0 /* other */
};
static void parse_config_file(void)
{
struct stat st;
char *err = 0;
FILE *f = 0;
int lc = 0;
struct BB_suid_config *sct_head;
struct BB_suid_config *sct;
struct BB_applet *applet;
FILE *f;
char *err;
char *s;
char *e;
int i, lc, section;
char buffer[256];
struct stat st;
suid_config = 0;
assert(!suid_config); /* Should be set to NULL by bss init. */
/* is there a config file ? */
if (stat (CONFIG_FILE, &st) == 0) {
/* is it owned by root with no write perm. for group and others ? */
if (S_ISREG (st.st_mode) && (st.st_uid == 0)
&& (!(st.st_mode & (S_IWGRP | S_IWOTH)))) {
/* that's ok .. then try to open it */
f = fopen (CONFIG_FILE, "r");
if (f) {
char buffer[256];
int section = 0;
while (fgets (buffer, sizeof (buffer) - 1, f)) {
char c = buffer[0];
char *p;
lc++;
p = strchr (buffer, '#');
if (p)
*p = 0;
p = buffer + bb_strlen (buffer);
while ((p > buffer) && isspace (*--p))
*p = 0;
if (p == buffer)
continue;
if (c == '[') {
p = strchr (buffer, ']');
if (!p || (p == (buffer + 1))) /* no matching ] or empty [] */
parse_error ("malformed section header");
*p = 0;
if (strcasecmp (buffer + 1, "SUID") == 0)
section = 1;
else
section = -1; /* unknown section - just skip */
} else if (section) {
switch (section) {
case 1:{ /* SUID */
int l;
struct BB_applet *applet;
p = strchr (buffer, '='); /* <key>[::space::]*=[::space::]*<value> */
if (!p || (p == (buffer + 1))) /* no = or key is empty */
parse_error ("malformed keyword");
l = p - buffer;
while (isspace (buffer[--l])) {
/* skip whitespace */
}
buffer[l + 1] = 0;
if ((applet = find_applet_by_name (buffer))) {
struct BB_suid_config *sct =
xmalloc (sizeof (struct BB_suid_config));
sct->m_applet = applet;
sct->m_next = suid_config;
suid_config = sct;
while (isspace (*++p)) {
/* skip whitespace */
}
sct->m_mode = 0;
switch (*p++) {
case 'S':
sct->m_mode |= S_ISUID;
break;
case 's':
sct->m_mode |= S_ISUID;
/* no break */
case 'x':
sct->m_mode |= S_IXUSR;
break;
case '-':
break;
default:
parse_error ("invalid user mode");
}
switch (*p++) {
case 's':
sct->m_mode |= S_ISGID;
/* no break */
case 'x':
sct->m_mode |= S_IXGRP;
break;
case 'S':
break;
case '-':
break;
default:
parse_error ("invalid group mode");
}
switch (*p) {
case 't':
case 'x':
sct->m_mode |= S_IXOTH;
break;
case 'T':
case '-':
break;
default:
parse_error ("invalid other mode");
}
while (isspace (*++p)) {
/* skip whitespace */
}
if (isdigit (*p)) {
sct->m_uid = strtol (p, &p, 10);
if (*p++ != '.')
parse_error ("parsing <uid>.<gid>");
} else {
struct passwd *pwd;
char *p2 = strchr (p, '.');
if (!p2)
parse_error ("parsing <uid>.<gid>");
*p2 = 0;
pwd = getpwnam (p);
if (!pwd)
parse_error ("invalid user name");
sct->m_uid = pwd->pw_uid;
p = p2 + 1;
}
if (isdigit (*p))
sct->m_gid = strtol (p, &p, 10);
else {
struct group *grp = getgrnam (p);
if (!grp)
parse_error ("invalid group name");
sct->m_gid = grp->gr_gid;
}
}
break;
}
default: /* unknown - skip */
break;
}
} else
parse_error ("keyword not within section");
}
fclose (f);
return 1;
}
if ((stat(config_file, &st) != 0) /* No config file? */
|| !S_ISREG(st.st_mode) /* Not a regular file? */
|| (st.st_uid != 0) /* Not owned by root? */
|| (st.st_mode & (S_IWGRP | S_IWOTH)) /* Writable by non-root? */
|| !(f = fopen(config_file, "r")) /* Can not open? */
) {
return;
}
}
return 0; /* no config file or not readable (not an error) */
pe_label:
fprintf (stderr, "Parse error in %s, line %d: %s\n", CONFIG_FILE, lc, err);
sct_head = NULL;
section = lc = 0;
if (f)
fclose (f);
return 0;
do {
s = buffer;
if (!fgets(s, sizeof(buffer), f)) { /* Are we done? */
if (ferror(f)) { /* Make sure it wasn't a read error. */
parse_error("reading");
}
fclose(f);
suid_config = sct_head; /* Success, so set the pointer. */
return;
}
lc++; /* Got a (partial) line. */
/* If a line is too long for our buffer, we consider it an error.
* The following test does mistreat one corner case though.
* If the final line of the file does not end with a newline and
* yet exactly fills the buffer, it will be treated as too long
* even though there isn't really a problem. But it isn't really
* worth adding code to deal with such an unlikely situation, and
* we do err on the side of caution. Besides, the line would be
* too long if it did end with a newline. */
if (!strchr(s, '\n') && !feof(f)) {
parse_error("line too long");
}
/* Trim leading and trailing whitespace, ignoring comments, and
* check if the resulting string is empty. */
if (!*(s = get_trimmed_slice(s, strchrnul(s, '#')))) {
continue;
}
/* Check for a section header. */
if (*s == '[') {
/* Unlike the old code, we ignore leading and trailing
* whitespace for the section name. We also require that
* there are no stray characters after the closing bracket. */
if (!(e = strchr(s, ']')) /* Missing right bracket? */
|| e[1] /* Trailing characters? */
|| !*(s = get_trimmed_slice(s+1, e)) /* Missing name? */
) {
parse_error("section header");
}
/* Right now we only have one section so just check it.
* If more sections are added in the future, please don't
* resort to cascading ifs with multiple strcasecmp calls.
* That kind of bloated code is all too common. A loop
* and a string table would be a better choice unless the
* number of sections is very small. */
if (strcasecmp(s, "SUID") == 0) {
section = 1;
continue;
}
section = -1; /* Unknown section so set to skip. */
continue;
}
/* Process sections. */
if (section == 1) { /* SUID */
/* Since we trimmed leading and trailing space above, we're
* now looking for strings of the form
* <key>[::space::]*=[::space::]*<value>
* where both key and value could contain inner whitespace. */
/* First get the key (an applet name in our case). */
if (!!(e = strchr(s, '='))) {
s = get_trimmed_slice(s, e);
}
if (!e || !*s) { /* Missing '=' or empty key. */
parse_error("keyword");
}
/* Ok, we have an applet name. Process the rhs if this
* applet is currently built in and ignore it otherwise.
* Note: This can hide config file bugs which only pop
* up when the busybox configuration is changed. */
if ((applet = find_applet_by_name(s))) {
/* Note: We currently don't check for duplicates!
* The last config line for each applet will be the
* one used since we insert at the head of the list.
* I suppose this could be considered a feature. */
sct = xmalloc(sizeof(struct BB_suid_config));
sct->m_applet = applet;
sct->m_mode = 0;
sct->m_next = sct_head;
sct_head = sct;
/* Get the specified mode. */
e = (char *) bb_skip_whitespace(e+1);
for (i=0 ; i < 3 ; i++) {
const char *q;
if (!*(q = strchrnul(mode_chars + 5*i, *e++))) {
parse_error("mode");
}
/* Adjust by -i to account for nul. */
sct->m_mode |= mode_mask[(q - mode_chars) - i];
}
/* Now get the the user/group info. */
s = (char *) bb_skip_whitespace(e);
/* Note: We require whitespace between the mode and the
* user/group info. */
if ((s == e) || !(e = strchr(s, '.'))) {
parse_error("<uid>.<gid>");
}
*e++ = 0;
/* We can't use get_ug_id here since it would exit()
* if a uid or gid was not found. Oh well... */
{
char *e2;
sct->m_uid = strtoul(s, &e2, 10);
if (*e2 || (s == e2)) {
struct passwd *pwd;
if (!(pwd = getpwnam(s))) {
parse_error("user");
}
sct->m_uid = pwd->pw_uid;
}
sct->m_gid = strtoul(e, &e2, 10);
if (*e2 || (e == e2)) {
struct group *grp;
if (!(grp = getgrnam(e))) {
parse_error("group");
}
sct->m_gid = grp->gr_gid;
}
}
}
continue;
}
/* Unknown sections are ignored. */
/* Encountering configuration lines prior to seeing a
* section header is treated as an error. This is how
* the old code worked, but it may not be desireable.
* We may want to simply ignore such lines in case they
* are used in some future version of busybox. */
if (!section) {
parse_error("keyword outside section");
}
} while (1);
pe_label:
fprintf(stderr, "Parse error in %s, line %d: %s\n",
config_file, lc, err);
fclose(f);
/* Release any allocated memory before returning. */
while (sct_head) {
sct = sct_head->m_next;
free(sct_head);
sct_head = sct;
}
return;
}
#endif
@@ -446,9 +491,9 @@ pe_label:
/* END CODE */
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
+11 -2
View File
@@ -135,6 +135,14 @@ int busybox_main(int argc, char **argv)
/* If we've already been here once, exit now */
if (been_there_done_that == 1 || argc < 1) {
const struct BB_applet *a = applets;
int output_width = 60;
#ifdef CONFIG_FEATURE_AUTOWIDTH
/* Obtain the terminal width. */
get_terminal_width_height(0, &output_width, NULL);
/* leading tab and room to wrap */
output_width -= 20;
#endif
fprintf(stderr, "%s\n\n"
"Usage: busybox [function] [arguments]...\n"
@@ -149,7 +157,7 @@ int busybox_main(int argc, char **argv)
col +=
fprintf(stderr, "%s%s", ((col == 0) ? "\t" : ", "),
(a++)->name);
if (col > 60 && a->name != 0) {
if (col > output_width && a->name != 0) {
fprintf(stderr, ",\n");
col = 0;
}
@@ -160,8 +168,9 @@ int busybox_main(int argc, char **argv)
/* Flag that we've been here already */
been_there_done_that = 1;
/* Move the command line down a notch */
/* Preserve pointers so setproctitle() works consistently */
len = argv[argc] + strlen(argv[argc]) - argv[1];
memmove(argv[0], argv[1], len);
memset(argv[0] + len, 0, argv[1] - argv[0]);
+59 -37
View File
@@ -16,13 +16,14 @@ config CONFIG_AR
The original files' contents, mode (permissions), timestamp, owner,
and group are preserved in the archive, and can be restored on
extraction.
The stored filename is limited to 15 characters. (for more information
see long filename support).
ar has 60 bytes of overheads for every stored file.
This implementation of ar can extract archives, it cannot create or
modify them.
On an x86 system, the ar applet adds about XXX bytes.
On an x86 system, the ar applet adds about 1K.
Unless you have a specific application which requires ar, you should
probably say N here.
@@ -41,14 +42,14 @@ config CONFIG_BUNZIP2
bool "bunzip2"
default n
help
bunzip2 is an compression utility using the Burrows-Wheeler block
bunzip2 is a compression utility using the Burrows-Wheeler block
sorting text compression algorithm, and Huffman coding. Compression
is generally considerably better than that achieved by more
conventional LZ77/LZ78-based compressors, and approaches the
performance of the PPM family of statistical compressors.
The BusyBox bunzip2 applet is limited to de-compression only.
On an x86 system, this applet adds about XXX bytes.
On an x86 system, this applet adds about 11K.
Unless you have a specific application which requires bunzip2, you
should probably say N here.
@@ -92,30 +93,10 @@ config CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
default n
depends on CONFIG_DPKG_DEB
help
This reduced dpkg-deb to the equivalent of "ar -p <deb> data.tar.gz | tar -zx".
This reduces dpkg-deb to the equivalent of "ar -p <deb> data.tar.gz | tar -zx".
However it saves space as none of the extra dpkg-deb, ar or tar options are
needed, they are linked to internally.
config CONFIG_FEATURE_DEB_TAR_GZ
bool " gzip debian packages (normal)"
default y if CONFIG_DPKG || CONFIG_DPKG_DEB
depends on CONFIG_DPKG || CONFIG_DPKG_DEB
help
This is the default compression method inside the debian ar file.
If you want compatability with standard .deb's you should say yes here.
config CONFIG_FEATURE_DEB_TAR_BZ2
bool " bzip2 debian packages"
default n
depends on CONFIG_DPKG || CONFIG_DPKG_DEB
help
This allows dpkg and dpkg-deb to extract deb's that are compressed internally
with bzip2 instead of gzip.
You only want this is your are creating your own custom debian packages that
use an internal control.tar.bz2 or data.tar.bz2.
config CONFIG_GUNZIP
bool "gunzip"
default n
@@ -129,7 +110,7 @@ config CONFIG_FEATURE_GUNZIP_UNCOMPRESS
default n
depends on CONFIG_GUNZIP
help
If you want gunzip to have the ability to decompress
Enable if you want gunzip to have the ability to decompress
archives created by the program compress (not much
used anymore).
@@ -138,7 +119,7 @@ config CONFIG_GZIP
default n
help
gzip is used to compress files.
It's probably the most used UNIX compression program.
It's probably the most widely used UNIX compression program.
config CONFIG_RPM2CPIO
bool "rpm2cpio"
@@ -150,14 +131,14 @@ config CONFIG_RPM
bool "rpm"
default n
help
Mini RPM applet - querys and extracts
Mini RPM applet - queries and extracts
config CONFIG_TAR
bool "tar"
default n
help
tar is an archiving program. It's commonly used with gzip to
create compressed archives. It's probably the most used
create compressed archives. It's probably the most widely used
UNIX archive program.
config CONFIG_FEATURE_TAR_CREATE
@@ -176,13 +157,13 @@ config CONFIG_FEATURE_TAR_BZIP2
If you enable this option you'll be able to extract
archives compressed with bzip2.
config CONFIG_FEATURE_TAR_EXCLUDE
bool " Enable -X and --exclude options (exclude files)"
config CONFIG_FEATURE_TAR_FROM
bool " Enable -X (exclude from) and -T (include from) options)"
default n
depends on CONFIG_TAR
help
If you enable this option you'll be able to specify
a list of files to exclude from an archive.
a list of files to include or exclude from an archive.
config CONFIG_FEATURE_TAR_GZIP
bool " Enable -z option"
@@ -192,13 +173,21 @@ config CONFIG_FEATURE_TAR_GZIP
If you enable this option tar will be able to call gzip,
when creating or extracting tar gziped archives.
config CONFIG_FEATURE_TAR_COMPRESS
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"
default N
depends on CONFIG_TAR
help
This option is required to unpack archives created with
in the old GNU format, help to kill this old format by
This option is required to unpack archives created in
the old GNU format; help to kill this old format by
repacking your ancient archives with the new format.
config CONFIG_FEATURE_TAR_GNU_EXTENSIONS
@@ -209,12 +198,12 @@ config CONFIG_FEATURE_TAR_GNU_EXTENSIONS
With this option busybox supports GNU long filenames and
linknames.
config CONFIG_FEATURE_UNARCHIVE_TAPE
bool " Enable tape drive support"
config CONFIG_FEATURE_TAR_LONG_OPTIONS
bool " Enable long options"
default n
depends on CONFIG_TAR || CONFIG_CPIO
depends on CONFIG_TAR
help
I dont think this is needed anymore.
Enable use of long options, increases size by about 400 Bytes
config CONFIG_UNCOMPRESS
bool "uncompress"
@@ -233,4 +222,37 @@ config CONFIG_UNZIP
current directory. Use the `-d' option to extract to a
directory of your choice.
comment "Common options for cpio and tar"
depends on CONFIG_CPIO || CONFIG_TAR
config CONFIG_FEATURE_UNARCHIVE_TAPE
bool " Enable tape drive support"
default n
depends on CONFIG_CPIO || CONFIG_TAR
help
I don't think this is needed anymore.
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)"
default y if CONFIG_DPKG || CONFIG_DPKG_DEB
depends on CONFIG_DPKG || CONFIG_DPKG_DEB
help
This is the default compression method inside the debian ar file.
If you want compatibility with standard .deb's you should say yes here.
config CONFIG_FEATURE_DEB_TAR_BZ2
bool " bzip2 debian packages"
default n
depends on CONFIG_DPKG || CONFIG_DPKG_DEB
help
This allows dpkg and dpkg-deb to extract deb's that are compressed internally
with bzip2 instead of gzip.
You only want this if you are creating your own custom debian packages that
use an internal control.tar.bz2 or data.tar.bz2.
endmenu
+32 -70
View File
@@ -21,20 +21,20 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* There is no signle standard to adhere to so ar may not portable
* There is no single standard to adhere to so ar may not portable
* between different systems
* http://www.unix-systems.org/single_unix_specification_v2/xcu/ar.html
*/
#include <sys/types.h>
#include <fcntl.h>
#include <fnmatch.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <utime.h>
#include <unistd.h>
#include <getopt.h>
#include "unarchive.h"
#include "busybox.h"
@@ -50,87 +50,50 @@ static void header_verbose_list_ar(const file_header_t *file_header)
printf("%s %d/%d%7d %s %s\n", &mode[1], file_header->uid, file_header->gid, (int) file_header->size, &mtime[4], file_header->name);
}
#if !defined CONFIG_TAR && !defined CONFIG_DPKG_DEB && !defined CONFIG_CPIO
/* This is simpler than data_extract_all */
static void data_extract_regular_file(archive_handle_t *archive_handle)
{
file_header_t *file_header;
int dst_fd;
file_header = archive_handle->file_header;
dst_fd = bb_xopen(file_header->name, O_WRONLY | O_CREAT);
archive_copy_file(archive_handle, dst_fd);
close(dst_fd);
chmod(file_header->name, file_header->mode);
chown(file_header->name, file_header->uid, file_header->gid);
if (archive_handle->flags & ARCHIVE_PRESERVE_DATE) {
struct utimbuf t;
t.actime = t.modtime = file_header->mtime;
utime(file_header->name, &t);
}
return;
}
#endif
#define AR_CTX_PRINT 1
#define AR_CTX_LIST 2
#define AR_CTX_EXTRACT 4
#define AR_OPT_PRESERVE_DATE 8
#define AR_OPT_VERBOSE 16
extern int ar_main(int argc, char **argv)
{
archive_handle_t *archive_handle;
int opt;
#if !defined CONFIG_DPKG_DEB && !defined CONFIG_DPKG
unsigned long opt;
char magic[8];
#endif
archive_handle = init_handle();
while ((opt = getopt(argc, argv, "covtpxX")) != -1) {
switch (opt) {
case 'p': /* print */
archive_handle->action_data = data_extract_to_stdout;
break;
case 't': /* list contents */
archive_handle->action_header = header_list;
break;
case 'X':
archive_handle->action_header = header_verbose_list_ar;
case 'x': /* extract */
#if defined CONFIG_TAR || defined CONFIG_DPKG_DEB || defined CONFIG_CPIO
archive_handle->action_data = data_extract_all;
#else
archive_handle->action_data = data_extract_regular_file;
#endif
break;
/* Modifiers */
case 'o': /* preserve original dates */
archive_handle->flags |= ARCHIVE_PRESERVE_DATE;
break;
case 'v': /* verbose */
archive_handle->action_header = header_verbose_list_ar;
break;
default:
bb_show_usage();
}
}
/* check the src filename was specified */
if (optind == argc) {
bb_opt_complementaly = "p~tx:t~px:x~pt";
opt = bb_getopt_ulflags(argc, argv, "ptxov");
if ((opt & 0x80000000UL) || (optind == argc)) {
bb_show_usage();
}
if (opt & AR_CTX_PRINT) {
archive_handle->action_data = data_extract_to_stdout;
}
if (opt & AR_CTX_LIST) {
archive_handle->action_header = header_list;
}
if (opt & AR_CTX_EXTRACT) {
archive_handle->action_data = data_extract_all;
}
if (opt & AR_OPT_PRESERVE_DATE) {
archive_handle->flags |= ARCHIVE_PRESERVE_DATE;
}
if (opt & AR_OPT_VERBOSE) {
archive_handle->action_header = header_verbose_list_ar;
}
archive_handle->src_fd = bb_xopen(argv[optind++], O_RDONLY);
/* TODO: This is the same as in tar, seperate function ? */
while (optind < argc) {
archive_handle->filter = filter_accept_list;
archive_handle->accept = llist_add_to(archive_handle->accept, argv[optind]);
optind++;
archive_handle->accept = llist_add_to(archive_handle->accept, argv[optind++]);
}
#if defined CONFIG_DPKG_DEB || defined CONFIG_DPKG
unpack_ar_archive(archive_handle);
#else
archive_xread_all(archive_handle, magic, 7);
if (strncmp(magic, "!<arch>", 7) != 0) {
bb_error_msg_and_die("Invalid ar magic");
@@ -138,7 +101,6 @@ extern int ar_main(int argc, char **argv)
archive_handle->offset += 7;
while (get_header_ar(archive_handle) == EXIT_SUCCESS);
#endif
return EXIT_SUCCESS;
}
+32 -46
View File
@@ -27,76 +27,62 @@
#include "busybox.h"
#include "unarchive.h"
#define BUNZIP2_OPT_STDOUT 1
#define BUNZIP2_OPT_FORCE 2
int bunzip2_main(int argc, char **argv)
{
const int bunzip_to_stdout = 1;
const int bunzip_force = 2;
int flags = 0;
int opt = 0;
char *compressed_name;
char *save_name;
unsigned long opt;
int status;
int src_fd;
int dst_fd;
char *save_name = NULL;
char *delete_name = NULL;
/* if called as bzcat */
if (strcmp(bb_applet_name, "bzcat") == 0)
flags |= bunzip_to_stdout;
opt = bb_getopt_ulflags(argc, argv, "cf");
while ((opt = getopt(argc, argv, "cfh")) != -1) {
switch (opt) {
case 'c':
flags |= bunzip_to_stdout;
break;
case 'f':
flags |= bunzip_force;
break;
case 'h':
default:
bb_show_usage(); /* exit's inside usage */
}
/* if called as bzcat force the stdout flag */
if (bb_applet_name[2] == 'c') {
opt |= BUNZIP2_OPT_STDOUT;
}
/* Set input filename and number */
if (argv[optind] == NULL || strcmp(argv[optind], "-") == 0) {
flags |= bunzip_to_stdout;
src_fd = fileno(stdin);
} else {
compressed_name = argv[optind];
if ((compressed_name) && (compressed_name[0] != '-') && (compressed_name[1] != '\0')) {
/* Open input file */
src_fd = bb_xopen(argv[optind], O_RDONLY);
save_name = bb_xstrdup(argv[optind]);
if (strcmp(save_name + strlen(save_name) - 4, ".bz2") != 0)
bb_error_msg_and_die("Invalid extension");
save_name[strlen(save_name) - 4] = '\0';
src_fd = bb_xopen(compressed_name, O_RDONLY);
} else {
src_fd = fileno(stdin);
opt |= BUNZIP2_OPT_STDOUT;
}
/* Check that the input is sane. */
if (isatty(src_fd) && (flags & bunzip_force) == 0) {
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.");
}
if (flags & bunzip_to_stdout) {
if (opt & BUNZIP2_OPT_STDOUT) {
dst_fd = fileno(stdout);
} else {
int len = strlen(compressed_name) - 4;
if (strcmp(compressed_name + len, ".bz2") != 0) {
bb_error_msg_and_die("Invalid extension");
}
save_name = bb_xstrndup(compressed_name, len);
dst_fd = bb_xopen(save_name, O_WRONLY | O_CREAT);
}
if (uncompressStream(src_fd, dst_fd)) {
if (!(flags & bunzip_to_stdout)) {
delete_name = argv[optind];
}
status = EXIT_SUCCESS;
} else {
if (!(flags & bunzip_to_stdout)) {
status = uncompressStream(src_fd, dst_fd);
if(!(opt & BUNZIP2_OPT_STDOUT)) {
char *delete_name;
if (status) {
delete_name = save_name;
} else {
delete_name = compressed_name;
}
if (unlink(delete_name) < 0) {
bb_error_msg_and_die("Couldn't remove %s", delete_name);
}
status = EXIT_FAILURE;
}
if ((delete_name) && (unlink(delete_name) < 0)) {
bb_error_msg_and_die("Couldn't remove %s", delete_name);
}
return status;
+15 -5
View File
@@ -40,8 +40,8 @@ extern int cpio_main(int argc, char **argv)
archive_handle = init_handle();
archive_handle->src_fd = fileno(stdin);
archive_handle->seek = seek_by_char;
archive_handle->action_header = header_list;
archive_handle->flags = ARCHIVE_EXTRACT_NEWER | ARCHIVE_PRESERVE_DATE;
while ((opt = getopt(argc, argv, "idmuvtF:")) != -1) {
switch (opt) {
case 'i': /* extract */
@@ -50,17 +50,28 @@ extern int cpio_main(int argc, char **argv)
case 'd': /* create _leading_ directories */
archive_handle->flags |= ARCHIVE_CREATE_LEADING_DIRS;
break;
#if 0
case 'm': /* preserve modification time */
archive_handle->flags |= ARCHIVE_PRESERVE_DATE;
break;
#endif
case 'v': /* verbosly list files */
archive_handle->action_header = header_verbose_list;
if (archive_handle->action_header == header_list) {
archive_handle->action_header = header_verbose_list;
} else {
archive_handle->action_header = header_list;
}
break;
case 'u': /* unconditional */
archive_handle->flags |= ARCHIVE_EXTRACT_UNCONDITIONAL;
archive_handle->flags &= ~ARCHIVE_EXTRACT_NEWER;
break;
case 't': /* list files */
archive_handle->action_header = header_list;
if (archive_handle->action_header == header_list) {
archive_handle->action_header = header_verbose_list;
} else {
archive_handle->action_header = header_list;
}
break;
case 'F':
archive_handle->src_fd = bb_xopen(optarg, O_RDONLY);
@@ -81,4 +92,3 @@ extern int cpio_main(int argc, char **argv)
return(EXIT_SUCCESS);
}
+286 -106
View File
@@ -27,11 +27,8 @@
* consider important, its worth keeping a note of differences anyway, just to
* make it easier to maintain.
* - The first value for the Confflile: field isnt placed on a new line.
* - The <package>.control file is extracted and kept in the info dir.
* - When installing a package the Status: field is placed at the end of the
* section, rather than just after the Package: field.
* - Packages with previously unknown status are inserted at the begining of
* the status file
*
* Bugs that need to be fixed
* - (unknown, please let me know when you find any)
@@ -392,8 +389,54 @@ int search_package_hashtable(const unsigned int name, const unsigned int version
return(probe_address);
}
/*
* This function searches through the entire package_hashtable looking
* for a package which provides "needle". It returns the index into
* the package_hashtable for the provining package.
*
* needle is the index into name_hashtable of the package we are
* looking for.
*
* start_at is the index in the package_hashtable to start looking
* at. If start_at is -1 then start at the beginning. This is to allow
* for repeated searches since more than one package might provide
* needle.
*
* FIXME: I don't think this is very efficient, but I thought I'd keep
* it simple for now until it proves to be a problem.
*/
int search_for_provides(int needle, int start_at) {
int i, j;
common_node_t *p;
for (i = start_at + 1; i < PACKAGE_HASH_PRIME; i++) {
p = package_hashtable[i];
if ( p == NULL ) continue;
for(j = 0; j < p->num_of_edges; j++)
if ( p->edge[j]->type == EDGE_PROVIDES && p->edge[j]->name == needle )
return i;
}
return -1;
}
/*
* Add an edge to a node
*/
void add_edge_to_node(common_node_t *node, edge_t *edge)
{
node->num_of_edges++;
node->edge = xrealloc(node->edge, sizeof(edge_t) * (node->num_of_edges + 1));
node->edge[node->num_of_edges - 1] = edge;
}
/*
* Create one new node and one new edge for every dependency.
*
* Dependencies which contain multiple alternatives are represented as
* an EDGE_OR_PRE_DEPENDS or EDGE_OR_DEPENDS node, followed by a
* number of EDGE_PRE_DEPENDS or EDGE_DEPENDS nodes. The name field of
* the OR edge contains the full dependency string while the version
* field contains the number of EDGE nodes which follow as part of
* this alternative.
*/
void add_split_dependencies(common_node_t *parent_node, const char *whole_line, unsigned int edge_type)
{
@@ -405,25 +448,33 @@ void add_split_dependencies(common_node_t *parent_node, const char *whole_line,
char *field2;
char *version;
edge_t *edge;
edge_t *or_edge;
int offset_ch;
int type;
field = strtok_r(line, ",", &line_ptr1);
do {
/* skip leading spaces */
field += strspn(field, " ");
line2 = bb_xstrdup(field);
field2 = strtok_r(line2, "|", &line_ptr2);
if ((edge_type == EDGE_DEPENDS) && (strcmp(field, field2) != 0)) {
type = EDGE_OR_DEPENDS;
}
else if ((edge_type == EDGE_PRE_DEPENDS) && (strcmp(field, field2) != 0)) {
type = EDGE_OR_PRE_DEPENDS;
if ( (edge_type == EDGE_DEPENDS || edge_type == EDGE_PRE_DEPENDS) &&
(strcmp(field, field2) != 0)) {
or_edge = (edge_t *)xmalloc(sizeof(edge_t));
or_edge->type = edge_type + 1;
} else {
type = edge_type;
or_edge = NULL;
}
if ( or_edge ) {
or_edge->name = search_name_hashtable(field);
or_edge->version = 0; // tracks the number of altenatives
add_edge_to_node(parent_node, or_edge);
}
do {
edge = (edge_t *) xmalloc(sizeof(edge_t));
edge->type = type;
edge->type = edge_type;
/* Skip any extra leading spaces */
field2 += strspn(field2, " ");
@@ -473,11 +524,11 @@ void add_split_dependencies(common_node_t *parent_node, const char *whole_line,
/* Get the dependency name */
field2[strcspn(field2, " (")] = '\0';
edge->name = search_name_hashtable(field2);
/* link the new edge to the current node */
parent_node->num_of_edges++;
parent_node->edge = xrealloc(parent_node->edge, sizeof(edge_t) * (parent_node->num_of_edges + 1));
parent_node->edge[parent_node->num_of_edges - 1] = edge;
if ( or_edge )
or_edge->version++;
add_edge_to_node(parent_node, edge);
} while ((field2 = strtok_r(NULL, "|", &line_ptr2)) != NULL);
free(line2);
} while ((field = strtok_r(NULL, ",", &line_ptr1)) != NULL);
@@ -493,7 +544,8 @@ void free_package(common_node_t *node)
for (i = 0; i < node->num_of_edges; i++) {
free(node->edge[i]);
}
free(node->edge);
if ( node->edge )
free(node->edge);
free(node);
}
}
@@ -630,6 +682,31 @@ void set_status(const unsigned int status_node_num, const char *new_value, const
return;
}
const char *describe_status(int status_num) {
int status_want, status_state ;
if ( status_hashtable[status_num] == NULL || status_hashtable[status_num]->status == 0 )
return "is not installed or flagged to be installed\n";
status_want = get_status(status_num, 1);
status_state = get_status(status_num, 3);
if ( status_state == search_name_hashtable("installed") ) {
if ( status_want == search_name_hashtable("install") )
return "is installed";
if ( status_want == search_name_hashtable("deinstall") )
return "is marked to be removed";
if ( status_want == search_name_hashtable("purge") )
return "is marked to be purged";
}
if ( status_want == search_name_hashtable("unknown") )
return "is in an indeterminate state";
if ( status_want == search_name_hashtable("install") )
return "is marked to be installed";
return "is not installed or flagged to be installed";
}
void index_status_file(const char *filename)
{
FILE *status_file;
@@ -662,7 +739,7 @@ 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;
@@ -733,6 +810,7 @@ char *get_depends_field(common_node_t *package, const int depends_type)
}
return(depends);
}
#endif
void write_buffer_no_status(FILE *new_status_file, const char *control_buffer)
{
@@ -893,13 +971,34 @@ void write_status_file(deb_file_t **deb_file)
}
}
/* This function returns TRUE if the given package can statisfy a
* dependency of type depend_type.
*
* A pre-depends is statisfied only if a package is already installed,
* which a regular depends can be satisfied by a package which we want
* to install.
*/
int package_satisfies_dependency(int package, int depend_type)
{
int status_num = search_status_hashtable(name_hashtable[package_hashtable[package]->name]);
/* status could be unknown if package is a pure virtual
* provides which cannot satisfy any dependency by itself.
*/
if ( status_hashtable[status_num] == NULL )
return 0;
switch (depend_type) {
case EDGE_PRE_DEPENDS: return get_status(status_num, 3) == search_name_hashtable("installed");
case EDGE_DEPENDS: return get_status(status_num, 1) == search_name_hashtable("install");
}
return 0;
}
int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
{
int *conflicts = NULL;
int conflicts_num = 0;
int state_status;
int state_flag;
int state_want;
int i = deb_start;
int j;
@@ -955,21 +1054,17 @@ int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
for (j = 0; j < package_node->num_of_edges; j++) {
const edge_t *package_edge = package_node->edge[j];
const unsigned int package_num =
search_package_hashtable(package_edge->name,
package_edge->version, package_edge->operator);
if (package_edge->type == EDGE_CONFLICTS) {
const unsigned int package_num =
search_package_hashtable(package_edge->name,
package_edge->version,
package_edge->operator);
int result = 0;
if (package_hashtable[package_num] != NULL) {
status_num = search_status_hashtable(name_hashtable[package_hashtable[package_num]->name]);
state_status = get_status(status_num, 3);
state_flag = get_status(status_num, 1);
result = (state_status == search_name_hashtable("installed")) ||
(state_flag == search_name_hashtable("want-install"));
if (result) {
if (get_status(status_num, 1) == search_name_hashtable("install")) {
result = test_version(package_hashtable[deb_file[i]->package]->version,
package_edge->version, package_edge->operator);
}
@@ -987,66 +1082,123 @@ int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
/* Check dependendcies */
i = 0;
while (deb_file[i] != NULL) {
const common_node_t *package_node = package_hashtable[deb_file[i]->package];
for (i = 0; i < PACKAGE_HASH_PRIME; i++) {
int status_num = 0;
int number_of_alternatives = 0;
const edge_t * root_of_alternatives;
const common_node_t *package_node = package_hashtable[i];
status_num = search_status_hashtable(name_hashtable[package_node->name]);
state_status = get_status(status_num, 3);
state_want = get_status(status_num, 1);
/* If the package node does not exist then this
* package is a virtual one. In which case there are
* no dependencies to check.
*/
if ( package_node == NULL ) continue;
if (state_status == search_name_hashtable("installed")) {
i++;
status_num = search_status_hashtable(name_hashtable[package_node->name]);
/* If there is no status then this package is a
* virtual one provided by something else. In which
* case there are no dependencies to check.
*/
if ( status_hashtable[status_num] == NULL ) continue;
/* If we don't want this package installed then we may
* as well ignore it's dependencies.
*/
if (get_status(status_num, 1) != search_name_hashtable("install")) {
continue;
}
for (j = 0; j < package_hashtable[deb_file[i]->package]->num_of_edges; j++) {
#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, sine I
* have no suitable pre-depends available. There is no
* reason that it shouldn't work though :-)
*/
for (j = 0; j < package_node->num_of_edges; j++) {
const edge_t *package_edge = package_node->edge[j];
unsigned int package_num;
if ( package_edge->type == EDGE_OR_PRE_DEPENDS ||
package_edge->type == EDGE_OR_DEPENDS ) { /* start an EDGE_OR_ list */
number_of_alternatives = package_edge->version;
root_of_alternatives = package_edge;
continue;
} else if ( number_of_alternatives == 0 ) { /* not in the middle of an EDGE_OR_ list */
number_of_alternatives = 1;
root_of_alternatives = NULL;
}
package_num = search_package_hashtable(package_edge->name, package_edge->version, package_edge->operator);
switch (package_edge->type) {
case(EDGE_PRE_DEPENDS):
case(EDGE_OR_PRE_DEPENDS): {
int result=1;
/* It must be already installed */
/* NOTE: This is untested, nothing apropriate in my status file */
if (package_hashtable[package_num] != NULL) {
status_num = search_status_hashtable(name_hashtable[package_hashtable[package_num]->name]);
state_status = get_status(status_num, 3);
state_want = get_status(status_num, 1);
result = (state_status != search_name_hashtable("installed"));
}
if (package_edge->type == EDGE_PRE_DEPENDS ||
package_edge->type == EDGE_DEPENDS ) {
int result=1;
status_num = 0;
if (result) {
bb_error_msg_and_die("Package %s pre-depends on %s, but it is not installed",
name_hashtable[package_node->name],
name_hashtable[package_edge->name]);
/* If we are inside an alternative then check
* this edge is the right type.
*
* EDGE_DEPENDS == OR_DEPENDS -1
* EDGE_PRE_DEPENDS == OR_PRE_DEPENDS -1
*/
if ( root_of_alternatives && package_edge->type != root_of_alternatives->type - 1)
bb_error_msg_and_die("Fatal error. Package dependencies corrupt: %d != %d - 1 \n",
package_edge->type, root_of_alternatives->type);
if (package_hashtable[package_num] != NULL)
result = !package_satisfies_dependency(package_num, package_edge->type);
if (result) { /* check for other package which provide what we are looking for */
int provider = -1;
while ( (provider = search_for_provides(package_edge->name, provider) ) > -1 ) {
if ( package_hashtable[provider] == NULL ) {
printf("Have a provider but no package information for it\n");
continue;
}
result = !package_satisfies_dependency(provider, package_edge->type);
if ( result == 0 )
break;
}
break;
}
case(EDGE_DEPENDS):
case(EDGE_OR_DEPENDS): {
int result=1;
if (package_hashtable[package_num] != NULL) {
status_num = search_status_hashtable(name_hashtable[package_hashtable[package_num]->name]);
state_status = get_status(status_num, 3);
state_want = get_status(status_num, 1);
result=(state_status != search_name_hashtable("installed")) && (state_want != search_name_hashtable("want-install"));
}
/* It must be already installed, or to be installed */
if (result) {
bb_error_msg_and_die("Package %s depends on %s, but it is not installed, or flaged to be installed",
/* It must be already installed, or to be installed */
number_of_alternatives--;
if (result && number_of_alternatives == 0) {
if ( root_of_alternatives )
bb_error_msg_and_die(
"Package %s %sdepends on %s, "
"which cannot be satisfied",
name_hashtable[package_node->name],
name_hashtable[package_edge->name]);
}
break;
package_edge->type == EDGE_PRE_DEPENDS ? "pre-" : "",
name_hashtable[root_of_alternatives->name]);
else
bb_error_msg_and_die(
"Package %s %sdepends on %s, which %s\n",
name_hashtable[package_node->name],
package_edge->type == EDGE_PRE_DEPENDS ? "pre-" : "",
name_hashtable[package_edge->name],
describe_status(status_num));
} else if ( result == 0 && number_of_alternatives ) {
/* we've found a package which
* satisfies the dependency,
* so skip over the rest of
* the alternatives.
*/
j += number_of_alternatives;
number_of_alternatives = 0;
}
}
}
i++;
}
free(conflicts);
return(TRUE);
@@ -1138,21 +1290,22 @@ int run_package_script(const char *package_name, const char *script_type)
return(result);
}
const char *all_control_files[] = {"preinst", "postinst", "prerm", "postrm",
"list", "md5sums", "shlibs", "conffiles", "config", "templates", NULL };
char **all_control_list(const char *package_name)
{
const char *extensions[11] = {"preinst", "postinst", "prerm", "postrm",
"list", "md5sums", "shlibs", "conffiles", "config", "templates", NULL };
unsigned short i = 0;
char **remove_files;
/* Create a list of all /var/lib/dpkg/info/<package> files */
remove_files = malloc(sizeof(char *) * 11);
while (extensions[i]) {
remove_files[i] = xmalloc(strlen(package_name) + strlen(extensions[i]) + 21);
sprintf(remove_files[i], "/var/lib/dpkg/info/%s.%s", package_name, extensions[i]);
remove_files = malloc(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]);
i++;
}
remove_files[10] = NULL;
remove_files[sizeof(all_control_files)/sizeof(char*) - 1] = NULL;
return(remove_files);
}
@@ -1211,9 +1364,10 @@ void list_packages(void)
}
}
void remove_package(const unsigned int package_num)
void remove_package(const unsigned int package_num, int noisy)
{
const char *package_name = name_hashtable[package_hashtable[package_num]->name];
const char *package_version = name_hashtable[package_hashtable[package_num]->version];
const unsigned int status_num = search_status_hashtable(package_name);
const int package_name_length = strlen(package_name);
char **remove_files;
@@ -1222,7 +1376,8 @@ void remove_package(const unsigned int package_num)
char conffile_name[package_name_length + 30];
int return_value;
printf("Removing %s ...\n", package_name);
if ( noisy )
printf("Removing %s (%s) ...\n", package_name, package_version);
/* run prerm script */
return_value = run_package_script(package_name, "prerm");
@@ -1260,18 +1415,20 @@ void remove_package(const unsigned int package_num)
rename(conffile_name, list_name);
/* Change package status */
set_status(status_num, "deinstall", 1);
set_status(status_num, "config-files", 3);
}
void purge_package(const unsigned int package_num)
{
const char *package_name = name_hashtable[package_hashtable[package_num]->name];
const char *package_version = name_hashtable[package_hashtable[package_num]->version];
const unsigned int status_num = search_status_hashtable(package_name);
char **remove_files;
char **exclude_files;
char list_name[strlen(package_name) + 25];
printf("Purging %s (%s) ...\n", package_name, package_version);
/* run prerm script */
if (run_package_script(package_name, "prerm") != 0) {
bb_error_msg_and_die("script failed, prerm failure");
@@ -1300,7 +1457,6 @@ void purge_package(const unsigned int package_num)
}
/* Change package status */
set_status(status_num, "purge", 1);
set_status(status_num, "not-installed", 3);
}
@@ -1322,7 +1478,6 @@ static void init_archive_deb_control(archive_handle_t *ar_handle)
/* Setup the tar archive handle */
tar_handle = init_handle();
tar_handle->filter = filter_accept_list;
tar_handle->src_fd = ar_handle->src_fd;
/* We dont care about data.tar.* or debian-binary, just control.tar.* */
@@ -1345,15 +1500,14 @@ static void init_archive_deb_data(archive_handle_t *ar_handle)
/* Setup the tar archive handle */
tar_handle = init_handle();
tar_handle->filter = filter_accept_all;
tar_handle->src_fd = ar_handle->src_fd;
/* We dont care about data.tar.* or debian-binary, just control.tar.* */
/* We dont care about control.tar.* or debian-binary, just data.tar.* */
#ifdef CONFIG_FEATURE_DEB_TAR_GZ
tar_handle->accept = llist_add_to(NULL, "data.tar.gz");
ar_handle->accept = llist_add_to(NULL, "data.tar.gz");
#endif
#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
tar_handle->accept = llist_add_to(ar_handle->accept, "data.tar.bz2");
ar_handle->accept = llist_add_to(ar_handle->accept, "data.tar.bz2");
#endif
/* Assign the tar handle as a subarchive of the ar handle */
@@ -1362,10 +1516,10 @@ static void init_archive_deb_data(archive_handle_t *ar_handle)
return;
}
static char *deb_extract_control_file_to_buffer(archive_handle_t *ar_handle, llist_t *accept)
static char *deb_extract_control_file_to_buffer(archive_handle_t *ar_handle, llist_t *myaccept)
{
ar_handle->sub_archive->action_data = data_extract_to_buffer;
ar_handle->sub_archive->accept = accept;
ar_handle->sub_archive->accept = myaccept;
unpack_ar_archive(ar_handle);
close(ar_handle->src_fd);
@@ -1395,6 +1549,8 @@ static void unpack_package(deb_file_t *deb_file)
char *info_prefix;
archive_handle_t *archive_handle;
FILE *out_stream;
llist_t *accept_list = NULL;
int i = 0;
/* If existing version, remove it first */
if (strcmp(name_hashtable[get_status(status_num, 3)], "installed") == 0) {
@@ -1402,7 +1558,7 @@ static void unpack_package(deb_file_t *deb_file)
printf("Preparing to replace %s %s (using %s) ...\n", package_name,
name_hashtable[package_hashtable[status_package_num]->version],
deb_file->filename);
remove_package(status_package_num);
remove_package(status_package_num, 0);
} else {
printf("Unpacking %s (from %s) ...\n", package_name, deb_file->filename);
}
@@ -1412,8 +1568,18 @@ static void unpack_package(deb_file_t *deb_file)
sprintf(info_prefix, "/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);
i++;
}
archive_handle->sub_archive->accept = accept_list;
archive_handle->sub_archive->filter = filter_accept_list;
archive_handle->sub_archive->action_data = data_extract_all_prefix;
archive_handle->sub_archive->buffer = info_prefix;
archive_handle->sub_archive->flags |= ARCHIVE_EXTRACT_UNCONDITIONAL;
unpack_ar_archive(archive_handle);
/* Run the preinst prior to extracting */
@@ -1425,16 +1591,19 @@ static void unpack_package(deb_file_t *deb_file)
/* Extract data.tar.gz to the root directory */
archive_handle = init_archive_deb_ar(deb_file->filename);
init_archive_deb_data(archive_handle);
archive_handle->sub_archive->action_data = data_extract_all_prefix;
archive_handle->sub_archive->buffer = "/";
archive_handle->sub_archive->flags |= ARCHIVE_EXTRACT_UNCONDITIONAL;
unpack_ar_archive(archive_handle);
/* Create the list file */
strcat(info_prefix, "list");
out_stream = bb_xfopen(info_prefix, "w");
while (archive_handle->passed) {
/* blindly skip over the leading '.' */
fputs(archive_handle->passed->data + 1, out_stream);
while (archive_handle->sub_archive->passed) {
/* the leading . has been stripped by data_extract_all_prefix already */
fputs(archive_handle->sub_archive->passed->data, out_stream);
fputc('\n', out_stream);
archive_handle->passed = archive_handle->passed->link;
archive_handle->sub_archive->passed = archive_handle->sub_archive->passed->link;
}
fclose(out_stream);
@@ -1451,7 +1620,7 @@ void configure_package(deb_file_t *deb_file)
const char *package_version = name_hashtable[package_hashtable[deb_file->package]->version];
const int status_num = search_status_hashtable(package_name);
printf("Setting up %s (%s)\n", package_name, package_version);
printf("Setting up %s (%s) ...\n", package_name, package_version);
/* Run the postinst script */
if (run_package_script(package_name, "postinst") != 0) {
@@ -1485,6 +1654,7 @@ int dpkg_main(int argc, char **argv)
if (strcmp(optarg, "depends") == 0) {
dpkg_opt |= dpkg_opt_force_ignore_depends;
}
break;
case 'i':
dpkg_opt |= dpkg_opt_install;
dpkg_opt |= dpkg_opt_filename;
@@ -1550,19 +1720,20 @@ int dpkg_main(int argc, char **argv)
/* Add the package to the status hashtable */
if ((dpkg_opt & dpkg_opt_unpack) || (dpkg_opt & dpkg_opt_install)) {
status_node = (status_node_t *) xmalloc(sizeof(status_node_t));
status_node->package = deb_file[deb_count]->package;
/* Try and find a currently installed version of this package */
status_num = search_status_hashtable(name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]);
/* If no previous entry was found initialise a new entry */
if ((status_hashtable[status_num] == NULL) ||
(status_hashtable[status_num]->status == 0)) {
status_node = (status_node_t *) xmalloc(sizeof(status_node_t));
status_node->package = deb_file[deb_count]->package;
/* reinstreq isnt changed to "ok" until the package control info
* is written to the status file*/
status_node->status = search_name_hashtable("want-install reinstreq not-installed");
status_node->status = search_name_hashtable("install reinstreq not-installed");
status_hashtable[status_num] = status_node;
} else {
status_hashtable[status_num]->status = search_name_hashtable("want-install reinstreq not-installed");
set_status(status_num, "install", 1);
set_status(status_num, "reinstreq", 2);
}
}
}
@@ -1575,20 +1746,24 @@ int dpkg_main(int argc, char **argv)
if (package_hashtable[deb_file[deb_count]->package] == NULL) {
bb_error_msg_and_die("Package %s is uninstalled or unknown\n", argv[optind]);
}
state_status = get_status(search_status_hashtable(name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]), 3);
package_num = deb_file[deb_count]->package;
status_num = search_status_hashtable(name_hashtable[package_hashtable[package_num]->name]);
state_status = get_status(status_num, 3);
/* check package status is "installed" */
if (dpkg_opt & dpkg_opt_remove) {
if ((strcmp(name_hashtable[state_status], "not-installed") == 0) ||
(strcmp(name_hashtable[state_status], "config-files") == 0)) {
bb_error_msg_and_die("%s is already removed.", name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]);
bb_error_msg_and_die("%s is already removed.", name_hashtable[package_hashtable[package_num]->name]);
}
set_status(status_num, "deinstall", 1);
}
else if (dpkg_opt & dpkg_opt_purge) {
/* if package status is "conf-files" then its ok */
if (strcmp(name_hashtable[state_status], "not-installed") == 0) {
bb_error_msg_and_die("%s is already purged.", name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]);
bb_error_msg_and_die("%s is already purged.", name_hashtable[package_hashtable[package_num]->name]);
}
set_status(status_num, "purge", 1);
}
}
deb_count++;
@@ -1597,17 +1772,17 @@ int dpkg_main(int argc, char **argv)
deb_file[deb_count] = NULL;
/* Check that the deb file arguments are installable */
/* TODO: check dependencies before removing */
if ((dpkg_opt & dpkg_opt_force_ignore_depends) != dpkg_opt_force_ignore_depends) {
if (!check_deps(deb_file, 0, deb_count)) {
bb_error_msg_and_die("Dependency check failed");
}
}
/* TODO: install or remove packages in the correct dependency order */
for (i = 0; i < deb_count; i++) {
/* Remove or purge packages */
if (dpkg_opt & dpkg_opt_remove) {
remove_package(deb_file[i]->package);
remove_package(deb_file[i]->package, 1);
}
else if (dpkg_opt & dpkg_opt_purge) {
purge_package(deb_file[i]->package);
@@ -1617,12 +1792,17 @@ int dpkg_main(int argc, char **argv)
}
else if (dpkg_opt & dpkg_opt_install) {
unpack_package(deb_file[i]);
configure_package(deb_file[i]);
/* package is configured in second pass below */
}
else if (dpkg_opt & dpkg_opt_configure) {
configure_package(deb_file[i]);
}
}
/* configure installed packages */
if (dpkg_opt & dpkg_opt_install) {
for (i = 0; i < deb_count; i++)
configure_package(deb_file[i]);
}
write_status_file(deb_file);
+49 -44
View File
@@ -12,24 +12,32 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>
#include "unarchive.h"
#include "busybox.h"
#define DPKG_DEB_OPT_CONTENTS 1
#define DPKG_DEB_OPT_CONTROL 2
#define DPKG_DEB_OPT_FIELD 4
#define DPKG_DEB_OPT_EXTRACT 8
#define DPKG_DEB_OPT_EXTRACT_VERBOSE 16
extern int dpkg_deb_main(int argc, char **argv)
{
archive_handle_t *ar_archive;
archive_handle_t *tar_archive;
int opt = 0;
#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
llist_t *control_tar_llist = NULL;
#endif
unsigned long opt;
char *extract_dir = NULL;
short argcount = 1;
/* Setup the tar archive handle */
tar_archive = init_handle();
@@ -40,53 +48,47 @@ extern int dpkg_deb_main(int argc, char **argv)
#ifdef CONFIG_FEATURE_DEB_TAR_GZ
ar_archive->accept = llist_add_to(NULL, "data.tar.gz");
# ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
control_tar_llist = llist_add_to(NULL, "control.tar.gz");
# endif
#endif
#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
ar_archive->accept = llist_add_to(ar_archive->accept, "data.tar.bz2");
# ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
control_tar_llist = llist_add_to(control_tar_llist, "control.tar.bz2");
# endif
#endif
#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
while ((opt = getopt(argc, argv, "cefXx")) != -1) {
#else
while ((opt = getopt(argc, argv, "x")) != -1) {
#endif
switch (opt) {
#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
case 'c':
tar_archive->action_header = header_verbose_list;
break;
case 'e':
ar_archive->accept = control_tar_llist;
tar_archive->action_data = data_extract_all;
break;
case 'f':
/* Print the entire control file
* 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");;
tar_archive->filter = filter_accept_list;
tar_archive->action_data = data_extract_to_stdout;
break;
case 'X':
tar_archive->action_header = header_list;
#endif
case 'x':
tar_archive->action_data = data_extract_all;
break;
default:
bb_show_usage();
bb_opt_complementaly = "c~efXx:e~cfXx:f~ceXx:X~cefx:x~cefX";
opt = bb_getopt_ulflags(argc, argv, "cefXx");
if (opt & DPKG_DEB_OPT_CONTENTS) {
tar_archive->action_header = header_verbose_list;
}
if (opt & DPKG_DEB_OPT_CONTROL) {
ar_archive->accept = control_tar_llist;
tar_archive->action_data = data_extract_all;
if (optind + 1 == argc) {
extract_dir = "./DEBIAN";
} else {
argcount++;
}
}
if (opt & DPKG_DEB_OPT_FIELD) {
/* Print the entire control file
* 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");;
tar_archive->filter = filter_accept_list;
tar_archive->action_data = data_extract_to_stdout;
}
if (opt & DPKG_DEB_OPT_EXTRACT) {
tar_archive->action_header = header_list;
}
if (opt & (DPKG_DEB_OPT_EXTRACT_VERBOSE | DPKG_DEB_OPT_EXTRACT)) {
tar_archive->action_data = data_extract_all;
argcount = 2;
}
if (optind + 2 < argc) {
if ((optind + argcount != argc) || (opt & 0x80000000UL)) {
bb_show_usage();
}
@@ -94,9 +96,13 @@ extern int dpkg_deb_main(int argc, char **argv)
/* Workout where to extract the files */
/* 2nd argument is a dir name */
mkdir(argv[optind], 0777);
chdir(argv[optind]);
if (argv[optind]) {
extract_dir = argv[optind];
}
if (extract_dir) {
mkdir(extract_dir, 0777);
chdir(extract_dir);
}
unpack_ar_archive(ar_archive);
/* Cleanup */
@@ -104,4 +110,3 @@ extern int dpkg_deb_main(int argc, char **argv)
return(EXIT_SUCCESS);
}
+12 -30
View File
@@ -71,37 +71,20 @@ static char *license_msg[] = {
#include "busybox.h"
#include "unarchive.h"
const char gunzip_to_stdout = 1;
const char gunzip_force = 2;
const char gunzip_test = 4;
#define GUNZIP_OPT_STDOUT 1
#define GUNZIP_OPT_FORCE 2
#define GUNZIP_OPT_TEST 4
#define GUNZIP_OPT_DECOMPRESS 8
extern int gunzip_main(int argc, char **argv)
{
char status = EXIT_SUCCESS;
char flags = 0;
int opt;
unsigned long opt;
opt = bb_getopt_ulflags(argc, argv, "cftd");
/* if called as zcat */
if (strcmp(bb_applet_name, "zcat") == 0) {
flags |= gunzip_to_stdout;
}
while ((opt = getopt(argc, argv, "ctfhd")) != -1) {
switch (opt) {
case 'c':
flags |= gunzip_to_stdout;
break;
case 'f':
flags |= gunzip_force;
break;
case 't':
flags |= gunzip_test;
break;
case 'd': /* Used to convert gzip to gunzip. */
break;
default:
bb_show_usage(); /* exit's inside usage */
}
opt |= GUNZIP_OPT_STDOUT;
}
do {
@@ -116,7 +99,7 @@ extern int gunzip_main(int argc, char **argv)
if (old_path == NULL || strcmp(old_path, "-") == 0) {
src_fd = fileno(stdin);
flags |= gunzip_to_stdout;
opt |= GUNZIP_OPT_STDOUT;
} else {
src_fd = bb_xopen(old_path, O_RDONLY);
@@ -127,15 +110,15 @@ extern int gunzip_main(int argc, char **argv)
}
/* Check that the input is sane. */
if (isatty(src_fd) && ((flags & gunzip_force) == 0)) {
if (isatty(src_fd) && ((opt & GUNZIP_OPT_FORCE) == 0)) {
bb_error_msg_and_die
("compressed data not read from terminal. Use -f to force it.");
}
/* Set output filename and number */
if (flags & gunzip_test) {
if (opt & GUNZIP_OPT_TEST) {
dst_fd = bb_xopen("/dev/null", O_WRONLY); /* why does test use filenum 2 ? */
} else if (flags & gunzip_to_stdout) {
} else if (opt & GUNZIP_OPT_STDOUT) {
dst_fd = fileno(stdout);
} else {
char *extension;
@@ -179,11 +162,10 @@ extern int gunzip_main(int argc, char **argv)
#endif
if (magic2 == 0x8b) {
check_header_gzip(src_fd);
status = inflate(src_fd, dst_fd);
status = inflate_gunzip(src_fd, dst_fd);
if (status != 0) {
bb_error_msg_and_die("Error inflating");
}
check_trailer_gzip(src_fd);
} else {
bb_error_msg_and_die("Invalid magic");
}
+1 -4
View File
@@ -305,8 +305,6 @@ DECLARE(ush, d_buf, DIST_BUFSIZE);
DECLARE(uch, window, 2L * WSIZE);
DECLARE(ush, tab_prefix, 1L << BITS);
static int crc_table_empty = 1;
static int foreground; /* set if program run in foreground */
static int method = DEFLATED; /* compression method */
static int exit_code = OK; /* program exit code */
@@ -387,14 +385,13 @@ static ulg updcrc(uch * s, unsigned n)
register ulg c; /* temporary variable */
static unsigned long crc_32_tab[256];
if (crc_table_empty) {
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. */
crc_32_tab[0] = 0x00000000L;
for (i = 1; i < 256; i++) {
csr = i;
/* The idea to initialize the register with the byte instead of
+26 -25
View File
@@ -31,46 +31,47 @@ LIBUNARCHIVE-y:= \
\
filter_accept_all.o \
filter_accept_list.o \
filter_accept_list_reassign.o \
filter_accept_reject_list.o \
\
get_header_ar.o \
get_header_cpio.o \
get_header_tar.o \
get_header_tar_bz2.o \
get_header_tar_gz.o \
\
header_skip.o \
header_list.o \
header_verbose_list.o \
\
archive_xread.o \
archive_xread_all.o \
archive_xread_all_eof.o \
archive_xread_char.o \
\
seek_by_char.o \
seek_by_jump.o \
\
archive_copy_file.o \
\
check_header_gzip.o \
data_align.o \
decompress_bunzip2.o \
find_list_entry.o \
init_handle.o \
uncompress.o \
unpack_ar_archive.o \
unzip.o
open_transformer.o \
init_handle.o
LIBUNARCHIVE-$(CONFIG_DPKG) +=
LIBUNARCHIVE-$(CONFIG_DPKG_DEB) +=
LIBUNARCHIVE-$(CONFIG_AR) +=
LIBUNARCHIVE-$(CONFIG_CPIO) +=
LIBUNARCHIVE-$(CONFIG_GUNZIP) +=
LIBUNARCHIVE-$(CONFIG_RPM2CPIO) +=
LIBUNARCHIVE-$(CONFIG_TAR) +=
LIBUNARCHIVE-$(CONFIG_UNZIP) +=
GUNZIP_FILES:= check_header_gzip.o unzip.o
DPKG_FILES:= \
get_header_ar.o \
unpack_ar_archive.o \
get_header_tar.o \
filter_accept_list_reassign.o
LIBUNARCHIVE-$(CONFIG_AR) += get_header_ar.o unpack_ar_archive.o
LIBUNARCHIVE-$(CONFIG_BUNZIP2) += decompress_bunzip2.o
LIBUNARCHIVE-$(CONFIG_CPIO) += get_header_cpio.o
LIBUNARCHIVE-$(CONFIG_DPKG) += $(DPKG_FILES)
LIBUNARCHIVE-$(CONFIG_DPKG_DEB) += $(DPKG_FILES)
LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_GZ) += $(GUNZIP_FILES) get_header_tar_gz.o
LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_BZ2) += decompress_bunzip2.o get_header_tar_bz2.o
LIBUNARCHIVE-$(CONFIG_GUNZIP) += $(GUNZIP_FILES)
LIBUNARCHIVE-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += uncompress.o
LIBUNARCHIVE-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio.o
LIBUNARCHIVE-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio.o
LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar.o
LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2.o get_header_tar_bz2.o
LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_GZIP) += $(GUNZIP_FILES) get_header_tar_gz.o
LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_COMPRESS) += uncompress.o
LIBUNARCHIVE-$(CONFIG_UNCOMPRESS) += uncompress.o
LIBUNARCHIVE-$(CONFIG_UNZIP) += $(GUNZIP_FILES)
libraries-y+=$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR)
-44
View File
@@ -1,44 +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 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 <unistd.h>
#include "libbb.h"
#include "unarchive.h"
extern void archive_copy_file(const archive_handle_t *archive_handle, const int dst_fd)
{
char buffer[512];
off_t chunksize = archive_handle->file_header->size;
while (chunksize != 0) {
size_t size;
if (chunksize > 512) {
size = 512;
} else {
size = chunksize;
}
// archive_xread_all(archive_handle, buffer, size);
size = archive_xread(archive_handle, buffer, size);
if (write(dst_fd, buffer, size) != size) {
bb_error_msg_and_die ("Short write");
}
chunksize -= size;
}
return;
}
+1 -1
View File
@@ -24,7 +24,7 @@ extern void archive_xread_all(const archive_handle_t *archive_handle, void *buf,
{
ssize_t size;
size = archive_xread(archive_handle, buf, count);
size = bb_full_read(archive_handle->src_fd, buf, count);
if (size != count) {
bb_error_msg_and_die("Short read");
}
@@ -24,7 +24,7 @@ extern ssize_t archive_xread_all_eof(archive_handle_t *archive_handle, unsigned
{
ssize_t size;
size = archive_xread(archive_handle, buf, count);
size = bb_full_read(archive_handle->src_fd, buf, count);
if ((size != 0) && (size != count)) {
bb_perror_msg_and_die("Short read, read %d of %d", size, count);
}
-1
View File
@@ -27,7 +27,6 @@ extern void data_align(archive_handle_t *archive_handle, const unsigned short bo
const unsigned short skip_amount = (boundary - (archive_handle->offset % boundary)) % boundary;
archive_handle->seek(archive_handle, skip_amount);
archive_handle->offset += skip_amount;
return;
+71 -47
View File
@@ -39,58 +39,82 @@ extern void data_extract_all(archive_handle_t *archive_handle)
free(name);
}
/* Create the filesystem entry */
switch(file_header->mode & S_IFMT) {
case S_IFREG: {
#ifdef CONFIG_CPIO
if (file_header->link_name && file_header->size == 0) {
/* hard link */
res = link(file_header->link_name, file_header->name);
if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
bb_perror_msg("Couldnt create hard link");
}
} else
#endif
{
/* Regular file */
unlink(file_header->name);
dst_fd = bb_xopen(file_header->name, O_WRONLY | O_CREAT | O_EXCL);
archive_copy_file(archive_handle, dst_fd);
close(dst_fd);
}
break;
/* Check if the file already exists */
if (archive_handle->flags & ARCHIVE_EXTRACT_UNCONDITIONAL) {
/* Remove the existing entry if it exists */
if (((file_header->mode & S_IFMT) != S_IFDIR) && (unlink(file_header->name) == -1) && (errno != ENOENT)) {
bb_perror_msg_and_die("Couldnt remove old file");
}
case S_IFDIR:
unlink(file_header->name);
res = mkdir(file_header->name, file_header->mode);
if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
bb_perror_msg("extract_archive: %s", file_header->name);
}
else if (archive_handle->flags & ARCHIVE_EXTRACT_NEWER) {
/* Remove the existing entry if its older than the extracted entry */
struct stat statbuf;
if (lstat(file_header->name, &statbuf) == -1) {
if (errno != ENOENT) {
bb_perror_msg_and_die("Couldnt stat old file");
}
break;
case S_IFLNK:
/* Symlink */
unlink(file_header->name);
res = symlink(file_header->link_name, file_header->name);
if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
bb_perror_msg("Cannot create symlink from %s to '%s'", file_header->name, file_header->link_name);
}
else if (statbuf.st_mtime <= file_header->mtime) {
if (!(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
bb_error_msg("%s not created: newer or same age file exists", file_header->name);
}
break;
case S_IFSOCK:
case S_IFBLK:
case S_IFCHR:
case S_IFIFO:
unlink(file_header->name);
res = mknod(file_header->name, file_header->mode, file_header->device);
if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
bb_perror_msg("Cannot create node %s", file_header->name);
}
break;
default:
bb_error_msg_and_die("Unrecognised file type");
data_skip(archive_handle);
return;
}
else if ((unlink(file_header->name) == -1) && (errno != EISDIR)) {
bb_perror_msg_and_die("Couldnt remove old file %s", file_header->name);
}
}
chmod(file_header->name, file_header->mode);
chown(file_header->name, file_header->uid, file_header->gid);
/* Handle hard links seperately
* We identified hard links as regular files of size 0 with a symlink */
if (S_ISREG(file_header->mode) && (file_header->link_name) && (file_header->size == 0)) {
/* hard link */
res = link(file_header->link_name, file_header->name);
if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
bb_perror_msg("Couldnt create hard link");
}
} else {
/* Create the filesystem entry */
switch(file_header->mode & S_IFMT) {
case S_IFREG: {
/* Regular file */
dst_fd = bb_xopen(file_header->name, O_WRONLY | O_CREAT | O_EXCL);
bb_copyfd_size(archive_handle->src_fd, dst_fd, file_header->size);
close(dst_fd);
break;
}
case S_IFDIR:
res = mkdir(file_header->name, file_header->mode);
if ((errno != EISDIR) && (res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
bb_perror_msg("extract_archive: %s", file_header->name);
}
break;
case S_IFLNK:
/* Symlink */
res = symlink(file_header->link_name, file_header->name);
if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
bb_perror_msg("Cannot create symlink from %s to '%s'", file_header->name, file_header->link_name);
}
break;
case S_IFSOCK:
case S_IFBLK:
case S_IFCHR:
case S_IFIFO:
res = mknod(file_header->name, file_header->mode, file_header->device);
if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
bb_perror_msg("Cannot create node %s", file_header->name);
}
break;
default:
bb_error_msg_and_die("Unrecognised file type");
}
}
lchown(file_header->name, file_header->uid, file_header->gid);
if ((file_header->mode & S_IFMT) != S_IFLNK) {
chmod(file_header->name, file_header->mode);
}
if (archive_handle->flags & ARCHIVE_PRESERVE_DATE) {
struct utimbuf t;
@@ -18,5 +18,5 @@
extern void data_extract_to_stdout(archive_handle_t *archive_handle)
{
archive_copy_file(archive_handle, fileno(stdout));
bb_copyfd_size(archive_handle->src_fd, fileno(stdout), archive_handle->file_header->size);
}
File diff suppressed because it is too large. Load diff
@@ -1,8 +1,6 @@
#include "config.h"
#include "libbb.h"
#if defined CONFIG_UNCOMPRESS || defined CONFIG_FEATURE_GUNZIP_UNCOMPRESS
/* uncompress for busybox -- (c) 2002 Robert Griebl
*
* based on the original compress42.c source
@@ -166,7 +164,7 @@ extern int uncompress(int fd_in, int fd_out)
}
if (insize < (int) sizeof(inbuf) - IBUFSIZ) {
rsize = read(fd_in, inbuf + insize, IBUFSIZ);
rsize = safe_read(fd_in, inbuf + insize, IBUFSIZ);
insize += rsize;
}
@@ -293,6 +291,3 @@ extern int uncompress(int fd_in, int fd_out)
return 0;
}
#endif
+41 -99
View File
@@ -103,7 +103,7 @@ static unsigned int gunzip_bb; /* bit buffer */
static unsigned char gunzip_bk; /* bits in bit buffer */
/* These control the size of the bytebuffer */
#define BYTEBUFFER_MAX 0x8000
static unsigned int bytebuffer_max = 0x8000;
static unsigned char *bytebuffer = NULL;
static unsigned int bytebuffer_offset = 0;
static unsigned int bytebuffer_size = 0;
@@ -144,21 +144,16 @@ static const unsigned char border[] = {
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
};
static void fill_bytebuffer(void)
{
if (bytebuffer_offset >= bytebuffer_size) {
/* 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() */
bytebuffer_size = 4 + bb_xread(gunzip_src_fd, &bytebuffer[4], BYTEBUFFER_MAX - 8);
bytebuffer_offset = 4;
}
}
static unsigned int fill_bitbuffer(unsigned int bitbuffer, unsigned int *current, const unsigned int required)
{
while (*current < required) {
fill_bytebuffer();
if (bytebuffer_offset >= bytebuffer_size) {
/* 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() */
bytebuffer_size = 4 + bb_xread(gunzip_src_fd, &bytebuffer[4], bytebuffer_max - 8);
bytebuffer_offset = 4;
}
bitbuffer |= ((unsigned int) bytebuffer[bytebuffer_offset]) << *current;
bytebuffer_offset++;
*current += 8;
@@ -861,9 +856,9 @@ static void calculate_gunzip_crc(void)
static int inflate_get_next_window(void)
{
static int needAnotherBlock = 1;
static int method = -1; // Method == -1 for stored, -2 for codes
static int e = 0;
static int needAnotherBlock = 1;
gunzip_outbuf_count = 0;
@@ -873,6 +868,8 @@ static int inflate_get_next_window(void)
if (needAnotherBlock) {
if(e) {
calculate_gunzip_crc();
e = 0;
needAnotherBlock = 1;
return 0;
} // Last block
method = inflate_block(&e);
@@ -895,54 +892,25 @@ static int inflate_get_next_window(void)
/* Doesnt get here */
}
/*
* User functions
*
* read_gz, GZ_gzReadOpen, GZ_gzReadClose, inflate
*/
extern ssize_t read_gz(int fd, void *buf, size_t count)
/* Initialise bytebuffer, be carefull not to overfill the buffer */
extern void inflate_init(unsigned int bufsize)
{
static int morebytes = 0, finished = 0;
if (morebytes) {
int bytesRead = morebytes > count ? count : morebytes;
memcpy(buf, gunzip_window + (gunzip_outbuf_count - morebytes), bytesRead);
morebytes -= bytesRead;
return bytesRead;
} else if (finished) {
return 0;
} else if (count >= 0x8000) { // We can decompress direcly to the buffer, 32k at a time
// Could decompress to larger buffer, but it must be a power of 2, and calculating that is probably more expensive than the benefit
unsigned char *old_gunzip_window = gunzip_window; // Save old window
gunzip_window = buf;
if (inflate_get_next_window() == 0) finished = 1;
gunzip_window = old_gunzip_window; // Restore old window
return gunzip_outbuf_count;
} else { // Oh well, need to split up the gunzip_window
int bytesRead;
if (inflate_get_next_window() == 0) finished = 1;
morebytes = gunzip_outbuf_count;
bytesRead = morebytes > count ? count : morebytes;
memcpy(buf, gunzip_window, bytesRead);
morebytes -= bytesRead;
return bytesRead;
}
/* Set the bytebuffer size, default is same as gunzip_wsize */
bytebuffer_max = bufsize + 8;
bytebuffer_offset = 4;
bytebuffer_size = 0;
}
extern void GZ_gzReadOpen(int fd, void *unused, int nUnused)
extern int inflate_unzip(int in, int out)
{
ssize_t nwrote;
typedef void (*sig_type) (int);
/* Allocate all global buffers (for DYN_ALLOC option) */
gunzip_window = xmalloc(gunzip_wsize);
gunzip_outbuf_count = 0;
gunzip_bytes_out = 0;
gunzip_src_fd = fd;
/* Input buffer */
bytebuffer = xmalloc(BYTEBUFFER_MAX);
gunzip_src_fd = in;
/* initialize gunzip_window, bit buffer */
gunzip_bk = 0;
@@ -950,10 +918,20 @@ extern void GZ_gzReadOpen(int fd, void *unused, int nUnused)
/* Create the crc table */
make_gunzip_crc_table();
}
extern void GZ_gzReadClose(void)
{
/* 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);
if (nwrote == -1) {
bb_perror_msg("write");
return -1;
}
if (ret == 0) break;
}
/* Cleanup */
free(gunzip_window);
free(gunzip_crc_table);
@@ -967,57 +945,20 @@ extern void GZ_gzReadClose(void)
gunzip_bb >>= 8;
gunzip_bk -= 8;
}
}
/*extern int inflate(int in, int out) // Useful for testing read_gz
{
char buf[8192];
ssize_t nread, nwrote;
GZ_gzReadOpen(in, 0, 0);
while(1) { // Robbed from bb_copyfd.c
nread = read_gz(in, buf, sizeof(buf));
if (nread == 0) break; // no data to write
else if (nread == -1) {
bb_perror_msg("read");
return -1;
}
nwrote = bb_full_write(out, buf, nread);
if (nwrote == -1) {
bb_perror_msg("write");
return -1;
}
}
GZ_gzReadClose();
return 0;
}*/
extern int inflate(int in, int out)
{
ssize_t nwrote;
GZ_gzReadOpen(in, 0, 0);
while(1) {
int ret = inflate_get_next_window();
nwrote = bb_full_write(out, gunzip_window, gunzip_outbuf_count);
if (nwrote == -1) {
bb_perror_msg("write");
return -1;
}
if (ret == 0) break;
}
GZ_gzReadClose();
return 0;
}
extern void check_trailer_gzip(int src_fd)
extern int inflate_gunzip(int in, int out)
{
unsigned int stored_crc = 0;
unsigned char count;
inflate_unzip(in, out);
/* top up the input buffer with the rest of the trailer */
count = bytebuffer_size - bytebuffer_offset;
if (count < 8) {
bb_xread_all(src_fd, &bytebuffer[bytebuffer_size], 8 - count);
bb_xread_all(in, &bytebuffer[bytebuffer_size], 8 - count);
bytebuffer_size += 8 - count;
}
for (count = 0; count != 4; count++) {
@@ -1027,14 +968,15 @@ extern void check_trailer_gzip(int src_fd)
/* Validate decompression - crc */
if (stored_crc != (gunzip_crc ^ 0xffffffffL)) {
bb_error_msg_and_die("crc error");
bb_error_msg("crc error");
}
/* Validate decompression - size */
if (gunzip_bytes_out !=
(bytebuffer[bytebuffer_offset] | (bytebuffer[bytebuffer_offset+1] << 8) |
(bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) {
bb_error_msg_and_die("Incorrect length, but crc is correct");
bb_error_msg("Incorrect length");
}
return 0;
}
@@ -40,16 +40,13 @@ extern char filter_accept_list_reassign(archive_handle_t *archive_handle)
/* Modify the subarchive handler based on the extension */
#ifdef CONFIG_FEATURE_DEB_TAR_GZ
if (strcmp(name_ptr, ".gz") == 0) {
archive_handle->sub_archive->read = read;
archive_handle->action_data_subarchive = get_header_tar_gz;
return(EXIT_SUCCESS);
}
#endif
#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
if (strcmp(name_ptr, ".bz2") == 0) {
archive_handle->sub_archive->read = read_bz2;
BZ2_bzReadOpen(archive_handle->src_fd, NULL, 0);
archive_handle->action_data_subarchive = get_header_tar;
archive_handle->action_data_subarchive = get_header_tar_bz2;
return(EXIT_SUCCESS);
}
#endif
+6 -4
View File
@@ -45,7 +45,7 @@ extern char get_header_ar(archive_handle_t *archive_handle)
if (read(archive_handle->src_fd, ar.raw, 60) != 60) {
/* End Of File */
return(EXIT_FAILURE);
}
}
/* Some ar entries have a trailing '\n' after the previous data entry */
if (ar.raw[0] == '\n') {
@@ -55,7 +55,7 @@ extern char get_header_ar(archive_handle_t *archive_handle)
archive_handle->offset++;
}
archive_handle->offset += 60;
/* align the headers based on the header magic */
if ((ar.formated.magic[0] != '`') || (ar.formated.magic[1] != '\n')) {
bb_error_msg_and_die("Invalid ar header");
@@ -84,6 +84,7 @@ extern char get_header_ar(archive_handle_t *archive_handle)
} else if (ar.formated.name[1] == ' ') {
/* This is the index of symbols in the file for compilers */
data_skip(archive_handle);
archive_handle->offset += typed->size;
return (get_header_ar(archive_handle)); /* Return next header */
} else {
/* The number after the '/' indicates the offset in the ar data section
@@ -115,8 +116,9 @@ extern char get_header_ar(archive_handle_t *archive_handle)
data_skip(archive_handle);
}
archive_handle->offset += typed->size + 1;
archive_handle->offset += typed->size;
/* Set the file pointer to the correct spot, we may have been reading a compressed file */
lseek(archive_handle->src_fd, archive_handle->offset, SEEK_SET);
return(EXIT_SUCCESS);
}
+4 -38
View File
@@ -36,7 +36,6 @@ extern char get_header_cpio(archive_handle_t *archive_handle)
int namesize;
char dummy[16];
int major, minor, nlink, inode;
char extract_flag;
if (pending_hardlinks) { /* Deal with any pending hardlinks */
hardlinks_t *tmp;
@@ -71,17 +70,7 @@ extern char get_header_cpio(archive_handle_t *archive_handle)
}
archive_handle->offset += 110;
if (strncmp(&cpio_header[0], "07070", 5) != 0) {
printf("cpio header is %x-%x-%x-%x-%x\n",
cpio_header[0],
cpio_header[1],
cpio_header[2],
cpio_header[3],
cpio_header[4]);
bb_error_msg_and_die("Unsupported cpio format");
}
if ((cpio_header[5] != '1') && (cpio_header[5] != '2')) {
if ((strncmp(&cpio_header[0], "07070", 5) != 0) || ((cpio_header[5] != '1') && (cpio_header[5] != '2'))) {
bb_error_msg_and_die("Unsupported cpio format, use newc or crc");
}
@@ -154,36 +143,13 @@ extern char get_header_cpio(archive_handle_t *archive_handle)
}
file_header->device = (major << 8) | minor;
extract_flag = FALSE;
if (archive_handle->filter(archive_handle) == EXIT_SUCCESS) {
struct stat statbuf;
extract_flag = TRUE;
/* Check if the file already exists */
if (lstat (file_header->name, &statbuf) == 0) {
if ((archive_handle->flags & ARCHIVE_EXTRACT_UNCONDITIONAL) || (statbuf.st_mtime < file_header->mtime)) {
/* Remove file if flag set or its older than the file to be extracted */
if (unlink(file_header->name) == -1) {
bb_perror_msg_and_die("Couldnt remove old file");
}
} else {
if (! archive_handle->flags & ARCHIVE_EXTRACT_QUIET) {
bb_error_msg("%s not created: newer or same age file exists", file_header->name);
}
extract_flag = FALSE;
}
}
archive_handle->action_header(file_header);
}
archive_handle->action_header(file_header);
if (extract_flag) {
archive_handle->action_data(archive_handle);
archive_handle->action_header(archive_handle->file_header);
} else {
data_skip(archive_handle);
data_skip(archive_handle);
}
archive_handle->offset += file_header->size;
return (EXIT_SUCCESS);
}
+22 -12
View File
@@ -29,6 +29,7 @@ extern char get_header_tar(archive_handle_t *archive_handle)
{
file_header_t *file_header = archive_handle->file_header;
union {
/* ustar header, Posix 1003.1 */
unsigned char raw[512];
struct {
char name[100]; /* 0-99 */
@@ -52,12 +53,11 @@ extern char get_header_tar(archive_handle_t *archive_handle)
} tar;
long sum = 0;
long i;
char *tmp;
/* Align header */
data_align(archive_handle, 512);
if (archive_xread(archive_handle, tar.raw, 512) != 512) {
if (bb_full_read(archive_handle->src_fd, tar.raw, 512) != 512) {
/* Assume end of file */
return(EXIT_FAILURE);
}
@@ -105,11 +105,15 @@ extern char get_header_tar(archive_handle_t *archive_handle)
} else {
file_header->name = concat_path_file(tar.formated.prefix, tar.formated.name);
}
tmp = last_char_is(archive_handle->file_header->name, '/');
if (tmp) {
*tmp = '\0';
{ /* Strip trailing '/' in directories */
char *tmp = last_char_is(file_header->name, '/');
if (tmp) {
*tmp = '\0';
}
}
file_header->mode = strtol(tar.formated.mode, NULL, 8);
file_header->uid = strtol(tar.formated.uid, NULL, 8);
file_header->gid = strtol(tar.formated.gid, NULL, 8);
@@ -120,16 +124,17 @@ extern char get_header_tar(archive_handle_t *archive_handle)
file_header->device = (dev_t) ((strtol(tar.formated.devmajor, NULL, 8) << 8) +
strtol(tar.formated.devminor, NULL, 8));
#if defined CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY || defined CONFIG_FEATURE_TAR_GNU_EXTENSIONS
/* Fix mode, used by the old format */
switch (tar.formated.typeflag) {
# ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
case 0:
case '0':
file_header->mode |= S_IFREG;
if (last_char_is(file_header->name, '/')) {
file_header->mode |= S_IFDIR;
} else {
file_header->mode |= S_IFREG;
}
break;
case '1':
bb_error_msg("WARNING: Converting hard link to symlink");
case '2':
file_header->mode |= S_IFLNK;
break;
@@ -146,6 +151,10 @@ extern char get_header_tar(archive_handle_t *archive_handle)
file_header->mode |= S_IFIFO;
break;
# endif
/* hard links are detected as regular files with 0 size and a link name */
case '1':
file_header->mode &= (S_IFREG | 07777);
break;
# ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS
case 'L': {
longname = xmalloc(file_header->size + 1);
@@ -172,17 +181,18 @@ extern char get_header_tar(archive_handle_t *archive_handle)
bb_error_msg("Ignoring GNU extension type %c", tar.formated.typeflag);
# endif
}
#endif
if (archive_handle->filter(archive_handle) == EXIT_SUCCESS) {
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, archive_handle->file_header->name);
archive_handle->passed = llist_add_to(archive_handle->passed, file_header->name);
} else {
data_skip(archive_handle);
}
archive_handle->offset += file_header->size;
free(file_header->link_name);
return(EXIT_SUCCESS);
}
+4 -8
View File
@@ -15,6 +15,7 @@
*/
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@@ -25,18 +26,13 @@
extern char get_header_tar_bz2(archive_handle_t *archive_handle)
{
BZ2_bzReadOpen(archive_handle->src_fd, NULL, 0);
archive_handle->read = read_bz2;
/* Cant lseek over pipe's */
archive_handle->seek = seek_by_char;
archive_handle->src_fd = open_transformer(archive_handle->src_fd, uncompressStream);
archive_handle->offset = 0;
while (get_header_tar(archive_handle) == EXIT_SUCCESS);
/* Cleanup */
BZ2_bzReadClose();
/* Can only do one tar.bz2 per archive */
/* Can only do one file at a time */
return(EXIT_FAILURE);
}
+5 -12
View File
@@ -23,6 +23,9 @@ extern char get_header_tar_gz(archive_handle_t *archive_handle)
{
unsigned char magic[2];
/* Cant lseek over pipe's */
archive_handle->seek = seek_by_char;
archive_xread_all(archive_handle, &magic, 2);
if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
bb_error_msg_and_die("Invalid gzip magic");
@@ -30,20 +33,10 @@ extern char get_header_tar_gz(archive_handle_t *archive_handle)
check_header_gzip(archive_handle->src_fd);
GZ_gzReadOpen(archive_handle->src_fd, 0, 0);
archive_handle->read = read_gz;
archive_handle->seek = seek_by_char;
archive_handle->src_fd = open_transformer(archive_handle->src_fd, inflate_gunzip);
archive_handle->offset = 0;
while (get_header_tar(archive_handle) == EXIT_SUCCESS);
/* Cleanup */
GZ_gzReadClose();
check_trailer_gzip(archive_handle->src_fd);
/* Can only do one tar.bz2 per archive */
/* Can only do one file at a time */
return(EXIT_FAILURE);
}
-1
View File
@@ -30,7 +30,6 @@ archive_handle_t *init_handle(void)
archive_handle->action_header = header_skip;
archive_handle->action_data = data_skip;
archive_handle->filter = filter_accept_all;
archive_handle->read = bb_full_read;
archive_handle->seek = seek_by_jump;
return(archive_handle);
@@ -14,20 +14,38 @@
* 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 <unistd.h>
#include "libbb.h"
extern ssize_t archive_xread(const archive_handle_t *archive_handle, unsigned char *buf, const size_t count)
/* transformer(), more than meets the eye */
extern int open_transformer(int src_fd, int (*transformer)(int src_fd, int dst_fd))
{
ssize_t size;
int fd_pipe[2];
int pid;
size = archive_handle->read(archive_handle->src_fd, buf, count);
if (size < 0) {
bb_perror_msg_and_die("Read error");
if (pipe(fd_pipe) != 0) {
bb_perror_msg_and_die("Can't create pipe");
}
return(size);
pid = fork();
if (pid == -1) {
bb_perror_msg_and_die("Fork failed");
}
if (pid == 0) {
/* child process */
close(fd_pipe[0]); /* We don't wan't to read from the parent */
transformer(src_fd, fd_pipe[1]);
close(fd_pipe[1]); /* Send EOF */
close(src_fd);
exit(0);
/* notreached */
}
/* parent process */
close(fd_pipe[1]); /* Don't want to write to the child */
return(fd_pipe[0]);
}
+12 -5
View File
@@ -14,12 +14,19 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "unarchive.h"
#include <stdlib.h>
extern void seek_by_char(const archive_handle_t *archive_handle, const unsigned int amount)
#include "unarchive.h"
#include "busybox.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.
*
* TODO: rename to seek_by_read
*/
extern void seek_by_char(const archive_handle_t *archive_handle, const unsigned int jump_size)
{
unsigned int i;
for (i = 0; i < amount; i++) {
archive_xread_char(archive_handle);
if (jump_size) {
bb_full_fd_action(archive_handle->src_fd, -1, jump_size, NULL);
}
}
+1 -6
View File
@@ -1,8 +1,6 @@
#include "config.h"
#include "libbb.h"
#if defined CONFIG_UNCOMPRESS || defined CONFIG_FEATURE_GUNZIP_UNCOMPRESS
/* uncompress for busybox -- (c) 2002 Robert Griebl
*
* based on the original compress42.c source
@@ -166,7 +164,7 @@ extern int uncompress(int fd_in, int fd_out)
}
if (insize < (int) sizeof(inbuf) - IBUFSIZ) {
rsize = read(fd_in, inbuf + insize, IBUFSIZ);
rsize = safe_read(fd_in, inbuf + insize, IBUFSIZ);
insize += rsize;
}
@@ -293,6 +291,3 @@ extern int uncompress(int fd_in, int fd_out)
return 0;
}
#endif
+41 -99
View File
@@ -103,7 +103,7 @@ static unsigned int gunzip_bb; /* bit buffer */
static unsigned char gunzip_bk; /* bits in bit buffer */
/* These control the size of the bytebuffer */
#define BYTEBUFFER_MAX 0x8000
static unsigned int bytebuffer_max = 0x8000;
static unsigned char *bytebuffer = NULL;
static unsigned int bytebuffer_offset = 0;
static unsigned int bytebuffer_size = 0;
@@ -144,21 +144,16 @@ static const unsigned char border[] = {
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
};
static void fill_bytebuffer(void)
{
if (bytebuffer_offset >= bytebuffer_size) {
/* 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() */
bytebuffer_size = 4 + bb_xread(gunzip_src_fd, &bytebuffer[4], BYTEBUFFER_MAX - 8);
bytebuffer_offset = 4;
}
}
static unsigned int fill_bitbuffer(unsigned int bitbuffer, unsigned int *current, const unsigned int required)
{
while (*current < required) {
fill_bytebuffer();
if (bytebuffer_offset >= bytebuffer_size) {
/* 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() */
bytebuffer_size = 4 + bb_xread(gunzip_src_fd, &bytebuffer[4], bytebuffer_max - 8);
bytebuffer_offset = 4;
}
bitbuffer |= ((unsigned int) bytebuffer[bytebuffer_offset]) << *current;
bytebuffer_offset++;
*current += 8;
@@ -861,9 +856,9 @@ static void calculate_gunzip_crc(void)
static int inflate_get_next_window(void)
{
static int needAnotherBlock = 1;
static int method = -1; // Method == -1 for stored, -2 for codes
static int e = 0;
static int needAnotherBlock = 1;
gunzip_outbuf_count = 0;
@@ -873,6 +868,8 @@ static int inflate_get_next_window(void)
if (needAnotherBlock) {
if(e) {
calculate_gunzip_crc();
e = 0;
needAnotherBlock = 1;
return 0;
} // Last block
method = inflate_block(&e);
@@ -895,54 +892,25 @@ static int inflate_get_next_window(void)
/* Doesnt get here */
}
/*
* User functions
*
* read_gz, GZ_gzReadOpen, GZ_gzReadClose, inflate
*/
extern ssize_t read_gz(int fd, void *buf, size_t count)
/* Initialise bytebuffer, be carefull not to overfill the buffer */
extern void inflate_init(unsigned int bufsize)
{
static int morebytes = 0, finished = 0;
if (morebytes) {
int bytesRead = morebytes > count ? count : morebytes;
memcpy(buf, gunzip_window + (gunzip_outbuf_count - morebytes), bytesRead);
morebytes -= bytesRead;
return bytesRead;
} else if (finished) {
return 0;
} else if (count >= 0x8000) { // We can decompress direcly to the buffer, 32k at a time
// Could decompress to larger buffer, but it must be a power of 2, and calculating that is probably more expensive than the benefit
unsigned char *old_gunzip_window = gunzip_window; // Save old window
gunzip_window = buf;
if (inflate_get_next_window() == 0) finished = 1;
gunzip_window = old_gunzip_window; // Restore old window
return gunzip_outbuf_count;
} else { // Oh well, need to split up the gunzip_window
int bytesRead;
if (inflate_get_next_window() == 0) finished = 1;
morebytes = gunzip_outbuf_count;
bytesRead = morebytes > count ? count : morebytes;
memcpy(buf, gunzip_window, bytesRead);
morebytes -= bytesRead;
return bytesRead;
}
/* Set the bytebuffer size, default is same as gunzip_wsize */
bytebuffer_max = bufsize + 8;
bytebuffer_offset = 4;
bytebuffer_size = 0;
}
extern void GZ_gzReadOpen(int fd, void *unused, int nUnused)
extern int inflate_unzip(int in, int out)
{
ssize_t nwrote;
typedef void (*sig_type) (int);
/* Allocate all global buffers (for DYN_ALLOC option) */
gunzip_window = xmalloc(gunzip_wsize);
gunzip_outbuf_count = 0;
gunzip_bytes_out = 0;
gunzip_src_fd = fd;
/* Input buffer */
bytebuffer = xmalloc(BYTEBUFFER_MAX);
gunzip_src_fd = in;
/* initialize gunzip_window, bit buffer */
gunzip_bk = 0;
@@ -950,10 +918,20 @@ extern void GZ_gzReadOpen(int fd, void *unused, int nUnused)
/* Create the crc table */
make_gunzip_crc_table();
}
extern void GZ_gzReadClose(void)
{
/* 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);
if (nwrote == -1) {
bb_perror_msg("write");
return -1;
}
if (ret == 0) break;
}
/* Cleanup */
free(gunzip_window);
free(gunzip_crc_table);
@@ -967,57 +945,20 @@ extern void GZ_gzReadClose(void)
gunzip_bb >>= 8;
gunzip_bk -= 8;
}
}
/*extern int inflate(int in, int out) // Useful for testing read_gz
{
char buf[8192];
ssize_t nread, nwrote;
GZ_gzReadOpen(in, 0, 0);
while(1) { // Robbed from bb_copyfd.c
nread = read_gz(in, buf, sizeof(buf));
if (nread == 0) break; // no data to write
else if (nread == -1) {
bb_perror_msg("read");
return -1;
}
nwrote = bb_full_write(out, buf, nread);
if (nwrote == -1) {
bb_perror_msg("write");
return -1;
}
}
GZ_gzReadClose();
return 0;
}*/
extern int inflate(int in, int out)
{
ssize_t nwrote;
GZ_gzReadOpen(in, 0, 0);
while(1) {
int ret = inflate_get_next_window();
nwrote = bb_full_write(out, gunzip_window, gunzip_outbuf_count);
if (nwrote == -1) {
bb_perror_msg("write");
return -1;
}
if (ret == 0) break;
}
GZ_gzReadClose();
return 0;
}
extern void check_trailer_gzip(int src_fd)
extern int inflate_gunzip(int in, int out)
{
unsigned int stored_crc = 0;
unsigned char count;
inflate_unzip(in, out);
/* top up the input buffer with the rest of the trailer */
count = bytebuffer_size - bytebuffer_offset;
if (count < 8) {
bb_xread_all(src_fd, &bytebuffer[bytebuffer_size], 8 - count);
bb_xread_all(in, &bytebuffer[bytebuffer_size], 8 - count);
bytebuffer_size += 8 - count;
}
for (count = 0; count != 4; count++) {
@@ -1027,14 +968,15 @@ extern void check_trailer_gzip(int src_fd)
/* Validate decompression - crc */
if (stored_crc != (gunzip_crc ^ 0xffffffffL)) {
bb_error_msg_and_die("crc error");
bb_error_msg("crc error");
}
/* Validate decompression - size */
if (gunzip_bytes_out !=
(bytebuffer[bytebuffer_offset] | (bytebuffer[bytebuffer_offset+1] << 8) |
(bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) {
bb_error_msg_and_die("Incorrect length, but crc is correct");
bb_error_msg("Incorrect length");
}
return 0;
}
+10 -13
View File
@@ -82,10 +82,10 @@ enum rpm_functions_e {
};
typedef struct {
u_int32_t tag; /* 4 byte tag */
u_int32_t type; /* 4 byte type */
u_int32_t offset; /* 4 byte offset */
u_int32_t count; /* 4 byte count */
uint32_t tag; /* 4 byte tag */
uint32_t type; /* 4 byte type */
uint32_t offset; /* 4 byte offset */
uint32_t count; /* 4 byte count */
} rpm_index;
static void *map;
@@ -197,7 +197,6 @@ void extract_cpio_gz(int fd) {
/* Initialise */
archive_handle = init_handle();
archive_handle->read = read_gz;
archive_handle->seek = seek_by_char;
//archive_handle->action_header = header_list;
archive_handle->action_data = data_extract_all;
@@ -213,11 +212,9 @@ void extract_cpio_gz(int fd) {
check_header_gzip(archive_handle->src_fd);
chdir("/"); // Install RPM's to root
GZ_gzReadOpen(archive_handle->src_fd, 0, 0);
archive_handle->src_fd = open_transformer(archive_handle->src_fd, inflate_gunzip);
archive_handle->offset = 0;
while (get_header_cpio(archive_handle) == EXIT_SUCCESS);
GZ_gzReadClose();
check_trailer_gzip(archive_handle->src_fd);
}
@@ -230,10 +227,10 @@ rpm_index **rpm_gettags(int fd, int *num_tags)
for (pass = 0; pass < 2; pass++) { /* 1st pass is the signature headers, 2nd is the main stuff */
struct {
char magic[3]; /* 3 byte magic: 0x8e 0xad 0xe8 */
u_int8_t version; /* 1 byte version number */
u_int32_t reserved; /* 4 bytes reserved */
u_int32_t entries; /* Number of entries in header (4 bytes) */
u_int32_t size; /* Size of store (4 bytes) */
uint8_t version; /* 1 byte version number */
uint32_t reserved; /* 4 bytes reserved */
uint32_t entries; /* Number of entries in header (4 bytes) */
uint32_t size; /* Size of store (4 bytes) */
} header;
rpm_index *tmpindex;
int storepos;
+10 -11
View File
@@ -31,21 +31,21 @@
struct rpm_lead {
unsigned char magic[4];
u_int8_t major, minor;
u_int16_t type;
u_int16_t archnum;
uint8_t major, minor;
uint16_t type;
uint16_t archnum;
char name[66];
u_int16_t osnum;
u_int16_t signature_type;
uint16_t osnum;
uint16_t signature_type;
char reserved[16];
};
struct rpm_header {
char magic[3]; /* 3 byte magic: 0x8e 0xad 0xe8 */
u_int8_t version; /* 1 byte version number */
u_int32_t reserved; /* 4 bytes reserved */
u_int32_t entries; /* Number of entries in header (4 bytes) */
u_int32_t size; /* Size of store (4 bytes) */
uint8_t version; /* 1 byte version number */
uint32_t reserved; /* 4 bytes reserved */
uint32_t entries; /* Number of entries in header (4 bytes) */
uint32_t size; /* Size of store (4 bytes) */
};
void skip_header(int rpm_fd)
@@ -96,10 +96,9 @@ extern int rpm2cpio_main(int argc, char **argv)
}
check_header_gzip(rpm_fd);
if (inflate(rpm_fd, fileno(stdout)) != 0) {
if (inflate_gunzip(rpm_fd, fileno(stdout)) != 0) {
bb_error_msg("Error inflating");
}
check_trailer_gzip(rpm_fd);
close(rpm_fd);
+222 -103
View File
@@ -308,21 +308,18 @@ static inline int writeTarHeader(struct TarBallInfo *tbInfo,
if (tbInfo->verboseFlag) {
FILE *vbFd = stdout;
if (tbInfo->verboseFlag == 2) /* If the archive goes to stdout, verbose to stderr */
if (tbInfo->tarFd == fileno(stdout)) /* If the archive goes to stdout, verbose to stderr */
vbFd = stderr;
fprintf(vbFd, "%s\n", header.name);
}
return (TRUE);
}
# if defined CONFIG_FEATURE_TAR_EXCLUDE
# ifdef CONFIG_FEATURE_TAR_FROM
static inline int exclude_file(const llist_t *excluded_files, const char *file)
{
if (excluded_files == NULL) {
return 0;
}
while (excluded_files) {
if (excluded_files->data[0] == '/') {
if (fnmatch(excluded_files->data, file,
@@ -343,7 +340,7 @@ static inline int exclude_file(const llist_t *excluded_files, const char *file)
return 0;
}
#endif
# endif
static int writeFileToTarball(const char *fileName, struct stat *statbuf,
void *userData)
@@ -399,11 +396,11 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf,
if (header_name[0] == '\0')
return TRUE;
# if defined CONFIG_FEATURE_TAR_EXCLUDE
# ifdef CONFIG_FEATURE_TAR_FROM
if (exclude_file(tbInfo->excludeList, header_name)) {
return SKIP;
}
# endif /* CONFIG_FEATURE_TAR_EXCLUDE */
# endif /* CONFIG_FEATURE_TAR_FROM */
if (writeTarHeader(tbInfo, header_name, fileName, statbuf) == FALSE) {
return (FALSE);
@@ -413,8 +410,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf,
if ((tbInfo->hlInfo == NULL)
&& (S_ISREG(statbuf->st_mode))) {
int inputFileFd;
char buffer[BUFSIZ];
ssize_t size = 0, readSize = 0;
ssize_t readSize = 0;
/* open the file we want to archive, and make sure all is well */
if ((inputFileFd = open(fileName, O_RDONLY)) < 0) {
@@ -423,18 +419,8 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf,
}
/* write the file to the archive */
while ((size = bb_full_read(inputFileFd, buffer, sizeof(buffer))) > 0) {
if (bb_full_write(tbInfo->tarFd, buffer, size) != size) {
/* Output file seems to have a problem */
bb_error_msg(bb_msg_io_error, fileName);
return (FALSE);
}
readSize += size;
}
if (size == -1) {
bb_error_msg(bb_msg_io_error, fileName);
return (FALSE);
}
readSize = bb_copyfd_eof(inputFileFd, tbInfo->tarFd);
/* Pad the file up to the tar block size */
for (; (readSize % TAR_BLOCK_SIZE) != 0; readSize++) {
write(tbInfo->tarFd, "\0", 1);
@@ -445,8 +431,9 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf,
return (TRUE);
}
static inline int writeTarFile(const char *tarName, const int verboseFlag,
const llist_t *include, const llist_t *exclude, const int gzip)
static inline int writeTarFile(const int tar_fd, const int verboseFlag,
const unsigned long dereferenceFlag, const llist_t *include,
const llist_t *exclude, const int gzip)
{
#ifdef CONFIG_FEATURE_TAR_GZIP
int gzipDataPipe[2] = { -1, -1 };
@@ -461,31 +448,14 @@ static inline int writeTarFile(const char *tarName, const int verboseFlag,
tbInfo.hlInfoHead = NULL;
/* Make sure there is at least one file to tar up. */
if (include == NULL) {
bb_error_msg_and_die("Cowardly refusing to create an empty archive");
}
/* Open the tar file for writing. */
if (tarName == NULL || (tarName[0] == '-' && tarName[1] == '\0')) {
tbInfo.tarFd = fileno(stdout);
tbInfo.verboseFlag = verboseFlag ? 2 : 0;
} else {
unlink(tarName);
tbInfo.tarFd = open(tarName, O_WRONLY | O_CREAT | O_EXCL, 0644);
tbInfo.verboseFlag = verboseFlag ? 1 : 0;
}
if (tbInfo.tarFd < 0) {
bb_perror_msg("%s: Cannot open", tarName);
freeHardLinkInfo(&tbInfo.hlInfoHead);
return (FALSE);
}
fchmod(tar_fd, 0644);
tbInfo.tarFd = tar_fd;
tbInfo.verboseFlag = verboseFlag;
/* Store the stat info for the tarball's file, so
* can avoid including the tarball into itself.... */
if (fstat(tbInfo.tarFd, &tbInfo.statBuf) < 0)
bb_error_msg_and_die(bb_msg_io_error, tarName);
bb_perror_msg_and_die("Couldnt stat tar file");
#ifdef CONFIG_FEATURE_TAR_GZIP
if (gzip) {
@@ -547,7 +517,7 @@ static inline int writeTarFile(const char *tarName, const int verboseFlag,
/* Read the directory/files and iterate over them one at a time */
while (include) {
if (!recursive_action(include->data, TRUE, FALSE, FALSE,
if (!recursive_action(include->data, TRUE, dereferenceFlag, FALSE,
writeFileToTarball, writeFileToTarball,
(void *) &tbInfo)) {
errorFlag = TRUE;
@@ -582,7 +552,7 @@ static inline int writeTarFile(const char *tarName, const int verboseFlag,
}
#endif /* tar_create */
#ifdef CONFIG_FEATURE_TAR_EXCLUDE
#ifdef CONFIG_FEATURE_TAR_FROM
static llist_t *append_file_list_to_list(llist_t *list)
{
FILE *src_stream;
@@ -605,29 +575,127 @@ static llist_t *append_file_list_to_list(llist_t *list)
}
#endif
#ifdef CONFIG_FEATURE_TAR_COMPRESS
static char get_header_tar_Z(archive_handle_t *archive_handle)
{
/* Cant lseek over pipe's */
archive_handle->seek = seek_by_char;
static const char tar_options[]="ctxjT:X:C:f:Opvz";
#define CTX_CREATE 1
#define CTX_TEST 2
#define CTX_EXTRACT 4
#define TAR_OPT_BZIP2 8
#define TAR_OPT_INCLUDE 16
#define TAR_OPT_EXCLUDE 32
#define TAR_OPT_BASEDIR 64
#define TAR_OPT_ARNAME 128
#define TAR_OPT_2STDOUT 256
#define TAR_OPT_P 512
#define TAR_OPT_VERBOSE 1024
#define TAR_OPT_GZIP 2048
/* do the decompression, and cleanup */
if ((bb_xread_char(archive_handle->src_fd) != 0x1f) || (bb_xread_char(archive_handle->src_fd) != 0x9d)) {
bb_error_msg_and_die("Invalid magic");
}
archive_handle->src_fd = open_transformer(archive_handle->src_fd, uncompress);
archive_handle->offset = 0;
while (get_header_tar(archive_handle) == EXIT_SUCCESS);
/* Can only do one file at a time */
return(EXIT_FAILURE);
}
#endif
#define CTX_TEST (1 << 0)
#define CTX_EXTRACT (1 << 1)
#define TAR_OPT_BASEDIR (1 << 2)
#define TAR_OPT_TARNAME (1 << 3)
#define TAR_OPT_2STDOUT (1 << 4)
#define TAR_OPT_P (1 << 5)
#define TAR_OPT_VERBOSE (1 << 6)
#define TAR_OPT_KEEP_OLD (1 << 7)
#ifdef CONFIG_FEATURE_TAR_CREATE
# define CTX_CREATE (1 << 8)
# define TAR_OPT_DEREFERNCE (1 << 9)
# define TAR_OPT_STR_CREATE "ch"
# define TAR_OPT_FLAG_CREATE 2
#else
//# define CTX_CREATE 0
# define TAR_OPT_STR_CREATE ""
# define TAR_OPT_FLAG_CREATE 0
#endif
#ifdef CONFIG_FEATURE_TAR_BZIP2
# define TAR_OPT_BZIP2 (1 << (8 + TAR_OPT_FLAG_CREATE))
# define TAR_OPT_STR_BZIP2 "j"
# define TAR_OPT_FLAG_BZIP2 1
#else
# define TAR_OPT_STR_BZIP2 ""
# define TAR_OPT_FLAG_BZIP2 0
#endif
#ifdef CONFIG_FEATURE_TAR_FROM
# define TAR_OPT_FROM_FILE (1 << (8 + TAR_OPT_FLAG_CREATE + TAR_OPT_FLAG_BZIP2))
# define TAR_OPT_EXCLUDE_FROM (1 << (8 + TAR_OPT_FLAG_CREATE + TAR_OPT_FLAG_BZIP2 + 1))
# define TAR_OPT_STR_FROM "T:X:"
# define TAR_OPT_FLAG_FROM 2
#else
# define TAR_OPT_STR_FROM ""
# define TAR_OPT_FLAG_FROM 0
#endif
#ifdef CONFIG_FEATURE_TAR_GZIP
# define TAR_OPT_GZIP (1 << (8 + TAR_OPT_FLAG_CREATE + TAR_OPT_FLAG_BZIP2 + TAR_OPT_FLAG_FROM))
# define TAR_OPT_STR_GZIP "z"
# define TAR_OPT_FLAG_GZIP 1
#else
# define TAR_OPT_STR_GZIP ""
# define TAR_OPT_FLAG_GZIP 0
#endif
#ifdef CONFIG_FEATURE_TAR_COMPRESS
# define TAR_OPT_UNCOMPRESS (1 << (8 + TAR_OPT_FLAG_CREATE + TAR_OPT_FLAG_BZIP2 + TAR_OPT_FLAG_FROM + TAR_OPT_FLAG_GZIP))
# define TAR_OPT_STR_COMPRESS "Z"
#else
# define TAR_OPT_STR_COMPRESS ""
#endif
static const char tar_options[]="txC:f:Opvk" \
TAR_OPT_STR_CREATE \
TAR_OPT_STR_BZIP2 \
TAR_OPT_STR_FROM \
TAR_OPT_STR_GZIP \
TAR_OPT_STR_COMPRESS;
#ifdef CONFIG_FEATURE_TAR_LONG_OPTIONS
static const struct option tar_long_options[] = {
{ "list", 0, NULL, 't' },
{ "extract", 0, NULL, 'x' },
{ "directory", 1, NULL, 'C' },
{ "file", 1, NULL, 'f' },
{ "to-stdout", 0, NULL, 'O' },
{ "same-permissions", 0, NULL, 'p' },
{ "verbose", 0, NULL, 'v' },
{ "keep-old", 0, NULL, 'k' },
# ifdef CONFIG_FEATURE_TAR_CREATE
{ "create", 0, NULL, 'c' },
{ "dereference", 0, NULL, 'h' },
# endif
# ifdef CONFIG_FEATURE_TAR_BZIP2
{ "bzip2", 0, NULL, 'j' },
# endif
# ifdef CONFIG_FEATURE_TAR_FROM
{ "from-file", 1, NULL, 'T' },
{ "exclude-from", 1, NULL, 'X' },
# endif
# ifdef CONFIG_FEATURE_TAR_GZIP
{ "gzip", 0, NULL, 'z' },
# endif
# ifdef CONFIG_FEATURE_TAR_COMPRESS
{ "compress", 0, NULL, 'Z' },
# endif
{ 0, 0, 0, 0 }
};
#endif
int tar_main(int argc, char **argv)
{
char (*get_header_ptr)(archive_handle_t *) = get_header_tar;
archive_handle_t *tar_handle;
int opt;
char *base_dir = NULL;
const char *tar_filename = "-";
unsigned char ctx_flag = 0;
unsigned long opt;
unsigned long ctx_flag = 0;
if (argc < 2) {
bb_show_usage();
@@ -643,59 +711,84 @@ int tar_main(int argc, char **argv)
/* Initialise default values */
tar_handle = init_handle();
tar_handle->flags = ARCHIVE_CREATE_LEADING_DIRS | ARCHIVE_PRESERVE_DATE;
tar_handle->flags = ARCHIVE_CREATE_LEADING_DIRS | ARCHIVE_PRESERVE_DATE | ARCHIVE_EXTRACT_UNCONDITIONAL;
bb_opt_complementaly = "c~tx:t~cx:x~ct:X*:T*";
#ifdef CONFIG_FEATURE_TAR_LONG_OPTIONS
bb_applet_long_options = tar_long_options;
#endif
bb_opt_complementaly = "c~tx:t~cx:x~ct:X*";
opt = bb_getopt_ulflags(argc, argv, tar_options,
NULL, /* T: arg is ignored by default
a list is an include list */
&(tar_handle->reject),
&base_dir, /* Change to dir <optarg> */
&tar_filename); /* archive filename */
&tar_filename /* archive filename */
#ifdef CONFIG_FEATURE_TAR_FROM
, NULL,
&(tar_handle->reject)
#endif
);
/* Check one and only one context option was given */
if(opt & 0x80000000UL)
if(opt & 0x80000000UL) {
bb_show_usage();
}
#ifdef CONFIG_FEATURE_TAR_CREATE
ctx_flag = opt & (CTX_CREATE | CTX_TEST | CTX_EXTRACT);
#else
ctx_flag = opt & (CTX_TEST | CTX_EXTRACT);
#endif
if (ctx_flag == 0) {
bb_show_usage();
}
if(ctx_flag & CTX_TEST) {
if ((tar_handle->action_header == header_list) ||
(tar_handle->action_header == header_verbose_list)) {
tar_handle->action_header = header_verbose_list;
} else {
tar_handle->action_header = header_list;
}
if ((tar_handle->action_header == header_list) ||
(tar_handle->action_header == header_verbose_list)) {
tar_handle->action_header = header_verbose_list;
} else {
tar_handle->action_header = header_list;
}
}
if(ctx_flag & CTX_EXTRACT) {
if (tar_handle->action_data != data_extract_to_stdout)
tar_handle->action_data = data_extract_all;
}
tar_handle->action_data = data_extract_all;
}
if(opt & TAR_OPT_2STDOUT) {
/* To stdout */
tar_handle->action_data = data_extract_to_stdout;
tar_handle->action_data = data_extract_to_stdout;
}
if(opt & TAR_OPT_VERBOSE) {
if ((tar_handle->action_header == header_list) ||
(tar_handle->action_header == header_verbose_list))
{
tar_handle->action_header = header_verbose_list;
} else {
tar_handle->action_header = header_list;
}
if ((tar_handle->action_header == header_list) ||
(tar_handle->action_header == header_verbose_list))
{
tar_handle->action_header = header_verbose_list;
} else {
tar_handle->action_header = header_list;
}
}
if (opt & TAR_OPT_KEEP_OLD) {
tar_handle->flags &= ~ARCHIVE_EXTRACT_UNCONDITIONAL;
}
#ifdef CONFIG_FEATURE_TAR_GZIP
if(opt & TAR_OPT_GZIP) {
get_header_ptr = get_header_tar_gz;
get_header_ptr = get_header_tar_gz;
}
#endif
#ifdef CONFIG_FEATURE_TAR_BZIP2
if(opt & TAR_OPT_BZIP2) {
get_header_ptr = get_header_tar_bz2;
get_header_ptr = get_header_tar_bz2;
}
#endif
#ifdef CONFIG_FEATURE_TAR_EXCLUDE
if(opt & TAR_OPT_EXCLUDE) {
#ifdef CONFIG_FEATURE_TAR_COMPRESS
if(opt & TAR_OPT_UNCOMPRESS) {
get_header_ptr = get_header_tar_Z;
}
#endif
#ifdef CONFIG_FEATURE_TAR_FROM
if(opt & TAR_OPT_EXCLUDE_FROM) {
tar_handle->reject = append_file_list_to_list(tar_handle->reject);
}
#endif
/* Check if we are reading from stdin */
if ((argv[optind]) && (*argv[optind] == '-')) {
/* Default is to read from stdin, so just skip to next arg */
@@ -705,6 +798,10 @@ int tar_main(int argc, char **argv)
/* Setup an array of filenames to work with */
/* TODO: This is the same as in ar, seperate function ? */
while (optind < argc) {
char *filename_ptr = last_char_is(argv[optind], '/');
if (filename_ptr) {
*filename_ptr = '\0';
}
tar_handle->accept = llist_add_to(tar_handle->accept, argv[optind]);
optind++;
}
@@ -713,9 +810,42 @@ int tar_main(int argc, char **argv)
tar_handle->filter = filter_accept_reject_list;
}
/* Open the tar file */
{
FILE *tar_stream;
int flags;
#ifdef CONFIG_FEATURE_TAR_CREATE
if (opt & CTX_CREATE) {
/* Make sure there is at least one file to tar up. */
if (tar_handle->accept == NULL) {
bb_error_msg_and_die("Cowardly refusing to create an empty archive");
}
tar_stream = stdout;
flags = O_WRONLY | O_CREAT | O_EXCL;
unlink(tar_filename);
} else
#endif
{
tar_stream = stdin;
flags = O_RDONLY;
}
if ((tar_filename[0] == '-') && (tar_filename[1] == '\0')) {
tar_handle->src_fd = fileno(tar_stream);
tar_handle->seek = seek_by_char;
} else {
tar_handle->src_fd = bb_xopen(tar_filename, flags);
}
}
if ((base_dir) && (chdir(base_dir))) {
bb_perror_msg_and_die("Couldnt chdir to %s", base_dir);
}
#ifdef CONFIG_FEATURE_TAR_CREATE
/* create an archive */
if (ctx_flag == CTX_CREATE) {
if (opt & CTX_CREATE) {
int verboseFlag = FALSE;
int gzipFlag = FALSE;
@@ -734,22 +864,11 @@ int tar_main(int argc, char **argv)
(tar_handle->action_header == header_verbose_list)) {
verboseFlag = TRUE;
}
writeTarFile(tar_filename, verboseFlag, tar_handle->accept,
writeTarFile(tar_handle->src_fd, verboseFlag, opt & TAR_OPT_DEREFERNCE, tar_handle->accept,
tar_handle->reject, gzipFlag);
} else
#endif /* CONFIG_FEATURE_TAR_CREATE */
{
if ((tar_filename[0] == '-') && (tar_filename[1] == '\0')) {
tar_handle->src_fd = fileno(stdin);
tar_handle->seek = seek_by_char;
} else {
tar_handle->src_fd = bb_xopen(tar_filename, O_RDONLY);
}
if ((base_dir) && (chdir(base_dir))) {
bb_perror_msg_and_die("Couldnt chdir");
}
while (get_header_ptr(tar_handle) == EXIT_SUCCESS);
/* Ckeck that every file that should have been extracted was */
+4 -5
View File
@@ -199,7 +199,8 @@ extern int unzip_main(int argc, char **argv)
archive_handle->action_data(archive_handle);
} else {
dst_fd = bb_xopen(archive_handle->file_header->name, O_WRONLY | O_CREAT);
inflate(archive_handle->src_fd, dst_fd);
inflate_init(zip_header.formated.cmpsize);
inflate_unzip(archive_handle->src_fd, dst_fd);
close(dst_fd);
chmod(archive_handle->file_header->name, archive_handle->file_header->mode);
@@ -227,10 +228,8 @@ extern int unzip_main(int argc, char **argv)
/* Data descriptor section */
if (zip_header.formated.flags & 4) {
/* skip over duplicate crc, compressed size and uncompressed size */
unsigned short i;
for (i = 0; i != 12; i++) {
archive_xread_char(archive_handle);
}
unsigned char data_description[12];
archive_xread_all(archive_handle, data_description, 12);
archive_handle->offset += 12;
}
}
-6
View File
@@ -31,12 +31,6 @@ config CONFIG_DUMPKMAP
This program dumps the kernel's keyboard translation table to
stdout, in binary format. You can then use loadkmap to load it.
config CONFIG_LOADACM
bool "loadacm"
default n
help
This program loads an acm from standard input.
config CONFIG_LOADFONT
bool "loadfont"
default n
-1
View File
@@ -27,7 +27,6 @@ CONSOLETOOLS_DIR-$(CONFIG_CHVT) += chvt.o
CONSOLETOOLS_DIR-$(CONFIG_CLEAR) += clear.o
CONSOLETOOLS_DIR-$(CONFIG_DEALLOCVT) += deallocvt.o
CONSOLETOOLS_DIR-$(CONFIG_DUMPKMAP) += dumpkmap.o
CONSOLETOOLS_DIR-$(CONFIG_LOADACM) += loadacm.o
CONSOLETOOLS_DIR-$(CONFIG_LOADFONT) += loadfont.o
CONSOLETOOLS_DIR-$(CONFIG_LOADKMAP) += loadkmap.o
CONSOLETOOLS_DIR-$(CONFIG_OPENVT) += openvt.o
+25 -7
View File
@@ -1,11 +1,25 @@
/* vi: set sw=4 ts=4: */
/*
* chvt.c - aeb - 940227 - Change virtual terminal
* Mini chvt implementation for busybox
*
* busyboxed by Erik Andersen
* Copyright (C) 1999-2003 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
*/
/* getopt not needed */
/* no options, no getopt */
#include <stdio.h>
#include <stdlib.h>
@@ -22,14 +36,18 @@ int chvt_main(int argc, char **argv)
{
int fd, num;
if ((argc != 2) || (**(argv + 1) == '-'))
if (argc != 2) {
bb_show_usage();
}
fd = get_console_fd();
num = atoi(argv[1]);
if (ioctl(fd, VT_ACTIVATE, num))
num = bb_xgetlarg(argv[1], 10, 0, INT_MAX);
if (ioctl(fd, VT_ACTIVATE, num)) {
bb_perror_msg_and_die("VT_ACTIVATE");
if (ioctl(fd, VT_WAITACTIVE, num))
}
if (ioctl(fd, VT_WAITACTIVE, num)) {
bb_perror_msg_and_die("VT_WAITACTIVE");
}
return EXIT_SUCCESS;
}
+2
View File
@@ -20,6 +20,8 @@
*
*/
/* no options, no getopt */
#include <stdio.h>
#include <stdlib.h>
#include "busybox.h"
+34 -24
View File
@@ -1,8 +1,27 @@
/* vi: set sw=4 ts=4: */
/*
* disalloc.c - aeb - 940501 - Disallocate virtual terminal(s)
* Renamed deallocvt.
* Disallocate virtual terminal(s)
*
* Copyright (C) 2003 by Tito Ragusa <farmatito@tiscali.it>
* Copyright (C) 1999-2003 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
*/
/* no options, no getopt */
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
@@ -15,32 +34,23 @@ static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */
int deallocvt_main(int argc, char *argv[])
{
int fd, num=0;
/* num = 0 deallocate all unused consoles */
int num = 0;
if (argc > 2)
bb_show_usage();
fd = get_console_fd();
/* num=0 deallocate all unused consoles */
if (argc == 1)
goto disallocate_all;
num=bb_xgetlarg(argv[1], 10, 0, INT_MAX);
switch(num)
switch(argc)
{
case 0:
bb_error_msg("0: illegal VT number");
break;
case 2:
if((num = bb_xgetlarg(argv[1], 10, 0, INT_MAX)) == 0)
bb_error_msg_and_die("0: illegal VT number");
/* Falltrough */
case 1:
bb_error_msg("VT 1 cannot be deallocated");
break;
default:
disallocate_all:
if (ioctl(fd, VT_DISALLOCATE, num))
bb_perror_msg_and_die("VT_DISALLOCATE");
return EXIT_SUCCESS;
bb_show_usage();
}
return EXIT_FAILURE;
if (ioctl( get_console_fd(), VT_DISALLOCATE, num )) {
bb_perror_msg_and_die("VT_DISALLOCATE");
}
return EXIT_SUCCESS;
}
+1 -5
View File
@@ -51,11 +51,7 @@ int dumpkmap_main(int argc, char **argv)
bb_show_usage();
}
fd = open(CURRENT_VC, O_RDWR);
if (fd < 0) {
bb_perror_msg("Error opening " CURRENT_VC);
return EXIT_FAILURE;
}
fd=bb_xopen(CURRENT_VC, O_RDWR);
write(1, magic, 7);
-357
View File
@@ -1,357 +0,0 @@
/* vi: set sw=4 ts=4: */
/*
* Derived from
* mapscrn.c - version 0.92
*
* Was taken from console-tools and adapted by
* Peter Novodvorsky <petya@logic.ru>
*/
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <assert.h>
#include <errno.h>
#include <signal.h>
#include <sys/kd.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include "busybox.h"
typedef unsigned short unicode;
static long int ctoi(unsigned char *s, int *is_unicode);
static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]);
static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode);
static unicode utf8_to_ucs2(char *buf);
static int screen_map_load(int fd, FILE * fp);
int loadacm_main(int argc, char **argv)
{
int fd;
if (argc>=2 && *argv[1]=='-') {
bb_show_usage();
}
fd = open(CURRENT_VC, O_RDWR);
if (fd < 0) {
bb_perror_msg_and_die("Error opening " CURRENT_VC);
}
if (screen_map_load(fd, stdin)) {
bb_perror_msg_and_die("Error loading acm");
}
write(fd, "\033(K", 3);
return EXIT_SUCCESS;
}
static int screen_map_load(int fd, FILE * fp)
{
struct stat stbuf;
unicode wbuf[E_TABSZ];
unsigned char buf[E_TABSZ];
int parse_failed = 0;
int is_unicode;
if (fstat(fileno(fp), &stbuf))
bb_perror_msg_and_die("Cannot stat map file");
/* first try a UTF screen-map: either ASCII (no restriction) or binary (regular file) */
if (!
(parse_failed =
(-1 == uni_screen_map_read_ascii(fp, wbuf, &is_unicode)))
|| (S_ISREG(stbuf.st_mode) && (stbuf.st_size == (sizeof(unicode) * E_TABSZ)))) { /* test for binary UTF map by size */
if (parse_failed) {
if (-1 == fseek(fp, 0, SEEK_SET)) {
if (errno == ESPIPE)
bb_error_msg_and_die("16bit screen-map MUST be a regular file.");
else
bb_perror_msg_and_die("fseek failed reading binary 16bit screen-map");
}
if (fread(wbuf, sizeof(unicode) * E_TABSZ, 1, fp) != 1)
bb_perror_msg_and_die("Cannot read [new] map from file");
#if 0
else
bb_error_msg("Input screen-map is binary.");
#endif
}
/* if it was effectively a 16-bit ASCII, OK, else try to read as 8-bit map */
/* same if it was binary, ie. if parse_failed */
if (parse_failed || is_unicode) {
if (ioctl(fd, PIO_UNISCRNMAP, wbuf))
bb_perror_msg_and_die("PIO_UNISCRNMAP ioctl");
else
return 0;
}
}
/* rewind... */
if (-1 == fseek(fp, 0, SEEK_SET)) {
if (errno == ESPIPE)
bb_error_msg("Assuming 8bit screen-map - MUST be a regular file."),
exit(1);
else
bb_perror_msg_and_die("fseek failed assuming 8bit screen-map");
}
/* ... and try an old 8-bit screen-map */
if (!(parse_failed = (-1 == old_screen_map_read_ascii(fp, buf))) ||
(S_ISREG(stbuf.st_mode) && (stbuf.st_size == E_TABSZ))) { /* test for binary old 8-bit map by size */
if (parse_failed) {
if (-1 == fseek(fp, 0, SEEK_SET)) {
if (errno == ESPIPE)
/* should not - it succedeed above */
bb_error_msg_and_die("fseek() returned ESPIPE !");
else
bb_perror_msg_and_die("fseek for binary 8bit screen-map");
}
if (fread(buf, E_TABSZ, 1, fp) != 1)
bb_perror_msg_and_die("Cannot read [old] map from file");
#if 0
else
bb_error_msg("Input screen-map is binary.");
#endif
}
if (ioctl(fd, PIO_SCRNMAP, buf))
bb_perror_msg_and_die("PIO_SCRNMAP ioctl");
else
return 0;
}
bb_error_msg("Error parsing symbolic map");
return(1);
}
/*
* - reads `fp' as a 16-bit ASCII SFM file.
* - returns -1 on error.
* - returns it in `unicode' in an E_TABSZ-elements array.
* - sets `*is_unicode' flagiff there were any non-8-bit
* (ie. real 16-bit) mapping.
*
* FIXME: ignores everything after second word
*/
static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
{
char buffer[256]; /* line buffer reading file */
char *p, *q; /* 1st + 2nd words in line */
int in, on; /* the same, as numbers */
int tmp_is_unicode; /* tmp for is_unicode calculation */
int i; /* loop index - result holder */
int ret_code = 0; /* return code */
sigset_t acmsigset, old_sigset;
assert(is_unicode);
*is_unicode = 0;
/* first 128 codes defaults to ASCII */
for (i = 0; i < 128; i++)
buf[i] = i;
/* remaining defaults to replacement char (usually E_TABSZ = 256) */
for (; i < E_TABSZ; i++)
buf[i] = 0xfffd;
/* block SIGCHLD */
sigemptyset(&acmsigset);
sigaddset(&acmsigset, SIGCHLD);
sigprocmask(SIG_BLOCK, &acmsigset, &old_sigset);
do {
if (NULL == fgets(buffer, sizeof(buffer), fp)) {
if (feof(fp))
break;
else
bb_perror_msg_and_die("uni_screen_map_read_ascii() can't read line");
}
/* get "charset-relative charcode", stripping leading spaces */
p = strtok(buffer, " \t\n");
/* skip empty lines and comments */
if (!p || *p == '#')
continue;
/* get unicode mapping */
q = strtok(NULL, " \t\n");
if (q) {
in = ctoi(p, NULL);
if (in < 0 || in > 255) {
ret_code = -1;
break;
}
on = ctoi(q, &tmp_is_unicode);
if (in < 0 && on > 65535) {
ret_code = -1;
break;
}
*is_unicode |= tmp_is_unicode;
buf[in] = on;
} else {
ret_code = -1;
break;
}
}
while (1); /* terminated by break on feof() */
/* restore sig mask */
sigprocmask(SIG_SETMASK, &old_sigset, NULL);
return ret_code;
}
static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
{
char buffer[256];
int in, on;
char *p, *q;
for (in = 0; in < 256; in++)
buf[in] = in;
while (fgets(buffer, sizeof(buffer) - 1, fp)) {
p = strtok(buffer, " \t\n");
if (!p || *p == '#')
continue;
q = strtok(NULL, " \t\n#");
if (q) {
in = ctoi(p, NULL);
if (in < 0 || in > 255)
return -1;
on = ctoi(q, NULL);
if (in < 0 && on > 255)
return -1;
buf[in] = on;
} else
return -1;
}
return (0);
}
/*
* - converts a string into an int.
* - supports dec and hex bytes, hex UCS2, single-quoted byte and UTF8 chars.
* - returns the converted value
* - if `is_unicode != NULL', use it to tell whether it was unicode
*
* CAVEAT: will report valid UTF mappings using only 1 byte as 8-bit ones.
*/
static long int ctoi(unsigned char *s, int *is_unicode)
{
int i;
size_t ls;
ls = strlen(s);
if (is_unicode)
*is_unicode = 0;
/* hex-specified UCS2 */
if ((strncmp(s, "U+", 2) == 0) &&
(strspn(s + 2, "0123456789abcdefABCDEF") == ls - 2)) {
sscanf(s + 2, "%x", &i);
if (is_unicode)
*is_unicode = 1;
}
/* hex-specified byte */
else if ((ls <= 4) && (strncmp(s, "0x", 2) == 0) &&
(strspn(s + 2, "0123456789abcdefABCDEF") == ls - 2))
sscanf(s + 2, "%x", &i);
/* oct-specified number (byte) */
else if ((*s == '0') && (strspn(s, "01234567") == ls))
sscanf(s, "%o", &i);
/* dec-specified number (byte) */
else if (strspn(s, "0123456789") == ls)
sscanf(s, "%d", &i);
/* single-byte quoted char */
else if ((strlen(s) == 3) && (s[0] == '\'') && (s[2] == '\''))
i = s[1];
/* multi-byte UTF8 quoted char */
else if ((s[0] == '\'') && (s[ls - 1] == '\'')) {
s[ls - 1] = 0; /* ensure we'll not "parse UTF too far" */
i = utf8_to_ucs2(s + 1);
if (is_unicode)
*is_unicode = 1;
} else
return (-1);
return (i);
}
static unicode utf8_to_ucs2(char *buf)
{
int utf_count = 0;
long utf_char = 0;
unicode tc = 0;
unsigned char c;
do {
c = *buf;
buf++;
/* if byte should be part of multi-byte sequence */
if (c & 0x80) {
/* if we have already started to parse a UTF8 sequence */
if (utf_count > 0 && (c & 0xc0) == 0x80) {
utf_char = (utf_char << 6) | (c & 0x3f);
utf_count--;
if (utf_count == 0)
tc = utf_char;
else
continue;
} else { /* Possibly 1st char of a UTF8 sequence */
if ((c & 0xe0) == 0xc0) {
utf_count = 1;
utf_char = (c & 0x1f);
} else if ((c & 0xf0) == 0xe0) {
utf_count = 2;
utf_char = (c & 0x0f);
} else if ((c & 0xf8) == 0xf0) {
utf_count = 3;
utf_char = (c & 0x07);
} else if ((c & 0xfc) == 0xf8) {
utf_count = 4;
utf_char = (c & 0x03);
} else if ((c & 0xfe) == 0xfc) {
utf_count = 5;
utf_char = (c & 0x01);
} else
utf_count = 0;
continue;
}
} else { /* not part of multi-byte sequence - treat as ASCII
* this makes incomplete sequences to be ignored
*/
tc = c;
utf_count = 0;
}
}
while (utf_count);
return tc;
}
+1 -3
View File
@@ -46,9 +46,7 @@ extern int loadfont_main(int argc, char **argv)
if (argc != 1)
bb_show_usage();
fd = open(CURRENT_VC, O_RDWR);
if (fd < 0)
bb_perror_msg_and_die("Error opening " CURRENT_VC);
fd = bb_xopen(CURRENT_VC, O_RDWR);
loadnewfont(fd);
return EXIT_SUCCESS;
+13 -20
View File
@@ -37,43 +37,35 @@ struct kbentry {
unsigned char kb_index;
unsigned short kb_value;
};
static const int KDSKBENT = 0x4B47; /* sets one entry in translation table */
/* sets one entry in translation table */
#define KDSKBENT 0x4B47
/* From <linux/keyboard.h> */
static const int NR_KEYS = 128;
static const int MAX_NR_KEYMAPS = 256;
#define NR_KEYS 128
#define MAX_NR_KEYMAPS 256
int loadkmap_main(int argc, char **argv)
{
struct kbentry ke;
u_short *ibuff;
int i, j, fd, readsz, pos, ibuffsz = NR_KEYS * sizeof(u_short);
char flags[MAX_NR_KEYMAPS], buff[7];
int i, j, fd;
u_short ibuff[NR_KEYS];
char flags[MAX_NR_KEYMAPS];
char buff[7];
if (argc != 1)
bb_show_usage();
fd = open(CURRENT_VC, O_RDWR);
if (fd < 0)
bb_perror_msg_and_die("Error opening " CURRENT_VC);
fd = bb_xopen(CURRENT_VC, O_RDWR);
read(0, buff, 7);
if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7))
if ((bb_full_read(0, buff, 7) != 7) || (strncmp(buff, BINARY_KEYMAP_MAGIC, 7) != 0))
bb_error_msg_and_die("This is not a valid binary keymap.");
if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS))
if (bb_full_read(0, flags, MAX_NR_KEYMAPS) != MAX_NR_KEYMAPS)
bb_perror_msg_and_die("Error reading keymap flags");
ibuff = (u_short *) xmalloc(ibuffsz);
for (i = 0; i < MAX_NR_KEYMAPS; i++) {
if (flags[i] == 1) {
pos = 0;
while (pos < ibuffsz) {
if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos)) < 0)
bb_perror_msg_and_die("Error reading keymap");
pos += readsz;
}
bb_full_read(0, ibuff, NR_KEYS * sizeof(u_short));
for (j = 0; j < NR_KEYS; j++) {
ke.kb_index = j;
ke.kb_table = i;
@@ -82,6 +74,7 @@ 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); */
+5 -18
View File
@@ -32,34 +32,22 @@
#include "busybox.h"
#define VTNAME "/dev/tty%d"
int openvt_main(int argc, char **argv)
{
int pid;
int fd;
int vtno;
char vtname[sizeof VTNAME + 2];
char vtname[sizeof VC_FORMAT + 2];
if (argc < 3)
bb_show_usage();
if (!isdigit(argv[1][0]))
bb_show_usage();
vtno = (int) atol(argv[1]);
/* if (vtno <= 0 || vtno > 63) */
if (vtno <= 0 || vtno > 12)
bb_error_msg_and_die("Illegal vt number (%d)", vtno);
sprintf(vtname, VTNAME, vtno);
/* check for Illegal vt number: < 1 or > 12 */
sprintf(vtname, VC_FORMAT,(int)bb_xgetlarg(argv[1], 10, 1, 12));
argv+=2;
argc-=2;
if((pid = fork()) == 0) {
if(fork() == 0) {
/* leave current vt */
#ifdef ESIX_5_3_2_D
@@ -73,8 +61,7 @@ int openvt_main(int argc, char **argv)
close(0); /* so that new vt becomes stdin */
/* and grab new one */
if ((fd = open(vtname, O_RDWR)) == -1)
bb_perror_msg_and_die("could not open %s", vtname);
fd = bb_xopen(vtname, O_RDWR);
/* Reassign stdout and sterr */
close(1);
+14 -2
View File
@@ -21,13 +21,25 @@
*
*/
/* no options, no getopt */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "busybox.h"
extern int reset_main(int argc, char **argv)
{
printf("\033[?25h\033c\033[J");
return EXIT_SUCCESS;
if (isatty(0) || isatty(0) || isatty(0)) {
/* See 'man 4 console_codes' for details:
* "ESC c" -- Reset
* "ESC ( K" -- Select user mapping
* "ESC [ J" -- Erase display
* "ESC [ 0 m" -- Reset all Graphics Rendition display attributes
* "ESC [ ? 25 h" -- Make cursor visible.
*/
printf("\033c\033(K\033[J\033[0m\033[?25h");
}
return EXIT_SUCCESS;
}
+36 -33
View File
@@ -17,7 +17,7 @@ config CONFIG_CAL
bool "cal"
default n
help
cal is used to display a montly calender.
cal is used to display a monthly calender.
config CONFIG_CAT
bool "cat"
@@ -30,7 +30,7 @@ config CONFIG_CHGRP
bool "chgrp"
default n
help
chgrp is used to change the group owership of files.
chgrp is used to change the group ownership of files.
config CONFIG_CHMOD
bool "chmod"
@@ -42,7 +42,7 @@ config CONFIG_CHOWN
bool "chown"
default n
help
chown is used too change the user and/or group ownership
chown is used to change the user and/or group ownership
of files.
config CONFIG_CHROOT
@@ -114,14 +114,14 @@ config CONFIG_DIRNAME
bool "dirname"
default n
help
dirname is used to strip a non directory suffix from
dirname is used to strip a non-directory suffix from
a file name.
config CONFIG_DOS2UNIX
bool "dos2unix/unix2dos"
default n
help
dos2unix is uses to convert a text file from DOS format to
dos2unix is used to convert a text file from DOS format to
UNIX format, and vice versa.
config CONFIG_UNIX2DOS
@@ -161,7 +161,7 @@ config CONFIG_ENV
default n
help
env is used to set an environment variable and run
a command, without options it displays the current
a command; without options it displays the current
environment.
config CONFIG_EXPR
@@ -218,6 +218,12 @@ config CONFIG_ID
help
id displays the current user and group ID names.
config CONFIG_INSTALL
bool "install"
default n
help
Copy files and set attributes.
config CONFIG_LENGTH
bool "length"
default n
@@ -347,7 +353,7 @@ config CONFIG_REALPATH
default n
help
Return the canonicalized absolute pathname.
This isnt provided by GNU shellutils, but where else does it belong.
This isn't provided by GNU shellutils, but where else does it belong.
config CONFIG_RM
bool "rm"
@@ -361,19 +367,18 @@ config CONFIG_RMDIR
help
rmdir is used to remove empty directories.
config CONFIG_SEQ
bool "seq"
default n
help
print a sequence of numbers
config CONFIG_SHA1SUM
bool "sha1sum"
default n
help
Compute and check SHA1 message digest
config CONFIG_FEATURE_SHA1SUM_CHECK
bool " Enale -c and -w options"
default n
help
Enabling the -c and -w options allow files to be checked
against pre-calculated hash values.
config CONFIG_SLEEP
bool "sleep (single integer arg with no suffix)"
default n
@@ -393,22 +398,6 @@ config CONFIG_SORT
help
sort is used to sort lines of text in specified files.
config CONFIG_FEATURE_SORT_REVERSE
bool " Enable reverse sort"
default y
depends on CONFIG_SORT
help
Enable the `-r' option that allows sort to sort lines of
text in reverse.
config CONFIG_FEATURE_SORT_UNIQUE
bool " Enable unique sort"
default y
depends on CONFIG_SORT
help
Enable the `-u' option that allows sort to only sort lines
that are uniq.
config CONFIG_STTY
bool "stty"
default n
@@ -429,11 +418,12 @@ config CONFIG_TAIL
from files.
config CONFIG_FEATURE_FANCY_TAIL
bool " Enable extra tail options (-c, -q, -s, and -v)"
bool " Enable extra tail options (-q, -s, and -v)"
default y
depends on CONFIG_TAIL
help
Enable tail options (-c, -q, -s, and -v).
The options (-q, -s, and -v) are provided by GNU tail, but
are not specific in the SUSv3 standard.
config CONFIG_TEE
bool "tee"
@@ -462,7 +452,7 @@ if !CONFIG_ASH && !CONFIG_HUSH && !CONFIG_LASH && !CONFIG_MSH
help
test is used to check file types and compare values,
returning an appropriate exit code. The shells (ash
and bash have test builtin).
and bash) have test builtin.
endif
config CONFIG_TOUCH
@@ -599,4 +589,17 @@ config CONFIG_FEATURE_HUMAN_READABLE
help
Allow df, du, and ls to have human readable output.
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"
default n
depends on CONFIG_MD5SUM || CONFIG_SHA1SUM
help
Enabling the -c options allows files to be checked
against pre-calculated hash values.
-s and -w are useful options when verifying checksums.
endmenu
+60 -59
View File
@@ -23,70 +23,71 @@ COREUTILS_DIR:=$(TOPDIR)coreutils/
endif
COREUTILS-y:=
COREUTILS-$(CONFIG_BASENAME) += basename.o
COREUTILS-$(CONFIG_CAL) += cal.o
COREUTILS-$(CONFIG_CAT) += cat.o
COREUTILS-$(CONFIG_CHGRP) += chgrp.o
COREUTILS-$(CONFIG_CHMOD) += chmod.o
COREUTILS-$(CONFIG_CHOWN) += chown.o
COREUTILS-$(CONFIG_CHROOT) += chroot.o
COREUTILS-$(CONFIG_CMP) += cmp.o
COREUTILS-$(CONFIG_CP) += cp.o
COREUTILS-$(CONFIG_CUT) += cut.o
COREUTILS-$(CONFIG_DATE) += date.o
COREUTILS-$(CONFIG_DD) += dd.o
COREUTILS-$(CONFIG_DF) += df.o
COREUTILS-$(CONFIG_DIRNAME) += dirname.o
COREUTILS-$(CONFIG_BASENAME) += basename.o
COREUTILS-$(CONFIG_CAL) += cal.o
COREUTILS-$(CONFIG_CAT) += cat.o
COREUTILS-$(CONFIG_CHGRP) += chgrp.o
COREUTILS-$(CONFIG_CHMOD) += chmod.o
COREUTILS-$(CONFIG_CHOWN) += chown.o
COREUTILS-$(CONFIG_CHROOT) += chroot.o
COREUTILS-$(CONFIG_CMP) += cmp.o
COREUTILS-$(CONFIG_CP) += cp.o
COREUTILS-$(CONFIG_CUT) += cut.o
COREUTILS-$(CONFIG_DATE) += date.o
COREUTILS-$(CONFIG_DD) += dd.o
COREUTILS-$(CONFIG_DF) += df.o
COREUTILS-$(CONFIG_DIRNAME) += dirname.o
COREUTILS-$(CONFIG_DOS2UNIX) += dos2unix.o
COREUTILS-$(CONFIG_DU) += du.o
COREUTILS-$(CONFIG_ECHO) += echo.o
COREUTILS-$(CONFIG_ENV) += env.o
COREUTILS-$(CONFIG_EXPR) += expr.o
COREUTILS-$(CONFIG_FALSE) += false.o
COREUTILS-$(CONFIG_FOLD) += fold.o
COREUTILS-$(CONFIG_HEAD) += head.o
COREUTILS-$(CONFIG_HOSTID) += hostid.o
COREUTILS-$(CONFIG_ID) += id.o
COREUTILS-$(CONFIG_LENGTH) += length.o
COREUTILS-$(CONFIG_LN) += ln.o
COREUTILS-$(CONFIG_LOGNAME) += logname.o
COREUTILS-$(CONFIG_LS) += ls.o
COREUTILS-$(CONFIG_MD5SUM) += md5sum.o
COREUTILS-$(CONFIG_MKDIR) += mkdir.o
COREUTILS-$(CONFIG_MKFIFO) += mkfifo.o
COREUTILS-$(CONFIG_MKNOD) += mknod.o
COREUTILS-$(CONFIG_MV) += mv.o
COREUTILS-$(CONFIG_OD) += od.o
COREUTILS-$(CONFIG_PRINTF) += printf.o
COREUTILS-$(CONFIG_PWD) += pwd.o
COREUTILS-$(CONFIG_REALPATH) += realpath.o
COREUTILS-$(CONFIG_RM) += rm.o
COREUTILS-$(CONFIG_RMDIR) += rmdir.o
COREUTILS-$(CONFIG_SHA1SUM) += sha1sum.o
COREUTILS-$(CONFIG_SLEEP) += sleep.o
COREUTILS-$(CONFIG_SORT) += sort.o
COREUTILS-$(CONFIG_STTY) += stty.o
COREUTILS-$(CONFIG_SYNC) += sync.o
COREUTILS-$(CONFIG_TAIL) += tail.o
COREUTILS-$(CONFIG_TEE) += tee.o
COREUTILS-$(CONFIG_TEST) += test.o
COREUTILS-$(CONFIG_TOUCH) += touch.o
COREUTILS-$(CONFIG_TR) += tr.o
COREUTILS-$(CONFIG_TRUE) += true.o
COREUTILS-$(CONFIG_TTY) += tty.o
COREUTILS-$(CONFIG_UNAME) += uname.o
COREUTILS-$(CONFIG_UNIQ) += uniq.o
COREUTILS-$(CONFIG_USLEEP) += usleep.o
COREUTILS-$(CONFIG_DU) += du.o
COREUTILS-$(CONFIG_ECHO) += echo.o
COREUTILS-$(CONFIG_ENV) += env.o
COREUTILS-$(CONFIG_EXPR) += expr.o
COREUTILS-$(CONFIG_FALSE) += false.o
COREUTILS-$(CONFIG_FOLD) += fold.o
COREUTILS-$(CONFIG_HEAD) += head.o
COREUTILS-$(CONFIG_HOSTID) += hostid.o
COREUTILS-$(CONFIG_ID) += id.o
COREUTILS-$(CONFIG_INSTALL) += install.o
COREUTILS-$(CONFIG_LENGTH) += length.o
COREUTILS-$(CONFIG_LN) += ln.o
COREUTILS-$(CONFIG_LOGNAME) += logname.o
COREUTILS-$(CONFIG_LS) += ls.o
COREUTILS-$(CONFIG_MD5SUM) += md5_sha1_sum.o
COREUTILS-$(CONFIG_MKDIR) += mkdir.o
COREUTILS-$(CONFIG_MKFIFO) += mkfifo.o
COREUTILS-$(CONFIG_MKNOD) += mknod.o
COREUTILS-$(CONFIG_MV) += mv.o
COREUTILS-$(CONFIG_OD) += od.o
COREUTILS-$(CONFIG_PRINTF) += printf.o
COREUTILS-$(CONFIG_PWD) += pwd.o
COREUTILS-$(CONFIG_REALPATH) += realpath.o
COREUTILS-$(CONFIG_RM) += rm.o
COREUTILS-$(CONFIG_RMDIR) += rmdir.o
COREUTILS-$(CONFIG_SEQ) += seq.o
COREUTILS-$(CONFIG_SHA1SUM) += md5_sha1_sum.o
COREUTILS-$(CONFIG_SLEEP) += sleep.o
COREUTILS-$(CONFIG_SORT) += sort.o
COREUTILS-$(CONFIG_STTY) += stty.o
COREUTILS-$(CONFIG_SYNC) += sync.o
COREUTILS-$(CONFIG_TAIL) += tail.o
COREUTILS-$(CONFIG_TEE) += tee.o
COREUTILS-$(CONFIG_TEST) += test.o
COREUTILS-$(CONFIG_TOUCH) += touch.o
COREUTILS-$(CONFIG_TR) += tr.o
COREUTILS-$(CONFIG_TRUE) += true.o
COREUTILS-$(CONFIG_TTY) += tty.o
COREUTILS-$(CONFIG_UNAME) += uname.o
COREUTILS-$(CONFIG_UNIQ) += uniq.o
COREUTILS-$(CONFIG_USLEEP) += usleep.o
COREUTILS-$(CONFIG_UUDECODE) += uudecode.o
COREUTILS-$(CONFIG_UUENCODE) += uuencode.o
COREUTILS-$(CONFIG_WATCH) += watch.o
COREUTILS-$(CONFIG_WC) += wc.o
COREUTILS-$(CONFIG_WHO) += who.o
COREUTILS-$(CONFIG_WHOAMI) += whoami.o
COREUTILS-$(CONFIG_YES) += yes.o
COREUTILS-$(CONFIG_WATCH) += watch.o
COREUTILS-$(CONFIG_WC) += wc.o
COREUTILS-$(CONFIG_WHO) += who.o
COREUTILS-$(CONFIG_WHOAMI) += whoami.o
COREUTILS-$(CONFIG_YES) += yes.o
libraries-y+=$(COREUTILS_DIR)$(COREUTILS_AR)
$(COREUTILS_DIR)$(COREUTILS_AR): $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y))
$(AR) -ro $@ $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y))
+1 -14
View File
@@ -1,19 +1,6 @@
/* NOTE:
*
* Apparently, all "Steven J. Merrifield" did was grab the util-linux cal applet,
* spend maybe 5 minutes integrating it into busybox, slapped a copyright on it,
* and submitted it. I certainly saw no evidence of any attempt at size reduction.
* Not only do I consider his copyright below meaningless, I also consider his
* actions shameful.
*
* Manuel Novoa III (mjn3@codepoet.org)
*/
/*
* Calendar implementation for busybox
*
* Copyright (C) 2001 by Steven J. Merrifield <steve@labyrinth.net.au>
*
* See original copyright at the end of this file
*
* This program is free software; you can redistribute it and/or modify
@@ -337,7 +324,7 @@ static char *build_row(char *p, int *dp)
do {
if ((day = *dp++) != SPACE) {
if (julian) {
*++p;
++p;
if (day >= 100) {
*p = '0';
p[-1] = (day / 100) + '0';
+1 -1
View File
@@ -54,7 +54,7 @@ extern int cat_main(int argc, char **argv)
do {
if ((f = bb_wfopen_input(*argv)) != NULL) {
int r = bb_copyfd(fileno(f), STDOUT_FILENO, 0);
int r = bb_copyfd_eof(fileno(f), STDOUT_FILENO);
bb_fclose_nonstdin(f);
if (r >= 0) {
continue;
+1 -5
View File
@@ -48,7 +48,6 @@ int chgrp_main(int argc, char **argv)
long gid;
int recursiveFlag;
int retval = EXIT_SUCCESS;
char *p;
recursiveFlag = bb_getopt_ulflags(argc, argv, "R");
@@ -59,10 +58,7 @@ int chgrp_main(int argc, char **argv)
argv += optind;
/* Find the selected group */
gid = strtoul(*argv, &p, 10); /* maybe it's already numeric */
if (*p || (p == *argv)) { /* trailing chars or nonnumeric */
gid = my_getgrnam(*argv);
}
gid = get_ug_id(*argv, my_getgrnam);
++argv;
/* Ok, ready to do the deed now */
+1 -13
View File
@@ -43,6 +43,7 @@ static int (*chown_func)(const char *, uid_t, gid_t) = chown;
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
{
if (chown_func(fileName, uid, (gid == -1) ? statbuf->st_gid : gid) == 0) {
chmod(fileName, statbuf->st_mode);
return (TRUE);
}
bb_perror_msg("%s", fileName); /* Avoid multibyte problems. */
@@ -52,19 +53,6 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
#define FLAG_R 1
#define FLAG_h 2
static unsigned long get_ug_id(const char *s, long (*my_getxxnam)(const char *))
{
unsigned long r;
char *p;
r = strtoul(s, &p, 10);
if (*p || (s == p)) {
r = my_getxxnam(s);
}
return r;
}
int chown_main(int argc, char **argv)
{
int flags;
+1 -1
View File
@@ -43,7 +43,7 @@ int chroot_main(int argc, char **argv)
if (argc == 2) {
argv -= 2;
if (!(*argv = getenv("SHELL"))) {
*argv = (char *) "/bin/sh";
*argv = (char *) DEFAULT_SHELL;
}
argv[1] = (char *) "-i";
}
+8 -1
View File
@@ -41,7 +41,8 @@
#include "busybox.h"
#include "libcoreutils/coreutils.h"
static const char cp_opts[] = "pdRfia"; /* WARNING!! ORDER IS IMPORTANT!! */
/* WARNING!! ORDER IS IMPORTANT!! */
static const char cp_opts[] = "pdRfiar";
extern int cp_main(int argc, char **argv)
{
@@ -66,6 +67,12 @@ extern int cp_main(int argc, char **argv)
if (flags & 32) {
flags |= (FILEUTILS_PRESERVE_STATUS | FILEUTILS_RECUR | FILEUTILS_DEREFERENCE);
}
if (flags & 64) {
/* Make -r a synonym for -R,
* -r was marked as obsolete in SUSv3, but is included for compatability
*/
flags |= FILEUTILS_RECUR;
}
flags ^= FILEUTILS_DEREFERENCE; /* The sense of this flag was reversed. */
+4 -4
View File
@@ -57,7 +57,7 @@ int dd_main(int argc, char **argv)
off_t skip = 0;
int sync_flag = FALSE;
int noerror = FALSE;
int trunc = TRUE;
int trunc_flag = TRUE;
int oflag;
int ifd;
int ofd;
@@ -83,7 +83,7 @@ int dd_main(int argc, char **argv)
buf = argv[i]+5;
while (1) {
if (strncmp("notrunc", buf, 7) == 0) {
trunc = FALSE;
trunc_flag = FALSE;
buf += 7;
} else if (strncmp("sync", buf, 4) == 0) {
sync_flag = TRUE;
@@ -115,7 +115,7 @@ int dd_main(int argc, char **argv)
if (outfile != NULL) {
oflag = O_WRONLY | O_CREAT;
if (!seek && trunc) {
if (!seek && trunc_flag) {
oflag |= O_TRUNC;
}
@@ -123,7 +123,7 @@ int dd_main(int argc, char **argv)
bb_perror_msg_and_die("%s", outfile);
}
if (seek && trunc) {
if (seek && trunc_flag) {
if (ftruncate(ofd, seek * bs) < 0) {
struct stat st;
+1 -1
View File
@@ -62,7 +62,7 @@ extern int env_main(int argc, char** argv)
char **ep, *p;
char *cleanenv[1] = { NULL };
unsigned long opt;
llist_t *unset_env;
llist_t *unset_env = NULL;
extern char **environ;
bb_opt_complementaly = "u*";
+80 -81
View File
@@ -7,6 +7,7 @@
*
* Busybox modifications
* Copyright (c) 2000 Edward Betts <edward@debian.org>.
* Aug 2003 Vladimir Oleynik - reduced 464 bytes.
*
* 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
@@ -40,6 +41,7 @@
#include <stdlib.h>
#include <regex.h>
#include <sys/types.h>
#include <errno.h>
#include "busybox.h"
@@ -115,7 +117,7 @@ static VALUE *str_value (char *s)
v = xmalloc (sizeof(VALUE));
v->type = string;
v->u.s = strdup (s);
v->u.s = bb_xstrdup (s);
return v;
}
@@ -135,10 +137,8 @@ static int null (VALUE *v)
switch (v->type) {
case integer:
return v->u.i == 0;
case string:
default: /* string: */
return v->u.s[0] == '\0' || strcmp (v->u.s, "0") == 0;
default:
abort ();
}
}
@@ -156,24 +156,20 @@ static void tostring (VALUE *v)
static int toarith (VALUE *v)
{
int i;
if(v->type == string) {
int i;
char *e;
switch (v->type) {
case integer:
return 1;
case string:
i = 0;
/* Don't interpret the empty string as an integer. */
if (v->u.s == 0)
return 0;
i = atoi(v->u.s);
free (v->u.s);
v->u.i = i;
v->type = integer;
return 1;
default:
abort ();
/* Don't interpret the empty string as an integer. */
/* Currently does not worry about overflow or int/long differences. */
i = (int) strtol(v->u.s, &e, 10);
if ((v->u.s == e) || *e)
return 0;
free (v->u.s);
v->u.i = i;
v->type = integer;
}
return 1;
}
/* Return nonzero if the next token matches STR exactly.
@@ -189,56 +185,59 @@ nextarg (char *str)
/* The comparison operator handling functions. */
#define cmpf(name, rel) \
static int name (VALUE *l, VALUE *r) \
{ \
if (l->type == string || r->type == string) { \
tostring (l); \
tostring (r); \
return strcmp (l->u.s, r->u.s) rel 0; \
} \
else \
return l->u.i rel r->u.i; \
}
cmpf (less_than, <)
cmpf (less_equal, <=)
cmpf (equal, ==)
cmpf (not_equal, !=)
cmpf (greater_equal, >=)
cmpf (greater_than, >)
static int cmp_common (VALUE *l, VALUE *r, int op)
{
int cmpval;
#undef cmpf
if (l->type == string || r->type == string) {
tostring (l);
tostring (r);
cmpval = strcmp (l->u.s, r->u.s);
}
else
cmpval = l->u.i - r->u.i;
switch(op) {
case '<':
return cmpval < 0;
case ('L'+'E'):
return cmpval <= 0;
case '=':
return cmpval == 0;
case '!':
return cmpval != 0;
case '>':
return cmpval > 0;
default: /* >= */
return cmpval >= 0;
}
}
/* The arithmetic operator handling functions. */
#define arithf(name, op) \
static \
int name (VALUE *l, VALUE *r) \
{ \
if (!toarith (l) || !toarith (r)) \
bb_error_msg_and_die ("non-numeric argument"); \
return l->u.i op r->u.i; \
static int arithmetic_common (VALUE *l, VALUE *r, int op)
{
int li, ri;
if (!toarith (l) || !toarith (r))
bb_error_msg_and_die ("non-numeric argument");
li = l->u.i;
ri = r->u.i;
if((op == '/' || op == '%') && ri == 0)
bb_error_msg_and_die ( "division by zero");
switch(op) {
case '+':
return li + ri;
case '-':
return li - ri;
case '*':
return li * ri;
case '/':
return li / ri;
default:
return li % ri;
}
}
#define arithdivf(name, op) \
static int name (VALUE *l, VALUE *r) \
{ \
if (!toarith (l) || !toarith (r)) \
bb_error_msg_and_die ( "non-numeric argument"); \
if (r->u.i == 0) \
bb_error_msg_and_die ( "division by zero"); \
return l->u.i op r->u.i; \
}
arithf (plus, +)
arithf (minus, -)
arithf (multiply, *)
arithdivf (divide, /)
arithdivf (mod, %)
#undef arithf
#undef arithdivf
/* Do the : operator.
SV is the VALUE for the lhs (the string),
PV is the VALUE for the rhs (the pattern). */
@@ -408,21 +407,21 @@ static VALUE *eval5 (void)
static VALUE *eval4 (void)
{
VALUE *l, *r;
int (*fxn) (VALUE *, VALUE *), val;
int op, val;
l = eval5 ();
while (1) {
if (nextarg ("*"))
fxn = multiply;
op = '*';
else if (nextarg ("/"))
fxn = divide;
op = '/';
else if (nextarg ("%"))
fxn = mod;
op = '%';
else
return l;
args++;
r = eval5 ();
val = (*fxn) (l, r);
val = arithmetic_common (l, r, op);
freev (l);
freev (r);
l = int_value (val);
@@ -434,19 +433,19 @@ static VALUE *eval4 (void)
static VALUE *eval3 (void)
{
VALUE *l, *r;
int (*fxn) (VALUE *, VALUE *), val;
int op, val;
l = eval4 ();
while (1) {
if (nextarg ("+"))
fxn = plus;
op = '+';
else if (nextarg ("-"))
fxn = minus;
op = '-';
else
return l;
args++;
r = eval4 ();
val = (*fxn) (l, r);
val = arithmetic_common (l, r, op);
freev (l);
freev (r);
l = int_value (val);
@@ -458,29 +457,29 @@ static VALUE *eval3 (void)
static VALUE *eval2 (void)
{
VALUE *l, *r;
int (*fxn) (VALUE *, VALUE *), val;
int op, val;
l = eval3 ();
while (1) {
if (nextarg ("<"))
fxn = less_than;
op = '<';
else if (nextarg ("<="))
fxn = less_equal;
op = 'L'+'E';
else if (nextarg ("=") || nextarg ("=="))
fxn = equal;
op = '=';
else if (nextarg ("!="))
fxn = not_equal;
op = '!';
else if (nextarg (">="))
fxn = greater_equal;
op = 'G'+'E';
else if (nextarg (">"))
fxn = greater_than;
op = '>';
else
return l;
args++;
r = eval3 ();
toarith (l);
toarith (r);
val = (*fxn) (l, r);
val = cmp_common (l, r, op);
freev (l);
freev (r);
l = int_value (val);
+151
View File
@@ -0,0 +1,151 @@
/*
* Copyright (C) 2003 by Glenn McGrath <bug1@optushome.com.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 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.
*
*
* TODO: -d option, need a way of recursively making directories and changing
* owner/group, will probably modify bb_make_directory(...)
*/
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <getopt.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "busybox.h"
#include "libcoreutils/coreutils.h"
#define INSTALL_OPT_CMD 1
#define INSTALL_OPT_DIRECTORY 2
#define INSTALL_OPT_PRESERVE_TIME 4
#define INSTALL_OPT_STRIP 8
#define INSTALL_OPT_GROUP 16
#define INSTALL_OPT_MODE 32
#define INSTALL_OPT_OWNER 64
static const struct option install_long_options[] = {
{ "directory", 0, NULL, 'd' },
{ "preserve-timestamps", 0, NULL, 'p' },
{ "strip", 0, NULL, 's' },
{ "group", 0, NULL, 'g' },
{ "mode", 0, NULL, 'm' },
{ "owner", 0, NULL, 'o' },
{ 0, 0, 0, 0 }
};
extern int install_main(int argc, char **argv)
{
struct stat statbuf;
mode_t mode;
uid_t uid;
gid_t gid;
char *gid_str = "-1";
char *uid_str = "-1";
char *mode_str = "0755";
int copy_flags = FILEUTILS_DEREFERENCE | FILEUTILS_FORCE;
int ret = EXIT_SUCCESS;
int flags;
int i;
bb_applet_long_options = install_long_options;
bb_opt_complementaly = "s~d:d~s";
/* -c exists for backwards compatability, its needed */
flags = bb_getopt_ulflags(argc, argv, "cdpsg:m:o:", &gid_str, &mode_str, &uid_str); /* 'a' must be 2nd */
/* Check valid options were given */
if(flags & 0x80000000UL) {
bb_show_usage();
}
/* preserve access and modification time, this is GNU behaviour, BSD only preserves modification time */
if (flags & INSTALL_OPT_PRESERVE_TIME) {
copy_flags |= FILEUTILS_PRESERVE_STATUS;
}
bb_parse_mode(mode_str, &mode);
gid = get_ug_id(gid_str, my_getgrnam);
uid = get_ug_id(uid_str, my_getpwnam);
umask(0);
/* Create directories
* dont use bb_make_directory() as it cant change uid or gid
* perhaps bb_make_directory() should be improved.
*/
if (flags & INSTALL_OPT_DIRECTORY) {
for (argv += optind; *argv; argv++) {
char *old_argv_ptr = *argv + 1;
char *argv_ptr;
do {
argv_ptr = strchr(old_argv_ptr, '/');
old_argv_ptr = argv_ptr;
if (argv_ptr) {
*argv_ptr = '\0';
old_argv_ptr++;
}
if (mkdir(*argv, mode) == -1) {
if (errno != EEXIST) {
bb_perror_msg("coulnt create %s", *argv);
ret = EXIT_FAILURE;
break;
}
}
else if (lchown(*argv, uid, gid) == -1) {
bb_perror_msg("cannot change ownership of %s", *argv);
ret = EXIT_FAILURE;
break;
}
if (argv_ptr) {
*argv_ptr = '/';
}
} while (old_argv_ptr);
}
return(ret);
}
cp_mv_stat2(argv[argc - 1], &statbuf, lstat);
for (i = optind; i < argc - 1; i++) {
unsigned char *dest;
if (S_ISDIR(statbuf.st_mode)) {
dest = concat_path_file(argv[argc - 1], basename(argv[i]));
} else {
dest = argv[argc - 1];
}
ret |= copy_file(argv[i], dest, copy_flags);
/* Set the file mode */
if (chmod(dest, mode) == -1) {
bb_perror_msg("cannot change permissions of %s", dest);
ret = EXIT_FAILURE;
}
/* Set the user and group id */
if (lchown(dest, uid, gid) == -1) {
bb_perror_msg("cannot change ownership of %s", dest);
ret = EXIT_FAILURE;
}
if (flags & INSTALL_OPT_STRIP) {
if (execlp("strip", "strip", dest, NULL) == -1) {
bb_error_msg("strip failed");
ret = EXIT_FAILURE;
}
}
}
return(ret);
}
+11 -14
View File
@@ -43,7 +43,8 @@ extern int ln_main(int argc, char **argv)
int flag;
char *last;
char *src_name;
const char *src;
char *src;
struct stat statbuf;
int (*link_func)(const char *, const char *);
flag = bb_getopt_ulflags(argc, argv, "sfn");
@@ -61,7 +62,7 @@ extern int ln_main(int argc, char **argv)
}
do {
src_name = 0;
src_name = NULL;
src = last;
if (is_directory(src,
@@ -70,7 +71,13 @@ extern int ln_main(int argc, char **argv)
src_name = bb_xstrdup(*argv);
src = concat_path_file(src, bb_get_last_path_component(src_name));
free(src_name);
src_name = (char *)src;
src_name = src;
}
if (!(flag & LN_SYMLINK) && stat(*argv, &statbuf)) {
bb_perror_msg(*argv);
status = EXIT_FAILURE;
free(src_name);
continue;
}
if (flag & LN_FORCE) {
@@ -84,7 +91,7 @@ extern int ln_main(int argc, char **argv)
if (link_func(*argv, src) != 0) {
bb_perror_msg(src);
status = EXIT_FAILURE;;
status = EXIT_FAILURE;
}
free(src_name);
@@ -93,13 +100,3 @@ extern int ln_main(int argc, char **argv)
return status;
}
+161 -122
View File
@@ -203,7 +203,7 @@ static int is_flask_enabled_flag;
#endif
#ifdef CONFIG_FEATURE_AUTOWIDTH
static unsigned short terminal_width = TERMINAL_WIDTH;
static int terminal_width = TERMINAL_WIDTH;
static unsigned short tabstops = COLUMN_GAP;
#else
#define tabstops COLUMN_GAP
@@ -717,21 +717,21 @@ static int list_single(struct dnode *dn)
break;
#ifdef CONFIG_FEATURE_LS_TIMESTAMPS
case LIST_FULLTIME:
printf("%24.24s ", filetime);
column += 25;
break;
case LIST_DATE_TIME:
if (all_fmt & LIST_FULLTIME) {
printf("%24.24s ", filetime);
column += 25;
break;
if ((all_fmt & LIST_FULLTIME) == 0) {
age = time(NULL) - ttime;
printf("%6.6s ", filetime + 4);
if (age < 3600L * 24 * 365 / 2 && age > -15 * 60) {
/* hh:mm if less than 6 months old */
printf("%5.5s ", filetime + 11);
} else {
printf(" %4.4s ", filetime + 20);
}
column += 13;
}
age = time(NULL) - ttime;
printf("%6.6s ", filetime + 4);
if (age < 3600L * 24 * 365 / 2 && age > -15 * 60) {
/* hh:mm if less than 6 months old */
printf("%5.5s ", filetime + 11);
} else {
printf(" %4.4s ", filetime + 20);
}
column += 13;
break;
#endif
#ifdef CONFIG_SELINUX
@@ -808,93 +808,134 @@ static int list_single(struct dnode *dn)
/*----------------------------------------------------------------------*/
static const char ls_opts[] = "1AaCdgilnsx"
#ifdef CONFIG_FEATURE_LS_FILETYPES
"Fp"
#endif
#ifdef CONFIG_FEATURE_LS_RECURSIVE
"R"
#endif
#ifdef CONFIG_FEATURE_LS_SORTFILES
"rSvX"
#endif
#ifdef CONFIG_FEATURE_LS_TIMESTAMPS
"ecut"
#endif
#ifdef CONFIG_FEATURE_LS_FOLLOWLINKS
"L"
#endif
#ifdef CONFIG_FEATURE_HUMAN_READABLE
"h"
#endif
"k"
#ifdef CONFIG_SELINUX
"K"
#endif
#ifdef CONFIG_FEATURE_AUTOWIDTH
"T:w:"
#endif
;
/* "[-]Cadil1", POSIX mandated options, busybox always supports */
/* "[-]gnsx", POSIX non-mandated options, busybox always supports */
/* "[-]Ak" GNU options, busybox always supports */
/* "[-]FLRctur", POSIX mandated options, busybox optionally supports */
/* "[-]p", POSIX non-mandated options, busybox optionally supports */
/* "[-]SXvThw", GNU options, busybox optionally supports */
/* "[-]K", SELinux mandated options, busybox optionally supports */
/* "[-]e", I think we made this one up */
#define LIST_MASK_TRIGGER LIST_SHORT
#define STYLE_MASK_TRIGGER STYLE_MASK
#define SORT_MASK_TRIGGER SORT_MASK
#define DISP_MASK_TRIGGER DISP_ROWS
#define TIME_MASK_TRIGGER TIME_MASK
#ifdef CONFIG_FEATURE_LS_TIMESTAMPS
# define LS_STR_TIMESTAMPS "cetu"
#else
# define LS_STR_TIMESTAMPS ""
#endif
#ifdef CONFIG_FEATURE_LS_SORTFILES
# define LS_STR_SORTFILES "SXrv"
#else
# define LS_STR_SORTFILES ""
#endif
#ifdef CONFIG_FEATURE_LS_FILETYPES
# define LS_STR_FILETYPES "Fp"
#else
# define LS_STR_FILETYPES ""
#endif
#ifdef CONFIG_FEATURE_LS_FOLLOWLINKS
# define LS_STR_FOLLOW_LINKS "L"
#else
# define LS_STR_FOLLOW_LINKS ""
#endif
#ifdef CONFIG_FEATURE_LS_RECURSIVE
# define LS_STR_RECURSIVE "R"
#else
# define LS_STR_RECURSIVE ""
#endif
#ifdef CONFIG_FEATURE_HUMAN_READABLE
# define LS_STR_HUMAN_READABLE "h"
#else
# define LS_STR_HUMAN_READABLE ""
#endif
#ifdef CONFIG_SELINUX
# define LS_STR_SELINUX "K"
#else
# define LS_STR_SELINUX ""
#endif
#ifdef CONFIG_FEATURE_AUTOWIDTH
# define LS_STR_AUTOWIDTH "T:w:"
#else
# define LS_STR_AUTOWIDTH ""
#endif
static const char ls_options[]="Cadil1gnsxAk" \
LS_STR_TIMESTAMPS \
LS_STR_SORTFILES \
LS_STR_FILETYPES \
LS_STR_FOLLOW_LINKS \
LS_STR_RECURSIVE \
LS_STR_HUMAN_READABLE \
LS_STR_SELINUX \
LS_STR_AUTOWIDTH;
#define LIST_MASK_TRIGGER LIST_SHORT
#define STYLE_MASK_TRIGGER STYLE_MASK
#define SORT_MASK_TRIGGER SORT_MASK
#define DISP_MASK_TRIGGER DISP_ROWS
#define TIME_MASK_TRIGGER TIME_MASK
static const unsigned opt_flags[] = {
LIST_SHORT | STYLE_SINGLE, /* 1 */
DISP_HIDDEN, /* A */
DISP_HIDDEN | DISP_DOT, /* a */
LIST_SHORT | STYLE_COLUMNS, /* C */
DISP_NOLIST, /* d */
0, /* g - ingored */
LIST_INO, /* i */
LIST_LONG | STYLE_LONG, /* l - remember LS_DISP_HR in mask! */
LIST_ID_NUMERIC, /* n */
LIST_BLOCKS, /* s */
DISP_ROWS, /* x */
#ifdef CONFIG_FEATURE_LS_FILETYPES
LIST_FILETYPE | LIST_EXEC, /* F */
LIST_FILETYPE, /* p */
#endif
#ifdef CONFIG_FEATURE_LS_RECURSIVE
DISP_RECURSIVE, /* R */
#endif
#ifdef CONFIG_FEATURE_LS_SORTFILES
SORT_ORDER_REVERSE, /* r */
SORT_SIZE, /* S */
SORT_VERSION, /* v */
SORT_EXT, /* v */
DISP_HIDDEN | DISP_DOT, /* a */
DISP_NOLIST, /* d */
LIST_INO, /* i */
LIST_LONG | STYLE_LONG, /* l - remember LS_DISP_HR in mask! */
LIST_SHORT | STYLE_SINGLE, /* 1 */
0, /* g - ingored */
LIST_ID_NUMERIC, /* n */
LIST_BLOCKS, /* s */
DISP_ROWS, /* x */
DISP_HIDDEN, /* A */
#ifdef CONFIG_SELINUX
LIST_CONTEXT, /* k */
#else
0, /* k - ingored */
#endif
#ifdef CONFIG_FEATURE_LS_TIMESTAMPS
LIST_FULLTIME, /* e */
#ifdef CONFIG_FEATURE_LS_SORTFILES
# ifdef CONFIG_FEATURE_LS_SORTFILES
TIME_CHANGE | SORT_CTIME, /* c */
#else
TIME_CHANGE, /* c */
#endif
#ifdef CONFIG_FEATURE_LS_SORTFILES
# else
TIME_CHANGE, /* c */
# endif
LIST_FULLTIME, /* e */
# ifdef CONFIG_FEATURE_LS_SORTFILES
SORT_MTIME, /* t */
# else
0, /* t - ignored -- is this correct? */
# endif
# ifdef CONFIG_FEATURE_LS_SORTFILES
TIME_ACCESS | SORT_ATIME, /* u */
#else
TIME_ACCESS, /* u */
# else
TIME_ACCESS, /* u */
# endif
#endif
#ifdef CONFIG_FEATURE_LS_SORTFILES
SORT_MTIME, /* t */
#else
0, /* t - ignored -- is this correct? */
SORT_ORDER_REVERSE, /* r */
SORT_SIZE, /* S */
SORT_VERSION, /* v */
SORT_EXT, /* v */
#endif
#ifdef CONFIG_FEATURE_LS_FILETYPES
LIST_FILETYPE | LIST_EXEC, /* F */
LIST_FILETYPE, /* p */
#endif
#ifdef CONFIG_FEATURE_LS_FOLLOWLINKS
FOLLOW_LINKS, /* L */
FOLLOW_LINKS, /* L */
#endif
#ifdef CONFIG_FEATURE_LS_RECURSIVE
DISP_RECURSIVE, /* R */
#endif
#ifdef CONFIG_FEATURE_HUMAN_READABLE
LS_DISP_HR, /* h */
LS_DISP_HR, /* h */
#endif
#ifndef CONFIG_SELINUX
0, /* k - ingored */
#else
LIST_CONTEXT, /* k */
#ifdef CONFIG_SELINUX
LIST_MODEBITS|LIST_NLINKS|LIST_CONTEXT|LIST_SIZE|LIST_DATE_TIME, /* K */
#endif
};
@@ -904,19 +945,26 @@ LS_DISP_HR, /* h */
extern int ls_main(int argc, char **argv)
{
struct dnode **dnf, **dnd;
int dnfiles, dndirs;
struct dnode *dn, *cur, **dnp;
int i, nfiles;
int opt;
int oi, ac;
struct dnode **dnd;
struct dnode **dnf;
struct dnode **dnp;
struct dnode *dn;
struct dnode *cur;
long opt;
int nfiles = 0;
int dnfiles;
int dndirs;
int oi;
int ac;
int i;
char **av;
#ifdef CONFIG_SELINUX
is_flask_enabled_flag = is_flask_enabled();
#ifdef CONFIG_FEATURE_AUTOWIDTH
char *tabstops_str = NULL;
char *terminal_width_str = NULL;
#endif
#ifdef CONFIG_FEATURE_AUTOWIDTH
struct winsize win = { 0, 0, 0, 0 };
#ifdef CONFIG_SELINUX
is_flask_enabled_flag = is_flask_enabled();
#endif
all_fmt = LIST_SHORT | DISP_NORMAL | STYLE_AUTO
@@ -927,12 +975,13 @@ extern int ls_main(int argc, char **argv)
| SORT_NAME | SORT_ORDER_FORWARD
#endif
;
#ifdef CONFIG_FEATURE_AUTOWIDTH
ioctl(fileno(stdout), TIOCGWINSZ, &win);
if (win.ws_col > 0)
terminal_width = win.ws_col - 1;
/* Obtain the terminal width. */
get_terminal_width_height(0, &terminal_width, NULL);
/* Go one less... */
terminal_width--;
#endif
nfiles = 0;
#ifdef CONFIG_FEATURE_LS_COLOR
if (isatty(fileno(stdout)))
@@ -940,27 +989,21 @@ extern int ls_main(int argc, char **argv)
#endif
/* process options */
while ((opt = getopt(argc, argv, ls_opts)) > 0) {
#ifdef CONFIG_FEATURE_AUTOWIDTH
if (opt == 'T') {
tabstops = atoi(optarg);
continue;
}
if (opt == 'w') {
terminal_width = atoi(optarg);
continue;
}
if (opt == ':') {
goto print_usage_message;
}
opt = bb_getopt_ulflags(argc, argv, ls_options, &tabstops_str, &terminal_width_str);
if (tabstops_str) {
tabstops = atoi(tabstops_str);
}
if (terminal_width_str) {
terminal_width = atoi(terminal_width_str);
}
#else
opt = bb_getopt_ulflags(argc, argv, ls_options);
#endif
{
unsigned int flags;
const char *p = strchr(ls_opts, opt);
if (!p) { /* shouldn't be necessary */
goto print_usage_message;
}
flags = opt_flags[(int)(p - ls_opts)];
/* 16 = maximum options minus tabsize and screewn width */
for (i = 0; i < 16; i++) {
if (opt & (1 << i)) {
unsigned int flags = opt_flags[i];
if (flags & LIST_MASK_TRIGGER) {
all_fmt &= ~LIST_MASK;
}
@@ -992,7 +1035,6 @@ extern int ls_main(int argc, char **argv)
}
}
/* sort out which command line options take precedence */
#ifdef CONFIG_FEATURE_LS_RECURSIVE
if (all_fmt & DISP_NOLIST)
@@ -1091,7 +1133,4 @@ extern int ls_main(int argc, char **argv)
}
}
return (status);
print_usage_message:
bb_show_usage();
}
+203
View File
@@ -0,0 +1,203 @@
/*
* Copyright (C) 2003 Glenn L. McGrath
* Copyright (C) 2003 Erik Andersen
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "busybox.h"
#define FLAG_SILENT 1
#define FLAG_CHECK 2
#define FLAG_WARN 4
/* This might be usefull elsewhere */
static unsigned char *hash_bin_to_hex(unsigned char *hash_value,
unsigned char hash_length)
{
int x, len, max;
unsigned char *hex_value;
max = (hash_length * 2) + 2;
hex_value = xmalloc(max);
for (x = len = 0; x < hash_length; x++) {
len += snprintf(hex_value + len, max - len, "%02x", hash_value[x]);
}
return (hex_value);
}
static uint8_t *hash_file(const char *filename, uint8_t hash_algo)
{
uint8_t *hash_value_bin;
uint8_t *hash_value = NULL;
uint8_t hash_length;
int src_fd;
if (strcmp(filename, "-") == 0) {
src_fd = fileno(stdin);
} else {
src_fd = open(filename, O_RDONLY);
}
if (hash_algo == HASH_MD5) {
hash_length = 16;
} else {
hash_length = 20;
}
hash_value_bin = xmalloc(hash_length);
if ((src_fd != -1) && (hash_fd(src_fd, -1, hash_algo, hash_value_bin) != -2)) {
hash_value = hash_bin_to_hex(hash_value_bin, hash_length);
} else {
bb_perror_msg("%s", filename);
}
close(src_fd);
return(hash_value);
}
/* This could become a common function for md5 as well, by using md5_stream */
extern int hash_files(int argc, char **argv, const uint8_t hash_algo)
{
int return_value = EXIT_SUCCESS;
uint8_t *hash_value;
#ifdef CONFIG_FEATURE_MD5_SHA1_SUM_CHECK
unsigned int flags;
flags = bb_getopt_ulflags(argc, argv, "scw");
#endif
#ifdef CONFIG_FEATURE_MD5_SHA1_SUM_CHECK
if (!(flags & FLAG_CHECK)) {
if (flags & FLAG_SILENT) {
bb_error_msg_and_die
("the -s option is meaningful only when verifying checksums");
} else if (flags & FLAG_WARN) {
bb_error_msg_and_die
("the -w option is meaningful only when verifying checksums");
}
}
#endif
if (argc == optind) {
argv[argc++] = "-";
}
#ifdef CONFIG_FEATURE_MD5_SHA1_SUM_CHECK
if (flags & FLAG_CHECK) {
FILE *pre_computed_stream;
int count_total = 0;
int count_failed = 0;
unsigned char *file_ptr = argv[optind];
char *line;
if (optind + 1 != argc) {
bb_error_msg_and_die
("only one argument may be specified when using -c");
}
if (strcmp(file_ptr, "-") == 0) {
pre_computed_stream = stdin;
} else {
pre_computed_stream = bb_xfopen(file_ptr, "r");
}
while ((line = bb_get_chomped_line_from_file(pre_computed_stream)) != NULL) {
char *filename_ptr;
count_total++;
filename_ptr = strstr(line, " ");
if (filename_ptr == NULL) {
if (flags & FLAG_WARN) {
bb_error_msg("Invalid format");
}
free(line);
continue;
}
*filename_ptr = '\0';
filename_ptr += 2;
hash_value = hash_file(filename_ptr, hash_algo);
if (hash_value && (strcmp(hash_value, line) == 0)) {
if (!(flags & FLAG_SILENT))
printf("%s: OK\n", filename_ptr);
} else {
if (!(flags & FLAG_SILENT))
printf("%s: FAILED\n", filename_ptr);
count_failed++;
}
/* possible free(NULL) */
free(hash_value);
free(line);
}
if (count_failed && !(flags & FLAG_SILENT)) {
bb_error_msg("WARNING: %d of %d computed checksums did NOT match",
count_failed, count_total);
}
if (bb_fclose_nonstdin(pre_computed_stream) == EOF) {
bb_perror_msg_and_die("Couldnt close file %s", file_ptr);
}
} else
#endif
{
uint8_t hash_length;
if (hash_algo == HASH_MD5) {
hash_length = 16;
} else {
hash_length = 20;
}
hash_value = xmalloc(hash_length);
while (optind < argc) {
unsigned char *file_ptr = argv[optind++];
hash_value = hash_file(file_ptr, hash_algo);
if (hash_value == NULL) {
return_value++;
} else {
printf("%s %s\n", hash_value, file_ptr);
free(hash_value);
}
}
}
return (return_value);
}
#ifdef CONFIG_MD5SUM
extern int md5sum_main(int argc, char **argv)
{
return(hash_files(argc, argv, HASH_MD5));
}
#endif
#ifdef CONFIG_SHA1SUM
extern int sha1sum_main(int argc, char **argv)
{
return(hash_files(argc, argv, HASH_SHA1));
}
#endif
-1102
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -411,7 +411,7 @@ static unsigned long xstrtoul(char *arg)
assert(arg!=NULL);
errno = 0;
result = strtoul(arg, &endptr, 10);
result = strtoul(arg, &endptr, 0);
if (errno != 0 || *endptr!='\0' || endptr==arg)
fprintf(stderr, "%s", arg);
//errno = errno_save;
@@ -427,7 +427,7 @@ static long xstrtol(char *arg)
assert(arg!=NULL);
errno = 0;
result = strtoul(arg, &endptr, 10);
result = strtoul(arg, &endptr, 0);
if (errno != 0 || *endptr!='\0' || endptr==arg)
fprintf(stderr, "%s", arg);
//errno = errno_save;
+44
View File
@@ -0,0 +1,44 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* 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 "busybox.h"
extern int seq_main(int argc, char **argv)
{
double last;
double first = 1;
double increment = 1;
double i;
if (argc == 4) {
first = atof(argv[1]);
increment = atof(argv[2]);
}
else if (argc == 3) {
first = atof(argv[1]);
}
else if (argc != 2) {
bb_show_usage();
}
last = atof(argv[argc - 1]);
for (i = first; ((first <= last) ? (i <= last): (i >= last));i += increment) {
printf("%g\n", i);
}
return(EXIT_SUCCESS);
}
-492
View File
@@ -1,492 +0,0 @@
/*
* Based on shasum from http://www.netsw.org/crypto/hash/
* Majorly hacked up to use Dr Brian Gladman's sha1 code
*
* Copyright (C) 1999 Scott G. Miller
* Copyright (C) 2003 Glenn L. McGrath
* Copyright (C) 2003 Erik Andersen
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <stdint.h>
#include <endian.h>
#include <byteswap.h>
#include "busybox.h"
/*
---------------------------------------------------------------------------
Begin Dr. Gladman's sha1 code
---------------------------------------------------------------------------
*/
/*
---------------------------------------------------------------------------
Copyright (c) 2002, Dr Brian Gladman <brg@gladman.me.uk>, Worcester, UK.
All rights reserved.
LICENSE TERMS
The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
3. the copyright holder's name is not used to endorse products
built using this software without specific written permission.
ALTERNATIVELY, provided that this notice is retained in full, this product
may be distributed under the terms of the GNU General Public License (GPL),
in which case the provisions of the GPL apply INSTEAD OF those given above.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
---------------------------------------------------------------------------
Issue Date: 10/11/2002
This is a byte oriented version of SHA1 that operates on arrays of bytes
stored in memory. It runs at 22 cycles per byte on a Pentium P4 processor
*/
#define SHA1_BLOCK_SIZE 64
#define SHA1_DIGEST_SIZE 20
#define SHA1_HASH_SIZE SHA1_DIGEST_SIZE
#define SHA2_GOOD 0
#define SHA2_BAD 1
/* type to hold the SHA1 context */
typedef struct
{ uint32_t count[2];
uint32_t hash[5];
uint32_t wbuf[16];
} sha1_ctx;
#define rotl32(x,n) (((x) << n) | ((x) >> (32 - n)))
#if __BYTE_ORDER == __BIG_ENDIAN
# define swap_b32(x) (x)
#elif defined(bswap_32)
# define swap_b32(x) bswap_32(x)
#else
# define swap_b32(x) ((rotl32((x), 8) & 0x00ff00ff) | (rotl32((x), 24) & 0xff00ff00))
#endif
#define SHA1_MASK (SHA1_BLOCK_SIZE - 1)
/* reverse byte order in 32-bit words */
#define ch(x,y,z) (((x) & (y)) ^ (~(x) & (z)))
#define parity(x,y,z) ((x) ^ (y) ^ (z))
#define maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
/* A normal version as set out in the FIPS. This version uses */
/* partial loop unrolling and is optimised for the Pentium 4 */
#define rnd(f,k) \
t = a; a = rotl32(a,5) + f(b,c,d) + e + k + w[i]; \
e = d; d = c; c = rotl32(b, 30); b = t
void sha1_compile(sha1_ctx ctx[1])
{
uint32_t w[80], i, a, b, c, d, e, t;
/* note that words are compiled from the buffer into 32-bit */
/* words in big-endian order so an order reversal is needed */
/* here on little endian machines */
for(i = 0; i < SHA1_BLOCK_SIZE / 4; ++i)
w[i] = swap_b32(ctx->wbuf[i]);
for(i = SHA1_BLOCK_SIZE / 4; i < 80; ++i)
w[i] = rotl32(w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16], 1);
a = ctx->hash[0];
b = ctx->hash[1];
c = ctx->hash[2];
d = ctx->hash[3];
e = ctx->hash[4];
for(i = 0; i < 20; ++i)
{
rnd(ch, 0x5a827999);
}
for(i = 20; i < 40; ++i)
{
rnd(parity, 0x6ed9eba1);
}
for(i = 40; i < 60; ++i)
{
rnd(maj, 0x8f1bbcdc);
}
for(i = 60; i < 80; ++i)
{
rnd(parity, 0xca62c1d6);
}
ctx->hash[0] += a;
ctx->hash[1] += b;
ctx->hash[2] += c;
ctx->hash[3] += d;
ctx->hash[4] += e;
}
void sha1_begin(sha1_ctx ctx[1])
{
ctx->count[0] = ctx->count[1] = 0;
ctx->hash[0] = 0x67452301;
ctx->hash[1] = 0xefcdab89;
ctx->hash[2] = 0x98badcfe;
ctx->hash[3] = 0x10325476;
ctx->hash[4] = 0xc3d2e1f0;
}
/* SHA1 hash data in an array of bytes into hash buffer and call the */
/* hash_compile function as required. */
void sha1_hash(const unsigned char data[], unsigned int len, sha1_ctx ctx[1])
{
uint32_t pos = (uint32_t)(ctx->count[0] & SHA1_MASK),
freeb = SHA1_BLOCK_SIZE - pos;
const unsigned char *sp = data;
if((ctx->count[0] += len) < len)
++(ctx->count[1]);
while(len >= freeb) /* tranfer whole blocks while possible */
{
memcpy(((unsigned char*)ctx->wbuf) + pos, sp, freeb);
sp += freeb; len -= freeb; freeb = SHA1_BLOCK_SIZE; pos = 0;
sha1_compile(ctx);
}
memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len);
}
/* SHA1 Final padding and digest calculation */
#if __BYTE_ORDER == __LITTLE_ENDIAN
static uint32_t mask[4] =
{ 0x00000000, 0x000000ff, 0x0000ffff, 0x00ffffff };
static uint32_t bits[4] =
{ 0x00000080, 0x00008000, 0x00800000, 0x80000000 };
#else
static uint32_t mask[4] =
{ 0x00000000, 0xff000000, 0xffff0000, 0xffffff00 };
static uint32_t bits[4] =
{ 0x80000000, 0x00800000, 0x00008000, 0x00000080 };
#endif
void sha1_end(unsigned char hval[], sha1_ctx ctx[1])
{
uint32_t i, cnt = (uint32_t)(ctx->count[0] & SHA1_MASK);
/* mask out the rest of any partial 32-bit word and then set */
/* the next byte to 0x80. On big-endian machines any bytes in */
/* the buffer will be at the top end of 32 bit words, on little */
/* endian machines they will be at the bottom. Hence the AND */
/* and OR masks above are reversed for little endian systems */
ctx->wbuf[cnt >> 2] = (ctx->wbuf[cnt >> 2] & mask[cnt & 3]) | bits[cnt & 3];
/* we need 9 or more empty positions, one for the padding byte */
/* (above) and eight for the length count. If there is not */
/* enough space pad and empty the buffer */
if(cnt > SHA1_BLOCK_SIZE - 9)
{
if(cnt < 60) ctx->wbuf[15] = 0;
sha1_compile(ctx);
cnt = 0;
}
else /* compute a word index for the empty buffer positions */
cnt = (cnt >> 2) + 1;
while(cnt < 14) /* and zero pad all but last two positions */
ctx->wbuf[cnt++] = 0;
/* assemble the eight byte counter in the buffer in big-endian */
/* format */
ctx->wbuf[14] = swap_b32((ctx->count[1] << 3) | (ctx->count[0] >> 29));
ctx->wbuf[15] = swap_b32(ctx->count[0] << 3);
sha1_compile(ctx);
/* extract the hash value as bytes in case the hash buffer is */
/* misaligned for 32-bit words */
for(i = 0; i < SHA1_DIGEST_SIZE; ++i)
hval[i] = (unsigned char)(ctx->hash[i >> 2] >> 8 * (~i & 3));
}
#if 0
void sha1(unsigned char hval[], const unsigned char data[], unsigned int len)
{ sha1_ctx cx[1];
sha1_begin(cx); sha1_hash(data, len, cx); sha1_end(hval, cx);
}
#endif
/*
---------------------------------------------------------------------------
End of Dr. Gladman's sha1 code
---------------------------------------------------------------------------
*/
/* Using a larger blocksize can make things _much_ faster
* by avoiding a zillion tiny little reads */
#define BLOCKSIZE 65536
/* Ensure that BLOCKSIZE is a multiple of 64. */
#if BLOCKSIZE % SHA1_BLOCK_SIZE != 0
# error "BLOCKSIZE not a multiple of 64"
#endif
static int sha1sum_stream(FILE *stream, unsigned char *hashval)
{
int result = 0;
sha1_ctx cx[1];
size_t sum, n;
RESERVE_CONFIG_BUFFER(buffer, BLOCKSIZE + 72);
/* Initialize the computation context. */
sha1_begin(cx);
/* Iterate over full file contents. */
while (1)
{
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
computation function processes the whole buffer so that with the
next round of the loop another block can be read. */
sum = 0;
/* Read block. Take care for partial reads. */
while (1)
{
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
sum += n;
if (sum == BLOCKSIZE)
break;
if (n == 0) {
/* Check for the error flag IFF N == 0, so that we don't
exit the loop after a partial read due to e.g., EAGAIN
or EWOULDBLOCK. */
if (feof (stream)) {
sum = 0;
goto process_partial_block;
}
if (ferror (stream)) {
result++;
goto all_done;
}
goto process_partial_block;
}
/* We've read at least one byte, so ignore errors. But always
check for EOF, since feof may be true even though N > 0.
Otherwise, we could end up calling fread after EOF. */
if (feof (stream))
goto process_partial_block;
}
/* Process buffer */
sha1_hash(buffer, BLOCKSIZE, cx);
}
process_partial_block:
/* Process any remaining bytes. */
if (sum > 0)
sha1_hash(buffer, sum, cx);
/* Finalize and write the hash into our buffer. */
sha1_end(hashval, cx);
all_done:
RELEASE_CONFIG_BUFFER(buffer);
return result;
}
#define FLAG_SILENT 1
#define FLAG_CHECK 2
#define FLAG_WARN 4
static unsigned char *hash_bin_to_hex(unsigned char *hash_value, unsigned char hash_length)
{
int x, len, max;
unsigned char *hex_value;
max = (hash_length * 2) + 2;
hex_value = xmalloc(max);
for (x = len = 0; x < hash_length; x++) {
len += snprintf(hex_value+len, max-len, "%02x", hash_value[x]);
}
return(hex_value);
}
FILE *wfopen_file_or_stdin(const char *file_ptr)
{
FILE *stream;
if ((file_ptr[0] == '-') && (file_ptr[1] == '\0')) {
stream = stdin;
} else {
stream = bb_wfopen(file_ptr, "r");
}
return(stream);
}
/* This could become a common function for md5 as well, by using md5_stream */
extern int authenticate(int argc, char **argv,
int (*hash_ptr)(FILE *stream, unsigned char *hashval),
const unsigned char hash_length)
{
unsigned char hash_value[hash_length];
unsigned int flags;
int return_value = EXIT_SUCCESS;
#ifdef CONFIG_FEATURE_SHA1SUM_CHECK
flags = bb_getopt_ulflags(argc, argv, "scw");
#else
flags = bb_getopt_ulflags(argc, argv, "s");
#endif
#ifdef CONFIG_FEATURE_SHA1SUM_CHECK
if (!(flags & FLAG_CHECK)) {
if (flags & FLAG_SILENT) {
bb_error_msg_and_die("the -s option is meaningful only when verifying checksums");
}
else if (flags & FLAG_WARN) {
bb_error_msg_and_die("the -w option is meaningful only when verifying checksums");
}
}
#endif
if (argc == optind) {
argv[argc++] = "-";
}
#ifdef CONFIG_FEATURE_SHA1SUM_CHECK
if (flags & FLAG_CHECK) {
FILE *pre_computed_stream;
int count_total = 0;
int count_failed = 0;
unsigned char *file_ptr = argv[optind];
if (optind + 1 != argc) {
bb_error_msg_and_die("only one argument may be specified when using -c");
}
pre_computed_stream = wfopen_file_or_stdin(file_ptr);
while (!feof(pre_computed_stream) && !ferror(pre_computed_stream)) {
FILE *stream;
char *line;
char *line_ptr;
char *hex_value;
line = bb_get_chomped_line_from_file(pre_computed_stream);
if (line == NULL) {
break;
}
count_total++;
line_ptr = strchr(line, ' ');
if (line_ptr == NULL) {
if (flags & FLAG_WARN) {
bb_error_msg("Invalid format");
}
free(line);
continue;
}
*line_ptr = '\0';
line_ptr++;
if ((flags & FLAG_WARN) && (*line_ptr != ' ')) {
bb_error_msg("Invalid format");
free(line);
continue;
}
line_ptr++;
stream = bb_wfopen(line_ptr, "r");
if (hash_ptr(stream, hash_value) == EXIT_FAILURE) {
bb_perror_msg("%s", file_ptr);
return_value = EXIT_FAILURE;
}
if (fclose(stream) == EOF) {
bb_perror_msg("Couldnt close file %s", file_ptr);
}
hex_value = hash_bin_to_hex(hash_value, hash_length);
printf("%s: ", line_ptr);
if (strcmp(hex_value, line) != 0) {
puts("FAILED");
count_failed++;
} else {
puts("ok");
}
free(line);
}
if (count_failed) {
bb_error_msg("WARNING: %d of %d computed checksum did NOT match", count_failed, count_total);
}
if (bb_fclose_nonstdin(pre_computed_stream) == EOF) {
bb_perror_msg_and_die("Couldnt close file %s", file_ptr);
}
} else
#endif
while (optind < argc) {
FILE *stream;
unsigned char *file_ptr = argv[optind];
optind++;
stream = wfopen_file_or_stdin(file_ptr);
if (stream == NULL) {
return_value = EXIT_FAILURE;
continue;
}
if (hash_ptr(stream, hash_value) == EXIT_FAILURE) {
bb_perror_msg("%s", file_ptr);
return_value = EXIT_FAILURE;
}
else if (!flags & FLAG_SILENT) {
char *hex_value = hash_bin_to_hex(hash_value, hash_length);
printf("%s %s\n", hex_value, file_ptr);
free(hex_value);
}
if (bb_fclose_nonstdin(stream) == EOF) {
bb_perror_msg("Couldnt close file %s", file_ptr);
return_value = EXIT_FAILURE;
}
}
return(return_value);
}
extern int sha1sum_main(int argc, char **argv)
{
return (authenticate(argc, argv, sha1sum_stream, SHA1_HASH_SIZE));
}
+6 -16
View File
@@ -89,9 +89,9 @@ static ssize_t tail_read(int fd, char *buf, size_t count)
}
static const char tail_opts[] =
"fn:"
"fn:c:"
#ifdef CONFIG_FEATURE_FANCY_TAIL
"c:qs:v"
"qs:v"
#endif
;
@@ -104,9 +104,7 @@ int tail_main(int argc, char **argv)
int from_top = 0;
int follow = 0;
int header_threshhold = 1;
#ifdef CONFIG_FEATURE_FANCY_TAIL
int count_bytes = 0;
#endif
char *tailbuf;
size_t tailbufsize;
@@ -132,11 +130,9 @@ int tail_main(int argc, char **argv)
case 'f':
follow = 1;
break;
#ifdef CONFIG_FEATURE_FANCY_TAIL
case 'c':
count_bytes = 1;
/* FALLS THROUGH */
#endif
case 'n':
GET_COUNT:
count = bb_xgetlarg10_sfx(optarg, tail_suffixes);
@@ -201,7 +197,7 @@ int tail_main(int argc, char **argv)
}
tailbufsize = BUFSIZ;
#ifdef CONFIG_FEATURE_FANCY_TAIL
/* tail the files */
if (from_top < count_bytes) { /* Each is 0 or 1, so true iff 0 < 1. */
/* Hence, !from_top && count_bytes */
@@ -209,7 +205,7 @@ int tail_main(int argc, char **argv)
tailbufsize = count + BUFSIZ;
}
}
#endif
buf = tailbuf = xmalloc(tailbufsize);
fmt = header_fmt + 1; /* Skip header leading newline on first output. */
@@ -237,13 +233,10 @@ int tail_main(int argc, char **argv)
if (from_top) {
nwrite = nread;
if (seen < count) {
#ifdef CONFIG_FEATURE_FANCY_TAIL
if (count_bytes) {
nwrite -= (count - seen);
seen = count;
} else
#endif
{
} else {
s = buf;
do {
--nwrite;
@@ -255,16 +248,13 @@ int tail_main(int argc, char **argv)
}
tail_xbb_full_write(buf + nread - nwrite, nwrite);
} else if (count) {
#ifdef CONFIG_FEATURE_FANCY_TAIL
if (count_bytes) {
taillen += nread;
if (taillen > count) {
memmove(tailbuf, tailbuf + taillen - count, count);
taillen = count;
}
} else
#endif
{
} else {
int k = nread;
int nbuf = 0;
+1
View File
@@ -89,6 +89,7 @@ int tee_main(int argc, char **argv)
#endif
#else
setvbuf(stdout, NULL, _IONBF, 0);
while ((c = getchar()) != EOF) {
for (p=files ; *p ; p++) {
putc(c, *p);
+160 -312
View File
@@ -1,353 +1,201 @@
/* uudecode.c -- uudecode utility.
* Copyright (C) 1994, 1995 Free Software Foundation, Inc.
/*
* GPLv2
* Copyright 2003, Glenn McGrath <bug1@optushome.com.au>
*
* This product 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 free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation; either version 2 of the License.
*
* This product 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.
* 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 product; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
* 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.
*
* Reworked to GNU style by Ian Lance Taylor, ian@airs.com, August 93.
* Based on specification from
* http://www.opengroup.org/onlinepubs/007904975/utilities/uuencode.html
*
* Original copyright notice is retained at the end of this file.
* Bugs: the spec doesnt mention anything about "`\n`\n" prior to the "end" line
*/
#include <stdio.h>
#include <errno.h>
#include <getopt.h>
#include <string.h>
#include <stdlib.h>
#include "busybox.h"
#include "pwd_.h"
#include "grp_.h"
/*struct passwd *getpwnam();*/
#include "libbb.h"
/* Single character decode. */
#define DEC(Char) (((Char) - ' ') & 077)
static int read_stduu (const char *inname)
static int read_stduu(FILE *src_stream, FILE *dst_stream)
{
char buf[2 * BUFSIZ];
char *line;
while (1) {
int n;
char *p;
while ((line = bb_get_chomped_line_from_file(src_stream)) != NULL) {
int length;
char *line_ptr = line;
if (fgets (buf, sizeof(buf), stdin) == NULL) {
bb_error_msg("%s: Short file", inname);
return FALSE;
}
p = buf;
if (strcmp(line, "end") == 0) {
return(EXIT_SUCCESS);
}
length = ((*line_ptr - 0x20) & 0x3f)* 4 / 3;
/* N is used to avoid writing out all the characters at the end of
the file. */
n = DEC (*p);
if (n <= 0)
break;
for (++p; n > 0; p += 4, n -= 3) {
char ch;
if (length <= 0) {
/* Ignore the "`\n" line, why is it even in the encode file ? */
continue;
}
if (length > 60) {
bb_error_msg_and_die("Line too long");
}
line_ptr++;
/* Tolerate an overly long line to acomadate a possible exta '`' */
if (strlen(line_ptr) < length) {
bb_error_msg_and_die("Short file");
}
if (n >= 3) {
ch = DEC (p[0]) << 2 | DEC (p[1]) >> 4;
putchar (ch);
ch = DEC (p[1]) << 4 | DEC (p[2]) >> 2;
putchar (ch);
ch = DEC (p[2]) << 6 | DEC (p[3]);
putchar (ch);
} else {
if (n >= 1) {
ch = DEC (p[0]) << 2 | DEC (p[1]) >> 4;
putchar (ch);
}
if (n >= 2) {
ch = DEC (p[1]) << 4 | DEC (p[2]) >> 2;
putchar (ch);
}
}
}
}
while (length > 0) {
/* Merge four 6 bit chars to three 8 bit chars */
fputc(((line_ptr[0] - 0x20) & 077) << 2 | ((line_ptr[1] - 0x20) & 077) >> 4, dst_stream);
line_ptr++;
length--;
if (length == 0) {
break;
}
if (fgets (buf, sizeof(buf), stdin) == NULL
|| strcmp (buf, "end\n")) {
bb_error_msg("%s: No `end' line", inname);
return FALSE;
}
fputc(((line_ptr[0] - 0x20) & 077) << 4 | ((line_ptr[1] - 0x20) & 077) >> 2, dst_stream);
line_ptr++;
length--;
if (length == 0) {
break;
}
return TRUE;
fputc(((line_ptr[0] - 0x20) & 077) << 6 | ((line_ptr[1] - 0x20) & 077), dst_stream);
line_ptr += 2;
length -= 2;
}
free(line);
}
bb_error_msg_and_die("Short file");
}
static int read_base64 (const char *inname)
static int read_base64(FILE *src_stream, FILE *dst_stream)
{
static const char b64_tab[256] = {
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*000-007*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*010-017*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*020-027*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*030-037*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*040-047*/
'\177', '\177', '\177', '\76', '\177', '\177', '\177', '\77', /*050-057*/
'\64', '\65', '\66', '\67', '\70', '\71', '\72', '\73', /*060-067*/
'\74', '\75', '\177', '\177', '\177', '\100', '\177', '\177', /*070-077*/
'\177', '\0', '\1', '\2', '\3', '\4', '\5', '\6', /*100-107*/
'\7', '\10', '\11', '\12', '\13', '\14', '\15', '\16', /*110-117*/
'\17', '\20', '\21', '\22', '\23', '\24', '\25', '\26', /*120-127*/
'\27', '\30', '\31', '\177', '\177', '\177', '\177', '\177', /*130-137*/
'\177', '\32', '\33', '\34', '\35', '\36', '\37', '\40', /*140-147*/
'\41', '\42', '\43', '\44', '\45', '\46', '\47', '\50', /*150-157*/
'\51', '\52', '\53', '\54', '\55', '\56', '\57', '\60', /*160-167*/
'\61', '\62', '\63', '\177', '\177', '\177', '\177', '\177', /*170-177*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*200-207*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*210-217*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*220-227*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*230-237*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*240-247*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*250-257*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*260-267*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*270-277*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*300-307*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*310-317*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*320-327*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*330-337*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*340-347*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*350-357*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*360-367*/
'\177', '\177', '\177', '\177', '\177', '\177', '\177', '\177', /*370-377*/
};
unsigned char buf[2 * BUFSIZ];
const char *base64_table =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n";
char term_count = 0;
while (1) {
int last_data = 0;
unsigned char *p;
while (1) {
char translated[4];
int count = 0;
if (fgets (buf, sizeof(buf), stdin) == NULL) {
bb_error_msg("%s: Short file", inname);
return FALSE;
}
p = buf;
while (count < 4) {
char *table_ptr;
char ch;
if (memcmp (buf, "====", 4) == 0)
break;
if (last_data != 0) {
bb_error_msg("%s: data following `=' padding character", inname);
return FALSE;
}
/* Get next _valid_ character */
do {
ch = fgetc(src_stream);
if (ch == EOF) {
bb_error_msg_and_die("Short file");
}
} while ((table_ptr = strchr(base64_table, ch)) == NULL);
/* The following implementation of the base64 decoding might look
a bit clumsy but I only try to follow the POSIX standard:
``All line breaks or other characters not found in the table
[with base64 characters] shall be ignored by decoding
software.'' */
while (*p != '\n') {
char c1, c2, c3;
/* Convert encoded charcter to decimal */
ch = table_ptr - base64_table;
while ((b64_tab[*p] & '\100') != 0)
if (*p == '\n' || *p++ == '=')
break;
if (*p == '\n')
/* This leaves the loop. */
continue;
c1 = b64_tab[*p++];
if (*table_ptr == '=') {
if (term_count == 0) {
translated[count] = 0;
break;
}
term_count++;
}
else if (*table_ptr == '\n') {
/* Check for terminating line */
if (term_count == 5) {
return(EXIT_SUCCESS);
}
term_count = 1;
continue;
} else {
translated[count] = ch;
count++;
term_count = 0;
}
}
while ((b64_tab[*p] & '\100') != 0)
if (*p == '\n' || *p++ == '=') {
bb_error_msg("%s: illegal line", inname);
return FALSE;
}
c2 = b64_tab[*p++];
while (b64_tab[*p] == '\177')
if (*p++ == '\n') {
bb_error_msg("%s: illegal line", inname);
return FALSE;
}
if (*p == '=') {
putchar (c1 << 2 | c2 >> 4);
last_data = 1;
break;
}
c3 = b64_tab[*p++];
while (b64_tab[*p] == '\177')
if (*p++ == '\n') {
bb_error_msg("%s: illegal line", inname);
return FALSE;
}
putchar (c1 << 2 | c2 >> 4);
putchar (c2 << 4 | c3 >> 2);
if (*p == '=') {
last_data = 1;
break;
}
else
putchar (c3 << 6 | b64_tab[*p++]);
}
}
return TRUE;
/* Merge 6 bit chars to 8 bit */
fputc(translated[0] << 2 | translated[1] >> 4, dst_stream);
if (count > 2) {
fputc(translated[1] << 4 | translated[2] >> 2, dst_stream);
}
if (count > 3) {
fputc(translated[2] << 6 | translated[3], dst_stream);
}
}
}
static int decode (const char *inname,
const char *forced_outname)
extern int uudecode_main(int argc, char **argv)
{
struct passwd *pw;
register char *p;
int mode;
char buf[2 * BUFSIZ];
char *outname;
int do_base64 = 0;
int res;
int dofre;
int (*decode_fn_ptr) (FILE * src, FILE * dst);
FILE *src_stream;
char *outname = NULL;
char *line;
int opt;
/* Search for header line. */
opt = bb_getopt_ulflags(argc, argv, "o:", &outname);
while (1) {
if (fgets (buf, sizeof (buf), stdin) == NULL) {
bb_error_msg("%s: No `begin' line", inname);
return FALSE;
}
if (optind == argc) {
src_stream = stdin;
} else if (optind + 1 == argc) {
src_stream = bb_xfopen(argv[optind], "r");
} else {
bb_show_usage();
}
if (strncmp (buf, "begin", 5) == 0) {
if (sscanf (buf, "begin-base64 %o %s", &mode, buf) == 2) {
do_base64 = 1;
break;
} else if (sscanf (buf, "begin %o %s", &mode, buf) == 2)
break;
}
}
/* Search for the start of the encoding */
while ((line = bb_get_chomped_line_from_file(src_stream)) != NULL) {
char *line_ptr = NULL;
/* If the output file name is given on the command line this rules. */
dofre = FALSE;
if (forced_outname != NULL)
outname = (char *) forced_outname;
else {
/* Handle ~user/file format. */
if (buf[0] != '~')
outname = buf;
else {
p = buf + 1;
while (*p != '/')
++p;
if (*p == '\0') {
bb_error_msg("%s: Illegal ~user", inname);
return FALSE;
}
*p++ = '\0';
pw = getpwnam (buf + 1);
if (pw == NULL) {
bb_error_msg("%s: No user `%s'", inname, buf + 1);
return FALSE;
}
outname = concat_path_file(pw->pw_dir, p);
dofre = TRUE;
}
}
if (line == NULL) {
break;
} else if (strncmp(line, "begin-base64 ", 13) == 0) {
line_ptr = line + 13;
decode_fn_ptr = read_base64;
} else if (strncmp(line, "begin ", 6) == 0) {
line_ptr = line + 6;
decode_fn_ptr = read_stduu;
}
/* Create output file and set mode. */
if (strcmp (outname, "/dev/stdout") != 0 && strcmp (outname, "-") != 0
&& (freopen (outname, "w", stdout) == NULL
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
)) {
bb_perror_msg("%s", outname); /* */
if (dofre)
free(outname);
return FALSE;
}
if (line_ptr) {
FILE *dst_stream;
int mode;
int ret;
/* We differenciate decoding standard UU encoding and base64. A
common function would only slow down the program. */
/* For each input line: */
if (do_base64)
res = read_base64 (inname);
else
res = read_stduu (inname);
if (dofre)
free(outname);
return res;
mode = strtoul(line_ptr, NULL, 8);
if (outname == NULL) {
outname = strchr(line_ptr, ' ');
if ((outname == NULL) || (*outname == '\0')) {
break;
}
outname++;
}
if (strcmp(outname, "-") == 0) {
dst_stream = stdout;
} else {
dst_stream = bb_xfopen(outname, "w");
chmod(outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO));
}
free(line);
ret = decode_fn_ptr(src_stream, dst_stream);
bb_fclose_nonstdin(src_stream);
return(ret);
}
free(line);
}
bb_error_msg_and_die("No `begin' line");
}
int uudecode_main (int argc,
char **argv)
{
int opt;
int exit_status;
const char *outname;
outname = NULL;
while ((opt = getopt(argc, argv, "o:")) != EOF) {
switch (opt) {
case 0:
break;
case 'o':
outname = optarg;
break;
default:
bb_show_usage();
}
}
if (optind == argc)
exit_status = decode ("stdin", outname) == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
else {
exit_status = EXIT_SUCCESS;
do {
if (freopen (argv[optind], "r", stdin) != NULL) {
if (decode (argv[optind], outname) != 0)
exit_status = FALSE;
} else {
bb_perror_msg("%s", argv[optind]);
exit_status = EXIT_FAILURE;
}
optind++;
}
while (optind < argc);
}
return(exit_status);
}
/* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
*
* 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>
*
* 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.
*/
+1 -1
View File
@@ -59,7 +59,7 @@ static const char tbl_std[65] = {
* buffer of at least 1+BASE64_LENGTH(length) bytes.
* where BASE64_LENGTH(len) = (4 * ((LENGTH + 2) / 3))
*/
static void uuencode (const char *s, const char *store, const int length, const char *tbl)
static void uuencode (const unsigned char *s, const char *store, const int length, const char *tbl)
{
int i;
unsigned char *p = (unsigned char *)store;
-13
View File
@@ -1,13 +0,0 @@
BusyBox for Debian
----------------------
BusyBox is being developed and maintained by Erik Andersen
<andersen@codepoet.org>.
If you find any bugs, please submit a detailed bug report to the busybox
mailing list at <busybox@busybox.net>. A well-written bug report should
include a transcript of a shell session that demonstrates the bad behavior and
enables anyone else to duplicate the bug on their own machine. Bug reports
lacking such detail may never be fixed...
Erik Andersen <andersen@codepoet.org>, Sun, 18 Jun 2000 21:52:00 -0600
+192 -2
View File
@@ -1,9 +1,199 @@
busybox-cvs (20031212-3) unstable; urgency=low
* debian/config-udeb-linux:
- Enable freeramdisk. (closes: #225360)
-- Bastian Blank <waldi@debian.org> Tue, 30 Dec 2003 22:36:50 +0100
busybox-cvs (20031212-2) unstable; urgency=low
* debian/config-udeb:
- Enable freeramdisk
* archival/libunarchive/data_extract_to_stdout.c:
- Don't extract to much (upstream).
* archival/libunarchive/data_extract_all.c:
- Don't set permissions on symlinks (upstream).
* editors/sed.c:
- Fix (upstream). (closes: #224676)
-- Bastian Blank <waldi@debian.org> Tue, 23 Dec 2003 16:59:13 +0100
busybox-cvs (20031212-1) unstable; urgency=low
* new cvs version
- fixes IOR in fdisk. (closes: #223773)
* debian/config*
- update
- remove mtab support from mount in busybox-static. (closes: #222386)
- enable progress bar for wget. (closes: #223770)
* modutils/obj/obj_s390{,x}.c
- fix abi change, R_390_GOTOFF -> R_390_GOTOFF32. (closes: #216528)
* acknowledge nmu. (closes: #216950, #216756, #215169, #215613)
-- Bastian Blank <waldi@debian.org> Fri, 12 Dec 2003 21:19:41 +0100
busybox-cvs (20030926-2.1) unstable; urgency=low
* NMU
* Remove /sbin/init from the udebs, while still leaving init support
compiled in. rootskel takes over providing init, but then calls bb init.
Remove linuxrc support from the udebs entirely. Closes: #216756
* config-floppy-udeb-linux: add minimal find, grep. Closes: #215169
* net-udeb-linux-i386: add loopback mount support. Closes: #215613
-- Joey Hess <joeyh@debian.org> Tue, 21 Oct 2003 12:47:52 -0400
busybox-cvs (20030926-2) unstable; urgency=low
* debian/config-floppy-udeb-linux
- update for new floppy images (closes: #212986, #214102)
-- Bastian Blank <waldi@debian.org> Thu, 09 Oct 2003 12:25:49 +0200
busybox-cvs (20030926-1) unstable; urgency=low
* new cvs version
* Makefile
- fix libpwdgrp link (upstream) (closes: #211675)
* Rules.mak.in
- fix optimization (closes: #212485)
* debian/config*
- update
* debian/config*udeb*
- move linux-i386 to linux (enable modutils on any linux arch)
- rename net to floppy
- enable wget status bar (closes: #211457)
* init/init.c
- workaround race conditions (closes: #212764)
-- Bastian Blank <waldi@debian.org> Fri, 26 Sep 2003 15:10:14 +0200
busybox-cvs (0.60.99.cvs20030819-3) unstable; urgency=low
* shell/ash.c
- fix signal handling (upstream)
-- Bastian Blank <waldi@debian.org> Mon, 15 Sep 2003 18:12:09 +0200
busybox-cvs (0.60.99.cvs20030819-2) unstable; urgency=low
* Fix configure permisions
* Set source Section to embedded
-- Glenn McGrath <bug1@debian.org> Mon, 25 Aug 2003 06:33:19 +0000
busybox-cvs (0.60.99.cvs20030819-1) unstable; urgency=low
* new cvs version
-- Bastian Blank <waldi@debian.org> Tue, 19 Aug 2003 13:18:54 +0200
busybox-cvs (0.60.99.cvs20030426-10) unstable; urgency=low
* archival/libunarchive/*
- add hardlink support (pending)
* debian/config-*udeb*
- add support for oldgnu tar format
-- Bastian Blank <waldi@debian.org> Tue, 10 Jun 2003 12:06:41 +0200
busybox-cvs (0.60.99.cvs20030426-9) unstable; urgency=low
* modutils/depmod.c
- fix base_dir for modules.dep
-- Bastian Blank <waldi@debian.org> Sat, 07 Jun 2003 14:52:54 +0200
busybox-cvs (0.60.99.cvs20030426-8) unstable; urgency=low
* util-linux/fdisk.c
- fix syscalls. (pending)
* libpwd/*
- don't build setgroups.o
-- Bastian Blank <waldi@debian.org> Tue, 03 Jun 2003 11:26:28 +0200
busybox-cvs (0.60.99.cvs20030426-7) unstable; urgency=low
* libbb/*syscallc.c
- fix syscalls. (upstream) (closes: #194631)
* modutils/*
- update complete objects code from upstream. (pending)
* debian/config-*udeb*
- update to busybox-applets.txt:1.14
-- Bastian Blank <waldi@debian.org> Thu, 29 May 2003 16:17:14 +0200
busybox-cvs (0.60.99.cvs20030426-6) unstable; urgency=low
* modutils/Makefile.in
- don't build anything if deactivated
-- Bastian Blank <waldi@debian.org> Sat, 24 May 2003 18:57:14 +0200
busybox-cvs (0.60.99.cvs20030426-5) unstable; urgency=low
* debian/config-*udeb*
- revert changes (closes: #192717, #192753)
- readd initrd support (workaround)
- make init quiet
* archival/tar.c
- fix usage of tar -O (upstream) (closes: #193788)
-- Bastian Blank <waldi@debian.org> Sat, 24 May 2003 13:25:36 +0200
busybox-cvs (0.60.99.cvs20030426-4) unstable; urgency=low
* debian/config-*udeb*
- update to busybox-applets.txt:1.12
* debian/rules
- use system instead of arch to determine which config file to use
-- Bastian Blank <waldi@debian.org> Fri, 09 May 2003 11:21:13 +0200
busybox-cvs (0.60.99.cvs20030426-3) unstable; urgency=low
* debian/config-udeb*
- update to busybox-applets.txt:1.11
-- Bastian Blank <waldi@debian.org> Wed, 07 May 2003 10:37:40 +0200
busybox-cvs (0.60.99.cvs20030426-2) unstable; urgency=low
* modutils/*
- modprobe failes gracefully if the module is already loaded. (pending)
- implement depmod. (pending)
* debian/config*
- update
-- Bastian Blank <waldi@debian.org> Wed, 30 Apr 2003 14:12:36 +0200
busybox-cvs (0.60.99.cvs20030426-1) unstable; urgency=low
* new cvs version
-- Bastian Blank <waldi@debian.org> Sat, 26 Apr 2003 18:33:17 +0200
busybox-cvs (0.60.99.cvs20030420-4) unstable; urgency=low
* network/libiproute/iproute.c
- fix usage of ip route flush (upstream)
-- Bastian Blank <waldi@debian.org> Fri, 25 Apr 2003 16:48:43 +0200
busybox-cvs (0.60.99.cvs20030420-3) unstable; urgency=low
* debian/config-*udeb*
- update to busybox-applets.txt:1.10
-- Bastian Blank <waldi@debian.org> Fri, 25 Apr 2003 14:03:23 +0200
busybox-cvs (0.60.99.cvs20030420-2) unstable; urgency=low
* archival/tar.c
* archival/tar.c, archival/libunarchive/data_extract_all.c
- unlink files first (upstream patch)
-- Bastian Blank <waldi@debian.org> Mon, 21 Apr 2003 12:06:57 +0200
-- Bastian Blank <waldi@debian.org> Mon, 21 Apr 2003 12:42:06 +0200
busybox-cvs (0.60.99.cvs20030420-1) unstable; urgency=low
+1
View File
@@ -0,0 +1 @@
4
+25 -11
View File
@@ -16,6 +16,7 @@ CONFIG_FEATURE_INSTALLER=y
# CONFIG_FEATURE_DEVPTS is not set
# CONFIG_FEATURE_CLEAN_UP is not set
# CONFIG_FEATURE_SUID is not set
# CONFIG_SELINUX is not set
#
# Build Options
@@ -50,12 +51,17 @@ CONFIG_FEATURE_TAR_CREATE=y
# CONFIG_FEATURE_TAR_BZIP2 is not set
# CONFIG_FEATURE_TAR_EXCLUDE is not set
CONFIG_FEATURE_TAR_GZIP=y
# CONFIG_FEATURE_TAR_COMPRESS is not set
# CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY is not set
CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
# CONFIG_FEATURE_UNARCHIVE_TAPE is not set
# CONFIG_UNCOMPRESS is not set
# CONFIG_UNZIP is not set
#
# Common options for cpio and tar
#
# CONFIG_FEATURE_UNARCHIVE_TAPE is not set
#
# Coreutils
#
@@ -80,10 +86,12 @@ CONFIG_FEATURE_FANCY_ECHO=y
# CONFIG_ENV is not set
CONFIG_EXPR=y
CONFIG_FALSE=y
# CONFIG_FOLD is not set
CONFIG_HEAD=y
# CONFIG_FEATURE_FANCY_HEAD is not set
# CONFIG_HOSTID is not set
CONFIG_ID=y
# CONFIG_INSTALL is not set
# CONFIG_LENGTH is not set
CONFIG_LN=y
# CONFIG_LOGNAME is not set
@@ -110,8 +118,6 @@ CONFIG_RMDIR=y
CONFIG_SLEEP=y
# CONFIG_FEATURE_FANCY_SLEEP is not set
CONFIG_SORT=y
# CONFIG_FEATURE_SORT_REVERSE is not set
# CONFIG_FEATURE_SORT_UNIQUE is not set
# CONFIG_STTY is not set
CONFIG_SYNC=y
CONFIG_TAIL=y
@@ -148,6 +154,11 @@ CONFIG_FEATURE_AUTOWIDTH=y
#
CONFIG_FEATURE_HUMAN_READABLE=y
#
# Common options for md5sum, sha1sum
#
# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
#
# Console Utilities
#
@@ -166,16 +177,18 @@ CONFIG_RESET=y
# Debian Utilities
#
# CONFIG_MKTEMP is not set
# CONFIG_PIPE_PROGRESS is not set
# CONFIG_READLINK is not set
# CONFIG_RUN_PARTS is not set
# CONFIG_START_STOP_DAEMON is not set
CONFIG_WHICH=y
#
# Editors
#
# CONFIG_AWK is not set
# CONFIG_PATCH is not set
CONFIG_SED=y
# CONFIG_FEATURE_SED_EMBEDED_NEWLINE is not set
# CONFIG_VI is not set
#
@@ -190,6 +203,7 @@ CONFIG_FEATURE_FIND_NEWER=y
CONFIG_FEATURE_FIND_INUM=y
CONFIG_GREP=y
# CONFIG_FEATURE_GREP_EGREP_ALIAS is not set
CONFIG_FEATURE_GREP_FGREP_ALIAS=y
# CONFIG_FEATURE_GREP_CONTEXT is not set
# CONFIG_XARGS is not set
@@ -204,7 +218,6 @@ CONFIG_FEATURE_INITRD=y
CONFIG_HALT=y
CONFIG_POWEROFF=y
CONFIG_REBOOT=y
# CONFIG_START_STOP_DAEMON is not set
# CONFIG_MESG is not set
#
@@ -229,17 +242,19 @@ CONFIG_REBOOT=y
# CONFIG_CROND is not set
# CONFIG_CRONTAB is not set
# CONFIG_DC is not set
# CONFIG_DUTMP is not set
# CONFIG_DEVFSD is not set
# CONFIG_LAST is not set
# CONFIG_HDPARM is not set
# CONFIG_MAKEDEVS is not set
# CONFIG_MT is not set
# CONFIG_STRINGS is not set
# CONFIG_TIME is not set
# CONFIG_UPDATE is not set
# CONFIG_WATCHDOG is not set
#
# Linux Module Utilities
#
# CONFIG_DEPMOD is not set
# CONFIG_INSMOD is not set
# CONFIG_LSMOD is not set
# CONFIG_MODPROBE is not set
@@ -283,6 +298,7 @@ CONFIG_ROUTE=y
CONFIG_WGET=y
CONFIG_FEATURE_WGET_STATUSBAR=y
CONFIG_FEATURE_WGET_AUTHENTICATION=y
CONFIG_FEATURE_WGET_IP6_LITERAL=y
#
# udhcp Server/Client
@@ -319,6 +335,7 @@ CONFIG_FEATURE_SH_IS_NONE=y
# System Logging Utilities
#
CONFIG_SYSLOGD=y
# CONFIG_FEATURE_ROTATE_LOGFILE is not set
# CONFIG_FEATURE_REMOTE_LOG is not set
# CONFIG_FEATURE_IPC_SYSLOG is not set
CONFIG_KLOGD=y
@@ -330,6 +347,7 @@ CONFIG_LOGGER=y
CONFIG_DMESG=y
# CONFIG_FBSET is not set
# CONFIG_FDFLUSH is not set
# CONFIG_FDFORMAT is not set
# CONFIG_FDISK is not set
# CONFIG_FREERAMDISK is not set
# CONFIG_FSCK_MINIX is not set
@@ -341,10 +359,6 @@ CONFIG_LOSETUP=y
CONFIG_MKSWAP=y
CONFIG_MORE=y
CONFIG_FEATURE_USE_TERMIOS=y
#
# Common options for ls and more
#
# CONFIG_PIVOT_ROOT is not set
# CONFIG_RDATE is not set
CONFIG_SWAPONOFF=y
+59 -69
View File
@@ -16,12 +16,13 @@ CONFIG_FEATURE_DEVFS=y
CONFIG_FEATURE_DEVPTS=y
# CONFIG_FEATURE_CLEAN_UP is not set
# CONFIG_FEATURE_SUID is not set
# CONFIG_SELINUX is not set
#
# Build Options
#
# CONFIG_STATIC is not set
# CONFIG_LFS is not set
CONFIG_LFS=y
# USING_CROSS_COMPILER is not set
EXTRA_CFLAGS_OPTIONS=""
@@ -34,8 +35,7 @@ PREFIX="./_install"
#
# Archival Utilities
#
CONFIG_AR=y
# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
# CONFIG_AR is not set
# CONFIG_BUNZIP2 is not set
# CONFIG_CPIO is not set
# CONFIG_DPKG is not set
@@ -45,14 +45,7 @@ CONFIG_GUNZIP=y
# CONFIG_GZIP is not set
# CONFIG_RPM2CPIO is not set
# CONFIG_RPM is not set
CONFIG_TAR=y
# CONFIG_FEATURE_TAR_CREATE is not set
# CONFIG_FEATURE_TAR_BZIP2 is not set
# CONFIG_FEATURE_TAR_EXCLUDE is not set
CONFIG_FEATURE_TAR_GZIP=y
# CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY is not set
CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
# CONFIG_FEATURE_UNARCHIVE_TAPE is not set
# CONFIG_TAR is not set
# CONFIG_UNCOMPRESS is not set
# CONFIG_UNZIP is not set
@@ -64,11 +57,11 @@ CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
CONFIG_CAT=y
# CONFIG_CHGRP is not set
# CONFIG_CHMOD is not set
CONFIG_CHOWN=y
# CONFIG_CHOWN is not set
CONFIG_CHROOT=y
# CONFIG_CMP is not set
# CONFIG_CP is not set
CONFIG_CUT=y
CONFIG_CP=y
# CONFIG_CUT is not set
# CONFIG_DATE is not set
# CONFIG_DD is not set
# CONFIG_DF is not set
@@ -76,19 +69,21 @@ CONFIG_CUT=y
# CONFIG_DOS2UNIX is not set
# CONFIG_DU is not set
CONFIG_ECHO=y
# CONFIG_FEATURE_FANCY_ECHO is not set
CONFIG_FEATURE_FANCY_ECHO=y
# CONFIG_ENV is not set
# CONFIG_EXPR is not set
CONFIG_FALSE=y
# CONFIG_FALSE is not set
# CONFIG_FOLD is not set
# CONFIG_HEAD is not set
# CONFIG_HOSTID is not set
# CONFIG_ID is not set
# CONFIG_INSTALL is not set
# CONFIG_LENGTH is not set
CONFIG_LN=y
# CONFIG_LOGNAME is not set
# CONFIG_LS is not set
CONFIG_MD5SUM=y
CONFIG_MKDIR=y
# CONFIG_MD5SUM is not set
# CONFIG_MKDIR is not set
# CONFIG_MKFIFO is not set
# CONFIG_MKNOD is not set
# CONFIG_MV is not set
@@ -99,10 +94,11 @@ CONFIG_MKDIR=y
CONFIG_RM=y
# CONFIG_RMDIR is not set
# CONFIG_SHA1SUM is not set
# CONFIG_SLEEP is not set
CONFIG_SLEEP=y
# CONFIG_FEATURE_FANCY_SLEEP is not set
# CONFIG_SORT is not set
# CONFIG_STTY is not set
CONFIG_SYNC=y
# CONFIG_SYNC is not set
# CONFIG_TAIL is not set
# CONFIG_TEE is not set
CONFIG_TEST=y
@@ -110,9 +106,9 @@ CONFIG_TEST=y
#
# test (forced enabled for use with shell)
#
CONFIG_TOUCH=y
# CONFIG_TOUCH is not set
# CONFIG_TR is not set
CONFIG_TRUE=y
# CONFIG_TRUE is not set
# CONFIG_TTY is not set
# CONFIG_UNAME is not set
# CONFIG_UNIQ is not set
@@ -125,6 +121,11 @@ CONFIG_TRUE=y
# CONFIG_WHOAMI is not set
# CONFIG_YES is not set
#
# Common options for cp and mv
#
CONFIG_FEATURE_PRESERVE_HARDLINKS=y
#
# Console Utilities
#
@@ -143,39 +144,44 @@ CONFIG_TRUE=y
# Debian Utilities
#
# CONFIG_MKTEMP is not set
# CONFIG_PIPE_PROGRESS is not set
# CONFIG_READLINK is not set
# CONFIG_RUN_PARTS is not set
# CONFIG_START_STOP_DAEMON is not set
# CONFIG_WHICH is not set
#
# Editors
#
# CONFIG_AWK is not set
CONFIG_SED=y
# CONFIG_FEATURE_SED_EMBEDED_NEWLINE is not set
# CONFIG_PATCH is not set
# CONFIG_SED is not set
# CONFIG_VI is not set
#
# Finding Utilities
#
# CONFIG_FIND is not set
CONFIG_FIND=y
# CONFIG_FEATURE_FIND_MTIME is not set
# CONFIG_FEATURE_FIND_PERM is not set
# CONFIG_FEATURE_FIND_TYPE is not set
# CONFIG_FEATURE_FIND_XDEV is not set
# CONFIG_FEATURE_FIND_NEWER is not set
# CONFIG_FEATURE_FIND_INUM is not set
CONFIG_GREP=y
# CONFIG_FEATURE_GREP_EGREP_ALIAS is not set
# CONFIG_FEATURE_GREP_FGREP_ALIAS is not set
# CONFIG_FEATURE_GREP_CONTEXT is not set
# CONFIG_XARGS is not set
#
# Init Utilities
#
CONFIG_INIT=y
CONFIG_FEATURE_USE_INITTAB=y
# CONFIG_FEATURE_INITRD is not set
# CONFIG_FEATURE_INIT_COREDUMPS is not set
# CONFIG_FEATURE_EXTRA_QUIET is not set
# CONFIG_INIT is not set
# CONFIG_HALT is not set
# CONFIG_POWEROFF is not set
CONFIG_REBOOT=y
# CONFIG_START_STOP_DAEMON is not set
# CONFIG_REBOOT is not set
# CONFIG_MINIT is not set
# CONFIG_MESG is not set
#
@@ -200,32 +206,31 @@ CONFIG_USE_BB_PWD_GRP=y
# CONFIG_CROND is not set
# CONFIG_CRONTAB is not set
# CONFIG_DC is not set
# CONFIG_DUTMP is not set
# CONFIG_DEVFSD is not set
# CONFIG_LAST is not set
# CONFIG_HDPARM is not set
# CONFIG_MAKEDEVS is not set
# CONFIG_MT is not set
# CONFIG_STRINGS is not set
# CONFIG_TIME is not set
# CONFIG_UPDATE is not set
# CONFIG_WATCHDOG is not set
#
# Linux Module Utilities
#
CONFIG_MODUTILS_OBJ=y
# CONFIG_DEPMOD is not set
CONFIG_INSMOD=y
# CONFIG_FEATURE_OLD_MODULE_INTERFACE is not set
CONFIG_FEATURE_NEW_MODULE_INTERFACE=y
#
# Support new (post 2.1) Linux kernels (Forced enabled)
#
# CONFIG_FEATURE_2_2_MODULES is not set
CONFIG_FEATURE_2_4_MODULES=y
# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
# CONFIG_LSMOD is not set
# CONFIG_MODPROBE is not set
CONFIG_MODPROBE=y
# CONFIG_RMMOD is not set
# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set
CONFIG_FEATURE_CHECK_TAINTED_MODULE=y
#
# Networking Utilities
@@ -239,11 +244,7 @@ CONFIG_FEATURE_NEW_MODULE_INTERFACE=y
# CONFIG_IFCONFIG is not set
# CONFIG_IFUPDOWN is not set
# CONFIG_INETD is not set
CONFIG_IP=y
CONFIG_FEATURE_IP_ADDRESS=y
CONFIG_FEATURE_IP_LINK=y
CONFIG_FEATURE_IP_ROUTE=y
# CONFIG_FEATURE_IP_TUNNEL is not set
# CONFIG_IP is not set
# CONFIG_IPCALC is not set
# CONFIG_IPADDR is not set
# CONFIG_IPLINK is not set
@@ -260,17 +261,13 @@ CONFIG_FEATURE_IP_ROUTE=y
# CONFIG_TFTP is not set
# CONFIG_TRACEROUTE is not set
# CONFIG_VCONFIG is not set
CONFIG_WGET=y
# CONFIG_FEATURE_WGET_STATUSBAR is not set
# CONFIG_FEATURE_WGET_AUTHENTICATION is not set
# CONFIG_WGET is not set
#
# udhcp Server/Client
#
# CONFIG_UDHCPD is not set
CONFIG_UDHCPC=y
CONFIG_FEATURE_UDHCP_SYSLOG=y
# CONFIG_FEATURE_UDHCP_DEBUG is not set
# CONFIG_UDHCPC is not set
#
# Process Utilities
@@ -293,16 +290,12 @@ CONFIG_FEATURE_SH_IS_ASH=y
# CONFIG_FEATURE_SH_IS_NONE is not set
CONFIG_ASH=y
#
# ash (forced enabled as default shell)
#
#
# Ash Shell Options
#
CONFIG_ASH_JOB_CONTROL=y
CONFIG_ASH_ALIAS=y
CONFIG_ASH_MATH_SUPPORT=y
# CONFIG_ASH_JOB_CONTROL is not set
# CONFIG_ASH_ALIAS is not set
# CONFIG_ASH_MATH_SUPPORT is not set
# CONFIG_ASH_GETOPTS is not set
# CONFIG_ASH_CMDCMD is not set
# CONFIG_ASH_MAIL is not set
@@ -314,23 +307,19 @@ CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
#
# Bourne Shell Options
#
CONFIG_FEATURE_COMMAND_EDITING=y
# CONFIG_FEATURE_COMMAND_EDITING is not set
# CONFIG_FEATURE_COMMAND_SAVEHISTORY is not set
CONFIG_FEATURE_COMMAND_TAB_COMPLETION=y
# CONFIG_FEATURE_COMMAND_TAB_COMPLETION is not set
# CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION is not set
CONFIG_FEATURE_COMMAND_HISTORY=15
# CONFIG_FEATURE_SH_STANDALONE_SHELL is not set
# CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN is not set
# CONFIG_FEATURE_SH_FANCY_PROMPT is not set
# CONFIG_FEATURE_SH_EXTRA_QUIET is not set
#
# System Logging Utilities
#
CONFIG_SYSLOGD=y
# CONFIG_FEATURE_REMOTE_LOG is not set
# CONFIG_FEATURE_IPC_SYSLOG is not set
CONFIG_KLOGD=y
# CONFIG_SYSLOGD is not set
# CONFIG_LOGGER is not set
#
@@ -339,6 +328,7 @@ CONFIG_KLOGD=y
# CONFIG_DMESG is not set
# CONFIG_FBSET is not set
# CONFIG_FDFLUSH is not set
# CONFIG_FDFORMAT is not set
# CONFIG_FDISK is not set
# CONFIG_FREERAMDISK is not set
# CONFIG_FSCK_MINIX is not set
@@ -355,12 +345,12 @@ CONFIG_PIVOT_ROOT=y
CONFIG_MOUNT=y
# CONFIG_NFSMOUNT is not set
CONFIG_UMOUNT=y
# CONFIG_FEATURE_MOUNT_FORCE is not set
CONFIG_FEATURE_MOUNT_FORCE=y
#
# Common options for mount/umount
#
# CONFIG_FEATURE_MOUNT_LOOP is not set
CONFIG_FEATURE_MOUNT_LOOP=y
# CONFIG_FEATURE_MTAB_SUPPORT is not set
#
-374
View File
@@ -1,374 +0,0 @@
#
# Automatically generated make config: don't edit
#
HAVE_DOT_CONFIG=y
#
# General Configuration
#
# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set
CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y
# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
# CONFIG_FEATURE_VERBOSE_USAGE is not set
# CONFIG_FEATURE_INSTALLER is not set
# CONFIG_LOCALE_SUPPORT is not set
CONFIG_FEATURE_DEVFS=y
CONFIG_FEATURE_DEVPTS=y
# CONFIG_FEATURE_CLEAN_UP is not set
# CONFIG_FEATURE_SUID is not set
#
# Build Options
#
# CONFIG_STATIC is not set
CONFIG_LFS=y
# USING_CROSS_COMPILER is not set
EXTRA_CFLAGS_OPTIONS=""
#
# Installation Options
#
# CONFIG_INSTALL_NO_USR is not set
PREFIX="./_install"
#
# Archival Utilities
#
CONFIG_AR=y
# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
# CONFIG_BUNZIP2 is not set
# CONFIG_CPIO is not set
# CONFIG_DPKG is not set
# CONFIG_DPKG_DEB is not set
CONFIG_GUNZIP=y
# CONFIG_FEATURE_GUNZIP_UNCOMPRESS is not set
# CONFIG_GZIP is not set
# CONFIG_RPM2CPIO is not set
# CONFIG_RPM is not set
CONFIG_TAR=y
# CONFIG_FEATURE_TAR_CREATE is not set
# CONFIG_FEATURE_TAR_BZIP2 is not set
# CONFIG_FEATURE_TAR_EXCLUDE is not set
CONFIG_FEATURE_TAR_GZIP=y
# CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY is not set
CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
# CONFIG_FEATURE_UNARCHIVE_TAPE is not set
# CONFIG_UNCOMPRESS is not set
# CONFIG_UNZIP is not set
#
# Coreutils
#
# CONFIG_BASENAME is not set
# CONFIG_CAL is not set
CONFIG_CAT=y
# CONFIG_CHGRP is not set
# CONFIG_CHMOD is not set
CONFIG_CHOWN=y
CONFIG_CHROOT=y
# CONFIG_CMP is not set
# CONFIG_CP is not set
CONFIG_CUT=y
# CONFIG_DATE is not set
# CONFIG_DD is not set
# CONFIG_DF is not set
# CONFIG_DIRNAME is not set
# CONFIG_DOS2UNIX is not set
# CONFIG_DU is not set
CONFIG_ECHO=y
CONFIG_FEATURE_FANCY_ECHO=y
# CONFIG_ENV is not set
# CONFIG_EXPR is not set
CONFIG_FALSE=y
# CONFIG_HEAD is not set
# CONFIG_HOSTID is not set
# CONFIG_ID is not set
# CONFIG_LENGTH is not set
CONFIG_LN=y
# CONFIG_LOGNAME is not set
# CONFIG_LS is not set
CONFIG_MD5SUM=y
CONFIG_MKDIR=y
# CONFIG_MKFIFO is not set
# CONFIG_MKNOD is not set
# CONFIG_MV is not set
# CONFIG_OD is not set
# CONFIG_PRINTF is not set
# CONFIG_PWD is not set
# CONFIG_REALPATH is not set
CONFIG_RM=y
# CONFIG_RMDIR is not set
# CONFIG_SHA1SUM is not set
# CONFIG_SLEEP is not set
# CONFIG_SORT is not set
# CONFIG_STTY is not set
CONFIG_SYNC=y
# CONFIG_TAIL is not set
# CONFIG_TEE is not set
CONFIG_TEST=y
#
# test (forced enabled for use with shell)
#
CONFIG_TOUCH=y
# CONFIG_TR is not set
CONFIG_TRUE=y
# CONFIG_TTY is not set
# CONFIG_UNAME is not set
# CONFIG_UNIQ is not set
# CONFIG_USLEEP is not set
# CONFIG_UUDECODE is not set
# CONFIG_UUENCODE is not set
# CONFIG_WATCH is not set
CONFIG_WC=y
# CONFIG_WHO is not set
# CONFIG_WHOAMI is not set
# CONFIG_YES is not set
#
# Console Utilities
#
# CONFIG_CHVT is not set
# CONFIG_CLEAR is not set
# CONFIG_DEALLOCVT is not set
# CONFIG_DUMPKMAP is not set
# CONFIG_LOADACM is not set
# CONFIG_LOADFONT is not set
# CONFIG_LOADKMAP is not set
# CONFIG_OPENVT is not set
# CONFIG_RESET is not set
# CONFIG_SETKEYCODES is not set
#
# Debian Utilities
#
# CONFIG_MKTEMP is not set
# CONFIG_READLINK is not set
# CONFIG_RUN_PARTS is not set
# CONFIG_WHICH is not set
#
# Editors
#
# CONFIG_AWK is not set
CONFIG_SED=y
# CONFIG_FEATURE_SED_EMBEDED_NEWLINE is not set
# CONFIG_VI is not set
#
# Finding Utilities
#
# CONFIG_FIND is not set
CONFIG_GREP=y
# CONFIG_FEATURE_GREP_EGREP_ALIAS is not set
# CONFIG_FEATURE_GREP_CONTEXT is not set
# CONFIG_XARGS is not set
#
# Init Utilities
#
CONFIG_INIT=y
CONFIG_FEATURE_USE_INITTAB=y
# CONFIG_FEATURE_INITRD is not set
# CONFIG_FEATURE_INIT_COREDUMPS is not set
# CONFIG_FEATURE_EXTRA_QUIET is not set
# CONFIG_HALT is not set
# CONFIG_POWEROFF is not set
CONFIG_REBOOT=y
# CONFIG_START_STOP_DAEMON is not set
# CONFIG_MESG is not set
#
# Login/Password Management Utilities
#
CONFIG_USE_BB_PWD_GRP=y
# CONFIG_ADDGROUP is not set
# CONFIG_DELGROUP is not set
# CONFIG_ADDUSER is not set
# CONFIG_DELUSER is not set
# CONFIG_GETTY is not set
# CONFIG_LOGIN is not set
# CONFIG_PASSWD is not set
# CONFIG_SU is not set
# CONFIG_SULOGIN is not set
# CONFIG_VLOCK is not set
#
# Miscellaneous Utilities
#
# CONFIG_ADJTIMEX is not set
# CONFIG_CROND is not set
# CONFIG_CRONTAB is not set
# CONFIG_DC is not set
# CONFIG_DUTMP is not set
# CONFIG_MAKEDEVS is not set
# CONFIG_MT is not set
# CONFIG_STRINGS is not set
# CONFIG_TIME is not set
# CONFIG_UPDATE is not set
# CONFIG_WATCHDOG is not set
#
# Linux Module Utilities
#
CONFIG_INSMOD=y
# CONFIG_FEATURE_OLD_MODULE_INTERFACE is not set
CONFIG_FEATURE_NEW_MODULE_INTERFACE=y
#
# Support new (post 2.1) Linux kernels (Forced enabled)
#
# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
# CONFIG_LSMOD is not set
# CONFIG_MODPROBE is not set
# CONFIG_RMMOD is not set
CONFIG_FEATURE_CHECK_TAINTED_MODULE=y
#
# Networking Utilities
#
# CONFIG_FEATURE_IPV6 is not set
# CONFIG_ARPING is not set
# CONFIG_FTPGET is not set
# CONFIG_FTPPUT is not set
# CONFIG_HOSTNAME is not set
# CONFIG_HTTPD is not set
CONFIG_IFCONFIG=y
CONFIG_FEATURE_IFCONFIG_STATUS=y
# CONFIG_FEATURE_IFCONFIG_SLIP is not set
# CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set
# CONFIG_FEATURE_IFCONFIG_HW is not set
# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set
# CONFIG_IFUPDOWN is not set
# CONFIG_INETD is not set
CONFIG_IP=y
CONFIG_FEATURE_IP_ADDRESS=y
CONFIG_FEATURE_IP_LINK=y
CONFIG_FEATURE_IP_ROUTE=y
# CONFIG_FEATURE_IP_TUNNEL is not set
# CONFIG_IPCALC is not set
# CONFIG_IPADDR is not set
# CONFIG_IPLINK is not set
# CONFIG_IPROUTE is not set
# CONFIG_IPTUNNEL is not set
# CONFIG_NAMEIF is not set
# CONFIG_NC is not set
# CONFIG_NETSTAT is not set
# CONFIG_NSLOOKUP is not set
# CONFIG_PING is not set
CONFIG_ROUTE=y
# CONFIG_TELNET is not set
# CONFIG_TELNETD is not set
# CONFIG_TFTP is not set
# CONFIG_TRACEROUTE is not set
# CONFIG_VCONFIG is not set
CONFIG_WGET=y
# CONFIG_FEATURE_WGET_STATUSBAR is not set
CONFIG_FEATURE_WGET_AUTHENTICATION=y
#
# udhcp Server/Client
#
# CONFIG_UDHCPD is not set
CONFIG_UDHCPC=y
CONFIG_FEATURE_UDHCP_SYSLOG=y
# CONFIG_FEATURE_UDHCP_DEBUG is not set
#
# Process Utilities
#
# CONFIG_FREE is not set
# CONFIG_KILL is not set
# CONFIG_PIDOF is not set
# CONFIG_PS is not set
# CONFIG_RENICE is not set
# CONFIG_TOP is not set
# CONFIG_UPTIME is not set
#
# Another Bourne-like Shell
#
CONFIG_FEATURE_SH_IS_ASH=y
# CONFIG_FEATURE_SH_IS_HUSH is not set
# CONFIG_FEATURE_SH_IS_LASH is not set
# CONFIG_FEATURE_SH_IS_MSH is not set
# CONFIG_FEATURE_SH_IS_NONE is not set
CONFIG_ASH=y
#
# ash (forced enabled as default shell)
#
#
# Ash Shell Options
#
# CONFIG_ASH_JOB_CONTROL is not set
# CONFIG_ASH_ALIAS is not set
CONFIG_ASH_MATH_SUPPORT=y
# CONFIG_ASH_GETOPTS is not set
# CONFIG_ASH_CMDCMD is not set
# CONFIG_ASH_MAIL is not set
CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
# CONFIG_HUSH is not set
# CONFIG_LASH is not set
# CONFIG_MSH is not set
#
# Bourne Shell Options
#
CONFIG_FEATURE_COMMAND_EDITING=y
# CONFIG_FEATURE_COMMAND_SAVEHISTORY is not set
# CONFIG_FEATURE_COMMAND_TAB_COMPLETION is not set
# CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION is not set
CONFIG_FEATURE_COMMAND_HISTORY=15
# CONFIG_FEATURE_SH_STANDALONE_SHELL is not set
# CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN is not set
# CONFIG_FEATURE_SH_FANCY_PROMPT is not set
# CONFIG_FEATURE_SH_EXTRA_QUIET is not set
#
# System Logging Utilities
#
CONFIG_SYSLOGD=y
# CONFIG_FEATURE_REMOTE_LOG is not set
# CONFIG_FEATURE_IPC_SYSLOG is not set
CONFIG_KLOGD=y
CONFIG_LOGGER=y
#
# Linux System Utilities
#
# CONFIG_DMESG is not set
# CONFIG_FBSET is not set
# CONFIG_FDFLUSH is not set
# CONFIG_FDISK is not set
# CONFIG_FREERAMDISK is not set
# CONFIG_FSCK_MINIX is not set
# CONFIG_MKFS_MINIX is not set
# CONFIG_GETOPT is not set
# CONFIG_HEXDUMP is not set
# CONFIG_HWCLOCK is not set
# CONFIG_LOSETUP is not set
# CONFIG_MKSWAP is not set
# CONFIG_MORE is not set
CONFIG_PIVOT_ROOT=y
# CONFIG_RDATE is not set
# CONFIG_SWAPONOFF is not set
CONFIG_MOUNT=y
# CONFIG_NFSMOUNT is not set
CONFIG_UMOUNT=y
CONFIG_FEATURE_MOUNT_FORCE=y
#
# Common options for mount/umount
#
# CONFIG_FEATURE_MOUNT_LOOP is not set
# CONFIG_FEATURE_MTAB_SUPPORT is not set
#
# Debugging Options
#
# CONFIG_DEBUG is not set
+41 -26
View File
@@ -16,6 +16,7 @@ CONFIG_FEATURE_DEVFS=y
CONFIG_FEATURE_DEVPTS=y
# CONFIG_FEATURE_CLEAN_UP is not set
# CONFIG_FEATURE_SUID is not set
# CONFIG_SELINUX is not set
#
# Build Options
@@ -53,12 +54,17 @@ CONFIG_FEATURE_TAR_CREATE=y
CONFIG_FEATURE_TAR_BZIP2=y
CONFIG_FEATURE_TAR_EXCLUDE=y
CONFIG_FEATURE_TAR_GZIP=y
# CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY is not set
# CONFIG_FEATURE_TAR_COMPRESS is not set
CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY=y
CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
CONFIG_FEATURE_UNARCHIVE_TAPE=y
CONFIG_UNCOMPRESS=y
CONFIG_UNZIP=y
#
# Common options for cpio and tar
#
CONFIG_FEATURE_UNARCHIVE_TAPE=y
#
# Coreutils
#
@@ -82,6 +88,7 @@ CONFIG_DD=y
CONFIG_DF=y
CONFIG_DIRNAME=y
CONFIG_DOS2UNIX=y
CONFIG_UNIX2DOS=y
CONFIG_DU=y
CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K=y
CONFIG_ECHO=y
@@ -89,10 +96,12 @@ CONFIG_FEATURE_FANCY_ECHO=y
CONFIG_ENV=y
CONFIG_EXPR=y
CONFIG_FALSE=y
CONFIG_FOLD=y
CONFIG_HEAD=y
# CONFIG_FEATURE_FANCY_HEAD is not set
CONFIG_FEATURE_FANCY_HEAD=y
CONFIG_HOSTID=y
CONFIG_ID=y
# CONFIG_INSTALL is not set
CONFIG_LENGTH=y
CONFIG_LN=y
CONFIG_LOGNAME=y
@@ -112,21 +121,19 @@ CONFIG_MV=y
CONFIG_OD=y
CONFIG_PRINTF=y
CONFIG_PWD=y
# CONFIG_REALPATH is not set
CONFIG_REALPATH=y
CONFIG_RM=y
CONFIG_RMDIR=y
# CONFIG_SHA1SUM is not set
CONFIG_SHA1SUM=y
CONFIG_SLEEP=y
# CONFIG_FEATURE_FANCY_SLEEP is not set
CONFIG_FEATURE_FANCY_SLEEP=y
CONFIG_SORT=y
CONFIG_FEATURE_SORT_REVERSE=y
CONFIG_FEATURE_SORT_UNIQUE=y
CONFIG_STTY=y
CONFIG_SYNC=y
CONFIG_TAIL=y
CONFIG_FEATURE_FANCY_TAIL=y
CONFIG_TEE=y
# CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set
CONFIG_FEATURE_TEE_USE_BLOCK_IO=y
CONFIG_TEST=y
#
@@ -162,6 +169,11 @@ CONFIG_FEATURE_AUTOWIDTH=y
#
CONFIG_FEATURE_HUMAN_READABLE=y
#
# Common options for md5sum, sha1sum
#
# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
#
# Console Utilities
#
@@ -180,8 +192,10 @@ CONFIG_SETKEYCODES=y
# Debian Utilities
#
CONFIG_MKTEMP=y
# CONFIG_PIPE_PROGRESS is not set
CONFIG_READLINK=y
CONFIG_RUN_PARTS=y
CONFIG_START_STOP_DAEMON=y
CONFIG_WHICH=y
#
@@ -189,8 +203,8 @@ CONFIG_WHICH=y
#
CONFIG_AWK=y
CONFIG_FEATURE_AWK_MATH=y
CONFIG_PATCH=y
CONFIG_SED=y
# CONFIG_FEATURE_SED_EMBEDED_NEWLINE is not set
CONFIG_VI=y
CONFIG_FEATURE_VI_COLON=y
CONFIG_FEATURE_VI_YANKMARK=y
@@ -215,8 +229,13 @@ CONFIG_FEATURE_FIND_NEWER=y
CONFIG_FEATURE_FIND_INUM=y
CONFIG_GREP=y
CONFIG_FEATURE_GREP_EGREP_ALIAS=y
CONFIG_FEATURE_GREP_FGREP_ALIAS=y
CONFIG_FEATURE_GREP_CONTEXT=y
CONFIG_XARGS=y
# CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set
# CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not set
# CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set
# CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM is not set
#
# Init Utilities
@@ -229,7 +248,6 @@ CONFIG_FEATURE_INITRD=y
CONFIG_HALT=y
CONFIG_POWEROFF=y
CONFIG_REBOOT=y
CONFIG_START_STOP_DAEMON=y
CONFIG_MESG=y
#
@@ -259,19 +277,22 @@ CONFIG_USE_BB_SHADOW=y
#
CONFIG_ADJTIMEX=y
CONFIG_CROND=y
CONFIG_FEATURE_CROND_CALL_SENDMAIL=y
CONFIG_CRONTAB=y
CONFIG_DC=y
CONFIG_DUTMP=y
# CONFIG_DEVFSD is not set
CONFIG_LAST=y
# CONFIG_HDPARM is not set
CONFIG_MAKEDEVS=y
CONFIG_MT=y
CONFIG_STRINGS=y
CONFIG_TIME=y
CONFIG_UPDATE=y
CONFIG_WATCHDOG=y
#
# Linux Module Utilities
#
# CONFIG_DEPMOD is not set
# CONFIG_INSMOD is not set
# CONFIG_LSMOD is not set
# CONFIG_MODPROBE is not set
@@ -288,11 +309,11 @@ CONFIG_HOSTNAME=y
CONFIG_HTTPD=y
# CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY is not set
CONFIG_FEATURE_HTTPD_BASIC_AUTH=y
# CONFIG_FEATURE_HTTPD_CGI is not set
# CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set
# CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP is not set
# CONFIG_FEATURE_HTTPD_SETUID is not set
# CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES is not set
# CONFIG_FEATURE_HTTPD_DECODE_URL_STR is not set
# CONFIG_FEATURE_HTTPD_CGI is not set
# CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set
CONFIG_IFCONFIG=y
CONFIG_FEATURE_IFCONFIG_STATUS=y
@@ -302,6 +323,7 @@ CONFIG_FEATURE_IFCONFIG_HW=y
CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y
CONFIG_IFUPDOWN=y
# CONFIG_FEATURE_IFUPDOWN_IP is not set
CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y
CONFIG_FEATURE_IFUPDOWN_IPV4=y
CONFIG_FEATURE_IFUPDOWN_IPV6=y
CONFIG_FEATURE_IFUPDOWN_IPX=y
@@ -354,11 +376,11 @@ CONFIG_FEATURE_TFTP_BLOCKSIZE=y
CONFIG_FEATURE_TFTP_DEBUG=y
CONFIG_TRACEROUTE=y
CONFIG_FEATURE_TRACEROUTE_VERBOSE=y
CONFIG_FEATURE_TRACEROUTE_SO_DEBUG=y
# CONFIG_VCONFIG is not set
CONFIG_WGET=y
CONFIG_FEATURE_WGET_STATUSBAR=y
CONFIG_FEATURE_WGET_AUTHENTICATION=y
CONFIG_FEATURE_WGET_IP6_LITERAL=y
#
# udhcp Server/Client
@@ -392,10 +414,6 @@ CONFIG_FEATURE_SH_IS_ASH=y
# CONFIG_FEATURE_SH_IS_NONE is not set
CONFIG_ASH=y
#
# ash (forced enabled as default shell)
#
#
# Ash Shell Options
#
@@ -427,6 +445,7 @@ CONFIG_FEATURE_SH_FANCY_PROMPT=y
# System Logging Utilities
#
CONFIG_SYSLOGD=y
# CONFIG_FEATURE_ROTATE_LOGFILE is not set
CONFIG_FEATURE_REMOTE_LOG=y
CONFIG_FEATURE_IPC_SYSLOG=y
CONFIG_LOGREAD=y
@@ -441,6 +460,7 @@ CONFIG_FBSET=y
CONFIG_FEATURE_FBSET_FANCY=y
CONFIG_FEATURE_FBSET_READMODE=y
CONFIG_FDFLUSH=y
# CONFIG_FDFORMAT is not set
CONFIG_FDISK=y
CONFIG_FEATURE_FDISK_WRITABLE=y
CONFIG_FEATURE_AIX_LABEL=y
@@ -464,10 +484,6 @@ CONFIG_LOSETUP=y
CONFIG_MKSWAP=y
CONFIG_MORE=y
CONFIG_FEATURE_USE_TERMIOS=y
#
# Common options for ls and more
#
CONFIG_PIVOT_ROOT=y
CONFIG_RDATE=y
CONFIG_SWAPONOFF=y
@@ -480,8 +496,7 @@ CONFIG_FEATURE_MOUNT_FORCE=y
# Common options for mount/umount
#
CONFIG_FEATURE_MOUNT_LOOP=y
CONFIG_FEATURE_MTAB_SUPPORT=y
CONFIG_FEATURE_MTAB_FILENAME="/etc/mtab"
# CONFIG_FEATURE_MTAB_SUPPORT is not set
#
# Debugging Options
+31 -21
View File
@@ -16,6 +16,7 @@ CONFIG_FEATURE_DEVFS=y
CONFIG_FEATURE_DEVPTS=y
# CONFIG_FEATURE_CLEAN_UP is not set
# CONFIG_FEATURE_SUID is not set
# CONFIG_SELINUX is not set
#
# Build Options
@@ -50,12 +51,17 @@ CONFIG_TAR=y
# CONFIG_FEATURE_TAR_BZIP2 is not set
# CONFIG_FEATURE_TAR_EXCLUDE is not set
CONFIG_FEATURE_TAR_GZIP=y
# CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY is not set
# CONFIG_FEATURE_TAR_COMPRESS is not set
CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY=y
CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
# CONFIG_FEATURE_UNARCHIVE_TAPE is not set
# CONFIG_UNCOMPRESS is not set
# CONFIG_UNZIP is not set
#
# Common options for cpio and tar
#
# CONFIG_FEATURE_UNARCHIVE_TAPE is not set
#
# Coreutils
#
@@ -80,10 +86,12 @@ CONFIG_FEATURE_FANCY_ECHO=y
CONFIG_ENV=y
CONFIG_EXPR=y
CONFIG_FALSE=y
# CONFIG_FOLD is not set
CONFIG_HEAD=y
# CONFIG_FEATURE_FANCY_HEAD is not set
# CONFIG_HOSTID is not set
CONFIG_ID=y
# CONFIG_INSTALL is not set
# CONFIG_LENGTH is not set
CONFIG_LN=y
# CONFIG_LOGNAME is not set
@@ -101,7 +109,7 @@ CONFIG_MKDIR=y
CONFIG_MKNOD=y
CONFIG_MV=y
# CONFIG_OD is not set
# CONFIG_PRINTF is not set
CONFIG_PRINTF=y
CONFIG_PWD=y
CONFIG_REALPATH=y
CONFIG_RM=y
@@ -109,8 +117,6 @@ CONFIG_RMDIR=y
# CONFIG_SHA1SUM is not set
# CONFIG_SLEEP is not set
CONFIG_SORT=y
# CONFIG_FEATURE_SORT_REVERSE is not set
# CONFIG_FEATURE_SORT_UNIQUE is not set
# CONFIG_STTY is not set
CONFIG_SYNC=y
CONFIG_TAIL=y
@@ -151,6 +157,11 @@ CONFIG_FEATURE_AUTOWIDTH=y
#
CONFIG_FEATURE_HUMAN_READABLE=y
#
# Common options for md5sum, sha1sum
#
# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
#
# Console Utilities
#
@@ -169,16 +180,18 @@ CONFIG_FEATURE_HUMAN_READABLE=y
# Debian Utilities
#
# CONFIG_MKTEMP is not set
# CONFIG_PIPE_PROGRESS is not set
CONFIG_READLINK=y
# CONFIG_RUN_PARTS is not set
# CONFIG_START_STOP_DAEMON is not set
# CONFIG_WHICH is not set
#
# Editors
#
# CONFIG_AWK is not set
# CONFIG_PATCH is not set
CONFIG_SED=y
# CONFIG_FEATURE_SED_EMBEDED_NEWLINE is not set
# CONFIG_VI is not set
#
@@ -193,6 +206,7 @@ CONFIG_FEATURE_FIND_NEWER=y
CONFIG_FEATURE_FIND_INUM=y
CONFIG_GREP=y
# CONFIG_FEATURE_GREP_EGREP_ALIAS is not set
# CONFIG_FEATURE_GREP_FGREP_ALIAS is not set
# CONFIG_FEATURE_GREP_CONTEXT is not set
# CONFIG_XARGS is not set
@@ -203,11 +217,10 @@ CONFIG_INIT=y
CONFIG_FEATURE_USE_INITTAB=y
# CONFIG_FEATURE_INITRD is not set
# CONFIG_FEATURE_INIT_COREDUMPS is not set
# CONFIG_FEATURE_EXTRA_QUIET is not set
CONFIG_FEATURE_EXTRA_QUIET=y
CONFIG_HALT=y
# CONFIG_POWEROFF is not set
CONFIG_REBOOT=y
# CONFIG_START_STOP_DAEMON is not set
# CONFIG_MESG is not set
#
@@ -232,17 +245,19 @@ CONFIG_USE_BB_PWD_GRP=y
# CONFIG_CROND is not set
# CONFIG_CRONTAB is not set
# CONFIG_DC is not set
# CONFIG_DUTMP is not set
# CONFIG_DEVFSD is not set
# CONFIG_LAST is not set
# CONFIG_HDPARM is not set
# CONFIG_MAKEDEVS is not set
# CONFIG_MT is not set
# CONFIG_STRINGS is not set
# CONFIG_TIME is not set
# CONFIG_UPDATE is not set
# CONFIG_WATCHDOG is not set
#
# Linux Module Utilities
#
# CONFIG_DEPMOD is not set
# CONFIG_INSMOD is not set
# CONFIG_LSMOD is not set
# CONFIG_MODPROBE is not set
@@ -287,8 +302,9 @@ CONFIG_ROUTE=y
# CONFIG_TRACEROUTE is not set
# CONFIG_VCONFIG is not set
CONFIG_WGET=y
# CONFIG_FEATURE_WGET_STATUSBAR is not set
CONFIG_FEATURE_WGET_STATUSBAR=y
CONFIG_FEATURE_WGET_AUTHENTICATION=y
CONFIG_FEATURE_WGET_IP6_LITERAL=y
#
# udhcp Server/Client
@@ -320,10 +336,6 @@ CONFIG_FEATURE_SH_IS_ASH=y
# CONFIG_FEATURE_SH_IS_NONE is not set
CONFIG_ASH=y
#
# ash (forced enabled as default shell)
#
#
# Ash Shell Options
#
@@ -355,6 +367,7 @@ CONFIG_FEATURE_SH_FANCY_PROMPT=y
# System Logging Utilities
#
CONFIG_SYSLOGD=y
# CONFIG_FEATURE_ROTATE_LOGFILE is not set
# CONFIG_FEATURE_REMOTE_LOG is not set
# CONFIG_FEATURE_IPC_SYSLOG is not set
CONFIG_KLOGD=y
@@ -366,8 +379,9 @@ CONFIG_LOGGER=y
CONFIG_DMESG=y
# CONFIG_FBSET is not set
# CONFIG_FDFLUSH is not set
# CONFIG_FDFORMAT is not set
# CONFIG_FDISK is not set
# CONFIG_FREERAMDISK is not set
CONFIG_FREERAMDISK=y
# CONFIG_FSCK_MINIX is not set
# CONFIG_MKFS_MINIX is not set
# CONFIG_GETOPT is not set
@@ -377,10 +391,6 @@ CONFIG_DMESG=y
CONFIG_MKSWAP=y
CONFIG_MORE=y
CONFIG_FEATURE_USE_TERMIOS=y
#
# Common options for ls and more
#
CONFIG_PIVOT_ROOT=y
# CONFIG_RDATE is not set
CONFIG_SWAPONOFF=y
@@ -392,7 +402,7 @@ CONFIG_FEATURE_MOUNT_FORCE=y
#
# Common options for mount/umount
#
# CONFIG_FEATURE_MOUNT_LOOP is not set
CONFIG_FEATURE_MOUNT_LOOP=y
# CONFIG_FEATURE_MTAB_SUPPORT is not set
#
+34 -27
View File
@@ -16,6 +16,7 @@ CONFIG_FEATURE_DEVFS=y
CONFIG_FEATURE_DEVPTS=y
# CONFIG_FEATURE_CLEAN_UP is not set
# CONFIG_FEATURE_SUID is not set
# CONFIG_SELINUX is not set
#
# Build Options
@@ -50,12 +51,17 @@ CONFIG_TAR=y
# CONFIG_FEATURE_TAR_BZIP2 is not set
# CONFIG_FEATURE_TAR_EXCLUDE is not set
CONFIG_FEATURE_TAR_GZIP=y
# CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY is not set
# CONFIG_FEATURE_TAR_COMPRESS is not set
CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY=y
CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
# CONFIG_FEATURE_UNARCHIVE_TAPE is not set
# CONFIG_UNCOMPRESS is not set
# CONFIG_UNZIP is not set
#
# Common options for cpio and tar
#
# CONFIG_FEATURE_UNARCHIVE_TAPE is not set
#
# Coreutils
#
@@ -80,10 +86,12 @@ CONFIG_FEATURE_FANCY_ECHO=y
CONFIG_ENV=y
CONFIG_EXPR=y
CONFIG_FALSE=y
# CONFIG_FOLD is not set
CONFIG_HEAD=y
# CONFIG_FEATURE_FANCY_HEAD is not set
# CONFIG_HOSTID is not set
CONFIG_ID=y
# CONFIG_INSTALL is not set
# CONFIG_LENGTH is not set
CONFIG_LN=y
# CONFIG_LOGNAME is not set
@@ -101,7 +109,7 @@ CONFIG_MKDIR=y
CONFIG_MKNOD=y
CONFIG_MV=y
# CONFIG_OD is not set
# CONFIG_PRINTF is not set
CONFIG_PRINTF=y
CONFIG_PWD=y
CONFIG_REALPATH=y
CONFIG_RM=y
@@ -109,8 +117,6 @@ CONFIG_RMDIR=y
# CONFIG_SHA1SUM is not set
# CONFIG_SLEEP is not set
CONFIG_SORT=y
# CONFIG_FEATURE_SORT_REVERSE is not set
# CONFIG_FEATURE_SORT_UNIQUE is not set
# CONFIG_STTY is not set
CONFIG_SYNC=y
CONFIG_TAIL=y
@@ -151,6 +157,11 @@ CONFIG_FEATURE_AUTOWIDTH=y
#
CONFIG_FEATURE_HUMAN_READABLE=y
#
# Common options for md5sum, sha1sum
#
# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
#
# Console Utilities
#
@@ -169,16 +180,18 @@ CONFIG_FEATURE_HUMAN_READABLE=y
# Debian Utilities
#
# CONFIG_MKTEMP is not set
# CONFIG_PIPE_PROGRESS is not set
CONFIG_READLINK=y
# CONFIG_RUN_PARTS is not set
# CONFIG_START_STOP_DAEMON is not set
# CONFIG_WHICH is not set
#
# Editors
#
# CONFIG_AWK is not set
# CONFIG_PATCH is not set
CONFIG_SED=y
# CONFIG_FEATURE_SED_EMBEDED_NEWLINE is not set
# CONFIG_VI is not set
#
@@ -193,6 +206,7 @@ CONFIG_FEATURE_FIND_NEWER=y
CONFIG_FEATURE_FIND_INUM=y
CONFIG_GREP=y
# CONFIG_FEATURE_GREP_EGREP_ALIAS is not set
# CONFIG_FEATURE_GREP_FGREP_ALIAS is not set
# CONFIG_FEATURE_GREP_CONTEXT is not set
# CONFIG_XARGS is not set
@@ -203,11 +217,10 @@ CONFIG_INIT=y
CONFIG_FEATURE_USE_INITTAB=y
# CONFIG_FEATURE_INITRD is not set
# CONFIG_FEATURE_INIT_COREDUMPS is not set
# CONFIG_FEATURE_EXTRA_QUIET is not set
CONFIG_FEATURE_EXTRA_QUIET=y
CONFIG_HALT=y
# CONFIG_POWEROFF is not set
CONFIG_REBOOT=y
# CONFIG_START_STOP_DAEMON is not set
# CONFIG_MESG is not set
#
@@ -232,24 +245,23 @@ CONFIG_USE_BB_PWD_GRP=y
# CONFIG_CROND is not set
# CONFIG_CRONTAB is not set
# CONFIG_DC is not set
# CONFIG_DUTMP is not set
# CONFIG_DEVFSD is not set
# CONFIG_LAST is not set
# CONFIG_HDPARM is not set
# CONFIG_MAKEDEVS is not set
# CONFIG_MT is not set
# CONFIG_STRINGS is not set
# CONFIG_TIME is not set
# CONFIG_UPDATE is not set
# CONFIG_WATCHDOG is not set
#
# Linux Module Utilities
#
CONFIG_MODUTILS_OBJ=y
CONFIG_DEPMOD=y
CONFIG_INSMOD=y
# CONFIG_FEATURE_OLD_MODULE_INTERFACE is not set
CONFIG_FEATURE_NEW_MODULE_INTERFACE=y
#
# Support new (post 2.1) Linux kernels (Forced enabled)
#
# CONFIG_FEATURE_2_2_MODULES is not set
CONFIG_FEATURE_2_4_MODULES=y
# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
@@ -299,8 +311,9 @@ CONFIG_ROUTE=y
# CONFIG_TRACEROUTE is not set
# CONFIG_VCONFIG is not set
CONFIG_WGET=y
# CONFIG_FEATURE_WGET_STATUSBAR is not set
CONFIG_FEATURE_WGET_STATUSBAR=y
CONFIG_FEATURE_WGET_AUTHENTICATION=y
CONFIG_FEATURE_WGET_IP6_LITERAL=y
#
# udhcp Server/Client
@@ -332,10 +345,6 @@ CONFIG_FEATURE_SH_IS_ASH=y
# CONFIG_FEATURE_SH_IS_NONE is not set
CONFIG_ASH=y
#
# ash (forced enabled as default shell)
#
#
# Ash Shell Options
#
@@ -367,6 +376,7 @@ CONFIG_FEATURE_SH_FANCY_PROMPT=y
# System Logging Utilities
#
CONFIG_SYSLOGD=y
# CONFIG_FEATURE_ROTATE_LOGFILE is not set
# CONFIG_FEATURE_REMOTE_LOG is not set
# CONFIG_FEATURE_IPC_SYSLOG is not set
CONFIG_KLOGD=y
@@ -378,8 +388,9 @@ CONFIG_LOGGER=y
CONFIG_DMESG=y
# CONFIG_FBSET is not set
# CONFIG_FDFLUSH is not set
# CONFIG_FDFORMAT is not set
# CONFIG_FDISK is not set
# CONFIG_FREERAMDISK is not set
CONFIG_FREERAMDISK=y
# CONFIG_FSCK_MINIX is not set
# CONFIG_MKFS_MINIX is not set
# CONFIG_GETOPT is not set
@@ -389,10 +400,6 @@ CONFIG_DMESG=y
CONFIG_MKSWAP=y
CONFIG_MORE=y
CONFIG_FEATURE_USE_TERMIOS=y
#
# Common options for ls and more
#
CONFIG_PIVOT_ROOT=y
# CONFIG_RDATE is not set
CONFIG_SWAPONOFF=y
@@ -404,7 +411,7 @@ CONFIG_FEATURE_MOUNT_FORCE=y
#
# Common options for mount/umount
#
# CONFIG_FEATURE_MOUNT_LOOP is not set
CONFIG_FEATURE_MOUNT_LOOP=y
# CONFIG_FEATURE_MTAB_SUPPORT is not set
#
+5 -4
View File
@@ -2,8 +2,8 @@ Source: busybox-cvs
Priority: optional
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Uploaders: Erik Andersen <andersee@debian.org>, Bastian Blank <waldi@debian.org>, Tollef Fog Heen <tfheen@debian.org>, Glenn McGrath <bug1@debian.org>
Build-Depends: debhelper (>= 2.1.18)
Standards-Version: 3.5.7.0
Build-Depends: debhelper (>= 4.0.0)
Standards-Version: 3.6.0
Package: busybox-cvs
Architecture: any
@@ -52,6 +52,7 @@ Architecture: any
Depends: ${shlibs:Depends}
Section: debian-installer
Conflicts: busybox-udeb
Enhances: busybox-cvs-floppy-udeb
Priority: extra
Description: Tiny utilities for the debian-installer
BusyBox combines tiny versions of many common UNIX utilities into a single
@@ -66,13 +67,13 @@ Description: Tiny utilities for the debian-installer
on the debian-installer, this package is not for you. Installing this
on your Debian system is a very, very bad idea. You have been warned.
Package: busybox-cvs-net-udeb
Package: busybox-cvs-floppy-udeb
Architecture: i386
Depends: ${shlibs:Depends}
Section: debian-installer
Conflicts: busybox-udeb
Priority: extra
Description: Tiny utilities for the debian-installer network images
Description: Tiny utilities for the debian-installer floppy images
BusyBox combines tiny versions of many common UNIX utilities into a single
small executable. It provides minimalist replacements for the most common
utilities you would usually find on your desktop system (i.e., ls, cp, mv,
+2
View File
@@ -0,0 +1,2 @@
#!/bin/sh
awk "BEGIN { i = 0; } { if (/^Package: $2/) i = 1; if (/^\s*\$/) i = 0; if (/$1:/ && i) print }" < debian/control | sed -e "s,^$1: ,,"
+1 -1
View File
@@ -1,4 +1,4 @@
This package was debianized by Erik Andersen <andersen@codepoet.org> on
This package was debianized by Erik Andersen <andersee@debian.org> on
Sun, 18 Jun 2000 23:31:02 -0600
It was downloaded from ftp://ftp.busybox.net/busybox
+82 -59
View File
@@ -3,10 +3,9 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# This is the debhelper compatibility version to use.
export DH_COMPAT=3
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_GNU_CPU ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
DEB_HOST_GNU_SYSTEM ?= $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
VERSION = $(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)
@@ -18,25 +17,39 @@ endif
PACKAGE_PREFIX = busybox-cvs
ARCH_FLOPPY_UDEB = $(shell sh debian/control-extract Architecture $(PACKAGE_PREFIX)-floppy-udeb)
PACKAGES_DEB = $(PACKAGE_PREFIX) $(PACKAGE_PREFIX)-static
PACKAGES_UDEB = $(PACKAGE_PREFIX)-udeb
ifneq ($(wildcard ./debian/config-net-udeb-$(DEB_HOST_ARCH)),)
PACKAGES_UDEB += $(PACKAGE_PREFIX)-net-udeb
ifneq ($(filter $(DEB_HOST_ARCH),$(ARCH_FLOPPY_UDEB)),)
PACKAGES_UDEB += $(PACKAGE_PREFIX)-floppy-udeb
endif
PACKAGES = $(PACKAGES_DEB) $(PACKAGES_UDEB)
DEBHELPER_PACKAGES_DEB = $(patsubst %,-p%,$(PACKAGES_DEB))
build-arch: build-arch-deb build-arch-static build-arch-udeb build-arch-net-udeb build-arch-doc
DEBHELPER_PACKAGES_DEB = $(patsubst %,-p%,$(PACKAGES_DEB))
DEBHELPER_PACKAGES_UDEB = $(patsubst %,-p%,$(PACKAGES_UDEB))
CONFIG = $(firstword $(wildcard ./debian/config-$(1)-$(DEB_HOST_GNU_SYSTEM)-$(DEB_HOST_GNU_CPU) ./debian/config-$(1)-$(DEB_HOST_GNU_SYSTEM) ./debian/config-$(1)))
CONFIG_DEB = $(call CONFIG,deb)
CONFIG_STATIC = $(call CONFIG,static)
CONFIG_UDEB = $(call CONFIG,udeb)
CONFIG_FLOPPY_UDEB = $(call CONFIG,floppy-udeb)
configure: configure-stamp
configure-stamp:
sh ./configure
touch $@
build-arch: build-arch-deb-all build-arch-udeb-all
build-arch-deb-all: build-arch-deb build-arch-static build-arch-doc
build-arch-udeb-all: build-arch-udeb build-arch-floppy-udeb
build-arch-deb: build-arch-deb-stamp
build-arch-deb-stamp:
build-arch-deb-stamp: configure-stamp
$(MAKE) clean
ifeq ($(wildcard ./debian/config-deb-$(DEB_HOST_ARCH)),)
cp ./debian/config-deb .config
else
cp ./debian/config-deb-$(DEB_HOST_ARCH) .config
endif
cp $(CONFIG_DEB) .config
$(MAKE) dep
$(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG)
@@ -47,14 +60,10 @@ endif
touch $@
build-arch-static: build-arch-static-stamp
build-arch-static-stamp:
build-arch-static-stamp: configure-stamp
$(MAKE) clean
ifeq ($(wildcard ./debian/config-static-$(DEB_HOST_ARCH)),)
cp ./debian/config-static .config
else
cp ./debian/config-static-$(DEB_HOST_ARCH) .config
endif
cp $(CONFIG_STATIC) .config
$(MAKE) dep
$(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG)
@@ -65,39 +74,38 @@ endif
touch $@
build-arch-udeb: build-arch-udeb-stamp
build-arch-udeb-stamp:
build-arch-udeb-stamp: configure-stamp
$(MAKE) clean
ifeq ($(wildcard ./debian/config-udeb-$(DEB_HOST_ARCH)),)
cp ./debian/config-udeb .config
else
cp ./debian/config-udeb-$(DEB_HOST_ARCH) .config
endif
cp $(CONFIG_UDEB) .config
$(MAKE) dep
$(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG)
$(MAKE) PREFIX=$(CURDIR)/install-$(PACKAGE_PREFIX)-udeb install
# Remove init link, but init support is still compiled in to be
# used.
rm -f $(CURDIR)/install-$(PACKAGE_PREFIX)-udeb/sbin/init
touch $@
build-arch-net-udeb: build-arch-net-udeb-stamp
build-arch-net-udeb-stamp:
ifneq ($(wildcard ./debian/config-net-udeb-$(DEB_HOST_ARCH)),)
build-arch-floppy-udeb: build-arch-floppy-udeb-stamp
build-arch-floppy-udeb-stamp: configure-stamp
ifneq ($(filter $(DEB_HOST_ARCH),$(ARCH_FLOPPY_UDEB)),)
$(MAKE) clean
cp ./debian/config-net-udeb-$(DEB_HOST_ARCH) .config
cp $(CONFIG_FLOPPY_UDEB) .config
$(MAKE) dep
$(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG)
$(MAKE) PREFIX=$(CURDIR)/install-$(PACKAGE_PREFIX)-net-udeb install
$(MAKE) PREFIX=$(CURDIR)/install-$(PACKAGE_PREFIX)-floppy-udeb install
endif
touch $@
build-arch-doc: build-arch-doc-stamp
build-arch-doc-stamp:
build-arch-doc-stamp: configure-stamp
$(MAKE) docs/BusyBox.1
cp docs/BusyBox.1 busybox.1
@@ -109,20 +117,20 @@ build: build-arch
clean:
dh_testdir
dh_testroot
rm -f build-*-stamp debian/files~
rm -f build-*-stamp configure-stamp debian/files~
$(MAKE) distclean
-$(MAKE) distclean
-rm -rf busybox-deb busybox-static install* busybox.1
dh_clean
install: build-arch
install-deb: build-arch-deb-all
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
dh_clean -k $(DEBHELPER_PACKAGES_DEB)
dh_installdirs $(DEBHELPER_PACKAGES_DEB)
for i in $(PACKAGES); do \
for i in $(PACKAGES_DEB); do \
( \
cd install-$$i; \
find -type d -exec install -d $(CURDIR)/debian/$$i/{} \;; \
@@ -133,36 +141,51 @@ install: build-arch
install -m644 debian/$(PACKAGE_PREFIX)-static.override \
debian/$(PACKAGE_PREFIX)-static/usr/share/lintian/overrides/$(PACKAGE_PREFIX)-static
install-udeb: build-arch-udeb-all
dh_testdir
dh_testroot
dh_clean -k $(DEBHELPER_PACKAGES_UDEB)
dh_installdirs $(DEBHELPER_PACKAGES_UDEB)
for i in $(PACKAGES_UDEB); do \
( \
cd install-$$i; \
find -type d -exec install -d $(CURDIR)/debian/$$i/{} \;; \
find \( -type f -o -type l \) -exec cp -a {} $(CURDIR)/debian/$$i/{} \;; \
); \
done
binary-arch: binary-arch-deb binary-arch-udeb
# Build architecture-dependent files here.
binary-arch: build-arch install
dh_testdir -a
dh_testroot -a
# dh_installdebconf -a
binary-arch-deb: build-arch-deb-all install-deb
dh_testdir
dh_testroot
dh_installdocs $(DEBHELPER_PACKAGES_DEB)
# dh_installexamples -a
# dh_installmenu -a
# dh_installlogrotate -a
# dh_installemacsen -a
# dh_installpam -a
# dh_installmime -a
# dh_installinit -a
# dh_installcron -a
dh_installman $(DEBHELPER_PACKAGES_DEB)
# dh_installinfo -a
# dh_undocumented -a
dh_installchangelogs Changelog $(DEBHELPER_PACKAGES_DEB)
dh_strip -a
dh_link -a
dh_compress -a
dh_fixperms -a
# dh_makeshlibs -a
dh_installdeb -a
# dh_perl -a
dh_shlibdeps -a
dh_strip $(DEBHELPER_PACKAGES_DEB)
dh_link $(DEBHELPER_PACKAGES_DEB)
dh_compress $(DEBHELPER_PACKAGES_DEB)
dh_fixperms $(DEBHELPER_PACKAGES_DEB)
dh_installdeb $(DEBHELPER_PACKAGES_DEB)
dh_shlibdeps $(DEBHELPER_PACKAGES_DEB)
dh_gencontrol $(DEBHELPER_PACKAGES_DEB)
dh_md5sums $(DEBHELPER_PACKAGES_DEB)
dh_builddeb $(DEBHELPER_PACKAGES_DEB)
# Build architecture-dependent files here.
binary-arch-udeb: build-arch-udeb-all install-udeb
dh_testdir
dh_testroot
dh_strip $(DEBHELPER_PACKAGES_UDEB)
dh_link $(DEBHELPER_PACKAGES_UDEB)
dh_compress $(DEBHELPER_PACKAGES_UDEB)
dh_fixperms $(DEBHELPER_PACKAGES_UDEB)
dh_installdeb $(DEBHELPER_PACKAGES_UDEB)
dh_shlibdeps $(DEBHELPER_PACKAGES_UDEB)
dh_gencontrol $(DEBHELPER_PACKAGES_DEB)
$(foreach PACKAGE, $(PACKAGES_UDEB), \
dh_gencontrol -p$(PACKAGE) -- -fdebian/files~; \
dpkg-distaddfile $(PACKAGE)_$(VERSION)_$(DEB_HOST_ARCH).udeb debian-installer extra; \
+8 -2
View File
@@ -11,6 +11,12 @@ config CONFIG_MKTEMP
help
mktemp is used to create unique temporary files
config CONFIG_PIPE_PROGRESS
bool "pipe_progress"
default n
help
Display a dot to indicate pipe activity.
config CONFIG_READLINK
bool "readlink"
default n
@@ -27,8 +33,8 @@ config CONFIG_RUN_PARTS
It is useful to set up a directory like cron.daily, where you need to
execute all the scripts in that directory.
This implementation of run-parts does not accept long options, and
some features (such as report mode) are not implemented.
In this implementation of run-parts some features (such as report mode)
are not implemented.
Unless you know that run-parts is used in some of your scripts
you can safely say N here.
+1
View File
@@ -25,6 +25,7 @@ endif
DEBIANUTILS-y:=
DEBIANUTILS-$(CONFIG_MKTEMP) += mktemp.o
DEBIANUTILS-$(CONFIG_PIPE_PROGRESS) += pipe_progress.o
DEBIANUTILS-$(CONFIG_READLINK) += readlink.o
DEBIANUTILS-$(CONFIG_RUN_PARTS) += run_parts.o
DEBIANUTILS-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o
+55
View File
@@ -0,0 +1,55 @@
/*
* Monitor a pipe with a simple progress display.
*
* Copyright (C) 2003 by Rob Landley <rob@landley.net>, Joey Hess
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include "busybox.h"
#define PIPE_PROGRESS_SIZE 4096
/* Read a block of data from stdin, write it to stdout.
* Activity is indicated by a '.' to stderr
*/
extern int pipe_progress_main(int argc, char **argv)
{
RESERVE_CONFIG_BUFFER(buf, PIPE_PROGRESS_SIZE);
time_t t = time(NULL);
size_t len;
while ((len = fread(buf, 1, PIPE_PROGRESS_SIZE, stdin)) > 0) {
time_t new_time = time(NULL);
if (new_time != t) {
t = new_time;
fputc('.', stderr);
}
fwrite(buf, len, 1, stdout);
}
fputc('\n', stderr);
#ifdef CONFIG_FEATURE_CLEAN_UP
RELEASE_CONFIG_BUFFER(buf);
#endif
return 0;
}
+16 -17
View File
@@ -21,15 +21,11 @@
#include "busybox.h"
#include "pwd_.h"
static int start = 0;
static int stop = 0;
static int fork_before_exec = 0;
static int signal_nr = 15;
static int user_id = -1;
static char *userspec = NULL;
static char *cmdname = NULL;
static char *execname = NULL;
static char *startas = NULL;
typedef struct pid_list {
struct pid_list *next;
@@ -195,35 +191,39 @@ static const struct option ssd_long_options[] = {
{ 0, 0, 0, 0 }
};
#define SSD_CTX_STOP 1
#define SSD_CTX_START 2
#define SSD_OPT_BACKGROUND 4
int
start_stop_daemon_main(int argc, char **argv)
{
int flags;
unsigned long opt;
char *signame = NULL;
char *startas = NULL;
bb_applet_long_options = ssd_long_options;
flags = bb_getopt_ulflags(argc, argv, "KSba:n:s:u:x:",
bb_opt_complementaly = "K~S:S~K";
opt = bb_getopt_ulflags(argc, argv, "KSba:n:s:u:x:",
&startas, &cmdname, &signame, &userspec, &execname);
/* Be sneaky and avoid branching */
stop = (flags & 1);
start = (flags & 2);
fork_before_exec = (flags & 4);
/* Check one and only one context option was given */
if ((opt & 0x80000000UL) || (opt & (SSD_CTX_STOP | SSD_CTX_START)) == 0) {
bb_show_usage();
}
if (signame) {
signal_nr = bb_xgetlarg(signame, 10, 0, NSIG);
}
if (start == stop)
bb_error_msg_and_die ("need exactly one of -S or -K");
if (!execname && !userspec)
bb_error_msg_and_die ("need at least one of -x or -u");
if (!startas)
startas = execname;
if (start && !startas)
if ((opt & SSD_CTX_START) && !startas)
bb_error_msg_and_die ("-S needs -x or -a");
argc -= optind;
@@ -234,7 +234,7 @@ start_stop_daemon_main(int argc, char **argv)
do_procfs();
if (stop) {
if (opt & SSD_CTX_STOP) {
do_stop();
return EXIT_SUCCESS;
}
@@ -244,7 +244,7 @@ start_stop_daemon_main(int argc, char **argv)
return EXIT_SUCCESS;
}
*--argv = startas;
if (fork_before_exec) {
if (opt & SSD_OPT_BACKGROUND) {
if (daemon(0, 0) == -1)
bb_perror_msg_and_die ("unable to fork");
}
@@ -252,4 +252,3 @@ start_stop_daemon_main(int argc, char **argv)
execv(startas, argv);
bb_perror_msg_and_die ("unable to start %s", startas);
}
+32 -12
View File
@@ -26,10 +26,21 @@
#include <stdlib.h>
#include "busybox.h"
static int file_exists(char *file)
{
struct stat filestat;
if (stat(file, &filestat) == 0 &&
S_ISREG(filestat.st_mode) &&
filestat.st_mode & S_IXUSR)
return 1;
else
return 0;
}
extern int which_main(int argc, char **argv)
{
char *path_list, *path_n;
struct stat filestat;
int i, count=1, found, status = EXIT_SUCCESS;
if (argc <= 1 || **(argv + 1) == '-')
@@ -49,21 +60,30 @@ extern int which_main(int argc, char **argv)
}
while(argc-- > 0) {
char *buf;
path_n = path_list;
argv++;
found = 0;
for (i = 0; i < count; i++) {
char *buf;
buf = concat_path_file(path_n, *argv);
if (stat (buf, &filestat) == 0
&& filestat.st_mode & S_IXUSR)
{
puts(buf);
found = 1;
break;
/*
* Check if we were given the full path, first.
* Otherwise see if the file exists in our $PATH.
*/
buf = *argv;
if (file_exists(buf)) {
puts(buf);
found = 1;
} else {
for (i = 0; i < count; i++) {
buf = concat_path_file(path_n, *argv);
if (file_exists(buf)) {
puts(buf);
found = 1;
break;
}
free(buf);
path_n += (strlen(path_n) + 1);
}
free(buf);
path_n += (strlen(path_n) + 1);
}
if (!found)
status = EXIT_FAILURE;
+63
View File
@@ -0,0 +1,63 @@
<!--#include file="header.html" -->
<!-- Begin Introduction section -->
<h3>BusyBox: The Swiss Army Knife of Embedded Linux</h3>
BusyBox combines tiny versions of many common UNIX utilities into a single
small executable. It provides replacements for most of the utilities you
usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox
generally have fewer options than their full-featured GNU cousins; however,
the options that are included provide the expected functionality and behave
very much like their GNU counterparts. BusyBox provides a fairly complete
environment for any small or embedded system.
<p>
BusyBox has been written with size-optimization and limited resources in
mind. It is also extremely modular so you can easily include or exclude
commands (or features) at compile time. This makes it easy to customize
your embedded systems. To create a working system, just add some device
nodes in /dev, a few configuration files in /etc, and a Linux kernel.
<p>
BusyBox is maintained by <a href=
"http://codepoet.org/andersen/erik/erik.html">Erik Andersen</a>, and
licensed under the
<a href= "http://www.gnu.org/copyleft/gpl.html">GNU GENERAL PUBLIC LICENSE</a>
<p>
<p>
<h3>Sponsors</h3>
Please visit our sponsors and thank them for their
support! They have provided money for equipment and
bandwidth. Next time you need help with a project,
consider these fine companies!
<ul>
<li><a href="http://www.penguru.net">Penguru Consulting</a><br>
Custom development for embedded Linux systems and multimedia platforms
</li>
<li><a href="http://opensource.se/">opensource.se</a><br>
Embedded open source consulting in Europe.
</li>
<li><a href="http://www.codepoet-consulting.com">Codepoet Consulting</a><br>
Custom Linux, embedded Linux, BusyBox, and uClibc
development.
</li>
</ul>
If you wish to be a sponsor, or if you have already contributed and would like
your name added here, email <a href= "mailto:andersen@codepoet.org">Erik</a>.
<!--#include file="footer.html" -->
+29
View File
@@ -0,0 +1,29 @@
The code and graphics on this website (and it's mirror sites, if any) are
Copyright (c) 1999-2003 by Erik Andersen. All rights reserved.
Documents on this Web site including their graphical elements, design, and
layout are protected by trade dress and other laws and MAY BE COPIED OR
IMITATED IN WHOLE OR IN PART. THIS WEBSITE IS LICENSED FREE OF CHARGE, THERE
IS NO WARRANTY FOR THE WEBSITE TO THE EXTENT PERMITTED BY APPLICABLE LAW.
SHOULD THIS WEBSITE PROVE DEFECTIVE, YOU MAY ASSUME THAT SOMEONE MIGHT GET
AROUND TO SERVICING, REPAIRING OR CORRECTING IT SOMETIME WHEN THEY HAVE NOTHING
BETTER TO DO. REGARDLESS, YOU GET TO KEEP BOTH PIECES.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY
COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS
WEBSITE AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
INABILITY TO USE THIS WEBSITE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
LOSS OF HAIR, LOSS OF LIFE, LOSS OF MEMORY, LOSS OF YOUR CARKEYS, MISPLACEMENT
OF YOUR PAYCHECK, OR COMMANDER DATA BEING RENDERED UNABLE TO ASSIST THE
STARFLEET OFFICERS ABORD THE STARSHIP ENTERPRISE TO RECALIBRATE THE MAIN
DEFLECTOR ARRAY, LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE
WEBSITE TO OPERATE WITH YOUR WEBBROWSER), EVEN IF SUCH HOLDER OR OTHER PARTY
HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
You have been warned.
You can contact the webmaster at <andersen@codepoet.org> if you have some sort
of problem with this.
+9 -88
View File
@@ -1,39 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<title>BusyBox Anonymous CVS Instructions</title>
</HEAD>
<body text="#000000" alink="#660000" link="#660000" bgcolor="#dee2de" vlink="#660000">
<basefont face="lucida, helvetica, arial" size="3">
<!--#include file="header.html" -->
<H3>Accessing the Busybox CVS Repository</H3>
<CENTER>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2>
<TR>
<td bgcolor="#000000">
<FONT FACE="lucida, helvetica" COLOR="#ccccc0">
<B>B&nbsp;u&nbsp;s&nbsp;y&nbsp;B&nbsp;o&nbsp;x</B>
</FONT>
</TD>
</TR>
</TABLE>
<a href="/"><IMG SRC="images/busybox2.jpg" alt="BusyBox" border="0" width="360" height="230"></a><BR>
</CENTER>
<TABLE WIDTH="95%" CELLSPACING=1 CELLPADDING=4 BORDER=1>
<TR><TD BGCOLOR="#ccccc0" ALIGN=center>
<A NAME="intro"> <BIG><B>
Anonymous CVS
</B></BIG></A>
</TD></TR>
<TR><TD BGCOLOR="#eeeee0">
<h3>Anonymous CVS</h3>
We allow anonymous (read-only) CVS access to everyone. The first command you
need to run for anonymous CVS access is:
@@ -59,6 +27,10 @@ This will create a directory called <b>busybox</b> and a directory called
<b>tinylogin</b> in the current directory. These directories contain the
latest and greatest source code for busybox and tinylogin.
<p>
If you are not already familiar with using CVS, I recommend you visit
this quick <a href="/cvs_howto.html">Introduction to CVS</a>.
<p>
I usually create a ~/.cvsrc file with the following things in it, and I
recommend you should use the same:
@@ -78,59 +50,8 @@ cvs update</pre>
Because you've only been granted anonymous access to the tree, you won't be
able to commit any changes. Changes can be submitted for inclusion by posting
them to the appropriate <a href="http://busybox.net/mailman/listinfo">mailing list</a>.
<!-- End of Table -->
</TD></TR>
</TABLE>
<!-- Footer -->
<HR>
<TABLE WIDTH="100%">
<TR>
<TD>
<font size="-1" face="arial, helvetica, sans-serif">
Mail all comments, insults, suggestions and bribes to
<a href="mailto:andersen@codepoet.org">Erik Andersen</a><BR>
The Busybox logo is copyright 1999-2002, Erik Andersen.
</font>
</TD>
<TD>
<a href="http://www.vim.org"><img border=0 width=90 height=36
src="images/written.in.vi.png"
alt="This site created with the vi editor"></a>
</TD>
<TD>
<a href="http://www.gimp.org/"><img border=0 width=90 height=36
src="images/gfx_by_gimp.png" alt="Graphics by GIMP"></a>
</TD>
<TD>
<a href="http://www.linuxtoday.com"><img width=90 height=36
src="images/ltbutton2.png" alt="Linux Today"></a>
</TD>
<TD>
<p><a href="http://slashdot.org"><img width=90 height=36
src="images/sdsmall.png" alt="Slashdot"></a>
</TD>
<TD>
<a href="http://freshmeat.net"><img width=90 height=36
src="images/fm.mini.png" alt="Freshmeat"></a>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
them to the appropriate mailing list. For those that are actively contributing
<a href="cvs_write.html">CVS write access</a> can be made available.
<!--#include file="footer.html" -->
+44
View File
@@ -0,0 +1,44 @@
<!--#include file="header.html" -->
<h3>How to use CVS</h3>
If you want to know all the gory details, you will want to visit
<a href="http://www.cvshome.org/">the CVS main web page</a>.<p>
For the impatient, the following is probably about all you need to know:
<p>
<dl>
<dt><pre>cvs checkout -c</pre>
<dd>Will list the modules available for checkout
<dt><pre>cvs checkout &lt module name &gt</pre>
<dd>Will checkout the named module
<dt><pre>cvs co &lt module name &gt</pre>
<dd>Same thing
<dt><pre>cvs update</pre>
<dd>Updates your local archive so it is in sync with the repository
-- your local updates are left intact. Tries to merge upstream updates
into your local updates. You will see the following tags when it is
updating your local repository: C means conflict, U means update,
P means patched, and M means modified.
<dt><pre>cvs up</pre>
<dd>Same thing
<dt><pre>cvs update &lt file name &gt</pre>
<dd>Same thing but for just the named file(s)/directory(s).
<dt><pre>cvs commit</pre>
<dd>Will check in all your work.
<dt><pre>cvs add &lt file name &gt</pre>
<dd>Adds the named file/directory into CVS
<dt><pre>cvs remove &lt file name &gt</pre>
<dd>Removes the named file/directory from the upstream repository.
<dt><pre>cvs rm &lt file name &gt</pre>
<dd>Same thing
<dt><pre>cvs log &lt file name &gt</pre>
</dl>
<!--#include file="footer.html" -->
+3 -88
View File
@@ -1,40 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<title>BusyBox CVS Read/Write Instructions</title>
</HEAD>
<body text="#000000" alink="#660000" link="#660000" bgcolor="#dee2de" vlink="#660000">
<basefont face="lucida, helvetica, arial" size="3">
<!--#include file="header.html" -->
<H3>Accessing the Busybox CVS Repository</H3>
<CENTER>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2>
<TR>
<td bgcolor="#000000">
<FONT FACE="lucida, helvetica" COLOR="#ccccc0">
<B>B&nbsp;u&nbsp;s&nbsp;y&nbsp;B&nbsp;o&nbsp;x</B>
</FONT>
</TD>
</TR>
</TABLE>
<a href="/"><IMG SRC="images/busybox2.jpg" alt="BusyBox" border="0" width="360" height="230"></a><BR>
</CENTER>
<TABLE WIDTH="95%" CELLSPACING=1 CELLPADDING=4 BORDER=1>
<TR><TD BGCOLOR="#ccccc0" ALIGN=center>
<A NAME="intro"> <BIG><B>
CVS Read/Write Access
</B></BIG></A>
</TD></TR>
<TR><TD BGCOLOR="#eeeee0">
<h3>CVS Read/Write Access</h3>
If you want to be able to commit things to CVS, first contribute some
stuff to show you are serious. Then, very nicely ask
@@ -60,58 +27,6 @@ Note that if you would prefer to keep your communications with me
private, you can encrypt your email using my
<a href="http://www.codepoet.org/~andersen/erik/gpg.asc">public key</a>.
<!-- End of Table -->
</TD></TR>
</TABLE>
<!-- Footer -->
<HR>
<TABLE WIDTH="100%">
<TR>
<TD>
<font size="-1" face="arial, helvetica, sans-serif">
Mail all comments, insults, suggestions and bribes to
<a href="mailto:andersen@codepoet.org">Erik Andersen</a><BR>
The Busybox logo is copyright 1999-2002, Erik Andersen.
</font>
</TD>
<TD>
<a href="http://www.vim.org"><img border=0 width=90 height=36
src="images/written.in.vi.png"
alt="This site created with the vi editor"></a>
</TD>
<TD>
<a href="http://www.gimp.org/"><img border=0 width=90 height=36
src="images/gfx_by_gimp.png" alt="Graphics by GIMP"></a>
</TD>
<TD>
<a href="http://www.linuxtoday.com"><img width=90 height=36
src="images/ltbutton2.png" alt="Linux Today"></a>
</TD>
<TD>
<p><a href="http://slashdot.org"><img width=90 height=36
src="images/sdsmall.png" alt="Slashdot"></a>
</TD>
<TD>
<a href="http://freshmeat.net"><img width=90 height=36
src="images/fm.mini.png" alt="Freshmeat"></a>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
<!--#include file="footer.html" -->
+27
View File
@@ -0,0 +1,27 @@
<!--#include file="header.html" -->
<h3>Documentation</h3>
Current documentation for BusyBox includes:
<ul>
<li><a href=
"downloads/BusyBox.html">BusyBox.html</a>. This is a
list of the all the available commands in BusyBox
with complete usage information and examples of how
to use each app. I have spent a <em>lot</em> of time
updating these docs and trying to make them fairly
comprehensive. If you find any errors (factual,
grammatical, whatever) please let me know.</li>
<li><a href="downloads/README">README</a>. This is
the README file included in the busybox source
release.</li>
<li>If you need more help, the BusyBox <a href=
"lists/busybox/">mailing list</a> is a good place to
start.</li>
</ul>
<!--#include file="footer.html" -->
+38
View File
@@ -0,0 +1,38 @@
<!--#include file="header.html" -->
<h3>Download</h3>
Source for the latest release can always be
downloaded from <a href="downloads">http://www.busybox.net/downloads</a>.
<p>
You can also obtain <a href= "downloads/snapshots/">Daily Snapshots</a> of
the latest stable, and the latest development CVS source trees.
<p>
BusyBox now has <b>two</b> CVS trees. The "busybox-stable" tree
contains the older 0.60.x stable series. The "busybox" tree contains
the latest 1.0.0-preX development version of busybox.<br>
<ul>
<li> Click here to browse the <a href="/cgi-bin/cvsweb/busybox/">
CVS tree for the 1.0.0-preX development version of BusyBox</a>
</li>
<li>Click here to browse the <a href="/cgi-bin/cvsweb/busybox.stable/">
CVS tree for the stable 0.60.x version of BusyBox</a>.
</li>
<li>Anonymous <a href="cvs_anon.html">CVS access</a> is available.
</li>
<li>For those that are actively contributing there is
even <a href="cvs_write.html">CVS write access</a>.
</li>
</ul>
<!--#include file="footer.html" -->
+20
View File
@@ -0,0 +1,20 @@
<!-- Footer -->
</td>
</tr>
</table>
<hr />
<p>
<font face="arial, helvetica, sans-serif" size="-1">
<a HREF="/copyright.txt">Copyright &copy; 1999-2003 Erik Andersen</a>
<br>
Mail all comments, insults, suggestions and bribes to
<br>
Erik Andersen <A HREF="mailto:andersen@codepoet.org">andersen@codepoet.org</A><BR>
</font>
</body>
</html>
Loaded 100 of 307 files, more files were not shown because too many files have changed in this diff. Show more