Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3986eb7ec | ||
|
|
9e78a1772d | ||
|
|
f7c7dde158 | ||
|
|
830c040f6f | ||
|
|
045dedad91 | ||
|
|
b309ec71c8 | ||
|
|
866bad310f | ||
|
|
5e1f2d429d | ||
|
|
0be69b1693 | ||
|
|
c7cba1ae3b | ||
|
|
be3dae145f | ||
|
|
6022fc8723 | ||
|
|
fc455b2101 | ||
|
|
365a345e92 | ||
|
|
d5138f44fe | ||
|
|
9344d8aa10 | ||
|
|
44dbd4bc65 | ||
|
|
25b8652b4f | ||
|
|
091a3e510e | ||
|
|
ffaa3deeeb | ||
|
|
5f07779aca | ||
|
|
ab6399a4c6 | ||
|
|
ca17c937c2 | ||
|
|
d62df011a0 | ||
|
|
164a716f96 | ||
|
|
8c59a0bf0e |
No files matched your search
@@ -1,7 +0,0 @@
|
||||
busybox
|
||||
busybox.links
|
||||
_install
|
||||
.config
|
||||
.menuconfig.log
|
||||
.config.cmd
|
||||
.config.old
|
||||
@@ -1,447 +0,0 @@
|
||||
---------------------
|
||||
PatchSet 4272
|
||||
Date: 2004/07/20 11:08:30
|
||||
Author: andersen
|
||||
Branch: HEAD
|
||||
Tag: busybox_1_00_rc1
|
||||
Log:
|
||||
Update for release
|
||||
|
||||
Members:
|
||||
docs/busybox.net/news.html:1.14->1.15
|
||||
docs/busybox.net/shame.html:1.17->1.18
|
||||
|
||||
---------------------
|
||||
PatchSet 4273
|
||||
Date: 2004/07/20 11:23:45
|
||||
Author: andersen
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
cut-n-paste strikes again
|
||||
|
||||
Members:
|
||||
docs/busybox.net/news.html:1.15->1.16
|
||||
|
||||
---------------------
|
||||
PatchSet 4274
|
||||
Date: 2004/07/20 11:31:08
|
||||
Author: andersen
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
more doc updates
|
||||
|
||||
Members:
|
||||
docs/busybox.net/news.html:1.16->1.17
|
||||
|
||||
---------------------
|
||||
PatchSet 4275
|
||||
Date: 2004/07/20 11:31:52
|
||||
Author: andersen
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Yet more doc updates
|
||||
|
||||
Members:
|
||||
docs/busybox.net/news.html:1.17->1.18
|
||||
|
||||
---------------------
|
||||
PatchSet 4276
|
||||
Date: 2004/07/20 11:41:16
|
||||
Author: andersen
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
oops
|
||||
|
||||
Members:
|
||||
docs/busybox.net/news.html:1.18->1.19
|
||||
|
||||
---------------------
|
||||
PatchSet 4277
|
||||
Date: 2004/07/20 15:43:57
|
||||
Author: sandman
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
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
|
||||
|
||||
Members:
|
||||
modutils/insmod.c:1.121->1.122
|
||||
|
||||
---------------------
|
||||
PatchSet 4278
|
||||
Date: 2004/07/20 18:36:51
|
||||
Author: sandman
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Patch from Mike Snitzer <snitzer@gmail.com>:
|
||||
Please see the attached patch for the following crash with busybox'
|
||||
2.6 rmmod support
|
||||
|
||||
Members:
|
||||
modutils/rmmod.c:1.30->1.31
|
||||
|
||||
---------------------
|
||||
PatchSet 4279
|
||||
Date: 2004/07/20 22:53:59
|
||||
Author: andersen
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Avoid a naming conflict with include/bits/fcntl.h
|
||||
|
||||
Members:
|
||||
miscutils/hdparm.c:1.15->1.16
|
||||
|
||||
---------------------
|
||||
PatchSet 4280
|
||||
Date: 2004/07/21 09:00:39
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Fixup -T (--files-from) option, works for non-directories now
|
||||
|
||||
Members:
|
||||
archival/tar.c:1.192->1.193
|
||||
|
||||
---------------------
|
||||
PatchSet 4281
|
||||
Date: 2004/07/21 10:20:19
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Patch from Jean Wolter, fixes compiler warning when ASH_ALIAS is
|
||||
disabled.
|
||||
|
||||
Members:
|
||||
shell/ash.c:1.101->1.102
|
||||
|
||||
---------------------
|
||||
PatchSet 4282
|
||||
Date: 2004/07/21 12:21:39
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Patch from Mike Snitzer, bring down dhclient using its correct pid, fix
|
||||
a grammatical error.
|
||||
|
||||
Members:
|
||||
networking/ifupdown.c:1.40->1.41
|
||||
|
||||
---------------------
|
||||
PatchSet 4283
|
||||
Date: 2004/07/21 12:25:55
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Patch from Tito, ass usage for strings -a options
|
||||
|
||||
Members:
|
||||
include/usage.h:1.213->1.214
|
||||
|
||||
---------------------
|
||||
PatchSet 4284
|
||||
Date: 2004/07/21 13:06:30
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Fix bug in accepting buffer size argument
|
||||
|
||||
Members:
|
||||
sysklogd/syslogd.c:1.111->1.112
|
||||
|
||||
---------------------
|
||||
PatchSet 4285
|
||||
Date: 2004/07/21 23:56:31
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
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."
|
||||
|
||||
Members:
|
||||
networking/ifupdown.c:1.41->1.42
|
||||
|
||||
---------------------
|
||||
PatchSet 4286
|
||||
Date: 2004/07/22 00:03:39
|
||||
Author: sandman
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
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
|
||||
|
||||
Members:
|
||||
modutils/modprobe.c:1.32->1.33
|
||||
|
||||
---------------------
|
||||
PatchSet 4287
|
||||
Date: 2004/07/22 04:23:18
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Reverse my previous change, "::" is a GNU getopt extension that allows
|
||||
an optional argument.
|
||||
Looks like a glibc bug to me
|
||||
|
||||
Members:
|
||||
sysklogd/syslogd.c:1.112->1.113
|
||||
|
||||
---------------------
|
||||
PatchSet 4288
|
||||
Date: 2004/07/23 01:10:22
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Patch from Manousaridis Angelos to bring dhclient down more elegently
|
||||
|
||||
Members:
|
||||
networking/ifupdown.c:1.42->1.43
|
||||
|
||||
---------------------
|
||||
PatchSet 4289
|
||||
Date: 2004/07/23 01:20:57
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Patch from Adam Slattery to add bzip2 support to rpm2cpio
|
||||
|
||||
Members:
|
||||
patches/rpm2cpio_bzip2.patch:INITIAL->1.1
|
||||
|
||||
---------------------
|
||||
PatchSet 4290
|
||||
Date: 2004/07/23 01:27:56
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Patch from Felipe Kellermann to fix some typo's
|
||||
|
||||
Members:
|
||||
include/usage.h:1.214->1.215
|
||||
|
||||
---------------------
|
||||
PatchSet 4291
|
||||
Date: 2004/07/23 01:35:41
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Patch from Felipe Kellermann, "There is a call to printf using `*pr-cchar'
|
||||
referencing a string and using a single char, when *p <= 0x1f."
|
||||
|
||||
Members:
|
||||
libbb/dump.c:1.12->1.13
|
||||
|
||||
---------------------
|
||||
PatchSet 4292
|
||||
Date: 2004/07/23 01:42:28
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
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
|
||||
|
||||
Members:
|
||||
coreutils/od.c:1.6->1.7
|
||||
|
||||
---------------------
|
||||
PatchSet 4293
|
||||
Date: 2004/07/23 01:49:46
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
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.
|
||||
|
||||
Members:
|
||||
libbb/interface.c:1.22->1.23
|
||||
|
||||
---------------------
|
||||
PatchSet 4294
|
||||
Date: 2004/07/23 02:11:25
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Patch from Dmitry Zakharov to fix a bug discovered via the freeswap
|
||||
script.
|
||||
|
||||
Members:
|
||||
editors/awk.c:1.8->1.9
|
||||
|
||||
---------------------
|
||||
PatchSet 4295
|
||||
Date: 2004/07/23 03:33:38
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
iUpdate reboot usage, patch by Felipe Kellermann
|
||||
|
||||
Members:
|
||||
include/usage.h:1.215->1.216
|
||||
|
||||
---------------------
|
||||
PatchSet 4296
|
||||
Date: 2004/07/23 05:16:17
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Patch from Felipe Kellermann, fixup usage for halt command
|
||||
|
||||
Members:
|
||||
include/usage.h:1.216->1.217
|
||||
|
||||
---------------------
|
||||
PatchSet 4297
|
||||
Date: 2004/07/23 06:06:21
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Patch from Felipe Kellermann, fixup usage for pidof, poweroff, remove
|
||||
some trailing '\n'
|
||||
|
||||
Members:
|
||||
include/usage.h:1.217->1.218
|
||||
|
||||
---------------------
|
||||
PatchSet 4298
|
||||
Date: 2004/07/23 06:43:29
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Patch from Felipe Kellermann, fix endless loop when first > last and
|
||||
increment > 0.
|
||||
|
||||
Members:
|
||||
coreutils/seq.c:1.2->1.3
|
||||
|
||||
---------------------
|
||||
PatchSet 4299
|
||||
Date: 2004/07/24 01:55:56
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Update Tito's contributions
|
||||
|
||||
Members:
|
||||
AUTHORS:1.44->1.45
|
||||
|
||||
---------------------
|
||||
PatchSet 4300
|
||||
Date: 2004/07/24 06:01:52
|
||||
Author: bug1
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
Patch by Paul Whittaker, make busybox dc compatable with GNU dc.
|
||||
the following example was broken, echo "1 1 +" | dc
|
||||
|
||||
Members:
|
||||
miscutils/dc.c:1.18->1.19
|
||||
|
||||
---------------------
|
||||
PatchSet 4301
|
||||
Date: 2004/07/24 12:44:13
|
||||
Author: andersen
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
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.
|
||||
|
||||
Members:
|
||||
shell/ash.c:1.102->1.103
|
||||
|
||||
---------------------
|
||||
PatchSet 4302
|
||||
Date: 2004/07/26 11:46:21
|
||||
Author: andersen
|
||||
Branch: HEAD
|
||||
Tag: (none)
|
||||
Log:
|
||||
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.
|
||||
|
||||
Members:
|
||||
util-linux/nfsmount.c:1.27->1.28
|
||||
|
||||
---------------------
|
||||
PatchSet 4303
|
||||
Date: 2004/07/26 11:55:23
|
||||
Author: andersen
|
||||
Branch: HEAD
|
||||
Tag: busybox_1_00_rc2
|
||||
Log:
|
||||
Update webpage for -rc2
|
||||
|
||||
Members:
|
||||
docs/busybox.net/news.html:1.19->1.20
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
Please see the LICENSE file for details on copying and usage.
|
||||
|
||||
BusyBox combines tiny versions of many common UNIX utilities into a single
|
||||
small executable. It provides minimalist replacements for most of the utilities
|
||||
you usually find in GNU coreutils, util-linux, etc. The utilities in BusyBox
|
||||
generally have fewer options than their full-featured GNU cousins; however, the
|
||||
options that are included provide the expected functionality and behave very
|
||||
much like their GNU counterparts.
|
||||
|
||||
BusyBox has been written with size-optimization and limited resources in mind.
|
||||
It is also extremely modular so you can easily include or exclude commands (or
|
||||
features) at compile time. This makes it easy to customize your embedded
|
||||
systems. To create a working system, just add /dev, /etc, and a Linux kernel.
|
||||
BusyBox provides a fairly complete POSIX environment for any small or embedded
|
||||
system.
|
||||
|
||||
BusyBox is extremely configurable. This allows you to include only the
|
||||
components you need, thereby reducing binary size. Run 'make config' or
|
||||
'make menuconfig' to select the functionality that you wish to enable.
|
||||
|
||||
After the build is complete, a busybox.links file is generated. This is
|
||||
used by 'make install' to create symlinks to the BusyBox binary for all
|
||||
compiled in functions. By default, 'make install' will place the symlink
|
||||
forest into `pwd`/_install unless you have defined the PREFIX environment
|
||||
variable (i.e., 'make PREFIX=/tmp/foo install')
|
||||
|
||||
If you wish to install hard links, rather than symlinks, you can use
|
||||
'make PREFIX=/tmp/foo install-hardlinks' instead.
|
||||
|
||||
----------------
|
||||
|
||||
Supported architectures:
|
||||
|
||||
BusyBox in general will build on any architecture supported by gcc. It has
|
||||
a few specialized features added for __sparc__ and __alpha__. insmod
|
||||
functionality is currently limited to x86, ARM, SH3/4, powerpc, m68k,
|
||||
MIPS, cris, and v850e.
|
||||
|
||||
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.
|
||||
|
||||
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).
|
||||
|
||||
----------------
|
||||
|
||||
Getting help:
|
||||
|
||||
When you find you need help, you can check out the BusyBox mailing list
|
||||
archives at http://busybox.net/lists/busybox/ or even join
|
||||
the mailing list if you are interested.
|
||||
|
||||
----------------
|
||||
|
||||
Bugs:
|
||||
|
||||
If you find bugs, please submit a 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:
|
||||
|
||||
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
|
||||
Sat Mar 27 14:19:41 MST 2004
|
||||
|
||||
But when I use BusyBox date I get this instead:
|
||||
|
||||
$ date
|
||||
illegal instruction
|
||||
|
||||
I am using Debian unstable, kernel version 2.4.25-vrs2 on a Netwinder,
|
||||
and the latest uClibc from CVS. Thanks for the wonderful program!
|
||||
|
||||
-Diligent
|
||||
|
||||
Note the careful description and use of examples showing not only what BusyBox
|
||||
does, but also a counter example showing what an equivalent GNU app does. Bug
|
||||
reports lacking such detail may never be fixed... Thanks for understanding.
|
||||
|
||||
----------------
|
||||
|
||||
Downloads:
|
||||
|
||||
Source for the latest released version, as well as daily snapshots, can always
|
||||
be downloaded from
|
||||
http://busybox.net/downloads/
|
||||
|
||||
----------------
|
||||
|
||||
CVS:
|
||||
|
||||
BusyBox now has its own publicly browsable CVS tree at:
|
||||
http://busybox.net/cgi-bin/cvsweb/busybox/
|
||||
|
||||
Anonymous CVS access is available. For instructions, check out:
|
||||
http://busybox.net/cvs_anon.html
|
||||
|
||||
For those that are actively contributing there is even CVS write access:
|
||||
http://busybox.net/cvs_write.html
|
||||
|
||||
----------------
|
||||
|
||||
Please feed suggestions, bug reports, insults, and bribes back to:
|
||||
Erik Andersen
|
||||
<andersen@codepoet.org>
|
||||
|
||||
File renamed without changes.
@@ -2,7 +2,7 @@ List of the authors of code contained in BusyBox.
|
||||
|
||||
If you have code in BusyBox, you should be listed here. If you should be
|
||||
listed, or the description of what you have done needs more detail, or is
|
||||
incorect, _please_ let me know.
|
||||
incorrect, _please_ let me know.
|
||||
|
||||
-Erik
|
||||
|
||||
@@ -23,6 +23,9 @@ Laurence Anderson <l.d.anderson@warwick.ac.uk>
|
||||
Jeff Angielski <jeff@theptrgroup.com>
|
||||
ftpput, ftpget
|
||||
|
||||
Jim Bauer <jfbauer@nfr.com>
|
||||
modprobe shell dependency
|
||||
|
||||
Edward Betts <edward@debian.org>
|
||||
expr, hostid, logname, whoami
|
||||
|
||||
@@ -56,6 +59,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.
|
||||
|
||||
@@ -65,6 +72,11 @@ Daniel Jacobowitz <dan@debian.org>
|
||||
Matt Kraai <kraai@alumni.cmu.edu>
|
||||
documentation, bugfixes, test suite
|
||||
|
||||
Rob Landley <rob@landley.net>
|
||||
sed (major rewrite in 2003, and I now maintain the thing).
|
||||
bunzip2 (complete from-scratch rewrite, then mjn3 optimized the result.)
|
||||
I've patched lots of other applets, but don't maintain 'em.
|
||||
|
||||
Stephan Linz <linz@li-pro.net>
|
||||
ipcalc, Red Hat equivalence
|
||||
|
||||
@@ -72,9 +84,9 @@ John Lombardo <john@deltanet.com>
|
||||
tr
|
||||
|
||||
Glenn McGrath <bug1@iinet.net.au>
|
||||
Common unarchving code and unarchiving applets, ifupdown, ftpgetput,
|
||||
nameif, sed, patch, fold, install, uudecode.
|
||||
Various bugfixes, review and apply numerous patches.
|
||||
Common unarchiving 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,
|
||||
File renamed without changes.
File renamed without changes.
+144
-58
@@ -23,61 +23,150 @@
|
||||
noconfig_targets := menuconfig config oldconfig randconfig \
|
||||
defconfig allyesconfig allnoconfig clean distclean \
|
||||
release tags
|
||||
TOPDIR=./
|
||||
include Rules.mak
|
||||
|
||||
ifndef TOPDIR
|
||||
TOPDIR=$(CURDIR)/
|
||||
endif
|
||||
ifndef top_srcdir
|
||||
top_srcdir=$(CURDIR)
|
||||
endif
|
||||
ifndef top_builddir
|
||||
top_builddir=$(CURDIR)
|
||||
endif
|
||||
|
||||
export 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
|
||||
for i in `cat busybox.links` ; do rm -f $(PREFIX)$$i; done
|
||||
|
||||
install-hardlinks: applets/install.sh busybox busybox.links
|
||||
install-hardlinks: $(top_srcdir)/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
|
||||
@echo BusyBox Documentation
|
||||
@echo
|
||||
$(SECHO)
|
||||
$(SECHO) BusyBox Documentation
|
||||
$(SECHO)
|
||||
-mkdir -p docs
|
||||
-pod2text $< > $@
|
||||
|
||||
@@ -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,40 +187,36 @@ 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
|
||||
.depend: scripts/mkdep include/config.h
|
||||
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
|
||||
depend dep: .depend
|
||||
|
||||
include/config/MARKER: depend scripts/split-include
|
||||
scripts/split-include include/config.h include/config
|
||||
@ touch include/config/MARKER
|
||||
|
||||
include/config.h: .config
|
||||
@if [ ! -x ./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
|
||||
@echo Finished installing...
|
||||
@echo
|
||||
$(SECHO)
|
||||
$(SECHO) Finished installing...
|
||||
$(SECHO)
|
||||
|
||||
else # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
|
||||
|
||||
@@ -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,9 +266,6 @@ allnoconfig: scripts/config/conf
|
||||
defconfig: scripts/config/conf
|
||||
@./scripts/config/conf -d $(CONFIG_CONFIG_IN)
|
||||
|
||||
check: busybox
|
||||
cd testsuite && ./runtest
|
||||
|
||||
clean:
|
||||
- rm -f docs/busybox.dvi docs/busybox.ps \
|
||||
docs/busybox.pod docs/busybox.net/busybox.html \
|
||||
@@ -200,20 +286,20 @@ distclean: clean
|
||||
- $(MAKE) -C scripts/config clean
|
||||
|
||||
release: distclean #doc
|
||||
cd ..; \
|
||||
rm -rf $(PROG)-$(VERSION); \
|
||||
cp -a busybox $(PROG)-$(VERSION); \
|
||||
\
|
||||
find $(PROG)-$(VERSION)/ -type d \
|
||||
-name CVS \
|
||||
-print \
|
||||
-exec rm -rf {} \; ; \
|
||||
\
|
||||
find $(PROG)-$(VERSION)/ -type f \
|
||||
-name .\#* \
|
||||
-print \
|
||||
-exec rm -f {} \; ; \
|
||||
\
|
||||
cd ..; \
|
||||
rm -rf $(PROG)-$(VERSION); \
|
||||
cp -a busybox $(PROG)-$(VERSION); \
|
||||
\
|
||||
find $(PROG)-$(VERSION)/ -type d \
|
||||
-name .svn \
|
||||
-print \
|
||||
-exec rm -rf {} \; ; \
|
||||
\
|
||||
find $(PROG)-$(VERSION)/ -type f \
|
||||
-name .\#* \
|
||||
-print \
|
||||
-exec rm -f {} \; ; \
|
||||
\
|
||||
tar -cvzf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)/;
|
||||
|
||||
tags:
|
||||
@@ -222,7 +308,7 @@ tags:
|
||||
|
||||
endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
|
||||
|
||||
endif # ifeq ($(skip-makefile),)
|
||||
|
||||
.PHONY: dummy subdirs release distclean clean config oldconfig \
|
||||
menuconfig tags check test depend
|
||||
|
||||
|
||||
menuconfig tags check test depend buildtree
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
Please see the LICENSE file for details on copying and usage.
|
||||
|
||||
What is busybox:
|
||||
|
||||
BusyBox combines tiny versions of many common UNIX utilities into a single
|
||||
small executable. It provides minimalist replacements for most of the
|
||||
utilities you usually find in bzip2, coreutils, file, findutils, gawk, grep,
|
||||
inetutils, modutils, net-tools, procps, sed, shadow, sysklogd, sysvinit, tar,
|
||||
util-linux, and vim. The utilities in BusyBox often have fewer options than
|
||||
their full-featured cousins; however, the options that are included provide
|
||||
the expected functionality and behave very much like their larger
|
||||
counterparts.
|
||||
|
||||
BusyBox has been written with size-optimization and limited resources in
|
||||
mind, both to produce small binaries and to reduce run-time memory usage.
|
||||
Busybox is also extremely modular so you can easily include or exclude
|
||||
commands (or features) at compile time. This makes it easy to customize
|
||||
embedded systems; to create a working system, just add /dev, /etc, and a
|
||||
Linux kernel. Busybox (usually together with uClibc) has also been used as
|
||||
a component of "thin client" desktop systems, live-CD distributions, rescue
|
||||
disks, installers, and so on.
|
||||
|
||||
BusyBox provides a fairly complete POSIX environment for any small system,
|
||||
both embedded environments and more full featured systems concerned about
|
||||
space. Busybox is slowly working towards implementing the full Single Unix
|
||||
Specification V3 (http://www.opengroup.org/onlinepubs/009695399/), but isn't
|
||||
there yet (and for size reasons will probably support at most UTF-8 for
|
||||
internationalization). We are also interested in passing the Linux Test
|
||||
Project (http://ltp.sourceforge.net).
|
||||
|
||||
----------------
|
||||
|
||||
Using busybox:
|
||||
|
||||
BusyBox is extremely configurable. This allows you to include only the
|
||||
components and options you need, thereby reducing binary size. Run 'make
|
||||
config' or 'make menuconfig' to select the functionality that you wish to
|
||||
enable.
|
||||
|
||||
The behavior of busybox is determined by the name it's called under: as
|
||||
"cp" it behaves like cp, as "sed" it behaves like sed, and so on. Called
|
||||
as "busybox" it takes the second argument as the name of the applet to
|
||||
run (I.E. "./busybox ls -l /proc").
|
||||
|
||||
The "standalone shell" mode is an easy way to try out busybox; this is a
|
||||
command shell that calls the builtin applets without needing them to be
|
||||
installed in the path. (Note that this requires /proc to be mounted, if
|
||||
testing from a boot floppy or in a chroot environment.)
|
||||
|
||||
The build automatically generates a file "busybox.links", which is used by
|
||||
'make install' to create symlinks to the BusyBox binary for all compiled in
|
||||
commands. Use the PREFIX environment variable to specify where to install
|
||||
the busybox binary and symlink forest. (i.e., 'make PREFIX=/tmp/foo install',
|
||||
or 'make PREFIX=/tmp/foo install-hardlinks' if you prefer hard links.)
|
||||
|
||||
----------------
|
||||
|
||||
Downloading the current source code:
|
||||
|
||||
Source for the latest released version, as well as daily snapshots, can always
|
||||
be downloaded from
|
||||
|
||||
http://busybox.net/downloads/
|
||||
|
||||
You can browse the up to the minute source code and change history online
|
||||
at:
|
||||
|
||||
http://www.busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_00_stable/busybox/
|
||||
|
||||
Anonymous SVN access is available. For instructions, check out:
|
||||
|
||||
http://busybox.net/subversion.html
|
||||
|
||||
For those that are actively contributing and would like to check files in,
|
||||
see:
|
||||
|
||||
http://busybox.net/developer.html
|
||||
|
||||
The developers also have a bug and patch tracking system
|
||||
(http://bugs.busybox.net) although posting a bug/patch to the mailing list
|
||||
is generally a faster way of getting it fixed, and the complete archive of
|
||||
what happened is the subversion changelog.
|
||||
|
||||
----------------
|
||||
|
||||
getting help:
|
||||
|
||||
when you find you need help, you can check out the busybox mailing list
|
||||
archives at http://busybox.net/lists/busybox/ or even join
|
||||
the mailing list if you are interested.
|
||||
|
||||
----------------
|
||||
|
||||
bugs:
|
||||
|
||||
if you find bugs, please submit a detailed bug report to the busybox mailing
|
||||
list at busybox@busybox.net. a well-written bug report should include a
|
||||
transcript of a shell session that demonstrates the bad behavior and enables
|
||||
anyone else to duplicate the bug on their own machine. the following is such
|
||||
an example:
|
||||
|
||||
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.25-vrs2 on a netwinder,
|
||||
and the latest uclibc from cvs. thanks for the wonderful program!
|
||||
|
||||
-diligent
|
||||
|
||||
note the careful description and use of examples showing not only what
|
||||
busybox does, but also a counter example showing what an equivalent app
|
||||
does (or pointing to the text of a relevant standard). Bug reports lacking
|
||||
such detail may never be fixed... Thanks for understanding.
|
||||
|
||||
----------------
|
||||
|
||||
Portability:
|
||||
|
||||
Busybox is developed and tested on Linux 2.4 and 2.6 kernels, linked
|
||||
against uClibc (0.9.27 or greater) and glibc (2.2 or greater). In such
|
||||
an environment, the full set of busybox features should work (and if
|
||||
anything doesn't we want to know about it so we can fix it). Note that
|
||||
the 2.6 kernel can be trimmed down considerably with the aid of Matt
|
||||
Mackall's -tiny work (http://www.selenic.com/tiny-about/).
|
||||
|
||||
Since busybox consists of a large number of more or less independent
|
||||
applets, portability is a question of which features work where. Some
|
||||
busybox applets (such as cat and rm) are highly portable and likely to work
|
||||
just about anywhere, while others (such as insmod and losetup) are only
|
||||
likely to work under fairly recent Linux kernels with recent C libraries.
|
||||
|
||||
Earlier versions of Linux and glibc may or may not work, for any given
|
||||
configuration. Linux 2.2 or earlier should mostly work, but this is no
|
||||
longer regularly tested and inherently won't support certain features (such
|
||||
as long files and --bind mounts). The same is true for glibc 2.0 and 2.1,
|
||||
expect a higher testing and debugging burden using such old infrastructure.
|
||||
(The busybox developers are not very interested in supporting these older
|
||||
versions, but can probably be talked into accepting small patches to fix
|
||||
simple problems.)
|
||||
|
||||
Some environments are not recommended. Early versions of uClibc were buggy
|
||||
and missing many features: upgrade. Linking against libc5 or dietlibc is
|
||||
not supported and not interesting to the busybox developers. (The first is
|
||||
obsolete and has no known size or feature advantages over uClibc, the second
|
||||
has known bugs that its developers have actively refused to fix.) Ancient
|
||||
Linux kernels (2.0.x and earlier) are similarly uninteresting.
|
||||
|
||||
In theory it's possible to use Busybox under other operating systems (such as
|
||||
MacOS X, Solaris, Cygwin, or the BSD Fork Du Jour). This generally involves
|
||||
a different kernel and a different C library at the same time. While it
|
||||
should be possible to port the majority of the code to work in one of
|
||||
these environments, don't be suprised if it doesn't work out of the box. If
|
||||
you're into that sort of thing, start small (selecting just a few applets)
|
||||
and work your way up.
|
||||
|
||||
Shaun Jackman has recently (2005) ported busybox to a combination of newlib
|
||||
and libgloss, and some of his patches have been integrated. This platform
|
||||
may join glibc/uclibc and Linux as a supported combination with the 1.1
|
||||
release, but is not supported in 1.0.
|
||||
|
||||
Supported hardware:
|
||||
|
||||
BusyBox in general will build on any architecture supported by gcc. We
|
||||
support both 32 and 64 bit platforms, and both big and little endian
|
||||
systems.
|
||||
|
||||
Under 2.4 Linux kernels, kernel module loading was implemented in a
|
||||
platform-specific manner. Busybox's insmod utility has been reported to
|
||||
work under ARM, CRIS, H8/300, x86, ia64, x86_64, m68k, MIPS, PowerPC, S390,
|
||||
SH3/4/5, Sparc, v850e, and x86_64. Anything else probably won't work.
|
||||
|
||||
The module loading mechanism for the 2.6 kernel is much more generic, and
|
||||
we believe 2.6.x kernel module loading support should work on all
|
||||
architectures supported by the kernel.
|
||||
|
||||
----------------
|
||||
|
||||
Please feed suggestions, bug reports, insults, and bribes back to the busybox
|
||||
maintainer:
|
||||
Erik Andersen
|
||||
<andersen@codepoet.org>
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#--------------------------------------------------------
|
||||
PROG := busybox
|
||||
VERSION := 1.00-rc2
|
||||
VERSION := 1.01
|
||||
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,13 +80,13 @@ BB_SRC_DIR=
|
||||
#GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
|
||||
|
||||
WARNINGS=-Wall -Wstrict-prototypes -Wshadow
|
||||
CFLAGS=-I$(TOPDIR)include
|
||||
ARFLAGS=-r
|
||||
CFLAGS=-I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)
|
||||
ARFLAGS=cru
|
||||
|
||||
#--------------------------------------------------------
|
||||
export VERSION BUILDTIME TOPDIR HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
|
||||
ifeq ($(strip $(TARGET_ARCH)),)
|
||||
TARGET_ARCH=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
|
||||
TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
|
||||
-e 's/i.86/i386/' \
|
||||
-e 's/sparc.*/sparc/' \
|
||||
-e 's/arm.*/arm/g' \
|
||||
@@ -102,21 +102,29 @@ 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
|
||||
check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
|
||||
then echo "$(1)"; else echo "$(2)"; fi)
|
||||
|
||||
# Setup some shortcuts so that silent mode is silent like it should be
|
||||
ifeq ($(subst s,,$(MAKEFLAGS)),$(MAKEFLAGS))
|
||||
export MAKE_IS_SILENT=n
|
||||
SECHO=@echo
|
||||
else
|
||||
export MAKE_IS_SILENT=y
|
||||
SECHO=-@false
|
||||
endif
|
||||
|
||||
#--------------------------------------------------------
|
||||
# Arch specific compiler optimization stuff should go here.
|
||||
# Unless you want to override the defaults, do not set anything
|
||||
# for OPTIMIZATION...
|
||||
|
||||
# use '-Os' optimization if available, else use -O2
|
||||
OPTIMIZATION=
|
||||
OPTIMIZATION=${call check_gcc,-Os,-O2}
|
||||
OPTIMIZATION:=${call check_gcc,-Os,-O2}
|
||||
|
||||
# Some nice architecture specific optimizations
|
||||
ifeq ($(strip $(TARGET_ARCH)),arm)
|
||||
@@ -158,8 +166,8 @@ ifeq ($(strip $(CONFIG_DEBUG)),y)
|
||||
STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging
|
||||
else
|
||||
CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG
|
||||
LDFLAGS += -s -Wl,-warn-common
|
||||
STRIPCMD:=$(STRIP) --remove-section=.note --remove-section=.comment
|
||||
LDFLAGS += -Wl,-warn-common
|
||||
STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment
|
||||
endif
|
||||
ifeq ($(strip $(CONFIG_STATIC)),y)
|
||||
LDFLAGS += --static
|
||||
@@ -189,12 +197,4 @@ endif
|
||||
# have a chance of winning.
|
||||
CFLAGS += $(CFLAGS_EXTRA)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
|
||||
|
||||
.PHONY: dummy
|
||||
|
||||
|
||||
|
||||
.EXPORT_ALL_VARIABLES:
|
||||
|
||||
File renamed without changes.
@@ -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)
|
||||
@@ -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)
|
||||
$(AR) $(ARFLAGS) $@ $(APPLET_OBJ)
|
||||
|
||||
$(APPLET_OBJ): $(top_builddir)/.config
|
||||
$(APPLET_OBJ): $(APPLETS_DIR)%.o: $(srcdir)/%.c
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
|
||||
|
||||
File renamed without changes.
@@ -144,25 +144,25 @@ int busybox_main(int argc, char **argv)
|
||||
output_width -= 20;
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "%s\n\n"
|
||||
"Usage: busybox [function] [arguments]...\n"
|
||||
" or: [function] [arguments]...\n\n"
|
||||
"\tBusyBox is a multi-call binary that combines many common Unix\n"
|
||||
"\tutilities into a single executable. Most people will create a\n"
|
||||
"\tlink to busybox for each function they wish to use, and BusyBox\n"
|
||||
"\twill act like whatever it was invoked as.\n"
|
||||
"\nCurrently defined functions:\n", bb_msg_full_version);
|
||||
printf("%s\n\n"
|
||||
"Usage: busybox [function] [arguments]...\n"
|
||||
" or: [function] [arguments]...\n\n"
|
||||
"\tBusyBox is a multi-call binary that combines many common Unix\n"
|
||||
"\tutilities into a single executable. Most people will create a\n"
|
||||
"\tlink to busybox for each function they wish to use and BusyBox\n"
|
||||
"\twill act like whatever it was invoked as!\n"
|
||||
"\nCurrently defined functions:\n", bb_msg_full_version);
|
||||
|
||||
while (a->name != 0) {
|
||||
col +=
|
||||
fprintf(stderr, "%s%s", ((col == 0) ? "\t" : ", "),
|
||||
(a++)->name);
|
||||
printf("%s%s", ((col == 0) ? "\t" : ", "),
|
||||
(a++)->name);
|
||||
if (col > output_width && a->name != 0) {
|
||||
fprintf(stderr, ",\n");
|
||||
printf(",\n");
|
||||
col = 0;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "\n\n");
|
||||
printf("\n\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -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)
|
||||
@@ -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) +=
|
||||
@@ -40,5 +41,8 @@ ARCHIVAL-$(CONFIG_UNZIP) += unzip.o
|
||||
libraries-y+=$(ARCHIVAL_DIR)$(ARCHIVAL_AR)
|
||||
|
||||
$(ARCHIVAL_DIR)$(ARCHIVAL_AR): $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
|
||||
$(AR) -ro $@ $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
|
||||
$(AR) $(ARFLAGS) $@ $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
|
||||
|
||||
$(ARCHIVAL_DIR)%.o: $(srcdir)/%.c
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
|
||||
|
||||
@@ -50,24 +50,27 @@ 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
|
||||
#define AR_OPT_INSERT 0x40
|
||||
|
||||
extern int ar_main(int argc, char **argv)
|
||||
{
|
||||
archive_handle_t *archive_handle;
|
||||
unsigned long opt;
|
||||
char *msg_unsupported_err = "Archive %s not supported. Install binutils 'ar'.";
|
||||
char magic[8];
|
||||
|
||||
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, "ptxovcr");
|
||||
|
||||
if ((opt & 0x80000000UL) || (optind == argc)) {
|
||||
if ((opt & BB_GETOPT_ERROR) || (opt == 0) || (optind == argc)) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
@@ -86,6 +89,12 @@ 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(msg_unsupported_err, "creation");
|
||||
}
|
||||
if (opt & AR_OPT_INSERT) {
|
||||
bb_error_msg_and_die(msg_unsupported_err, "insertion");
|
||||
}
|
||||
|
||||
archive_handle->src_fd = bb_xopen(argv[optind++], O_RDONLY);
|
||||
|
||||
@@ -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;
|
||||
File renamed without changes.
@@ -1327,7 +1327,7 @@ void free_array(char **array)
|
||||
* the status_hashtable to retrieve the info. This results in smaller code than
|
||||
* scanning the status file. The resulting list, however, is unsorted.
|
||||
*/
|
||||
void list_packages(void)
|
||||
static void list_packages(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1520,6 +1520,7 @@ static char *deb_extract_control_file_to_buffer(archive_handle_t *ar_handle, lli
|
||||
{
|
||||
ar_handle->sub_archive->action_data = data_extract_to_buffer;
|
||||
ar_handle->sub_archive->accept = myaccept;
|
||||
ar_handle->sub_archive->filter = filter_accept_list;
|
||||
|
||||
unpack_ar_archive(ar_handle);
|
||||
close(ar_handle->src_fd);
|
||||
@@ -1714,6 +1715,7 @@ int dpkg_main(int argc, char **argv)
|
||||
|
||||
if (package_num == -1) {
|
||||
bb_error_msg("Invalid control file in %s", argv[optind]);
|
||||
optind++;
|
||||
continue;
|
||||
}
|
||||
deb_file[deb_count]->package = (unsigned int) package_num;
|
||||
@@ -88,7 +88,7 @@ extern int dpkg_deb_main(int argc, char **argv)
|
||||
argcount = 2;
|
||||
}
|
||||
|
||||
if ((optind + argcount != argc) || (opt & 0x80000000UL)) {
|
||||
if ((optind + argcount != argc) || (opt & BB_GETOPT_ERROR)) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
File renamed without changes.
@@ -51,12 +51,6 @@
|
||||
#include <time.h>
|
||||
#include "busybox.h"
|
||||
|
||||
#define memzero(s, n) memset ((void *)(s), 0, (n))
|
||||
|
||||
#ifndef RETSIGTYPE
|
||||
# define RETSIGTYPE void
|
||||
#endif
|
||||
|
||||
typedef unsigned char uch;
|
||||
typedef unsigned short ush;
|
||||
typedef unsigned long ulg;
|
||||
@@ -214,9 +208,6 @@ typedef int file_t; /* Do not use stdio */
|
||||
static int zip(int in, int out);
|
||||
static int file_read(char *buf, unsigned size);
|
||||
|
||||
/* from gzip.c */
|
||||
static RETSIGTYPE abort_gzip(void);
|
||||
|
||||
/* from deflate.c */
|
||||
static void lm_init(ush * flags);
|
||||
static ulg deflate(void);
|
||||
@@ -335,7 +326,7 @@ static void put_short(ush w)
|
||||
/* ========================================================================
|
||||
* Signal and error handler.
|
||||
*/
|
||||
static void abort_gzip()
|
||||
static void abort_gzip(int ignored)
|
||||
{
|
||||
exit(ERROR);
|
||||
}
|
||||
@@ -350,13 +341,6 @@ static void clear_bufs(void)
|
||||
bytes_in = 0L;
|
||||
}
|
||||
|
||||
static void write_bb_error_msg(void)
|
||||
{
|
||||
fputc('\n', stderr);
|
||||
bb_perror_nomsg();
|
||||
abort_gzip();
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
* Does the same as write(), but also handles partial pipe writes and checks
|
||||
* for error return.
|
||||
@@ -366,9 +350,7 @@ static void write_buf(int fd, void *buf, unsigned cnt)
|
||||
unsigned n;
|
||||
|
||||
while ((n = write(fd, buf, cnt)) != cnt) {
|
||||
if (n == (unsigned) (-1)) {
|
||||
write_bb_error_msg();
|
||||
}
|
||||
if (n == (unsigned) (-1)) bb_error_msg_and_die("can't write");
|
||||
cnt -= n;
|
||||
buf = (void *) ((char *) buf + n);
|
||||
}
|
||||
@@ -559,7 +541,7 @@ static unsigned bi_reverse(unsigned code, int len)
|
||||
/* ===========================================================================
|
||||
* Write out any remaining bits in an incomplete byte.
|
||||
*/
|
||||
static void bi_windup()
|
||||
static void bi_windup(void)
|
||||
{
|
||||
if (bi_valid > 8) {
|
||||
put_short(bi_buf);
|
||||
@@ -846,7 +828,7 @@ static void lm_init(ush * flags)
|
||||
register unsigned j;
|
||||
|
||||
/* Initialize the hash table. */
|
||||
memzero((char *) head, HASH_SIZE * sizeof(*head));
|
||||
memset(head, 0, HASH_SIZE * sizeof(*head));
|
||||
/* prev will be initialized on the fly */
|
||||
|
||||
*flags |= SLOW;
|
||||
@@ -996,7 +978,7 @@ static void check_match(IPos start, IPos match, int length)
|
||||
* file reads are performed for at least two bytes (required for the
|
||||
* translate_eol option).
|
||||
*/
|
||||
static void fill_window()
|
||||
static void fill_window(void)
|
||||
{
|
||||
register unsigned n, m;
|
||||
unsigned more =
|
||||
@@ -1060,7 +1042,7 @@ static void fill_window()
|
||||
* evaluation for matches: a match is finally adopted only if there is
|
||||
* no better match at the next window position.
|
||||
*/
|
||||
static ulg deflate()
|
||||
static ulg deflate(void)
|
||||
{
|
||||
IPos hash_head; /* head of hash chain */
|
||||
IPos prev_match; /* previous match */
|
||||
@@ -1188,8 +1170,6 @@ static ulg deflate()
|
||||
|
||||
typedef struct dirent dir_type;
|
||||
|
||||
typedef RETSIGTYPE(*sig_type) (int);
|
||||
|
||||
/* ======================================================================== */
|
||||
int gzip_main(int argc, char **argv)
|
||||
{
|
||||
@@ -1235,16 +1215,16 @@ int gzip_main(int argc, char **argv)
|
||||
|
||||
foreground = signal(SIGINT, SIG_IGN) != SIG_IGN;
|
||||
if (foreground) {
|
||||
(void) signal(SIGINT, (sig_type) abort_gzip);
|
||||
(void) signal(SIGINT, abort_gzip);
|
||||
}
|
||||
#ifdef SIGTERM
|
||||
if (signal(SIGTERM, SIG_IGN) != SIG_IGN) {
|
||||
(void) signal(SIGTERM, (sig_type) abort_gzip);
|
||||
(void) signal(SIGTERM, abort_gzip);
|
||||
}
|
||||
#endif
|
||||
#ifdef SIGHUP
|
||||
if (signal(SIGHUP, SIG_IGN) != SIG_IGN) {
|
||||
(void) signal(SIGHUP, (sig_type) abort_gzip);
|
||||
(void) signal(SIGHUP, abort_gzip);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1271,6 +1251,7 @@ int gzip_main(int argc, char **argv)
|
||||
for (i = optind; i < argc; i++) {
|
||||
char *path = NULL;
|
||||
|
||||
clear_bufs();
|
||||
if (strcmp(argv[i], "-") == 0) {
|
||||
time_stamp = 0;
|
||||
ifile_size = -1L;
|
||||
@@ -1749,7 +1730,7 @@ static void ct_init(ush * attr, int *methodp)
|
||||
/* ===========================================================================
|
||||
* Initialize a new block.
|
||||
*/
|
||||
static void init_block()
|
||||
static void init_block(void)
|
||||
{
|
||||
int n; /* iterates over tree elements */
|
||||
|
||||
@@ -2162,7 +2143,7 @@ static void send_tree(ct_data * tree, int max_code)
|
||||
* Construct the Huffman tree for the bit lengths and return the index in
|
||||
* bl_order of the last bit length code to send.
|
||||
*/
|
||||
static const int build_bl_tree()
|
||||
static int build_bl_tree(void)
|
||||
{
|
||||
int max_blindex; /* index of last bit length code of non zero freq */
|
||||
|
||||
@@ -2425,7 +2406,7 @@ static void compress_block(ct_data * ltree, ct_data * dtree)
|
||||
* IN assertion: the fields freq of dyn_ltree are set and the total of all
|
||||
* frequencies does not exceed 64K (to fit in an int on 16 bit machines).
|
||||
*/
|
||||
static void set_file_type()
|
||||
static void set_file_type(void)
|
||||
{
|
||||
int n = 0;
|
||||
unsigned ascii_freq = 0;
|
||||
@@ -2538,7 +2519,7 @@ static int file_read(char *buf, unsigned size)
|
||||
* Write the output buffer outbuf[0..outcnt-1] and update bytes_out.
|
||||
* (used for the compressed data only)
|
||||
*/
|
||||
static void flush_outbuf()
|
||||
static void flush_outbuf(void)
|
||||
{
|
||||
if (outcnt == 0)
|
||||
return;
|
||||
@@ -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)
|
||||
@@ -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:= \
|
||||
\
|
||||
@@ -76,5 +77,8 @@ LIBUNARCHIVE-$(CONFIG_UNZIP) += $(GUNZIP_FILES)
|
||||
libraries-y+=$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR)
|
||||
|
||||
$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR): $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
|
||||
$(AR) -ro $@ $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
|
||||
$(AR) $(ARFLAGS) $@ $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
|
||||
|
||||
$(LIBUNARCHIVA_DIR)%.o: $(srcdir)/%.c
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
|
||||
|
||||
File renamed without changes.
+1
-1
@@ -26,7 +26,7 @@ extern ssize_t archive_xread_all_eof(archive_handle_t *archive_handle, unsigned
|
||||
|
||||
size = bb_full_read(archive_handle->src_fd, buf, count);
|
||||
if ((size != 0) && (size != count)) {
|
||||
bb_perror_msg_and_die("Short read, read %d of %d", size, count);
|
||||
bb_perror_msg_and_die("Short read, read %ld of %ld", (long)size, (long)count);
|
||||
}
|
||||
return(size);
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+13
-10
@@ -284,16 +284,15 @@ static int get_next_block(bunzip_data *bd)
|
||||
mtfSymbol[i]=(unsigned char)i;
|
||||
}
|
||||
/* Loop through compressed symbols. */
|
||||
runPos=dbufCount=symCount=selector=0;
|
||||
runPos=dbufCount=selector=0;
|
||||
for(;;) {
|
||||
/* Determine which Huffman coding group to use. */
|
||||
if(!(symCount--)) {
|
||||
symCount=GROUP_SIZE-1;
|
||||
if(selector>=nSelectors) return RETVAL_DATA_ERROR;
|
||||
hufGroup=bd->groups+selectors[selector++];
|
||||
base=hufGroup->base-1;
|
||||
limit=hufGroup->limit-1;
|
||||
}
|
||||
/* fetch next Huffman coding group from list. */
|
||||
symCount=GROUP_SIZE-1;
|
||||
if(selector>=nSelectors) return RETVAL_DATA_ERROR;
|
||||
hufGroup=bd->groups+selectors[selector++];
|
||||
base=hufGroup->base-1;
|
||||
limit=hufGroup->limit-1;
|
||||
continue_this_group:
|
||||
/* 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
|
||||
@@ -344,7 +343,7 @@ got_huff_bits:
|
||||
context). Thus space is saved. */
|
||||
t += (runPos << nextSym); /* +runPos if RUNA; +2*runPos if RUNB */
|
||||
runPos <<= 1;
|
||||
continue;
|
||||
goto end_of_huffman_loop;
|
||||
}
|
||||
/* When we hit the first non-run symbol after a run, we now know
|
||||
how many times to repeat the last literal, so append that many
|
||||
@@ -382,6 +381,10 @@ got_huff_bits:
|
||||
/* We have our literal byte. Save it into dbuf. */
|
||||
byteCount[uc]++;
|
||||
dbuf[dbufCount++] = (unsigned int)uc;
|
||||
/* Skip group initialization if we're not done with this group. Done this
|
||||
* way to avoid compiler warning. */
|
||||
end_of_huffman_loop:
|
||||
if(symCount--) goto continue_this_group;
|
||||
}
|
||||
/* 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
|
||||
File renamed without changes.
+4
-1
@@ -151,7 +151,10 @@ static unsigned int fill_bitbuffer(unsigned int bitbuffer, unsigned int *current
|
||||
/* Leave the first 4 bytes empty so we can always unwind the bitbuffer
|
||||
* to the front of the bytebuffer, leave 4 bytes free at end of tail
|
||||
* so we can easily top up buffer in check_trailer_gzip() */
|
||||
bytebuffer_size = 4 + bb_xread(gunzip_src_fd, &bytebuffer[4], bytebuffer_max - 8);
|
||||
if (!(bytebuffer_size = bb_xread(gunzip_src_fd, &bytebuffer[4], bytebuffer_max - 8))) {
|
||||
bb_error_msg_and_die("unexpected end of file");
|
||||
}
|
||||
bytebuffer_size += 4;
|
||||
bytebuffer_offset = 4;
|
||||
}
|
||||
bitbuffer |= ((unsigned int) bytebuffer[bytebuffer_offset]) << *current;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+10
@@ -62,6 +62,7 @@ extern char get_header_tar(archive_handle_t *archive_handle)
|
||||
} tar;
|
||||
long sum = 0;
|
||||
long i;
|
||||
static int end = 0;
|
||||
|
||||
/* Align header */
|
||||
data_align(archive_handle, 512);
|
||||
@@ -74,8 +75,17 @@ extern char get_header_tar(archive_handle_t *archive_handle)
|
||||
|
||||
/* If there is no filename its an empty header */
|
||||
if (tar.formated.name[0] == 0) {
|
||||
if (end) {
|
||||
/* This is the second consecutive empty header! End of archive!
|
||||
* Read until the end to empty the pipe from gz or bz2
|
||||
*/
|
||||
while (bb_full_read(archive_handle->src_fd, tar.raw, 512) == 512);
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
end = 1;
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
end = 0;
|
||||
|
||||
/* Check header has valid magic, "ustar" is for the proper tar
|
||||
* 0's are for the old tar format
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -234,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) {
|
||||
@@ -724,7 +724,7 @@ int tar_main(int argc, char **argv)
|
||||
);
|
||||
|
||||
/* Check one and only one context option was given */
|
||||
if(opt & 0x80000000UL) {
|
||||
if(opt & BB_GETOPT_ERROR) {
|
||||
bb_show_usage();
|
||||
}
|
||||
#ifdef CONFIG_FEATURE_TAR_CREATE
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -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)
|
||||
@@ -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
|
||||
@@ -36,5 +37,8 @@ CONSOLETOOLS_DIR-$(CONFIG_SETKEYCODES) += setkeycodes.o
|
||||
libraries-y+=$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR)
|
||||
|
||||
$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR): $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
|
||||
$(AR) -ro $@ $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
|
||||
$(AR) $(ARFLAGS) $@ $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
|
||||
|
||||
$(CONSOLETOOLS_DIR)%.o: $(srcdir)/%.c
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -35,11 +35,11 @@ struct kbentry {
|
||||
unsigned char kb_index;
|
||||
unsigned short kb_value;
|
||||
};
|
||||
static const int KDGKBENT = 0x4B46; /* gets one entry in translation table */
|
||||
#define KDGKBENT 0x4B46 /* gets one entry in translation table */
|
||||
|
||||
/* From <linux/keyboard.h> */
|
||||
static const int NR_KEYS = 128;
|
||||
static const int MAX_NR_KEYMAPS = 256;
|
||||
#define NR_KEYS 128
|
||||
#define MAX_NR_KEYMAPS 256
|
||||
|
||||
int dumpkmap_main(int argc, char **argv)
|
||||
{
|
||||
@@ -47,28 +47,21 @@ int dumpkmap_main(int argc, char **argv)
|
||||
int i, j, fd;
|
||||
char flags[MAX_NR_KEYMAPS], magic[] = "bkeymap";
|
||||
|
||||
if (argc>=2 && *argv[1]=='-') {
|
||||
if (argc >= 2 && *argv[1] == '-')
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
fd=bb_xopen(CURRENT_VC, O_RDWR);
|
||||
fd = bb_xopen(CURRENT_VC, O_RDWR);
|
||||
|
||||
write(1, magic, 7);
|
||||
|
||||
for (i=0; i < MAX_NR_KEYMAPS; i++) flags[i]=0;
|
||||
flags[0]=1;
|
||||
flags[1]=1;
|
||||
flags[2]=1;
|
||||
flags[4]=1;
|
||||
flags[5]=1;
|
||||
flags[6]=1;
|
||||
flags[8]=1;
|
||||
flags[9]=1;
|
||||
flags[10]=1;
|
||||
flags[12]=1;
|
||||
/* Here we want to set everything to 0 except for indexes:
|
||||
* [0-2] [4-6] [8-10] [12] */
|
||||
memset(flags, 0x00, MAX_NR_KEYMAPS);
|
||||
memset(flags, 0x01, 13);
|
||||
flags[3] = flags[7] = flags[11] = 0;
|
||||
|
||||
/* dump flags */
|
||||
for (i=0; i < MAX_NR_KEYMAPS; i++) write(1,&flags[i],1);
|
||||
write(1, flags, MAX_NR_KEYMAPS);
|
||||
|
||||
for (i = 0; i < MAX_NR_KEYMAPS; i++) {
|
||||
if (flags[i] == 1) {
|
||||
@@ -76,13 +69,13 @@ int dumpkmap_main(int argc, char **argv)
|
||||
ke.kb_index = j;
|
||||
ke.kb_table = i;
|
||||
if (ioctl(fd, KDGKBENT, &ke) < 0) {
|
||||
|
||||
bb_error_msg("ioctl returned: %m, %s, %s, %xqq", (char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
|
||||
}
|
||||
else {
|
||||
write(1,(void*)&ke.kb_value,2);
|
||||
}
|
||||
|
||||
bb_perror_msg("ioctl failed with %s, %s, %p",
|
||||
(char *)&ke.kb_index,
|
||||
(char *)&ke.kb_table,
|
||||
&ke.kb_value);
|
||||
} else {
|
||||
write(1, (void*)&ke.kb_value, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -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_UTMP
|
||||
help
|
||||
who is used to show who is logged on.
|
||||
|
||||
@@ -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)
|
||||
@@ -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
|
||||
@@ -90,4 +91,8 @@ COREUTILS-$(CONFIG_YES) += yes.o
|
||||
libraries-y+=$(COREUTILS_DIR)$(COREUTILS_AR)
|
||||
|
||||
$(COREUTILS_DIR)$(COREUTILS_AR): $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y))
|
||||
$(AR) -ro $@ $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y))
|
||||
$(AR) $(ARFLAGS) $@ $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y))
|
||||
|
||||
$(COREUTILS_DIR)%.o: $(srcdir)/%.c
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -42,7 +42,7 @@
|
||||
#include "libcoreutils/coreutils.h"
|
||||
|
||||
/* WARNING!! ORDER IS IMPORTANT!! */
|
||||
static const char cp_opts[] = "pdRfiar";
|
||||
static const char cp_opts[] = "pdRfiarP";
|
||||
|
||||
extern int cp_main(int argc, char **argv)
|
||||
{
|
||||
@@ -73,6 +73,12 @@ extern int cp_main(int argc, char **argv)
|
||||
*/
|
||||
flags |= FILEUTILS_RECUR;
|
||||
}
|
||||
if (flags & 128) {
|
||||
/* Make -P a synonym for -d,
|
||||
* -d is the GNU option while -P is the POSIX 2003 option
|
||||
*/
|
||||
flags |= FILEUTILS_DEREFERENCE;
|
||||
}
|
||||
|
||||
flags ^= FILEUTILS_DEREFERENCE; /* The sense of this flag was reversed. */
|
||||
|
||||
@@ -300,7 +300,7 @@ extern int cut_main(int argc, char **argv)
|
||||
part = opt & (OPT_BYTE_FLGS|OPT_CHAR_FLGS|OPT_FIELDS_FLGS);
|
||||
if(part == 0)
|
||||
bb_error_msg_and_die("you must specify a list of bytes, characters, or fields");
|
||||
if(opt & 0x80000000UL)
|
||||
if(opt & BB_GETOPT_ERROR)
|
||||
bb_error_msg_and_die("only one type of list may be specified");
|
||||
parse_lists(sopt);
|
||||
if((opt & (OPT_DELIM_FLGS))) {
|
||||
@@ -47,6 +47,7 @@
|
||||
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;
|
||||
@@ -127,7 +136,6 @@ int date_main(int argc, char **argv)
|
||||
{
|
||||
char *date_str = NULL;
|
||||
char *date_fmt = NULL;
|
||||
char *t_buff;
|
||||
int set_time;
|
||||
int utc;
|
||||
int use_arg = 0;
|
||||
@@ -157,7 +165,7 @@ int date_main(int argc, char **argv)
|
||||
bb_error_msg_and_die(bb_msg_memory_exhausted);
|
||||
}
|
||||
use_arg = opt & DATE_OPT_DATE;
|
||||
if(opt & 0x80000000UL)
|
||||
if(opt & BB_GETOPT_ERROR)
|
||||
bb_show_usage();
|
||||
#ifdef CONFIG_FEATURE_DATE_ISOFMT
|
||||
if(opt & DATE_OPT_TIMESPEC) {
|
||||
@@ -274,10 +282,13 @@ int date_main(int argc, char **argv)
|
||||
date_fmt = "%Y.%m.%d-%H:%M:%S";
|
||||
}
|
||||
|
||||
/* Print OUTPUT (after ALL that!) */
|
||||
t_buff = xmalloc(201);
|
||||
strftime(t_buff, 200, date_fmt, &tm_time);
|
||||
puts(t_buff);
|
||||
{
|
||||
/* Print OUTPUT (after ALL that!) */
|
||||
RESERVE_CONFIG_BUFFER(t_buff, 201);
|
||||
strftime(t_buff, 200, date_fmt, &tm_time);
|
||||
puts(t_buff);
|
||||
RELEASE_CONFIG_BUFFER(t_buff);
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
File renamed without changes.
@@ -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;
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -245,10 +245,9 @@ static int arithmetic_common (VALUE *l, VALUE *r, int op)
|
||||
static VALUE *docolon (VALUE *sv, VALUE *pv)
|
||||
{
|
||||
VALUE *v;
|
||||
const char *errmsg;
|
||||
struct re_pattern_buffer re_buffer;
|
||||
struct re_registers re_regs;
|
||||
int len;
|
||||
regex_t re_buffer;
|
||||
const int NMATCH = 2;
|
||||
regmatch_t re_regs[NMATCH];
|
||||
|
||||
tostring (sv);
|
||||
tostring (pv);
|
||||
@@ -260,27 +259,22 @@ of a basic regular expression is not portable; it is being ignored",
|
||||
pv->u.s);
|
||||
}
|
||||
|
||||
len = strlen (pv->u.s);
|
||||
memset (&re_buffer, 0, sizeof (re_buffer));
|
||||
memset (&re_regs, 0, sizeof (re_regs));
|
||||
re_buffer.allocated = 2 * len;
|
||||
re_buffer.buffer = (unsigned char *) xmalloc (re_buffer.allocated);
|
||||
re_buffer.translate = 0;
|
||||
re_syntax_options = RE_SYNTAX_POSIX_BASIC;
|
||||
errmsg = re_compile_pattern (pv->u.s, len, &re_buffer);
|
||||
if (errmsg) {
|
||||
bb_error_msg_and_die("%s", errmsg);
|
||||
}
|
||||
memset (re_regs, 0, sizeof (*re_regs));
|
||||
if( regcomp (&re_buffer, pv->u.s, 0) != 0 )
|
||||
bb_error_msg_and_die("Invalid regular expression");
|
||||
|
||||
len = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs);
|
||||
if (len >= 0) {
|
||||
/* expr uses an anchored pattern match, so check that there was a
|
||||
* match and that the match starts at offset 0. */
|
||||
if (regexec (&re_buffer, sv->u.s, NMATCH, re_regs, 0) != REG_NOMATCH &&
|
||||
re_regs[0].rm_so == 0) {
|
||||
/* Were \(...\) used? */
|
||||
if (re_buffer.re_nsub > 0) { /* was (re_regs.start[1] >= 0) */
|
||||
sv->u.s[re_regs.end[1]] = '\0';
|
||||
v = str_value (sv->u.s + re_regs.start[1]);
|
||||
if (re_buffer.re_nsub > 0) {
|
||||
sv->u.s[re_regs[1].rm_eo] = '\0';
|
||||
v = str_value (sv->u.s + re_regs[1].rm_so);
|
||||
}
|
||||
else
|
||||
v = int_value (len);
|
||||
v = int_value (re_regs[0].rm_eo);
|
||||
}
|
||||
else {
|
||||
/* Match failed -- return the right kind of null. */
|
||||
@@ -289,7 +283,6 @@ of a basic regular expression is not portable; it is being ignored",
|
||||
else
|
||||
v = int_value (0);
|
||||
}
|
||||
free (re_buffer.buffer);
|
||||
return v;
|
||||
}
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 810 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user