Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cbc300d08 | ||
|
|
6f01ccffc2 | ||
|
|
4ac9819263 | ||
|
|
5b807cd5ac | ||
|
|
d7686c8c2c | ||
|
|
e7aa0d9eca | ||
|
|
0d5866624d | ||
|
|
0da1c0a732 | ||
|
|
dc3d8939d4 | ||
|
|
f2a8d5db9a | ||
|
|
00ea82e846 | ||
|
|
45de0746b3 | ||
|
|
e10db56aa3 | ||
|
|
1cc4b13917 | ||
|
|
263cff9a2f | ||
|
|
d7874ed1d4 | ||
|
|
0793491ff8 | ||
|
|
a67a9627d0 | ||
|
|
ffc39202aa | ||
|
|
f210cff601 | ||
|
|
16d1e3c26f | ||
|
|
5da42fce51 | ||
|
|
007c6fc677 | ||
|
|
aa369e0f0d | ||
|
|
4803db53b8 | ||
|
|
dbfa45b3b2 | ||
|
|
cbfe6ad4c6 | ||
|
|
19679784c0 | ||
|
|
09516066d4 | ||
|
|
79b021d738 | ||
|
|
e531759ef1 | ||
|
|
a43df64eec | ||
|
|
0568b6e45a | ||
|
|
334fcc8fd4 | ||
|
|
eecbb547d2 | ||
|
|
63416cc57d | ||
|
|
dc9495df03 | ||
|
|
80a3418b8c | ||
|
|
aebb742939 | ||
|
|
e2944af43e | ||
|
|
6d48d3ee2a | ||
|
|
be116490d6 | ||
|
|
e766f62132 | ||
|
|
09449630fb | ||
|
|
97af2ff8ca | ||
|
|
d1090c91cc | ||
|
|
f3b56b428f | ||
|
|
bac9f03ed8 | ||
|
|
330d898e99 | ||
|
|
0e1b626b9a | ||
|
|
7cee00e8ae | ||
|
|
e56f22ac60 | ||
|
|
86e83ec487 | ||
|
|
7cc5a50465 | ||
|
|
3b5a664440 | ||
|
|
997538ab58 | ||
|
|
d6513cff17 | ||
|
|
3ed181b7ac | ||
|
|
4abfc2642d | ||
|
|
753a3ce73e | ||
|
|
7d6a791ef6 | ||
|
|
13ca4b12e2 | ||
|
|
252ccba948 | ||
|
|
e414896f38 | ||
|
|
c1fc3d3000 | ||
|
|
875f782b12 | ||
|
|
6ae6426a74 | ||
|
|
b71ce023e9 | ||
|
|
f8e6b6eccb | ||
|
|
941990f0c5 | ||
|
|
38dd8aa657 | ||
|
|
7aca89a7a3 | ||
|
|
73b71f381d | ||
|
|
d23f64eba7 | ||
|
|
fff73641e4 | ||
|
|
9531f7dad7 | ||
|
|
5c2e81bb67 | ||
|
|
01ba1676af | ||
|
|
f6106e6041 | ||
|
|
53fd1bf223 | ||
|
|
9038d6f8f5 | ||
|
|
7dd0ce4953 | ||
|
|
0ad438b12a | ||
|
|
3b405437b8 | ||
|
|
b3ba9e28e8 | ||
|
|
e46601d8a3 | ||
|
|
8e96b5b531 | ||
|
|
2907e79749 | ||
|
|
189f74d0f2 | ||
|
|
044b18083b | ||
|
|
1302892a14 | ||
|
|
fda8f57360 | ||
|
|
42a8fd0db0 | ||
|
|
883cea4751 | ||
|
|
2e6d4ef695 | ||
|
|
860d2bbdda | ||
|
|
874201fee5 | ||
|
|
ae68f1133f | ||
|
|
52a426744e | ||
|
|
4c8a721b45 | ||
|
|
b773f715d6 | ||
|
|
da49f58524 | ||
|
|
95cc814dbd | ||
|
|
a51543a3a4 | ||
|
|
7e7e08fb09 | ||
|
|
57dc5345e2 | ||
|
|
666e1d3978 | ||
|
|
fe4ef36bcd | ||
|
|
6f58be0748 | ||
|
|
2d7b5bfa9b | ||
|
|
09e63bb81f | ||
|
|
9b1b62adc4 | ||
|
|
b22bbfffec | ||
|
|
fca70a8cce | ||
|
|
c5d07fba29 | ||
|
|
97ef65483a | ||
|
|
7895b91743 | ||
|
|
c3b6f2c7e1 | ||
|
|
ae05dd42ca | ||
|
|
86e992da84 | ||
|
|
ec97062b20 | ||
|
|
ca4f8d54e5 | ||
|
|
5508363fd0 | ||
|
|
5478aaf5b8 | ||
|
|
90db359972 | ||
|
|
cf4e503875 | ||
|
|
7d5ddf14a3 | ||
|
|
8bca3e20b9 | ||
|
|
f1fab09242 | ||
|
|
ab0c8d7b35 | ||
|
|
7f43280420 | ||
|
|
1881ba48b1 | ||
|
|
4fc5ec56f9 | ||
|
|
eb1cda2f2d | ||
|
|
7e6034309e | ||
|
|
4248c33a85 | ||
|
|
d30b89c7ee | ||
|
|
2f86ca1350 | ||
|
|
b0bee2b0da | ||
|
|
7a76eba1f6 | ||
|
|
8e5d83b6c1 | ||
|
|
beca96ffa7 | ||
|
|
f3b92d3856 | ||
|
|
e2e4cc249d | ||
|
|
b96159d663 | ||
|
|
e1e2273076 | ||
|
|
bf4aeed129 | ||
|
|
c9f280cc46 | ||
|
|
2207cd6e14 | ||
|
|
bcbd37df24 | ||
|
|
14f6f0ad4a | ||
|
|
7eaf58d958 | ||
|
|
ee47f6e44f | ||
|
|
a5bdbe1087 | ||
|
|
dc36a72ac0 | ||
|
|
799d00e84c | ||
|
|
6947d2c7e1 | ||
|
|
2b0e957808 | ||
|
|
4945ed32d7 | ||
|
|
31af3d5a1d | ||
|
|
ac906fa85e | ||
|
|
ed8982bfc0 | ||
|
|
26918dd28e | ||
|
|
cab3a0127c | ||
|
|
56f2d06c64 | ||
|
|
990a617edf | ||
|
|
1d924f59b1 | ||
|
|
47f2d7ef7d | ||
|
|
1f363a0867 | ||
|
|
9517d8ad72 | ||
|
|
6548edd430 | ||
|
|
4813a5100d | ||
|
|
cd3dd42c28 | ||
|
|
82a6fb3ea6 | ||
|
|
2441060beb | ||
|
|
16635cc2e0 | ||
|
|
a3dcee3e8a | ||
|
|
145512c634 | ||
|
|
a99aa6e9c4 | ||
|
|
641dd7b080 | ||
|
|
77539190ab | ||
|
|
9ca656b149 | ||
|
|
1d77db8459 | ||
|
|
a4bcbd0e04 | ||
|
|
9d617c44d2 | ||
|
|
2634bf366b | ||
|
|
38d9072b2c | ||
|
|
764b2f0ec0 | ||
|
|
df5131cf3d | ||
|
|
8f24f9812d | ||
|
|
d6b05eb9c2 | ||
|
|
62152da892 | ||
|
|
035b4d77dc | ||
|
|
71016baf55 | ||
|
|
0f952c249e | ||
|
|
53f1791212 | ||
|
|
d5f1b1bbe0 | ||
|
|
8507e1f109 | ||
|
|
a43972cb0f | ||
|
|
dc2bbb9669 | ||
|
|
0821801349 | ||
|
|
6f22624a91 | ||
|
|
295fef80bc | ||
|
|
98f74034cd | ||
|
|
5177e28e9c | ||
|
|
eab40e5885 | ||
|
|
a1e5ebe9bd | ||
|
|
6a46ab8b8f | ||
|
|
ef3e7fdd3b | ||
|
|
dc3bc40578 | ||
|
|
ff64fb9e31 | ||
|
|
f524b6c87f | ||
|
|
28a105d867 | ||
|
|
4b7db4f2ca | ||
|
|
171932d7ca | ||
|
|
e640cb4ad1 | ||
|
|
5d7cca2090 | ||
|
|
dd6b211921 | ||
|
|
b9f2bb36ea | ||
|
|
f3cbfc0e2c | ||
|
|
398c659970 | ||
|
|
93cadc2fdd | ||
|
|
673e945052 | ||
|
|
29ec116037 | ||
|
|
68759edb6e | ||
|
|
e2df5f46d0 | ||
|
|
140def848c | ||
|
|
8d7be232a3 | ||
|
|
bf2af9acb2 | ||
|
|
4f26c97b9a | ||
|
|
e9bda90e54 | ||
|
|
342a63d659 | ||
|
|
12bcc76e9b | ||
|
|
7b424fe738 | ||
|
|
cc9205bda7 | ||
|
|
33f85eeac5 | ||
|
|
2b132e5139 | ||
|
|
d8aeba4eed | ||
|
|
c706845539 | ||
|
|
6d335be211 | ||
|
|
73f3799236 | ||
|
|
e18255d1da | ||
|
|
38478a600f | ||
|
|
0149f02a72 | ||
|
|
5e61115ea4 | ||
|
|
5a49d284a6 | ||
|
|
e424423a7b | ||
|
|
167cd709df | ||
|
|
16bda3bd1f | ||
|
|
c396fe6306 | ||
|
|
020f40693a | ||
|
|
071ede1e5d | ||
|
|
c15f40c3e7 | ||
|
|
1b0a93edb9 | ||
|
|
810b7161dc | ||
|
|
e71dd7c1db | ||
|
|
7a5814c74c | ||
|
|
318a8e5ed5 | ||
|
|
845142e106 | ||
|
|
f427c80d02 | ||
|
|
c8ab67cad8 | ||
|
|
8082ea1000 | ||
|
|
b5d5245f46 | ||
|
|
8606aba04b | ||
|
|
af61b2a5ad | ||
|
|
1e12ae9059 | ||
|
|
2b6497ba84 | ||
|
|
00ffaeab80 | ||
|
|
3322351724 | ||
|
|
4f239b1bb4 | ||
|
|
76f5e38c82 | ||
|
|
6245202e7f | ||
|
|
62851171db | ||
|
|
acdc49c073 | ||
|
|
cb6ff25afe | ||
|
|
e19e1935a3 | ||
|
|
b1cfc45376 | ||
|
|
aa0a12d549 | ||
|
|
1dd6cf8677 | ||
|
|
54e0843e7d | ||
|
|
48a29defca | ||
|
|
9c35a1cfb6 | ||
|
|
44d1989997 | ||
|
|
05ae400830 | ||
|
|
47aaa2bee6 | ||
|
|
690ad2426e | ||
|
|
1fd3b38fd1 | ||
|
|
052ad9a568 | ||
|
|
c8653f62f2 | ||
|
|
42e4af3119 | ||
|
|
28e67966f3 | ||
|
|
572930027d | ||
|
|
5b7589eb27 | ||
|
|
80e57eb7d5 | ||
|
|
f4e4563fe7 | ||
|
|
71c165780a | ||
|
|
5bf59c104a | ||
|
|
f6b4685691 | ||
|
|
9ac3dc764a | ||
|
|
6fb5f01c0b | ||
|
|
26cf2831d7 | ||
|
|
67c1c7b456 | ||
|
|
eb4e5ecc32 | ||
|
|
c2931aa2df | ||
|
|
c8d7109f60 | ||
|
|
00643ca520 | ||
|
|
1cf4a0eb81 | ||
|
|
574c316e5a | ||
|
|
b029154a2a | ||
|
|
8ed1945a91 | ||
|
|
a771e7c005 | ||
|
|
e6b10ef0a7 | ||
|
|
f9d4fc3cf8 | ||
|
|
950bd72966 | ||
|
|
5e34ff29bc | ||
|
|
8b814b4a34 | ||
|
|
76478b8091 | ||
|
|
0ad8234474 | ||
|
|
1b47bbdfa4 | ||
|
|
ad4bd0548a | ||
|
|
d40fa397e4 | ||
|
|
e41fdbc279 | ||
|
|
8c64e033c0 | ||
|
|
11c17f75a7 | ||
|
|
dcd78c4d0f | ||
|
|
3798db58cf | ||
|
|
f66fe9af89 | ||
|
|
9f8d938172 | ||
|
|
bf25fbccb9 | ||
|
|
a29c935442 | ||
|
|
c7cc5a9432 | ||
|
|
885b6f29ae | ||
|
|
6008d8a3cc | ||
|
|
38e626df4d | ||
|
|
6a07d1fb5c | ||
|
|
730106767e | ||
|
|
40e84374ec | ||
|
|
eb85849b50 | ||
|
|
6b9e05392b | ||
|
|
7b9e5c57ae | ||
|
|
3d40d8e655 | ||
|
|
3be2308676 | ||
|
|
66cb86e489 | ||
|
|
270b1c3f68 | ||
|
|
4ea187fd62 | ||
|
|
e4bd4f2cc8 | ||
|
|
f8c1f02d2f | ||
|
|
5ff9629b8f | ||
|
|
184f4ff432 | ||
|
|
3161b61199 | ||
|
|
6dda5dec23 | ||
|
|
ea4f0847c3 | ||
|
|
fa4ca7889e | ||
|
|
bb929517a8 | ||
|
|
74a931ac9e | ||
|
|
c4ada79343 | ||
|
|
41ddecd9ed | ||
|
|
c376db332c | ||
|
|
27014ed5cb | ||
|
|
c3587223c7 |
No files matched your search
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# Kbuild ignores
|
||||
#
|
||||
.*
|
||||
*.o
|
||||
*.o.*
|
||||
*.a
|
||||
*.s
|
||||
|
||||
#
|
||||
# Never ignore these
|
||||
#
|
||||
!.gitignore
|
||||
|
||||
#
|
||||
# Normal output
|
||||
#
|
||||
/busybox
|
||||
/busybox_unstripped*
|
||||
|
||||
#
|
||||
# Backups / patches
|
||||
#
|
||||
*~
|
||||
*.orig
|
||||
*.rej
|
||||
/*.patch
|
||||
|
||||
#
|
||||
# debugging stuff
|
||||
#
|
||||
core
|
||||
.gdb_history
|
||||
.gdbinit
|
||||
@@ -30,18 +30,6 @@ config EXTRA_COMPAT
|
||||
some GNU extensions in libc. You probably only need this option
|
||||
if you plan to run busybox on desktop.
|
||||
|
||||
config FEATURE_ASSUME_UNICODE
|
||||
bool "Assume that 1:1 char/glyph correspondence is not true"
|
||||
default n
|
||||
help
|
||||
This makes various applets aware that one byte is not
|
||||
one character on screen.
|
||||
|
||||
Busybox aims to eventually work correctly with Unicode displays.
|
||||
Any older encodings are not guaranteed to work.
|
||||
Probably by the time when busybox will be fully Unicode-clean,
|
||||
other encodings will be mainly of historic interest.
|
||||
|
||||
choice
|
||||
prompt "Buffer allocation policy"
|
||||
default FEATURE_BUFFERS_USE_MALLOC
|
||||
@@ -114,7 +102,29 @@ config LOCALE_SUPPORT
|
||||
Enable this if your system has locale support and you would like
|
||||
busybox to support locale settings.
|
||||
|
||||
config GETOPT_LONG
|
||||
config FEATURE_ASSUME_UNICODE
|
||||
bool "Support Unicode"
|
||||
default n
|
||||
help
|
||||
This makes various applets aware that one byte is not
|
||||
one character on screen.
|
||||
|
||||
Busybox aims to eventually work correctly with Unicode displays.
|
||||
Any older encodings are not guaranteed to work.
|
||||
Probably by the time when busybox will be fully Unicode-clean,
|
||||
other encodings will be mainly of historic interest.
|
||||
|
||||
config FEATURE_CHECK_UNICODE_IN_ENV
|
||||
bool "Check $LANG environment variable"
|
||||
default y
|
||||
depends on FEATURE_ASSUME_UNICODE && !LOCALE_SUPPORT
|
||||
help
|
||||
With this option on, Unicode support is activated
|
||||
only if LANG variable has the value of the form "xxxx.utf8"
|
||||
|
||||
Otherwise, Unicode support will be always enabled and active.
|
||||
|
||||
config LONG_OPTS
|
||||
bool "Support for --long-options"
|
||||
default y
|
||||
help
|
||||
|
||||
@@ -10,7 +10,7 @@ distributed under.
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
@@ -313,7 +313,7 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
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
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
VERSION = 1
|
||||
PATCHLEVEL = 14
|
||||
SUBLEVEL = 0
|
||||
PATCHLEVEL = 15
|
||||
SUBLEVEL = 2
|
||||
EXTRAVERSION =
|
||||
NAME = Unnamed
|
||||
|
||||
|
||||
@@ -32,6 +32,15 @@ CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
|
||||
|
||||
ifeq ($(CONFIG_WERROR),y)
|
||||
CFLAGS += $(call cc-option,-Werror,)
|
||||
## TODO:
|
||||
## gcc version 4.4.0 20090506 (Red Hat 4.4.0-4) (GCC) is a PITA:
|
||||
## const char *ptr; ... off_t v = *(off_t*)ptr; -> BOOM
|
||||
## and no easy way to convince it to shut the hell up.
|
||||
## We have a lot of such things all over the place.
|
||||
## Classic *(off_t*)(void*)ptr does not work,
|
||||
## and I am unwilling to do crazy gcc specific ({ void *ppp = ...; })
|
||||
## stuff in macros. This would obfuscate the code too much.
|
||||
#CFLAGS += $(call cc-ifversion, -eq, 0404, -fno-strict-aliasing)
|
||||
endif
|
||||
# gcc 3.x emits bogus "old style proto" warning on find.c:alloc_action()
|
||||
CFLAGS += $(call cc-ifversion, -ge, 0400, -Wold-style-definition)
|
||||
|
||||
@@ -16,14 +16,10 @@ Rob Landley suggested these:
|
||||
Figure out where we need utf8 support, and add it.
|
||||
|
||||
sh
|
||||
The command shell situation is a big mess. We have three different
|
||||
The command shell situation is a mess. We have two different
|
||||
shells that don't really share any code, and the "standalone shell" doesn't
|
||||
work all that well (especially not in a chroot environment), due to apps not
|
||||
being reentrant.
|
||||
lash is phased out. hush can be configured down to be nearly as small,
|
||||
but less buggy :)
|
||||
init
|
||||
General cleanup (should use ENABLE_FEATURE_INIT_SYSLOG).
|
||||
Do a SUSv3 audit
|
||||
Look at the full Single Unix Specification version 3 (available online at
|
||||
"http://www.opengroup.org/onlinepubs/009695399/nfindex.html") and
|
||||
@@ -251,7 +247,6 @@ FEATURE_CLEAN_UP
|
||||
For right now, exit() handles it just fine.
|
||||
|
||||
|
||||
|
||||
Minor stuff:
|
||||
watchdog.c could autodetect the timer duration via:
|
||||
if(!ioctl (fd, WDIOC_GETTIMEOUT, &tmo)) timer_duration = 1 + (tmo / 2);
|
||||
@@ -266,7 +261,7 @@ Minor stuff:
|
||||
---
|
||||
possible code duplication ingroup() and is_a_group_member()
|
||||
---
|
||||
Move __get_hz() to a better place and (re)use it in route.c, ash.c, msh.c
|
||||
Move __get_hz() to a better place and (re)use it in route.c, ash.c
|
||||
---
|
||||
See grep -r strtod
|
||||
Alot of duplication that wants cleanup.
|
||||
@@ -283,3 +278,39 @@ Replace deprecated functions.
|
||||
---
|
||||
vdprintf() -> similar sized functionality
|
||||
---
|
||||
|
||||
(TODO list after discussion 11.05.2009)
|
||||
|
||||
* shrink tc/brctl/ip
|
||||
tc/brctl seem like fairly large things to try and tackle in your timeframe,
|
||||
and i think people have posted attempts in the past. Adding additional
|
||||
options to ip though seems reasonable.
|
||||
|
||||
* add tests for some applets
|
||||
|
||||
* implement POSIX utilities and audit them for POSIX conformance. then
|
||||
audit them for GNU conformance. then document all your findings in a new
|
||||
doc/conformance.txt file while perhaps implementing some of the missing
|
||||
features.
|
||||
you can find the latest POSIX documentation (1003.1-2008) here:
|
||||
http://www.opengroup.org/onlinepubs/9699919799/
|
||||
and the complete list of all utilities that POSIX covers:
|
||||
http://www.opengroup.org/onlinepubs/9699919799/idx/utilities.html
|
||||
The first step would to generate a file/matrix what is already archived
|
||||
(also IPV6)
|
||||
|
||||
* ntpdate/ntpd (see ntpclient and openntp for examples)
|
||||
|
||||
* implement 'at'
|
||||
|
||||
* rpcbind (former portmap) or equivalent
|
||||
so that we don't have to use -o nolock on nfs mounts
|
||||
|
||||
* check IPV6 compliance
|
||||
|
||||
* generate a mini example using kernel+busybox only (+libc) for example
|
||||
|
||||
* more support for advanced linux 2.6.x features, see: iotop
|
||||
most likely there is more
|
||||
|
||||
* even more support for statistics: mpstat, iostat, powertop....
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Busybox version: 1.13.0.svn
|
||||
# Sun Nov 9 17:09:13 2008
|
||||
# Busybox version: 1.15.0.svn
|
||||
# Fri Aug 21 00:13:18 2009
|
||||
#
|
||||
CONFIG_HAVE_DOT_CONFIG=y
|
||||
|
||||
@@ -14,7 +14,6 @@ CONFIG_HAVE_DOT_CONFIG=y
|
||||
#
|
||||
CONFIG_DESKTOP=y
|
||||
CONFIG_EXTRA_COMPAT=y
|
||||
# CONFIG_FEATURE_ASSUME_UNICODE is not set
|
||||
CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
|
||||
# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set
|
||||
# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
|
||||
@@ -23,7 +22,9 @@ CONFIG_FEATURE_VERBOSE_USAGE=y
|
||||
CONFIG_FEATURE_COMPRESS_USAGE=y
|
||||
CONFIG_FEATURE_INSTALLER=y
|
||||
# CONFIG_LOCALE_SUPPORT is not set
|
||||
CONFIG_GETOPT_LONG=y
|
||||
# CONFIG_FEATURE_ASSUME_UNICODE is not set
|
||||
# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set
|
||||
CONFIG_LONG_OPTS=y
|
||||
CONFIG_FEATURE_DEVPTS=y
|
||||
# CONFIG_FEATURE_CLEAN_UP is not set
|
||||
CONFIG_FEATURE_PIDFILE=y
|
||||
@@ -47,6 +48,7 @@ CONFIG_NOMMU=y
|
||||
# CONFIG_FEATURE_SHARED_BUSYBOX is not set
|
||||
CONFIG_LFS=y
|
||||
CONFIG_CROSS_COMPILER_PREFIX=""
|
||||
CONFIG_EXTRA_CFLAGS=""
|
||||
|
||||
#
|
||||
# Debugging Options
|
||||
@@ -87,6 +89,8 @@ CONFIG_FEATURE_EDITING_HISTORY=15
|
||||
CONFIG_FEATURE_TAB_COMPLETION=y
|
||||
CONFIG_FEATURE_USERNAME_COMPLETION=y
|
||||
CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
|
||||
CONFIG_FEATURE_EDITING_ASK_TERMINAL=y
|
||||
CONFIG_FEATURE_NON_POSIX_CP=y
|
||||
CONFIG_FEATURE_VERBOSE_CP_MESSAGE=y
|
||||
CONFIG_FEATURE_COPYBUF_KB=4
|
||||
CONFIG_MONOTONIC_SYSCALL=y
|
||||
@@ -116,6 +120,8 @@ CONFIG_DPKG_DEB=y
|
||||
CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY=y
|
||||
CONFIG_GUNZIP=y
|
||||
CONFIG_GZIP=y
|
||||
CONFIG_LZOP=y
|
||||
CONFIG_LZOP_COMPR_HIGH=y
|
||||
CONFIG_RPM2CPIO=y
|
||||
CONFIG_RPM=y
|
||||
CONFIG_TAR=y
|
||||
@@ -169,6 +175,7 @@ CONFIG_EXPR=y
|
||||
CONFIG_EXPR_MATH_SUPPORT_64=y
|
||||
CONFIG_FALSE=y
|
||||
CONFIG_FOLD=y
|
||||
CONFIG_FSYNC=y
|
||||
CONFIG_HEAD=y
|
||||
CONFIG_FEATURE_FANCY_HEAD=y
|
||||
CONFIG_HOSTID=y
|
||||
@@ -208,6 +215,8 @@ CONFIG_RMDIR=y
|
||||
CONFIG_FEATURE_RMDIR_LONG_OPTIONS=y
|
||||
CONFIG_SEQ=y
|
||||
CONFIG_SHA1SUM=y
|
||||
CONFIG_SHA256SUM=y
|
||||
CONFIG_SHA512SUM=y
|
||||
CONFIG_SLEEP=y
|
||||
CONFIG_FEATURE_FANCY_SLEEP=y
|
||||
CONFIG_FEATURE_FLOAT_SLEEP=y
|
||||
@@ -378,6 +387,8 @@ CONFIG_FEATURE_EXTRA_QUIET=y
|
||||
CONFIG_FEATURE_INIT_COREDUMPS=y
|
||||
CONFIG_FEATURE_INITRD=y
|
||||
CONFIG_HALT=y
|
||||
# CONFIG_FEATURE_CALL_TELINIT is not set
|
||||
CONFIG_TELINIT_PATH=""
|
||||
CONFIG_MESG=y
|
||||
|
||||
#
|
||||
@@ -387,13 +398,17 @@ CONFIG_FEATURE_SHADOWPASSWDS=y
|
||||
CONFIG_USE_BB_PWD_GRP=y
|
||||
CONFIG_USE_BB_SHADOW=y
|
||||
CONFIG_USE_BB_CRYPT=y
|
||||
CONFIG_USE_BB_CRYPT_SHA=y
|
||||
CONFIG_ADDGROUP=y
|
||||
CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS=y
|
||||
CONFIG_FEATURE_ADDUSER_TO_GROUP=y
|
||||
CONFIG_DELGROUP=y
|
||||
CONFIG_FEATURE_DEL_USER_FROM_GROUP=y
|
||||
CONFIG_FEATURE_CHECK_NAMES=y
|
||||
CONFIG_ADDUSER=y
|
||||
CONFIG_FEATURE_ADDUSER_LONG_OPTIONS=y
|
||||
CONFIG_FIRST_SYSTEM_ID=100
|
||||
CONFIG_LAST_SYSTEM_ID=999
|
||||
CONFIG_DELUSER=y
|
||||
CONFIG_GETTY=y
|
||||
CONFIG_FEATURE_UTMP=y
|
||||
@@ -423,8 +438,6 @@ CONFIG_LSATTR=y
|
||||
#
|
||||
# Linux Module Utilities
|
||||
#
|
||||
CONFIG_DEFAULT_MODULES_DIR="/lib/modules"
|
||||
CONFIG_DEFAULT_DEPMOD_FILE="modules.dep"
|
||||
CONFIG_MODPROBE_SMALL=y
|
||||
CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE=y
|
||||
CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y
|
||||
@@ -448,10 +461,14 @@ CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y
|
||||
# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set
|
||||
# CONFIG_FEATURE_MODUTILS_ALIAS is not set
|
||||
# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set
|
||||
CONFIG_DEFAULT_MODULES_DIR="/lib/modules"
|
||||
CONFIG_DEFAULT_DEPMOD_FILE="modules.dep"
|
||||
|
||||
#
|
||||
# Linux System Utilities
|
||||
#
|
||||
# CONFIG_ACPID is not set
|
||||
# CONFIG_FEATURE_ACPID_COMPAT is not set
|
||||
CONFIG_BLKID=y
|
||||
CONFIG_DMESG=y
|
||||
CONFIG_FEATURE_DMESG_PRETTY=y
|
||||
@@ -477,7 +494,9 @@ CONFIG_MKFS_MINIX=y
|
||||
# Minix filesystem support
|
||||
#
|
||||
CONFIG_FEATURE_MINIX2=y
|
||||
CONFIG_MKFS_VFAT=y
|
||||
CONFIG_GETOPT=y
|
||||
CONFIG_FEATURE_GETOPT_LONG=y
|
||||
CONFIG_HEXDUMP=y
|
||||
CONFIG_FEATURE_HEXDUMP_REVERSE=y
|
||||
CONFIG_HD=y
|
||||
@@ -494,7 +513,7 @@ CONFIG_FEATURE_MDEV_RENAME_REGEXP=y
|
||||
CONFIG_FEATURE_MDEV_EXEC=y
|
||||
CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
|
||||
CONFIG_MKSWAP=y
|
||||
CONFIG_FEATURE_MKSWAP_V0=y
|
||||
CONFIG_FEATURE_MKSWAP_UUID=y
|
||||
CONFIG_MORE=y
|
||||
CONFIG_FEATURE_USE_TERMIOS=y
|
||||
CONFIG_VOLUMEID=y
|
||||
@@ -529,6 +548,7 @@ CONFIG_RDEV=y
|
||||
CONFIG_READPROFILE=y
|
||||
CONFIG_RTCWAKE=y
|
||||
CONFIG_SCRIPT=y
|
||||
CONFIG_SCRIPTREPLAY=y
|
||||
CONFIG_SETARCH=y
|
||||
CONFIG_SWAPONOFF=y
|
||||
CONFIG_FEATURE_SWAPON_PRI=y
|
||||
@@ -547,6 +567,9 @@ CONFIG_FEATURE_MOUNT_LOOP=y
|
||||
#
|
||||
CONFIG_ADJTIMEX=y
|
||||
CONFIG_BBCONFIG=y
|
||||
CONFIG_BEEP=y
|
||||
CONFIG_FEATURE_BEEP_FREQ=4000
|
||||
CONFIG_FEATURE_BEEP_LENGTH_MS=30
|
||||
CONFIG_CHAT=y
|
||||
CONFIG_FEATURE_CHAT_NOFAIL=y
|
||||
CONFIG_FEATURE_CHAT_TTY_HIFI=y
|
||||
@@ -559,6 +582,7 @@ CONFIG_CHRT=y
|
||||
CONFIG_CROND=y
|
||||
CONFIG_FEATURE_CROND_D=y
|
||||
CONFIG_FEATURE_CROND_CALL_SENDMAIL=y
|
||||
CONFIG_FEATURE_CROND_DIR="/var/spool/cron"
|
||||
CONFIG_CRONTAB=y
|
||||
CONFIG_DC=y
|
||||
CONFIG_FEATURE_DC_LIBM=y
|
||||
@@ -571,6 +595,10 @@ CONFIG_DEVMEM=y
|
||||
CONFIG_EJECT=y
|
||||
CONFIG_FEATURE_EJECT_SCSI=y
|
||||
CONFIG_FBSPLASH=y
|
||||
# CONFIG_FLASH_LOCK is not set
|
||||
# CONFIG_FLASH_UNLOCK is not set
|
||||
# CONFIG_FLASH_ERASEALL is not set
|
||||
CONFIG_IONICE=y
|
||||
CONFIG_INOTIFYD=y
|
||||
CONFIG_LAST=y
|
||||
CONFIG_FEATURE_LAST_SMALL=y
|
||||
@@ -579,11 +607,11 @@ CONFIG_LESS=y
|
||||
CONFIG_FEATURE_LESS_MAXLINES=9999999
|
||||
CONFIG_FEATURE_LESS_BRACKETS=y
|
||||
CONFIG_FEATURE_LESS_FLAGS=y
|
||||
CONFIG_FEATURE_LESS_DASHCMD=y
|
||||
CONFIG_FEATURE_LESS_MARKS=y
|
||||
CONFIG_FEATURE_LESS_REGEXP=y
|
||||
CONFIG_FEATURE_LESS_LINENUMS=y
|
||||
CONFIG_FEATURE_LESS_WINCH=y
|
||||
CONFIG_FEATURE_LESS_DASHCMD=y
|
||||
CONFIG_FEATURE_LESS_LINENUMS=y
|
||||
CONFIG_HDPARM=y
|
||||
CONFIG_FEATURE_HDPARM_GET_IDENTITY=y
|
||||
CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF=y
|
||||
@@ -607,13 +635,16 @@ CONFIG_STRINGS=y
|
||||
CONFIG_TASKSET=y
|
||||
CONFIG_FEATURE_TASKSET_FANCY=y
|
||||
CONFIG_TIME=y
|
||||
CONFIG_TIMEOUT=y
|
||||
CONFIG_TTYSIZE=y
|
||||
CONFIG_VOLNAME=y
|
||||
CONFIG_WATCHDOG=y
|
||||
|
||||
#
|
||||
# Networking Utilities
|
||||
#
|
||||
CONFIG_FEATURE_IPV6=y
|
||||
CONFIG_FEATURE_UNIX_LOCAL=y
|
||||
CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
|
||||
CONFIG_VERBOSE_RESOLUTION_ERRORS=y
|
||||
CONFIG_ARP=y
|
||||
@@ -624,6 +655,8 @@ CONFIG_FEATURE_BRCTL_SHOW=y
|
||||
CONFIG_DNSD=y
|
||||
CONFIG_ETHER_WAKE=y
|
||||
CONFIG_FAKEIDENTD=y
|
||||
CONFIG_FTPD=y
|
||||
CONFIG_FEATURE_FTP_WRITE=y
|
||||
CONFIG_FTPGET=y
|
||||
CONFIG_FTPPUT=y
|
||||
CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS=y
|
||||
@@ -647,6 +680,7 @@ CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y
|
||||
CONFIG_FEATURE_IFCONFIG_HW=y
|
||||
CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y
|
||||
CONFIG_IFENSLAVE=y
|
||||
CONFIG_IFPLUGD=y
|
||||
CONFIG_IFUPDOWN=y
|
||||
CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate"
|
||||
CONFIG_FEATURE_IFUPDOWN_IP=y
|
||||
@@ -717,10 +751,11 @@ CONFIG_DHCPD_LEASES_FILE="/var/lib/misc/udhcpd.leases"
|
||||
CONFIG_APP_UDHCPC=y
|
||||
CONFIG_FEATURE_UDHCPC_ARPING=y
|
||||
CONFIG_FEATURE_UDHCP_PORT=y
|
||||
CONFIG_UDHCP_DEBUG=y
|
||||
CONFIG_UDHCP_DEBUG=9
|
||||
CONFIG_FEATURE_UDHCP_RFC3397=y
|
||||
CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
|
||||
CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
|
||||
CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n"
|
||||
CONFIG_VCONFIG=y
|
||||
CONFIG_WGET=y
|
||||
CONFIG_FEATURE_WGET_STATUSBAR=y
|
||||
@@ -728,6 +763,8 @@ CONFIG_FEATURE_WGET_AUTHENTICATION=y
|
||||
CONFIG_FEATURE_WGET_LONG_OPTIONS=y
|
||||
CONFIG_ZCIP=y
|
||||
CONFIG_TCPSVD=y
|
||||
CONFIG_TUNCTL=y
|
||||
CONFIG_FEATURE_TUNCTL_UG=y
|
||||
CONFIG_UDPSVD=y
|
||||
|
||||
#
|
||||
@@ -747,8 +784,6 @@ CONFIG_FEATURE_POPMAILDIR_DELIVERY=y
|
||||
CONFIG_REFORMIME=y
|
||||
CONFIG_FEATURE_REFORMIME_COMPAT=y
|
||||
CONFIG_SENDMAIL=y
|
||||
CONFIG_FEATURE_SENDMAIL_MAILX=y
|
||||
CONFIG_FEATURE_SENDMAIL_MAILXX=y
|
||||
|
||||
#
|
||||
# Process Utilities
|
||||
@@ -767,6 +802,7 @@ CONFIG_PKILL=y
|
||||
CONFIG_PS=y
|
||||
CONFIG_FEATURE_PS_WIDE=y
|
||||
CONFIG_FEATURE_PS_TIME=y
|
||||
CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS=y
|
||||
CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS=y
|
||||
CONFIG_RENICE=y
|
||||
CONFIG_BB_SYSCTL=y
|
||||
@@ -819,7 +855,6 @@ CONFIG_SESTATUS=y
|
||||
#
|
||||
# CONFIG_FEATURE_SH_IS_ASH is not set
|
||||
CONFIG_FEATURE_SH_IS_HUSH=y
|
||||
# CONFIG_FEATURE_SH_IS_MSH is not set
|
||||
# CONFIG_FEATURE_SH_IS_NONE is not set
|
||||
# CONFIG_ASH is not set
|
||||
# CONFIG_ASH_BASH_COMPAT is not set
|
||||
@@ -827,8 +862,6 @@ CONFIG_FEATURE_SH_IS_HUSH=y
|
||||
# CONFIG_ASH_READ_NCHARS is not set
|
||||
# CONFIG_ASH_READ_TIMEOUT is not set
|
||||
# CONFIG_ASH_ALIAS is not set
|
||||
# CONFIG_ASH_MATH_SUPPORT is not set
|
||||
# CONFIG_ASH_MATH_SUPPORT_64 is not set
|
||||
# CONFIG_ASH_GETOPTS is not set
|
||||
# CONFIG_ASH_BUILTIN_ECHO is not set
|
||||
# CONFIG_ASH_BUILTIN_PRINTF is not set
|
||||
@@ -839,6 +872,7 @@ CONFIG_FEATURE_SH_IS_HUSH=y
|
||||
# CONFIG_ASH_RANDOM_SUPPORT is not set
|
||||
# CONFIG_ASH_EXPAND_PRMT is not set
|
||||
CONFIG_HUSH=y
|
||||
CONFIG_HUSH_BASH_COMPAT=y
|
||||
CONFIG_HUSH_HELP=y
|
||||
CONFIG_HUSH_INTERACTIVE=y
|
||||
CONFIG_HUSH_JOB=y
|
||||
@@ -846,12 +880,13 @@ CONFIG_HUSH_TICK=y
|
||||
CONFIG_HUSH_IF=y
|
||||
CONFIG_HUSH_LOOPS=y
|
||||
CONFIG_HUSH_CASE=y
|
||||
CONFIG_HUSH_FUNCTIONS=y
|
||||
CONFIG_HUSH_LOCAL=y
|
||||
CONFIG_HUSH_EXPORT_N=y
|
||||
CONFIG_LASH=y
|
||||
CONFIG_MSH=y
|
||||
|
||||
#
|
||||
# Bourne Shell Options
|
||||
#
|
||||
CONFIG_SH_MATH_SUPPORT=y
|
||||
CONFIG_SH_MATH_SUPPORT_64=y
|
||||
CONFIG_FEATURE_SH_EXTRA_QUIET=y
|
||||
CONFIG_FEATURE_SH_STANDALONE=y
|
||||
CONFIG_FEATURE_SH_NOFORK=y
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
/applet_tables
|
||||
/usage
|
||||
@@ -14,17 +14,26 @@ always:= $(hostprogs-y)
|
||||
|
||||
# Generated files need additional love
|
||||
|
||||
HOSTCFLAGS_usage.o = -I$(srctree)/include
|
||||
# This trick decreases amount of rebuilds
|
||||
# if tree is merely renamed/copied
|
||||
ifeq ($(srctree),$(objtree))
|
||||
srctree_slash =
|
||||
else
|
||||
srctree_slash = $(srctree)/
|
||||
endif
|
||||
|
||||
|
||||
HOSTCFLAGS_usage.o = -I$(srctree_slash)include
|
||||
|
||||
applets/applets.o: include/usage_compressed.h include/applet_tables.h
|
||||
|
||||
applets/usage: .config $(srctree)/applets/usage_compressed
|
||||
applets/usage: .config $(srctree_slash)applets/usage_compressed
|
||||
applets/applet_tables: .config
|
||||
|
||||
quiet_cmd_gen_usage_compressed = GEN include/usage_compressed.h
|
||||
cmd_gen_usage_compressed = $(srctree)/applets/usage_compressed include/usage_compressed.h applets
|
||||
cmd_gen_usage_compressed = $(srctree_slash)applets/usage_compressed include/usage_compressed.h applets
|
||||
|
||||
include/usage_compressed.h: applets/usage $(srctree)/applets/usage_compressed
|
||||
include/usage_compressed.h: applets/usage $(srctree_slash)applets/usage_compressed
|
||||
$(call cmd,gen_usage_compressed)
|
||||
|
||||
quiet_cmd_gen_applet_tables = GEN include/applet_tables.h
|
||||
|
||||
@@ -24,7 +24,7 @@ echo 'static const char packed_usage[] ALIGN1 = {'
|
||||
## | grep -v '^$' \
|
||||
## | $SED -e 's/\(..\)\(..\)/0x\2,0x\1,/g'
|
||||
|
||||
"$loc/usage" | bzip2 -1 | od -v -t x1 \
|
||||
"$loc/usage" | bzip2 -1 | dd bs=2 skip=1 | od -v -t x1 \
|
||||
| $SED -e 's/^[^ ]*//' \
|
||||
| $SED -e 's/ //g' \
|
||||
| grep -v '^$' \
|
||||
|
||||
@@ -53,12 +53,12 @@ config AR
|
||||
probably say N here.
|
||||
|
||||
config FEATURE_AR_LONG_FILENAMES
|
||||
bool "Support for long filenames (not need for debs)"
|
||||
bool "Support for long filenames (not needed for debs)"
|
||||
default n
|
||||
depends on AR
|
||||
help
|
||||
By default the ar format can only store the first 15 characters of
|
||||
the filename, this option removes that limitation.
|
||||
By default the ar format can only store the first 15 characters
|
||||
of the filename, this option removes that limitation.
|
||||
It supports the GNU ar long filename method which moves multiple long
|
||||
filenames into a the data section of a new ar entry.
|
||||
|
||||
@@ -165,6 +165,21 @@ config GZIP
|
||||
gzip is used to compress files.
|
||||
It's probably the most widely used UNIX compression program.
|
||||
|
||||
config LZOP
|
||||
bool "lzop"
|
||||
default n
|
||||
help
|
||||
Lzop compression/decompresion.
|
||||
|
||||
config LZOP_COMPR_HIGH
|
||||
bool "lzop complession levels 7,8,9 (not very useful)"
|
||||
default n
|
||||
depends on LZOP
|
||||
help
|
||||
High levels (7,8,9) of lzop compression. These levels
|
||||
are actually slower than gzip at equivalent compression ratios
|
||||
and take up 3.2K of code.
|
||||
|
||||
config RPM2CPIO
|
||||
bool "rpm2cpio"
|
||||
default n
|
||||
@@ -196,11 +211,11 @@ config FEATURE_TAR_CREATE
|
||||
tar archives using the `-c' option.
|
||||
|
||||
config FEATURE_TAR_AUTODETECT
|
||||
bool "Autodetect gz/bz2 compressed tarballs"
|
||||
bool "Autodetect compressed tarballs"
|
||||
default n
|
||||
depends on FEATURE_SEAMLESS_Z || FEATURE_SEAMLESS_GZ || FEATURE_SEAMLESS_BZ2 || FEATURE_SEAMLESS_LZMA
|
||||
help
|
||||
With this option tar can automatically detect gzip/bzip2 compressed
|
||||
With this option tar can automatically detect compressed
|
||||
tarballs. Currently it works only on files (not pipes etc).
|
||||
|
||||
config FEATURE_TAR_FROM
|
||||
@@ -241,7 +256,7 @@ config FEATURE_TAR_GNU_EXTENSIONS
|
||||
config FEATURE_TAR_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on TAR && GETOPT_LONG
|
||||
depends on TAR && LONG_OPTS
|
||||
help
|
||||
Enable use of long options, increases size by about 400 Bytes
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ lib-$(CONFIG_DPKG) += dpkg.o
|
||||
lib-$(CONFIG_DPKG_DEB) += dpkg_deb.o
|
||||
lib-$(CONFIG_GUNZIP) += bbunzip.o
|
||||
lib-$(CONFIG_GZIP) += gzip.o bbunzip.o
|
||||
lib-$(CONFIG_LZOP) += lzop.o lzo1x_1.o lzo1x_1o.o lzo1x_d.o bbunzip.o
|
||||
lib-$(CONFIG_LZOP_COMPR_HIGH) += lzo1x_9x.o
|
||||
lib-$(CONFIG_RPM2CPIO) += rpm2cpio.o
|
||||
lib-$(CONFIG_RPM) += rpm.o
|
||||
lib-$(CONFIG_TAR) += tar.o
|
||||
|
||||
@@ -30,11 +30,11 @@ int open_to_or_warn(int to_fd, const char *filename, int flags, int mode)
|
||||
|
||||
int FAST_FUNC bbunpack(char **argv,
|
||||
char* (*make_new_name)(char *filename),
|
||||
USE_DESKTOP(long long) int (*unpacker)(unpack_info_t *info)
|
||||
IF_DESKTOP(long long) int (*unpacker)(unpack_info_t *info)
|
||||
)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
USE_DESKTOP(long long) int status;
|
||||
IF_DESKTOP(long long) int status;
|
||||
char *filename, *new_name;
|
||||
smallint exitcode = 0;
|
||||
unpack_info_t info;
|
||||
@@ -175,7 +175,7 @@ char* make_new_name_bunzip2(char *filename)
|
||||
}
|
||||
|
||||
static
|
||||
USE_DESKTOP(long long) int unpack_bunzip2(unpack_info_t *info UNUSED_PARAM)
|
||||
IF_DESKTOP(long long) int unpack_bunzip2(unpack_info_t *info UNUSED_PARAM)
|
||||
{
|
||||
return unpack_bz2_stream_prime(STDIN_FILENO, STDOUT_FILENO);
|
||||
}
|
||||
@@ -251,9 +251,9 @@ char* make_new_name_gunzip(char *filename)
|
||||
}
|
||||
|
||||
static
|
||||
USE_DESKTOP(long long) int unpack_gunzip(unpack_info_t *info)
|
||||
IF_DESKTOP(long long) int unpack_gunzip(unpack_info_t *info)
|
||||
{
|
||||
USE_DESKTOP(long long) int status = -1;
|
||||
IF_DESKTOP(long long) int status = -1;
|
||||
|
||||
/* do the decompression, and cleanup */
|
||||
if (xread_char(STDIN_FILENO) == 0x1f) {
|
||||
@@ -325,7 +325,7 @@ char* make_new_name_unlzma(char *filename)
|
||||
}
|
||||
|
||||
static
|
||||
USE_DESKTOP(long long) int unpack_unlzma(unpack_info_t *info UNUSED_PARAM)
|
||||
IF_DESKTOP(long long) int unpack_unlzma(unpack_info_t *info UNUSED_PARAM)
|
||||
{
|
||||
return unpack_lzma_stream(STDIN_FILENO, STDOUT_FILENO);
|
||||
}
|
||||
@@ -360,9 +360,9 @@ char* make_new_name_uncompress(char *filename)
|
||||
}
|
||||
|
||||
static
|
||||
USE_DESKTOP(long long) int unpack_uncompress(unpack_info_t *info UNUSED_PARAM)
|
||||
IF_DESKTOP(long long) int unpack_uncompress(unpack_info_t *info UNUSED_PARAM)
|
||||
{
|
||||
USE_DESKTOP(long long) int status = -1;
|
||||
IF_DESKTOP(long long) int status = -1;
|
||||
|
||||
if ((xread_char(STDIN_FILENO) != 0x1f) || (xread_char(STDIN_FILENO) != 0x9d)) {
|
||||
bb_error_msg("invalid magic");
|
||||
|
||||
@@ -64,7 +64,7 @@ static uint8_t level;
|
||||
* total written bytes so far otherwise
|
||||
*/
|
||||
static
|
||||
USE_DESKTOP(long long) int bz_write(bz_stream *strm, void* rbuf, ssize_t rlen, void *wbuf)
|
||||
IF_DESKTOP(long long) int bz_write(bz_stream *strm, void* rbuf, ssize_t rlen, void *wbuf)
|
||||
{
|
||||
int n, n2, ret;
|
||||
|
||||
@@ -98,13 +98,13 @@ USE_DESKTOP(long long) int bz_write(bz_stream *strm, void* rbuf, ssize_t rlen, v
|
||||
if (rlen && strm->avail_in == 0)
|
||||
break;
|
||||
}
|
||||
return 0 USE_DESKTOP( + strm->total_out );
|
||||
return 0 IF_DESKTOP( + strm->total_out );
|
||||
}
|
||||
|
||||
static
|
||||
USE_DESKTOP(long long) int compressStream(unpack_info_t *info UNUSED_PARAM)
|
||||
IF_DESKTOP(long long) int compressStream(unpack_info_t *info UNUSED_PARAM)
|
||||
{
|
||||
USE_DESKTOP(long long) int total;
|
||||
IF_DESKTOP(long long) int total;
|
||||
ssize_t count;
|
||||
bz_stream bzs; /* it's small */
|
||||
#define strm (&bzs)
|
||||
@@ -163,7 +163,7 @@ int bzip2_main(int argc UNUSED_PARAM, char **argv)
|
||||
|
||||
opt_complementary = "s2"; /* -s means -2 (compatibility) */
|
||||
/* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */
|
||||
opt = getopt32(argv, "cfv" USE_BUNZIP2("dt") "123456789qzs");
|
||||
opt = getopt32(argv, "cfv" IF_BUNZIP2("dt") "123456789qzs");
|
||||
#if ENABLE_BUNZIP2 /* bunzip2_main may not be visible... */
|
||||
if (opt & 0x18) // -d and/or -t
|
||||
return bunzip2_main(argc, argv);
|
||||
|
||||
@@ -88,9 +88,17 @@ enum {
|
||||
CPIO_OPT_PRESERVE_MTIME = (1 << 6),
|
||||
CPIO_OPT_DEREF = (1 << 7),
|
||||
CPIO_OPT_FILE = (1 << 8),
|
||||
CPIO_OPT_CREATE = (1 << 9) * ENABLE_FEATURE_CPIO_O,
|
||||
CPIO_OPT_FORMAT = (1 << 10) * ENABLE_FEATURE_CPIO_O,
|
||||
CPIO_OPT_PASSTHROUGH = (1 << 11) * ENABLE_FEATURE_CPIO_P,
|
||||
OPTBIT_FILE = 8,
|
||||
IF_FEATURE_CPIO_O(OPTBIT_CREATE ,)
|
||||
IF_FEATURE_CPIO_O(OPTBIT_FORMAT ,)
|
||||
IF_FEATURE_CPIO_P(OPTBIT_PASSTHROUGH,)
|
||||
IF_LONG_OPTS( OPTBIT_QUIET ,)
|
||||
IF_LONG_OPTS( OPTBIT_2STDOUT ,)
|
||||
CPIO_OPT_CREATE = IF_FEATURE_CPIO_O((1 << OPTBIT_CREATE )) + 0,
|
||||
CPIO_OPT_FORMAT = IF_FEATURE_CPIO_O((1 << OPTBIT_FORMAT )) + 0,
|
||||
CPIO_OPT_PASSTHROUGH = IF_FEATURE_CPIO_P((1 << OPTBIT_PASSTHROUGH)) + 0,
|
||||
CPIO_OPT_QUIET = IF_LONG_OPTS( (1 << OPTBIT_QUIET )) + 0,
|
||||
CPIO_OPT_2STDOUT = IF_LONG_OPTS( (1 << OPTBIT_2STDOUT )) + 0,
|
||||
};
|
||||
|
||||
#define OPTION_STR "it0uvdmLF:"
|
||||
@@ -270,10 +278,10 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
archive_handle_t *archive_handle;
|
||||
char *cpio_filename;
|
||||
USE_FEATURE_CPIO_O(const char *cpio_fmt = "";)
|
||||
IF_FEATURE_CPIO_O(const char *cpio_fmt = "";)
|
||||
unsigned opt;
|
||||
|
||||
#if ENABLE_GETOPT_LONG
|
||||
#if ENABLE_LONG_OPTS
|
||||
applet_long_options =
|
||||
"extract\0" No_argument "i"
|
||||
"list\0" No_argument "t"
|
||||
@@ -284,6 +292,9 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
|
||||
"pass-through\0" No_argument "p"
|
||||
#endif
|
||||
#endif
|
||||
"verbose\0" No_argument "v"
|
||||
"quiet\0" No_argument "\xff"
|
||||
"to-stdout\0" No_argument "\xfe"
|
||||
;
|
||||
#endif
|
||||
|
||||
@@ -295,7 +306,7 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
|
||||
#if !ENABLE_FEATURE_CPIO_O
|
||||
opt = getopt32(argv, OPTION_STR, &cpio_filename);
|
||||
#else
|
||||
opt = getopt32(argv, OPTION_STR "oH:" USE_FEATURE_CPIO_P("p"), &cpio_filename, &cpio_fmt);
|
||||
opt = getopt32(argv, OPTION_STR "oH:" IF_FEATURE_CPIO_P("p"), &cpio_filename, &cpio_fmt);
|
||||
if (opt & CPIO_OPT_PASSTHROUGH) {
|
||||
pid_t pid;
|
||||
struct fd_pair pp;
|
||||
@@ -372,6 +383,8 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
if (opt & CPIO_OPT_EXTRACT) {
|
||||
archive_handle->action_data = data_extract_all;
|
||||
if (opt & CPIO_OPT_2STDOUT)
|
||||
archive_handle->action_data = data_extract_to_stdout;
|
||||
}
|
||||
if (opt & CPIO_OPT_UNCONDITIONAL) {
|
||||
archive_handle->ah_flags |= ARCHIVE_EXTRACT_UNCONDITIONAL;
|
||||
@@ -406,7 +419,9 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
|
||||
while (get_header_cpio(archive_handle) == EXIT_SUCCESS)
|
||||
continue;
|
||||
|
||||
if (archive_handle->ah_priv[2] != (void*) ~(ptrdiff_t)0)
|
||||
if (archive_handle->ah_priv[2] != (void*) ~(ptrdiff_t)0
|
||||
&& !(opt & CPIO_OPT_QUIET)
|
||||
)
|
||||
printf("%lu blocks\n", (unsigned long)(ptrdiff_t)(archive_handle->ah_priv[2]));
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
@@ -1354,8 +1354,8 @@ static void remove_package(const unsigned package_num, int noisy)
|
||||
free_array(exclude_files);
|
||||
free_array(remove_files);
|
||||
|
||||
/* Create a list of files in /var/lib/dpkg/info/<package>.* to keep */
|
||||
exclude_files = xzalloc(sizeof(char*) * 3);
|
||||
/* Create a list of files in /var/lib/dpkg/info/<package>.* to keep */
|
||||
exclude_files = xzalloc(sizeof(exclude_files[0]) * 3);
|
||||
exclude_files[0] = xstrdup(conffile_name);
|
||||
exclude_files[1] = xasprintf("/var/lib/dpkg/info/%s.%s", package_name, "postrm");
|
||||
|
||||
@@ -1393,20 +1393,25 @@ static void purge_package(const unsigned package_num)
|
||||
sprintf(list_name, "/var/lib/dpkg/info/%s.%s", package_name, "list");
|
||||
remove_files = create_list(list_name);
|
||||
|
||||
exclude_files = xzalloc(sizeof(char*));
|
||||
|
||||
/* Some directories cant be removed straight away, so do multiple passes */
|
||||
while (remove_file_array(remove_files, exclude_files)) /* repeat */;
|
||||
while (remove_file_array(remove_files, NULL))
|
||||
continue;
|
||||
free_array(remove_files);
|
||||
|
||||
/* Create a list of all /var/lib/dpkg/info/<package> files */
|
||||
remove_files = all_control_list(package_name);
|
||||
remove_file_array(remove_files, exclude_files);
|
||||
free_array(remove_files);
|
||||
free(exclude_files);
|
||||
|
||||
/* Run postrm script */
|
||||
/* Delete all of them except the postrm script */
|
||||
exclude_files = xzalloc(sizeof(exclude_files[0]) * 2);
|
||||
exclude_files[0] = xasprintf("/var/lib/dpkg/info/%s.%s", package_name, "postrm");
|
||||
remove_file_array(remove_files, exclude_files);
|
||||
free_array(exclude_files);
|
||||
|
||||
/* Run and remove postrm script */
|
||||
run_package_script_or_die(package_name, "postrm");
|
||||
remove_file_array(remove_files, NULL);
|
||||
|
||||
free_array(remove_files);
|
||||
|
||||
/* Change package status */
|
||||
set_status(status_num, "not-installed", 3);
|
||||
|
||||
@@ -267,7 +267,7 @@ struct globals {
|
||||
#define DECLARE(type, array, size) \
|
||||
type * array
|
||||
#define ALLOC(type, array, size) \
|
||||
array = xzalloc((size_t)(((size)+1L)/2) * 2*sizeof(type));
|
||||
array = xzalloc((size_t)(((size)+1L)/2) * 2*sizeof(type))
|
||||
#define FREE(array) \
|
||||
do { free(array); array = NULL; } while (0)
|
||||
|
||||
@@ -388,19 +388,6 @@ static void put_32bit(ulg n)
|
||||
put_16bit(n >> 16);
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
* Clear input and output buffers
|
||||
*/
|
||||
static void clear_bufs(void)
|
||||
{
|
||||
G1.outcnt = 0;
|
||||
#ifdef DEBUG
|
||||
G1.insize = 0;
|
||||
#endif
|
||||
G1.isize = 0;
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Run a set of bytes through the crc shift register. If s is a NULL
|
||||
* pointer, then initialize the crc shift register contents instead.
|
||||
@@ -2015,11 +2002,41 @@ char* make_new_name_gzip(char *filename)
|
||||
}
|
||||
|
||||
static
|
||||
USE_DESKTOP(long long) int pack_gzip(unpack_info_t *info UNUSED_PARAM)
|
||||
IF_DESKTOP(long long) int pack_gzip(unpack_info_t *info UNUSED_PARAM)
|
||||
{
|
||||
struct stat s;
|
||||
|
||||
clear_bufs();
|
||||
/* Clear input and output buffers */
|
||||
G1.outcnt = 0;
|
||||
#ifdef DEBUG
|
||||
G1.insize = 0;
|
||||
#endif
|
||||
G1.isize = 0;
|
||||
|
||||
/* Reinit G2.xxx */
|
||||
memset(&G2, 0, sizeof(G2));
|
||||
G2.l_desc.dyn_tree = G2.dyn_ltree;
|
||||
G2.l_desc.static_tree = G2.static_ltree;
|
||||
G2.l_desc.extra_bits = extra_lbits;
|
||||
G2.l_desc.extra_base = LITERALS + 1;
|
||||
G2.l_desc.elems = L_CODES;
|
||||
G2.l_desc.max_length = MAX_BITS;
|
||||
//G2.l_desc.max_code = 0;
|
||||
G2.d_desc.dyn_tree = G2.dyn_dtree;
|
||||
G2.d_desc.static_tree = G2.static_dtree;
|
||||
G2.d_desc.extra_bits = extra_dbits;
|
||||
//G2.d_desc.extra_base = 0;
|
||||
G2.d_desc.elems = D_CODES;
|
||||
G2.d_desc.max_length = MAX_BITS;
|
||||
//G2.d_desc.max_code = 0;
|
||||
G2.bl_desc.dyn_tree = G2.bl_tree;
|
||||
//G2.bl_desc.static_tree = NULL;
|
||||
G2.bl_desc.extra_bits = extra_blbits,
|
||||
//G2.bl_desc.extra_base = 0;
|
||||
G2.bl_desc.elems = BL_CODES;
|
||||
G2.bl_desc.max_length = MAX_BL_BITS;
|
||||
//G2.bl_desc.max_code = 0;
|
||||
|
||||
s.st_ctime = 0;
|
||||
fstat(STDIN_FILENO, &s);
|
||||
zip(s.st_ctime);
|
||||
@@ -2050,7 +2067,7 @@ int gzip_main(int argc UNUSED_PARAM, char **argv)
|
||||
unsigned opt;
|
||||
|
||||
/* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */
|
||||
opt = getopt32(argv, "cfv" USE_GUNZIP("dt") "q123456789n");
|
||||
opt = getopt32(argv, "cfv" IF_GUNZIP("dt") "q123456789n");
|
||||
#if ENABLE_GUNZIP /* gunzip_main may not be visible... */
|
||||
if (opt & 0x18) // -d and/or -t
|
||||
return gunzip_main(argc, argv);
|
||||
@@ -2064,29 +2081,6 @@ int gzip_main(int argc UNUSED_PARAM, char **argv)
|
||||
SET_PTR_TO_GLOBALS(xzalloc(sizeof(struct globals) + sizeof(struct globals2))
|
||||
+ sizeof(struct globals));
|
||||
barrier();
|
||||
G2.l_desc.dyn_tree = G2.dyn_ltree;
|
||||
G2.l_desc.static_tree = G2.static_ltree;
|
||||
G2.l_desc.extra_bits = extra_lbits;
|
||||
G2.l_desc.extra_base = LITERALS + 1;
|
||||
G2.l_desc.elems = L_CODES;
|
||||
G2.l_desc.max_length = MAX_BITS;
|
||||
//G2.l_desc.max_code = 0;
|
||||
|
||||
G2.d_desc.dyn_tree = G2.dyn_dtree;
|
||||
G2.d_desc.static_tree = G2.static_dtree;
|
||||
G2.d_desc.extra_bits = extra_dbits;
|
||||
//G2.d_desc.extra_base = 0;
|
||||
G2.d_desc.elems = D_CODES;
|
||||
G2.d_desc.max_length = MAX_BITS;
|
||||
//G2.d_desc.max_code = 0;
|
||||
|
||||
G2.bl_desc.dyn_tree = G2.bl_tree;
|
||||
//G2.bl_desc.static_tree = NULL;
|
||||
G2.bl_desc.extra_bits = extra_blbits,
|
||||
//G2.bl_desc.extra_base = 0;
|
||||
G2.bl_desc.elems = BL_CODES;
|
||||
G2.bl_desc.max_length = MAX_BL_BITS;
|
||||
//G2.bl_desc.max_code = 0;
|
||||
|
||||
/* Allocate all global buffers (for DYN_ALLOC option) */
|
||||
ALLOC(uch, G1.l_buf, INBUFSIZ);
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
This file is part of the LZO real-time data compression library.
|
||||
|
||||
Copyright (C) 1996..2008 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
Markus F.X.J. Oberhumer <markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/lzo/
|
||||
|
||||
The LZO library 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.
|
||||
|
||||
The LZO 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the LZO library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "liblzo_interface.h"
|
||||
|
||||
/* lzo-2.03/src/config1x.h */
|
||||
#define M2_MIN_LEN 3
|
||||
#define M2_MAX_LEN 8
|
||||
#define M3_MAX_LEN 33
|
||||
#define M4_MAX_LEN 9
|
||||
#define M1_MAX_OFFSET 0x0400
|
||||
#define M2_MAX_OFFSET 0x0800
|
||||
#define M3_MAX_OFFSET 0x4000
|
||||
#define M4_MAX_OFFSET 0xbfff
|
||||
#define M1_MARKER 0
|
||||
#define M3_MARKER 32
|
||||
#define M4_MARKER 16
|
||||
|
||||
#define MX_MAX_OFFSET (M1_MAX_OFFSET + M2_MAX_OFFSET)
|
||||
#define MIN_LOOKAHEAD (M2_MAX_LEN + 1)
|
||||
|
||||
#define LZO_EOF_CODE
|
||||
|
||||
/* lzo-2.03/src/lzo_dict.h */
|
||||
#define GINDEX(m_pos,m_off,dict,dindex,in) m_pos = dict[dindex]
|
||||
#define DX2(p,s1,s2) \
|
||||
(((((unsigned)((p)[2]) << (s2)) ^ (p)[1]) << (s1)) ^ (p)[0])
|
||||
//#define DA3(p,s1,s2,s3) ((DA2((p)+1,s2,s3) << (s1)) + (p)[0])
|
||||
//#define DS3(p,s1,s2,s3) ((DS2((p)+1,s2,s3) << (s1)) - (p)[0])
|
||||
#define DX3(p,s1,s2,s3) ((DX2((p)+1,s2,s3) << (s1)) ^ (p)[0])
|
||||
|
||||
#define D_SIZE (1U << D_BITS)
|
||||
#define D_MASK ((1U << D_BITS) - 1)
|
||||
#define D_HIGH ((D_MASK >> 1) + 1)
|
||||
|
||||
#define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \
|
||||
( \
|
||||
m_pos = ip - (unsigned)(ip - m_pos), \
|
||||
((uintptr_t)m_pos < (uintptr_t)in \
|
||||
|| (m_off = (unsigned)(ip - m_pos)) <= 0 \
|
||||
|| m_off > max_offset) \
|
||||
)
|
||||
|
||||
#define DENTRY(p,in) (p)
|
||||
#define UPDATE_I(dict,drun,index,p,in) dict[index] = DENTRY(p,in)
|
||||
|
||||
#define DMS(v,s) ((unsigned) (((v) & (D_MASK >> (s))) << (s)))
|
||||
#define DM(v) ((unsigned) ((v) & D_MASK))
|
||||
#define DMUL(a,b) ((unsigned) ((a) * (b)))
|
||||
|
||||
/* lzo-2.03/src/lzo_ptr.h */
|
||||
#define pd(a,b) ((unsigned)((a)-(b)))
|
||||
|
||||
# define TEST_IP (ip < ip_end)
|
||||
# define NEED_IP(x) \
|
||||
if ((unsigned)(ip_end - ip) < (unsigned)(x)) goto input_overrun
|
||||
|
||||
# undef TEST_OP /* don't need both of the tests here */
|
||||
# define TEST_OP 1
|
||||
# define NEED_OP(x) \
|
||||
if ((unsigned)(op_end - op) < (unsigned)(x)) goto output_overrun
|
||||
|
||||
#define HAVE_ANY_OP 1
|
||||
|
||||
//#if defined(LZO_TEST_OVERRUN_LOOKBEHIND)
|
||||
# define TEST_LB(m_pos) if (m_pos < out || m_pos >= op) goto lookbehind_overrun
|
||||
//# define TEST_LBO(m_pos,o) if (m_pos < out || m_pos >= op - (o)) goto lookbehind_overrun
|
||||
//#else
|
||||
//# define TEST_LB(m_pos) ((void) 0)
|
||||
//# define TEST_LBO(m_pos,o) ((void) 0)
|
||||
//#endif
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
This file is part of the LZO real-time data compression library.
|
||||
|
||||
Copyright (C) 1996..2008 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
Markus F.X.J. Oberhumer <markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/lzo/
|
||||
|
||||
The LZO library 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.
|
||||
|
||||
The LZO 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the LZO library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#define LZO1X
|
||||
#undef LZO1Y
|
||||
|
||||
#undef assert
|
||||
/*
|
||||
static void die_at(int line)
|
||||
{
|
||||
bb_error_msg_and_die("internal error at %d", line);
|
||||
}
|
||||
#define assert(v) if (!(v)) die_at(__LINE__)
|
||||
*/
|
||||
#define assert(v) ((void)0)
|
||||
|
||||
int lzo1x_1_compress(const uint8_t* src, unsigned src_len,
|
||||
uint8_t* dst, unsigned* dst_len,
|
||||
void* wrkmem);
|
||||
int lzo1x_1_15_compress(const uint8_t* src, unsigned src_len,
|
||||
uint8_t* dst, unsigned* dst_len,
|
||||
void* wrkmem);
|
||||
int lzo1x_999_compress_level(const uint8_t* in, unsigned in_len,
|
||||
uint8_t* out, unsigned* out_len,
|
||||
void* wrkmem,
|
||||
int compression_level);
|
||||
|
||||
/* decompression */
|
||||
//int lzo1x_decompress(const uint8_t* src, unsigned src_len,
|
||||
// uint8_t* dst, unsigned* dst_len,
|
||||
// void* wrkmem /* NOT USED */);
|
||||
/* safe decompression with overrun testing */
|
||||
int lzo1x_decompress_safe(const uint8_t* src, unsigned src_len,
|
||||
uint8_t* dst, unsigned* dst_len,
|
||||
void* wrkmem /* NOT USED */);
|
||||
|
||||
#define LZO_E_OK 0
|
||||
#define LZO_E_ERROR (-1)
|
||||
#define LZO_E_OUT_OF_MEMORY (-2) /* [not used right now] */
|
||||
#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */
|
||||
#define LZO_E_INPUT_OVERRUN (-4)
|
||||
#define LZO_E_OUTPUT_OVERRUN (-5)
|
||||
#define LZO_E_LOOKBEHIND_OVERRUN (-6)
|
||||
#define LZO_E_EOF_NOT_FOUND (-7)
|
||||
#define LZO_E_INPUT_NOT_CONSUMED (-8)
|
||||
#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */
|
||||
|
||||
/* lzo-2.03/include/lzo/lzoconf.h */
|
||||
#define LZO_VERSION 0x2030
|
||||
@@ -4,7 +4,9 @@
|
||||
#
|
||||
# Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
|
||||
|
||||
lib-y:= \
|
||||
lib-y:=
|
||||
|
||||
COMMON_FILES:= \
|
||||
\
|
||||
data_skip.o \
|
||||
data_extract_all.o \
|
||||
@@ -49,3 +51,7 @@ lib-$(CONFIG_FEATURE_SEAMLESS_GZ) += open_transformer.o decompress_unzip.o
|
||||
lib-$(CONFIG_FEATURE_SEAMLESS_BZ2) += open_transformer.o decompress_bunzip2.o get_header_tar_bz2.o
|
||||
lib-$(CONFIG_FEATURE_SEAMLESS_LZMA) += open_transformer.o decompress_unlzma.o get_header_tar_lzma.o
|
||||
lib-$(CONFIG_FEATURE_COMPRESS_USAGE) += decompress_bunzip2.o
|
||||
|
||||
ifneq ($(lib-y),)
|
||||
lib-y += $(COMMON_FILES)
|
||||
endif
|
||||
@@ -21,7 +21,7 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
|
||||
/* Check if the file already exists */
|
||||
if (archive_handle->ah_flags & ARCHIVE_EXTRACT_UNCONDITIONAL) {
|
||||
/* Remove the entry if it exists */
|
||||
if (((file_header->mode & S_IFMT) != S_IFDIR)
|
||||
if ((!S_ISDIR(file_header->mode))
|
||||
&& (unlink(file_header->name) == -1)
|
||||
&& (errno != ENOENT)
|
||||
) {
|
||||
@@ -115,23 +115,24 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
|
||||
|
||||
if (!(archive_handle->ah_flags & ARCHIVE_NOPRESERVE_OWN)) {
|
||||
#if ENABLE_FEATURE_TAR_UNAME_GNAME
|
||||
uid_t uid = file_header->uid;
|
||||
gid_t gid = file_header->gid;
|
||||
if (!(archive_handle->ah_flags & ARCHIVE_NUMERIC_OWNER)) {
|
||||
uid_t uid = file_header->uid;
|
||||
gid_t gid = file_header->gid;
|
||||
|
||||
if (file_header->uname) {
|
||||
struct passwd *pwd = getpwnam(file_header->uname);
|
||||
if (pwd) uid = pwd->pw_uid;
|
||||
}
|
||||
if (file_header->gname) {
|
||||
struct group *grp = getgrnam(file_header->gname);
|
||||
if (grp) gid = grp->gr_gid;
|
||||
}
|
||||
lchown(file_header->name, uid, gid);
|
||||
#else
|
||||
lchown(file_header->name, file_header->uid, file_header->gid);
|
||||
if (file_header->uname) {
|
||||
struct passwd *pwd = getpwnam(file_header->uname);
|
||||
if (pwd) uid = pwd->pw_uid;
|
||||
}
|
||||
if (file_header->gname) {
|
||||
struct group *grp = getgrnam(file_header->gname);
|
||||
if (grp) gid = grp->gr_gid;
|
||||
}
|
||||
lchown(file_header->name, uid, gid);
|
||||
} else
|
||||
#endif
|
||||
lchown(file_header->name, file_header->uid, file_header->gid);
|
||||
}
|
||||
if ((file_header->mode & S_IFMT) != S_IFLNK) {
|
||||
if (!S_ISLNK(file_header->mode)) {
|
||||
/* uclibc has no lchmod, glibc is even stranger -
|
||||
* it has lchmod which seems to do nothing!
|
||||
* so we use chmod... */
|
||||
|
||||
@@ -648,10 +648,10 @@ void FAST_FUNC dealloc_bunzip(bunzip_data *bd)
|
||||
|
||||
|
||||
/* Decompress src_fd to dst_fd. Stops at end of bzip data, not end of file. */
|
||||
USE_DESKTOP(long long) int FAST_FUNC
|
||||
IF_DESKTOP(long long) int FAST_FUNC
|
||||
unpack_bz2_stream(int src_fd, int dst_fd)
|
||||
{
|
||||
USE_DESKTOP(long long total_written = 0;)
|
||||
IF_DESKTOP(long long total_written = 0;)
|
||||
char *outbuf;
|
||||
bunzip_data *bd;
|
||||
int i;
|
||||
@@ -666,7 +666,7 @@ unpack_bz2_stream(int src_fd, int dst_fd)
|
||||
i = RETVAL_SHORT_WRITE;
|
||||
break;
|
||||
}
|
||||
USE_DESKTOP(total_written += i;)
|
||||
IF_DESKTOP(total_written += i;)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -686,10 +686,10 @@ unpack_bz2_stream(int src_fd, int dst_fd)
|
||||
dealloc_bunzip(bd);
|
||||
free(outbuf);
|
||||
|
||||
return i ? i : USE_DESKTOP(total_written) + 0;
|
||||
return i ? i : IF_DESKTOP(total_written) + 0;
|
||||
}
|
||||
|
||||
USE_DESKTOP(long long) int FAST_FUNC
|
||||
IF_DESKTOP(long long) int FAST_FUNC
|
||||
unpack_bz2_stream_prime(int src_fd, int dst_fd)
|
||||
{
|
||||
unsigned char magic[2];
|
||||
|
||||
@@ -72,11 +72,11 @@
|
||||
* be stored in the compressed file.
|
||||
*/
|
||||
|
||||
USE_DESKTOP(long long) int FAST_FUNC
|
||||
IF_DESKTOP(long long) int FAST_FUNC
|
||||
unpack_Z_stream(int fd_in, int fd_out)
|
||||
{
|
||||
USE_DESKTOP(long long total_written = 0;)
|
||||
USE_DESKTOP(long long) int retval = -1;
|
||||
IF_DESKTOP(long long total_written = 0;)
|
||||
IF_DESKTOP(long long) int retval = -1;
|
||||
unsigned char *stackp;
|
||||
long code;
|
||||
int finchar;
|
||||
@@ -265,7 +265,7 @@ unpack_Z_stream(int fd_in, int fd_out)
|
||||
if (outpos >= OBUFSIZ) {
|
||||
full_write(fd_out, outbuf, outpos);
|
||||
//error check??
|
||||
USE_DESKTOP(total_written += outpos;)
|
||||
IF_DESKTOP(total_written += outpos;)
|
||||
outpos = 0;
|
||||
}
|
||||
stackp += i;
|
||||
@@ -294,10 +294,10 @@ unpack_Z_stream(int fd_in, int fd_out)
|
||||
if (outpos > 0) {
|
||||
full_write(fd_out, outbuf, outpos);
|
||||
//error check??
|
||||
USE_DESKTOP(total_written += outpos;)
|
||||
IF_DESKTOP(total_written += outpos;)
|
||||
}
|
||||
|
||||
retval = USE_DESKTOP(total_written) + 0;
|
||||
retval = IF_DESKTOP(total_written) + 0;
|
||||
err:
|
||||
free(inbuf);
|
||||
free(outbuf);
|
||||
|
||||
@@ -228,10 +228,10 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
USE_DESKTOP(long long) int FAST_FUNC
|
||||
IF_DESKTOP(long long) int FAST_FUNC
|
||||
unpack_lzma_stream(int src_fd, int dst_fd)
|
||||
{
|
||||
USE_DESKTOP(long long total_written = 0;)
|
||||
IF_DESKTOP(long long total_written = 0;)
|
||||
lzma_header_t header;
|
||||
int lc, pb, lp;
|
||||
uint32_t pos_state_mask;
|
||||
@@ -330,7 +330,7 @@ unpack_lzma_stream(int src_fd, int dst_fd)
|
||||
global_pos += header.dict_size;
|
||||
if (full_write(dst_fd, buffer, header.dict_size) != (ssize_t)header.dict_size)
|
||||
goto bad;
|
||||
USE_DESKTOP(total_written += header.dict_size;)
|
||||
IF_DESKTOP(total_written += header.dict_size;)
|
||||
}
|
||||
#else
|
||||
len = 1;
|
||||
@@ -468,20 +468,20 @@ unpack_lzma_stream(int src_fd, int dst_fd)
|
||||
}
|
||||
|
||||
len += LZMA_MATCH_MIN_LEN;
|
||||
SKIP_FEATURE_LZMA_FAST(string:)
|
||||
IF_NOT_FEATURE_LZMA_FAST(string:)
|
||||
do {
|
||||
pos = buffer_pos - rep0;
|
||||
while (pos >= header.dict_size)
|
||||
pos += header.dict_size;
|
||||
previous_byte = buffer[pos];
|
||||
SKIP_FEATURE_LZMA_FAST(one_byte2:)
|
||||
IF_NOT_FEATURE_LZMA_FAST(one_byte2:)
|
||||
buffer[buffer_pos++] = previous_byte;
|
||||
if (buffer_pos == header.dict_size) {
|
||||
buffer_pos = 0;
|
||||
global_pos += header.dict_size;
|
||||
if (full_write(dst_fd, buffer, header.dict_size) != (ssize_t)header.dict_size)
|
||||
goto bad;
|
||||
USE_DESKTOP(total_written += header.dict_size;)
|
||||
IF_DESKTOP(total_written += header.dict_size;)
|
||||
}
|
||||
len--;
|
||||
} while (len != 0 && buffer_pos < header.dst_size);
|
||||
@@ -489,8 +489,8 @@ unpack_lzma_stream(int src_fd, int dst_fd)
|
||||
}
|
||||
|
||||
{
|
||||
SKIP_DESKTOP(int total_written = 0; /* success */)
|
||||
USE_DESKTOP(total_written += buffer_pos;)
|
||||
IF_NOT_DESKTOP(int total_written = 0; /* success */)
|
||||
IF_DESKTOP(total_written += buffer_pos;)
|
||||
if (full_write(dst_fd, buffer, buffer_pos) != (ssize_t)buffer_pos) {
|
||||
bad:
|
||||
total_written = -1; /* failure */
|
||||
|
||||
@@ -970,10 +970,10 @@ static int inflate_get_next_window(STATE_PARAM_ONLY)
|
||||
|
||||
|
||||
/* Called from unpack_gz_stream() and inflate_unzip() */
|
||||
static USE_DESKTOP(long long) int
|
||||
static IF_DESKTOP(long long) int
|
||||
inflate_unzip_internal(STATE_PARAM int in, int out)
|
||||
{
|
||||
USE_DESKTOP(long long) int n = 0;
|
||||
IF_DESKTOP(long long) int n = 0;
|
||||
ssize_t nwrote;
|
||||
|
||||
/* Allocate all global buffers (for DYN_ALLOC option) */
|
||||
@@ -1008,7 +1008,7 @@ inflate_unzip_internal(STATE_PARAM int in, int out)
|
||||
n = -1;
|
||||
goto ret;
|
||||
}
|
||||
USE_DESKTOP(n += nwrote;)
|
||||
IF_DESKTOP(n += nwrote;)
|
||||
if (r == 0) break;
|
||||
}
|
||||
|
||||
@@ -1033,10 +1033,10 @@ inflate_unzip_internal(STATE_PARAM int in, int out)
|
||||
|
||||
/* For unzip */
|
||||
|
||||
USE_DESKTOP(long long) int FAST_FUNC
|
||||
IF_DESKTOP(long long) int FAST_FUNC
|
||||
inflate_unzip(inflate_unzip_result *res, off_t compr_size, int in, int out)
|
||||
{
|
||||
USE_DESKTOP(long long) int n;
|
||||
IF_DESKTOP(long long) int n;
|
||||
DECLARE_STATE;
|
||||
|
||||
ALLOC_STATE;
|
||||
@@ -1181,11 +1181,11 @@ static int check_header_gzip(STATE_PARAM unpack_info_t *info)
|
||||
return 1;
|
||||
}
|
||||
|
||||
USE_DESKTOP(long long) int FAST_FUNC
|
||||
IF_DESKTOP(long long) int FAST_FUNC
|
||||
unpack_gz_stream_with_info(int in, int out, unpack_info_t *info)
|
||||
{
|
||||
uint32_t v32;
|
||||
USE_DESKTOP(long long) int n;
|
||||
IF_DESKTOP(long long) int n;
|
||||
DECLARE_STATE;
|
||||
|
||||
n = 0;
|
||||
@@ -1245,7 +1245,7 @@ unpack_gz_stream_with_info(int in, int out, unpack_info_t *info)
|
||||
return n;
|
||||
}
|
||||
|
||||
USE_DESKTOP(long long) int FAST_FUNC
|
||||
IF_DESKTOP(long long) int FAST_FUNC
|
||||
unpack_gz_stream(int in, int out)
|
||||
{
|
||||
return unpack_gz_stream_with_info(in, out, NULL);
|
||||
|
||||
@@ -144,8 +144,8 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
|
||||
// if (!archive_handle->ah_priv_inited) {
|
||||
// archive_handle->ah_priv_inited = 1;
|
||||
// p_end = 0;
|
||||
// USE_FEATURE_TAR_GNU_EXTENSIONS(p_longname = NULL;)
|
||||
// USE_FEATURE_TAR_GNU_EXTENSIONS(p_linkname = NULL;)
|
||||
// IF_FEATURE_TAR_GNU_EXTENSIONS(p_longname = NULL;)
|
||||
// IF_FEATURE_TAR_GNU_EXTENSIONS(p_linkname = NULL;)
|
||||
// }
|
||||
|
||||
if (sizeof(tar) != 512)
|
||||
@@ -176,7 +176,7 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
|
||||
bb_error_msg_and_die("short read");
|
||||
}
|
||||
if (i != 512) {
|
||||
USE_FEATURE_TAR_AUTODETECT(goto autodetect;)
|
||||
IF_FEATURE_TAR_AUTODETECT(goto autodetect;)
|
||||
goto short_read;
|
||||
}
|
||||
|
||||
@@ -265,14 +265,14 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
|
||||
#if ENABLE_FEATURE_TAR_OLDGNU_COMPATIBILITY
|
||||
sum = strtoul(tar.chksum, &cp, 8);
|
||||
if ((*cp && *cp != ' ')
|
||||
|| (sum_u != sum USE_FEATURE_TAR_OLDSUN_COMPATIBILITY(&& sum_s != sum))
|
||||
|| (sum_u != sum IF_FEATURE_TAR_OLDSUN_COMPATIBILITY(&& sum_s != sum))
|
||||
) {
|
||||
bb_error_msg_and_die("invalid tar header checksum");
|
||||
}
|
||||
#else
|
||||
/* This field does not need special treatment (getOctal) */
|
||||
sum = xstrtoul(tar.chksum, 8);
|
||||
if (sum_u != sum USE_FEATURE_TAR_OLDSUN_COMPATIBILITY(&& sum_s != sum)) {
|
||||
if (sum_u != sum IF_FEATURE_TAR_OLDSUN_COMPATIBILITY(&& sum_s != sum)) {
|
||||
bb_error_msg_and_die("invalid tar header checksum");
|
||||
}
|
||||
#endif
|
||||
@@ -301,9 +301,13 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
|
||||
file_header->uname = tar.uname[0] ? xstrndup(tar.uname, sizeof(tar.uname)) : NULL;
|
||||
file_header->gname = tar.gname[0] ? xstrndup(tar.gname, sizeof(tar.gname)) : NULL;
|
||||
#endif
|
||||
file_header->mtime = GET_OCTAL(tar.mtime);
|
||||
/* Size field: handle GNU tar's "base256 encoding" */
|
||||
file_header->size = (*tar.size & 0xc0) == 0x80 /* positive base256? */
|
||||
/* mtime: rudimentally handle GNU tar's "base256 encoding"
|
||||
* People report tarballs with NEGATIVE unix times encoded that way */
|
||||
file_header->mtime = (tar.mtime[0] & 0x80) /* base256? */
|
||||
? 0 /* bogus */
|
||||
: GET_OCTAL(tar.mtime);
|
||||
/* size: handle GNU tar's "base256 encoding" */
|
||||
file_header->size = (tar.size[0] & 0xc0) == 0x80 /* positive base256? */
|
||||
? getBase256_len12(tar.size)
|
||||
: GET_OCTAL(tar.size);
|
||||
file_header->gid = GET_OCTAL(tar.gid);
|
||||
@@ -356,7 +360,7 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
|
||||
file_header->mode |= S_IFBLK;
|
||||
goto size0;
|
||||
case '5':
|
||||
USE_FEATURE_TAR_OLDGNU_COMPATIBILITY(set_dir:)
|
||||
IF_FEATURE_TAR_OLDGNU_COMPATIBILITY(set_dir:)
|
||||
file_header->mode |= S_IFDIR;
|
||||
goto size0;
|
||||
case '6':
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* in include/unarchive.h. On NOMMU, transformer is removed.
|
||||
*/
|
||||
void FAST_FUNC open_transformer(int fd,
|
||||
USE_DESKTOP(long long) int FAST_FUNC (*transformer)(int src_fd, int dst_fd),
|
||||
IF_DESKTOP(long long) int FAST_FUNC (*transformer)(int src_fd, int dst_fd),
|
||||
const char *transform_prog)
|
||||
{
|
||||
struct fd_pair fd_pipe;
|
||||
@@ -52,7 +52,7 @@ void FAST_FUNC open_transformer(int fd,
|
||||
argv[2] = (char*)"-";
|
||||
argv[3] = NULL;
|
||||
BB_EXECVP(transform_prog, argv);
|
||||
bb_perror_msg_and_die("can't exec %s", transform_prog);
|
||||
bb_perror_msg_and_die("can't execute '%s'", transform_prog);
|
||||
}
|
||||
#endif
|
||||
/* notreached */
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/* LZO1X-1 compression
|
||||
|
||||
This file is part of the LZO real-time data compression library.
|
||||
|
||||
Copyright (C) 1996..2008 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
Markus F.X.J. Oberhumer <markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/lzo/
|
||||
|
||||
The LZO library 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.
|
||||
|
||||
The LZO 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the LZO library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#include "libbb.h"
|
||||
#include "liblzo.h"
|
||||
|
||||
#define D_BITS 14
|
||||
#define D_INDEX1(d,p) d = DM(DMUL(0x21,DX3(p,5,5,6)) >> 5)
|
||||
#define D_INDEX2(d,p) d = (d & (D_MASK & 0x7ff)) ^ (D_HIGH | 0x1f)
|
||||
|
||||
#define DO_COMPRESS lzo1x_1_compress
|
||||
|
||||
#include "lzo1x_c.c"
|
||||
@@ -0,0 +1,35 @@
|
||||
/* LZO1X-1(15) compression
|
||||
|
||||
This file is part of the LZO real-time data compression library.
|
||||
|
||||
Copyright (C) 1996..2008 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
Markus F.X.J. Oberhumer <markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/lzo/
|
||||
|
||||
The LZO library 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.
|
||||
|
||||
The LZO 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the LZO library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#include "libbb.h"
|
||||
#include "liblzo.h"
|
||||
|
||||
#define D_BITS 15
|
||||
#define D_INDEX1(d,p) d = DM(DMUL(0x21,DX3(p,5,5,6)) >> 5)
|
||||
#define D_INDEX2(d,p) d = (d & (D_MASK & 0x7ff)) ^ (D_HIGH | 0x1f)
|
||||
|
||||
#define DO_COMPRESS lzo1x_1_15_compress
|
||||
|
||||
#include "lzo1x_c.c"
|
||||
@@ -0,0 +1,920 @@
|
||||
/* lzo1x_9x.c -- implementation of the LZO1X-999 compression algorithm
|
||||
|
||||
This file is part of the LZO real-time data compression library.
|
||||
|
||||
Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The LZO library 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.
|
||||
|
||||
The LZO 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the LZO library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/lzo/
|
||||
*/
|
||||
#include "libbb.h"
|
||||
|
||||
/* The following is probably only safe on Intel-compatible processors ... */
|
||||
#define LZO_UNALIGNED_OK_2
|
||||
#define LZO_UNALIGNED_OK_4
|
||||
|
||||
#include "liblzo.h"
|
||||
|
||||
#define LZO_MAX(a,b) ((a) >= (b) ? (a) : (b))
|
||||
#define LZO_MIN(a,b) ((a) <= (b) ? (a) : (b))
|
||||
#define LZO_MAX3(a,b,c) ((a) >= (b) ? LZO_MAX(a,c) : LZO_MAX(b,c))
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
#define SWD_N M4_MAX_OFFSET /* size of ring buffer */
|
||||
#define SWD_F 2048 /* upper limit for match length */
|
||||
|
||||
#define SWD_BEST_OFF (LZO_MAX3(M2_MAX_LEN, M3_MAX_LEN, M4_MAX_LEN) + 1)
|
||||
|
||||
typedef struct {
|
||||
int init;
|
||||
|
||||
unsigned look; /* bytes in lookahead buffer */
|
||||
|
||||
unsigned m_len;
|
||||
unsigned m_off;
|
||||
|
||||
const uint8_t *bp;
|
||||
const uint8_t *ip;
|
||||
const uint8_t *in;
|
||||
const uint8_t *in_end;
|
||||
uint8_t *out;
|
||||
|
||||
unsigned r1_lit;
|
||||
|
||||
} lzo1x_999_t;
|
||||
|
||||
#define getbyte(c) ((c).ip < (c).in_end ? *((c).ip)++ : (-1))
|
||||
|
||||
/* lzo_swd.c -- sliding window dictionary */
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
#define SWD_UINT_MAX USHRT_MAX
|
||||
|
||||
#ifndef SWD_HSIZE
|
||||
# define SWD_HSIZE 16384
|
||||
#endif
|
||||
#ifndef SWD_MAX_CHAIN
|
||||
# define SWD_MAX_CHAIN 2048
|
||||
#endif
|
||||
|
||||
#define HEAD3(b, p) \
|
||||
( ((0x9f5f * ((((b[p]<<5)^b[p+1])<<5) ^ b[p+2])) >> 5) & (SWD_HSIZE-1) )
|
||||
|
||||
#if defined(LZO_UNALIGNED_OK_2)
|
||||
# define HEAD2(b,p) (* (uint16_t *) &(b[p]))
|
||||
#else
|
||||
# define HEAD2(b,p) (b[p] ^ ((unsigned)b[p+1]<<8))
|
||||
#endif
|
||||
#define NIL2 SWD_UINT_MAX
|
||||
|
||||
typedef struct lzo_swd {
|
||||
/* public - "built-in" */
|
||||
|
||||
/* public - configuration */
|
||||
unsigned max_chain;
|
||||
int use_best_off;
|
||||
|
||||
/* public - output */
|
||||
unsigned m_len;
|
||||
unsigned m_off;
|
||||
unsigned look;
|
||||
int b_char;
|
||||
#if defined(SWD_BEST_OFF)
|
||||
unsigned best_off[SWD_BEST_OFF];
|
||||
#endif
|
||||
|
||||
/* semi public */
|
||||
lzo1x_999_t *c;
|
||||
unsigned m_pos;
|
||||
#if defined(SWD_BEST_OFF)
|
||||
unsigned best_pos[SWD_BEST_OFF];
|
||||
#endif
|
||||
|
||||
/* private */
|
||||
unsigned ip; /* input pointer (lookahead) */
|
||||
unsigned bp; /* buffer pointer */
|
||||
unsigned rp; /* remove pointer */
|
||||
|
||||
unsigned node_count;
|
||||
unsigned first_rp;
|
||||
|
||||
uint8_t b[SWD_N + SWD_F];
|
||||
uint8_t b_wrap[SWD_F]; /* must follow b */
|
||||
uint16_t head3[SWD_HSIZE];
|
||||
uint16_t succ3[SWD_N + SWD_F];
|
||||
uint16_t best3[SWD_N + SWD_F];
|
||||
uint16_t llen3[SWD_HSIZE];
|
||||
#ifdef HEAD2
|
||||
uint16_t head2[65536L];
|
||||
#endif
|
||||
} lzo_swd_t, *lzo_swd_p;
|
||||
|
||||
#define SIZEOF_LZO_SWD_T (sizeof(lzo_swd_t))
|
||||
|
||||
|
||||
/* Access macro for head3.
|
||||
* head3[key] may be uninitialized, but then its value will never be used.
|
||||
*/
|
||||
#define s_get_head3(s,key) s->head3[key]
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
#define B_SIZE (SWD_N + SWD_F)
|
||||
|
||||
static int swd_init(lzo_swd_p s)
|
||||
{
|
||||
/* defaults */
|
||||
s->node_count = SWD_N;
|
||||
|
||||
memset(s->llen3, 0, sizeof(s->llen3[0]) * (unsigned)SWD_HSIZE);
|
||||
#ifdef HEAD2
|
||||
memset(s->head2, 0xff, sizeof(s->head2[0]) * 65536L);
|
||||
assert(s->head2[0] == NIL2);
|
||||
#endif
|
||||
|
||||
s->ip = 0;
|
||||
s->bp = s->ip;
|
||||
s->first_rp = s->ip;
|
||||
|
||||
assert(s->ip + SWD_F <= B_SIZE);
|
||||
s->look = (unsigned) (s->c->in_end - s->c->ip);
|
||||
if (s->look > 0) {
|
||||
if (s->look > SWD_F)
|
||||
s->look = SWD_F;
|
||||
memcpy(&s->b[s->ip],s->c->ip,s->look);
|
||||
s->c->ip += s->look;
|
||||
s->ip += s->look;
|
||||
}
|
||||
if (s->ip == B_SIZE)
|
||||
s->ip = 0;
|
||||
|
||||
s->rp = s->first_rp;
|
||||
if (s->rp >= s->node_count)
|
||||
s->rp -= s->node_count;
|
||||
else
|
||||
s->rp += B_SIZE - s->node_count;
|
||||
|
||||
return LZO_E_OK;
|
||||
}
|
||||
|
||||
#define swd_pos2off(s,pos) \
|
||||
(s->bp > (pos) ? s->bp - (pos) : B_SIZE - ((pos) - s->bp))
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
static void swd_getbyte(lzo_swd_p s)
|
||||
{
|
||||
int c;
|
||||
|
||||
if ((c = getbyte(*(s->c))) < 0) {
|
||||
if (s->look > 0)
|
||||
--s->look;
|
||||
} else {
|
||||
s->b[s->ip] = c;
|
||||
if (s->ip < SWD_F)
|
||||
s->b_wrap[s->ip] = c;
|
||||
}
|
||||
if (++s->ip == B_SIZE)
|
||||
s->ip = 0;
|
||||
if (++s->bp == B_SIZE)
|
||||
s->bp = 0;
|
||||
if (++s->rp == B_SIZE)
|
||||
s->rp = 0;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// remove node from lists
|
||||
************************************************************************/
|
||||
static void swd_remove_node(lzo_swd_p s, unsigned node)
|
||||
{
|
||||
if (s->node_count == 0) {
|
||||
unsigned key;
|
||||
|
||||
key = HEAD3(s->b,node);
|
||||
assert(s->llen3[key] > 0);
|
||||
--s->llen3[key];
|
||||
|
||||
#ifdef HEAD2
|
||||
key = HEAD2(s->b,node);
|
||||
assert(s->head2[key] != NIL2);
|
||||
if ((unsigned) s->head2[key] == node)
|
||||
s->head2[key] = NIL2;
|
||||
#endif
|
||||
} else
|
||||
--s->node_count;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
static void swd_accept(lzo_swd_p s, unsigned n)
|
||||
{
|
||||
assert(n <= s->look);
|
||||
|
||||
while (n--) {
|
||||
unsigned key;
|
||||
|
||||
swd_remove_node(s,s->rp);
|
||||
|
||||
/* add bp into HEAD3 */
|
||||
key = HEAD3(s->b,s->bp);
|
||||
s->succ3[s->bp] = s_get_head3(s,key);
|
||||
s->head3[key] = s->bp;
|
||||
s->best3[s->bp] = SWD_F + 1;
|
||||
s->llen3[key]++;
|
||||
assert(s->llen3[key] <= SWD_N);
|
||||
|
||||
#ifdef HEAD2
|
||||
/* add bp into HEAD2 */
|
||||
key = HEAD2(s->b,s->bp);
|
||||
s->head2[key] = s->bp;
|
||||
#endif
|
||||
|
||||
swd_getbyte(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
static void swd_search(lzo_swd_p s, unsigned node, unsigned cnt)
|
||||
{
|
||||
const uint8_t *p1;
|
||||
const uint8_t *p2;
|
||||
const uint8_t *px;
|
||||
unsigned m_len = s->m_len;
|
||||
const uint8_t *b = s->b;
|
||||
const uint8_t *bp = s->b + s->bp;
|
||||
const uint8_t *bx = s->b + s->bp + s->look;
|
||||
unsigned char scan_end1;
|
||||
|
||||
assert(s->m_len > 0);
|
||||
|
||||
scan_end1 = bp[m_len - 1];
|
||||
for ( ; cnt-- > 0; node = s->succ3[node]) {
|
||||
p1 = bp;
|
||||
p2 = b + node;
|
||||
px = bx;
|
||||
|
||||
assert(m_len < s->look);
|
||||
|
||||
if (p2[m_len - 1] == scan_end1 &&
|
||||
p2[m_len] == p1[m_len] &&
|
||||
p2[0] == p1[0] &&
|
||||
p2[1] == p1[1]) {
|
||||
unsigned i;
|
||||
assert(lzo_memcmp(bp,&b[node],3) == 0);
|
||||
|
||||
p1 += 2; p2 += 2;
|
||||
do {} while (++p1 < px && *p1 == *++p2);
|
||||
i = p1-bp;
|
||||
|
||||
assert(lzo_memcmp(bp,&b[node],i) == 0);
|
||||
|
||||
#if defined(SWD_BEST_OFF)
|
||||
if (i < SWD_BEST_OFF) {
|
||||
if (s->best_pos[i] == 0)
|
||||
s->best_pos[i] = node + 1;
|
||||
}
|
||||
#endif
|
||||
if (i > m_len) {
|
||||
s->m_len = m_len = i;
|
||||
s->m_pos = node;
|
||||
if (m_len == s->look)
|
||||
return;
|
||||
if (m_len >= SWD_F)
|
||||
return;
|
||||
if (m_len > (unsigned) s->best3[node])
|
||||
return;
|
||||
scan_end1 = bp[m_len - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
#ifdef HEAD2
|
||||
|
||||
static int swd_search2(lzo_swd_p s)
|
||||
{
|
||||
unsigned key;
|
||||
|
||||
assert(s->look >= 2);
|
||||
assert(s->m_len > 0);
|
||||
|
||||
key = s->head2[ HEAD2(s->b,s->bp) ];
|
||||
if (key == NIL2)
|
||||
return 0;
|
||||
assert(lzo_memcmp(&s->b[s->bp],&s->b[key],2) == 0);
|
||||
#if defined(SWD_BEST_OFF)
|
||||
if (s->best_pos[2] == 0)
|
||||
s->best_pos[2] = key + 1;
|
||||
#endif
|
||||
|
||||
if (s->m_len < 2) {
|
||||
s->m_len = 2;
|
||||
s->m_pos = key;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
static void swd_findbest(lzo_swd_p s)
|
||||
{
|
||||
unsigned key;
|
||||
unsigned cnt, node;
|
||||
unsigned len;
|
||||
|
||||
assert(s->m_len > 0);
|
||||
|
||||
/* get current head, add bp into HEAD3 */
|
||||
key = HEAD3(s->b,s->bp);
|
||||
node = s->succ3[s->bp] = s_get_head3(s,key);
|
||||
cnt = s->llen3[key]++;
|
||||
assert(s->llen3[key] <= SWD_N + SWD_F);
|
||||
if (cnt > s->max_chain)
|
||||
cnt = s->max_chain;
|
||||
s->head3[key] = s->bp;
|
||||
|
||||
s->b_char = s->b[s->bp];
|
||||
len = s->m_len;
|
||||
if (s->m_len >= s->look) {
|
||||
if (s->look == 0)
|
||||
s->b_char = -1;
|
||||
s->m_off = 0;
|
||||
s->best3[s->bp] = SWD_F + 1;
|
||||
} else {
|
||||
#ifdef HEAD2
|
||||
if (swd_search2(s))
|
||||
#endif
|
||||
if (s->look >= 3)
|
||||
swd_search(s,node,cnt);
|
||||
if (s->m_len > len)
|
||||
s->m_off = swd_pos2off(s,s->m_pos);
|
||||
s->best3[s->bp] = s->m_len;
|
||||
|
||||
#if defined(SWD_BEST_OFF)
|
||||
if (s->use_best_off) {
|
||||
int i;
|
||||
for (i = 2; i < SWD_BEST_OFF; i++)
|
||||
if (s->best_pos[i] > 0)
|
||||
s->best_off[i] = swd_pos2off(s,s->best_pos[i]-1);
|
||||
else
|
||||
s->best_off[i] = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
swd_remove_node(s,s->rp);
|
||||
|
||||
#ifdef HEAD2
|
||||
/* add bp into HEAD2 */
|
||||
key = HEAD2(s->b,s->bp);
|
||||
s->head2[key] = s->bp;
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef HEAD3
|
||||
#undef HEAD2
|
||||
#undef s_get_head3
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
static int init_match(lzo1x_999_t *c, lzo_swd_p s, uint32_t use_best_off)
|
||||
{
|
||||
int r;
|
||||
|
||||
assert(!c->init);
|
||||
c->init = 1;
|
||||
|
||||
s->c = c;
|
||||
|
||||
r = swd_init(s);
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
s->use_best_off = use_best_off;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
static int find_match(lzo1x_999_t *c, lzo_swd_p s,
|
||||
unsigned this_len, unsigned skip)
|
||||
{
|
||||
assert(c->init);
|
||||
|
||||
if (skip > 0) {
|
||||
assert(this_len >= skip);
|
||||
swd_accept(s, this_len - skip);
|
||||
} else {
|
||||
assert(this_len <= 1);
|
||||
}
|
||||
|
||||
s->m_len = 1;
|
||||
s->m_len = 1;
|
||||
#ifdef SWD_BEST_OFF
|
||||
if (s->use_best_off)
|
||||
memset(s->best_pos,0,sizeof(s->best_pos));
|
||||
#endif
|
||||
swd_findbest(s);
|
||||
c->m_len = s->m_len;
|
||||
c->m_off = s->m_off;
|
||||
|
||||
swd_getbyte(s);
|
||||
|
||||
if (s->b_char < 0) {
|
||||
c->look = 0;
|
||||
c->m_len = 0;
|
||||
} else {
|
||||
c->look = s->look + 1;
|
||||
}
|
||||
c->bp = c->ip - c->look;
|
||||
|
||||
return LZO_E_OK;
|
||||
}
|
||||
|
||||
/* this is a public functions, but there is no prototype in a header file */
|
||||
static int lzo1x_999_compress_internal(const uint8_t *in , unsigned in_len,
|
||||
uint8_t *out, unsigned *out_len,
|
||||
void *wrkmem,
|
||||
unsigned good_length,
|
||||
unsigned max_lazy,
|
||||
unsigned max_chain,
|
||||
uint32_t use_best_off);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
static uint8_t *code_match(lzo1x_999_t *c,
|
||||
uint8_t *op, unsigned m_len, unsigned m_off)
|
||||
{
|
||||
assert(op > c->out);
|
||||
if (m_len == 2) {
|
||||
assert(m_off <= M1_MAX_OFFSET);
|
||||
assert(c->r1_lit > 0); assert(c->r1_lit < 4);
|
||||
m_off -= 1;
|
||||
*op++ = M1_MARKER | ((m_off & 3) << 2);
|
||||
*op++ = m_off >> 2;
|
||||
} else if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET) {
|
||||
assert(m_len >= 3);
|
||||
m_off -= 1;
|
||||
*op++ = ((m_len - 1) << 5) | ((m_off & 7) << 2);
|
||||
*op++ = m_off >> 3;
|
||||
assert(op[-2] >= M2_MARKER);
|
||||
} else if (m_len == M2_MIN_LEN && m_off <= MX_MAX_OFFSET && c->r1_lit >= 4) {
|
||||
assert(m_len == 3);
|
||||
assert(m_off > M2_MAX_OFFSET);
|
||||
m_off -= 1 + M2_MAX_OFFSET;
|
||||
*op++ = M1_MARKER | ((m_off & 3) << 2);
|
||||
*op++ = m_off >> 2;
|
||||
} else if (m_off <= M3_MAX_OFFSET) {
|
||||
assert(m_len >= 3);
|
||||
m_off -= 1;
|
||||
if (m_len <= M3_MAX_LEN)
|
||||
*op++ = M3_MARKER | (m_len - 2);
|
||||
else {
|
||||
m_len -= M3_MAX_LEN;
|
||||
*op++ = M3_MARKER | 0;
|
||||
while (m_len > 255)
|
||||
{
|
||||
m_len -= 255;
|
||||
*op++ = 0;
|
||||
}
|
||||
assert(m_len > 0);
|
||||
*op++ = m_len;
|
||||
}
|
||||
*op++ = m_off << 2;
|
||||
*op++ = m_off >> 6;
|
||||
} else {
|
||||
unsigned k;
|
||||
|
||||
assert(m_len >= 3);
|
||||
assert(m_off > 0x4000); assert(m_off <= 0xbfff);
|
||||
m_off -= 0x4000;
|
||||
k = (m_off & 0x4000) >> 11;
|
||||
if (m_len <= M4_MAX_LEN)
|
||||
*op++ = M4_MARKER | k | (m_len - 2);
|
||||
else {
|
||||
m_len -= M4_MAX_LEN;
|
||||
*op++ = M4_MARKER | k | 0;
|
||||
while (m_len > 255)
|
||||
{
|
||||
m_len -= 255;
|
||||
*op++ = 0;
|
||||
}
|
||||
assert(m_len > 0);
|
||||
*op++ = m_len;
|
||||
}
|
||||
*op++ = m_off << 2;
|
||||
*op++ = m_off >> 6;
|
||||
}
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
|
||||
static uint8_t *STORE_RUN(lzo1x_999_t *c, uint8_t *op,
|
||||
const uint8_t *ii, unsigned t)
|
||||
{
|
||||
if (op == c->out && t <= 238) {
|
||||
*op++ = 17 + t;
|
||||
} else if (t <= 3) {
|
||||
op[-2] |= t;
|
||||
} else if (t <= 18) {
|
||||
*op++ = t - 3;
|
||||
} else {
|
||||
unsigned tt = t - 18;
|
||||
|
||||
*op++ = 0;
|
||||
while (tt > 255) {
|
||||
tt -= 255;
|
||||
*op++ = 0;
|
||||
}
|
||||
assert(tt > 0);
|
||||
*op++ = tt;
|
||||
}
|
||||
do *op++ = *ii++; while (--t > 0);
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
|
||||
static uint8_t *code_run(lzo1x_999_t *c, uint8_t *op, const uint8_t *ii,
|
||||
unsigned lit)
|
||||
{
|
||||
if (lit > 0) {
|
||||
assert(m_len >= 2);
|
||||
op = STORE_RUN(c,op,ii,lit);
|
||||
} else {
|
||||
assert(m_len >= 3);
|
||||
}
|
||||
c->r1_lit = lit;
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
static int len_of_coded_match(unsigned m_len, unsigned m_off, unsigned lit)
|
||||
{
|
||||
int n = 4;
|
||||
|
||||
if (m_len < 2)
|
||||
return -1;
|
||||
if (m_len == 2)
|
||||
return (m_off <= M1_MAX_OFFSET && lit > 0 && lit < 4) ? 2 : -1;
|
||||
if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET)
|
||||
return 2;
|
||||
if (m_len == M2_MIN_LEN && m_off <= MX_MAX_OFFSET && lit >= 4)
|
||||
return 2;
|
||||
if (m_off <= M3_MAX_OFFSET) {
|
||||
if (m_len <= M3_MAX_LEN)
|
||||
return 3;
|
||||
m_len -= M3_MAX_LEN;
|
||||
} else if (m_off <= M4_MAX_OFFSET) {
|
||||
if (m_len <= M4_MAX_LEN)
|
||||
return 3;
|
||||
m_len -= M4_MAX_LEN;
|
||||
} else
|
||||
return -1;
|
||||
while (m_len > 255) {
|
||||
m_len -= 255;
|
||||
n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
static int min_gain(unsigned ahead, unsigned lit1,
|
||||
unsigned lit2, int l1, int l2, int l3)
|
||||
{
|
||||
int lazy_match_min_gain = 0;
|
||||
|
||||
assert (ahead >= 1);
|
||||
lazy_match_min_gain += ahead;
|
||||
|
||||
if (lit1 <= 3)
|
||||
lazy_match_min_gain += (lit2 <= 3) ? 0 : 2;
|
||||
else if (lit1 <= 18)
|
||||
lazy_match_min_gain += (lit2 <= 18) ? 0 : 1;
|
||||
|
||||
lazy_match_min_gain += (l2 - l1) * 2;
|
||||
if (l3 > 0)
|
||||
lazy_match_min_gain -= (ahead - l3) * 2;
|
||||
|
||||
if (lazy_match_min_gain < 0)
|
||||
lazy_match_min_gain = 0;
|
||||
|
||||
return lazy_match_min_gain;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
#if defined(SWD_BEST_OFF)
|
||||
|
||||
static void better_match(const lzo_swd_p swd,
|
||||
unsigned *m_len, unsigned *m_off)
|
||||
{
|
||||
|
||||
if (*m_len <= M2_MIN_LEN)
|
||||
return;
|
||||
|
||||
if (*m_off <= M2_MAX_OFFSET)
|
||||
return;
|
||||
|
||||
/* M3/M4 -> M2 */
|
||||
if (*m_off > M2_MAX_OFFSET &&
|
||||
*m_len >= M2_MIN_LEN + 1 && *m_len <= M2_MAX_LEN + 1 &&
|
||||
swd->best_off[*m_len-1] && swd->best_off[*m_len-1] <= M2_MAX_OFFSET)
|
||||
{
|
||||
*m_len = *m_len - 1;
|
||||
*m_off = swd->best_off[*m_len];
|
||||
return;
|
||||
}
|
||||
|
||||
/* M4 -> M2 */
|
||||
if (*m_off > M3_MAX_OFFSET &&
|
||||
*m_len >= M4_MAX_LEN + 1 && *m_len <= M2_MAX_LEN + 2 &&
|
||||
swd->best_off[*m_len-2] && swd->best_off[*m_len-2] <= M2_MAX_OFFSET)
|
||||
{
|
||||
*m_len = *m_len - 2;
|
||||
*m_off = swd->best_off[*m_len];
|
||||
return;
|
||||
}
|
||||
/* M4 -> M3 */
|
||||
if (*m_off > M3_MAX_OFFSET &&
|
||||
*m_len >= M4_MAX_LEN + 1 && *m_len <= M3_MAX_LEN + 1 &&
|
||||
swd->best_off[*m_len-1] && swd->best_off[*m_len-1] <= M3_MAX_OFFSET)
|
||||
{
|
||||
*m_len = *m_len - 1;
|
||||
*m_off = swd->best_off[*m_len];
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
static int lzo1x_999_compress_internal(const uint8_t *in, unsigned in_len,
|
||||
uint8_t *out, unsigned *out_len,
|
||||
void *wrkmem,
|
||||
unsigned good_length,
|
||||
unsigned max_lazy,
|
||||
unsigned max_chain,
|
||||
uint32_t use_best_off)
|
||||
{
|
||||
uint8_t *op;
|
||||
const uint8_t *ii;
|
||||
unsigned lit;
|
||||
unsigned m_len, m_off;
|
||||
lzo1x_999_t cc;
|
||||
lzo1x_999_t * const c = &cc;
|
||||
lzo_swd_p const swd = (lzo_swd_p) wrkmem;
|
||||
int r;
|
||||
|
||||
c->init = 0;
|
||||
c->ip = c->in = in;
|
||||
c->in_end = in + in_len;
|
||||
c->out = out;
|
||||
|
||||
op = out;
|
||||
ii = c->ip; /* point to start of literal run */
|
||||
lit = 0;
|
||||
c->r1_lit = 0;
|
||||
|
||||
r = init_match(c, swd, use_best_off);
|
||||
if (r != 0)
|
||||
return r;
|
||||
swd->max_chain = max_chain;
|
||||
|
||||
r = find_match(c, swd, 0, 0);
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
while (c->look > 0) {
|
||||
unsigned ahead;
|
||||
unsigned max_ahead;
|
||||
int l1, l2, l3;
|
||||
|
||||
m_len = c->m_len;
|
||||
m_off = c->m_off;
|
||||
|
||||
assert(c->bp == c->ip - c->look);
|
||||
assert(c->bp >= in);
|
||||
if (lit == 0)
|
||||
ii = c->bp;
|
||||
assert(ii + lit == c->bp);
|
||||
assert(swd->b_char == *(c->bp));
|
||||
|
||||
if ( m_len < 2 ||
|
||||
(m_len == 2 && (m_off > M1_MAX_OFFSET || lit == 0 || lit >= 4)) ||
|
||||
/* Do not accept this match for compressed-data compatibility
|
||||
* with LZO v1.01 and before
|
||||
* [ might be a problem for decompress() and optimize() ]
|
||||
*/
|
||||
(m_len == 2 && op == out) ||
|
||||
(op == out && lit == 0))
|
||||
{
|
||||
/* a literal */
|
||||
m_len = 0;
|
||||
}
|
||||
else if (m_len == M2_MIN_LEN) {
|
||||
/* compression ratio improves if we code a literal in some cases */
|
||||
if (m_off > MX_MAX_OFFSET && lit >= 4)
|
||||
m_len = 0;
|
||||
}
|
||||
|
||||
if (m_len == 0) {
|
||||
/* a literal */
|
||||
lit++;
|
||||
swd->max_chain = max_chain;
|
||||
r = find_match(c,swd,1,0);
|
||||
assert(r == 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* a match */
|
||||
#if defined(SWD_BEST_OFF)
|
||||
if (swd->use_best_off)
|
||||
better_match(swd,&m_len,&m_off);
|
||||
#endif
|
||||
|
||||
/* shall we try a lazy match ? */
|
||||
ahead = 0;
|
||||
if (m_len >= max_lazy) {
|
||||
/* no */
|
||||
l1 = 0;
|
||||
max_ahead = 0;
|
||||
} else {
|
||||
/* yes, try a lazy match */
|
||||
l1 = len_of_coded_match(m_len,m_off,lit);
|
||||
assert(l1 > 0);
|
||||
max_ahead = LZO_MIN(2, (unsigned)l1 - 1);
|
||||
}
|
||||
|
||||
|
||||
while (ahead < max_ahead && c->look > m_len) {
|
||||
int lazy_match_min_gain;
|
||||
|
||||
if (m_len >= good_length)
|
||||
swd->max_chain = max_chain >> 2;
|
||||
else
|
||||
swd->max_chain = max_chain;
|
||||
r = find_match(c,swd,1,0);
|
||||
ahead++;
|
||||
|
||||
assert(r == 0);
|
||||
assert(c->look > 0);
|
||||
assert(ii + lit + ahead == c->bp);
|
||||
|
||||
if (c->m_len < m_len)
|
||||
continue;
|
||||
if (c->m_len == m_len && c->m_off >= m_off)
|
||||
continue;
|
||||
#if defined(SWD_BEST_OFF)
|
||||
if (swd->use_best_off)
|
||||
better_match(swd,&c->m_len,&c->m_off);
|
||||
#endif
|
||||
l2 = len_of_coded_match(c->m_len,c->m_off,lit+ahead);
|
||||
if (l2 < 0)
|
||||
continue;
|
||||
|
||||
/* compressed-data compatibility [see above] */
|
||||
l3 = (op == out) ? -1 : len_of_coded_match(ahead,m_off,lit);
|
||||
|
||||
lazy_match_min_gain = min_gain(ahead,lit,lit+ahead,l1,l2,l3);
|
||||
if (c->m_len >= m_len + lazy_match_min_gain) {
|
||||
if (l3 > 0) {
|
||||
/* code previous run */
|
||||
op = code_run(c,op,ii,lit);
|
||||
lit = 0;
|
||||
/* code shortened match */
|
||||
op = code_match(c,op,ahead,m_off);
|
||||
} else {
|
||||
lit += ahead;
|
||||
assert(ii + lit == c->bp);
|
||||
}
|
||||
goto lazy_match_done;
|
||||
}
|
||||
}
|
||||
|
||||
assert(ii + lit + ahead == c->bp);
|
||||
|
||||
/* 1 - code run */
|
||||
op = code_run(c,op,ii,lit);
|
||||
lit = 0;
|
||||
|
||||
/* 2 - code match */
|
||||
op = code_match(c,op,m_len,m_off);
|
||||
swd->max_chain = max_chain;
|
||||
r = find_match(c,swd,m_len,1+ahead);
|
||||
assert(r == 0);
|
||||
|
||||
lazy_match_done: ;
|
||||
}
|
||||
|
||||
/* store final run */
|
||||
if (lit > 0)
|
||||
op = STORE_RUN(c,op,ii,lit);
|
||||
|
||||
#if defined(LZO_EOF_CODE)
|
||||
*op++ = M4_MARKER | 1;
|
||||
*op++ = 0;
|
||||
*op++ = 0;
|
||||
#endif
|
||||
|
||||
*out_len = op - out;
|
||||
|
||||
return LZO_E_OK;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
int lzo1x_999_compress_level(const uint8_t *in, unsigned in_len,
|
||||
uint8_t *out, unsigned *out_len,
|
||||
void *wrkmem,
|
||||
int compression_level)
|
||||
{
|
||||
static const struct {
|
||||
uint16_t good_length;
|
||||
uint16_t max_lazy;
|
||||
uint16_t max_chain;
|
||||
uint16_t use_best_off;
|
||||
} c[3] = {
|
||||
{ 8, 32, 256, 0 },
|
||||
{ 32, 128, 2048, 1 },
|
||||
{ SWD_F, SWD_F, 4096, 1 } /* max. compression */
|
||||
};
|
||||
|
||||
if (compression_level < 7 || compression_level > 9)
|
||||
return LZO_E_ERROR;
|
||||
|
||||
compression_level -= 7;
|
||||
return lzo1x_999_compress_internal(in, in_len, out, out_len, wrkmem,
|
||||
c[compression_level].good_length,
|
||||
c[compression_level].max_lazy,
|
||||
c[compression_level].max_chain,
|
||||
c[compression_level].use_best_off);
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
/* implementation of the LZO1[XY]-1 compression algorithm
|
||||
|
||||
This file is part of the LZO real-time data compression library.
|
||||
|
||||
Copyright (C) 1996..2008 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
Markus F.X.J. Oberhumer <markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/lzo/
|
||||
|
||||
The LZO library 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.
|
||||
|
||||
The LZO 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the LZO library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/***********************************************************************
|
||||
// compress a block of data.
|
||||
************************************************************************/
|
||||
static NOINLINE unsigned
|
||||
do_compress(const uint8_t* in, unsigned in_len,
|
||||
uint8_t* out, unsigned* out_len,
|
||||
void* wrkmem)
|
||||
{
|
||||
register const uint8_t* ip;
|
||||
uint8_t* op;
|
||||
const uint8_t* const in_end = in + in_len;
|
||||
const uint8_t* const ip_end = in + in_len - M2_MAX_LEN - 5;
|
||||
const uint8_t* ii;
|
||||
const void* *const dict = (const void**) wrkmem;
|
||||
|
||||
op = out;
|
||||
ip = in;
|
||||
ii = ip;
|
||||
|
||||
ip += 4;
|
||||
for (;;) {
|
||||
register const uint8_t* m_pos;
|
||||
unsigned m_off;
|
||||
unsigned m_len;
|
||||
unsigned dindex;
|
||||
|
||||
D_INDEX1(dindex,ip);
|
||||
GINDEX(m_pos,m_off,dict,dindex,in);
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET))
|
||||
goto literal;
|
||||
#if 1
|
||||
if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3])
|
||||
goto try_match;
|
||||
D_INDEX2(dindex,ip);
|
||||
#endif
|
||||
GINDEX(m_pos,m_off,dict,dindex,in);
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET))
|
||||
goto literal;
|
||||
if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3])
|
||||
goto try_match;
|
||||
goto literal;
|
||||
|
||||
try_match:
|
||||
#if 1 && defined(LZO_UNALIGNED_OK_2)
|
||||
if (* (const lzo_ushortp) m_pos != * (const lzo_ushortp) ip)
|
||||
#else
|
||||
if (m_pos[0] != ip[0] || m_pos[1] != ip[1])
|
||||
#endif
|
||||
{
|
||||
} else {
|
||||
if (m_pos[2] == ip[2]) {
|
||||
#if 0
|
||||
if (m_off <= M2_MAX_OFFSET)
|
||||
goto match;
|
||||
if (lit <= 3)
|
||||
goto match;
|
||||
if (lit == 3) { /* better compression, but slower */
|
||||
assert(op - 2 > out); op[-2] |= (uint8_t)(3);
|
||||
*op++ = *ii++; *op++ = *ii++; *op++ = *ii++;
|
||||
goto code_match;
|
||||
}
|
||||
if (m_pos[3] == ip[3])
|
||||
#endif
|
||||
goto match;
|
||||
}
|
||||
else {
|
||||
/* still need a better way for finding M1 matches */
|
||||
#if 0
|
||||
/* a M1 match */
|
||||
#if 0
|
||||
if (m_off <= M1_MAX_OFFSET && lit > 0 && lit <= 3)
|
||||
#else
|
||||
if (m_off <= M1_MAX_OFFSET && lit == 3)
|
||||
#endif
|
||||
{
|
||||
register unsigned t;
|
||||
|
||||
t = lit;
|
||||
assert(op - 2 > out); op[-2] |= (uint8_t)(t);
|
||||
do *op++ = *ii++; while (--t > 0);
|
||||
assert(ii == ip);
|
||||
m_off -= 1;
|
||||
*op++ = (uint8_t)(M1_MARKER | ((m_off & 3) << 2));
|
||||
*op++ = (uint8_t)(m_off >> 2);
|
||||
ip += 2;
|
||||
goto match_done;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* a literal */
|
||||
literal:
|
||||
UPDATE_I(dict, 0, dindex, ip, in);
|
||||
++ip;
|
||||
if (ip >= ip_end)
|
||||
break;
|
||||
continue;
|
||||
|
||||
/* a match */
|
||||
match:
|
||||
UPDATE_I(dict, 0, dindex, ip, in);
|
||||
/* store current literal run */
|
||||
if (pd(ip, ii) > 0) {
|
||||
register unsigned t = pd(ip, ii);
|
||||
|
||||
if (t <= 3) {
|
||||
assert(op - 2 > out);
|
||||
op[-2] |= (uint8_t)(t);
|
||||
}
|
||||
else if (t <= 18)
|
||||
*op++ = (uint8_t)(t - 3);
|
||||
else {
|
||||
register unsigned tt = t - 18;
|
||||
|
||||
*op++ = 0;
|
||||
while (tt > 255) {
|
||||
tt -= 255;
|
||||
*op++ = 0;
|
||||
}
|
||||
assert(tt > 0);
|
||||
*op++ = (uint8_t)(tt);
|
||||
}
|
||||
do *op++ = *ii++; while (--t > 0);
|
||||
}
|
||||
|
||||
/* code the match */
|
||||
assert(ii == ip);
|
||||
ip += 3;
|
||||
if (m_pos[3] != *ip++ || m_pos[4] != *ip++ || m_pos[5] != *ip++
|
||||
|| m_pos[6] != *ip++ || m_pos[7] != *ip++ || m_pos[8] != *ip++
|
||||
#ifdef LZO1Y
|
||||
|| m_pos[ 9] != *ip++ || m_pos[10] != *ip++ || m_pos[11] != *ip++
|
||||
|| m_pos[12] != *ip++ || m_pos[13] != *ip++ || m_pos[14] != *ip++
|
||||
#endif
|
||||
) {
|
||||
--ip;
|
||||
m_len = pd(ip, ii);
|
||||
assert(m_len >= 3);
|
||||
assert(m_len <= M2_MAX_LEN);
|
||||
|
||||
if (m_off <= M2_MAX_OFFSET) {
|
||||
m_off -= 1;
|
||||
#if defined(LZO1X)
|
||||
*op++ = (uint8_t)(((m_len - 1) << 5) | ((m_off & 7) << 2));
|
||||
*op++ = (uint8_t)(m_off >> 3);
|
||||
#elif defined(LZO1Y)
|
||||
*op++ = (uint8_t)(((m_len + 1) << 4) | ((m_off & 3) << 2));
|
||||
*op++ = (uint8_t)(m_off >> 2);
|
||||
#endif
|
||||
}
|
||||
else if (m_off <= M3_MAX_OFFSET) {
|
||||
m_off -= 1;
|
||||
*op++ = (uint8_t)(M3_MARKER | (m_len - 2));
|
||||
goto m3_m4_offset;
|
||||
} else {
|
||||
#if defined(LZO1X)
|
||||
m_off -= 0x4000;
|
||||
assert(m_off > 0);
|
||||
assert(m_off <= 0x7fff);
|
||||
*op++ = (uint8_t)(M4_MARKER | ((m_off & 0x4000) >> 11) | (m_len - 2));
|
||||
goto m3_m4_offset;
|
||||
#elif defined(LZO1Y)
|
||||
goto m4_match;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else {
|
||||
{
|
||||
const uint8_t* end = in_end;
|
||||
const uint8_t* m = m_pos + M2_MAX_LEN + 1;
|
||||
while (ip < end && *m == *ip)
|
||||
m++, ip++;
|
||||
m_len = pd(ip, ii);
|
||||
}
|
||||
assert(m_len > M2_MAX_LEN);
|
||||
|
||||
if (m_off <= M3_MAX_OFFSET) {
|
||||
m_off -= 1;
|
||||
if (m_len <= 33)
|
||||
*op++ = (uint8_t)(M3_MARKER | (m_len - 2));
|
||||
else {
|
||||
m_len -= 33;
|
||||
*op++ = M3_MARKER | 0;
|
||||
goto m3_m4_len;
|
||||
}
|
||||
} else {
|
||||
#if defined(LZO1Y)
|
||||
m4_match:
|
||||
#endif
|
||||
m_off -= 0x4000;
|
||||
assert(m_off > 0);
|
||||
assert(m_off <= 0x7fff);
|
||||
if (m_len <= M4_MAX_LEN)
|
||||
*op++ = (uint8_t)(M4_MARKER | ((m_off & 0x4000) >> 11) | (m_len - 2));
|
||||
else {
|
||||
m_len -= M4_MAX_LEN;
|
||||
*op++ = (uint8_t)(M4_MARKER | ((m_off & 0x4000) >> 11));
|
||||
m3_m4_len:
|
||||
while (m_len > 255) {
|
||||
m_len -= 255;
|
||||
*op++ = 0;
|
||||
}
|
||||
assert(m_len > 0);
|
||||
*op++ = (uint8_t)(m_len);
|
||||
}
|
||||
}
|
||||
m3_m4_offset:
|
||||
*op++ = (uint8_t)((m_off & 63) << 2);
|
||||
*op++ = (uint8_t)(m_off >> 6);
|
||||
}
|
||||
#if 0
|
||||
match_done:
|
||||
#endif
|
||||
ii = ip;
|
||||
if (ip >= ip_end)
|
||||
break;
|
||||
}
|
||||
|
||||
*out_len = pd(op, out);
|
||||
return pd(in_end, ii);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
// public entry point
|
||||
************************************************************************/
|
||||
int DO_COMPRESS(const uint8_t* in, unsigned in_len,
|
||||
uint8_t* out, unsigned* out_len,
|
||||
void* wrkmem)
|
||||
{
|
||||
uint8_t* op = out;
|
||||
unsigned t;
|
||||
|
||||
if (in_len <= M2_MAX_LEN + 5)
|
||||
t = in_len;
|
||||
else {
|
||||
t = do_compress(in,in_len,op,out_len,wrkmem);
|
||||
op += *out_len;
|
||||
}
|
||||
|
||||
if (t > 0) {
|
||||
const uint8_t* ii = in + in_len - t;
|
||||
|
||||
if (op == out && t <= 238)
|
||||
*op++ = (uint8_t)(17 + t);
|
||||
else if (t <= 3)
|
||||
op[-2] |= (uint8_t)(t);
|
||||
else if (t <= 18)
|
||||
*op++ = (uint8_t)(t - 3);
|
||||
else {
|
||||
unsigned tt = t - 18;
|
||||
|
||||
*op++ = 0;
|
||||
while (tt > 255) {
|
||||
tt -= 255;
|
||||
*op++ = 0;
|
||||
}
|
||||
assert(tt > 0);
|
||||
*op++ = (uint8_t)(tt);
|
||||
}
|
||||
do *op++ = *ii++; while (--t > 0);
|
||||
}
|
||||
|
||||
*op++ = M4_MARKER | 1;
|
||||
*op++ = 0;
|
||||
*op++ = 0;
|
||||
|
||||
*out_len = pd(op, out);
|
||||
return 0; /*LZO_E_OK*/
|
||||
}
|
||||
@@ -0,0 +1,420 @@
|
||||
/* implementation of the LZO1X decompression algorithm
|
||||
|
||||
This file is part of the LZO real-time data compression library.
|
||||
|
||||
Copyright (C) 1996..2008 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
Markus F.X.J. Oberhumer <markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/lzo/
|
||||
|
||||
The LZO library 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.
|
||||
|
||||
The LZO 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the LZO library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#include "libbb.h"
|
||||
#include "liblzo.h"
|
||||
|
||||
/***********************************************************************
|
||||
// decompress a block of data.
|
||||
************************************************************************/
|
||||
/* safe decompression with overrun testing */
|
||||
int lzo1x_decompress_safe(const uint8_t* in, unsigned in_len,
|
||||
uint8_t* out, unsigned* out_len,
|
||||
void* wrkmem UNUSED_PARAM)
|
||||
{
|
||||
register uint8_t* op;
|
||||
register const uint8_t* ip;
|
||||
register unsigned t;
|
||||
#if defined(COPY_DICT)
|
||||
unsigned m_off;
|
||||
const uint8_t* dict_end;
|
||||
#else
|
||||
register const uint8_t* m_pos = NULL; /* possibly not needed */
|
||||
#endif
|
||||
const uint8_t* const ip_end = in + in_len;
|
||||
#if defined(HAVE_ANY_OP)
|
||||
uint8_t* const op_end = out + *out_len;
|
||||
#endif
|
||||
#if defined(LZO1Z)
|
||||
unsigned last_m_off = 0;
|
||||
#endif
|
||||
|
||||
// LZO_UNUSED(wrkmem);
|
||||
|
||||
#if defined(COPY_DICT)
|
||||
if (dict) {
|
||||
if (dict_len > M4_MAX_OFFSET) {
|
||||
dict += dict_len - M4_MAX_OFFSET;
|
||||
dict_len = M4_MAX_OFFSET;
|
||||
}
|
||||
dict_end = dict + dict_len;
|
||||
} else {
|
||||
dict_len = 0;
|
||||
dict_end = NULL;
|
||||
}
|
||||
#endif /* COPY_DICT */
|
||||
|
||||
*out_len = 0;
|
||||
|
||||
op = out;
|
||||
ip = in;
|
||||
|
||||
if (*ip > 17) {
|
||||
t = *ip++ - 17;
|
||||
if (t < 4)
|
||||
goto match_next;
|
||||
assert(t > 0); NEED_OP(t); NEED_IP(t+1);
|
||||
do *op++ = *ip++; while (--t > 0);
|
||||
goto first_literal_run;
|
||||
}
|
||||
|
||||
while (TEST_IP && TEST_OP) {
|
||||
t = *ip++;
|
||||
if (t >= 16)
|
||||
goto match;
|
||||
/* a literal run */
|
||||
if (t == 0) {
|
||||
NEED_IP(1);
|
||||
while (*ip == 0) {
|
||||
t += 255;
|
||||
ip++;
|
||||
NEED_IP(1);
|
||||
}
|
||||
t += 15 + *ip++;
|
||||
}
|
||||
/* copy literals */
|
||||
assert(t > 0);
|
||||
NEED_OP(t+3);
|
||||
NEED_IP(t+4);
|
||||
#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4)
|
||||
# if !defined(LZO_UNALIGNED_OK_4)
|
||||
if (PTR_ALIGNED2_4(op, ip))
|
||||
# endif
|
||||
{
|
||||
COPY4(op, ip);
|
||||
op += 4;
|
||||
ip += 4;
|
||||
if (--t > 0) {
|
||||
if (t >= 4) {
|
||||
do {
|
||||
COPY4(op, ip);
|
||||
op += 4;
|
||||
ip += 4;
|
||||
t -= 4;
|
||||
} while (t >= 4);
|
||||
if (t > 0)
|
||||
do *op++ = *ip++; while (--t > 0);
|
||||
} else {
|
||||
do *op++ = *ip++; while (--t > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
# if !defined(LZO_UNALIGNED_OK_4)
|
||||
else
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(LZO_UNALIGNED_OK_4)
|
||||
{
|
||||
*op++ = *ip++;
|
||||
*op++ = *ip++;
|
||||
*op++ = *ip++;
|
||||
do *op++ = *ip++; while (--t > 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
first_literal_run:
|
||||
t = *ip++;
|
||||
if (t >= 16)
|
||||
goto match;
|
||||
#if defined(COPY_DICT)
|
||||
#if defined(LZO1Z)
|
||||
m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2);
|
||||
last_m_off = m_off;
|
||||
#else
|
||||
m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2);
|
||||
#endif
|
||||
NEED_OP(3);
|
||||
t = 3; COPY_DICT(t,m_off)
|
||||
#else /* !COPY_DICT */
|
||||
#if defined(LZO1Z)
|
||||
t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2);
|
||||
m_pos = op - t;
|
||||
last_m_off = t;
|
||||
#else
|
||||
m_pos = op - (1 + M2_MAX_OFFSET);
|
||||
m_pos -= t >> 2;
|
||||
m_pos -= *ip++ << 2;
|
||||
#endif
|
||||
TEST_LB(m_pos); NEED_OP(3);
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos;
|
||||
#endif /* COPY_DICT */
|
||||
goto match_done;
|
||||
|
||||
/* handle matches */
|
||||
do {
|
||||
match:
|
||||
if (t >= 64) { /* a M2 match */
|
||||
#if defined(COPY_DICT)
|
||||
#if defined(LZO1X)
|
||||
m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3);
|
||||
t = (t >> 5) - 1;
|
||||
#elif defined(LZO1Y)
|
||||
m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2);
|
||||
t = (t >> 4) - 3;
|
||||
#elif defined(LZO1Z)
|
||||
m_off = t & 0x1f;
|
||||
if (m_off >= 0x1c)
|
||||
m_off = last_m_off;
|
||||
else {
|
||||
m_off = 1 + (m_off << 6) + (*ip++ >> 2);
|
||||
last_m_off = m_off;
|
||||
}
|
||||
t = (t >> 5) - 1;
|
||||
#endif
|
||||
#else /* !COPY_DICT */
|
||||
#if defined(LZO1X)
|
||||
m_pos = op - 1;
|
||||
m_pos -= (t >> 2) & 7;
|
||||
m_pos -= *ip++ << 3;
|
||||
t = (t >> 5) - 1;
|
||||
#elif defined(LZO1Y)
|
||||
m_pos = op - 1;
|
||||
m_pos -= (t >> 2) & 3;
|
||||
m_pos -= *ip++ << 2;
|
||||
t = (t >> 4) - 3;
|
||||
#elif defined(LZO1Z)
|
||||
{
|
||||
unsigned off = t & 0x1f;
|
||||
m_pos = op;
|
||||
if (off >= 0x1c) {
|
||||
assert(last_m_off > 0);
|
||||
m_pos -= last_m_off;
|
||||
} else {
|
||||
off = 1 + (off << 6) + (*ip++ >> 2);
|
||||
m_pos -= off;
|
||||
last_m_off = off;
|
||||
}
|
||||
}
|
||||
t = (t >> 5) - 1;
|
||||
#endif
|
||||
TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
|
||||
goto copy_match;
|
||||
#endif /* COPY_DICT */
|
||||
}
|
||||
else if (t >= 32) { /* a M3 match */
|
||||
t &= 31;
|
||||
if (t == 0) {
|
||||
NEED_IP(1);
|
||||
while (*ip == 0) {
|
||||
t += 255;
|
||||
ip++;
|
||||
NEED_IP(1);
|
||||
}
|
||||
t += 31 + *ip++;
|
||||
}
|
||||
#if defined(COPY_DICT)
|
||||
#if defined(LZO1Z)
|
||||
m_off = 1 + (ip[0] << 6) + (ip[1] >> 2);
|
||||
last_m_off = m_off;
|
||||
#else
|
||||
m_off = 1 + (ip[0] >> 2) + (ip[1] << 6);
|
||||
#endif
|
||||
#else /* !COPY_DICT */
|
||||
#if defined(LZO1Z)
|
||||
{
|
||||
unsigned off = 1 + (ip[0] << 6) + (ip[1] >> 2);
|
||||
m_pos = op - off;
|
||||
last_m_off = off;
|
||||
}
|
||||
#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN)
|
||||
m_pos = op - 1;
|
||||
m_pos -= (* (const lzo_ushortp) ip) >> 2;
|
||||
#else
|
||||
m_pos = op - 1;
|
||||
m_pos -= (ip[0] >> 2) + (ip[1] << 6);
|
||||
#endif
|
||||
#endif /* COPY_DICT */
|
||||
ip += 2;
|
||||
}
|
||||
else if (t >= 16) { /* a M4 match */
|
||||
#if defined(COPY_DICT)
|
||||
m_off = (t & 8) << 11;
|
||||
#else /* !COPY_DICT */
|
||||
m_pos = op;
|
||||
m_pos -= (t & 8) << 11;
|
||||
#endif /* COPY_DICT */
|
||||
t &= 7;
|
||||
if (t == 0) {
|
||||
NEED_IP(1);
|
||||
while (*ip == 0) {
|
||||
t += 255;
|
||||
ip++;
|
||||
NEED_IP(1);
|
||||
}
|
||||
t += 7 + *ip++;
|
||||
}
|
||||
#if defined(COPY_DICT)
|
||||
#if defined(LZO1Z)
|
||||
m_off += (ip[0] << 6) + (ip[1] >> 2);
|
||||
#else
|
||||
m_off += (ip[0] >> 2) + (ip[1] << 6);
|
||||
#endif
|
||||
ip += 2;
|
||||
if (m_off == 0)
|
||||
goto eof_found;
|
||||
m_off += 0x4000;
|
||||
#if defined(LZO1Z)
|
||||
last_m_off = m_off;
|
||||
#endif
|
||||
#else /* !COPY_DICT */
|
||||
#if defined(LZO1Z)
|
||||
m_pos -= (ip[0] << 6) + (ip[1] >> 2);
|
||||
#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN)
|
||||
m_pos -= (* (const lzo_ushortp) ip) >> 2;
|
||||
#else
|
||||
m_pos -= (ip[0] >> 2) + (ip[1] << 6);
|
||||
#endif
|
||||
ip += 2;
|
||||
if (m_pos == op)
|
||||
goto eof_found;
|
||||
m_pos -= 0x4000;
|
||||
#if defined(LZO1Z)
|
||||
last_m_off = pd((const uint8_t*)op, m_pos);
|
||||
#endif
|
||||
#endif /* COPY_DICT */
|
||||
}
|
||||
else { /* a M1 match */
|
||||
#if defined(COPY_DICT)
|
||||
#if defined(LZO1Z)
|
||||
m_off = 1 + (t << 6) + (*ip++ >> 2);
|
||||
last_m_off = m_off;
|
||||
#else
|
||||
m_off = 1 + (t >> 2) + (*ip++ << 2);
|
||||
#endif
|
||||
NEED_OP(2);
|
||||
t = 2; COPY_DICT(t,m_off)
|
||||
#else /* !COPY_DICT */
|
||||
#if defined(LZO1Z)
|
||||
t = 1 + (t << 6) + (*ip++ >> 2);
|
||||
m_pos = op - t;
|
||||
last_m_off = t;
|
||||
#else
|
||||
m_pos = op - 1;
|
||||
m_pos -= t >> 2;
|
||||
m_pos -= *ip++ << 2;
|
||||
#endif
|
||||
TEST_LB(m_pos); NEED_OP(2);
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos;
|
||||
#endif /* COPY_DICT */
|
||||
goto match_done;
|
||||
}
|
||||
|
||||
/* copy match */
|
||||
#if defined(COPY_DICT)
|
||||
|
||||
NEED_OP(t+3-1);
|
||||
t += 3-1; COPY_DICT(t,m_off)
|
||||
|
||||
#else /* !COPY_DICT */
|
||||
|
||||
TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
|
||||
#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4)
|
||||
# if !defined(LZO_UNALIGNED_OK_4)
|
||||
if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) {
|
||||
assert((op - m_pos) >= 4); /* both pointers are aligned */
|
||||
# else
|
||||
if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) {
|
||||
# endif
|
||||
COPY4(op,m_pos);
|
||||
op += 4; m_pos += 4; t -= 4 - (3 - 1);
|
||||
do {
|
||||
COPY4(op,m_pos);
|
||||
op += 4; m_pos += 4; t -= 4;
|
||||
} while (t >= 4);
|
||||
if (t > 0)
|
||||
do *op++ = *m_pos++; while (--t > 0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
copy_match:
|
||||
*op++ = *m_pos++; *op++ = *m_pos++;
|
||||
do *op++ = *m_pos++; while (--t > 0);
|
||||
}
|
||||
|
||||
#endif /* COPY_DICT */
|
||||
|
||||
match_done:
|
||||
#if defined(LZO1Z)
|
||||
t = ip[-1] & 3;
|
||||
#else
|
||||
t = ip[-2] & 3;
|
||||
#endif
|
||||
if (t == 0)
|
||||
break;
|
||||
|
||||
/* copy literals */
|
||||
match_next:
|
||||
assert(t > 0);
|
||||
assert(t < 4);
|
||||
NEED_OP(t);
|
||||
NEED_IP(t+1);
|
||||
#if 0
|
||||
do *op++ = *ip++; while (--t > 0);
|
||||
#else
|
||||
*op++ = *ip++;
|
||||
if (t > 1) {
|
||||
*op++ = *ip++;
|
||||
if (t > 2)
|
||||
*op++ = *ip++;
|
||||
}
|
||||
#endif
|
||||
t = *ip++;
|
||||
} while (TEST_IP && TEST_OP);
|
||||
}
|
||||
|
||||
//#if defined(HAVE_TEST_IP) || defined(HAVE_TEST_OP)
|
||||
/* no EOF code was found */
|
||||
*out_len = pd(op, out);
|
||||
return LZO_E_EOF_NOT_FOUND;
|
||||
//#endif
|
||||
|
||||
eof_found:
|
||||
assert(t == 1);
|
||||
*out_len = pd(op, out);
|
||||
return (ip == ip_end ? LZO_E_OK :
|
||||
(ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
|
||||
|
||||
//#if defined(HAVE_NEED_IP)
|
||||
input_overrun:
|
||||
*out_len = pd(op, out);
|
||||
return LZO_E_INPUT_OVERRUN;
|
||||
//#endif
|
||||
|
||||
//#if defined(HAVE_NEED_OP)
|
||||
output_overrun:
|
||||
*out_len = pd(op, out);
|
||||
return LZO_E_OUTPUT_OVERRUN;
|
||||
//#endif
|
||||
|
||||
//#if defined(LZO_TEST_OVERRUN_LOOKBEHIND)
|
||||
lookbehind_overrun:
|
||||
*out_len = pd(op, out);
|
||||
return LZO_E_LOOKBEHIND_OVERRUN;
|
||||
//#endif
|
||||
}
|
||||
@@ -190,7 +190,7 @@ static void extract_cpio_gz(int fd)
|
||||
archive_handle_t *archive_handle;
|
||||
unsigned char magic[2];
|
||||
#if BB_MMU
|
||||
USE_DESKTOP(long long) int FAST_FUNC (*xformer)(int src_fd, int dst_fd);
|
||||
IF_DESKTOP(long long) int FAST_FUNC (*xformer)(int src_fd, int dst_fd);
|
||||
enum { xformer_prog = 0 };
|
||||
#else
|
||||
enum { xformer = 0 };
|
||||
@@ -224,7 +224,7 @@ static void extract_cpio_gz(int fd)
|
||||
|| magic[0] != 'B' || magic[1] != 'Z'
|
||||
) {
|
||||
bb_error_msg_and_die("no gzip"
|
||||
USE_FEATURE_SEAMLESS_BZ2("/bzip2")
|
||||
IF_FEATURE_SEAMLESS_BZ2("/bzip2")
|
||||
" magic");
|
||||
}
|
||||
#if BB_MMU
|
||||
|
||||
@@ -577,7 +577,7 @@ static void NOINLINE vfork_compressor(int tar_fd, int gzip)
|
||||
#endif
|
||||
if (vfork_exec_errno) {
|
||||
errno = vfork_exec_errno;
|
||||
bb_perror_msg_and_die("cannot exec %s", zip_exec);
|
||||
bb_perror_msg_and_die("can't execute '%s'", zip_exec);
|
||||
}
|
||||
}
|
||||
#endif /* ENABLE_FEATURE_SEAMLESS_GZ || ENABLE_FEATURE_SEAMLESS_BZ2 */
|
||||
@@ -728,16 +728,17 @@ static void handle_SIGCHLD(int status)
|
||||
|
||||
enum {
|
||||
OPTBIT_KEEP_OLD = 7,
|
||||
USE_FEATURE_TAR_CREATE( OPTBIT_CREATE ,)
|
||||
USE_FEATURE_TAR_CREATE( OPTBIT_DEREFERENCE ,)
|
||||
USE_FEATURE_SEAMLESS_BZ2( OPTBIT_BZIP2 ,)
|
||||
USE_FEATURE_SEAMLESS_LZMA(OPTBIT_LZMA ,)
|
||||
USE_FEATURE_TAR_FROM( OPTBIT_INCLUDE_FROM,)
|
||||
USE_FEATURE_TAR_FROM( OPTBIT_EXCLUDE_FROM,)
|
||||
USE_FEATURE_SEAMLESS_GZ( OPTBIT_GZIP ,)
|
||||
USE_FEATURE_SEAMLESS_Z( OPTBIT_COMPRESS ,)
|
||||
IF_FEATURE_TAR_CREATE( OPTBIT_CREATE ,)
|
||||
IF_FEATURE_TAR_CREATE( OPTBIT_DEREFERENCE ,)
|
||||
IF_FEATURE_SEAMLESS_BZ2( OPTBIT_BZIP2 ,)
|
||||
IF_FEATURE_SEAMLESS_LZMA(OPTBIT_LZMA ,)
|
||||
IF_FEATURE_TAR_FROM( OPTBIT_INCLUDE_FROM,)
|
||||
IF_FEATURE_TAR_FROM( OPTBIT_EXCLUDE_FROM,)
|
||||
IF_FEATURE_SEAMLESS_GZ( OPTBIT_GZIP ,)
|
||||
IF_FEATURE_SEAMLESS_Z( OPTBIT_COMPRESS ,)
|
||||
OPTBIT_NOPRESERVE_OWN,
|
||||
OPTBIT_NOPRESERVE_PERM,
|
||||
OPTBIT_NUMERIC_OWNER,
|
||||
OPT_TEST = 1 << 0, // t
|
||||
OPT_EXTRACT = 1 << 1, // x
|
||||
OPT_BASEDIR = 1 << 2, // C
|
||||
@@ -746,16 +747,17 @@ enum {
|
||||
OPT_P = 1 << 5, // p
|
||||
OPT_VERBOSE = 1 << 6, // v
|
||||
OPT_KEEP_OLD = 1 << 7, // k
|
||||
OPT_CREATE = USE_FEATURE_TAR_CREATE( (1 << OPTBIT_CREATE )) + 0, // c
|
||||
OPT_DEREFERENCE = USE_FEATURE_TAR_CREATE( (1 << OPTBIT_DEREFERENCE )) + 0, // h
|
||||
OPT_BZIP2 = USE_FEATURE_SEAMLESS_BZ2( (1 << OPTBIT_BZIP2 )) + 0, // j
|
||||
OPT_LZMA = USE_FEATURE_SEAMLESS_LZMA((1 << OPTBIT_LZMA )) + 0, // a
|
||||
OPT_INCLUDE_FROM = USE_FEATURE_TAR_FROM( (1 << OPTBIT_INCLUDE_FROM)) + 0, // T
|
||||
OPT_EXCLUDE_FROM = USE_FEATURE_TAR_FROM( (1 << OPTBIT_EXCLUDE_FROM)) + 0, // X
|
||||
OPT_GZIP = USE_FEATURE_SEAMLESS_GZ( (1 << OPTBIT_GZIP )) + 0, // z
|
||||
OPT_COMPRESS = USE_FEATURE_SEAMLESS_Z( (1 << OPTBIT_COMPRESS )) + 0, // Z
|
||||
OPT_CREATE = IF_FEATURE_TAR_CREATE( (1 << OPTBIT_CREATE )) + 0, // c
|
||||
OPT_DEREFERENCE = IF_FEATURE_TAR_CREATE( (1 << OPTBIT_DEREFERENCE )) + 0, // h
|
||||
OPT_BZIP2 = IF_FEATURE_SEAMLESS_BZ2( (1 << OPTBIT_BZIP2 )) + 0, // j
|
||||
OPT_LZMA = IF_FEATURE_SEAMLESS_LZMA((1 << OPTBIT_LZMA )) + 0, // a
|
||||
OPT_INCLUDE_FROM = IF_FEATURE_TAR_FROM( (1 << OPTBIT_INCLUDE_FROM)) + 0, // T
|
||||
OPT_EXCLUDE_FROM = IF_FEATURE_TAR_FROM( (1 << OPTBIT_EXCLUDE_FROM)) + 0, // X
|
||||
OPT_GZIP = IF_FEATURE_SEAMLESS_GZ( (1 << OPTBIT_GZIP )) + 0, // z
|
||||
OPT_COMPRESS = IF_FEATURE_SEAMLESS_Z( (1 << OPTBIT_COMPRESS )) + 0, // Z
|
||||
OPT_NOPRESERVE_OWN = 1 << OPTBIT_NOPRESERVE_OWN , // no-same-owner
|
||||
OPT_NOPRESERVE_PERM = 1 << OPTBIT_NOPRESERVE_PERM, // no-same-permissions
|
||||
OPT_NUMERIC_OWNER = 1 << OPTBIT_NUMERIC_OWNER,
|
||||
};
|
||||
#if ENABLE_FEATURE_TAR_LONG_OPTIONS
|
||||
static const char tar_longopts[] ALIGN1 =
|
||||
@@ -787,6 +789,7 @@ static const char tar_longopts[] ALIGN1 =
|
||||
# if ENABLE_FEATURE_SEAMLESS_Z
|
||||
"compress\0" No_argument "Z"
|
||||
# endif
|
||||
"numeric-owner\0" No_argument "\xfc"
|
||||
"no-same-owner\0" No_argument "\xfd"
|
||||
"no-same-permissions\0" No_argument "\xfe"
|
||||
/* --exclude takes next bit position in option mask, */
|
||||
@@ -829,24 +832,24 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
|
||||
#if ENABLE_FEATURE_TAR_LONG_OPTIONS && ENABLE_FEATURE_TAR_FROM
|
||||
"\xff::" // cumulative lists for --exclude
|
||||
#endif
|
||||
USE_FEATURE_TAR_CREATE("c:") "t:x:" // at least one of these is reqd
|
||||
USE_FEATURE_TAR_CREATE("c--tx:t--cx:x--ct") // mutually exclusive
|
||||
SKIP_FEATURE_TAR_CREATE("t--x:x--t"); // mutually exclusive
|
||||
IF_FEATURE_TAR_CREATE("c:") "t:x:" // at least one of these is reqd
|
||||
IF_FEATURE_TAR_CREATE("c--tx:t--cx:x--ct") // mutually exclusive
|
||||
IF_NOT_FEATURE_TAR_CREATE("t--x:x--t"); // mutually exclusive
|
||||
#if ENABLE_FEATURE_TAR_LONG_OPTIONS
|
||||
applet_long_options = tar_longopts;
|
||||
#endif
|
||||
opt = getopt32(argv,
|
||||
"txC:f:Opvk"
|
||||
USE_FEATURE_TAR_CREATE( "ch" )
|
||||
USE_FEATURE_SEAMLESS_BZ2( "j" )
|
||||
USE_FEATURE_SEAMLESS_LZMA("a" )
|
||||
USE_FEATURE_TAR_FROM( "T:X:")
|
||||
USE_FEATURE_SEAMLESS_GZ( "z" )
|
||||
USE_FEATURE_SEAMLESS_Z( "Z" )
|
||||
IF_FEATURE_TAR_CREATE( "ch" )
|
||||
IF_FEATURE_SEAMLESS_BZ2( "j" )
|
||||
IF_FEATURE_SEAMLESS_LZMA("a" )
|
||||
IF_FEATURE_TAR_FROM( "T:X:")
|
||||
IF_FEATURE_SEAMLESS_GZ( "z" )
|
||||
IF_FEATURE_SEAMLESS_Z( "Z" )
|
||||
, &base_dir // -C dir
|
||||
, &tar_filename // -f filename
|
||||
USE_FEATURE_TAR_FROM(, &(tar_handle->accept)) // T
|
||||
USE_FEATURE_TAR_FROM(, &(tar_handle->reject)) // X
|
||||
IF_FEATURE_TAR_FROM(, &(tar_handle->accept)) // T
|
||||
IF_FEATURE_TAR_FROM(, &(tar_handle->reject)) // X
|
||||
#if ENABLE_FEATURE_TAR_LONG_OPTIONS && ENABLE_FEATURE_TAR_FROM
|
||||
, &excludes // --exclude
|
||||
#endif
|
||||
@@ -873,6 +876,9 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
|
||||
if (opt & OPT_NOPRESERVE_PERM)
|
||||
tar_handle->ah_flags |= ARCHIVE_NOPRESERVE_PERM;
|
||||
|
||||
if (opt & OPT_NUMERIC_OWNER)
|
||||
tar_handle->ah_flags |= ARCHIVE_NUMERIC_OWNER;
|
||||
|
||||
if (opt & OPT_GZIP)
|
||||
get_header_ptr = get_header_tar_gz;
|
||||
|
||||
|
||||
@@ -208,7 +208,8 @@ static uint32_t read_next_cds(int count_m1, uint32_t cds_offset, cds_header_t *c
|
||||
|
||||
static void unzip_skip(off_t skip)
|
||||
{
|
||||
bb_copyfd_exact_size(zip_fd, -1, skip);
|
||||
if (lseek(zip_fd, skip, SEEK_CUR) == (off_t)-1)
|
||||
bb_copyfd_exact_size(zip_fd, -1, skip);
|
||||
}
|
||||
|
||||
static void unzip_create_leading_dirs(const char *fn)
|
||||
|
||||
@@ -91,7 +91,7 @@ config SETCONSOLE
|
||||
config FEATURE_SETCONSOLE_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on SETCONSOLE && GETOPT_LONG
|
||||
depends on SETCONSOLE && LONG_OPTS
|
||||
help
|
||||
Support long options for the setconsole applet.
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ config ENV
|
||||
config FEATURE_ENV_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on ENV && GETOPT_LONG
|
||||
depends on ENV && LONG_OPTS
|
||||
help
|
||||
Support long options for the env applet.
|
||||
|
||||
@@ -217,7 +217,7 @@ config EXPAND
|
||||
config FEATURE_EXPAND_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on EXPAND && GETOPT_LONG
|
||||
depends on EXPAND && LONG_OPTS
|
||||
help
|
||||
Support long options for the expand applet.
|
||||
|
||||
@@ -249,6 +249,12 @@ config FOLD
|
||||
help
|
||||
Wrap text to fit a specific width.
|
||||
|
||||
config FSYNC
|
||||
bool "fsync"
|
||||
default n
|
||||
help
|
||||
fsync is used to flush file-related cached blocks to disk.
|
||||
|
||||
config HEAD
|
||||
bool "head"
|
||||
default n
|
||||
@@ -285,7 +291,7 @@ config INSTALL
|
||||
config FEATURE_INSTALL_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on INSTALL && GETOPT_LONG
|
||||
depends on INSTALL && LONG_OPTS
|
||||
help
|
||||
Support long options for the install applet.
|
||||
|
||||
@@ -358,7 +364,7 @@ config FEATURE_LS_USERNAME
|
||||
config FEATURE_LS_COLOR
|
||||
bool "Allow use of color to identify file types"
|
||||
default y
|
||||
depends on LS && GETOPT_LONG
|
||||
depends on LS && LONG_OPTS
|
||||
help
|
||||
This enables the --color option to ls.
|
||||
|
||||
@@ -388,7 +394,7 @@ config MKDIR
|
||||
config FEATURE_MKDIR_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on MKDIR && GETOPT_LONG
|
||||
depends on MKDIR && LONG_OPTS
|
||||
help
|
||||
Support long options for the mkdir applet.
|
||||
|
||||
@@ -415,7 +421,7 @@ config MV
|
||||
config FEATURE_MV_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on MV && GETOPT_LONG
|
||||
depends on MV && LONG_OPTS
|
||||
help
|
||||
Support long options for the mv applet.
|
||||
|
||||
@@ -492,7 +498,7 @@ config RMDIR
|
||||
config FEATURE_RMDIR_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on RMDIR && GETOPT_LONG
|
||||
depends on RMDIR && LONG_OPTS
|
||||
help
|
||||
Support long options for the rmdir applet, including
|
||||
--ignore-fail-on-non-empty for compatibility with GNU rmdir.
|
||||
@@ -629,7 +635,7 @@ config TAIL
|
||||
from files.
|
||||
|
||||
config FEATURE_FANCY_TAIL
|
||||
bool "Enable extra tail options (-q, -s, and -v)"
|
||||
bool "Enable extra tail options (-q, -s, -v, and -F)"
|
||||
default y
|
||||
depends on TAIL
|
||||
help
|
||||
@@ -661,7 +667,7 @@ config TEST
|
||||
config FEATURE_TEST_64
|
||||
bool "Extend test to 64 bit"
|
||||
default n
|
||||
depends on TEST || ASH_BUILTIN_TEST
|
||||
depends on TEST || ASH_BUILTIN_TEST || HUSH
|
||||
help
|
||||
Enable 64-bit support in test.
|
||||
|
||||
@@ -726,7 +732,7 @@ config UNEXPAND
|
||||
config FEATURE_UNEXPAND_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on UNEXPAND && GETOPT_LONG
|
||||
depends on UNEXPAND && LONG_OPTS
|
||||
help
|
||||
Support long options for the unexpand applet.
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ lib-$(CONFIG_EXPR) += expr.o
|
||||
lib-$(CONFIG_EXPAND) += expand.o
|
||||
lib-$(CONFIG_FALSE) += false.o
|
||||
lib-$(CONFIG_FOLD) += fold.o
|
||||
lib-$(CONFIG_FSYNC) += fsync.o
|
||||
lib-$(CONFIG_HEAD) += head.o
|
||||
lib-$(CONFIG_HOSTID) += hostid.o
|
||||
lib-$(CONFIG_ID) += id.o
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
|
||||
|
||||
#define OPT_RECURSE (option_mask32 & 1)
|
||||
#define OPT_VERBOSE (USE_DESKTOP(option_mask32 & 2) SKIP_DESKTOP(0))
|
||||
#define OPT_CHANGED (USE_DESKTOP(option_mask32 & 4) SKIP_DESKTOP(0))
|
||||
#define OPT_QUIET (USE_DESKTOP(option_mask32 & 8) SKIP_DESKTOP(0))
|
||||
#define OPT_STR "R" USE_DESKTOP("vcf")
|
||||
#define OPT_VERBOSE (IF_DESKTOP(option_mask32 & 2) IF_NOT_DESKTOP(0))
|
||||
#define OPT_CHANGED (IF_DESKTOP(option_mask32 & 4) IF_NOT_DESKTOP(0))
|
||||
#define OPT_QUIET (IF_DESKTOP(option_mask32 & 8) IF_NOT_DESKTOP(0))
|
||||
#define OPT_STR "R" IF_DESKTOP("vcf")
|
||||
|
||||
/* coreutils:
|
||||
* chmod never changes the permissions of symbolic links; the chmod
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
/* This is a NOEXEC applet. Be very careful! */
|
||||
|
||||
|
||||
#define OPT_STR ("Rh" USE_DESKTOP("vcfLHP"))
|
||||
#define OPT_STR ("Rh" IF_DESKTOP("vcfLHP"))
|
||||
#define BIT_RECURSE 1
|
||||
#define OPT_RECURSE (opt & 1)
|
||||
#define OPT_NODEREF (opt & 2)
|
||||
#define OPT_VERBOSE (USE_DESKTOP(opt & 0x04) SKIP_DESKTOP(0))
|
||||
#define OPT_CHANGED (USE_DESKTOP(opt & 0x08) SKIP_DESKTOP(0))
|
||||
#define OPT_QUIET (USE_DESKTOP(opt & 0x10) SKIP_DESKTOP(0))
|
||||
#define OPT_VERBOSE (IF_DESKTOP(opt & 0x04) IF_NOT_DESKTOP(0))
|
||||
#define OPT_CHANGED (IF_DESKTOP(opt & 0x08) IF_NOT_DESKTOP(0))
|
||||
#define OPT_QUIET (IF_DESKTOP(opt & 0x10) IF_NOT_DESKTOP(0))
|
||||
/* POSIX options
|
||||
* -L traverse every symbolic link to a directory encountered
|
||||
* -H if a command line argument is a symbolic link to a directory, traverse it
|
||||
@@ -32,10 +32,10 @@
|
||||
* The last option specified shall determine the behavior of the utility." */
|
||||
/* -L */
|
||||
#define BIT_TRAVERSE 0x20
|
||||
#define OPT_TRAVERSE (USE_DESKTOP(opt & BIT_TRAVERSE) SKIP_DESKTOP(0))
|
||||
#define OPT_TRAVERSE (IF_DESKTOP(opt & BIT_TRAVERSE) IF_NOT_DESKTOP(0))
|
||||
/* -H or -L */
|
||||
#define BIT_TRAVERSE_TOP (0x20|0x40)
|
||||
#define OPT_TRAVERSE_TOP (USE_DESKTOP(opt & BIT_TRAVERSE_TOP) SKIP_DESKTOP(0))
|
||||
#define OPT_TRAVERSE_TOP (IF_DESKTOP(opt & BIT_TRAVERSE_TOP) IF_NOT_DESKTOP(0))
|
||||
|
||||
typedef int (*chown_fptr)(const char *, uid_t, gid_t);
|
||||
|
||||
@@ -85,7 +85,7 @@ int chown_main(int argc UNUSED_PARAM, char **argv)
|
||||
/* This matches coreutils behavior (almost - see below) */
|
||||
if (OPT_NODEREF
|
||||
/* || (OPT_RECURSE && !OPT_TRAVERSE_TOP): */
|
||||
USE_DESKTOP( || (opt & (BIT_RECURSE|BIT_TRAVERSE_TOP)) == BIT_RECURSE)
|
||||
IF_DESKTOP( || (opt & (BIT_RECURSE|BIT_TRAVERSE_TOP)) == BIT_RECURSE)
|
||||
) {
|
||||
param.chown_func = lchown;
|
||||
}
|
||||
|
||||
@@ -33,5 +33,5 @@ int chroot_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
BB_EXECVP(*argv, argv);
|
||||
bb_perror_msg_and_die("cannot execute %s", *argv);
|
||||
bb_perror_msg_and_die("can't execute '%s'", *argv);
|
||||
}
|
||||
@@ -10,8 +10,6 @@
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
/* This 'date' command supports only 2 time setting formats,
|
||||
all the GNU strftime stuff (its in libc, lets use it),
|
||||
setting time using UTC and displaying it, as well as
|
||||
@@ -23,18 +21,51 @@
|
||||
|
||||
/* Default input handling to save surprising some people */
|
||||
|
||||
/* GNU coreutils 6.9 man page:
|
||||
* date [OPTION]... [+FORMAT]
|
||||
* date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
|
||||
* -d, --date=STRING
|
||||
* display time described by STRING, not `now'
|
||||
* -f, --file=DATEFILE
|
||||
* like --date once for each line of DATEFILE
|
||||
* -r, --reference=FILE
|
||||
* display the last modification time of FILE
|
||||
* -R, --rfc-2822
|
||||
* output date and time in RFC 2822 format.
|
||||
* Example: Mon, 07 Aug 2006 12:34:56 -0600
|
||||
* --rfc-3339=TIMESPEC
|
||||
* output date and time in RFC 3339 format.
|
||||
* TIMESPEC='date', 'seconds', or 'ns'
|
||||
* Date and time components are separated by a single space:
|
||||
* 2006-08-07 12:34:56-06:00
|
||||
* -s, --set=STRING
|
||||
* set time described by STRING
|
||||
* -u, --utc, --universal
|
||||
* print or set Coordinated Universal Time
|
||||
*
|
||||
* Busybox:
|
||||
* long options are not supported
|
||||
* -f is not supported
|
||||
* -I seems to roughly match --rfc-3339, but -I has _optional_ param
|
||||
* (thus "-I seconds" doesn't work, only "-Iseconds"),
|
||||
* and does not support -Ins
|
||||
* -D FMT is a bbox extension for _input_ conversion of -d DATE
|
||||
*/
|
||||
#include "libbb.h"
|
||||
|
||||
#define DATE_OPT_RFC2822 0x01
|
||||
#define DATE_OPT_SET 0x02
|
||||
#define DATE_OPT_UTC 0x04
|
||||
#define DATE_OPT_DATE 0x08
|
||||
#define DATE_OPT_REFERENCE 0x10
|
||||
#define DATE_OPT_TIMESPEC 0x20
|
||||
#define DATE_OPT_HINT 0x40
|
||||
enum {
|
||||
OPT_RFC2822 = (1 << 0), /* R */
|
||||
OPT_SET = (1 << 1), /* s */
|
||||
OPT_UTC = (1 << 2), /* u */
|
||||
OPT_DATE = (1 << 3), /* d */
|
||||
OPT_REFERENCE = (1 << 4), /* r */
|
||||
OPT_TIMESPEC = (1 << 5) * ENABLE_FEATURE_DATE_ISOFMT, /* I */
|
||||
OPT_HINT = (1 << 6) * ENABLE_FEATURE_DATE_ISOFMT, /* D */
|
||||
};
|
||||
|
||||
static void maybe_set_utc(int opt)
|
||||
{
|
||||
if (opt & DATE_OPT_UTC)
|
||||
if (opt & OPT_UTC)
|
||||
putenv((char*)"TZ=UTC0");
|
||||
}
|
||||
|
||||
@@ -52,15 +83,15 @@ int date_main(int argc UNUSED_PARAM, char **argv)
|
||||
char *isofmt_arg = NULL;
|
||||
|
||||
opt_complementary = "d--s:s--d"
|
||||
USE_FEATURE_DATE_ISOFMT(":R--I:I--R");
|
||||
IF_FEATURE_DATE_ISOFMT(":R--I:I--R");
|
||||
opt = getopt32(argv, "Rs:ud:r:"
|
||||
USE_FEATURE_DATE_ISOFMT("I::D:"),
|
||||
IF_FEATURE_DATE_ISOFMT("I::D:"),
|
||||
&date_str, &date_str, &filename
|
||||
USE_FEATURE_DATE_ISOFMT(, &isofmt_arg, &fmt_str2dt));
|
||||
IF_FEATURE_DATE_ISOFMT(, &isofmt_arg, &fmt_str2dt));
|
||||
argv += optind;
|
||||
maybe_set_utc(opt);
|
||||
|
||||
if (ENABLE_FEATURE_DATE_ISOFMT && (opt & DATE_OPT_TIMESPEC)) {
|
||||
if (ENABLE_FEATURE_DATE_ISOFMT && (opt & OPT_TIMESPEC)) {
|
||||
ifmt = 0; /* default is date */
|
||||
if (isofmt_arg) {
|
||||
static const char isoformats[] ALIGN1 =
|
||||
@@ -76,8 +107,8 @@ int date_main(int argc UNUSED_PARAM, char **argv)
|
||||
fmt_dt2str = &argv[0][1]; /* Skip over the '+' */
|
||||
argv++;
|
||||
}
|
||||
if (!(opt & (DATE_OPT_SET | DATE_OPT_DATE))) {
|
||||
opt |= DATE_OPT_SET;
|
||||
if (!(opt & (OPT_SET | OPT_DATE))) {
|
||||
opt |= OPT_SET;
|
||||
date_str = argv[0]; /* can be NULL */
|
||||
if (date_str)
|
||||
argv++;
|
||||
@@ -88,13 +119,14 @@ int date_main(int argc UNUSED_PARAM, char **argv)
|
||||
/* Now we have parsed all the information except the date format
|
||||
which depends on whether the clock is being set or read */
|
||||
|
||||
if (opt & DATE_OPT_REFERENCE) {
|
||||
if (opt & OPT_REFERENCE) {
|
||||
struct stat statbuf;
|
||||
xstat(filename, &statbuf);
|
||||
tm = statbuf.st_mtime;
|
||||
} else
|
||||
} else {
|
||||
time(&tm);
|
||||
memcpy(&tm_time, localtime(&tm), sizeof(tm_time));
|
||||
}
|
||||
localtime_r(&tm, &tm_time);
|
||||
|
||||
/* If date string is given, update tm_time, and maybe set date */
|
||||
if (date_str != NULL) {
|
||||
@@ -104,80 +136,21 @@ int date_main(int argc UNUSED_PARAM, char **argv)
|
||||
tm_time.tm_hour = 0;
|
||||
|
||||
/* Process any date input to UNIX time since 1 Jan 1970 */
|
||||
if (ENABLE_FEATURE_DATE_ISOFMT && (opt & DATE_OPT_HINT)) {
|
||||
if (ENABLE_FEATURE_DATE_ISOFMT && (opt & OPT_HINT)) {
|
||||
if (strptime(date_str, fmt_str2dt, &tm_time) == NULL)
|
||||
bb_error_msg_and_die(bb_msg_invalid_date, date_str);
|
||||
} else {
|
||||
char end = '\0';
|
||||
const char *last_colon = strrchr(date_str, ':');
|
||||
|
||||
if (last_colon != NULL) {
|
||||
/* Parse input and assign appropriately to tm_time */
|
||||
|
||||
if (sscanf(date_str, "%u:%u%c",
|
||||
&tm_time.tm_hour,
|
||||
&tm_time.tm_min,
|
||||
&end) >= 2) {
|
||||
/* no adjustments needed */
|
||||
} else if (sscanf(date_str, "%u.%u-%u:%u%c",
|
||||
&tm_time.tm_mon, &tm_time.tm_mday,
|
||||
&tm_time.tm_hour, &tm_time.tm_min,
|
||||
&end) >= 4) {
|
||||
/* Adjust dates from 1-12 to 0-11 */
|
||||
tm_time.tm_mon -= 1;
|
||||
} else if (sscanf(date_str, "%u.%u.%u-%u:%u%c", &tm_time.tm_year,
|
||||
&tm_time.tm_mon, &tm_time.tm_mday,
|
||||
&tm_time.tm_hour, &tm_time.tm_min,
|
||||
&end) >= 5) {
|
||||
tm_time.tm_year -= 1900; /* Adjust years */
|
||||
tm_time.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
|
||||
} else if (sscanf(date_str, "%u-%u-%u %u:%u%c", &tm_time.tm_year,
|
||||
&tm_time.tm_mon, &tm_time.tm_mday,
|
||||
&tm_time.tm_hour, &tm_time.tm_min,
|
||||
&end) >= 5) {
|
||||
tm_time.tm_year -= 1900; /* Adjust years */
|
||||
tm_time.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
|
||||
//TODO: coreutils 6.9 also accepts "YYYY-MM-DD HH" (no minutes)
|
||||
} else {
|
||||
bb_error_msg_and_die(bb_msg_invalid_date, date_str);
|
||||
}
|
||||
if (end == ':') {
|
||||
if (sscanf(last_colon + 1, "%u%c", &tm_time.tm_sec, &end) == 1)
|
||||
end = '\0';
|
||||
/* else end != NUL and we error out */
|
||||
}
|
||||
} else {
|
||||
if (sscanf(date_str, "%2u%2u%2u%2u%u%c", &tm_time.tm_mon,
|
||||
&tm_time.tm_mday, &tm_time.tm_hour, &tm_time.tm_min,
|
||||
&tm_time.tm_year, &end) < 4)
|
||||
bb_error_msg_and_die(bb_msg_invalid_date, date_str);
|
||||
/* correct for century - minor Y2K problem here? */
|
||||
if (tm_time.tm_year >= 1900) {
|
||||
tm_time.tm_year -= 1900;
|
||||
}
|
||||
/* adjust date */
|
||||
tm_time.tm_mon -= 1;
|
||||
if (end == '.') {
|
||||
if (sscanf(strchr(date_str, '.') + 1, "%u%c",
|
||||
&tm_time.tm_sec, &end) == 1)
|
||||
end = '\0';
|
||||
/* else end != NUL and we error out */
|
||||
}
|
||||
}
|
||||
if (end != '\0') {
|
||||
bb_error_msg_and_die(bb_msg_invalid_date, date_str);
|
||||
}
|
||||
parse_datestr(date_str, &tm_time);
|
||||
}
|
||||
|
||||
/* Correct any day of week and day of year etc. fields */
|
||||
tm_time.tm_isdst = -1; /* Be sure to recheck dst. */
|
||||
tm = mktime(&tm_time);
|
||||
if (tm < 0) {
|
||||
bb_error_msg_and_die(bb_msg_invalid_date, date_str);
|
||||
}
|
||||
tm_time.tm_isdst = -1; /* Be sure to recheck dst */
|
||||
tm = validate_tm_time(date_str, &tm_time);
|
||||
|
||||
maybe_set_utc(opt);
|
||||
|
||||
/* if setting time, set it */
|
||||
if ((opt & DATE_OPT_SET) && stime(&tm) < 0) {
|
||||
if ((opt & OPT_SET) && stime(&tm) < 0) {
|
||||
bb_perror_msg("cannot set date");
|
||||
}
|
||||
}
|
||||
@@ -207,9 +180,9 @@ int date_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
format_utc:
|
||||
fmt_dt2str[i++] = '%';
|
||||
fmt_dt2str[i] = (opt & DATE_OPT_UTC) ? 'Z' : 'z';
|
||||
fmt_dt2str[i] = (opt & OPT_UTC) ? 'Z' : 'z';
|
||||
}
|
||||
} else if (opt & DATE_OPT_RFC2822) {
|
||||
} else if (opt & OPT_RFC2822) {
|
||||
/* Undo busybox.c for date -R */
|
||||
if (ENABLE_LOCALE_SUPPORT)
|
||||
setlocale(LC_TIME, "C");
|
||||
|
||||
@@ -286,23 +286,26 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
|
||||
while (!(flags & FLAG_COUNT) || (G.in_full + G.in_part != count)) {
|
||||
if (flags & FLAG_NOERROR) /* Pre-zero the buffer if conv=noerror */
|
||||
memset(ibuf, 0, ibs);
|
||||
n = safe_read(ifd, ibuf, ibs);
|
||||
if (n == 0)
|
||||
break;
|
||||
if (n < 0) {
|
||||
/* "Bad block" */
|
||||
if (!(flags & FLAG_NOERROR))
|
||||
goto die_infile;
|
||||
n = ibs;
|
||||
bb_simple_perror_msg(infile);
|
||||
/* GNU dd with conv=noerror skips over bad blocks */
|
||||
xlseek(ifd, ibs, SEEK_CUR);
|
||||
/* conv=noerror,sync writes NULs,
|
||||
* conv=noerror just ignores input bad blocks */
|
||||
n = 0;
|
||||
}
|
||||
if ((size_t)n == ibs)
|
||||
G.in_full++;
|
||||
else {
|
||||
G.in_part++;
|
||||
if (flags & FLAG_SYNC) {
|
||||
memset(ibuf + n, '\0', ibs - n);
|
||||
memset(ibuf + n, 0, ibs - n);
|
||||
n = ibs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,6 @@ int df_main(int argc, char **argv)
|
||||
FILE *mount_table;
|
||||
struct mntent *mount_entry;
|
||||
struct statfs s;
|
||||
static const char ignored_mounts[] ALIGN1 = "rootfs\0";
|
||||
|
||||
enum {
|
||||
OPT_KILO = (1 << 0),
|
||||
@@ -64,9 +63,9 @@ int df_main(int argc, char **argv)
|
||||
opt_complementary = "k-m:m-k";
|
||||
#endif
|
||||
opt = getopt32(argv, "kP"
|
||||
USE_FEATURE_DF_FANCY("aiB:")
|
||||
USE_FEATURE_HUMAN_READABLE("hm")
|
||||
USE_FEATURE_DF_FANCY(, &chp));
|
||||
IF_FEATURE_DF_FANCY("aiB:")
|
||||
IF_FEATURE_HUMAN_READABLE("hm")
|
||||
IF_FEATURE_DF_FANCY(, &chp));
|
||||
if (opt & OPT_MEGA)
|
||||
df_disp_hr = 1024*1024;
|
||||
|
||||
@@ -120,7 +119,7 @@ int df_main(int argc, char **argv)
|
||||
mount_point = *argv++;
|
||||
if (!mount_point)
|
||||
break;
|
||||
mount_entry = find_mount_point(mount_point, bb_path_mtab_file);
|
||||
mount_entry = find_mount_point(mount_point, 1);
|
||||
if (!mount_entry) {
|
||||
bb_error_msg("%s: can't find mount point", mount_point);
|
||||
set_error:
|
||||
@@ -154,8 +153,8 @@ int df_main(int argc, char **argv)
|
||||
) / (blocks_used + s.f_bavail);
|
||||
}
|
||||
|
||||
/* GNU coreutils 6.10 skip certain mounts, try to be compatible. */
|
||||
if (index_in_strings(device, ignored_mounts) != -1)
|
||||
/* GNU coreutils 6.10 skips certain mounts, try to be compatible. */
|
||||
if (strcmp(device, "rootfs") == 0)
|
||||
continue;
|
||||
|
||||
#ifdef WHY_WE_DO_IT_FOR_DEV_ROOT_ONLY
|
||||
|
||||
@@ -155,13 +155,13 @@ int du_main(int argc UNUSED_PARAM, char **argv)
|
||||
unsigned opt;
|
||||
|
||||
#if ENABLE_FEATURE_HUMAN_READABLE
|
||||
USE_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_hr = 1024;)
|
||||
SKIP_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_hr = 512;)
|
||||
IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_hr = 1024;)
|
||||
IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_hr = 512;)
|
||||
if (getenv("POSIXLY_CORRECT")) /* TODO - a new libbb function? */
|
||||
G.disp_hr = 512;
|
||||
#else
|
||||
USE_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_k = 1;)
|
||||
/* SKIP_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_k = 0;) - G is pre-zeroed */
|
||||
IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_k = 1;)
|
||||
/* IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_k = 0;) - G is pre-zeroed */
|
||||
#endif
|
||||
G.max_print_depth = INT_MAX;
|
||||
|
||||
|
||||
@@ -132,10 +132,10 @@ int expand_main(int argc UNUSED_PARAM, char **argv)
|
||||
#endif
|
||||
|
||||
if (ENABLE_EXPAND && (!ENABLE_UNEXPAND || applet_name[0] == 'e')) {
|
||||
USE_FEATURE_EXPAND_LONG_OPTIONS(applet_long_options = expand_longopts);
|
||||
IF_FEATURE_EXPAND_LONG_OPTIONS(applet_long_options = expand_longopts);
|
||||
opt = getopt32(argv, "it:", &opt_t);
|
||||
} else {
|
||||
USE_FEATURE_UNEXPAND_LONG_OPTIONS(applet_long_options = unexpand_longopts);
|
||||
IF_FEATURE_UNEXPAND_LONG_OPTIONS(applet_long_options = unexpand_longopts);
|
||||
/* -t NUM sets also -a */
|
||||
opt_complementary = "ta";
|
||||
opt = getopt32(argv, "ft:a", &opt_t);
|
||||
@@ -157,9 +157,9 @@ int expand_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
|
||||
if (ENABLE_EXPAND && (!ENABLE_UNEXPAND || applet_name[0] == 'e'))
|
||||
USE_EXPAND(expand(file, tab_size, opt));
|
||||
IF_EXPAND(expand(file, tab_size, opt));
|
||||
else
|
||||
USE_UNEXPAND(unexpand(file, tab_size, opt));
|
||||
IF_UNEXPAND(unexpand(file, tab_size, opt));
|
||||
|
||||
/* Check and close the file */
|
||||
if (fclose_if_not_stdin(file)) {
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini fsync implementation for busybox
|
||||
*
|
||||
* Copyright (C) 2008 Nokia Corporation. All rights reserved.
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
#include "libbb.h"
|
||||
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
int fsync_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int fsync_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
int status;
|
||||
int opts;
|
||||
|
||||
opts = getopt32(argv, "d"); /* fdatasync */
|
||||
argv += optind;
|
||||
if (!*argv) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
status = EXIT_SUCCESS;
|
||||
do {
|
||||
int fd = open3_or_warn(*argv, O_NOATIME | O_NOCTTY | O_RDONLY, 0);
|
||||
|
||||
if (fd == -1) {
|
||||
status = EXIT_FAILURE;
|
||||
continue;
|
||||
}
|
||||
if ((opts ? fdatasync(fd) : fsync(fd))) {
|
||||
//status = EXIT_FAILURE; - do we want this?
|
||||
bb_simple_perror_msg(*argv);
|
||||
}
|
||||
close(fd);
|
||||
} while (*++argv);
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -119,8 +119,8 @@ int id_main(int argc UNUSED_PARAM, char **argv)
|
||||
/* Don't allow -n -r -nr -ug -rug -nug -rnug -uZ -gZ -GZ*/
|
||||
/* Don't allow more than one username */
|
||||
opt_complementary = "?1:u--g:g--u:G--u:u--G:g--G:G--g:r?ugG:n?ugG"
|
||||
USE_SELINUX(":u--Z:Z--u:g--Z:Z--g:G--Z:Z--G");
|
||||
opt = getopt32(argv, "rnugG" USE_SELINUX("Z"));
|
||||
IF_SELINUX(":u--Z:Z--u:g--Z:Z--g:G--Z:Z--G");
|
||||
opt = getopt32(argv, "rnugG" IF_SELINUX("Z"));
|
||||
|
||||
username = argv[optind];
|
||||
if (username) {
|
||||
|
||||
@@ -101,12 +101,12 @@ int install_main(int argc, char **argv)
|
||||
#if ENABLE_FEATURE_INSTALL_LONG_OPTIONS
|
||||
applet_long_options = install_longopts;
|
||||
#endif
|
||||
opt_complementary = "s--d:d--s" USE_SELINUX(":Z--\xff:\xff--Z");
|
||||
opt_complementary = "s--d:d--s" IF_SELINUX(":Z--\xff:\xff--Z");
|
||||
/* -c exists for backwards compatibility, it's needed */
|
||||
/* -v is ignored ("print name of each created directory") */
|
||||
/* -b is ignored ("make a backup of each existing destination file") */
|
||||
opts = getopt32(argv, "cvb" "Ddpsg:m:o:" USE_SELINUX("Z:"),
|
||||
&gid_str, &mode_str, &uid_str USE_SELINUX(, &scontext));
|
||||
opts = getopt32(argv, "cvb" "Ddpsg:m:o:" IF_SELINUX("Z:"),
|
||||
&gid_str, &mode_str, &uid_str IF_SELINUX(, &scontext));
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
@@ -129,7 +129,7 @@ int install_main(int argc, char **argv)
|
||||
if (opts & OPT_PRESERVE_TIME) {
|
||||
copy_flags |= FILEUTILS_PRESERVE_STATUS;
|
||||
}
|
||||
mode = 0666;
|
||||
mode = 0755; /* GNU coreutils 6.10 compat */
|
||||
if (opts & OPT_MODE)
|
||||
bb_parse_mode(mode_str, &mode);
|
||||
uid = (opts & OPT_OWNER) ? get_ug_id(uid_str, xuname2uid) : getuid();
|
||||
@@ -175,8 +175,9 @@ int install_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the file mode */
|
||||
if ((opts & OPT_MODE) && chmod(dest, mode) == -1) {
|
||||
/* Set the file mode (always, not only with -m).
|
||||
* GNU coreutils 6.10 is not affected by umask. */
|
||||
if (chmod(dest, mode) == -1) {
|
||||
bb_perror_msg("can't change %s of %s", "permissions", dest);
|
||||
ret = EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ mode_t FAST_FUNC getopt_mk_fifo_nod(char **argv)
|
||||
security_context_t scontext;
|
||||
#endif
|
||||
int opt;
|
||||
opt = getopt32(argv, "m:" USE_SELINUX("Z:"), &smode USE_SELINUX(,&scontext));
|
||||
opt = getopt32(argv, "m:" IF_SELINUX("Z:"), &smode IF_SELINUX(,&scontext));
|
||||
if (opt & 1) {
|
||||
if (bb_parse_mode(smode, &mode))
|
||||
umask(0);
|
||||
|
||||
@@ -30,12 +30,9 @@
|
||||
* [2009-03]
|
||||
* ls sorts listing now, and supports almost all options.
|
||||
*/
|
||||
|
||||
#include "libbb.h"
|
||||
#include "unicode.h"
|
||||
|
||||
#if ENABLE_FEATURE_ASSUME_UNICODE
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
/* This is a NOEXEC applet. Be very careful! */
|
||||
|
||||
@@ -46,12 +43,12 @@
|
||||
*/
|
||||
# undef CONFIG_FEATURE_LS_TIMESTAMPS
|
||||
# undef ENABLE_FEATURE_LS_TIMESTAMPS
|
||||
# undef USE_FEATURE_LS_TIMESTAMPS
|
||||
# undef SKIP_FEATURE_LS_TIMESTAMPS
|
||||
# undef IF_FEATURE_LS_TIMESTAMPS
|
||||
# undef IF_NOT_FEATURE_LS_TIMESTAMPS
|
||||
# define CONFIG_FEATURE_LS_TIMESTAMPS 1
|
||||
# define ENABLE_FEATURE_LS_TIMESTAMPS 1
|
||||
# define USE_FEATURE_LS_TIMESTAMPS(...) __VA_ARGS__
|
||||
# define SKIP_FEATURE_LS_TIMESTAMPS(...)
|
||||
# define IF_FEATURE_LS_TIMESTAMPS(...) __VA_ARGS__
|
||||
# define IF_NOT_FEATURE_LS_TIMESTAMPS(...)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -138,15 +135,14 @@ SPLIT_SUBDIR = 2,
|
||||
/* "[-]e", I think we made this one up */
|
||||
static const char ls_options[] ALIGN1 =
|
||||
"Cadil1gnsxQAk" /* 13 opts, total 13 */
|
||||
USE_FEATURE_LS_TIMESTAMPS("cetu") /* 4, 17 */
|
||||
USE_FEATURE_LS_SORTFILES("SXrv") /* 4, 21 */
|
||||
USE_FEATURE_LS_FILETYPES("Fp") /* 2, 23 */
|
||||
USE_FEATURE_LS_FOLLOWLINKS("L") /* 1, 24 */
|
||||
USE_FEATURE_LS_RECURSIVE("R") /* 1, 25 */
|
||||
USE_FEATURE_HUMAN_READABLE("h") /* 1, 26 */
|
||||
USE_SELINUX("K") /* 1, 27 */
|
||||
USE_SELINUX("Z") /* 1, 28 */
|
||||
USE_FEATURE_AUTOWIDTH("T:w:") /* 2, 30 */
|
||||
IF_FEATURE_LS_TIMESTAMPS("cetu") /* 4, 17 */
|
||||
IF_FEATURE_LS_SORTFILES("SXrv") /* 4, 21 */
|
||||
IF_FEATURE_LS_FILETYPES("Fp") /* 2, 23 */
|
||||
IF_FEATURE_LS_FOLLOWLINKS("L") /* 1, 24 */
|
||||
IF_FEATURE_LS_RECURSIVE("R") /* 1, 25 */
|
||||
IF_FEATURE_HUMAN_READABLE("h") /* 1, 26 */
|
||||
IF_SELINUX("KZ") /* 2, 28 */
|
||||
IF_FEATURE_AUTOWIDTH("T:w:") /* 2, 30 */
|
||||
;
|
||||
enum {
|
||||
//OPT_C = (1 << 0),
|
||||
@@ -162,6 +158,16 @@ enum {
|
||||
OPT_Q = (1 << 10),
|
||||
//OPT_A = (1 << 11),
|
||||
//OPT_k = (1 << 12),
|
||||
OPTBIT_color = 13
|
||||
+ 4 * ENABLE_FEATURE_LS_TIMESTAMPS
|
||||
+ 4 * ENABLE_FEATURE_LS_SORTFILES
|
||||
+ 2 * ENABLE_FEATURE_LS_FILETYPES
|
||||
+ 1 * ENABLE_FEATURE_LS_FOLLOWLINKS
|
||||
+ 1 * ENABLE_FEATURE_LS_RECURSIVE
|
||||
+ 1 * ENABLE_FEATURE_HUMAN_READABLE
|
||||
+ 2 * ENABLE_SELINUX
|
||||
+ 2 * ENABLE_FEATURE_AUTOWIDTH,
|
||||
OPT_color = 1 << OPTBIT_color,
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -232,7 +238,7 @@ struct dnode { /* the basic node */
|
||||
const char *fullname; /* the dir entry name */
|
||||
int allocated;
|
||||
struct stat dstat; /* the file stat info */
|
||||
USE_SELINUX(security_context_t sid;)
|
||||
IF_SELINUX(security_context_t sid;)
|
||||
struct dnode *next; /* point at the next node */
|
||||
};
|
||||
|
||||
@@ -277,32 +283,17 @@ enum {
|
||||
/* memset: we have to zero it out because of NOEXEC */
|
||||
#define INIT_G() do { \
|
||||
memset(&G, 0, sizeof(G)); \
|
||||
USE_FEATURE_AUTOWIDTH(tabstops = COLUMN_GAP;) \
|
||||
USE_FEATURE_AUTOWIDTH(terminal_width = TERMINAL_WIDTH;) \
|
||||
USE_FEATURE_LS_TIMESTAMPS(time(¤t_time_t);) \
|
||||
IF_FEATURE_AUTOWIDTH(tabstops = COLUMN_GAP;) \
|
||||
IF_FEATURE_AUTOWIDTH(terminal_width = TERMINAL_WIDTH;) \
|
||||
IF_FEATURE_LS_TIMESTAMPS(time(¤t_time_t);) \
|
||||
} while (0)
|
||||
|
||||
|
||||
#if ENABLE_FEATURE_ASSUME_UNICODE
|
||||
/* libbb candidate */
|
||||
static size_t mbstrlen(const char *string)
|
||||
{
|
||||
size_t width = mbsrtowcs(NULL /*dest*/, &string,
|
||||
MAXINT(size_t) /*len*/, NULL /*state*/);
|
||||
if (width == (size_t)-1)
|
||||
return strlen(string);
|
||||
return width;
|
||||
}
|
||||
#else
|
||||
#define mbstrlen(string) strlen(string)
|
||||
#endif
|
||||
|
||||
|
||||
static struct dnode *my_stat(const char *fullname, const char *name, int force_follow)
|
||||
{
|
||||
struct stat dstat;
|
||||
struct dnode *cur;
|
||||
USE_SELINUX(security_context_t sid = NULL;)
|
||||
IF_SELINUX(security_context_t sid = NULL;)
|
||||
|
||||
if ((all_fmt & FOLLOW_LINKS) || force_follow) {
|
||||
#if ENABLE_SELINUX
|
||||
@@ -332,7 +323,7 @@ static struct dnode *my_stat(const char *fullname, const char *name, int force_f
|
||||
cur->fullname = fullname;
|
||||
cur->name = name;
|
||||
cur->dstat = dstat;
|
||||
USE_SELINUX(cur->sid = sid;)
|
||||
IF_SELINUX(cur->sid = sid;)
|
||||
return cur;
|
||||
}
|
||||
|
||||
@@ -565,12 +556,12 @@ static void showfiles(struct dnode **dn, int nfiles)
|
||||
} else {
|
||||
/* find the longest file name, use that as the column width */
|
||||
for (i = 0; i < nfiles; i++) {
|
||||
int len = mbstrlen(dn[i]->name);
|
||||
int len = bb_mbstrlen(dn[i]->name);
|
||||
if (column_width < len)
|
||||
column_width = len;
|
||||
}
|
||||
column_width += tabstops +
|
||||
USE_SELINUX( ((all_fmt & LIST_CONTEXT) ? 33 : 0) + )
|
||||
IF_SELINUX( ((all_fmt & LIST_CONTEXT) ? 33 : 0) + )
|
||||
((all_fmt & LIST_INO) ? 8 : 0) +
|
||||
((all_fmt & LIST_BLOCKS) ? 5 : 0);
|
||||
ncols = (int) (terminal_width / column_width);
|
||||
@@ -712,7 +703,7 @@ static int print_name(const char *name)
|
||||
{
|
||||
if (option_mask32 & OPT_Q) {
|
||||
#if ENABLE_FEATURE_ASSUME_UNICODE
|
||||
int len = 2 + mbstrlen(name);
|
||||
int len = 2 + bb_mbstrlen(name);
|
||||
#else
|
||||
int len = 2;
|
||||
#endif
|
||||
@@ -732,7 +723,7 @@ static int print_name(const char *name)
|
||||
/* No -Q: */
|
||||
#if ENABLE_FEATURE_ASSUME_UNICODE
|
||||
fputs(name, stdout);
|
||||
return mbstrlen(name);
|
||||
return bb_mbstrlen(name);
|
||||
#else
|
||||
return printf("%s", name);
|
||||
#endif
|
||||
@@ -889,16 +880,6 @@ static int list_single(const struct dnode *dn)
|
||||
}
|
||||
|
||||
|
||||
/* colored LS support by JaWi, janwillem.janssen@lxtreme.nl */
|
||||
#if ENABLE_FEATURE_LS_COLOR
|
||||
/* long option entry used only for --color, which has no short option
|
||||
* equivalent */
|
||||
static const char ls_color_opt[] ALIGN1 =
|
||||
"color\0" Optional_argument "\xff" /* no short equivalent */
|
||||
;
|
||||
#endif
|
||||
|
||||
|
||||
int ls_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
struct dnode **dnd;
|
||||
@@ -911,29 +892,48 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
|
||||
int dnfiles;
|
||||
int dndirs;
|
||||
int i;
|
||||
#if ENABLE_FEATURE_LS_COLOR
|
||||
/* colored LS support by JaWi, janwillem.janssen@lxtreme.nl */
|
||||
/* coreutils 6.10:
|
||||
* # ls --color=BOGUS
|
||||
* ls: invalid argument 'BOGUS' for '--color'
|
||||
* Valid arguments are:
|
||||
* 'always', 'yes', 'force'
|
||||
* 'never', 'no', 'none'
|
||||
* 'auto', 'tty', 'if-tty'
|
||||
* (and substrings: "--color=alwa" work too)
|
||||
*/
|
||||
static const char ls_longopts[] ALIGN1 =
|
||||
"color\0" Optional_argument "\xff"; /* no short equivalent */
|
||||
static const char color_str[] ALIGN1 =
|
||||
"always\0""yes\0""force\0"
|
||||
"auto\0""tty\0""if-tty\0";
|
||||
/* need to initialize since --color has _an optional_ argument */
|
||||
USE_FEATURE_LS_COLOR(const char *color_opt = "always";)
|
||||
const char *color_opt = color_str; /* "always" */
|
||||
#endif
|
||||
|
||||
INIT_G();
|
||||
|
||||
check_unicode_in_env();
|
||||
|
||||
all_fmt = LIST_SHORT |
|
||||
(ENABLE_FEATURE_LS_SORTFILES * (SORT_NAME | SORT_FORWARD));
|
||||
|
||||
#if ENABLE_FEATURE_AUTOWIDTH
|
||||
/* Obtain the terminal width */
|
||||
/* obtain the terminal width */
|
||||
get_terminal_width_height(STDIN_FILENO, &terminal_width, NULL);
|
||||
/* Go one less... */
|
||||
/* go one less... */
|
||||
terminal_width--;
|
||||
#endif
|
||||
|
||||
/* process options */
|
||||
USE_FEATURE_LS_COLOR(applet_long_options = ls_color_opt;)
|
||||
IF_FEATURE_LS_COLOR(applet_long_options = ls_longopts;)
|
||||
#if ENABLE_FEATURE_AUTOWIDTH
|
||||
opt_complementary = "T+:w+"; /* -T N, -w N */
|
||||
opt = getopt32(argv, ls_options, &tabstops, &terminal_width
|
||||
USE_FEATURE_LS_COLOR(, &color_opt));
|
||||
IF_FEATURE_LS_COLOR(, &color_opt));
|
||||
#else
|
||||
opt = getopt32(argv, ls_options USE_FEATURE_LS_COLOR(, &color_opt));
|
||||
opt = getopt32(argv, ls_options IF_FEATURE_LS_COLOR(, &color_opt));
|
||||
#endif
|
||||
for (i = 0; opt_flags[i] != (1U<<31); i++) {
|
||||
if (opt & (1 << i)) {
|
||||
@@ -966,13 +966,20 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
|
||||
if (!p || (p[0] && strcmp(p, "none") != 0))
|
||||
show_color = 1;
|
||||
}
|
||||
if (opt & (1 << i)) { /* next flag after short options */
|
||||
if (strcmp("always", color_opt) == 0)
|
||||
show_color = 1;
|
||||
else if (strcmp("never", color_opt) == 0)
|
||||
if (opt & OPT_color) {
|
||||
if (color_opt[0] == 'n')
|
||||
show_color = 0;
|
||||
else if (strcmp("auto", color_opt) == 0 && isatty(STDOUT_FILENO))
|
||||
show_color = 1;
|
||||
else switch (index_in_substrings(color_str, color_opt)) {
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
if (isatty(STDOUT_FILENO)) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
show_color = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ int mkdir_main(int argc, char **argv)
|
||||
#if ENABLE_FEATURE_MKDIR_LONG_OPTIONS
|
||||
applet_long_options = mkdir_longopts;
|
||||
#endif
|
||||
opt = getopt32(argv, "m:p" USE_SELINUX("Z:"), &smode USE_SELINUX(,&scontext));
|
||||
opt = getopt32(argv, "m:p" IF_SELINUX("Z:"), &smode IF_SELINUX(,&scontext));
|
||||
if (opt & 1) {
|
||||
mode = 0777;
|
||||
if (!bb_parse_mode(smode, &mode)) {
|
||||
|
||||
@@ -832,7 +832,7 @@ format_address_std(off_t address, char c)
|
||||
printf(address_fmt, address);
|
||||
}
|
||||
|
||||
#if ENABLE_GETOPT_LONG
|
||||
#if ENABLE_LONG_OPTS
|
||||
/* only used with --traditional */
|
||||
static void
|
||||
format_address_paren(off_t address, char c)
|
||||
@@ -953,7 +953,7 @@ get_lcm(void)
|
||||
return l_c_m;
|
||||
}
|
||||
|
||||
#if ENABLE_GETOPT_LONG
|
||||
#if ENABLE_LONG_OPTS
|
||||
/* If S is a valid traditional offset specification with an optional
|
||||
leading '+' return nonzero and set *OFFSET to the offset it denotes. */
|
||||
|
||||
@@ -1199,9 +1199,9 @@ int od_main(int argc, char **argv)
|
||||
OPT_s = 1 << 15,
|
||||
OPT_S = 1 << 16,
|
||||
OPT_w = 1 << 17,
|
||||
OPT_traditional = (1 << 18) * ENABLE_GETOPT_LONG,
|
||||
OPT_traditional = (1 << 18) * ENABLE_LONG_OPTS,
|
||||
};
|
||||
#if ENABLE_GETOPT_LONG
|
||||
#if ENABLE_LONG_OPTS
|
||||
static const char od_longopts[] ALIGN1 =
|
||||
"skip-bytes\0" Required_argument "j"
|
||||
"address-radix\0" Required_argument "A"
|
||||
@@ -1235,7 +1235,7 @@ int od_main(int argc, char **argv)
|
||||
|
||||
/* Parse command line */
|
||||
opt_complementary = "w+:t::"; /* -w N, -t is a list */
|
||||
#if ENABLE_GETOPT_LONG
|
||||
#if ENABLE_LONG_OPTS
|
||||
applet_long_options = od_longopts;
|
||||
#endif
|
||||
opt = getopt32(argv, "A:N:abcdfhij:lot:vxsS:"
|
||||
@@ -1306,7 +1306,7 @@ int od_main(int argc, char **argv)
|
||||
* FIXME: POSIX 1003.1-2001 with XSI requires support for the
|
||||
* traditional syntax even if --traditional is not given. */
|
||||
|
||||
#if ENABLE_GETOPT_LONG
|
||||
#if ENABLE_LONG_OPTS
|
||||
if (opt & OPT_traditional) {
|
||||
off_t o1, o2;
|
||||
|
||||
|
||||
@@ -53,10 +53,7 @@
|
||||
* (but negative numbers are not "bad").
|
||||
* Both accept negative numbers for %u specifier.
|
||||
*
|
||||
* We try to be compatible. We are not compatible here:
|
||||
* - we do not accept -NUM for %u
|
||||
* - exit code is 0 even if "invalid number" was seen (FIXME)
|
||||
* See "if (errno)" checks in the code below.
|
||||
* We try to be compatible.
|
||||
*/
|
||||
|
||||
typedef void FAST_FUNC (*converter)(const char *arg, void *result);
|
||||
@@ -78,6 +75,14 @@ static int multiconvert(const char *arg, void *result, converter convert)
|
||||
static void FAST_FUNC conv_strtoull(const char *arg, void *result)
|
||||
{
|
||||
*(unsigned long long*)result = bb_strtoull(arg, NULL, 0);
|
||||
/* both coreutils 6.10 and bash 3.2:
|
||||
* $ printf '%x\n' -2
|
||||
* fffffffffffffffe
|
||||
* Mimic that:
|
||||
*/
|
||||
if (errno) {
|
||||
*(unsigned long long*)result = bb_strtoll(arg, NULL, 0);
|
||||
}
|
||||
}
|
||||
static void FAST_FUNC conv_strtoll(const char *arg, void *result)
|
||||
{
|
||||
@@ -147,6 +152,8 @@ static void print_direc(char *format, unsigned fmt_length,
|
||||
if (have_width - 1 == have_prec)
|
||||
have_width = NULL;
|
||||
|
||||
errno = 0;
|
||||
|
||||
switch (format[fmt_length - 1]) {
|
||||
case 'c':
|
||||
printf(format, *argument);
|
||||
@@ -155,7 +162,6 @@ static void print_direc(char *format, unsigned fmt_length,
|
||||
case 'i':
|
||||
llv = my_xstrtoll(argument);
|
||||
print_long:
|
||||
/* if (errno) return; - see comment at the top */
|
||||
if (!have_width) {
|
||||
if (!have_prec)
|
||||
printf(format, llv);
|
||||
@@ -202,7 +208,6 @@ static void print_direc(char *format, unsigned fmt_length,
|
||||
case 'g':
|
||||
case 'G':
|
||||
dv = my_xstrtod(argument);
|
||||
/* if (errno) return; */
|
||||
if (!have_width) {
|
||||
if (!have_prec)
|
||||
printf(format, dv);
|
||||
@@ -233,7 +238,7 @@ static int get_width_prec(const char *str)
|
||||
|
||||
/* Print the text in FORMAT, using ARGV for arguments to any '%' directives.
|
||||
Return advanced ARGV. */
|
||||
static char **print_formatted(char *f, char **argv)
|
||||
static char **print_formatted(char *f, char **argv, int *conv_err)
|
||||
{
|
||||
char *direc_start; /* Start of % directive. */
|
||||
unsigned direc_length; /* Length of % directive. */
|
||||
@@ -291,8 +296,8 @@ static char **print_formatted(char *f, char **argv)
|
||||
|
||||
/* Remove "lLhz" size modifiers, repeatedly.
|
||||
* bash does not like "%lld", but coreutils
|
||||
* would happily take even "%Llllhhzhhzd"!
|
||||
* We will be permissive like coreutils */
|
||||
* happily takes even "%Llllhhzhhzd"!
|
||||
* We are permissive like coreutils */
|
||||
while ((*f | 0x20) == 'l' || *f == 'h' || *f == 'z') {
|
||||
overlapping_strcpy(f, f + 1);
|
||||
}
|
||||
@@ -322,12 +327,12 @@ static char **print_formatted(char *f, char **argv)
|
||||
}
|
||||
if (*argv) {
|
||||
print_direc(direc_start, direc_length, field_width,
|
||||
precision, *argv);
|
||||
++argv;
|
||||
precision, *argv++);
|
||||
} else {
|
||||
print_direc(direc_start, direc_length, field_width,
|
||||
precision, "");
|
||||
}
|
||||
*conv_err |= errno;
|
||||
free(p);
|
||||
}
|
||||
break;
|
||||
@@ -348,6 +353,7 @@ static char **print_formatted(char *f, char **argv)
|
||||
|
||||
int printf_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
int conv_err;
|
||||
char *format;
|
||||
char **argv2;
|
||||
|
||||
@@ -384,9 +390,10 @@ int printf_main(int argc UNUSED_PARAM, char **argv)
|
||||
format = argv[1];
|
||||
argv2 = argv + 2;
|
||||
|
||||
conv_err = 0;
|
||||
do {
|
||||
argv = argv2;
|
||||
argv2 = print_formatted(format, argv);
|
||||
argv2 = print_formatted(format, argv, &conv_err);
|
||||
} while (argv2 > argv && *argv2);
|
||||
|
||||
/* coreutils compat (bash doesn't do this):
|
||||
@@ -394,5 +401,6 @@ int printf_main(int argc UNUSED_PARAM, char **argv)
|
||||
fprintf(stderr, "excess args ignored");
|
||||
*/
|
||||
|
||||
return (argv2 < argv); /* if true, print_formatted errored out */
|
||||
return (argv2 < argv) /* if true, print_formatted errored out */
|
||||
|| conv_err; /* print_formatted saw invalid number */
|
||||
}
|
||||
@@ -6,9 +6,31 @@
|
||||
*
|
||||
* Licensed under GPL v2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
/*
|
||||
* # readlink --version
|
||||
* readlink (GNU coreutils) 6.10
|
||||
* # readlink --help
|
||||
* -f, --canonicalize
|
||||
* canonicalize by following every symlink in
|
||||
* every component of the given name recursively;
|
||||
* all but the last component must exist
|
||||
* -e, --canonicalize-existing
|
||||
* canonicalize by following every symlink in
|
||||
* every component of the given name recursively,
|
||||
* all components must exist
|
||||
* -m, --canonicalize-missing
|
||||
* canonicalize by following every symlink in
|
||||
* every component of the given name recursively,
|
||||
* without requirements on components existence
|
||||
* -n, --no-newline do not output the trailing newline
|
||||
* -q, --quiet, -s, --silent suppress most error messages
|
||||
* -v, --verbose report error messages
|
||||
*
|
||||
* bbox supports: -f -n -v (fully), -q -s (accepts but ignores)
|
||||
*/
|
||||
|
||||
int readlink_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int readlink_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
@@ -16,23 +38,24 @@ int readlink_main(int argc UNUSED_PARAM, char **argv)
|
||||
char *fname;
|
||||
char pathbuf[PATH_MAX];
|
||||
|
||||
USE_FEATURE_READLINK_FOLLOW(
|
||||
IF_FEATURE_READLINK_FOLLOW(
|
||||
unsigned opt;
|
||||
/* We need exactly one non-option argument. */
|
||||
opt_complementary = "=1";
|
||||
opt = getopt32(argv, "f");
|
||||
opt = getopt32(argv, "fnvsq");
|
||||
fname = argv[optind];
|
||||
)
|
||||
SKIP_FEATURE_READLINK_FOLLOW(
|
||||
IF_NOT_FEATURE_READLINK_FOLLOW(
|
||||
const unsigned opt = 0;
|
||||
if (argc != 2) bb_show_usage();
|
||||
fname = argv[1];
|
||||
)
|
||||
|
||||
/* compat: coreutils readlink reports errors silently via exit code */
|
||||
logmode = LOGMODE_NONE;
|
||||
if (!(opt & 4)) /* not -v */
|
||||
logmode = LOGMODE_NONE;
|
||||
|
||||
if (opt) {
|
||||
if (opt & 1) { /* -f */
|
||||
buf = realpath(fname, pathbuf);
|
||||
} else {
|
||||
buf = xmalloc_readlink_or_warn(fname);
|
||||
@@ -40,7 +63,7 @@ int readlink_main(int argc UNUSED_PARAM, char **argv)
|
||||
|
||||
if (!buf)
|
||||
return EXIT_FAILURE;
|
||||
puts(buf);
|
||||
printf((opt & 2) ? "%s" : "%s\n", buf);
|
||||
|
||||
if (ENABLE_FEATURE_CLEAN_UP && !opt)
|
||||
free(buf);
|
||||
|
||||
@@ -6,12 +6,10 @@
|
||||
*
|
||||
* Licensed under the GPL v2, see the file LICENSE in this tarball.
|
||||
*/
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
|
||||
int seq_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int seq_main(int argc, char **argv)
|
||||
{
|
||||
@@ -19,35 +17,83 @@ int seq_main(int argc, char **argv)
|
||||
OPT_w = (1 << 0),
|
||||
OPT_s = (1 << 1),
|
||||
};
|
||||
double last, increment, i;
|
||||
double first, last, increment, v;
|
||||
unsigned n;
|
||||
unsigned width;
|
||||
unsigned frac_part;
|
||||
const char *sep, *opt_s = "\n";
|
||||
unsigned opt = getopt32(argv, "+ws:", &opt_s);
|
||||
unsigned width = 0;
|
||||
unsigned opt;
|
||||
|
||||
#if ENABLE_LOCALE_SUPPORT
|
||||
/* Undo busybox.c: on input, we want to use dot
|
||||
* as fractional separator, regardless of current locale */
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
#endif
|
||||
|
||||
opt = getopt32(argv, "+ws:", &opt_s);
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
i = increment = 1;
|
||||
first = increment = 1;
|
||||
errno = 0;
|
||||
switch (argc) {
|
||||
char *pp;
|
||||
case 3:
|
||||
increment = atof(argv[1]);
|
||||
increment = strtod(argv[1], &pp);
|
||||
errno |= *pp;
|
||||
case 2:
|
||||
i = atof(*argv);
|
||||
first = strtod(argv[0], &pp);
|
||||
errno |= *pp;
|
||||
case 1:
|
||||
last = atof(argv[argc-1]);
|
||||
break;
|
||||
last = strtod(argv[argc-1], &pp);
|
||||
if (!errno && *pp == '\0')
|
||||
break;
|
||||
default:
|
||||
bb_show_usage();
|
||||
}
|
||||
if (opt & OPT_w) /* Pad to length of start or last */
|
||||
width = MAX(strlen(*argv), strlen(argv[argc-1]));
|
||||
|
||||
/* You should note that this is pos-5.0.91 semantics, -- FK. */
|
||||
sep = "";
|
||||
while ((increment > 0 && i <= last) || (increment < 0 && i >= last)) {
|
||||
printf("%s%0*g", sep, width, i);
|
||||
sep = opt_s;
|
||||
i += increment;
|
||||
#if ENABLE_LOCALE_SUPPORT
|
||||
setlocale(LC_NUMERIC, "");
|
||||
#endif
|
||||
|
||||
/* Last checked to be compatible with: coreutils-6.10 */
|
||||
width = 0;
|
||||
frac_part = 0;
|
||||
while (1) {
|
||||
char *dot = strchrnul(*argv, '.');
|
||||
int w = (dot - *argv);
|
||||
int f = strlen(dot);
|
||||
if (width < w)
|
||||
width = w;
|
||||
argv++;
|
||||
if (!*argv)
|
||||
break;
|
||||
/* Why do the above _before_ frac check below?
|
||||
* Try "seq 1 2.0" and "seq 1.0 2.0":
|
||||
* coreutils never pay attention to the number
|
||||
* of fractional digits in last arg. */
|
||||
if (frac_part < f)
|
||||
frac_part = f;
|
||||
}
|
||||
bb_putchar('\n');
|
||||
if (frac_part) {
|
||||
frac_part--;
|
||||
if (frac_part)
|
||||
width += frac_part + 1;
|
||||
}
|
||||
if (!(opt & OPT_w))
|
||||
width = 0;
|
||||
|
||||
sep = "";
|
||||
v = first;
|
||||
n = 0;
|
||||
while (increment >= 0 ? v <= last : v >= last) {
|
||||
printf("%s%0*.*f", sep, width, frac_part, v);
|
||||
sep = opt_s;
|
||||
/* v += increment; - would accumulate floating point errors */
|
||||
n++;
|
||||
v = first + n * increment;
|
||||
}
|
||||
if (n) /* if while loop executed at least once */
|
||||
bb_putchar('\n');
|
||||
|
||||
return fflush(stdout);
|
||||
}
|
||||
@@ -54,11 +54,13 @@ int sleep_main(int argc UNUSED_PARAM, char **argv)
|
||||
char *arg = *argv;
|
||||
if (strchr(arg, '.')) {
|
||||
double d;
|
||||
char *pp;
|
||||
int len = strspn(arg, "0123456789.");
|
||||
char sv = arg[len];
|
||||
arg[len] = '\0';
|
||||
d = bb_strtod(arg, NULL);
|
||||
if (errno)
|
||||
errno = 0;
|
||||
d = strtod(arg, &pp);
|
||||
if (errno || *pp)
|
||||
bb_show_usage();
|
||||
arg[len] = sv;
|
||||
len--;
|
||||
|
||||
@@ -156,7 +156,7 @@ static void printfs(char *pformat, const char *msg)
|
||||
/* print statfs info */
|
||||
static void print_statfs(char *pformat, const char m,
|
||||
const char *const filename, const void *data
|
||||
USE_SELINUX(, security_context_t scontext))
|
||||
IF_SELINUX(, security_context_t scontext))
|
||||
{
|
||||
const struct statfs *statfsbuf = data;
|
||||
if (m == 'n') {
|
||||
@@ -203,7 +203,7 @@ static void print_statfs(char *pformat, const char m,
|
||||
/* print stat info */
|
||||
static void print_stat(char *pformat, const char m,
|
||||
const char *const filename, const void *data
|
||||
USE_SELINUX(, security_context_t scontext))
|
||||
IF_SELINUX(, security_context_t scontext))
|
||||
{
|
||||
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
|
||||
struct stat *statbuf = (struct stat *) data;
|
||||
@@ -306,9 +306,9 @@ static void print_stat(char *pformat, const char m,
|
||||
}
|
||||
|
||||
static void print_it(const char *masterformat, const char *filename,
|
||||
void (*print_func) (char*, char, const char*, const void* USE_SELINUX(, security_context_t scontext)),
|
||||
void (*print_func) (char*, char, const char*, const void* IF_SELINUX(, security_context_t scontext)),
|
||||
const void *data
|
||||
USE_SELINUX(, security_context_t scontext) )
|
||||
IF_SELINUX(, security_context_t scontext) )
|
||||
{
|
||||
/* Create a working copy of the format string */
|
||||
char *format = xstrdup(masterformat);
|
||||
@@ -347,7 +347,7 @@ static void print_it(const char *masterformat, const char *filename,
|
||||
break;
|
||||
default:
|
||||
/* Completes "%<modifiers>" with specifier and printfs */
|
||||
print_func(dest, *p, filename, data USE_SELINUX(,scontext));
|
||||
print_func(dest, *p, filename, data IF_SELINUX(,scontext));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -416,7 +416,7 @@ static bool do_statfs(const char *filename, const char *format)
|
||||
);
|
||||
#endif /* SELINUX */
|
||||
}
|
||||
print_it(format, filename, print_statfs, &statfsbuf USE_SELINUX(, scontext));
|
||||
print_it(format, filename, print_statfs, &statfsbuf IF_SELINUX(, scontext));
|
||||
#else /* FEATURE_STAT_FORMAT */
|
||||
format = (option_mask32 & OPT_TERSE
|
||||
? "%s %llx %lu "
|
||||
@@ -560,11 +560,11 @@ static bool do_stat(const char *filename, const char *format)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
print_it(format, filename, print_stat, &statbuf USE_SELINUX(, scontext));
|
||||
print_it(format, filename, print_stat, &statbuf IF_SELINUX(, scontext));
|
||||
#else /* FEATURE_STAT_FORMAT */
|
||||
if (option_mask32 & OPT_TERSE) {
|
||||
printf("%s %ju %ju %lx %lu %lu %jx %ju %lu %lx %lx %lu %lu %lu %lu"
|
||||
SKIP_SELINUX("\n"),
|
||||
IF_NOT_SELINUX("\n"),
|
||||
filename,
|
||||
(uintmax_t) (statbuf.st_size),
|
||||
(uintmax_t) statbuf.st_blocks,
|
||||
@@ -642,14 +642,14 @@ static bool do_stat(const char *filename, const char *format)
|
||||
int stat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int stat_main(int argc, char **argv)
|
||||
{
|
||||
USE_FEATURE_STAT_FORMAT(char *format = NULL;)
|
||||
IF_FEATURE_STAT_FORMAT(char *format = NULL;)
|
||||
int i;
|
||||
int ok = 1;
|
||||
statfunc_ptr statfunc = do_stat;
|
||||
|
||||
getopt32(argv, "ftL"
|
||||
USE_SELINUX("Z")
|
||||
USE_FEATURE_STAT_FORMAT("c:", &format)
|
||||
IF_SELINUX("Z")
|
||||
IF_FEATURE_STAT_FORMAT("c:", &format)
|
||||
);
|
||||
|
||||
if (option_mask32 & OPT_FILESYS) /* -f */
|
||||
@@ -663,7 +663,7 @@ int stat_main(int argc, char **argv)
|
||||
}
|
||||
#endif /* ENABLE_SELINUX */
|
||||
for (i = optind; i < argc; ++i)
|
||||
ok &= statfunc(argv[i] USE_FEATURE_STAT_FORMAT(, format));
|
||||
ok &= statfunc(argv[i] IF_FEATURE_STAT_FORMAT(, format));
|
||||
|
||||
return (ok ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
@@ -677,8 +677,8 @@ static tcflag_t *mode_type_flag(unsigned type, const struct termios *mode)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void set_speed_or_die(enum speed_setting type, const char *const arg,
|
||||
struct termios * const mode)
|
||||
static void set_speed_or_die(enum speed_setting type, const char *arg,
|
||||
struct termios *mode)
|
||||
{
|
||||
speed_t baud;
|
||||
|
||||
@@ -801,7 +801,7 @@ enum {
|
||||
param_ospeed = 8 | 0x80,
|
||||
};
|
||||
|
||||
static int find_param(const char *const name)
|
||||
static int find_param(const char *name)
|
||||
{
|
||||
static const char params[] ALIGN1 =
|
||||
"line\0" /* 1 */
|
||||
|
||||
@@ -50,12 +50,12 @@ static ssize_t tail_read(int fd, char *buf, size_t count)
|
||||
off_t current;
|
||||
struct stat sbuf;
|
||||
|
||||
/* (A good comment is missing here) */
|
||||
current = lseek(fd, 0, SEEK_CUR);
|
||||
/* /proc files report zero st_size, don't lseek them. */
|
||||
if (fstat(fd, &sbuf) == 0 && sbuf.st_size)
|
||||
if (fstat(fd, &sbuf) == 0 && sbuf.st_size > 0) {
|
||||
current = lseek(fd, 0, SEEK_CUR);
|
||||
if (sbuf.st_size < current)
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
xlseek(fd, 0, SEEK_SET);
|
||||
}
|
||||
|
||||
r = full_read(fd, buf, count);
|
||||
if (r < 0) {
|
||||
@@ -85,18 +85,15 @@ int tail_main(int argc, char **argv)
|
||||
unsigned count = 10;
|
||||
unsigned sleep_period = 1;
|
||||
bool from_top;
|
||||
int header_threshhold = 1;
|
||||
const char *str_c, *str_n;
|
||||
|
||||
char *tailbuf;
|
||||
size_t tailbufsize;
|
||||
int taillen = 0;
|
||||
int newlines_seen = 0;
|
||||
int nfiles, nread, nwrite, i, opt;
|
||||
unsigned seen;
|
||||
unsigned header_threshhold = 1;
|
||||
unsigned nfiles;
|
||||
int i, opt;
|
||||
|
||||
int *fds;
|
||||
char *s, *buf;
|
||||
const char *fmt;
|
||||
|
||||
#if ENABLE_INCLUDE_SUSv2 || ENABLE_FEATURE_FANCY_TAIL
|
||||
@@ -110,17 +107,23 @@ int tail_main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
USE_FEATURE_FANCY_TAIL(opt_complementary = "s+";) /* -s N */
|
||||
opt = getopt32(argv, "fc:n:" USE_FEATURE_FANCY_TAIL("qs:v"),
|
||||
&str_c, &str_n USE_FEATURE_FANCY_TAIL(,&sleep_period));
|
||||
/* -s NUM, -F imlies -f */
|
||||
IF_FEATURE_FANCY_TAIL(opt_complementary = "s+:Ff";)
|
||||
opt = getopt32(argv, "fc:n:" IF_FEATURE_FANCY_TAIL("qs:vF"),
|
||||
&str_c, &str_n IF_FEATURE_FANCY_TAIL(,&sleep_period));
|
||||
#define FOLLOW (opt & 0x1)
|
||||
#define COUNT_BYTES (opt & 0x2)
|
||||
//if (opt & 0x1) // -f
|
||||
if (opt & 0x2) count = eat_num(str_c); // -c
|
||||
if (opt & 0x4) count = eat_num(str_n); // -n
|
||||
#if ENABLE_FEATURE_FANCY_TAIL
|
||||
if (opt & 0x8) header_threshhold = INT_MAX; // -q
|
||||
/* q: make it impossible for nfiles to be > header_threshhold */
|
||||
if (opt & 0x8) header_threshhold = UINT_MAX; // -q
|
||||
//if (opt & 0x10) // -s
|
||||
if (opt & 0x20) header_threshhold = 0; // -v
|
||||
# define FOLLOW_RETRY (opt & 0x40)
|
||||
#else
|
||||
# define FOLLOW_RETRY 0
|
||||
#endif
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
@@ -128,19 +131,21 @@ int tail_main(int argc, char **argv)
|
||||
G.status = EXIT_SUCCESS;
|
||||
|
||||
/* open all the files */
|
||||
fds = xmalloc(sizeof(int) * (argc + 1));
|
||||
fds = xmalloc(sizeof(fds[0]) * (argc + 1));
|
||||
if (!argv[0]) {
|
||||
struct stat statbuf;
|
||||
|
||||
if (!fstat(STDIN_FILENO, &statbuf) && S_ISFIFO(statbuf.st_mode)) {
|
||||
if (fstat(STDIN_FILENO, &statbuf) == 0
|
||||
&& S_ISFIFO(statbuf.st_mode)
|
||||
) {
|
||||
opt &= ~1; /* clear FOLLOW */
|
||||
}
|
||||
*argv = (char *) bb_msg_standard_input;
|
||||
argv[0] = (char *) bb_msg_standard_input;
|
||||
}
|
||||
nfiles = i = 0;
|
||||
do {
|
||||
int fd = open_or_warn_stdin(argv[i]);
|
||||
if (fd < 0) {
|
||||
if (fd < 0 && !FOLLOW_RETRY) {
|
||||
G.status = EXIT_FAILURE;
|
||||
continue;
|
||||
}
|
||||
@@ -161,44 +166,73 @@ int tail_main(int argc, char **argv)
|
||||
tailbuf = xmalloc(tailbufsize);
|
||||
|
||||
/* tail the files */
|
||||
fmt = header_fmt + 1; /* Skip header leading newline on first output. */
|
||||
fmt = header_fmt + 1; /* skip header leading newline on first output */
|
||||
i = 0;
|
||||
do {
|
||||
char *buf;
|
||||
int taillen;
|
||||
int newlines_seen;
|
||||
unsigned seen;
|
||||
int nread;
|
||||
int fd = fds[i];
|
||||
|
||||
if (ENABLE_FEATURE_FANCY_TAIL && fd < 0)
|
||||
continue; /* may happen with -E */
|
||||
|
||||
if (nfiles > header_threshhold) {
|
||||
tail_xprint_header(fmt, argv[i]);
|
||||
fmt = header_fmt;
|
||||
}
|
||||
|
||||
/* Optimizing count-bytes case if the file is seekable.
|
||||
* Beware of backing up too far.
|
||||
* Also we exclude files with size 0 (because of /proc/xxx) */
|
||||
if (COUNT_BYTES && !from_top) {
|
||||
off_t current = lseek(fds[i], 0, SEEK_END);
|
||||
if (!from_top) {
|
||||
off_t current = lseek(fd, 0, SEEK_END);
|
||||
if (current > 0) {
|
||||
if (count == 0)
|
||||
continue; /* showing zero lines is easy :) */
|
||||
current -= count;
|
||||
unsigned off;
|
||||
if (COUNT_BYTES) {
|
||||
/* Optimizing count-bytes case if the file is seekable.
|
||||
* Beware of backing up too far.
|
||||
* Also we exclude files with size 0 (because of /proc/xxx) */
|
||||
if (count == 0)
|
||||
continue; /* showing zero bytes is easy :) */
|
||||
current -= count;
|
||||
if (current < 0)
|
||||
current = 0;
|
||||
xlseek(fd, current, SEEK_SET);
|
||||
bb_copyfd_size(fd, STDOUT_FILENO, count);
|
||||
continue;
|
||||
}
|
||||
#if 1 /* This is technically incorrect for *LONG* strings, but very useful */
|
||||
/* Optimizing count-lines case if the file is seekable.
|
||||
* We assume the lines are <64k.
|
||||
* (Users complain that tail takes too long
|
||||
* on multi-gigabyte files) */
|
||||
off = (count | 0xf); /* for small counts, be more paranoid */
|
||||
if (off > (INT_MAX / (64*1024)))
|
||||
off = (INT_MAX / (64*1024));
|
||||
current -= off * (64*1024);
|
||||
if (current < 0)
|
||||
current = 0;
|
||||
xlseek(fds[i], current, SEEK_SET);
|
||||
bb_copyfd_size(fds[i], STDOUT_FILENO, count);
|
||||
continue;
|
||||
xlseek(fd, current, SEEK_SET);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
buf = tailbuf;
|
||||
taillen = 0;
|
||||
/* "We saw 1st line/byte".
|
||||
* Used only by +N code ("start from Nth", 1-based): */
|
||||
seen = 1;
|
||||
newlines_seen = 0;
|
||||
while ((nread = tail_read(fds[i], buf, tailbufsize-taillen)) > 0) {
|
||||
while ((nread = tail_read(fd, buf, tailbufsize-taillen)) > 0) {
|
||||
if (from_top) {
|
||||
nwrite = nread;
|
||||
int nwrite = nread;
|
||||
if (seen < count) {
|
||||
/* We need to skip a few more bytes/lines */
|
||||
if (COUNT_BYTES) {
|
||||
nwrite -= (count - seen);
|
||||
seen = count;
|
||||
} else {
|
||||
s = buf;
|
||||
char *s = buf;
|
||||
do {
|
||||
--nwrite;
|
||||
if (*s++ == '\n' && ++seen == count) {
|
||||
@@ -231,6 +265,7 @@ int tail_main(int argc, char **argv)
|
||||
taillen += nread;
|
||||
} else {
|
||||
int extra = (buf[nread-1] != '\n');
|
||||
char *s;
|
||||
|
||||
k = newlines_seen + newlines_in_buf + extra - count;
|
||||
s = tailbuf;
|
||||
@@ -257,23 +292,54 @@ int tail_main(int argc, char **argv)
|
||||
}
|
||||
} while (++i < nfiles);
|
||||
|
||||
buf = xrealloc(tailbuf, BUFSIZ);
|
||||
tailbuf = xrealloc(tailbuf, BUFSIZ);
|
||||
|
||||
fmt = NULL;
|
||||
|
||||
if (FOLLOW) while (1) {
|
||||
sleep(sleep_period);
|
||||
|
||||
i = 0;
|
||||
do {
|
||||
int nread;
|
||||
const char *filename = argv[i];
|
||||
int fd = fds[i];
|
||||
|
||||
if (FOLLOW_RETRY) {
|
||||
struct stat sbuf, fsbuf;
|
||||
|
||||
if (fd < 0
|
||||
|| fstat(fd, &fsbuf) < 0
|
||||
|| stat(filename, &sbuf) < 0
|
||||
|| fsbuf.st_dev != sbuf.st_dev
|
||||
|| fsbuf.st_ino != sbuf.st_ino
|
||||
) {
|
||||
int new_fd;
|
||||
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
new_fd = open(filename, O_RDONLY);
|
||||
if (new_fd >= 0) {
|
||||
bb_error_msg("%s has %s; following end of new file",
|
||||
filename, (fd < 0) ? "appeared" : "been replaced"
|
||||
);
|
||||
} else if (fd >= 0) {
|
||||
bb_perror_msg("%s has become inaccessible", filename);
|
||||
}
|
||||
fds[i] = fd = new_fd;
|
||||
}
|
||||
}
|
||||
if (ENABLE_FEATURE_FANCY_TAIL && fd < 0)
|
||||
continue;
|
||||
if (nfiles > header_threshhold) {
|
||||
fmt = header_fmt;
|
||||
}
|
||||
while ((nread = tail_read(fds[i], buf, BUFSIZ)) > 0) {
|
||||
while ((nread = tail_read(fd, tailbuf, BUFSIZ)) > 0) {
|
||||
if (fmt) {
|
||||
tail_xprint_header(fmt, argv[i]);
|
||||
tail_xprint_header(fmt, filename);
|
||||
fmt = NULL;
|
||||
}
|
||||
xwrite(STDOUT_FILENO, buf, nread);
|
||||
xwrite(STDOUT_FILENO, tailbuf, nread);
|
||||
}
|
||||
} while (++i < nfiles);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* Original copyright notice states:
|
||||
* "This program is in the Public Domain."
|
||||
*/
|
||||
|
||||
#include "libbb.h"
|
||||
#include <setjmp.h>
|
||||
|
||||
@@ -29,7 +28,6 @@
|
||||
* This is true regardless of PREFER_APPLETS and STANDALONE_SHELL
|
||||
* state. */
|
||||
|
||||
|
||||
/* test(1) accepts the following grammar:
|
||||
oexpr ::= aexpr | aexpr "-o" oexpr ;
|
||||
aexpr ::= nexpr | nexpr "-a" aexpr ;
|
||||
@@ -47,43 +45,97 @@
|
||||
operand ::= <any legal UNIX file name>
|
||||
*/
|
||||
|
||||
/* TODO: handle [[ expr ]] bashism bash-compatibly.
|
||||
* [[ ]] is meant to be a "better [ ]", with less weird syntax
|
||||
* and without the risk of variables and quoted strings misinterpreted
|
||||
* as operators.
|
||||
* This will require support from shells - we need to know quote status
|
||||
* of each parameter (see below).
|
||||
*
|
||||
* Word splitting and pathname expansion should NOT be performed:
|
||||
* # a="a b"; [[ $a = "a b" ]] && echo YES
|
||||
* YES
|
||||
* # [[ /bin/m* ]] && echo YES
|
||||
* YES
|
||||
*
|
||||
* =~ should do regexp match
|
||||
* = and == should do pattern match against right side:
|
||||
* # [[ *a* == bab ]] && echo YES
|
||||
* # [[ bab == *a* ]] && echo YES
|
||||
* YES
|
||||
* != does the negated == (i.e., also with pattern matching).
|
||||
* Pattern matching is quotation-sensitive:
|
||||
* # [[ bab == "b"a* ]] && echo YES
|
||||
* YES
|
||||
* # [[ bab == b"a*" ]] && echo YES
|
||||
*
|
||||
* Conditional operators such as -f must be unquoted literals to be recognized:
|
||||
* # [[ -e /bin ]] && echo YES
|
||||
* YES
|
||||
* # [[ '-e' /bin ]] && echo YES
|
||||
* bash: conditional binary operator expected...
|
||||
* # A='-e'; [[ $A /bin ]] && echo YES
|
||||
* bash: conditional binary operator expected...
|
||||
*
|
||||
* || and && should work as -o and -a work in [ ]
|
||||
* -a and -o aren't recognized (&& and || are to be used instead)
|
||||
* ( and ) do not need to be quoted unlike in [ ]:
|
||||
* # [[ ( abc ) && '' ]] && echo YES
|
||||
* # [[ ( abc ) || '' ]] && echo YES
|
||||
* YES
|
||||
* # [[ ( abc ) -o '' ]] && echo YES
|
||||
* bash: syntax error in conditional expression...
|
||||
*
|
||||
* Apart from the above, [[ expr ]] should work as [ expr ]
|
||||
*/
|
||||
|
||||
#define TEST_DEBUG 0
|
||||
|
||||
enum token {
|
||||
EOI,
|
||||
FILRD,
|
||||
|
||||
FILRD, /* file access */
|
||||
FILWR,
|
||||
FILEX,
|
||||
|
||||
FILEXIST,
|
||||
FILREG,
|
||||
|
||||
FILREG, /* file type */
|
||||
FILDIR,
|
||||
FILCDEV,
|
||||
FILBDEV,
|
||||
FILFIFO,
|
||||
FILSOCK,
|
||||
|
||||
FILSYM,
|
||||
FILGZ,
|
||||
FILTT,
|
||||
FILSUID,
|
||||
|
||||
FILSUID, /* file bit */
|
||||
FILSGID,
|
||||
FILSTCK,
|
||||
FILNT,
|
||||
|
||||
FILNT, /* file ops */
|
||||
FILOT,
|
||||
FILEQ,
|
||||
|
||||
FILUID,
|
||||
FILGID,
|
||||
STREZ,
|
||||
|
||||
STREZ, /* str ops */
|
||||
STRNZ,
|
||||
STREQ,
|
||||
STRNE,
|
||||
STRLT,
|
||||
STRGT,
|
||||
INTEQ,
|
||||
|
||||
INTEQ, /* int ops */
|
||||
INTNE,
|
||||
INTGE,
|
||||
INTGT,
|
||||
INTLE,
|
||||
INTLT,
|
||||
|
||||
UNOT,
|
||||
BAND,
|
||||
BOR,
|
||||
@@ -170,7 +222,7 @@ static const char *const TOKSTR[] = {
|
||||
#define unnest_msg_and_return(expr, ...) return expr
|
||||
#endif
|
||||
|
||||
enum token_types {
|
||||
enum {
|
||||
UNOP,
|
||||
BINOP,
|
||||
BUNOP,
|
||||
@@ -179,53 +231,96 @@ enum token_types {
|
||||
};
|
||||
|
||||
struct operator_t {
|
||||
char op_text[4];
|
||||
unsigned char op_num, op_type;
|
||||
};
|
||||
|
||||
static const struct operator_t ops[] = {
|
||||
{ "-r", FILRD , UNOP },
|
||||
{ "-w", FILWR , UNOP },
|
||||
{ "-x", FILEX , UNOP },
|
||||
{ "-e", FILEXIST, UNOP },
|
||||
{ "-f", FILREG , UNOP },
|
||||
{ "-d", FILDIR , UNOP },
|
||||
{ "-c", FILCDEV , UNOP },
|
||||
{ "-b", FILBDEV , UNOP },
|
||||
{ "-p", FILFIFO , UNOP },
|
||||
{ "-u", FILSUID , UNOP },
|
||||
{ "-g", FILSGID , UNOP },
|
||||
{ "-k", FILSTCK , UNOP },
|
||||
{ "-s", FILGZ , UNOP },
|
||||
{ "-t", FILTT , UNOP },
|
||||
{ "-z", STREZ , UNOP },
|
||||
{ "-n", STRNZ , UNOP },
|
||||
{ "-h", FILSYM , UNOP }, /* for backwards compat */
|
||||
static const struct operator_t ops_table[] = {
|
||||
{ /* "-r" */ FILRD , UNOP },
|
||||
{ /* "-w" */ FILWR , UNOP },
|
||||
{ /* "-x" */ FILEX , UNOP },
|
||||
{ /* "-e" */ FILEXIST, UNOP },
|
||||
{ /* "-f" */ FILREG , UNOP },
|
||||
{ /* "-d" */ FILDIR , UNOP },
|
||||
{ /* "-c" */ FILCDEV , UNOP },
|
||||
{ /* "-b" */ FILBDEV , UNOP },
|
||||
{ /* "-p" */ FILFIFO , UNOP },
|
||||
{ /* "-u" */ FILSUID , UNOP },
|
||||
{ /* "-g" */ FILSGID , UNOP },
|
||||
{ /* "-k" */ FILSTCK , UNOP },
|
||||
{ /* "-s" */ FILGZ , UNOP },
|
||||
{ /* "-t" */ FILTT , UNOP },
|
||||
{ /* "-z" */ STREZ , UNOP },
|
||||
{ /* "-n" */ STRNZ , UNOP },
|
||||
{ /* "-h" */ FILSYM , UNOP }, /* for backwards compat */
|
||||
|
||||
{ "-O" , FILUID , UNOP },
|
||||
{ "-G" , FILGID , UNOP },
|
||||
{ "-L" , FILSYM , UNOP },
|
||||
{ "-S" , FILSOCK, UNOP },
|
||||
{ "=" , STREQ , BINOP },
|
||||
{ "==" , STREQ , BINOP },
|
||||
{ "!=" , STRNE , BINOP },
|
||||
{ "<" , STRLT , BINOP },
|
||||
{ ">" , STRGT , BINOP },
|
||||
{ "-eq", INTEQ , BINOP },
|
||||
{ "-ne", INTNE , BINOP },
|
||||
{ "-ge", INTGE , BINOP },
|
||||
{ "-gt", INTGT , BINOP },
|
||||
{ "-le", INTLE , BINOP },
|
||||
{ "-lt", INTLT , BINOP },
|
||||
{ "-nt", FILNT , BINOP },
|
||||
{ "-ot", FILOT , BINOP },
|
||||
{ "-ef", FILEQ , BINOP },
|
||||
{ "!" , UNOT , BUNOP },
|
||||
{ "-a" , BAND , BBINOP },
|
||||
{ "-o" , BOR , BBINOP },
|
||||
{ "(" , LPAREN , PAREN },
|
||||
{ ")" , RPAREN , PAREN },
|
||||
{ /* "-O" */ FILUID , UNOP },
|
||||
{ /* "-G" */ FILGID , UNOP },
|
||||
{ /* "-L" */ FILSYM , UNOP },
|
||||
{ /* "-S" */ FILSOCK , UNOP },
|
||||
{ /* "=" */ STREQ , BINOP },
|
||||
{ /* "==" */ STREQ , BINOP },
|
||||
{ /* "!=" */ STRNE , BINOP },
|
||||
{ /* "<" */ STRLT , BINOP },
|
||||
{ /* ">" */ STRGT , BINOP },
|
||||
{ /* "-eq"*/ INTEQ , BINOP },
|
||||
{ /* "-ne"*/ INTNE , BINOP },
|
||||
{ /* "-ge"*/ INTGE , BINOP },
|
||||
{ /* "-gt"*/ INTGT , BINOP },
|
||||
{ /* "-le"*/ INTLE , BINOP },
|
||||
{ /* "-lt"*/ INTLT , BINOP },
|
||||
{ /* "-nt"*/ FILNT , BINOP },
|
||||
{ /* "-ot"*/ FILOT , BINOP },
|
||||
{ /* "-ef"*/ FILEQ , BINOP },
|
||||
{ /* "!" */ UNOT , BUNOP },
|
||||
{ /* "-a" */ BAND , BBINOP },
|
||||
{ /* "-o" */ BOR , BBINOP },
|
||||
{ /* "(" */ LPAREN , PAREN },
|
||||
{ /* ")" */ RPAREN , PAREN },
|
||||
};
|
||||
/* Please keep these two tables in sync */
|
||||
static const char ops_texts[] ALIGN1 =
|
||||
"-r" "\0"
|
||||
"-w" "\0"
|
||||
"-x" "\0"
|
||||
"-e" "\0"
|
||||
"-f" "\0"
|
||||
"-d" "\0"
|
||||
"-c" "\0"
|
||||
"-b" "\0"
|
||||
"-p" "\0"
|
||||
"-u" "\0"
|
||||
"-g" "\0"
|
||||
"-k" "\0"
|
||||
"-s" "\0"
|
||||
"-t" "\0"
|
||||
"-z" "\0"
|
||||
"-n" "\0"
|
||||
"-h" "\0"
|
||||
|
||||
"-O" "\0"
|
||||
"-G" "\0"
|
||||
"-L" "\0"
|
||||
"-S" "\0"
|
||||
"=" "\0"
|
||||
"==" "\0"
|
||||
"!=" "\0"
|
||||
"<" "\0"
|
||||
">" "\0"
|
||||
"-eq" "\0"
|
||||
"-ne" "\0"
|
||||
"-ge" "\0"
|
||||
"-gt" "\0"
|
||||
"-le" "\0"
|
||||
"-lt" "\0"
|
||||
"-nt" "\0"
|
||||
"-ot" "\0"
|
||||
"-ef" "\0"
|
||||
"!" "\0"
|
||||
"-a" "\0"
|
||||
"-o" "\0"
|
||||
"(" "\0"
|
||||
")" "\0"
|
||||
;
|
||||
|
||||
|
||||
#if ENABLE_FEATURE_TEST_64
|
||||
@@ -332,29 +427,22 @@ static int equalf(const char *f1, const char *f2)
|
||||
*/
|
||||
|
||||
|
||||
static enum token check_operator(char *s)
|
||||
static enum token check_operator(const char *s)
|
||||
{
|
||||
static const struct operator_t no_op = {
|
||||
.op_num = -1,
|
||||
.op_type = -1
|
||||
};
|
||||
const struct operator_t *op;
|
||||
int n;
|
||||
|
||||
last_operator = &no_op;
|
||||
if (s == NULL) {
|
||||
if (s == NULL)
|
||||
return EOI;
|
||||
}
|
||||
|
||||
op = ops;
|
||||
do {
|
||||
if (strcmp(s, op->op_text) == 0) {
|
||||
last_operator = op;
|
||||
return op->op_num;
|
||||
}
|
||||
op++;
|
||||
} while (op < ops + ARRAY_SIZE(ops));
|
||||
|
||||
return OPERAND;
|
||||
n = index_in_strings(ops_texts, s);
|
||||
if (n < 0)
|
||||
return OPERAND;
|
||||
last_operator = &ops_table[n];
|
||||
return ops_table[n].op_num;
|
||||
}
|
||||
|
||||
|
||||
@@ -370,7 +458,7 @@ static int binop(void)
|
||||
|
||||
opnd2 = *++args;
|
||||
if (opnd2 == NULL)
|
||||
syntax(op->op_text, "argument expected");
|
||||
syntax(args[-1], "argument expected");
|
||||
|
||||
if (is_int_op(op->op_num)) {
|
||||
val1 = getn(opnd1);
|
||||
@@ -385,8 +473,8 @@ static int binop(void)
|
||||
return val1 > val2;
|
||||
if (op->op_num == INTLE)
|
||||
return val1 <= val2;
|
||||
if (op->op_num == INTLT)
|
||||
return val1 < val2;
|
||||
/*if (op->op_num == INTLT)*/
|
||||
return val1 < val2;
|
||||
}
|
||||
if (is_str_op(op->op_num)) {
|
||||
val1 = strcmp(opnd1, opnd2);
|
||||
@@ -396,8 +484,8 @@ static int binop(void)
|
||||
return val1 != 0;
|
||||
if (op->op_num == STRLT)
|
||||
return val1 < 0;
|
||||
if (op->op_num == STRGT)
|
||||
return val1 > 0;
|
||||
/*if (op->op_num == STRGT)*/
|
||||
return val1 > 0;
|
||||
}
|
||||
/* We are sure that these three are by now the only binops we didn't check
|
||||
* yet, so we do not check if the class is correct:
|
||||
@@ -412,25 +500,29 @@ static int binop(void)
|
||||
return b1.st_mtime > b2.st_mtime;
|
||||
if (op->op_num == FILOT)
|
||||
return b1.st_mtime < b2.st_mtime;
|
||||
if (op->op_num == FILEQ)
|
||||
return b1.st_dev == b2.st_dev && b1.st_ino == b2.st_ino;
|
||||
/*if (op->op_num == FILEQ)*/
|
||||
return b1.st_dev == b2.st_dev && b1.st_ino == b2.st_ino;
|
||||
}
|
||||
return 1; /* NOTREACHED */
|
||||
/*return 1; - NOTREACHED */
|
||||
}
|
||||
|
||||
|
||||
static void initialize_group_array(void)
|
||||
{
|
||||
ngroups = getgroups(0, NULL);
|
||||
if (ngroups > 0) {
|
||||
int n;
|
||||
|
||||
/* getgroups may be expensive, try to use it only once */
|
||||
ngroups = 32;
|
||||
do {
|
||||
/* FIXME: ash tries so hard to not die on OOM,
|
||||
* and we spoil it with just one xrealloc here */
|
||||
/* We realloc, because test_main can be entered repeatedly by shell.
|
||||
* Testcase (ash): 'while true; do test -x some_file; done'
|
||||
* and watch top. (some_file must have owner != you) */
|
||||
group_array = xrealloc(group_array, ngroups * sizeof(gid_t));
|
||||
getgroups(ngroups, group_array);
|
||||
}
|
||||
n = ngroups;
|
||||
group_array = xrealloc(group_array, n * sizeof(gid_t));
|
||||
ngroups = getgroups(n, group_array);
|
||||
} while (ngroups > n);
|
||||
}
|
||||
|
||||
|
||||
@@ -571,7 +663,14 @@ static number_t nexpr(enum token n)
|
||||
|
||||
nest_msg(">nexpr(%s)\n", TOKSTR[n]);
|
||||
if (n == UNOT) {
|
||||
res = !nexpr(check_operator(*++args));
|
||||
n = check_operator(*++args);
|
||||
if (n == EOI) {
|
||||
/* special case: [ ! ], [ a -a ! ] are valid */
|
||||
/* IOW, "! ARG" may miss ARG */
|
||||
unnest_msg("<nexpr:1 (!EOI)\n");
|
||||
return 1;
|
||||
}
|
||||
res = !nexpr(n);
|
||||
unnest_msg("<nexpr:%lld\n", res);
|
||||
return res;
|
||||
}
|
||||
@@ -717,7 +816,7 @@ int test_main(int argc, char **argv)
|
||||
* isn't likely in the case of a shell. paranoia
|
||||
* prevails...
|
||||
*/
|
||||
ngroups = 0;
|
||||
/*ngroups = 0; - done by INIT_S() */
|
||||
|
||||
//argc--;
|
||||
argv++;
|
||||
@@ -742,7 +841,7 @@ int test_main(int argc, char **argv)
|
||||
check_operator(argv[1]);
|
||||
if (last_operator->op_type == BINOP) {
|
||||
/* "test [!] arg1 <binary_op> arg2" */
|
||||
args = &argv[0];
|
||||
args = argv;
|
||||
res = (binop() == 0);
|
||||
goto ret;
|
||||
}
|
||||
@@ -755,7 +854,7 @@ int test_main(int argc, char **argv)
|
||||
argv--;
|
||||
}
|
||||
#endif
|
||||
args = &argv[0];
|
||||
args = argv;
|
||||
res = !oexpr(check_operator(*args));
|
||||
|
||||
if (*args != NULL && *++args != NULL) {
|
||||
|
||||
@@ -41,31 +41,38 @@ int touch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int touch_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
#if ENABLE_DESKTOP
|
||||
#if ENABLE_GETOPT_LONG
|
||||
static const char longopts[] ALIGN1 =
|
||||
# if ENABLE_LONG_OPTS
|
||||
static const char touch_longopts[] ALIGN1 =
|
||||
/* name, has_arg, val */
|
||||
"no-create\0" No_argument "c"
|
||||
"reference\0" Required_argument "r"
|
||||
"date\0" Required_argument "d"
|
||||
;
|
||||
#endif
|
||||
# endif
|
||||
struct utimbuf timebuf;
|
||||
char *reference_file = NULL;
|
||||
char *date_str = NULL;
|
||||
#else
|
||||
#define reference_file NULL
|
||||
#define timebuf (*(struct utimbuf*)NULL)
|
||||
# define reference_file NULL
|
||||
# define date_str NULL
|
||||
# define timebuf (*(struct utimbuf*)NULL)
|
||||
#endif
|
||||
int fd;
|
||||
int status = EXIT_SUCCESS;
|
||||
int opts;
|
||||
|
||||
#if ENABLE_DESKTOP
|
||||
#if ENABLE_GETOPT_LONG
|
||||
applet_long_options = longopts;
|
||||
#if ENABLE_DESKTOP && ENABLE_LONG_OPTS
|
||||
applet_long_options = touch_longopts;
|
||||
#endif
|
||||
#endif
|
||||
opts = getopt32(argv, "c" USE_DESKTOP("r:")
|
||||
/* -d and -t both set time. In coreutils,
|
||||
* accepted data format differs a bit between -d and -t.
|
||||
* We accept the same formats for both */
|
||||
opts = getopt32(argv, "c" IF_DESKTOP("r:d:t:")
|
||||
/*ignored:*/ "fma"
|
||||
USE_DESKTOP(, &reference_file));
|
||||
IF_DESKTOP(, &reference_file)
|
||||
IF_DESKTOP(, &date_str)
|
||||
IF_DESKTOP(, &date_str)
|
||||
);
|
||||
|
||||
opts &= 1; /* only -c bit is left */
|
||||
argv += optind;
|
||||
@@ -80,6 +87,23 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
|
||||
timebuf.modtime = stbuf.st_mtime;
|
||||
}
|
||||
|
||||
if (date_str) {
|
||||
struct tm tm_time;
|
||||
time_t t;
|
||||
|
||||
//time(&t);
|
||||
//localtime_r(&t, &tm_time);
|
||||
memset(&tm_time, 0, sizeof(tm_time));
|
||||
parse_datestr(date_str, &tm_time);
|
||||
|
||||
/* Correct any day of week and day of year etc. fields */
|
||||
tm_time.tm_isdst = -1; /* Be sure to recheck dst */
|
||||
t = validate_tm_time(date_str, &tm_time);
|
||||
|
||||
timebuf.actime = t;
|
||||
timebuf.modtime = t;
|
||||
}
|
||||
|
||||
do {
|
||||
if (utime(*argv, reference_file ? &timebuf : NULL)) {
|
||||
if (errno == ENOENT) { /* no such file */
|
||||
|
||||
@@ -13,17 +13,17 @@
|
||||
#include "libbb.h"
|
||||
|
||||
int tty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int tty_main(int argc, char **argv SKIP_INCLUDE_SUSv2(UNUSED_PARAM))
|
||||
int tty_main(int argc, char **argv IF_NOT_INCLUDE_SUSv2(UNUSED_PARAM))
|
||||
{
|
||||
const char *s;
|
||||
USE_INCLUDE_SUSv2(int silent;) /* Note: No longer relevant in SUSv3. */
|
||||
IF_INCLUDE_SUSv2(int silent;) /* Note: No longer relevant in SUSv3. */
|
||||
int retval;
|
||||
|
||||
xfunc_error_retval = 2; /* SUSv3 requires > 1 for error. */
|
||||
|
||||
USE_INCLUDE_SUSv2(silent = getopt32(argv, "s");)
|
||||
USE_INCLUDE_SUSv2(argc -= optind;)
|
||||
SKIP_INCLUDE_SUSv2(argc -= 1;)
|
||||
IF_INCLUDE_SUSv2(silent = getopt32(argv, "s");)
|
||||
IF_INCLUDE_SUSv2(argc -= optind;)
|
||||
IF_NOT_INCLUDE_SUSv2(argc -= 1;)
|
||||
|
||||
/* gnu tty outputs a warning that it is ignoring all args. */
|
||||
bb_warn_ignoring_args(argc);
|
||||
@@ -37,8 +37,8 @@ int tty_main(int argc, char **argv SKIP_INCLUDE_SUSv2(UNUSED_PARAM))
|
||||
s = "not a tty";
|
||||
retval = 1;
|
||||
}
|
||||
USE_INCLUDE_SUSv2(if (!silent) puts(s);)
|
||||
SKIP_INCLUDE_SUSv2(puts(s);)
|
||||
IF_INCLUDE_SUSv2(if (!silent) puts(s);)
|
||||
IF_NOT_INCLUDE_SUSv2(puts(s);)
|
||||
|
||||
fflush_stdout_and_exit(retval);
|
||||
}
|
||||
@@ -73,8 +73,8 @@ static const unsigned short utsname_offset[] = {
|
||||
int uname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int uname_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
#if ENABLE_GETOPT_LONG
|
||||
static const char longopts[] ALIGN1 =
|
||||
#if ENABLE_LONG_OPTS
|
||||
static const char uname_longopts[] ALIGN1 =
|
||||
/* name, has_arg, val */
|
||||
"all\0" No_argument "a"
|
||||
"kernel-name\0" No_argument "s"
|
||||
@@ -97,7 +97,7 @@ int uname_main(int argc UNUSED_PARAM, char **argv)
|
||||
const unsigned short *delta;
|
||||
unsigned toprint;
|
||||
|
||||
USE_GETOPT_LONG(applet_long_options = longopts);
|
||||
IF_LONG_OPTS(applet_long_options = uname_longopts);
|
||||
toprint = getopt32(argv, options);
|
||||
|
||||
if (argv[optind]) { /* coreutils-6.9 compat */
|
||||
|
||||
@@ -84,6 +84,7 @@ int uniq_main(int argc UNUSED_PARAM, char **argv)
|
||||
break;
|
||||
}
|
||||
|
||||
free((char*)s1);
|
||||
++dups; /* note: testing for overflow seems excessive. */
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ config RUN_PARTS
|
||||
config FEATURE_RUN_PARTS_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on RUN_PARTS && GETOPT_LONG
|
||||
depends on RUN_PARTS && LONG_OPTS
|
||||
help
|
||||
Support long options for the run-parts applet.
|
||||
|
||||
@@ -69,7 +69,7 @@ config FEATURE_START_STOP_DAEMON_FANCY
|
||||
config FEATURE_START_STOP_DAEMON_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on START_STOP_DAEMON && GETOPT_LONG
|
||||
depends on START_STOP_DAEMON && LONG_OPTS
|
||||
help
|
||||
Support long options for the start-stop-daemon applet.
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ int run_parts_main(int argc UNUSED_PARAM, char **argv)
|
||||
/* We require exactly one argument: the directory name */
|
||||
/* We require exactly one argument: the directory name */
|
||||
opt_complementary = "=1:a::";
|
||||
getopt32(argv, "ra:u:t"USE_FEATURE_RUN_PARTS_FANCY("l"), &arg_list, &umask_p);
|
||||
getopt32(argv, "ra:u:t"IF_FEATURE_RUN_PARTS_FANCY("l"), &arg_list, &umask_p);
|
||||
|
||||
umask(xstrtou_range(umask_p, 8, 0, 07777));
|
||||
|
||||
@@ -164,7 +164,7 @@ int run_parts_main(int argc UNUSED_PARAM, char **argv)
|
||||
continue;
|
||||
n = 1;
|
||||
if (ret < 0)
|
||||
bb_perror_msg("can't exec %s", name);
|
||||
bb_perror_msg("can't execute '%s'", name);
|
||||
else /* ret > 0 */
|
||||
bb_error_msg("%s exited with code %d", name, ret);
|
||||
}
|
||||
|
||||
@@ -347,13 +347,13 @@ int start_stop_daemon_main(int argc UNUSED_PARAM, char **argv)
|
||||
/* -xa (at least one) is required if -S is given */
|
||||
/* -q turns off -v */
|
||||
opt_complementary = "K:S:K--S:S--K:m?p:K?xpun:S?xa"
|
||||
USE_FEATURE_START_STOP_DAEMON_FANCY("q-v");
|
||||
IF_FEATURE_START_STOP_DAEMON_FANCY("q-v");
|
||||
opt = getopt32(argv, "KSbqtma:n:s:u:c:x:p:"
|
||||
USE_FEATURE_START_STOP_DAEMON_FANCY("ovN:R:"),
|
||||
IF_FEATURE_START_STOP_DAEMON_FANCY("ovN:R:"),
|
||||
&startas, &cmdname, &signame, &userspec, &chuid, &execname, &pidfile
|
||||
USE_FEATURE_START_STOP_DAEMON_FANCY(,&opt_N)
|
||||
IF_FEATURE_START_STOP_DAEMON_FANCY(,&opt_N)
|
||||
/* We accept and ignore -R <param> / --retry <param> */
|
||||
USE_FEATURE_START_STOP_DAEMON_FANCY(,NULL)
|
||||
IF_FEATURE_START_STOP_DAEMON_FANCY(,NULL)
|
||||
);
|
||||
|
||||
if (opt & OPT_s) {
|
||||
@@ -366,7 +366,7 @@ int start_stop_daemon_main(int argc UNUSED_PARAM, char **argv)
|
||||
if (!execname) /* in case -a is given and -x is not */
|
||||
execname = startas;
|
||||
|
||||
// USE_FEATURE_START_STOP_DAEMON_FANCY(
|
||||
// IF_FEATURE_START_STOP_DAEMON_FANCY(
|
||||
// if (retry_arg)
|
||||
// retries = xatoi_u(retry_arg);
|
||||
// )
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
int which_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int which_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
USE_DESKTOP(int opt;)
|
||||
IF_DESKTOP(int opt;)
|
||||
int status = EXIT_SUCCESS;
|
||||
char *path;
|
||||
char *p;
|
||||
|
||||
opt_complementary = "-1"; /* at least one argument */
|
||||
USE_DESKTOP(opt =) getopt32(argv, "a");
|
||||
IF_DESKTOP(opt =) getopt32(argv, "a");
|
||||
argv += optind;
|
||||
|
||||
/* This matches what is seen on e.g. ubuntu.
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
/BusyBox.1
|
||||
/BusyBox.html
|
||||
/BusyBox.txt
|
||||
/busybox.pod
|
||||
@@ -24,8 +24,8 @@ sub beautify {
|
||||
my $text = shift;
|
||||
for (;;) {
|
||||
my $text2 = $text;
|
||||
$text =~ s/SKIP_\w+\(.*?"\s*\)//sxg;
|
||||
$text =~ s/USE_\w+\(\s*?(.*?)"\s*\)/$1"/sxg;
|
||||
$text =~ s/IF_NOT_\w+\(.*?"\s*\)//sxg;
|
||||
$text =~ s/IF_\w+\(\s*?(.*?)"\s*\)/$1"/sxg;
|
||||
$text =~ s/USAGE_\w+\(\s*?(.*?)"\s*\)/$1"/sxg;
|
||||
last if ( $text2 eq $text );
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<!--#include file="header.html" -->
|
||||
|
||||
<h3>BusyBox: The Swiss Army Knife of Embedded Linux</h3>
|
||||
|
||||
<p>BusyBox combines tiny versions of many common UNIX utilities into a single
|
||||
small executable. It provides replacements for most of the utilities you
|
||||
usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox
|
||||
generally have fewer options than their full-featured GNU cousins; however,
|
||||
the options that are included provide the expected functionality and behave
|
||||
very much like their GNU counterparts. BusyBox provides a fairly complete
|
||||
environment for any small or embedded system.</p>
|
||||
|
||||
<p>BusyBox has been written with size-optimization and limited resources in
|
||||
mind. It is also extremely modular so you can easily include or exclude
|
||||
commands (or features) at compile time. This makes it easy to customize
|
||||
your embedded systems. To create a working system, just add some device
|
||||
nodes in /dev, a few configuration files in /etc, and a Linux kernel.</p>
|
||||
|
||||
<p>BusyBox is maintained by
|
||||
<a href="mailto:vda.linux@googlemail.com">Denys Vlasenko</a>,
|
||||
and licensed under the <a href="license.html">GNU GENERAL PUBLIC LICENSE</a>
|
||||
version 2.</p>
|
||||
|
||||
<!--#include file="footer.html" -->
|
||||
@@ -1,404 +0,0 @@
|
||||
%!PS-Adobe-2.0
|
||||
%%Title: busybox-growth.ps
|
||||
%%Creator: gnuplot 3.5 (pre 3.6) patchlevel beta 347
|
||||
%%CreationDate: Tue Apr 10 14:03:36 2001
|
||||
%%DocumentFonts: (atend)
|
||||
%%BoundingBox: 50 40 554 770
|
||||
%%Orientation: Landscape
|
||||
%%Pages: (atend)
|
||||
%%EndComments
|
||||
/gnudict 120 dict def
|
||||
gnudict begin
|
||||
/Color true def
|
||||
/Solid true def
|
||||
/gnulinewidth 5.000 def
|
||||
/userlinewidth gnulinewidth def
|
||||
/vshift -46 def
|
||||
/dl {10 mul} def
|
||||
/hpt_ 31.5 def
|
||||
/vpt_ 31.5 def
|
||||
/hpt hpt_ def
|
||||
/vpt vpt_ def
|
||||
/M {moveto} bind def
|
||||
/L {lineto} bind def
|
||||
/R {rmoveto} bind def
|
||||
/V {rlineto} bind def
|
||||
/vpt2 vpt 2 mul def
|
||||
/hpt2 hpt 2 mul def
|
||||
/Lshow { currentpoint stroke M
|
||||
0 vshift R show } def
|
||||
/Rshow { currentpoint stroke M
|
||||
dup stringwidth pop neg vshift R show } def
|
||||
/Cshow { currentpoint stroke M
|
||||
dup stringwidth pop -2 div vshift R show } def
|
||||
/UP { dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
|
||||
/hpt2 hpt 2 mul def /vpt2 vpt 2 mul def } def
|
||||
/DL { Color {setrgbcolor Solid {pop []} if 0 setdash }
|
||||
{pop pop pop Solid {pop []} if 0 setdash} ifelse } def
|
||||
/BL { stroke gnulinewidth 2 mul setlinewidth } def
|
||||
/AL { stroke gnulinewidth 2 div setlinewidth } def
|
||||
/UL { gnulinewidth mul /userlinewidth exch def } def
|
||||
/PL { stroke userlinewidth setlinewidth } def
|
||||
/LTb { BL [] 0 0 0 DL } def
|
||||
/LTa { AL [1 dl 2 dl] 0 setdash 0 0 0 setrgbcolor } def
|
||||
/LT0 { PL [] 1 0 0 DL } def
|
||||
/LT1 { PL [4 dl 2 dl] 0 1 0 DL } def
|
||||
/LT2 { PL [2 dl 3 dl] 0 0 1 DL } def
|
||||
/LT3 { PL [1 dl 1.5 dl] 1 0 1 DL } def
|
||||
/LT4 { PL [5 dl 2 dl 1 dl 2 dl] 0 1 1 DL } def
|
||||
/LT5 { PL [4 dl 3 dl 1 dl 3 dl] 1 1 0 DL } def
|
||||
/LT6 { PL [2 dl 2 dl 2 dl 4 dl] 0 0 0 DL } def
|
||||
/LT7 { PL [2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 1 0.3 0 DL } def
|
||||
/LT8 { PL [2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 0.5 0.5 0.5 DL } def
|
||||
/Pnt { stroke [] 0 setdash
|
||||
gsave 1 setlinecap M 0 0 V stroke grestore } def
|
||||
/Dia { stroke [] 0 setdash 2 copy vpt add M
|
||||
hpt neg vpt neg V hpt vpt neg V
|
||||
hpt vpt V hpt neg vpt V closepath stroke
|
||||
Pnt } def
|
||||
/Pls { stroke [] 0 setdash vpt sub M 0 vpt2 V
|
||||
currentpoint stroke M
|
||||
hpt neg vpt neg R hpt2 0 V stroke
|
||||
} def
|
||||
/Box { stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M
|
||||
0 vpt2 neg V hpt2 0 V 0 vpt2 V
|
||||
hpt2 neg 0 V closepath stroke
|
||||
Pnt } def
|
||||
/Crs { stroke [] 0 setdash exch hpt sub exch vpt add M
|
||||
hpt2 vpt2 neg V currentpoint stroke M
|
||||
hpt2 neg 0 R hpt2 vpt2 V stroke } def
|
||||
/TriU { stroke [] 0 setdash 2 copy vpt 1.12 mul add M
|
||||
hpt neg vpt -1.62 mul V
|
||||
hpt 2 mul 0 V
|
||||
hpt neg vpt 1.62 mul V closepath stroke
|
||||
Pnt } def
|
||||
/Star { 2 copy Pls Crs } def
|
||||
/BoxF { stroke [] 0 setdash exch hpt sub exch vpt add M
|
||||
0 vpt2 neg V hpt2 0 V 0 vpt2 V
|
||||
hpt2 neg 0 V closepath fill } def
|
||||
/TriUF { stroke [] 0 setdash vpt 1.12 mul add M
|
||||
hpt neg vpt -1.62 mul V
|
||||
hpt 2 mul 0 V
|
||||
hpt neg vpt 1.62 mul V closepath fill } def
|
||||
/TriD { stroke [] 0 setdash 2 copy vpt 1.12 mul sub M
|
||||
hpt neg vpt 1.62 mul V
|
||||
hpt 2 mul 0 V
|
||||
hpt neg vpt -1.62 mul V closepath stroke
|
||||
Pnt } def
|
||||
/TriDF { stroke [] 0 setdash vpt 1.12 mul sub M
|
||||
hpt neg vpt 1.62 mul V
|
||||
hpt 2 mul 0 V
|
||||
hpt neg vpt -1.62 mul V closepath fill} def
|
||||
/DiaF { stroke [] 0 setdash vpt add M
|
||||
hpt neg vpt neg V hpt vpt neg V
|
||||
hpt vpt V hpt neg vpt V closepath fill } def
|
||||
/Pent { stroke [] 0 setdash 2 copy gsave
|
||||
translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
|
||||
closepath stroke grestore Pnt } def
|
||||
/PentF { stroke [] 0 setdash gsave
|
||||
translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
|
||||
closepath fill grestore } def
|
||||
/Circle { stroke [] 0 setdash 2 copy
|
||||
hpt 0 360 arc stroke Pnt } def
|
||||
/CircleF { stroke [] 0 setdash hpt 0 360 arc fill } def
|
||||
/C0 { BL [] 0 setdash 2 copy moveto vpt 90 450 arc } bind def
|
||||
/C1 { BL [] 0 setdash 2 copy moveto
|
||||
2 copy vpt 0 90 arc closepath fill
|
||||
vpt 0 360 arc closepath } bind def
|
||||
/C2 { BL [] 0 setdash 2 copy moveto
|
||||
2 copy vpt 90 180 arc closepath fill
|
||||
vpt 0 360 arc closepath } bind def
|
||||
/C3 { BL [] 0 setdash 2 copy moveto
|
||||
2 copy vpt 0 180 arc closepath fill
|
||||
vpt 0 360 arc closepath } bind def
|
||||
/C4 { BL [] 0 setdash 2 copy moveto
|
||||
2 copy vpt 180 270 arc closepath fill
|
||||
vpt 0 360 arc closepath } bind def
|
||||
/C5 { BL [] 0 setdash 2 copy moveto
|
||||
2 copy vpt 0 90 arc
|
||||
2 copy moveto
|
||||
2 copy vpt 180 270 arc closepath fill
|
||||
vpt 0 360 arc } bind def
|
||||
/C6 { BL [] 0 setdash 2 copy moveto
|
||||
2 copy vpt 90 270 arc closepath fill
|
||||
vpt 0 360 arc closepath } bind def
|
||||
/C7 { BL [] 0 setdash 2 copy moveto
|
||||
2 copy vpt 0 270 arc closepath fill
|
||||
vpt 0 360 arc closepath } bind def
|
||||
/C8 { BL [] 0 setdash 2 copy moveto
|
||||
2 copy vpt 270 360 arc closepath fill
|
||||
vpt 0 360 arc closepath } bind def
|
||||
/C9 { BL [] 0 setdash 2 copy moveto
|
||||
2 copy vpt 270 450 arc closepath fill
|
||||
vpt 0 360 arc closepath } bind def
|
||||
/C10 { BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill
|
||||
2 copy moveto
|
||||
2 copy vpt 90 180 arc closepath fill
|
||||
vpt 0 360 arc closepath } bind def
|
||||
/C11 { BL [] 0 setdash 2 copy moveto
|
||||
2 copy vpt 0 180 arc closepath fill
|
||||
2 copy moveto
|
||||
2 copy vpt 270 360 arc closepath fill
|
||||
vpt 0 360 arc closepath } bind def
|
||||
/C12 { BL [] 0 setdash 2 copy moveto
|
||||
2 copy vpt 180 360 arc closepath fill
|
||||
vpt 0 360 arc closepath } bind def
|
||||
/C13 { BL [] 0 setdash 2 copy moveto
|
||||
2 copy vpt 0 90 arc closepath fill
|
||||
2 copy moveto
|
||||
2 copy vpt 180 360 arc closepath fill
|
||||
vpt 0 360 arc closepath } bind def
|
||||
/C14 { BL [] 0 setdash 2 copy moveto
|
||||
2 copy vpt 90 360 arc closepath fill
|
||||
vpt 0 360 arc } bind def
|
||||
/C15 { BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill
|
||||
vpt 0 360 arc closepath } bind def
|
||||
/Rec { newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
|
||||
neg 0 rlineto closepath } bind def
|
||||
/Square { dup Rec } bind def
|
||||
/Bsquare { vpt sub exch vpt sub exch vpt2 Square } bind def
|
||||
/S0 { BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare } bind def
|
||||
/S1 { BL [] 0 setdash 2 copy vpt Square fill Bsquare } bind def
|
||||
/S2 { BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare } bind def
|
||||
/S3 { BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare } bind def
|
||||
/S4 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare } bind def
|
||||
/S5 { BL [] 0 setdash 2 copy 2 copy vpt Square fill
|
||||
exch vpt sub exch vpt sub vpt Square fill Bsquare } bind def
|
||||
/S6 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare } bind def
|
||||
/S7 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill
|
||||
2 copy vpt Square fill
|
||||
Bsquare } bind def
|
||||
/S8 { BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare } bind def
|
||||
/S9 { BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare } bind def
|
||||
/S10 { BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill
|
||||
Bsquare } bind def
|
||||
/S11 { BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill
|
||||
Bsquare } bind def
|
||||
/S12 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare } bind def
|
||||
/S13 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
|
||||
2 copy vpt Square fill Bsquare } bind def
|
||||
/S14 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
|
||||
2 copy exch vpt sub exch vpt Square fill Bsquare } bind def
|
||||
/S15 { BL [] 0 setdash 2 copy Bsquare fill Bsquare } bind def
|
||||
/D0 { gsave translate 45 rotate 0 0 S0 stroke grestore } bind def
|
||||
/D1 { gsave translate 45 rotate 0 0 S1 stroke grestore } bind def
|
||||
/D2 { gsave translate 45 rotate 0 0 S2 stroke grestore } bind def
|
||||
/D3 { gsave translate 45 rotate 0 0 S3 stroke grestore } bind def
|
||||
/D4 { gsave translate 45 rotate 0 0 S4 stroke grestore } bind def
|
||||
/D5 { gsave translate 45 rotate 0 0 S5 stroke grestore } bind def
|
||||
/D6 { gsave translate 45 rotate 0 0 S6 stroke grestore } bind def
|
||||
/D7 { gsave translate 45 rotate 0 0 S7 stroke grestore } bind def
|
||||
/D8 { gsave translate 45 rotate 0 0 S8 stroke grestore } bind def
|
||||
/D9 { gsave translate 45 rotate 0 0 S9 stroke grestore } bind def
|
||||
/D10 { gsave translate 45 rotate 0 0 S10 stroke grestore } bind def
|
||||
/D11 { gsave translate 45 rotate 0 0 S11 stroke grestore } bind def
|
||||
/D12 { gsave translate 45 rotate 0 0 S12 stroke grestore } bind def
|
||||
/D13 { gsave translate 45 rotate 0 0 S13 stroke grestore } bind def
|
||||
/D14 { gsave translate 45 rotate 0 0 S14 stroke grestore } bind def
|
||||
/D15 { gsave translate 45 rotate 0 0 S15 stroke grestore } bind def
|
||||
/DiaE { stroke [] 0 setdash vpt add M
|
||||
hpt neg vpt neg V hpt vpt neg V
|
||||
hpt vpt V hpt neg vpt V closepath stroke } def
|
||||
/BoxE { stroke [] 0 setdash exch hpt sub exch vpt add M
|
||||
0 vpt2 neg V hpt2 0 V 0 vpt2 V
|
||||
hpt2 neg 0 V closepath stroke } def
|
||||
/TriUE { stroke [] 0 setdash vpt 1.12 mul add M
|
||||
hpt neg vpt -1.62 mul V
|
||||
hpt 2 mul 0 V
|
||||
hpt neg vpt 1.62 mul V closepath stroke } def
|
||||
/TriDE { stroke [] 0 setdash vpt 1.12 mul sub M
|
||||
hpt neg vpt 1.62 mul V
|
||||
hpt 2 mul 0 V
|
||||
hpt neg vpt -1.62 mul V closepath stroke } def
|
||||
/PentE { stroke [] 0 setdash gsave
|
||||
translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
|
||||
closepath stroke grestore } def
|
||||
/CircE { stroke [] 0 setdash
|
||||
hpt 0 360 arc stroke } def
|
||||
/Opaque { gsave closepath 1 setgray fill grestore 0 setgray closepath } def
|
||||
/DiaW { stroke [] 0 setdash vpt add M
|
||||
hpt neg vpt neg V hpt vpt neg V
|
||||
hpt vpt V hpt neg vpt V Opaque stroke } def
|
||||
/BoxW { stroke [] 0 setdash exch hpt sub exch vpt add M
|
||||
0 vpt2 neg V hpt2 0 V 0 vpt2 V
|
||||
hpt2 neg 0 V Opaque stroke } def
|
||||
/TriUW { stroke [] 0 setdash vpt 1.12 mul add M
|
||||
hpt neg vpt -1.62 mul V
|
||||
hpt 2 mul 0 V
|
||||
hpt neg vpt 1.62 mul V Opaque stroke } def
|
||||
/TriDW { stroke [] 0 setdash vpt 1.12 mul sub M
|
||||
hpt neg vpt 1.62 mul V
|
||||
hpt 2 mul 0 V
|
||||
hpt neg vpt -1.62 mul V Opaque stroke } def
|
||||
/PentW { stroke [] 0 setdash gsave
|
||||
translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
|
||||
Opaque stroke grestore } def
|
||||
/CircW { stroke [] 0 setdash
|
||||
hpt 0 360 arc Opaque stroke } def
|
||||
/BoxFill { gsave Rec 1 setgray fill grestore } def
|
||||
end
|
||||
%%EndProlog
|
||||
%%Page: 1 1
|
||||
gnudict begin
|
||||
gsave
|
||||
50 50 translate
|
||||
0.100 0.100 scale
|
||||
90 rotate
|
||||
0 -5040 translate
|
||||
0 setgray
|
||||
newpath
|
||||
(Helvetica) findfont 140 scalefont setfont
|
||||
1.000 UL
|
||||
LTb
|
||||
560 420 M
|
||||
63 0 V
|
||||
6409 0 R
|
||||
-63 0 V
|
||||
476 420 M
|
||||
(0) Rshow
|
||||
560 1056 M
|
||||
63 0 V
|
||||
6409 0 R
|
||||
-63 0 V
|
||||
-6493 0 R
|
||||
(100) Rshow
|
||||
560 1692 M
|
||||
63 0 V
|
||||
6409 0 R
|
||||
-63 0 V
|
||||
-6493 0 R
|
||||
(200) Rshow
|
||||
560 2328 M
|
||||
63 0 V
|
||||
6409 0 R
|
||||
-63 0 V
|
||||
-6493 0 R
|
||||
(300) Rshow
|
||||
560 2964 M
|
||||
63 0 V
|
||||
6409 0 R
|
||||
-63 0 V
|
||||
-6493 0 R
|
||||
(400) Rshow
|
||||
560 3600 M
|
||||
63 0 V
|
||||
6409 0 R
|
||||
-63 0 V
|
||||
-6493 0 R
|
||||
(500) Rshow
|
||||
560 4236 M
|
||||
63 0 V
|
||||
6409 0 R
|
||||
-63 0 V
|
||||
-6493 0 R
|
||||
(600) Rshow
|
||||
560 4872 M
|
||||
63 0 V
|
||||
6409 0 R
|
||||
-63 0 V
|
||||
-6493 0 R
|
||||
(700) Rshow
|
||||
1531 420 M
|
||||
0 63 V
|
||||
0 4389 R
|
||||
0 -63 V
|
||||
0 -4529 R
|
||||
(400) Cshow
|
||||
2825 420 M
|
||||
0 63 V
|
||||
0 4389 R
|
||||
0 -63 V
|
||||
0 -4529 R
|
||||
(600) Cshow
|
||||
4120 420 M
|
||||
0 63 V
|
||||
0 4389 R
|
||||
0 -63 V
|
||||
0 -4529 R
|
||||
(800) Cshow
|
||||
5414 420 M
|
||||
0 63 V
|
||||
0 4389 R
|
||||
0 -63 V
|
||||
0 -4529 R
|
||||
(1000) Cshow
|
||||
6708 420 M
|
||||
0 63 V
|
||||
0 4389 R
|
||||
0 -63 V
|
||||
0 -4529 R
|
||||
(1200) Cshow
|
||||
1.000 UL
|
||||
LTb
|
||||
560 420 M
|
||||
6472 0 V
|
||||
0 4452 V
|
||||
-6472 0 V
|
||||
560 420 L
|
||||
0 2646 M
|
||||
currentpoint gsave translate 90 rotate 0 0 M
|
||||
(tar.gz size \(Kb\)) Cshow
|
||||
grestore
|
||||
3796 140 M
|
||||
(time \(days since Jan 1, 1998\)) Cshow
|
||||
1.000 UL
|
||||
LT0
|
||||
696 420 M
|
||||
0 593 V
|
||||
1255 0 V
|
||||
0 15 V
|
||||
214 0 V
|
||||
0 6 V
|
||||
958 0 V
|
||||
0 1 V
|
||||
-84 0 V
|
||||
0 37 V
|
||||
168 0 V
|
||||
0 262 V
|
||||
13 0 V
|
||||
0 56 V
|
||||
91 0 V
|
||||
0 33 V
|
||||
6 0 V
|
||||
0 1 V
|
||||
19 0 V
|
||||
0 11 V
|
||||
20 0 V
|
||||
0 13 V
|
||||
32 0 V
|
||||
0 104 V
|
||||
52 0 V
|
||||
0 27 V
|
||||
65 0 V
|
||||
0 15 V
|
||||
39 0 V
|
||||
0 126 V
|
||||
174 0 V
|
||||
0 103 V
|
||||
52 0 V
|
||||
0 49 V
|
||||
175 0 V
|
||||
0 56 V
|
||||
433 0 V
|
||||
0 661 V
|
||||
415 0 V
|
||||
0 857 V
|
||||
123 0 V
|
||||
0 -291 V
|
||||
498 0 V
|
||||
0 208 V
|
||||
505 0 V
|
||||
0 66 V
|
||||
291 0 V
|
||||
0 115 V
|
||||
311 0 V
|
||||
0 449 V
|
||||
162 0 V
|
||||
0 309 V
|
||||
stroke
|
||||
grestore
|
||||
end
|
||||
showpage
|
||||
%%Trailer
|
||||
%%DocumentFonts: Helvetica
|
||||
%%Pages: 1
|
||||
@@ -1,30 +0,0 @@
|
||||
|
||||
The code and graphics on this website (and it's mirror sites, if any) are
|
||||
Copyright (c) 1999-2004 by Erik Andersen. All rights reserved.
|
||||
Copyright (c) 2005-2006 Rob Landley.
|
||||
|
||||
Documents on this Web site including their graphical elements, design, and
|
||||
layout are protected by trade dress and other laws and MAY BE COPIED OR
|
||||
IMITATED IN WHOLE OR IN PART. THIS WEBSITE IS LICENSED FREE OF CHARGE, THERE
|
||||
IS NO WARRANTY FOR THE WEBSITE TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
SHOULD THIS WEBSITE PROVE DEFECTIVE, YOU MAY ASSUME THAT SOMEONE MIGHT GET
|
||||
AROUND TO SERVICING, REPAIRING OR CORRECTING IT SOMETIME WHEN THEY HAVE NOTHING
|
||||
BETTER TO DO. REGARDLESS, YOU GET TO KEEP BOTH PIECES.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY
|
||||
COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS
|
||||
WEBSITE AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
|
||||
INABILITY TO USE THIS WEBSITE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
|
||||
LOSS OF HAIR, LOSS OF LIFE, LOSS OF MEMORY, LOSS OF YOUR CARKEYS, MISPLACEMENT
|
||||
OF YOUR PAYCHECK, OR COMMANDER DATA BEING RENDERED UNABLE TO ASSIST THE
|
||||
STARFLEET OFFICERS ABORD THE STARSHIP ENTERPRISE TO RECALIBRATE THE MAIN
|
||||
DEFLECTOR ARRAY, LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE
|
||||
WEBSITE TO OPERATE WITH YOUR WEBBROWSER), EVEN IF SUCH HOLDER OR OTHER PARTY
|
||||
HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
You have been warned.
|
||||
|
||||
You can contact the webmaster at <rob@landley.net> if you have some sort
|
||||
of problem with this.
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
<!--#include file="header.html" -->
|
||||
|
||||
<h3>Morris Dancing</h3>
|
||||
|
||||
<p>Subversion commit access requires an account on Morris. The server
|
||||
behind busybox.net and uclibc.org. If you want to be able to commit things to
|
||||
Subversion, first contribute some stuff to show you are serious, can handle
|
||||
some responsibility, and that your patches don't generally need a lot of
|
||||
cleanup. Then, very nicely ask one of us (<a href="mailto:rob@landley.net">Rob
|
||||
Landley</a> for BusyBox, or <a href="mailto:andersen@codepoet.org">Erik
|
||||
Andersen</a> for uClibc) for an account.</p>
|
||||
|
||||
<p>If you're approved for an account, you'll need to send an email from your
|
||||
preferred contact email address with the username you'd like to use when
|
||||
committing changes to SVN, and attach a public ssh key to access your account
|
||||
with.</p>
|
||||
|
||||
<p>If you don't currently have an ssh version 2 DSA key at least 1024 bits
|
||||
long (the default), you can generate a key using the
|
||||
command <b>ssh-keygen -t dsa</b> and hitting enter at the prompts. This
|
||||
will create the files <b>~/.ssh/id_dsa</b> and <b>~/.ssh/id_dsa.pub</b>
|
||||
You must then send the content of 'id_dsa.pub' to me so I can set up your
|
||||
account. (The content of 'id_dsa' should of course be kept secret, anyone
|
||||
who has that can access any account that's installed your public key in
|
||||
its <b>.ssh/authorized_keys</b> file.)</p>
|
||||
|
||||
<p>Note that if you would prefer to keep your communications with us
|
||||
private, you can encrypt your email using
|
||||
<a href="http://landley.net/pubkey.gpg">Rob's public key</a> or
|
||||
<a href="http://www.codepoet.org/andersen/erik/gpg.asc">Erik's public
|
||||
key</a>.</p>
|
||||
|
||||
<p>Once you are setup with an account, you will need to use your account to
|
||||
checkout a copy of BusyBox from Subversion:</p>
|
||||
|
||||
<p><b>svn checkout svn+ssh://username@busybox.net/svn/trunk/busybox</b></p>
|
||||
<p>or</p>
|
||||
<p><b>svn checkout svn+ssh://username@uclibc.org/svn/trunk/uclibc</b></p>
|
||||
|
||||
<p>You must change <em>username</em> to your own username, or omit
|
||||
it if it's the same as your local username.</p>
|
||||
|
||||
<p>You can then enter the newly checked out project directory, make changes,
|
||||
check your changes, diff your changes, revert your changes, and and commit your
|
||||
changes using commands such as:</p>
|
||||
|
||||
<b><pre>
|
||||
svn diff
|
||||
svn status
|
||||
svn revert
|
||||
EDITOR=vi svn commit
|
||||
svn log -v -r PREV:HEAD
|
||||
svn help
|
||||
</pre></b>
|
||||
|
||||
<p>For additional detail on how to use Subversion, please visit the
|
||||
<a href="http://subversion.tigris.org/">the Subversion website</a>.
|
||||
You might also want to read online or buy a copy of <a
|
||||
href="http://svnbook.red-bean.com/">the Subversion Book</a>...</p>
|
||||
|
||||
<p>A morris account also gives you a personal web page
|
||||
(http://busybox.net/~username comes from ~/public_html on morris), and of
|
||||
course a shell prompt you can ssh into (as a regular user, root access is
|
||||
reserved for Erik and Rob). But keep in mind an account on Morris is a
|
||||
priviledge, not a requirement. Most contributors to busybox and uClibc
|
||||
haven't got one, and accounts are handed out to make the project maintainers'
|
||||
lives easier, not because "you deserve it".</p>
|
||||
|
||||
<!--#include file="footer.html" -->
|
||||
@@ -1,60 +0,0 @@
|
||||
<!--#include file="header.html" -->
|
||||
|
||||
|
||||
|
||||
<h3>Download</h3>
|
||||
|
||||
<p>
|
||||
Source for the latest release can always be
|
||||
downloaded from <a href="downloads/">http://www.busybox.net/downloads/</a>.
|
||||
|
||||
<p>
|
||||
Each 1.x branch has bug fix releases after initial 1.x.0 release.
|
||||
Also there are patches on top of latest bug fix release.
|
||||
<p>
|
||||
Latest releases and patch directories for each branch:
|
||||
<br>
|
||||
<a href="http://busybox.net/downloads/busybox-1.10.1.tar.bz2">1.10.1</a>,
|
||||
<a href="http://busybox.net/downloads/fixes-1.10.1/">patches</a>,
|
||||
<br>
|
||||
<a href="http://busybox.net/downloads/busybox-1.9.2.tar.bz2">1.9.2</a>,
|
||||
<a href="http://busybox.net/downloads/fixes-1.9.2/">patches</a>,
|
||||
<br>
|
||||
<a href="http://busybox.net/downloads/busybox-1.8.3.tar.bz2">1.8.3</a>,
|
||||
<a href="http://busybox.net/downloads/fixes-1.8.3/">patches</a>,
|
||||
<br>
|
||||
<a href="http://busybox.net/downloads/busybox-1.7.5.tar.bz2">1.7.5</a>,
|
||||
<a href="http://busybox.net/downloads/fixes-1.7.5/">patches</a>,
|
||||
<br>
|
||||
<a href="http://busybox.net/downloads/busybox-1.6.2.tar.bz2">1.6.2</a>,
|
||||
<a href="http://busybox.net/downloads/fixes-1.6.2/">patches</a>,
|
||||
<br>
|
||||
<a href="http://busybox.net/downloads/busybox-1.5.2.tar.bz2">1.5.2</a>,
|
||||
<a href="http://busybox.net/downloads/fixes-1.5.2/">patches</a>,
|
||||
<br>
|
||||
<a href="http://busybox.net/downloads/busybox-1.4.2.tar.bz2">1.4.2</a>,
|
||||
<a href="http://busybox.net/downloads/fixes-1.4.2/">patches</a>,
|
||||
<br>
|
||||
<a href="http://busybox.net/downloads/busybox-1.3.2.tar.bz2">1.3.2</a>,
|
||||
<a href="http://busybox.net/downloads/fixes-1.3.2/">patches</a>.
|
||||
|
||||
<p>
|
||||
You can also obtain <a href="downloads/snapshots/">Daily Snapshots</a> of
|
||||
the latest development source tree for those wishing to follow BusyBox development,
|
||||
but cannot or do not wish to use Subversion (svn).
|
||||
|
||||
<ul>
|
||||
<li> Click here to <a href="http://sources.busybox.net/index.py/trunk/busybox/">browse the source tree</a>.
|
||||
</li>
|
||||
|
||||
<li>Anonymous <a href="subversion.html">Subversion access</a> is available.
|
||||
</li>
|
||||
|
||||
<li>For those that are actively contributing obtaining
|
||||
<a href="developer.html">Subversion read/write access</a> is also possible.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<!--#include file="footer.html" -->
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<!--#include file="header.html" -->
|
||||
|
||||
<h3>How to get your patch added to "hot fixes"</h3>
|
||||
|
||||
<p> If you found a regression or severe bug in busybox, and you have a patch
|
||||
for it, and you want to see it added to "hot fixes", please rediff your
|
||||
patch against corresponding unmodified busybox source and send it to
|
||||
<a href="mailto:busybox@busybox.net">the mailing list</a>.
|
||||
</p>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<!--#include file="footer.html" -->
|
||||
@@ -1,51 +0,0 @@
|
||||
<!-- Footer -->
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td width="60%">
|
||||
<font face="arial, helvetica, sans-serif" size="-1">
|
||||
<!--div style="font-family: arial, helvetica, sans-serif; font-size: 80%;" -->
|
||||
<a href="/copyright.txt">Copyright © 1999-2008 Erik Andersen</a>
|
||||
<br>
|
||||
Mail all comments, insults, suggestions and bribes to
|
||||
<br>
|
||||
Denys Vlasenko <a href="mailto:vda.linux@googlemail.com">vda.linux@googlemail.com</a><br>
|
||||
</font>
|
||||
<!--/div-->
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<a href="http://www.vim.org/"><img border="0"
|
||||
width="88" height="31"
|
||||
src="images/written.in.vi.png"
|
||||
alt="This site created with the vi editor" /></a>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<a href="http://osuosl.org/"><img border="0"
|
||||
width="114" height="63"
|
||||
src="images/osuosl.png"
|
||||
alt="This site is kindly hosted by OSL" /></a>
|
||||
</td>
|
||||
<!--
|
||||
<td>
|
||||
<a href="http://validator.w3.org/check?uri=referer"><img
|
||||
border="0" height="31" width="88"
|
||||
src="images/valid-html401.png"
|
||||
alt="Valid HTML" /></a>
|
||||
</td>
|
||||
-->
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
|
||||
<title>BusyBox</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
background-color: #DEE2DE;
|
||||
color: #000000;
|
||||
font-family: lucida, helvetica, arial;
|
||||
font-size: 100%;
|
||||
}
|
||||
:link { color: #660000 }
|
||||
:visited { color: #660000 }
|
||||
:active { color: #660000 }
|
||||
td.c2 {font-family: arial, helvetica, sans-serif; font-size: 80%}
|
||||
td.c1 {font-family: lucida, helvetica; font-size: 248%}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!--basefont face="lucida, helvetica, arial" size="3"-->
|
||||
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<div class="c3">
|
||||
<table border="0" cellspacing="1" cellpadding="2">
|
||||
<tr>
|
||||
<td class="c1">BUSYBOX</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<a href="/"><img src="images/busybox1.png" alt="BusyBox" border="0" /></a><br>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign="top">
|
||||
<b>About</b>
|
||||
<ul>
|
||||
<li><a href="about.html">About BusyBox</a></li>
|
||||
<li><a href="screenshot.html">Screenshot</a></li>
|
||||
<li><a href="news.html">Announcements</a></li>
|
||||
</ul>
|
||||
<b>Documentation</b>
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="downloads/BusyBox.html">Command Help</a></li>
|
||||
<li><a href="downloads/README">README</a></li>
|
||||
</ul>
|
||||
<b>Get BusyBox</b>
|
||||
<ul>
|
||||
<li><a href="download.html">Download Source</a></li>
|
||||
<li><a href="license.html">License</a></li>
|
||||
<li><a href="products.html">Products</a></li>
|
||||
</ul>
|
||||
<b>Development</b>
|
||||
<ul>
|
||||
<li><a href="http://sources.busybox.net/index.py/trunk/busybox/">Browse Source</a></li>
|
||||
<li><a href="subversion.html">Source Control</a></li>
|
||||
<!--li><a href="/downloads/patches/recent.html">Recent Changes</a></li-->
|
||||
<li><a href="lists.html">Mailing Lists</a></li>
|
||||
<li><a href="https://bugs.busybox.net/">Bug Tracking</a></li>
|
||||
</ul>
|
||||
<p><b>Links</b>
|
||||
<ul>
|
||||
<li><a href="links.html">Related Sites</a></li>
|
||||
<li><a href="tinyutils.html">Tiny Utilities</a></li>
|
||||
<li><a href="sponsors.html">Sponsors</a></li>
|
||||
</ul>
|
||||
<p><b>Developer Pages</b>
|
||||
<ul>
|
||||
<li><a href="http://busybox.net/~landley/">Rob</a></li>
|
||||
<li><a href="http://busybox.net/~aldot/">Bernhard</a></li>
|
||||
<li><a href="http://busybox.net/~vda/">Denys</a>
|
||||
<br>- <a href="http://busybox.net/~vda/resume/denys_vlasenko.htm">resume</a>
|
||||
<br>- <a href="http://busybox.net/~vda/mboot/">mboot</a>
|
||||
<br>- <a href="http://busybox.net/~vda/linld/">linld</a>
|
||||
<br>- <a href="http://busybox.net/~vda/init_vs_runsv.html">init must die</a>
|
||||
<br>- <a href="http://busybox.net/~vda/no_ifup.txt">no ifup</a>
|
||||
<br>- <a href="http://busybox.net/~vda/unscd/">unscd</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
|
||||
<td valign="top">
|
||||
|
||||
|
Before Width: | Height: | Size: 322 B |
|
Before Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 8.0 KiB |
|
Before Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 309 B |
|
Before Width: | Height: | Size: 807 B |
|
Before Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 307 B |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 906 B |
|
Before Width: | Height: | Size: 4.3 KiB |
@@ -1 +0,0 @@
|
||||
<!--#include file="news.html" -->
|
||||