Compare commits

...
2270 Commits
Author SHA1 Message Date
Eric Andersen 9395ca4f68 prepare for release 2004-10-13 09:42:10 +00:00
Eric Andersen 9789bf1019 return failure when nslookup fails 2004-10-13 07:25:01 +00:00
Eric Andersen 1aee3ff8bb Simon Poole writes:
Erik,

Attached is a patch for the udhcpc sample scripts, to correct the order in
which routers are applied if the DHCP server provides more than one (as per
section 3.5 of RFC2132).

Apologies for not being on the mailing list and thanks for your continued
efforts.

Simon.
2004-10-13 07:18:05 +00:00
Eric Andersen 0e020d1025 Make certain clients of bb_make_directory default to honoring
the user's umask
2004-10-13 06:25:52 +00:00
Eric Andersen 9315842242 Patch from David Daney:
It seems that date  -s MMDDHHMMYYYY.ss

will ignore the .ss part.  This patch tries to fix the problem.

David Daney.
2004-10-11 20:52:16 +00:00
Eric Andersen 62e0037d2d oops 2004-10-08 11:11:02 +00:00
Eric Andersen 5c5f983faf unmerged fix 2004-10-08 10:54:20 +00:00
Eric Andersen 90d3317fbf Bump version 2004-10-08 10:52:33 +00:00
Eric Andersen fdfa09b5c7 Fix the supported architectures section 2004-10-08 10:52:08 +00:00
Eric Andersen 6c4a6b1a23 Add an initial FAQ 2004-10-08 10:50:08 +00:00
Eric Andersen ad63cb2514 Fix CONFIG_ASH_MATH_SUPPORT_64 so it actually works 2004-10-08 09:43:34 +00:00
Eric Andersen a62665b72f Patch from Claus Klein to increase, and make more apparent
the hard coded limit on the number of mounts
2004-10-08 08:57:35 +00:00
Eric Andersen abf58d6ba5 Wade Berrier writes:
Hello,

Here's a patch for a first attempt at static leases for udhcpd.
Included in the tarball are 2 files (static_leases.c, static_leases.h)
and a patch against the latest cvs.

In the config file you can configure static leases with the following
format:

static_lease 00:60:08:11:CE:4E 192.168.0.54
static_lease 00:60:08:11:CE:3E 192.168.0.44

Comments/suggestions/improvements are welcome.


Wade
2004-10-08 08:49:26 +00:00
Eric Andersen 751750e3ee Patch from Denis Vlasenko to fix a problem where
wget http://1.2.3.4/abc/ loses last '/'
2004-10-08 08:27:40 +00:00
Eric Andersen 82baf63de5 Hiroshi Ito writes:
Hello, all.

Busybox init does not handle removed inittab entry correctly.

# I'm sorry about my poor english, but you can find
# what I would like to say from patch, isn't it?

even if you apply this path,
when yoy try to change a command line option in inittab,
you have to do following steps.
1. remove old line from initrd
2. send HUP signal to init
3. kill old proces which is invoked from init.
4. append new line to inittab
5. send HUP signal to init, again

patch is against current CVS + last patch witch I send it last.
2004-10-08 08:21:54 +00:00
Eric Andersen 2271809d75 Hiroshi Ito writes:
"kill -HUP 1" reloads inittab, and when I append one line to inittab
and send HUP signal two times, It will starts 2 process.

patch against current CVS is attached.
2004-10-08 08:17:39 +00:00
Eric Andersen c00e11df85 Hiroshi Ito writes:
ash
   "unset OLDPWD; cd -"  causes segmentation fault.
    ( OLDPWD is not set when sh is invoked from getty. )

patch against current CVS is attached.
2004-10-08 08:14:58 +00:00
Eric Andersen 31c27a9c65 Hiroshi Ito writes:
Hello

    I'm using busy box on mipsel machine.

    "grep -f file" will cause segmentation fault.

Vladimir N. Oleynik writes:

Hiroshi,

Thank for bug report, but your patch is full broken.
Worked patch attached.
(really changes is zero initialize, and indent correcting).


--w
vodz
2004-10-08 08:10:57 +00:00
Eric Andersen 94d628c76a Tito writes:
Hi to all,
This patch contains just some fixes for some misleading
comments in my_getpwuid.c and my_getug.c.
The code is untouched so this patch will not
cause troubles.

Please apply.

Thanks in advance and Ciao,
Tito
2004-10-08 08:07:40 +00:00
Eric Andersen 07f2fea62c last_patch139.gz from Vladimir N. Oleynik:
>I also don't mean to disagree about leaving 30x status codes until after
>1.0.  In fact, although redirecting http://host/dir to http://host/dir/
>with a 301 is common practice (e.g. Apache, IIS), AFAIK it isn't
>actually required (or mentioned) by the HTTP specs.

Ok.
Attached patch have 302 and 408 implemented features.


--w
vodz
2004-10-08 08:03:29 +00:00
Eric Andersen 9e954abc4f As noticed by egor duda, current_menu is declared as 'extern struct menu
*current_menu;' in scripts/config/lkc.h line 63, and this conflicts with
static definition in mconf.c.
2004-10-08 07:58:30 +00:00
Eric Andersen 7daa076d3e egor duda writes:
Hi!

I've created a patch to busybox' build system to allow building it in
separate tree in a manner similar to kbuild from kernel version 2.6.

That is, one runs command like
'make O=/build/some/where/for/specific/target/and/options'
and everything is built in this exact directory, provided that it exists.

I understand that applyingc such invasive changes during 'release
candidates' stage of development is at best unwise. So, i'm currently
asking for comments about this patch, starting from whether such thing
is needed at all to whether it coded properly.

'make check' should work now, and one make creates Makefile in build
directory, so one can run 'make' in build directory after that.

One possible caveat is that if we build in some directory other than
source one, the source directory should be 'distclean'ed first.

egor
2004-10-08 07:46:08 +00:00
Eric Andersen 2842659cc0 Patch from Michael Tokarev:
Scenario:

  touch x -- creates plain file name `x'
  mkdir x -- exits successefully

libbb/make_directory.c, bb_make_directory(), contains
the following code:

        if (mkdir(path, 0777) < 0) {
            /* If we failed for any other reason than the directory
             * already exists, output a diagnostic and return -1.*/
            if (errno != EEXIST) {
                fail_msg = "create";
                umask(mask);
                break;
            }
            /* Since the directory exists, don't attempt to change
             * permissions if it was the full target.  Note that
             * this is not an error conditon. */
            if (!c) {
                umask(mask);
                return 0;
            }
        }

The assumption that EEXIST error is due to that the *directory*
already exists is wrong: any file type with that name will cause
this error to be returned.  Proper way IMHO will be is to stat()
the path and check whenever this is really a directory.  Below
(attached) is a patch to fix this issue.
2004-10-08 07:21:58 +00:00
Eric Andersen d952ee2e9e Make it more apparent that archive creation is not supported 2004-10-07 00:35:59 +00:00
Glenn L McGrath f86391e7d7 Patch from William Barsse to fix a segfault when multiple files are specified. 2004-09-30 00:24:21 +00:00
Glenn L McGrath ca29ffc206 Patch from Dmitry Zakharov to fix a bug triggered by freeswan's scripts. 2004-09-24 09:24:27 +00:00
Glenn L McGrath bdf6319d3a Patch from Egor Duda
Attached patch prevents modprobe from trying to call 'insmod (null)'
whenever nonexistent module is either passed to modprobe via command
line or mentioned in modules.dep

this replaces cryptic error
sh: Syntax error: word unexpected (expecting ")")
with
modprobe: module some-module not found.

egor.
2004-09-24 09:18:55 +00:00
Glenn L McGrath 53090cdedd Fix a typo 2004-09-24 09:09:44 +00:00
Glenn L McGrath 29de86314a Remove this error message at Vodz request, it was misleading. 2004-09-24 02:36:44 +00:00
Glenn L McGrath afc9ab8686 Patch from David Daney to make the -i option work with -l. 2004-09-24 02:04:13 +00:00
Eric Andersen 6f8542b98d A bit of extra explanation regarding STANDALONE 2004-09-24 01:25:39 +00:00
Eric Andersen 31ec93e580 Add some notes on how to make telnetd actually work 2004-09-23 20:08:46 +00:00
Glenn L McGrath ca1c1afadc Add a missing brace, patch by Hideki IWAMOTO 2004-09-15 03:24:32 +00:00
Glenn L McGrath f15dfc5570 Tito writes,
"This patch fixes all the bugs in id previously spotted by vodz and me.
The binary size increased a bit,  but now it should work as expected."
2004-09-15 03:04:08 +00:00
Glenn L McGrath 995d96a99d Only write to shadow file is shadow passwords are enabled. Patch by magicfox modified by myself to retain check for shadow file access. 2004-09-15 02:39:09 +00:00
Glenn L McGrath 240a91d8a1 Patch by Felipe Kellermann, use the common escape handling function and remove some unused code. 2004-09-15 02:05:23 +00:00
Glenn L McGrath b6570d07c4 remove a cut/paste mistake, i better get some sleep. 2004-09-14 19:14:00 +00:00
Glenn L McGrath 225be8c1f0 Apply patch from Felipe Kellermann to simlify logic of sort functions.
I reversed the result of the sort functions to make the big numbers go to the top.
2004-09-14 18:56:52 +00:00
Glenn L McGrath 73ebb889da Patch by Felipe Kellermann, fix a bug introduced in the last patch by adding a condition around the remote logging, also adds some comments. 2004-09-14 18:12:13 +00:00
Glenn L McGrath d4004ee6a9 Patch from Felipe Kellermann, remove some unnecessary dups, i declared a few extra const's also. 2004-09-14 17:24:59 +00:00
Glenn L McGrath ab1955c236 Patch from Felipe Kellermann, adds missing applet usage options, removes usage
for options that are currently not implemented and fixes typos.
2004-09-14 16:23:56 +00:00
Glenn L McGrath d2bd7d8dd5 Patch from tito to add argument checking. 2004-09-14 16:08:02 +00:00
Glenn L McGrath e11db0ed35 I have to assume both Avaks and LSILogic are deliberatly ignoring me. 2004-09-14 13:59:44 +00:00
Eric Andersen e9c826f12a Fixup URL 2004-09-08 20:13:05 +00:00
Eric Andersen f91b9282a3 Felipe Kellermann writes:
The Togg's sysklogd patch to use sendto() on remote logging is formatting
strangely (using `<' and '>' surrounding the `msg' string message).  This
is OK, but this is not the standard way of formatting this message.

So this patch does the following:

o Fix the formatting to the standard way.
o Uses `MAXLINE' when needed;
o Don't loop sending messages without a "sleeping time",
  I'm now doing `now = 1', `now <<= 1';
o Don't die on `init_RemoteLog' when starting up (feature!)
  We're now trying to connect every time we have an invalid fd;
o Removes one static uneeded variable.
o Removes two automatic uneeded variables.
2004-09-08 10:56:06 +00:00
Eric Andersen 4a79c0e9e1 Patrick Huesmann noticed BusyBox would not link when
CONFIG_FEATURE_COMMAND_EDITING was defined *and*
CONFIG_FEATURE_COMMAND_TAB_COMPLETION was undefined.

Vladimir N. Oleynik writes:

Its declare always, also if CONFIG_FEATURE_COMMAND_TAB_COMPLETION
undefined.
Patch to CVS version attached.

--w
vodz
2004-09-08 10:01:07 +00:00
Eric Andersen fd7a4c8c28 Jonas Holmberg from axis dot com writes:
This patch makes msh handle variable expansion within backticks more
correctly.

Current behaviour (wrong):
--------------------------

BusyBox v1.00-rc3 (2004.08.26-11:51+0000) Built-in shell (msh)
Enter 'help' for a list of built-in commands.

$ A='`echo hello`'
$ echo $A
`echo hello`
$ echo `echo $A`
hello
$


New behaviour (correct):
------------------------

BusyBox v1.00-rc3 (2004.08.26-11:51+0000) Built-in shell (msh)
Enter 'help' for a list of built-in commands.

$ A='`echo hello`'
$ echo $A
`echo hello`
$ echo `echo $A`
`echo hello`
$

The current behaviour (wrong according to standards) was actually my
fault. msh handles backticks by executing a subshell (which makes it
work on MMU-less systems). Executing a subshell makes it hard to only
expand variables once in the parent. Therefore I export all variables
that will be expanded within the backticks and let the subshell handle
the expansion instead.

The bug was found while searching for security leaks in CGI-scripts.
Current behaviour of msh makes it easy to expand backticks by mistake
in $QUERY_STRING. I recommend appling the patch before release of bb
1.00.

/Jonas
2004-09-02 23:13:10 +00:00
Eric Andersen 7b08cdd98c No longer needed 2004-09-02 23:11:53 +00:00
Eric Andersen 45a0513a64 Based on patches from Mike Frysinger, add insmod support for
sparc and ia64 (itanium).

Also, reorganize the insmod architecture support code to be
alphasorted and less messy.

Update the readme to list current insmod arch support.
2004-09-02 23:03:25 +00:00
Eric Andersen 192c35f6eb Tito writes:
The second patch contains:
1) a size optimization for adduser.c
2) removes a warning about an unused variable in syslogd.c if CONFIG_FEATURE_REMOTE_LOG is not set
3)cosmetic fixes for addgroup_full_usage and adduser_full_usage

Ciao,
Tito
2004-09-02 22:22:17 +00:00
Eric Andersen 7eb79fff10 Tito writes:
Hi Erik,
Hi to all,
This is part five of the my_get*id story.
I've tweaked a bit this two functions to make them more flexible,
but this changes will not affect existing code.
Now they work so:
1) my_getpwuid( char *user, uid_t uid, int bufsize)

   if bufsize is > 0 char *user cannot be set to NULL
                     on success username is written on static allocated buffer
                     on failure uid as string is written to buffer and NULL is returned
   if bufsize is = 0 char *user can be set to NULL
                     on success username is returned
                     on failure NULL is returned
   if bufsize is < 0 char *user can be set to NULL
                     on success username is returned
                     on failure an error message is printed and the program exits

  2) 1) my_getgrgid( char *group, uid_t uid, int bufsize)

   if bufsize is > 0 char *group cannot be set to NULL
                     on success groupname is written on static allocated buffer
                     on failure gid as string is written to buffer and NULL is returned
   if bufsize is = 0 char *group can be set to NULL
                     on success groupname is returned
                     on failure NULL is returned
   if bufsize is < 0 char *group can be set to nULL
                     on success groupname is returned
                     on failure an error message is printed and the program exits

This changes were needed mainly for my new id applet.
It is somewhat bigger then the previous but matches the behaviour of GNU id
and is capable to handle usernames of whatever length.
BTW: at a first look it seems to me that it will integrate well (with just a few changes)
with the pending patch  in patches/id_groups_alias.patch.
The increase in size is balanced by the removal of my_getpwnamegid.c
from libbb as this was used only in previous id applet and by size optimizations
made possible in whoami.c and in passwd.c.
I know that we are in feature freeze but I think that i've tested it enough
(at least I hope so.......).
2004-09-02 22:21:41 +00:00
Eric Andersen b225e2a76b Fixup some warnings 2004-08-28 00:43:07 +00:00
Eric Andersen 785001468d Quiet a few warnings 2004-08-27 19:55:28 +00:00
Eric Andersen 75813eea23 Togg writes:
Syslogd wont start if remote-logging is enabled and the connection to the
remote-log server is not possible on syslogd startup.

I found a patch somewhere which works like a charm. It uses sendto() which
seems more reliable for this issue.

Please see attached patch. Many people will be more happy with this included
I think.

Regards,
Togg
2004-08-26 23:15:29 +00:00
Eric Andersen 138791050d Improve the setuid situation a bit, and make it more apparent
when people really ought to make busybox setuid root.
 -Erik
2004-08-26 23:13:00 +00:00
Eric Andersen 37ba6bfb6d The login applet should always be setuid root 2004-08-26 23:01:34 +00:00
Eric Andersen 095dd0c46d Tito writes:
Hi,
I've fixed also the issue of whoami cutting down usernames.
This time I cannot send a diff because i don't know if my previous patches will be applied
or not, so I send in the whole file.
The changes I've made don't affect size but ensure that usernames of whatever lenght
are correctly displayed.
root@localhost:/dev/pts/3:/root/Desktop/busybox/coreutils# size whoami_orig.o
   text    data     bss     dec     hex filename
    102       0       0     102      66 whoami_orig.o
root@localhost:/dev/pts/3:/root/Desktop/busybox/coreutils# size whoami.o
   text    data     bss     dec     hex filename
     93       0       0      93      5d whoami.o

This should be applied even if the other patches aren't as this matches the behaviour of the  GNU whoami.

Thanks in advance,
Ciao,
Tito
2004-08-26 22:36:02 +00:00
Eric Andersen 713d6e3dd3 Save a line or two 2004-08-26 22:26:26 +00:00
Eric Andersen 97a1de10e9 Vladimir N. Oleynik writes:
Ming-Ching,

>>No. Here there are no mistakes.
>>You using POST metod.
>>For get data you should read from stdin CONTENT_LENGTH bytes.

>Hower as I posted a little while ago, there is indeed a bug
>in POST method if the CONTENT_LENGTH is bigger
>than sizeof(wbuf[128]). So if your CGI script is expecting to
>read the full CONTENT_LENGTH, it might block forever,
>because it will only transfer sizeof(wbuf) to the CGI.

Ok, Ok. I should find time to understand with a problem.
Try attached patch.


--w
vodz
2004-08-26 22:22:50 +00:00
Eric Andersen 52499cb9ae Tito writes:
Hi,
I've spent the half night staring at the devilish  my_getpwuid and my_getgrgid functions
trying to find out a way to avoid actual and future potential buffer overflow problems
without breaking existing code.
Finally I've  found a not intrusive way to do this that surely doesn't break existing code
and fixes a couple of problems too.
The attached patch:
1) changes the behaviour of my_getpwuid and my_getgrgid to avoid potetntial buffer overflows
2) fixes all occurences of this function calls in tar.c , id.c , ls.c, whoami.c, logger.c, libbb.h.
3) The behaviour of tar, ls and  logger is unchanged.
4) The behavior of ps with somewhat longer usernames messing up output is fixed.
5) The only bigger change was the increasing of size of the buffers in id.c to avoid
     false negatives (unknown user: xxxxxx) with usernames longer than 8 chars.
     The value i used ( 32 chars ) was taken from the tar header ( see gname and uname).
     Maybe this buffers can be reduced a bit  ( to 16 or whatever ), this is up to you.
6) The increase of size of the binary is not so dramatic:
     size busybox
       text    data     bss     dec     hex filename
     239568    2300   36816  278684   4409c busybox
    size busybox_fixed
       text    data     bss     dec     hex filename
     239616    2300   36816  278732   440cc busybox
7) The behaviour of whoami changed:
    actually it  prints out an username cut down to the size of the buffer.
    This could be fixed by increasing the size of the buffer as in id.c or
    avoid the use of my_getpwuid and use getpwuid directly instead.
    Maybe this colud be also remain unchanged......

Please apply if you think it is ok to do so.
The diff applies on today's cvs tarball (2004-08-25).
Thanks in advance,
Ciao,
Tito
2004-08-26 22:18:59 +00:00
Eric Andersen 6fea7328ee Felipe Kellermann writes:
Unfortunatelly I've not followed the last two or three weeks commits (new
semester started and so now I rarely have time to fix my personal bridge)
but tonight I synched my tree and immediately noticed a rather nasty bug!

[Using libbb/interface.c:1.24]
# grep eth0 /proc/net/dev | xargs
eth0:311708397 237346 1670 0 1789 1670 0 0 22580308 120297 0 0 0 102 0 0

# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:20:AF:7C:EA:B7
          inet addr:10.0.0.1  Bcast:10.0.0.127  Mask:255.255.255.128
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:5 Base address:0x320


All values `ifconfig' is showing are `zeroed' -- I quickly looked at the
last commits I missed and noticed that there were a commit relating to
ifconfig, libbb/interface.c:1.23->1.24 (PatchSet 4338).

I've reversed the patch and now everything is working again.  I compared
the get_name's return values from the 1.23 and 1.24 and quickly noticed
that the new revision is leaving `p' right on the sep while the rev 1.23
was leaving it right on the starting of the values...

1-line, 1/3-minute patch attached  :-)
2004-08-26 21:45:21 +00:00
Glenn L McGrath b619419962 Patch from Manousaridis Angelos to cleanup stale file descriptors, it was preventing unmounting an initial filesystem. 2004-08-25 02:02:19 +00:00
Eric Andersen a4d27d2d38 Patch from Rodney Radford adding x86_64 support. 2004-08-19 19:17:30 +00:00
Eric Andersen a9eb33ddc7 regularly update the status line display
-Erik
2004-08-19 19:15:06 +00:00
Eric Andersen 807bd846b6 Patch from Mike Castle to cleanup some modutils issues, in
particular making alias support work better.
2004-08-19 18:30:31 +00:00
Eric Andersen a4fcccefa6 Patch from Tito adding support for '-q' 2004-08-19 18:26:26 +00:00
Eric Andersen b131db4326 Patch from Tito documenting the '-q' option 2004-08-19 18:25:02 +00:00
Eric Andersen cb01bb1d68 Patch from Vladimir N. Oleynik:
On Wed Aug 18, 2004 at 06:52:57PM +0800, Matt Johnston wrote:
> I've come across some strange-seeming behaviour when running programs
> under Busybox (1.0.0-rc3) ash. If the child process sets stdin to be
> non-blocking and then exits, the parent ash will also exit. A quick strace
> shows that a subsequent read() from stdin returns EAGAIN (as would be
> expected):

Thanks!
Patch attached.


--w
vodz
2004-08-19 18:22:13 +00:00
Eric Andersen 9ab4657c89 Fixup 'dc' usage 2004-08-18 17:57:16 +00:00
Eric Andersen b36900c4b4 Prepare for release 2004-08-16 10:29:29 +00:00
Eric Andersen 85ae1bb67d Bump version 2004-08-16 10:23:33 +00:00
Eric Andersen e3a792c80c Only pass modprobe module params with 2.6.x kernel support.
-Erik
2004-08-16 10:22:34 +00:00
Eric Andersen 1f50e84283 Do not use vfork, as init is not vfork safe. Do not allow
askfirst when mmuless.
2004-08-16 09:29:42 +00:00
Eric Andersen 88e38ca2fb Bertrand Baudet writes:
Looks like the -D and -H options of the adduser applet aren't handle
properly in BusyBox.

This patch fixes the masks definition for those options according to
there position in the optstring.

Patch against RC2 but should also apply cleanly against CVS.

Bertrand
2004-08-16 09:07:39 +00:00
Eric Andersen acd647c877 Joe.C writes:
This bug is in busybox 1.0.0-rc2. When using lash exec
builtin with redirection, the opened file fd keep increasing.
For example, please try the following command with lash.


ls -al /proc/<lash pid>/fd
exec /bin/sh 2>/dev/null
ls -al /proc/<lash pid>/fd

  The last 'ls' command output will look like this. The fd
number 4 shouldn't exist.

lrwx------    1 501      100         64 Aug 13 13:56 4 -> /dev/pts/5
l-wx------    1 501      100         64 Aug 13 13:56 2 -> /dev/null
lrwx------    1 501      100         64 Aug 13 13:56 1 -> /dev/pts/5
lrwx------    1 501      100         64 Aug 13 13:56 0 -> /dev/pts/5
dr-xr-xr-x    3 501      100          0 Aug 13 13:56 ..
dr-x------    2 501      100          0 Aug 13 13:56 .

  This one-line patch fix this problem by setting CLOEXEC flag for
squirrel fd. Please apply.

Joe.C
2004-08-16 08:38:34 +00:00
Eric Andersen 0722513497 Use __kernel_old_dev_t for 2.6.x kernels 2004-08-16 08:36:28 +00:00
Eric Andersen cf6ef05711 Aurelien Jacobs writes:
with a quick conversion you will see that 132608 == 0x20600
so noticed that the elif will never be matched !
Apparently there was already a try to modify this in CVS which
was reverted (it was plain wrong).

I don't know when __kernel_old_dev_t is needed, but with a 2.6.7
or a 2.6.8 this is __kernel_dev_t wich is needed.

I corrected this with the following patch but maybe older 2.6
still need __kernel_old_dev_t ?

I think this should be corrected before 1.0.

Thanks
Aurel
2004-08-16 08:29:44 +00:00
Eric Andersen beaef16315 Christian Ostheimer writes:
Hello,

function build_dep in modprobe.c assumes that dependencies of one module
have not more than 255 chars;
that is not sufficient in kernel 2.6.7 (alsa sound modules). - Below is
a diff that solves the problem for me.

With regards, Christian Ostheimer
2004-08-14 20:57:33 +00:00
Eric Andersen 9940e081c9 Patch from solar to fix problems with get_name() 2004-08-12 16:52:00 +00:00
Glenn L McGrath 4014ab1c60 Set default command to list rather than get, its default behaviour now
coincides with upstream. Patch from debian diff.
2004-08-11 08:10:58 +00:00
Glenn L McGrath fcf47321d4 Patch from Mike Castle, dont print an empty line (patch modified by me to
change formatting).
2004-08-11 05:56:30 +00:00
Glenn L McGrath 18bbd9bf3b Patch from Tito to fix memory leak upon error. 2004-08-11 03:50:30 +00:00
Glenn L McGrath 73db8be80a Patch from Bastian Blank to add 64 bit support to the test command.
Example of broken usage: ./busybox test 2147483648 -gt 2147483648
2004-08-11 02:45:47 +00:00
Glenn L McGrath d2c6f9a1f9 Patch from Phil Blundellto improve substring match 2004-08-11 02:32:18 +00:00
Glenn L McGrath 65c8c7ba27 Willian Barsse wrote
"There seems to be a slight problem with the "mod_strcmp" function in
modprobe.c, it scans for the first occurence of the module name in the
"mod_path" variable and expects it to be the last path element. ie
/lib/modules/2.4.22-debug/kernel/fs/vfat in my example. The comparison
will always fail if mod_path contains another substring matching the
module name."

Robert McQueen wrote
"Although William Barsse's patch fixed mod_strcmp for 2.4 kernels, there
was a remaining problem which prevented it from working for me. I've
just tracked it down - when you enable kernel 2.6 module support it
hard-wired the extension to .ko instead of checking at runtime like the
other places where 2.4 differs from 2.6. The attached patch fixes this
for me."
2004-08-11 02:30:30 +00:00
Glenn L McGrath 2f325a030b Patch from Tito to fix warnings about redifined functionions barrier and likely. 2004-08-06 01:49:04 +00:00
Glenn L McGrath 12ed333714 Part of patch from William Barsse, fixes a problem with unescaped %. 2004-08-06 00:58:53 +00:00
Eric Andersen 12de6cf0d7 Michael Leibow, MichaelLe at belkin.com writes:
A question was posted a month ago by Mark Alamo to see if others had
problems with sourcing subscripts within msh.  We asked his firm to fix the
msh.c bug he described because we didn't have enough time to do it
ourselves.

When msh.c is executing a compound statement and there is a . command to
source another script file, msh.c will not execute the subscript until it's
completed executing the rest of the compound statement.

His example was this:

Echo "Start" ; . ./subA; echo "mid" ; . ./subB ; echo "end"

subA and subB execute AFTER end is printed in reverse order.  The same is
true if the sourced files are inside an if else fi, case esac, or any
compound statement.

Attached is a patch to msh.c.  It fixes the problem.  Cd to the root of your
busybox tree and execute "patch -p1 < msh.c.patch"

Unfortunately, I won't have more time to work on this so I hope that there
aren't any problems!

Michael Leibow
Senior Software Engineer

Belkin Corporation
2004-08-04 19:19:10 +00:00
Eric Andersen 8401eeafd6 Run msh through indent 2004-08-04 19:16:54 +00:00
Eric Andersen 44b5758247 William Barsse writes:
fixes two other issues (plus the previous as well) with a 2.4 kernel :

- should be able to modprobe an already loaded module and get 0 return
code :
# modprobe <something> && modprobe <something> && echo "ok" || echo "failed"
....
failed

Well, hope this helps and that I didn't screw up again,
- William
2004-08-03 08:23:33 +00:00
Eric Andersen 93d7fba892 Tito, farmatito at tiscali dot it writes:
Hi to all,
This patch is useful for:
1) remove an unused var from extern char *find_real_root_device_name(const char* name)
    changing it to extern char *find_real_root_device_name(void).
2) fixes include/libbb.h, coreutils/df.c, util-linux/mount.c and  util-linux/umount.c accordingly.
3) fixes a bug, really a false positive,  in find_real_root_device_name() that happens if
    in the /dev directory exists a link named root (/dev/root) that should be skipped but
    is not. This affects applets like df that display wrong results
2004-08-03 00:14:02 +00:00
Eric Andersen ec91de762a fixup cut-n-paste problem 2004-08-01 18:54:45 +00:00
Eric Andersen 67776bef59 Simon Poole reports that awk segfaults when environment variables
with no value exist, i.e.

	$ export BOB=''
	% ./busybox awk
	Segmentation fault

This patch teaches awk to not blow chunks on empty env variables.
 -Erik
2004-07-30 23:52:08 +00:00
Eric Andersen cbcdbc41ff Fix incorrect arguments being passed to mknod 2004-07-30 17:48:21 +00:00
Eric Andersen b737b1a68b Umm. Not guilty by reason of insanity.
-Erik
2004-07-30 17:39:08 +00:00
Eric Andersen aad29b37a7 Fixup getty, login, etc so the utmp and wtmp are updated, allowing
the 'who' and 'last' applets among other things to work as expected.
 -Erik
2004-07-30 17:24:47 +00:00
Eric Andersen 15b588559b use SIGTERM to kill off udhcpd, not SIGKILL 2004-07-30 14:45:08 +00:00
Eric Andersen e71e760a99 Fix up brain damage with the way major and minor are used to
create a dev_t
2004-07-30 14:36:37 +00:00
Eric Andersen 373bc1eaee As noted by Eric Spakman, calling static_down() and then calling
bootp_down() seems redundant, esp since bootp_down was a subset
of static_down, so just use that...
2004-07-30 14:31:01 +00:00
Manuel Novoa III 413db4d583 Clean up hex escape support. 2004-07-29 23:15:16 +00:00
Eric Andersen 27645b4345 Thanks to Ken Roberts, fix the slackware url 2004-07-28 19:15:04 +00:00
Eric Andersen ccfc44806d Felipe Kellermann noticed a missing `break'. 2004-07-27 16:45:46 +00:00
Robert Griebl 9768a65eb4 document stuff I have done 2004-07-26 18:57:49 +00:00
Eric Andersen 7f8bcbefc7 add missing ; 2004-07-26 12:22:33 +00:00
Eric Andersen 461cdc89a9 bump version to -rc2 2004-07-26 12:12:06 +00:00
Eric Andersen b2a300590d bother. unrevert my fix. 2004-07-26 12:11:32 +00:00
Eric Andersen 8f38782a6e Prepare for release 2004-07-26 12:07:01 +00:00
Eric Andersen 53f5c0d5bf Allow hex escape sequences 2004-07-26 12:06:19 +00:00
Eric Andersen ac594257c3 Make certain that udhcp shuts down the interface 2004-07-26 12:05:44 +00:00
Eric Andersen 882cec3e40 YAEGASHI Takeshi writes:
Hi,

With the following /etc/fstab (any two or more lines of nfs), mount -a
-t nfs causes a segmentation faults.

server:/exports/aaa /mnt/aaa nfs defaults 0 0
server:/exprots/bbb /mnt/bbb nfs defaults 0 0

In util-linux/nfsmount.c, it overwrites malloc'ed pointer *mount_opts
with a static pointer.  With this patch it does proper memory realloc
and data copy instead.
2004-07-26 12:05:12 +00:00
Eric Andersen 29128cd412 oops 2004-07-26 11:46:50 +00:00
Eric Andersen f54176de6d bump version to -rc2 2004-07-26 11:45:47 +00:00
Eric Andersen 06e62fd5f0 Make certain that udhcp shuts down the interface 2004-07-26 11:45:25 +00:00
Eric Andersen 380919905c Allow hex escape sequences 2004-07-26 11:28:47 +00:00
Eric Andersen 4f807a84c5 BusyBox has no business hard coding the number of major and minor bits for a
dev_t.  This is especially important now that the user space concept of a dev_t
and the kernel concept of a dev_t are divergant.  The only bit of user space
allowed to know the number of major and minor bits is include/sys/sysmacros.h
(i.e. part of libc).  When used with a current C library and a 2.6.x kernel,
this fix should allow BusyBox to support wide device major/minor numbers.
 -Erik
2004-07-26 09:11:12 +00:00
Eric Andersen 5dcf15e02d Paul Whittaker writes:
With job control enabled, ash fails to tcsetpgrp back to initialpgrp
upon exit.  exitshell() should call setjobctl(0) to do this.

Context: I am using a lightweight menu system (replimenu[.sf.net]) on my
console, which invokes "/bin/sh -i -c /bin/login", where /bin/sh and
/bin/login are busybox applets.   /bin/sh is ash, with
CONFIG_ASH_JOB_CONTROL=y as the sole suboption.  The shell of the user
concerned (nobody) is also /bin/sh (ash).  When the user /bin/sh exits
(and thereby login and its parent sh), replimenu receives EIO when it
tries to read from the terminal.
2004-07-24 12:44:13 +00:00
Glenn L McGrath 7991ad1720 Patch by Paul Whittaker, make busybox dc compatable with GNU dc.
the following example was broken, echo "1 1 +" | dc
2004-07-24 06:01:52 +00:00
Glenn L McGrath 6caf13bc7f Update Tito's contributions 2004-07-24 01:55:56 +00:00
Glenn L McGrath efc6bf6365 Patch from Felipe Kellermann, fix endless loop when first > last and
increment > 0.
2004-07-23 06:43:29 +00:00
Glenn L McGrath c0dd26f68d Patch from Felipe Kellermann, fixup usage for pidof, poweroff, remove
some trailing '\n'
2004-07-23 06:06:21 +00:00
Glenn L McGrath d250167bd2 Patch from Felipe Kellermann, fixup usage for halt command 2004-07-23 05:16:17 +00:00
Glenn L McGrath 72b14a8638 iUpdate reboot usage, patch by Felipe Kellermann 2004-07-23 03:33:38 +00:00
Glenn L McGrath 1fbc909570 Patch from Dmitry Zakharov to fix a bug discovered via the freeswap
script.
2004-07-23 02:11:25 +00:00
Glenn L McGrath 2e99d43846 Fix for a bug identied by Harald Kuthe, when using many interfaces (29
in this case) the order was incorrect and there were duplicate entries.
2004-07-23 01:49:46 +00:00
Glenn L McGrath 9c83e83628 Felipe Kellermann writes,
"As noticed today by Steven Scholz, the od's `-v' was broken.
I've fixed that and now both the flags `-v' and `-a' are OK"

Fixes a segfault in
echo "uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu\02bar\4"| ./busybox od -av
2004-07-23 01:42:28 +00:00
Glenn L McGrath eeb06bf230 Patch from Felipe Kellermann, "There is a call to printf using `*pr-cchar'
referencing a string and using a single char, when *p <= 0x1f."
2004-07-23 01:35:41 +00:00
Glenn L McGrath 435962327a Patch from Felipe Kellermann to fix some typo's 2004-07-23 01:27:56 +00:00
Glenn L McGrath b875631754 Patch from Adam Slattery to add bzip2 support to rpm2cpio 2004-07-23 01:20:57 +00:00
Glenn L McGrath 4d405bbc05 Patch from Manousaridis Angelos to bring dhclient down more elegently 2004-07-23 01:10:22 +00:00
Glenn L McGrath 5529b7bb87 Reverse my previous change, "::" is a GNU getopt extension that allows
an optional argument.
Looks like a glibc bug to me
2004-07-22 04:23:18 +00:00
Robert Griebl 36a836d564 Patch from Mike Snitzer <snitzer@gmail.com>:
Support for /etc/modprobe.conf (for 2.6 kernels) should likely be added
to bb's modprobe, see attached patch.

modprobe.conf is just a (even simpler) variant of modules.conf
2004-07-22 00:03:39 +00:00
Glenn L McGrath 0177ce1256 Patch from Mike Snitzer to fix return codes.
"I have a need to _really_ know if the interface was properly configured
via ifup so I made busybox's ifupdown pass the return codes through rather
than dropping them on the floor."

"All the functions in ifupdown.c return 1 on success and 0 on failure
(which happens to the opposite of standard practices but whatever).
So it is important for all these functions to not blindly return 1."

"The problem with blindly returning ret, even if it is != 1, is the
callers expect a 0 or 1 and accumulate the return codes.  So a function that
makes 3 calls to execute will have a value of 3 accumulated.  That value
of 1 (success) was almost always returned even if 1 of the commands in the
command sequence failed.  The attached patch fixes the lack of checking
to verify thar result == expected_reult."
2004-07-21 23:56:31 +00:00
Glenn L McGrath e8f46515cb Fix bug in accepting buffer size argument 2004-07-21 13:06:30 +00:00
Glenn L McGrath 8539667279 Patch from Tito, ass usage for strings -a options 2004-07-21 12:25:55 +00:00
Glenn L McGrath 469a1ead53 Patch from Mike Snitzer, bring down dhclient using its correct pid, fix
a grammatical error.
2004-07-21 12:21:39 +00:00
Glenn L McGrath 28939ade2d Patch from Jean Wolter, fixes compiler warning when ASH_ALIAS is
disabled.
2004-07-21 10:20:19 +00:00
Glenn L McGrath a88ae491e3 Fixup -T (--files-from) option, works for non-directories now 2004-07-21 09:00:39 +00:00
Eric Andersen f828da0020 Avoid a naming conflict with include/bits/fcntl.h 2004-07-20 22:53:59 +00:00
Robert Griebl bd8dd1e763 Patch from Mike Snitzer <snitzer@gmail.com>:
Please see the attached patch for the following crash with busybox'
2.6 rmmod support
2004-07-20 18:36:51 +00:00
Robert Griebl 809387fe9e new_process_module_arguments returns 0 on error and 1 if everything went ok
somehow the ! got lost..
symptoms: modules could only be loaded _without_ parameters
2004-07-20 15:43:57 +00:00
Eric Andersen 83676f1731 oops 2004-07-20 11:41:16 +00:00
Eric Andersen a212af1ef2 Yet more doc updates 2004-07-20 11:31:52 +00:00
Eric Andersen 24c20b1d10 more doc updates 2004-07-20 11:31:08 +00:00
Eric Andersen ab95e3cd66 cut-n-paste strikes again 2004-07-20 11:23:45 +00:00
Eric Andersen f429d511b1 Update for release 2004-07-20 11:08:30 +00:00
Eric Andersen 197d6d45f3 Update changelog 2004-07-20 10:12:21 +00:00
Eric Andersen c0693ed61b Deal with the fact that 2.6.x kernels replace any '-'s in the
module name with a '_'.
 -Erik
2004-07-20 10:05:13 +00:00
Eric Andersen aea8e0eea7 Bump version up to release candidate 1 2004-07-20 09:23:41 +00:00
Eric Andersen 98e4eab0c6 Include some documentation posted to the list by vodz 2004-07-20 08:07:10 +00:00
Eric Andersen 165e8cbf34 Assign 'forced' before the goto to avoid a warning 2004-07-20 06:44:46 +00:00
Eric Andersen 5e136f269b Prevent "bootp_down' was declared implicitly extern' and later `static'" warning 2004-07-20 06:35:54 +00:00
Eric Andersen 65659be213 Add missing type for CONFIG_FEATURE_QUERY_MODULE_INTERFACE 2004-07-20 06:09:14 +00:00
Eric Andersen f9584a19ca Update the default config to not ask stuff 2004-07-20 06:06:56 +00:00
Eric Andersen 8f41bfc05c The 'tests' target is long gone. 2004-07-20 06:04:28 +00:00
Eric Andersen 9615a08218 Replace the old and somewhat buggy pwd_grp stuff with the shiny
new stuff mjn3 wrote for uClibc
2004-07-15 12:53:49 +00:00
Eric Andersen 837f058fb3 Peter Kjellerstedt at axis.com writes:
Hello,

the attached patch should bring extra/config in line
with the Linux 2.6.7 sources.

The following are the commit messages for the respective
files from the Linux bk-repository:

checklist.c:
* fix menuconfig choice item help display

confdata.c:
* config: choice fix
* kconfig: don't rename target dir when saving config

expr.c, expr.h:
* config: disable debug prints

mconf.c:
* fix menuconfig choice item help display

menu.c:
* Kconfig: use select statements

symbol.c:
* config: choice fix
* Avoid bogus warning about recursive dependencies
* c99 struct initialiser conversions

textbox.c:
* janitor: don't init statics to 0

util.c:
* fix lxdialog behaviour

//Peter
2004-07-15 06:01:05 +00:00
Eric Andersen 449f2bca96 Fixup a few documentation bugs 2004-07-14 10:01:04 +00:00
Eric Andersen e8521f14a2 Fixup some cases of "QM_MODULES: not implemented" for both
lsmod and rmmod when using 2.6.x module support
 -Erik
2004-07-13 00:09:34 +00:00
Eric Andersen fe9b9cdfa5 Paul Fox writes:
hi --

working with ifupdown, i've found a couple of buglets --
the wrong string is passed to an error message.

paul
2004-06-29 00:48:30 +00:00
Eric Andersen d926149d26 Avoid a number of places where large drives could wrap a uint, and
instead use off_t which will be automagically promoted to 64bit if
compiled with support for large drives.
 -Erik
2004-06-28 23:50:31 +00:00
Eric Andersen 0373cf1396 Do not mess with the console logging level unless
asked to do so.
 -Erik
2004-06-25 11:23:03 +00:00
Glenn L McGrath 774e6cc29c Revert my previous commit 2004-06-25 09:01:09 +00:00
Glenn L McGrath d9670461c4 Fix compile error under 2.6, check for newer versions first or all the
checks wont be considered.
2004-06-25 07:47:03 +00:00
Glenn L McGrath 5f2a23c3c6 Fix compile error when math support disabled. 2004-06-25 07:05:13 +00:00
Eric Andersen 5275b1e49f fix a stupid compile error when CONFIG_FEATURE_INSMOD_VERSION_CHECKING
is disabled
2004-06-22 20:10:53 +00:00
Eric Andersen fac312d78b Stupidity-1, Erik-0 2004-06-22 20:09:40 +00:00
Eric Andersen e983584c70 Bastian Blank notices a couple of int64_ts that should have
been longs
2004-06-22 19:07:21 +00:00
Eric Andersen bb692cdb32 Add missing 'S' to the getopt string. 2004-06-22 19:05:05 +00:00
Eric Andersen cb3b9b1fed kill off insmod support for older pre 2.1 Linux kernels,
which are not supported with the current busybox 1.0 release
 -Erik
2004-06-22 11:50:52 +00:00
Eric Andersen d943837dab Patrick Huesmann writes:
Hi,

    There was some problem with busybox modprobe. For details see
    http://www.busybox.net/lists/busybox/2004-May/011507.html

    I made a patch against busybox-1.00-pre10 to fix that one.

This is a slight variant of Patrick's patch with a slightly
cleaner implementation of mod_strcmp()
 -Erik
2004-06-22 10:43:09 +00:00
Eric Andersen 4872ed9737 Robin Farine writes:
Hi,

Package: BusyBox
Version: 1.0.0-pre10

When an incomplete read or write from/to a local file occurs (i.e.
not an EOF condition), the tftp client prematurely exits. This
problem can be reproduced by slowly piping data to the tftp client
like this:

  (for v in 1 2 3; do echo $v; sleep 1; done) | \
  tftp -p -l - -r output.txt <host>

The output file on the TFTP server will contain "1".

The attached patch provides a possible solution to this problem.

I can reproduce this on ARM sa1110 and ARM xscale boards, both
running Linux-2.6.4 & glibc-2.3.2. Thanks for the wonderful
program!

Robin
2004-06-22 10:18:30 +00:00
Eric Andersen 7f94a5caa2 Patch from Bastian Blank:
Hi folks

    The following patch adds a new log message output to syslogd. This
    output omits hostname and priority and is used in d-i to make the syslog
    output better readable without lossing information.

    Bastian

I am applying this since I have syslogd hacked up in my wife's
access point with the same format string....  Might as well make
this hack official.
 -Erik
2004-06-22 10:12:59 +00:00
Eric Andersen 36adca81f5 Patch from Bastian Blank:
On Sat, Jun 19, 2004 at 10:57:37PM +0200, Bastian Blank wrote:
> The following patch changes klogd to use openlog/syslog themself
> instead of calling syslog_msg which always calls the triple
> openlog/syslog/closelog.

Updated patch: get rid of syslog_msg entirely. Request from Erik Andersen.

Bastian
2004-06-22 10:07:17 +00:00
Eric Andersen 78a5ddeff0 Robin Farine writes:
Package: BusyBox
Version: 1.0.0-pre10

Passing the -q <integer> option to inetd causes it to dereference an
invalid pointer (optarg). The attached patch provides a fix to this
problem.

Robin
2004-06-22 08:40:54 +00:00
Eric Andersen ed9ecf7894 Patch from Bastian Blank:
The updated patch adds a config option to explicitely enable 64 bit
    arithmetic.

    Also it removes the arith prototype from libbb.h as it is not used
    outside of ash.

    Bastian

this patch has been slightly modified by Erik for cleanliness.
2004-06-22 08:29:45 +00:00
Eric Andersen 16a4c41674 note the new mailing list policy 2004-06-19 06:26:30 +00:00
Eric Andersen 3023317a91 Typo fix from Niemann Hartmut 2004-06-09 10:00:20 +00:00
Glenn L McGrath f34b0e996b Update reference for zip format 2004-06-06 10:22:43 +00:00
Glenn L McGrath 07e1ccdf75 Woops, the previous commit was an accident, its supplied in the patch,
dont commit yet as we are in feature freeze
2004-06-05 07:58:18 +00:00
Glenn L McGrath 84b6264670 Device table support for makedevs, the previous behaviour can been
selected at configure time.
2004-06-05 07:54:52 +00:00
Rob Landley 58b118ae33 Ahem. ("I'm just tweaking a documentation string, I don't need to compile
test it before checking in..."  New entry for famous last words list.)

Add the missing backslash at the end of the new sed doc string line.

(This one actually compiled with "show verbose applet usage messages"...)
2004-05-26 22:09:37 +00:00
Rob Landley 1ce5968443 Update sed help. (Add -r option to long help, add -i option to brief help,
and alphabetizie the option list.)
2004-05-26 21:59:31 +00:00
Eric Andersen 86af052d25 Kevin P. Fleming writes:
Yes, I know busybox is in feature freeze. If this two-liner is too much
that's fine, but it's handy.

This patch allows busybox mount to support "-o move" just like it
supports "-o bind", which is the equivalent of util-linux "mount --move".

Usage is:

mount -o move /mnt/point/1 /mnt/point/2

where /mnt/point/1 is an already mounted filesystem; it will be moved to
/mnt/point/2.
2004-05-26 21:26:07 +00:00
Eric Andersen 2c1f1bc7f6 Update U.S. Robotics and Actiontec entries 2004-05-26 17:17:39 +00:00
Manuel Novoa III d709743b09 If read were to return with an error, bad things would happen. Fix it.
Also, make sure read errors are reflected in the applet exit code.
2004-05-26 15:21:19 +00:00
Eric Andersen a6f6a95ba4 oops 2004-05-26 12:06:38 +00:00
Eric Andersen 42f8883c71 Per suggestion from Bastian Blank, be less evil when we force fdisk to
transparently remap 32-bit interfaces to actually use 64 bit interfaces.
 -Erik
2004-05-26 11:59:19 +00:00
Eric Andersen 823b17263a Use tab not space 2004-05-26 11:50:37 +00:00
Eric Andersen abc513a90f Make the grep option values a bit less horrible 2004-05-26 11:48:29 +00:00
Eric Andersen dec7f81370 Rick Richardson writes:
Here is a patch that adds egrep -L support (the opposite of egrep -l).

I realize this is probably too late for 1.0.  But I offer it for your
future consideration.

egrep -L is used in some networking startup scripts I inherited.

-Rick
2004-05-26 11:47:55 +00:00
Eric Andersen ee70fa5523 Patch from Yoshinori Sato:
This patch is uClinux-2.4.x for H8/300 module support.
please apply.

--
Yoshinori Sato
2004-05-26 11:38:46 +00:00
Eric Andersen 0dfe4e9956 As discussed, drop minit, which was not being supported in busybox.
People wishing to use minit can obtain it and obtain support from
http://www.fefe.de/minit/
2004-05-26 10:28:32 +00:00
Eric Andersen febd744d31 Use STDIN_FILENO rather than '0' 2004-05-26 10:26:10 +00:00
Eric Andersen 9855548a77 Rob Landley writes:
add sed -r support.

I bumped into a couple of things that want to use extended regular expressions
in sed, and it really isn't that hard to add.  Can't say I've extensively
tested it, but it's small and isn't going to break anything that doesn't use
it, so...

Rob
2004-05-26 10:03:33 +00:00
Eric Andersen d4d01d2b9b Rob Landley writes:
Run this test, against both busybox and a non-busybox version of "tee".

while true; do i=$[$i+1]; echo "hello $i"; sleep 1; done | ./busybox tee

Now run the busybox one again with the following small patch applied:
2004-05-26 09:54:36 +00:00
Eric Andersen 7f164cd052 Patch from vodz to correct 'grep -e pattern1 -e pattern2' logic 2004-05-26 09:46:41 +00:00
Eric Andersen f086ed8ddd Do not prompt about FDISK large disk support when LFS is enabled.
Resolve a dependancy problem with the various malloc debug libs
and make them mutually exclusive.
 -Erik
2004-05-25 11:30:22 +00:00
Eric Andersen 1be01072e9 Do not select LFS 2004-05-19 11:06:20 +00:00
Eric Andersen 84bdea8cb2 Erik,
>http://busybox.net/cgi-bin/cvsweb/busybox/util-linux/fdisk.c?r1=1.22&r2=1.23&diff_format=u

Its hack for "force" ;-)

If to return the previous version of a Config.in
http://busybox.net/cgi-bin/cvsweb/busybox/util-linux/Config.in?r1=1.12&r2=1.13
and to apply last patch, then I shall calm down. ;-)


(OOPS, last patch have autocorrected from my editor begins spaces to tabs and
removed spaces from empty lines too).


--w
vodz
2004-05-19 10:49:17 +00:00
Russ Dill 5c9323f4e6 use busybox sysinfo struct 2004-05-19 09:18:04 +00:00
Eric Andersen 256c4fd587 Make vodz happy and make fdisk always use large file support if
possible, even if LFS is not enabled for the rest of busybox.
 -Erik
2004-05-19 09:00:00 +00:00
Eric Andersen 28885c3f20 Fix a compile problem 2004-05-19 08:54:28 +00:00
Russ Dill 309c7b71e6 fix timewarp in client (server fix later) 2004-05-19 08:29:05 +00:00
Russ Dill 91e006c1ad remove uneccessary check (already done in pidfile.c) 2004-05-19 07:46:23 +00:00
Russ Dill 57f49d3185 fix memory leak caused by switch to vfork 2004-05-19 07:45:47 +00:00
Glenn L McGrath 21d7d61de1 Use int instead of char for return type, in theory avoiding a cast 2004-05-16 02:35:49 +00:00
Glenn L McGrath 5d2edbf16d Fix for debian bug #248106, should use int for returned getopt value. 2004-05-10 08:59:17 +00:00
Eric Andersen 6c0396ba2a Steve Grubb writes:
Hi,

I just re-reviewed the patch I just sent...and it needed to be BUFSIZ-3 in
dos2unix.c . tempFn is BUFSIZ so the last addressable spot it BUFSIZ-1. The loop
increments by 2. That's why it should be BUFSIZ-3.

Best Regards,
Steve Grubb
2004-05-05 19:39:21 +00:00
Eric Andersen aaff79a8dd Steve Grubb writes:
Hello,

I found and patched 2 more bugs. The first is a misplaced semi-colon. The second
one is a buffer overflow. I doubt the buffer overflow is triggered in real life.
But you never know what those wily hackers are up to.

Thanks,
Steve Grubb
2004-05-05 10:37:49 +00:00
Eric Andersen 6c8161d69f Steve Grubb writes:
Hello,

Last November a bug was found in iproute. CAN-2003-0856 has more information.
Basically, netlink packets can come from any user. If a program performs action
based on netlink packets, they must be examined to make sure they came from the
place they are expected (the kernel).

Attached is a patch against pre8. Please apply this before releasing 1.00 final.
All users of busy box may be vulnerable to local attacks without it.

Best Regards,
Steve Grubb
2004-05-05 07:05:32 +00:00
Glenn L McGrath 5ec58285c3 Fix size command, safe_strtoul gives and error if the \r is left in, the
RFC spec says the \r should be there.
This fix is the same as a recent wget fix
2004-05-04 10:43:34 +00:00
Glenn L McGrath ff5309ac99 Add part of a patch from Vernon Sauder that i missed a while back 2004-05-02 08:38:53 +00:00
Glenn L McGrath cbc453c7a2 Update dpkg-deb usage to match current practices 2004-05-02 03:01:08 +00:00
Glenn L McGrath d14084019f This patch makes the id command SuS3 compliant and provides a groups
applet via an alias to id.
 - Add G option
 - Pedantic option checking
 - If effective group and user differs from the real one show both.
id.
 - Alias id -Gn to groups applet
2004-05-01 11:47:24 +00:00
Eric Andersen 6f9a7783ce Do not use getpass(3) 2004-05-01 01:27:30 +00:00
Glenn L McGrath 90d2bff4c6 Re-add the TODO list, mention tr 2004-05-01 00:49:49 +00:00
Glenn L McGrath edaf39156a Bugfixes
1) a non NULL terminated buffer that can mess up output, spotted by Ian
Latter
2) in miscutils/strings.c: get rid of useless pointer dereference in
third part of for(;;), spotted by Larry Doolittle
3) bug when reading from a pipe and being invoked as strings
"cat Readme | strings" is broken
"cat Readme | busybox strings" works
spotted by Ian Latter and fixed by Tito.
2004-04-30 23:09:39 +00:00
Glenn L McGrath faa3546fd7 Fix symlink handling and small memory leak 2004-04-29 09:24:19 +00:00
Eric Andersen f71ad6c9e4 Thomas Koeller writes:
Hi,

    the following output is from BusyBox 1.0.0-pre10:

    ~ # ip link help
    ip: Command "help" is unknown, try "ip link help".

    tk

This patch fixes it by removing the advertisements for
the "ip blah help" stuff that is not implemented.
2004-04-26 19:32:49 +00:00
Glenn L McGrath 51ba90ef51 Sync my tasks with AUTHORS file 2004-04-25 06:05:14 +00:00
Glenn L McGrath c6992feee3 Update my email address, document some of my tasks in the AUTHORS file 2004-04-25 05:11:19 +00:00
Eric Andersen b94669543d This sed patch can only be described as "duh". Stat the source file, chmod
the _destination_ file.  (Ah hah!  That works _much_ better...)  I
implemented the behavior, I just forgot to test this corner of it.  My fault,
sorry...

No, gnu sed -i doesn't preverve ownership information.  I checked.
Permissions, yes, ownership info, no.

Rob
2004-04-21 00:57:14 +00:00
Eric Andersen faa7d863fc So I'm building a linux from scratch system, using a working script to do this
that the _only_ change to is that gnu sed has been replaced with busybox sed.
And ncurses' install phase hangs.  I trace it down, and it's trying to run
gawk.  (Insert obligatory doubletake, but this is FSF code we're talking
about, so...)

It turns out gawk shells out to sed, ala "sed -f /tmp/blah file.h".  The
/tmp/blah file is basically empty (it contains one character, a newline).  So
basically, gawk is using sed as "cat".  With gnu sed, it works like cat,
anyway.

With busybox sed, it tests if its command list is empty after parsing the
command line, and if the list is empty it takes the first file argument as a
sed command string, and if that leaves the file list empty it tries to read
the data to operate on from stdin.  (Hence the hang, since nothing's coming
in on stdin...)

It _should_ be testing whether there were any instances of -f or -e, not
whether it actually got any commands.  Using sed as cat may be kind of
stupid, but it's valid and gawk relies on this behavior.

Here's a patch to fix it, turning a couple of ints into chars in hopes of
saving a bit of the space this adds.  Comments?

Rob
2004-04-21 00:56:22 +00:00
Glenn L McGrath 1219879422 Dont try and preserve hard links to directories.
The linux kernel doesnt allow hard links to directories, SUS says its
implementation specific.
cramfs gives empty directories and 0 length files the same node it
makies it difficult to distinguish from hard links.
2004-04-19 12:28:02 +00:00
Glenn L McGrath c6a99b993d Add two fundamental tests for copying directories 2004-04-18 13:35:56 +00:00
Eric Andersen 7ff33f1b42 Thats odd. I guess this was cut-n-paste error, but vodz
email address was wrong!
2004-04-16 15:02:10 +00:00
Eric Andersen b054aeb4fe Update Acronis and Belkin 2004-04-15 19:16:28 +00:00
Eric Andersen 73afd89610 Steven Scholz writes:
Hi there,

the "-h" option of httpd is not described in the usage text.

Please find the attached patch.

Thanks.

Steven
2004-04-14 17:59:21 +00:00
Eric Andersen 2c2256cb8b remove a warning 2004-04-14 17:57:11 +00:00
Eric Andersen aff114c33d Larry Doolittle writes:
This is a bulk spelling fix patch against busybox-1.00-pre10.
If anyone gets a corrupted copy (and cares), let me know and
I will make alternate arrangements.

Erik - please apply.

Authors - please check that I didn't corrupt any meaning.

Package importers - see if any of these changes should be
passed to the upstream authors.

I glossed over lots of sloppy capitalizations, missing apostrophes,
mixed American/British spellings, and German-style compound words.

What is "pretect redefined for test" in cmdedit.c?

Good luck on the 1.00 release!

      - Larry
2004-04-14 17:51:38 +00:00
Eric Andersen 4c8b0dd973 bump version, prepare for -pre10 2004-04-13 19:38:17 +00:00
Eric Andersen 3561b017ce Fix incorrect ipcalc usage text 2004-04-13 19:27:20 +00:00
Eric Andersen a4375047d3 slightly clean the whacked out formatting 2004-04-13 19:25:57 +00:00
Eric Andersen 625da9d61e Fix several problems with start-stop-daemon, add -m support 2004-04-13 18:28:46 +00:00
Eric Andersen 3ddff210e6 Put the glibc nss junk back at the end 2004-04-13 16:31:41 +00:00
Eric Andersen b37f883478 Sigh. The patch from David Anders (prpplague) broke standard
securetty files since the /dev was not stripped.
2004-04-12 22:49:06 +00:00
Eric Andersen 99fcd168cc Wolfgang Denk writes:
He,

there is a bug in HUSH's handling of "if" / "elif" commands:

        $  if true
        > then
        > echo 1
        > elif
        > true
        > then
        > echo 2
        > elif
        > true
        > then
        > echo 3
        > else
        > echo 4
        > fi
        1
        2
        3
        $

The same bug exists in all versions of HUSH from BB v0.60.x up to and
including v1.00-pre9. The attached patch fixes this:

        $ if true
        > then
        > echo 1
        > elif
        > true
        > then
        > echo 2
        > elif
        > true
        > then
        > echo 3
        > else
        > echo 4
        > fi
        1
        $



Best regards,

Wolfgang Denk
2004-04-12 21:41:29 +00:00
Eric Andersen 238e354b58 Eric Spakman noticed that ifdown' will attempt to run 'ifconfig'
even if built with CONFIG_FEATURE_IFUPDOWN_IP when shutting down
a dhcp connection.
2004-04-12 20:57:17 +00:00
Eric Andersen 87812dc3b0 Silly me 2004-04-12 19:21:54 +00:00
Eric Andersen 4e19fa9b64 As reported by Quy Tonthat, init has problems with inittab's that
contain only actions sysinit/wait/once. It does not clean up zombies
in that case.
2004-04-12 19:17:13 +00:00
Eric Andersen 1e6aba967c Peter Milne writes:
Just upgraded from 0.6 to 1.00-pre8

Dot command handling handled args correctly (same as bash) in 0.60,
but failed in 1.00:

I fixed this by reverting the dotcmd function back to previous 0.60
instantiation,
please consider using the older version.

Thanks


Peter
2004-04-12 19:12:13 +00:00
Eric Andersen e3efc9230c Jamie Guinan writes:
It looks like latest uClibc defines ARCH_HAS_MMU, but a few busybox files
test UCLIBC_HAS_MMU, resulting in vfork() getting called instead of
fork(), etc.

Patch below.   Only tested for lash.

Cheers,
-Jamie
2004-04-12 17:59:24 +00:00
Eric Andersen a08345598d Add an extra link 2004-04-12 15:23:19 +00:00
Eric Andersen f802ff76d0 Patch from Rob Landley to fix sed documentation.
The -i option was not documented, and in genereal
the formatting was a bit ugly.
2004-04-12 15:12:06 +00:00
Eric Andersen 2d71756217 "Mac OS X" is how it is written on the Apple website 2004-04-12 15:05:10 +00:00
Eric Andersen 9b3ce77b07 Fix spelling. "sort of" is two words. 2004-04-12 15:03:51 +00:00
Eric Andersen ee4b7d496d make mount ignore -n when CONFIG_FEATURE_MTAB_SUPPORT is disabled 2004-04-12 15:02:53 +00:00
Glenn L McGrath 19efb3dc59 Fix compile error if CONFIG_FEATURE_IP_ADDR isnt enabled 2004-04-12 02:35:44 +00:00
Glenn L McGrath 36c7478992 Fix up conditional compile of files needed by ip applets 2004-04-12 02:22:39 +00:00
Glenn L McGrath 958ac18d4e Add a comment explaining why we have to check for an extra \n 2004-04-09 06:59:05 +00:00
Glenn L McGrath 32da885a91 Fix ftp resume
Terminate returned message at <CRLF> so strtoul returns without error
2004-04-08 10:27:11 +00:00
Eric Andersen 66a56aa028 Vladimir N. Oleynik writes:
Hi.

Last changes (rev 1.12) to recursive_actions() by Christian Grigis
have problem.
Test for demonstrate:

$ mkdir aaa bbb ccc
$ su
# chown root bbb
# chmod 700 bbb
# exit
$ busybox chmod 777 -R .
./bbb: Permision denied

But "./ccc" mode not changed. Previous variant works fine,
errors skiped and continued recursion.


--w
vodz
2004-04-07 17:59:04 +00:00
Eric Andersen 57a0d9156c Add the Tritton Technologies NAS120 2004-04-07 16:59:59 +00:00
Eric Andersen 957879ae1e Document insmod -o 2004-04-07 15:07:55 +00:00
Eric Andersen e54e8ef053 Update for release 2004-04-07 14:19:41 +00:00
Eric Andersen 23465579df Update changelog for release 2004-04-07 14:19:26 +00:00
Eric Andersen 6534fc764d Fix url 2004-04-07 14:07:27 +00:00
Eric Andersen 28738ff42d Minor update 2004-04-07 14:02:40 +00:00
Eric Andersen 47b73d09ba Mention Acronis PartitionExpert 2004-04-07 12:57:15 +00:00
Eric Andersen b48847319c More doc updates 2004-04-07 12:26:57 +00:00
Eric Andersen cd2af2475c Add an example inetd.conf file 2004-04-07 10:34:16 +00:00
Eric Andersen 075dd81c44 Remove the CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN option. It was sortof
stupid and didn't work properly anyways.
2004-04-07 09:34:27 +00:00
Eric Andersen b80c67e32c Update the default config 2004-04-07 09:17:14 +00:00
Eric Andersen 01bf3d0c92 Bump version to -pre9 2004-04-06 17:58:37 +00:00
Eric Andersen c4e5bfd65b Fix buffalo url 2004-04-06 17:53:09 +00:00
Eric Andersen 15c03c315f Yet more doc updates 2004-04-06 17:52:02 +00:00
Eric Andersen a151d19504 Yet more doc cleanups. Many thanks to Robert P. J. Day for
kindly reviewing the existing docs and providing helpful feedback.
2004-04-06 17:16:36 +00:00
Eric Andersen 0a87ac6546 Seem not many people are using 'ipaddr' since it has
never worked....  Most people use 'ip addr foo' I suppose.
2004-04-06 16:59:43 +00:00
Eric Andersen 7b5bb51f6a Fix indenting 2004-04-06 16:56:00 +00:00
Eric Andersen 178de17969 yet-more doc updates and cleanups 2004-04-06 16:36:20 +00:00
Eric Andersen 69bd0d1e89 Yet more doc updates 2004-04-06 15:39:20 +00:00
Eric Andersen f730088bbc Eliminate all trace of the sgml based docs. It was a noble effort,
but it just never worked out...
2004-04-06 15:26:25 +00:00
Eric Andersen 515881c6e1 Fix it so build dependancies actually work and do something useful 2004-04-06 15:19:52 +00:00
Eric Andersen 674b08a6b8 Fix it so usage is _always_ in sync with applets.c. Previously,
broken depends allowed these to get out of sync.
2004-04-06 14:28:35 +00:00
Eric Andersen 7e496a71cf Michael Tokarev, mjt at tls dot msk dot ru writes:
Fix parsing of all tag-value pairs (in modules.conf in particular).
Without this fix, code chokes badly on lines where either value or
both tag+value are missing, like bare
 alias
line, or alias w/o the value like
 alias some-module
(syntactically incorrect, but no need for coredumps either).
2004-04-06 12:06:03 +00:00
Eric Andersen d298bd1d51 Michael Tokarev, mjt at tls dot msk dot ru writes:
alias 'off' parsing fix.
It is not
 alias off module
it is
 alias module off
2004-04-06 12:05:04 +00:00
Eric Andersen ba05e79815 Michael Tokarev, mjt at tls dot msk dot ru writes:
Initialize all fields of struct dep_t.
Without that, e.g. `busybox modprobe -v char-major-10-144' *sometimes*
fails this way (strace):

 write(1, "insmod    nvram `\213\f\10\n", 21) = 21

Note the garbage after module name which is taken from the m_options field,
which is not initialized in the alias reading/parsing part.
(Shell properly complains to this command, telling it can't find the
closing backtick)
2004-04-06 12:04:14 +00:00
Eric Andersen 3f47c453da Christian Grigis, christian.grigis at smartdata dot ch writes:
Hello everyone,

Busybox's insmod fails to locate a module when that module is the only one
existing in the /lib/modules directory (with a unique name).

Example:

# find /lib/modules/ -type f
/lib/modules/kernel/drivers/char/bios.o
# insmod bios
insmod: bios.o: no module by that name found
# touch /lib/modules/dummy
# find /lib/modules/ -type f
/lib/modules/kernel/drivers/char/bios.o
/lib/modules/dummy
# insmod bios
Using /lib/modules/kernel/drivers/char/bios.o

As long as there is another file in the /lib/modules directory, insmod
finds it OK.

I tracked the problem down to 'check_module_name_match()' in insmod.c:

It returns TRUE when a match is found, and FALSE otherwise. In the case
where there is only one module in the /lib/modules directory (or more that
one module, but all with the same name), 'recursive_action()' will return
TRUE and we end up on line 4196 in 'insmod.c' which returns an error.
[The reason it works with more than one module with different
names is that in this case there will always be one not matching,
'recursive_action()' will return FALSE and we end up in line 4189.]

Now, from the implementation of 'recursive_action()' and from other
usages of it (tar.c, etc.), it seems to me that FALSE should be returned
to indicate that we want to stop the recursion, so TRUE and FALSE should
be inverted in 'check_module_name_match()'.

At the same time, 'recursive_action()' continues to recurse even after
the recursive call has returned FALSE; again in my understanding and
other usages of it, we can safely stop recursing at this point.


Here is my patch against 1.00-pre8:
2004-04-06 11:56:26 +00:00
Eric Andersen b07ae7ba10 Yet more 'make allyesconfig' adjustments 2004-04-06 11:51:45 +00:00
Eric Andersen 8ee6943d3e Make 'allyesconfig' be a bit less stupid 2004-04-06 11:46:56 +00:00
Eric Andersen 5c1ee519ea Minor tar test update 2004-04-06 11:34:02 +00:00
Eric Andersen ba9b22a8cc Simplify, make formatting better match the procps version 2004-04-06 11:10:50 +00:00
Eric Andersen 650fe63467 Kill off the old 'tests' stuff. Write a ton of new tests for the
'testsuite' dir.  Fix a bunch of broken tests.  Fix the testsuite
'runtest' script so it actually reports all failures and provides
meaningful feedback.
 -Erik
2004-04-06 11:10:30 +00:00
Eric Andersen 39396b95fc Fix non standard 'date -R' formatting 2004-04-06 09:38:18 +00:00
Eric Andersen c354f6ee54 Fix the test suite script so it actually works and actually flags
all errors as such.  Make verbose mode exit on FAIL and provide a
printout of the failed test run.
2004-04-06 00:41:39 +00:00
Eric Andersen b2e267f153 Some test additions 2004-04-05 18:46:24 +00:00
Eric Andersen 18751cd4a2 Patch adding support for ibs= and obs= to dd 2004-04-05 14:30:15 +00:00
Eric Andersen 009617f413 Per suggestion by Pawel Sakowski, fix the dash_arith() prototype
to return a long.  We were needlessly truncating to an int.
2004-04-05 13:24:07 +00:00
Eric Andersen b2aa776f89 Tito, farmatito at tiscali dot it writes:
Hi to all,
I discovered a little bug in hdparm.c
(really two little bugs...I've made...sigh! Mea culpa).
Some vars were  modified only locally and this could lead to wrong
results to be displayed with the -I switch and maybe with others.
Attached is a patch that fix it ( +88b).

Also attached is second patch that reduces the size a little bit:
   text    data     bss     dec     hex filename
    27984     624     900   29508    7344 hdparm.o (without bug-fix)
    28072     624     900   29596    739c hdparm.o (with bug-fix)
    28141     624     900   29665    73e1 hdparm.o (original)
but maybe this one can wait as we are in a feature freeze.

Ciao,
Tito
2004-04-05 13:08:08 +00:00
Eric Andersen 762c64fdf1 rename uncompress.c to decompress_uncompress.c
rename unzip.c to decompress_unzip.c
2004-04-05 13:03:34 +00:00
Eric Andersen 522a2f3b39 Everything should be made as simple as possible. But no simpler. 2004-04-03 12:36:03 +00:00
Rob Landley 25d82397f7 The last patch broke:
sed -i "/^boo/a fred" ipsec.conf

Which works in gnu sed.  (And is _supposed_ to strip all the whitespace before
"fred".)

It also broke:
sed -i -e "/^boo/a \\" -e "   fred" ipsec.conf

I.E. there can legally be spaces between the a and the backslash at the end of
the line.

And strangely enough, gnu sed accepts the following syntax as well:
sed -i "/^boo/a \\  fred" ipsec.conf

Which is a way of having the significant whitespace at the start of the line,
all on one line.  (But notice that the whitespace BEFORE the slash is still
stripped, as is the slash itself.  And notice that the naieve placement of
"\n" there doesn't work, it puts an n at the start of the appended line.  The
double slashing is for shell escapes because you could escape the quote, you
see.  It's turned into a single backslash.  But \n there is _not_ turned into
a newline by the shell.  So there.)

This makes all three syntaxes work in my tests.  I should probably start
writing better documentation at some point.  I posted my current sedtests.py
file to the list, which needs a lot more tests added as well...
2004-04-01 09:23:30 +00:00
Eric Andersen 0b5bf45d32 Patch from Hideki IWAMOTO adding support for 'cmp -n' 2004-03-31 11:53:37 +00:00
Eric Andersen 46390ed829 Junio Hamano, junio at twinsun dot com writes:
The sed command in busybox 1.0.0-pre8 loses leading whitespace
in 'a' command ('i' and 'c' commands are also affected).  A
patch to fix this is attached at the end of this message.

The following is a transcript that reproduces the problem.  The
first run uses busybox 1.0.0-pre3 as "/bin/sed" command, which
gets the expected result.  Later in the test, /bin/sed symlink
is changed to point at busybox 1.0.0-pre8 and the test script is
run again, which shows the failure.

=== reproduction recipe ===
* Part 1.  Use busybox 1.0.0-pre3 as sed; this works.

root# cd /tmp
root# cat 1.sh
#!/bin/sh

cd /tmp
rm -f ipsec.conf ipsec.conf+
cat >ipsec.conf <<\EOF
version 2.0

config setup
        klipsdebug=none
        plutodebug=none
        plutostderrlog=/dev/null

conn %default
        keyingtries=1
        ...
EOF
sed -e '/^config setup/a\
	nat_traversal=yes' ipsec.conf >ipsec.conf+
mv -f ipsec.conf+ ipsec.conf
root# sh -x 1.sh
+ cd /tmp
+ rm -f ipsec.conf ipsec.conf+
+ cat
+ sed -e /^config setup/a\
        nat_traversal=yes ipsec.conf
+ mv -f ipsec.conf+ ipsec.conf
root# cat ipsec.conf
version 2.0

config setup
        nat_traversal=yes
        klipsdebug=none
        plutodebug=none
        plutostderrlog=/dev/null

conn %default
        keyingtries=1
        ...
root# sed --version
sed: invalid option -- -
BusyBox v1.00-pre3 (2004.02.26-18:47+0000) multi-call binary

Usage: sed [-nef] pattern [files...]

* Part 2.  Continuing from the above, use busybox 1.0.0-pre8
  as sed; this fails.

root# ln -s busybox-pre8 /bin/sed-8
root# mv /bin/sed-8 /bin/sed
root# sed --version
This is not GNU sed version 4.0
root# sed --
BusyBox v1.00-pre8 (2004.03.30-02:44+0000) multi-call binary

Usage: sed [-nef] pattern [files...]
root# sh -x 1.sh
+ cd /tmp
+ rm -f ipsec.conf ipsec.conf+
+ cat
+ sed -e /^config setup/a\
        nat_traversal=yes ipsec.conf
+ mv -f ipsec.conf+ ipsec.conf
root# cat ipsec.conf
version 2.0

config setup
nat_traversal=yes
        klipsdebug=none
        plutodebug=none
        plutostderrlog=/dev/null

conn %default
        keyingtries=1
        ...
root#
=== reproduction recipe ends here ===

This problem was introduced in 1.0.0-pre4.  The problem is that
the command argument parsing code strips leading whitespaces too
aggressively.  When running the above example, the piece of code
in question gets "\n\tnat_traversal=yes" as its argument in
cmdstr variable (shown part in the following patch).  What it
needs to do at this point is to strip the first newline and
nothing else, but it instead strips all the leading whitespaces
at the beginning of the string, thus losing the tab character.
The following patch fixes this.
2004-03-31 11:42:40 +00:00
Eric Andersen c11a6a887b Patch from Thomas Winkler:
ifconfig did not look up hostnames, so
	ifconfig lo localhost
would not work, you have to do
	ifconfig lo 127.0.0.1
2004-03-31 11:30:08 +00:00
Eric Andersen 11e5516d67 Patch from Thomas Winkler showing the the system time for each process
when running 'top'
2004-03-31 11:21:24 +00:00
Eric Andersen 90fb65f7a6 Patch from Thomas Winkler -- vi -R did not work 2004-03-31 11:12:51 +00:00
Eric Andersen bbbbcfef24 Sigh. what a mess. 2004-03-30 09:33:18 +00:00
Eric Andersen 0a92f35702 As waldi noticed, checks for the size of an off_t and casting
etc was also redundant and possibly buggy...
2004-03-30 09:21:54 +00:00
Eric Andersen 259cf97803 Go ahead and kill off the FDISK_SUPPORT_LARGE_DISKS option,
as it is redundant....
2004-03-30 09:13:05 +00:00
Eric Andersen 1236631700 The fdisk llseek junk was redundant, since both uClibc and glibc
automatically promote lseek and friends to their 64 bit counterparts
when CONFIG_LFS is enabled, since it enables __USE_FILE_OFFSET64
2004-03-30 09:08:58 +00:00
Eric Andersen 75eb90f288 As noted by Martin Schwenke, the example for find was wrong 2004-03-29 08:20:08 +00:00
Eric Andersen 38748fddf3 Yet more doc cleanups 2004-03-27 11:35:46 +00:00
Eric Andersen 8ee2b27f0c Add missing include files 2004-03-27 11:26:32 +00:00
Eric Andersen ea9bcda373 passwd and sulogin also need libcrypt, via libbb/pw_encrypt() 2004-03-27 10:08:53 +00:00
Eric Andersen 70060d25d2 s/fileno\(stdin\)/STDIN_FILENO/g
s/fileno\(stdout\)/STDOUT_FILENO/g
2004-03-27 10:02:48 +00:00
Eric Andersen edd580a088 Vladimir N. Oleynik (vodz) writes:
Ok. Last patch reduce 73 bytes for compensate (and over) your changes ;-)

Comments:
Added cin_fileno variable, auto setted to 0 from BSS and have "eq" stdin
descriptor if isatty(stout)==0, removed global variable FILE* cin.
Removed default setting to terminal_width/terminal_height, this used
only from main() and setted after call get_terminal_width_height()
always correct.
Variable please_display_more_prompt changed to bits logic, have size
reducing.
--w
vodz
2004-03-27 09:49:57 +00:00
Eric Andersen fbcf06d296 Update docs 2004-03-27 09:40:15 +00:00
Eric Andersen 97310d0253 Brian Pomerantz writes:
I've noticed a bug in the "autowidth" feature more, and is probably in
others.  The call to the function get_terminal_width_height() passes
in a file descriptor but that file descriptor is never used, instead
the ioctl() is called with 0.  In more_main() the call to
get_terminal_width_height() passes 0 as the file descriptor instead of
fileno(cin).  This isn't a problem when you more a file (e.g. "more
/etc/passwd") but when you pipe a file to it (e.g. "cat /etc/passwd |
more") the size of the terminal cannot be determined because file
descriptor 0 is not a terminal.  The fix is simple, I've attached a
patch for more.c and get_terminal_width_height.c.


BAPper
2004-03-23 23:15:36 +00:00
Robert Griebl 6bb80870b8 Some corrections from vodz:
- Make -u/-l mutually exclusive
- Minor size reduction
2004-03-22 21:27:39 +00:00
Robert Griebl c8685ead57 The utc variable was not modified according to the -u/-l command line
parameters.
2004-03-21 18:01:46 +00:00
Eric Andersen bfb51574ae Tito noticed a printf that should have been a bb_error_msg. 2004-03-20 00:56:46 +00:00
Manuel Novoa III 539fa95e0d Oops.. got a bit to aggressive with size optimization and global replace. :-( 2004-03-19 23:27:08 +00:00
Eric Andersen 1daa0c6097 As noted in a patch from Kendrick Hamilton, rmmod was only
half way converted, and still used the old delete_module(),
call rather than a syscall, in one spot.
2004-03-19 21:00:03 +00:00
Eric Andersen 9e458f5b7a Add missing ELFCLASSM for m68k 2004-03-19 12:17:04 +00:00
Eric Andersen 16451a07b4 Only use R_68K_GOTOFF if it is defined 2004-03-19 12:16:18 +00:00
Eric Andersen 06d4ec2a4b Fix broken arg parsing (was not passing pointer to items so p, argc, and argv
were only modified locally).  Fix error reporting to properly describe why
ioctls fail.
2004-03-19 10:53:52 +00:00
Eric Andersen 16767e2377 Patch from vodz to fix the dynamic vars patch, which I should not
have checked in.  Vladimir writes:

Your patch have many problem.
1. You always added + time(). This cannot reset RANDOM=value for debuging
with
replay sequential.
2. Hmm. I examine bash 2.04 source. This pseudorandom generator use low bits
of
counter value. You use high bits. This make bad pseudorandom values after
have
0-value. For example, if + time() do remove, your generator always return 0
after
first generate 0.
3. Memory leak per call. Use ash-unlike unecessary bb_strdup function.
4. Unsupport show last $RANDOM value for "set" and "export" command.
5. Bloat code. Busybox-unlike patch - added unstandart feature as default
hardcode.

Last patch attached.

Erik, why you apply Paul patch with have 5-th point problem? :(

Last patch have ash change xwrite() to fresh libbb/bb_full_write interfase
(haved loop after EINTR).


--w
vodz
2004-03-16 05:14:10 +00:00
Eric Andersen ca65ca7d45 Oops. Using the wrong variable was a rather stupid
thing for me to do.
2004-03-15 08:46:37 +00:00
Eric Andersen c7bda1ce65 Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
Manuel Novoa III 8854004b41 I redid route. 2004-03-13 18:17:37 +00:00
Eric Andersen 63a1a7aaa5 Update docs for start_stop_daemon to match reality. Update
the reality a bit to better match debian behavior.
2004-03-13 08:33:10 +00:00
Eric Andersen 55c704c119 Fix some doc generation problems 2004-03-13 08:32:14 +00:00
Eric Andersen ed43806c3b Hideki IWAMOTO writes:
Current `tr' implementation has a problem, if `plain char' is signed.

[current cvs version]

>echo a | _install/usr/bin/tr '\0' '\377'
Segmentation fault (core dumped)

[patched version]

>echo a | _install/usr/bin/tr '\0' '\377'
a
2004-03-12 22:10:40 +00:00
Eric Andersen d20d37559f Fix some goofy formatting 2004-03-12 22:08:42 +00:00
Eric Andersen 3cac0c7d7f Add prototypes for safe_strtol and friends 2004-03-12 22:08:13 +00:00
Eric Andersen 08f59e32c1 Fix awk entry, which was not showing up in BusyBox.txt for some reason 2004-03-12 22:07:10 +00:00
Eric Andersen ef02f82bcf Paul Mundt, lethal at linux-sh dot org writes:
Here's a follow-up replacement to the patch I sent earlier, this adjusts some
of the semantics of the dynamic variable setting. Namely, dynamic vars can hook
a set handler (which RANDOM uses to adjust the seed). They'll only lose their
dynamic status if they're unset.

I've used the same approach that bash does to come up with the random number,
mostly just for consistency.

For example:

$ echo $RANDOM
13759
$ echo $RANDOM
20057
$ echo $RANDOM
1502
$ export RANDOM=42
$ echo $RANDOM
24179
$ echo $RANDOM
2046
$ unset RANDOM
$ echo $RANDOM

$ export RANDOM=42
$ echo $RANDOM
42
$
2004-03-11 13:34:24 +00:00
Glenn L McGrath b7b3bda3ba Patch from Thomas Frohlich to fix an option ordering bug of mine. 2004-03-10 10:47:37 +00:00
Glenn L McGrath c66ebe4200 When displaying the size in 1kB blocks round up if an odd number of
blocks
2004-03-10 09:58:51 +00:00
Glenn L McGrath 44c0e17dbe Patch by Seth W. Klein, the -l switch was reversed 2004-03-10 09:10:53 +00:00
Manuel Novoa III 7d0c51919c In spite of the feature freeze, check in a complete rework of route which
fixes some bugs, adds some error checking, and removes _lots_ of bloat.
Text size on i386...
              old     new
   ipv6      5425    3523
   no ipv6   3143    2193
2004-03-10 07:42:38 +00:00
Eric Andersen 2715fa147a Note that /proc must be mounted for filesystem type autodetection
to work.  Without /proc mounted, one must explicitly specify the
type of every filesystem being mounted.
2004-03-09 21:32:57 +00:00
Eric Andersen 21d308601e David Anders (prpplague) submitted this patch to allow login to work
when the device nodes are symlinks on a read only file system.
2004-03-09 21:27:32 +00:00
Manuel Novoa III 1117c5281b Fix broken sort order flags. 2004-03-08 10:54:29 +00:00
Manuel Novoa III 948d4907a0 My bug. :-( 2004-03-08 05:44:30 +00:00
Eric Andersen 2479445562 Fix/eliminate use of atol 2004-03-06 22:11:45 +00:00
Glenn L McGrath c4db0833a6 Patch from Matt Kraai to fix debian bug number 231994.
There was an extra blank line preceding the first directory.
2004-03-06 09:12:55 +00:00
Glenn L McGrath a89bbfb257 Woops, how did that get in there 2004-03-06 07:38:27 +00:00
Manuel Novoa III adab517f76 Don't build these support functions for uClibc, as it always supplies
versions.
2004-03-06 00:32:54 +00:00
Glenn L McGrath db6ee81c99 Patch from John Powers, adds multicast (rfc2090) and timeout (rfc2349)
options
2004-03-05 15:52:57 +00:00
Glenn L McGrath ec58bce363 Patch from duane no-name, optionally request additional items 2004-03-05 14:35:00 +00:00
Glenn L McGrath 3f79300e37 Patch by Andrew Victor,
In arpping.h, fix structure alignment of "struct arpMsg".
GCC can insert padding in the structure which causes udhcpd to send an
invalid ARP packet on the network.  It will then not receive a valid
reply, which can cause it to assign an IP address that's already in use
on the network.
(With kernels before 2.4.20, the "struct ethhdr" in linux/if_ether.h
wasn't marked as packed.  This is also an issue if your toolchain was
built with a pre-2.4.20 kernel).
2004-03-05 14:25:49 +00:00
Glenn L McGrath 0226596dcb Fix a typo, patch by Andrew Victor 2004-03-05 14:23:16 +00:00
Glenn L McGrath 1bdc5d87f4 Patch from Tony J. White to allow paths to be configured 2004-03-05 13:23:40 +00:00
Glenn L McGrath bd5d84ddca Patch by Denis Vlasenko to add forground support. 2004-03-05 13:11:05 +00:00
Glenn L McGrath fbe984e1c9 Fix debugging output, patch by Hideki IWAMOTO 2004-03-05 13:04:39 +00:00
Glenn L McGrath c45146cf24 Patch by Felipe Kellermann to fix a compiler compatability problem 2004-03-05 12:55:30 +00:00
Glenn L McGrath 3d752f7ab2 Patch from Steven Scholz to fix compiler warnings 2004-03-05 09:38:16 +00:00
Glenn L McGrath fca056f691 New applet, eject, by Peter Willis 2004-03-05 07:26:28 +00:00
Glenn L McGrath 95ed8d9f35 Close bracket in description from Peter Willis's eject applet 2004-03-05 06:47:25 +00:00
Glenn L McGrath d2b860fecb Patch from Vernon Sauder.
The off_t type is not a consistent size; it depends on the kernel options
(something about large file support). Therefore, the format string for
printing an address is not always the same.
2004-03-05 05:47:19 +00:00
Glenn L McGrath bbf2ce36d8 Fix a compile error identiefied by Steven Scholz.
Declare variables first for compatability.
2004-03-03 21:12:16 +00:00
Glenn L McGrath e84152e9e1 Check file has execute permission for the current user, minor formating 2004-03-01 08:32:49 +00:00
Glenn L McGrath d5d5e54290 Quick fix for tftp truncation bug 2004-02-26 07:47:20 +00:00
Glenn L McGrath d1daf8b6f4 Patch from Denis Dowling to fix a ocuple of usage entries 2004-02-25 10:35:55 +00:00
Glenn L McGrath 10b781345f Fix option handling, -i or -t must be given, if both ignore the -t.
Use bb_getopt_ulflags.
2004-02-25 09:30:06 +00:00
Eric Andersen d8746cdc40 Joe.C, joe at numa dot com dot tw writes:
Hi,

When downloading files over slow network (e.g. wireless/
internet) using IE, sometimes it will stop downloading and
show error message 'connection closed' when the download
is almost complete. This is because IE can't handle server
close connection properly.

Apache http_main.c fix this problem by close the connection
after client close the connection. This patch do exactly the
same thing. Please consider include this patch.

Joe.C
2004-02-24 07:28:38 +00:00
Eric Andersen 60be069d58 Prepare for release 2004-02-23 09:14:07 +00:00
Glenn L McGrath 181f0773e2 bb_full_fd_action was incorrectly returning an error message causing
major breaking.
2004-02-23 08:11:07 +00:00
Eric Andersen a9d8f9c7bf Bump up version in preparation for -pre8 2004-02-22 12:27:04 +00:00
Eric Andersen 539ffc9129 Fernando Silveira writes:
Hi,

  Well, I made this patch a long time ago (08/2002) because it was a
  need of a project, but had no time to send it to you. It adds support
  to `autologin' option of the telnet protocol. It has been used since
  made with busybox 0.60.3 at production and I had no problems with it.
  I have ported it to the HEAD revision of the CVS server (20040211) and
  I hope you enjoy and apply it to the official sources. :)

Thanks a lot!
2004-02-22 12:25:47 +00:00
Glenn L McGrath df2c56529c Fix from Paul Kortekaas for syslog -C option, size should be in kB. 2004-02-22 12:17:33 +00:00
Glenn L McGrath 4bded58207 Patch from Dmitry Zakharov, this line was missedfrom the last patch 2004-02-22 11:55:09 +00:00
Eric Andersen 817565a0ff For the time being, revert the changes for detecting copying
a directory into itself.  It is harder to do this correctly
than it appears.  Not trying at all seems a better compromise
for the time being, untill we can implement this correctly.
2004-02-22 11:46:49 +00:00
Glenn L McGrath 15a4f1ee50 Patch from Chris Larson (kergoth), to allow multiple directores to be
unmounted at once.
2004-02-22 11:35:13 +00:00
Glenn L McGrath df7d84cf25 Patch from Vodz, cleanup memory usage, send strdup error messages to
syslog.
2004-02-22 11:25:13 +00:00
Glenn L McGrath 7fc504c6f7 Vodz. last_patch_128
- declare applet_using as static from applets.c
- small correction to cmdedit,
   previous version cleared history after Ctrl-C
- small spelling correction (by Friedrich Lobenstock)
2004-02-22 11:13:28 +00:00
Glenn L McGrath 90ed9a0eb6 Patch from James Zhu, telnetd window resizing support. 2004-02-22 09:45:57 +00:00
Glenn L McGrath 689e4b9531 Use bb_getopt_ulflags, marginal saving, better argument checking. 2004-02-22 09:11:33 +00:00
Glenn L McGrath f461e0123d Use /var/lib/hwclock for adjtime, its really a state file rather than a
config file, so it should be in /etc, FHS mentions it also.
2004-02-22 08:33:37 +00:00
Glenn L McGrath fa134cd954 Patch from Florian Schirmer. compile fix for debug builds 2004-02-22 07:38:36 +00:00
Glenn L McGrath d33278dea5 Patch from Hideki IWAMOTO, output debugging messages to stderr 2004-02-22 07:20:25 +00:00
Glenn L McGrath 34e1469f24 remove duplicate header declarations 2004-02-22 04:58:36 +00:00
Glenn L McGrath 9079ad0cab Fixup braces (patch from Thomas Geulig), run through indent and manually
adjust.
2004-02-22 04:44:21 +00:00
Glenn L McGrath e7f2b2bf31 Thomas Geulig, remove duplicate header 2004-02-22 04:17:26 +00:00
Glenn L McGrath 58fd67fa98 Update usage for ftpget and ftpput 2004-02-22 04:12:58 +00:00
Glenn L McGrath c699778fbb Ptch by Hideki IWAMOTO, fix a bug preventing tftp from getting or
putting more than 0xffff blocks.
2004-02-22 03:33:53 +00:00
Glenn L McGrath 6db8c22d07 Return 1 upon failure 2004-02-22 02:58:57 +00:00
Glenn L McGrath f1c4b11b24 No need to check proxy env variable twice, ignore proxy env variable if
its set to 0
2004-02-22 00:27:34 +00:00
Glenn L McGrath 15c3512614 Sometimes i get carried away with the use of function pointers, im sure
it seemed like a good idea at the time.
2004-02-21 09:20:56 +00:00
Glenn L McGrath 96099d51b6 Use return instead of exit, use == instead of & ==, left justify labels,
adjustment of whitespace.
2004-02-21 07:49:54 +00:00
Eric Andersen ced9705c42 Document missing cp options 2004-02-20 09:55:37 +00:00
Glenn L McGrath 916ba53f1a Fix up hard links 2004-02-20 02:34:42 +00:00
Glenn L McGrath c9f1fce9bb A strict interpretation of the ustar format requires the type flag to be
interpreted, we cannot depend on the file type being set in the mode
field.
2004-02-20 02:25:18 +00:00
Glenn L McGrath b0e163a93b Add extra comments, freakout if a pax archive is encoutered. 2004-02-19 08:48:30 +00:00
Eric Andersen e7d244cc96 Chris Larson (kergoth) writes:
As Manuel points out, this is a flawed fix, and doesnt fix the
following:

mkdir -p cpa cpb cpc
cp -a cpa cpa/cpb/cpc

Attached what appears to be a more sane fix.  Apply on top of previous.
Please confirm sanity.
2004-02-19 01:52:29 +00:00
Eric Andersen e0cbe48637 Chris Larson (kergoth) writes:
I was adding -s/--symbolic-link support to busybox cp when I noticed a
bug with -r/-a.  Test case:

mkdir -p test/out
cd test
busybox cp -a * out/

Will never return until we run out of open files or similar.
Coreutils cp on the other hand will error with "cannot copy a directory,
`out', into itself, `out'".  Patch attached.
2004-02-19 00:44:08 +00:00
Glenn L McGrath 03a0643fbc Dont use same variable and struct name 2004-02-18 13:19:58 +00:00
Glenn L McGrath 82d42dbb57 Formatting 2004-02-18 13:12:53 +00:00
Glenn L McGrath aac2a19e50 remove debugging 2004-02-18 12:58:00 +00:00
Manuel Novoa III 21fbe0e375 Patch from OpenWrt. 2004-02-18 10:14:17 +00:00
Rob Landley 53302f80da Add -i option to sed, to edit files in-place. 2004-02-18 09:54:15 +00:00
Manuel Novoa III be8a6ae6eb Fix vstype[] to match VS* defines. Patch from OpenWrt by mbm. 2004-02-18 09:40:41 +00:00
Eric Andersen 37aac6489e Remove the unused CONFIG_FEATURE_HTTPD_SET_CGI_VARS_TO_ENV option. 2004-02-17 20:08:11 +00:00
Eric Andersen 60bb3f31af Mark Lord writes:
The config file processing for inetd in busybox-1.00-pre7 and newer
is broken -- the saved command argv[] values overwrite each other.

Patch to fix it is attached.

Cheers
--
Mark Lord
Real-Time Remedies Inc.
2004-02-17 20:04:34 +00:00
Glenn L McGrath 01cdb66987 Add the -r option, patch from Rob with some help from myself. 2004-02-17 12:22:21 +00:00
Glenn L McGrath a8f756fc7f Remove debugging 2004-02-17 12:04:13 +00:00
Glenn L McGrath 6aa52234e8 Dont strip trailing '/' until _after_ i test to set if its there ! 2004-02-17 11:55:06 +00:00
Manuel Novoa III 7b565a0c8a Patch from Florian Schirmer <jolt@tuxbox.org>. When I rewrote the parser,
I overlooked the case of someone wanting to use a valid but empty suid
config file.
2004-02-17 10:16:21 +00:00
Glenn L McGrath c2266bd519 Woops, im getting ahead of myself, we dont have the -r (refernece)
option yet
2004-02-17 07:58:04 +00:00
Glenn L McGrath 5f11541bd4 define option names to be clearer, simplify nested if statements, remove
un-needed if statement, minor indenting change
2004-02-17 07:51:31 +00:00
Eric Andersen 7e8f41cb5b Avoid naming conflict with symbol in newer glibc headers 2004-02-14 21:33:39 +00:00
Eric Andersen ec359e9ebb Accomodate the fact that newer libc versions may in fact not
contain query_module and friends and more
2004-02-13 08:09:43 +00:00
Eric Andersen 95b26250a7 oops. Leave the default feature set enbled for now... 2004-02-10 01:30:21 +00:00
Eric Andersen 37032b4d6c Initial effort at disabling job control as well 2004-02-10 01:28:36 +00:00
Eric Andersen ff9ad47d79 Support disabling pipe and redirect support 2004-02-10 01:07:45 +00:00
Eric Andersen a0e4c3f119 Update URL 2004-02-09 10:57:04 +00:00
Eric Andersen 2af7f4c404 Buffalo appears to have resolved their GPL problems 2004-02-09 10:01:01 +00:00
Eric Andersen 5cc90eade5 Richard Kojedzinszky writes:
Hi All,

I aplogoize for the mistake, but i have just recognized that somehow the
last patch I sent in was wrong, and a '0' was instead of a '-1'. Because
of this, vi does behave the wrong way. So again, it should be the last
patch for vi. This is for pre7.
2004-02-06 10:36:08 +00:00
Eric Andersen fa06a77040 Patch from vodz, based on bug report from Richard Kojedzinszky:
Richard,

>I have a problem, which I can reproduce now. I am using pre7 version of
>busybox, and the tab completion works fine. I mean, with an empty command
>line I press the TAB twice, and ash shows me the available commands. But
>when i process the profile file below, as
> $ . /etc/profile
>then it stops working, and the double-tab lists the directories available
>from the cwd, and not the commands. Has someone else meet this problem
>before, or am i doing something wrong?
>
>This is  my '/etc/profile':
>- ---
># System profile
>
>PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
>export PATH
>trap ":" INT QUIT TERM
>
>export PS1="\h \w # "

Thanks. Patch attached.


--w
vodz
2004-02-06 10:33:19 +00:00
Eric Andersen ef8cd3be17 Make the loop support stuff be much less evil, and make it cope
with 2.6.x asm/posix_types.h, which has done singularly evil thing
by yanking __kernel_dev_t and renaming it.  The loop interface was
really poorly designed in the first place.  The new 64 bit loop
interface looks to be somewhat less horrible, too bad it is only
present in 2.6.x kernels.
 -Erik
2004-02-06 07:16:36 +00:00
Eric Andersen 7495b0d4b1 Eliminate use of a kernel scsi header file.
Prevent potentially misaligned accesses while indexing a pointer
to the partition table, which would be a bad thing on i.e. arm.
2004-02-06 05:26:58 +00:00
Manuel Novoa III 68474f3b36 Make sure stdlib.h is always included before dmalloc.h to avoid problems
parsing problems.
2004-02-05 14:45:58 +00:00
Eric Andersen d07cf59a98 Vladimir N. Oleynik writes:
Hi, Glenn.

Current CVS "ls" applet have small problem: some options
ignoring. Last patch attached ;-)


--w
vodz
2004-02-05 13:52:03 +00:00
Eric Andersen 54426d5297 Vladimir N. Oleynik writes:
Ok. I found my mistake :(
The trivial patch attached.

--w
vodz
2004-02-05 13:49:29 +00:00
Eric Andersen 31d898feff Elaborate on CONFIG_SELINUX, and explain that most people should
not enbable this option.
2004-02-05 00:18:26 +00:00
Eric Andersen 96e9785493 Grammar fix 2004-02-04 12:07:40 +00:00
Eric Andersen 4da3dbb7df Minor grammar fixup 2004-02-04 11:59:48 +00:00
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
Eric Andersen 7a6a77362b Update webpage and changelog for release 2003-07-30 09:33:54 +00:00
Eric Andersen 25f95dee2d Lars Ekman writes:
When using "losetup" the device is always setup as Read-Only.

(I have only tested with the -o flag, but looking at the code the
 problem seems general)

The problem is the "opt" variable in "losetup.c" that is reused in
the "set_loop()" call. Clear it before the call and everything is OK;

  opt = 0;         /* <-------- added line */
  if (delete)
    return del_loop (argv[optind]) ? EXIT_SUCCESS : EXIT_FAILURE;
  else
    return set_loop (argv[optind], argv[optind + 1], offset, &opt)
      ? EXIT_FAILURE : EXIT_SUCCESS;
}

Best Regards,
Lars Ekman
2003-07-30 08:55:59 +00:00
Eric Andersen 040f440262 last_patch100 from vidz updating fdisk to 2.12pre 2003-07-30 08:40:37 +00:00
Eric Andersen 08804ceaf1 Do not require that the signal number be specified 2003-07-30 08:29:56 +00:00
Eric Andersen 76097edc0e Eric Spakman writes:
The recent changes in ifupdown where all calls to 'ip link set' and
'ip addr set' are swapped give some problems with v4tunnels.
For plain ipv4 and ipv6 interfaces it works correct, other methods
not tried. The patch below change the behaviour back for v4tunnels
only.

Without the patch the following errors are shown:
RTNETLINK answers: Network is down
RTNETLINK answers: No route to host
and the tunnel is not fully brought up

With this patch all works as expected.
2003-07-30 08:22:53 +00:00
Eric Andersen 3124a9ecee Vladimir N. Oleynik writes:
This moment have algoritmicaly problem, not overflow:
    strcat(wrapped, wrapped) - may be looped.

    Hand patch:

    - else if (strstr(strcat(wrapped, wrapped), newmono))
    + else {
    +    safe_strncpy(wrapped + lenwrap, wrapped, lenwrap + 1);
    +    if (strstr(wrapped, newmono))
    +}

    --w
    vodz
2003-07-30 07:57:06 +00:00
Eric Andersen b99aec0ba5 Christian Meyer provided this patch to fix more bugs with the tftp client 2003-07-30 07:16:39 +00:00
Eric Andersen d8ceba959a Ronny L Nilsson writes:
The login process should always timeout if user don't login sucessfully within
reasonable time. Otherwise we're sensetive to a DOS attack by simply doing a
bunch of simultaneous telnet connections (deploys all availible TTY's).

This patch make login.c terminate the connection after  "TIMEOUT" seconds.
2003-07-30 06:56:07 +00:00
Eric Andersen eef2317b9f Ronny L Nilsson writes:
If BusyBox was compiled with -DCONFIG_FEATURE_CLEAN_UP dmesg command
    segfaults if invoked with the "-n" option. (Due to a free() of an
    uninitialized pointer).
2003-07-30 06:52:33 +00:00
Eric Andersen eac20451d2 Set libbb dead last in the link order 2003-07-29 07:45:05 +00:00
Eric Andersen c663ab0c6b Match up interfaces 2003-07-29 07:37:39 +00:00
Eric Andersen ca16204c31 Fixup typo noticed by Nick Fedchik 2003-07-29 07:15:17 +00:00
Eric Andersen 2a186890ee Bruno Randolf writes:
this patch fixes run_parts when it's called by ifupdown. 1) argv has to be a
NULL terminated char* array, not just a string. 2) run_parts now explicitly
sets the environment. this environment is populated from the
/etc/network/interfaces config file and is needed by the scripts in
/etc/network/if-pre-up.d/. when run-parts is called from the command line the
environment is taken from the current process.


Vladimir Oleynik then wrote:

You can simplify this if use:

+       bb_xasprintf(&buf[0], "/etc/network/if-%s.d", opt);
+       buf[1] = NULL;
+
+       run_parts(&buf, 2, environ);
+       free(buf[0]);

--w
vodz
2003-07-29 07:05:40 +00:00
Eric Andersen 81fe123040 Vladimir N. Oleynik writes:
Last patch have synced form Manuel Nova III xxreadtoken() function,
corrected (C) form dash debian/copyright, removed my small mistake
with IFS_BROKEN (thanks by Herbert), and synced cmdedit.c from
current CVS (removed libc5 support, your email correction, my (C) year
corertion).
2003-07-29 06:38:40 +00:00
Eric Andersen 9cdef5d928 Yang Xiaopeng writes:
>I'm sure that no user process use old root now,  but when run "umount
>/old_root", it says:
>   umount: /old_root: Device or resource busy
>
>I have tried to remount /proc within the new root *after* chroot, but
>get the same result.
>
>
I found the problem, I said that no user process use old root when run
my scripts, but
I'm wrong, actually there is a '3' fd open the file
"/old_root/dev/console". By adding
debug message in init/init.c, I found the problem: when init restart(in
exec_signal()),
before open the new terminal device, there is still a file opened(I
don't know which file it is), so the
terminal device(stdin) get fd '1', and the first dup(0)(stdout) return
'2', the second(stderr) return '3'.

I attach a simple patch to solve this problem.
2003-07-29 06:33:12 +00:00
Eric Andersen 930c59675a bump version to 1.0.0-pre2 2003-07-28 10:34:38 +00:00
Eric Andersen cad4c5b0f3 A small update to the new docs. Plenty more is needed... 2003-07-28 10:13:03 +00:00
Eric Andersen 4052051864 Patch from vodz to update httpd usage 2003-07-28 09:59:05 +00:00
Eric Andersen c470f4477a This is synced from dash-0.4.17 and full ready for insert to new busybox
version:
ftp://ftp.simtreas.ru/pub/my/bb/new

News:

- code is smalest!
- support ${var...} expr
- used new very strongly steal controlling terminal
2003-07-28 09:56:35 +00:00
Eric Andersen 9b47661165 Avoid shadowing built-in function `log' 2003-07-28 09:37:56 +00:00
Eric Andersen 68d4a85f12 Fixup bugs in last patch 2003-07-28 09:31:28 +00:00
Eric Andersen f3a02bbf41 Update docs a bit 2003-07-28 08:31:56 +00:00
Eric Andersen 05df91a3ac last_patch98 from vodz:
Denis,

># ./busybox env - echo zzz
>zzz
># ./busybox echo -n zzz
>zzz
># ./busybox env - echo -n zzz
>env: invalid option -- n
>
>       obviously, env tried to understand -n as env's option
>       instead of blindly passing it to echo...
>
>BusyBox v1.00-pre1 (2003.07.16-07:53+0000) multi-call binary
>
>Usage: env [-iu] [-] [name=value]... [command]

Ah, you found very old problem.
Last patch also have:

- multiple "-u unsetenv" support
- GNU long option support
- save errno after exec failed before bb_perror_msg()


--w
vodz
2003-07-28 07:42:19 +00:00
Eric Andersen 35e643b39f last_patch95 from vodz:
Hi.

Last patch have new libbb function
vfork_rexec() for can use daemon() to uClinux system.
This patched daemons: syslog, klogd, inetd, crond.
This not tested! I havn`t this systems.
Also. Previous patch for feature request MD5 crypt password for
httpd don`t sended to this mailist on 07/15/03
(mailist have Pytom module problem?).
The previous patch included, and have testing.


--w
vodz
2003-07-28 07:40:39 +00:00
Eric Andersen 4f4631732c Add a "search google" button 2003-07-28 06:42:59 +00:00
Eric Andersen f96675bc50 James Petterson writes:
I've found a possible bug in libbb/interface.c, in function
if_readlist_proc(). This function calls get_name(), and passes
as an argument 'name', a buffer of 16 bytes (IFNAMSIZ).  The
function get_name(), however, may use more than 16 bytes,
when it is searching for aliases. Even if you don't have an
alias interface, you can run into trouble if the interface
has received more than 99999999 bytes, in which case the
space between the interface name and the rx stats
disappears, as in the /proc/net/dev example below:
 wan0.200:264573315  462080    ...
In this case get_name() correctly identifies the interface name
as "wan0.200", but to do that it uses 18 bytes of the 'name'
buffer, which could lead to an unpredictable error.

A simple solution would be to increase the size of the buffer:
2003-07-28 06:37:04 +00:00
Eric Andersen 727f529211 There should be only one instance of CONFIG_FEATURE_AUTOWIDTH 2003-07-26 09:33:16 +00:00
Eric Andersen 342aea967f Allow people to use the full blown iproute2 programs with busybox ifupdown. 2003-07-26 09:27:02 +00:00
Eric Andersen a1ed06b047 Move start_stop_daemon to debianutils.
Cleanup run_parts a bit and add long opts
2003-07-26 09:16:00 +00:00
Eric Andersen aa820dbc00 cleanup and add long options 2003-07-26 09:10:35 +00:00
Eric Andersen 480f1533f3 The logger utility does not really depend on CONFIG_SYSLOGD,
since it can also be used with other syslog daemons
 -Erik
2003-07-26 08:20:46 +00:00
Eric Andersen 05e662ab4d Patch from Christian Meyer:
The client gives up way too soon because timeout is set to 0 ...
    There's a solution for that problem.
2003-07-26 08:16:10 +00:00
Eric Andersen ac00aa7599 Some additional description based on a patch from Terje Kvernes 2003-07-26 08:07:56 +00:00
Eric Andersen ef73d3b5d9 Patch from Nick Fedchik to fixup paths in busybox/libpwdgrp
which were not properly using the bb_path_*_file strings.
2003-07-26 07:48:13 +00:00
Eric Andersen 7d72e796d6 Rework kill / killall so it behaves itself, even when subjected
to abuse.
 -Erik
2003-07-26 07:41:56 +00:00
Eric Andersen d5868c1692 Patch from Thomas Gleixner to reap any zombie processes that are
reparented to init...
2003-07-26 06:25:12 +00:00
Eric Andersen f231c72630 Don't depend on CONFIG_LFS. It is really a suggestion, not a requirement,
since fdisk will work just fine on smaller disks w/o it.
2003-07-26 00:45:52 +00:00
Manuel Novoa III b511f9cea9 Set the tm_isdst flag to -1 before calling mktime(). Otherwise, the current
timezone setting is used for the new date.
2003-07-23 23:24:31 +00:00
Eric Andersen e5272074c9 eliminate DOSTATIC, DODEBUG, etc and name them sensibly 2003-07-22 22:15:21 +00:00
Eric Andersen 20c9f1e5e7 Several simplifications and indenting changes, per
last_patch97 from vodz
2003-07-22 17:14:10 +00:00
Eric Andersen 4c6c236781 As vodz noticed, I screwed up reboot 2003-07-22 17:04:54 +00:00
Eric Andersen 340aa1cb3f the word "only" is repeated for CONFIG_FEATURE_SHADOWPASSWDS 2003-07-22 17:03:24 +00:00
Eric Andersen fe55b260e2 There is no need to expose CONFIG_FEATURE_TRACEROUTE_SO_DEBUG 2003-07-22 10:18:17 +00:00
Eric Andersen b24da33a06 Document CONFIG_FEATURE_INSMOD_LOADINKMEM 2003-07-22 10:16:58 +00:00
Eric Andersen 3857a184c7 Document CONFIG_ASH_CMDCMD 2003-07-22 10:14:32 +00:00
Eric Andersen 795c4bac91 Write some more docs 2003-07-22 10:11:48 +00:00
Eric Andersen a501d0f01f Remove the update utility, that is only relevant to older 2.0.x kernels
that are no longer supported.
2003-07-22 10:11:27 +00:00
Eric Andersen 9c3c38da55 Patch from Terje Kvernes adding quite a lot of missing documentation 2003-07-22 09:59:34 +00:00
Eric Andersen 6fd0e31e87 Patch from Andrew Flegg:
Here's a pretty crude patch to reload /etc/inittab when init receives a
    SIGHUP. The mailing list archives weren't entirely clear on whether or
    not it should already happen, but didn't appear to be.

    The patch:
       * Adds a new function, reload_signal() which just calls
	 parse_inittab() and run_actions(RESPAWN)

       * Before entering the while (1) loop set up SIGHUP to call
	 reload_signal()

       * Modify new_init_action to skip the action if the same command
	 already exists on the same terminal

    This last bit means that changing already running entries is a bit
    hairy as you can end up with, for example, two shells running on the
    same virtual console. However, for solely adding/removing entries this patch
    seems to work quite well.
2003-07-22 09:48:56 +00:00
Eric Andersen 0246222351 Support reboot, halt, and poweroff independent of busybox init.
Simplify and fixup some logic.
 -Erik
2003-07-22 09:41:39 +00:00
Eric Andersen 85e5e72bc1 Remove remaining libc5 support code 2003-07-22 08:56:55 +00:00
Eric Andersen 0a14c9f924 A minor update for handling older gcc versions 2003-07-22 08:56:01 +00:00
Eric Andersen d14d2a1f61 Update TODO list 2003-07-22 08:55:12 +00:00
Eric Andersen e199220d48 Add a default clean target 2003-07-22 08:54:02 +00:00
Eric Andersen 725db196c3 Very minor rdate updates 2003-07-22 08:26:05 +00:00
Eric Andersen d9fe958921 Error out early if people try to build mount with nfs support
using uClibc, but have not enabled UCLIBC_HAS_RPC...
 -Erik
2003-07-22 08:25:37 +00:00
Eric Andersen 680ec6eeae mention stresslinux 2003-07-22 07:50:18 +00:00
Eric Andersen cde8f53c60 Paul Mundt <lethal@linux-sh.org> writes:
Here's a bunch of fixes for the watchdog app in busybox. This does a
	couple of things:

		- configurable timer duration (userspace timer duration is
		  usually configurable within the device drivers themselves).
		- run as a daemon
		- shutdown the device properly on SIGINT or SIGHUP
		- clear the counter immediately instead of sleeping first

	as well as updating the usage information. This has also been switched
	over to getopt to deal with the optional timer duration specifier.

	The changes themselves are harmless and isolated, and I've veried that
	this works on sh and x86 without any problems.
2003-07-22 07:39:18 +00:00
Eric Andersen 592ebd507a Patch from Paul Mundt:
The current SC_x references automatically assume that everyone uses ttyS/tts
    as their naming scheme for their serial ports. This isn't the case for quite
    a few architectures, including sh, sh64, h8, arm, etc.
2003-07-22 07:33:14 +00:00
Eric Andersen 3443bd7286 Matteo Croce submitted a hdparm applet. 2003-07-22 07:30:36 +00:00
Eric Andersen 1ebcff191a Patch from Jeff Angielski <jeff@theptrgroup.com> recognizing
his work on ftpput and ftpget.
2003-07-22 05:57:29 +00:00
Eric Andersen 8212aa5a37 Fixup some little error in the webpage. Mention the Dell TrueMobile 1184. 2003-07-19 08:19:21 +00:00
Eric Andersen 85c3c3f091 Update required kernel version and note that libc5 is no longer
supported (it is unmaintained and lacks support for simple things
such as stdint.h) and uClibc is a better choice these days anyways.
2003-07-16 07:31:14 +00:00
Eric Andersen 1b0075d243 Fixup problem unconditionally converting all hard links to symlinks. 2003-07-16 06:29:51 +00:00
Eric Andersen c989724316 Update changelog and docs 2003-07-15 07:52:41 +00:00
Eric Andersen db210ae02c Document CONFIG_USE_BB_PWD_GRP 2003-07-15 07:15:03 +00:00
Eric Andersen bb9dc93477 Update the default set of applets that are listed 2003-07-15 00:31:25 +00:00
Eric Andersen d4fcb80609 Yet more preparation to make a release... 2003-07-15 00:28:26 +00:00
Eric Andersen 335816bc4c Fix a silly typo 2003-07-14 22:14:49 +00:00
Eric Andersen 43da9d19ef Looks like I forgot one little tiny detail... 2003-07-14 21:50:51 +00:00
Eric Andersen cb81e6484d Update a bunch of docs. Run a script to update my email addr. 2003-07-14 21:21:08 +00:00
Eric Andersen 74f270a317 decouple delgroup and deluser 2003-07-14 20:20:45 +00:00
Eric Andersen e5642119ee Patch from Thomas Cameron:
Hello all,
	    This patch adds more "Help" text to the config system.  Almost
    all applets now have a help entry.  Also, I cleaned up the spacing of
    the existing text so that things are consistent.  This patch is against
    this morning's CVS.

    Thomas Cameron
    CEI Systems, Inc.
2003-07-14 19:37:08 +00:00
Eric Andersen 1eceb127bd Use standard types 2003-07-14 19:32:40 +00:00
Eric Andersen b7ebc61b54 Michael Sternberg writes:
Latest BusyBox from CVS (Jul 7 2003).
    File coreutils/ls.c
    "if" at line 970 should be enclosed in #ifdef CONFIG_FEATURE_LS_SORTFILES
    "if" at line 976 should be enclosed in #ifdef CONFIG_FEATURE_LS_TIMESTAMPS
2003-07-14 19:20:46 +00:00
Eric Andersen fb0c6af286 Patch from Lars Kellogg-Stedman:
The attached two patches add config documentation to init/Config.in and
    fileutils/Config.in.
2003-07-14 19:18:43 +00:00
Eric Andersen 9edcabdc34 Patch from Lars Kellogg-Stedman:
Busybox vi is installed in /bin/vi, but crontab was looking for
    /usr/bin/vi.  This patch makes crontab look for /bin/vi instead.
2003-07-14 19:14:26 +00:00
Eric Andersen 96916b7f41 Require that LFS is enabled to get fdisk 2003-07-14 19:08:04 +00:00
Eric Andersen 341170b012 Remove all the llseek junk and just use regular old lseek. When DOLFS is
enabled, regular lseek is transparently promoted to lseek64 anyways, rendering
the llseek stuff pointless.
 -Erik
2003-07-14 19:03:14 +00:00
Eric Andersen feb283a437 On second thought, this is a better way to fix things 2003-07-14 08:49:43 +00:00
Eric Andersen 9059e3a37b Don't use Linux kernel headers
-Erik
2003-07-14 08:46:30 +00:00
Eric Andersen f890f9dd16 This declaration no longer needs to hide when using dmalloc 2003-07-07 06:10:31 +00:00
Eric Andersen e3393513c5 Be certain to not abort prematurely when reading stuff from pipes. 2003-07-05 23:10:27 +00:00
Eric Andersen 9f894f4062 Fixup compile problem with dmalloc 2003-07-05 22:15:43 +00:00
Eric Andersen 3c5a83c567 As noted by Thomas Eckert:
bb-tar "cjf" does not create a valid tbz2-archive -- if fact the result is a
    plain tar-file (no compression) -- but does not warn about the unrecognized
    parameter combination "cj" (bb does not have bzip2-compression yet, right?).

to fix this I have added an error message stating this does not work.

He also reported

    cosmetic: versose "-v" does not show any output when used with "create"

which I have now fixed as well.

 -Erik
2003-07-05 21:56:55 +00:00
Eric Andersen d5a2780aa2 oops 2003-07-05 08:39:47 +00:00
Eric Andersen 3c8064ff69 Daniel writes:
I've found a problem with job control when the init process is restarted.

If the system boots for the first time, I get job control on a serial terminal -
no problems. However, when I restart init by issuing "init -q", then the shell
no longer has job control.

I traced this a problem in console_init in the file init.c. What was happening
after the restart is that the first compare

    if (ioctl(0, TIOCGSERIAL, &sr) == 0) {
	...
    } else if (ioctl(0, VT_GETSTATE, &vt) == 0) {
	...
    } else {
	... // assume /dev/console
    }

returned error and subsequently the code assumes /dev/console as the console,
which does not support job control.

Checking the errno after the first call showed that the system was complaining
about the file descriptor. This is probably because the previous init process
had closed all its file descriptors which the new init process had inherited.
2003-07-05 08:29:01 +00:00
Eric Andersen 40ea66cd9d Patch from Lars Kellogg-Stedman:
Glibc 2.1.3 (used by the Hardhat Linux SDK distributed by Cyclades)
    does not define IF_NAMESIZE in net/if.h.
2003-07-05 08:00:17 +00:00
Eric Andersen 7207b88d06 Patch from Lars Kellogg-Stedman:
This patch fixes endian problems with get_netmask().  I don't know if
    this is the cleanest solution, but it makes 'ipcalc -n' work on both
    an i386 system and a ppc system.
2003-07-05 07:59:30 +00:00
Eric Andersen 65e20a33c2 Patch from Kent Robotti adding a bunch of needed docs!
-Erik
2003-07-05 07:52:35 +00:00
Eric Andersen 01c3d40f3c Add the fdformat utility, based on a patch from Kent Robotti,
but I then completely reworked the fdformat utility to comply
with the current busybox way of doing things.
2003-07-05 07:51:31 +00:00
Eric Andersen a21f4e018a Glenn McGrath (bug1) isaway from my email till the 17th, but caught me on IRC.
He took a look into the recent reports of tar problems, and found an obvious
typo in last_patch91 from vodz which converted tar to use bb_getopt_ulflags.
2003-07-05 06:38:41 +00:00
Eric Andersen e968ee3f70 Patch from Vladimir N. Oleynik (vodz):
Last patch have changed for "ipcalc" applet with usage new get_ulflags()
    function.
2003-07-03 10:28:07 +00:00
Eric Andersen 8a93179c14 Patch from Lars Kellogg-Stedman:
Erik, et al.

    The attached patch makes the following changes to networking/ifupdown.c:

    (1) It swaps all calls to 'ip link set' and 'ip addr set'.  This solves
    two problems:

      (a) Calling 'ip link set <dev> up' before assigning an address
      generates an error message, and

      (b) Under User Mode Linux, running in with ethernet interfaces
      in daemon mode, the MAC address for an interface is selected
      based on the IP address assigned to that interface.  If the
      interface is brought up before being assigned an IP address,
      it gets a null MAC.

    (2) It further cleans up run_mapping().

    This patch is against ifupdown.c revision 1.25.

    -- Lars
2003-07-03 10:20:29 +00:00
Eric Andersen bccb31533e Fix stupid unterminated parenthesis 2003-07-03 10:19:20 +00:00
Eric Andersen 9e48045e45 Patch from Russell Coker:
I've attached my latest SE Linux patch for busybox against the latest CVS
    version of busybox.
2003-07-03 10:07:04 +00:00
Eric Andersen c48d49ad98 Patch from Kent Robotti updating fdisk to version v2.11z 2003-07-03 10:02:32 +00:00
Eric Andersen e5920a2dc0 Patch from Kent Robotti adding a bunch of menuconfig help 2003-07-03 10:00:15 +00:00
Eric Andersen a5c488449e Using safe_read seems, well, safer... 2003-07-03 09:48:07 +00:00
Eric Andersen 61f6db130e As implemented, sha1sum would sometimes give the wrong answer.
This fixes it and uses faster sha1 code from Dr. Gladman.
 -Erik
2003-07-03 09:41:41 +00:00
Eric Andersen a63d09a517 Patch from Pavel Roskin to fixup toplevel help text 2003-06-30 18:14:36 +00:00
Eric Andersen b01ed65ad2 Apply last_patch93 from vodz:
andersen@busybox.net wrote:
    >Message: 4
    >Modified Files:
    >       init.c
    >Log Message:
    >Remove code for unsupported kernel versions

    Hmm. Current init.c have check >= 2.2.0 kernel one time too.
    Ok. Last patch removed this point and move common init code to new file for
    /init dir
2003-06-27 17:08:15 +00:00
Eric Andersen 0b0d393347 Remove bdflush garbage, which is only relevant to unsupported
kernel versions
2003-06-27 05:46:29 +00:00
Eric Andersen 4a2dcd904c oops. make this actually work as intended.... 2003-06-26 23:55:55 +00:00
Eric Andersen 7c512439b2 Make sure we end up with a unix2dos link to busybox 2003-06-26 21:53:51 +00:00
Eric Andersen f60d4b491a Oops. 2003-06-26 18:01:43 +00:00
Eric Andersen 27cb6846d7 last_patch91 from vodz to convert tar to use bb_getopt_ulflags 2003-06-26 09:07:59 +00:00
Eric Andersen a3bb3e6e0b Geir Thomassen wrote, regarding networking/httpd.c line 1358
Hello, I think the test for an unconfigured httpd is wrong in
    the CVS (busybox-unstable-20030620.tar.bz2)

    flg_deny_all is default 0

vodz then wrote:

    Oops. You are right.
    Also, this mistake haved from two place.
    Last patch rewroted to my new get_ularg() function for overcompensate size
    from this error found ;-)
2003-06-26 09:05:32 +00:00
Eric Andersen fd10c70521 Per patch from Nick Fedchik, use SHADOW_FILE, not "/etc/shadow".
Change fopen to bb_xfopen
2003-06-26 08:53:49 +00:00
Eric Andersen 1c25ba9de1 Oops. As Andrew Dennison just noticed, I left a stray
space in the Makefile, thereby totally breaking it.
2003-06-25 05:18:48 +00:00
Eric Andersen b6071ea5cb Regenerate the busybox.links file when the .config changes 2003-06-25 03:26:04 +00:00
Glenn L McGrath 655d814d75 New applet: patch, applies a unified diff 2003-06-22 15:32:41 +00:00
Glenn L McGrath a0b3705fa1 Save a few bytes by using bb_getopt_ulflags and a few other minor
improvments
2003-06-22 06:59:34 +00:00
Eric Andersen f0f754aeaf Based on a tinylogin patch from Philip Blundell, add several
additional options to adduser.
 -Erik
2003-06-21 20:03:07 +00:00
Eric Andersen 9d9cecfd63 Fix a silly bug I introduced yesterday 2003-06-21 09:05:49 +00:00
Eric Andersen 3c8bca364d Fixup whitespace handing, fixing some annoying behavior and
a couple of segfaults
2003-06-20 10:02:29 +00:00
Eric Andersen 25ea42de9b Fall back to looking in /lib/modules/modules.dep if
/lib/modules/<kernel version>/modules.dep is missing
2003-06-20 09:57:30 +00:00
Eric Andersen 908e362133 Patch from Andrew Dennison:
I've had some issues with modprobe which I reported a few months ago. This
is still an issue so I decided to sort it out.

The attached diff includes the changes against the unstable cvs tree that
work for me.

Changes are:
mod_process() will report success if the module at the head of the list
loads successfully. It will also report success if any module unloads
successfully.
The net result being that modprobe will succeed in the cases outlined below.
I've also added error reporting to modprobe -r. Previously it would silently
fail (but report success) if the module could not be unloaded.

Andrew
2003-06-20 09:56:37 +00:00
Eric Andersen 9d7f0f0fe8 Somewhere in the 2.4.x kernel series, /proc/mounts was changed to display a
"rootfs" entry as well as the traditional "/dev/root" entry.  This caused
applets such as mount and df to display two root filesystem entries....

This teaches the relevant utilities to ignore the "rootfs" entry.
 -Erik
2003-06-20 09:36:49 +00:00
Eric Andersen dd92c77bb0 Don't shadow a paramater 2003-06-20 09:25:34 +00:00
Eric Andersen 0cc7e6236a Fix a couple vars that could be used uninitialized 2003-06-20 09:23:34 +00:00
Eric Andersen 2a41ec6c63 use an explicit cast on some types that change size when
large file support is enabled.
2003-06-20 09:22:12 +00:00
Eric Andersen 1b2e7c3b2a Make gcc not whine about "deprecated use of label at end of compound statement" 2003-06-20 09:20:28 +00:00
Eric Andersen c9e7024924 Add prototype update missing from last_patch89. Fix screwy
formatting in cut.
2003-06-20 09:16:00 +00:00
Eric Andersen 0f08e53535 Patch from Lars Kellogg-Stedman:
I'm building BusyBox using a development kit for MontaVista Hardhat Linux
(PPC) -- which, at least in this instance, is based around kernel 2.2.14.
I've had to massage a few files in networking/libiproute/ to make it
compile.  Specifically:

  (1) Added a #include <sys/uio.h> for the iovec structure in
      libnetlink.c,

  (2) Put ifdefs in ll_types.c and ll_proto.c around various
      constants (ETH_P_xxx and ARPHRD_xxx) that weren't defined,

  (3) Make do_changename() in iplink.c require a kernel >=
      2.4.0 -- the ifr structure in my environment doesn't
      have the ifr_name attribute.  I've assumed this is
      a kernel dependency -- let me know if I ought to be
      checking something else.

      In the absence of the correct kernel, do_changename()
      always returns 0.

Attached is a patch against the current CVS that will make these changes.

-- Lars
2003-06-20 09:05:00 +00:00
Eric Andersen 8876fb2f59 last_patch89 from vodz:
Manuel,

    I rewrite bb_getopt_ulflags() function for more universal usage.
    My version support now:
    - options with arguments (optional arg as GNU extension also)
    - complementaly and/or incomplementaly and/or incongruously and/or list
    options
    - long_opt (all applets may have long option, add supporting is trivial)
    This realisation full compatibile from your version.
    Code size grow 480 bytes, but only coreutils/* over compensate this size
    after using new function. Last patch reduced over 800 bytes and not full
    applied to all. "mkdir" and "mv" applets have long_opt now for demonstrate
    trivial addition support long_opt with usage new bb_getopt_ulflags().
    Complementaly and/or incomplementaly and/or incongruously and/or list options
    logic is not trivial, but new "cut" and "grep" applets using this logic
    for examples with full demostrating. New "grep" applet reduced over 300
    bytes.

    Mark,
    Also. I removed bug from "grep" applet.
    $ echo a b | busybox grep -e a b
    a b
    a b
    But right is printing one only.

    --w
    vodz
2003-06-20 09:01:58 +00:00
Eric Andersen dfce3536ac Fix rpm usage msg 2003-06-15 07:00:54 +00:00
Eric Andersen a8da17acef Add missing pieces from vodz' last_patch88 2003-06-14 02:57:53 +00:00
Eric Andersen fa7532b91a Fix the location for the default config so 'make defconfig'
actually works
2003-06-12 22:09:08 +00:00
Glenn L McGrath b838420fd5 Handle hard links by converting them to symlinks 2003-06-12 13:47:16 +00:00
Glenn L McGrath 24833430bc Vodz, last_patch_88 2003-06-10 17:22:49 +00:00
Glenn L McGrath 6c43f743a3 sha1sum option to compare checksums 2003-06-08 13:32:12 +00:00
Glenn L McGrath a721204ec5 Better error handling 2003-06-07 17:38:33 +00:00
Glenn L McGrath a9e4617494 Minor correction 2003-06-07 17:11:00 +00:00
Glenn L McGrath 138d71bc35 Fix bug (wrong value computed) when reading file from stdin, implement
-s option
2003-06-07 17:06:28 +00:00
Glenn L McGrath 7aa62cf173 Run through indent 2003-06-07 14:54:24 +00:00
Eric Andersen 233b170a85 Patch from Lars Kellogg-Stedman, lars at larsshack.org, to
make ifupdown's mapping function work as documented.
2003-06-05 19:37:01 +00:00
Eric Andersen d130973f34 Put this back the way it was. I misunderstood what vodz was doing. 2003-05-27 20:45:59 +00:00
Eric Andersen 82ab3d7c3e Make all syscall declarations use the syscall() function 2003-05-26 18:48:56 +00:00
Eric Andersen b0cfca7544 This was doing some silly stuff that is not necessary when using
vfork(), so I have simplified it.
2003-05-26 18:12:00 +00:00
Eric Andersen a2d1982841 cleanup a bit to remove needless verify() function 2003-05-26 18:09:14 +00:00
Eric Andersen fab3e12cec Skip printing "/proc/%d/cmdline" stuff when it is not relevant 2003-05-26 18:07:30 +00:00
Eric Andersen 64191c3896 Remove cruft 2003-05-26 18:06:20 +00:00
Glenn L McGrath 2faee7b1ed Vodz, last_path_87, formatiing changes 2003-05-26 14:09:12 +00:00
Glenn L McGrath 393183dccc Vodz, last_patch_86 2003-05-26 14:07:50 +00:00
Eric Andersen ddfe18df75 Update mkdep, per the "touchless dependencies for 2.4.x" patch
from Geert Uytterhoeven posted to the lkml.
 -Erik
2003-05-24 07:30:58 +00:00
Eric Andersen 46ba568fc0 oops 2003-05-23 09:29:57 +00:00
Eric Andersen d4f90ed37e This patch from Vitezslav Batrla, is a cleaner fix for the
problem with syslogd logging the '<' char.
2003-05-23 09:28:01 +00:00
Eric Andersen 787ff55a69 Patch from Russell Coker:
The attached patch fixes a compilation error.  If you compile ping6 without
the CONFIG_FEATURE_FANCY_PING6 option then the compile will fail without this
patch.
2003-05-22 07:10:22 +00:00
Glenn L McGrath 4fe3ff8cff Patch from Glenn Engel
- more comments
- larger allowed number of CGI script variables
- ifdefs for regression test hooks
- default to ./ rather than /www (if unspecified) for compatibility with
earlier versions.
- Allow ip: as a synomym for A: rules for compatibility with earlier
versions.
- Setting of CGI_ARGLIST_  when automatic setting of env vars for form
scripting is utilized.  This helps with minimal systems like openap.
2003-05-19 05:56:16 +00:00
Matt Kraai 0861e828d0 Handle -O preceding -x. 2003-05-18 21:12:36 +00:00
Eric Andersen 900c8f3362 Apply patch from Georg Magschok to fix syslog behavior so that the
'>' charactor can be logged, per rfc3164.

Also, a small patch from me to fix it so we use MAXLINE when allocating the
buffer, which is consistant with use everywhere else.  This is needed since
uClibc defines BUFSIZE as 255, causing lines to be truncated at 255...
2003-05-16 08:35:02 +00:00
Glenn L McGrath d3af409eae Part of a patch from Glenn Engel, updates httpd help 2003-05-14 12:20:21 +00:00
Glenn L McGrath 874e3381db vodz, last_patch_85 2003-05-14 12:11:36 +00:00
Glenn L McGrath 0a3b0106ab Re-use existing variables, patch from Tito 2003-05-13 16:31:15 +00:00
Glenn L McGrath c9163fee91 last_patch84 by Vodz. 2003-05-13 16:20:11 +00:00
Glenn L McGrath 49e74effbc Add some missing lines for getty, patch by Steven Scholz 2003-05-13 14:59:07 +00:00
Glenn L McGrath 74fcbb0f7d Fix \l so it doesnt print the character as well as the tty, from old
patch by Nick Fedchik
2003-05-13 13:28:25 +00:00
Glenn L McGrath 1e11c34be4 minit, a Minimal init system. 2003-05-11 14:52:39 +00:00
Glenn L McGrath 8c6887c855 Use xopen instead of xfopen 2003-05-08 13:09:28 +00:00
Eric Andersen 7b3edeb14d Patch from Dmitry V. Levin to fix a fd leak 2003-05-02 16:25:01 +00:00
Eric Andersen a860bec167 A couple of patches from Tito <farmatito@tiscali.it> 2003-04-27 10:42:31 +00:00
Glenn L McGrath 7a54360cd4 Use bb_xgetlarg 2003-04-27 10:05:35 +00:00
Glenn L McGrath f01b805d91 New applet, fold 2003-04-27 06:02:14 +00:00
Glenn L McGrath c91ce57099 Config option to create an fgrep alias 2003-04-27 02:43:54 +00:00
Glenn L McGrath c5408fe7f7 Fix segfault when cleaning up 2003-04-27 02:22:01 +00:00
Glenn L McGrath 26df70a823 grep -f support, adds only 60 Bytes, but regex's now compiled as
required, rather than being pre-compiled.
2003-04-27 01:50:57 +00:00
Glenn L McGrath e2aed7ffd7 Always preserve date 2003-04-26 13:16:44 +00:00
Glenn L McGrath 91e1978ff0 New commands, 'G' and 'H' 2003-04-26 07:40:07 +00:00
Glenn L McGrath 69f28e7c0c Add the -d option, its used by old versions of config.guess, change to
use getopt.
2003-04-26 04:56:17 +00:00
Glenn L McGrath fbf0b8af41 iPatch from waldi, fixes usage of ip route flush (from)? (match|exact) 2003-04-26 02:22:19 +00:00
Eric Andersen 86f2cce6bf Patch from Steven Scholz to fix telnetd compile problem 2003-04-25 12:32:37 +00:00
Eric Andersen 2c1de61023 There have been many reports of init failing to reboot and/or failing to halt
over the years.  Well I finally took the time to track this down.  It turns out
that inside linux/kernel/sys.c the kernel will call
    machine_halt();
    do_exit(0);
when halting, or will call
    machine_power_off();
    do_exit(0);

during a reboot.  Unlike sysv init, we call reboot from within the init
process, so if the call to machine_halt() or machine_power_off() returns,                                       the call to do_exit(0) will cause the kernel to panic.  Which is a very
bad thing to happen.

So I just added this little patch to fork and call the reboot
syscall from within the forked child process, thereby neatly
avoiding the problem.

But IMHO, both calls to do_exit(0) within linux/kernel/sys.c
are bugs and should be fixed.

 -Erik
2003-04-24 11:41:28 +00:00
Glenn L McGrath afc01cd485 unlink a previous file before its extracted 2003-04-21 11:03:29 +00:00
Glenn L McGrath 923dd79af7 sync with waldi 2003-04-21 10:26:39 +00:00
Glenn L McGrath 35a5b08eee unlink() an existing file, before opening it, simply truncating can
cause nasty problems if overwriting glibc, spotted by waldi.
2003-04-21 10:07:48 +00:00
Eric Andersen 6f9a0d4bbb Add link to SimplyGNUstep 2003-04-21 03:34:01 +00:00
Eric Andersen 4a11e0fb45 Patch from David Updegraff to use calloc so that forward pointers start out
NULL, and so it can handle format strings that have stuff _after_ the last %?
specification
2003-04-19 23:18:35 +00:00
Eric Andersen 2894266f12 Patch from David Updegraff to avoid corrupting memory while parsing the
networks/iterfaces file with next_word routine.  Without this, next_word
increments one beyond the end of the string.
2003-04-19 23:15:06 +00:00
Eric Andersen 343658582b Minor .o file naming change 2003-04-16 23:02:35 +00:00
Eric Andersen 7cb6ef7982 enable CONFIG_USE_BB_PWD_GRP for the debian installer,
to prevent glibc from trying and failing to use NSS junk
that is not present.
 -Erik
2003-04-16 20:52:01 +00:00
Glenn L McGrath fc4cb4dbb5 Fix logic error in grouped commands 2003-04-12 16:10:42 +00:00
Glenn L McGrath d4185b0e15 Fix up indenting 2003-04-11 17:10:23 +00:00
Glenn L McGrath d7fe39b587 Really fix the 'r' command 2003-04-09 15:52:32 +00:00
Glenn L McGrath d87a7ac269 Fix the sed 'r' command 2003-04-09 15:26:14 +00:00
Glenn L McGrath 2410386611 fix substitution when replacing with &, we shouldnt check for an escape charcter. Its already been taken care of _somewhere_ else 2003-04-09 07:51:43 +00:00
Glenn L McGrath bd9b32bc0d Label ends at a newline, update comments, rename linked list field 2003-04-09 01:43:54 +00:00
Glenn L McGrath 8d6395d41a Run through indent 2003-04-08 11:56:11 +00:00
Glenn L McGrath c1d95076f0 Fixes block commands to correctly identify end of block, recognise the #n directive, fix substitue command when regex isnt specified 2003-04-08 06:42:45 +00:00
Glenn L McGrath 7ce9e247f0 Add hold space commands 'g', 'h', 'x' 2003-04-07 16:04:14 +00:00
Glenn L McGrath c6adada158 Rename "line" to pattern_space to be more descriptive and closer to the POSIX description 2003-04-07 12:24:44 +00:00
Glenn L McGrath 4957fc7a93 Sync with waldi's package 2003-04-06 15:35:52 +00:00
Glenn L McGrath 8353fe9298 Preparation for the new net-udeb based on required applets documented at
http://cvs.debian.org/debian-installer/doc/busybox-applets.txt
2003-04-06 03:39:24 +00:00
Eric Andersen 982da3e6b4 Add more help text 2003-04-04 15:20:53 +00:00
Eric Andersen 4762a48166 Test that cvs commit messages are working properly
-Erik
2003-04-04 14:35:36 +00:00
Manuel Novoa III 0c236a09ed Fix 'thinko'. 2003-04-03 19:29:11 +00:00
Eric Andersen 8320b425a3 Yet another rather large face lift. It now works for me as expected.
-Erik
2003-04-02 10:13:26 +00:00
Eric Andersen a71c7047cf Avoid errors with buggy preprocessors 2003-03-31 16:27:18 +00:00
Glenn L McGrath f3def2792b Update config to new menu options 2003-03-30 16:10:06 +00:00
Glenn L McGrath 1b6dfa7066 Rename, to specify kernel 2003-03-30 13:57:26 +00:00
Glenn L McGrath 9a52bb6878 Group common string 2003-03-30 09:38:40 +00:00
Glenn L McGrath 30b47df86b Small fix for sed 'y' command 2003-03-30 08:40:09 +00:00
Glenn L McGrath f01b46d7dd sed 'y' command, simplify some other code 2003-03-30 08:02:18 +00:00
Glenn L McGrath 0c51832b60 Experimental support for embeded newline. (im evil)
Fix segfault when using 'N' with an odd number of lines.
2003-03-30 03:41:53 +00:00
Eric Andersen b5b5ac3237 trivial fix to make sure we have sufficient arguments before
we mess with a possibly non-existant argv[1]
 -Erik
2003-03-28 16:54:14 +00:00
Glenn L McGrath a0f0f0cf76 Still fine tunning the printing of the substitute command 2003-03-28 14:11:34 +00:00
Glenn L McGrath 595a6a4199 sed 't' branching command 2003-03-28 08:36:52 +00:00
Glenn L McGrath ccd43a8301 Fix sed 's' command's 'p' flag, so it can print line twice 2003-03-28 07:44:03 +00:00
Glenn L McGrath b08e3e8c2e fix q command 2003-03-28 04:57:52 +00:00
Glenn L McGrath 961c6c19da Add basic branching support, sed ':' and 'b' commands 2003-03-28 04:43:39 +00:00
Glenn L McGrath 56c633c139 make sed cleanup use linked list 2003-03-28 04:23:23 +00:00
Glenn L McGrath c949bfa555 Use a linked list for sed commands in preparation for branching support 2003-03-28 03:53:31 +00:00
Manuel Novoa III 3a9b0bf0ba Oops... had != but meant ==. 2003-03-23 20:27:33 +00:00
Manuel Novoa III 4baef0c77f Minor cleanups. Document the cmp -l option. 2003-03-19 18:40:42 +00:00
Manuel Novoa III ea4c43445c Restrict octal perms to <= 07777. Cosmetic error message change. 2003-03-19 18:09:03 +00:00
Manuel Novoa III 1cb1b64c35 Obligatory forgotten item. 2003-03-19 09:42:33 +00:00
Manuel Novoa III 4eff18189a Things my compiler didn't catch... 2003-03-19 09:42:02 +00:00
Manuel Novoa III cad5364599 Major coreutils update. 2003-03-19 09:13:01 +00:00
Glenn L McGrath e01f9662a5 Match newlines, this fixes matching of ^ or $ when there is a '\n' in the pattern being matched. This fixes cases when the N command is used. 2003-03-18 08:37:57 +00:00
Glenn L McGrath 2971ef1730 Fix a bug that corrupted the string followed commands that had no arguments (Closes #1304) 2003-03-18 01:19:23 +00:00
Eric Andersen 737f5fb890 Patch from Jonas Holmberg, adjusted by Robert Schwebel, and
later re-adjusted by me to fix msh backtick handling
2003-03-14 16:05:59 +00:00
Eric Andersen d2b8118650 oops. args shuffled. 2003-03-13 20:54:26 +00:00
Eric Andersen c3b2dbec8c Fix obviously wrong names from older busybox 2003-03-13 18:57:08 +00:00
Eric Andersen 92b7e7baa1 Patch from Tito Ragusa:
The changes I've made: in strings.c:
1) fix memory allocation error I've detected with MALLOC_CHECK_=1 in *string;
2) code clean up;
3) fix compiler warnings about uninitialized vars;
2003-03-13 18:49:45 +00:00
Eric Andersen 3f1cf455a0 cope with crappy windoze ftp servers 2003-03-11 18:03:39 +00:00
Eric Andersen e68afefe56 Avoid potential rendering problems 2003-03-10 17:21:46 +00:00
Glenn L McGrath 4157a8a71e fix n, add N, P 2003-03-10 04:12:35 +00:00
Glenn L McGrath ff724fb076 add the 'n' command 2003-03-10 02:56:56 +00:00
Glenn L McGrath bed4033e96 Add the q (quit) option 2003-03-10 02:21:14 +00:00
Glenn L McGrath f3bd7c4631 Fix a delimiter matching bug i introduced. 2003-03-09 15:40:40 +00:00
Glenn L McGrath f50ce3135f Support grouped commands, i.e. {cmd1;cmd2} 2003-03-09 15:12:24 +00:00
Glenn L McGrath 4c6523a90b alloc array for commands, use string ptr in parse_command_string() 2003-03-09 11:06:38 +00:00
Glenn L McGrath e7a8bc949b use typedef for struct sed_cmd 2003-03-09 10:23:57 +00:00
Glenn L McGrath 1fb446795d redo get_addres(). save some space. possible fix a bug where the command might be set to 0 if no second address is given. dont parse sed_cmd struct to get_address, we only need the delim field. 2003-03-09 08:44:49 +00:00
Glenn L McGrath 2f8a401772 Woops, remove the code i didnt mean to commit 2003-03-09 02:44:49 +00:00
Glenn L McGrath d5eadea970 Mention the opengroup sed reference, add a check which is disabled at present. 2003-03-09 02:39:29 +00:00
Glenn L McGrath 505bd0f15a Fix matching for the $ address (last line) 2003-03-08 05:21:02 +00:00
Eric Andersen 77831c11d1 be more careful about cleaning up 2003-03-07 18:09:06 +00:00
Eric Andersen 3719e9e790 Scrub things a bit, shave off a few bytes.
-Erik
2003-03-07 18:03:02 +00:00
Eric Andersen 1bc5fa8c0c Save a few bytes and remove a redundant string 2003-03-07 17:59:32 +00:00
Eric Andersen 6067c08145 With nightmares of libbb ending up with 100 .c files starting
with "bb_" it seems best to rename this now and avoid starting
an evil KDE style naming trend.
2003-03-07 17:43:32 +00:00
Eric Andersen 2afcbe436f audit for proper error handling, apply a few size optimizations
-Erik
2003-03-07 17:33:40 +00:00
Eric Andersen a9c6bc41e9 Define bb_xgetlarg as a standard interface for extracting
numbers from getopt which includes careful error checking.
 -Erik
2003-03-07 17:29:12 +00:00
Eric Andersen bae7c1ac24 Explicitly define -DNDEBUG so asserts don't clutter release code 2003-03-07 17:27:51 +00:00
Eric Andersen 08f4a4c508 Add all the syslogd help text 2003-02-28 07:20:55 +00:00
Eric Andersen 5ef448285b There is no good reason to prevent nfs mounts from being mounted
during 'mount -a'.  If the user wants to do that, hey, its their
lifs.  If the nfs server is down and they don't want to wait for
nfs to time out, that is their problem.
 -Erik
2003-02-28 06:29:27 +00:00
Eric Andersen a0ac4523b1 Write all the help text for the util-linux utilities. Allow
people to locate the mtab file somewhere other that /etc to
accomodate read only root filesystems.
 -Erik
2003-02-27 03:14:04 +00:00
Eric Andersen ee6da5527c mention "katamaran" 2003-02-18 20:17:30 +00:00
Glenn L McGrath 008c01915b Fix for big endian machines 2003-02-17 12:18:16 +00:00
Glenn L McGrath ae0f1e7052 New applet sha1sum 2003-02-17 08:23:22 +00:00
Glenn L McGrath 4a4c677fcc Patch from Bastian Blank
- ip route flush
 - different usage for telnetd in inetd mode
 - changes for the default flags of the ip features
 - if no /usr requested, udhcpc should use the script also without /usr.
2003-02-15 11:50:33 +00:00
Glenn L McGrath 3238ea1673 Merge fileutils, textutils and shellutils into coreuils 2003-02-15 10:53:40 +00:00
Russ Dill 858fad722f sync with udhcp bug fixes 2003-02-12 22:20:19 +00:00
Eric Andersen 496411b489 Don't use HZ -- use sysconf(_SC_CLK_TCK) 2003-02-12 10:56:53 +00:00
Manuel Novoa III c2843563f3 Fix compile error... header problems. 2003-02-11 07:06:06 +00:00
Glenn L McGrath ae494a9086 last_patch83 by Vladimir N. Oleynik 2003-02-10 22:53:37 +00:00
Glenn L McGrath b1207b3320 Fix compile error, last_patch82 by Vladimir N. Oleynik 2003-02-10 22:31:09 +00:00
Glenn L McGrath 3d2405cfb3 Fix compile error, last_patch81 by Vladimir N. Oleynik 2003-02-10 22:28:21 +00:00
Eric Andersen 18d8a3b7e3 udhcpc is supposed to be in /sbin, not /usr/sbin/ 2003-02-10 09:22:36 +00:00
Glenn L McGrath 883d4842d2 Fix compiler warnings, patch by Steven Scholz 2003-02-09 22:40:34 +00:00
Glenn L McGrath 826b48b624 Woops, my gunzip fix broke unzip, these cant be static 2003-02-09 12:00:17 +00:00
Glenn L McGrath a837e2d9b3 Minor update to arping, patch from Nick Fedchik 2003-02-09 07:01:33 +00:00
Glenn L McGrath 06e9565b6c New applet, inetd, make httpd features more configurable, update authors, last_patch_80
from Vladimir N. Oleynik
2003-02-09 06:51:14 +00:00
Glenn L McGrath 877d418b39 Dont die if logging remotely fails, patch by Joshua Jackson 2003-02-09 05:07:42 +00:00
Glenn L McGrath def85e8752 Specify install path, patch by Nick Fedchik 2003-02-09 05:00:52 +00:00
Glenn L McGrath 1d21fb3c23 Moved to libunarchive/unzip.c 2003-02-09 04:49:17 +00:00
Glenn L McGrath cc616928d5 Fix endian probelm on PPC, i had different types for an extern variable. 2003-02-09 04:46:34 +00:00
Glenn L McGrath a88cb5025c Patch from mathuria, compatability with solaris 2003-02-08 23:36:16 +00:00
Glenn L McGrath 3aeaee33b6 Patch from Joshua Jackson, make md5 the default hash algorithm 2003-02-08 23:20:02 +00:00
Glenn L McGrath b4f3d7f594 Rewrite by Manuel Novoa III, very compact implimentation. 2003-02-08 23:11:19 +00:00
Glenn L McGrath cb665093b8 Patch from Nick Fedchik, CONFIG_SYSLOGD should determine getty's
behaviour.
2003-02-08 22:33:53 +00:00
Eric Andersen a486f469cb Mention penguru 2003-02-05 18:16:45 +00:00
Eric Andersen 46c203a6ce Fix a couple more ifupdown bugs 2003-02-03 12:44:59 +00:00
Glenn L McGrath 21110a0aa2 Fix long standing bug with old gnu tar files, add a check so tar will
complain "unknown file type" if it tries to extract an oldgnu tar file
and TAR_FEATURE_OLDGNU_COMPATABILITY sint defined.
Print a warning if unisupported gnu extensions are encountered.
2003-01-28 01:45:48 +00:00
Eric Andersen a99534354a Don't wipe the config system on 'make clean' 2003-01-27 22:11:59 +00:00
Eric Andersen 66a3af9d7c This seems sufficient for ifup and ifdown to actually work
as advertised.  Works for me (at least with glibc)
2003-01-27 17:41:19 +00:00
Eric Andersen 22237017a7 Fix a silly compile error, thanks to a patch from Wen-chien Jesse Sung 2003-01-23 07:08:26 +00:00
Eric Andersen ee9441f848 Patch from Brett Hunt at micron.com to fixup potential segfaults
during 'make menuconfig'
2003-01-23 06:36:15 +00:00
Eric Andersen bf77f61d69 Patch from Jason McMullan @ linuxcare.com adding insmod
support for s390 systems.
2003-01-23 06:02:39 +00:00
Eric Andersen 853c494efd A patch from John F. Kelly to add in a utility for configuring
vlan under linux, derived from Ben Greear's VLAN "vconfig" tool.
2003-01-23 05:59:32 +00:00
Eric Andersen 97d86f2bb5 Apply patch from Ghozlane Toumi to add -inum support to find.
Apply patch from Ghozlane Toumi to make find smaller by combining
    similar error messages
Forward port find -newer support from busybox stable that was
    missing from unstable.  -Erik.
Fixup usage messages for find.  -Erik
2003-01-23 05:27:42 +00:00
Eric Andersen be65c350ae Patch from Artem Egorkine to support the -m option 2003-01-23 04:57:35 +00:00
Eric Andersen 889dd20c69 Patch from Joel Vallier to add modules symbols to the kernel symbol
table in order to obtain better debug output from ksymoops.
2003-01-23 04:48:34 +00:00
Glenn L McGrath 8eb214edbd Patch from Basitan Blank to fix nasty bug 2003-01-22 21:09:48 +00:00
Eric Andersen d8fdf0c57d Fix a typo that broke it so busybox won't build 2003-01-22 01:20:35 +00:00
Russ Dill 6393d69f76 merge fixes with udhcp 2003-01-21 22:39:34 +00:00
Glenn L McGrath 6af21c2afa Login prompt function, part of waldi's telnetd from inetd patch 2003-01-21 20:59:34 +00:00
Glenn L McGrath 9e5d6c002c run telnet from inetd, present login prompt if login is configured,
patch from Bastian Blank
2003-01-21 20:55:56 +00:00
Glenn L McGrath 4c51202b9d re-order config options, part of a patch from Bastian Blank 2003-01-21 00:12:11 +00:00
Glenn L McGrath 5cc9ada0e4 header update 2003-01-21 00:03:05 +00:00
Glenn L McGrath 2e51a14d57 New test mode that allows run_parts to fail silently if the directory
is not found. Patch from Bastian Blank
2003-01-20 23:50:59 +00:00
Glenn L McGrath aad465efb7 Make test mode output same as official version 2003-01-20 23:34:12 +00:00
Glenn L McGrath a9adef0394 Dont use getopt_long, minor usage changes, patch by Nick Fedchik 2003-01-19 13:34:21 +00:00
Glenn L McGrath e6ae6e3d39 fix missed option argument for -I <device>, interface name checks
redesigned, patch by Nick Fedchik
2003-01-19 13:31:41 +00:00
Glenn L McGrath f2ba45e339 Compile option to avoid using /usr directory, patch by Bastian Blank 2003-01-19 12:55:13 +00:00
Glenn L McGrath 77c60e5c66 Use vsyslog instead of syslog, improve initalisation and cleanup of
variables, save 300 Bytes or so, patch by Vladimir N. Oleynik
2003-01-16 11:37:57 +00:00
Glenn L McGrath 8573704097 Fix leading spaces bug, free line buffer, redo next_word, save some
space.
2003-01-14 23:26:57 +00:00
Glenn L McGrath 147a3ca1a4 Patch for the debian-cvs package, ip* applets in /bin, patch from Bastian Blank 2003-01-14 21:41:12 +00:00
Eric Andersen fc4a0fd82e last_patch75_2 from vodz, 2003-01-14 18:13:13 +00:00
Eric Andersen 85d9d80db8 Ensure consistant sort order, sed behavior, etc
-Erik
2003-01-14 09:12:39 +00:00
Eric Andersen ab4e19afc6 Eliminate most instances where we use linux kernel headers
-Erik
2003-01-14 08:54:08 +00:00
Eric Andersen 92a06d0943 Clean config binsries on 'make clean' 2003-01-14 08:52:18 +00:00
Eric Andersen 8004bb7661 Eliminate use of kernel header file
-Erik
2003-01-14 08:06:07 +00:00
Eric Andersen e0716ba23b Fixup addgroup help text 2003-01-14 06:42:56 +00:00
Eric Andersen 4b525addb8 Only call free if it is necessary 2003-01-14 06:40:11 +00:00
Eric Andersen 65ddf77fbd Patch from Tito to rework strings applet, and some testsuite
stuff to test it added by me.
2003-01-13 23:19:31 +00:00
Glenn L McGrath b4a1baa312 Correct some init issues, update email address, last_patch78 by Vladimir
N. Oleynik
2003-01-13 22:09:50 +00:00
Glenn L McGrath d66370cd73 Option to allow ifupdown use ip commands instead of ifconfig, add flush
command to ipaddr, patch by Bastian Blank
2003-01-13 21:40:38 +00:00
Eric Andersen 4e486a5d00 Kiss Gabor noticed that ping compiled without BB_FEATURE_FANCY_PING
would return 0 instead of EXIT_FAILURE when no response was received.
2003-01-12 06:08:33 +00:00
Eric Andersen 1dcf218e60 Patch from Daniel J Walsh at redhat to make free work for systems
with more than 1 GB of memory...
2003-01-11 20:40:49 +00:00
Eric Andersen 575c78274a Patch from Robert Schwebel -- support ncurses installed in /usr/local 2003-01-11 18:07:38 +00:00
Eric Andersen b1c9469f65 Patch from Robert Schwebel fixing a missing \n 2003-01-11 18:06:02 +00:00
Eric Andersen aaab46baba Fix an obvious mistake 2003-01-11 18:02:51 +00:00
Eric Andersen f05fd444e8 Fix addgroup so it actually works
-Erik
2003-01-09 18:53:53 +00:00
Eric Andersen e931909d2d Additional patch from Tito to fix some anomolies 2003-01-09 14:36:26 +00:00
Glenn L McGrath 9e59841375 arping applet by Nick Fedchik 2003-01-09 10:06:01 +00:00
Glenn L McGrath dd3461af2f Make output the same as upstream, patch by Tito 2003-01-09 10:00:49 +00:00
Glenn L McGrath a69fd2ecf6 Patch by Stewart Brodie to terminate the string array correctly 2003-01-08 03:26:47 +00:00
Eric Andersen e40500f9cb Lineo has ceased to exist, and is no longer a sponsor. 2003-01-08 01:15:31 +00:00
Glenn L McGrath 7040ecc993 Minor cleanup, identified by Stewart Brodie, patch by Vladimir N.
Oleynik
2003-01-06 16:27:07 +00:00
Glenn L McGrath 4d00129d0f Correct column width for tab completion and ls 2003-01-06 01:11:50 +00:00
Glenn L McGrath 58c708af23 New applet: httpd, by Glenn Engel 2003-01-05 04:01:56 +00:00
Glenn L McGrath c2e74ca934 Prepare for new busybox-cvs upload 2003-01-05 02:02:02 +00:00
Glenn L McGrath ea2a1064b3 fixes for ia64 2003-01-05 00:43:00 +00:00
Glenn L McGrath 39dd4011e4 Sync with 20030104-2 cvs package, disable fdisk BSD label as they dont
compile on m68k
2003-01-04 13:45:42 +00:00
Glenn L McGrath 4dcc2ddfcc fdisk writable feature, allows compilation of a small fdisk that can
only read partition table, by Vladimir N. Oleynik
2003-01-04 11:56:06 +00:00
Eric Andersen 2c24bb80f9 Fix tab-tab listing of files so it properly reflects current
terminal width.
 -Erik
2003-01-02 07:25:47 +00:00
Robert Griebl 7ce75f44ae > Eliminate dependancy on kernel header files. Naughty naughty.
> Using linux kernel headers is a Bad Thing(tm) and should be
> punished.
>  -Erik

Doing this wrong should be punished even harder :)
 - Robert
2003-01-02 07:16:53 +00:00
Manuel Novoa III a6685585d8 Add "Broadcast +" support back in. Also cut the size down some. Not well
tested, but it is the holidays...
2002-12-27 17:42:01 +00:00
Glenn L McGrath 87444efbab Add usage for tar -j and -z 2002-12-27 00:45:35 +00:00
Glenn L McGrath d4c8d1a97f Sync with 20021214-1 debian package 2002-12-23 12:49:32 +00:00
Glenn L McGrath 76ff0da4d2 Support the obsolete '+' option 2002-12-23 11:54:56 +00:00
Glenn L McGrath c00c56e7c8 Fix STANDALONE_SHELL and ALWAYS_WIN options, last_path_73 by Vladimir N. Oleynik 2002-12-23 10:23:10 +00:00
Glenn L McGrath 0a65e190f4 Support the '=' command 2002-12-23 10:16:12 +00:00
Glenn L McGrath 4d7f965c8e Adjust for new .depend target 2002-12-20 10:06:38 +00:00
Glenn L McGrath e86e4a2282 busybox target wasnt checking .depend, clean kbuild binaries only on distclean 2002-12-20 06:03:47 +00:00
Glenn L McGrath 0f18271a8a Bugfix, wastn retrieving last block, patch by Jean-Christophe Dubois 2002-12-19 20:16:22 +00:00
Glenn L McGrath 1643f41986 When retrieving a file dont open file until we have to to prevent files of size 0 being created when retrieval fails, bug found by Jeff Angielski 2002-12-18 02:47:40 +00:00
Glenn L McGrath 688cf014af Get interface names using ioctl rather than /proc, from Nick Fedchik 2002-12-17 12:43:43 +00:00
Eric Andersen cf1fee06a5 Odd. I never brought this forward from bb.stable. Should handle
reaping child processes better.
 -Erik
2002-12-17 09:48:16 +00:00
Robert Griebl be2ae246fb Always print the routing table header for IPv4:
- this is consistent with IPv6 route
 - you can get very confused, if there are no routes and "route" prints
   nothing at all (not even "No routes" message)
2002-12-16 22:04:18 +00:00
Robert Griebl 53f133ac33 changed most assignments from ":=" to "=" to allow setting some variables
at the command line (this is also needed for cross-compilation)
2002-12-16 21:55:39 +00:00
Glenn L McGrath 275be87be7 Only included headers that are used. 2002-12-16 07:37:21 +00:00
Glenn L McGrath 1e132dd4dd fix warning 2002-12-16 06:40:37 +00:00
Tim Riker cf93274663 rmmod -a removed modules recursively 2002-12-14 01:58:59 +00:00
Tim Riker 6fe1960ff5 cleanup 2002-12-13 22:59:15 +00:00
Eric Andersen 068b6b07ff Don't build the ncurses stuff unless it is specifically asked for
-Erik
2002-12-13 22:53:28 +00:00
Tim Riker c118f99f73 use const group_file 2002-12-13 22:02:12 +00:00
Glenn L McGrath 8b08bda66b Fix bug when reading mac from command line, continue; if hwaddrr not found 2002-12-13 09:02:16 +00:00
Glenn L McGrath 25fe94fd32 Merge copyfd and copy_file_chunk 2002-12-13 08:20:44 +00:00
Glenn L McGrath a67dffe186 Change ftpput so it uses <remote-path> <local-file> as it should 2002-12-13 05:57:46 +00:00
Glenn L McGrath 3b33dd9b1e Fix possible bug if file length not known 2002-12-13 04:14:36 +00:00
Glenn L McGrath 02d7cbfe92 New applets, ftpget and ftpput 2002-12-13 02:43:50 +00:00
Glenn L McGrath f03c933e47 New applet, nameif by Nick Fedchik and myself. 2002-12-13 00:01:44 +00:00
Glenn L McGrath 9130c85847 full usage cleanup for udhcp 2002-12-12 12:56:18 +00:00
Glenn L McGrath 6ed77595f1 Update email address for Gennady Feldman <gena01@gena01.com> 2002-12-12 10:54:48 +00:00
Glenn L McGrath 6d07432b2f Support the o, f and p options, patch by Magnus M�rtensson 2002-12-12 10:31:53 +00:00
Eric Andersen b8dff0c2a2 Teach addgroup to add user names to groups 2002-12-12 08:57:16 +00:00
Eric Andersen b2bfd34a7b hehe. Screwed that one up. Lets do things right this time.
-Erik
2002-12-11 22:59:39 +00:00
Eric Andersen 1f1c3f9485 Makefile rework coordinate with Russ so udhcp will behave
-Erik
2002-12-11 22:45:33 +00:00
Russ Dill 54fde9ea5c slight change to reflect BB_VER change 2002-12-11 22:43:37 +00:00
Eric Andersen f4b273cbb4 A cleaner cleanup that avoids passing an off_t to scanf 2002-12-11 21:45:08 +00:00
Russ Dill 9f4395c54e sorry about all the noise, should be all synced up now 2002-12-11 21:40:46 +00:00
Russ Dill 920c1e8d6c another sync to udhcp cvs 2002-12-11 21:39:13 +00:00
Eric Andersen 9701411d21 squash a warning 2002-12-11 21:34:04 +00:00
Glenn L McGrath 49b0f86043 Fix -mtime, by Ian Abbott 2002-12-11 21:22:21 +00:00
Glenn L McGrath 4501dbe509 Small bugfix, last_patch72 from Vladimir N. Oleynik 2002-12-11 21:13:00 +00:00
Russ Dill 1eb7a17b12 resync with udhcp cvs 2002-12-11 21:12:45 +00:00
Eric Andersen d7e1a6c6eb Make sure we have a show_usage function prototype
-Erik
2002-12-11 07:46:30 +00:00
Eric Andersen 392947c860 Fixup all the horrible broken function prototypes
-Erik
2002-12-11 07:42:46 +00:00
Eric Andersen ece8fc2b9b Squash a warning by making function declaration a proper prototype 2002-12-11 04:26:28 +00:00
Eric Andersen 29f9b2fbdb Add missing header file to squash a warning 2002-12-11 04:25:02 +00:00
Eric Andersen 80ff9449bf Eliminate dependancy on kernel header files. Naughty naughty.
Using linux kernel headers is a Bad Thing(tm) and should be
punished.
 -Erik
2002-12-11 04:04:26 +00:00
Eric Andersen 0552b9a7ff Eliminate dependancy on kernel header files. Naughty naughty.
Using linux kernel headers is a Bad Thing(tm) and should be
punished.
 -Erik
2002-12-11 03:57:12 +00:00
Glenn L McGrath 84cc4e7e3e undefine sysinfo to prevent breakage on ia64 2002-12-11 03:55:52 +00:00
Eric Andersen acd244af1c Eliminate dependancy on kernel header files. Naughty naughty.
Using linux kernel headers is a Bad Thing(tm) and should be
punished.
2002-12-11 03:49:33 +00:00
Eric Andersen 8882ea53d5 Eliminate dependancy on kernel header files. Naughty naughty.
Using linux kernel headers is a Bad Thing(tm) and should be
punished.
 -Erik
2002-12-11 03:41:28 +00:00
Eric Andersen 39438c7c17 Fixup header file ordering 2002-12-11 03:40:10 +00:00
Glenn L McGrath b323162aab Use libbb/get_line_from_file instead of getline 2002-12-11 03:10:13 +00:00
Glenn L McGrath 11adab0535 Sync debian files with debian package version 0.60.99.cvs20021209-2 2002-12-10 11:28:40 +00:00
Glenn L McGrath 7b4e89b9e3 Fix undefined behaviour and save some bytes as suggested by Manuel Novoa III 2002-12-10 03:16:37 +00:00
Glenn L McGrath 38386d7fed include busybox after libc includes 2002-12-10 02:09:12 +00:00
Glenn L McGrath b72a735a32 rpm applet by Laurence Anderson 2002-12-10 00:17:22 +00:00
Glenn L McGrath 62fae308a3 Realpath applet 2002-12-10 00:14:33 +00:00
Glenn L McGrath 9bf9f1edbe Forgot to rename foo 2002-12-09 21:52:29 +00:00
Glenn L McGrath 919798d5a8 err.. Make clean in the scripts/config directory to remove some binaries 2002-12-09 21:16:39 +00:00
Glenn L McGrath a94c3108b1 Make clean in the scripts directory to remove some binaries 2002-12-09 21:14:38 +00:00
Glenn L McGrath 584baeb47d Stop linian warning about statically linked binary 2002-12-09 21:11:54 +00:00
Glenn L McGrath fad90db887 Fix a debug message, from Bastian Blank 2002-12-09 21:05:40 +00:00
Glenn L McGrath fdbbb04893 Command line history changes, lastpatch_71 from Vladimir N. Oleynik 2002-12-09 11:10:40 +00:00
Glenn L McGrath 6b5bd0e5ab Support using ip in udhcpc scripts.
Slightly modified version of patch by Bastian Blank
2002-12-08 22:17:54 +00:00
Glenn L McGrath c4698b3668 Updates for the new build system from Bastian Blank (waldi) 2002-12-08 20:45:47 +00:00
Glenn L McGrath a6bbf7929c Fix compile warning 2002-12-08 12:08:37 +00:00
Glenn L McGrath 35631a6e00 Fix compile warning with OSF 2002-12-08 11:51:05 +00:00
Glenn L McGrath e167d69309 Change #include order to fix warning 2002-12-08 11:47:52 +00:00
Glenn L McGrath 8e49caa54f Start to cleanup handling of the state file, save some space and uses linked lists. 2002-12-08 01:23:39 +00:00
Glenn L McGrath 66125c8065 Move add_to_list from libunarchive to libbb so it can be of more general use (eg ifupdown). Changed the name to llist_add_to as i plan on adding more llist_ functions as needed (e.g. llist_free). 2002-12-08 00:54:33 +00:00
Glenn L McGrath 346cdb1dde Re-sort filenames to alphebetical order. 2002-12-07 23:56:14 +00:00
Glenn L McGrath 4a6b4e393c Commit to reverse my previous commit, isnt cvs supposed to have some undo command ? 2002-12-07 23:30:11 +00:00
Glenn L McGrath 4e05b9b043 include "busybox" after the libc includes tofix compile errors 2002-12-07 23:14:40 +00:00
Glenn L McGrath 0325a1c9e3 Differentiate struct and type names 2002-12-07 07:45:42 +00:00
Glenn L McGrath 1d658263e8 Fix command that brings down loopback 2002-12-07 00:48:54 +00:00
Glenn L McGrath 80a60419f7 depends on for telnet and ipcalc 2002-12-06 23:11:30 +00:00
Glenn L McGrath 75360f951f It shouldnt depend on itself 2002-12-06 23:05:22 +00:00
Glenn L McGrath f795b027c6 Remove duplicate entry for kill 2002-12-06 22:45:07 +00:00
Glenn L McGrath 0337c467a0 Add some help descriptions 2002-12-06 22:40:54 +00:00
Eric Andersen a6b9051e16 Allow for people to select no default shell 2002-12-06 21:49:59 +00:00
Eric Andersen 110ee23515 Do the dumb/obvious thing for the killall->kill dependancy 2002-12-06 21:44:50 +00:00
Eric Andersen 27e99c8f09 Fixup dumpleases compile problem 2002-12-06 21:42:56 +00:00
Eric Andersen cc2bc454d1 Fix adjtimex applet compile 2002-12-06 21:41:09 +00:00
Eric Andersen b077c9f47d Fixup buffer allocation 2002-12-06 21:39:48 +00:00
Eric Andersen da15a496e2 Make hush comple once again 2002-12-06 21:37:08 +00:00
Glenn L McGrath 398ff9d981 Use libbb/get_line_from_file, change default state file location 2002-12-06 11:51:46 +00:00
Glenn L McGrath cdbe5e5d4c Make mapping a config option again to save space, turn off file locking, do we really need it ? 2002-12-06 08:35:55 +00:00
Glenn L McGrath 9227371b71 Fix bug that stoped -a working 2002-12-06 08:10:40 +00:00
Eric Andersen 83fdb317a7 Kill link now pointing to porn site. 2002-12-06 02:22:20 +00:00
Eric Andersen 23b5146247 Put stuff back into a sub-menu 2002-12-05 21:25:20 +00:00
Eric Andersen 536018278a Kill the now obsolete docs/Configure.help file, and move all existing
help texts into their respective Config.in file.
 -Erik
2002-12-05 21:12:42 +00:00
Glenn L McGrath f0a360ea19 Usage for klogd -c 2002-12-05 20:56:31 +00:00
Eric Andersen 08c358b604 Fix a silly oversight breaking cross compilation
-Erik
2002-12-05 18:28:41 +00:00
Eric Andersen c9f20d9fb9 Yet another major rework of the BusyBox config system, using the considerably
modified Kbuild system I put into uClibc.  With this, there should be no more
need to modify Rules.mak since I've moved all the interesting options into the
config system.  I think I've got everything updated, but you never know, I may
have made some mistakes, so watch closely.
 -Erik
2002-12-05 08:41:41 +00:00
Eric Andersen deca106b6d Kill CONFIG_FEATURE_USE_DEVPS_PATCH and the devps patch. I'm not
maintaining it anymore, and it is now terribly out of date.
 -Erik
2002-12-05 07:24:08 +00:00
Glenn L McGrath 6f9b45b9ef Unlink before mkdir, mknod, symlink to overwrite 2002-12-04 22:26:30 +00:00
Robert Griebl 350d26bbbb - the number of commands in the history list is now configureable via the
config system
 - added a new config option to allow persistant history lists. This is
   currently only used by ash, but the calls ({load,save}_history) could
   be added to the other shells as well.
2002-12-03 22:45:46 +00:00
Robert Griebl 3ba7ceebfc print an error message if we can't load a module 2002-12-03 22:41:36 +00:00
Glenn L McGrath 7127b58baa Fix crashme code, by Jim Treadway 2002-12-03 21:48:15 +00:00
Glenn L McGrath bf91f2eb1b Save 10 bytes or so, last_patch_70 from Vladimir N. Oleynik 2002-12-03 20:34:36 +00:00
Robert Griebl 69b5756594 A missing /etc/securetty is not an error when checking the tty name - the
comment is right, but the code was wrong ..
2002-12-03 19:54:12 +00:00
Glenn L McGrath 09adaca37d last_patch_69, 8 bit clean and other fixes from Vladimir N. Oleynik 2002-12-02 21:18:10 +00:00
Glenn L McGrath 06b1aeaf0a Its move to busybox-cvs-doc.docs 2002-12-02 21:14:56 +00:00
Glenn L McGrath 2626ef613e Use compare_string_array in ipaddress to save a few bytes, minor cleanups 2002-12-02 01:40:05 +00:00
Glenn L McGrath 18eae0031a Save a few more bytes 2002-12-02 00:54:10 +00:00
Glenn L McGrath c82f2324bd Save a hundred bytes or so on the do_iproute function 2002-12-02 00:35:23 +00:00
Glenn L McGrath b963875a3e Move compare_string_array to libbb 2002-12-02 00:01:36 +00:00
Glenn L McGrath f112daa232 Enable ip commands to be compiled seperate from ip, modifed patch from Bastian Blank 2002-12-01 23:04:06 +00:00
Glenn L McGrath f3faf41334 fix warning 2002-12-01 21:52:40 +00:00
Glenn L McGrath b9e57f45f3 Fix the package name, patch from Bastian Blank 2002-12-01 20:16:01 +00:00
Glenn L McGrath 941eb80795 Build files from Bastian Blank 2002-12-01 11:38:56 +00:00
Glenn L McGrath e1ad672216 add the -c option, modified version of a patch from Bastian Blank 2002-12-01 11:31:58 +00:00
Glenn L McGrath 6fc6d7fe4f Patch from Bastian Blank (waldi) for debian installer 2002-12-01 02:09:19 +00:00
Glenn L McGrath 4d4ef19c76 I miscalculated on this one, change it back 2002-11-28 21:49:06 +00:00
Glenn L McGrath 82d2cd4ead Clean up error messages 2002-11-28 12:45:48 +00:00
Glenn L McGrath 1b0813ab61 Minor error messages changes 2002-11-28 12:39:19 +00:00
Glenn L McGrath d4de975cd2 Cleanup error messages 2002-11-28 12:35:46 +00:00
Glenn L McGrath 8b6024449f Cleanup error messages 2002-11-28 12:19:51 +00:00
Glenn L McGrath e3e2a7b41c Syntax error 2002-11-28 12:01:25 +00:00
Aaron Lehmann a170e1c858 Change if(x)free(x); to free(x); 2002-11-28 11:27:31 +00:00
Glenn L McGrath 1652855fbc Style, error_msg 2002-11-28 11:17:19 +00:00
Glenn L McGrath eaed78a91f Style 2002-11-28 11:05:28 +00:00
Glenn L McGrath cdf142af90 Woops, forgot they printout applet name as well.... 2002-11-28 10:58:19 +00:00
Glenn L McGrath 9048ae5923 Use standard error messages 2002-11-28 10:56:38 +00:00
Glenn L McGrath df72536f8e Use error_msg instead of fprintf(stderr 2002-11-28 10:49:14 +00:00
Glenn L McGrath 68d949956a Use error_msg instead of fprintf(stderr 2002-11-28 10:35:40 +00:00
Glenn L McGrath b2e28a0e35 Use error_msg instead of fprintf(stderr 2002-11-28 10:27:50 +00:00
Glenn L McGrath b122217d90 Use error_msg( instead of fprintf(stderr 2002-11-28 10:25:19 +00:00
Glenn L McGrath 642f28903a Use error_msg instead of fprintf(stderr, other minor cleanups 2002-11-28 10:20:45 +00:00
Glenn L McGrath 30db423e11 Style, minor cleanups 2002-11-28 09:52:23 +00:00
Glenn L McGrath efdd0aed23 Use error_msg instead of fprintf(stderr 2002-11-28 09:40:36 +00:00
Glenn L McGrath d7d5f42934 Use error_msg instead of fprintf(stderr 2002-11-28 09:34:51 +00:00
Glenn L McGrath d4036f86e5 Use erorr_msg( isntead of fprintf(stderr, 2002-11-28 09:30:40 +00:00
Glenn L McGrath d211214d42 Use error_msg instead of printf(stderr 2002-11-28 09:22:14 +00:00
Glenn L McGrath fedbfe4059 Style 2002-11-28 09:09:47 +00:00
Glenn L McGrath 8e027f6474 Use printf instead of fprintf(stdout 2002-11-28 08:37:46 +00:00
Glenn L McGrath 6ead3abd55 Save a few bytes in show_usage 2002-11-28 08:33:04 +00:00
Glenn L McGrath 9c802416ab left out a \" 2002-11-28 00:51:38 +00:00
Glenn L McGrath 73ceca275e This test was hanging 2002-11-28 00:47:49 +00:00
Glenn L McGrath 2601559fb6 Adds a dummy entry to make it easier to make custom debs 2002-11-27 23:40:46 +00:00
Glenn L McGrath 10d905ce27 Install symlinks for the udeb, dont install changelogs for the udeb 2002-11-27 23:24:49 +00:00
Glenn L McGrath 062c74f710 last_patch_68 from Vladimir N. Oleynik 2002-11-27 09:29:49 +00:00
Glenn L McGrath ec87d37305 Check that one and only one of the [cxt] options is given 2002-11-27 07:52:22 +00:00
Glenn L McGrath 441e7efc72 fdisk applet by Vladimir N. Oleynik 2002-11-26 22:00:21 +00:00
Glenn L McGrath 0ff941e1c3 Name package busybox-unstable to keep a clean seperation between the official packages. 2002-11-26 09:05:15 +00:00
Glenn L McGrath 8ae4cab4a8 use #ifdef CONFIG_* instead of #if CONFIG_* 2002-11-26 09:02:06 +00:00
Glenn L McGrath c5dced17c5 Required file for busybox-doc package 2002-11-26 03:38:14 +00:00
Glenn L McGrath 2f79f5b60d Store a custom Rules.mak file to enable buildign static binaries 2002-11-26 03:08:31 +00:00
Glenn L McGrath efc6fbd452 use #ifdef instead of #if 2002-11-26 03:03:41 +00:00
Glenn L McGrath a2e24825a2 Include heaps of options as is tradional with this deb 2002-11-26 03:01:27 +00:00
Glenn L McGrath d7fb1b372c Use #ifdef instead of #if 2002-11-26 02:40:56 +00:00
Glenn L McGrath 2801eb925d Fix simple syntax error 2002-11-26 02:23:41 +00:00
Glenn L McGrath 12371f916b Make a seperate busybox-doc package 2002-11-26 02:16:06 +00:00
Glenn L McGrath f66de64a11 Use vfork instead of fork, some more cleanup from Vladimir N. Oleynik 2002-11-25 23:57:27 +00:00
Glenn L McGrath 393ad1a834 Handle name entries that have a \0 in them, last_patch_65 from Vladimir N. Oleynik 2002-11-25 22:31:37 +00:00
Glenn L McGrath bb2e9d47f3 last_patch_67 from Vladimir N. Oleynik 2002-11-25 22:12:28 +00:00
Glenn L McGrath 5b110874df Dont need a seperate function 2002-11-24 23:22:29 +00:00
Glenn L McGrath 822e7fd587 When making parent directories set permissions based on the base parent tree rather than the new directory to be created. 2002-11-24 22:48:20 +00:00
Glenn L McGrath eda4f53f2e Add an input buffer (currently 32kB) to speed things up heaps, it still requires 25% longer to decompress as compared to upstream. 2002-11-24 06:01:20 +00:00
Glenn L McGrath 7b1eca265a include libbb after stdlib.h as it breaks dmalloc 2002-11-24 01:32:56 +00:00
Glenn L McGrath b7a76df4d1 Fix long filename support 2002-11-23 10:44:47 +00:00
Glenn L McGrath 1b16bf6b1b New rules file for unstable 2002-11-23 07:14:55 +00:00
Glenn L McGrath 77dbaa48df Config file for the static deb, based on options from the stable 0.60.5 branch 2002-11-22 23:00:16 +00:00
Glenn L McGrath 2997fca414 Config file for the standard debian package based on 0.60.5 options 2002-11-22 22:16:19 +00:00
Glenn L McGrath 30a35d20d9 The tunnel option isnt required for the ip command 2002-11-22 21:43:08 +00:00
Glenn L McGrath f23fdf1717 Update configuration options 2002-11-22 11:39:42 +00:00
Glenn L McGrath 2f1f898228 Config file for udeb based on options from 0.60.5 2002-11-22 10:39:09 +00:00
Glenn L McGrath 157fea5960 Fix a vfork bug, by Nick Fedchik and Vladimir N. Oleynik 2002-11-21 22:17:11 +00:00
Glenn L McGrath 82701e4d67 Add entry for Laurence Anderson 2002-11-20 22:01:48 +00:00
Glenn L McGrath 83bf47c02f Speed and memory usage improvements from Laurence Adnerson 2002-11-20 22:00:31 +00:00
Glenn L McGrath 0126fda5bb read_gz patch 3 from Laurence Anderson 2002-11-20 06:46:46 +00:00
Glenn L McGrath efe7889086 Headers for the read_gz changes 2002-11-19 21:07:17 +00:00
Glenn L McGrath d1431073d1 Dont use xargs 2002-11-19 09:58:56 +00:00
Glenn L McGrath 83bcba26c0 dont use the -i option of xargs 2002-11-19 09:23:13 +00:00
Glenn L McGrath a0d395eac9 Use read_gz, remove fork() woohoo! 2002-11-19 08:22:03 +00:00
Russ Dill ae01fa99e1 udhcpc documentation update 2002-11-19 00:41:09 +00:00
Glenn L McGrath 50c00f4b45 Use error_msg_and_die, style 2002-11-18 07:26:42 +00:00
Glenn L McGrath 29d801b834 Remove mapping option, its should always be used 2002-11-17 21:48:11 +00:00
Glenn L McGrath fd73b8c2ce Patch from Laurence Anderson to provide a read_gz function, doesnt require fork(), pipe(), consistent with read_bz2 and more flexible. 2002-11-17 21:33:30 +00:00
Glenn L McGrath 36233bdd71 Remove #defines around get_header_ptr, we allways need it. 2002-11-16 21:34:57 +00:00
Glenn L McGrath 39289b54a7 Use vfork, by vodz 2002-11-15 22:18:01 +00:00
Glenn L McGrath 02fcd2d2df Allow short reads as we are looping anyway. 2002-11-15 21:58:30 +00:00
Eric Andersen 5780adb586 Patch from Bastian Blank:
hi erik

    the following patch fixes the handling of iproute add <route> dev <dev>.
    the code got lost while removing things.

    bastian
2002-11-15 09:12:47 +00:00
Glenn L McGrath 2666679692 Dont chdir untill after we open the archive 2002-11-15 08:48:47 +00:00
Eric Andersen 09eb000d7a Patch from Marcel Hamer to fix addgroup argument parsing 2002-11-14 11:10:14 +00:00
Eric Andersen f870148a04 A missing securetty file is not an error.
-Erik
2002-11-14 10:58:17 +00:00
Glenn L McGrath e356883ffb Minor cleanups 2002-11-13 00:24:20 +00:00
Glenn L McGrath 034c371bb2 Reduce block size to 512 to prevent short read's when reading from a pipe 2002-11-12 23:34:15 +00:00
Glenn L McGrath 9af8a72f10 Make ifupdown use internal run_parts 2002-11-11 07:03:02 +00:00
Glenn L McGrath 545106f8db Move awk from textutils to editors. Cleanup run-parts, saves 200 bytes, moves the guts of run_parts to libbb to be used by ifupdown. 2002-11-11 06:21:00 +00:00
Glenn L McGrath 8f0722a53b Move readlink, mktemp, run-parts and which to a new debianutils dir. 2002-11-11 03:00:12 +00:00
Glenn L McGrath c11986d89e ipcalc applet by Stephan Linz and Jordan Crouse 2002-11-10 23:42:27 +00:00
Glenn L McGrath 912d8f4cbc run through indent and manually check result 2002-11-10 22:46:45 +00:00
Glenn L McGrath f234e7c755 Config feature DEVPTS defined and used in telnetd, by Pavel Roskin 2002-11-10 22:26:19 +00:00
Glenn L McGrath e16860df08 Will the real od.c please stand up! (my previous commit was a mistake) 2002-11-10 22:16:09 +00:00
Glenn L McGrath 3ff3f4ac35 Fix for hostname -s, by Stephan Linz 2002-11-10 22:07:48 +00:00
Glenn L McGrath 59870e89ae Prevent a segfault if no argument, by Geoffrey Lee <glee@bluesat.unsw.edu.au> 2002-11-10 21:52:59 +00:00
Glenn L McGrath f57674e9a9 Rewrite of xargs by Vladimir N. Oleynik 2002-11-10 21:47:17 +00:00
Glenn L McGrath 907a240b1c last_patch57 from Vladimir N. Oleynik 2002-11-10 21:33:28 +00:00
Glenn L McGrath 5a7ec22c49 last_patch64 from Vladimir N. Oleynik <dzo@simtreas.ru> 2002-11-10 21:28:13 +00:00
Glenn L McGrath eebe31d997 Fixup a previous define 2002-11-10 13:20:35 +00:00
Glenn L McGrath 49a28b3b5e Make mapping support a definable feature, saves 1.6kB 2002-11-10 13:17:08 +00:00
Glenn L McGrath 8ae75013c8 Only compile the files in this dir if the IP applet is enabled 2002-11-10 10:20:45 +00:00
Glenn L McGrath 9a2d27249c IP applet by Bastian Blank <waldi@debian.org> 2002-11-10 01:33:55 +00:00
Glenn L McGrath 021fa7db91 debian compatable ifup and ifdown commands 2002-11-09 09:34:15 +00:00
Eric Andersen 7ab93d9980 Teach lash to get $1 $2 $3 etc correct
-Erik
2002-11-08 09:40:02 +00:00
Glenn L McGrath 5703341123 #ifdef, not just #if... grrr 2002-11-08 08:07:38 +00:00
Glenn L McGrath f6bf7a03fe Fix reading from stdin (me), Fix tar segfault when no arguments specified (Geoffrey Lee) 2002-11-08 07:09:42 +00:00
Eric Andersen b26674b2f8 Remove gratuitous and unnecessary "BusyBox" refernece in login prompt
-Erik
2002-11-07 02:45:55 +00:00
Eric Andersen 1713a11a26 Fix a stupid typo 2002-11-07 02:26:59 +00:00
Eric Andersen ef5e8f8de0 Implement a small strings applet 2002-11-07 02:09:37 +00:00
Eric Andersen f9496d4e44 Fix broken tabs 2002-11-07 02:06:58 +00:00
Glenn L McGrath 62d28828d6 Use a switch instead of successive if (strcmp()) statments. 2002-11-06 23:35:28 +00:00
Glenn L McGrath 747381c602 Split deb_extract() into more generic functions 2002-11-06 22:54:41 +00:00
Glenn L McGrath ea12202288 Terminate the buffer with a '\0' 2002-11-06 22:31:45 +00:00
Russ Dill 0288c8e543 typo in udhcpc help 2002-11-05 20:13:41 +00:00
Russ Dill da970859da version number oops 2002-11-05 20:10:21 +00:00
Glenn L McGrath d8d1191505 Support for bziped debs, i.e. use .tar.bz2 instead .tar.gz internally 2002-11-05 13:56:04 +00:00
Glenn L McGrath 7f2a95319b Fail silently if a partial tar header is read as tar.bz2 is leaving trailing junk (not sure why), add some missing files 2002-11-05 02:56:57 +00:00
Glenn L McGrath 18bbca18ac enable .tar.bz2 for dpkg-deb 2002-11-05 01:52:23 +00:00
Glenn L McGrath 8e94098423 Change filter paramaters, filters can be more powefull now 2002-11-04 23:47:31 +00:00
Glenn L McGrath f92caa7619 Call lseek directly rather than via data_align() 2002-11-03 14:14:53 +00:00
Glenn L McGrath 237ae42fc9 Abstract read and seek in unarchiving code, convert bunzip to file descriptors, support tar -j 2002-11-03 14:05:15 +00:00
Glenn L McGrath 2fc54a9258 Fix #define syntax 2002-11-03 12:50:33 +00:00
Glenn L McGrath 6ab32eb34c Move data_extract_all_prefix to dpkg, its only used there. 2002-11-03 11:57:10 +00:00
Glenn L McGrath b8e556e5f5 Add copyright notice and license, use strcat+strcpy instead of sprintf 2002-11-03 11:46:49 +00:00
Glenn L McGrath 9c60b29071 Use xread_char to save a few bytes, fix indenting of comments 2002-11-03 10:57:25 +00:00
Glenn L McGrath 60bce4905c Move bunzip2 idecompression code to libunarchive 2002-11-03 07:28:38 +00:00
Eric Andersen 97b141ac69 Test for holes in swapfiles
-Erik
2002-11-03 00:25:23 +00:00
Glenn L McGrath bf1cc8b1b7 Make uncompress a seperate applet so it doesnt pull in all the gunzip code 2002-11-01 23:38:54 +00:00
Glenn L McGrath d6aec8619d Allow short reads when filling compress buffer 2002-11-01 22:28:13 +00:00
Glenn L McGrath 9ef0944456 Allow the .Z prefix if compress support enabled 2002-11-01 22:11:53 +00:00
Glenn L McGrath b2f67b4068 Make it a fatal error if bad chksum or crc, if not we should return an error code 2002-11-01 22:08:59 +00:00
Glenn L McGrath 563ac6e789 Report errror if the first magic character doesnt match 2002-11-01 21:40:52 +00:00
Russ Dill f5ecd43473 sync to udhcp 0.9.8 2002-10-31 19:21:27 +00:00
Eric Andersen 1b6eb9b6eb Use a nifty macro to make testing gcc features simpler
and much easier to read.
 -Erik
2002-10-30 06:55:37 +00:00
Eric Andersen df5b8679a2 Formatting 2002-10-27 06:14:44 +00:00
Eric Andersen 69051e817c Update the webpage
-Erik
2002-10-27 06:08:30 +00:00
Eric Andersen db1df5ebeb last_patch64 from vodz:
The following usage from original user:
    $ ./busybox swapon -a
    Have typo problem:
    swapon: swapon: Operation not permitted

    But regular version:
    swapon: /dev/hda5: Operation not permitted

    Patch attached, reduced 9 bytes and advanced
    exit code also.
2002-10-26 10:27:42 +00:00
Eric Andersen fda2b7ff47 A patch from Jouni Malinen to avoid some buffer overflows in vi,
closing bug #1270
2002-10-26 10:19:19 +00:00
Eric Andersen 12f834ccfc Ivan Popov noticed that handling of PREFIX was bad.
-Erik
2002-10-26 10:17:24 +00:00
Eric Andersen 18921bd00d A bugfix from Danny Lepage:
It seems that under busybox unstable, "tar -c -f - blabla" create
    a tar file named "-" instead of writing to stdout.

    The included patch should fix this.
2002-10-26 10:05:37 +00:00
Eric Andersen 5ad22c933c This patch from Magnus Damm fixed a long standing problem
with freeing memory.
2002-10-25 12:14:02 +00:00
Eric Andersen 09da627a23 Fix warning 2002-10-22 22:15:33 +00:00
Eric Andersen 080ddc1c19 mjn3 noticed that crond and crontab had #include <pwd.h> and #include <grp.h>
but this conflicted with the internal pwd_.h and grp_.h.  Removing these
headers is correct, since the correct pwd/grp headers will be included via
busybox.h
 -Erik
2002-10-22 20:08:51 +00:00
Eric Andersen 5e02c67331 vodz forgot to include the suid field 2002-10-22 20:01:08 +00:00
Eric Andersen fe5b1a9f3c Apply patch from bug #1278 -- fix usage message for the
start_stop_daemon applet.
2002-10-22 19:21:48 +00:00
Eric Andersen 72e1212ad8 vodz writes:
Oops... Last patch 63 have small typo (stable/devel) mixing.
    Attached patch removing lines from TODO also :)
2002-10-22 19:19:13 +00:00
Eric Andersen f02c26f1ef I committed the fflush in the wrong spot. I should go to bed
earlier so I don't screw up such easy stuff.
 -Erik
2002-10-22 19:15:43 +00:00
Eric Andersen f6f7bfb8e0 last_patch63 from vodz: add in crond and crontab applets 2002-10-22 12:24:59 +00:00
Eric Andersen 44608e9693 Patch last_pach62 from vodz. This patch moves all the /proc parsing
code into libbb so it can be shared by ps, top, etc, saving over 1.5k.
2002-10-22 12:21:15 +00:00
Eric Andersen 1887b0478f Apply last_patch51_3 from vodz 2002-10-22 11:58:59 +00:00
Eric Andersen 5956028f6f Be absurdly careful about flushing stdout. 2002-10-22 11:45:20 +00:00
Glenn L McGrath 9ffd5776eb Move unzip.c uncompress.c from libbb to archiveal/libunarchive 2002-10-22 01:07:32 +00:00
Glenn L McGrath 0d53ebdc52 gz_open is used anymore, use inflate directly, see how its done in get_header_tar_gz 2002-10-21 06:29:55 +00:00
Glenn L McGrath 4298e87fa5 Dont try and make the "/" directory 2002-10-19 23:56:41 +00:00
Glenn L McGrath 61b7904afd Update dpkg to use new unarchive code 2002-10-19 10:40:55 +00:00
Glenn L McGrath c5c1a8a112 Fix exclude/include problem 2002-10-19 06:19:22 +00:00
Glenn L McGrath 05fa661123 Find a string in a list 2002-10-19 05:10:51 +00:00
Glenn L McGrath 25bca9566d Remove entries from the accept list as they are matched so we can determine if any files that were specified in the list wernt found. 2002-10-19 02:18:51 +00:00
Glenn L McGrath 98f824aa22 Dont use absolute pathname (dunno why i did that), fix tar filename/stdin problems 2002-10-19 00:46:35 +00:00
Glenn L McGrath 934805aec1 Put bac kthe code that handles cases where a '-' wasnt specified prior to the options. 2002-10-18 23:59:40 +00:00
Eric Andersen 2a2ab1479c Fix an obvious thinko
-Erik
2002-10-18 22:31:02 +00:00
Eric Andersen 431a18497d disambiguate a test 2002-10-18 22:18:10 +00:00
Eric Andersen 31f9747a23 Fix needless formatting differences vs modutils 2002-10-18 22:14:07 +00:00
Eric Andersen d69e31fb93 Fix needless difference vs GNU 2002-10-18 22:13:23 +00:00
Russ Dill 1977a60de4 missed add for udhcp 2002-10-14 21:47:07 +00:00
Russ Dill 61fb48930f added full udhcp integration 2002-10-14 21:41:28 +00:00
Eric Andersen 9060a73159 Doh! I screwed up applying vodz' patch.
-Erik
2002-10-12 04:16:08 +00:00
Eric Andersen e8a90fb2bc After thinking about it, I think this patch from Matt Kraai is probably the
best way to go.  Sysvinit does not provide a controlling tty since it doesn't
even try to open ttys for apps.  We do.  So we should _try_ to provide a
controlling tty if possible, but we needn't freak out if it doesn't work.  This
way we won't need to use openvt or similar, we'll just have init do the Right
Thing(tm).
2002-10-12 04:05:48 +00:00
Eric Andersen 71ae64bdc6 last_patch61 from vodz:
New complex patch for decrease size devel version. Requires previous patch.
    Also removed small problems from dutmp and tar applets.
Also includes vodz' last_patch61_2:
    Last patch correcting comment for #endif and more integrated
    with libbb (very reduce size if used "cat" applet also).
    Requires last_patch61 for modutils/config.in.
2002-10-10 04:20:21 +00:00
Eric Andersen fdfe298a96 last_patch60 from vodz:
login and getty applets writes utmp/wtmp but init do clearing not.
    I think, in current time deny wtmp/utmp writes as undefault features.
2002-10-10 03:55:09 +00:00
Eric Andersen d274b53c1d last_patch59 from vodz to cleanup chmod and correctly parse '-rwxgoa' 2002-10-10 03:47:01 +00:00
Eric Andersen 1bb1e83454 last_patch58_2 from vodz -- add FEATURE_CPU_USAGE_PERCENTAGE option 2002-10-10 03:44:12 +00:00
"Steven J. Hill" adb058b0de Fixed the script. It always put output to 'stdout' and never to
the 'modules.dep' file.
2002-10-08 21:33:51 +00:00
Eric Andersen a39342b131 Remember to delete docs/busybox.pod 2002-10-08 19:31:04 +00:00
Eric Andersen 528649463f Fix missing \n noticed by Robert Schwebel 2002-10-08 09:38:07 +00:00
Glenn L McGrath 2983330512 Fix segfault when testing if reaidng from stdin "-" 2002-10-06 23:25:23 +00:00
Eric Andersen e0f5500bb5 Fix init docs 2002-09-30 20:59:33 +00:00
Eric Andersen 506177df7f Bugfix from Claudio Fleiner <claudio@fleiner.com> 2002-09-30 20:53:38 +00:00
Eric Andersen 08a72209c9 last_patch58 from vodz:
Ok. I generate patch for include to busybox-devel my work with
    top (original author give me maintaining) and telnetd (my
    support and unofficial maintaining) applets.  Docs changes
    also: added awk, netstat, time applets to list ;)
2002-09-30 20:52:10 +00:00
Eric Andersen 02e6ba91e8 Vodz' last_patch57:
Hi, Erik.

    my_getpw(uid/gid) and applets used it have problem:
    if username for uid not found, applets can`t detect it
    (but code pessent). Also "%8ld " format is bad:
    spaces not required (applets have self format
    or spec format (tar applet) and overflow for "id" applet...)
    This problem also pressent in stable version.
    Patch for unstable in attach.

    --w
    vodz
2002-09-30 20:39:56 +00:00
Eric Andersen a6f6e06107 Fix dependancy so we rebuild busybox.o, usage.o and busybox.o
whenever the config changes.
 -Erik
2002-09-30 20:39:12 +00:00
Eric Andersen ad082987d0 Use %m, not strerror, and strerror(err) was broken anyways and should have been
strerror(errno).  Problem noted by Alexey V. Neyman <alex.neyman@auriga.ru>
2002-09-30 20:20:20 +00:00
Eric Andersen d9d47c3078 Patch from Konstantin Isakov <ikm@pisem.net>:
In most cases, dirname returns the same argument it was given, so this code
    works nice, but there's one special case: when the name contains no
    dirname, it returns "." (stored statically in the body of itself), and we
    get a segfault in attempt to free() it.
This patch fixes this problem.
2002-09-30 20:14:57 +00:00
Eric Andersen aa1d6ccbfb Don't even try to run ash on uClinux. It won't work.
-Erik
2002-09-30 20:12:32 +00:00
Eric Andersen 6a9799020b Set the close-on-exec flag, just to be saf 2002-09-30 20:08:53 +00:00
Eric Andersen e4d2a43951 Doh. We divide microseconds by 60? 2002-09-30 19:37:48 +00:00
Glenn L McGrath 5c99581880 Save status so we know if to delete compressed file 2002-09-30 05:30:29 +00:00
Glenn L McGrath 924f93e848 make_directory() will fail instantly so we dont need to test for failure here 2002-09-28 08:32:14 +00:00
Glenn L McGrath 891ee641cb Fail straight away rather than recursively printing error messages :) 2002-09-28 08:30:47 +00:00
Glenn L McGrath 8132e933e6 Fix for using '-' as the filename when reading from stdin 2002-09-28 02:06:39 +00:00
Eric Andersen 92052e3945 Bug fix from Nitin Gupta <gupta@equator.com> 2002-09-27 23:34:53 +00:00
Glenn L McGrath 2e41d0cb77 Fix compress support and prevent a segfault 2002-09-27 06:46:02 +00:00
Glenn L McGrath a47a3eada6 Fix simple define problem 2002-09-26 16:01:21 +00:00
Eric Andersen 6f2ebcaa01 Avoid calling exit() from within fork/vfork'ed processes.
-Erik
2002-09-26 13:59:40 +00:00
Eric Andersen a920871c3a Ignoring SIGCHLD causes a race leading to the occasional hang of init
when init will wait() on itself in waitfor() when the child exits before
init is scheduled to run.  Letting init hang is very seriously bad.
 -Erik
2002-09-25 15:08:40 +00:00
Glenn L McGrath 5a66b640f9 Reverse some minor changes that got caught up in my big unarchive patch 2002-09-25 06:08:19 +00:00
Glenn L McGrath 69eab26401 Remove files made obsolete by new unarchiving code 2002-09-25 03:04:03 +00:00
Glenn L McGrath 7ca04f328e New common unarchive code. 2002-09-25 02:47:48 +00:00
Eric Andersen ecfa290cfd Fixup largefile settings
-Erik
2002-09-22 12:09:44 +00:00
Glenn L McGrath b3f7261ffe Fix error messages conditions, and make them the same as GNU mkdir. 2002-09-22 02:12:30 +00:00
Eric Andersen 3a1d8377ab don't leak FILEs 2002-09-20 07:33:18 +00:00
Eric Andersen 19feada06f update the noise a tiny bit 2002-09-18 20:52:26 +00:00
Eric Andersen 7695b7b5f4 Update webpage 2002-09-18 20:48:20 +00:00
Manuel Novoa III d499330e9e Commit vodz's patch, plus a tweak to change TracePid to TracerPid. Now
works on i386 (2.4.19) and arm (2.4.6).
2002-09-18 19:27:10 +00:00
Eric Andersen 06c35da6af patch from John Hall <john.hall@optionexist.co.uk> to change the
klogd specific messages to facility LOG_SYSLOG and tidies up some
of the priorities.
2002-09-18 14:23:06 +00:00
Eric Andersen 420b208a45 Add a new top applet
-Erik
2002-09-17 22:14:58 +00:00
Eric Andersen 793c3b4a7d Clear screen too. 2002-09-17 21:21:27 +00:00
Eric Andersen dc180d1442 re-enable the cursor, in case it got disabled
-Erik
2002-09-17 21:17:35 +00:00
Manuel Novoa III 6c32a8add4 Modified so that it "works" for archs other than i386... arm in particular.
Also tried to clean up the logic a little, and ensure that read errors
or invalid archives resulted in error returns.  This could use a lot more
work... Volunteers?
2002-09-17 21:02:16 +00:00
Eric Andersen 60943c5d5c Sane-ify the screen clearing stuff.
-Erik
2002-09-17 20:53:41 +00:00
Eric Andersen 39ad2833c0 hehe. 2002-09-17 20:35:58 +00:00
Eric Andersen 871d93c462 Vodz' last_patch57:
Ok. Patch with reduce size ready.
    Notes: syslogd imposible close logsocket,
    the real programm write logmessages (hmm, cycle loop?)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1) busybox.c: fix warining
    2) docs/: add applets for list from pwd_grp
    3) usage.h: add -n option for route
    4) run_parts.c: many todo fix for busybox style
    5) addgroup.c: add #ifdef CONFIG_FEATURE_SHADOWPASSWDS, reduce one
    perror_msg
    6) adduser.c: fix bug "variable i not initialize" and
       add #ifdef CONFIG_FEATURE_SHADOWPASSWDS
2001-12-18 14:06:03 +00:00
Eric Andersen f3f9062ecf Things like 'tar -c /tmp/*' and 'tar -cO /tmp/*' where the output
filename was not explicitly specified were segfaulting.
 -Erik
2001-12-18 00:57:55 +00:00
Eric Andersen 730f826f25 Add in a new restart init target, triggered by SIGHUP. Patch from
Russ Dill, with adjustments by me.
 -Erik
2001-12-17 23:13:08 +00:00
Matt Kraai ace02dc9cd Make cp and mv optionally preserve hard links. 2001-12-17 15:26:36 +00:00
Eric Andersen 46ea0e4696 * Add ^L clear to shell 2001-12-16 09:25:57 +00:00
Eric Andersen 6925d50176 Some minor usage cleanups from David Douthitt <ssrat@mailbag.com> 2001-12-16 09:23:09 +00:00
Eric Andersen de2a342289 Add a more verbose non-strip command. 2001-12-16 09:20:08 +00:00
Matt Kraai e62dc86bc7 Add support for big-endian ARM (initial patch by Mike Voytovich). 2001-12-14 16:08:17 +00:00
Matt Kraai 04ae328851 Update uClibc URL. 2001-12-12 19:09:51 +00:00
Matt Kraai 14b7c5d12b Open the source before creating the destination. 2001-12-11 16:43:48 +00:00
Matt Kraai 741f40b58e Use an int to hold the result of fgetc (bug noted by David Kimdon). 2001-12-11 16:06:02 +00:00
Eric Andersen 72812d3143 And a bit more 2001-12-08 02:14:02 +00:00
Eric Andersen a2e6908165 More polish 2001-12-08 02:13:05 +00:00
Eric Andersen 90c2abd212 Oops 2001-12-08 02:10:37 +00:00
Eric Andersen dec43433e5 Add in cvs info 2001-12-08 02:08:31 +00:00
Eric Andersen 2423b12dae Begin moving things to busybox.net
-Erik
2001-12-08 01:56:15 +00:00
Eric Andersen 05b5addcaa Use a local image, not an offsite one. 2001-12-08 00:18:20 +00:00
Matt Kraai 07a37aebf5 New. 2001-12-07 21:27:57 +00:00
Matt Kraai dba11452cb Continue processing files if we are asked to touch, but not create, a file
which doesn't exist.
2001-12-07 21:27:38 +00:00
Matt Kraai 1a781a499f Enable test only if CONFIG_FEATURE_GREP_EGREP_ALIAS is defined. 2001-12-07 21:24:25 +00:00
Eric Andersen 603557b466 Fix link name 2001-12-07 19:01:31 +00:00
Eric Andersen 089db51fbe Fix broken link 2001-12-07 19:00:30 +00:00
Matt Kraai 3eeab3b23f Update copyright and close file descriptors (noted by Axel Kittenberger). 2001-12-07 16:27:37 +00:00
Eric Andersen 6834ee941a Avoid NULL pointer problems. Patch from "Frank P. MacLachlan"
<fpm-plutus@tgs.indyme.com>
2001-12-06 21:33:55 +00:00
Matt Kraai 54805af092 Remove documentation for the --file option to hostname (noted by
David Douthitt).
2001-12-06 17:37:51 +00:00
Eric Andersen c98c06233e Merge in the cal applet from Steve Merrifield <steve@labyrinth.net.au> 2001-12-06 15:16:43 +00:00
Eric Andersen b24d65659f If find_pid_by_name() had an error, it was returning -1, but storing
that into a pid_t, which is unsigned on a number archs.  Furthermore,
find_pid_by_name() would _never_ return an error if the intended proces
was "init", but instead would return 1, meaning we would fail to work
on 2.4.x kernels running an initrd...
 -Erik
2001-12-06 14:52:32 +00:00
Eric Andersen 06656f363d Minor adjustment to the strip command 2001-12-06 14:44:11 +00:00
Eric Andersen db930948a9 More copyright and email addr cleanups 2001-12-06 08:20:14 +00:00
Eric Andersen 463304edfd Silly cosmetic problem in the comment 2001-12-06 08:04:45 +00:00
Eric Andersen 356b6dbf86 Patch from Steve Merrifield <steve@labyrinth.net.au> to
fixup the merge of the time applet, which I messed up.
 -Erik
2001-12-06 07:42:04 +00:00
Eric Andersen 0ee0a8d539 Fix running more on files in the (broken) procfs that claim 0 length
when that isn't actually true.
 -Erik
2001-12-06 07:24:29 +00:00
Aaron Lehmann b6ecbdc07d The ash ansification diff!
Please tell me if you notice any problems resulting from this.
2001-12-06 03:37:38 +00:00
Aaron Lehmann ebd8065f38 Trying to commit Changelog and TODO. cvs is being weird :/ 2001-12-06 03:32:12 +00:00
Aaron Lehmann 2dd2d7a37d Patch to avoid warnings 2001-12-06 03:29:37 +00:00
Aaron Lehmann b9df470c4d Commit my improvement on Rodney Brown's patch to g(un)zip, decreasing
binary size.
2001-12-06 03:22:43 +00:00
Glenn L McGrath 249f39a265 Simplify unzip(), remove unused checks and unneccessary variables 2001-12-05 16:01:02 +00:00
Glenn L McGrath ef03dbcd4d Simplify CRC table generation 2001-12-05 13:08:03 +00:00
Glenn L McGrath aad44fb37a Fix some fegfaults and picket fence 2001-12-05 04:40:52 +00:00
Manuel Novoa III 3280f9a3fc New version to cut size. Includes optional basename() compatibility, but
enabling that would break the basename applet at least for one corner case.
2001-12-05 04:35:32 +00:00
Manuel Novoa III 6509f92a3b Combined size reduction changes by Glenn and myself. Added back in "unknown"
for -p to match normal uname behavior (at a cost of 30-40 bytes).
2001-12-05 04:21:30 +00:00
Glenn L McGrath 1dbbd2fe34 Fail gracefully if package depends on a virtual package. 2001-12-05 04:10:14 +00:00
Eric Andersen ed8a9be287 Patch from Dan Langlois <dan@somanetworks.com> Support SIGSTOP/SIGCONT
for wierd situations when people want init to actualy stop doing
anything for a while...
2001-11-30 19:10:58 +00:00
Eric Andersen c3657428d3 Add in a 'time' applet. Adds 4.5k.
-Erik
2001-11-30 07:54:32 +00:00
Glenn L McGrath 38288bbf4c gunzip was incorrectly reporting a failed crc and length (discovered by
Chang, Shu-Hao).  The bitbuffer needs to be unwound after decompression,
as it was eating into the crc/size field.
2001-11-29 06:36:56 +00:00
Matt Kraai 8a35c9a557 Add space before module name (noted by Ron Yorston). 2001-11-27 17:28:01 +00:00
Glenn L McGrath 9e6c9f7311 Minor space saving improvments 2001-11-21 12:46:36 +00:00
Glenn L McGrath 74afa9aed1 When just counting chars of a file stat file instead of reading the whole file (Fixes Debian bug #103302) 2001-11-21 10:26:28 +00:00
Glenn L McGrath c29ab97094 woops. dotn pass NULL 2001-11-21 10:01:29 +00:00
Glenn L McGrath 1477ad8e83 Simplify print function, prints an extra space if no filename, but saves 4 bytes 2001-11-21 09:58:29 +00:00
Glenn L McGrath 02d090d3d2 Use enums for selected functionality, Reduce the size by nearly 100 Bytes 2001-11-21 09:17:00 +00:00
Eric Andersen 2480e3a30a Fix dangling comma 2001-11-21 09:05:31 +00:00
Matt Kraai 1dbd6ff80f New. 2001-11-20 16:04:22 +00:00
Matt Kraai 585f657e2d Fix undeclared variable error. 2001-11-20 16:00:44 +00:00
Matt Kraai 0c390a76fe Eliminate warning. 2001-11-20 16:00:19 +00:00
Matt Kraai fd3f1be57f New. 2001-11-20 15:49:55 +00:00
Matt Kraai 355a61b56f Treat NUL as the end-of-line. 2001-11-20 15:49:50 +00:00
Eric Andersen 66c22051f9 More grammar fixes 2001-11-20 12:40:37 +00:00
Eric Andersen dbdc0d5da9 grammer error 2001-11-20 12:36:28 +00:00
Eric Andersen 4d7f9c3d99 Update the website 2001-11-20 11:56:51 +00:00
Eric Andersen 4b8a1e89a5 Fix email addr 2001-11-20 11:41:37 +00:00
Eric Andersen f435a918fa S390 wierdness 2001-11-20 05:42:57 +00:00
Eric Andersen 81ee96fe62 Usr get_last_path_component() name basename() 2001-11-20 00:23:48 +00:00
Eric Andersen c36642195c Include time.h 2001-11-20 00:15:27 +00:00
Eric Andersen edc6e0248c Oops. doubled myself 2001-11-19 23:50:18 +00:00
Eric Andersen 372f12678e Note tinylogin TODO items 2001-11-19 22:51:41 +00:00
Matt Kraai efd7f03657 Fix opt type in dpkg (closes: #118975). 2001-11-19 21:07:15 +00:00
Matt Kraai 4e05da89f3 Add a check target. 2001-11-19 19:47:56 +00:00
Matt Kraai 36c613a443 Update usage instructions, and document test case format. 2001-11-19 19:28:56 +00:00
Matt Kraai 9dfe508a3f New. 2001-11-19 19:00:13 +00:00
Matt Kraai c2d6ca0922 Fix misspelling. 2001-11-19 18:44:58 +00:00
Matt Kraai 03bb3088b0 New. 2001-11-19 15:13:12 +00:00
Eric Andersen 6f8b7ea452 oops 2001-11-19 11:45:39 +00:00
Eric Andersen 55805bcba4 More scrubbing 2001-11-19 10:59:37 +00:00
Eric Andersen d81891a2e6 Call xmalloc before realloc 2001-11-19 10:49:30 +00:00
Eric Andersen 43626d7671 Fixup CLEANUP behavior 2001-11-19 10:36:20 +00:00
Eric Andersen cc05ce64e9 Update webpage 2001-11-18 15:49:26 +00:00
Glenn L McGrath fff11f1ab7 bzcat and bunzip -c support from Thomas Lundquist 2001-11-18 14:20:25 +00:00
Eric Andersen fedce06b7f Hide some ifdefs to make it more readible 2001-11-17 07:27:14 +00:00
Eric Andersen 9c6b5fcb0a Minor warning cleanups 2001-11-17 07:23:46 +00:00
Eric Andersen bff7a60f63 Patch from "Andrew Tipton" <andrew@cadre5.com> to enable vi cursor
keys while editing.
2001-11-17 07:15:43 +00:00
Eric Andersen 80f5ac7016 Patch from Steve Merrifield <steve@labyrinth.net.au> to make vi
use xmalloc
2001-11-17 06:57:42 +00:00
Eric Andersen 26f8e95d2d David Kimdon <dwhedon@instant802.com> noticed a thinko
in md5sum where only binary sums were verified.  He also
sent in this patch,
 -Erik
2001-11-17 04:16:15 +00:00
Matt Kraai 5c2bbb55d7 Remove unnecessary errno handling. 2001-11-12 18:44:26 +00:00
Matt Kraai 6c5fdfaf56 New. 2001-11-12 18:42:57 +00:00
Matt Kraai a21c24bf03 Convert strdup call to xstrdup, and calloc calls to xcalloc (patch from
Steve Merrifield).
2001-11-12 16:58:07 +00:00
Matt Kraai c8227639db Change strdup calls to xstrdup (patch from Steve Merrifield). 2001-11-12 16:57:27 +00:00
Matt Kraai 357cfc739e Brag. 2001-11-12 16:45:43 +00:00
Matt Kraai 9fb38f600c Eliminate unused variable warnings. 2001-11-12 16:45:23 +00:00
Matt Kraai a5f09c668e Use fopen wrapper. 2001-11-12 16:44:55 +00:00
Eric Andersen c5f9a9dd0c Add redhat and slackware 2001-11-10 13:38:36 +00:00
Eric Andersen 31ac3b7764 Add in Redhat 2001-11-10 13:35:27 +00:00
Eric Andersen 45784febaf Some more minor build cleanups 2001-11-10 13:08:02 +00:00
Eric Andersen dba4e6f046 Add in grep -E support 2001-11-10 12:54:00 +00:00
Eric Andersen c223ced0ea I forgot to add these. Part of the patch from vodz 2001-11-10 12:18:42 +00:00
Eric Andersen 282671bf76 Cleanup some config problems. Add a sane default config that basically
matches the default old Config.h
2001-11-10 12:07:24 +00:00
Eric Andersen 30fcef430c Only use -mpreferred-stack-boundary with gcc versions that support it 2001-11-10 11:23:47 +00:00
Eric Andersen cd8c436d81 Latest patch from vodz:
-- reverse resolve network name and cache in route and ifconfig
	applets, fix print nslookup server name if compile without
	uClibc, fix route crashe 'route add', fix warnings compile
	networking and pwd_grp applets
2001-11-10 11:22:46 +00:00
Eric Andersen 94f19a8385 oops 2001-11-10 11:17:17 +00:00
Eric Andersen 744a194f53 Can't use RESERVE_CONFIG_BUFFER here since the allocation
size varies meaning BUFFERS_GO_ON_STACK will fail
2001-11-10 11:16:39 +00:00
Eric Andersen c52a6b0f10 |2001-10-08 Rodney Brown <rbrown64@csc.com.au>
|
|       * editors/sed.c: Fix multiline [aic] commands. Make # an endline
|       comment for compatibility. Codespace reduction.
|       * tests/testcases: Cope with move to subdirectories.
|       * testsuite/sed/sed-aic-commands: Add.
|
|   text           data     bss     dec     hex filename
|   3772             16       0    3788     ecc editors/sed.o
|   4516             16       0    4532    11b4 editors/sed.o.bu
2001-11-10 10:49:42 +00:00
Eric Andersen e5d58c3dcc Mention that glibc-2.2 is supported 2001-11-10 10:46:42 +00:00
Eric Andersen 882cbcdfa1 more config.in entries from Giulio Orsero <giulioo@pobox.com>
with some minor edits by me.
2001-11-10 10:43:09 +00:00
Eric Andersen 7131213460 config.in features patch from Giulio Orsero <giulioo@pobox.com>
with some minor edits from me
2001-11-10 09:53:23 +00:00
Eric Andersen df23302cb5 Remove comments about 'make bzImage' 2001-11-07 07:50:08 +00:00
Eric Andersen 5abdaa9a16 Force main to always be included 2001-11-06 18:45:56 +00:00
Eric Andersen 3c513e3858 Fix spelling 2001-11-05 23:10:48 +00:00
Glenn L McGrath 0a25b35c66 Fix create list segfault 2001-11-03 08:29:35 +00:00
Glenn L McGrath 55b2deda08 Required for od and hexdump applets 2001-11-02 11:40:44 +00:00
Glenn L McGrath 60281118d0 Introduce od and hexdump applets 2001-11-02 11:39:46 +00:00
Matt Kraai b89637a037 New. 2001-10-31 16:36:23 +00:00
Matt Kraai 5447f17ef9 Remove completed task. 2001-10-31 16:36:02 +00:00
Matt Kraai f419855300 Mark as unsupported unless CONFIG_FEATURE_TAR_EXCLUDE is defined. 2001-10-31 16:18:48 +00:00
Matt Kraai bb0088e980 Make egrep only set REG_EXTENDED flag. 2001-10-31 16:16:31 +00:00
Eric Andersen 8fc0589777 *** empty log message *** 2001-10-31 11:45:10 +00:00
Eric Andersen f46999f8bc Fix location of Configure.help 2001-10-31 11:12:25 +00:00
Eric Andersen 1552ff7efb Move usage.h to include/usage.h 2001-10-31 11:07:12 +00:00
Eric Andersen ec07469a3e Patch from Aaron Lehmann <aaronl@vitelus.com>;
This diff does 2 things:

    1) removes an unnecessary function. saves 64 bytes on i386

    2) allows you to disable checking of mail (actually, it's now disabled
    by default). this would be a nice CML1 option, but for now it's a
    #(define|undef) in the C file like the other internal ash options.
    this saves an additional 352 bytes if you leave mail disabled.
2001-10-31 11:05:49 +00:00
Eric Andersen 31a0ece3a7 Add netstat applet, submitted by Bart Visscher <magick@linux-fan.com> 2001-10-31 11:00:46 +00:00
Eric Andersen 7d6829096d Add the run-parts applet submitted by Emanuele Aina
<emanuele.aina@tiscali.it>
2001-10-31 10:59:29 +00:00
Eric Andersen eaecbf33f7 Fixup some silly prototype warnings 2001-10-31 10:41:31 +00:00
Eric Andersen 69a20f0aca Patch from ASA <llb@udm.net.ru> to that source files
are properly passed their arguments.
2001-10-31 10:40:37 +00:00
Eric Andersen 6cf47a79ac Run parts applet by Emanuele Aina <faina.mail@tiscalinet.it> 2001-10-31 10:24:36 +00:00
Eric Andersen 2bc4dec7a1 Document CONFIG_RUN_PARTS, patch from Emanuele Aina <faina.mail@tiscalinet.it> 2001-10-31 10:21:17 +00:00
Eric Andersen a58f040a37 Add Gennady Feldman 2001-10-31 10:04:44 +00:00
Eric Andersen 85dd4b3b27 start-stop-deamon is done 2001-10-31 10:04:04 +00:00
Eric Andersen ccd96f1972 Patch from Charles Steinkuehler <charles@steinkuehler.net>
to properly handle extended regexps for egrep
2001-10-31 10:02:46 +00:00
Eric Andersen 3d61b10595 Major cleanup from Charles Steinkuehler <charles@steinkuehler.net>:
- Switched to getopt argument parsing
    - Added -f option to get fully qualified domain name
    - Fixed the -s (short) and -d (domain) options, which were not
      doing a gethostbyname lookup to get the FQDN before trying to
      separate the local and domain portions of the hostname.
    - Fixed probem with 'agressive setting' of the hostname...the
      previous busybox version would try to set the hostname if called
      with a non-option argument, or the -F option, even if another
      option (like -i or -s) was given.  This behavior does not match
      the net-tools hostname, which does not attempt to set anything if
      given a 'display' option, regardless of the presence/absence of
      the -F option or additional command line arguments.
    - When using a file to set the hostname, behavior now matches
      net-tools version...previous busybox version did not handle
      comments, and simply grabbed the first line from the file.
2001-10-31 09:59:57 +00:00
Eric Andersen 950d8b496f patch from vodz:
I reduce 148 bytes from start_stop_daemon.c code. Also reduced
    memory allocated.
2001-10-31 09:55:39 +00:00
Eric Andersen 2c669dd108 patch from Giulio Orsero <giulioo@pobox.com> 2001-10-31 09:54:29 +00:00
John Beppu ce22feea01 - fixed typos
- thinking about how to generate Configure.help...
2001-10-31 04:29:18 +00:00
Matt Kraai 3889078dbe Merge test suite. 2001-10-30 23:11:20 +00:00
Matt Kraai 999623e973 Use extended regular expressions when invoked as egrep (noted and initial
patch by Charles Steinkuehler).
2001-10-29 15:49:03 +00:00
Matt Kraai b5f2516e3f Add killall (noted by Giulio Orsero). 2001-10-29 15:22:42 +00:00
Eric Andersen 813d88cf78 As Aaron Lehmann just pointed out, I forgot a line... 2001-10-28 22:49:48 +00:00
Eric Andersen 4acf8f8481 Use error_msg() instead of fprintf(stderr, ...) 2001-10-28 09:36:48 +00:00
Eric Andersen 72f9a4277f Add in some (theoretical) uClinux support. Some init cleanups 2001-10-28 05:12:20 +00:00
Glenn L McGrath 9af363fe20 include unistd which provides off_t for the header and hence unarchive applets 2001-10-27 14:10:37 +00:00
Glenn L McGrath 7134d6581b Attempt to fix libc compiling error regarding off_t 2001-10-27 13:14:52 +00:00
Eric Andersen 8e392922b0 Be extra pedantic about printing the correct type for an address 2001-10-27 03:28:53 +00:00
Eric Andersen c265b17550 Wrap exclude_file() inside a #ifdef CONFIG_FEATURE_TAR_EXCLUDE block 2001-10-27 03:20:00 +00:00
Gennady Feldman 087bc82bb0 Fix up the configuration rules and update Libc5 piece for Syslogd. (copied code from logread.c) 2001-10-26 16:09:09 +00:00
Glenn L McGrath ee28362597 Menu entry for tar creation support 2001-10-25 18:37:41 +00:00
Glenn L McGrath 107c796e79 Recovery from previous commit 2001-10-25 15:01:10 +00:00
Glenn L McGrath 9f2f8540c5 rEcover from my previous commit 2001-10-25 14:59:48 +00:00
Glenn L McGrath e9fc781570 libunarchive, and recovery from my previous commit 2001-10-25 14:57:14 +00:00
Glenn L McGrath 633f153808 Move libbb/unarchive functions to ./archival/libunarchive 2001-10-25 14:53:50 +00:00
Glenn L McGrath ef0eab514d Recovering from my previous commit 2001-10-25 14:49:48 +00:00
Glenn L McGrath 0d2fb76c11 Modify applets to use libunarchive 2001-10-25 14:26:05 +00:00
Glenn L McGrath 95ebf618b7 *** empty log message *** 2001-10-25 14:18:08 +00:00
Eric Andersen 8eaa7b3698 Oops. I forgot pwd_group/config.in 2001-10-25 05:56:51 +00:00
Eric Andersen 2293b96f42 ignore .menuconfig.log 2001-10-24 20:01:04 +00:00
Eric Andersen 9ae7ebd0fd Ignore lxdialog 2001-10-24 19:59:38 +00:00
Matt Kraai 258bd3d971 Split true and false into separate applets. 2001-10-24 19:00:20 +00:00
Matt Kraai 3c2f27d9f1 Add CONFIG_FEATURE_TAR_EXCLUDE support. 2001-10-24 18:51:27 +00:00
Eric Andersen 99702ab221 Fix variable name -- was stuck at the old RPMUNPACK value. Doh! 2001-10-24 17:37:07 +00:00
Eric Andersen b78d9b56eb Oops. Fix capililization 2001-10-24 17:35:52 +00:00
Eric Andersen 1a10eec178 Fixup the location of pwd.h and grp.h 2001-10-24 17:19:38 +00:00
Eric Andersen bfebd35bea Fix missing BB_VER defines 2001-10-24 16:51:39 +00:00
Eric Andersen a49b025b19 Oops. As Aaron Lehmann <aaronl@vitelus.com> just noticed,
I forgot to add procps to the SUBDIR list
2001-10-24 08:24:41 +00:00
Eric Andersen a3483db55f Patch from vodz:
1) complete true: $ > /tmp/tmpfile
    2) the builtin pwd now does not unwrap symlinks
    3) reduce 680 bytes
2001-10-24 08:01:06 +00:00
Eric Andersen 3cd2760ba1 Fixup the new buildsystem a bit. 2001-10-24 07:58:02 +00:00
Eric Andersen b36e684fd7 Ignore generated files 2001-10-24 06:53:33 +00:00
Eric Andersen 28593a085b ignore generated files 2001-10-24 06:50:42 +00:00
Eric Andersen ca38a29c81 A couple of leftovers 2001-10-24 06:48:42 +00:00
Eric Andersen 9b5a953a98 Add in a mostly content free config help file 2001-10-24 06:33:31 +00:00
Eric Andersen 4bcdd72142 Oops. Forgot these.... 2001-10-24 05:26:42 +00:00
Eric Andersen bdfd0d78bc Major rework of the directory structure and the entire build system.
-Erik
2001-10-24 05:00:29 +00:00
Eric Andersen 9260fc5552 Accomodate older glibc, which also lacks the module syscalls 2001-10-24 00:44:11 +00:00
Matt Kraai 1c9cebc8df Fix empty line substitutions (noted by Joshua Hudson). 2001-10-23 21:18:59 +00:00
Matt Kraai 8470b9a85c Fix empty line substitutions (noted by Joshua Hudson). 2001-10-23 21:12:07 +00:00
Glenn L McGrath 6ccdd8c122 Abort if scripts return value != 0 2001-10-23 17:52:28 +00:00
Matt Kraai c2e5b977ab Add ttylinux. 2001-10-19 15:33:45 +00:00
Eric Andersen 68ca35c90f Add slackware 8 to list 2001-10-19 06:32:15 +00:00
Eric Andersen 9c93721ea5 Add mindi linux 2001-10-19 00:46:06 +00:00
Eric Andersen d63dee4019 Add an option to make the shells not advertise their busybox nature 2001-10-19 00:22:23 +00:00
Eric Andersen f4c208937c Remove the now unused ARITH_* defines
-Erik
2001-10-19 00:08:17 +00:00
Eric Andersen c2af1ee036 Commit the start-stop-daemon applet. This was contributed by David
Kimdon <dwhedon@gordian.com> on october 7th -- the day I was fired from
Lineo.  So it seems I totally forgot about this patch until now.
Sorry about that David!
2001-10-18 19:33:06 +00:00
Matt Kraai bcca3317b5 Return NULL if EOF is encountered before terminating_string. 2001-10-18 17:04:22 +00:00
Matt Kraai a7512d74fa Process extra empty lines correctly. 2001-10-18 17:03:59 +00:00
Matt Kraai 3dd4f5ed69 Remove xmalloc calls. 2001-10-18 15:08:30 +00:00
Eric Andersen a0f0ae5a7a Revert that change. As Matt Kraai rightly points out,
this is not a bug.  What I was I thinking when I committed
this.  Doh!
2001-10-18 06:04:23 +00:00
Eric Andersen 74400ccfd0 Scrub up some function prototypes.
-Erik
2001-10-18 04:11:39 +00:00
Eric Andersen 8acbf1d307 Make mount default to using /proc/filesystems to avoid
ever trying to mount a nodev filesystem.
 -Erik
2001-10-18 04:10:22 +00:00
Eric Andersen 11fdb8a4c7 Fix a nasty bug with variable name shadowing 2001-10-18 04:04:34 +00:00
Eric Andersen 1bf25f0307 Patch from Stefan Soucek <ssoucek@coactive.com> to
ignore extra empty lines in fgets_str
2001-10-18 03:20:41 +00:00
Glenn L McGrath 4bef7b4186 unarchive function changed to support both exclude and include lists, applets that use unarchive changed to match. 2001-10-13 19:43:46 +00:00
Glenn L McGrath 051eee6ed3 Reverse part of previous change.... i think it was the wrong approach... im lost 2001-10-13 07:11:03 +00:00
Glenn L McGrath d642a67928 Match subdirectories of included/excluded files 2001-10-13 06:54:45 +00:00
Glenn L McGrath 527880e5cf match exclude/include names with trailing '/' 2001-10-13 06:53:34 +00:00
Glenn L McGrath b5937d3eea Use fnmatch() to compare excluded/included files 2001-10-13 06:21:32 +00:00
Glenn L McGrath 0e766183ee Superficial changes to make the exclude/include code easier to understand 2001-10-13 05:03:29 +00:00
Matt Kraai f86bbfaddd Fix tar segfault when include list is empty and exclude list is not. 2001-10-12 19:00:15 +00:00
Glenn L McGrath 9b2589dafd Cleanup memory usage properly 2001-10-08 13:10:12 +00:00
Glenn L McGrath dfa7b0eff6 Free some variables after use 2001-10-08 08:22:48 +00:00
Glenn L McGrath 30f68908ef Another part of Stafan's latest patch, when replacing a pre-existing package set its status correctly. 2001-10-06 02:40:20 +00:00
Glenn L McGrath f28d819554 status_package_num should refer to package not status.
Only initialise a new entry in the status hashtable if it really is a new entry.
2001-10-06 02:27:36 +00:00
Glenn L McGrath 3550753445 Remove duplicate tftp -l option help 2001-10-05 10:11:28 +00:00
Glenn L McGrath 1d098cefe2 Use wfopen instead of fopen & error_msg, saves 64 bytes 2001-10-05 05:24:19 +00:00
Glenn L McGrath bf265daa47 Use xfopen, saves 32 bytes ! 2001-10-05 05:03:14 +00:00
Glenn L McGrath ad117d8a21 Apply Magnus Damm's patch, adds tftp blocksize support, and some cleanups. 2001-10-05 04:40:37 +00:00
Glenn L McGrath 24e2833cdf Initial support for for bunzip2....
This code could be improvemed by
 1) supporting more options,
 2) Creating a shared crc table with gunzip, or perhaps generated on the fly.
 3) Removing any remaining unneccessary code (e.g. if (noisy))
2001-10-05 03:48:57 +00:00
Glenn L McGrath 2e772edacf Change extraction/list code to use common unarchive code. 2001-10-05 02:58:48 +00:00
Matt Kraai 4c557bf576 Invert FILEUTILS_PRESERVE_SYMLINKS into FILEUTILS_DEREFERENCE. 2001-10-05 01:35:10 +00:00
Matt Kraai 54a992d81e Fix BB_FEATURE_MTAB_SUPPORT test (report and patch by Magnus Damm). 2001-10-04 15:23:34 +00:00
Eric Andersen b0a0fc8944 Add Magnus Damm and fix alpha sorting 2001-10-04 09:33:40 +00:00
Glenn L McGrath a8412dbf39 Fixes with help from Stefan, Typo in prerm script, and when reinstall a package the old packages status was getting overwritten. 2001-10-04 05:22:42 +00:00
Eric Andersen fd35de564e Always enable BB_TEST when BB_ASH, BB_LASH, or BB_MSH is enabled 2001-10-03 23:37:24 +00:00
Eric Andersen 371ca19f53 Look for either "init" or "linuxrc" processes 2001-10-03 21:26:12 +00:00
Eric Andersen f0a4ac8216 Patch from Magnus Damm <damm@opensource.se> to avoid lash hanging
on serial ports
2001-10-03 11:23:42 +00:00
Glenn L McGrath 35636540ea Extract control.tar.gz and data.tar.gz unconditionally, another one picked up by Stefan 2001-10-03 03:10:35 +00:00
Eric Andersen 5c72104a85 Fix large file support -- 2+ gig files should now actually
work this time...
 -Erik
2001-10-02 07:58:23 +00:00
Matt Kraai c9fc633f9e Use port 37 by default. 2001-10-01 17:52:14 +00:00
Matt Kraai 524fcb9e01 Use xgethostbyname instead of gethostbyname (found by Erik Andersen). 2001-10-01 17:50:25 +00:00
Glenn L McGrath 95bfe631a4 Fix return status, picked up by Stefan 2001-09-29 03:34:38 +00:00
Eric Andersen 63ae66198d use the pedantically correct compiler for preprocessing 2001-09-26 06:20:54 +00:00
Matt Kraai b67adb0d83 Add Cachier. 2001-09-24 22:44:52 +00:00
Glenn L McGrath c5bd149261 List full path instead of relative path if prefix is specified (this was supposed to be in last patch) 2001-09-24 18:34:06 +00:00
Glenn L McGrath dece3c5684 The <package>.list file was prepending "./" to the files, fixed that.
Also fixed a very silly error by me when running postinst (remember to use the variable BEFORE its freed)
2001-09-22 04:16:55 +00:00
Glenn L McGrath b8f5adb64f Dont free everytime getline() is used, fix from Stefan Soucek 2001-09-22 03:24:07 +00:00
Matt Kraai 3be34309e3 Fix tftp usage information (closes: #1216). 2001-09-21 14:42:30 +00:00
Eric Andersen f8f6e624bb Eliminate ldconfig which is no longer built by
default (or needed) with uClibc.
2001-09-21 06:05:35 +00:00
Glenn L McGrath 48cc89b738 Fix to make preinst run when required, from Stefan Soucek 2001-09-21 05:07:47 +00:00
Glenn L McGrath e73866181f Implement dpkg -l option, from Stefan Soucek (slightly modified) 2001-09-21 04:30:51 +00:00
Tim Riker 4c67c596d1 closes bug#1215? 2001-09-16 02:00:09 +00:00
Manuel Novoa III 8d0afde412 Commit my changes to xxreadtoken() to reduce code size. Also set defines
so that the table implementations of copynode, calcsize, and cmdtxt are
used.  Hopefully this will result in wider testing.  ;-)  If it breaks,
just unset the appropriate defines.
2001-09-11 01:14:02 +00:00
Manuel Novoa III 6a9d1f652b Commit my changes to arith.c which fixed a couple of bugs and decreased
code size.  Please read the TODO comments regarding accessing shell
variables from the arith() funciton.
2001-09-11 01:11:31 +00:00
Eric Andersen f6ecaccf92 Fix my email address. 2001-09-08 20:52:33 +00:00
Eric Andersen 886b84211e Lineo is no longer sponsoring busybox 2001-09-08 20:47:19 +00:00
Eric Andersen 5bb1677f1d define IFS_BROKEN 2001-09-06 18:00:41 +00:00
Eric Andersen 88cec25e99 Patch from vodz to make ash cope with leading redirections
(i.e. '2>/dev/null ls rubbish') will now work.
2001-09-06 17:35:20 +00:00
Eric Andersen 1644db9a2b Two patches from Magick <magick@linux-fan.com>:
1st makes init smaller, and fixes a bug with AskFirst. Reading from
    /dev/null gives EOF.
    2nd makes init run the command's in the order of inittab, as in
    FIFO instead of LIFO.
2001-09-05 20:18:15 +00:00
Eric Andersen b9408504f5 Another fix from vodz 2001-09-05 19:32:00 +00:00
Eric Andersen 3b1525e444 Don't automount things as "usbdevfs" -- patch from
Ethan Benson <erbenson@alaska.net>
2001-09-03 16:49:25 +00:00
Matt Kraai 1350666498 Add -p support. 2001-08-29 21:18:47 +00:00
Matt Kraai 5171bf6d40 SUSv2 specifies that if the extension is identical to the basename, it
should not be removed.
2001-08-29 20:19:29 +00:00
Eric Andersen dcbca62e89 Standard typing (u_int16_t instead of u16, u_int32_t instead
of u32, etc) cleanups from Laurence Anderson <laurence@zxmail.com>
2001-08-29 19:02:26 +00:00
Matt Kraai 5078919981 Use the correct buffer when calling dirname, improve an error message, and
plug some memory leaks.  Patch by Laurence Anderson.
2001-08-28 22:57:38 +00:00
Eric Andersen 28d0ac13d1 Add "DutNux" 2001-08-27 19:22:44 +00:00
Matt Kraai 91631011cc Remove traces of rpmunpack (patch by Laurence Anderson). 2001-08-27 18:55:10 +00:00
Eric Andersen 863a3e15d6 patch from vodz -- route cleanup to display all route entries 2001-08-27 17:57:27 +00:00
Matt Kraai ab3d839ef4 Add support for `busybox --help APPLET' by Vladimir Oleynik. 2001-08-27 17:19:38 +00:00
Matt Kraai 861e624e15 Fix ash exec (noted by Arne Bernin). 2001-08-27 15:08:57 +00:00
Matt Kraai 449377aa6a Fix invocation of `-/bin/sh' (bug #1209). 2001-08-27 15:02:32 +00:00
Matt Kraai 80f6d55836 Eliminate improper consts and allow standard version to override. 2001-08-24 20:35:45 +00:00
Matt Kraai ac20ce1924 Canonicalize dirname(3) behavior. 2001-08-24 19:51:54 +00:00
Matt Kraai 2a953aed38 Fix a memory leak if parent directory creation failed. 2001-08-24 19:07:31 +00:00
Matt Kraai a0065d5955 Fix s/[/]// handling (noted by Dumas Patrice). 2001-08-24 14:45:50 +00:00
Eric Andersen 31b35a16e0 Merge with the stable branch 2001-08-23 22:05:55 +00:00
Eric Andersen a3c8481a33 A patch from Jaspreet Singh <jsingh@somanetworks.com>
fixing both a segfault and cosmetic bug in route
2001-08-23 22:05:33 +00:00
Eric Andersen b76cb68979 A patch from Shu-Hao Chang <shuhao_chang@trend.com.tw> to
fixed sed handling of multiple -e commands
2001-08-22 05:58:16 +00:00
Eric Andersen 1071ccfd25 Force BB_FEATURE_NEW_MODULE_INTERFACE and BB_FEATURE_OLD_MODULE_INTERFACE
to be mutually exclusive
2001-08-22 05:41:57 +00:00
Eric Andersen c0f9d0dce7 Add #include <sys/param.h> to ensure PATH_MAX is defined 2001-08-22 05:35:39 +00:00
Eric Andersen 5d60a46269 Fix a warning and potential segfault in lash when BB_FEATURE_CLEAN_UP
is enabled
2001-08-22 05:32:24 +00:00
Eric Andersen ac5dbd193b Fix an _old_ interface problem with a never-used feature. 2001-08-22 05:26:08 +00:00
Eric Andersen 59443965ad Scrub things and ditch uint64_t and use a custom type name
to avoid C lib compatibility problems.
2001-08-22 05:06:29 +00:00
Eric Andersen d36cdd25a5 Bump version to 0.61.pre 2001-08-22 04:16:36 +00:00
Eric Andersen 39eb040757 Patch from Rodney Brown <RDBrown@mira.net>, shrinking 1.5k
from gzip by careful optimization.  Appears to work just fine
(I've tested the changes on x86, ARM, and powerpc).
2001-08-22 04:15:47 +00:00
Eric Andersen a07c902648 Make it compile with uClibc 2001-08-22 00:10:00 +00:00
Eric Andersen 75220b55ff dfp might be used uninitialized. NULL it. 2001-08-21 23:36:32 +00:00
Eric Andersen 994c6ffd3b Disable the tinylogin apps by default. 2001-08-21 23:34:10 +00:00
Eric Andersen c61804ed59 Fix dos2unix compile problem with certain glibc versions 2001-08-21 22:34:05 +00:00
Eric Andersen f349e978c4 Initial merge of all tinylogin applets that do not require crypt.
There is some optimization that can be done to better use libbb in
these applets.  There is also redundancy between stty and getty which
could be eliminated.
 -Erik
2001-08-21 16:18:59 +00:00
Matt Kraai a3e4f455ac Fix a problem with unsatisfied backrefs (noted by Martin Bene). 2001-08-20 21:21:06 +00:00
Eric Andersen 54eceffcae some minor wording changes 2001-08-20 17:48:17 +00:00
Eric Andersen 76fa8ea790 Apply Glenn's tftp rewrite 2001-08-20 17:47:49 +00:00
Glenn L McGrath bac490fe53 Fix version comparision bug 2001-08-15 11:25:01 +00:00
Matt Kraai b6ec78161d Log all messages from a single connection, not just the first. Patch from
matthias@corelatus.com, approved by Gennady Feldman <gena01@cachier.com>.
2001-08-14 17:32:23 +00:00
Matt Kraai 0a68590314 Rewritten by Manuel Novoa III. 2001-08-14 17:10:08 +00:00
Manuel Novoa III c639a35f50 I stupidly forgot one level of pointer indirection in the cmdtxt(), calcsize(),
and copynode() table implementations.  Commit the fix but keep them disabled
until others check them out.  Uncomment "//#define CMDTXT_TABLE",
"//#define CALCSIZE_TABLE", and "//#define COPYNODE_TABLE" to try them out.
Saves over 600 bytes on i386.
2001-08-12 17:32:56 +00:00
Eric Andersen dd9173c07f Fix a merging error 2001-08-10 21:11:56 +00:00
Manuel Novoa III 16815d4b45 A few bug fixes and significant size savings. Combined effort of
Vladimir N. Oleynik dzo@simtreas.ru, Aaron Lehmann aaronl@vitelus.com,
and myself.
2001-08-10 19:36:07 +00:00
Eric Andersen 80dd0863e2 Small size optimization from Aaron Lehmann 2001-08-10 18:42:04 +00:00
Eric Andersen e20b7d844a Fix stupid grammar error. 2001-08-10 15:22:35 +00:00
Matt Kraai a7cecbc917 Commit Vladimir's simplify_path. 2001-08-10 15:05:27 +00:00
Manuel Novoa III 4fb0b51703 This corrects the _really_poor_ implementation of "broadcast +" handling
by ifconfig that someone had submitted.  It fixes 1 bug, gets rid of the
excessive bloating of a structure that is used in a static const array,
and removes the implicit struct copys by keeping only the int type needed.
It also turns this into a configurable feature (off by default).
2001-08-10 06:02:23 +00:00
Matt Kraai 6c4250c0dc Remind people to enable RPC support when using NFS mount and uClibc (thanks
to David Douthitt).
2001-08-09 21:07:10 +00:00
Matt Kraai d0b5be6da8 Remove BB_SH define entirely. 2001-08-09 21:00:15 +00:00
Matt Kraai 2338d3176b Use ferror(3) to check for errors, rather than inspecting errno. Thanks to
David Douthitt for reporting, and shame on me for writing such crappy code.
2001-08-06 16:09:09 +00:00
Matt Kraai 063c1f54ea Simplified version checking. 2001-08-06 14:18:08 +00:00
Matt Kraai 69edfecfb9 Add support for underscores in variable names. 2001-08-06 14:14:18 +00:00
Glenn L McGrath b373a8d0ca Fix exclude list handling 2001-08-04 05:28:29 +00:00
Eric Andersen 0b7d70c822 Fix up some silly messups with the debian packaging, and a dumb
bug with chroot.  I've had the package uploaded but perms set to
000, so I am going to re-tag things and re-cut the release.  Folks
who pulled from CVS in the last 30 minutes with just have to cope.
 -Erik
2001-08-02 20:56:16 +00:00
Matt Kraai 8aa0b62a88 Fix misspelling of `stabilize'. 2001-08-02 20:34:24 +00:00
Eric Andersen 9e6089ee0f Ok, here we go... 2001-08-02 19:31:08 +00:00
Matt Kraai c9dd5f945b Commit NMU changelog. 2001-08-02 15:12:16 +00:00
Eric Andersen be0c36009a More libc5 fixups
-Erik
2001-08-02 10:55:32 +00:00
Eric Andersen 23b1e5c7df Some libc5 cleanups 2001-08-02 09:58:41 +00:00
Eric Andersen 879d6c85af make_directory used mode as if it were an signed entity, but in fact
it was a mode_t which is unsigned.  Fix it to be signed...
 -Erik
2001-08-02 09:58:19 +00:00
Eric Andersen 8a915880e7 Teach libc5 about realpath
-Erik
2001-08-02 09:55:58 +00:00
Eric Andersen 95b520110d Teach libc5 what a sighandler_t is
-Erik
2001-08-02 09:52:40 +00:00
Eric Andersen deba6dea03 multibuild.pl saves us again. unix2dos requires that dos2unix
be enabled.
 -Erik
2001-08-02 09:21:17 +00:00
Eric Andersen 46bf7de5f6 Ok, if no shell is enabled, don't include any of the SH_IS_<name>
options or the build will fail
 -Erik
2001-08-02 08:48:03 +00:00
Eric Andersen ff9b4a8981 Scrub away the last leftovers from BB_FEATURE_<shell>. Good thing
for multibuild.pl -- I would have missed this stupid mess otherwise.
 -Erik
2001-08-02 08:42:58 +00:00
Eric Andersen fdbac35b33 Patch from Robert J. Osborne <rj@resourceinternational.com> that fixes
a bug in vi where the beginning of the text space was not checked
before dot is decremented for delete and escape sequences on an empty
file.
2001-08-02 05:26:41 +00:00
Eric Andersen 842757dc96 Oops. I forgot to commit this part of vodz' patch. 2001-08-02 05:18:55 +00:00
Eric Andersen 3450636169 Latest patch from vodz. Adds a check for divide by zero in the posix
math suport, cleaner math syntax error checking, moves redundant signal
string tables (from kill and ash) into libbb and provides a few
cleanups elsewhere.
2001-08-02 05:02:46 +00:00
Matt Kraai 2d91deba45 Allow multiple shells to be enabled. 2001-08-01 17:21:35 +00:00
Eric Andersen 0034443140 Fix behavior of grep -lc to match GNU grep. SuS2 is ambiguous
on the correct behavior, so acting like GNU grep seems best
 -Erik
2001-07-31 23:18:49 +00:00
Eric Andersen af6b40a1ea Silence some silly warnings 2001-07-31 22:53:36 +00:00
Eric Andersen f672c9e62f Silence a silly warning 2001-07-31 22:51:49 +00:00
Eric Andersen bb9579ffc3 Make formatting match GNU ls (we were including a spare ' ')
-Erik
2001-07-31 22:43:50 +00:00
Eric Andersen fa1c5aac51 Fix the let builtin (so we can close bug #1196) and remove the
nonstandard exp builtin.
 -Erik
2001-07-31 21:38:23 +00:00
Matt Kraai 73f6a1b058 Always write record counts to stderr. 2001-07-31 21:02:19 +00:00
Eric Andersen 221b2ea6c4 I just wrote up a simple pidof applet, closing bug #1197
-Erik
2001-07-31 19:06:07 +00:00
Matt Kraai 9a53feaa76 Give credit to Adam Slattery. 2001-07-31 16:44:16 +00:00
Eric Andersen 57c82fe7c4 I think this should be the final changelog update...
-Erik
2001-07-31 16:11:41 +00:00
Matt Kraai 51038a3f42 Don't save and restore readonly flag if BB_FEATURE_VI_READONLY isn't enabled. 2001-07-31 15:01:12 +00:00
Eric Andersen 74bcd16425 This incorporates Posix math support into ash. The Posix math support
was written by Aaron Lehmann <aaronl@vitelus.com> for busybox.  This
patch makes a few trivial changes to Aaron's code so that it can be
used (in theory) by the other shells as well...
 -Erik
2001-07-30 21:41:37 +00:00
Eric Andersen dc6647201d Simplify/clarify the shell dependant bit of Config.h 2001-07-30 19:33:00 +00:00
Eric Andersen c126f8ffb6 This depmod script will create a modules.dep file, just like the depmod
binary from modutils.  This one, however, can be run on the _host_
system (need not be run on the target) and is fully cross platform, so
even if your target is ARM or powerpc or whatever, this will still
work.  When used to support the new modprobe applet, this allows
busybox to fully supplant modutils for architectures supported by
busybox insmod.
 -Erik
2001-07-30 19:32:03 +00:00
Eric Andersen 3555fd006e Fix up the sample inittab entry per what is current.
-Erik
2001-07-30 19:28:33 +00:00
Matt Kraai 13cb842773 Rework option handling to save space. 2001-07-30 14:43:20 +00:00
Matt Kraai 547e102082 Preserve whether or not the line was previously altered when running a
subst command (discovery and patch by Jim Gleason).
2001-07-30 14:05:58 +00:00
Glenn L McGrath 7499918f30 If filename is a '-' then read from stdin to stdout 2001-07-30 04:48:50 +00:00
Glenn L McGrath 14d7ea460f Note my uuencode work 2001-07-29 06:07:35 +00:00
Glenn L McGrath b6071b6341 Fix permisions when reading from stdin 2001-07-29 06:04:26 +00:00
Glenn L McGrath eba260587a Fix broken logic when wraping encoded data into rows, also simplifies it a bit 2001-07-29 05:47:33 +00:00
Glenn L McGrath 4e664ac51d The src buffer size has to be a multiple of 3 (as i noted, but didnt do). 2001-07-28 21:34:25 +00:00
Glenn L McGrath 089decab65 Rewrite based on wget uuencode function.
Saves aprox. 200 Bytes and in future can use common code between
this and wget if BB_FEATURE_WGET_AUTHENTICATION is defined.
2001-07-28 21:06:13 +00:00
Eric Andersen 220238305f PArtial Changelog update. I'm still on vacation (I'm at a campground
near the Grand Teton Mountains in Montana at the moment and my
connection is terribly slow) so this is a partial update only,
 -Erik
2001-07-28 16:35:51 +00:00
Matt Kraai 26eeb0c9da Shorten static package description. 2001-07-26 14:45:21 +00:00
Matt Kraai f9d6aa0a86 Rename dirname variable to pathname to eliminate namespace conflict. 2001-07-26 14:26:53 +00:00
Russ Dill 4db35647dd char renamed can never be negative on ARM (rp->renamed[i] != EMPTY) 2001-07-26 05:58:40 +00:00
Eric Andersen 2835efe3da Note that m68k is supported 2001-07-25 16:58:58 +00:00
Eric Andersen 1b06419e60 Cleanup some warnings and a really obvious bug.
-Erik
2001-07-25 07:23:38 +00:00
Eric Andersen 655584b07a This fixes dos2unix and unix2dos so they behave as expected. dos2unix
was broken in the 0.52 release, and unix2dos was pretty lame...
 -Erik
2001-07-25 07:22:55 +00:00
Glenn L McGrath 6c7ac21f3a Update my email address and applets 2001-07-24 02:46:35 +00:00
Glenn L McGrath 096b151f76 note dpkg rewrite 2001-07-24 02:41:06 +00:00
Matt Kraai 439e3df653 Add support for devfs device names. 2001-07-23 14:52:08 +00:00
Eric Andersen 0139ca92ff An initial modproble implementation. Quite suboptimal still,
but it does work...
2001-07-22 23:01:03 +00:00
Eric Andersen 8d79ce8320 Some patches to make dietlibc work... 2001-07-22 23:00:15 +00:00
Eric Andersen 20aab260e2 Some adjustments, mostly from David McCullough <davidm@lineo.com> to
make busybox be more uClinux friendly.  I also adjusted Config.h for
uClinux so it will automagically disable apps the arn't going to
work without fork() and such.
 -Erik
2001-07-19 22:28:02 +00:00
Matt Kraai 0382eb8865 The -P prefix should only be prepended to filenames which are not explicitly
specified.
2001-07-19 19:13:55 +00:00
Matt Kraai e92895c038 Note that wget fix is important. 2001-07-19 17:46:17 +00:00
Matt Kraai c8eae6684b The directory name should only be prepended if one was specified. 2001-07-19 17:29:38 +00:00
Matt Kraai c1cda4a609 Add a RELEASE_BB_BUFFER macro and use it to fix a memory leak in syslogd.c
(noted by Adam Slattery).
2001-07-19 15:00:14 +00:00
Glenn L McGrath 81108e7653 Cleanup (most) memory leaks 2001-07-19 12:15:13 +00:00
Glenn L McGrath c3fbec73fb Change read_package_field interface, and rewrite using low level functions
Fixes for a few bugs that have crept into dpkg in the last few days
2001-07-18 15:47:21 +00:00
Glenn L McGrath 8d3b0497a4 Fix extract_archive so it doesnt mangle filenames, dont try and extract "./" and strip leading "./" on other files 2001-07-18 13:22:44 +00:00
Glenn L McGrath 778041f8d1 Use the unofficial -C instead of -c to --configure a package, -c conflicts with another dpkg command 2001-07-18 05:17:39 +00:00
Glenn L McGrath b9e4ce99d8 Update dpkg usage 2001-07-18 05:16:31 +00:00
Glenn L McGrath ed4492a697 More feedback to user 2001-07-18 05:03:49 +00:00
Glenn L McGrath 7b0241579c Be more verbose when configureing package, minor changes 2001-07-18 04:33:31 +00:00
Glenn L McGrath 6fc92a506a Fail silently on failure to read tar header, its unfortunate that many tar implementations must be adding unwanted crap to the end of their archives.
It makes error reporting here more trouble than its worth
2001-07-18 03:23:10 +00:00
Glenn L McGrath 4cdc607f72 Use xfopen to abort on error to prevent segfaulting later. 2001-07-18 03:13:49 +00:00
Eric Andersen bc4c030023 Cleanup from vodz 2001-07-17 01:14:06 +00:00
Eric Andersen 044228d5ec This is vodz' latest patch. Sorry it took so long...
1) ping cleanup (compile fix from this patch already applied).
    2) traceroute call not spare ntohl() now (and reduce size);
    3) Fix for functions not declared static in insmod, ash, vi and mount.
    4) a more simple API cmdedit :))
    5) adds "stopped jobs" warning to ash on Ctrl-D and fixes "ignoreeof" option
    6) reduce exporting library function index->strchr (traceroute), bzero->memset (syslogd)
2001-07-17 01:12:36 +00:00
Glenn L McGrath 51ded05b3b enum entry for unarchive to be used by tar 2001-07-14 12:38:55 +00:00
Glenn L McGrath a868ec89e8 Allow the unarchive() extract_list variable to be NULL, meaning extract all 2001-07-14 08:49:53 +00:00
Glenn L McGrath 58a5bd187d Tolerate fields with no data, e.g. "Depends: " 2001-07-14 06:25:54 +00:00
Matt Kraai 06ef16563b Allow featureless ping to compile, and featureful ping to shrink
(by Adam Slattery).
2001-07-13 20:56:27 +00:00
Glenn L McGrath ccd65c9be6 Total rewrite, uses hash tables for speed and low memory use. 2001-07-13 18:35:24 +00:00
Glenn L McGrath 3d46224b78 Return NULL if file doesnt open in deb_extract 2001-07-13 18:16:57 +00:00
Glenn L McGrath cfeb08a193 Make sure there is a trailing '\0' when extracting to buffer. 2001-07-13 17:59:48 +00:00
Glenn L McGrath 5e66a26eaa Dont setvbuff in here, must be called just after stream is initialised, glibc tolerates using it later, uclibc doesnt 2001-07-13 06:51:56 +00:00
Glenn L McGrath 26a0d9a945 Call setvbuf from here isntead of gz_open for compatability with uclibc 2001-07-13 06:49:18 +00:00
Glenn L McGrath b028e08d35 Move setvbuf calls from gz_open() to calling functions, setvbuf is only supposed to be called prior to opening the stream, glibc tolerates later use, uclibc doesnt. 2001-07-13 06:43:03 +00:00
Eric Andersen 7467c8d3b6 Patch from vodz:
Changed email address
    cmdedit API change
    optimizations for traceroute and md5sum
    added a new shared create_icmp_socket() function
2001-07-12 20:26:32 +00:00
Matt Kraai f69bfc76fa Allow assignments in the export and readonly commands. 2001-07-12 19:39:59 +00:00
Matt Kraai ab6526c8b3 Remove debugging statement. 2001-07-12 18:44:34 +00:00
Glenn L McGrath 3e94f729a5 Quiet mode, sometimes error messages arent wanted 2001-07-12 10:24:57 +00:00
Glenn L McGrath c127008840 Allow unarchive to redirect stdout (tobe used by dpkg applet) 2001-07-11 17:32:14 +00:00
Glenn L McGrath 481d19b38e Fix bug where it wasnt returning the last line of a multiline field 2001-07-11 15:43:03 +00:00
Glenn L McGrath daf0b78e1a Reverse part of my previous changes 2001-07-11 15:32:52 +00:00
Glenn L McGrath 93febe672a free coniditionally, just to make it play nice with dmalloc which is incompatable with standard free() 2001-07-11 07:25:01 +00:00
Eric Andersen c59fa37d40 Make the obj's generated from libbb/unarchive.c depend on the
Makefile, so things like setting DODMALLOC will cause them to
be recompiled
 -Erik
2001-07-11 07:24:05 +00:00
Glenn L McGrath 248c57ca43 minor dmalloc inspired cleanups 2001-07-11 07:22:17 +00:00
Glenn L McGrath 59e50f634a Unpack the filename not the package name 2001-07-11 03:30:11 +00:00
Eric Andersen 8c145dc31b Fix a stupid search and replace bug... 2001-07-10 16:57:09 +00:00
Eric Andersen 55522080c6 Patch for md5sum from Aaron Lehmann <aaronl@vitelus.com> to slim
it down a little bit.
2001-07-10 16:31:29 +00:00
Eric Andersen 5c58d283bb A traceroute applet from vodz. This could probably be slimmed down,
but will do for now...
2001-07-10 16:29:00 +00:00
Eric Andersen 91b84603d3 Cleanup from vodz 2001-07-10 16:25:34 +00:00
Eric Andersen 2a46634617 Make the rev be 0.53pre... 2001-07-10 15:24:16 +00:00
Matt Kraai 5710f9f690 Read 20 512-byte blocks at a time (like GNU tar). 2001-07-10 15:05:39 +00:00
Glenn L McGrath 654944fc36 Reverse my previous change, still cant compile with dmalloc 2001-07-10 14:33:22 +00:00
Glenn L McGrath c3d2f1287e When compiling unarchive objects link to $(LIBRARIES) incase using dmalloc 2001-07-10 14:04:30 +00:00
Matt Kraai 6199fa90e5 Update version number to 0.53pre. 2001-07-10 13:57:30 +00:00
Eric Andersen 6248355c6f vodz' latest update to ash.c 2001-07-10 06:09:16 +00:00
Eric Andersen 5a4a46a251 Patch from vodz to support 'tr a-z A-Z' syntax. 2001-07-09 21:32:29 +00:00
Eric Andersen f52947ba71 Fix the spec file so it works on redhat systems. At least I think
it will work on redhat.  At least it now works on my Debian box...
 -Erik
2001-07-09 18:34:12 +00:00
Eric Andersen aa64ba459f Minor working update 2001-07-07 16:36:29 +00:00
Eric Andersen ceece81414 Move a bit more to the old news section 2001-07-07 09:38:30 +00:00
Eric Andersen d0e5f86a10 Enable APPLETS_ALWAYS_WIN 2001-07-07 09:37:28 +00:00
Eric Andersen d0b4d3dabf Typo fix. 2001-07-07 08:47:21 +00:00
Eric Andersen 7b2dfc623b Move some stuff to the oldnews area 2001-07-07 08:44:25 +00:00
939 changed files with 119433 additions and 112464 deletions

No files matched your search

+4 -1
View File
@@ -1,4 +1,7 @@
busybox
busybox.links
_install
applet_source_list
.config
.menuconfig.log
.config.cmd
.config.old
+75 -23
View File
@@ -8,49 +8,103 @@ incorect, _please_ let me know.
-----------
Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
Emanuele Aina <emanuele.aina@tiscali.it>
run-parts
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.
Lots of tedious effort writing these boring docs that
nobody is going to actually read.
Laurence Anderson <l.d.anderson@warwick.ac.uk>
rpm2cpio, unzip, get_header_cpio, read_gz interface, rpm
Jeff Angielski <jeff@theptrgroup.com>
ftpput, ftpget
Edward Betts <edward@debian.org>
expr, hostid, logname, tty, wc, whoami, yes
John Beppu <beppu@lineo.com>
du, head, nslookup, sort, tee, uniq
expr, hostid, logname, whoami
John Beppu <beppu@codepoet.org>
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,
Dave Cinege <dcinege@psychosis.com>
more(v2), makedevs, dutmp, modularization, auto links file,
various fixes, Linux Router Project maintenance
Jordan Crouse <jordan@cosmicpenguin.net>
ipcalc
Magnus Damm <damm@opensource.se>
tftp client
insmod powerpc support
Larry Doolittle <ldoolitt@recycle.lbl.gov>
pristine source directory compilation, lots of patches and fixes.
Glenn Engel <glenne@engel.org>
httpd
Gennady Feldman <gfeldman@gena01.com>
Sysklogd (single threaded syslogd, IPC Circular buffer support,
logread), various fixes.
Robert Griebl <sandman@handhelds.org>
modprobe, hwclock, suid/sgid handling, tinylogin integration
many bugfixes and enhancements
Karl M. Hegbloom <karlheg@debian.org>
cp_mv.c, the test suite, various fixes to utility.c, &c.
Daniel Jacobowitz <dan@debian.org>
mktemp.c
Matt Kraai <kraai@alumni.carnegiemellon.edu>
documentation, bugfixes
Matt Kraai <kraai@alumni.cmu.edu>
documentation, bugfixes, test suite
John Lombardo <john@deltanet.com>
dirname, tr
Stephan Linz <linz@li-pro.net>
ipcalc, Red Hat equivalence
Glenn McGrath <bug1@netconnect.com.au>
ar.c
John Lombardo <john@deltanet.com>
tr
Glenn McGrath <bug1@iinet.net.au>
Common unarchving code and unarchiving applets, ifupdown, ftpgetput,
nameif, sed, patch, fold, install, uudecode.
Various bugfixes, review and apply numerous patches.
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, route
Vladimir Oleynik <dzo@simtreas.ru>
cmdedit; xargs(current), httpd(current);
ports: ash, crond, fdisk, inetd, stty, traceroute, top;
locale, various fixes
and irreconcilable critic of everything not perfect.
Bruce Perens <bruce@pixar.com>
Original author of BusyBox. His code is still in many apps.
Original author of BusyBox in 1995, 1996. Some of his code can
still be found hiding here and there...
Tim Riker <Tim@Rikers.org>
bug fixes, member of fan club
Kent Robotti <robotti@metconnect.com>
reset, tons and tons of bug reports and patchs.
reset, tons and tons of bug reports and patches.
Chip Rosenthal <chip@unicom.com>, <crosenth@covad.com>
wget - Contributed by permission of Covad Communications
@@ -64,8 +118,9 @@ Gyepi Sam <gyepi@praxis-sw.com>
Linus Torvalds <torvalds@transmeta.com>
mkswap, fsck.minix, mkfs.minix
Mark Whitley <markw@lineo.com> <markw@codepoet.org>
grep, sed, cut, xargs, style-guide, new-applet-HOWTO, bug fixes, etc.
Mark Whitley <markw@codepoet.org>
grep, sed, cut, xargs(previous),
style-guide, new-applet-HOWTO, bug fixes, etc.
Charles P. Wright <cpwright@villagenet.com>
gzip, mini-netcat(nc)
@@ -73,9 +128,6 @@ Charles P. Wright <cpwright@villagenet.com>
Enrique Zanardi <ezanardi@ull.es>
tarcat (since removed), loadkmap, various fixes, Debian maintenance
Vladimir Oleynik <dzo@simtreas.ru>
cmdedit, stty-port, locale, various fixes
and irreconcilable critic of everything not perfect.
Tito Ragusa <farmatito@tiscali.it>
devfsd and size optimizations in strings, openvt, chvt, deallocvt, hdparm and fdformat.
Tim Riker <Tim@Rikers.org>
bug fixes, member of fan club
+1381 -1086
View File
File diff suppressed because it is too large. Load diff
-484
View File
@@ -1,484 +0,0 @@
/* vi: set sw=4 ts=4: */
// This file defines the feature set to be compiled into busybox.
// When you turn things off here, they won't be compiled in at all.
//
//// This file is parsed by sed. You MUST use single line comments.
// i.e., //#define BB_BLAH
//
//
// BusyBox Applications
//#define BB_ADJTIMEX
//#define BB_AR
#define BB_BASENAME
#define BB_CAT
#define BB_CHGRP
#define BB_CHMOD
#define BB_CHOWN
#define BB_CHROOT
#define BB_CHVT
#define BB_CLEAR
//#define BB_CMP
#define BB_CP
//#define BB_CPIO
#define BB_CUT
#define BB_DATE
//#define BB_DC
#define BB_DD
//#define BB_DEALLOCVT
#define BB_DF
#define BB_DIRNAME
#define BB_DMESG
//#define BB_DOS2UNIX
//#define BB_DPKG
//#define BB_DPKG_DEB
//#define BB_DUTMP
#define BB_DU
//#define BB_DUMPKMAP
#define BB_ECHO
#define BB_ENV
//#define BB_EXPR
//#define BB_FBSET
//#define BB_FDFLUSH
#define BB_FIND
#define BB_FREE
//#define BB_FREERAMDISK
//#define BB_FSCK_MINIX
//#define BB_GETOPT
#define BB_GREP
#define BB_GUNZIP
#define BB_GZIP
#define BB_HALT
#define BB_HEAD
//#define BB_HOSTID
//#define BB_HOSTNAME
#define BB_ID
//#define BB_IFCONFIG
#define BB_INIT
//#define BB_INSMOD
#define BB_KILL
#define BB_KILLALL
#define BB_KLOGD
//#define BB_LENGTH
#define BB_LN
//#define BB_LOADACM
//#define BB_LOADFONT
//#define BB_LOADKMAP
#define BB_LOGGER
//#define BB_LOGNAME
#define BB_LS
#define BB_LSMOD
//#define BB_MAKEDEVS
//#define BB_MD5SUM
#define BB_MKDIR
//#define BB_MKFIFO
//#define BB_MKFS_MINIX
#define BB_MKNOD
#define BB_MKSWAP
//#define BB_MKTEMP
//#define BB_NC
#define BB_MORE
#define BB_MOUNT
//#define BB_MT
#define BB_MV
//#define BB_NSLOOKUP
//#define BB_PING
//#define BB_PIVOT_ROOT
#define BB_POWEROFF
//#define BB_PRINTF
#define BB_PS
#define BB_PWD
//#define BB_RDATE
//#define BB_READLINK
#define BB_REBOOT
//#define BB_RENICE
#define BB_RESET
#define BB_RM
#define BB_RMDIR
//#define BB_RMMOD
//#define BB_ROUTE
//#define BB_RPM2CPIO
#define BB_SED
//#define BB_SETKEYCODES
#define BB_SH
#define BB_SLEEP
#define BB_SORT
//#define BB_STTY
#define BB_SWAPONOFF
#define BB_SYNC
#define BB_SYSLOGD
#define BB_TAIL
#define BB_TAR
//#define BB_TEE
//#define BB_TEST
//#define BB_TELNET
//#define BB_TFTP
#define BB_TOUCH
//#define BB_TR
#define BB_TRUE_FALSE
#define BB_TTY
//#define BB_UNIX2DOS
//#define BB_UUENCODE
//#define BB_UUDECODE
#define BB_UMOUNT
#define BB_UNIQ
#define BB_UNAME
//#define BB_UPDATE
#define BB_UPTIME
//#define BB_USLEEP
//#define BB_VI
//#define BB_WATCHDOG
#define BB_WC
//#define BB_WGET
#define BB_WHICH
#define BB_WHOAMI
#define BB_XARGS
#define BB_YES
// End of Applications List
//
//
//
// ---------------------------------------------------------
// This is where feature definitions go. Generally speaking,
// turning this stuff off makes things a bit smaller (and less
// pretty/useful).
//
//
// If you enabled BB_SH above, you may select one of the following shells.
// You can only select ONE of the following shells. Sorry.
//
// 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 very nice
// lightweight command prompt.
//#define BB_FEATURE_LASH
//
// 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.
//#define BB_FEATURE_HUSH
//
// 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...
#define BB_FEATURE_MSH
//
// 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. The
// Posix math support is currently disabled (that bit of code was horrible) but
// will be restored for the next BusyBox release.
//#define BB_FEATURE_ASH
//
// BusyBox will, by default, malloc space for its buffers. This costs code
// size for the call to xmalloc. You can use the following feature to have
// them put on the stack. For some very small machines with limited stack
// space, this can be deadly. For most folks, this works just fine...
//#define BB_FEATURE_BUFFERS_GO_ON_STACK
// The third alternative for buffer allocation is to use BSS. This works
// beautifully for computers with a real MMU (and OS support), but wastes
// runtime RAM for uCLinux. This behavior was the only one available for
// BusyBox versions 0.48 and earlier.
//#define BB_FEATURE_BUFFERS_GO_IN_BSS
//
// Turn this on to use Erik's very cool devps, and devmtab kernel drivers,
// thereby eliminating the need for the /proc filesystem and thereby saving
// lots and lots memory for more important things. NOTE: If you enable this
// feature, you _must_ have patched the kernel to include the devps patch that
// is included in the busybox/kernel-patches directory. You will also need to
// create some device special files in /dev on your embedded system:
// mknod /dev/mtab c 10 22
// mknod /dev/ps c 10 21
// I emailed Linus and this patch will not be going into the stock kernel.
//#define BB_FEATURE_USE_DEVPS_PATCH
//
// show verbose usage messages
//#define BB_FEATURE_VERBOSE_USAGE
//
// Use termios to manipulate the screen ('more' is prettier with this on)
//#define BB_FEATURE_USE_TERMIOS
//
// calculate terminal & column widths (for more and ls)
#define BB_FEATURE_AUTOWIDTH
//
// show username/groupnames for ls
#define BB_FEATURE_LS_USERNAME
//
// show file timestamps in ls
#define BB_FEATURE_LS_TIMESTAMPS
//
// enable ls -p and -F
#define BB_FEATURE_LS_FILETYPES
//
// sort the file names
#define BB_FEATURE_LS_SORTFILES
//
// enable ls -R
#define BB_FEATURE_LS_RECURSIVE
//
// enable ls -L
#define BB_FEATURE_LS_FOLLOWLINKS
//
// Disable for a smaller (but less functional) ping
#define BB_FEATURE_FANCY_PING
//
// Make init use a simplified /etc/inittab file (recommended).
#define BB_FEATURE_USE_INITTAB
//
//Enable init being called as /linuxrc
#define BB_FEATURE_LINUXRC
//
//Have init enable core dumping for child processes (for debugging only)
//#define BB_FEATURE_INIT_COREDUMPS
//
//Make sure nothing is printed to the console on boot
//#define BB_FEATURE_EXTRA_QUIET
//
// enable syslogd -R remotehost
#define BB_FEATURE_REMOTE_LOG
//
// enable syslogd -C
//#define BB_FEATURE_IPC_SYSLOG
//
//Disable for a simple tail implementation (2.34k vs 3k for the full one).
//Both provide 'tail -f', but this cuts out -c, -q, -s, and -v.
#define BB_FEATURE_FANCY_TAIL
//
// Enable support for loop devices in mount
#define BB_FEATURE_MOUNT_LOOP
//
// Enable support for a real /etc/mtab file instead of /proc/mounts
//#define BB_FEATURE_MTAB_SUPPORT
//
// Enable support for mounting remote NFS volumes.
// You may need to mount with "-o nolock" if you are
// not running a local portmapper daemon...
//#define BB_FEATURE_NFSMOUNT
//
// Enable support forced filesystem unmounting
// (i.e., in case of an unreachable NFS system).
#define BB_FEATURE_MOUNT_FORCE
//
// Enable support for creation of tar files.
#define BB_FEATURE_TAR_CREATE
//
// Enable support for "--exclude" and "-X" for excluding files
#define BB_FEATURE_TAR_EXCLUDE
//
// Enable support for tar -z option (currently only works for inflating)
#define BB_FEATURE_TAR_GZIP
//
// Enable reverse sort
#define BB_FEATURE_SORT_REVERSE
//
// Enable uniqe sort
#define BB_FEATURE_SORT_UNIQUE
//
// Enable command line editing in the shell.
// Only relevant if BB_SH is enabled. On by default.
#define BB_FEATURE_COMMAND_EDITING
//
// Enable tab completion in the shell. This is now working quite nicely.
// This feature adds a bit over 4k. Only relevant if BB_SH is enabled.
#define BB_FEATURE_COMMAND_TAB_COMPLETION
//
// Attempts to match usernames in a ~-prefixed path
//#define BB_FEATURE_COMMAND_USERNAME_COMPLETION
//
//Allow the shell to invoke all the compiled in BusyBox applets as if they
//were shell builtins. Nice for staticly linking an emergency rescue shell,
//among other things. Off by default.
// Only relevant if BB_SH is enabled.
//#define BB_FEATURE_SH_STANDALONE_SHELL
//
//When this is enabled, busybox shell applets can be called using full path
//names. This causes applets (i.e., most busybox commands) to override
//real commands on the filesystem. For example, if you run run /bin/cat, it
//will use BusyBox cat even if /bin/cat exists on the filesystem and is _not_
//busybox. Some systems want this, others do not. Choose wisely. :-) This
//only has meaning when BB_FEATURE_SH_STANDALONE_SHELL is enabled.
// Only relevant if BB_SH is enabled. Off by default.
//#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN
//
// Uncomment this option for a fancy shell prompt that includes the
// current username and hostname. On systems that don't have usernames
// or hostnames, this can look hideous.
// Only relevant if BB_SH is enabled.
//#define BB_FEATURE_SH_FANCY_PROMPT
//
//Turn on extra fbset options
//#define BB_FEATURE_FBSET_FANCY
//
//Turn on fbset readmode support
//#define BB_FEATURE_FBSET_READMODE
//
// Support insmod/lsmod/rmmod for post 2.1 kernels
//#define BB_FEATURE_NEW_MODULE_INTERFACE
//
// Support insmod/lsmod/rmmod for pre 2.1 kernels
//#define BB_FEATURE_OLD_MODULE_INTERFACE
//
// Support module version checking
//#define BB_FEATURE_INSMOD_VERSION_CHECKING
//
// Support for uClinux memory usage optimization, which will load the image
// directly into the kernel memory. This divides memory requrements by three.
// If you are not running uClinux (i.e., your CPU has an MMU) leave this
// disabled...
//#define BB_FEATURE_INSMOD_LOADINKMEM
//
// Support for Minix filesystem, version 2
//#define BB_FEATURE_MINIX2
//
// Enable ifconfig status reporting output -- this feature adds 12k.
//#define BB_FEATURE_IFCONFIG_STATUS
//
// Enable ifconfig slip-specific options "keepalive" and "outfill"
//#define BB_FEATURE_IFCONFIG_SLIP
//
// Enable ifconfig options "mem_start", "io_addr", and "irq".
//#define BB_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ
//
// Enable ifconfig option "hw". Currently works for only with "ether".
//#define BB_FEATURE_IFCONFIG_HW
//
// Enable busybox --install [-s]
// to create links (or symlinks) for all the commands that are
// compiled into the binary. (needs /proc filesystem)
//#define BB_FEATURE_INSTALLER
//
// Enable a nifty progress meter in wget (adds just under 2k)
#define BB_FEATURE_WGET_STATUSBAR
//
// Enable HTTP authentication in wget
#define BB_FEATURE_WGET_AUTHENTICATION
//
// Clean up all memory before exiting -- usually not needed
// as the OS can clean up... Don't enable this unless you
// have a really good reason for cleaning things up manually.
//#define BB_FEATURE_CLEAN_UP
//
// Support for human readable output by ls, du, etc.(example 13k, 23M, 235G)
#define BB_FEATURE_HUMAN_READABLE
//
// Support for the find -type option.
#define BB_FEATURE_FIND_TYPE
//
// Support for the find -perm option.
#define BB_FEATURE_FIND_PERM
//
// Support for the find -mtine option.
#define BB_FEATURE_FIND_MTIME
//
// Support for the -A -B and -C context flags in grep
//#define BB_FEATURE_GREP_CONTEXT
//
// Support for the EGREP applet (alias to the grep applet)
//#define BB_FEATURE_GREP_EGREP_ALIAS
//
// Tell tftp what commands that should be supported.
#define BB_FEATURE_TFTP_PUT
#define BB_FEATURE_TFTP_GET
//
// features for vi
#define BB_FEATURE_VI_COLON // ":" colon commands, no "ex" mode
#define BB_FEATURE_VI_YANKMARK // Yank/Put commands and Mark cmds
#define BB_FEATURE_VI_SEARCH // search and replace cmds
#define BB_FEATURE_VI_USE_SIGNALS // catch signals
#define BB_FEATURE_VI_DOT_CMD // remember previous cmd and "." cmd
#define BB_FEATURE_VI_READONLY // vi -R and "view" mode
#define BB_FEATURE_VI_SETOPTS // set-able options, ai ic showmatch
#define BB_FEATURE_VI_SET // :set
#define BB_FEATURE_VI_WIN_RESIZE // handle window resize
//
// Enable a if you system have setuped locale
//#define BB_LOCALE_SUPPORT
//
// Support for TELNET to pass TERM type to remote host. Adds 384 bytes.
#define BB_FEATURE_TELNET_TTYPE
//
// End of Features List
//
//
//
//
//
//
//---------------------------------------------------
// Nothing beyond this point should ever be touched by
// mere mortals so leave this stuff alone.
//
#if defined BB_SH
#if defined BB_FEATURE_COMMAND_EDITING
#define BB_CMDEDIT
#else
#undef BB_FEATURE_COMMAND_EDITING
#undef BB_FEATURE_COMMAND_TAB_COMPLETION
#undef BB_FEATURE_COMMAND_USERNAME_COMPLETION
#undef BB_FEATURE_SH_FANCY_PROMPT
#endif
#if ! defined BB_FEATURE_LASH && ! defined BB_FEATURE_HUSH && ! defined BB_FEATURE_MSH && ! defined BB_FEATURE_ASH
#define BB_FEATURE_MSH
#endif
#if defined BB_FEATURE_ASH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
#undef BB_FEATURE_LASH
#undef BB_FEATURE_HUSH
#undef BB_FEATURE_MSH
#elif defined BB_FEATURE_MSH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
#undef BB_FEATURE_LASH
#undef BB_FEATURE_HUSH
#undef BB_FEATURE_ASH
#elif defined BB_FEATURE_HUSH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
#undef BB_FEATURE_LASH
#undef BB_FEATURE_MSH
#undef BB_FEATURE_ASH
#elif defined BB_FEATURE_LASH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
#undef BB_FEATURE_HUSH
#undef BB_FEATURE_MSH
#undef BB_FEATURE_ASH
#endif
#else
#undef BB_FEATURE_SH_APPLETS_ALWAYS_WIN
#undef BB_FEATURE_SH_STANDALONE_SHELL
#undef BB_FEATURE_SH_FANCY_PROMPT
#endif
//
#ifdef BB_KILLALL
#ifndef BB_KILL
#define BB_KILL
#endif
#endif
//
#ifndef BB_INIT
#undef BB_FEATURE_LINUXRC
#endif
//
#if defined BB_MOUNT && defined BB_FEATURE_NFSMOUNT
#define BB_NFSMOUNT
#endif
//
#if defined BB_FEATURE_AUTOWIDTH
#ifndef BB_FEATURE_USE_TERMIOS
#define BB_FEATURE_USE_TERMIOS
#endif
#endif
//
#if defined BB_INSMOD || defined BB_LSMOD
#if ! defined BB_FEATURE_NEW_MODULE_INTERFACE && ! defined BB_FEATURE_OLD_MODULE_INTERFACE
#define BB_FEATURE_NEW_MODULE_INTERFACE
#endif
#endif
//
#ifdef BB_SYSLOGD
#if defined BB_FEATURE_IPC_SYSLOG
#define BB_LOGREAD
#endif
#endif
+17 -5
View File
@@ -1,8 +1,20 @@
1) Check Config.h and adjust if you need a different functionality than
defined by default.
1) Run 'make config' or 'make menuconfig' and select the
functionality that you wish to enable.
2) Check the Makefile
2) Run 'make dep'
3) make
3) Check the Makefile for any Makefile setting you wish
to adjust for your system (things like like setting
your cross compiler, adjusting optimizations, etc)
4) make install
4) Run 'make'
5) Go get a drink of water, drink a soda, visit the bathroom,
or whatever while it compiles. It doesn't take very
long to compile, so you don't really need to waste too
much time waiting...
6) Run 'make install' or 'make PREFIX=/target install' to
install busybox and all the needed links. Some people
will prefer to install using hardlinks and will instead
want to run 'make install-hardlinks'....
-38
View File
@@ -1,40 +1,3 @@
Original release code (unless otherwise noted)
Copyright 1995, 1996 Bruce Perens <bruce@pixar.com>
mkswap
Copyright 1991 Linus Torvalds
tiny-ls(ls)
Copyright 1996 Brian Candler <B.Candler@pobox.com>
tarcat, loadkmap, various fixes, Debian maintenance
Copyright 1998 Enrique Zanardi <ezanardi@ull.es>
more(v2), makedevs, dutmp, modularization, auto links file,
various fixes, Linux Router Project maintenance
Copyright 1998 Dave Cinege <dcinege@psychosis.com>
mini-gzip(gzip), mini-netcat(mnc)
Copyright 1998 Charles P. Wright <cpwright@villagenet.com>
Tons of new stuff as noted in header files
Copyright (C) 1999,2000,2001 by Lineo, inc. and written by
Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
Please feed suggestions, bug reports, insults, and bribes back to:
Erik Andersen
<andersen@lineo.com>
<andersee@debian.org>
Busybox may be used and distributed under the GNU General Public License.
---------------------------------------------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
@@ -375,4 +338,3 @@ proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
+226 -348
View File
@@ -1,6 +1,6 @@
# Makefile for busybox
#
# Copyright (C) 1999,2000,2001 Erik Andersen <andersee@debian.org>
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,275 +17,151 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
PROG := busybox
VERSION := 0.52
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
export VERSION
#--------------------------------------------------------------
# You shouldn't need to mess with anything beyond this point...
#--------------------------------------------------------------
noconfig_targets := menuconfig config oldconfig randconfig \
defconfig allyesconfig allnoconfig clean distclean \
release tags
# With a modern GNU make(1) (highly recommended, that's what all the
# developers use), all of the following configuration values can be
# overridden at the command line. For example:
# make CROSS=powerpc-linux- BB_SRC_DIR=$HOME/busybox PREFIX=/mnt/app
# If you want to add some simple compiler switches (like -march=i686),
# especially from the command line, use this instead of CFLAGS directly.
# For optimization overrides, it's better still to set OPTIMIZATION.
CFLAGS_EXTRA =
# If you want a static binary, turn this on.
DOSTATIC = false
# Set the following to `true' to make a debuggable build.
# Leave this set to `false' for production use.
DODEBUG = false
# Setting this to `true' will cause busybox to directly use the system's
# password and group functions. Assuming you use GNU libc, when this is
# `true', you will need to install the /etc/nsswitch.conf configuration file
# and the required libnss_* libraries. This generally makes your embedded
# system quite a bit larger... If you leave this off, busybox will directly use
# the /etc/password, /etc/group files (and your system will be smaller, and I
# will get fewer emails asking about how glibc NSS works). Enabling this adds
# just 1.4k to the binary size (which is a _lot_ less then glibc NSS costs).
# Note that if you want hostname resolution to work with glibc, you still need
# the libnss_* libraries. Most people will want to leave this set to false.
USE_SYSTEM_PWD_GRP = true
# This enables compiling with dmalloc ( http://dmalloc.com/ )
# which is an excellent public domain mem leak and malloc problem
# detector. To enable dmalloc, before running busybox you will
# want to first set up your environment.
# eg: `export DMALLOC_OPTIONS=debug=0x14f47d83,inter=100,log=logfile`
# Do not enable this for production builds...
DODMALLOC = false
# Electric-fence is another very useful malloc debugging library.
# Do not enable this for production builds...
DOEFENCE = false
# If you want large file summit support, turn this on.
# This has no effect if you don't have a kernel with lfs
# support, and a system with libc-2.1.3 or later.
# Some of the programs that can benefit from lfs support
# are dd, gzip, mount, tar, and mkfs_minix.
# LFS allows you to use the above programs for files
# larger than 2GB!
DOLFS = false
# If you have a "pristine" source directory, point BB_SRC_DIR to it.
# Experimental and incomplete; tell the mailing list
# <busybox@opensource.lineo.com> if you do or don't like it so far.
BB_SRC_DIR =
# If you are running a cross compiler, you may want to set this
# to something more interesting, like "powerpc-linux-".
CROSS =
CC = $(CROSS)gcc
AR = $(CROSS)ar
STRIPTOOL = $(CROSS)strip
# To compile vs uClibc, just use the compiler wrapper built by uClibc...
# This make things very easy? Everything should compile and work as
# expected these days...
#CC = ../uClibc/extra/gcc-uClibc/i386-uclibc-gcc
# To compile vs some other alternative libc, you may need to use/adjust
# the following lines to meet your needs...
#
# If you are using Red Hat 6.x with the compatible RPMs (for developing under
# Red Hat 5.x and glibc 2.0) uncomment the following. Be sure to read about
# using the compatible RPMs (compat-*) at http://www.redhat.com !
#LIBCDIR=/usr/i386-glibc20-linux
#
# The following is used for libc5 (if you install altgcc and libc5-altdev
# on a Debian system).
#LIBCDIR=/usr/i486-linuxlibc1
#
# For other libraries, you are on your own...
#LDFLAGS+=-nostdlib
#LIBRARIES = $(LIBCDIR)/lib/libc.a -lgcc
#CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR)
#GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
# use '-Os' optimization if available, else use -O2
OPTIMIZATION := $(shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
then echo "-Os"; else echo "-O2" ; fi)
WARNINGS = -Wall -Wshadow
ARFLAGS = -r
#
#--------------------------------------------------------
# If you're going to do a lot of builds with a non-vanilla configuration,
# it makes sense to adjust parameters above, so you can type "make"
# by itself, instead of following it by the same half-dozen overrides
# every time. The stuff below, on the other hand, is probably less
# prone to casual user adjustment.
#
ifeq ($(strip $(DOLFS)),true)
# For large file summit support
CFLAGS+=-D_FILE_OFFSET_BITS=64
ifndef TOPDIR
TOPDIR=$(CURDIR)/
endif
ifeq ($(strip $(DODMALLOC)),true)
# For testing mem leaks with dmalloc
CFLAGS+=-DDMALLOC
LIBRARIES = -ldmalloc
# Force debug=true, since this is useless when not debugging...
DODEBUG = true
else
ifeq ($(strip $(DOEFENCE)),true)
LIBRARIES = -lefence
# Force debug=true, since this is useless when not debugging...
DODEBUG = true
endif
ifndef top_srcdir
top_srcdir=$(CURDIR)
endif
ifeq ($(strip $(DODEBUG)),true)
CFLAGS += $(WARNINGS) -g -D_GNU_SOURCE
LDFLAGS += -Wl,-warn-common
STRIP =
else
CFLAGS += $(WARNINGS) $(OPTIMIZATION) -fomit-frame-pointer -D_GNU_SOURCE
LDFLAGS += -s -Wl,-warn-common
STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG)
endif
ifeq ($(strip $(DOSTATIC)),true)
LDFLAGS += --static
#
#use '-ffunction-sections -fdata-sections' and '--gc-sections' (if they
# work) to try and strip out any unused junk. Doesn't do much for me,
# but you may want to give it a shot...
#
#ifeq ($(shell $(CC) -ffunction-sections -fdata-sections -S \
# -o /dev/null -xc /dev/null 2>/dev/null && $(LD) \
# --gc-sections -v >/dev/null && echo 1),1)
# CFLAGS += -ffunction-sections -fdata-sections
# LDFLAGS += --gc-sections
#endif
ifndef top_builddir
top_builddir=$(CURDIR)
endif
ifndef $(PREFIX)
PREFIX = `pwd`/_install
srctree=$(top_srcdir)
vpath %/Config.in $(srctree)
include $(top_builddir)/Rules.mak
DIRS:=applets archival archival/libunarchive coreutils console-tools \
debianutils editors findutils init miscutils modutils networking \
networking/libiproute networking/udhcp procps loginutils shell \
sysklogd util-linux libpwdgrp coreutils/libcoreutils libbb
SRC_DIRS:=$(patsubst %,$(top_srcdir)/%,$(DIRS))
ifeq ($(strip $(CONFIG_SELINUX)),y)
CFLAGS += -I/usr/include/selinux
LIBRARIES += -lsecure
endif
# Additional complications due to support for pristine source dir.
# Include files in the build directory should take precedence over
# the copy in BB_SRC_DIR, both during the compilation phase and the
# shell script that finds the list of object files.
# Work in progress by <ldoolitt@recycle.lbl.gov>.
#
ifneq ($(strip $(BB_SRC_DIR)),)
VPATH = $(BB_SRC_DIR)
endif
#ifneq ($(strip $(VPATH)),)
# CFLAGS += -I- -I. $(patsubst %,-I%,$(subst :, ,$(VPATH)))
#endif
CONFIG_CONFIG_IN = $(top_srcdir)/sysdeps/$(TARGET_OS)/Config.in
CONFIG_DEFCONFIG = $(top_srcdir)/sysdeps/$(TARGET_OS)/defconfig
# We need to set APPLET_SOURCES to something like
# $(shell busybox.sh Config.h)
# but in a manner that works with VPATH and BB_SRC_DIR.
# Possible ways to approach this:
#
# 1. Explicitly search through .:$(VPATH) for busybox.sh and config.h,
# then $(shell $(BUSYBOX_SH) $(CONFIG_H) $(BB_SRC_DIR))
#
# 2. Explicity search through .:$(VPATH) for slist.mk,
# then $(shell $(MAKE) -f $(SLIST_MK) VPATH=$(VPATH) BB_SRC_DIR=$(BB_SRC_DIR))
#
# 3. Create slist.mk in this directory, with commands embedded in
# a $(shell ...) command, and $(MAKE) it immediately.
#
# 4. Use a real rule within this makefile to create a file that sets
# APPLET_SOURCE_LIST, then include that file. Has complications
# with the first trip through the makefile (before processing the
# include) trying to do too much, and a spurious warning the first
# time make is run.
#
# This is option 3:
#
#APPLET_SOURCES = $(shell \
# echo -e 'all: busybox.sh Config.h\n\t@ $$(SHELL) $$^ $$(BB_SRC_DIR)' >slist.mk; \
# make -f slist.mk VPATH=$(VPATH) BB_SRC_DIR=$(BB_SRC_DIR) \
#)
# And option 4:
-include applet_source_list
ALL_DIRS:= $(DIRS) scripts/config
ALL_MAKEFILES:=$(patsubst %,%/Makefile,$(ALL_DIRS))
OBJECTS = $(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o
CFLAGS += $(CROSS_CFLAGS)
CFLAGS += -DBB_VER='"$(VERSION)"'
CFLAGS += -DBB_BT='"$(BUILDTIME)"'
ifdef BB_INIT_SCRIPT
CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"'
ifeq ($(KBUILD_SRC),)
ifdef O
ifeq ("$(origin O)", "command line")
KBUILD_OUTPUT := $(O)
endif
endif
ifneq ($(strip $(USE_SYSTEM_PWD_GRP)),true)
PWD_GRP = pwd_grp
PWD_GRP_DIR = $(BB_SRC_DIR:=/)$(PWD_GRP)
PWD_LIB = libpwd.a
PWD_CSRC=__getpwent.c pwent.c getpwnam.c getpwuid.c putpwent.c getpw.c \
fgetpwent.c __getgrent.c grent.c getgrnam.c getgrgid.c fgetgrent.c \
initgroups.c setgroups.c
PWD_OBJS=$(patsubst %.c,$(PWD_GRP)/%.o, $(PWD_CSRC))
PWD_CFLAGS = -I$(PWD_GRP_DIR)
else
CFLAGS += -DUSE_SYSTEM_PWD_GRP
endif
LIBBB = libbb
LIBBB_LIB = libbb.a
LIBBB_CSRC= ask_confirmation.c chomp.c concat_path_file.c copy_file.c \
copy_file_chunk.c daemon.c device_open.c error_msg.c \
error_msg_and_die.c fgets_str.c find_mount_point.c find_pid_by_name.c \
find_root_device.c full_read.c full_write.c get_console.c \
get_last_path_component.c get_line_from_file.c gz_open.c human_readable.c \
isdirectory.c kernel_version.c loop.c mode_string.c module_syscalls.c mtab.c \
mtab_file.c my_getgrnam.c my_getgrgid.c my_getpwnam.c my_getpwnamegid.c \
my_getpwuid.c parse_mode.c parse_number.c perror_msg.c perror_msg_and_die.c \
print_file.c process_escape_sequence.c read_package_field.c recursive_action.c \
safe_read.c safe_strncpy.c syscalls.c syslog_msg_with_name.c time_string.c \
trim.c unzip.c vdprintf.c verror_msg.c vperror_msg.c wfopen.c xfuncs.c \
xgetcwd.c xreadlink.c xregcomp.c interface.c remove_file.c last_char_is.c \
copyfd.c vherror_msg.c herror_msg.c herror_msg_and_die.c xgethostbyname.c \
dirname.c make_directory.c
LIBBB_OBJS=$(patsubst %.c,$(LIBBB)/%.o, $(LIBBB_CSRC))
LIBBB_CFLAGS = -I$(LIBBB)
ifneq ($(strip $(BB_SRC_DIR)),)
LIBBB_CFLAGS += -I$(BB_SRC_DIR)/$(LIBBB)
# That's our default target when none is given on the command line
.PHONY: _all
_all:
ifneq ($(KBUILD_OUTPUT),)
# Invoke a second make in the output directory, passing relevant variables
# check that the output directory actually exists
saved-output := $(KBUILD_OUTPUT)
KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
$(if $(wildcard $(KBUILD_OUTPUT)),, \
$(error output directory "$(saved-output)" does not exist))
.PHONY: $(MAKECMDGOALS)
$(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile
$(MAKE) -C $(KBUILD_OUTPUT) \
top_srcdir=$(CURDIR) \
top_builddir=$(KBUILD_OUTPUT) \
TOPDIR=$(KBUILD_OUTPUT) \
KBUILD_SRC=$(CURDIR) \
-f $(CURDIR)/Makefile $@
$(KBUILD_OUTPUT)/Rules.mak:
@echo > $@
@echo top_srcdir=$(CURDIR) >> $@
@echo top_builddir=$(KBUILD_OUTPUT) >> $@
@echo include $(top_srcdir)/Rules.mak >> $@
$(KBUILD_OUTPUT)/Makefile:
@echo > $@
@echo top_srcdir=$(CURDIR) >> $@
@echo top_builddir=$(KBUILD_OUTPUT) >> $@
@echo KBUILD_SRC='$$(top_srcdir)' >> $@
@echo include '$$(KBUILD_SRC)'/Makefile >> $@
# Leave processing to above invocation of make
skip-makefile := 1
endif # ifneq ($(KBUILD_OUTPUT),)
endif # ifeq ($(KBUILD_SRC),)
ifeq ($(skip-makefile),)
_all: all
ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
all: busybox busybox.links doc
all_tree: $(ALL_MAKEFILES)
$(ALL_MAKEFILES): %/Makefile: $(top_srcdir)/%/Makefile
d=`dirname $@`; [ -d "$$d" ] || mkdir -p "$$d"; cp $< $@
# In this section, we need .config
-include $(top_builddir)/.config.cmd
include $(patsubst %,%/Makefile.in, $(SRC_DIRS))
-include $(top_builddir)/.depend
busybox: $(ALL_MAKEFILES) .depend include/config.h $(libraries-y)
$(CC) $(LDFLAGS) -o $@ -Wl,--start-group $(libraries-y) $(LIBRARIES) -Wl,--end-group
$(STRIPCMD) $@
busybox.links: $(top_srcdir)/applets/busybox.mkll include/config.h $(top_srcdir)/include/applets.h
- $(SHELL) $^ >$@
install: applets/install.sh busybox busybox.links
$(SHELL) $< $(PREFIX)
ifeq ($(strip $(CONFIG_FEATURE_SUID)),y)
@echo
@echo
@echo --------------------------------------------------
@echo You will probably need to make your busybox binary
@echo setuid root to ensure all configured applets will
@echo work properly.
@echo --------------------------------------------------
@echo
endif
LIBBB_MSRC=libbb/messages.c
LIBBB_MESSAGES= full_version name_too_long omitting_directory not_a_directory \
memory_exhausted invalid_date invalid_option io_error dash_dash_help \
write_error too_few_args name_longer_than_foo unknown
LIBBB_MOBJ=$(patsubst %,$(LIBBB)/%.o, $(LIBBB_MESSAGES))
uninstall: busybox.links
rm -f $(PREFIX)/bin/busybox
for i in `cat busybox.links` ; do rm -f $(PREFIX)$$i; done
LIBBB_ARCSRC=libbb/unarchive.c
LIBBB_ARCOBJ= archive_offset seek_sub_file extract_archive unarchive \
get_header_ar get_header_cpio get_header_tar deb_extract
LIBBB_AROBJS=$(patsubst %,$(LIBBB)/%.o, $(LIBBB_ARCOBJ))
install-hardlinks: applets/install.sh busybox busybox.links
$(SHELL) $< $(PREFIX) --hardlinks
check: busybox
bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite \
$(top_srcdir)/testsuite/runtest
# Put user-supplied flags at the end, where they
# have a chance of winning.
CFLAGS += $(CFLAGS_EXTRA)
# Documentation Targets
doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
.EXPORT_ALL_VARIABLES:
all: applet_source_list busybox busybox.links doc
applet_source_list: busybox.sh Config.h
(echo -n "APPLET_SOURCES := "; BB_SRC_DIR=$(BB_SRC_DIR) $(SHELL) $^) > $@
doc: olddoc
# Old Docs...
olddoc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
docs/busybox.pod : docs/busybox_header.pod usage.h docs/busybox_footer.pod
- ( cat docs/busybox_header.pod; \
docs/autodocifier.pl usage.h; \
cat docs/busybox_footer.pod ) > docs/busybox.pod
docs/busybox.pod : $(top_srcdir)/docs/busybox_header.pod $(top_srcdir)/include/usage.h $(top_srcdir)/docs/busybox_footer.pod
-mkdir -p docs
- ( cat $(top_srcdir)/docs/busybox_header.pod; \
$(top_srcdir)/docs/autodocifier.pl $(top_srcdir)/include/usage.h; \
cat $(top_srcdir)/docs/busybox_footer.pod ) > docs/busybox.pod
docs/BusyBox.txt: docs/busybox.pod
@echo
@@ -299,139 +175,141 @@ docs/BusyBox.1: docs/busybox.pod
- pod2man --center=BusyBox --release="version $(VERSION)" \
$< > $@
docs/BusyBox.html: docs/busybox.lineo.com/BusyBox.html
docs/BusyBox.html: docs/busybox.net/BusyBox.html
- mkdir -p docs
-@ rm -f docs/BusyBox.html
-@ ln -s busybox.lineo.com/BusyBox.html docs/BusyBox.html
-@ cp docs/busybox.net/BusyBox.html docs/BusyBox.html
docs/busybox.lineo.com/BusyBox.html: docs/busybox.pod
-@ mkdir -p docs/busybox.lineo.com
docs/busybox.net/BusyBox.html: docs/busybox.pod
-@ mkdir -p docs/busybox.net
- pod2html --noindex $< > \
docs/busybox.lineo.com/BusyBox.html
docs/busybox.net/BusyBox.html
-@ rm -f pod2htm*
# The nifty new buildsystem stuff
scripts/mkdep: $(top_srcdir)/scripts/mkdep.c
$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
# New docs based on DOCBOOK SGML
newdoc: docs/busybox.txt docs/busybox.pdf docs/busybox/busyboxdocumentation.html
scripts/split-include: $(top_srcdir)/scripts/split-include.c
$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
docs/busybox.txt: docs/busybox.sgml
.depend: scripts/mkdep
rm -f .depend .hdepend;
mkdir -p include/config;
scripts/mkdep -I include -- \
`find $(top_srcdir) -name \*.c -print | sed -e "s,^./,,"` >> .depend;
scripts/mkdep -I include -- \
`find $(top_srcdir) -name \*.h -print | sed -e "s,^./,,"` >> .hdepend;
depend dep: include/config.h .depend
include/config/MARKER: depend scripts/split-include
scripts/split-include include/config.h include/config
@ touch include/config/MARKER
include/config.h: .config
@if [ ! -x $(top_builddir)/scripts/config/conf ] ; then \
$(MAKE) -C scripts/config conf; \
fi;
@$(top_builddir)/scripts/config/conf -o $(CONFIG_CONFIG_IN)
finished2:
@echo
@echo BusyBox Documentation
@echo Finished installing...
@echo
- mkdir -p docs
(cd docs; sgmltools -b txt busybox.sgml)
docs/busybox.dvi: docs/busybox.sgml
- mkdir -p docs
(cd docs; sgmltools -b dvi busybox.sgml)
else # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
docs/busybox.ps: docs/busybox.sgml
- mkdir -p docs
(cd docs; sgmltools -b ps busybox.sgml)
all: menuconfig
docs/busybox.pdf: docs/busybox.ps
- mkdir -p docs
(cd docs; ps2pdf busybox.ps)
# configuration
# ---------------------------------------------------------------------------
docs/busybox/busyboxdocumentation.html: docs/busybox.sgml
- mkdir -p docs
(cd docs/busybox.lineo.com; sgmltools -b html ../busybox.sgml)
$(ALL_MAKEFILES): %/Makefile: $(top_srcdir)/%/Makefile
d=`dirname $@`; [ -d "$$d" ] || mkdir -p "$$d"; cp $< $@
scripts/config/conf: scripts/config/Makefile Rules.mak
$(MAKE) -C scripts/config conf
-@if [ ! -f .config ] ; then \
cp $(CONFIG_DEFCONFIG) .config; \
fi
busybox: $(PWD_LIB) $(LIBBB_LIB) $(OBJECTS)
$(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBBB_LIB) $(PWD_LIB) $(LIBRARIES)
$(STRIP)
scripts/config/mconf: scripts/config/Makefile Rules.mak
$(MAKE) -C scripts/config ncurses conf mconf
-@if [ ! -f .config ] ; then \
cp $(CONFIG_DEFCONFIG) .config; \
fi
# Without VPATH, rule expands to "/bin/sh busybox.mkll Config.h applets.h"
# but with VPATH, some or all of those file names are resolved to the
# directories in which they live.
busybox.links: busybox.mkll Config.h applets.h
- $(SHELL) $^ >$@
menuconfig: scripts/config/mconf
@./scripts/config/mconf $(CONFIG_CONFIG_IN)
nfsmount.o cmdedit.o: %.o: %.h
sh.o: cmdedit.h
$(OBJECTS): %.o: %.c Config.h busybox.h applets.h Makefile
$(CC) -I- $(CFLAGS) -I. $(patsubst %,-I%,$(subst :, ,$(BB_SRC_DIR))) -c $< -o $*.o
config: scripts/config/conf
@./scripts/config/conf $(CONFIG_CONFIG_IN)
$(PWD_OBJS): %.o: %.c Config.h busybox.h applets.h Makefile
- mkdir -p $(PWD_GRP)
$(CC) $(CFLAGS) $(PWD_CFLAGS) -c $< -o $*.o
oldconfig: scripts/config/conf
@./scripts/config/conf -o $(CONFIG_CONFIG_IN)
$(LIBBB_OBJS): %.o: %.c Config.h busybox.h applets.h Makefile libbb/libbb.h
- mkdir -p $(LIBBB)
$(CC) $(CFLAGS) $(LIBBB_CFLAGS) -c $< -o $*.o
randconfig: scripts/config/conf
@./scripts/config/conf -r $(CONFIG_CONFIG_IN)
$(LIBBB_MOBJ): $(LIBBB_MSRC)
- mkdir -p $(LIBBB)
$(CC) $(CFLAGS) $(LIBBB_CFLAGS) -DL_$(patsubst libbb/%,%,$*) -c $< -o $*.o
allyesconfig: scripts/config/conf
@./scripts/config/conf -y $(CONFIG_CONFIG_IN)
sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
sed -i -e "s/^USING_CROSS_COMPILER.*/# USING_CROSS_COMPILER is not set/" .config
sed -i -e "s/^CONFIG_STATIC.*/# CONFIG_STATIC is not set/" .config
sed -i -e "s/^CONFIG_SELINUX.*/# CONFIG_SELINUX is not set/" .config
@./scripts/config/conf -o $(CONFIG_CONFIG_IN)
$(LIBBB_AROBJS): $(LIBBB_ARCSRC)
- mkdir -p $(LIBBB)
$(CC) $(CFLAGS) $(LIBBB_CFLAGS) -DL_$(patsubst libbb/%,%,$*) -c $< -o $*.o
allnoconfig: scripts/config/conf
@./scripts/config/conf -n $(CONFIG_CONFIG_IN)
libpwd.a: $(PWD_OBJS)
$(AR) $(ARFLAGS) $@ $^
libbb.a: $(LIBBB_MOBJ) $(LIBBB_AROBJS) $(LIBBB_OBJS)
$(AR) $(ARFLAGS) $@ $^
usage.o: usage.h
sh.o: sh.c lash.c hush.c msh.c ash.c
libbb/loop.o: libbb/loop.h
libbb/loop.h: mk_loop_h.sh
@ $(SHELL) $< > $@
test tests:
# old way of doing it
#cd tests && $(MAKE) all
# new way of doing it
cd tests && ./tester.sh
defconfig: scripts/config/conf
@./scripts/config/conf -d $(CONFIG_CONFIG_IN)
clean:
- cd tests && $(MAKE) clean
- rm -f docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
docs/busybox.lineo.com/BusyBox.html
- rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \
docs/busybox.pdf docs/busybox.lineo.com/busybox.html
- rm -f multibuild.log Config.h.orig
- rm -rf docs/busybox _install libpwd.a libbb.a pod2htm*
- rm -f busybox.links libbb/loop.h *~ slist.mk core applet_source_list
- find -name \*.o -exec rm -f {} \;
- rm -f docs/busybox.dvi docs/busybox.ps \
docs/busybox.pod docs/busybox.net/busybox.html \
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 {} \;
distclean: clean
- rm -f busybox applet_source_list
- cd tests && $(MAKE) distclean
- rm -f scripts/split-include scripts/mkdep
- rm -rf include/config include/config.h
- find . -name .depend -exec rm -f {} \;
rm -f .config .config.old .config.cmd
- $(MAKE) -C scripts/config clean
install: install.sh busybox busybox.links
$(SHELL) $< $(PREFIX)
install-hardlinks: install.sh busybox busybox.links
$(SHELL) $< $(PREFIX) --hardlinks
debug_pristine:
@ echo VPATH=\"$(VPATH)\"
@ echo OBJECTS=\"$(OBJECTS)\"
dist release: distclean doc
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)/;
.PHONY: tags
tags:
ctags -R .
endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
endif # ifeq ($(skip-makefile),)
.PHONY: dummy subdirs release distclean clean config oldconfig \
menuconfig tags check test depend buildtree
+67 -63
View File
@@ -1,123 +1,127 @@
Please see the LICENSE file for copyright information.
Please see the LICENSE file for details on copying and usage.
BusyBox combines tiny versions of many common UNIX utilities into a single
small executable. It provides minimalist replacements for most of the utilities
you usually find in fileutils, shellutils, findutils, textutils, grep, gzip,
tar, etc. BusyBox provides a fairly complete POSIX environment for any small or
embedded system. The utilities in BusyBox generally have fewer options than
their full featured GNU cousins; however, the options that are included provide
the expected functionality and behave very much like their GNU counterparts.
you usually find in GNU coreutils, util-linux, 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 has been written with size-optimization and limited resources in mind.
It is also extremely modular so you can easily include or exclude commands (or
features) at compile time. This makes it easy to customize your embedded
systems. To create a working system, just add /dev, a shell, and a kernel. For
a really minimal system, you can even use the busybox shell (not Bourne
compatible, but very small and quite usable) and the busybox vi editor.
systems. To create a working system, just add /dev, /etc, and a Linux kernel.
BusyBox provides a fairly complete POSIX environment for any small or embedded
system.
BusyBox was originally written to support the Debian Rescue/Install disks, but
it also makes an excellent environment for any small or embedded system.
As of version 0.20 there is now a version number. : ) Also as of version 0.20,
BusyBox is now modularized to easily allow you to build only the components you
need, thereby reducing binary size. To turn off unwanted BusyBox components,
simply edit the file "Config.h" and comment out the components you do not need
using C++ style (//) comments.
BusyBox is extremely configurable. This allows you to include only the
components you need, thereby reducing binary size. Run 'make config' or
'make menuconfig' to select the functionality that you wish to enable.
After the build is complete, a busybox.links file is generated. This is
used by 'make install' to create symlinks to the busybox binary for all
used by 'make install' to create symlinks to the BusyBox binary for all
compiled in functions. By default, 'make install' will place the symlink
forest into `pwd`/_install unless you have defined the PREFIX environment
variable (i.e., 'make PREFIX=/tmp/foo install')
If you wish to install hard links, rather than symlinks, you can use
'make PREFIX=/tmp/foo install-hardlinks' instead.
----------------
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, and MIPS.
BusyBox in general will build on any architecture supported by gcc.
Kernel module loading for 2.2 and 2.4 Linux kernels is currently
limited to ARM, CRIS, H8/300, x86, ia64, x86_64, m68k, MIPS, PowerPC,
S390, SH3/4/5, Sparc, v850e, and x86_64 for 2.4.x kernels. For 2.6.x
kernels, kernel module loading support should work on all architectures.
Supported libcs:
glibc-2.0.x, glibc-2.1.x, Linux-libc5, uClibc. People are looking at
newlib and diet-libc, but consider them unsupported, untested, or worse.
Supported C Libraries:
uClibc and glibc are supported. People have been looking at newlib and
dietlibc, but they are currently considered unsupported, untested, or
worse. Linux-libc5 is no longer supported -- you should probably use uClibc
instead if you want a small C library.
Supported kernels:
Full functionality requires Linux 2.0.x, 2.2.x, or 2.4.x. A large fraction
of the code should run on just about anything.
Full functionality requires Linux 2.2.x or better. A large fraction of the
code should run on just about anything. While the current code is fairly
Linux specific, it should be fairly easy to port the majority of the code
to support, say, FreeBSD or Solaris, or Mac OS X, or even Windows (if you
are into that sort of thing).
----------------
Getting help:
When you find you need help, you can check out the BusyBox mailing list
archives at http://opensource.lineo.com/lists/busybox/ or even join
archives at http://busybox.net/lists/busybox/ or even join
the mailing list if you are interested.
----------------
Bugs:
If you find bugs, please submit a bug report. Full instructions on how to
report a bug are found at http://bugs.lineo.com/Reporting.html.
If you find bugs, please submit a detailed bug report to the BusyBox mailing
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:
For the impatient: To submit a bug, simply send an email describing the problem
to submit@bugs.lineo.com. Bug reports should look something like this:
To: submit@bugs.lineo.com
To: busybox@mail.busybox.net
From: diligent@testing.linux.org
Subject: /bin/true doesn't work
Subject: /bin/date doesn't work
Package: busybox
Version: 0.51
Package: BusyBox
Version: 1.00
When I execute BusyBox 'date' it produces unexpected results.
With GNU date I get the following output:
$ date
Fri Oct 8 14:19:41 MDT 2004
But when I use BusyBox date I get this instead:
$ date
illegal instruction
I am using Debian unstable, kernel version 2.4.25-vrs2 on a Netwinder,
and the latest uClibc from CVS. Thanks for the wonderful program!
When I invoke '/bin/true' it doesn't work. I expected it to return
a "0" but it returned a "1" instead. Here is the transcript:
$ /bin/true ; echo $?
1
With GNU /bin/true, I get the following output:
$ /bin/true ; echo $?
0
I am using Debian 2.2r2, kernel version 2.2.18, and the latest
uClibc from CVS. Thanks for the wonderful program!
-Diligent
Note the careful description and use of examples showing not only what BusyBox
does, but also a counter example showing what an equivalent GNU app does. Bug
reports lacking such detail may take a _long_ time to be fixed... Thanks for
understanding.
reports lacking such detail may never be fixed... Thanks for understanding.
----------------
FTP:
Downloads:
Source for the latest released version can always be downloaded from
ftp://ftp.lineo.com/pub/busybox.
Source for the latest released version, as well as daily snapshots, can always
be downloaded from
http://busybox.net/downloads/
----------------
CVS:
BusyBox now has its own publicly browsable CVS tree at:
http://opensource.lineo.com/cgi-bin/cvsweb/busybox/
http://busybox.net/cgi-bin/cvsweb/busybox/
Anonymous CVS access is available. For instructions, check out:
http://opensource.lineo.com/cvs_anon.html
http://busybox.net/cvs_anon.html
For those that are actively contributing there is even CVS write access:
http://opensource.lineo.com/cvs_write.html
http://busybox.net/cvs_write.html
----------------
Please feed suggestions, bug reports, insults, and bribes back to:
Erik Andersen
<andersen@lineo.com>
<andersee@debian.org>
<andersee@codepoet.org>
<blatant plug>
Many thanks to go to Lineo for paying me to work on busybox.
</blatant plug>
Erik Andersen
<andersen@codepoet.org>
+196
View File
@@ -0,0 +1,196 @@
# Rules.make for busybox
#
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#--------------------------------------------------------
PROG := busybox
VERSION := 1.00
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
#--------------------------------------------------------
# With a modern GNU make(1) (highly recommended, that's what all the
# developers use), all of the following configuration values can be
# overridden at the command line. For example:
# make CROSS=powerpc-linux- BB_SRC_DIR=$HOME/busybox PREFIX=/mnt/app
#--------------------------------------------------------
# If you are running a cross compiler, you will want to set 'CROSS'
# to something more interesting... Target architecture is determined
# by asking the CC compiler what arch it compiles things for, so unless
# your compiler is broken, you should not need to specify TARGET_ARCH
CROSS =$(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
CC = $(CROSS)gcc
AR = $(CROSS)ar
AS = $(CROSS)as
LD = $(CROSS)ld
NM = $(CROSS)nm
STRIP = $(CROSS)strip
CPP = $(CC) -E
# MAKEFILES = $(top_builddir)/.config
# What OS are you compiling busybox for? This allows you to include
# OS specific things, syscall overrides, etc.
TARGET_OS=linux
# Select the compiler needed to build binaries for your development system
HOSTCC = gcc
HOSTCFLAGS= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
LC_ALL:= C
# If you want to add some simple compiler switches (like -march=i686),
# especially from the command line, use this instead of CFLAGS directly.
# For optimization overrides, it's better still to set OPTIMIZATION.
CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS)))
# If you have a "pristine" source directory, point BB_SRC_DIR to it.
# Experimental and incomplete; tell the mailing list
# <busybox@busybox.net> if you do or don't like it so far.
BB_SRC_DIR=
# To compile vs some other alternative libc, you may need to use/adjust
# the following lines to meet your needs...
#
# If you are using Red Hat 6.x with the compatible RPMs (for developing under
# Red Hat 5.x and glibc 2.0) uncomment the following. Be sure to read about
# using the compatible RPMs (compat-*) at http://www.redhat.com !
#LIBCDIR:=/usr/i386-glibc20-linux
#
# For other libraries, you are on your own. But these may (or may not) help...
#LDFLAGS+=-nostdlib
#LIBRARIES:=$(LIBCDIR)/lib/libc.a -lgcc
#CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR)
#GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
WARNINGS=-Wall -Wstrict-prototypes -Wshadow
CFLAGS=-I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)
ARFLAGS=-r
#--------------------------------------------------------
export VERSION BUILDTIME TOPDIR HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
ifeq ($(strip $(TARGET_ARCH)),)
TARGET_ARCH=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
-e 's/i.86/i386/' \
-e 's/sparc.*/sparc/' \
-e 's/arm.*/arm/g' \
-e 's/m68k.*/m68k/' \
-e 's/ppc/powerpc/g' \
-e 's/v850.*/v850/g' \
-e 's/sh[234]/sh/' \
-e 's/mips-.*/mips/' \
-e 's/mipsel-.*/mipsel/' \
-e 's/cris.*/cris/' \
)
endif
# Pull in the user's busybox configuration
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
-include $(top_builddir)/.config
endif
# A nifty macro to make testing gcc features easier
check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
then echo "$(1)"; else echo "$(2)"; fi)
#--------------------------------------------------------
# Arch specific compiler optimization stuff should go here.
# Unless you want to override the defaults, do not set anything
# for OPTIMIZATION...
# use '-Os' optimization if available, else use -O2
OPTIMIZATION=
OPTIMIZATION=${call check_gcc,-Os,-O2}
# Some nice architecture specific optimizations
ifeq ($(strip $(TARGET_ARCH)),arm)
OPTIMIZATION+=-fstrict-aliasing
endif
ifeq ($(strip $(TARGET_ARCH)),i386)
OPTIMIZATION+=$(call check_gcc,-march=i386,)
OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=2,)
OPTIMIZATION+=$(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,\
-malign-functions=0 -malign-jumps=0 -malign-loops=0)
endif
OPTIMIZATIONS=$(OPTIMIZATION) -fomit-frame-pointer
#
#--------------------------------------------------------
# If you're going to do a lot of builds with a non-vanilla configuration,
# it makes sense to adjust parameters above, so you can type "make"
# by itself, instead of following it by the same half-dozen overrides
# every time. The stuff below, on the other hand, is probably less
# prone to casual user adjustment.
#
ifeq ($(strip $(CONFIG_LFS)),y)
# For large file summit support
CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
endif
ifeq ($(strip $(CONFIG_DMALLOC)),y)
# For testing mem leaks with dmalloc
CFLAGS+=-DDMALLOC
LIBRARIES:=-ldmalloc
else
ifeq ($(strip $(CONFIG_EFENCE)),y)
LIBRARIES:=-lefence
endif
endif
ifeq ($(strip $(CONFIG_DEBUG)),y)
CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE
LDFLAGS +=-Wl,-warn-common
STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging
else
CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG
LDFLAGS += -s -Wl,-warn-common
STRIPCMD:=$(STRIP) --remove-section=.note --remove-section=.comment
endif
ifeq ($(strip $(CONFIG_STATIC)),y)
LDFLAGS += --static
endif
ifeq ($(strip $(PREFIX)),)
PREFIX:=`pwd`/_install
endif
# Additional complications due to support for pristine source dir.
# Include files in the build directory should take precedence over
# the copy in BB_SRC_DIR, both during the compilation phase and the
# shell script that finds the list of object files.
# Work in progress by <ldoolitt@recycle.lbl.gov>.
#
ifneq ($(strip $(BB_SRC_DIR)),)
VPATH:=$(BB_SRC_DIR)
endif
OBJECTS:=$(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o
CFLAGS += $(CROSS_CFLAGS)
ifdef BB_INIT_SCRIPT
CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"'
endif
# Put user-supplied flags at the end, where they
# have a chance of winning.
CFLAGS += $(CFLAGS_EXTRA)
.PHONY: dummy
.EXPORT_ALL_VARIABLES:
+8 -54
View File
@@ -1,57 +1,11 @@
TODO list for busybox in no particular order. Just because something
is listed here doesn't mean that it is going to be added to busybox,
or that doing so is even a good idea. It just means that I _might_ get
around to it some time. If you have any good ideas, please let me know.
Busybox TODO
* login/sulogin/passwd/getty/etc are part of tinylogin, and so are not
needed or wanted in busybox (or else I'd have to link to libcrypt).
Stuff that needs to be done
* We _were_ going to split networking apps into a new package called
netkit-tiny. Per discussions on the mailing list, this isn't going
to happen. False alarm. Sorry about the confusion.
----
tr - missing SuS3 features in busybox 1.0pre10
-Erik
-----------
Possible apps to include some time:
* hwclock
* start-stop-daemon
* group/commonize strings, remove dups (for i18n, l10n)
-----------
With sysvinit, reboot, poweroff and halt all used a named pipe,
/dev/initctl, to communicate with the init process. Busybox
currently uses signals to communicate with init. This makes
busybox incompatible with sysvinit. We should probably use
a named pipe as well so we can be compatible.
-----------------------
Run the following:
rm -f busybox && make LDFLAGS+=-nostdlib 2>&1 | \
sed -ne 's/.*undefined reference to `\(.*\)..*/\1/gp' | sort | uniq
reveals the list of all external (i.e., libc) things that BusyBox depends on.
It would be a very nice thing to reduce this list to an absolute minimum, to
reduce the footprint of busybox, especially when staticly linking with
libraries such as uClibc.
-----------------------
Compile with debugging on, run 'nm --size-sort ./busybox'
and then start with the biggest things and make them smaller...
-----------------------
du.c probably ought to have an -x switch like GNU du does...
-----------------------
xargs could use a -l option
------------------------------------------------------------------
tr doesnt support [:blank:], [:digit:] or other predefined classes, [=equiv=]
support is also missing.
----
-176
View File
@@ -1,176 +0,0 @@
/*
* adjtimex.c - read, and possibly modify, the Linux kernel `timex' variables.
*
* Originally written: October 1997
* Last hack: March 2001
* Copyright 1997, 2000, 2001 Larry Doolittle <LRDoolittle@lbl.gov>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (Version 2,
* June 1991) as published by the Free Software Foundation. At the
* time of writing, that license was published by the FSF with the URL
* http://www.gnu.org/copyleft/gpl.html, and is incorporated herein by
* reference.
*
* 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.
*
* This adjtimex(1) is very similar in intent to adjtimex(8) by Steven
* Dick <ssd@nevets.oau.org> and Jim Van Zandt <jrv@vanzandt.mv.com>
* (see http://metalab.unc.edu/pub/Linux/system/admin/time/adjtimex*).
* That version predates this one, and is _much_ bigger and more
* featureful. My independently written version was very similar to
* Steven's from the start, because they both follow the kernel timex
* structure. I further tweaked this version to be equivalent to Steven's
* where possible, but I don't like getopt_long, so the actual usage
* syntax is incompatible.
*
* Amazingly enough, my Red Hat 5.2 sys/timex (and sub-includes)
* don't actually give a prototype for adjtimex(2), so building
* this code (with -Wall) gives a warning. Later versions of
* glibc fix this issue.
*
* This program is too simple for a Makefile, just build with:
* gcc -Wall -O adjtimex.c -o adjtimex
*
* busyboxed 20 March 2001, Larry Doolittle <ldoolitt@recycle.lbl.gov>
* It will autosense if it is built in a busybox environment, based
* on the BB_VER preprocessor macro.
*/
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
#if __GNU_LIBRARY__ < 5
#include <sys/timex.h>
extern int adjtimex(struct timex *buf);
#else
#include <sys/timex.h>
#endif
#ifdef BB_VER
#include "busybox.h"
#endif
static struct {int bit; char *name;} statlist[] = {
{ STA_PLL, "PLL" },
{ STA_PPSFREQ, "PPSFREQ" },
{ STA_PPSTIME, "PPSTIME" },
{ STA_FLL, "FFL" },
{ STA_INS, "INS" },
{ STA_DEL, "DEL" },
{ STA_UNSYNC, "UNSYNC" },
{ STA_FREQHOLD, "FREQHOLD" },
{ STA_PPSSIGNAL, "PPSSIGNAL" },
{ STA_PPSJITTER, "PPSJITTER" },
{ STA_PPSWANDER, "PPSWANDER" },
{ STA_PPSERROR, "PPSERROR" },
{ STA_CLOCKERR, "CLOCKERR" },
{ 0, NULL } };
static char *ret_code_descript[] = {
"clock synchronized",
"insert leap second",
"delete leap second",
"leap second in progress",
"leap second has occurred",
"clock not synchronized" };
#ifdef BB_VER
#define main adjtimex_main
#else
void usage(char *prog)
{
fprintf(stderr,
"Usage: %s [ -q ] [ -o offset ] [ -f frequency ] [ -p timeconstant ] [ -t tick ]\n",
prog);
}
#define show_usage() usage(argv[0])
#endif
int main(int argc, char ** argv)
{
struct timex txc;
int quiet=0;
int c, i, ret, sep;
char *descript;
txc.modes=0;
for (;;) {
c = getopt( argc, argv, "qo:f:p:t:");
if (c == EOF) break;
switch (c) {
case 'q':
quiet=1;
break;
case 'o':
txc.offset = atoi(optarg);
txc.modes |= ADJ_OFFSET_SINGLESHOT;
break;
case 'f':
txc.freq = atoi(optarg);
txc.modes |= ADJ_FREQUENCY;
break;
case 'p':
txc.constant = atoi(optarg);
txc.modes |= ADJ_TIMECONST;
break;
case 't':
txc.tick = atoi(optarg);
txc.modes |= ADJ_TICK;
break;
default:
show_usage();
exit(1);
}
}
if (argc != optind) { /* no valid non-option parameters */
show_usage();
exit(1);
}
ret = adjtimex(&txc);
if (ret < 0) perror("adjtimex");
if (!quiet && ret>=0) {
printf(
" mode: %d\n"
"-o offset: %ld\n"
"-f frequency: %ld\n"
" maxerror: %ld\n"
" esterror: %ld\n"
" status: %d ( ",
txc.modes, txc.offset, txc.freq, txc.maxerror,
txc.esterror, txc.status);
/* representative output of next code fragment:
"PLL | PPSTIME" */
sep=0;
for (i=0; statlist[i].name; i++) {
if (txc.status & statlist[i].bit) {
if (sep) fputs(" | ",stdout);
fputs(statlist[i].name,stdout);
sep=1;
}
}
descript = "error";
if (ret >= 0 && ret <= 5) descript = ret_code_descript[ret];
printf(" )\n"
"-p timeconstant: %ld\n"
" precision: %ld\n"
" tolerance: %ld\n"
"-t tick: %ld\n"
" time.tv_sec: %ld\n"
" time.tv_usec: %ld\n"
" return value: %d (%s)\n",
txc.constant,
txc.precision, txc.tolerance, txc.tick,
(long)txc.time.tv_sec, (long)txc.time.tv_usec, ret, descript);
}
return (ret<0);
}
-113
View File
@@ -1,113 +0,0 @@
/* vi: set sw=4 ts=4: */
/*
* Utility routines.
*
* Copyright (C) tons of folks. Tracking down who wrote what
* isn't something I'm going to worry about... If you wrote something
* here, please feel free to acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Based in part on code from sash, Copyright (c) 1999 by David I. Bell
* Permission has been granted to redistribute this code under the GPL.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "busybox.h"
#undef APPLET
#undef APPLET_NOUSAGE
#undef PROTOTYPES
#include "applets.h"
struct BB_applet *applet_using;
/* The -1 arises because of the {0,NULL,0,-1} entry above. */
const size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1);
extern void show_usage(void)
{
const char *format_string;
const char *usage_string = usage_messages;
int i;
/* From busybox.c */
extern int been_there_done_that;
if (strcmp(applet_using->name, "busybox")==0) {
been_there_done_that=1;
busybox_main(0, NULL);
}
for (i = applet_using - applets; i > 0; ) {
if (!*usage_string++) {
--i;
}
}
format_string = "%s\n\nUsage: %s %s\n\n";
if(*usage_string == 0)
format_string = "%s\n\nNo help available.\n\n";
fprintf(stderr, format_string,
full_version, applet_using->name, usage_string);
exit(EXIT_FAILURE);
}
static int applet_name_compare(const void *x, const void *y)
{
const char *name = x;
const struct BB_applet *applet = y;
return strcmp(name, applet->name);
}
extern const size_t NUM_APPLETS;
struct BB_applet *find_applet_by_name(const char *name)
{
return bsearch(name, applets, NUM_APPLETS, sizeof(struct BB_applet),
applet_name_compare);
}
void run_applet_by_name(const char *name, int argc, char **argv)
{
static int recurse_level = 0;
recurse_level++;
/* Do a binary search to find the applet entry given the name. */
if ((applet_using = find_applet_by_name(name)) != NULL) {
applet_name = applet_using->name;
if (argv[1] && strcmp(argv[1], "--help") == 0) {
show_usage();
}
exit((*(applet_using->main)) (argc, argv));
}
/* Just in case they have renamed busybox - Check argv[1] */
if (recurse_level == 1) {
run_applet_by_name("busybox", argc, argv);
}
recurse_level = 0;
}
/* END CODE */
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
-454
View File
@@ -1,454 +0,0 @@
/*
* applets.h - a listing of all busybox applets.
*
* If you write a new applet, you need to add an entry to this list to make
* busybox aware of it.
*
* It is CRUCIAL that this listing be kept in ascii order, otherwise the binary
* search lookup contributed by Gaute B Strokkenes stops working. If you value
* your kneecaps, you'll be sure to *make sure* that any changes made to this
* file result in the listing remaining in ascii order. You have been warned.
*/
#undef APPLET
#undef APPLET_ODDNAME
#undef APPLET_NOUSAGE
#if defined(PROTOTYPES)
#define APPLET(a,b,c) extern int b(int argc, char **argv);
#define APPLET_NOUSAGE(a,b,c) extern int b(int argc, char **argv);
#define APPLET_ODDNAME(a,b,c,d) extern int b(int argc, char **argv);
extern const char usage_messages[];
#elif defined(MAKE_USAGE)
#ifdef BB_FEATURE_VERBOSE_USAGE
#define APPLET(a,b,c) a##_trivial_usage "\n\n" a##_full_usage "\0"
#define APPLET_NOUSAGE(a,b,c) "\0"
#define APPLET_ODDNAME(a,b,c,d) d##_trivial_usage "\n\n" d##_full_usage "\0"
#else
#define APPLET(a,b,c) a##_trivial_usage "\0"
#define APPLET_NOUSAGE(a,b,c) "\0"
#define APPLET_ODDNAME(a,b,c,d) d##_trivial_usage "\0"
#endif
#elif defined(MAKE_LINKS)
# define APPLET(a,b,c) LINK c a
# define APPLET_NOUSAGE(a,b,c) LINK c a
# define APPLET_ODDNAME(a,b,c,d) LINK c a
#else
const struct BB_applet applets[] = {
#define APPLET(a,b,c) {#a,b,c},
#define APPLET_NOUSAGE(a,b,c) {a,b,c},
#define APPLET_ODDNAME(a,b,c,d) {a,b,c},
#endif
#ifdef BB_TEST
APPLET_NOUSAGE("[", test_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_ADJTIMEX
APPLET(adjtimex, adjtimex_main, _BB_DIR_SBIN)
#endif
#ifdef BB_AR
APPLET(ar, ar_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_BASENAME
APPLET(basename, basename_main, _BB_DIR_USR_BIN)
#endif
APPLET_NOUSAGE("busybox", busybox_main, _BB_DIR_BIN)
#ifdef BB_CAT
APPLET(cat, cat_main, _BB_DIR_BIN)
#endif
#ifdef BB_CHGRP
APPLET(chgrp, chgrp_main, _BB_DIR_BIN)
#endif
#ifdef BB_CHMOD
APPLET(chmod, chmod_main, _BB_DIR_BIN)
#endif
#ifdef BB_CHOWN
APPLET(chown, chown_main, _BB_DIR_BIN)
#endif
#ifdef BB_CHROOT
APPLET(chroot, chroot_main, _BB_DIR_USR_SBIN)
#endif
#ifdef BB_CHVT
APPLET(chvt, chvt_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_CLEAR
APPLET(clear, clear_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_CMP
APPLET(cmp, cmp_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_CP
APPLET(cp, cp_main, _BB_DIR_BIN)
#endif
#ifdef BB_CPIO
APPLET(cpio, cpio_main, _BB_DIR_BIN)
#endif
#ifdef BB_CUT
APPLET(cut, cut_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_DATE
APPLET(date, date_main, _BB_DIR_BIN)
#endif
#ifdef BB_DC
APPLET(dc, dc_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_DD
APPLET(dd, dd_main, _BB_DIR_BIN)
#endif
#ifdef BB_DEALLOCVT
APPLET(deallocvt, deallocvt_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_DF
APPLET(df, df_main, _BB_DIR_BIN)
#endif
#ifdef BB_DIRNAME
APPLET(dirname, dirname_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_DMESG
APPLET(dmesg, dmesg_main, _BB_DIR_BIN)
#endif
#ifdef BB_DOS2UNIX
APPLET(dos2unix, dos2unix_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_DPKG
APPLET(dpkg, dpkg_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_DPKG_DEB
APPLET_ODDNAME("dpkg-deb", dpkg_deb_main, _BB_DIR_USR_BIN, dpkg_deb)
#endif
#ifdef BB_DU
APPLET(du, du_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_DUMPKMAP
APPLET(dumpkmap, dumpkmap_main, _BB_DIR_BIN)
#endif
#ifdef BB_DUTMP
APPLET(dutmp, dutmp_main, _BB_DIR_USR_SBIN)
#endif
#ifdef BB_ECHO
APPLET(echo, echo_main, _BB_DIR_BIN)
#endif
#if defined(BB_FEATURE_GREP_EGREP_ALIAS) && defined(BB_GREP)
APPLET_NOUSAGE("egrep", grep_main, _BB_DIR_BIN)
#endif
#ifdef BB_ENV
APPLET(env, env_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_EXPR
APPLET(expr, expr_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_TRUE_FALSE
APPLET(false, false_main, _BB_DIR_BIN)
#endif
#ifdef BB_FBSET
APPLET(fbset, fbset_main, _BB_DIR_USR_SBIN)
#endif
#ifdef BB_FDFLUSH
APPLET(fdflush, fdflush_main, _BB_DIR_BIN)
#endif
#ifdef BB_FIND
APPLET(find, find_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_FREE
APPLET(free, free_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_FREERAMDISK
APPLET(freeramdisk, freeramdisk_main, _BB_DIR_SBIN)
#endif
#ifdef BB_FSCK_MINIX
APPLET_ODDNAME("fsck.minix", fsck_minix_main, _BB_DIR_SBIN, fsck_minix)
#endif
#ifdef BB_GETOPT
APPLET(getopt, getopt_main, _BB_DIR_BIN)
#endif
#ifdef BB_GREP
APPLET(grep, grep_main, _BB_DIR_BIN)
#endif
#ifdef BB_GUNZIP
APPLET(gunzip, gunzip_main, _BB_DIR_BIN)
#endif
#ifdef BB_GZIP
APPLET(gzip, gzip_main, _BB_DIR_BIN)
#endif
#ifdef BB_HALT
APPLET(halt, halt_main, _BB_DIR_SBIN)
#endif
#ifdef BB_HEAD
APPLET(head, head_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_HOSTID
APPLET(hostid, hostid_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_HOSTNAME
APPLET(hostname, hostname_main, _BB_DIR_BIN)
#endif
#ifdef BB_ID
APPLET(id, id_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_IFCONFIG
APPLET(ifconfig, ifconfig_main, _BB_DIR_SBIN)
#endif
#ifdef BB_INIT
APPLET(init, init_main, _BB_DIR_SBIN)
#endif
#ifdef BB_INSMOD
APPLET(insmod, insmod_main, _BB_DIR_SBIN)
#endif
#ifdef BB_KILL
APPLET(kill, kill_main, _BB_DIR_BIN)
#endif
#ifdef BB_KILLALL
APPLET(killall, kill_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_KLOGD
APPLET(klogd, klogd_main, _BB_DIR_SBIN)
#endif
#ifdef BB_LENGTH
APPLET(length, length_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_FEATURE_LINUXRC
APPLET_NOUSAGE("linuxrc", init_main, _BB_DIR_ROOT)
#endif
#ifdef BB_LN
APPLET(ln, ln_main, _BB_DIR_BIN)
#endif
#ifdef BB_LOADACM
APPLET(loadacm, loadacm_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_LOADFONT
APPLET(loadfont, loadfont_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_LOADKMAP
APPLET(loadkmap, loadkmap_main, _BB_DIR_SBIN)
#endif
#ifdef BB_LOGGER
APPLET(logger, logger_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_LOGNAME
APPLET(logname, logname_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_LOGREAD
APPLET(logread, logread_main, _BB_DIR_SBIN)
#endif
#ifdef BB_LS
APPLET(ls, ls_main, _BB_DIR_BIN)
#endif
#ifdef BB_LSMOD
APPLET(lsmod, lsmod_main, _BB_DIR_SBIN)
#endif
#ifdef BB_MAKEDEVS
APPLET(makedevs, makedevs_main, _BB_DIR_SBIN)
#endif
#ifdef BB_MD5SUM
APPLET(md5sum, md5sum_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_MKDIR
APPLET(mkdir, mkdir_main, _BB_DIR_BIN)
#endif
#ifdef BB_MKFIFO
APPLET(mkfifo, mkfifo_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_MKFS_MINIX
APPLET_ODDNAME("mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, mkfs_minix)
#endif
#ifdef BB_MKNOD
APPLET(mknod, mknod_main, _BB_DIR_BIN)
#endif
#ifdef BB_MKSWAP
APPLET(mkswap, mkswap_main, _BB_DIR_SBIN)
#endif
#ifdef BB_MKTEMP
APPLET(mktemp, mktemp_main, _BB_DIR_BIN)
#endif
#ifdef BB_MORE
APPLET(more, more_main, _BB_DIR_BIN)
#endif
#ifdef BB_MOUNT
APPLET(mount, mount_main, _BB_DIR_BIN)
#endif
#ifdef BB_MT
APPLET(mt, mt_main, _BB_DIR_BIN)
#endif
#ifdef BB_MV
APPLET(mv, mv_main, _BB_DIR_BIN)
#endif
#ifdef BB_NC
APPLET(nc, nc_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_NSLOOKUP
APPLET(nslookup, nslookup_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_PING
APPLET(ping, ping_main, _BB_DIR_BIN)
#endif
#ifdef BB_PIVOT_ROOT
APPLET(pivot_root, pivot_root_main, _BB_DIR_SBIN)
#endif
#ifdef BB_POWEROFF
APPLET(poweroff, poweroff_main, _BB_DIR_SBIN)
#endif
#ifdef BB_PRINTF
APPLET(printf, printf_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_PS
APPLET(ps, ps_main, _BB_DIR_BIN)
#endif
#ifdef BB_PWD
APPLET(pwd, pwd_main, _BB_DIR_BIN)
#endif
#ifdef BB_RDATE
APPLET(rdate, rdate_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_READLINK
APPLET(readlink, readlink_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_REBOOT
APPLET(reboot, reboot_main, _BB_DIR_SBIN)
#endif
#ifdef BB_RENICE
APPLET(renice, renice_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_RESET
APPLET(reset, reset_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_RM
APPLET(rm, rm_main, _BB_DIR_BIN)
#endif
#ifdef BB_RMDIR
APPLET(rmdir, rmdir_main, _BB_DIR_BIN)
#endif
#ifdef BB_RMMOD
APPLET(rmmod, rmmod_main, _BB_DIR_SBIN)
#endif
#ifdef BB_ROUTE
APPLET(route, route_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_RPM2CPIO
APPLET(rpm2cpio, rpm2cpio_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_RPMUNPACK
APPLET(rpmunpack, rpmunpack_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_SED
APPLET(sed, sed_main, _BB_DIR_BIN)
#endif
#ifdef BB_SETKEYCODES
APPLET(setkeycodes, setkeycodes_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_SH
APPLET(sh, shell_main, _BB_DIR_BIN)
#endif
#ifdef BB_SLEEP
APPLET(sleep, sleep_main, _BB_DIR_BIN)
#endif
#ifdef BB_SORT
APPLET(sort, sort_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_STTY
APPLET(stty, stty_main, _BB_DIR_BIN)
#endif
#ifdef BB_SWAPONOFF
APPLET(swapoff, swap_on_off_main, _BB_DIR_SBIN)
#endif
#ifdef BB_SWAPONOFF
APPLET(swapon, swap_on_off_main, _BB_DIR_SBIN)
#endif
#ifdef BB_SYNC
APPLET(sync, sync_main, _BB_DIR_BIN)
#endif
#ifdef BB_SYSLOGD
APPLET(syslogd, syslogd_main, _BB_DIR_SBIN)
#endif
#ifdef BB_TAIL
APPLET(tail, tail_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_TAR
APPLET(tar, tar_main, _BB_DIR_BIN)
#endif
#ifdef BB_TEE
APPLET(tee, tee_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_TELNET
APPLET(telnet, telnet_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_TEST
APPLET(test, test_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_TFTP
APPLET(tftp, tftp_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_TOUCH
APPLET(touch, touch_main, _BB_DIR_BIN)
#endif
#ifdef BB_TR
APPLET(tr, tr_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_TRUE_FALSE
APPLET(true, true_main, _BB_DIR_BIN)
#endif
#ifdef BB_TTY
APPLET(tty, tty_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_UMOUNT
APPLET(umount, umount_main, _BB_DIR_BIN)
#endif
#ifdef BB_UNAME
APPLET(uname, uname_main, _BB_DIR_BIN)
#endif
#ifdef BB_UNIQ
APPLET(uniq, uniq_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_UNIX2DOS
APPLET(unix2dos, unix2dos_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_UPDATE
APPLET(update, update_main, _BB_DIR_SBIN)
#endif
#ifdef BB_UPTIME
APPLET(uptime, uptime_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_USLEEP
APPLET(usleep, usleep_main, _BB_DIR_BIN)
#endif
#ifdef BB_UUDECODE
APPLET(uudecode, uudecode_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_UUENCODE
APPLET(uuencode, uuencode_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_VI
APPLET(vi, vi_main, _BB_DIR_BIN)
#endif
#ifdef BB_WATCHDOG
APPLET(watchdog, watchdog_main, _BB_DIR_SBIN)
#endif
#ifdef BB_WC
APPLET(wc, wc_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_WGET
APPLET(wget, wget_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_WHICH
APPLET(which, which_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_WHOAMI
APPLET(whoami, whoami_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_XARGS
APPLET(xargs, xargs_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_YES
APPLET(yes, yes_main, _BB_DIR_USR_BIN)
#endif
#ifdef BB_GUNZIP
APPLET(zcat, gunzip_main, _BB_DIR_BIN)
#endif
#if !defined(PROTOTYPES) && !defined(MAKE_USAGE)
{ 0,NULL,0 }
};
#endif
+32
View File
@@ -0,0 +1,32 @@
# Makefile for busybox
#
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
top_srcdir=..
top_builddir=..
srcdir=$(top_srcdir)/applets
APPLETS_DIR:=./
include $(top_builddir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
-include $(top_builddir).depend
clean:
rm -f *.o *.a $(AR_TARGET)
+37
View File
@@ -0,0 +1,37 @@
# Makefile for busybox
#
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
APPLETS_AR:=applets.a
ifndef $(APPLETS_DIR)
APPLETS_DIR:=$(top_builddir)/applets/
endif
srcdir=$(top_srcdir)/applets
APPLET_SRC:=applets.c busybox.c
APPLET_OBJ:= $(patsubst %.c,$(APPLETS_DIR)%.o, $(APPLET_SRC))
libraries-y+=$(APPLETS_DIR)$(APPLETS_AR)
$(APPLETS_DIR)$(APPLETS_AR): $(APPLET_OBJ)
$(AR) -ro $@ $(APPLET_OBJ)
$(APPLET_OBJ): $(top_builddir)/.config
$(APPLET_OBJ): $(APPLETS_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+446 -47
View File
@@ -20,94 +20,493 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Based in part on code from sash, Copyright (c) 1999 by David I. Bell
* Based in part on code from sash, Copyright (c) 1999 by David I. Bell
* Permission has been granted to redistribute this code under the GPL.
*
*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "busybox.h"
const char usage_messages[] =
#define MAKE_USAGE
#include "usage.h"
#include "applets.h"
;
#undef MAKE_USAGE
#undef APPLET
#undef APPLET_NOUSAGE
#undef PROTOTYPES
#include "applets.h"
struct BB_applet *applet_using;
static struct BB_applet *applet_using;
/* The -1 arises because of the {0,NULL,0,-1} entry above. */
const size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1);
extern void show_usage(void)
#ifdef CONFIG_FEATURE_SUID
static void check_suid (struct BB_applet *app);
#ifdef CONFIG_FEATURE_SUID_CONFIG
#include <sys/stat.h>
#include <ctype.h>
#include "pwd_.h"
#include "grp_.h"
static void parse_config_file (void);
#define CONFIG_FILE "/etc/busybox.conf"
/* applets [] is const, so we have to define this "override" structure */
struct BB_suid_config
{
const char *format_string;
const char *usage_string = usage_messages;
int i;
/* From busybox.c */
extern int been_there_done_that;
struct BB_applet *m_applet;
if (strcmp(applet_using->name, "busybox")==0) {
been_there_done_that=1;
busybox_main(0, NULL);
}
uid_t m_uid;
gid_t m_gid;
mode_t m_mode;
for (i = applet_using - applets; i > 0; ) {
if (!*usage_string++) {
--i;
}
struct BB_suid_config *m_next;
};
static struct BB_suid_config *suid_config;
static int suid_cfg_readable;
#endif /* CONFIG_FEATURE_SUID_CONFIG */
#endif /* CONFIG_FEATURE_SUID */
extern void
bb_show_usage (void)
{
const char *format_string;
const char *usage_string = usage_messages;
int i;
for (i = applet_using - applets; i > 0;) {
if (!*usage_string++) {
--i;
}
format_string = "%s\n\nUsage: %s %s\n\n";
if(*usage_string == 0)
format_string = "%s\n\nNo help available.\n\n";
fprintf(stderr, format_string,
full_version, applet_using->name, usage_string);
exit(EXIT_FAILURE);
}
format_string = "%s\n\nUsage: %s %s\n\n";
if (*usage_string == '\b')
format_string = "%s\n\nNo help available.\n\n";
fprintf (stderr, format_string, bb_msg_full_version, applet_using->name,
usage_string);
exit (EXIT_FAILURE);
}
static int applet_name_compare(const void *x, const void *y)
static int
applet_name_compare (const void *x, const void *y)
{
const char *name = x;
const struct BB_applet *applet = y;
const char *name = x;
const struct BB_applet *applet = y;
return strcmp(name, applet->name);
return strcmp (name, applet->name);
}
extern const size_t NUM_APPLETS;
struct BB_applet *find_applet_by_name(const char *name)
struct BB_applet *
find_applet_by_name (const char *name)
{
return bsearch(name, applets, NUM_APPLETS, sizeof(struct BB_applet),
applet_name_compare);
return bsearch (name, applets, NUM_APPLETS, sizeof (struct BB_applet),
applet_name_compare);
}
void run_applet_by_name(const char *name, int argc, char **argv)
void
run_applet_by_name (const char *name, int argc, char **argv)
{
static int recurse_level = 0;
static int recurse_level = 0;
extern int been_there_done_that; /* From busybox.c */
recurse_level++;
/* Do a binary search to find the applet entry given the name. */
if ((applet_using = find_applet_by_name(name)) != NULL) {
applet_name = applet_using->name;
if (argv[1] && strcmp(argv[1], "--help") == 0) {
show_usage();
#ifdef CONFIG_FEATURE_SUID_CONFIG
if (recurse_level == 0)
parse_config_file ();
#endif
recurse_level++;
/* Do a binary search to find the applet entry given the name. */
if ((applet_using = find_applet_by_name (name)) != NULL) {
bb_applet_name = applet_using->name;
if (argv[1] && strcmp (argv[1], "--help") == 0) {
if (strcmp (applet_using->name, "busybox") == 0) {
if (argv[2])
applet_using = find_applet_by_name (argv[2]);
else
applet_using = NULL;
}
if (applet_using)
bb_show_usage ();
been_there_done_that = 1;
busybox_main (0, NULL);
}
#ifdef CONFIG_FEATURE_SUID
check_suid (applet_using);
#endif
exit ((*(applet_using->main)) (argc, argv));
}
/* Just in case they have renamed busybox - Check argv[1] */
if (recurse_level == 1) {
run_applet_by_name ("busybox", argc, argv);
}
recurse_level--;
}
#ifdef CONFIG_FEATURE_SUID
#ifdef CONFIG_FEATURE_SUID_CONFIG
/* check if u is member of group g */
static int
ingroup (uid_t u, gid_t g)
{
struct group *grp = getgrgid (g);
if (grp) {
char **mem;
for (mem = grp->gr_mem; *mem; mem++) {
struct passwd *pwd = getpwnam (*mem);
if (pwd && (pwd->pw_uid == u))
return 1;
}
}
return 0;
}
#endif
void
check_suid (struct BB_applet *applet)
{
uid_t ruid = getuid (); /* real [ug]id */
uid_t rgid = getgid ();
#ifdef CONFIG_FEATURE_SUID_CONFIG
if (suid_cfg_readable) {
struct BB_suid_config *sct;
for (sct = suid_config; sct; sct = sct->m_next) {
if (sct->m_applet == applet)
break;
}
if (sct) {
mode_t m = sct->m_mode;
if (sct->m_uid == ruid) /* same uid */
m >>= 6;
else if ((sct->m_gid == rgid) || ingroup (ruid, sct->m_gid)) /* same group / in group */
m >>= 3;
if (!(m & S_IXOTH)) /* is x bit not set ? */
bb_error_msg_and_die ("You have no permission to run this applet!");
if ((sct->m_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { /* *both* have to be set for sgid */
if (setegid (sct->m_gid))
bb_error_msg_and_die
("BusyBox binary has insufficient rights to set proper GID for applet!");
} else
setgid (rgid); /* no sgid -> drop */
if (sct->m_mode & S_ISUID) {
if (seteuid (sct->m_uid))
bb_error_msg_and_die
("BusyBox binary has insufficient rights to set proper UID for applet!");
} else
setuid (ruid); /* no suid -> drop */
} else {
/* default: drop all priviledges */
setgid (rgid);
setuid (ruid);
}
return;
} else {
#ifndef CONFIG_FEATURE_SUID_CONFIG_QUIET
static int onetime = 0;
if (!onetime) {
onetime = 1;
fprintf (stderr, "Using fallback suid method\n");
}
#endif
}
#endif
if (applet->need_suid == _BB_SUID_ALWAYS) {
if (geteuid () != 0)
bb_error_msg_and_die ("This applet requires root priviledges!");
} else if (applet->need_suid == _BB_SUID_NEVER) {
setgid (rgid); /* drop all priviledges */
setuid (ruid);
}
}
#ifdef CONFIG_FEATURE_SUID_CONFIG
/* 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;
}
exit((*(applet_using->main)) (argc, argv));
}
/* Just in case they have renamed busybox - Check argv[1] */
if (recurse_level == 1) {
run_applet_by_name("busybox", argc, argv);
}
recurse_level = 0;
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;
/* 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 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;
assert(!suid_config); /* Should be set to NULL by bss init. */
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;
}
suid_cfg_readable = 1;
sct_head = NULL;
section = lc = 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 desirable.
* 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
#endif
/* 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:
*/
+48 -36
View File
@@ -5,37 +5,40 @@
#include <errno.h>
#include <stdlib.h>
#include "busybox.h"
#ifdef BB_LOCALE_SUPPORT
#ifdef CONFIG_LOCALE_SUPPORT
#include <locale.h>
#endif
int been_there_done_that = 0; /* Also used in applets.c */
const char *applet_name;
const char *bb_applet_name;
#ifdef BB_FEATURE_INSTALLER
/*
#ifdef CONFIG_FEATURE_INSTALLER
/*
* directory table
* this should be consistent w/ the enum, busybox.h::Location,
* or else...
*/
static char* install_dir[] = {
"/",
"/bin",
"/sbin",
"/usr/bin",
"/usr/sbin",
static const char usr_bin [] ="/usr/bin";
static const char usr_sbin[] ="/usr/sbin";
static const char* const install_dir[] = {
&usr_bin [8], /* "", equivalent to "/" for concat_path_file() */
&usr_bin [4], /* "/bin" */
&usr_sbin[4], /* "/sbin" */
usr_bin,
usr_sbin
};
/* abstract link() */
typedef int (*__link_f)(const char *, const char *);
/*
/*
* Where in the filesystem is this busybox?
* [return]
* malloc'd string w/ full pathname of busybox's location
* NULL on failure
*/
static char *busybox_fullpath()
static inline char *busybox_fullpath(void)
{
return xreadlink("/proc/self/exe");
}
@@ -49,7 +52,7 @@ static void install_links(const char *busybox, int use_symbolic_links)
int i;
int rc;
if (use_symbolic_links)
if (use_symbolic_links)
Link = symlink;
for (i = 0; applets[i].name != NULL; i++) {
@@ -57,30 +60,30 @@ static void install_links(const char *busybox, int use_symbolic_links)
install_dir[applets[i].location], applets[i].name);
rc = Link(busybox, fpc);
if (rc!=0 && errno!=EEXIST) {
perror_msg("%s", fpc);
bb_perror_msg("%s", fpc);
}
free(fpc);
}
}
#endif /* BB_FEATURE_INSTALLER */
#endif /* CONFIG_FEATURE_INSTALLER */
int main(int argc, char **argv)
{
const char *s;
for (s = applet_name = argv[0]; *s != '\0';) {
bb_applet_name = argv[0];
if (bb_applet_name[0] == '-')
bb_applet_name++;
for (s = bb_applet_name; *s != '\0';) {
if (*s++ == '/')
applet_name = s;
bb_applet_name = s;
}
/* Add in a special case hack for a leading hyphen */
if (**argv == '-' && *(*argv+1)!= '-') {
applet_name = (*argv+1);
}
#ifdef BB_LOCALE_SUPPORT
#ifdef BB_INIT
#ifdef CONFIG_LOCALE_SUPPORT
#ifdef CONFIG_INIT
if(getpid()!=1) /* Do not set locale for `init' */
#endif
{
@@ -88,8 +91,8 @@ int main(int argc, char **argv)
}
#endif
run_applet_by_name(applet_name, argc, argv);
error_msg_and_die("applet not found");
run_applet_by_name(bb_applet_name, argc, argv);
bb_error_msg_and_die("applet not found");
}
@@ -97,9 +100,9 @@ int busybox_main(int argc, char **argv)
{
int col = 0, len, i;
#ifdef BB_FEATURE_INSTALLER
/*
* This style of argument parsing doesn't scale well
#ifdef CONFIG_FEATURE_INSTALLER
/*
* This style of argument parsing doesn't scale well
* in the event that busybox starts wanting more --options.
* If someone has a cleaner approach, by all means implement it.
*/
@@ -110,8 +113,8 @@ int busybox_main(int argc, char **argv)
/* to use symlinks, or not to use symlinks... */
if (argc > 2) {
if ((strcmp(argv[2], "-s") == 0)) {
use_symbolic_links = 1;
if ((strcmp(argv[2], "-s") == 0)) {
use_symbolic_links = 1;
}
}
@@ -125,13 +128,21 @@ int busybox_main(int argc, char **argv)
}
return rc;
}
#endif /* BB_FEATURE_INSTALLER */
#endif /* CONFIG_FEATURE_INSTALLER */
argc--;
/* 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"
@@ -139,14 +150,14 @@ int busybox_main(int argc, char **argv)
"\tBusyBox is a multi-call binary that combines many common Unix\n"
"\tutilities into a single executable. Most people will create a\n"
"\tlink to busybox for each function they wish to use, and BusyBox\n"
"\twill act like whatever it was invoked as.\n"
"\nCurrently defined functions:\n", full_version);
"\twill act like whatever it was invoked as.\n"
"\nCurrently defined functions:\n", bb_msg_full_version);
while (a->name != 0) {
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;
}
@@ -157,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]);
+2 -2
View File
@@ -10,8 +10,8 @@
export LC_ALL=POSIX
export LC_CTYPE=POSIX
CONFIG_H=${1:-Config.h}
APPLETS_H=${2:-applets.h}
CONFIG_H=${1:-include/config.h}
APPLETS_H=${2:-include/applets.h}
gcc -E -DMAKE_LINKS -include $CONFIG_H $APPLETS_H |
awk '/^[ \t]*LINK/{
dir=substr($2,8)
-16
View File
@@ -1,16 +0,0 @@
#!/bin/sh
export LC_ALL=POSIX
export LC_CTYPE=POSIX
RAW=` \
gcc -E -dM ${1:-Config.h} | \
sed -n -e '/^.*BB_FEATURE.*$/d;s/^#define.*\<BB_\(.*\)\>/\1.c/gp;' \
| tr A-Z a-z | sort
`
test "${RAW}" != "" || exit
if [ -d "$BB_SRC_DIR" ]; then cd $BB_SRC_DIR; fi
# By running $RAW through "ls", we avoid listing
# source files that don't exist.
ls $RAW 2>/dev/null | tr '\n' ' '
-10
View File
@@ -1,10 +0,0 @@
#include "busybox.h"
const char usage_messages[] =
#define MAKE_USAGE
#include "usage.h"
#include "applets.h"
;
-1787
View File
File diff suppressed because it is too large. Load diff
-89
View File
@@ -1,89 +0,0 @@
/* vi: set sw=4 ts=4: */
/*
* Mini ar implementation for busybox
*
* Copyright (C) 2000 by Glenn McGrath
* Written by Glenn McGrath <bug1@optushome.com.au> 1 June 2000
*
* Based in part on BusyBox tar, Debian dpkg-deb and GNU ar.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <unistd.h>
#include "busybox.h"
extern int ar_main(int argc, char **argv)
{
FILE *src_stream = NULL;
char **extract_names = NULL;
char ar_magic[8];
int extract_function = extract_unconditional;
int opt;
int num_of_entries = 0;
extern off_t archive_offset;
while ((opt = getopt(argc, argv, "ovtpx")) != -1) {
switch (opt) {
case 'o':
extract_function |= extract_preserve_date;
break;
case 'v':
extract_function |= extract_verbose_list;
break;
case 't':
extract_function |= extract_list;
break;
case 'p':
extract_function |= extract_to_stdout;
break;
case 'x':
extract_function |= extract_all_to_fs;
break;
default:
show_usage();
}
}
/* check the src filename was specified */
if (optind == argc) {
show_usage();
}
src_stream = xfopen(argv[optind++], "r");
/* check ar magic */
fread(ar_magic, 1, 8, src_stream);
if (strncmp(ar_magic,"!<arch>",7) != 0) {
error_msg_and_die("invalid magic");
}
archive_offset = 8;
extract_names = malloc(sizeof(char *));
extract_names[0] = NULL;
while (optind < argc) {
num_of_entries++;
*extract_names = realloc(*extract_names, num_of_entries);
extract_names[num_of_entries - 1] = xstrdup(argv[optind]);
optind++;
}
unarchive(src_stream, &get_header_ar, extract_function, "./", extract_names);
return EXIT_SUCCESS;
}
+258
View File
@@ -0,0 +1,258 @@
#
# For a description of the syntax of this configuration file,
# see scripts/kbuild/config-language.txt.
#
menu "Archival Utilities"
config CONFIG_AR
bool "ar"
default n
help
ar is an archival utility program used to create, modify, and
extract contents from archives. An archive is a single file holding
a collection of other files in a structure that makes it possible to
retrieve the original individual files (called archive members).
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 1K.
Unless you have a specific application which requires ar, you should
probably say N here.
config CONFIG_FEATURE_AR_LONG_FILENAMES
bool " Enable support for long filenames (not need for debs)"
default n
depends on CONFIG_AR
help
By default the ar format can only store the first 15 characters of the
filename, this option removes that limitation.
It supports the GNU ar long filename method which moves multiple long
filenames into a the data section of a new ar entry.
config CONFIG_BUNZIP2
bool "bunzip2"
default n
help
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 11K.
Unless you have a specific application which requires bunzip2, you
should probably say N here.
config CONFIG_CPIO
bool "cpio"
default n
help
cpio is an archival utility program used to create, modify, and extract
contents from archives.
cpio has 110 bytes of overheads for every stored file.
This implementation of cpio can extract cpio archives created in the
"newc" or "crc" format, it cannot create or modify them.
Unless you have a specific application which requires cpio, you should
probably say N here.
config CONFIG_DPKG
bool "dpkg"
default n
help
dpkg is a medium-level tool to install, build, remove and manage Debian packages.
This implementation of dpkg has a number of limitations, you should use the
official dpkg if possible.
config CONFIG_DPKG_DEB
bool "dpkg_deb"
default n
help
dpkg-deb packs, unpacks and provides information about Debian archives.
This implementation of dpkg-deb cannot pack archives.
Unless you have a specific application which requires dpkg-deb, you should
probably say N here.
config CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
bool " extract only (-x)"
default n
depends on CONFIG_DPKG_DEB
help
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_GUNZIP
bool "gunzip"
default n
help
gunzip is used to decompress archives created by gzip.
You can use the `-t' option to test the integrity of
an archive, without decompressing it.
config CONFIG_FEATURE_GUNZIP_UNCOMPRESS
bool " Uncompress support"
default n
depends on CONFIG_GUNZIP
help
Enable if you want gunzip to have the ability to decompress
archives created by the program compress (not much
used anymore).
config CONFIG_GZIP
bool "gzip"
default n
help
gzip is used to compress files.
It's probably the most widely used UNIX compression program.
config CONFIG_RPM2CPIO
bool "rpm2cpio"
default n
help
Converts an RPM file into a CPIO archive.
config CONFIG_RPM
bool "rpm"
default n
help
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 widely used
UNIX archive program.
config CONFIG_FEATURE_TAR_CREATE
bool " Enable archive creation"
default y
depends on CONFIG_TAR
help
If you enable this option you'll be able to create
tar archives using the `-c' option.
config CONFIG_FEATURE_TAR_BZIP2
bool " Enable -j option to handle .tar.bz2 files"
default n
depends on CONFIG_TAR
help
If you enable this option you'll be able to extract
archives compressed with bzip2.
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 include or exclude from an archive.
config CONFIG_FEATURE_TAR_GZIP
bool " Enable -z option"
default y
depends on CONFIG_TAR
help
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 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
bool " Enable support for some GNU tar extensions"
default y
depends on CONFIG_TAR
help
With this option busybox supports GNU long filenames and
linknames.
config CONFIG_FEATURE_TAR_LONG_OPTIONS
bool " Enable long options"
default n
depends on CONFIG_TAR
help
Enable use of long options, increases size by about 400 Bytes
config CONFIG_UNCOMPRESS
bool "uncompress"
default n
help
uncompress is used to decompress archives created by compress.
Not much used anymore, replaced by gzip/gunzip.
config CONFIG_UNZIP
bool "unzip"
default n
help
unzip will list or extract files from a ZIP archive,
commonly found on DOS/WIN systems. The default behavior
(with no options) is to extract the archive into the
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
View File
@@ -0,0 +1,32 @@
# Makefile for busybox
#
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
top_srcdir=..
top_builddir=..
ARCHIVAL_DIR:=./
srcdir=$(top_srcdir)/archival
include $(top_builddir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
+48
View File
@@ -0,0 +1,48 @@
# Makefile for busybox
#
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
ARCHIVAL_AR:=archival.a
ifndef $(ARCHIVAL_DIR)
ARCHIVAL_DIR:=$(top_builddir)/archival/
endif
srcdir=$(top_srcdir)/archival
ARCHIVAL-y:=
ARCHIVAL-$(CONFIG_APT_GET) +=
ARCHIVAL-$(CONFIG_AR) += ar.o
ARCHIVAL-$(CONFIG_BUNZIP2) += bunzip2.o
ARCHIVAL-$(CONFIG_CPIO) += cpio.o
ARCHIVAL-$(CONFIG_DPKG) += dpkg.o
ARCHIVAL-$(CONFIG_DPKG_DEB) += dpkg_deb.o
ARCHIVAL-$(CONFIG_GUNZIP) += gunzip.o
ARCHIVAL-$(CONFIG_GZIP) += gzip.o
ARCHIVAL-$(CONFIG_RPM2CPIO) += rpm2cpio.o
ARCHIVAL-$(CONFIG_RPM) += rpm.o
ARCHIVAL-$(CONFIG_TAR) += tar.o
ARCHIVAL-$(CONFIG_UNCOMPRESS) += uncompress.o
ARCHIVAL-$(CONFIG_UNZIP) += unzip.o
libraries-y+=$(ARCHIVAL_DIR)$(ARCHIVAL_AR)
$(ARCHIVAL_DIR)$(ARCHIVAL_AR): $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
$(AR) -ro $@ $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
$(ARCHIVAL_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+71 -50
View File
@@ -1,10 +1,10 @@
/* vi: set sw=4 ts=4: */
/*
* Mini ar implementation for busybox
* Mini ar implementation for busybox
*
* Copyright (C) 2000 by Glenn McGrath
* Written by Glenn McGrath <bug1@optushome.com.au> 1 June 2000
*
* Written by Glenn McGrath <bug1@iinet.net.au> 1 June 2000
*
* Based in part on BusyBox tar, Debian dpkg-deb and GNU ar.
*
* This program is free software; you can redistribute it and/or modify
@@ -21,69 +21,90 @@
* 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 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 <fcntl.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <time.h>
#include <utime.h>
#include <unistd.h>
#include "unarchive.h"
#include "busybox.h"
static void header_verbose_list_ar(const file_header_t *file_header)
{
const char *mode = bb_mode_string(file_header->mode);
char *mtime;
mtime = ctime(&file_header->mtime);
mtime[16] = ' ';
memmove(&mtime[17], &mtime[20], 4);
mtime[21] = '\0';
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);
}
#define AR_CTX_PRINT 0x01
#define AR_CTX_LIST 0x02
#define AR_CTX_EXTRACT 0x04
#define AR_OPT_PRESERVE_DATE 0x08
#define AR_OPT_VERBOSE 0x10
#define AR_OPT_CREATE 0x20
extern int ar_main(int argc, char **argv)
{
FILE *src_stream = NULL;
char **extract_names = NULL;
char ar_magic[8];
int extract_function = extract_unconditional;
int opt;
int num_of_entries = 0;
extern off_t archive_offset;
archive_handle_t *archive_handle;
unsigned long opt;
char magic[8];
while ((opt = getopt(argc, argv, "ovtpx")) != -1) {
switch (opt) {
case 'o':
extract_function |= extract_preserve_date;
break;
case 'v':
extract_function |= extract_verbose_list;
break;
case 't':
extract_function |= extract_list;
break;
case 'p':
extract_function |= extract_to_stdout;
break;
case 'x':
extract_function |= extract_all_to_fs;
break;
default:
show_usage();
}
}
/* check the src filename was specified */
if (optind == argc) {
show_usage();
archive_handle = init_handle();
bb_opt_complementaly = "p~tx:t~px:x~pt";
opt = bb_getopt_ulflags(argc, argv, "ptxovc");
if ((opt & 0x80000000UL) || (optind == argc)) {
bb_show_usage();
}
src_stream = xfopen(argv[optind++], "r");
/* check ar magic */
fread(ar_magic, 1, 8, src_stream);
if (strncmp(ar_magic,"!<arch>",7) != 0) {
error_msg_and_die("invalid magic");
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;
}
if (opt & AR_OPT_CREATE) {
bb_error_msg_and_die("Archive creation not supported. Install binutils 'ar'.");
}
archive_offset = 8;
extract_names = malloc(sizeof(char *));
extract_names[0] = NULL;
archive_handle->src_fd = bb_xopen(argv[optind++], O_RDONLY);
while (optind < argc) {
num_of_entries++;
*extract_names = realloc(*extract_names, num_of_entries);
extract_names[num_of_entries - 1] = xstrdup(argv[optind]);
optind++;
archive_handle->filter = filter_accept_list;
archive_handle->accept = llist_add_to(archive_handle->accept, argv[optind++]);
}
unarchive(src_stream, &get_header_ar, extract_function, "./", extract_names);
archive_xread_all(archive_handle, magic, 7);
if (strncmp(magic, "!<arch>", 7) != 0) {
bb_error_msg_and_die("Invalid ar magic");
}
archive_handle->offset += 7;
while (get_header_ar(archive_handle) == EXIT_SUCCESS);
return EXIT_SUCCESS;
}
+91
View File
@@ -0,0 +1,91 @@
/*
* Modified for busybox by Glenn McGrath <bug1@iinet.net.au>
* Added support output to stdout by Thomas Lundquist <thomasez@zelow.no>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <fcntl.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "busybox.h"
#include "unarchive.h"
#define BUNZIP2_OPT_STDOUT 1
#define BUNZIP2_OPT_FORCE 2
int bunzip2_main(int argc, char **argv)
{
char *compressed_name;
/* Note: Ignore the warning about save_name being used uninitialized.
* That is not the case, but gcc has trouble working that out... */
char *save_name;
unsigned long opt;
int status;
int src_fd;
int dst_fd;
opt = bb_getopt_ulflags(argc, argv, "cf");
/* if called as bzcat force the stdout flag */
if (bb_applet_name[2] == 'c') {
opt |= BUNZIP2_OPT_STDOUT;
}
/* Set input filename and number */
compressed_name = argv[optind];
if ((compressed_name) && (compressed_name[0] != '-') && (compressed_name[1] != '\0')) {
/* Open input file */
src_fd = bb_xopen(compressed_name, O_RDONLY);
} else {
src_fd = STDIN_FILENO;
opt |= BUNZIP2_OPT_STDOUT;
}
/* Check that the input is sane. */
if (isatty(src_fd) && (opt & BUNZIP2_OPT_FORCE) == 0) {
bb_error_msg_and_die("compressed data not read from terminal. Use -f to force it.");
}
if (opt & BUNZIP2_OPT_STDOUT) {
dst_fd = STDOUT_FILENO;
} 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);
}
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);
}
}
return status;
}
+56 -49
View File
@@ -2,7 +2,7 @@
/*
* Mini cpio implementation for busybox
*
* Copyright (C) 2001 by Glenn McGrath
* Copyright (C) 2001 by Glenn McGrath
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,65 +28,72 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "unarchive.h"
#include "busybox.h"
#define CPIO_OPT_EXTRACT 0x01
#define CPIO_OPT_TEST 0x02
#define CPIO_OPT_UNCONDITIONAL 0x04
#define CPIO_OPT_VERBOSE 0x08
#define CPIO_OPT_FILE 0x10
#define CPIO_OPT_CREATE_LEADING_DIR 0x20
#define CPIO_OPT_PRESERVE_MTIME 0x40
extern int cpio_main(int argc, char **argv)
{
FILE *src_stream = stdin;
char **extract_names = NULL;
int extract_function = 0;
int num_of_entries = 0;
int opt = 0;
mode_t oldmask = 0;
archive_handle_t *archive_handle;
char *cpio_filename = NULL;
unsigned long opt;
while ((opt = getopt(argc, argv, "idmuvtF:")) != -1) {
switch (opt) {
case 'i': // extract
extract_function |= extract_all_to_fs;
break;
case 'd': // create _leading_ directories
extract_function |= extract_create_leading_dirs;
oldmask = umask(077); /* Make make_directory act like GNU cpio */
break;
case 'm': // preserve modification time
extract_function |= extract_preserve_date;
break;
case 'v': // verbosly list files
extract_function |= extract_verbose_list;
break;
case 'u': // unconditional
extract_function |= extract_unconditional;
break;
case 't': // list files
extract_function |= extract_list;
break;
case 'F':
src_stream = xfopen(optarg, "r");
break;
default:
show_usage();
/* Initialise */
archive_handle = init_handle();
archive_handle->src_fd = STDIN_FILENO;
archive_handle->seek = seek_by_char;
archive_handle->flags = ARCHIVE_EXTRACT_NEWER | ARCHIVE_PRESERVE_DATE;
opt = bb_getopt_ulflags(argc, argv, "ituvF:dm", &cpio_filename);
/* One of either extract or test options must be given */
if ((opt & (CPIO_OPT_TEST | CPIO_OPT_EXTRACT)) == 0) {
bb_show_usage();
}
if (opt & CPIO_OPT_TEST) {
/* if both extract and test option are given, ignore extract option */
if (opt & CPIO_OPT_EXTRACT) {
opt &= ~CPIO_OPT_EXTRACT;
}
archive_handle->action_header = header_list;
}
if (opt & CPIO_OPT_EXTRACT) {
archive_handle->action_data = data_extract_all;
}
if (opt & CPIO_OPT_UNCONDITIONAL) {
archive_handle->flags |= ARCHIVE_EXTRACT_UNCONDITIONAL;
archive_handle->flags &= ~ARCHIVE_EXTRACT_NEWER;
}
if (opt & CPIO_OPT_VERBOSE) {
if (archive_handle->action_header == header_list) {
archive_handle->action_header = header_verbose_list;
} else {
archive_handle->action_header = header_list;
}
}
if (extract_function & extract_all_to_fs && extract_function & extract_list) {
extract_function ^= extract_all_to_fs; /* If specify t, don't extract*/
if (cpio_filename) { /* CPIO_OPT_FILE */
archive_handle->src_fd = bb_xopen(cpio_filename, O_RDONLY);
archive_handle->seek = seek_by_jump;
}
if (opt & CPIO_OPT_CREATE_LEADING_DIR) {
archive_handle->flags |= ARCHIVE_CREATE_LEADING_DIRS;
}
if (extract_function & extract_all_to_fs && extract_function & extract_verbose_list) { /* The meaning of v changes on extract */
extract_function ^= extract_verbose_list;
extract_function |= extract_list;
}
extract_names = malloc(4);
while (optind < argc) {
num_of_entries++;
*extract_names = realloc(*extract_names, num_of_entries);
extract_names[num_of_entries - 1] = xstrdup(argv[optind]);
archive_handle->filter = filter_accept_list;
archive_handle->accept = llist_add_to(archive_handle->accept, argv[optind]);
optind++;
}
unarchive(src_stream, &get_header_cpio, extract_function, "./", extract_names);
if (oldmask) umask(oldmask); /* Restore umask if we changed it */
return EXIT_SUCCESS;
}
while (get_header_cpio(archive_handle) == EXIT_SUCCESS);
return(EXIT_SUCCESS);
}
+1728 -749
View File
File diff suppressed because it is too large. Load diff
+78 -91
View File
@@ -12,114 +12,101 @@
* 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)
{
char *prefix = NULL;
char *filename = NULL;
char *output_buffer = NULL;
int opt = 0;
int arg_type = 0;
int deb_extract_funct = extract_create_leading_dirs | extract_unconditional;
const int arg_type_prefix = 1;
const int arg_type_field = 2;
const int arg_type_filename = 4;
// const int arg_type_un_ar_gz = 8;
archive_handle_t *ar_archive;
archive_handle_t *tar_archive;
llist_t *control_tar_llist = NULL;
unsigned long opt;
char *extract_dir = NULL;
short argcount = 1;
while ((opt = getopt(argc, argv, "ceftXxI")) != -1) {
switch (opt) {
case 'c':
deb_extract_funct |= extract_data_tar_gz;
deb_extract_funct |= extract_verbose_list;
break;
case 'e':
arg_type = arg_type_prefix;
deb_extract_funct |= extract_control_tar_gz;
deb_extract_funct |= extract_all_to_fs;
break;
case 'f':
arg_type = arg_type_field;
deb_extract_funct |= extract_control_tar_gz;
deb_extract_funct |= extract_one_to_buffer;
filename = xstrdup("./control");
break;
case 't': /* --fsys-tarfile, i just made up this short name */
/* Integrate the functionality needed with some code from ar.c */
error_msg_and_die("Option disabled");
// arg_type = arg_type_un_ar_gz;
break;
case 'X':
arg_type = arg_type_prefix;
deb_extract_funct |= extract_data_tar_gz;
deb_extract_funct |= extract_all_to_fs;
deb_extract_funct |= extract_list;
case 'x':
arg_type = arg_type_prefix;
deb_extract_funct |= extract_data_tar_gz;
deb_extract_funct |= extract_all_to_fs;
break;
case 'I':
arg_type = arg_type_filename;
deb_extract_funct |= extract_control_tar_gz;
deb_extract_funct |= extract_one_to_buffer;
break;
default:
show_usage();
/* Setup the tar archive handle */
tar_archive = init_handle();
/* Setup an ar archive handle that refers to the gzip sub archive */
ar_archive = init_handle();
ar_archive->sub_archive = tar_archive;
ar_archive->filter = filter_accept_list_reassign;
#ifdef CONFIG_FEATURE_DEB_TAR_GZ
ar_archive->accept = llist_add_to(NULL, "data.tar.gz");
control_tar_llist = llist_add_to(NULL, "control.tar.gz");
#endif
#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
ar_archive->accept = llist_add_to(ar_archive->accept, "data.tar.bz2");
control_tar_llist = llist_add_to(control_tar_llist, "control.tar.bz2");
#endif
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 (optind == argc) {
show_usage();
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 + argcount != argc) || (opt & 0x80000000UL)) {
bb_show_usage();
}
tar_archive->src_fd = ar_archive->src_fd = bb_xopen(argv[optind++], O_RDONLY);
/* Workout where to extract the files */
if (arg_type == arg_type_prefix) {
/* argument is a dir name */
if ((optind + 1) == argc ) {
prefix = xstrdup("./DEBIAN/");
} else {
prefix = (char *) xmalloc(strlen(argv[optind + 1]) + 2);
strcpy(prefix, argv[optind + 1]);
/* Make sure the directory has a trailing '/' */
if (last_char_is(prefix, '/') == NULL) {
strcat(prefix, "/");
}
}
mkdir(prefix, 0777);
/* 2nd argument is a dir name */
if (argv[optind]) {
extract_dir = argv[optind];
}
if (arg_type == arg_type_filename) {
if ((optind + 1) != argc) {
filename = xstrdup(argv[optind + 1]);
} else {
error_msg_and_die("-I currently requires a filename to be specified");
}
if (extract_dir) {
mkdir(extract_dir, 0777);
chdir(extract_dir);
}
unpack_ar_archive(ar_archive);
output_buffer = deb_extract(argv[optind], stdout, deb_extract_funct, prefix, filename);
if ((arg_type == arg_type_filename) && (output_buffer != NULL)) {
puts(output_buffer);
}
else if (arg_type == arg_type_field) {
char *field = NULL;
int field_start = 0;
while ((field = read_package_field(&output_buffer[field_start])) != NULL) {
field_start += (strlen(field) + 1);
if (strstr(field, argv[optind + 1]) == field) {
puts(field + strlen(argv[optind + 1]) + 2);
}
free(field);
}
}
/* Cleanup */
close (ar_archive->src_fd);
return(EXIT_SUCCESS);
}
+120 -102
View File
@@ -7,13 +7,13 @@
* Originally adjusted for busybox by Sven Rudolph <sr1@inf.tu-dresden.de>
* based on gzip sources
*
* Adjusted further by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
* to support files as well as stdin/stdout, and to generally behave itself wrt
* command line handling.
* Adjusted further by Erik Andersen <andersen@codepoet.org> to support files as
* well as stdin/stdout, and to generally behave itself wrt command line
* handling.
*
* General cleanup to better adhere to the style guide and make use of standard
* busybox functions by Glenn McGrath <bug1@optushome.com.au>
*
* busybox functions by Glenn McGrath <bug1@iinet.net.au>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -64,117 +64,135 @@ static char *license_msg[] = {
#include <string.h>
#include <unistd.h>
#include <getopt.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "busybox.h"
#include "unarchive.h"
#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)
{
FILE *in_file = stdin;
FILE *out_file = NULL;
struct stat stat_buf;
char *if_name = NULL;
char *of_name = NULL;
char *delete_file_name = NULL;
const int gunzip_to_stdout = 1;
const int gunzip_force = 2;
const int gunzip_test = 4;
int flags = 0;
int opt = 0;
int delete_old_file = FALSE;
char status = EXIT_SUCCESS;
unsigned long opt;
opt = bb_getopt_ulflags(argc, argv, "cftd");
/* if called as zcat */
if (strcmp(applet_name, "zcat") == 0)
flags |= gunzip_to_stdout;
while ((opt = getopt(argc, argv, "ctfhdq")) != -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;
case 'q':
error_msg("-q option not supported, ignored");
break;
case 'h':
default:
show_usage(); /* exit's inside usage */
}
if (strcmp(bb_applet_name, "zcat") == 0) {
opt |= GUNZIP_OPT_STDOUT;
}
/* Set input filename and number */
if (argv[optind] == NULL || strcmp(argv[optind], "-") == 0) {
flags |= gunzip_to_stdout;
} else {
if_name = strdup(argv[optind]);
/* Open input file */
in_file = xfopen(if_name, "r");
do {
struct stat stat_buf;
const char *old_path = argv[optind];
const char *delete_path = NULL;
char *new_path = NULL;
int src_fd;
int dst_fd;
/* Get the time stamp on the input file. */
if (stat(if_name, &stat_buf) < 0) {
error_msg_and_die("Couldn't stat file %s", if_name);
}
}
optind++;
/* Check that the input is sane. */
if (isatty(fileno(in_file)) && (flags & gunzip_force) == 0)
error_msg_and_die("compressed data not read from terminal. Use -f to force it.");
/* Set output filename and number */
if (flags & gunzip_test) {
out_file = xfopen("/dev/null", "w"); /* why does test use filenum 2 ? */
} else if (flags & gunzip_to_stdout) {
out_file = stdout;
} else {
char *extension;
int length = strlen(if_name);
delete_old_file = TRUE;
extension = strrchr(if_name, '.');
if (extension && strcmp(extension, ".gz") == 0) {
length -= 3;
} else if (extension && strcmp(extension, ".tgz") == 0) {
length -= 4;
if (old_path == NULL || strcmp(old_path, "-") == 0) {
src_fd = STDIN_FILENO;
opt |= GUNZIP_OPT_STDOUT;
} else {
error_msg_and_die("Invalid extension");
src_fd = bb_xopen(old_path, O_RDONLY);
/* Get the time stamp on the input file. */
if (stat(old_path, &stat_buf) < 0) {
bb_error_msg_and_die("Couldn't stat file %s", old_path);
}
}
of_name = (char *) xcalloc(sizeof(char), length + 1);
strncpy(of_name, if_name, length);
/* Open output file */
out_file = xfopen(of_name, "w");
/* Set permissions on the file */
chmod(of_name, stat_buf.st_mode);
}
/* do the decompression, and cleanup */
if (unzip(in_file, out_file) == 0) {
/* Success, remove .gz file */
delete_file_name = if_name;
} else {
/* remove failed attempt */
delete_file_name = of_name;
}
fclose(out_file);
fclose(in_file);
if (delete_old_file == TRUE) {
if (unlink(delete_file_name) < 0) {
error_msg_and_die("Couldnt remove %s", delete_file_name);
/* Check that the input is sane. */
if (isatty(src_fd) && ((opt & GUNZIP_OPT_FORCE) == 0)) {
bb_error_msg_and_die
("compressed data not read from terminal. Use -f to force it.");
}
}
free(of_name);
/* Set output filename and number */
if (opt & GUNZIP_OPT_TEST) {
dst_fd = bb_xopen("/dev/null", O_WRONLY); /* why does test use filenum 2 ? */
} else if (opt & GUNZIP_OPT_STDOUT) {
dst_fd = STDOUT_FILENO;
} else {
char *extension;
return(EXIT_SUCCESS);
new_path = bb_xstrdup(old_path);
extension = strrchr(new_path, '.');
#ifdef CONFIG_FEATURE_GUNZIP_UNCOMPRESS
if (extension && (strcmp(extension, ".Z") == 0)) {
*extension = '\0';
} else
#endif
if (extension && (strcmp(extension, ".gz") == 0)) {
*extension = '\0';
} else if (extension && (strcmp(extension, ".tgz") == 0)) {
extension[2] = 'a';
extension[3] = 'r';
} else {
bb_error_msg_and_die("Invalid extension");
}
/* Open output file */
dst_fd = bb_xopen(new_path, O_WRONLY | O_CREAT);
/* Set permissions on the file */
chmod(new_path, stat_buf.st_mode);
/* If unzip succeeds remove the old file */
delete_path = old_path;
}
/* do the decompression, and cleanup */
if (bb_xread_char(src_fd) == 0x1f) {
unsigned char magic2;
magic2 = bb_xread_char(src_fd);
#ifdef CONFIG_FEATURE_GUNZIP_UNCOMPRESS
if (magic2 == 0x9d) {
status = uncompress(src_fd, dst_fd);
} else
#endif
if (magic2 == 0x8b) {
check_header_gzip(src_fd);
status = inflate_gunzip(src_fd, dst_fd);
if (status != 0) {
bb_error_msg_and_die("Error inflating");
}
} else {
bb_error_msg_and_die("Invalid magic");
}
} else {
bb_error_msg_and_die("Invalid magic");
}
if ((status != EXIT_SUCCESS) && (new_path)) {
/* Unzip failed, remove new path instead of old path */
delete_path = new_path;
}
if (dst_fd != STDOUT_FILENO) {
close(dst_fd);
}
if (src_fd != STDIN_FILENO) {
close(src_fd);
}
/* delete_path will be NULL if in test mode or from stdin */
if (delete_path && (unlink(delete_path) == -1)) {
bb_error_msg_and_die("Couldn't remove %s", delete_path);
}
free(new_path);
} while (optind < argc);
return status;
}
+339 -341
View File
File diff suppressed because it is too large. Load diff
+32
View File
@@ -0,0 +1,32 @@
# Makefile for busybox
#
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
top_srcdir=../..
top_builddir=../..
srcdir=$(top_srcdir)/archival/libunarchive
LIBUNARCHIVE_DIR:=./
include $(top_builddir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
+84
View File
@@ -0,0 +1,84 @@
# Makefile for busybox
#
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
LIBUNARCHIVE_AR:=libunarchive.a
ifndef $(LIBUNARCHIVE_DIR)
LIBUNARCHIVE_DIR:=$(top_builddir)/archival/libunarchive/
endif
srcdir=$(top_srcdir)/archvial/libunarchive
LIBUNARCHIVE-y:= \
\
data_skip.o \
data_extract_all.o \
data_extract_to_stdout.o \
data_extract_to_buffer.o \
\
filter_accept_all.o \
filter_accept_list.o \
filter_accept_reject_list.o \
\
header_skip.o \
header_list.o \
header_verbose_list.o \
\
archive_xread_all.o \
archive_xread_all_eof.o \
\
seek_by_char.o \
seek_by_jump.o \
\
data_align.o \
find_list_entry.o \
open_transformer.o \
init_handle.o
GUNZIP_FILES:= check_header_gzip.o decompress_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) += decompress_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) += decompress_uncompress.o
LIBUNARCHIVE-$(CONFIG_UNCOMPRESS) += decompress_uncompress.o
LIBUNARCHIVE-$(CONFIG_UNZIP) += $(GUNZIP_FILES)
libraries-y+=$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR)
$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR): $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
$(AR) -ro $@ $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
$(LIBUNARCHIVA_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+32
View File
@@ -0,0 +1,32 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "unarchive.h"
#include "libbb.h"
extern void archive_xread_all(const archive_handle_t *archive_handle, void *buf, const size_t count)
{
ssize_t size;
size = bb_full_read(archive_handle->src_fd, buf, count);
if (size != count) {
bb_error_msg_and_die("Short read");
}
return;
}
@@ -0,0 +1,32 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "unarchive.h"
#include "libbb.h"
extern ssize_t archive_xread_all_eof(archive_handle_t *archive_handle, unsigned char *buf, size_t count)
{
ssize_t size;
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);
}
return(size);
}
+57
View File
@@ -0,0 +1,57 @@
#include <stdlib.h>
#include <unistd.h>
#include "libbb.h"
extern void check_header_gzip(int src_fd)
{
union {
unsigned char raw[8];
struct {
unsigned char method;
unsigned char flags;
unsigned int mtime;
unsigned char xtra_flags;
unsigned char os_flags;
} formated;
} header;
bb_xread_all(src_fd, header.raw, 8);
/* Check the compression method */
if (header.formated.method != 8) {
bb_error_msg_and_die("Unknown compression method %d",
header.formated.method);
}
if (header.formated.flags & 0x04) {
/* bit 2 set: extra field present */
unsigned char extra_short;
extra_short = bb_xread_char(src_fd) + (bb_xread_char(src_fd) << 8);
while (extra_short > 0) {
/* Ignore extra field */
bb_xread_char(src_fd);
extra_short--;
}
}
/* Discard original name if any */
if (header.formated.flags & 0x08) {
/* bit 3 set: original file name present */
while(bb_xread_char(src_fd) != 0);
}
/* Discard file comment if any */
if (header.formated.flags & 0x10) {
/* bit 4 set: file comment present */
while(bb_xread_char(src_fd) != 0);
}
/* Read the header checksum */
if (header.formated.flags & 0x02) {
bb_xread_char(src_fd);
bb_xread_char(src_fd);
}
return;
}
+33
View File
@@ -0,0 +1,33 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include "libbb.h"
#include "unarchive.h"
extern void data_align(archive_handle_t *archive_handle, const unsigned short boundary)
{
const unsigned short skip_amount = (boundary - (archive_handle->offset % boundary)) % boundary;
archive_handle->seek(archive_handle, skip_amount);
archive_handle->offset += skip_amount;
return;
}
+124
View File
@@ -0,0 +1,124 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <utime.h>
#include <unistd.h>
#include <stdlib.h>
#include "libbb.h"
#include "unarchive.h"
extern void data_extract_all(archive_handle_t *archive_handle)
{
file_header_t *file_header = archive_handle->file_header;
int dst_fd;
int res;
if (archive_handle->flags & ARCHIVE_CREATE_LEADING_DIRS) {
char *name = bb_xstrdup(file_header->name);
bb_make_directory (dirname(name), -1, FILEUTILS_RECUR);
free(name);
}
/* 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");
}
}
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");
}
}
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);
}
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);
}
}
/* Handle hard links separately
* 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;
t.actime = t.modtime = file_header->mtime;
utime(file_header->name, &t);
}
}
@@ -0,0 +1,28 @@
/*
* 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 "libbb.h"
#include "unarchive.h"
extern void data_extract_to_buffer(archive_handle_t *archive_handle)
{
const unsigned int size = archive_handle->file_header->size;
archive_handle->buffer = xmalloc(size + 1);
archive_xread_all(archive_handle, archive_handle->buffer, size);
archive_handle->buffer[size] = '\0';
}
@@ -0,0 +1,23 @@
/*
* 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 "unarchive.h"
#include <unistd.h>
extern void data_extract_to_stdout(archive_handle_t *archive_handle)
{
bb_copyfd_size(archive_handle->src_fd, STDOUT_FILENO, archive_handle->file_header->size);
}
+27
View File
@@ -0,0 +1,27 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include "unarchive.h"
#include "libbb.h"
extern void data_skip(archive_handle_t *archive_handle)
{
archive_handle->seek(archive_handle, archive_handle->file_header->size);
}
+611
View File
@@ -0,0 +1,611 @@
/* vi: set sw=4 ts=4: */
/* Small bzip2 deflate implementation, by Rob Landley (rob@landley.net).
Based on bzip2 decompression code by Julian R Seward (jseward@acm.org),
which also acknowledges contributions by Mike Burrows, David Wheeler,
Peter Fenwick, Alistair Moffat, Radford Neal, Ian H. Witten,
Robert Sedgewick, and Jon L. Bentley.
This code is licensed under the LGPLv2:
LGPL (http://www.gnu.org/copyleft/lgpl.html
*/
/*
Size and speed optimizations by Manuel Novoa III (mjn3@codepoet.org).
More efficient reading of Huffman codes, a streamlined read_bunzip()
function, and various other tweaks. In (limited) tests, approximately
20% faster than bzcat on x86 and about 10% faster on arm.
Note that about 2/3 of the time is spent in read_unzip() reversing
the Burrows-Wheeler transformation. Much of that time is delay
resulting from cache misses.
I would ask that anyone benefiting from this work, especially those
using it in commercial products, consider making a donation to my local
non-profit hospice organization in the name of the woman I loved, who
passed away Feb. 12, 2003.
In memory of Toni W. Hagan
Hospice of Acadiana, Inc.
2600 Johnston St., Suite 200
Lafayette, LA 70503-3240
Phone (337) 232-1234 or 1-800-738-2226
Fax (337) 232-1297
http://www.hospiceacadiana.com/
Manuel
*/
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include "libbb.h"
/* Constants for Huffman coding */
#define MAX_GROUPS 6
#define GROUP_SIZE 50 /* 64 would have been more efficient */
#define MAX_HUFCODE_BITS 20 /* Longest Huffman code allowed */
#define MAX_SYMBOLS 258 /* 256 literals + RUNA + RUNB */
#define SYMBOL_RUNA 0
#define SYMBOL_RUNB 1
/* Status return values */
#define RETVAL_OK 0
#define RETVAL_LAST_BLOCK (-1)
#define RETVAL_NOT_BZIP_DATA (-2)
#define RETVAL_UNEXPECTED_INPUT_EOF (-3)
#define RETVAL_UNEXPECTED_OUTPUT_EOF (-4)
#define RETVAL_DATA_ERROR (-5)
#define RETVAL_OUT_OF_MEMORY (-6)
#define RETVAL_OBSOLETE_INPUT (-7)
/* Other housekeeping constants */
#define IOBUF_SIZE 4096
/* This is what we know about each Huffman coding group */
struct group_data {
/* We have an extra slot at the end of limit[] for a sentinal value. */
int limit[MAX_HUFCODE_BITS+1],base[MAX_HUFCODE_BITS],permute[MAX_SYMBOLS];
int minLen, maxLen;
};
/* Structure holding all the housekeeping data, including IO buffers and
memory that persists between calls to bunzip */
typedef struct {
/* State for interrupting output loop */
int writeCopies,writePos,writeRunCountdown,writeCount,writeCurrent;
/* I/O tracking data (file handles, buffers, positions, etc.) */
int in_fd,out_fd,inbufCount,inbufPos /*,outbufPos*/;
unsigned char *inbuf /*,*outbuf*/;
unsigned int inbufBitCount, inbufBits;
/* The CRC values stored in the block header and calculated from the data */
unsigned int crc32Table[256],headerCRC, totalCRC, writeCRC;
/* Intermediate buffer and its size (in bytes) */
unsigned int *dbuf, dbufSize;
/* These things are a bit too big to go on the stack */
unsigned char selectors[32768]; /* nSelectors=15 bits */
struct group_data groups[MAX_GROUPS]; /* Huffman coding tables */
/* For I/O error handling */
jmp_buf jmpbuf;
} bunzip_data;
/* Return the next nnn bits of input. All reads from the compressed input
are done through this function. All reads are big endian */
static unsigned int get_bits(bunzip_data *bd, char bits_wanted)
{
unsigned int bits=0;
/* If we need to get more data from the byte buffer, do so. (Loop getting
one byte at a time to enforce endianness and avoid unaligned access.) */
while (bd->inbufBitCount<bits_wanted) {
/* If we need to read more data from file into byte buffer, do so */
if(bd->inbufPos==bd->inbufCount) {
if((bd->inbufCount = read(bd->in_fd, bd->inbuf, IOBUF_SIZE)) <= 0)
longjmp(bd->jmpbuf,RETVAL_UNEXPECTED_INPUT_EOF);
bd->inbufPos=0;
}
/* Avoid 32-bit overflow (dump bit buffer to top of output) */
if(bd->inbufBitCount>=24) {
bits=bd->inbufBits&((1<<bd->inbufBitCount)-1);
bits_wanted-=bd->inbufBitCount;
bits<<=bits_wanted;
bd->inbufBitCount=0;
}
/* Grab next 8 bits of input from buffer. */
bd->inbufBits=(bd->inbufBits<<8)|bd->inbuf[bd->inbufPos++];
bd->inbufBitCount+=8;
}
/* Calculate result */
bd->inbufBitCount-=bits_wanted;
bits|=(bd->inbufBits>>bd->inbufBitCount)&((1<<bits_wanted)-1);
return bits;
}
/* Unpacks the next block and sets up for the inverse burrows-wheeler step. */
static int get_next_block(bunzip_data *bd)
{
/* Note: Ignore the warning about hufGroup, base and limit being used uninitialized.
* They will be initialized on the fist pass of the loop. */
struct group_data *hufGroup;
int dbufCount,nextSym,dbufSize,groupCount,*base,*limit,selector,
i,j,k,t,runPos,symCount,symTotal,nSelectors,byteCount[256];
unsigned char uc, symToByte[256], mtfSymbol[256], *selectors;
unsigned int *dbuf,origPtr;
dbuf=bd->dbuf;
dbufSize=bd->dbufSize;
selectors=bd->selectors;
/* Reset longjmp I/O error handling */
i=setjmp(bd->jmpbuf);
if(i) return i;
/* Read in header signature and CRC, then validate signature.
(last block signature means CRC is for whole file, return now) */
i = get_bits(bd,24);
j = get_bits(bd,24);
bd->headerCRC=get_bits(bd,32);
if ((i == 0x177245) && (j == 0x385090)) return RETVAL_LAST_BLOCK;
if ((i != 0x314159) || (j != 0x265359)) return RETVAL_NOT_BZIP_DATA;
/* We can add support for blockRandomised if anybody complains. There was
some code for this in busybox 1.0.0-pre3, but nobody ever noticed that
it didn't actually work. */
if(get_bits(bd,1)) return RETVAL_OBSOLETE_INPUT;
if((origPtr=get_bits(bd,24)) > dbufSize) return RETVAL_DATA_ERROR;
/* mapping table: if some byte values are never used (encoding things
like ascii text), the compression code removes the gaps to have fewer
symbols to deal with, and writes a sparse bitfield indicating which
values were present. We make a translation table to convert the symbols
back to the corresponding bytes. */
t=get_bits(bd, 16);
symTotal=0;
for (i=0;i<16;i++) {
if(t&(1<<(15-i))) {
k=get_bits(bd,16);
for(j=0;j<16;j++)
if(k&(1<<(15-j))) symToByte[symTotal++]=(16*i)+j;
}
}
/* How many different Huffman coding groups does this block use? */
groupCount=get_bits(bd,3);
if (groupCount<2 || groupCount>MAX_GROUPS) return RETVAL_DATA_ERROR;
/* nSelectors: Every GROUP_SIZE many symbols we select a new Huffman coding
group. Read in the group selector list, which is stored as MTF encoded
bit runs. (MTF=Move To Front, as each value is used it's moved to the
start of the list.) */
if(!(nSelectors=get_bits(bd, 15))) return RETVAL_DATA_ERROR;
for(i=0; i<groupCount; i++) mtfSymbol[i] = i;
for(i=0; i<nSelectors; i++) {
/* Get next value */
for(j=0;get_bits(bd,1);j++) if (j>=groupCount) return RETVAL_DATA_ERROR;
/* Decode MTF to get the next selector */
uc = mtfSymbol[j];
for(;j;j--) mtfSymbol[j] = mtfSymbol[j-1];
mtfSymbol[0]=selectors[i]=uc;
}
/* Read the Huffman coding tables for each group, which code for symTotal
literal symbols, plus two run symbols (RUNA, RUNB) */
symCount=symTotal+2;
for (j=0; j<groupCount; j++) {
unsigned char length[MAX_SYMBOLS],temp[MAX_HUFCODE_BITS+1];
int minLen, maxLen, pp;
/* Read Huffman code lengths for each symbol. They're stored in
a way similar to mtf; record a starting value for the first symbol,
and an offset from the previous value for everys symbol after that.
(Subtracting 1 before the loop and then adding it back at the end is
an optimization that makes the test inside the loop simpler: symbol
length 0 becomes negative, so an unsigned inequality catches it.) */
t=get_bits(bd, 5)-1;
for (i = 0; i < symCount; i++) {
for(;;) {
if (((unsigned)t) > (MAX_HUFCODE_BITS-1))
return RETVAL_DATA_ERROR;
/* If first bit is 0, stop. Else second bit indicates whether
to increment or decrement the value. Optimization: grab 2
bits and unget the second if the first was 0. */
k = get_bits(bd,2);
if (k < 2) {
bd->inbufBitCount++;
break;
}
/* Add one if second bit 1, else subtract 1. Avoids if/else */
t+=(((k+1)&2)-1);
}
/* Correct for the initial -1, to get the final symbol length */
length[i]=t+1;
}
/* Find largest and smallest lengths in this group */
minLen=maxLen=length[0];
for(i = 1; i < symCount; i++) {
if(length[i] > maxLen) maxLen = length[i];
else if(length[i] < minLen) minLen = length[i];
}
/* Calculate permute[], base[], and limit[] tables from length[].
*
* permute[] is the lookup table for converting Huffman coded symbols
* into decoded symbols. base[] is the amount to subtract from the
* value of a Huffman symbol of a given length when using permute[].
*
* limit[] indicates the largest numerical value a symbol with a given
* number of bits can have. This is how the Huffman codes can vary in
* length: each code with a value>limit[length] needs another bit.
*/
hufGroup=bd->groups+j;
hufGroup->minLen = minLen;
hufGroup->maxLen = maxLen;
/* Note that minLen can't be smaller than 1, so we adjust the base
and limit array pointers so we're not always wasting the first
entry. We do this again when using them (during symbol decoding).*/
base=hufGroup->base-1;
limit=hufGroup->limit-1;
/* Calculate permute[]. Concurently, initialize temp[] and limit[]. */
pp=0;
for(i=minLen;i<=maxLen;i++) {
temp[i]=limit[i]=0;
for(t=0;t<symCount;t++)
if(length[t]==i) hufGroup->permute[pp++] = t;
}
/* Count symbols coded for at each bit length */
for (i=0;i<symCount;i++) temp[length[i]]++;
/* Calculate limit[] (the largest symbol-coding value at each bit
* length, which is (previous limit<<1)+symbols at this level), and
* base[] (number of symbols to ignore at each bit length, which is
* limit minus the cumulative count of symbols coded for already). */
pp=t=0;
for (i=minLen; i<maxLen; i++) {
pp+=temp[i];
/* We read the largest possible symbol size and then unget bits
after determining how many we need, and those extra bits could
be set to anything. (They're noise from future symbols.) At
each level we're really only interested in the first few bits,
so here we set all the trailing to-be-ignored bits to 1 so they
don't affect the value>limit[length] comparison. */
limit[i]= (pp << (maxLen - i)) - 1;
pp<<=1;
base[i+1]=pp-(t+=temp[i]);
}
limit[maxLen+1] = INT_MAX; /* Sentinal value for reading next sym. */
limit[maxLen]=pp+temp[maxLen]-1;
base[minLen]=0;
}
/* We've finished reading and digesting the block header. Now read this
block's Huffman coded symbols from the file and undo the Huffman coding
and run length encoding, saving the result into dbuf[dbufCount++]=uc */
/* Initialize symbol occurrence counters and symbol Move To Front table */
for(i=0;i<256;i++) {
byteCount[i] = 0;
mtfSymbol[i]=(unsigned char)i;
}
/* Loop through compressed symbols. */
runPos=dbufCount=symCount=selector=0;
for(;;) {
/* Determine which Huffman coding group to use. */
if(!(symCount--)) {
symCount=GROUP_SIZE-1;
if(selector>=nSelectors) return RETVAL_DATA_ERROR;
hufGroup=bd->groups+selectors[selector++];
base=hufGroup->base-1;
limit=hufGroup->limit-1;
}
/* Read next Huffman-coded symbol. */
/* Note: It is far cheaper to read maxLen bits and back up than it is
to read minLen bits and then an additional bit at a time, testing
as we go. Because there is a trailing last block (with file CRC),
there is no danger of the overread causing an unexpected EOF for a
valid compressed file. As a further optimization, we do the read
inline (falling back to a call to get_bits if the buffer runs
dry). The following (up to got_huff_bits:) is equivalent to
j=get_bits(bd,hufGroup->maxLen);
*/
while (bd->inbufBitCount<hufGroup->maxLen) {
if(bd->inbufPos==bd->inbufCount) {
j = get_bits(bd,hufGroup->maxLen);
goto got_huff_bits;
}
bd->inbufBits=(bd->inbufBits<<8)|bd->inbuf[bd->inbufPos++];
bd->inbufBitCount+=8;
};
bd->inbufBitCount-=hufGroup->maxLen;
j = (bd->inbufBits>>bd->inbufBitCount)&((1<<hufGroup->maxLen)-1);
got_huff_bits:
/* Figure how how many bits are in next symbol and unget extras */
i=hufGroup->minLen;
while(j>limit[i]) ++i;
bd->inbufBitCount += (hufGroup->maxLen - i);
/* Huffman decode value to get nextSym (with bounds checking) */
if ((i > hufGroup->maxLen)
|| (((unsigned)(j=(j>>(hufGroup->maxLen-i))-base[i]))
>= MAX_SYMBOLS))
return RETVAL_DATA_ERROR;
nextSym = hufGroup->permute[j];
/* We have now decoded the symbol, which indicates either a new literal
byte, or a repeated run of the most recent literal byte. First,
check if nextSym indicates a repeated run, and if so loop collecting
how many times to repeat the last literal. */
if (((unsigned)nextSym) <= SYMBOL_RUNB) { /* RUNA or RUNB */
/* If this is the start of a new run, zero out counter */
if(!runPos) {
runPos = 1;
t = 0;
}
/* Neat trick that saves 1 symbol: instead of or-ing 0 or 1 at
each bit position, add 1 or 2 instead. For example,
1011 is 1<<0 + 1<<1 + 2<<2. 1010 is 2<<0 + 2<<1 + 1<<2.
You can make any bit pattern that way using 1 less symbol than
the basic or 0/1 method (except all bits 0, which would use no
symbols, but a run of length 0 doesn't mean anything in this
context). Thus space is saved. */
t += (runPos << nextSym); /* +runPos if RUNA; +2*runPos if RUNB */
runPos <<= 1;
continue;
}
/* When we hit the first non-run symbol after a run, we now know
how many times to repeat the last literal, so append that many
copies to our buffer of decoded symbols (dbuf) now. (The last
literal used is the one at the head of the mtfSymbol array.) */
if(runPos) {
runPos=0;
if(dbufCount+t>=dbufSize) return RETVAL_DATA_ERROR;
uc = symToByte[mtfSymbol[0]];
byteCount[uc] += t;
while(t--) dbuf[dbufCount++]=uc;
}
/* Is this the terminating symbol? */
if(nextSym>symTotal) break;
/* At this point, nextSym indicates a new literal character. Subtract
one to get the position in the MTF array at which this literal is
currently to be found. (Note that the result can't be -1 or 0,
because 0 and 1 are RUNA and RUNB. But another instance of the
first symbol in the mtf array, position 0, would have been handled
as part of a run above. Therefore 1 unused mtf position minus
2 non-literal nextSym values equals -1.) */
if(dbufCount>=dbufSize) return RETVAL_DATA_ERROR;
i = nextSym - 1;
uc = mtfSymbol[i];
/* Adjust the MTF array. Since we typically expect to move only a
* small number of symbols, and are bound by 256 in any case, using
* memmove here would typically be bigger and slower due to function
* call overhead and other assorted setup costs. */
do {
mtfSymbol[i] = mtfSymbol[i-1];
} while (--i);
mtfSymbol[0] = uc;
uc=symToByte[uc];
/* We have our literal byte. Save it into dbuf. */
byteCount[uc]++;
dbuf[dbufCount++] = (unsigned int)uc;
}
/* At this point, we've read all the Huffman-coded symbols (and repeated
runs) for this block from the input stream, and decoded them into the
intermediate buffer. There are dbufCount many decoded bytes in dbuf[].
Now undo the Burrows-Wheeler transform on dbuf.
See http://dogma.net/markn/articles/bwt/bwt.htm
*/
/* Turn byteCount into cumulative occurrence counts of 0 to n-1. */
j=0;
for(i=0;i<256;i++) {
k=j+byteCount[i];
byteCount[i] = j;
j=k;
}
/* Figure out what order dbuf would be in if we sorted it. */
for (i=0;i<dbufCount;i++) {
uc=(unsigned char)(dbuf[i] & 0xff);
dbuf[byteCount[uc]] |= (i << 8);
byteCount[uc]++;
}
/* Decode first byte by hand to initialize "previous" byte. Note that it
doesn't get output, and if the first three characters are identical
it doesn't qualify as a run (hence writeRunCountdown=5). */
if(dbufCount) {
if(origPtr>=dbufCount) return RETVAL_DATA_ERROR;
bd->writePos=dbuf[origPtr];
bd->writeCurrent=(unsigned char)(bd->writePos&0xff);
bd->writePos>>=8;
bd->writeRunCountdown=5;
}
bd->writeCount=dbufCount;
return RETVAL_OK;
}
/* Undo burrows-wheeler transform on intermediate buffer to produce output.
If start_bunzip was initialized with out_fd=-1, then up to len bytes of
data are written to outbuf. Return value is number of bytes written or
error (all errors are negative numbers). If out_fd!=-1, outbuf and len
are ignored, data is written to out_fd and return is RETVAL_OK or error.
*/
static int read_bunzip(bunzip_data *bd, char *outbuf, int len)
{
const unsigned int *dbuf;
int pos,current,previous,gotcount;
/* If last read was short due to end of file, return last block now */
if(bd->writeCount<0) return bd->writeCount;
gotcount = 0;
dbuf=bd->dbuf;
pos=bd->writePos;
current=bd->writeCurrent;
/* We will always have pending decoded data to write into the output
buffer unless this is the very first call (in which case we haven't
Huffman-decoded a block into the intermediate buffer yet). */
if (bd->writeCopies) {
/* Inside the loop, writeCopies means extra copies (beyond 1) */
--bd->writeCopies;
/* Loop outputting bytes */
for(;;) {
/* If the output buffer is full, snapshot state and return */
if(gotcount >= len) {
bd->writePos=pos;
bd->writeCurrent=current;
bd->writeCopies++;
return len;
}
/* Write next byte into output buffer, updating CRC */
outbuf[gotcount++] = current;
bd->writeCRC=(((bd->writeCRC)<<8)
^bd->crc32Table[((bd->writeCRC)>>24)^current]);
/* Loop now if we're outputting multiple copies of this byte */
if (bd->writeCopies) {
--bd->writeCopies;
continue;
}
decode_next_byte:
if (!bd->writeCount--) break;
/* Follow sequence vector to undo Burrows-Wheeler transform */
previous=current;
pos=dbuf[pos];
current=pos&0xff;
pos>>=8;
/* After 3 consecutive copies of the same byte, the 4th is a repeat
count. We count down from 4 instead
* of counting up because testing for non-zero is faster */
if(--bd->writeRunCountdown) {
if(current!=previous) bd->writeRunCountdown=4;
} else {
/* We have a repeated run, this byte indicates the count */
bd->writeCopies=current;
current=previous;
bd->writeRunCountdown=5;
/* Sometimes there are just 3 bytes (run length 0) */
if(!bd->writeCopies) goto decode_next_byte;
/* Subtract the 1 copy we'd output anyway to get extras */
--bd->writeCopies;
}
}
/* Decompression of this block completed successfully */
bd->writeCRC=~bd->writeCRC;
bd->totalCRC=((bd->totalCRC<<1) | (bd->totalCRC>>31)) ^ bd->writeCRC;
/* If this block had a CRC error, force file level CRC error. */
if(bd->writeCRC!=bd->headerCRC) {
bd->totalCRC=bd->headerCRC+1;
return RETVAL_LAST_BLOCK;
}
}
/* Refill the intermediate buffer by Huffman-decoding next block of input */
/* (previous is just a convenient unused temp variable here) */
previous=get_next_block(bd);
if(previous) {
bd->writeCount=previous;
return (previous!=RETVAL_LAST_BLOCK) ? previous : gotcount;
}
bd->writeCRC=0xffffffffUL;
pos=bd->writePos;
current=bd->writeCurrent;
goto decode_next_byte;
}
/* Allocate the structure, read file header. If in_fd==-1, inbuf must contain
a complete bunzip file (len bytes long). If in_fd!=-1, inbuf and len are
ignored, and data is read from file handle into temporary buffer. */
static int start_bunzip(bunzip_data **bdp, int in_fd, char *inbuf, int len)
{
bunzip_data *bd;
unsigned int i,j,c;
const unsigned int BZh0=(((unsigned int)'B')<<24)+(((unsigned int)'Z')<<16)
+(((unsigned int)'h')<<8)+(unsigned int)'0';
/* Figure out how much data to allocate */
i=sizeof(bunzip_data);
if(in_fd!=-1) i+=IOBUF_SIZE;
/* Allocate bunzip_data. Most fields initialize to zero. */
bd=*bdp=xmalloc(i);
memset(bd,0,sizeof(bunzip_data));
/* Setup input buffer */
if(-1==(bd->in_fd=in_fd)) {
bd->inbuf=inbuf;
bd->inbufCount=len;
} else bd->inbuf=(unsigned char *)(bd+1);
/* Init the CRC32 table (big endian) */
for(i=0;i<256;i++) {
c=i<<24;
for(j=8;j;j--)
c=c&0x80000000 ? (c<<1)^0x04c11db7 : (c<<1);
bd->crc32Table[i]=c;
}
/* Setup for I/O error handling via longjmp */
i=setjmp(bd->jmpbuf);
if(i) return i;
/* Ensure that file starts with "BZh['1'-'9']." */
i = get_bits(bd,32);
if (((unsigned int)(i-BZh0-1)) >= 9) return RETVAL_NOT_BZIP_DATA;
/* Fourth byte (ascii '1'-'9'), indicates block size in units of 100k of
uncompressed data. Allocate intermediate buffer for block. */
bd->dbufSize=100000*(i-BZh0);
bd->dbuf=xmalloc(bd->dbufSize * sizeof(int));
return RETVAL_OK;
}
/* Example usage: decompress src_fd to dst_fd. (Stops at end of bzip data,
not end of file.) */
extern int uncompressStream(int src_fd, int dst_fd)
{
char *outbuf;
bunzip_data *bd;
int i;
outbuf=xmalloc(IOBUF_SIZE);
if(!(i=start_bunzip(&bd,src_fd,0,0))) {
for(;;) {
if((i=read_bunzip(bd,outbuf,IOBUF_SIZE)) <= 0) break;
if(i!=write(dst_fd,outbuf,i)) {
i=RETVAL_UNEXPECTED_OUTPUT_EOF;
break;
}
}
}
/* Check CRC and release memory */
if(i==RETVAL_LAST_BLOCK) {
if (bd->headerCRC!=bd->totalCRC) {
bb_error_msg("Data integrity error when decompressing.");
} else {
i=RETVAL_OK;
}
}
else if (i==RETVAL_UNEXPECTED_OUTPUT_EOF) {
bb_error_msg("Compressed file ends unexpectedly");
} else {
bb_error_msg("Decompression failed");
}
if(bd->dbuf) free(bd->dbuf);
free(bd);
free(outbuf);
return i;
}
#ifdef TESTING
static char * const bunzip_errors[]={NULL,"Bad file checksum","Not bzip data",
"Unexpected input EOF","Unexpected output EOF","Data error",
"Out of memory","Obsolete (pre 0.9.5) bzip format not supported."};
/* Dumb little test thing, decompress stdin to stdout */
int main(int argc, char *argv[])
{
int i=uncompressStream(0,1);
char c;
if(i) fprintf(stderr,"%s\n", bunzip_errors[-i]);
else if(read(0,&c,1)) fprintf(stderr,"Trailing garbage ignored\n");
return -i;
}
#endif
@@ -0,0 +1,293 @@
#include "config.h"
#include "libbb.h"
/* uncompress for busybox -- (c) 2002 Robert Griebl
*
* based on the original compress42.c source
* (see disclaimer below)
*/
/* (N)compress42.c - File compression ala IEEE Computer, Mar 1992.
*
* Authors:
* Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas)
* Jim McKie (decvax!mcvax!jim)
* Steve Davies (decvax!vax135!petsd!peora!srd)
* Ken Turkowski (decvax!decwrl!turtlevax!ken)
* James A. Woods (decvax!ihnp4!ames!jaw)
* Joe Orost (decvax!vax135!petsd!joe)
* Dave Mack (csu@alembic.acs.com)
* Peter Jannesen, Network Communication Systems
* (peter@ncs.nl)
*
* marc@suse.de : a small security fix for a buffer overflow
*
* [... History snipped ...]
*
*/
#include <stdio.h>
#include <string.h>
#include <unistd.h>
/* Default input buffer size */
#define IBUFSIZ 2048
/* Default output buffer size */
#define OBUFSIZ 2048
/* Defines for third byte of header */
#define MAGIC_1 (char_type)'\037' /* First byte of compressed file */
#define MAGIC_2 (char_type)'\235' /* Second byte of compressed file */
#define BIT_MASK 0x1f /* Mask for 'number of compresssion bits' */
/* Masks 0x20 and 0x40 are free. */
/* I think 0x20 should mean that there is */
/* a fourth header byte (for expansion). */
#define BLOCK_MODE 0x80 /* Block compresssion if table is full and */
/* compression rate is dropping flush tables */
/* the next two codes should not be changed lightly, as they must not */
/* lie within the contiguous general code space. */
#define FIRST 257 /* first free entry */
#define CLEAR 256 /* table clear output code */
#define INIT_BITS 9 /* initial number of bits/code */
/* machine variants which require cc -Dmachine: pdp11, z8000, DOS */
#define FAST
#define HBITS 17 /* 50% occupancy */
#define HSIZE (1<<HBITS)
#define HMASK (HSIZE-1)
#define HPRIME 9941
#define BITS 16
#undef MAXSEG_64K
#define MAXCODE(n) (1L << (n))
/* Block compress mode -C compatible with 2.0 */
int block_mode = BLOCK_MODE;
/* user settable max # bits/code */
int maxbits = BITS;
/* Exitcode of compress (-1 no file compressed) */
int exit_code = -1;
/* Input buffer */
unsigned char inbuf[IBUFSIZ + 64];
/* Output buffer */
unsigned char outbuf[OBUFSIZ + 2048];
long int htab[HSIZE];
unsigned short codetab[HSIZE];
#define htabof(i) htab[i]
#define codetabof(i) codetab[i]
#define tab_prefixof(i) codetabof(i)
#define tab_suffixof(i) ((unsigned char *)(htab))[i]
#define de_stack ((unsigned char *)&(htab[HSIZE-1]))
#define clear_htab() memset(htab, -1, sizeof(htab))
#define clear_tab_prefixof() memset(codetab, 0, 256);
/*
* Decompress stdin to stdout. This routine adapts to the codes in the
* file building the "string" table on-the-fly; requiring no table to
* be stored in the compressed file. The tables used herein are shared
* with those of the compress() routine. See the definitions above.
*/
extern int uncompress(int fd_in, int fd_out)
{
unsigned char *stackp;
long int code;
int finchar;
long int oldcode;
long int incode;
int inbits;
int posbits;
int outpos;
int insize;
int bitmask;
long int free_ent;
long int maxcode;
long int maxmaxcode;
int n_bits;
int rsize = 0;
insize = 0;
inbuf[0] = bb_xread_char(fd_in);
maxbits = inbuf[0] & BIT_MASK;
block_mode = inbuf[0] & BLOCK_MODE;
maxmaxcode = MAXCODE(maxbits);
if (maxbits > BITS) {
bb_error_msg("compressed with %d bits, can only handle %d bits", maxbits,
BITS);
return -1;
}
maxcode = MAXCODE(n_bits = INIT_BITS) - 1;
bitmask = (1 << n_bits) - 1;
oldcode = -1;
finchar = 0;
outpos = 0;
posbits = 0 << 3;
free_ent = ((block_mode) ? FIRST : 256);
/* As above, initialize the first 256 entries in the table. */
clear_tab_prefixof();
for (code = 255; code >= 0; --code) {
tab_suffixof(code) = (unsigned char) code;
}
do {
resetbuf:;
{
int i;
int e;
int o;
e = insize - (o = (posbits >> 3));
for (i = 0; i < e; ++i)
inbuf[i] = inbuf[i + o];
insize = e;
posbits = 0;
}
if (insize < (int) sizeof(inbuf) - IBUFSIZ) {
rsize = safe_read(fd_in, inbuf + insize, IBUFSIZ);
insize += rsize;
}
inbits = ((rsize > 0) ? (insize - insize % n_bits) << 3 :
(insize << 3) - (n_bits - 1));
while (inbits > posbits) {
if (free_ent > maxcode) {
posbits =
((posbits - 1) +
((n_bits << 3) -
(posbits - 1 + (n_bits << 3)) % (n_bits << 3)));
++n_bits;
if (n_bits == maxbits) {
maxcode = maxmaxcode;
} else {
maxcode = MAXCODE(n_bits) - 1;
}
bitmask = (1 << n_bits) - 1;
goto resetbuf;
}
{
unsigned char *p = &inbuf[posbits >> 3];
code =
((((long) (p[0])) | ((long) (p[1]) << 8) |
((long) (p[2]) << 16)) >> (posbits & 0x7)) & bitmask;
}
posbits += n_bits;
if (oldcode == -1) {
outbuf[outpos++] = (unsigned char) (finchar =
(int) (oldcode = code));
continue;
}
if (code == CLEAR && block_mode) {
clear_tab_prefixof();
free_ent = FIRST - 1;
posbits =
((posbits - 1) +
((n_bits << 3) -
(posbits - 1 + (n_bits << 3)) % (n_bits << 3)));
maxcode = MAXCODE(n_bits = INIT_BITS) - 1;
bitmask = (1 << n_bits) - 1;
goto resetbuf;
}
incode = code;
stackp = de_stack;
/* Special case for KwKwK string. */
if (code >= free_ent) {
if (code > free_ent) {
unsigned char *p;
posbits -= n_bits;
p = &inbuf[posbits >> 3];
bb_error_msg
("insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)",
insize, posbits, p[-1], p[0], p[1], p[2], p[3],
(posbits & 07));
bb_error_msg("uncompress: corrupt input");
return -1;
}
*--stackp = (unsigned char) finchar;
code = oldcode;
}
/* Generate output characters in reverse order */
while ((long int) code >= (long int) 256) {
*--stackp = tab_suffixof(code);
code = tab_prefixof(code);
}
*--stackp = (unsigned char) (finchar = tab_suffixof(code));
/* And put them out in forward order */
{
int i;
if (outpos + (i = (de_stack - stackp)) >= OBUFSIZ) {
do {
if (i > OBUFSIZ - outpos) {
i = OBUFSIZ - outpos;
}
if (i > 0) {
memcpy(outbuf + outpos, stackp, i);
outpos += i;
}
if (outpos >= OBUFSIZ) {
write(fd_out, outbuf, outpos);
outpos = 0;
}
stackp += i;
} while ((i = (de_stack - stackp)) > 0);
} else {
memcpy(outbuf + outpos, stackp, i);
outpos += i;
}
}
/* Generate the new entry. */
if ((code = free_ent) < maxmaxcode) {
tab_prefixof(code) = (unsigned short) oldcode;
tab_suffixof(code) = (unsigned char) finchar;
free_ent = code + 1;
}
/* Remember previous code. */
oldcode = incode;
}
} while (rsize > 0);
if (outpos > 0) {
write(fd_out, outbuf, outpos);
}
return 0;
}
File diff suppressed because it is too large. Load diff
+32
View File
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2002 by Glenn McGrath
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <fnmatch.h>
#include <stdlib.h>
#include "unarchive.h"
/* Accept any non-null name, its not really a filter at all */
extern char filter_accept_all(archive_handle_t *archive_handle)
{
if (archive_handle->file_header->name) {
return(EXIT_SUCCESS);
} else {
return(EXIT_FAILURE);
}
}
@@ -0,0 +1,34 @@
/*
* Copyright (C) 2002 by Glenn McGrath
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <fnmatch.h>
#include <stdlib.h>
#include "unarchive.h"
/*
* Accept names that are in the accept list, ignoring reject list.
*/
extern char filter_accept_list(archive_handle_t *archive_handle)
{
if (find_list_entry(archive_handle->accept, archive_handle->file_header->name)) {
return(EXIT_SUCCESS);
} else {
return(EXIT_FAILURE);
}
}
@@ -0,0 +1,55 @@
/*
* Copyright (C) 2002 by Glenn McGrath
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "libbb.h"
#include "unarchive.h"
/*
* Reassign the subarchive metadata parser based on the filename extension
* e.g. if its a .tar.gz modify archive_handle->sub_archive to process a .tar.gz
* or if its a .tar.bz2 make archive_handle->sub_archive handle that
*/
extern char filter_accept_list_reassign(archive_handle_t *archive_handle)
{
/* Check the file entry is in the accept list */
if (find_list_entry(archive_handle->accept, archive_handle->file_header->name)) {
const char *name_ptr;
/* Extract the last 2 extensions */
name_ptr = strrchr(archive_handle->file_header->name, '.');
/* Modify the subarchive handler based on the extension */
#ifdef CONFIG_FEATURE_DEB_TAR_GZ
if (strcmp(name_ptr, ".gz") == 0) {
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->action_data_subarchive = get_header_tar_bz2;
return(EXIT_SUCCESS);
}
#endif
}
return(EXIT_FAILURE);
}
@@ -0,0 +1,45 @@
/*
* Copyright (C) 2002 by Glenn McGrath
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <fnmatch.h>
#include <stdlib.h>
#include "unarchive.h"
/*
* Accept names that are in the accept list and not in the reject list
*/
extern char filter_accept_reject_list(archive_handle_t *archive_handle)
{
const char *key = archive_handle->file_header->name;
const llist_t *accept_entry = find_list_entry(archive_handle->accept, key);
const llist_t *reject_entry = find_list_entry(archive_handle->reject, key);
/* If the key is in a reject list fail */
if (reject_entry) {
return(EXIT_FAILURE);
}
/* Fail if an accept list was specified and the key wasnt in there */
if (archive_handle->accept && (accept_entry == NULL)) {
return(EXIT_FAILURE);
}
/* Accepted */
return(EXIT_SUCCESS);
}
+30
View File
@@ -0,0 +1,30 @@
/*
* 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 <fnmatch.h>
#include <stdlib.h>
#include "unarchive.h"
extern const llist_t *find_list_entry(const llist_t *list, const char *filename)
{
while (list) {
if (fnmatch(list->data, filename, 0) == 0) {
return(list);
}
list = list->link;
}
return(NULL);
}
+126
View File
@@ -0,0 +1,126 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "unarchive.h"
#include "libbb.h"
extern char get_header_ar(archive_handle_t *archive_handle)
{
file_header_t *typed = archive_handle->file_header;
union {
char raw[60];
struct {
char name[16];
char date[12];
char uid[6];
char gid[6];
char mode[8];
char size[10];
char magic[2];
} formated;
} ar;
#ifdef CONFIG_FEATURE_AR_LONG_FILENAMES
static char *ar_long_names;
static unsigned int ar_long_name_size;
#endif
/* dont use bb_xread as we want to handle the error ourself */
if (read(archive_handle->src_fd, ar.raw, 60) != 60) {
/* End Of File */
return(EXIT_FAILURE);
}
/* ar header starts on an even byte (2 byte aligned)
* '\n' is used for padding
*/
if (ar.raw[0] == '\n') {
/* fix up the header, we started reading 1 byte too early */
memmove(ar.raw, &ar.raw[1], 59);
ar.raw[59] = bb_xread_char(archive_handle->src_fd);
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");
}
typed->mode = strtol(ar.formated.mode, NULL, 8);
typed->mtime = atoi(ar.formated.date);
typed->uid = atoi(ar.formated.uid);
typed->gid = atoi(ar.formated.gid);
typed->size = atoi(ar.formated.size);
/* long filenames have '/' as the first character */
if (ar.formated.name[0] == '/') {
#ifdef CONFIG_FEATURE_AR_LONG_FILENAMES
if (ar.formated.name[1] == '/') {
/* If the second char is a '/' then this entries data section
* stores long filename for multiple entries, they are stored
* in static variable long_names for use in future entries */
ar_long_name_size = typed->size;
ar_long_names = xmalloc(ar_long_name_size);
bb_xread_all(archive_handle->src_fd, ar_long_names, ar_long_name_size);
archive_handle->offset += ar_long_name_size;
/* This ar entries data section only contained filenames for other records
* they are stored in the static ar_long_names for future reference */
return (get_header_ar(archive_handle)); /* Return next header */
} 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
(saved in variable long_name) that conatains the real filename */
const unsigned int long_offset = atoi(&ar.formated.name[1]);
if (long_offset >= ar_long_name_size) {
bb_error_msg_and_die("Cant resolve long filename");
}
typed->name = bb_xstrdup(ar_long_names + long_offset);
}
#else
bb_error_msg_and_die("long filenames not supported");
#endif
} else {
/* short filenames */
typed->name = bb_xstrndup(ar.formated.name, 16);
}
typed->name[strcspn(typed->name, " /")] = '\0';
if (archive_handle->filter(archive_handle) == EXIT_SUCCESS) {
archive_handle->action_header(typed);
if (archive_handle->sub_archive) {
while (archive_handle->action_data_subarchive(archive_handle->sub_archive) == EXIT_SUCCESS);
} else {
archive_handle->action_data(archive_handle);
}
} else {
data_skip(archive_handle);
}
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);
}
+161
View File
@@ -0,0 +1,161 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/sysmacros.h> /* major() and minor() */
#include "unarchive.h"
#include "libbb.h"
typedef struct hardlinks_s {
file_header_t *entry;
int inode;
struct hardlinks_s *next;
} hardlinks_t;
extern char get_header_cpio(archive_handle_t *archive_handle)
{
static hardlinks_t *saved_hardlinks = NULL;
static unsigned short pending_hardlinks = 0;
file_header_t *file_header = archive_handle->file_header;
char cpio_header[110];
int namesize;
char dummy[16];
int major, minor, nlink, inode;
if (pending_hardlinks) { /* Deal with any pending hardlinks */
hardlinks_t *tmp;
hardlinks_t *oldtmp;
tmp = saved_hardlinks;
oldtmp = NULL;
while (tmp) {
bb_error_msg_and_die("need to fix this\n");
if (tmp->entry->link_name) { /* Found a hardlink ready to be extracted */
file_header = tmp->entry;
if (oldtmp) {
oldtmp->next = tmp->next; /* Remove item from linked list */
} else {
saved_hardlinks = tmp->next;
}
free(tmp);
continue;
}
oldtmp = tmp;
tmp = tmp->next;
}
pending_hardlinks = 0; /* No more pending hardlinks, read next file entry */
}
/* There can be padding before archive header */
data_align(archive_handle, 4);
if (archive_xread_all_eof(archive_handle, cpio_header, 110) == 0) {
return(EXIT_FAILURE);
}
archive_handle->offset += 110;
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");
}
{
unsigned long tmpsize;
sscanf(cpio_header, "%6c%8x%8x%8x%8x%8x%8lx%8lx%16c%8x%8x%8x%8c",
dummy, &inode, (unsigned int*)&file_header->mode,
(unsigned int*)&file_header->uid, (unsigned int*)&file_header->gid,
&nlink, &file_header->mtime, &tmpsize,
dummy, &major, &minor, &namesize, dummy);
file_header->size = tmpsize;
}
file_header->name = (char *) xmalloc(namesize + 1);
archive_xread_all(archive_handle, file_header->name, namesize); /* Read in filename */
file_header->name[namesize] = '\0';
archive_handle->offset += namesize;
/* Update offset amount and skip padding before file contents */
data_align(archive_handle, 4);
if (strcmp(file_header->name, "TRAILER!!!") == 0) {
printf("%d blocks\n", (int) (archive_handle->offset % 512 ? (archive_handle->offset / 512) + 1 : archive_handle->offset / 512)); /* Always round up */
if (saved_hardlinks) { /* Bummer - we still have unresolved hardlinks */
hardlinks_t *tmp = saved_hardlinks;
hardlinks_t *oldtmp = NULL;
while (tmp) {
bb_error_msg("%s not created: cannot resolve hardlink", tmp->entry->name);
oldtmp = tmp;
tmp = tmp->next;
free (oldtmp->entry->name);
free (oldtmp->entry);
free (oldtmp);
}
saved_hardlinks = NULL;
pending_hardlinks = 0;
}
return(EXIT_FAILURE);
}
if (S_ISLNK(file_header->mode)) {
file_header->link_name = (char *) xmalloc(file_header->size + 1);
archive_xread_all(archive_handle, file_header->link_name, file_header->size);
file_header->link_name[file_header->size] = '\0';
archive_handle->offset += file_header->size;
file_header->size = 0; /* Stop possible seeks in future */
} else {
file_header->link_name = NULL;
}
if (nlink > 1 && !S_ISDIR(file_header->mode)) {
if (file_header->size == 0) { /* Put file on a linked list for later */
hardlinks_t *new = xmalloc(sizeof(hardlinks_t));
new->next = saved_hardlinks;
new->inode = inode;
new->entry = file_header;
saved_hardlinks = new;
return(EXIT_SUCCESS); // Skip this one
} else { /* Found the file with data in */
hardlinks_t *tmp = saved_hardlinks;
pending_hardlinks = 1;
while (tmp) {
if (tmp->inode == inode) {
tmp->entry->link_name = bb_xstrdup(file_header->name);
nlink--;
}
tmp = tmp->next;
}
if (nlink > 1) {
bb_error_msg("error resolving hardlink: did you create the archive with GNU cpio 2.0-2.2?");
}
}
}
file_header->device = makedev(major, minor);
if (archive_handle->filter(archive_handle) == EXIT_SUCCESS) {
archive_handle->action_data(archive_handle);
archive_handle->action_header(archive_handle->file_header);
} else {
data_skip(archive_handle);
}
archive_handle->offset += file_header->size;
free(file_header->link_name);
return (EXIT_SUCCESS);
}
+215
View File
@@ -0,0 +1,215 @@
/*
* 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.
*
* FIXME:
* In privileged mode if uname and gname map to a uid and gid then use the
* mapped value instead of the uid/gid values in tar header
*
* References:
* GNU tar and star man pages,
* Opengroup's ustar interchange format,
* http://www.opengroup.org/onlinepubs/007904975/utilities/pax.html
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "unarchive.h"
#include "libbb.h"
#ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS
static char *longname = NULL;
static char *linkname = NULL;
#endif
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 */
char mode[8]; /* 100-107 */
char uid[8]; /* 108-115 */
char gid[8]; /* 116-123 */
char size[12]; /* 124-135 */
char mtime[12]; /* 136-147 */
char chksum[8]; /* 148-155 */
char typeflag; /* 156-156 */
char linkname[100]; /* 157-256 */
char magic[6]; /* 257-262 */
char version[2]; /* 263-264 */
char uname[32]; /* 265-296 */
char gname[32]; /* 297-328 */
char devmajor[8]; /* 329-336 */
char devminor[8]; /* 337-344 */
char prefix[155]; /* 345-499 */
char padding[12]; /* 500-512 */
} formated;
} tar;
long sum = 0;
long i;
/* Align header */
data_align(archive_handle, 512);
if (bb_full_read(archive_handle->src_fd, tar.raw, 512) != 512) {
/* Assume end of file */
return(EXIT_FAILURE);
}
archive_handle->offset += 512;
/* If there is no filename its an empty header */
if (tar.formated.name[0] == 0) {
return(EXIT_SUCCESS);
}
/* Check header has valid magic, "ustar" is for the proper tar
* 0's are for the old tar format
*/
if (strncmp(tar.formated.magic, "ustar", 5) != 0) {
#ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
if (strncmp(tar.formated.magic, "\0\0\0\0\0", 5) != 0)
#endif
bb_error_msg_and_die("Invalid tar magic");
}
/* Do checksum on headers */
for (i = 0; i < 148 ; i++) {
sum += tar.raw[i];
}
sum += ' ' * 8;
for (i = 156; i < 512 ; i++) {
sum += tar.raw[i];
}
if (sum != strtol(tar.formated.chksum, NULL, 8)) {
bb_error_msg("Invalid tar header checksum");
return(EXIT_FAILURE);
}
#ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS
if (longname) {
file_header->name = longname;
longname = NULL;
}
else if (linkname) {
file_header->name = linkname;
linkname = NULL;
} else
#endif
if (tar.formated.prefix[0] == 0) {
file_header->name = strdup(tar.formated.name);
} else {
file_header->name = concat_path_file(tar.formated.prefix, tar.formated.name);
}
file_header->uid = strtol(tar.formated.uid, NULL, 8);
file_header->gid = strtol(tar.formated.gid, NULL, 8);
file_header->size = strtol(tar.formated.size, NULL, 8);
file_header->mtime = strtol(tar.formated.mtime, NULL, 8);
file_header->link_name = (tar.formated.linkname[0] != '\0') ?
bb_xstrdup(tar.formated.linkname) : NULL;
file_header->device = makedev(strtol(tar.formated.devmajor, NULL, 8),
strtol(tar.formated.devminor, NULL, 8));
/* Set bits 0-11 of the files mode */
file_header->mode = 07777 & strtol(tar.formated.mode, NULL, 8);
/* Set bits 12-15 of the files mode */
switch (tar.formated.typeflag) {
/* busybox identifies hard links as being regular files with 0 size and a link name */
case '1':
file_header->mode |= S_IFREG;
break;
case 'x':
case 'g':
bb_error_msg_and_die("pax is not tar");
break;
case '7':
/* Reserved for high performance files, treat as normal file */
case 0:
case '0':
#ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
if (last_char_is(file_header->name, '/')) {
file_header->mode |= S_IFDIR;
} else
#endif
file_header->mode |= S_IFREG;
break;
case '2':
file_header->mode |= S_IFLNK;
break;
case '3':
file_header->mode |= S_IFCHR;
break;
case '4':
file_header->mode |= S_IFBLK;
break;
case '5':
file_header->mode |= S_IFDIR;
break;
case '6':
file_header->mode |= S_IFIFO;
break;
#ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS
case 'L': {
longname = xmalloc(file_header->size + 1);
archive_xread_all(archive_handle, longname, file_header->size);
longname[file_header->size] = '\0';
archive_handle->offset += file_header->size;
return(get_header_tar(archive_handle));
}
case 'K': {
linkname = xmalloc(file_header->size + 1);
archive_xread_all(archive_handle, linkname, file_header->size);
linkname[file_header->size] = '\0';
archive_handle->offset += file_header->size;
file_header->name = linkname;
return(get_header_tar(archive_handle));
}
case 'D': /* GNU dump dir */
case 'M': /* Continuation of multi volume archive*/
case 'N': /* Old GNU for names > 100 characters */
case 'S': /* Sparse file */
case 'V': /* Volume header */
bb_error_msg("Ignoring GNU extension type %c", tar.formated.typeflag);
#endif
default:
bb_error_msg("Unknown typeflag: 0x%x", tar.formated.typeflag);
}
{ /* Strip trailing '/' in directories */
/* Must be done after mode is set as '/' is used to check if its a directory */
char *tmp = last_char_is(file_header->name, '/');
if (tmp) {
*tmp = '\0';
}
}
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, file_header->name);
} else {
data_skip(archive_handle);
}
archive_handle->offset += file_header->size;
free(file_header->link_name);
return(EXIT_SUCCESS);
}
@@ -0,0 +1,38 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "libbb.h"
#include "unarchive.h"
extern char get_header_tar_bz2(archive_handle_t *archive_handle)
{
/* 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);
/* Can only do one file at a time */
return(EXIT_FAILURE);
}
+42
View File
@@ -0,0 +1,42 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include "libbb.h"
#include "unarchive.h"
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");
}
check_header_gzip(archive_handle->src_fd);
archive_handle->src_fd = open_transformer(archive_handle->src_fd, inflate_gunzip);
archive_handle->offset = 0;
while (get_header_tar(archive_handle) == EXIT_SUCCESS);
/* Can only do one file at a time */
return(EXIT_FAILURE);
}
+7
View File
@@ -0,0 +1,7 @@
#include <stdio.h>
#include "unarchive.h"
extern void header_list(const file_header_t *file_header)
{
puts(file_header->name);
}
+7
View File
@@ -0,0 +1,7 @@
#include <stdio.h>
#include "unarchive.h"
extern void header_skip(const file_header_t *file_header)
{
return;
}
@@ -0,0 +1,29 @@
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "libbb.h"
#include "unarchive.h"
extern void header_verbose_list(const file_header_t *file_header)
{
struct tm *mtime = localtime(&file_header->mtime);
printf("%s %d/%d%10u %4u-%02u-%02u %02u:%02u:%02u %s",
bb_mode_string(file_header->mode),
file_header->uid,
file_header->gid,
(unsigned int) file_header->size,
1900 + mtime->tm_year,
1 + mtime->tm_mon,
mtime->tm_mday,
mtime->tm_hour,
mtime->tm_min,
mtime->tm_sec,
file_header->name);
if (file_header->link_name) {
printf(" -> %s", file_header->link_name);
}
/* putchar isnt used anywhere else i dont think */
puts("");
}
+36
View File
@@ -0,0 +1,36 @@
/*
* 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 <string.h>
#include "libbb.h"
#include "unarchive.h"
archive_handle_t *init_handle(void)
{
archive_handle_t *archive_handle;
/* Initialise default values */
archive_handle = xmalloc(sizeof(archive_handle_t));
memset(archive_handle, 0, sizeof(archive_handle_t));
archive_handle->file_header = xmalloc(sizeof(file_header_t));
archive_handle->action_header = header_skip;
archive_handle->action_data = data_skip;
archive_handle->filter = filter_accept_all;
archive_handle->seek = seek_by_jump;
return(archive_handle);
}
+51
View File
@@ -0,0 +1,51 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include <unistd.h>
#include "libbb.h"
/* transformer(), more than meets the eye */
extern int open_transformer(int src_fd, int (*transformer)(int src_fd, int dst_fd))
{
int fd_pipe[2];
int pid;
if (pipe(fd_pipe) != 0) {
bb_perror_msg_and_die("Can't create pipe");
}
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]);
}
+32
View File
@@ -0,0 +1,32 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#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)
{
if (jump_size) {
bb_copyfd_size(archive_handle->src_fd, -1, jump_size);
}
}
+35
View File
@@ -0,0 +1,35 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include "libbb.h"
#include "unarchive.h"
extern void seek_by_jump(const archive_handle_t *archive_handle, const unsigned int amount)
{
if (lseek(archive_handle->src_fd, (off_t) amount, SEEK_CUR) == (off_t) -1) {
#ifdef CONFIG_FEATURE_UNARCHIVE_TAPE
if (errno == ESPIPE) {
seek_by_char(archive_handle, amount);
} else
#endif
bb_perror_msg_and_die("Seek failure");
}
}
+34
View File
@@ -0,0 +1,34 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include "unarchive.h"
#include "busybox.h"
extern void unpack_ar_archive(archive_handle_t *ar_archive)
{
char magic[7];
archive_xread_all(ar_archive, magic, 7);
if (strncmp(magic, "!<arch>", 7) != 0) {
bb_error_msg_and_die("Invalid ar magic");
}
ar_archive->offset += 7;
while (get_header_ar(ar_archive) == EXIT_SUCCESS);
}
File diff suppressed because it is too large. Load diff
+349
View File
@@ -0,0 +1,349 @@
/* vi: set sw=4 ts=4: */
/*
* Mini rpm applet for busybox
*
* Copyright (C) 2001,2002 by Laurence Anderson
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
#include <fcntl.h>
#include <netinet/in.h> /* For ntohl & htonl function */
#include <string.h> /* For strncmp */
#include <sys/mman.h> /* For mmap */
#include <time.h> /* For ctime */
#include "busybox.h"
#include "unarchive.h"
#define RPM_HEADER_MAGIC "\216\255\350"
#define RPM_CHAR_TYPE 1
#define RPM_INT8_TYPE 2
#define RPM_INT16_TYPE 3
#define RPM_INT32_TYPE 4
/* #define RPM_INT64_TYPE 5 ---- These aren't supported (yet) */
#define RPM_STRING_TYPE 6
#define RPM_BIN_TYPE 7
#define RPM_STRING_ARRAY_TYPE 8
#define RPM_I18NSTRING_TYPE 9
#define RPMTAG_NAME 1000
#define RPMTAG_VERSION 1001
#define RPMTAG_RELEASE 1002
#define RPMTAG_SUMMARY 1004
#define RPMTAG_DESCRIPTION 1005
#define RPMTAG_BUILDTIME 1006
#define RPMTAG_BUILDHOST 1007
#define RPMTAG_SIZE 1009
#define RPMTAG_VENDOR 1011
#define RPMTAG_LICENSE 1014
#define RPMTAG_PACKAGER 1015
#define RPMTAG_GROUP 1016
#define RPMTAG_URL 1020
#define RPMTAG_PREIN 1023
#define RPMTAG_POSTIN 1024
#define RPMTAG_FILEFLAGS 1037
#define RPMTAG_FILEUSERNAME 1039
#define RPMTAG_FILEGROUPNAME 1040
#define RPMTAG_SOURCERPM 1044
#define RPMTAG_PREINPROG 1085
#define RPMTAG_POSTINPROG 1086
#define RPMTAG_PREFIXS 1098
#define RPMTAG_DIRINDEXES 1116
#define RPMTAG_BASENAMES 1117
#define RPMTAG_DIRNAMES 1118
#define RPMFILE_CONFIG (1 << 0)
#define RPMFILE_DOC (1 << 1)
enum rpm_functions_e {
rpm_query = 1,
rpm_install = 2,
rpm_query_info = 4,
rpm_query_package = 8,
rpm_query_list = 16,
rpm_query_list_doc = 32,
rpm_query_list_config = 64
};
typedef struct {
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;
static rpm_index **mytags;
static int tagcount;
void extract_cpio_gz(int fd);
rpm_index **rpm_gettags(int fd, int *num_tags);
int bsearch_rpmtag(const void *key, const void *item);
char *rpm_getstring(int tag, int itemindex);
int rpm_getint(int tag, int itemindex);
int rpm_getcount(int tag);
void exec_script(int progtag, int datatag, char *prefix);
void fileaction_dobackup(char *filename, int fileref);
void fileaction_setowngrp(char *filename, int fileref);
void fileaction_list(char *filename, int itemno);
void loop_through_files(int filetag, void (*fileaction)(char *filename, int fileref));
int rpm_main(int argc, char **argv)
{
int opt = 0, func = 0, rpm_fd, offset;
while ((opt = getopt(argc, argv, "iqpldc")) != -1) {
switch (opt) {
case 'i': // First arg: Install mode, with q: Information
if (!func) func |= rpm_install;
else func |= rpm_query_info;
break;
case 'q': // First arg: Query mode
if (!func) func |= rpm_query;
else bb_show_usage();
break;
case 'p': // Query a package
func |= rpm_query_package;
break;
case 'l': // List files in a package
func |= rpm_query_list;
break;
case 'd': // List doc files in a package (implies list)
func |= rpm_query_list;
func |= rpm_query_list_doc;
break;
case 'c': // List config files in a package (implies list)
func |= rpm_query_list;
func |= rpm_query_list_config;
break;
default:
bb_show_usage();
}
}
if (optind == argc) bb_show_usage();
while (optind < argc) {
rpm_fd = bb_xopen(argv[optind], O_RDONLY);
mytags = rpm_gettags(rpm_fd, (int *) &tagcount);
offset = lseek(rpm_fd, 0, SEEK_CUR);
if (!mytags) { printf("Error reading rpm header\n"); exit(-1); }
map = mmap(0, offset > getpagesize() ? (offset + offset % getpagesize()) : getpagesize(), PROT_READ, MAP_SHARED, rpm_fd, 0); // Mimimum is one page
if (func & rpm_install) {
loop_through_files(RPMTAG_BASENAMES, fileaction_dobackup); /* Backup any config files */
extract_cpio_gz(rpm_fd); // Extact the archive
loop_through_files(RPMTAG_BASENAMES, fileaction_setowngrp); /* Set the correct file uid/gid's */
} else if (func & rpm_query && func & rpm_query_package) {
if (!((func & rpm_query_info) || (func & rpm_query_list))) { // If just a straight query, just give package name
printf("%s-%s-%s\n", rpm_getstring(RPMTAG_NAME, 0), rpm_getstring(RPMTAG_VERSION, 0), rpm_getstring(RPMTAG_RELEASE, 0));
}
if (func & rpm_query_info) {
/* Do the nice printout */
time_t bdate_time;
struct tm *bdate;
char bdatestring[50];
printf("Name : %-29sRelocations: %s\n", rpm_getstring(RPMTAG_NAME, 0), rpm_getstring(RPMTAG_PREFIXS, 0) ? rpm_getstring(RPMTAG_PREFIXS, 0) : "(not relocateable)");
printf("Version : %-34sVendor: %s\n", rpm_getstring(RPMTAG_VERSION, 0), rpm_getstring(RPMTAG_VENDOR, 0) ? rpm_getstring(RPMTAG_VENDOR, 0) : "(none)");
bdate_time = rpm_getint(RPMTAG_BUILDTIME, 0);
bdate = localtime((time_t *) &bdate_time);
strftime(bdatestring, 50, "%a %d %b %Y %T %Z", bdate);
printf("Release : %-30sBuild Date: %s\n", rpm_getstring(RPMTAG_RELEASE, 0), bdatestring);
printf("Install date: %-30sBuild Host: %s\n", "(not installed)", rpm_getstring(RPMTAG_BUILDHOST, 0));
printf("Group : %-30sSource RPM: %s\n", rpm_getstring(RPMTAG_GROUP, 0), rpm_getstring(RPMTAG_SOURCERPM, 0));
printf("Size : %-33dLicense: %s\n", rpm_getint(RPMTAG_SIZE, 0), rpm_getstring(RPMTAG_LICENSE, 0));
printf("URL : %s\n", rpm_getstring(RPMTAG_URL, 0));
printf("Summary : %s\n", rpm_getstring(RPMTAG_SUMMARY, 0));
printf("Description :\n%s\n", rpm_getstring(RPMTAG_DESCRIPTION, 0));
}
if (func & rpm_query_list) {
int count, it, flags;
count = rpm_getcount(RPMTAG_BASENAMES);
for (it = 0; it < count; it++) {
flags = rpm_getint(RPMTAG_FILEFLAGS, it);
switch ((func & rpm_query_list_doc) + (func & rpm_query_list_config))
{
case rpm_query_list_doc: if (!(flags & RPMFILE_DOC)) continue; break;
case rpm_query_list_config: if (!(flags & RPMFILE_CONFIG)) continue; break;
case rpm_query_list_doc + rpm_query_list_config: if (!((flags & RPMFILE_CONFIG) || (flags & RPMFILE_DOC))) continue; break;
}
printf("%s%s\n", rpm_getstring(RPMTAG_DIRNAMES, rpm_getint(RPMTAG_DIRINDEXES, it)), rpm_getstring(RPMTAG_BASENAMES, it));
}
}
}
optind++;
free (mytags);
}
return 0;
}
void extract_cpio_gz(int fd) {
archive_handle_t *archive_handle;
unsigned char magic[2];
/* Initialise */
archive_handle = init_handle();
archive_handle->seek = seek_by_char;
//archive_handle->action_header = header_list;
archive_handle->action_data = data_extract_all;
archive_handle->flags |= ARCHIVE_PRESERVE_DATE;
archive_handle->flags |= ARCHIVE_CREATE_LEADING_DIRS;
archive_handle->src_fd = fd;
archive_handle->offset = 0;
bb_xread_all(archive_handle->src_fd, &magic, 2);
if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
bb_error_msg_and_die("Invalid gzip magic");
}
check_header_gzip(archive_handle->src_fd);
chdir("/"); // Install RPM's to root
archive_handle->src_fd = open_transformer(archive_handle->src_fd, inflate_gunzip);
archive_handle->offset = 0;
while (get_header_cpio(archive_handle) == EXIT_SUCCESS);
}
rpm_index **rpm_gettags(int fd, int *num_tags)
{
rpm_index **tags = calloc(200, sizeof(struct rpmtag *)); /* We should never need mode than 200, and realloc later */
int pass, tagindex = 0;
lseek(fd, 96, SEEK_CUR); /* Seek past the unused lead */
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 */
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;
read(fd, &header, sizeof(header));
if (strncmp((char *) &header.magic, RPM_HEADER_MAGIC, 3) != 0) return NULL; /* Invalid magic */
if (header.version != 1) return NULL; /* This program only supports v1 headers */
header.size = ntohl(header.size);
header.entries = ntohl(header.entries);
storepos = lseek(fd,0,SEEK_CUR) + header.entries * 16;
while (header.entries--) {
tmpindex = tags[tagindex++] = malloc(sizeof(rpm_index));
read(fd, tmpindex, sizeof(rpm_index));
tmpindex->tag = ntohl(tmpindex->tag); tmpindex->type = ntohl(tmpindex->type); tmpindex->count = ntohl(tmpindex->count);
tmpindex->offset = storepos + ntohl(tmpindex->offset);
if (pass==0) tmpindex->tag -= 743;
}
lseek(fd, header.size, SEEK_CUR); /* Seek past store */
if (pass==0) lseek(fd, (8 - (lseek(fd,0,SEEK_CUR) % 8)) % 8, SEEK_CUR); /* Skip padding to 8 byte boundary after reading signature headers */
}
tags = realloc(tags, tagindex * sizeof(struct rpmtag *)); /* realloc tags to save space */
*num_tags = tagindex;
return tags; /* All done, leave the file at the start of the gzipped cpio archive */
}
int bsearch_rpmtag(const void *key, const void *item)
{
rpm_index **tmp = (rpm_index **) item;
return ((int) key - tmp[0]->tag);
}
int rpm_getcount(int tag)
{
rpm_index **found;
found = bsearch((void *) tag, mytags, tagcount, sizeof(struct rpmtag *), bsearch_rpmtag);
if (!found) return 0;
else return found[0]->count;
}
char *rpm_getstring(int tag, int itemindex)
{
rpm_index **found;
found = bsearch((void *) tag, mytags, tagcount, sizeof(struct rpmtag *), bsearch_rpmtag);
if (!found || itemindex >= found[0]->count) return NULL;
if (found[0]->type == RPM_STRING_TYPE || found[0]->type == RPM_I18NSTRING_TYPE || found[0]->type == RPM_STRING_ARRAY_TYPE) {
int n;
char *tmpstr = (char *) (map + found[0]->offset);
for (n=0; n < itemindex; n++) tmpstr = tmpstr + strlen(tmpstr) + 1;
return tmpstr;
} else return NULL;
}
int rpm_getint(int tag, int itemindex)
{
rpm_index **found;
int n, *tmpint;
found = bsearch((void *) tag, mytags, tagcount, sizeof(struct rpmtag *), bsearch_rpmtag);
if (!found || itemindex >= found[0]->count) return -1;
tmpint = (int *) (map + found[0]->offset);
if (found[0]->type == RPM_INT32_TYPE) {
for (n=0; n<itemindex; n++) tmpint = (int *) ((void *) tmpint + 4);
return ntohl(*tmpint);
} else if (found[0]->type == RPM_INT16_TYPE) {
for (n=0; n<itemindex; n++) tmpint = (int *) ((void *) tmpint + 2);
return ntohs(*tmpint);
} else if (found[0]->type == RPM_INT8_TYPE) {
for (n=0; n<itemindex; n++) tmpint = (int *) ((void *) tmpint + 1);
return ntohs(*tmpint);
} else return -1;
}
void fileaction_dobackup(char *filename, int fileref)
{
struct stat oldfile;
int stat_res;
char *newname;
if (rpm_getint(RPMTAG_FILEFLAGS, fileref) & RPMFILE_CONFIG) { /* Only need to backup config files */
stat_res = lstat (filename, &oldfile);
if (stat_res == 0 && S_ISREG(oldfile.st_mode)) { /* File already exists - really should check MD5's etc to see if different */
newname = bb_xstrdup(filename);
newname = strcat(newname, ".rpmorig");
copy_file(filename, newname, FILEUTILS_RECUR | FILEUTILS_PRESERVE_STATUS);
remove_file(filename, FILEUTILS_RECUR | FILEUTILS_FORCE);
free(newname);
}
}
}
void fileaction_setowngrp(char *filename, int fileref)
{
int uid, gid;
uid = my_getpwnam(rpm_getstring(RPMTAG_FILEUSERNAME, fileref));
gid = my_getgrnam(rpm_getstring(RPMTAG_FILEGROUPNAME, fileref));
chown (filename, uid, gid);
}
void fileaction_list(char *filename, int fileref)
{
printf("%s\n", filename);
}
void loop_through_files(int filetag, void (*fileaction)(char *filename, int fileref))
{
int count = 0;
char *filename, *tmp_dirname, *tmp_basename;
while (rpm_getstring(filetag, count)) {
tmp_dirname = rpm_getstring(RPMTAG_DIRNAMES, rpm_getint(RPMTAG_DIRINDEXES, count)); /* 1st put on the directory */
tmp_basename = rpm_getstring(RPMTAG_BASENAMES, count);
filename = xmalloc(strlen(tmp_basename) + strlen(tmp_dirname) + 1);
strcpy(filename, tmp_dirname); /* First the directory name */
strcat(filename, tmp_basename); /* then the filename */
fileaction(filename, count++);
free(filename);
}
}
+49 -35
View File
@@ -18,75 +18,89 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "busybox.h"
#include <sys/types.h>
#include <netinet/in.h> /* For ntohl & htonl function */
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include "busybox.h"
#include "unarchive.h"
#define RPM_MAGIC "\355\253\356\333"
#define RPM_HEADER_MAGIC "\216\255\350"
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
struct rpm_lead {
unsigned char magic[4];
u8 major, minor;
u16 type;
u16 archnum;
uint8_t major, minor;
uint16_t type;
uint16_t archnum;
char name[66];
u16 osnum;
u16 signature_type;
uint16_t osnum;
uint16_t signature_type;
char reserved[16];
};
struct rpm_header {
char magic[3]; /* 3 byte magic: 0x8e 0xad 0xe8 */
u8 version; /* 1 byte version number */
u32 reserved; /* 4 bytes reserved */
u32 entries; /* Number of entries in header (4 bytes) */
u32 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(FILE *rpmfile)
void skip_header(int rpm_fd)
{
struct rpm_header header;
fread(&header, sizeof(struct rpm_header), 1, rpmfile);
if (strncmp((char *) &header.magic, RPM_HEADER_MAGIC, 3) != 0) error_msg_and_die("Invalid RPM header magic"); /* Invalid magic */
if (header.version != 1) error_msg_and_die("Unsupported RPM header version"); /* This program only supports v1 headers */
bb_xread_all(rpm_fd, &header, sizeof(struct rpm_header));
if (strncmp((char *) &header.magic, RPM_HEADER_MAGIC, 3) != 0) {
bb_error_msg_and_die("Invalid RPM header magic"); /* Invalid magic */
}
if (header.version != 1) {
bb_error_msg_and_die("Unsupported RPM header version"); /* This program only supports v1 headers */
}
header.entries = ntohl(header.entries);
header.size = ntohl(header.size);
fseek (rpmfile, 16 * header.entries, SEEK_CUR); /* Seek past index entries */
fseek (rpmfile, header.size, SEEK_CUR); /* Seek past store */
lseek (rpm_fd, 16 * header.entries, SEEK_CUR); /* Seek past index entries */
lseek (rpm_fd, header.size, SEEK_CUR); /* Seek past store */
}
/* No getopt required */
extern int rpm2cpio_main(int argc, char **argv)
{
struct rpm_lead lead;
int gunzip_pid;
FILE *rpmfile, *cpiofile;
int rpm_fd;
unsigned char magic[2];
if (argc == 1) {
rpmfile = stdin;
rpm_fd = STDIN_FILENO;
} else {
rpmfile = fopen(argv[1], "r");
if (!rpmfile) perror_msg_and_die("Can't open rpm file");
rpm_fd = bb_xopen(argv[1], O_RDONLY);
}
fread (&lead, sizeof(struct rpm_lead), 1, rpmfile);
if (strncmp((char *) &lead.magic, RPM_MAGIC, 4) != 0) error_msg_and_die("Invalid RPM magic"); /* Just check the magic, the rest is irrelevant */
bb_xread_all(rpm_fd, &lead, sizeof(struct rpm_lead));
if (strncmp((char *) &lead.magic, RPM_MAGIC, 4) != 0) {
bb_error_msg_and_die("Invalid RPM magic"); /* Just check the magic, the rest is irrelevant */
}
/* Skip the signature header */
skip_header(rpmfile);
fseek(rpmfile, (8 - (ftell(rpmfile) % 8)) % 8, SEEK_CUR); /* Pad to 8 byte boundary */
skip_header(rpm_fd);
lseek(rpm_fd, (8 - (lseek(rpm_fd, 0, SEEK_CUR) % 8)) % 8, SEEK_CUR);
/* Skip the main header */
skip_header(rpmfile);
skip_header(rpm_fd);
bb_xread_all(rpm_fd, &magic, 2);
if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
bb_error_msg_and_die("Invalid gzip magic");
}
check_header_gzip(rpm_fd);
if (inflate_gunzip(rpm_fd, STDOUT_FILENO) != 0) {
bb_error_msg("Error inflating");
}
close(rpm_fd);
cpiofile = gz_open(rpmfile, &gunzip_pid);
copyfd(fileno(cpiofile), fileno(stdout));
gz_close(gunzip_pid);
fclose(rpmfile);
return 0;
}
+644 -897
View File
File diff suppressed because it is too large. Load diff
+115
View File
@@ -0,0 +1,115 @@
/* vi: set sw=4 ts=4: */
/*
* Uncompress applet for busybox (c) 2002 Glenn McGrath
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "libbb.h"
#include "unarchive.h"
#define GUNZIP_TO_STDOUT 1
#define GUNZIP_FORCE 2
extern int uncompress_main(int argc, char **argv)
{
int status = EXIT_SUCCESS;
unsigned long flags;
flags = bb_getopt_ulflags(argc, argv, "cf");
while (optind < argc) {
const char *compressed_file = argv[optind++];
const char *delete_path = NULL;
char *uncompressed_file = NULL;
int src_fd;
int dst_fd;
if (strcmp(compressed_file, "-") == 0) {
src_fd = STDIN_FILENO;
flags |= GUNZIP_TO_STDOUT;
} else {
src_fd = bb_xopen(compressed_file, O_RDONLY);
}
/* Check that the input is sane. */
if (isatty(src_fd) && ((flags & GUNZIP_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_TO_STDOUT) {
dst_fd = STDOUT_FILENO;
} else {
struct stat stat_buf;
char *extension;
uncompressed_file = bb_xstrdup(compressed_file);
extension = strrchr(uncompressed_file, '.');
if (!extension || (strcmp(extension, ".Z") != 0)) {
bb_error_msg_and_die("Invalid extension");
}
*extension = '\0';
/* Open output file */
dst_fd = bb_xopen(uncompressed_file, O_WRONLY | O_CREAT);
/* Set permissions on the file */
stat(compressed_file, &stat_buf);
chmod(uncompressed_file, stat_buf.st_mode);
/* If unzip succeeds remove the old file */
delete_path = compressed_file;
}
/* do the decompression, and cleanup */
if ((bb_xread_char(src_fd) != 0x1f) || (bb_xread_char(src_fd) != 0x9d)) {
bb_error_msg_and_die("Invalid magic");
}
status = uncompress(src_fd, dst_fd);
if ((status != EXIT_SUCCESS) && (uncompressed_file)) {
/* Unzip failed, remove the uncomressed file instead of compressed file */
delete_path = uncompressed_file;
}
if (dst_fd != STDOUT_FILENO) {
close(dst_fd);
}
if (src_fd != STDIN_FILENO) {
close(src_fd);
}
/* delete_path will be NULL if in test mode or from stdin */
if (delete_path && (unlink(delete_path) == -1)) {
bb_error_msg_and_die("Couldn't remove %s", delete_path);
}
free(uncompressed_file);
}
return status;
}
+247
View File
@@ -0,0 +1,247 @@
/* vi: set sw=4 ts=4: */
/*
* Mini unzip implementation for busybox
*
* Copyright (C) 2001 by Laurence Anderson
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/* For reference see
* http://www.pkware.com/products/enterprise/white_papers/appnote.txt
* http://www.info-zip.org/pub/infozip/doc/appnote-iz-latest.zip
*/
/* TODO Endian issues, exclude, should we accept input from stdin ? */
#include <fcntl.h>
#include <getopt.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "unarchive.h"
#include "busybox.h"
#define ZIP_FILEHEADER_MAGIC 0x04034b50
#define ZIP_CDS_MAGIC 0x02014b50
#define ZIP_CDS_END_MAGIC 0x06054b50
#define ZIP_DD_MAGIC 0x08074b50
extern unsigned int gunzip_crc;
extern unsigned int gunzip_bytes_out;
static void header_list_unzip(const file_header_t *file_header)
{
printf(" inflating: %s\n", file_header->name);
}
static void header_verbose_list_unzip(const file_header_t *file_header)
{
unsigned int dostime = (unsigned int) file_header->mtime;
/* can printf arguments cut of the decade component ? */
unsigned short year = 1980 + ((dostime & 0xfe000000) >> 25);
while (year >= 100) {
year -= 100;
}
printf("%9u %02u-%02u-%02u %02u:%02u %s\n",
(unsigned int) file_header->size,
(dostime & 0x01e00000) >> 21,
(dostime & 0x001f0000) >> 16,
year,
(dostime & 0x0000f800) >> 11,
(dostime & 0x000007e0) >> 5,
file_header->name);
}
extern int unzip_main(int argc, char **argv)
{
union {
unsigned char raw[26];
struct {
unsigned short version; /* 0-1 */
unsigned short flags; /* 2-3 */
unsigned short method; /* 4-5 */
unsigned short modtime; /* 6-7 */
unsigned short moddate; /* 8-9 */
unsigned int crc32 __attribute__ ((packed)); /* 10-13 */
unsigned int cmpsize __attribute__ ((packed));; /* 14-17 */
unsigned int ucmpsize __attribute__ ((packed));; /* 18-21 */
unsigned short filename_len; /* 22-23 */
unsigned short extra_len; /* 24-25 */
} formated __attribute__ ((packed));
} zip_header;
archive_handle_t *archive_handle;
unsigned int total_size = 0;
unsigned int total_entries = 0;
char *base_dir = NULL;
int opt = 0;
/* Initialise */
archive_handle = init_handle();
archive_handle->action_data = NULL;
archive_handle->action_header = header_list_unzip;
while ((opt = getopt(argc, argv, "lnopqd:")) != -1) {
switch (opt) {
case 'l': /* list */
archive_handle->action_header = header_verbose_list_unzip;
archive_handle->action_data = data_skip;
break;
case 'n': /* never overwright existing files */
break;
case 'o':
archive_handle->flags = ARCHIVE_EXTRACT_UNCONDITIONAL;
break;
case 'p': /* extract files to stdout */
archive_handle->action_data = data_extract_to_stdout;
break;
case 'q': /* Extract files quietly */
archive_handle->action_header = header_skip;
break;
case 'd': /* Extract files to specified base directory*/
base_dir = optarg;
break;
#if 0
case 'x': /* Exclude the specified files */
archive_handle->filter = filter_accept_reject_list;
break;
#endif
default:
bb_show_usage();
}
}
if (argc == optind) {
bb_show_usage();
}
printf("Archive: %s\n", argv[optind]);
if (archive_handle->action_header == header_verbose_list_unzip) {
printf(" Length Date Time Name\n");
printf(" -------- ---- ---- ----\n");
}
if (*argv[optind] == '-') {
archive_handle->src_fd = STDIN_FILENO;
archive_handle->seek = seek_by_char;
} else {
archive_handle->src_fd = bb_xopen(argv[optind++], O_RDONLY);
}
if ((base_dir) && (chdir(base_dir))) {
bb_perror_msg_and_die("Couldnt chdir");
}
while (optind < argc) {
archive_handle->filter = filter_accept_list;
archive_handle->accept = llist_add_to(archive_handle->accept, argv[optind]);
optind++;
}
while (1) {
unsigned int magic;
int dst_fd;
/* TODO Endian issues */
archive_xread_all(archive_handle, &magic, 4);
archive_handle->offset += 4;
if (magic == ZIP_CDS_MAGIC) {
break;
}
else if (magic != ZIP_FILEHEADER_MAGIC) {
bb_error_msg_and_die("Invlaide zip magic");
}
/* Read the file header */
archive_xread_all(archive_handle, zip_header.raw, 26);
archive_handle->offset += 26;
archive_handle->file_header->mode = S_IFREG | 0777;
if (zip_header.formated.method != 8) {
bb_error_msg_and_die("Unsupported compression method %d\n", zip_header.formated.method);
}
/* Read filename */
archive_handle->file_header->name = xmalloc(zip_header.formated.filename_len + 1);
archive_xread_all(archive_handle, archive_handle->file_header->name, zip_header.formated.filename_len);
archive_handle->offset += zip_header.formated.filename_len;
archive_handle->file_header->name[zip_header.formated.filename_len] = '\0';
/* Skip extra header bits */
archive_handle->file_header->size = zip_header.formated.extra_len;
data_skip(archive_handle);
archive_handle->offset += zip_header.formated.extra_len;
/* Handle directories */
archive_handle->file_header->mode = S_IFREG | 0777;
if (last_char_is(archive_handle->file_header->name, '/')) {
archive_handle->file_header->mode ^= S_IFREG;
archive_handle->file_header->mode |= S_IFDIR;
}
/* Data section */
archive_handle->file_header->size = zip_header.formated.cmpsize;
if (archive_handle->action_data) {
archive_handle->action_data(archive_handle);
} else {
dst_fd = bb_xopen(archive_handle->file_header->name, O_WRONLY | O_CREAT);
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);
/* Validate decompression - crc */
if (zip_header.formated.crc32 != (gunzip_crc ^ 0xffffffffL)) {
bb_error_msg("Invalid compressed data--crc error");
}
/* Validate decompression - size */
if (gunzip_bytes_out != zip_header.formated.ucmpsize) {
bb_error_msg("Invalid compressed data--length error");
}
}
/* local file descriptor section */
archive_handle->offset += zip_header.formated.cmpsize;
/* This ISNT unix time */
archive_handle->file_header->mtime = zip_header.formated.modtime | (zip_header.formated.moddate << 16);
archive_handle->file_header->size = zip_header.formated.ucmpsize;
total_size += archive_handle->file_header->size;
total_entries++;
archive_handle->action_header(archive_handle->file_header);
/* Data descriptor section */
if (zip_header.formated.flags & 4) {
/* skip over duplicate crc, compressed size and uncompressed size */
unsigned char data_description[12];
archive_xread_all(archive_handle, data_description, 12);
archive_handle->offset += 12;
}
}
/* Central directory section */
if (archive_handle->action_header == header_verbose_list_unzip) {
printf(" -------- -------\n");
printf("%9d %d files\n", total_size, total_entries);
}
return(EXIT_SUCCESS);
}
-13205
View File
File diff suppressed because it is too large. Load diff
-52
View File
@@ -1,52 +0,0 @@
/* vi: set sw=4 ts=4: */
/*
* Mini basename implementation for busybox
*
* Copyright (C) 1999,2000,2001 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/* getopt not needed */
#include <stdlib.h>
#include "busybox.h"
#include <string.h>
extern int basename_main(int argc, char **argv)
{
int m, n;
char *s;
if ((argc < 2) || (**(argv + 1) == '-')) {
show_usage();
}
argv++;
s = get_last_path_component(*argv);
if (argc>2) {
argv++;
n = strlen(*argv);
m = strlen(s);
if (m>=n && strncmp(s+m-n, *argv, n)==0)
s[m-n] = '\0';
}
puts(s);
return EXIT_SUCCESS;
}
-181
View File
@@ -1,181 +0,0 @@
/* vi: set sw=4 ts=4: */
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include "busybox.h"
#ifdef BB_LOCALE_SUPPORT
#include <locale.h>
#endif
int been_there_done_that = 0; /* Also used in applets.c */
const char *applet_name;
#ifdef BB_FEATURE_INSTALLER
/*
* directory table
* this should be consistent w/ the enum, busybox.h::Location,
* or else...
*/
static char* install_dir[] = {
"/",
"/bin",
"/sbin",
"/usr/bin",
"/usr/sbin",
};
/* abstract link() */
typedef int (*__link_f)(const char *, const char *);
/*
* Where in the filesystem is this busybox?
* [return]
* malloc'd string w/ full pathname of busybox's location
* NULL on failure
*/
static char *busybox_fullpath()
{
return xreadlink("/proc/self/exe");
}
/* create (sym)links for each applet */
static void install_links(const char *busybox, int use_symbolic_links)
{
__link_f Link = link;
char *fpc;
int i;
int rc;
if (use_symbolic_links)
Link = symlink;
for (i = 0; applets[i].name != NULL; i++) {
fpc = concat_path_file(
install_dir[applets[i].location], applets[i].name);
rc = Link(busybox, fpc);
if (rc!=0 && errno!=EEXIST) {
perror_msg("%s", fpc);
}
free(fpc);
}
}
#endif /* BB_FEATURE_INSTALLER */
int main(int argc, char **argv)
{
const char *s;
for (s = applet_name = argv[0]; *s != '\0';) {
if (*s++ == '/')
applet_name = s;
}
/* Add in a special case hack for a leading hyphen */
if (**argv == '-' && *(*argv+1)!= '-') {
applet_name = (*argv+1);
}
#ifdef BB_LOCALE_SUPPORT
#ifdef BB_INIT
if(getpid()!=1) /* Do not set locale for `init' */
#endif
{
setlocale(LC_ALL, "");
}
#endif
run_applet_by_name(applet_name, argc, argv);
error_msg_and_die("applet not found");
}
int busybox_main(int argc, char **argv)
{
int col = 0, len, i;
#ifdef BB_FEATURE_INSTALLER
/*
* This style of argument parsing doesn't scale well
* in the event that busybox starts wanting more --options.
* If someone has a cleaner approach, by all means implement it.
*/
if (argc > 1 && (strcmp(argv[1], "--install") == 0)) {
int use_symbolic_links = 0;
int rc = 0;
char *busybox;
/* to use symlinks, or not to use symlinks... */
if (argc > 2) {
if ((strcmp(argv[2], "-s") == 0)) {
use_symbolic_links = 1;
}
}
/* link */
busybox = busybox_fullpath();
if (busybox) {
install_links(busybox, use_symbolic_links);
free(busybox);
} else {
rc = 1;
}
return rc;
}
#endif /* BB_FEATURE_INSTALLER */
argc--;
/* If we've already been here once, exit now */
if (been_there_done_that == 1 || argc < 1) {
const struct BB_applet *a = applets;
fprintf(stderr, "%s\n\n"
"Usage: busybox [function] [arguments]...\n"
" or: [function] [arguments]...\n\n"
"\tBusyBox is a multi-call binary that combines many common Unix\n"
"\tutilities into a single executable. Most people will create a\n"
"\tlink to busybox for each function they wish to use, and BusyBox\n"
"\twill act like whatever it was invoked as.\n"
"\nCurrently defined functions:\n", full_version);
while (a->name != 0) {
col +=
fprintf(stderr, "%s%s", ((col == 0) ? "\t" : ", "),
(a++)->name);
if (col > 60 && a->name != 0) {
fprintf(stderr, ",\n");
col = 0;
}
}
fprintf(stderr, "\n\n");
exit(0);
}
/* Flag that we've been here already */
been_there_done_that = 1;
/* Move the command line down a notch */
len = argv[argc] + strlen(argv[argc]) - argv[1];
memmove(argv[0], argv[1], len);
memset(argv[0] + len, 0, argv[1] - argv[0]);
/* Fix up the argv pointers */
len = argv[1] - argv[0];
memmove(argv, argv + 1, sizeof(char *) * (argc + 1));
for (i = 0; i < argc; i++)
argv[i] -= len;
return (main(argc, argv));
}
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
-103
View File
@@ -1,103 +0,0 @@
/* vi: set sw=4 ts=4: */
/*
* Busybox main internal header file
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Based in part on code from sash, Copyright (c) 1999 by David I. Bell
* Permission has been granted to redistribute this code under the GPL.
*
*/
#ifndef _BB_INTERNAL_H_
#define _BB_INTERNAL_H_ 1
#include "Config.h"
#include <stdio.h>
#include <stdarg.h>
#include <sys/stat.h>
#include <sys/types.h>
#define BB_BANNER "BusyBox v" BB_VER " (" BB_BT ")"
#ifdef DMALLOC
#include "dmalloc.h"
#endif
#include <features.h>
enum Location {
_BB_DIR_ROOT = 0,
_BB_DIR_BIN,
_BB_DIR_SBIN,
_BB_DIR_USR_BIN,
_BB_DIR_USR_SBIN
};
struct BB_applet {
const char* name;
int (*main)(int argc, char** argv);
enum Location location;
};
/* From busybox.c */
extern const struct BB_applet applets[];
/* Automagically pull in all the applet function prototypes and
* applet usage strings. These are all of the form:
* extern int foo_main(int argc, char **argv);
* extern const char foo_usage[];
* These are all autogenerated from the set of currently defined applets.
*/
#define PROTOTYPES
#include "applets.h"
#undef PROTOTYPES
#ifdef BB_FEATURE_BUFFERS_GO_ON_STACK
#define RESERVE_BB_BUFFER(buffer,len) char buffer[len]
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char buffer[len]
#else
#ifdef BB_FEATURE_BUFFERS_GO_IN_BSS
#define RESERVE_BB_BUFFER(buffer,len) static char buffer[len]
#define RESERVE_BB_UBUFFER(buffer,len) static unsigned char buffer[len]
#else
#define RESERVE_BB_BUFFER(buffer,len) char *buffer=xmalloc(len)
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len)
#endif
#endif
/* Bit map related macros -- libc5 doens't provide these... sigh. */
#ifndef setbit
#define NBBY CHAR_BIT
#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
#endif
#ifndef RB_POWER_OFF
/* Stop system and switch power off if possible. */
#define RB_POWER_OFF 0x4321fedc
#endif
/* Pull in the utility routines from libbb */
#include "libbb/libbb.h"
#endif /* _BB_INTERNAL_H_ */
-24
View File
@@ -1,24 +0,0 @@
#!/bin/sh
# Make busybox links list file.
# input $1: full path to Config.h
# input $2: full path to applets.h
# output (stdout): list of pathnames that should be linked to busybox
# Maintainer: Larry Doolittle <ldoolitt@recycle.lbl.gov>
export LC_ALL=POSIX
export LC_CTYPE=POSIX
CONFIG_H=${1:-Config.h}
APPLETS_H=${2:-applets.h}
gcc -E -DMAKE_LINKS -include $CONFIG_H $APPLETS_H |
awk '/^[ \t]*LINK/{
dir=substr($2,8)
gsub("_","/",dir)
if(dir=="/ROOT") dir=""
file=$3
gsub("\"","",file)
if (file=="busybox") next
print tolower(dir) "/" file
}'
-16
View File
@@ -1,16 +0,0 @@
#!/bin/sh
export LC_ALL=POSIX
export LC_CTYPE=POSIX
RAW=` \
gcc -E -dM ${1:-Config.h} | \
sed -n -e '/^.*BB_FEATURE.*$/d;s/^#define.*\<BB_\(.*\)\>/\1.c/gp;' \
| tr A-Z a-z | sort
`
test "${RAW}" != "" || exit
if [ -d "$BB_SRC_DIR" ]; then cd $BB_SRC_DIR; fi
# By running $RAW through "ls", we avoid listing
# source files that don't exist.
ls $RAW 2>/dev/null | tr '\n' ' '
-36
View File
@@ -1,36 +0,0 @@
Name: busybox
Version: 0.52
Release: 1
Group: System/Utilities
Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary.
Copyright: GPL
Packager : Erik Andersen <andersen@lineo.com>
Conflicts: fileutils grep shellutils
Buildroot: /tmp/%{Name}-%{Version}
Source: %{Name}-%{Version}.tar.gz
%Description
BusyBox combines tiny versions of many common UNIX utilities into a single
small executable. It provides minimalist replacements for most of the utilities
you usually find in fileutils, shellutils, findutils, textutils, grep, gzip,
tar, etc. BusyBox provides a fairly complete POSIX environment for any small
or emdedded system. The utilities in BusyBox generally have fewer options then
their full featured GNU cousins; however, the options that are provided behave
very much like their GNU counterparts.
%Prep
%setup -q -n %{Name}-%{Version}
%Build
make
%Install
rm -rf $RPM_BUILD_ROOT
make PREFIX=$RPM_BUILD_ROOT install
%Clean
rm -rf $RPM_BUILD_ROOT
%Files
%defattr(-,root,root)
/
-53
View File
@@ -1,53 +0,0 @@
/* vi: set sw=4 ts=4: */
/*
* Mini Cat implementation for busybox
*
* Copyright (C) 1999,2000,2001 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <stdlib.h>
#include <string.h>
#include "busybox.h"
extern int cat_main(int argc, char **argv)
{
int status = EXIT_SUCCESS;
if (argc == 1) {
print_file(stdin);
return status;
}
while (--argc > 0) {
if(!(strcmp(*++argv, "-"))) {
print_file(stdin);
} else if (print_file_by_name(*argv) == FALSE) {
status = EXIT_FAILURE;
}
}
return status;
}
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
-91
View File
@@ -1,91 +0,0 @@
/* vi: set sw=4 ts=4: */
/*
* Mini chown/chmod/chgrp implementation for busybox
*
*
* Copyright (C) 1999,2000,2001 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "busybox.h"
/* Don't use lchown for libc5 or glibc older then 2.1.x */
#if (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)
#define lchown chown
#endif
static long gid;
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
{
if (lchown(fileName, statbuf->st_uid, (gid == -1) ? statbuf->st_gid : gid) == 0) {
return (TRUE);
}
perror(fileName);
return (FALSE);
}
int chgrp_main(int argc, char **argv)
{
int opt;
int recursiveFlag = FALSE;
char *p=NULL;
/* do normal option parsing */
while ((opt = getopt(argc, argv, "R")) > 0) {
switch (opt) {
case 'R':
recursiveFlag = TRUE;
break;
default:
show_usage();
}
}
if (argc > optind && argc > 2 && argv[optind]) {
/* Find the selected group */
gid = strtoul(argv[optind], &p, 10); /* maybe it's already numeric */
if (argv[optind] == p)
gid = my_getgrnam(argv[optind]);
} else {
error_msg_and_die(too_few_args);
}
/* Ok, ready to do the deed now */
while (++optind < argc) {
if (recursive_action (argv[optind], recursiveFlag, FALSE, FALSE,
fileAction, fileAction, NULL) == FALSE) {
return EXIT_FAILURE;
}
}
return EXIT_SUCCESS;
}
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
-85
View File
@@ -1,85 +0,0 @@
/* vi: set sw=4 ts=4: */
/*
* Mini chown/chmod/chgrp implementation for busybox
*
*
* Copyright (C) 1999,2000,2001 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>
#include "busybox.h"
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
{
if (!parse_mode((char *)junk, &(statbuf->st_mode)))
error_msg_and_die("internal error");
if (chmod(fileName, statbuf->st_mode) == 0)
return (TRUE);
perror(fileName);
return (FALSE);
}
int chmod_main(int argc, char **argv)
{
int i;
int opt;
int recursiveFlag = FALSE;
/* do normal option parsing */
while ((opt = getopt(argc, argv, "R")) > 0) {
switch (opt) {
case 'R':
recursiveFlag = TRUE;
break;
default:
show_usage();
}
}
if (argc > optind && argc > 2 && argv[optind]) {
/* Parse the specified mode */
mode_t mode;
if (parse_mode(argv[optind], &mode) == FALSE) {
error_msg_and_die( "unknown mode: %s", argv[optind]);
}
} else {
error_msg_and_die(too_few_args);
}
/* Ok, ready to do the deed now */
for (i = optind + 1; i < argc; i++) {
if (recursive_action (argv[i], recursiveFlag, FALSE, FALSE, fileAction,
fileAction, argv[optind]) == FALSE) {
return EXIT_FAILURE;
}
}
return EXIT_SUCCESS;
}
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
-113
View File
@@ -1,113 +0,0 @@
/* vi: set sw=4 ts=4: */
/*
* Mini chown/chmod/chgrp implementation for busybox
*
*
* Copyright (C) 1999,2000,2001 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "busybox.h"
/* Don't use lchown for libc5 or glibc older then 2.1.x */
#if (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)
#define lchown chown
#endif
static long uid;
static long gid;
static int (*chown_func)() = chown;
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
{
if (chown_func(fileName, uid, (gid == -1) ? statbuf->st_gid : gid) == 0) {
return (TRUE);
}
perror(fileName);
return (FALSE);
}
int chown_main(int argc, char **argv)
{
int opt;
int recursiveFlag = FALSE,
noderefFlag = FALSE;
char *groupName=NULL;
char *p=NULL;
/* do normal option parsing */
while ((opt = getopt(argc, argv, "Rh")) > 0) {
switch (opt) {
case 'R':
recursiveFlag = TRUE;
break;
case 'h':
noderefFlag = TRUE;
break;
default:
show_usage();
}
}
if (noderefFlag) chown_func = lchown;
if (argc > optind && argc > 2 && argv[optind]) {
/* First, check if there is a group name here */
groupName = strchr(argv[optind], '.');
if (groupName == NULL)
groupName = strchr(argv[optind], ':');
if (groupName) {
*groupName++ = '\0';
gid = strtoul(groupName, &p, 10);
if (groupName == p)
gid = my_getgrnam(groupName);
} else {
gid = -1;
}
/* Now check for the username */
uid = strtoul(argv[optind], &p, 10); /* Is is numeric? */
if (argv[optind] == p) {
uid = my_getpwnam(argv[optind]);
}
} else {
error_msg_and_die(too_few_args);
}
/* Ok, ready to do the deed now */
while (++optind < argc) {
if (recursive_action (argv[optind], recursiveFlag, FALSE, FALSE,
fileAction, fileAction, NULL) == FALSE) {
return EXIT_FAILURE;
}
}
return EXIT_SUCCESS;
}
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
-75
View File
@@ -1,75 +0,0 @@
/* vi: set sw=4 ts=4: */
/*
* Mini chroot implementation for busybox
*
*
* Copyright (C) 1999,2000,2001 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include "busybox.h"
int chroot_main(int argc, char **argv)
{
char *prog;
if ((argc < 2) || (**(argv + 1) == '-')) {
show_usage();
}
argc--;
argv++;
if (chroot(*argv) || (chdir("/"))) {
perror_msg_and_die("cannot change root directory to %s", *argv);
}
argc--;
argv++;
if (argc >= 1) {
prog = *argv;
execvp(*argv, argv);
} else {
#ifndef BB_SH
prog = getenv("SHELL");
if (!prog)
prog = "/bin/sh";
execlp(prog, prog, NULL);
#else
char shell[] = "/bin/sh";
char *shell_argv[2] = { shell, NULL };
applet_name = shell;
shell_main(1, shell_argv);
return EXIT_SUCCESS;
#endif
}
perror_msg_and_die("cannot execute %s", prog);
}
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
-43
View File
@@ -1,43 +0,0 @@
/* vi: set sw=4 ts=4: */
/*
* chvt.c - aeb - 940227 - Change virtual terminal
*
* busyboxed by Erik Andersen
*/
/* getopt not needed */
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include "busybox.h"
/* From <linux/vt.h> */
static const int VT_ACTIVATE = 0x5606; /* make vt active */
static const int VT_WAITACTIVE = 0x5607; /* wait for vt active */
int chvt_main(int argc, char **argv)
{
int fd, num;
if ((argc != 2) || (**(argv + 1) == '-'))
show_usage();
fd = get_console_fd("/dev/console");
num = atoi(argv[1]);
if (ioctl(fd, VT_ACTIVATE, num))
perror_msg_and_die("VT_ACTIVATE");
if (ioctl(fd, VT_WAITACTIVE, num))
perror_msg_and_die("VT_WAITACTIVE");
return EXIT_SUCCESS;
}
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
-1548
View File
File diff suppressed because it is too large. Load diff
-8
View File
@@ -1,8 +0,0 @@
#ifndef CMDEDIT_H
#define CMDEDIT_H
void cmdedit_init(void);
void cmdedit_terminate(void);
void cmdedit_read_input(char* promptStr, char* command); /* read a line of input */
#endif /* CMDEDIT_H */
-80
View File
@@ -1,80 +0,0 @@
/* vi: set sw=4 ts=4: */
/*
* Mini cmp implementation for busybox
*
*
* Copyright (C) 1999,2000,2001 by Lineo, inc.
* Written by Matt Kraai <kraai@alumni.carnegiemellon.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <getopt.h>
#include "busybox.h"
int cmp_main(int argc, char **argv)
{
FILE *fp1 = NULL, *fp2 = stdin;
char *filename1, *filename2 = "-";
int c, c1, c2, char_pos = 1, line_pos = 1, silent = FALSE;
while ((c = getopt(argc, argv, "s")) != EOF) {
switch (c) {
case 's':
silent = TRUE;
break;
default:
show_usage();
}
}
filename1 = argv[optind];
switch (argc - optind) {
case 2:
fp2 = xfopen(filename2 = argv[optind + 1], "r");
case 1:
fp1 = xfopen(filename1, "r");
break;
default:
show_usage();
}
do {
c1 = fgetc(fp1);
c2 = fgetc(fp2);
if (c1 != c2) {
if (silent)
return EXIT_FAILURE;
if (c1 == EOF)
printf("EOF on %s\n", filename1);
else if (c2 == EOF)
printf("EOF on %s\n", filename2);
else
printf("%s %s differ: char %d, line %d\n", filename1, filename2,
char_pos, line_pos);
return EXIT_FAILURE;
}
char_pos++;
if (c1 == '\n')
line_pos++;
} while (c1 != EOF);
return EXIT_SUCCESS;
}
+68
View File
@@ -0,0 +1,68 @@
#
# For a description of the syntax of this configuration file,
# see scripts/kbuild/config-language.txt.
#
menu "Console Utilities"
config CONFIG_CHVT
bool "chvt"
default n
help
This program is used to change to another terminal.
Example: chvt 4 (change to terminal /dev/tty4)
config CONFIG_CLEAR
bool "clear"
default n
help
This program clears the terminal screen.
config CONFIG_DEALLOCVT
bool "deallocvt"
default n
help
This program deallocates unused virtual consoles.
config CONFIG_DUMPKMAP
bool "dumpkmap"
default n
help
This program dumps the kernel's keyboard translation table to
stdout, in binary format. You can then use loadkmap to load it.
config CONFIG_LOADFONT
bool "loadfont"
default n
help
This program loads a console font from standard input.
config CONFIG_LOADKMAP
bool "loadkmap"
default n
help
This program loads a keyboard translation table from
standard input.
config CONFIG_OPENVT
bool "openvt"
default n
help
This program is used to start a command on an unused
virtual terminal.
config CONFIG_RESET
bool "reset"
default n
help
This program is used to reset the terminal screen, if it
gets messed up.
config CONFIG_SETKEYCODES
bool "setkeycodes"
default n
help
This program loads entries into the kernel's scancode-to-keycode
map, allowing unusual keyboards to generate usable keycodes.
endmenu
+32
View File
@@ -0,0 +1,32 @@
# Makefile for busybox
#
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
top_srcdir=..
top_builddir=..
srcdir=$(top_srcdir)/console/tools
CONSOLETOOLS_DIR:=./
include $(top_builddir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
+44
View File
@@ -0,0 +1,44 @@
# Makefile for busybox
#
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
CONSOLETOOLS_AR:=console-tools.a
ifndef $(CONSOLETOOLS_DIR)
CONSOLETOOLS_DIR:=$(top_builddir)/console-tools/
endif
srcdir=$(top_srcdir)/console-tools
CONSOLETOOLS_DIR-y:=
CONSOLETOOLS_DIR-$(CONFIG_CHVT) += chvt.o
CONSOLETOOLS_DIR-$(CONFIG_CLEAR) += clear.o
CONSOLETOOLS_DIR-$(CONFIG_DEALLOCVT) += deallocvt.o
CONSOLETOOLS_DIR-$(CONFIG_DUMPKMAP) += dumpkmap.o
CONSOLETOOLS_DIR-$(CONFIG_LOADFONT) += loadfont.o
CONSOLETOOLS_DIR-$(CONFIG_LOADKMAP) += loadkmap.o
CONSOLETOOLS_DIR-$(CONFIG_OPENVT) += openvt.o
CONSOLETOOLS_DIR-$(CONFIG_RESET) += reset.o
CONSOLETOOLS_DIR-$(CONFIG_SETKEYCODES) += setkeycodes.o
libraries-y+=$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR)
$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR): $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
$(AR) -ro $@ $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
$(CONSOLETOOLS_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+29 -11
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-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* 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) == '-'))
show_usage();
fd = get_console_fd("/dev/console");
num = atoi(argv[1]);
if (ioctl(fd, VT_ACTIVATE, num))
perror_msg_and_die("VT_ACTIVATE");
if (ioctl(fd, VT_WAITACTIVE, num))
perror_msg_and_die("VT_WAITACTIVE");
if (argc != 2) {
bb_show_usage();
}
fd = get_console_fd();
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)) {
bb_perror_msg_and_die("VT_WAITACTIVE");
}
return EXIT_SUCCESS;
}
+3 -3
View File
@@ -2,9 +2,7 @@
/*
* Mini clear implementation for busybox
*
*
* Copyright (C) 1999,2000,2001 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,6 +20,8 @@
*
*/
/* no options, no getopt */
#include <stdio.h>
#include <stdlib.h>
#include "busybox.h"
+36 -23
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-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* no options, no getopt */
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
@@ -15,29 +34,23 @@ static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */
int deallocvt_main(int argc, char *argv[])
{
int fd, num, i;
/* num = 0 deallocate all unused consoles */
int num = 0;
//if ((argc > 2) || ((argv == 2) && (**(argv + 1) == '-')))
if (argc > 2)
show_usage();
fd = get_console_fd("/dev/console");
if (argc == 1) {
/* deallocate all unused consoles */
if (ioctl(fd, VT_DISALLOCATE, 0))
perror_msg_and_die("VT_DISALLOCATE");
} else {
for (i = 1; i < argc; i++) {
num = atoi(argv[i]);
if (num == 0)
error_msg("0: illegal VT number");
else if (num == 1)
error_msg("VT 1 cannot be deallocated");
else if (ioctl(fd, VT_DISALLOCATE, num))
perror_msg_and_die("VT_DISALLOCATE");
}
switch(argc)
{
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:
break;
default:
bb_show_usage();
}
if (ioctl( get_console_fd(), VT_DISALLOCATE, num )) {
bb_perror_msg_and_die("VT_DISALLOCATE");
}
return EXIT_SUCCESS;
}
+10 -14
View File
@@ -48,19 +48,15 @@ int dumpkmap_main(int argc, char **argv)
char flags[MAX_NR_KEYMAPS], magic[] = "bkeymap";
if (argc>=2 && *argv[1]=='-') {
show_usage();
bb_show_usage();
}
fd = open("/dev/tty0", O_RDWR);
if (fd < 0) {
perror_msg("Error opening /dev/tty0");
return EXIT_FAILURE;
}
fd=bb_xopen(CURRENT_VC, O_RDWR);
write(1, magic, 7);
for (i=0; i < MAX_NR_KEYMAPS; i++) flags[i]=0;
flags[0]=1;
flags[0]=1;
flags[1]=1;
flags[2]=1;
flags[4]=1;
@@ -70,9 +66,9 @@ int dumpkmap_main(int argc, char **argv)
flags[9]=1;
flags[10]=1;
flags[12]=1;
/* dump flags */
for (i=0; i < MAX_NR_KEYMAPS; i++) write(1,&flags[i],1);
for (i=0; i < MAX_NR_KEYMAPS; i++) write(1,&flags[i],1);
for (i = 0; i < MAX_NR_KEYMAPS; i++) {
if (flags[i] == 1) {
@@ -80,13 +76,13 @@ int dumpkmap_main(int argc, char **argv)
ke.kb_index = j;
ke.kb_table = i;
if (ioctl(fd, KDGKBENT, &ke) < 0) {
error_msg("ioctl returned: %s, %s, %s, %xqq", strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
bb_error_msg("ioctl returned: %m, %s, %s, %xqq", (char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
}
else {
write(1,(void*)&ke.kb_value,2);
}
write(1,(void*)&ke.kb_value,2);
}
}
}
}
-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]=='-') {
show_usage();
}
fd = open("/dev/tty", O_RDWR);
if (fd < 0) {
perror_msg_and_die("Error opening /dev/tty1");
}
if (screen_map_load(fd, stdin)) {
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))
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)
error_msg_and_die("16bit screen-map MUST be a regular file.");
else
perror_msg_and_die("fseek failed reading binary 16bit screen-map");
}
if (fread(wbuf, sizeof(unicode) * E_TABSZ, 1, fp) != 1)
perror_msg_and_die("Cannot read [new] map from file");
#if 0
else
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))
perror_msg_and_die("PIO_UNISCRNMAP ioctl");
else
return 0;
}
}
/* rewind... */
if (-1 == fseek(fp, 0, SEEK_SET)) {
if (errno == ESPIPE)
error_msg("Assuming 8bit screen-map - MUST be a regular file."),
exit(1);
else
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 */
error_msg_and_die("fseek() returned ESPIPE !");
else
perror_msg_and_die("fseek for binary 8bit screen-map");
}
if (fread(buf, E_TABSZ, 1, fp) != 1)
perror_msg_and_die("Cannot read [old] map from file");
#if 0
else
error_msg("Input screen-map is binary.");
#endif
}
if (ioctl(fd, PIO_SCRNMAP, buf))
perror_msg_and_die("PIO_SCRNMAP ioctl");
else
return 0;
}
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
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;
}
+15 -17
View File
@@ -44,11 +44,9 @@ extern int loadfont_main(int argc, char **argv)
int fd;
if (argc != 1)
show_usage();
bb_show_usage();
fd = open("/dev/tty0", O_RDWR);
if (fd < 0)
perror_msg_and_die("Error opening /dev/tty0");
fd = bb_xopen(CURRENT_VC, O_RDWR);
loadnewfont(fd);
return EXIT_SUCCESS;
@@ -62,7 +60,7 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
memset(buf, 0, sizeof(buf));
if (unit < 1 || unit > 32)
error_msg_and_die("Bad character size %d", unit);
bb_error_msg_and_die("Bad character size %d", unit);
for (i = 0; i < fontsize; i++)
memcpy(buf + (32 * i), inbuf + (unit * i), unit);
@@ -77,11 +75,11 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
if (ioctl(fd, PIO_FONTX, &cfd) == 0)
return; /* success */
perror_msg("PIO_FONTX ioctl error (trying PIO_FONT)");
bb_perror_msg("PIO_FONTX ioctl error (trying PIO_FONT)");
}
#endif
if (ioctl(fd, PIO_FONT, buf))
perror_msg_and_die("PIO_FONT ioctl error");
bb_perror_msg_and_die("PIO_FONT ioctl error");
}
static void
@@ -119,11 +117,11 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
if (ioctl(fd, PIO_UNIMAPCLR, &advice)) {
#ifdef ENOIOCTLCMD
if (errno == ENOIOCTLCMD) {
error_msg("It seems this kernel is older than 1.1.92");
error_msg_and_die("No Unicode mapping table loaded.");
bb_error_msg("It seems this kernel is older than 1.1.92");
bb_error_msg_and_die("No Unicode mapping table loaded.");
} else
#endif
perror_msg_and_die("PIO_UNIMAPCLR");
bb_perror_msg_and_die("PIO_UNIMAPCLR");
}
ud.entry_ct = ct;
ud.entries = up;
@@ -133,7 +131,7 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
/* change advice parameters */
}
#endif
perror_msg_and_die("PIO_UNIMAP");
bb_perror_msg_and_die("PIO_UNIMAP");
}
}
@@ -150,13 +148,13 @@ static void loadnewfont(int fd)
*/
inputlth = fread(inbuf, 1, sizeof(inbuf), stdin);
if (ferror(stdin))
perror_msg_and_die("Error reading input font");
bb_perror_msg_and_die("Error reading input font");
/* use malloc/realloc in case of giant files;
maybe these do not occur: 16kB for the font,
and 16kB for the map leaves 32 unicode values
for each font position */
if (!feof(stdin))
perror_msg_and_die("Font too large");
bb_perror_msg_and_die("Font too large");
/* test for psf first */
{
@@ -174,11 +172,11 @@ static void loadnewfont(int fd)
goto no_psf;
if (psfhdr.mode > PSF_MAXMODE)
error_msg_and_die("Unsupported psf file mode");
bb_error_msg_and_die("Unsupported psf file mode");
fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256);
#if !defined( PIO_FONTX ) || defined( __sparc__ )
if (fontsize != 256)
error_msg_and_die("Only fontsize 256 supported");
bb_error_msg_and_die("Only fontsize 256 supported");
#endif
hastable = (psfhdr.mode & PSF_MODEHASTAB);
unit = psfhdr.charsize;
@@ -186,7 +184,7 @@ static void loadnewfont(int fd)
head = head0 + fontsize * unit;
if (head > inputlth || (!hastable && head != inputlth))
error_msg_and_die("Input file: bad length");
bb_error_msg_and_die("Input file: bad length");
do_loadfont(fd, inbuf + head0, unit, fontsize);
if (hastable)
do_loadtable(fd, inbuf + head, inputlth - head, fontsize);
@@ -201,7 +199,7 @@ static void loadnewfont(int fd)
} else {
/* bare font */
if (inputlth & 0377)
error_msg_and_die("Bad input file size");
bb_error_msg_and_die("Bad input file size");
offset = 0;
unit = inputlth / 256;
}
+17 -24
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)
show_usage();
bb_show_usage();
fd = open("/dev/tty0", O_RDWR);
if (fd < 0)
perror_msg_and_die("Error opening /dev/tty0");
fd = bb_xopen(CURRENT_VC, O_RDWR);
read(0, buff, 7);
if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7))
error_msg_and_die("This is not a valid binary keymap.");
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))
perror_msg_and_die("Error reading keymap flags");
ibuff = (u_short *) xmalloc(ibuffsz);
if (bb_full_read(0, flags, MAX_NR_KEYMAPS) != MAX_NR_KEYMAPS)
bb_perror_msg_and_die("Error reading keymap flags");
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)
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,7 +74,8 @@ int loadkmap_main(int argc, char **argv)
}
}
}
/* Don't bother to close files. Exit does that
/* Don't bother to close files. Exit does that
* automagically, so we can save a few bytes */
/* close(fd); */
return EXIT_SUCCESS;
+84
View File
@@ -0,0 +1,84 @@
/* vi: set sw=4 ts=4: */
/*
* openvt.c - open a vt to run a command.
*
* busyboxed by Quy Tonthat <quy@signal3.com>
* hacked by Tito <farmatito@tiscali.it>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* getopt not needed */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
#include <ctype.h>
#include "busybox.h"
int openvt_main(int argc, char **argv)
{
int fd;
char vtname[sizeof VC_FORMAT + 2];
if (argc < 3)
bb_show_usage();
/* 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(fork() == 0) {
/* leave current vt */
#ifdef ESIX_5_3_2_D
if (setpgrp() < 0) {
#else
if (setsid() < 0) {
#endif
bb_perror_msg_and_die("Unable to set new session");
}
close(0); /* so that new vt becomes stdin */
/* and grab new one */
fd = bb_xopen(vtname, O_RDWR);
/* Reassign stdout and sterr */
close(1);
close(2);
dup(fd);
dup(fd);
execvp(argv[0], argv);
_exit(1);
}
return EXIT_SUCCESS;
}
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
+16 -6
View File
@@ -2,10 +2,8 @@
/*
* Mini reset implementation for busybox
*
*
* Copyright (C) 1999,2000,2001 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
* and Kent Robotti <robotti@metconnect.com>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
* Written by Erik Andersen and Kent Robotti <robotti@metconnect.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,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("\033c");
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;
}
+8 -8
View File
@@ -4,7 +4,7 @@
*
* Copyright (C) 1994-1998 Andries E. Brouwer <aeb@cwi.nl>
*
* Adjusted for BusyBox by Erik Andersen <andersee@debian.org>
* Adjusted for BusyBox by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ struct kbkeycode {
};
static const int KDSETKEYCODE = 0x4B4D; /* write kernel keycode table entry */
extern int
extern int
setkeycodes_main(int argc, char** argv)
{
char *ep;
@@ -43,27 +43,27 @@ setkeycodes_main(int argc, char** argv)
struct kbkeycode a;
if (argc % 2 != 1 || argc < 2) {
show_usage();
bb_show_usage();
}
fd = get_console_fd("/dev/console");
fd = get_console_fd();
while (argc > 2) {
a.keycode = atoi(argv[2]);
a.scancode = sc = strtol(argv[1], &ep, 16);
if (*ep) {
error_msg_and_die("error reading SCANCODE: '%s'", argv[1]);
bb_error_msg_and_die("error reading SCANCODE: '%s'", argv[1]);
}
if (a.scancode > 127) {
a.scancode -= 0xe000;
a.scancode += 128;
}
if (a.scancode > 255 || a.keycode > 127) {
error_msg_and_die("SCANCODE or KEYCODE outside bounds");
bb_error_msg_and_die("SCANCODE or KEYCODE outside bounds");
}
if (ioctl(fd,KDSETKEYCODE,&a)) {
perror("KDSETKEYCODE");
error_msg_and_die("failed to set SCANCODE %x to KEYCODE %d", sc, a.keycode);
bb_error_msg_and_die("failed to set SCANCODE %x to KEYCODE %d", sc, a.keycode);
}
argc -= 2;
argv += 2;
+613
View File
@@ -0,0 +1,613 @@
#
# For a description of the syntax of this configuration file,
# see scripts/kbuild/config-language.txt.
#
menu "Coreutils"
config CONFIG_BASENAME
bool "basename"
default n
help
basename is used to strip the directory and suffix from filenames,
leaving just the filename itself. Enable this option if you wish
to enable the 'basename' utility.
config CONFIG_CAL
bool "cal"
default n
help
cal is used to display a monthly calender.
config CONFIG_CAT
bool "cat"
default n
help
cat is used to concatenate files and print them to the standard
output. Enable this option if you wish to enable the 'cat' utility.
config CONFIG_CHGRP
bool "chgrp"
default n
help
chgrp is used to change the group ownership of files.
config CONFIG_CHMOD
bool "chmod"
default n
help
chmod is used to change the access permission of files.
config CONFIG_CHOWN
bool "chown"
default n
help
chown is used to change the user and/or group ownership
of files.
config CONFIG_CHROOT
bool "chroot"
default n
help
chroot is used to change the root directory and run a command.
The default command is `/bin/sh'.
config CONFIG_CMP
bool "cmp"
default n
help
cmp is used to compare two files and returns the result
to standard output.
config CONFIG_CP
bool "cp"
default n
help
cp is used to copy files and directories.
config CONFIG_CUT
bool "cut"
default n
help
cut is used to print selected parts of lines from
each file to stdout.
if CONFIG_WATCH
config CONFIG_DATE
default y
comment "date (forced enabled for use with watch)"
endif
if !CONFIG_WATCH
config CONFIG_DATE
bool "date"
default n
help
date is used to set the system date or display the
current time in the given format.
endif
config CONFIG_FEATURE_DATE_ISOFMT
bool " Enable ISO date format output (-I)"
default y
depends on CONFIG_DATE
help
Enable option (-I) to output an ISO-8601 compliant
date/time string.
config CONFIG_DD
bool "dd"
default n
help
dd copies a file (from standard input to standard output,
by default) using specific input and output blocksizes,
while optionally performing conversions on it.
config CONFIG_DF
bool "df"
default n
help
df reports the amount of disk space used and available
on filesystems.
config CONFIG_DIRNAME
bool "dirname"
default n
help
dirname is used to strip a non-directory suffix from
a file name.
config CONFIG_DOS2UNIX
bool "dos2unix/unix2dos"
default n
help
dos2unix is used to convert a text file from DOS format to
UNIX format, and vice versa.
config CONFIG_UNIX2DOS
bool
default y
depends on CONFIG_DOS2UNIX
config CONFIG_DU
bool "du (default blocksize of 512 bytes)"
default n
help
du is used to report the amount of disk space used
for specified files.
config CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K
bool " Use a default blocksize of 1024 bytes (1K)"
default y
depends on CONFIG_DU
help
Use a blocksize of (1K) instead of the default 512b.
config CONFIG_ECHO
bool "echo (basic SUSv3 version taking no options)"
default n
help
echo is used to print a specified string to stdout.
config CONFIG_FEATURE_FANCY_ECHO
bool " Enable echo options (-n and -e)"
default y
depends on CONFIG_ECHO
help
This adds options (-n and -e) to echo.
config CONFIG_ENV
bool "env"
default n
help
env is used to set an environment variable and run
a command; without options it displays the current
environment.
config CONFIG_EXPR
bool "expr"
default n
help
expr is used to calculate numbers and print the result
to standard output.
if CONFIG_HUSH || CONFIG_LASH || CONFIG_MSH
config CONFIG_FALSE
default y
comment "false (forced enabled for use with shell)"
endif
if !CONFIG_HUSH && !CONFIG_LASH && !CONFIG_MSH
config CONFIG_FALSE
bool "false"
default n
help
false returns an exit code of FALSE (1).
endif
config CONFIG_FOLD
bool "fold"
default n
help
Wrap text to fit a specific width.
config CONFIG_HEAD
bool "head"
default n
help
head is used to print the first specified number of lines
from files.
config CONFIG_FEATURE_FANCY_HEAD
bool " Enable head options (-c, -q, and -v)"
default n
depends on CONFIG_HEAD
help
This enables the head options (-c, -q, and -v).
config CONFIG_HOSTID
bool "hostid"
default n
help
hostid prints the numeric identifier (in hexadecimal) for
the current host.
config CONFIG_ID
bool "id"
default n
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
help
length is used to print out the length of a specified string.
config CONFIG_LN
bool "ln"
default n
help
ln is used to create hard or soft links between files.
config CONFIG_LOGNAME
bool "logname"
default n
help
logname is used to print the current user's login name.
config CONFIG_LS
bool "ls"
default n
help
ls is used to list the contents of directories.
config CONFIG_FEATURE_LS_FILETYPES
bool " Enable filetyping options (-p and -F)"
default y
depends on CONFIG_LS
help
Enable the ls options (-p and -F).
config CONFIG_FEATURE_LS_FOLLOWLINKS
bool " Enable symlinks dereferencing (-L)"
default y
depends on CONFIG_LS
help
Enable the ls option (-L).
config CONFIG_FEATURE_LS_RECURSIVE
bool " Enable recursion (-R)"
default y
depends on CONFIG_LS
help
Enable the ls option (-R).
config CONFIG_FEATURE_LS_SORTFILES
bool " Sort the file names"
default y
depends on CONFIG_LS
help
Allow ls to sort file names alphabetically.
config CONFIG_FEATURE_LS_TIMESTAMPS
bool " Show file timestamps"
default y
depends on CONFIG_LS
help
Allow ls to display timestamps for files.
config CONFIG_FEATURE_LS_USERNAME
bool " Show username/groupnames"
default y
depends on CONFIG_LS
help
Allow ls to display username/groupname for files.
config CONFIG_FEATURE_LS_COLOR
bool " Use color to identify file types"
default y
depends on CONFIG_LS
help
Allow ls to use color when displaying files.
config CONFIG_MD5SUM
bool "md5sum"
default n
help
md5sum is used to print or check MD5 checksums.
config CONFIG_MKDIR
bool "mkdir"
default n
help
mkdir is used to create directories with the specified names.
config CONFIG_MKFIFO
bool "mkfifo"
default n
help
mkfifo is used to create FIFOs (named pipes).
The `mknod' program can also create FIFOs.
config CONFIG_MKNOD
bool "mknod"
default n
help
mknod is used to create FIFOs or block/character special
files with the specified names.
config CONFIG_MV
bool "mv"
default n
help
mv is used to move or rename files or directories.
config CONFIG_OD
bool "od"
default n
help
od is used to dump binary files in octal and other formats.
config CONFIG_PRINTF
bool "printf"
default n
help
printf is used to format and print specified strings.
It's similar to `echo' except it has more options.
config CONFIG_PWD
bool "pwd"
default n
help
pwd is used to print the current directory.
config CONFIG_REALPATH
bool "realpath"
default n
help
Return the canonicalized absolute pathname.
This isn't provided by GNU shellutils, but where else does it belong.
config CONFIG_RM
bool "rm"
default n
help
rm is used to remove files or directories.
config CONFIG_RMDIR
bool "rmdir"
default n
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_SLEEP
bool "sleep (single integer arg with no suffix)"
default n
help
sleep is used to pause for a specified number of seconds,
config CONFIG_FEATURE_FANCY_SLEEP
bool " Enable multiple integer args and optional time suffixes"
default n
depends on CONFIG_SLEEP
help
Allow sleep to pause for specified minutes, hours, and days.
config CONFIG_SORT
bool "sort"
default n
help
sort is used to sort lines of text in specified files.
config CONFIG_STTY
bool "stty"
default n
help
stty is used to change and print terminal line settings.
config CONFIG_SYNC
bool "sync"
default n
help
sync is used to flush filesystem buffers.
config CONFIG_TAIL
bool "tail"
default n
help
tail is used to print the last specified number of lines
from files.
config CONFIG_FEATURE_FANCY_TAIL
bool " Enable extra tail options (-q, -s, and -v)"
default y
depends on CONFIG_TAIL
help
The options (-q, -s, and -v) are provided by GNU tail, but
are not specific in the SUSv3 standard.
config CONFIG_TEE
bool "tee"
default n
help
tee is used to read from standard input and write
to standard output and files.
config CONFIG_FEATURE_TEE_USE_BLOCK_IO
bool " Enable block i/o (larger/faster) instead of byte i/o."
default n
depends on CONFIG_TEE
help
Enable this option for a faster tee, at expense of size.
if CONFIG_ASH || CONFIG_HUSH || CONFIG_LASH || CONFIG_MSH
config CONFIG_TEST
default y
comment "test (forced enabled for use with shell)"
endif
if !CONFIG_ASH && !CONFIG_HUSH && !CONFIG_LASH && !CONFIG_MSH
config CONFIG_TEST
bool "test"
default n
help
test is used to check file types and compare values,
returning an appropriate exit code. The shells (ash
and bash) have test builtin.
endif
config CONFIG_FEATURE_TEST_64
bool " Extend test to 64 bit"
default n
depends on CONFIG_TEST
help
Enable 64-bit support in test.
config CONFIG_TOUCH
bool "touch"
default n
help
touch is used to create or change the access and/or
modification timestamp of specified files.
config CONFIG_TR
bool "tr"
default n
help
tr is used to squeeze, and/or delete characters from standard
input, writing to standard output.
if CONFIG_HUSH || CONFIG_LASH || CONFIG_MSH
config CONFIG_TRUE
default y
comment "true (forced enabled for use with shell)"
endif
if !CONFIG_HUSH && !CONFIG_LASH && !CONFIG_MSH
config CONFIG_TRUE
bool "true"
default n
help
true returns an exit code of TRUE (0).
endif
config CONFIG_TTY
bool "tty"
default n
help
tty is used to print the name of the current terminal to
standard output.
config CONFIG_UNAME
bool "uname"
default n
help
uname is used to print system information.
config CONFIG_UNIQ
bool "uniq"
default n
help
uniq is used to remove duplicate lines from a sorted file.
config CONFIG_USLEEP
bool "usleep"
default n
help
usleep is used to pause for a specified number of microseconds.
config CONFIG_UUDECODE
bool "uudecode"
default n
help
uudecode is used to decode a uuencoded file.
config CONFIG_UUENCODE
bool "uuencode"
default n
help
uuencode is used to uuencode a file.
config CONFIG_WATCH
bool "watch"
default n
help
watch is used to execute a program periodically, showing
output to the screen.
config CONFIG_WC
bool "wc"
default n
help
wc is used to print the number of bytes, words, and lines,
in specified files.
config CONFIG_WHO
bool "who"
default n
select CONFIG_FEATURE_U_W_TMP
help
who is used to show who is logged on.
config CONFIG_WHOAMI
bool "whoami"
default n
help
whoami is used to print the username of the current
user id (same as id -un).
config CONFIG_YES
bool "yes"
default n
help
yes is used to repeatedly output a specific string, or
the default string `y'.
comment "Common options for cp and mv"
depends on CONFIG_CP || CONFIG_MV
config CONFIG_FEATURE_PRESERVE_HARDLINKS
bool " Preserve hard links"
default n
depends on CONFIG_CP || CONFIG_MV
help
Allow cp and mv to preserve hard links.
comment "Common options for ls and more"
depends on CONFIG_LS || CONFIG_MORE
config CONFIG_FEATURE_AUTOWIDTH
bool " Calculate terminal & column widths"
default y
depends on CONFIG_LS || CONFIG_MORE
help
This option allows utilities such as 'ls' and 'more' to determine the
width of the screen, which can allow them to display additional text
or avoid wrapping text onto the next line. If you leave this
disabled, your utilities will be especially primitive and will be
unable to determine the current screen width.
comment "Common options for df, du, ls"
depends on CONFIG_DF || CONFIG_DU || CONFIG_LS
config CONFIG_FEATURE_HUMAN_READABLE
bool " Support for human readable output (example 13k, 23M, 235G)"
default n
depends on CONFIG_DF || CONFIG_DU || CONFIG_LS
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
+32
View File
@@ -0,0 +1,32 @@
# Makefile for busybox
#
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
top_srcdir=..
top_builddir=..
srcdir=$(top_srcdir)/coreutils
SHELLUTILS_DIR:=./
include $(top_builddir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
Loaded 100 of 939 files, more files were not shown because too many files have changed in this diff. Show more