Compare commits

...
230 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
278 changed files with 8452 additions and 6584 deletions

No files matched your search

+12 -6
View File
@@ -9,7 +9,7 @@ incorect, _please_ let me know.
-----------
Emanuele Aina <emanuele.aina@tiscali.it>
run-parts
run-parts
Erik Andersen <andersen@codepoet.org>
Tons of new stuff, major rewrite of most of the
@@ -40,7 +40,7 @@ Dave Cinege <dcinege@psychosis.com>
various fixes, Linux Router Project maintenance
Jordan Crouse <jordan@cosmicpenguin.net>
ipcalc
ipcalc
Magnus Damm <damm@opensource.se>
tftp client
@@ -56,6 +56,10 @@ 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.
@@ -66,13 +70,15 @@ Matt Kraai <kraai@alumni.cmu.edu>
documentation, bugfixes, test suite
Stephan Linz <linz@li-pro.net>
ipcalc, Red Hat equivalence
ipcalc, Red Hat equivalence
John Lombardo <john@deltanet.com>
tr
Glenn McGrath <bug1@optushome.com.au>
ar, dpkg, dpkg-deb
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,
@@ -123,5 +129,5 @@ Enrique Zanardi <ezanardi@ull.es>
tarcat (since removed), loadkmap, various fixes, Debian maintenance
Tito Ragusa <farmatito@tiscali.it>
devfsd and size optimizations in strings, openvt and deallocvt.
devfsd and size optimizations in strings, openvt, chvt, deallocvt, hdparm and fdformat.
+1193 -218
View File
File diff suppressed because it is too large. Load diff
+122 -41
View File
@@ -22,41 +22,126 @@
#--------------------------------------------------------------
noconfig_targets := menuconfig config oldconfig randconfig \
defconfig allyesconfig allnoconfig clean distclean \
release tags
TOPDIR=./
include Rules.mak
release tags
ifndef TOPDIR
TOPDIR=$(CURDIR)/
endif
ifndef top_srcdir
top_srcdir=$(CURDIR)
endif
ifndef top_builddir
top_builddir=$(CURDIR)
endif
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
CONFIG_CONFIG_IN = sysdeps/$(TARGET_OS)/Config.in
CONFIG_DEFCONFIG = sysdeps/$(TARGET_OS)/defconfig
CONFIG_CONFIG_IN = $(top_srcdir)/sysdeps/$(TARGET_OS)/Config.in
CONFIG_DEFCONFIG = $(top_srcdir)/sysdeps/$(TARGET_OS)/defconfig
ALL_DIRS:= $(DIRS) scripts/config
ALL_MAKEFILES:=$(patsubst %,%/Makefile,$(ALL_DIRS))
ifeq ($(KBUILD_SRC),)
ifdef O
ifeq ("$(origin O)", "command line")
KBUILD_OUTPUT := $(O)
endif
endif
# 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
# In this section, we need .config
-include .config.cmd
include $(patsubst %,%/Makefile.in, $(DIRS))
-include $(TOPDIR).depend
all_tree: $(ALL_MAKEFILES)
busybox: .depend include/config.h $(libraries-y)
$(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: applets/busybox.mkll include/config.h
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
uninstall: busybox.links
rm -f $(PREFIX)/bin/busybox
@@ -65,14 +150,18 @@ uninstall: busybox.links
install-hardlinks: applets/install.sh busybox busybox.links
$(SHELL) $< $(PREFIX) --hardlinks
check: busybox
bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite \
$(top_srcdir)/testsuite/runtest
# Documentation Targets
doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
docs/busybox.pod : docs/busybox_header.pod include/usage.h docs/busybox_footer.pod
- ( cat docs/busybox_header.pod; \
docs/autodocifier.pl include/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
@@ -89,7 +178,7 @@ docs/BusyBox.1: docs/busybox.pod
docs/BusyBox.html: docs/busybox.net/BusyBox.html
- mkdir -p docs
-@ rm -f docs/BusyBox.html
-@ ln -s busybox.net/BusyBox.html docs/BusyBox.html
-@ cp docs/busybox.net/BusyBox.html docs/BusyBox.html
docs/busybox.net/BusyBox.html: docs/busybox.pod
-@ mkdir -p docs/busybox.net
@@ -98,20 +187,19 @@ docs/busybox.net/BusyBox.html: docs/busybox.pod
-@ rm -f pod2htm*
# The nifty new buildsystem stuff
scripts/mkdep: scripts/mkdep.c
$(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
scripts/mkdep: $(top_srcdir)/scripts/mkdep.c
$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
scripts/split-include: scripts/split-include.c
$(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c
scripts/split-include: $(top_srcdir)/scripts/split-include.c
$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
.depend: scripts/mkdep
rm -f .depend .hdepend;
mkdir -p include/config;
$(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
scripts/mkdep -I include -- \
`find -name \*.c -print | sed -e "s,^./,,"` >> .depend;
`find $(top_srcdir) -name \*.c -print | sed -e "s,^./,,"` >> .depend;
scripts/mkdep -I include -- \
`find -name \*.h -print | sed -e "s,^./,,"` >> .hdepend;
`find $(top_srcdir) -name \*.h -print | sed -e "s,^./,,"` >> .hdepend;
depend dep: include/config.h .depend
@@ -120,13 +208,10 @@ include/config/MARKER: depend scripts/split-include
@ touch include/config/MARKER
include/config.h: .config
@if [ ! -x ./scripts/config/conf ] ; then \
@if [ ! -x $(top_builddir)/scripts/config/conf ] ; then \
$(MAKE) -C scripts/config conf; \
fi;
@./scripts/config/conf -o $(CONFIG_CONFIG_IN)
%.o: %.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
@$(top_builddir)/scripts/config/conf -o $(CONFIG_CONFIG_IN)
finished2:
@echo
@@ -140,12 +225,16 @@ all: menuconfig
# configuration
# ---------------------------------------------------------------------------
scripts/config/conf:
$(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
scripts/config/mconf:
scripts/config/mconf: scripts/config/Makefile Rules.mak
$(MAKE) -C scripts/config ncurses conf mconf
-@if [ ! -f .config ] ; then \
cp $(CONFIG_DEFCONFIG) .config; \
@@ -177,16 +266,7 @@ allnoconfig: scripts/config/conf
defconfig: scripts/config/conf
@./scripts/config/conf -d $(CONFIG_CONFIG_IN)
test tests: busybox
# Note that 'tests' is depricated. Use 'make check' instead
# To use the nice new testsuite....
cd tests && ./tester.sh
check: busybox
cd testsuite && ./runtest
clean:
- $(MAKE) -C tests clean
- rm -f docs/busybox.dvi docs/busybox.ps \
docs/busybox.pod docs/busybox.net/busybox.html \
docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \
@@ -228,7 +308,8 @@ tags:
endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
endif # ifeq ($(skip-makefile),)
.PHONY: dummy subdirs release distclean clean config oldconfig \
menuconfig tags check test tests depend
menuconfig tags check test depend buildtree
+13 -11
View File
@@ -31,25 +31,27 @@ If you wish to install hard links, rather than symlinks, you can use
Supported architectures:
BusyBox in general will build on any architecture supported by gcc. It has
a few specialized features added for __sparc__ and __alpha__. insmod
functionality is currently limited to x86, ARM, SH3/4, powerpc, m68k,
MIPS, cris, and v850e.
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 C Libraries:
glibc-2.0.x, glibc-2.1.x, glibc-2.2.x, glibc-2.3.x, uClibc. People
are looking at newlib and diet-libc, but consider them unsupported,
untested, or worse. Linux-libc5 is no longer supported -- you
should probably use uClibc instead if you want a small C library.
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.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, say, FreeBSD or Solaris, or Mac OS X, or even Windows (if you are into
that sort of thing).
to support, say, FreeBSD or Solaris, or Mac OS X, or even Windows (if you
are into that sort of thing).
----------------
@@ -80,7 +82,7 @@ an example:
With GNU date I get the following output:
$ date
Sat Mar 27 14:19:41 MST 2004
Fri Oct 8 14:19:41 MDT 2004
But when I use BusyBox date I get this instead:
+4 -8
View File
@@ -19,7 +19,7 @@
#--------------------------------------------------------
PROG := busybox
VERSION := 1.00-pre10
VERSION := 1.00
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
@@ -42,7 +42,7 @@ LD = $(CROSS)ld
NM = $(CROSS)nm
STRIP = $(CROSS)strip
CPP = $(CC) -E
MAKEFILES = $(TOPDIR).config
# MAKEFILES = $(top_builddir)/.config
# What OS are you compiling busybox for? This allows you to include
# OS specific things, syscall overrides, etc.
@@ -80,7 +80,7 @@ BB_SRC_DIR=
#GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
WARNINGS=-Wall -Wstrict-prototypes -Wshadow
CFLAGS=-I$(TOPDIR)include
CFLAGS=-I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)
ARFLAGS=-r
#--------------------------------------------------------
@@ -102,7 +102,7 @@ endif
# Pull in the user's busybox configuration
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
-include $(TOPDIR).config
-include $(top_builddir)/.config
endif
# A nifty macro to make testing gcc features easier
@@ -189,12 +189,8 @@ endif
# have a chance of winning.
CFLAGS += $(CFLAGS_EXTRA)
%.o: %.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
.PHONY: dummy
.EXPORT_ALL_VARIABLES:
+11
View File
@@ -0,0 +1,11 @@
Busybox TODO
Stuff that needs to be done
----
tr - missing SuS3 features in busybox 1.0pre10
tr doesnt support [:blank:], [:digit:] or other predefined classes, [=equiv=]
support is also missing.
----
+7 -5
View File
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
TOPDIR:= ../
top_srcdir=..
top_builddir=..
srcdir=$(top_srcdir)/applets
APPLETS_DIR:=./
include $(TOPDIR).config
include $(TOPDIR)Rules.mak
include Makefile.in
include $(top_builddir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
-include $(TOPDIR).depend
-include $(top_builddir).depend
clean:
rm -f *.o *.a $(AR_TARGET)
+6 -5
View File
@@ -19,18 +19,19 @@
APPLETS_AR:=applets.a
ifndef $(APPLETS_DIR)
APPLETS_DIR:=$(TOPDIR)applets/
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)
$(APPLET_OBJ): $(TOPDIR).config
$(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 $@ $<
+1 -1
View File
@@ -475,7 +475,7 @@ static void parse_config_file(void)
/* Encountering configuration lines prior to seeing a
* section header is treated as an error. This is how
* the old code worked, but it may not be desireable.
* 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) {
+7 -5
View File
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
TOPDIR:= ../
top_srcdir=..
top_builddir=..
ARCHIVAL_DIR:=./
include $(TOPDIR).config
include $(TOPDIR)Rules.mak
include Makefile.in
srcdir=$(top_srcdir)/archival
include $(top_builddir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
-include $(TOPDIR).depend
-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
+5 -1
View File
@@ -19,8 +19,9 @@
ARCHIVAL_AR:=archival.a
ifndef $(ARCHIVAL_DIR)
ARCHIVAL_DIR:=$(TOPDIR)archival/
ARCHIVAL_DIR:=$(top_builddir)/archival/
endif
srcdir=$(top_srcdir)/archival
ARCHIVAL-y:=
ARCHIVAL-$(CONFIG_APT_GET) +=
@@ -42,3 +43,6 @@ 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 $@ $<
+11 -7
View File
@@ -3,7 +3,7 @@
* 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.
*
@@ -50,11 +50,12 @@ static void header_verbose_list_ar(const file_header_t *file_header)
printf("%s %d/%d%7d %s %s\n", &mode[1], file_header->uid, file_header->gid, (int) file_header->size, &mtime[4], file_header->name);
}
#define AR_CTX_PRINT 1
#define AR_CTX_LIST 2
#define AR_CTX_EXTRACT 4
#define AR_OPT_PRESERVE_DATE 8
#define AR_OPT_VERBOSE 16
#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)
{
@@ -65,7 +66,7 @@ extern int ar_main(int argc, char **argv)
archive_handle = init_handle();
bb_opt_complementaly = "p~tx:t~px:x~pt";
opt = bb_getopt_ulflags(argc, argv, "ptxov");
opt = bb_getopt_ulflags(argc, argv, "ptxovc");
if ((opt & 0x80000000UL) || (optind == argc)) {
bb_show_usage();
@@ -86,6 +87,9 @@ extern int ar_main(int argc, char **argv)
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_handle->src_fd = bb_xopen(argv[optind++], O_RDONLY);
+3 -1
View File
@@ -1,5 +1,5 @@
/*
* Modified for busybox by Glenn McGrath <bug1@optushome.com.au>
* 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
@@ -33,6 +33,8 @@
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;
+18 -18
View File
@@ -1,6 +1,6 @@
/*
* Mini dpkg implementation for busybox.
* This is not meant as a replacemnt for dpkg
* This is not meant as a replacement for dpkg
*
* Written By Glenn McGrath with the help of others
* Copyright (C) 2001 by Glenn McGrath
@@ -23,7 +23,7 @@
*/
/*
* Known difference between busybox dpkg and the official dpkg that i dont
* Known difference between busybox dpkg and the official dpkg that i don't
* consider important, its worth keeping a note of differences anyway, just to
* make it easier to maintain.
* - The first value for the Confflile: field isnt placed on a new line.
@@ -86,7 +86,7 @@ common_node_t *package_hashtable[PACKAGE_HASH_PRIME + 1];
/* Currently it doesnt store packages that have state-status of not-installed
* So it only really has to be the size of the maximum number of packages
* likely to be installed at any one time, so there is a bit of leaway here */
* likely to be installed at any one time, so there is a bit of leeway here */
#define STATUS_HASH_PRIME 8191
typedef struct status_node_s {
unsigned int package:14; /* has to fit PACKAGE_HASH_PRIME */
@@ -94,7 +94,7 @@ typedef struct status_node_s {
} status_node_t;
status_node_t *status_hashtable[STATUS_HASH_PRIME + 1];
/* Even numbers are for 'extras', like ored dependecies or null */
/* Even numbers are for 'extras', like ored dependencies or null */
enum edge_type_e {
EDGE_NULL = 0,
EDGE_PRE_DEPENDS = 1,
@@ -148,7 +148,7 @@ void make_hash(const char *key, unsigned int *start, unsigned int *decrement, co
for(i = 1; i < len; i++) {
/* shifts the ascii based value and adds it to previous value
* shift amount is mod 24 because long int is 32 bit and data
* to be shifted is 8, dont want to shift data to where it has
* to be shifted is 8, don't want to shift data to where it has
* no effect*/
hash_num += ((key[i] + key[i-1]) << ((key[i] * i) % 24));
}
@@ -392,7 +392,7 @@ int search_package_hashtable(const unsigned int name, const unsigned int version
/*
* This function searches through the entire package_hashtable looking
* for a package which provides "needle". It returns the index into
* the package_hashtable for the provining package.
* the package_hashtable for the providing package.
*
* needle is the index into name_hashtable of the package we are
* looking for.
@@ -489,7 +489,7 @@ void add_split_dependencies(common_node_t *parent_node, const char *whole_line,
/* Skip leading ' ' or '(' */
version += strspn(field2, " ");
version += strspn(version, "(");
/* Calculate length of any operator charactors */
/* Calculate length of any operator characters */
offset_ch = strspn(version, "<=>");
/* Determine operator */
if (offset_ch > 0) {
@@ -636,7 +636,7 @@ unsigned int get_status(const unsigned int status_node, const int num)
for (i = 1; i < num; i++) {
/* skip past a word */
status_string += strcspn(status_string, " ");
/* skip past the seperating spaces */
/* skip past the separating spaces */
status_string += strspn(status_string, " ");
}
len = strcspn(status_string, " \n\0");
@@ -955,13 +955,13 @@ void write_status_file(deb_file_t **deb_file)
fclose(new_status_file);
/* Create a seperate backfile to dpkg */
/* Create a separate backfile to dpkg */
if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) {
struct stat stat_buf;
if (stat("/var/lib/dpkg/status", &stat_buf) == 0) {
bb_error_msg_and_die("Couldnt create backup status file");
}
/* Its ok if renaming the status file fails becasue status
/* Its ok if renaming the status file fails because status
* file doesnt exist, maybe we are starting from scratch */
bb_error_msg("No status file found, creating new one");
}
@@ -971,10 +971,10 @@ void write_status_file(deb_file_t **deb_file)
}
}
/* This function returns TRUE if the given package can statisfy a
/* This function returns TRUE if the given package can satisfy a
* dependency of type depend_type.
*
* A pre-depends is statisfied only if a package is already installed,
* A pre-depends is satisfied only if a package is already installed,
* which a regular depends can be satisfied by a package which we want
* to install.
*/
@@ -1085,7 +1085,7 @@ int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
for (i = 0; i < PACKAGE_HASH_PRIME; i++) {
int status_num = 0;
int number_of_alternatives = 0;
const edge_t * root_of_alternatives;
const edge_t * root_of_alternatives = NULL;
const common_node_t *package_node = package_hashtable[i];
/* If the package node does not exist then this
@@ -1118,7 +1118,7 @@ int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
continue;
#endif
/* This code is tested only for EDGE_DEPENDS, sine I
/* This code is tested only for EDGE_DEPENDS, since I
* have no suitable pre-depends available. There is no
* reason that it shouldn't work though :-)
*/
@@ -1211,7 +1211,7 @@ char **create_list(const char *filename)
char *line = NULL;
int count = 0;
/* dont use [xw]fopen here, handle error ourself */
/* don't use [xw]fopen here, handle error ourself */
list_stream = fopen(filename, "r");
if (list_stream == NULL) {
return(NULL);
@@ -1385,7 +1385,7 @@ void remove_package(const unsigned int package_num, int noisy)
bb_error_msg_and_die("script failed, prerm failure");
}
/* Create a list of files to remove, and a seperate list of those to keep */
/* Create a list of files to remove, and a separate list of those to keep */
sprintf(list_name, "/var/lib/dpkg/info/%s.list", package_name);
remove_files = create_list(list_name);
@@ -1480,7 +1480,7 @@ static void init_archive_deb_control(archive_handle_t *ar_handle)
tar_handle = init_handle();
tar_handle->src_fd = ar_handle->src_fd;
/* We dont care about data.tar.* or debian-binary, just control.tar.* */
/* We don't care about data.tar.* or debian-binary, just control.tar.* */
#ifdef CONFIG_FEATURE_DEB_TAR_GZ
ar_handle->accept = llist_add_to(NULL, "control.tar.gz");
#endif
@@ -1502,7 +1502,7 @@ static void init_archive_deb_data(archive_handle_t *ar_handle)
tar_handle = init_handle();
tar_handle->src_fd = ar_handle->src_fd;
/* We dont care about control.tar.* or debian-binary, just data.tar.* */
/* We don't care about control.tar.* or debian-binary, just data.tar.* */
#ifdef CONFIG_FEATURE_DEB_TAR_GZ
ar_handle->accept = llist_add_to(NULL, "data.tar.gz");
#endif
+1 -1
View File
@@ -12,7 +12,7 @@
* 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
+1 -1
View File
@@ -632,7 +632,7 @@ static void copy_block(char *buf, unsigned len, int header)
* However the F&G algorithm may be faster for some highly redundant
* files if the parameter max_chain_length (described below) is too large.
*
* ACKNOWLEDGEMENTS
* ACKNOWLEDGMENTS
*
* The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
* I found it in 'freeze' written by Leonid Broukhis.
+7 -5
View File
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
TOPDIR:= ../../
top_srcdir=../..
top_builddir=../..
srcdir=$(top_srcdir)/archival/libunarchive
LIBUNARCHIVE_DIR:=./
include $(TOPDIR).config
include $(TOPDIR)Rules.mak
include Makefile.in
include $(top_builddir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
-include $(TOPDIR).depend
-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
+5 -1
View File
@@ -19,8 +19,9 @@
LIBUNARCHIVE_AR:=libunarchive.a
ifndef $(LIBUNARCHIVE_DIR)
LIBUNARCHIVE_DIR:=$(TOPDIR)archival/libunarchive/
LIBUNARCHIVE_DIR:=$(top_builddir)/archival/libunarchive/
endif
srcdir=$(top_srcdir)/archvial/libunarchive
LIBUNARCHIVE-y:= \
\
@@ -78,3 +79,6 @@ 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 $@ $<
+2 -2
View File
@@ -35,7 +35,7 @@ extern void data_extract_all(archive_handle_t *archive_handle)
if (archive_handle->flags & ARCHIVE_CREATE_LEADING_DIRS) {
char *name = bb_xstrdup(file_header->name);
bb_make_directory (dirname(name), 0777, FILEUTILS_RECUR);
bb_make_directory (dirname(name), -1, FILEUTILS_RECUR);
free(name);
}
@@ -66,7 +66,7 @@ extern void data_extract_all(archive_handle_t *archive_handle)
}
}
/* Handle hard links seperately
/* 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 */
+20 -18
View File
@@ -13,7 +13,7 @@
/*
Size and speed optimizations by Manuel Novoa III (mjn3@codepoet.org).
More efficient reading of huffman codes, a streamlined read_bunzip()
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.
@@ -49,10 +49,10 @@
#include "libbb.h"
/* Constants for huffman coding */
/* 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_HUFCODE_BITS 20 /* Longest Huffman code allowed */
#define MAX_SYMBOLS 258 /* 256 literals + RUNA + RUNB */
#define SYMBOL_RUNA 0
#define SYMBOL_RUNB 1
@@ -70,7 +70,7 @@
/* Other housekeeping constants */
#define IOBUF_SIZE 4096
/* This is what we know about each huffman coding group */
/* 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];
@@ -92,7 +92,7 @@ typedef struct {
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 */
struct group_data groups[MAX_GROUPS]; /* Huffman coding tables */
/* For I/O error handling */
jmp_buf jmpbuf;
} bunzip_data;
@@ -134,6 +134,8 @@ static unsigned int get_bits(bunzip_data *bd, char bits_wanted)
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];
@@ -172,10 +174,10 @@ static int get_next_block(bunzip_data *bd)
if(k&(1<<(15-j))) symToByte[symTotal++]=(16*i)+j;
}
}
/* How many different huffman coding groups does this block use? */
/* 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
/* 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.) */
@@ -189,13 +191,13 @@ static int get_next_block(bunzip_data *bd)
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
/* 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
/* 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
@@ -228,12 +230,12 @@ static int get_next_block(bunzip_data *bd)
}
/* Calculate permute[], base[], and limit[] tables from length[].
*
* permute[] is the lookup table for converting huffman coded symbols
* 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[].
* 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
* 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;
@@ -275,7 +277,7 @@ static int get_next_block(bunzip_data *bd)
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
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 */
@@ -286,7 +288,7 @@ static int get_next_block(bunzip_data *bd)
/* Loop through compressed symbols. */
runPos=dbufCount=symCount=selector=0;
for(;;) {
/* Determine which huffman coding group to use. */
/* Determine which Huffman coding group to use. */
if(!(symCount--)) {
symCount=GROUP_SIZE-1;
if(selector>=nSelectors) return RETVAL_DATA_ERROR;
@@ -294,7 +296,7 @@ static int get_next_block(bunzip_data *bd)
base=hufGroup->base-1;
limit=hufGroup->limit-1;
}
/* Read next huffman-coded symbol. */
/* 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),
@@ -383,7 +385,7 @@ got_huff_bits:
byteCount[uc]++;
dbuf[dbufCount++] = (unsigned int)uc;
}
/* At this point, we've read all the huffman-coded symbols (and repeated
/* 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.
@@ -439,7 +441,7 @@ static int read_bunzip(bunzip_data *bd, char *outbuf, int len)
/* 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). */
Huffman-decoded a block into the intermediate buffer yet). */
if (bd->writeCopies) {
/* Inside the loop, writeCopies means extra copies (beyond 1) */
@@ -495,7 +497,7 @@ decode_next_byte:
}
}
/* Refill the intermediate buffer by huffman-decoding next block of input */
/* 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) {
@@ -30,7 +30,7 @@
#include <string.h>
#include <unistd.h>
/* Defailt input buffer size */
/* Default input buffer size */
#define IBUFSIZ 2048
/* Default output buffer size */
+2 -2
View File
@@ -12,7 +12,7 @@
* 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>
*
* read_gz interface + associated hacking by Laurence Anderson
*
@@ -892,7 +892,7 @@ static int inflate_get_next_window(void)
/* Doesnt get here */
}
/* Initialise bytebuffer, be carefull not to overfill the buffer */
/* Initialise bytebuffer, be careful not to overfill the buffer */
extern void inflate_init(unsigned int bufsize)
{
/* Set the bytebuffer size, default is same as gunzip_wsize */
+7 -1
View File
@@ -18,6 +18,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/sysmacros.h> /* major() and minor() */
#include "unarchive.h"
#include "libbb.h"
@@ -117,6 +118,8 @@ extern char get_header_cpio(archive_handle_t *archive_handle)
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 */
@@ -141,7 +144,7 @@ extern char get_header_cpio(archive_handle_t *archive_handle)
}
}
}
file_header->device = (major << 8) | minor;
file_header->device = makedev(major, minor);
if (archive_handle->filter(archive_handle) == EXIT_SUCCESS) {
archive_handle->action_data(archive_handle);
@@ -151,5 +154,8 @@ extern char get_header_cpio(archive_handle_t *archive_handle)
}
archive_handle->offset += file_header->size;
free(file_header->link_name);
return (EXIT_SUCCESS);
}
+3 -3
View File
@@ -14,7 +14,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* FIXME:
* In privelidged mode if uname and gname map to a uid amd gid then use the
* 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:
@@ -121,8 +121,8 @@ extern char get_header_tar(archive_handle_t *archive_handle)
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 = (dev_t) ((strtol(tar.formated.devmajor, NULL, 8) << 8) +
strtol(tar.formated.devminor, NULL, 8));
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);
+19 -20
View File
@@ -2,11 +2,11 @@
/*
* Mini tar implementation for busybox
*
* Modifed to use common extraction code used by ar, cpio, dpkg-deb, dpkg
* Glenn McGrath <bug1@optushome.com.au>
* Modified to use common extraction code used by ar, cpio, dpkg-deb, dpkg
* Glenn McGrath <bug1@iinet.net.au>
*
* Note, that as of BusyBox-0.43, tar has been completely rewritten from the
* ground up. It still has remnents of the old code lying about, but it is
* ground up. It still has remnants of the old code lying about, but it is
* very different now (i.e., cleaner, less global variables, etc.)
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
@@ -49,6 +49,7 @@
#include <signal.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include <sys/sysmacros.h> /* major() and minor() */
#include "unarchive.h"
#include "busybox.h"
@@ -58,11 +59,6 @@
# define TAR_MAGIC "ustar" /* ustar and a null */
# define TAR_VERSION " " /* Be compatable with GNU tar format */
# ifndef MAJOR
# define MAJOR(dev) (((dev)>>8)&0xff)
# define MINOR(dev) ((dev)&0xff)
# endif
static const int TAR_BLOCK_SIZE = 512;
static const int TAR_MAGIC_LEN = 6;
static const int TAR_VERSION_LEN = 2;
@@ -238,9 +234,9 @@ static inline int writeTarHeader(struct TarBallInfo *tbInfo,
TAR_MAGIC_LEN + TAR_VERSION_LEN);
/* Enter the user and group names (default to root if it fails) */
if (my_getpwuid(header.uname, statbuf->st_uid) == NULL)
if (my_getpwuid(header.uname, statbuf->st_uid, sizeof(header.uname)) == NULL)
strcpy(header.uname, "root");
if (my_getgrgid(header.gname, statbuf->st_gid) == NULL)
if (my_getgrgid(header.gname, statbuf->st_gid, sizeof(header.gname)) == NULL)
strcpy(header.gname, "root");
if (tbInfo->hlInfo) {
@@ -262,15 +258,15 @@ static inline int writeTarHeader(struct TarBallInfo *tbInfo,
} else if (S_ISCHR(statbuf->st_mode)) {
header.typeflag = CHRTYPE;
putOctal(header.devmajor, sizeof(header.devmajor),
MAJOR(statbuf->st_rdev));
major(statbuf->st_rdev));
putOctal(header.devminor, sizeof(header.devminor),
MINOR(statbuf->st_rdev));
minor(statbuf->st_rdev));
} else if (S_ISBLK(statbuf->st_mode)) {
header.typeflag = BLKTYPE;
putOctal(header.devmajor, sizeof(header.devmajor),
MAJOR(statbuf->st_rdev));
major(statbuf->st_rdev));
putOctal(header.devminor, sizeof(header.devminor),
MINOR(statbuf->st_rdev));
minor(statbuf->st_rdev));
} else if (S_ISFIFO(statbuf->st_mode)) {
header.typeflag = FIFOTYPE;
} else if (S_ISREG(statbuf->st_mode)) {
@@ -477,8 +473,8 @@ static inline int writeTarFile(const int tar_fd, const int verboseFlag,
dup2(gzipDataPipe[0], 0);
close(gzipDataPipe[1]);
if (tbInfo.tarFd != 1);
dup2(tbInfo.tarFd, 1);
if (tbInfo.tarFd != 1)
dup2(tbInfo.tarFd, 1);
close(gzipStatusPipe[0]);
fcntl(gzipStatusPipe[1], F_SETFD, FD_CLOEXEC); /* close on exec shows sucess */
@@ -625,7 +621,7 @@ static char get_header_tar_Z(archive_handle_t *archive_handle)
#endif
#ifdef CONFIG_FEATURE_TAR_FROM
# define TAR_OPT_FROM_FILE (1 << (8 + TAR_OPT_FLAG_CREATE + TAR_OPT_FLAG_BZIP2))
# define TAR_OPT_INCLUDE_FROM (1 << (8 + TAR_OPT_FLAG_CREATE + TAR_OPT_FLAG_BZIP2))
# define TAR_OPT_EXCLUDE_FROM (1 << (8 + TAR_OPT_FLAG_CREATE + TAR_OPT_FLAG_BZIP2 + 1))
# define TAR_OPT_STR_FROM "T:X:"
# define TAR_OPT_FLAG_FROM 2
@@ -675,7 +671,7 @@ static const struct option tar_long_options[] = {
{ "bzip2", 0, NULL, 'j' },
# endif
# ifdef CONFIG_FEATURE_TAR_FROM
{ "from-file", 1, NULL, 'T' },
{ "files-from", 1, NULL, 'T' },
{ "exclude-from", 1, NULL, 'X' },
# endif
# ifdef CONFIG_FEATURE_TAR_GZIP
@@ -722,7 +718,7 @@ int tar_main(int argc, char **argv)
&base_dir, /* Change to dir <optarg> */
&tar_filename /* archive filename */
#ifdef CONFIG_FEATURE_TAR_FROM
, NULL,
, &(tar_handle->accept),
&(tar_handle->reject)
#endif
);
@@ -787,6 +783,9 @@ int tar_main(int argc, char **argv)
if(opt & TAR_OPT_EXCLUDE_FROM) {
tar_handle->reject = append_file_list_to_list(tar_handle->reject);
}
if(opt & TAR_OPT_INCLUDE_FROM) {
tar_handle->accept = append_file_list_to_list(tar_handle->accept);
}
#endif
/* Check if we are reading from stdin */
@@ -796,7 +795,7 @@ int tar_main(int argc, char **argv)
}
/* Setup an array of filenames to work with */
/* TODO: This is the same as in ar, seperate function ? */
/* TODO: This is the same as in ar, separate function ? */
while (optind < argc) {
char *filename_ptr = last_char_is(argv[optind], '/');
if (filename_ptr) {
+4 -1
View File
@@ -20,7 +20,10 @@
*
*/
/* For reference to format see http://www.pkware.com/support/appnote.html */
/* 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 ? */
+7 -5
View File
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
TOPDIR:= ../
top_srcdir=..
top_builddir=..
srcdir=$(top_srcdir)/console/tools
CONSOLETOOLS_DIR:=./
include $(TOPDIR).config
include $(TOPDIR)Rules.mak
include Makefile.in
include $(top_builddir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
-include $(TOPDIR).depend
-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
+5 -1
View File
@@ -19,8 +19,9 @@
CONSOLETOOLS_AR:=console-tools.a
ifndef $(CONSOLETOOLS_DIR)
CONSOLETOOLS_DIR:=$(TOPDIR)console-tools/
CONSOLETOOLS_DIR:=$(top_builddir)/console-tools/
endif
srcdir=$(top_srcdir)/console-tools
CONSOLETOOLS_DIR-y:=
CONSOLETOOLS_DIR-$(CONFIG_CHVT) += chvt.o
@@ -38,3 +39,6 @@ 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 $@ $<
+8
View File
@@ -455,6 +455,13 @@ if !CONFIG_ASH && !CONFIG_HUSH && !CONFIG_LASH && !CONFIG_MSH
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
@@ -538,6 +545,7 @@ config CONFIG_WC
config CONFIG_WHO
bool "who"
default n
select CONFIG_FEATURE_U_W_TMP
help
who is used to show who is logged on.
+7 -5
View File
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
TOPDIR:= ../
top_srcdir=..
top_builddir=..
srcdir=$(top_srcdir)/coreutils
SHELLUTILS_DIR:=./
include $(TOPDIR).config
include $(TOPDIR)Rules.mak
include Makefile.in
include $(top_builddir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
-include $(TOPDIR).depend
-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
+6 -1
View File
@@ -19,8 +19,9 @@
COREUTILS_AR:=coreutils.a
ifndef $(COREUTILS_DIR)
COREUTILS_DIR:=$(TOPDIR)coreutils/
COREUTILS_DIR:=$(top_builddir)/coreutils/
endif
srcdir=$(top_srcdir)/coreutils
COREUTILS-y:=
COREUTILS-$(CONFIG_BASENAME) += basename.o
@@ -91,3 +92,7 @@ libraries-y+=$(COREUTILS_DIR)$(COREUTILS_AR)
$(COREUTILS_DIR)$(COREUTILS_AR): $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y))
$(AR) -ro $@ $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y))
$(COREUTILS_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+1 -1
View File
@@ -65,7 +65,7 @@ static const char sep1752[] = {
static int julian;
/* leap year -- account for gregorian reformation in 1752 */
/* leap year -- account for Gregorian reformation in 1752 */
#define leap_year(yr) \
((yr) <= 1752 ? !((yr) % 4) : \
(!((yr) % 4) && ((yr) % 100)) || !((yr) % 400))
+1 -1
View File
@@ -27,7 +27,7 @@
*
* Original version majorly reworked for SUSv3 compliance, bug fixes, and
* size optimizations. Changes include:
* 1) Now correctly distingusishes between errors and actual file differences.
* 1) Now correctly distinguishes between errors and actual file differences.
* 2) Proper handling of '-' args.
* 3) Actual error checking of i/o.
* 4) Accept SUSv3 -l option. Note that we use the slightly nicer gnu format
+2 -2
View File
@@ -70,7 +70,7 @@ static int cmpfunc(const void *a, const void *b)
/*
* parse_lists() - parses a list and puts values into startpos and endpos.
* valid list formats: N, N-, N-M, -M
* more than one list can be seperated by commas
* more than one list can be separated by commas
*/
static void parse_lists(char *lists)
{
@@ -79,7 +79,7 @@ static void parse_lists(char *lists)
char *junk;
int s = 0, e = 0;
/* take apart the lists, one by one (they are seperated with commas */
/* take apart the lists, one by one (they are separated with commas */
while ((ltok = strsep(&lists, ",")) != NULL) {
/* it's actually legal to pass an empty list */
+10 -1
View File
@@ -42,11 +42,12 @@
/* Input parsing code is always bulky - used heavy duty libc stuff as
much as possible, missed out a lot of bounds checking */
/* Default input handling to save suprising some people */
/* Default input handling to save surprising some people */
static struct tm *date_conv_time(struct tm *tm_time, const char *t_string)
{
int nr;
char *cp;
nr = sscanf(t_string, "%2d%2d%2d%2d%d", &(tm_time->tm_mon),
&(tm_time->tm_mday), &(tm_time->tm_hour), &(tm_time->tm_min),
@@ -56,6 +57,14 @@ static struct tm *date_conv_time(struct tm *tm_time, const char *t_string)
bb_error_msg_and_die(bb_msg_invalid_date, t_string);
}
cp = strchr(t_string, '.');
if (cp) {
nr = sscanf(cp + 1, "%2d", &(tm_time->tm_sec));
if (nr != 1) {
bb_error_msg_and_die(bb_msg_invalid_date, t_string);
}
}
/* correct for century - minor Y2K problem here? */
if (tm_time->tm_year >= 1900) {
tm_time->tm_year -= 1900;
+2 -2
View File
@@ -27,7 +27,7 @@
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Size reduction. Removed floating point dependency. Added error checking
* on output. Output stats on 0-sized filesystems if specificly listed on
* on output. Output stats on 0-sized filesystems if specifically listed on
* the command line. Properly round *-blocks, Used, and Available quantities.
*/
@@ -130,7 +130,7 @@ extern int df_main(int argc, char **argv)
} else if (strcmp(device, "/dev/root") == 0) {
/* Adjusts device to be the real root device,
* or leaves device alone if it can't find it */
if ((device = find_real_root_device_name(device)) == NULL) {
if ((device = find_real_root_device_name()) == NULL) {
goto SET_ERROR;
}
}
+3 -1
View File
@@ -64,7 +64,9 @@ static int convert(char *fn, int ConvType)
c = strlen(tempFn);
tempFn[c] = '.';
while(1) {
if (c >=BUFSIZ)
/* tempFn is BUFSIZ so the last addressable spot it BUFSIZ-1.
* The loop increments by 2. So this must check for BUFSIZ-3. */
if (c >=BUFSIZ-3)
bb_error_msg_and_die("unique name not found");
/* Get some semi random stuff to try and make a
* random filename based (and in the same dir as)
+1 -1
View File
@@ -27,7 +27,7 @@
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Because of behavioral differences, implemented configureable SUSv3
* Because of behavioral differences, implemented configurable SUSv3
* or 'fancy' gnu-ish behaviors. Also, reduced size and fixed bugs.
* 1) In handling '\c' escape, the previous version only suppressed the
* trailing newline. SUSv3 specifies _no_ output after '\c'.
+2 -2
View File
@@ -34,8 +34,8 @@
*/
/*
* Modified by Vladimir Oleynik <andersen@codepoet.org> (C) 2003
* - corretion "-" option usage
* Modified by Vladimir Oleynik <dzo@simtreas.ru> (C) 2003
* - correct "-" option usage
* - multiple "-u unsetenv" support
* - GNU long option support
* - save errno after exec failed before bb_perror_msg()
+11 -11
View File
@@ -9,24 +9,24 @@
* Copyright (c) 2000 Edward Betts <edward@debian.org>.
* Aug 2003 Vladimir Oleynik - reduced 464 bytes.
*
* this program is free software; you can redistribute it and/or modify
* it under the terms of the gnu general public license as published by
* the free software foundation; either version 2 of the license, or
* 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.
* 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
* 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
*
*/
/* This program evaluates expressions. Each token (operator, operand,
* parenthesis) of the expression must be a seperate argument. The
* parenthesis) of the expression must be a separate argument. The
* parser used is a reasonably general one, though any incarnation of
* it is language-specific. It is especially nice for expressions.
*
+1 -1
View File
@@ -4,7 +4,7 @@
Copyright (C) 91, 1995-2002 Free Software Foundation, Inc.
Modified for busybox based on coreutils v 5.0
Copyright (C) 2003 Glenn McGrath <bug1@optushome.com.au>
Copyright (C) 2003 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
+84 -59
View File
@@ -21,90 +21,115 @@
*/
/* BB_AUDIT SUSv3 _NOT_ compliant -- option -G is not currently supported. */
/* Hacked by Tito Ragusa (C) 2004 to handle usernames of whatever length and to
* be more similar to GNU id.
*/
#include "busybox.h"
#include "pwd_.h"
#include <stdio.h>
#include <unistd.h>
#include <getopt.h>
#include <string.h>
#include <sys/types.h>
#ifdef CONFIG_SELINUX
#include <proc_secure.h>
#include <flask_util.h>
#endif
#define JUST_USER 1
#define JUST_GROUP 2
#define PRINT_REAL 4
#define NAME_NOT_NUMBER 8
#define PRINT_REAL 1
#define NAME_NOT_NUMBER 2
#define JUST_USER 4
#define JUST_GROUP 8
static short printf_full(unsigned int id, const char *arg, const char prefix)
{
const char *fmt = "%cid=%u";
short status=EXIT_FAILURE;
if(arg) {
fmt = "%cid=%u(%s)";
status=EXIT_SUCCESS;
}
bb_printf(fmt, prefix, id, arg);
return status;
}
extern int id_main(int argc, char **argv)
{
char user[9], group[9];
long pwnam, grnam;
int uid, gid;
int flags;
struct passwd *p;
uid_t uid;
gid_t gid;
unsigned long flags;
short status;
#ifdef CONFIG_SELINUX
int is_flask_enabled_flag = is_flask_enabled();
#endif
flags = bb_getopt_ulflags(argc, argv, "ugrn");
bb_opt_complementaly = "u~g:g~u";
flags = bb_getopt_ulflags(argc, argv, "rnug");
if (((flags & (JUST_USER | JUST_GROUP)) == (JUST_USER | JUST_GROUP))
|| (argc > optind + 1)
) {
if ((flags & 0x80000000UL)
/* Don't allow -n -r -nr */
|| (flags <= 3 && flags > 0)
/* Don't allow more than one username */
|| (argc > optind + 1))
bb_show_usage();
/* This values could be overwritten later */
uid = geteuid();
gid = getegid();
if (flags & PRINT_REAL) {
uid = getuid();
gid = getgid();
}
if(argv[optind]) {
p=getpwnam(argv[optind]);
/* my_getpwnam is needed because it exits on failure */
uid = my_getpwnam(argv[optind]);
gid = p->pw_gid;
/* in this case PRINT_REAL is the same */
}
if (argv[optind] == NULL) {
if (flags & PRINT_REAL) {
uid = getuid();
gid = getgid();
if(flags & (JUST_GROUP | JUST_USER)) {
/* JUST_GROUP and JUST_USER are mutually exclusive */
if(flags & NAME_NOT_NUMBER) {
/* my_getpwuid and my_getgrgid exit on failure so puts cannot segfault */
puts((flags & JUST_USER) ? my_getpwuid(NULL, uid, -1 ) : my_getgrgid(NULL, gid, -1 ));
} else {
uid = geteuid();
gid = getegid();
bb_printf("%u\n",(flags & JUST_USER) ? uid : gid);
}
my_getpwuid(user, uid);
} else {
safe_strncpy(user, argv[optind], sizeof(user));
gid = my_getpwnamegid(user);
/* exit */
bb_fflush_stdout_and_exit(EXIT_SUCCESS);
}
my_getgrgid(group, gid);
pwnam=my_getpwnam(user);
grnam=my_getgrnam(group);
if (flags & (JUST_GROUP | JUST_USER)) {
char *s = group;
if (flags & JUST_USER) {
s = user;
grnam = pwnam;
}
if (flags & NAME_NOT_NUMBER) {
puts(s);
} else {
printf("%ld\n", grnam);
}
} else {
/* Print full info like GNU id */
/* my_getpwuid doesn't exit on failure here */
status=printf_full(uid, my_getpwuid(NULL, uid, 0), 'u');
putchar(' ');
/* my_getgrgid doesn't exit on failure here */
status|=printf_full(gid, my_getgrgid(NULL, gid, 0), 'g');
#ifdef CONFIG_SELINUX
printf("uid=%ld(%s) gid=%ld(%s)", pwnam, user, grnam, group);
if(is_flask_enabled_flag)
{
security_id_t mysid = getsecsid();
char context[80];
int len = sizeof(context);
context[0] = '\0';
if(security_sid_to_context(mysid, context, &len))
strcpy(context, "unknown");
printf(" context=%s\n", context);
}
else
printf("\n");
#else
printf("uid=%ld(%s) gid=%ld(%s)\n", pwnam, user, grnam, group);
#endif
if(is_flask_enabled_flag) {
security_id_t mysid = getsecsid();
char context[80];
int len = sizeof(context);
context[0] = '\0';
if(security_sid_to_context(mysid, context, &len))
strcpy(context, "unknown");
bb_printf(" context=%s", context);
}
bb_fflush_stdout_and_exit(0);
#endif
putchar('\n');
bb_fflush_stdout_and_exit(status);
}
/* END CODE */
/*
Local Variables:
c-file-style: "linux"
c-basic-offset: 4
tab-width: 4
End:
*/
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003 by Glenn McGrath <bug1@optushome.com.au>
* Copyright (C) 2003 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
+8 -5
View File
@@ -17,13 +17,16 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
TOPDIR:= ../../
top_srcdir=../..
top_builddir=../..
srcdir=$(top_srcdir)/coreutils/libcoreutils
LIBCOREUTILS_DIR:=./
include $(TOPDIR).config
include $(TOPDIR)Rules.mak
include Makefile.in
include $(top_builddir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
-include $(TOPDIR).depend
-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
+6 -1
View File
@@ -19,8 +19,9 @@
LIBCOREUTILS_AR:=libcoreutils.a
ifndef $(LIBCOREUTILS_DIR)
LIBCOREUTILS_DIR:=$(TOPDIR)coreutils/libcoreutils/
LIBCOREUTILS_DIR:=$(top_builddir)/coreutils/libcoreutils/
endif
srcdir=$(top_srcdir)/coreutils/libcoreutils
LIBCOREUTILS_SRC:= cp_mv_stat.c getopt_mk_fifo_nod.c xgetoptfile_sort_uniq.c
@@ -30,3 +31,7 @@ libraries-y+=$(LIBCOREUTILS_DIR)$(LIBCOREUTILS_AR)
$(LIBCOREUTILS_DIR)$(LIBCOREUTILS_AR): $(LIBCOREUTILS_OBJS)
$(AR) -ro $@ $(LIBCOREUTILS_OBJS)
$(LIBCOREUTILS_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+1 -1
View File
@@ -30,7 +30,7 @@
* is _not_ the same. Erik apparently made this change almost 3 years
* ago to avoid failing when no utmp was available. However, the
* correct course of action wrt SUSv3 for a failing getlogin() is
* a dianostic message and an error return.
* a diagnostic message and an error return.
*/
#include <stdio.h>
+6 -10
View File
@@ -61,6 +61,7 @@ enum {
#include <signal.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <sys/sysmacros.h> /* major() and minor() */
#include "busybox.h"
#ifdef CONFIG_SELINUX
#include <fs_secure.h>
@@ -72,11 +73,6 @@ enum {
#include <time.h>
#endif
#ifndef MAJOR
#define MAJOR(dev) (((dev)>>8)&0xff)
#define MINOR(dev) ((dev)&0xff)
#endif
/* what is the overall style of the listing */
#define STYLE_AUTO (0)
#define STYLE_COLUMNS (1U<<21) /* fill columns */
@@ -687,9 +683,9 @@ static int list_single(struct dnode *dn)
break;
case LIST_ID_NAME:
#ifdef CONFIG_FEATURE_LS_USERNAME
my_getpwuid(scratch, dn->dstat.st_uid);
my_getpwuid(scratch, dn->dstat.st_uid, sizeof(scratch));
printf("%-8.8s ", scratch);
my_getgrgid(scratch, dn->dstat.st_gid);
my_getgrgid(scratch, dn->dstat.st_gid, sizeof(scratch));
printf("%-8.8s", scratch);
column += 17;
break;
@@ -700,8 +696,8 @@ static int list_single(struct dnode *dn)
case LIST_SIZE:
case LIST_DEV:
if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) {
column += printf("%4d, %3d ", (int) MAJOR(dn->dstat.st_rdev),
(int) MINOR(dn->dstat.st_rdev));
column += printf("%4d, %3d ", (int) major(dn->dstat.st_rdev),
(int) minor(dn->dstat.st_rdev));
} else {
#ifdef CONFIG_FEATURE_HUMAN_READABLE
if (all_fmt & LS_DISP_HR) {
@@ -878,7 +874,7 @@ static const char ls_options[]="Cadil1gnsxAk" \
LS_STR_SELINUX \
LS_STR_AUTOWIDTH;
#define LIST_MASK_TRIGGER LIST_SHORT
#define LIST_MASK_TRIGGER 0
#define STYLE_MASK_TRIGGER STYLE_MASK
#define SORT_MASK_TRIGGER SORT_MASK
#define DISP_MASK_TRIGGER DISP_ROWS
+1 -1
View File
@@ -32,7 +32,7 @@
#define FLAG_CHECK 2
#define FLAG_WARN 4
/* This might be usefull elsewhere */
/* This might be useful elsewhere */
static unsigned char *hash_bin_to_hex(unsigned char *hash_value,
unsigned char hash_length)
{
+5 -5
View File
@@ -155,13 +155,13 @@ static const char * const add_strings[] = {
"4/4 \" %011o \" \"\\n\"", /* O */
};
static const signed char od_opts[] = "aBbcDdeFfHhIiLlOovXx";
static const signed char od_opts[] = "aBbcDdeFfHhIiLlOoXxv";
static const signed char od_o2si[] = {
0, 1, 2, 3, 5,
4, 6, 6, 7, 8,
9, 0xa, 0xb, 0xa, 0xa,
0xb, 1, -1, 8, 9,
0xb, 1, 8, 9,
};
int od_main(int argc, char **argv)
@@ -173,7 +173,9 @@ int od_main(int argc, char **argv)
bb_dump_length = -1;
while ((ch = getopt(argc, argv, od_opts)) > 0) {
if (((p = strchr(od_opts, ch)) != NULL) && (*p >= 0)) {
if (ch == 'v') {
bb_dump_vflag = ALL;
} else if (((p = strchr(od_opts, ch)) != NULL) && (*p >= 0)) {
if (first) {
first = 0;
bb_dump_add("\"%07.7_Ao\n\"");
@@ -182,8 +184,6 @@ int od_main(int argc, char **argv)
bb_dump_add("\" \"");
}
bb_dump_add(add_strings[od_o2si[(int)(p-od_opts)]]);
} else if (ch == 'v') {
bb_dump_vflag = ALL;
} else { /* P, p, s, w, or other unhandled */
bb_show_usage();
}
+21 -133
View File
@@ -58,68 +58,19 @@
#include <assert.h>
#include "busybox.h"
#ifndef S_IFMT
static const int S_IFMT = 0170000;
#endif
#if !defined(S_ISBLK) && defined(S_IFBLK)
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#endif
#if !defined(S_ISCHR) && defined(S_IFCHR)
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#endif
#if !defined(S_ISDIR) && defined(S_IFDIR)
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
#if !defined(S_ISREG) && defined(S_IFREG)
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
#if !defined(S_ISFIFO) && defined(S_IFIFO)
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#endif
#if !defined(S_ISLNK) && defined(S_IFLNK)
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
#endif
#if !defined(S_ISSOCK) && defined(S_IFSOCK)
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
#endif
#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
#endif
#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
#endif
#define IN_CTYPE_DOMAIN(c) 1
#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c))
#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
#define ISDIGIT(c) (((unsigned char) (c)) - '0' <= 9)
#define isodigit(c) ((c) >= '0' && (c) <= '7')
#define hextobin(c) ((c)>='a'&&(c)<='f' ? (c)-'a'+10 : (c)>='A'&&(c)<='F' ? (c)-'A'+10 : (c)-'0')
#define octtobin(c) ((c) - '0')
static double xstrtod __P((char *s));
static int print_esc __P((char *escstart));
static int print_formatted __P((char *format, int argc, char **argv));
static long xstrtol __P((char *s));
static unsigned long xstrtoul __P((char *s));
static void print_esc_string __P((char *str));
static int print_formatted __P((char *format, int argc, char **argv));
static void print_direc __P( (char *start, size_t length,
int field_width, int precision, char *argument));
static void print_esc_char __P((int c));
static void print_esc_string __P((char *str));
/* The value to return to the calling program. */
static int exit_status;
int printf_main(int argc, char **argv)
{
char *format;
int args_used;
exit_status = 0;
if (argc <= 1 || **(argv + 1) == '-') {
bb_show_usage();
}
@@ -140,7 +91,7 @@ int printf_main(int argc, char **argv)
fprintf(stderr, "excess args ignored");
*/
return(exit_status);
return EXIT_SUCCESS;
}
/* Print the text in FORMAT, using ARGV (with ARGC elements) for
@@ -188,7 +139,7 @@ static int print_formatted(char *format, int argc, char **argv)
} else
field_width = 0;
} else
while (ISDIGIT(*f)) {
while (isdigit(*f)) {
++f;
++direc_length;
}
@@ -205,7 +156,7 @@ static int print_formatted(char *format, int argc, char **argv)
} else
precision = 0;
} else
while (ISDIGIT(*f)) {
while (isdigit(*f)) {
++f;
++direc_length;
}
@@ -230,7 +181,10 @@ static int print_formatted(char *format, int argc, char **argv)
break;
case '\\':
f += print_esc(f);
if (*++f == 'c')
exit(0);
putchar(bb_process_escape_sequence((const char **)&f));
f--;
break;
default:
@@ -241,84 +195,6 @@ static int print_formatted(char *format, int argc, char **argv)
return save_argc - argc;
}
/* Print a \ escape sequence starting at ESCSTART.
Return the number of characters in the escape sequence
besides the backslash. */
static int print_esc(char *escstart)
{
register char *p = escstart + 1;
int esc_value = 0; /* Value of \nnn escape. */
int esc_length; /* Length of \nnn escape. */
/* \0ooo and \xhhh escapes have maximum length of 3 chars. */
if (*p == 'x') {
for (esc_length = 0, ++p;
esc_length < 3 && ISXDIGIT(*p); ++esc_length, ++p)
esc_value = esc_value * 16 + hextobin(*p);
/* if (esc_length == 0)
fprintf(stderr, "missing hex in esc");
*/
putchar(esc_value);
} else if (*p == '0') {
for (esc_length = 0, ++p;
esc_length < 3 && isodigit(*p); ++esc_length, ++p)
esc_value = esc_value * 8 + octtobin(*p);
putchar(esc_value);
} else if (strchr("\"\\abcfnrtv", *p))
print_esc_char(*p++);
/* else
fprintf(stderr, "\\%c: invalid esc", *p);
*/
return p - escstart - 1;
}
/* Output a single-character \ escape. */
static void print_esc_char(int c)
{
switch (c) {
case 'a': /* Alert. */
putchar(7);
break;
case 'b': /* Backspace. */
putchar(8);
break;
case 'c': /* Cancel the rest of the output. */
exit(0);
break;
case 'f': /* Form feed. */
putchar(12);
break;
case 'n': /* New line. */
putchar(10);
break;
case 'r': /* Carriage return. */
putchar(13);
break;
case 't': /* Horizontal tab. */
putchar(9);
break;
case 'v': /* Vertical tab. */
putchar(11);
break;
default:
putchar(c);
break;
}
}
/* Print string STR, evaluating \ escapes. */
static void print_esc_string(char *str)
{
for (; *str; str++)
if (*str == '\\')
str += print_esc(str);
else
putchar(*str);
}
static void
print_direc(char *start, size_t length, int field_width, int precision,
char *argument)
@@ -426,3 +302,15 @@ static double xstrtod(char *arg)
return result;
}
static void print_esc_string(char *str)
{
for (; *str; str++) {
if (*str == '\\') {
str++;
putchar(bb_process_escape_sequence((const char **)&str));
} else {
putchar(*str);
}
}
}
+13 -6
View File
@@ -1,4 +1,7 @@
/* vi: set sw=4 ts=4: */
/*
* seq implementation for busybox
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
@@ -27,18 +30,22 @@ extern int seq_main(int argc, char **argv)
if (argc == 4) {
first = atof(argv[1]);
increment = atof(argv[2]);
}
else if (argc == 3) {
} else if (argc == 3) {
first = atof(argv[1]);
}
else if (argc != 2) {
} else if (argc != 2) {
bb_show_usage();
}
last = atof(argv[argc - 1]);
for (i = first; ((first <= last) ? (i <= last): (i >= last));i += increment) {
/* You should note that this is pos-5.0.91 semantics, -- FK. */
if ((first > last) && (increment > 0)) {
return EXIT_SUCCESS;
}
for (i = first; ((first <= last) ? (i <= last) : (i >= last));
i += increment) {
printf("%g\n", i);
}
return(EXIT_SUCCESS);
return EXIT_SUCCESS;
}
+1
View File
@@ -980,6 +980,7 @@ set_window_size(int rows, int cols, int fd)
if ((ioctl(fd, TIOCSWINSZ, (char *) &win) != 0)
|| (ioctl(fd, TIOCSSIZE, (char *) &ttysz) != 0)) {
perror_on_device("%s");
}
return;
}
# endif
+1
View File
@@ -228,6 +228,7 @@ int tail_main(int argc, char **argv)
buf = tailbuf;
taillen = 0;
seen = 1;
newline = 0;
while ((nread = tail_read(fds[i], buf, tailbufsize-taillen)) > 0) {
if (from_top) {
+6 -2
View File
@@ -38,7 +38,7 @@ int tee_main(int argc, char **argv)
int flags;
int retval = EXIT_SUCCESS;
#ifdef CONFIG_FEATURE_TEE_USE_BLOCK_IO
size_t c;
ssize_t c;
RESERVE_CONFIG_BUFFER(buf, BUFSIZ);
#else
int c;
@@ -78,12 +78,16 @@ int tee_main(int argc, char **argv)
*p = NULL; /* Store the sentinal value. */
#ifdef CONFIG_FEATURE_TEE_USE_BLOCK_IO
while ((c = fread(buf, 1, BUFSIZ, stdin)) != 0) {
while ((c = safe_read(STDIN_FILENO, buf, BUFSIZ)) > 0) {
for (p=files ; *p ; p++) {
fwrite(buf, 1, c, *p);
}
}
if (c < 0) { /* Make sure read errors are signaled. */
retval = EXIT_FAILURE;
}
#ifdef CONFIG_FEATURE_CLEAN_UP
RELEASE_CONFIG_BUFFER(buf);
#endif
+28 -14
View File
@@ -155,19 +155,25 @@ static const struct t_op {
0, 0, 0}
};
#ifdef CONFIG_FEATURE_TEST_64
typedef int64_t arith_t;
#else
typedef int arith_t;
#endif
static char **t_wp;
static struct t_op const *t_wp_op;
static gid_t *group_array = NULL;
static int ngroups;
static enum token t_lex(char *s);
static int oexpr(enum token n);
static int aexpr(enum token n);
static int nexpr(enum token n);
static arith_t oexpr(enum token n);
static arith_t aexpr(enum token n);
static arith_t nexpr(enum token n);
static int binop(void);
static int primary(enum token n);
static arith_t primary(enum token n);
static int filstat(char *nm, enum token mode);
static int getn(const char *s);
static arith_t getn(const char *s);
static int newerf(const char *f1, const char *f2);
static int olderf(const char *f1, const char *f2);
static int equalf(const char *f1, const char *f2);
@@ -232,9 +238,9 @@ static void syntax(const char *op, const char *msg)
}
}
static int oexpr(enum token n)
static arith_t oexpr(enum token n)
{
int res;
arith_t res;
res = aexpr(n);
if (t_lex(*++t_wp) == BOR) {
@@ -244,9 +250,9 @@ static int oexpr(enum token n)
return res;
}
static int aexpr(enum token n)
static arith_t aexpr(enum token n)
{
int res;
arith_t res;
res = nexpr(n);
if (t_lex(*++t_wp) == BAND)
@@ -255,16 +261,16 @@ static int aexpr(enum token n)
return res;
}
static int nexpr(enum token n)
static arith_t nexpr(enum token n)
{
if (n == UNOT)
return !nexpr(t_lex(*++t_wp));
return primary(n);
}
static int primary(enum token n)
static arith_t primary(enum token n)
{
int res;
arith_t res;
if (n == EOI) {
syntax(NULL, "argument expected");
@@ -441,13 +447,21 @@ static enum token t_lex(char *s)
}
/* atoi with error detection */
static int getn(const char *s)
static arith_t getn(const char *s)
{
char *p;
#ifdef CONFIG_FEATURE_TEST_64
long long r;
#else
long r;
#endif
errno = 0;
#ifdef CONFIG_FEATURE_TEST_64
r = strtoll(s, &p, 10);
#else
r = strtol(s, &p, 10);
#endif
if (errno != 0)
bb_error_msg_and_die("%s: out of range", s);
@@ -456,7 +470,7 @@ static int getn(const char *s)
if (*(bb_skip_whitespace(p)))
bb_error_msg_and_die("%s: bad number", s);
return (int) r;
return r;
}
static int newerf(const char *f1, const char *f2)
+1 -1
View File
@@ -36,7 +36,7 @@ static const char uniq_opts[] = "f:s:cdu\0\7\3\5\1\2\4";
int uniq_main(int argc, char **argv)
{
FILE *in, *out;
/* Note: Ignore the warning about dups and e0 possibly being uninitialized.
/* Note: Ignore the warning about dups and e0 being used uninitialized.
* They will be initialized on the fist pass of the loop (since s0 is NULL). */
unsigned long dups, skip_fields, skip_chars, i;
const char *s0, *e0, *s1, *e1, *input_filename;
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* GPLv2
* Copyright 2003, Glenn McGrath <bug1@optushome.com.au>
* Copyright 2003, 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 version 2 as published
+3 -9
View File
@@ -29,16 +29,10 @@
extern int whoami_main(int argc, char **argv)
{
char user[9];
uid_t uid;
if (argc > 1)
bb_show_usage();
uid = geteuid();
if (my_getpwuid(user, uid)) {
puts(user);
bb_fflush_stdout_and_exit(EXIT_SUCCESS);
}
bb_error_msg_and_die("cannot find username for UID %u", (unsigned) uid);
puts(my_getpwuid(NULL, geteuid(), -1));
/* exits on error */
bb_fflush_stdout_and_exit(EXIT_SUCCESS);
}
+7 -5
View File
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
TOPDIR:= ../
top_srcdir=..
top_builddir=..
srcdir=$(top_srcdir)/debianutils
DEBIANUTILS_DIR:=./
include $(TOPDIR).config
include $(TOPDIR)Rules.mak
include Makefile.in
include $(top_builddir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
-include $(TOPDIR).depend
-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
+5 -2
View File
@@ -19,9 +19,9 @@
DEBIANUTILS_AR:=debianutils.a
ifndef $(DEBIANUTILS_DIR)
DEBIANUTILS_DIR:=$(TOPDIR)debianutils/
DEBIANUTILS_DIR:=$(top_builddir)/debianutils/
endif
srcdir=$(top_srcdir)/debianutils
DEBIANUTILS-y:=
DEBIANUTILS-$(CONFIG_MKTEMP) += mktemp.o
@@ -36,3 +36,6 @@ libraries-y+=$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR)
$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR): $(patsubst %,$(DEBIANUTILS_DIR)%, $(DEBIANUTILS-y))
$(AR) -ro $@ $(patsubst %,$(DEBIANUTILS_DIR)%, $(DEBIANUTILS-y))
$(DEBIANUTILS_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+324
View File
@@ -0,0 +1,324 @@
<!--#include file="header.html" -->
<h3>Frequently Asked Questions</h3>
This is a collection of some of the more frequently asked questions
about BusyBox. Some of the questions even have answers. If you
have additions to this FAQ document, we would love to add them,
<ol>
<li><a href="#kernel">Which Linux kernel versions are supported?</a>
<li><a href="#arch">Which architectures does BusyBox run on?</a>
<li><a href="#libc">Which C libraries are supported?</a>
<li><a href="#commercial">Can I include BusyBox as part of the software on my device?</a>
<li><a href="#bugs">I think I found a bug in BusyBox! What should I do?!</a>
<li><a href="#job_control">Why do I keep getting "sh: can't access tty; job control
turned off" errors? Why doesn't Control-C work within my shell?</a>
<li><a href="#demanding">I demand that you to add &lt;favorite feature&gt; right now! How come
you don't answer all my questions on the mailing list instantly? I demand
that you help me with all of my problems <em>Right Now</em>!</a>
<li><a href="#getting_started">How can I get started using BusyBox?</a>
<li><a href="#helpme">I need help with BusyBox! What should I do?</a>
<li><a href="#contracts">I need you to add &lt;favorite feature&gt;! Are the BusyBox developers willing to
be paid in order to fix bugs or add in &lt;favorite feature&gt;? Are you willing to provide
support contracts?</a>
<li><a href="#support">I think you guys are great and I want to help support your work!</a>
</ol>
<hr />
<p>
<h2><a name="kernel">Which Linux kernel versions are supported?</a></h2>
<p>
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).
<hr />
<p>
<h2><a name="arch">Which architectures does BusyBox run on?</a></h2>
<p>
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.
With 2.6.x kernels, module loading support should work on all architectures.
<hr />
<p>
<h2><a name="libc">Which C libraries are supported?</a></h2>
<p>
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. If you require a small C
library, you should probably use uClibc.
<hr />
<p>
<h2><a name="commercial">Can I include BusyBox as part of the software on my device?</h2>
Yes. As long as you <a href="http://busybox.net/license.html">fully comply
with the generous terms of the GPL BusyBox license</a> you can ship BusyBox
as part of the software on your device.
<a href="#support">Please consider sharing some of the money you make.</a>
<hr />
<p>
<h2><a name="bugs">I think I found a bug in BusyBox! What should I do?</h2>
<p>
If you find a problem with BusyBox, please submit a detailed bug report to
the BusyBox mailing list at <a href="mailto:busybox@mail.busybox.net">
busybox@mail.busybox.net</a>. Please do not send private email to Erik
(the maintainer of BusyBox) asking for private help unless you are planning
on paying for consulting services. When we answer questions on the BusyBox
mailing list, it helps everyone, while private answers help only you...
<p>
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:
<pre>
To: busybox@mail.busybox.net
From: diligent@testing.linux.org
Subject: /bin/date doesn't work
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.27 on a x86 system,
and the latest uClibc from CVS. Thanks for the wonderful program!
-Diligent
</pre>
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 proper detail may never be fixed... Thanks for understanding.
<hr />
<p>
<h2><a name="job_control">Why do I keep getting "sh: can't access tty; job control
turned off" errors? Why doesn't Control-C work within my shell?</a></h2>
<p>
Job control will be turned off since your shell can not obtain a controlling
terminal. This typically happens when you run your shell on /dev/console.
The kernel will not provide a controlling terminal on the /dev/console
device. Your should run your shell on a normal tty such as tty1 or ttyS0
and everything will work perfectly. If you <em>REALLY</em> want your shell
to run on /dev/console, then you can hack your kernel (if you are into that
sortof thing) by changing drivers/char/tty_io.c to change the lines where
it sets "noctty = 1;" to instead set it to "0". I recommend you instead
run your shell on a real console...
<hr />
<p>
<h2><a name="getting_started">How can I get started using BusyBox?</a></h2>
<p>
An easy method to build your own basic BusyBox based system, is to
follow these simple steps:
<ul>
<li> Point your web browser <a href="/cgi-bin/cvsweb/buildroot/">here</a>
<li> Click on "Download tarball"
<li> Unpack the tarball on your Linux system somewhere
<li> run 'make' and configure things to taste.
<li> run 'unset CC'. Some Linux systems (i.e. Gentoo) set 'CC'
in the system environment which messes up cross compiles.
<li> run 'make'
<li> go have lunch, drink a pop, call a friend, play a video game, etc
till it finishes downloading software and compiling things.
<li> You should now have a shiny new BusyBox based system.
</ul>
<hr />
<p>
<h2><a name="demanding">I demand that you to add &lt;favorite feature&gt; right now! How come
you don't answer all my questions on the mailing list instantly? I demand
that you help me with all of my problems <em>Right Now</em>!</a></h2>
<p>
You have not paid us a single cent and yet you still have the product of
many years of our work. We are not your slaves! We work on BusyBox
because we find it useful and interesting. If you go off flaming us, we
will ignore you.
<hr />
<p>
<h2><a name="helpme">I need help with BusyBox! What should I do?</a></h2>
<p>
If you find that you need help with BusyBox, you can ask for help on the
BusyBox mailing list at busybox@mail.busybox.net. In addition to the BusyBox
mailing list, Erik (andersee), Manuel (mjn3) and others are known to hang out
on the uClibc IRC channel: #uclibc on irc.freenode.net.
<p>
<b>Please do not send private email to Erik, Manuel, or the other BusyBox
contributors asking for private help unless you are planning on paying for
consulting services.</b>
<p>
When we answer questions on the BusyBox mailing list, it helps everyone
since people with similar problems in the future will be able to get help
by searching the mailing list archives. Private help is reserved as a paid
service. If you need to use private communication, or if you are serious
about getting timely assistance with BusyBox, you should seriously consider
paying for consulting services.
<p>
<hr />
<p>
<h2><a name="contracts">I need you to add &lt;favorite feature&gt;! Are the BusyBox
developers willing to be paid in order to fix bugs or add in &lt;favorite feature&gt;?
Are you willing to provide support contracts?</a></h2>
<p>
Sure! Now you have our attention! What you should do is contact <a
href="mailto:andersen@codepoet.org">Erik Andersen</a> of <a
href="http://codepoet-consulting.com/">CodePoet Consulting</a> to bid
on your project. If Erik is too busy to personally add your feature, there
are many other active BusyBox contributors who will almost certainly be able
to help you out. Erik can contact them privatly, and may even let you to
post your request for services on the mailing list.
<hr />
<p>
<h2><a name="support">I think you guys are great and I want to help support your work!</a></h2>
<p>
Wow, that would be great! Erik personally pays for all the bandwidth, and
all servers used for busybox.net out of his own pocket. If you would like
to make a donation to help support BusyBox, and/or request features, you
can click here:
<!-- Begin PayPal Logo -->
<center>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="andersen@codepoet.org">
<input type="hidden" name="item_name" value="Support BusyBox">
<input type="hidden" name="image_url" value="http://codepoet-consulting.com/images/codepoet.png">
<input type="hidden" name="no_shipping" value="1">
<input type="image" src="images/donate.png" name="submit" alt="Make donation using PayPal">
</form>
</center>
<!-- End PayPal Logo -->
If you prefer to contact Erik directly to make a donation, donate hardware,
request support, etc, you can contact
<a href="http://codepoet-consulting.com/">CodePoet Consulting</a> here.
CodePoet Consulting can accept both Visa and MasterCard for those that do not
trust PayPal...
<hr />
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<!--#include file="footer.html" -->
+1 -1
View File
@@ -25,7 +25,7 @@ to you, but not store it).
<p>
Note that if you would prefer to keep your communications with me
private, you can encrypt your email using my
<a href="http://www.codepoet.org/~andersen/erik/gpg.asc">public key</a>.
<a href="http://www.codepoet.org/andersen/erik/gpg.asc">public key</a>.
<!--#include file="footer.html" -->
+1
View File
@@ -48,6 +48,7 @@
<br><a href="/lists.html">Mailing Lists</a>
<br><a href="/news.html">Latest News</a>
<br><a href="/download.html">Download</a>
<br><a href="/FAQ.html">FAQ</a>
<br><a href="/cvs_anon.html">Accessing CVS</a>
<br><a href="/cgi-bin/cvsweb/busybox/">Browse CVS</a>
<br><a href="/docs.html">Documentation</a>
+46 -23
View File
@@ -10,12 +10,32 @@ whatsoever, this page attempts to summarize what you should do to
ensure you do not accidentally violate the law.
<p>
<h3>Complying with the BusyBox license is easy and completely free.</h3>
U.S. and International Law protects copyright owners from the unauthorized
reproduction, adaptation, display, distribution, etc of copyright protected
works. Copyright violations (such as shipping BusyBox in a manner contrary to
its license) are subject to severe penalties. The courts can award up to
$150,000 per product shipped without even showing any actual loss by the
copyright holder. Criminal penalties are available for intentional acts
undertaken for purposes of "commercial advantage" or "private financial gain."
In addition, if it comes to my attention that you are violating the BusyBox
license, I will list you on the <a href="/shame.html">BusyBox Hall of Shame</a>
webpage.
<p>
Nobody wants that to happen. Do everyone a favor and don't break the law -- if
you use BusyBox, you <b>must comply with the BusyBox license</b>.
<p>
<h3>BusyBox is licensed under the GNU General Public License</h3>
BusyBox is licensed under the GNU General Public License , which
is generally just abbreviated simply as the GPL license, or
just the GPL. <a href="/products.html">Anyone thinking of shipping
is generally just abbreviated as the GPL license, or
just the GPL.
<p>
<a href="/products.html">Anyone thinking of shipping
BusyBox as part of a product</a> should be familiar with the
licensing terms under which they are allowed to use and
distribute BusyBox. You are advised to take a look over the
@@ -49,41 +69,43 @@ encrypt or obfuscate it. You are not required to provide full
source for all the closed source applications that happen to be
part of the system with BusyBox, though you can certainly do so
if you feel like it. But providing source for the GPL licensed
applications such as BusyBox is manditory.
applications such as BusyBox is mandatory.
<p>
<b>Accompanied by source</b> generally means you place the full
source code for all GPL'd products such as BusyBox on a driver CD
somewhere. Full source code includes the BusyBox ".config" file
used when your shipping BusyBox binary was compiled.
<b>Accompanied by source</b> generally means you distribute the full
source code for all GPL'd products including BusyBox along with your
product, such as by placing it somewhere on a driver CD. Full source
code includes the BusyBox ".config" file used when your shipping BusyBox
binary was compiled, and any and all modifications you made to the
BusyBox source code.
<p>
<b>A written offer</b> generally means that somewhere in the
docs for your product, you write something like
documentation for your product, you write something like
<blockquote>
The GPL source code contained in this product is available as a
free download from http://blah.blah.blah/
</blockquote>
Or you can offer source by writing
somewhere in the docs for your product something like
Alternatively, you can offer the source code by writing
somewhere in the documentation for your product something like
<blockquote>
If you would like a copy of the GPL source code in this product
on a CD, please send $9.99 to &lt;address&gt; for the costs of
preparing and mailing a CD to you.
If you would like a copy of the GPL source code contained in this
product shipped to you on CD, please send $9.99 to &lt;address&gt;
which covers the cost of preparing and mailing a CD to you.
</blockquote>
<p>
Keep in mind though that if you distribute GPL'd binaries online
(as is often done when supplying firmware updates), it is highly
recommended that you make the corresponding source available online
at the same place. Regardless, you <b>must</b> either make source
available online (i.e. <b>accompanied by source</b>) and/or inform
those downloading firmware updates of their right to obtain source
(i.e. <b>a written offer</b>). Failure to do so is a violation of
your licensing obligations.
Keep in mind though that if you distribute GPL'd binaries online (as is often
done when supplying firmware updates), it is <b>highly</b> recommended that you
make the corresponding source available online at the same place. Regardless,
if you distribute a binary copy of BusyBox online (such as part of a firmware
update) you <b>must</b> either make source available online (i.e.
<b>accompanied by source</b>) and/or inform those downloading firmware updates
of their right to obtain source (i.e. <b>a written offer</b>). Failure to do
so is a violation of your licensing obligations.
<p>
@@ -97,6 +119,7 @@ If you distribute any GPL'd binaries, you must also make source available
as discussed on this webpage.
<p>
<h3>A Good Example</h3>
These days, <a href="http://www.linksys.com/">Linksys</a> is
doing a good job at complying with the GPL, they get to be an
@@ -104,8 +127,8 @@ example of how to do things right. Please take a moment and
check out what they do with
<a href="http://www.linksys.com/download/firmware.asp?fwid=178">
distributing the firmware for their WRT54G Router.</a>
Following their example would be a fine way to ensure you have
fulfilled your licensing obligations.
Following their example would be a fine way to ensure that you
have also fulfilled your licensing obligations.
<!--#include file="footer.html" -->
+3
View File
@@ -7,12 +7,15 @@
BusyBox has a <a href="/lists/busybox/">mailing list</a> for discussion and
development. You can subscribe by visiting
<a href="http://codepoet.org/mailman/listinfo/busybox">this page</a>.
Only subscribers to the BusyBox mailing list are allowed to post
to this list.
<p>
There is also a mailing list for <a href="/lists/busybox-cvs/">active developers</a>
wishing to read the complete diff of each and every change to busybox -- not for the
faint of heart. Active developers can subscribe by visiting
<a href="http://codepoet.org/mailman/listinfo/busybox-cvs">this page</a>.
The CVS server is the only one permtted to post to this list.
<p>
+32 -63
View File
@@ -3,74 +3,43 @@
<ul>
<li><b>13 April 2004 -- BusyBox 1.0.0-pre10 released</b><p>
<li><b>13 October 2004 -- BusyBox 1.00 released</b><p>
Ok, I lied. It turns out that -pre9 will not be the final BusyBox
pre-release. With any luck however -pre10 will be, since I <b>really</b>
want to get BusyBox 1.0.0 released this week. As usual, please do not
bother to send in patches adding cool new features at this time. Only
bug-fix patches will be accepted. It would also be <b>very</b> helpful if
people could continue to review the BusyBox documentation and submit
improvements.
When you take a careful look at nearly every embedded Linux device or
software distribution shipping today, you will find a copy of BusyBox.
With countless routers, set top boxes, wireless access points, PDAs, and
who knows what else, the future for Linux and BusyBox on embedded devices
is looking very bright.
<p>
The <a href="downloads/Changelog">changelog</a> has all the details.
And as usual you can <a href="downloads">download busybox here</a>.
It is therefore with great satisfaction that I declare each and every
device already shipping with BusyBox is now officially out of date.
The highly anticipated release of BusyBox 1.00 has arrived!
<p>
Over three years in development, BusyBox 1.00 represents a tremendous
improvement over the old 0.60.x stable series. Now featuring a Linux
KernelConf based configuration system (as used by the Linux kernel),
Linux 2.6 kernel support, many many new applets, and the development
work and testing of thousands of people from around the world.
<p>
If you are already using BusyBox, you are strongly encouraged to upgrade to
BusyBox 1.00. If you are considering developing an embedded Linux device
or software distribution, you may wish to investigate if using BusyBox is
right for your application. If you need help getting started using
BusyBox, if you wish to donate to help cover expenses, or if you find a bug
and need help reporting it, you are invited to visit the <a
href="FAQ.html">BusyBox FAQ</a>.
<p>
As usual you can <a href="downloads">download busybox here</a>.
<p>Have Fun!
<p>
<p>
<li><b>6 April 2004 -- BusyBox 1.0.0-pre9 released</b><p>
Here goes the final BusyBox pre-release... This is your last chance for
bug fixes. With luck this will be released as BusyBox 1.0.0 later this
week. Please do not bother to send in patches adding cool new features at
this time. Only bug-fix patches will be accepted. It would also be
<b>very</b> helpful if people could help review the BusyBox documentation
and submit improvements. I've spent a lot of time updating the
documentation to make it better match reality, but I could really use some
assistance in checking that the features supported by the various applets
match the features listed in the documentation.
<p>
I had hoped to get this released a month ago, but
<a href="http://codepoet.org/gallery/baby_peter/img_1796">
another release on 1 March 2004</a> has kept me busy...
<p>
The <a href="downloads/Changelog">changelog</a> has all the details.
And as usual you can <a href="downloads">download busybox here</a>.
<p>Have Fun!
<p>
<p>
<li><b>23 February 2004 -- BusyBox 1.0.0-pre8 released</b><p>
Here goes yet another BusyBox pre-release... Please do not bother to send
in patches supplying new features at this time. Only bug-fix patches will
be accepted. If you have a cool new feature you would like to see
supported, or if you have an amazing new applet you would like to submit,
please wait and submit such things later. We really want to get a release
out we can all be proud of. We are still aiming to finish off the -pre
series in February and move on to the final 1.0.0 release... So if you
spot any bugs, now would be an excellent time to send in a fix to the
busybox mailing list. It would also be <b>very</b> helpful if people could
help review the BusyBox documentation and submit improvements. It would be
especially helpful if people could check that the features supported by the
various applets match the features listed in the documentation.
<p>
The <a href="downloads/Changelog">changelog</a> has all the details.
And as usual you can <a href="downloads">download busybox here</a>.
<p>Have Fun!
<p>
<p>
<li><b>Old News</b><p>
+136
View File
@@ -3,6 +3,142 @@
<ul>
<li><b>16 August 2004 -- BusyBox 1.0.0-rc3 released</b><p>
Here goes release candidate 3...
<p>
The <a href="downloads/Changelog">changelog</a> has all the details.
And as usual you can <a href="downloads">download busybox here</a>.
<p>Have Fun!
<p>
<li><b>26 July 2004 -- BusyBox 1.0.0-rc2 released</b><p>
Here goes release candidate 2...
<p>
The <a href="downloads/Changelog">changelog</a> has all the details.
And as usual you can <a href="downloads">download busybox here</a>.
<p>Have Fun!
<p>
<li><b>20 July 2004 -- BusyBox 1.0.0-rc1 released</b><p>
Here goes release candidate 1... This fixes all (most?) of the problems
that have turned up since -pre10. In particular, loading and unloading of
kernel modules with 2.6.x kernels should be working much better.
<p>
I <b>really</b> want to get BusyBox 1.0.0 released soon and I see no real
reason why the 1.0.0 release shouldn't happen with things pretty much as
is. BusyBox is in good shape at the moment, and it works nicely for
everything that I'm doing with it. And from the reports I've been getting,
it works nicely for what most everyone else is doing with it as well.
There will eventually be a 1.0.1 anyway, so we might as well get on with
it. No, BusyBox is not perfect. No piece of software ever is. And while
there is still plenty that can be done to improve things, most of that work
is waiting till we can get a solid 1.0.0 release out the door....
<p>
Please do not bother to send in patches adding cool new features at this
time. Only bug-fix patches will be accepted. If you have submitted a
bug-fixing patch to the busybox mailing list and no one has emailed you
explaining why your patch was rejected, it is safe to say that your patch
has been lost or forgotten. That happens sometimes. Please re-submit your
bug-fixing patch to the BusyBox mailing list, and be sure to put "[PATCH]"
at the beginning of the email subject line!
<p>
The <a href="downloads/Changelog">changelog</a> has all the details.
And as usual you can <a href="downloads">download busybox here</a>.
<p>Have Fun!
<p>
On a less happy note, My 92 year old grandmother (my dad's mom) passed away
yesterday (June 19th). The funeral will be Thursday in a little town about
2 hours south of my home. I've checked and there is absolutely no way I
could be back in time for the funeral if I attend <a
href="http://www.linuxsymposium.org/2004/">OLS</a> and give my presentation
as scheduled.
<p>
As such, it is with great reluctance and sadness that I have come
to the conclusion I will have to make my appologies and skip OLS
this year.
<p>
<p>
<li><b>13 April 2004 -- BusyBox 1.0.0-pre10 released</b><p>
Ok, I lied. It turns out that -pre9 will not be the final BusyBox
pre-release. With any luck however -pre10 will be, since I <b>really</b>
want to get BusyBox 1.0.0 released very soon. As usual, please do not
bother to send in patches adding cool new features at this time. Only
bug-fix patches will be accepted. It would also be <b>very</b> helpful if
people could continue to review the BusyBox documentation and submit
improvements.
<p>
The <a href="downloads/Changelog">changelog</a> has all the details.
And as usual you can <a href="downloads">download busybox here</a>.
<p>Have Fun!
<p>
<p>
<li><b>6 April 2004 -- BusyBox 1.0.0-pre9 released</b><p>
Here goes the final BusyBox pre-release... This is your last chance for
bug fixes. With luck this will be released as BusyBox 1.0.0 later this
week. Please do not bother to send in patches adding cool new features at
this time. Only bug-fix patches will be accepted. It would also be
<b>very</b> helpful if people could help review the BusyBox documentation
and submit improvements. I've spent a lot of time updating the
documentation to make it better match reality, but I could really use some
assistance in checking that the features supported by the various applets
match the features listed in the documentation.
<p>
I had hoped to get this released a month ago, but
<a href="http://codepoet.org/gallery/baby_peter/img_1796">
another release on 1 March 2004</a> has kept me busy...
<p>
The <a href="downloads/Changelog">changelog</a> has all the details.
And as usual you can <a href="downloads">download busybox here</a>.
<p>Have Fun!
<p>
<p>
<li><b>23 February 2004 -- BusyBox 1.0.0-pre8 released</b><p>
Here goes yet another BusyBox pre-release... Please do not bother to send
in patches supplying new features at this time. Only bug-fix patches will
be accepted. If you have a cool new feature you would like to see
supported, or if you have an amazing new applet you would like to submit,
please wait and submit such things later. We really want to get a release
out we can all be proud of. We are still aiming to finish off the -pre
series in February and move on to the final 1.0.0 release... So if you
spot any bugs, now would be an excellent time to send in a fix to the
busybox mailing list. It would also be <b>very</b> helpful if people could
help review the BusyBox documentation and submit improvements. It would be
especially helpful if people could check that the features supported by the
various applets match the features listed in the documentation.
<p>
The <a href="downloads/Changelog">changelog</a> has all the details.
And as usual you can <a href="downloads">download busybox here</a>.
<p>Have Fun!
<p>
<li><b>4 February 2004 -- BusyBox 1.0.0-pre7 released</b><p>
There was a bug in -pre6 that broke argument parsing for a
+29 -9
View File
@@ -26,7 +26,7 @@ Debian installer (boot floppies) project</a>
</li><li><a href="http://redhat.com/">Red Hat installer</a>
</li><li><a href=
"http://distro.ibiblio.org/pub/Linux/distributions/slackware/source/rootdsks/">
"http://distro.ibiblio.org/pub/Linux/distributions/slackware/slackware-current/source/rootdisks/">
Slackware Installer</a>
</li><li><a href="http://www.gentoo.org/">Gentoo Linux install/boot CDs</a>
@@ -71,17 +71,13 @@ nanoEngine</a>
</li><li><a href="http://www.ltsp.org/">Linux Terminal
Server Project</a>
</li><li><a href=
"http://www.devil-linux.org/">Devil-Linux</a>
</li><li><a href="http://www.devil-linux.org/">Devil-Linux</a>
</li><li><a href=
"http://dutnux.sourceforge.net/">DutNux</a>
</li><li><a href="http://dutnux.sourceforge.net/">DutNux</a>
</li><li><a href=
"http://www.microwerks.net/~hugo/mindi/">Mindi</a>
</li><li><a href="http://www.microwerks.net/~hugo/mindi/">Mindi</a>
</li><li><a href=
"http://www.tzi.de/~pharao90/ttylinux">ttylinux</a>
</li><li><a href="http://www.minimalinux.org/ttylinux/">ttylinux</a>
</li><li><a href="http://www.coyotelinux.com/">Coyote Linux</a>
@@ -93,6 +89,7 @@ Image</a>
</li><li><a href="http://tinfoilhat.cultists.net/">Tinfoil
Hat Linux</a>
</li><li><a href="http://sourceforge.net/projects/gp32linux/">gp32linux</a>
</li><li><a href="http://familiar.handhelds.org/">Familiar Linux</a><br>A linux distribution for handheld computers
</li><li><a href="http://rescuecd.sourceforge.net/">Timo's Rescue CD Set</a>
</li><li><a href="http://sf.net/projects/netstation/">Netstation</a>
@@ -136,7 +133,30 @@ Hat Linux</a>
</li><li><a href="http://www.buffalo-technology.com/webcontent/products/wireless/wbr-g54.htm">Buffalo WBR-G54 wireless router</a>
</li><li><a href="http://www.asus.com/products/communication/wireless/wl-300g/overview.htm">ASUS WL-300g Wireless LAN Access Point</a>
<br>with source<a href="http://www.asus.com.tw/support/download/item.aspx?ModelName=WL-300G">here</a>
</li><li><a href="http://catalog.belkin.com/IWCatProductPage.process?Merchant_Id=&Section_Id=201522&pcount=&Product_Id=136493">Belkin 54g Wireless DSL/Cable Gateway Router</a>
<br>with source<a href="http://web.belkin.com/support/gpl.asp">here</a>
<li><a href="http://www.acronis.com/products/partitionexpert/">Acronis PartitionExpert 2003</a>
<br>includes a heavily modified BusyBox v0.60.5 with built in
cardmgr, device detection, gpm, lspci, etc. Also includes udhcp,
uClibc 0.9.26, a heavily patched up linux kernel, etc. Source
can only be obtained <a href="http://www.acronis.com/files/gpl/linux.tar.bz2">here</a>
</li><li><a href="http://www.usr.com/">U.S. Robotics Sureconnect 4-port ADSL router</a><br>
with source <a href="http://www.usr.com/support/s-gpl-code.asp">here</a>
</li><li><a href="http://www.actiontec.com/products/broadband/54mbps_wireless_gateway_1p/index.html">
ActionTec GT701-WG Wireless Gateway/DSL Modem</a>
with source <a href="http://128.121.226.214/gtproducts/index.html">here</a>
</li><li><a href="http://smartlinux.sourceforge.net/">S.M.A.R.T. Linux</a>
</li><li><a href="http://www.dlink.com/">DLink - Model GSL-G604T, DSL-300T, and possibly other models</a>
with source <a href="ftp://ftp.dlink.co.uk/dsl_routers_modems/">here,</a>
with source <a href="ftp://ftp.dlink.de/dsl-products/">and here,</a>
and quite possibly other places as well. You may need to dig down a bit
to find the source, but it does seem to be there.
</li><li><a href="http://www.siemens-mobile.de/cds/frontdoor/0,2241,de_de_0_42931_rArNrNrNrN,00.html">Siemens SE515 DSL router</a>
with source <a href="http://now-portal.c-lab.de/projects/gigaset/">here, I think...</a>
with some details <a href="http://heinz.hippenstiel.org/familie/hp/hobby/gigaset_se515dsl.html">here.</a>
</li><li><a href="http://frwt.stim.ru/">Free Remote Windows Terminal</a>
</li>
</ul>
+6 -6
View File
@@ -13,7 +13,7 @@ font-family: monospace; font-size: smaller;" width="100">
$ ./busybox
BusyBox v1.00 (2004.04.06-14:56+0000) multi-call binary
BusyBox v1.00 (2004.10.13-04:49+0000) multi-call binary
Usage: busybox [function] [arguments]...
or: [function] [arguments]...
@@ -33,11 +33,11 @@ Currently defined functions:
fgrep, find, fold, free, freeramdisk, fsck.minix, ftpget, ftpput, getopt,
getty, grep, gunzip, gzip, halt, hdparm, head, hexdump, hostid, hostname,
httpd, hush, hwclock, id, ifconfig, ifdown, ifup, inetd, init, insmod,
install, ip, ipcalc, iplink, iproute, iptunnel, kill, killall, klogd, lash,
last, length, linuxrc, ln, loadfont, loadkmap, logger, login, logname,
logread, losetup, ls, lsmod, makedevs, md5sum, mesg, mkdir, mkfifo,
mkfs.minix, mknod, mkswap, mktemp, modprobe, more, mount, msh, mt, mv,
nameif, nc, netstat, nslookup, od, openvt, passwd, patch, pidof, ping,
install, ip, ipaddr, ipcalc, iplink, iproute, iptunnel, kill, killall,
klogd, lash, last, length, linuxrc, ln, loadfont, loadkmap, logger, login,
logname, logread, losetup, ls, lsmod, makedevs, md5sum, mesg, mkdir,
mkfifo, mkfs.minix, mknod, mkswap, mktemp, modprobe, more, mount, msh, mt,
mv, nameif, nc, netstat, nslookup, od, openvt, passwd, patch, pidof, ping,
ping6, pipe_progress, pivot_root, poweroff, printf, ps, pwd, rdate,
readlink, realpath, reboot, renice, reset, rm, rmdir, rmmod, route, rpm,
rpm2cpio, run-parts, rx, sed, seq, setkeycodes, sha1sum, sleep, sort,
+10 -13
View File
@@ -22,9 +22,13 @@ companies listed below should be ashamed of themselves. Furthermore, each
product listed here is subject to being legally ordered to cease and desist
distribution for violation of copyright law, and the distributor of each
product is subject to being sued for statutory copyright infringement damages
plus legal fees. Nobody wants to be sued, and <a
href="mailto:andersen@codepoet.org">Erik</a> certainly has better things to do
than sue people. But he will sue if forced to do so to maintain compliance.
of up to $150,000 per work plus legal fees. Nobody wants to be sued, and <a
href="mailto:andersen@codepoet.org">Erik</a> certainly would prefer to spend
his time doing better things than sue people. But he will sue if forced to
do so to maintain compliance.
<p>
Do everyone a favor and don't break the law -- if you use busybox, comply with
the busybox license by releasing the source code with your product.
@@ -34,17 +38,9 @@ the busybox license by releasing the source code with your product.
<li><a href="http://www.trittontechnologies.com/products.html">Tritton Technologies NAS120</a>
<br>see <a href="http://www.ussg.iu.edu/hypermail/linux/kernel/0404.0/1611.html">here for details</a>
<li><a href="http://www.acronis.com/products/partitionexpert/">Acronis PartitionExpert 2003</a>
<br>includes a heavily modified BusyBox v0.60.5 with no source
and no offer for source on their website. Some other Acronis
products have also been reported as being in violation.
<li><a href="http://www.macsense.com/product/homepod/">Macsense HomePod</a>
<br>with details
<a href="http://developer.gloolabs.com/modules.php?op=modload&name=Forums&file=viewtopic&topic=123&forum=7">here</a>
<li><a href="http://www.actiontec.com/products/broadband/54mbps_wireless_gateway_1p/index.html">ActionTec GT701-WG Wireless Gateway/DSL Modem</a>
<br>appears to be running BusyBox v0.61.pre, built Jan 09, 2004, but the accompanying
CD and documentation do not mention BusyBox, nor the GPL, and no source code is mentioned
or offered on their website.
<li><a href="http://www.cpx.com/products.asp?c=Wireless+Products">Compex Wireless Products</a>
<br>appears to be running v0.60.5 with Linux version 2.4.20-uc0 on ColdFire,
but no source code is mentioned or offered.
@@ -55,8 +51,6 @@ the busybox license by releasing the source code with your product.
<li><a href="http://www.trendware.com/products/TEW-410APB.htm">TRENDnet TEW-410APB</a>
</li><li><a href="http://www.hauppauge.com/Pages/products/data_mediamvp.html">Hauppauge Media MVP</a>
<br>Hauppauge contacted me on 16 Dec 2003, and claims to be working on resolving this problem.
</li><li><a href="http://catalog.belkin.com/IWCatProductPage.process?Merchant_Id=&Section_Id=201522&pcount=&Product_Id=136493">Belkin 54g Wireless DSL/Cable Gateway Router</a>
</li><li><a href="http://www.usr.com/">U.S. Robotics Sureconnect 4-port ADSL router</a>
</li><li><a href="http://www.hitex.com/download/adescom/data/">TriCore</a>
</li><li><a href="http://www.allnet.de/">ALLNET 0186 wireless router</a>
</li><li><a href="http://www.dmmtv.com/">Dreambox DM7000S DVB Satellite Receiver</a>
@@ -71,6 +65,9 @@ the busybox license by releasing the source code with your product.
</li><li><a href="http://www.vinc.us/">Bravo DVD players using the Sigma Designs EM8500</a>
</li><li><a href="http://www.hb-direct.com/">H&B DX3110 Divx player based on Sigma Designs EM8500</a>
</li><li><a href="http://www.recospa.it/mdpro1/index.php">United *DVX4066 mpeg4 capable DVD players</a>
</li><li><a href="http://www.a-link.com/RR64AP.html">Avaks alink Roadrunner 64</a>
<br> Partial source available, based on source distributed under NDA from <a href="http://www.lsilogic.com/products/dsl_platform_solutions/hb_linuxr2_2.html"> LSILogic</a>. Why the NDA LSILogic, what are you hiding ?
<br>To verify the Avaks infrigment see my slashdot <a href="http://slashdot.org/~bug1/journal/">journal</a>.
</li><li>Undoubtedly there are others... Please report them so we can shame them (or if necessary sue them) into compliance.
</ul>
+5 -3
View File
@@ -156,9 +156,11 @@ John Lombardo <john@deltanet.com>
=for html <br>
Glenn McGrath <bug1@optushome.com.au>
Glenn McGrath <bug1@iinet.net.au>
ar, dpkg, dpkg-deb
Common unarchving code and unarchiving applets, ifupdown, ftpgetput,
nameif, sed, patch, fold, install, uudecode.
Various bugfixes, review and apply numerous patches.
=for html <br>
@@ -252,5 +254,5 @@ Tito Ragusa <farmatito@tiscali.it>
=cut
# $Id: busybox_footer.pod,v 1.16 2004/04/13 16:31:41 andersen Exp $
# $Id: busybox_footer.pod,v 1.18 2004/04/25 06:05:14 bug1 Exp $
+5 -5
View File
@@ -89,11 +89,11 @@ Currently defined functions include:
fgrep, find, fold, free, freeramdisk, fsck.minix, ftpget, ftpput, getopt,
getty, grep, gunzip, gzip, halt, hdparm, head, hexdump, hostid, hostname,
httpd, hush, hwclock, id, ifconfig, ifdown, ifup, inetd, init, insmod,
install, ip, ipcalc, iplink, iproute, iptunnel, kill, killall, klogd, lash,
last, length, linuxrc, ln, loadfont, loadkmap, logger, login, logname,
logread, losetup, ls, lsmod, makedevs, md5sum, mesg, mkdir, mkfifo,
mkfs.minix, mknod, mkswap, mktemp, modprobe, more, mount, msh, mt, mv,
nameif, nc, netstat, nslookup, od, openvt, passwd, patch, pidof, ping,
install, ip, ipaddr, ipcalc, iplink, iproute, iptunnel, kill, killall,
klogd, lash, last, length, linuxrc, ln, loadfont, loadkmap, logger, login,
logname, logread, losetup, ls, lsmod, makedevs, md5sum, mesg, mkdir,
mkfifo, mkfs.minix, mknod, mkswap, mktemp, modprobe, more, mount, msh, mt,
mv, nameif, nc, netstat, nslookup, od, openvt, passwd, patch, pidof, ping,
ping6, pipe_progress, pivot_root, poweroff, printf, ps, pwd, rdate,
readlink, realpath, reboot, renice, reset, rm, rmdir, rmmod, route, rpm,
rpm2cpio, run-parts, rx, sed, seq, setkeycodes, sha1sum, sleep, sort,
+2 -2
View File
@@ -73,7 +73,7 @@ Areas Where You Can Help
------------------------
Busybox can always use improvement! If you're looking for ways to help, there
there are a variety of areas where you could help.
are a variety of areas where you could help.
What Busybox Doesn't Need
@@ -214,7 +214,7 @@ These are dirty jobs, but somebody's gotta do 'em.
is very Perl-specific, but the advice given in here applies equally well to
C.
- C library funciton use audits: Verifying that functions are being used
- C library function use audits: Verifying that functions are being used
properly (called with the right args), replacing unsafe library functions
with safer versions, making sure return codes are being checked, etc.
+7 -5
View File
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
TOPDIR:= ../
top_srcdir=..
top_builddir=..
srcdir=$(top_srcdir)/editors
EDITOR_DIR:=./
include $(TOPDIR).config
include $(TOPDIR)Rules.mak
include Makefile.in
include $(top_builddir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
-include $(TOPDIR).depend
-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
+5 -1
View File
@@ -19,8 +19,9 @@
EDITOR_AR:=editors.a
ifndef $(EDITOR_DIR)
EDITOR_DIR:=$(TOPDIR)editors/
EDITOR_DIR:=$(top_builddir)/editors/
endif
srcdir=$(top_srcdir)/editors
EDITOR-y:=
EDITOR-$(CONFIG_AWK) += awk.o
@@ -42,3 +43,6 @@ endif
$(EDITOR_DIR)$(EDITOR_AR): $(patsubst %,$(EDITOR_DIR)%, $(EDITOR-y))
$(AR) -ro $@ $(patsubst %,$(EDITOR_DIR)%, $(EDITOR-y))
$(EDITOR_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+9 -3
View File
@@ -784,7 +784,7 @@ static int istrue(var *v) {
return (v->string && *(v->string)) ? 1 : 0;
}
/* temporary varables allocator. Last allocated should be first freed */
/* temporary variables allocator. Last allocated should be first freed */
static var *nvalloc(int n) {
nvblock *pb = NULL;
@@ -1211,6 +1211,7 @@ static void chain_group(void) {
if (c & TC_GRPSTART) {
while(next_token(TC_GRPSEQ | TC_GRPTERM) != TC_GRPTERM) {
if (t.tclass & TC_NEWLINE) continue;
rollback_token();
chain_group();
}
@@ -1386,7 +1387,7 @@ static node *mk_splitter(char *s, tsplitter *spl) {
}
/* use node as a regular expression. Supplied with node ptr and regex_t
* storage space. Return ptr to regex (if result points to preg, it shuold
* storage space. Return ptr to regex (if result points to preg, it should
* be later regfree'd manually
*/
static regex_t *as_regex(node *op, regex_t *preg) {
@@ -1553,7 +1554,7 @@ static void handle_special(var *v) {
memcpy(b+len, s, l);
len += l;
}
b[len] = '\0';
if (b) b[len] = '\0';
setvar_p(V[F0], b);
is_f0_split = TRUE;
@@ -2550,6 +2551,7 @@ static int awk_exit(int r) {
if (! exiting) {
exiting = TRUE;
nextrec = FALSE;
evaluate(endseq.first, &tv);
}
@@ -2669,8 +2671,12 @@ extern int awk_main(int argc, char **argv) {
for (envp=environ; *envp; envp++) {
s = bb_xstrdup(*envp);
s1 = strchr(s, '=');
if (!s1) {
goto keep_going;
}
*(s1++) = '\0';
setvar_u(findvar(iamarray(V[ENVIRON]), s), s1);
keep_going:
free(s);
}
+1 -1
View File
@@ -1,7 +1,7 @@
/* vi: set sw=4 ts=4: */
/*
* busybox patch applet to handle the unified diff format.
* Copyright (C) 2003 Glenn McGrath <bug1@optushome.com.au>
* Copyright (C) 2003 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
+16 -9
View File
@@ -5,7 +5,7 @@
* Copyright (C) 1999,2000,2001 by Lineo, inc. and Mark Whitley
* Copyright (C) 1999,2000,2001 by Mark Whitley <markw@codepoet.org>
* Copyright (C) 2002 Matt Kraai
* Copyright (C) 2003 by Glenn McGrath <bug1@optushome.com.au>
* Copyright (C) 2003 by Glenn McGrath <bug1@iinet.net.au>
* Copyright (C) 2003,2004 by Rob Landley <rob@landley.net>
*
* This program is free software; you can redistribute it and/or modify
@@ -112,7 +112,7 @@ typedef struct sed_cmd_s {
/* globals */
/* options */
static int be_quiet = 0, in_place=0;
static int be_quiet = 0, in_place=0, regex_type=0;
FILE *nonstdout;
char *outname;
@@ -210,7 +210,7 @@ static char *copy_parsing_slashn(const char *string, int len)
/*
* index_of_next_unescaped_regexp_delim - walks left to right through a string
* beginning at a specified index and returns the index of the next regular
* expression delimiter (typically a forward * slash ('/')) not preceeded by
* expression delimiter (typically a forward * slash ('/')) not preceded by
* a backslash ('\').
*/
static int index_of_next_unescaped_regexp_delim(const char delimiter,
@@ -298,7 +298,7 @@ static int get_address(char *my_str, int *linenum, regex_t ** regex)
temp=copy_parsing_slashn(pos,next);
*regex = (regex_t *) xmalloc(sizeof(regex_t));
xregcomp(*regex, temp, REG_NEWLINE);
xregcomp(*regex, temp, regex_type|REG_NEWLINE);
free(temp);
/* Move position to next character after last delimiter */
pos+=(next+1);
@@ -326,7 +326,7 @@ static int parse_file_cmd(sed_cmd_t * sed_cmd, const char *filecmdstr, char **re
static int parse_subst_cmd(sed_cmd_t * const sed_cmd, char *substr)
{
int cflags = 0;
int cflags = regex_type;
char *match;
int idx = 0;
@@ -1096,7 +1096,9 @@ static void add_cmd_block(char *cmdstr)
extern int sed_main(int argc, char **argv)
{
int opt, status = EXIT_SUCCESS;
int status = EXIT_SUCCESS;
int opt;
uint8_t getpat = 1;
#ifdef CONFIG_FEATURE_CLEAN_UP
/* destroy command strings on exit */
@@ -1113,17 +1115,21 @@ extern int sed_main(int argc, char **argv)
#endif
/* do normal option parsing */
while ((opt = getopt(argc, argv, "ine:f:")) > 0) {
while ((opt = getopt(argc, argv, "irne:f:")) > 0) {
switch (opt) {
case 'i':
in_place++;
atexit(cleanup_outname);
break;
case 'r':
regex_type|=REG_EXTENDED;
break;
case 'n':
be_quiet++;
break;
case 'e':
add_cmd_block(optarg);
getpat=0;
break;
case 'f':
{
@@ -1135,6 +1141,7 @@ extern int sed_main(int argc, char **argv)
while ((line = bb_get_chomped_line_from_file(cmdfile))
!= NULL) {
add_cmd(line);
getpat=0;
free(line);
}
bb_xprint_and_close_file(cmdfile);
@@ -1148,7 +1155,7 @@ extern int sed_main(int argc, char **argv)
/* if we didn't get a pattern from a -e and no command file was specified,
* argv[optind] should be the pattern. no pattern, no worky */
if (sed_cmd_head.next == NULL) {
if(getpat) {
if (argv[optind] == NULL)
bb_show_usage();
else
@@ -1189,7 +1196,7 @@ extern int sed_main(int argc, char **argv)
nonstdout=bb_wfopen(outname,"w");
/* Set permissions of output file */
fstat(fileno(file),&statbuf);
fchmod(fileno(file),statbuf.st_mode);
fchmod(fileno(nonstdout),statbuf.st_mode);
atexit(cleanup_outname);
}
process_file(file);
+10 -9
View File
@@ -19,7 +19,7 @@
*/
static const char vi_Version[] =
"$Id: vi.c,v 1.35 2004/03/31 11:12:51 andersen Exp $";
"$Id: vi.c,v 1.38 2004/08/19 19:15:06 andersen Exp $";
/*
* To compile for standalone use:
@@ -45,7 +45,7 @@ static const char vi_Version[] =
* An "ex" line oriented mode- maybe using "cmdedit"
*/
//---- Feature -------------- Bytes to immplement
//---- Feature -------------- Bytes to implement
#ifdef STANDALONE
#define vi_main main
#define CONFIG_FEATURE_VI_COLON // 4288
@@ -507,7 +507,6 @@ static void edit_file(Byte * fn)
#endif /* CONFIG_FEATURE_VI_DOT_CMD */
redraw(FALSE); // dont force every col re-draw
show_status_line();
fflush(stdout);
//------This is the main Vi cmd handling loop -----------------------
while (editing > 0) {
@@ -641,7 +640,7 @@ static Byte *get_address(Byte *p, int *b, int *e) // get two colon addrs, if pre
p = get_one_address(p, b);
while (isblnk(*p))
p++;
if (*p == ',') { // is there a address seperator
if (*p == ',') { // is there a address separator
p++;
while (isblnk(*p))
p++;
@@ -676,7 +675,7 @@ static void colon(Byte * buf)
Byte c, *orig_buf, *buf1, *q, *r;
Byte *fn, cmd[BUFSIZ], args[BUFSIZ];
int i, l, li, ch, st, b, e;
int useforce, forced;
int useforce = FALSE, forced = FALSE;
struct stat st_buf;
// :3154 // if (-e line 3154) goto it else stay put
@@ -693,12 +692,12 @@ static void colon(Byte * buf)
// :s/find/replace/ // substitute pattern "find" with "replace"
// :!<cmd> // run <cmd> then return
//
if (strlen((char *) buf) <= 0)
goto vc1;
if (*buf == ':')
buf++; // move past the ':'
forced = useforce = FALSE;
li = st = ch = i = 0;
b = e = -1;
q = text; // assume 1,$ for the range
@@ -1452,7 +1451,7 @@ static Byte *new_screen(int ro, int co)
screen = (Byte *) xmalloc(screensize);
// initialize the new screen. assume this will be a empty file.
screen_erase();
// non-existant text[] lines start with a tilde (~).
// non-existent text[] lines start with a tilde (~).
for (li = 1; li < ro - 1; li++) {
screen[(li * co) + 0] = '~';
}
@@ -2528,7 +2527,7 @@ static int file_write(Byte * fn, Byte * first, Byte * last)
//----- Terminal Drawing ---------------------------------------
// The terminal is made up of 'rows' line of 'columns' columns.
// classicly this would be 24 x 80.
// classically this would be 24 x 80.
// screen coordinates
// 0,0 ... 0,79
// 1,0 ... 1,79
@@ -2660,6 +2659,7 @@ static void show_status_line(void)
static int last_cksum;
int l, cnt, cksum;
edit_status();
cnt = strlen((char *) status_buffer);
for (cksum= l= 0; l < cnt; l++) { cksum += (int)(status_buffer[l]); }
// don't write the status line unless it changes
@@ -2670,6 +2670,7 @@ static void show_status_line(void)
clear_to_eol();
place_cursor(crow, ccol, FALSE); // put cursor back in correct place
}
fflush(stdout);
}
//----- format the status buffer, the bottom line of screen ------
@@ -3222,7 +3223,7 @@ key_cmd_mode:
case 'f': // f- forward to a user specified char
last_forward_char = get_one_char(); // get the search char
//
// dont seperate these two commands. 'f' depends on ';'
// dont separate these two commands. 'f' depends on ';'
//
//**** fall thru to ... 'i'
case ';': // ;- look at rest of line for last forward char
+2 -1
View File
@@ -15,9 +15,10 @@ then
do :
done
metric=0
for i in $router
do
/sbin/route add default gw $i dev $interface
/sbin/route add default gw $i dev $interface metric $((metric++))
done
fi
+2 -1
View File
@@ -15,9 +15,10 @@ then
do :
done
metric=0
for i in $router
do
/sbin/route add default gw $i dev $interface
/sbin/route add default gw $i dev $interface metric $((metric++))
done
fi
+2 -1
View File
@@ -22,8 +22,9 @@ case "$1" in
:
done
metric=0
for i in $router ; do
route add default gw $i dev $interface
route add default gw $i dev $interface metric $((metric++))
done
fi
+7
View File
@@ -114,3 +114,10 @@ option lease 864000 # 10 days of seconds
#opt ntpsrv
#opt tftp
#opt bootfile
# Static leases map
#static_lease 00:60:08:11:CE:4E 192.168.0.54
#static_lease 00:60:08:11:CE:3E 192.168.0.44
+7 -5
View File
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
TOPDIR:= ../
top_srcdir=..
top_builddir=..
srcdir=$(top_srcdir)/findutils
FINDUTILS_DIR:=./
include $(TOPDIR).config
include $(TOPDIR)Rules.mak
include Makefile.in
include $(top_builddir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
-include $(TOPDIR).depend
-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
+5 -1
View File
@@ -19,8 +19,9 @@
FINDUTILS_AR:=findutils.a
ifndef $(FINDUTILS_DIR)
FINDUTILS_DIR:=$(TOPDIR)findutils/
FINDUTILS_DIR:=$(top_builddir)/findutils/
endif
srcdir=$(top_srcdir)/findutils
FINDUTILS-y:=
FINDUTILS-$(CONFIG_FIND) += find.o
@@ -32,3 +33,6 @@ libraries-y+=$(FINDUTILS_DIR)$(FINDUTILS_AR)
$(FINDUTILS_DIR)$(FINDUTILS_AR): $(patsubst %,$(FINDUTILS_DIR)%, $(FINDUTILS-y))
$(AR) -ro $@ $(patsubst %,$(FINDUTILS_DIR)%, $(FINDUTILS-y))
$(FINDUTILS_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+36 -30
View File
@@ -20,8 +20,8 @@
*
*/
/*
* Jun 2003 by Vladimir Oleynik <dzo@simtreas.ru> -
* correction "-e pattern1 -e -e pattern2" logic and more optimizations.
* Apr 2004 by Vladimir Oleynik <dzo@simtreas.ru> -
* correction "-e pattern1 -e pattern2" logic and more optimizations.
*/
#include <stdio.h>
@@ -34,36 +34,38 @@
/* options */
#define GREP_OPTS "lnqvscFiHhe:f:"
#define GREP_OPT_l 1
#define GREP_OPTS "lnqvscFiHhe:f:L"
#define GREP_OPT_l (1<<0)
static char print_files_with_matches;
#define GREP_OPT_n 2
#define GREP_OPT_n (1<<1)
static char print_line_num;
#define GREP_OPT_q 4
#define GREP_OPT_q (1<<2)
static char be_quiet;
#define GREP_OPT_v 8
#define GREP_OPT_v (1<<3)
typedef char invert_search_t;
static invert_search_t invert_search;
#define GREP_OPT_s 16
#define GREP_OPT_s (1<<4)
static char suppress_err_msgs;
#define GREP_OPT_c 32
#define GREP_OPT_c (1<<5)
static char print_match_counts;
#define GREP_OPT_F 64
#define GREP_OPT_F (1<<6)
static char fgrep_flag;
#define GREP_OPT_i 128
#define GREP_OPT_H 256
#define GREP_OPT_h 512
#define GREP_OPT_e 1024
#define GREP_OPT_f 2048
#define GREP_OPT_i (1<<7)
#define GREP_OPT_H (1<<8)
#define GREP_OPT_h (1<<9)
#define GREP_OPT_e (1<<10)
#define GREP_OPT_f (1<<11)
#define GREP_OPT_L (1<<12)
static char print_files_without_matches;
#ifdef CONFIG_FEATURE_GREP_CONTEXT
#define GREP_OPT_CONTEXT "A:B:C"
#define GREP_OPT_A 4096
#define GREP_OPT_B 8192
#define GREP_OPT_C 16384
#define GREP_OPT_E 32768U
#define GREP_OPT_A (1<<13)
#define GREP_OPT_B (1<<14)
#define GREP_OPT_C (1<<15)
#define GREP_OPT_E (1<<16)
#else
#define GREP_OPT_CONTEXT ""
#define GREP_OPT_E 4096
#define GREP_OPT_E (1<<13)
#endif
#ifdef CONFIG_FEATURE_GREP_EGREP_ALIAS
# define OPT_EGREP "E"
@@ -89,7 +91,7 @@ static char *cur_file; /* the current file we are reading */
static void print_line(const char *line, int linenum, char decoration)
{
#ifdef CONFIG_FEATURE_GREP_CONTEXT
/* possibly print the little '--' seperator */
/* possibly print the little '--' separator */
if ((lines_before || lines_after) && last_line_printed &&
last_line_printed < linenum - 1) {
puts("--");
@@ -135,11 +137,9 @@ static int grep_file(FILE *file)
*/
regex_t regex;
xregcomp(&regex, pattern_ptr->data, reflags);
ret = regexec(&regex, line, 0, NULL, 0) == 0;
ret |= regexec(&regex, line, 0, NULL, 0) == 0;
regfree(&regex);
}
if (!ret)
break;
pattern_ptr = pattern_ptr->link;
} /* while (pattern_ptr) */
@@ -149,7 +149,7 @@ static int grep_file(FILE *file)
free(line);
/* if we found a match but were told to be quiet, stop here */
if (be_quiet)
if (be_quiet || print_files_without_matches)
return -1;
/* keep track of matches */
@@ -229,6 +229,11 @@ static int grep_file(FILE *file)
puts(cur_file);
}
/* grep -L: print just the filename, but only if we didn't grep the line in the file */
if (print_files_without_matches && nmatches == 0) {
puts(cur_file);
}
return nmatches;
}
@@ -244,9 +249,9 @@ static void load_regexes_from_file(llist_t *fopt)
fopt = cur->link;
free(cur);
f = bb_xfopen(ffile, "r");
while ((line = bb_get_chomped_line_from_file(f)) != NULL) {
pattern_head = llist_add_to(pattern_head, line);
}
while ((line = bb_get_chomped_line_from_file(f)) != NULL) {
pattern_head = llist_add_to(pattern_head, line);
}
}
}
@@ -256,7 +261,7 @@ extern int grep_main(int argc, char **argv)
FILE *file;
int matched;
unsigned long opt;
llist_t *fopt;
llist_t *fopt = NULL;
/* do normal option parsing */
#ifdef CONFIG_FEATURE_GREP_CONTEXT
@@ -292,7 +297,7 @@ extern int grep_main(int argc, char **argv)
bb_error_msg_and_die("invalid context length argument");
}
/* sanity checks after parse may be invalid numbers ;-) */
if ((opt & (GREP_OPT_c|GREP_OPT_q|GREP_OPT_l))) {
if ((opt & (GREP_OPT_c|GREP_OPT_q|GREP_OPT_l|GREP_OPT_L))) {
opt &= ~GREP_OPT_n;
lines_before = 0;
lines_after = 0;
@@ -307,6 +312,7 @@ extern int grep_main(int argc, char **argv)
#endif
print_files_with_matches = opt & GREP_OPT_l;
print_files_without_matches = (opt & GREP_OPT_L) != 0;
print_line_num = opt & GREP_OPT_n;
be_quiet = opt & GREP_OPT_q;
invert_search = (opt & GREP_OPT_v) != 0; /* 0 | 1 */
+1 -1
View File
@@ -5,7 +5,7 @@
* (C) 2002,2003 by Vladimir Oleynik <dzo@simtreas.ru>
*
* Special thanks
* - Mark Whitley and Glenn McGrath for stimul to rewrote :)
* - Mark Whitley and Glenn McGrath for stimulus to rewrite :)
* - Mike Rendell <michael@cs.mun.ca>
* and David MacKenzie <djm@gnu.ai.mit.edu>.
*
+1 -10
View File
@@ -341,7 +341,7 @@
APPLET(logger, logger_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
#endif
#ifdef CONFIG_LOGIN
APPLET(login, login_main, _BB_DIR_BIN, _BB_SUID_NEVER)
APPLET(login, login_main, _BB_DIR_BIN, _BB_SUID_ALWAYS)
#endif
#ifdef CONFIG_LOGNAME
APPLET(logname, logname_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
@@ -367,9 +367,6 @@
#ifdef CONFIG_MESG
APPLET(mesg, mesg_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
#endif
#ifdef CONFIG_MINIT
APPLET(minit, minit_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
#endif
#ifdef CONFIG_MKDIR
APPLET(mkdir, mkdir_main, _BB_DIR_BIN, _BB_SUID_NEVER)
#endif
@@ -400,9 +397,6 @@
#ifdef CONFIG_MSH
APPLET_NOUSAGE("msh", msh_main, _BB_DIR_BIN, _BB_SUID_NEVER)
#endif
#ifdef CONFIG_MSVC
APPLET(msvc, msvc_main, _BB_DIR_BIN, _BB_SUID_NEVER)
#endif
#ifdef CONFIG_MT
APPLET(mt, mt_main, _BB_DIR_BIN, _BB_SUID_NEVER)
#endif
@@ -433,9 +427,6 @@
#ifdef CONFIG_PATCH
APPLET(patch, patch_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
#endif
#ifdef CONFIG_PIDFILEHACK
APPLET(pidfilehack, pidfilehack_main, _BB_DIR_BIN, _BB_SUID_NEVER)
#endif
#ifdef CONFIG_PIDOF
APPLET(pidof, pidof_main, _BB_DIR_BIN, _BB_SUID_NEVER)
#endif
+95 -18
View File
@@ -1,39 +1,116 @@
#ifndef __CONFIG_GRP_H
#define __CONFIG_GRP_H
/* Copyright (C) 1991,92,95,96,97,98,99,2000,01 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/*
* POSIX Standard: 9.2.1 Group Database Access <grp.h>
*/
#if !defined CONFIG_USE_BB_PWD_GRP
#include <grp.h>
#else
#ifndef _GRP_H
#define _GRP_H 1
#include <sys/types.h>
#include <features.h>
#include <stdio.h>
/* The group structure */
/* The group structure. */
struct group
{
char *gr_name; /* Group name. */
char *gr_passwd; /* Password. */
gid_t gr_gid; /* Group ID. */
char **gr_mem; /* Member list. */
char *gr_name; /* Group name. */
char *gr_passwd; /* Password. */
gid_t gr_gid; /* Group ID. */
char **gr_mem; /* Member list. */
};
extern void setgrent __P ((void));
extern void endgrent __P ((void));
extern struct group * getgrent __P ((void));
extern struct group * getgrgid __P ((__const gid_t gid));
extern struct group * getgrnam __P ((__const char * name));
/* Rewind the group-file stream. */
extern void setgrent (void);
extern struct group * fgetgrent __P ((FILE * file));
/* Close the group-file stream. */
extern void endgrent (void);
extern int setgroups __P ((size_t n, __const gid_t * groups));
extern int initgroups __P ((__const char * user, gid_t gid));
/* Read an entry from the group-file stream, opening it if necessary. */
extern struct group *getgrent (void);
extern struct group * bb_getgrent __P ((int grp_fd));
/* Read a group entry from STREAM. */
extern struct group *fgetgrent (FILE *__stream);
#endif /* USE_SYSTEM_PWD_GRP */
#endif /* __CONFIG_GRP_H */
/* Write the given entry onto the given stream. */
extern int putgrent (__const struct group *__restrict __p,
FILE *__restrict __f);
/* Search for an entry with a matching group ID. */
extern struct group *getgrgid (gid_t __gid);
/* Search for an entry with a matching group name. */
extern struct group *getgrnam (__const char *__name);
/* Reentrant versions of some of the functions above.
PLEASE NOTE: the `getgrent_r' function is not (yet) standardized.
The interface may change in later versions of this library. But
the interface is designed following the principals used for the
other reentrant functions so the chances are good this is what the
POSIX people would choose. */
extern int getgrent_r (struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct group **__restrict __result);
/* Search for an entry with a matching group ID. */
extern int getgrgid_r (gid_t __gid, struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct group **__restrict __result);
/* Search for an entry with a matching group name. */
extern int getgrnam_r (__const char *__restrict __name,
struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct group **__restrict __result);
/* Read a group entry from STREAM. This function is not standardized
an probably never will. */
extern int fgetgrent_r (FILE *__restrict __stream,
struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct group **__restrict __result);
/* Set the group set for the current user to GROUPS (N of them). */
extern int setgroups (size_t __n, __const gid_t *__groups);
/* Store at most *NGROUPS members of the group set for USER into
*GROUPS. Also include GROUP. The actual number of groups found is
returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. */
extern int getgrouplist (__const char *__user, gid_t __group,
gid_t *__groups, int *__ngroups);
/* Initialize the group set for the current user
by reading the group database and using all groups
of which USER is a member. Also include GROUP. */
extern int initgroups (__const char *__user, gid_t __group);
#endif /* grp.h */
#endif
+5 -9
View File
@@ -134,7 +134,7 @@ extern void write_mtab(char* blockDevice, char* directory,
char* filesystemType, long flags, char* string_flags);
extern void erase_mtab(const char * name);
extern long *find_pid_by_name( const char* pidName);
extern char *find_real_root_device_name(const char* name);
extern char *find_real_root_device_name(void);
extern char *bb_get_line_from_file(FILE *file);
extern char *bb_get_chomped_line_from_file(FILE *file);
extern int bb_copyfd_size(int fd1, int fd2, const off_t size);
@@ -230,9 +230,10 @@ extern unsigned long bb_xparse_number(const char *numstr,
* increases target size and is often not needed embedded systems. */
extern long my_getpwnam(const char *name);
extern long my_getgrnam(const char *name);
extern char * my_getpwuid(char *name, long uid);
extern char * my_getgrgid(char *group, long gid);
extern long my_getpwnamegid(const char *name);
extern char * my_getug(char *buffer, char *idname, long id, int bufsize, char prefix);
extern char * my_getpwuid(char *name, long uid, int bufsize);
extern char * my_getgrgid(char *group, long gid, int bufsize);
extern char *bb_askpass(int timeout, const char * prompt);
extern int device_open(const char *device, int mode);
@@ -248,9 +249,6 @@ extern int vdprintf(int d, const char *format, va_list ap);
int nfsmount(const char *spec, const char *node, int *flags,
char **extra_opts, char **mount_opts, int running_bg);
void syslog_msg_with_name(const char *name, int facility, int pri, const char *msg);
void syslog_msg(int facility, int pri, const char *msg);
/* Include our own copy of struct sysinfo to avoid binary compatability
* problems with Linux 2.4, which changed things. Grumble, grumble. */
struct sysinfo {
@@ -288,8 +286,6 @@ char *concat_path_file(const char *path, const char *filename);
char *concat_subpath_file(const char *path, const char *filename);
char *last_char_is(const char *s, int c);
extern long arith (const char *startbuf, int *errcode);
int read_package_field(const char *package_buffer, char **field_name, char **field_value);
//#warning yuk!
char *fgets_str(FILE *file, const char *terminating_string);
+85 -20
View File
@@ -1,11 +1,33 @@
#ifndef __CONFIG_PWD_H
#define __CONFIG_PWD_H
/* Copyright (C) 1991,92,95,96,97,98,99,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/*
* POSIX Standard: 9.2.2 User Database Access <pwd.h>
*/
#if !defined CONFIG_USE_BB_PWD_GRP
#include <pwd.h>
#else
#ifndef _PWD_H
#define _PWD_H 1
#include <sys/types.h>
#include <features.h>
#include <stdio.h>
@@ -13,29 +35,72 @@
/* The passwd structure. */
struct passwd
{
char *pw_name; /* Username. */
char *pw_passwd; /* Password. */
uid_t pw_uid; /* User ID. */
gid_t pw_gid; /* Group ID. */
char *pw_gecos; /* Real name. */
char *pw_dir; /* Home directory. */
char *pw_shell; /* Shell program. */
char *pw_name; /* Username. */
char *pw_passwd; /* Password. */
uid_t pw_uid; /* User ID. */
gid_t pw_gid; /* Group ID. */
char *pw_gecos; /* Real name. */
char *pw_dir; /* Home directory. */
char *pw_shell; /* Shell program. */
};
extern void setpwent __P ((void));
extern void endpwent __P ((void));
extern struct passwd * getpwent __P ((void));
extern int putpwent __P ((__const struct passwd * __p, FILE * __f));
extern int getpw __P ((uid_t uid, char *buf));
/* Rewind the password-file stream. */
extern void setpwent (void);
extern struct passwd * fgetpwent __P ((FILE * file));
/* Close the password-file stream. */
extern void endpwent (void);
extern struct passwd * getpwuid __P ((__const uid_t));
extern struct passwd * getpwnam __P ((__const char *));
/* Read an entry from the password-file stream, opening it if necessary. */
extern struct passwd *getpwent (void);
extern struct passwd * __getpwent __P ((__const int passwd_fd));
/* Read an entry from STREAM. */
extern struct passwd *fgetpwent (FILE *__stream);
#endif /* USE_SYSTEM_PWD_GRP */
#endif /* __CONFIG_PWD_H */
/* Write the given entry onto the given stream. */
extern int putpwent (__const struct passwd *__restrict __p,
FILE *__restrict __f);
/* Search for an entry with a matching user ID. */
extern struct passwd *getpwuid (uid_t __uid);
/* Search for an entry with a matching username. */
extern struct passwd *getpwnam (__const char *__name);
/* Reentrant versions of some of the functions above.
PLEASE NOTE: the `getpwent_r' function is not (yet) standardized.
The interface may change in later versions of this library. But
the interface is designed following the principals used for the
other reentrant functions so the chances are good this is what the
POSIX people would choose. */
extern int getpwent_r (struct passwd *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct passwd **__restrict __result);
extern int getpwuid_r (uid_t __uid,
struct passwd *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct passwd **__restrict __result);
extern int getpwnam_r (__const char *__restrict __name,
struct passwd *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct passwd **__restrict __result);
/* Read an entry from STREAM. This function is not standardized and
probably never will. */
extern int fgetpwent_r (FILE *__restrict __stream,
struct passwd *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct passwd **__restrict __result);
/* Re-construct the password-file line for the given uid
in the given buffer. This knows the format that the caller
will expect, but this need not be the format of the password file. */
extern int getpw (uid_t __uid, char *__buffer);
#endif /* pwd.h */
#endif
+83 -67
View File
@@ -1,82 +1,98 @@
/*
* Copyright 1988 - 1994, Julianne Frances Haugh <jockgrrl@austin.rr.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Julianne F. Haugh nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY JULIE HAUGH AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL JULIE HAUGH OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
#ifndef _H_SHADOW
#define _H_SHADOW
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
#ifdef USE_SYSTEM_SHADOW
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* Declaration of types and functions for shadow password suite. */
#if !defined CONFIG_USE_BB_SHADOW
#include <shadow.h>
#else
/*
* This information is not derived from AT&T licensed sources. Posted
* to the USENET 11/88, and updated 11/90 with information from SVR4.
*
* $Id: shadow_.h,v 1.1 2002/06/23 04:24:20 andersen Exp $
*/
#ifndef _SHADOW_H
#define _SHADOW_H 1
typedef long sptime;
#include <stdio.h>
/*
* Shadow password security file structure.
*/
/* Paths to the user database files. */
#ifndef _PATH_SHADOW
#define _PATH_SHADOW "/etc/shadow"
#endif
#define SHADOW _PATH_SHADOW
struct spwd {
char *sp_namp; /* login name */
char *sp_pwdp; /* encrypted password */
sptime sp_lstchg; /* date of last change */
sptime sp_min; /* minimum number of days between changes */
sptime sp_max; /* maximum number of days between changes */
sptime sp_warn; /* number of days of warning before password
expires */
sptime sp_inact; /* number of days after password expires
until the account becomes unusable. */
sptime sp_expire; /* days since 1/1/70 until account expires */
unsigned long sp_flag; /* reserved for future use */
/* Structure of the password file. */
struct spwd
{
char *sp_namp; /* Login name. */
char *sp_pwdp; /* Encrypted password. */
long int sp_lstchg; /* Date of last change. */
long int sp_min; /* Minimum number of days between changes. */
long int sp_max; /* Maximum number of days between changes. */
long int sp_warn; /* Number of days to warn user to change
the password. */
long int sp_inact; /* Number of days the account may be
inactive. */
long int sp_expire; /* Number of days since 1970-01-01 until
account expires. */
unsigned long int sp_flag; /* Reserved. */
};
/*
* Shadow password security file functions.
*/
#include <stdio.h> /* for FILE */
/* Open database for reading. */
extern void setspent (void);
extern struct spwd *getspent(void);
extern struct spwd *sgetspent(const char *);
extern struct spwd *fgetspent(FILE *);
extern void setspent(void);
extern void endspent(void);
extern int putspent(const struct spwd *, FILE *);
extern struct spwd *getspnam(const char *name);
extern struct spwd *pwd_to_spwd(const struct passwd *pw);
/* Close database. */
extern void endspent (void);
#endif /* USE_LOCAL_SHADOW */
/* Get next entry from database, perhaps after opening the file. */
extern struct spwd *getspent (void);
#endif /* _H_SHADOW */
/* Get shadow entry matching NAME. */
extern struct spwd *getspnam (__const char *__name);
/* Read shadow entry from STRING. */
extern struct spwd *sgetspent (__const char *__string);
/* Read next shadow entry from STREAM. */
extern struct spwd *fgetspent (FILE *__stream);
/* Write line containing shadow password entry to stream. */
extern int putspent (__const struct spwd *__p, FILE *__stream);
/* Reentrant versions of some of the functions above. */
extern int getspent_r (struct spwd *__result_buf, char *__buffer,
size_t __buflen, struct spwd **__result);
extern int getspnam_r (__const char *__name, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result)__THROW;
extern int sgetspent_r (__const char *__string, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result);
extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result);
/* Protect password file against multi writers. */
extern int lckpwdf (void);
/* Unlock password file. */
extern int ulckpwdf (void);
#endif /* shadow.h */
#endif
+90 -88
View File
@@ -4,14 +4,14 @@
#define addgroup_trivial_usage \
"[-g GID] group_name [user_name]"
#define addgroup_full_usage \
"Adds a group to the system" \
"Adds a group to the system\n\n" \
"Options:\n" \
"\t-g GID\t\tspecify gid"
#define adduser_trivial_usage \
"[OPTIONS] user_name"
#define adduser_full_usage \
"Adds a user to the system" \
"Adds a user to the system\n\n" \
"Options:\n" \
"\t-h DIR\t\tAssign home directory DIR\n" \
"\t-g GECOS\tAssign gecos field GECOS\n" \
@@ -219,6 +219,7 @@
"\ti\t\textract\n" \
"\tm\t\tpreserve mtime\n" \
"\tt\t\tlist\n" \
"\tv\t\tverbose\n" \
"\tu\t\tunconditional overwrite\n" \
"\tF\t\tinput from file"
@@ -228,7 +229,7 @@
"\t-d [#] -l [#] -S -L logfile -f -b -c dir\n" \
"\t-d num\tdebug level\n" \
"\t-l num\tlog level (8 - default)\n" \
"\t-S\tlog to syslod (default)\n" \
"\t-S\tlog to syslogd (default)\n" \
"\t-L file\tlog to file\n" \
"\t-f\trun in fordeground\n" \
"\t-b\trun in background (default)\n" \
@@ -281,6 +282,7 @@
"\t\t\t`hours', `minutes', or `seconds' for date and,\n" \
"\t\t\ttime to the indicated precision.\n") \
"\t-s\t\tSets time described by STRING\n" \
"\t-r FILE\t\tDisplays the last modification time of FILE\n" \
"\t-u\t\tPrints or sets Coordinated Universal Time"
#define date_example_usage \
"$ date\n" \
@@ -299,15 +301,15 @@
"o - Pops the value off the top of the stack and uses it to set the output radix.\n" \
" Only 10 and 16 are supported."
#define dc_example_usage \
"$ dc 2 2 +\n" \
"$ dc 2 2 + p\n" \
"4\n" \
"$ dc 8 8 * 2 2 + /\n" \
"$ dc 8 8 \\* 2 2 + / p\n" \
"16\n" \
"$ dc 0 1 and\n" \
"$ dc 0 1 and p\n" \
"0\n" \
"$ dc 0 1 or\n" \
"$ dc 0 1 or p\n" \
"1\n" \
"$ echo 72 9 div 8 mul | dc\n" \
"$ echo 72 9 div 8 mul p | dc\n" \
"64\n"
#define dd_trivial_usage \
@@ -423,26 +425,26 @@
"\t-d\toutput will be in DOS format"
#define dpkg_trivial_usage \
"[-iCPru] package_name"
"[-ilCPru] [-F option] package_name"
#define dpkg_full_usage \
"dpkg is a utility to install, remove and manage Debian packages.\n\n" \
"Options:\n" \
"\t-i\tInstall the package\n" \
"\t-C\tConfigure an unpackaged package\n" \
"\t-P\tPurge all files of a package\n" \
"\t-r\tRemove all but the configuration files for a package\n" \
"\t-u\tUnpack a package, but dont configure it"
"\t-i\t\tInstall the package\n" \
"\t-l\t\tList of installed packages\n" \
"\t-C\t\tConfigure an unpackaged package\n" \
"\t-F depends\tIgnore depency problems\n" \
"\t-P\t\tPurge all files of a package\n" \
"\t-r\t\tRemove all but the configuration files for a package\n" \
"\t-u\t\tUnpack a package, but don't configure it"
#define dpkg_deb_trivial_usage \
"[-cefItxX] FILE [argument]"
"[-cefxX] FILE [argument]"
#define dpkg_deb_full_usage \
"Perform actions on Debian packages (.debs)\n\n" \
"Options:\n" \
"\t-c\tList contents of filesystem tree\n" \
"\t-e\tExtract control files to [argument] directory\n" \
"\t-f\tDisplay control field name starting with [argument]\n" \
"\t-I\tDisplay the control filenamed [argument]\n" \
"\t-t\tExtract filesystem tree to stdout in tar format\n" \
"\t-x\tExtract packages filesystem tree to directory\n" \
"\t-X\tVerbose extract"
#define dpkg_deb_example_usage \
@@ -502,8 +504,8 @@
"Displays the DHCP leases granted by udhcpd.\n\n" \
"Options:\n" \
"\t-f,\t--file=FILENAME\tLeases file to load\n" \
"\t-r,\t--remaining\tInterepret lease times as time remaing\n" \
"\t-a,\t--absolute\tInterepret lease times as expire time"
"\t-r,\t--remaining\tInterpret lease times as time remaing\n" \
"\t-a,\t--absolute\tInterpret lease times as expire time"
#ifdef CONFIG_FEATURE_FANCY_ECHO
#define USAGE_FANCY_ECHO(a) a
@@ -608,7 +610,7 @@
"\t-n\tDon't verify after format"
#define fdisk_trivial_usage \
"[-l] [-v] [-b SSZ] [-u] DISK"
"[-luv] [-C CYLINDERS] [-H HEADS] [-S SECTORS] [-b SSZ] DISK"
#define fdisk_full_usage \
"Change partition table\n" \
"Options:\n" \
@@ -616,6 +618,9 @@
"\t-u Give Start and End in sector (instead of cylinder) units\n" \
"\t-s PARTITION Give partition size(s) in blocks\n" \
"\t-b 2048: (for certain MO disks) use 2048-byte sectors\n" \
"\t-C CYLINDERS Set the number of cylinders\n" \
"\t-H HEADS Set the number of heads\n" \
"\t-S SECTORS Set the number of sectors\n" \
"\t-v Give fdisk version"
#ifdef CONFIG_FEATURE_FIND_TYPE
@@ -741,7 +746,7 @@
"\t-Q, --quiet-output No normal output\n" \
"\t-s, --shell=shell Set shell quoting conventions\n" \
"\t-T, --test Test for getopt(1) version\n" \
"\t-u, --unqote Do not quote the output"
"\t-u, --unquoted Do not quote the output"
#define getopt_example_usage \
"$ cat getopt.test\n" \
"#!/bin/sh\n" \
@@ -806,6 +811,7 @@
"Uncompress FILE (or standard input if FILE is '-').\n\n" \
"Options:\n" \
"\t-c\tWrite output to standard output\n" \
"\t-f\tForce read when source is a terminal\n" \
"\t-t\tTest compressed file integrity"
#define gunzip_example_usage \
"$ ls -la /tmp/BusyBox*\n" \
@@ -821,7 +827,8 @@
"When FILE is '-' or unspecified, reads standard input. Implies -c.\n\n" \
"Options:\n" \
"\t-c\tWrite output to standard output instead of FILE.gz\n" \
"\t-d\tdecompress"
"\t-d\tDecompress\n" \
"\t-f\tForce write when destination is a terminal"
#define gzip_example_usage \
"$ ls -la /tmp/busybox*\n" \
"-rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/busybox.tar\n" \
@@ -830,9 +837,11 @@
"-rw-rw-r-- 1 andersen andersen 554058 Apr 14 17:49 /tmp/busybox.tar.gz\n"
#define halt_trivial_usage \
""
"[-d<delay>]"
#define halt_full_usage \
"Halt the system."
"Halt the system.\n" \
"Options:\n" \
"\t-d\t\tdelay interval for halting."
#ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY
#define USAGE_HDPARM_IDENT(a) a
@@ -1003,15 +1012,17 @@
USAGE_HTTPD_SETUID(" [-u user]") \
USAGE_HTTPD_BASIC_AUTH(" [-r <realm>]") \
USAGE_HTTPD_AUTH_MD5(" [-m pass]") \
" [-h home]" \
" [-d/-e <string>]"
#define httpd_full_usage \
"Listens for incoming http server requests.\n\n"\
"Options:\n" \
"\t-c FILE\t\tSpecifies configuration file. (default httpd.conf)\n" \
USAGE_HTTPD_STANDALONE("\t-p PORT\tServer port (default 80)\n") \
USAGE_HTTPD_SETUID("\t-u USER\tSet uid to USER after listening privilegies port\n") \
USAGE_HTTPD_SETUID("\t-u USER\tSet uid to USER after listening privileges port\n") \
USAGE_HTTPD_BASIC_AUTH("\t-r REALM\tAuthentication Realm for Basic Authentication\n") \
USAGE_HTTPD_AUTH_MD5("\t-m PASS\t\tCrypt PASS with md5 algorithm\n") \
"\t-h HOME \tSpecifies http HOME directory (default ./)\n" \
"\t-e STRING\tHtml encode STRING\n" \
"\t-d STRING\tURL decode STRING"
@@ -1217,7 +1228,7 @@
"\n" \
" <process>:\n" \
"\n" \
" Specifies the process to be executed and it's command line.\n" \
" Specifies the process to be executed and its command line.\n" \
"\n" \
"Example /etc/inittab file:\n" \
"\n" \
@@ -1269,6 +1280,7 @@
"\t-f\tForce module to load into the wrong kernel version.\n" \
"\t-k\tMake module autoclean-able.\n" \
"\t-v\tverbose output\n" \
"\t-q\tquiet output\n" \
"\t-L\tLock to prevent simultaneous loads of a module\n" \
USAGE_INSMOD_MAP("\t-m\tOutput load map to stdout\n") \
"\t-o NAME\tSet internal module name to NAME\n" \
@@ -1280,6 +1292,7 @@
"Copies files and set attributes\n\n" \
"Options:\n" \
"\t-c\tcopy the file, default\n" \
"\t-d\tcreate directories\n" \
"\t-g\tset group ownership\n" \
"\t-m\tset permission modes\n" \
"\t-o\tset ownership\n" \
@@ -1369,11 +1382,12 @@
"$ kill 252\n"
#define killall_trivial_usage \
"[-signal] process-name [process-name ...]"
"[-q] [-signal] process-name [process-name ...]"
#define killall_full_usage \
"Send a signal (default is SIGTERM) to the specified process(es).\n\n"\
"Options:\n" \
"\t-l\tList all signal names and numbers."
"\t-l\tList all signal names and numbers.\n"\
"\t-q\tDo not complain if no processes were killed."
#define killall_example_usage \
"$ killall apache\n"
@@ -1591,11 +1605,6 @@
"\ty\tAllow write access to your terminal.\n" \
"\tn\tDisallow write access to your terminal.\n"
#define minit_trivial_usage \
"[-spPrRC]"
#define minit_full_usage \
"A small replacement for SysV init"
#define mkdir_trivial_usage \
"[OPTION] DIRECTORY..."
#define mkdir_full_usage \
@@ -1654,10 +1663,13 @@
"\tblock-count\tNumber of block to use (default is entire partition)."
#define mktemp_trivial_usage \
"[-q] TEMPLATE"
"[-dq] TEMPLATE"
#define mktemp_full_usage \
"Creates a temporary file with its name based on TEMPLATE.\n" \
"TEMPLATE is any name with six `Xs' (i.e., /tmp/temp.XXXXXX)."
"TEMPLATE is any name with six `Xs' (i.e., /tmp/temp.XXXXXX).\n\n" \
"Options:\n" \
"\t-d\t\tMake a directory instead of a file\n" \
"\t-q\t\tFail silently if an error occurs"
#define mktemp_example_usage \
"$ mktemp /tmp/temp.XXXXXX\n" \
"/tmp/temp.mWiLjM\n" \
@@ -1665,9 +1677,16 @@
"-rw------- 1 andersen andersen 0 Apr 25 17:10 /tmp/temp.mWiLjM\n"
#define modprobe_trivial_usage \
"[FILE ...]"
"[-knqrsv] [MODULE ...]"
#define modprobe_full_usage \
"Used for high level module loading and unloading."
"Used for high level module loading and unloading.\n\n" \
"Options:\n" \
"\t-k\tMake module autoclean-able.\n" \
"\t-n\tJust show what would be done.\n" \
"\t-q\tQuiet output.\n" \
"\t-r\tRemove module (stacks) or do autoclean.\n" \
"\t-s\tReport via syslog instead of stderr.\n" \
"\t-v\tVerbose output."
#define modprobe_example_usage \
"$ modprobe cdrom\n"
@@ -1726,25 +1745,6 @@
"$ mount /dev/fd0 /mnt -t msdos -o ro\n" \
"$ mount /tmp/diskimage /opt -t ext2 -o loop\n"
#define msvc_trivial_usage \
"-[udorspchaitkx] service"
#define msvc_full_usage \
"[option] service\n" \
"Where option is one of\n" \
"\t-u\tUp. If the service is not running, start it. If the service stops, restart it.\n" \
"\t-d\tDown. If the service is running, stop it, do not restart it.\n" \
"\t-o\tOnce. If the service is not running, start it. Do not restart it if it stops.\n" \
"\t-r\tTell supervise that the service is normally running; this affects status messages.\n" \
"\t-s\tTell supervise that the service is normally stopped; this affects status messages.\n" \
"\t-p\tPause. Send the service a STOP signal.\n" \
"\t-c\tContinue. Send the service a CONT signal.\n" \
"\t-h\tHangup. Send the service a HUP signal.\n" \
"\t-a\tAlarm. Send the service an ALRM signal.\n" \
"\t-i\tInterrupt. Send the service an INT signal.\n" \
"\t-t\tTerminate. Send the service a TERM signal.\n" \
"\t-k\tKill. Send the service a KILL signal.\n" \
"\t-x\tExit. supervise will quit as soon as the service is down."
#define mt_trivial_usage \
"[-f device] opcode value"
#define mt_full_usage \
@@ -1756,10 +1756,13 @@
"setpart tell unload unlock weof wset"
#define mv_trivial_usage \
"SOURCE DEST\n" \
"or: mv SOURCE... DIRECTORY"
"[OPTION]... SOURCE DEST\n" \
"or: mv [OPTION]... SOURCE... DIRECTORY"
#define mv_full_usage \
"Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY."
"Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n\n" \
"Options:\n" \
"\t-f\tdon't prompt before overwriting\n" \
"\t-i\tinteractive, prompt before overwrite"
#define mv_example_usage \
"$ mv /tmp/foo /bin/bar\n"
@@ -1861,16 +1864,13 @@
#define patch_example_usage \
"$ patch -p1 <example.diff"
#define pidfilehack_trivial_usage \
"[daemon.pid] [daemon]"
#define pidfilehack_full_usage \
"service /var/run/daemon.pid /usr/sbin/daemon args...\n"
#define pidof_trivial_usage \
"process-name [process-name ...]"
"process-name [OPTION] [process-name ...]"
#define pidof_full_usage \
"Lists the PIDs of all processes with names that match the\n" \
"names on the command line"
"names on the command line.\n" \
"Options:\n" \
"\t-s\t\tdisplay only a single PID."
#define pidof_example_usage \
"$ pidof init\n" \
"1\n"
@@ -1928,9 +1928,11 @@
"the new root file system."
#define poweroff_trivial_usage \
""
"[-d<delay>]"
#define poweroff_full_usage \
"Halt the system and request that the kernel shut off the power."
"Halt the system and request that the kernel shut off the power.\n" \
"Options:\n" \
"\t-d\t\tdelay interval for shutting off."
#define printf_trivial_usage \
"FORMAT [ARGUMENT...]"
@@ -1975,12 +1977,6 @@
"$ pwd\n" \
"/root\n"
#define raid_start_trivial_usage \
"MD_DEVICE DISK_DEVICE"
#define raid_start_full_usage \
"Start MD_DEVICE, taking superblock from DISK_DEVICE.\n" \
"Example: raid_start /dev/md0 /dev/sdb"
#define rdate_trivial_usage \
"[-sp] HOST"
#define rdate_full_usage \
@@ -2000,9 +1996,11 @@
"Returns the absolute pathnames of given argument."
#define reboot_trivial_usage \
""
"[-d<delay>]"
#define reboot_full_usage \
"Reboot the system."
"Reboot the system.\n" \
"Options:\n" \
"\t-d\t\tdelay interval for rebooting."
#define renice_trivial_usage \
"priority pid [pid ...]"
@@ -2095,14 +2093,15 @@
"$ rx /tmp/foo\n"
#define sed_trivial_usage \
"[-nef] pattern [files...]"
"[-efinr] pattern [files...]"
#define sed_full_usage \
"Options:\n" \
"\t-n\t\tsuppress automatic printing of pattern space\n" \
"\t-e script\tadd the script to the commands to be executed\n" \
"\t-f scriptfile\tadd script-file contents to the\n" \
"\t\t\tcommands to be executed\n" \
"\t-i\t\tEdit files in-place\n" \
"\t-i\t\tedit files in-place\n" \
"\t-n\t\tsuppress automatic printing of pattern space\n" \
"\t-r\t\tuse extended regular expression syntax\n" \
"\n" \
"If no -e or -f is given, the first non-option argument is taken as the sed\n"\
"script to interpret. All remaining arguments are names of input files; if no\n"\
@@ -2235,6 +2234,7 @@
#define strings_full_usage \
"Display printable strings in a binary file." \
"\n\nOptions:" \
"\n\t-a\tScan the whole files (this is the default)."\
"\n\t-f\tPrecede each string with the name of the file where it was found." \
"\n\t-n N\tSpecifies that at least N characters forms a sequence (default 4)" \
"\n\t-o\tEach string is preceded by its decimal offset in the file."
@@ -2309,17 +2309,16 @@
"sysctl - configure kernel parameters at runtime\n\n" \
"Options:\n" \
"\t-n\tUse this option to disable printing of the key name when printing values.\n" \
"\t-e\tUse this option to ignore errors about unknown keys.\n" \
"\t-w\tUse this option when you want to change a sysctl setting.\n" \
"\t-p\tLoad in sysctl settings from the file specified or /etc/sysctl.conf if none given.\n" \
"\t-a\tDisplay all values currently available.\n" \
"\t-A\tDisplay all values currently available in table form."
#define sysctl_example_usage
"sysctl [-n] [-e] variable ...\n" \
"sysctl [-n] [-e] -w variable=value ...\n" \
"sysctl [-n] [-e] -a\n" \
"sysctl [-n] [-e] -p <file>\t(default /etc/sysctl.conf)\n" \
"sysctl [-n] [-e] -A\n"
"sysctl [-n] variable ...\n" \
"sysctl [-n] -w variable=value ...\n" \
"sysctl [-n] -a\n" \
"sysctl [-n] -p <file>\t(default /etc/sysctl.conf)\n" \
"sysctl [-n] -A\n"
#endif
#define syslogd_trivial_usage \
@@ -2330,7 +2329,8 @@
"Options:\n" \
"\t-m MIN\t\tMinutes between MARK lines (default=20, 0=off)\n" \
"\t-n\t\tRun as a foreground process\n" \
"\t-O FILE\t\tUse an alternate log file (default=/var/log/messages)" \
"\t-O FILE\t\tUse an alternate log file (default=/var/log/messages)\n" \
"\t-S\t\tMake logging output smaller." \
USAGE_ROTATE_LOGFILE( \
"\n\t-s SIZE\t\tMax size (KB) before rotate (default=200KB, 0=off)\n" \
"\t-b NUM\t\tNumber of rotated logs to keep (default=1, max=99, 0=purge)") \
@@ -2461,7 +2461,8 @@
#define telnetd_full_usage \
"Telnetd uses incoming TELNET connections via inetd.\n"\
"Options:\n" \
"\t-l LOGIN\texec LOGIN on connect (default /bin/sh)"
"\t-l LOGIN\texec LOGIN on connect (default /bin/sh)\n" \
"\t-f issue_file\tDisplay issue_file instead of /etc/issue."
#else
#define telnetd_trivial_usage \
"[OPTION]"
@@ -2469,7 +2470,8 @@
"Telnetd listens for incoming TELNET connections on PORT.\n"\
"Options:\n" \
"\t-p PORT\tlisten for connections on PORT (default 23)\n"\
"\t-l LOGIN\texec LOGIN on connect (default /bin/sh)"
"\t-l LOGIN\texec LOGIN on connect (default /bin/sh)\n"\
"\t-f issue_file\tDisplay issue_file instead of /etc/issue."
#endif
#define test_trivial_usage \
-24
View File
@@ -61,30 +61,6 @@ config CONFIG_REBOOT
help
Stop all processes and reboot the system.
config CONFIG_MINIT
bool "minit"
default n
depends on ! CONFIG_INIT
help
Minimal init, based on minit v0.9.1. This is a simple
init replacement that handles starting/stopping services,
and service dependencies. See http://www.fefe.de/minit/
for additional information.
config CONFIG_PIDFILEHACK
bool "pidfilehack"
default y
depends on CONFIG_MINIT
help
pidfilehack is used by minit to run servers.
config CONFIG_MSVC
bool "msvc"
default y
depends on CONFIG_MINIT
help
msvc is used to start and stop processes controlled by minit
config CONFIG_MESG
bool "mesg"
default y
+7 -5
View File
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
TOPDIR:= ../
top_srcdir=..
top_builddir=..
srcdir=$(top_srcdir)/init
INIT_DIR:=./
include $(TOPDIR).config
include $(TOPDIR)Rules.mak
include Makefile.in
include $(top_builddir)/Rules.mak
include $(top_builddir)/.config
include $(srcdir)/Makefile.in
all: $(libraries-y)
-include $(TOPDIR).depend
-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
+5 -4
View File
@@ -19,16 +19,14 @@
INIT_AR:=init.a
ifndef $(INIT_DIR)
INIT_DIR:=$(TOPDIR)init/
INIT_DIR:=$(top_builddir)/init/
endif
srcdir=$(top_srcdir)/init
INIT-y:=
INIT-$(CONFIG_HALT) += halt.o
INIT-$(CONFIG_INIT) += init.o
INIT-$(CONFIG_MESG) += mesg.o
INIT-$(CONFIG_MINIT) += minit.o
INIT-$(CONFIG_MSVC) += msvc.o
INIT-$(CONFIG_PIDFILEHACK) += pidfilehack.o
INIT-$(CONFIG_POWEROFF) += poweroff.o
INIT-$(CONFIG_REBOOT) += reboot.o
@@ -59,3 +57,6 @@ libraries-y+=$(INIT_DIR)$(INIT_AR)
$(INIT_DIR)$(INIT_AR): $(patsubst %,$(INIT_DIR)%, $(INIT-y))
$(AR) -ro $@ $(patsubst %,$(INIT_DIR)%, $(INIT-y))
$(INIT_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+41 -14
View File
@@ -53,10 +53,6 @@
#endif
#if defined(__UCLIBC__) && !defined(__ARCH_HAS_MMU__)
#define fork vfork
#endif
#define INIT_BUFFS_SIZE 256
/* From <linux/vt.h> */
@@ -229,7 +225,9 @@ static void message(int device, const char *fmt, ...)
/* Log the message to syslogd */
if (device & LOG) {
/* don`t out "\r\n" */
syslog_msg(LOG_DAEMON, LOG_INFO, msg + 1);
openlog(bb_applet_name, 0, LOG_DAEMON);
syslog(LOG_INFO, "%s", msg);
closelog();
}
msg[l++] = '\n';
@@ -578,6 +576,7 @@ static pid_t run(const struct init_action *a)
}
}
#if !defined(__UCLIBC__) || defined(__ARCH_HAS_MMU__)
if (a->action & ASKFIRST) {
char c;
/*
@@ -595,6 +594,7 @@ static pid_t run(const struct init_action *a)
while(read(0, &c, 1) == 1 && c != '\n')
;
}
#endif
/* Log the process name and args */
message(LOG, "Starting pid %d, console %s: '%s'",
@@ -846,7 +846,7 @@ static void cont_handler(int sig)
static void new_init_action(int action, const char *command, const char *cons)
{
struct init_action *new_action, *a;
struct init_action *new_action, *a, *last;
if (*cons == '\0')
cons = console;
@@ -864,16 +864,19 @@ static void new_init_action(int action, const char *command, const char *cons)
}
/* Append to the end of the list */
for (a = init_action_list; a && a->next; a = a->next) {
/* don't enter action if it's already in the list */
for (a = last = init_action_list; a; a = a->next) {
/* don't enter action if it's already in the list,
* but do overwrite existing actions */
if ((strcmp(a->command, command) == 0) &&
(strcmp(a->terminal, cons) ==0)) {
a->action = action;
free(new_action);
return;
}
last = a;
}
if (a) {
a->next = new_action;
if (last) {
last->next = new_action;
} else {
init_action_list = new_action;
}
@@ -1046,14 +1049,33 @@ static void parse_inittab(void)
#endif /* CONFIG_FEATURE_USE_INITTAB */
}
#ifdef CONFIG_FEATURE_USE_INITTAB
static void reload_signal(int sig)
{
message(LOG, "Reloading /etc/inittab");
parse_inittab();
struct init_action *a, *tmp;
message(LOG, "Reloading /etc/inittab");
/* disable old entrys */
for (a = init_action_list; a; a = a->next ) {
a->action = ONCE;
}
parse_inittab();
/* remove unused entrys */
for (a = init_action_list; a; a = tmp) {
tmp = a->next;
if (a->action & (ONCE | SYSINIT | WAIT ) &&
a->pid == 0 ) {
delete_init_action(a);
}
}
run_actions(RESPAWN);
return;
return;
}
#endif /* CONFIG_FEATURE_USE_INITTAB */
extern int init_main(int argc, char **argv)
{
struct init_action *a;
@@ -1144,8 +1166,13 @@ extern int init_main(int argc, char **argv)
/* Next run anything to be run only once */
run_actions(ONCE);
#ifdef CONFIG_FEATURE_USE_INITTAB
/* Redefine SIGHUP to reread /etc/inittab */
signal(SIGHUP, reload_signal);
#else
signal(SIGHUP, SIG_IGN);
#endif /* CONFIG_FEATURE_USE_INITTAB */
/* Now run the looping stuff for the rest of forever */
while (1) {
+1 -1
View File
@@ -32,7 +32,7 @@ extern int mesg_main(int argc, char *argv[])
{
struct stat sb;
char *tty;
char c;
char c = 0;
if ((--argc == 0)
|| ((argc == 1) && (((c = **++argv) == 'y') || (c == 'n')))) {
-612
View File
@@ -1,612 +0,0 @@
/*
* minit version 0.9.1 by Felix von Leitner
* ported to busybox by Glenn McGrath <bug1@optushome.com.au>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU 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 <time.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include <errno.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <sys/poll.h>
#include <sys/reboot.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <linux/kd.h>
#include "busybox.h"
#define MINITROOT "/etc/minit"
static int i_am_init;
static int infd, outfd;
extern char **environ;
static struct process {
char *name;
pid_t pid;
char respawn;
char circular;
time_t startedat;
int __stdin, __stdout;
int logservice;
} *root;
static int maxprocess = -1;
static int processalloc = 0;
static unsigned int fmt_ulong(char *dest, unsigned long i)
{
register unsigned long len, tmp, len2;
/* first count the number of bytes needed */
for (len = 1, tmp = i; tmp > 9; ++len)
tmp /= 10;
if (dest)
for (tmp = i, dest += len, len2 = len + 1; --len2; tmp /= 10)
*--dest = (tmp % 10) + '0';
return len;
}
/* split buf into n strings that are separated by c. return n as *len.
* Allocate plus more slots and leave the first ofs of them alone. */
static char **split(char *buf, int c, int *len, int plus, int ofs)
{
int n = 1;
char **v = 0;
char **w;
/* step 1: count tokens */
char *s;
for (s = buf; *s; s++)
if (*s == c)
n++;
/* step 2: allocate space for pointers */
v = (char **) malloc((n + plus) * sizeof(char *));
if (!v)
return 0;
w = v + ofs;
*w++ = buf;
for (s = buf;; s++) {
while (*s && *s != c)
s++;
if (*s == 0)
break;
if (*s == c) {
*s = 0;
*w++ = s + 1;
}
}
*len = w - v;
return v;
}
static int openreadclose(char *fn, char **buf, unsigned long *len)
{
int fd = open(fn, O_RDONLY);
if (fd < 0)
return -1;
if (!*buf) {
*len = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
*buf = (char *) malloc(*len + 1);
if (!*buf) {
close(fd);
return -1;
}
}
*len = read(fd, *buf, *len);
if (*len != (unsigned long) -1)
(*buf)[*len] = 0;
return close(fd);
}
/* return index of service in process data structure or -1 if not found */
static int findservice(char *service)
{
int i;
for (i = 0; i <= maxprocess; i++) {
if (!strcmp(root[i].name, service))
return i;
}
return -1;
}
/* look up process index in data structure by PID */
static int findbypid(pid_t pid)
{
int i;
for (i = 0; i <= maxprocess; i++) {
if (root[i].pid == pid)
return i;
}
return -1;
}
/* clear circular dependency detection flags */
static void circsweep(void)
{
int i;
for (i = 0; i <= maxprocess; i++)
root[i].circular = 0;
}
/* add process to data structure, return index or -1 */
static int addprocess(struct process *p)
{
if (maxprocess + 1 >= processalloc) {
struct process *fump;
processalloc += 8;
if ((fump =
(struct process *) xrealloc(root,
processalloc *
sizeof(struct process))) == 0)
return -1;
root = fump;
}
memmove(&root[++maxprocess], p, sizeof(struct process));
return maxprocess;
}
/* load a service into the process data structure and return index or -1
* if failed */
static int loadservice(char *service)
{
struct process tmp;
int fd;
if (*service == 0)
return -1;
fd = findservice(service);
if (fd >= 0)
return fd;
if (chdir(MINITROOT) || chdir(service))
return -1;
if (!(tmp.name = strdup(service)))
return -1;
tmp.pid = 0;
fd = open("respawn", O_RDONLY);
if (fd >= 0) {
tmp.respawn = 1;
close(fd);
} else
tmp.respawn = 0;
tmp.startedat = 0;
tmp.circular = 0;
tmp.__stdin = 0;
tmp.__stdout = 1;
{
char *logservice = alloca(strlen(service) + 5);
strcpy(logservice, service);
strcat(logservice, "/log");
tmp.logservice = loadservice(logservice);
if (tmp.logservice >= 0) {
int pipefd[2];
if (pipe(pipefd))
return -1;
root[tmp.logservice].__stdin = pipefd[0];
tmp.__stdout = pipefd[1];
}
}
return (addprocess(&tmp));
}
/* usage: isup(findservice("sshd")).
* returns nonzero if process is up */
static int isup(int service)
{
if (service < 0)
return 0;
return (root[service].pid != 0);
}
static void opendevconsole(void)
{
int fd;
if ((fd = open("/dev/console", O_RDWR | O_NOCTTY)) >= 0) {
dup2(fd, 0);
dup2(fd, 1);
dup2(fd, 2);
if (fd > 2)
close(fd);
}
}
/* called from inside the service directory, return the PID or 0 on error */
static pid_t forkandexec(int pause_flag, int service)
{
char **argv = 0;
int count = 0;
pid_t p;
int fd;
unsigned long len;
char *s = 0;
int argc;
char *argv0 = 0;
again:
switch (p = fork()) {
case (pid_t) - 1:
if (count > 3)
return 0;
sleep(++count * 2);
goto again;
case 0:
/* child */
if (i_am_init) {
ioctl(0, TIOCNOTTY, 0);
setsid();
opendevconsole();
tcsetpgrp(0, getpgrp());
}
close(infd);
close(outfd);
if (pause_flag) {
struct timespec req;
req.tv_sec = 0;
req.tv_nsec = 500000000;
nanosleep(&req, 0);
}
if (!openreadclose("params", &s, &len)) {
argv = split(s, '\n', &argc, 2, 1);
if (argv[argc - 1])
argv[argc - 1] = 0;
else
argv[argc] = 0;
} else {
argv = (char **) xmalloc(2 * sizeof(char *));
argv[1] = 0;
}
argv0 = (char *) xmalloc(PATH_MAX + 1);
if (!argv || !argv0)
goto abort;
if (readlink("run", argv0, PATH_MAX) < 0) {
if (errno != EINVAL)
goto abort; /* not a symbolic link */
argv0 = strdup("./run");
}
argv[0] = strrchr(argv0, '/');
if (argv[0])
argv[0]++;
else
argv[0] = argv0;
if (root[service].__stdin != 0)
dup2(root[service].__stdin, 0);
if (root[service].__stdout != 1) {
dup2(root[service].__stdout, 1);
dup2(root[service].__stdout, 2);
}
{
int i;
for (i = 3; i < 1024; ++i)
close(i);
}
execve(argv0, argv, environ);
_exit(0);
abort:
free(argv0);
free(argv);
_exit(0);
default:
fd = open("sync", O_RDONLY);
if (fd >= 0) {
pid_t p2;
close(fd);
p2 = waitpid(p, 0, 0);
return 1;
}
return p;
}
}
/* start a service, return nonzero on error */
static int startnodep(int service, int pause_flag)
{
/* step 1: see if the process is already up */
if (isup(service))
return 0;
/* step 2: fork and exec service, put PID in data structure */
if (chdir(MINITROOT) || chdir(root[service].name))
return -1;
root[service].startedat = time(0);
root[service].pid = forkandexec(pause_flag, service);
return root[service].pid;
}
static int startservice(int service, int pause_flag)
{
int dir = -1;
unsigned long len;
char *s = 0;
pid_t pid;
if (service < 0)
return 0;
if (root[service].circular)
return 0;
root[service].circular = 1;
if (root[service].logservice >= 0)
startservice(root[service].logservice, pause_flag);
if (chdir(MINITROOT) || chdir(root[service].name))
return -1;
if ((dir = open(".", O_RDONLY)) >= 0) {
if (!openreadclose("depends", &s, &len)) {
char **deps;
int depc, i;
deps = split(s, '\n', &depc, 0, 0);
for (i = 0; i < depc; i++) {
int service_index;
if (deps[i][0] == '#')
continue;
service_index = loadservice(deps[i]);
if (service_index >= 0 && root[service_index].pid != 1)
startservice(service_index, 0);
}
fchdir(dir);
}
pid = startnodep(service, pause_flag);
close(dir);
dir = -1;
return pid;
}
return 0;
}
static void sulogin(void)
{
/* exiting on an initialization failure is not a good idea for init */
char *argv[] = { "sulogin", 0 };
execve("/sbin/sulogin", argv, environ);
exit(1);
}
static void handlekilled(pid_t killed)
{
int i;
if (killed == (pid_t) - 1) {
write(2, "all services exited.\n", 21);
exit(0);
}
if (killed == 0)
return;
i = findbypid(killed);
if (i >= 0) {
root[i].pid = 0;
if (root[i].respawn) {
circsweep();
startservice(i, time(0) - root[i].startedat < 1);
} else {
root[i].startedat = time(0);
root[i].pid = 1;
}
}
}
static void childhandler(void)
{
int status;
pid_t killed;
do {
killed = waitpid(-1, &status, WNOHANG);
handlekilled(killed);
} while (killed && killed != (pid_t) - 1);
}
static volatile int dowinch = 0;
static volatile int doint = 0;
static void sigchild(int whatever)
{
}
static void sigwinch(int sig)
{
dowinch = 1;
}
static void sigint(int sig)
{
doint = 1;
}
extern int minit_main(int argc, char *argv[])
{
/* Schritt 1: argv[1] als Service nehmen und starten */
struct pollfd pfd;
time_t last = time(0);
int nfds = 1;
int count = 0;
int i;
infd = open("/etc/minit/in", O_RDWR);
outfd = open("/etc/minit/out", O_RDWR | O_NONBLOCK);
if (getpid() == 1) {
int fd;
i_am_init = 1;
reboot(0);
if ((fd = open("/dev/console", O_RDWR | O_NOCTTY))) {
ioctl(fd, KDSIGACCEPT, SIGWINCH);
close(fd);
} else
ioctl(0, KDSIGACCEPT, SIGWINCH);
}
/* signal(SIGPWR,sighandler); don't know what to do about it */
/* signal(SIGHUP,sighandler); ??? */
{
struct sigaction sa;
sigemptyset(&sa.sa_mask);
sa.sa_sigaction = 0;
sa.sa_flags = SA_RESTART | SA_NOCLDSTOP;
sa.sa_handler = sigchild;
sigaction(SIGCHLD, &sa, 0);
sa.sa_handler = sigint;
sigaction(SIGINT, &sa, 0); /* ctrl-alt-del */
sa.sa_handler = sigwinch;
sigaction(SIGWINCH, &sa, 0); /* keyboard request */
}
if (infd < 0 || outfd < 0) {
puts("minit: could not open /etc/minit/in or /etc/minit/out\n");
sulogin();
nfds = 0;
} else
pfd.fd = infd;
pfd.events = POLLIN;
for (i = 1; i < argc; i++) {
circsweep();
if (startservice(loadservice(argv[i]), 0))
count++;
}
circsweep();
if (!count)
startservice(loadservice("default"), 0);
for (;;) {
char buf[1501];
time_t now;
if (doint) {
doint = 0;
startservice(loadservice("ctrlaltdel"), 0);
}
if (dowinch) {
dowinch = 0;
startservice(loadservice("kbreq"), 0);
}
childhandler();
now = time(0);
if (now < last || now - last > 30) {
/* The system clock was reset. Compensate. */
long diff = last - now;
int j;
for (j = 0; j <= maxprocess; ++j) {
root[j].startedat -= diff;
}
}
last = now;
switch (poll(&pfd, nfds, 5000)) {
case -1:
if (errno == EINTR) {
childhandler();
break;
}
opendevconsole();
puts("poll failed!\n");
sulogin();
/* what should we do if poll fails?! */
break;
case 1:
i = read(infd, buf, 1500);
if (i > 1) {
pid_t pid;
int idx = 0;
int tmp;
buf[i] = 0;
if (buf[0] != 's' && ((idx = findservice(buf + 1)) < 0))
error:
write(outfd, "0", 1);
else {
switch (buf[0]) {
case 'p':
write(outfd, buf, fmt_ulong(buf, root[idx].pid));
break;
case 'r':
root[idx].respawn = 0;
goto ok;
case 'R':
root[idx].respawn = 1;
goto ok;
case 'C':
if (kill(root[idx].pid, 0)) { /* check if still active */
handlekilled(root[idx].pid); /* no!?! remove form active list */
goto error;
}
goto ok;
break;
case 'P':
{
unsigned char *x = buf + strlen(buf) + 1;
unsigned char c;
tmp = 0;
while ((c = *x++ - '0') < 10)
tmp = tmp * 10 + c;
}
if (tmp > 0) {
if (kill(tmp, 0))
goto error;
pid = tmp;
}
root[idx].pid = tmp;
goto ok;
case 's':
idx = loadservice(buf + 1);
if (idx < 0)
goto error;
if (root[idx].pid < 2) {
root[idx].pid = 0;
circsweep();
idx = startservice(idx, 0);
if (idx == 0) {
write(outfd, "0", 1);
break;
}
}
ok:
write(outfd, "1", 1);
break;
case 'u':
write(outfd, buf,
fmt_ulong(buf, time(0) - root[idx].startedat));
}
}
}
break;
default:
break;
}
}
}
-300
View File
@@ -1,300 +0,0 @@
/*
* minit version 0.9.1 by Felix von Leitner
* ported to busybox by Glenn McGrath <bug1@optushome.com.au>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU 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/fcntl.h>
#include <sys/file.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "busybox.h"
static int infd, outfd;
static char buf[1500];
static unsigned int fmt_ulong(char *dest, unsigned long i)
{
register unsigned long len, tmp, len2;
/* first count the number of bytes needed */
for (len = 1, tmp = i; tmp > 9; ++len)
tmp /= 10;
if (dest)
for (tmp = i, dest += len, len2 = len + 1; --len2; tmp /= 10)
*--dest = (tmp % 10) + '0';
return len;
}
static void addservice(char *service)
{
char *service_ptr;
if (strncmp(service, "/etc/minit/", 11) == 0) {
service += 11;
}
while ((service_ptr = last_char_is(service, '/')) != NULL) {
*service_ptr = 0;
}
strncpy(buf + 1, service, 1400);
buf[1400] = 0;
}
static int addreadwrite(char *service)
{
addservice(service);
write(infd, buf, strlen(buf));
return read(outfd, buf, 1500);
}
/* return PID, 0 if error */
static pid_t __readpid(char *service)
{
int len;
buf[0] = 'p';
len = addreadwrite(service);
if (len < 0)
return 0;
buf[len] = 0;
return atoi(buf);
}
/* return nonzero if error */
static int respawn(char *service, int yesno)
{
int len;
buf[0] = yesno ? 'R' : 'r';
len = addreadwrite(service);
return (len != 1 || buf[0] == '0');
}
/* return nonzero if error */
static int startservice(char *service)
{
int len;
buf[0] = 's';
len = addreadwrite(service);
return (len != 1 || buf[0] == '0');
}
extern int msvc_main(int argc, char **argv)
{
if (argc < 2) {
bb_show_usage();
}
infd = bb_xopen("/etc/minit/in", O_WRONLY);
outfd = bb_xopen("/etc/minit/out", O_RDONLY);
while (lockf(infd, F_LOCK, 1)) {
bb_perror_msg("could not aquire lock!\n");
sleep(1);
}
if (argc == 2) {
pid_t pid = __readpid(argv[1]);
if (buf[0] != '0') {
int len;
int up_time;
printf("%s: ", argv[1]);
if (pid == 0)
printf("down ");
else if (pid == 1)
printf("finished ");
else {
printf("up (pid %d) ", pid);
}
buf[0] = 'u';
len = addreadwrite(argv[1]);
if (len < 0) {
up_time = 0;
} else {
buf[len] = 0;
up_time = atoi(buf);
}
printf("%d seconds\n", up_time);
if (pid == 0)
return 2;
else if (pid == 1)
return 3;
else
return 0;
} else {
bb_error_msg_and_die("no such service");
}
} else {
int i;
int ret = 0;
int sig = 0;
pid_t pid;
if (argv[1][0] == '-') {
switch (argv[1][1]) {
case 'g':
for (i = 2; i < argc; ++i) {
pid = __readpid(argv[i]);
if (pid < 2) {
if (pid == 1) {
bb_error_msg("%s, service termination", argv[i]);
} else {
bb_error_msg("%s, no such service", argv[i]);
}
ret = 1;
}
printf("%d\n", pid);
}
break;
case 'p':
sig = SIGSTOP;
goto dokill;
break;
case 'c':
sig = SIGCONT;
goto dokill;
break;
case 'h':
sig = SIGHUP;
goto dokill;
break;
case 'a':
sig = SIGALRM;
goto dokill;
break;
case 'i':
sig = SIGINT;
goto dokill;
break;
case 't':
sig = SIGTERM;
goto dokill;
break;
case 'k':
sig = SIGKILL;
goto dokill;
break;
case 'o':
for (i = 2; i < argc; ++i)
if (startservice(argv[i]) || respawn(argv[i], 0)) {
bb_error_msg("Couldnt not start %s\n", argv[i]);
ret = 1;
}
break;
case 'd':
for (i = 2; i < argc; ++i) {
pid = __readpid(argv[i]);
if (pid == 0) {
bb_error_msg("%s, no such service\n", argv[i]);
ret = 1;
} else if (pid == 1)
continue;
if (respawn(argv[i], 0) || kill(pid, SIGTERM)
|| kill(pid, SIGCONT));
}
break;
case 'u':
for (i = 2; i < argc; ++i) {
if (startservice(argv[i]) || respawn(argv[i], 1)) {
bb_error_msg("Couldnt not start %s\n", argv[i]);
ret = 1;
}
break;
}
case 'C':
for (i = 2; i < argc; ++i) {
int len;
buf[0] = 'C';
len = addreadwrite(argv[i]);
if (len != 1 || buf[0] == '0') {
bb_error_msg("%s has terminated or was killed\n",
argv[i]);
ret = 1;
}
}
break;
case 'P':
pid = atoi(argv[1] + 2);
if (pid > 1) {
char *tmp;
int len;
buf[0] = 'P';
addservice(argv[2]);
tmp = buf + strlen(buf) + 1;
tmp[fmt_ulong(tmp, pid)] = 0;
write(infd, buf, strlen(buf) + strlen(tmp) + 2);
len = read(outfd, buf, 1500);
if (len != 1 || buf[0] == '0') {
bb_error_msg_and_die("Couldnt not set pid of service %s\n", argv[2]);
}
}
break;
default:
bb_show_usage();
}
} else {
bb_show_usage();
}
return ret;
dokill:
for (i = 2; i < argc; i++) {
pid = __readpid(argv[i]);
if (!pid) {
bb_error_msg("%s no such service\n", argv[i]);
ret = 1;
}
if (kill(pid, sig)) {
bb_error_msg("%s, could not send signal %d to PID %d\n",
argv[i], sig, pid);
ret = 1;
}
}
return ret;
}
}
/*
-u Up. If the service is not running, start it. If the service stops,
restart it.
-d Down. If the service is running, send it a TERM signal and then a CONT
signal. After it stops, do not restart it.
-o Once. If the service is not running, start it. Do not restart it if it
stops.
-r Tell supervise that the service is normally running; this affects status
messages.
-s Tell supervise that the service is normally stopped; this affects status
messages.
-p Pause. Send the service a STOP signal.
-c Continue. Send the service a CONT signal.
-h Hangup. Send the service a HUP signal.
-a Alarm. Send the service an ALRM signal.
-i Interrupt. Send the service an INT signal.
-t Terminate. Send the service a TERM signal.
-k Kill. Send the service a KILL signal.
-x Exit. supervise will quit as soon as the service is down.
*/
Loaded 100 of 278 files, more files were not shown because too many files have changed in this diff. Show more