Compare commits
316
Commits
1_9_2
..
1_10_stable
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9f8b2f830 | ||
|
|
49b78fc1a8 | ||
|
|
a3087ca749 | ||
|
|
0abe9d96ee | ||
|
|
378481ed1e | ||
|
|
fc9fc1f929 | ||
|
|
74f8208f18 | ||
|
|
ffa5d76602 | ||
|
|
45911a60c3 | ||
|
|
31567c1c70 | ||
|
|
68d09697c9 | ||
|
|
4824ccae8e | ||
|
|
0dc490bda2 | ||
|
|
f90ab183d6 | ||
|
|
275b929e01 | ||
|
|
9e1f92d0bb | ||
|
|
9230582315 | ||
|
|
c52248e41c | ||
|
|
3c96d0258c | ||
|
|
0f3a580c4f | ||
|
|
027271e5a9 | ||
|
|
0a0180cdc5 | ||
|
|
104d544fd7 | ||
|
|
dd5702d696 | ||
|
|
a7d6c8bab9 | ||
|
|
cf7cf62204 | ||
|
|
0764a7f72d | ||
|
|
7a60133c6c | ||
|
|
403a5a298e | ||
|
|
71c9f015e9 | ||
|
|
dd9228b861 | ||
|
|
c0183e6e0d | ||
|
|
6aa7696e28 | ||
|
|
2a7a451391 | ||
|
|
d7e6af2dda | ||
|
|
78c5656530 | ||
|
|
e421b5ebf6 | ||
|
|
2724fa9d8a | ||
|
|
fb274df079 | ||
|
|
9c8c038981 | ||
|
|
d1277c6052 | ||
|
|
d0a071a528 | ||
|
|
b44c790e41 | ||
|
|
d25c33f186 | ||
|
|
c5b737231d | ||
|
|
592d4fe772 | ||
|
|
4866e905d7 | ||
|
|
4ee7cd4f6f | ||
|
|
aa9b1828b9 | ||
|
|
1d42665b6b | ||
|
|
62a90cdd74 | ||
|
|
d02db89244 | ||
|
|
85c247161b | ||
|
|
081eb71ebd | ||
|
|
68404f13d4 | ||
|
|
a55bd05f3c | ||
|
|
397de617f3 | ||
|
|
a4522c5a66 | ||
|
|
afc4113ed7 | ||
|
|
cdf62770af | ||
|
|
107fe7c081 | ||
|
|
aefed941c2 | ||
|
|
9f153f610f | ||
|
|
3f165fa5b3 | ||
|
|
8e2cfec1cd | ||
|
|
4cf1d08fc2 | ||
|
|
4e6d5117b8 | ||
|
|
4e6c8120a5 | ||
|
|
35e9c5d83a | ||
|
|
c51fc7bed6 | ||
|
|
b4a5087ee0 | ||
|
|
4917c11432 | ||
|
|
a43dba76ea | ||
|
|
444639cc21 | ||
|
|
c3fff877e1 | ||
|
|
4aafd5f4e3 | ||
|
|
d18f52bd18 | ||
|
|
fb29038b59 | ||
|
|
509697f00d | ||
|
|
da8ae75340 | ||
|
|
fe2188378c | ||
|
|
8a2e421f26 | ||
|
|
19fb67eee4 | ||
|
|
b29028e351 | ||
|
|
f39c7c0c86 | ||
|
|
cd174d1f31 | ||
|
|
32fd76c1d5 | ||
|
|
93e1a215af | ||
|
|
3444bd4fc2 | ||
|
|
51f421a55c | ||
|
|
1acb4ef87e | ||
|
|
574f2f4394 | ||
|
|
fe66a0eca1 | ||
|
|
c8f2f74ddd | ||
|
|
5014dada3f | ||
|
|
8195d20e36 | ||
|
|
17db1a9ac1 | ||
|
|
7be1030dcc | ||
|
|
be048f21e6 | ||
|
|
06aed4316e | ||
|
|
04bb2d2d06 | ||
|
|
d4f0b9476a | ||
|
|
d686482d05 | ||
|
|
6f1713f216 | ||
|
|
394eebed66 | ||
|
|
38b8831b32 | ||
|
|
f99afb5dff | ||
|
|
a2f47358eb | ||
|
|
6d8112cc24 | ||
|
|
8f8a420f12 | ||
|
|
b78d1c045f | ||
|
|
4f82bdb050 | ||
|
|
52feee9b1f | ||
|
|
28b29916cb | ||
|
|
400d8bb45e | ||
|
|
d553faf5a5 | ||
|
|
a7259b64e8 | ||
|
|
d2172c04e6 | ||
|
|
33196372be | ||
|
|
86620756d2 | ||
|
|
32b2a9fd6a | ||
|
|
68444b9f0c | ||
|
|
6aa74fcf5b | ||
|
|
838ffd5be2 | ||
|
|
2f518b078b | ||
|
|
081efd1232 | ||
|
|
a523e2efad | ||
|
|
84da0bf475 | ||
|
|
e376d454bb | ||
|
|
ae86a338b8 | ||
|
|
597906c436 | ||
|
|
e7b43cf59f | ||
|
|
c12d51e94e | ||
|
|
624188aec0 | ||
|
|
671ca33aa1 | ||
|
|
a58a637bed | ||
|
|
99a61842df | ||
|
|
8617454027 | ||
|
|
e93550866b | ||
|
|
53ce7f0d71 | ||
|
|
431a7c9c53 | ||
|
|
a37e7134f7 | ||
|
|
92657d484f | ||
|
|
e8419c90f1 | ||
|
|
5233cd3800 | ||
|
|
6f04391cec | ||
|
|
de7684a309 | ||
|
|
27dd495b98 | ||
|
|
b4133683a4 | ||
|
|
f732e96757 | ||
|
|
c9ca0a3274 | ||
|
|
56244736ec | ||
|
|
542963685c | ||
|
|
03b4c14bd4 | ||
|
|
b3b0753593 | ||
|
|
cb448fe01b | ||
|
|
ffae845cfd | ||
|
|
b1d8e7db0f | ||
|
|
25591c322c | ||
|
|
7fc294cdfe | ||
|
|
3718832a15 | ||
|
|
1e18f1bab3 | ||
|
|
284d0faed6 | ||
|
|
069e347863 | ||
|
|
cd5c61cd3b | ||
|
|
753f42ab8d | ||
|
|
0e6f661e23 | ||
|
|
977bc6a137 | ||
|
|
ea915363e7 | ||
|
|
6b160e490d | ||
|
|
be7d2a8ded | ||
|
|
25cd7fd702 | ||
|
|
1e47c429bf | ||
|
|
e00e5025ec | ||
|
|
39487e2d6a | ||
|
|
94e87bc83d | ||
|
|
28bf671d6d | ||
|
|
f1d93ec420 | ||
|
|
b2e578a1f2 | ||
|
|
773f6710c1 | ||
|
|
12c0622231 | ||
|
|
b5ee8db9b5 | ||
|
|
65eb550024 | ||
|
|
81887e2342 | ||
|
|
23ffb6a4a2 | ||
|
|
6dd03f04ea | ||
|
|
87cf2ee8ab | ||
|
|
d5fe880a57 | ||
|
|
9d96af2e83 | ||
|
|
3b92eaac53 | ||
|
|
75cddd8eb5 | ||
|
|
0a4624aece | ||
|
|
59bb4a4f50 | ||
|
|
7c5258b1c4 | ||
|
|
3d3d698594 | ||
|
|
fee2d0c256 | ||
|
|
7e497527ea | ||
|
|
e26b2783a5 | ||
|
|
648b44fd78 | ||
|
|
a5f2cd30c9 | ||
|
|
fc21305892 | ||
|
|
f536b99d26 | ||
|
|
a985d306a1 | ||
|
|
83177991c8 | ||
|
|
08126f665d | ||
|
|
459a5ad410 | ||
|
|
4ecfcdcced | ||
|
|
c04163a289 | ||
|
|
04e11c9209 | ||
|
|
9304d6ea92 | ||
|
|
991a1da148 | ||
|
|
0ef240d979 | ||
|
|
05743d7949 | ||
|
|
68e8e96d7f | ||
|
|
d56e3ccf96 | ||
|
|
937b10f35d | ||
|
|
761e1d1462 | ||
|
|
65581f3ed1 | ||
|
|
1e2a7e4ed1 | ||
|
|
6d52c1ee24 | ||
|
|
dc1c45795b | ||
|
|
97bd0e05cc | ||
|
|
7dbf1b4d9e | ||
|
|
afdad653ac | ||
|
|
534b8d0483 | ||
|
|
9412ec7555 | ||
|
|
22876c797c | ||
|
|
b386c1c614 | ||
|
|
d55fe3e595 | ||
|
|
e8ef7ec7de | ||
|
|
f3f33ebb0b | ||
|
|
f8157cafcb | ||
|
|
32d49bc70f | ||
|
|
c85bfcad52 | ||
|
|
5c3d2b334a | ||
|
|
95dc672326 | ||
|
|
30eb319103 | ||
|
|
6e602c4931 | ||
|
|
80667e30fb | ||
|
|
a2980c6249 | ||
|
|
5de754a395 | ||
|
|
7cff01ec2d | ||
|
|
0b2b5842a1 | ||
|
|
f0044c480c | ||
|
|
c348e0bc7b | ||
|
|
8c69afd992 | ||
|
|
c882f341ce | ||
|
|
8c638cbf09 | ||
|
|
c96d37050f | ||
|
|
36fc3cd8bc | ||
|
|
ddd42cb064 | ||
|
|
9772816570 | ||
|
|
73032ca04b | ||
|
|
847fa779af | ||
|
|
0effc2410b | ||
|
|
b5c60fc787 | ||
|
|
da42bd5bbe | ||
|
|
ef67c5758a | ||
|
|
c4e4be9414 | ||
|
|
f470196a41 | ||
|
|
61160dd0a1 | ||
|
|
b76b9a4328 | ||
|
|
893988182a | ||
|
|
ca9635b19d | ||
|
|
a5549c9617 | ||
|
|
680b86afbb | ||
|
|
1d290d1e24 | ||
|
|
9e58921e7e | ||
|
|
314820e595 | ||
|
|
8e8200a772 | ||
|
|
46ef46aefb | ||
|
|
46904bfbcc | ||
|
|
518d8dd979 | ||
|
|
52432f2b06 | ||
|
|
2b11fb483e | ||
|
|
c2f0de5eef | ||
|
|
1aac3ab49f | ||
|
|
78e1d58d3a | ||
|
|
c44c21060e | ||
|
|
ce34cccf28 | ||
|
|
d27d925a6d | ||
|
|
481ce92bdf | ||
|
|
84bbac5a09 | ||
|
|
ee8e3ee919 | ||
|
|
de24bd960f | ||
|
|
d2c450ce81 | ||
|
|
474d1c57c8 | ||
|
|
9b4c072a04 | ||
|
|
766f65919b | ||
|
|
482f2b31e7 | ||
|
|
6b404431aa | ||
|
|
4e9ca75281 | ||
|
|
bcd5fc12ec | ||
|
|
56ea65ca5f | ||
|
|
5fee2e1a79 | ||
|
|
9cd30d30a0 | ||
|
|
83c44229d2 | ||
|
|
21e20cb4ad | ||
|
|
4dada747e5 | ||
|
|
4f2e8bc765 | ||
|
|
fb0eba706c | ||
|
|
27963980db | ||
|
|
d3c042fc60 | ||
|
|
fcd878efcd | ||
|
|
3f9c848576 | ||
|
|
ddc865fb0d | ||
|
|
c03e872112 | ||
|
|
abee3d0e0d | ||
|
|
d55268d0d4 | ||
|
|
5adfa44101 | ||
|
|
1d61416b5a | ||
|
|
08137c28c4 | ||
|
|
bb50fdfe07 | ||
|
|
ec5631b6d6 | ||
|
|
7b55c7f97d | ||
|
|
8e5b6f58a2 |
No files matched your search
@@ -111,7 +111,7 @@ config LOCALE_SUPPORT
|
||||
busybox to support locale settings.
|
||||
|
||||
config GETOPT_LONG
|
||||
bool "Enable support for --long-options"
|
||||
bool "Support for --long-options"
|
||||
default y
|
||||
help
|
||||
Enable this if you want busybox applets to use the gnu --long-option
|
||||
@@ -280,6 +280,17 @@ config STATIC
|
||||
|
||||
Most people will leave this set to 'N'.
|
||||
|
||||
config NOMMU
|
||||
bool "Force NOMMU build"
|
||||
default n
|
||||
help
|
||||
Busybox tries to detect whether architecture it is being
|
||||
built against supports MMU or not. If this detection fails,
|
||||
or if you want to build NOMMU version of busybox for testing,
|
||||
you may force NOMMU build here.
|
||||
|
||||
Most people will leave this set to 'N'.
|
||||
|
||||
config BUILD_LIBBUSYBOX
|
||||
bool "Build shared libbusybox"
|
||||
default n
|
||||
@@ -555,4 +566,4 @@ source shell/Config.in
|
||||
source sysklogd/Config.in
|
||||
source runit/Config.in
|
||||
source selinux/Config.in
|
||||
source ipsvd/Config.in
|
||||
source printutils/Config.in
|
||||
@@ -1,6 +1,6 @@
|
||||
VERSION = 1
|
||||
PATCHLEVEL = 9
|
||||
SUBLEVEL = 2
|
||||
PATCHLEVEL = 10
|
||||
SUBLEVEL = 4
|
||||
EXTRAVERSION =
|
||||
NAME = Unnamed
|
||||
|
||||
@@ -437,7 +437,6 @@ libs-y := \
|
||||
editors/ \
|
||||
findutils/ \
|
||||
init/ \
|
||||
ipsvd/ \
|
||||
libbb/ \
|
||||
libpwdgrp/ \
|
||||
loginutils/ \
|
||||
@@ -446,12 +445,14 @@ libs-y := \
|
||||
networking/ \
|
||||
networking/libiproute/ \
|
||||
networking/udhcp/ \
|
||||
printutils/ \
|
||||
procps/ \
|
||||
runit/ \
|
||||
selinux/ \
|
||||
shell/ \
|
||||
sysklogd/ \
|
||||
util-linux/ \
|
||||
util-linux/volume_id/ \
|
||||
|
||||
endif # KBUILD_EXTMOD
|
||||
|
||||
@@ -571,6 +572,7 @@ quiet_cmd_busybox__ ?= LINK $@
|
||||
cmd_busybox__ ?= $(srctree)/scripts/trylink \
|
||||
"$@" \
|
||||
"$(CC)" \
|
||||
"$(CFLAGS)" \
|
||||
"$(LDFLAGS) $(EXTRA_LDFLAGS)" \
|
||||
"$(core-y)" \
|
||||
"$(libs-y)" \
|
||||
@@ -729,7 +731,7 @@ localver = $(subst $(space),, \
|
||||
# Currently, only git is supported.
|
||||
# Other SCMs can edit scripts/setlocalversion and add the appropriate
|
||||
# checks as needed.
|
||||
ifdef CONFIG_LOCALVERSION_AUTO
|
||||
ifdef _BB_DISABLED_CONFIG_LOCALVERSION_AUTO
|
||||
_localver-auto = $(shell $(CONFIG_SHELL) \
|
||||
$(srctree)/scripts/setlocalversion $(srctree))
|
||||
localver-auto = $(LOCALVERSION)$(_localver-auto)
|
||||
@@ -842,7 +844,7 @@ depend dep:
|
||||
# ---------------------------------------------------------------------------
|
||||
# Modules
|
||||
|
||||
ifdef CONFIG_MODULES
|
||||
ifdef _BB_DISABLED_CONFIG_MODULES
|
||||
|
||||
# By default, build modules as well
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ CPPFLAGS += \
|
||||
# flag checks are grouped together to speed the checks up a bit..
|
||||
CFLAGS += $(call cc-option,-Wall -Wshadow -Wwrite-strings,)
|
||||
CFLAGS += $(call cc-option,-Wundef -Wstrict-prototypes,)
|
||||
CFLAGS += $(call cc-option,-Wunused -Wunused-parameter,)
|
||||
# If you want to add "-Wmissing-prototypes -Wmissing-declarations" above
|
||||
# (or anything else for that matter) make sure that it is still possible
|
||||
# to build bbox without warnings. Current offender: find.c:alloc_action().
|
||||
|
||||
@@ -82,6 +82,9 @@ Downloading the current source code:
|
||||
is generally a faster way of getting it fixed, and the complete archive of
|
||||
what happened is the subversion changelog.
|
||||
|
||||
Note: if you want to compile busybox in a busybox environment you must
|
||||
select ENABLE_DESKTOP.
|
||||
|
||||
----------------
|
||||
|
||||
getting help:
|
||||
|
||||
@@ -7,19 +7,16 @@ have any suggestions how they plan to go about it, and to minimize conflicts
|
||||
between your work and theirs. But otherwise, all of these are fair game.
|
||||
|
||||
Rob Landley <rob@landley.net>:
|
||||
Add BB_NOMMU to platform.h and migrate __uClinux__ tests to that.
|
||||
#if defined __UCLIBC__ && !defined __ARCH_USE_MMU__
|
||||
Add a libbb/platform.c
|
||||
Implement fdprintf() for platforms that haven't got one.
|
||||
Implement bb_realpath() that can handle NULL on non-glibc.
|
||||
Cleanup bb_asprintf()
|
||||
|
||||
Migrate calloc() and bb_calloc() occurrences to bb_xzalloc().
|
||||
Remove obsolete _() wrapper crud for internationalization we don't do.
|
||||
Figure out where we need utf8 support, and add it.
|
||||
|
||||
sh
|
||||
The command shell situation is a big mess. We have three or four different
|
||||
The command shell situation is a big mess. We have three 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.
|
||||
@@ -123,9 +120,6 @@ Bernhard Fischer <busybox@busybox.net> suggests to look at these:
|
||||
|
||||
As yet unclaimed:
|
||||
|
||||
----
|
||||
find
|
||||
doesn't understand (), lots of susv3 stuff.
|
||||
----
|
||||
diff
|
||||
Make sure we handle empty files properly:
|
||||
@@ -143,10 +137,6 @@ patch
|
||||
And while we're at it, a new patch filename quoting format is apparently
|
||||
coming soon: http://marc.theaimsgroup.com/?l=git&m=112927316408690&w=2
|
||||
---
|
||||
ps / top
|
||||
Add support for both RSS and VSIZE rather than just one or the other.
|
||||
Or make it a build option.
|
||||
---
|
||||
man
|
||||
It would be nice to have a man command. Not one that handles troff or
|
||||
anything, just one that can handle preformatted ascii man pages, possibly
|
||||
@@ -301,15 +291,15 @@ Minor stuff:
|
||||
---
|
||||
Move __get_hz() to a better place and (re)use it in route.c, ash.c, msh.c
|
||||
---
|
||||
See grep -r strtod
|
||||
Alot of duplication that wants cleanup.
|
||||
---
|
||||
|
||||
|
||||
Code cleanup:
|
||||
|
||||
Replace deprecated functions.
|
||||
|
||||
bzero() -> memset()
|
||||
---
|
||||
sigblock(), siggetmask(), sigsetmask(), sigmask() -> sigprocmask et al
|
||||
---
|
||||
vdprintf() -> similar sized functionality
|
||||
---
|
||||
+127
-66
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Busybox version: 1.9.0.svn
|
||||
# Mon Dec 24 14:21:28 2007
|
||||
# Busybox version: 1.10.0.svn
|
||||
# Thu Mar 20 14:54:21 2008
|
||||
#
|
||||
CONFIG_HAVE_DOT_CONFIG=y
|
||||
|
||||
@@ -29,7 +29,7 @@ CONFIG_FEATURE_PIDFILE=y
|
||||
CONFIG_FEATURE_SUID=y
|
||||
CONFIG_FEATURE_SUID_CONFIG=y
|
||||
CONFIG_FEATURE_SUID_CONFIG_QUIET=y
|
||||
# CONFIG_SELINUX is not set
|
||||
CONFIG_SELINUX=y
|
||||
CONFIG_FEATURE_PREFER_APPLETS=y
|
||||
CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
|
||||
CONFIG_FEATURE_SYSLOG=y
|
||||
@@ -39,6 +39,7 @@ CONFIG_FEATURE_HAVE_RPC=y
|
||||
# Build Options
|
||||
#
|
||||
# CONFIG_STATIC is not set
|
||||
CONFIG_NOMMU=y
|
||||
# CONFIG_BUILD_LIBBUSYBOX is not set
|
||||
# CONFIG_FEATURE_INDIVIDUAL is not set
|
||||
# CONFIG_FEATURE_SHARED_BUSYBOX is not set
|
||||
@@ -48,7 +49,7 @@ CONFIG_LFS=y
|
||||
# Debugging Options
|
||||
#
|
||||
# CONFIG_DEBUG is not set
|
||||
CONFIG_WERROR=y
|
||||
# CONFIG_WERROR is not set
|
||||
CONFIG_NO_DEBUG_LIB=y
|
||||
# CONFIG_DMALLOC is not set
|
||||
# CONFIG_EFENCE is not set
|
||||
@@ -72,17 +73,17 @@ CONFIG_PREFIX="./_install"
|
||||
#
|
||||
CONFIG_PASSWORD_MINLEN=6
|
||||
CONFIG_MD5_SIZE_VS_SPEED=2
|
||||
# CONFIG_FEATURE_FAST_TOP is not set
|
||||
# CONFIG_FEATURE_ETC_NETWORKS is not set
|
||||
CONFIG_FEATURE_FAST_TOP=y
|
||||
CONFIG_FEATURE_ETC_NETWORKS=y
|
||||
CONFIG_FEATURE_EDITING=y
|
||||
CONFIG_FEATURE_EDITING_MAX_LEN=1024
|
||||
# CONFIG_FEATURE_EDITING_FANCY_KEYS is not set
|
||||
# CONFIG_FEATURE_EDITING_VI is not set
|
||||
CONFIG_FEATURE_EDITING_VI=y
|
||||
CONFIG_FEATURE_EDITING_HISTORY=15
|
||||
# CONFIG_FEATURE_EDITING_SAVEHISTORY is not set
|
||||
CONFIG_FEATURE_TAB_COMPLETION=y
|
||||
CONFIG_FEATURE_USERNAME_COMPLETION=y
|
||||
CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
|
||||
CONFIG_FEATURE_VERBOSE_CP_MESSAGE=y
|
||||
CONFIG_FEATURE_COPYBUF_KB=4
|
||||
CONFIG_MONOTONIC_SYSCALL=y
|
||||
CONFIG_IOCTL_HEX2STR_ERROR=y
|
||||
@@ -101,7 +102,7 @@ CONFIG_BZIP2=y
|
||||
CONFIG_CPIO=y
|
||||
CONFIG_DPKG=y
|
||||
CONFIG_DPKG_DEB=y
|
||||
# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
|
||||
CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY=y
|
||||
CONFIG_GUNZIP=y
|
||||
CONFIG_FEATURE_GUNZIP_UNCOMPRESS=y
|
||||
CONFIG_GZIP=y
|
||||
@@ -110,15 +111,17 @@ CONFIG_RPM=y
|
||||
CONFIG_FEATURE_RPM_BZ2=y
|
||||
CONFIG_TAR=y
|
||||
CONFIG_FEATURE_TAR_CREATE=y
|
||||
CONFIG_FEATURE_TAR_GZIP=y
|
||||
CONFIG_FEATURE_TAR_BZIP2=y
|
||||
CONFIG_FEATURE_TAR_LZMA=y
|
||||
CONFIG_FEATURE_TAR_FROM=y
|
||||
CONFIG_FEATURE_TAR_GZIP=y
|
||||
CONFIG_FEATURE_TAR_COMPRESS=y
|
||||
CONFIG_FEATURE_TAR_AUTODETECT=y
|
||||
CONFIG_FEATURE_TAR_FROM=y
|
||||
CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y
|
||||
CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY=y
|
||||
CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
|
||||
CONFIG_FEATURE_TAR_LONG_OPTIONS=y
|
||||
CONFIG_FEATURE_TAR_UNAME_GNAME=y
|
||||
CONFIG_UNCOMPRESS=y
|
||||
CONFIG_UNLZMA=y
|
||||
CONFIG_FEATURE_LZMA_FAST=y
|
||||
@@ -209,6 +212,7 @@ CONFIG_FEATURE_READLINK_FOLLOW=y
|
||||
CONFIG_REALPATH=y
|
||||
CONFIG_RM=y
|
||||
CONFIG_RMDIR=y
|
||||
CONFIG_FEATURE_RMDIR_LONG_OPTIONS=y
|
||||
CONFIG_SEQ=y
|
||||
CONFIG_SHA1SUM=y
|
||||
CONFIG_SLEEP=y
|
||||
@@ -222,6 +226,7 @@ CONFIG_FEATURE_STAT_FORMAT=y
|
||||
CONFIG_STTY=y
|
||||
CONFIG_SUM=y
|
||||
CONFIG_SYNC=y
|
||||
CONFIG_TAC=y
|
||||
CONFIG_TAIL=y
|
||||
CONFIG_FEATURE_FANCY_TAIL=y
|
||||
CONFIG_TEE=y
|
||||
@@ -314,7 +319,7 @@ CONFIG_PATCH=y
|
||||
CONFIG_SED=y
|
||||
CONFIG_VI=y
|
||||
CONFIG_FEATURE_VI_MAX_LEN=4096
|
||||
# CONFIG_FEATURE_VI_8BIT is not set
|
||||
CONFIG_FEATURE_VI_8BIT=y
|
||||
CONFIG_FEATURE_VI_COLON=y
|
||||
CONFIG_FEATURE_VI_YANKMARK=y
|
||||
CONFIG_FEATURE_VI_SEARCH=y
|
||||
@@ -351,7 +356,7 @@ CONFIG_FEATURE_FIND_PRUNE=y
|
||||
CONFIG_FEATURE_FIND_DELETE=y
|
||||
CONFIG_FEATURE_FIND_PATH=y
|
||||
CONFIG_FEATURE_FIND_REGEX=y
|
||||
# CONFIG_FEATURE_FIND_CONTEXT is not set
|
||||
CONFIG_FEATURE_FIND_CONTEXT=y
|
||||
CONFIG_GREP=y
|
||||
CONFIG_FEATURE_GREP_EGREP_ALIAS=y
|
||||
CONFIG_FEATURE_GREP_FGREP_ALIAS=y
|
||||
@@ -365,14 +370,16 @@ CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
|
||||
#
|
||||
# Init Utilities
|
||||
#
|
||||
# CONFIG_INIT is not set
|
||||
CONFIG_INIT=y
|
||||
# CONFIG_DEBUG_INIT is not set
|
||||
# CONFIG_FEATURE_USE_INITTAB is not set
|
||||
# CONFIG_FEATURE_INIT_SCTTY is not set
|
||||
# CONFIG_FEATURE_INIT_SYSLOG is not set
|
||||
# CONFIG_FEATURE_EXTRA_QUIET is not set
|
||||
# CONFIG_FEATURE_INIT_COREDUMPS is not set
|
||||
# CONFIG_FEATURE_INITRD is not set
|
||||
CONFIG_FEATURE_USE_INITTAB=y
|
||||
CONFIG_FEATURE_KILL_REMOVED=y
|
||||
CONFIG_FEATURE_KILL_DELAY=1
|
||||
CONFIG_FEATURE_INIT_SCTTY=y
|
||||
CONFIG_FEATURE_INIT_SYSLOG=y
|
||||
CONFIG_FEATURE_EXTRA_QUIET=y
|
||||
CONFIG_FEATURE_INIT_COREDUMPS=y
|
||||
CONFIG_FEATURE_INITRD=y
|
||||
CONFIG_HALT=y
|
||||
CONFIG_MESG=y
|
||||
|
||||
@@ -386,7 +393,9 @@ CONFIG_ADDGROUP=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_DELUSER=y
|
||||
CONFIG_GETTY=y
|
||||
CONFIG_FEATURE_UTMP=y
|
||||
@@ -394,7 +403,7 @@ CONFIG_FEATURE_WTMP=y
|
||||
CONFIG_LOGIN=y
|
||||
# CONFIG_PAM is not set
|
||||
CONFIG_LOGIN_SCRIPTS=y
|
||||
# CONFIG_FEATURE_NOLOGIN is not set
|
||||
CONFIG_FEATURE_NOLOGIN=y
|
||||
CONFIG_FEATURE_SECURETTY=y
|
||||
CONFIG_PASSWD=y
|
||||
CONFIG_FEATURE_PASSWD_WEAK_CHECK=y
|
||||
@@ -455,6 +464,7 @@ CONFIG_FEATURE_SGI_LABEL=y
|
||||
CONFIG_FEATURE_SUN_LABEL=y
|
||||
CONFIG_FEATURE_OSF_LABEL=y
|
||||
CONFIG_FEATURE_FDISK_ADVANCED=y
|
||||
CONFIG_FINDFS=y
|
||||
CONFIG_FREERAMDISK=y
|
||||
CONFIG_FSCK_MINIX=y
|
||||
CONFIG_MKFS_MINIX=y
|
||||
@@ -465,8 +475,8 @@ CONFIG_MKFS_MINIX=y
|
||||
CONFIG_FEATURE_MINIX2=y
|
||||
CONFIG_GETOPT=y
|
||||
CONFIG_HEXDUMP=y
|
||||
CONFIG_HD=y
|
||||
CONFIG_FEATURE_HEXDUMP_REVERSE=y
|
||||
CONFIG_HD=y
|
||||
CONFIG_HWCLOCK=y
|
||||
CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS=y
|
||||
CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS=y
|
||||
@@ -475,14 +485,35 @@ CONFIG_IPCS=y
|
||||
CONFIG_LOSETUP=y
|
||||
CONFIG_MDEV=y
|
||||
CONFIG_FEATURE_MDEV_CONF=y
|
||||
CONFIG_FEATURE_MDEV_RENAME=y
|
||||
CONFIG_FEATURE_MDEV_EXEC=y
|
||||
CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
|
||||
CONFIG_MKSWAP=y
|
||||
CONFIG_FEATURE_MKSWAP_V0=y
|
||||
CONFIG_MORE=y
|
||||
CONFIG_FEATURE_USE_TERMIOS=y
|
||||
CONFIG_VOLUMEID=y
|
||||
CONFIG_FEATURE_VOLUMEID_EXT=y
|
||||
CONFIG_FEATURE_VOLUMEID_REISERFS=y
|
||||
CONFIG_FEATURE_VOLUMEID_FAT=y
|
||||
CONFIG_FEATURE_VOLUMEID_HFS=y
|
||||
CONFIG_FEATURE_VOLUMEID_JFS=y
|
||||
CONFIG_FEATURE_VOLUMEID_XFS=y
|
||||
CONFIG_FEATURE_VOLUMEID_NTFS=y
|
||||
CONFIG_FEATURE_VOLUMEID_ISO9660=y
|
||||
CONFIG_FEATURE_VOLUMEID_UDF=y
|
||||
CONFIG_FEATURE_VOLUMEID_LUKS=y
|
||||
CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y
|
||||
CONFIG_FEATURE_VOLUMEID_CRAMFS=y
|
||||
CONFIG_FEATURE_VOLUMEID_ROMFS=y
|
||||
CONFIG_FEATURE_VOLUMEID_SYSV=y
|
||||
CONFIG_FEATURE_VOLUMEID_OCFS2=y
|
||||
CONFIG_FEATURE_VOLUMEID_LINUXRAID=y
|
||||
CONFIG_MOUNT=y
|
||||
CONFIG_FEATURE_MOUNT_FAKE=y
|
||||
CONFIG_FEATURE_MOUNT_VERBOSE=y
|
||||
CONFIG_FEATURE_MOUNT_HELPERS=y
|
||||
CONFIG_FEATURE_MOUNT_LABEL=y
|
||||
CONFIG_FEATURE_MOUNT_NFS=y
|
||||
CONFIG_FEATURE_MOUNT_CIFS=y
|
||||
CONFIG_FEATURE_MOUNT_FLAGS=y
|
||||
@@ -490,6 +521,7 @@ CONFIG_FEATURE_MOUNT_FSTAB=y
|
||||
CONFIG_PIVOT_ROOT=y
|
||||
CONFIG_RDATE=y
|
||||
CONFIG_READPROFILE=y
|
||||
CONFIG_RTCWAKE=y
|
||||
CONFIG_SETARCH=y
|
||||
CONFIG_SWAPONOFF=y
|
||||
CONFIG_SWITCH_ROOT=y
|
||||
@@ -506,12 +538,20 @@ CONFIG_FEATURE_MOUNT_LOOP=y
|
||||
# Miscellaneous Utilities
|
||||
#
|
||||
CONFIG_ADJTIMEX=y
|
||||
# CONFIG_BBCONFIG is not set
|
||||
CONFIG_BBCONFIG=y
|
||||
CONFIG_CHAT=y
|
||||
CONFIG_FEATURE_CHAT_NOFAIL=y
|
||||
CONFIG_FEATURE_CHAT_TTY_HIFI=y
|
||||
CONFIG_FEATURE_CHAT_IMPLICIT_CR=y
|
||||
CONFIG_FEATURE_CHAT_SWALLOW_OPTS=y
|
||||
CONFIG_FEATURE_CHAT_SEND_ESCAPES=y
|
||||
CONFIG_FEATURE_CHAT_VAR_ABORT_LEN=y
|
||||
CONFIG_FEATURE_CHAT_CLR_ABORT=y
|
||||
CONFIG_CHRT=y
|
||||
# CONFIG_CROND is not set
|
||||
# CONFIG_DEBUG_CROND_OPTION is not set
|
||||
# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set
|
||||
# CONFIG_CRONTAB is not set
|
||||
CONFIG_CROND=y
|
||||
CONFIG_DEBUG_CROND_OPTION=y
|
||||
CONFIG_FEATURE_CROND_CALL_SENDMAIL=y
|
||||
CONFIG_CRONTAB=y
|
||||
CONFIG_DC=y
|
||||
# CONFIG_DEVFSD is not set
|
||||
# CONFIG_DEVFSD_MODLOAD is not set
|
||||
@@ -519,6 +559,7 @@ CONFIG_DC=y
|
||||
# CONFIG_DEVFSD_VERBOSE is not set
|
||||
# CONFIG_FEATURE_DEVFS is not set
|
||||
CONFIG_EJECT=y
|
||||
CONFIG_FEATURE_EJECT_SCSI=y
|
||||
CONFIG_LAST=y
|
||||
CONFIG_LESS=y
|
||||
CONFIG_FEATURE_LESS_MAXLINES=9999999
|
||||
@@ -544,6 +585,7 @@ CONFIG_RAIDAUTORUN=y
|
||||
CONFIG_READAHEAD=y
|
||||
CONFIG_RUNLEVEL=y
|
||||
CONFIG_RX=y
|
||||
CONFIG_SCRIPT=y
|
||||
CONFIG_STRINGS=y
|
||||
CONFIG_SETSID=y
|
||||
CONFIG_TASKSET=y
|
||||
@@ -560,6 +602,8 @@ CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
|
||||
CONFIG_VERBOSE_RESOLUTION_ERRORS=y
|
||||
CONFIG_ARP=y
|
||||
CONFIG_ARPING=y
|
||||
CONFIG_BRCTL=y
|
||||
CONFIG_FEATURE_BRCTL_FANCY=y
|
||||
CONFIG_DNSD=y
|
||||
CONFIG_ETHER_WAKE=y
|
||||
CONFIG_FAKEIDENTD=y
|
||||
@@ -587,22 +631,23 @@ CONFIG_FEATURE_IFCONFIG_SLIP=y
|
||||
CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y
|
||||
CONFIG_FEATURE_IFCONFIG_HW=y
|
||||
CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y
|
||||
# CONFIG_IFUPDOWN is not set
|
||||
CONFIG_IFUPDOWN_IFSTATE_PATH=""
|
||||
# CONFIG_FEATURE_IFUPDOWN_IP is not set
|
||||
# CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN is not set
|
||||
CONFIG_IFENSLAVE=y
|
||||
CONFIG_IFUPDOWN=y
|
||||
CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate"
|
||||
CONFIG_FEATURE_IFUPDOWN_IP=y
|
||||
CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y
|
||||
# CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set
|
||||
# CONFIG_FEATURE_IFUPDOWN_IPV4 is not set
|
||||
# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set
|
||||
# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
|
||||
# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
|
||||
# CONFIG_INETD is not set
|
||||
# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
|
||||
# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set
|
||||
# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set
|
||||
# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set
|
||||
# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
|
||||
# CONFIG_FEATURE_INETD_RPC is not set
|
||||
CONFIG_FEATURE_IFUPDOWN_IPV4=y
|
||||
CONFIG_FEATURE_IFUPDOWN_IPV6=y
|
||||
CONFIG_FEATURE_IFUPDOWN_MAPPING=y
|
||||
CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP=y
|
||||
CONFIG_INETD=y
|
||||
CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO=y
|
||||
CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD=y
|
||||
CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME=y
|
||||
CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME=y
|
||||
CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN=y
|
||||
CONFIG_FEATURE_INETD_RPC=y
|
||||
CONFIG_IP=y
|
||||
CONFIG_FEATURE_IP_ADDRESS=y
|
||||
CONFIG_FEATURE_IP_LINK=y
|
||||
@@ -629,9 +674,11 @@ CONFIG_FEATURE_NETSTAT_WIDE=y
|
||||
CONFIG_NSLOOKUP=y
|
||||
CONFIG_PING=y
|
||||
CONFIG_PING6=y
|
||||
CONFIG_PSCAN=y
|
||||
CONFIG_FEATURE_FANCY_PING=y
|
||||
CONFIG_PSCAN=y
|
||||
CONFIG_ROUTE=y
|
||||
CONFIG_SENDMAIL=y
|
||||
CONFIG_FETCHMAIL=y
|
||||
CONFIG_SLATTACH=y
|
||||
CONFIG_TELNET=y
|
||||
CONFIG_FEATURE_TELNET_TTYPE=y
|
||||
@@ -639,10 +686,11 @@ CONFIG_FEATURE_TELNET_AUTOLOGIN=y
|
||||
CONFIG_TELNETD=y
|
||||
CONFIG_FEATURE_TELNETD_STANDALONE=y
|
||||
CONFIG_TFTP=y
|
||||
CONFIG_TFTPD=y
|
||||
CONFIG_FEATURE_TFTP_GET=y
|
||||
CONFIG_FEATURE_TFTP_PUT=y
|
||||
CONFIG_FEATURE_TFTP_BLOCKSIZE=y
|
||||
# CONFIG_DEBUG_TFTP is not set
|
||||
CONFIG_DEBUG_TFTP=y
|
||||
CONFIG_TRACEROUTE=y
|
||||
CONFIG_FEATURE_TRACEROUTE_VERBOSE=y
|
||||
CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE=y
|
||||
@@ -651,10 +699,13 @@ CONFIG_APP_UDHCPD=y
|
||||
CONFIG_APP_DHCPRELAY=y
|
||||
CONFIG_APP_DUMPLEASES=y
|
||||
CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY=y
|
||||
CONFIG_DHCPD_LEASES_FILE="/var/lib/misc/udhcpd.leases"
|
||||
CONFIG_APP_UDHCPC=y
|
||||
CONFIG_FEATURE_UDHCPC_ARPING=y
|
||||
CONFIG_FEATURE_UDHCP_PORT=y
|
||||
CONFIG_FEATURE_UDHCP_DEBUG=y
|
||||
CONFIG_FEATURE_RFC3397=y
|
||||
CONFIG_DHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
|
||||
CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
|
||||
CONFIG_VCONFIG=y
|
||||
CONFIG_WGET=y
|
||||
@@ -662,6 +713,8 @@ CONFIG_FEATURE_WGET_STATUSBAR=y
|
||||
CONFIG_FEATURE_WGET_AUTHENTICATION=y
|
||||
CONFIG_FEATURE_WGET_LONG_OPTIONS=y
|
||||
CONFIG_ZCIP=y
|
||||
CONFIG_TCPSVD=y
|
||||
CONFIG_UDPSVD=y
|
||||
|
||||
#
|
||||
# Process Utilities
|
||||
@@ -679,6 +732,8 @@ CONFIG_FEATURE_PIDOF_OMIT=y
|
||||
CONFIG_PKILL=y
|
||||
CONFIG_PS=y
|
||||
CONFIG_FEATURE_PS_WIDE=y
|
||||
CONFIG_FEATURE_PS_TIME=y
|
||||
CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS=y
|
||||
CONFIG_RENICE=y
|
||||
CONFIG_BB_SYSCTL=y
|
||||
CONFIG_TOP=y
|
||||
@@ -713,8 +768,8 @@ CONFIG_FEATURE_SH_IS_NONE=y
|
||||
# CONFIG_ASH_EXPAND_PRMT is not set
|
||||
CONFIG_HUSH=y
|
||||
CONFIG_HUSH_HELP=y
|
||||
# CONFIG_HUSH_INTERACTIVE is not set
|
||||
# CONFIG_HUSH_JOB is not set
|
||||
CONFIG_HUSH_INTERACTIVE=y
|
||||
CONFIG_HUSH_JOB=y
|
||||
CONFIG_HUSH_TICK=y
|
||||
CONFIG_HUSH_IF=y
|
||||
CONFIG_HUSH_LOOPS=y
|
||||
@@ -734,6 +789,7 @@ CONFIG_CTTYHACK=y
|
||||
CONFIG_SYSLOGD=y
|
||||
CONFIG_FEATURE_ROTATE_LOGFILE=y
|
||||
CONFIG_FEATURE_REMOTE_LOG=y
|
||||
CONFIG_FEATURE_SYSLOGD_DUP=y
|
||||
CONFIG_FEATURE_IPC_SYSLOG=y
|
||||
CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16
|
||||
CONFIG_LOGREAD=y
|
||||
@@ -744,33 +800,38 @@ CONFIG_LOGGER=y
|
||||
#
|
||||
# Runit Utilities
|
||||
#
|
||||
# CONFIG_RUNSV is not set
|
||||
CONFIG_RUNSV=y
|
||||
CONFIG_RUNSVDIR=y
|
||||
CONFIG_SV=y
|
||||
# CONFIG_SVLOGD is not set
|
||||
CONFIG_SVLOGD=y
|
||||
CONFIG_CHPST=y
|
||||
CONFIG_SETUIDGID=y
|
||||
CONFIG_ENVUIDGID=y
|
||||
CONFIG_ENVDIR=y
|
||||
CONFIG_SOFTLIMIT=y
|
||||
# CONFIG_CHCON is not set
|
||||
# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set
|
||||
# CONFIG_GETENFORCE is not set
|
||||
# CONFIG_GETSEBOOL is not set
|
||||
# CONFIG_LOAD_POLICY is not set
|
||||
# CONFIG_MATCHPATHCON is not set
|
||||
# CONFIG_RESTORECON is not set
|
||||
# CONFIG_RUNCON is not set
|
||||
# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set
|
||||
# CONFIG_SELINUXENABLED is not set
|
||||
# CONFIG_SETENFORCE is not set
|
||||
# CONFIG_SETFILES is not set
|
||||
# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set
|
||||
# CONFIG_SETSEBOOL is not set
|
||||
# CONFIG_SESTATUS is not set
|
||||
|
||||
#
|
||||
# ipsvd utilities
|
||||
# Selinux Utilities
|
||||
#
|
||||
# CONFIG_TCPSVD is not set
|
||||
# CONFIG_UDPSVD is not set
|
||||
CONFIG_CHCON=y
|
||||
CONFIG_FEATURE_CHCON_LONG_OPTIONS=y
|
||||
CONFIG_GETENFORCE=y
|
||||
CONFIG_GETSEBOOL=y
|
||||
CONFIG_LOAD_POLICY=y
|
||||
CONFIG_MATCHPATHCON=y
|
||||
CONFIG_RESTORECON=y
|
||||
CONFIG_RUNCON=y
|
||||
CONFIG_FEATURE_RUNCON_LONG_OPTIONS=y
|
||||
CONFIG_SELINUXENABLED=y
|
||||
CONFIG_SETENFORCE=y
|
||||
CONFIG_SETFILES=y
|
||||
CONFIG_FEATURE_SETFILES_CHECK_OPTION=y
|
||||
CONFIG_SETSEBOOL=y
|
||||
CONFIG_SESTATUS=y
|
||||
|
||||
#
|
||||
# Print Utilities
|
||||
#
|
||||
CONFIG_LPD=y
|
||||
CONFIG_LPR=y
|
||||
CONFIG_LPQ=y
|
||||
@@ -32,7 +32,7 @@ struct bb_applet {
|
||||
/* Define struct bb_applet applets[] */
|
||||
#include "../include/applets.h"
|
||||
|
||||
enum { NUM_APPLETS = sizeof(applets)/sizeof(applets[0]) };
|
||||
enum { NUM_APPLETS = ARRAY_SIZE(applets) };
|
||||
|
||||
static int offset[NUM_APPLETS];
|
||||
|
||||
@@ -71,7 +71,7 @@ int main(int argc, char **argv)
|
||||
|
||||
puts("/* This is a generated file, don't edit */");
|
||||
|
||||
puts("const char applet_names[] ALIGN1 = \"\" \n");
|
||||
puts("const char applet_names[] ALIGN1 = \"\"\n");
|
||||
for (i = 0; i < NUM_APPLETS; i++) {
|
||||
printf("\"%s\" \"\\0\"\n", applets[i].name);
|
||||
}
|
||||
@@ -92,7 +92,7 @@ int main(int argc, char **argv)
|
||||
+ (applets[i].noexec << 13)
|
||||
#endif
|
||||
#if ENABLE_FEATURE_SUID
|
||||
+ (applets[i].need_suid << 14) /* 2 bits */
|
||||
+ (applets[i].need_suid << 14) /* 2 bits */
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
+2
-13
@@ -10,20 +10,9 @@
|
||||
#include <assert.h>
|
||||
#include "busybox.h"
|
||||
|
||||
/* Apparently uclibc defines __GLIBC__ (compat trick?). Oh well. */
|
||||
#if ENABLE_STATIC && defined(__GLIBC__) && !defined(__UCLIBC__)
|
||||
#warning Static linking against glibc produces buggy executables
|
||||
#warning (glibc does not cope well with ld --gc-sections).
|
||||
#warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400
|
||||
#warning Note that glibc is unsuitable for static linking anyway.
|
||||
#warning If you still want to do it, remove -Wl,--gc-sections
|
||||
#warning from scripts/trylink and remove this warning.
|
||||
#error Aborting compilation.
|
||||
#endif
|
||||
|
||||
#if ENABLE_BUILD_LIBBUSYBOX
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
return lbb_main(argc, argv);
|
||||
return lbb_main(argv);
|
||||
}
|
||||
#endif
|
||||
@@ -12,8 +12,16 @@ sz=`"$loc/usage" | wc -c` || exit 1
|
||||
|
||||
exec >"$target"
|
||||
|
||||
echo 'static const char packed_usage[] ALIGN1 = '
|
||||
"$loc/usage" | bzip2 -1 | od -v -t x1 \
|
||||
| $SED -e 's/^[^ ]*//' -e 's/ *\(..\)/\\x\1/g' -e 's/^\(.*\)$/"\1"/'
|
||||
echo ';'
|
||||
echo 'static const char packed_usage[] ALIGN1 = {'
|
||||
|
||||
# Extra effort to avoid using "od -t x1": -t is not available
|
||||
# in non-CONFIG_DESKTOPed busybox od
|
||||
|
||||
"$loc/usage" | bzip2 -1 | od -v -x \
|
||||
| $SED -e 's/^[^ ]*//' \
|
||||
| $SED -e 's/ //g' \
|
||||
| grep -v '^$' \
|
||||
| $SED -e 's/\(..\)\(..\)/0x\2,0x\1,/g'
|
||||
|
||||
echo '};'
|
||||
echo '#define SIZEOF_usage_messages' `expr 0 + $sz`
|
||||
+38
-21
@@ -29,7 +29,7 @@ config AR
|
||||
probably say N here.
|
||||
|
||||
config FEATURE_AR_LONG_FILENAMES
|
||||
bool "Enable support for long filenames (not need for debs)"
|
||||
bool "Support for long filenames (not need for debs)"
|
||||
default n
|
||||
depends on AR
|
||||
help
|
||||
@@ -99,7 +99,7 @@ config DPKG_DEB
|
||||
probably say N here.
|
||||
|
||||
config FEATURE_DPKG_DEB_EXTRACT_ONLY
|
||||
bool "extract only (-x)"
|
||||
bool "Extract only (-x)"
|
||||
default n
|
||||
depends on DPKG_DEB
|
||||
help
|
||||
@@ -166,6 +166,14 @@ config FEATURE_TAR_CREATE
|
||||
If you enable this option you'll be able to create
|
||||
tar archives using the `-c' option.
|
||||
|
||||
config FEATURE_TAR_GZIP
|
||||
bool "Enable -z option"
|
||||
default y
|
||||
depends on TAR
|
||||
help
|
||||
If you enable this option tar will be able to call gzip,
|
||||
when creating or extracting tar gziped archives.
|
||||
|
||||
config FEATURE_TAR_BZIP2
|
||||
bool "Enable -j option to handle .tar.bz2 files"
|
||||
default n
|
||||
@@ -182,22 +190,6 @@ config FEATURE_TAR_LZMA
|
||||
If you enable this option you'll be able to extract
|
||||
archives compressed with lzma.
|
||||
|
||||
config FEATURE_TAR_FROM
|
||||
bool "Enable -X (exclude from) and -T (include from) options)"
|
||||
default n
|
||||
depends on TAR
|
||||
help
|
||||
If you enable this option you'll be able to specify
|
||||
a list of files to include or exclude from an archive.
|
||||
|
||||
config FEATURE_TAR_GZIP
|
||||
bool "Enable -z option"
|
||||
default y
|
||||
depends on TAR
|
||||
help
|
||||
If you enable this option tar will be able to call gzip,
|
||||
when creating or extracting tar gziped archives.
|
||||
|
||||
config FEATURE_TAR_COMPRESS
|
||||
bool "Enable -Z option"
|
||||
default n
|
||||
@@ -206,8 +198,24 @@ config FEATURE_TAR_COMPRESS
|
||||
If you enable this option tar will be able to call uncompress,
|
||||
when extracting .tar.Z archives.
|
||||
|
||||
config FEATURE_TAR_AUTODETECT
|
||||
bool "Let tar autodetect gz/bz2 compresses tarballs"
|
||||
default n
|
||||
depends on FEATURE_TAR_GZIP || FEATURE_TAR_BZIP2
|
||||
help
|
||||
With this option tar can automatically detect gzip/bzip2 compressed
|
||||
tarballs. Currently it works only on seekable streams.
|
||||
|
||||
config FEATURE_TAR_FROM
|
||||
bool "Enable -X (exclude from) and -T (include from) options)"
|
||||
default n
|
||||
depends on TAR
|
||||
help
|
||||
If you enable this option you'll be able to specify
|
||||
a list of files to include or exclude from an archive.
|
||||
|
||||
config FEATURE_TAR_OLDGNU_COMPATIBILITY
|
||||
bool "Enable support for old tar header format"
|
||||
bool "Support for old tar header format"
|
||||
default N
|
||||
depends on TAR
|
||||
help
|
||||
@@ -225,7 +233,7 @@ config FEATURE_TAR_OLDSUN_COMPATIBILITY
|
||||
It is said to be fixed in newer Sun tar, but "old" tarballs still exist.
|
||||
|
||||
config FEATURE_TAR_GNU_EXTENSIONS
|
||||
bool "Enable support for some GNU tar extensions"
|
||||
bool "Support for GNU tar extensions (long filenames)"
|
||||
default y
|
||||
depends on TAR
|
||||
help
|
||||
@@ -237,7 +245,16 @@ config FEATURE_TAR_LONG_OPTIONS
|
||||
default n
|
||||
depends on TAR && GETOPT_LONG
|
||||
help
|
||||
Enable use of long options, increases size by about 400 Bytes
|
||||
Enable use of long options, increases size by about 400 Bytes
|
||||
|
||||
config FEATURE_TAR_UNAME_GNAME
|
||||
bool "Enable use of user and group names"
|
||||
default n
|
||||
depends on TAR
|
||||
help
|
||||
Enables use of user and group names in tar. This affects contents
|
||||
listings (-t) and preserving permissions when unpacking (-p).
|
||||
+200 bytes.
|
||||
|
||||
config UNCOMPRESS
|
||||
bool "uncompress"
|
||||
|
||||
+4
-4
@@ -159,7 +159,7 @@ USE_DESKTOP(long long) int unpack_bunzip2(void)
|
||||
}
|
||||
|
||||
int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int bunzip2_main(int argc, char **argv)
|
||||
int bunzip2_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
getopt32(argv, "cfvdt");
|
||||
argv += optind;
|
||||
@@ -257,7 +257,7 @@ USE_DESKTOP(long long) int unpack_gunzip(void)
|
||||
}
|
||||
|
||||
int gunzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int gunzip_main(int argc, char **argv)
|
||||
int gunzip_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
getopt32(argv, "cfvdt");
|
||||
argv += optind;
|
||||
@@ -295,7 +295,7 @@ USE_DESKTOP(long long) int unpack_unlzma(void)
|
||||
}
|
||||
|
||||
int unlzma_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int unlzma_main(int argc, char **argv)
|
||||
int unlzma_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
getopt32(argv, "cf");
|
||||
argv += optind;
|
||||
@@ -337,7 +337,7 @@ USE_DESKTOP(long long) int unpack_uncompress(void)
|
||||
}
|
||||
|
||||
int uncompress_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int uncompress_main(int argc, char **argv)
|
||||
int uncompress_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
getopt32(argv, "cf");
|
||||
argv += optind;
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ char* make_new_name_bzip2(char *filename)
|
||||
}
|
||||
|
||||
int bzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int bzip2_main(int argc, char **argv)
|
||||
int bzip2_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
unsigned opt;
|
||||
|
||||
|
||||
+9
-13
@@ -602,7 +602,7 @@ static unsigned fill_package_struct(char *control_buffer)
|
||||
&field_name, &field_value);
|
||||
|
||||
if (field_name == NULL) {
|
||||
goto fill_package_struct_cleanup; /* Oh no, the dreaded goto statement! */
|
||||
goto fill_package_struct_cleanup;
|
||||
}
|
||||
|
||||
field_num = index_in_strings(field_names, field_name);
|
||||
@@ -745,7 +745,7 @@ static void index_status_file(const char *filename)
|
||||
unsigned status_num;
|
||||
|
||||
status_file = xfopen(filename, "r");
|
||||
while ((control_buffer = xmalloc_fgets_str(status_file, "\n\n")) != NULL) {
|
||||
while ((control_buffer = xmalloc_fgetline_str(status_file, "\n\n")) != NULL) {
|
||||
const unsigned package_num = fill_package_struct(control_buffer);
|
||||
if (package_num != -1) {
|
||||
status_node = xmalloc(sizeof(status_node_t));
|
||||
@@ -798,7 +798,7 @@ static void write_status_file(deb_file_t **deb_file)
|
||||
int i = 0;
|
||||
|
||||
/* Update previously known packages */
|
||||
while ((control_buffer = xmalloc_fgets_str(old_status_file, "\n\n")) != NULL) {
|
||||
while ((control_buffer = xmalloc_fgetline_str(old_status_file, "\n\n")) != NULL) {
|
||||
tmp_string = strstr(control_buffer, "Package:");
|
||||
if (tmp_string == NULL) {
|
||||
continue;
|
||||
@@ -913,20 +913,16 @@ static void write_status_file(deb_file_t **deb_file)
|
||||
fclose(old_status_file);
|
||||
fclose(new_status_file);
|
||||
|
||||
|
||||
/* Create a separate backfile to dpkg */
|
||||
if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) {
|
||||
struct stat stat_buf;
|
||||
xstat("/var/lib/dpkg/status", &stat_buf);
|
||||
if (errno != ENOENT)
|
||||
bb_error_msg_and_die("cannot create backup status file");
|
||||
/* Its ok if renaming the status file fails because status
|
||||
* file doesnt exist, maybe we are starting from scratch */
|
||||
bb_error_msg("no status file found, creating new one");
|
||||
}
|
||||
|
||||
if (rename("/var/lib/dpkg/status.udeb", "/var/lib/dpkg/status") == -1) {
|
||||
bb_error_msg_and_die("DANGER: cannot create status file, "
|
||||
"you need to manually repair your status file");
|
||||
}
|
||||
xrename("/var/lib/dpkg/status.udeb", "/var/lib/dpkg/status");
|
||||
}
|
||||
|
||||
/* This function returns TRUE if the given package can satisfy a
|
||||
@@ -953,7 +949,7 @@ static int package_satisfies_dependency(int package, int depend_type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
|
||||
static int check_deps(deb_file_t **deb_file, int deb_start /*, int dep_max_count - ?? */)
|
||||
{
|
||||
int *conflicts = NULL;
|
||||
int conflicts_num = 0;
|
||||
@@ -1344,7 +1340,7 @@ static void remove_package(const unsigned package_num, int noisy)
|
||||
free_array(exclude_files);
|
||||
|
||||
/* rename <package>.conffile to <package>.list */
|
||||
rename(conffile_name, list_name);
|
||||
xrename(conffile_name, list_name);
|
||||
|
||||
/* Change package status */
|
||||
set_status(status_num, "config-files", 3);
|
||||
@@ -1693,7 +1689,7 @@ int dpkg_main(int argc, char **argv)
|
||||
|
||||
/* Check that the deb file arguments are installable */
|
||||
if (!(opt & OPT_force_ignore_depends)) {
|
||||
if (!check_deps(deb_file, 0, deb_count)) {
|
||||
if (!check_deps(deb_file, 0 /*, deb_count*/)) {
|
||||
bb_error_msg_and_die("dependency check failed");
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -2026,7 +2026,11 @@ USE_DESKTOP(long long) int pack_gzip(void)
|
||||
}
|
||||
|
||||
int gzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
#if ENABLE_GUNZIP
|
||||
int gzip_main(int argc, char **argv)
|
||||
#else
|
||||
int gzip_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
#endif
|
||||
{
|
||||
unsigned opt;
|
||||
|
||||
@@ -2042,8 +2046,8 @@ int gzip_main(int argc, char **argv)
|
||||
//if (opt & 0x4) // -v
|
||||
argv += optind;
|
||||
|
||||
PTR_TO_GLOBALS = xzalloc(sizeof(struct globals) + sizeof(struct globals2))
|
||||
+ sizeof(struct globals);
|
||||
SET_PTR_TO_GLOBALS(xzalloc(sizeof(struct globals) + sizeof(struct globals2))
|
||||
+ sizeof(struct globals));
|
||||
G2.l_desc.dyn_tree = G2.dyn_ltree;
|
||||
G2.l_desc.static_tree = G2.static_ltree;
|
||||
G2.l_desc.extra_bits = extra_lbits;
|
||||
|
||||
@@ -3,14 +3,12 @@
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
//#include <sys/types.h>
|
||||
|
||||
#include "libbb.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
void data_align(archive_handle_t *archive_handle, const unsigned short boundary)
|
||||
void data_align(archive_handle_t *archive_handle, unsigned boundary)
|
||||
{
|
||||
const unsigned short skip_amount = (boundary - (archive_handle->offset % boundary)) % boundary;
|
||||
unsigned skip_amount = (boundary - (archive_handle->offset % boundary)) % boundary;
|
||||
|
||||
archive_handle->seek(archive_handle, skip_amount);
|
||||
archive_handle->offset += skip_amount;
|
||||
|
||||
@@ -112,7 +112,22 @@ void data_extract_all(archive_handle_t *archive_handle)
|
||||
}
|
||||
|
||||
if (!(archive_handle->flags & ARCHIVE_NOPRESERVE_OWN)) {
|
||||
#if ENABLE_FEATURE_TAR_UNAME_GNAME
|
||||
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);
|
||||
#endif
|
||||
}
|
||||
if ((file_header->mode & S_IFMT) != S_IFLNK) {
|
||||
/* uclibc has no lchmod, glibc is even stranger -
|
||||
|
||||
@@ -282,14 +282,16 @@ unpack_lzma_stream(int src_fd, int dst_fd)
|
||||
while (global_pos + buffer_pos < header.dst_size) {
|
||||
int pos_state = (buffer_pos + global_pos) & pos_state_mask;
|
||||
|
||||
prob =
|
||||
p + LZMA_IS_MATCH + (state << LZMA_NUM_POS_BITS_MAX) + pos_state;
|
||||
prob = p + LZMA_IS_MATCH + (state << LZMA_NUM_POS_BITS_MAX) + pos_state;
|
||||
if (rc_is_bit_0(rc, prob)) {
|
||||
mi = 1;
|
||||
rc_update_bit_0(rc, prob);
|
||||
prob = (p + LZMA_LITERAL + (LZMA_LIT_SIZE
|
||||
* ((((buffer_pos + global_pos) & literal_pos_mask) << lc)
|
||||
+ (previous_byte >> (8 - lc)))));
|
||||
prob = (p + LZMA_LITERAL
|
||||
+ (LZMA_LIT_SIZE * ((((buffer_pos + global_pos) & literal_pos_mask) << lc)
|
||||
+ (previous_byte >> (8 - lc))
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (state >= LZMA_NUM_LIT_STATES) {
|
||||
int match_byte;
|
||||
@@ -304,21 +306,25 @@ unpack_lzma_stream(int src_fd, int dst_fd)
|
||||
match_byte <<= 1;
|
||||
bit = match_byte & 0x100;
|
||||
prob_lit = prob + 0x100 + bit + mi;
|
||||
if (rc_get_bit(rc, prob_lit, &mi)) {
|
||||
if (!bit)
|
||||
break;
|
||||
} else {
|
||||
if (bit)
|
||||
break;
|
||||
}
|
||||
bit ^= (rc_get_bit(rc, prob_lit, &mi) << 8); /* 0x100 or 0 */
|
||||
if (bit)
|
||||
break;
|
||||
} while (mi < 0x100);
|
||||
}
|
||||
while (mi < 0x100) {
|
||||
prob_lit = prob + mi;
|
||||
rc_get_bit(rc, prob_lit, &mi);
|
||||
}
|
||||
previous_byte = (uint8_t) mi;
|
||||
|
||||
state -= 3;
|
||||
if (state < 4-3)
|
||||
state = 0;
|
||||
if (state >= 10-3)
|
||||
state -= 6-3;
|
||||
|
||||
previous_byte = (uint8_t) mi;
|
||||
#if ENABLE_FEATURE_LZMA_FAST
|
||||
one_byte1:
|
||||
buffer[buffer_pos++] = previous_byte;
|
||||
if (buffer_pos == header.dict_size) {
|
||||
buffer_pos = 0;
|
||||
@@ -327,12 +333,10 @@ unpack_lzma_stream(int src_fd, int dst_fd)
|
||||
goto bad;
|
||||
USE_DESKTOP(total_written += header.dict_size;)
|
||||
}
|
||||
if (state < 4)
|
||||
state = 0;
|
||||
else if (state < 10)
|
||||
state -= 3;
|
||||
else
|
||||
state -= 6;
|
||||
#else
|
||||
len = 1;
|
||||
goto one_byte2;
|
||||
#endif
|
||||
} else {
|
||||
int offset;
|
||||
uint16_t *prob_len;
|
||||
@@ -352,24 +356,23 @@ unpack_lzma_stream(int src_fd, int dst_fd)
|
||||
if (rc_is_bit_0(rc, prob)) {
|
||||
rc_update_bit_0(rc, prob);
|
||||
prob = (p + LZMA_IS_REP_0_LONG
|
||||
+ (state << LZMA_NUM_POS_BITS_MAX) + pos_state);
|
||||
+ (state << LZMA_NUM_POS_BITS_MAX)
|
||||
+ pos_state
|
||||
);
|
||||
if (rc_is_bit_0(rc, prob)) {
|
||||
rc_update_bit_0(rc, prob);
|
||||
|
||||
state = state < LZMA_NUM_LIT_STATES ? 9 : 11;
|
||||
#if ENABLE_FEATURE_LZMA_FAST
|
||||
pos = buffer_pos - rep0;
|
||||
while (pos >= header.dict_size)
|
||||
pos += header.dict_size;
|
||||
previous_byte = buffer[pos];
|
||||
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) != header.dict_size)
|
||||
goto bad;
|
||||
USE_DESKTOP(total_written += header.dict_size;)
|
||||
}
|
||||
continue;
|
||||
goto one_byte1;
|
||||
#else
|
||||
len = 1;
|
||||
goto string;
|
||||
#endif
|
||||
} else {
|
||||
rc_update_bit_1(rc, prob);
|
||||
}
|
||||
@@ -405,7 +408,7 @@ unpack_lzma_stream(int src_fd, int dst_fd)
|
||||
if (rc_is_bit_0(rc, prob_len)) {
|
||||
rc_update_bit_0(rc, prob_len);
|
||||
prob_len = (prob + LZMA_LEN_LOW
|
||||
+ (pos_state << LZMA_LEN_NUM_LOW_BITS));
|
||||
+ (pos_state << LZMA_LEN_NUM_LOW_BITS));
|
||||
offset = 0;
|
||||
num_bits = LZMA_LEN_NUM_LOW_BITS;
|
||||
} else {
|
||||
@@ -414,14 +417,14 @@ unpack_lzma_stream(int src_fd, int dst_fd)
|
||||
if (rc_is_bit_0(rc, prob_len)) {
|
||||
rc_update_bit_0(rc, prob_len);
|
||||
prob_len = (prob + LZMA_LEN_MID
|
||||
+ (pos_state << LZMA_LEN_NUM_MID_BITS));
|
||||
+ (pos_state << LZMA_LEN_NUM_MID_BITS));
|
||||
offset = 1 << LZMA_LEN_NUM_LOW_BITS;
|
||||
num_bits = LZMA_LEN_NUM_MID_BITS;
|
||||
} else {
|
||||
rc_update_bit_1(rc, prob_len);
|
||||
prob_len = prob + LZMA_LEN_HIGH;
|
||||
offset = ((1 << LZMA_LEN_NUM_LOW_BITS)
|
||||
+ (1 << LZMA_LEN_NUM_MID_BITS));
|
||||
+ (1 << LZMA_LEN_NUM_MID_BITS));
|
||||
num_bits = LZMA_LEN_NUM_HIGH_BITS;
|
||||
}
|
||||
}
|
||||
@@ -432,12 +435,10 @@ unpack_lzma_stream(int src_fd, int dst_fd)
|
||||
int pos_slot;
|
||||
|
||||
state += LZMA_NUM_LIT_STATES;
|
||||
prob =
|
||||
p + LZMA_POS_SLOT +
|
||||
((len <
|
||||
LZMA_NUM_LEN_TO_POS_STATES ? len :
|
||||
LZMA_NUM_LEN_TO_POS_STATES - 1)
|
||||
<< LZMA_NUM_POS_SLOT_BITS);
|
||||
prob = p + LZMA_POS_SLOT +
|
||||
((len < LZMA_NUM_LEN_TO_POS_STATES ? len :
|
||||
LZMA_NUM_LEN_TO_POS_STATES - 1)
|
||||
<< LZMA_NUM_POS_SLOT_BITS);
|
||||
rc_bit_tree_decode(rc, prob, LZMA_NUM_POS_SLOT_BITS,
|
||||
&pos_slot);
|
||||
if (pos_slot >= LZMA_START_POS_MODEL_INDEX) {
|
||||
@@ -468,12 +469,13 @@ unpack_lzma_stream(int src_fd, int dst_fd)
|
||||
}
|
||||
|
||||
len += LZMA_MATCH_MIN_LEN;
|
||||
|
||||
SKIP_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:)
|
||||
buffer[buffer_pos++] = previous_byte;
|
||||
if (buffer_pos == header.dict_size) {
|
||||
buffer_pos = 0;
|
||||
@@ -487,7 +489,6 @@ unpack_lzma_stream(int src_fd, int dst_fd)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (full_write(dst_fd, buffer, buffer_pos) != buffer_pos) {
|
||||
bad:
|
||||
rc_free(rc);
|
||||
|
||||
@@ -85,7 +85,8 @@ typedef struct state_t {
|
||||
|
||||
/* input (compressed) data */
|
||||
unsigned char *bytebuffer; /* buffer itself */
|
||||
unsigned bytebuffer_max; /* buffer size */
|
||||
off_t to_read; /* compressed bytes to read (unzip only, -1 for gunzip) */
|
||||
// unsigned bytebuffer_max; /* buffer size */
|
||||
unsigned bytebuffer_offset; /* buffer position */
|
||||
unsigned bytebuffer_size; /* how much data is there (size <= max) */
|
||||
|
||||
@@ -126,7 +127,10 @@ typedef struct state_t {
|
||||
#define gunzip_crc_table (S()gunzip_crc_table )
|
||||
#define gunzip_bb (S()gunzip_bb )
|
||||
#define gunzip_bk (S()gunzip_bk )
|
||||
#define bytebuffer_max (S()bytebuffer_max )
|
||||
#define to_read (S()to_read )
|
||||
// #define bytebuffer_max (S()bytebuffer_max )
|
||||
// Both gunzip and unzip can use constant buffer size now (16k):
|
||||
#define bytebuffer_max 0x4000
|
||||
#define bytebuffer (S()bytebuffer )
|
||||
#define bytebuffer_offset (S()bytebuffer_offset )
|
||||
#define bytebuffer_size (S()bytebuffer_size )
|
||||
@@ -251,13 +255,18 @@ static unsigned fill_bitbuffer(STATE_PARAM unsigned bitbuffer, unsigned *current
|
||||
{
|
||||
while (*current < required) {
|
||||
if (bytebuffer_offset >= bytebuffer_size) {
|
||||
unsigned sz = bytebuffer_max - 4;
|
||||
if (to_read >= 0 && to_read < sz) /* unzip only */
|
||||
sz = to_read;
|
||||
/* Leave the first 4 bytes empty so we can always unwind the bitbuffer
|
||||
* to the front of the bytebuffer */
|
||||
bytebuffer_size = safe_read(gunzip_src_fd, &bytebuffer[4], bytebuffer_max - 4);
|
||||
bytebuffer_size = safe_read(gunzip_src_fd, &bytebuffer[4], sz);
|
||||
if ((int)bytebuffer_size < 1) {
|
||||
error_msg = "unexpected end of file";
|
||||
abort_unzip(PASS_STATE_ONLY);
|
||||
}
|
||||
if (to_read >= 0) /* unzip only */
|
||||
to_read -= bytebuffer_size;
|
||||
bytebuffer_size += 4;
|
||||
bytebuffer_offset = 4;
|
||||
}
|
||||
@@ -1025,14 +1034,15 @@ inflate_unzip_internal(STATE_PARAM int in, int out)
|
||||
/* For unzip */
|
||||
|
||||
USE_DESKTOP(long long) int
|
||||
inflate_unzip(inflate_unzip_result *res, unsigned bufsize, int in, int out)
|
||||
inflate_unzip(inflate_unzip_result *res, off_t compr_size, int in, int out)
|
||||
{
|
||||
USE_DESKTOP(long long) int n;
|
||||
DECLARE_STATE;
|
||||
|
||||
ALLOC_STATE;
|
||||
|
||||
bytebuffer_max = bufsize + 4;
|
||||
to_read = compr_size;
|
||||
// bytebuffer_max = 0x8000;
|
||||
bytebuffer_offset = 4;
|
||||
bytebuffer = xmalloc(bytebuffer_max);
|
||||
n = inflate_unzip_internal(PASS_STATE in, out);
|
||||
@@ -1176,7 +1186,8 @@ unpack_gz_stream(int in, int out)
|
||||
n = 0;
|
||||
|
||||
ALLOC_STATE;
|
||||
bytebuffer_max = 0x8000;
|
||||
to_read = -1;
|
||||
// bytebuffer_max = 0x8000;
|
||||
bytebuffer = xmalloc(bytebuffer_max);
|
||||
gunzip_src_fd = in;
|
||||
|
||||
|
||||
@@ -13,11 +13,14 @@
|
||||
*/
|
||||
char filter_accept_reject_list(archive_handle_t *archive_handle)
|
||||
{
|
||||
const char *key = archive_handle->file_header->name;
|
||||
const llist_t *reject_entry = find_list_entry2(archive_handle->reject, key);
|
||||
const char *key;
|
||||
const llist_t *reject_entry;
|
||||
const llist_t *accept_entry;
|
||||
|
||||
key = archive_handle->file_header->name;
|
||||
|
||||
/* If the key is in a reject list fail */
|
||||
reject_entry = find_list_entry2(archive_handle->reject, key);
|
||||
if (reject_entry) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ const llist_t *find_list_entry2(const llist_t *list, const char *filename)
|
||||
if (*c++ == '/') pattern_slash_cnt++;
|
||||
c = filename;
|
||||
d = buf;
|
||||
/* paranoia is better that buffer overflows */
|
||||
/* paranoia is better than buffer overflows */
|
||||
while (*c && d != buf + sizeof(buf)-1) {
|
||||
if (*c == '/' && --pattern_slash_cnt < 0)
|
||||
break;
|
||||
|
||||
@@ -46,6 +46,9 @@ void BUG_tar_header_size(void);
|
||||
char get_header_tar(archive_handle_t *archive_handle)
|
||||
{
|
||||
static smallint end;
|
||||
#if ENABLE_FEATURE_TAR_AUTODETECT
|
||||
static smallint not_first;
|
||||
#endif
|
||||
|
||||
file_header_t *file_header = archive_handle->file_header;
|
||||
struct {
|
||||
@@ -90,17 +93,32 @@ char get_header_tar(archive_handle_t *archive_handle)
|
||||
|
||||
again_after_align:
|
||||
|
||||
#if ENABLE_DESKTOP
|
||||
i = full_read(archive_handle->src_fd, &tar, 512);
|
||||
/* if GNU tar sees EOF in above read, it says:
|
||||
* "tar: A lone zero block at N", where N = kilobyte
|
||||
* where EOF was met (not EOF block, actual EOF!),
|
||||
* and tar will exit with error code 0.
|
||||
* We will mimic exit(EXIT_SUCCESS), although we will not mimic
|
||||
* the message and we don't check whether we indeed
|
||||
* saw zero block directly before this. */
|
||||
if (i == 0)
|
||||
xfunc_error_retval = 0;
|
||||
if (i != 512)
|
||||
bb_error_msg_and_die("short read");
|
||||
#else
|
||||
xread(archive_handle->src_fd, &tar, 512);
|
||||
#endif
|
||||
archive_handle->offset += 512;
|
||||
|
||||
/* If there is no filename its an empty header */
|
||||
if (tar.name[0] == 0) {
|
||||
if (tar.name[0] == 0 && tar.prefix[0] == 0) {
|
||||
if (end) {
|
||||
/* This is the second consecutive empty header! End of archive!
|
||||
* Read until the end to empty the pipe from gz or bz2
|
||||
*/
|
||||
while (full_read(archive_handle->src_fd, &tar, 512) == 512)
|
||||
/* repeat */;
|
||||
continue;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
end = 1;
|
||||
@@ -108,16 +126,49 @@ char get_header_tar(archive_handle_t *archive_handle)
|
||||
}
|
||||
end = 0;
|
||||
|
||||
/* Check header has valid magic, "ustar" is for the proper tar
|
||||
* 0's are for the old tar format
|
||||
*/
|
||||
if (strncmp(tar.magic, "ustar", 5) != 0) {
|
||||
#if ENABLE_FEATURE_TAR_OLDGNU_COMPATIBILITY
|
||||
if (memcmp(tar.magic, "\0\0\0\0", 5) != 0)
|
||||
/* Check header has valid magic, "ustar" is for the proper tar,
|
||||
* five NULs are for the old tar format */
|
||||
if (strncmp(tar.magic, "ustar", 5) != 0
|
||||
&& (!ENABLE_FEATURE_TAR_OLDGNU_COMPATIBILITY
|
||||
|| memcmp(tar.magic, "\0\0\0\0", 5) != 0)
|
||||
) {
|
||||
#if ENABLE_FEATURE_TAR_AUTODETECT
|
||||
char (*get_header_ptr)(archive_handle_t *);
|
||||
|
||||
/* tar gz/bz autodetect: check for gz/bz2 magic.
|
||||
* If it is the very first block, and we see the magic,
|
||||
* we can switch to get_header_tar_gz/bz2/lzma().
|
||||
* Needs seekable fd. I wish recv(MSG_PEEK) works
|
||||
* on any fd... */
|
||||
if (not_first)
|
||||
goto err;
|
||||
#if ENABLE_FEATURE_TAR_GZIP
|
||||
if (tar.name[0] == 0x1f && tar.name[1] == (char)0x8b) { /* gzip */
|
||||
get_header_ptr = get_header_tar_gz;
|
||||
} else
|
||||
#endif
|
||||
bb_error_msg_and_die("invalid tar magic");
|
||||
#if ENABLE_FEATURE_TAR_BZIP2
|
||||
if (tar.name[0] == 'B' && tar.name[1] == 'Z'
|
||||
&& tar.name[2] == 'h' && isdigit(tar.name[3])
|
||||
) { /* bzip2 */
|
||||
get_header_ptr = get_header_tar_bz2;
|
||||
} else
|
||||
#endif
|
||||
goto err;
|
||||
if (lseek(archive_handle->src_fd, -512, SEEK_CUR) != 0)
|
||||
goto err;
|
||||
while (get_header_ptr(archive_handle) == EXIT_SUCCESS)
|
||||
continue;
|
||||
return EXIT_FAILURE;
|
||||
err:
|
||||
#endif /* FEATURE_TAR_AUTODETECT */
|
||||
bb_error_msg_and_die("invalid tar magic");
|
||||
}
|
||||
|
||||
#if ENABLE_FEATURE_TAR_AUTODETECT
|
||||
not_first = 1;
|
||||
#endif
|
||||
|
||||
/* Do checksum on headers.
|
||||
* POSIX says that checksum is done on unsigned bytes, but
|
||||
* Sun and HP-UX gets it wrong... more details in
|
||||
@@ -160,18 +211,23 @@ char get_header_tar(archive_handle_t *archive_handle)
|
||||
/* getOctal trashes subsequent field, therefore we call it
|
||||
* on fields in reverse order */
|
||||
if (tar.devmajor[0]) {
|
||||
char t = tar.prefix[0];
|
||||
/* we trash prefix[0] here, but we DO need it later! */
|
||||
unsigned minor = GET_OCTAL(tar.devminor);
|
||||
unsigned major = GET_OCTAL(tar.devmajor);
|
||||
file_header->device = makedev(major, minor);
|
||||
tar.prefix[0] = t;
|
||||
}
|
||||
file_header->link_target = NULL;
|
||||
if (!linkname && parse_names && tar.linkname[0]) {
|
||||
/* we trash magic[0] here, it's ok */
|
||||
tar.linkname[sizeof(tar.linkname)] = '\0';
|
||||
file_header->link_target = xstrdup(tar.linkname);
|
||||
file_header->link_target = xstrndup(tar.linkname, sizeof(tar.linkname));
|
||||
/* FIXME: what if we have non-link object with link_target? */
|
||||
/* Will link_target be free()ed? */
|
||||
}
|
||||
#if ENABLE_FEATURE_TAR_UNAME_GNAME
|
||||
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);
|
||||
file_header->size = GET_OCTAL(tar.size);
|
||||
file_header->gid = GET_OCTAL(tar.gid);
|
||||
@@ -182,10 +238,12 @@ char get_header_tar(archive_handle_t *archive_handle)
|
||||
file_header->name = NULL;
|
||||
if (!longname && parse_names) {
|
||||
/* we trash mode[0] here, it's ok */
|
||||
tar.name[sizeof(tar.name)] = '\0';
|
||||
//tar.name[sizeof(tar.name)] = '\0'; - gcc 4.3.0 would complain
|
||||
tar.mode[0] = '\0';
|
||||
if (tar.prefix[0]) {
|
||||
/* and padding[0] */
|
||||
tar.prefix[sizeof(tar.prefix)] = '\0';
|
||||
//tar.prefix[sizeof(tar.prefix)] = '\0'; - gcc 4.3.0 would complain
|
||||
tar.padding[0] = '\0';
|
||||
file_header->name = concat_path_file(tar.prefix, tar.name);
|
||||
} else
|
||||
file_header->name = xstrdup(tar.name);
|
||||
@@ -302,6 +360,9 @@ char get_header_tar(archive_handle_t *archive_handle)
|
||||
|
||||
free(file_header->link_target);
|
||||
/* Do not free(file_header->name)! */
|
||||
|
||||
#if ENABLE_FEATURE_TAR_UNAME_GNAME
|
||||
free(file_header->uname);
|
||||
free(file_header->gname);
|
||||
#endif
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -10,6 +10,33 @@ void header_verbose_list(const file_header_t *file_header)
|
||||
{
|
||||
struct tm *mtime = localtime(&(file_header->mtime));
|
||||
|
||||
#if ENABLE_FEATURE_TAR_UNAME_GNAME
|
||||
char uid[8];
|
||||
char gid[8];
|
||||
char *user = file_header->uname;
|
||||
char *group = file_header->gname;
|
||||
|
||||
if (user == NULL) {
|
||||
snprintf(uid, sizeof(uid), "%u", (unsigned)file_header->uid);
|
||||
user = uid;
|
||||
}
|
||||
if (group == NULL) {
|
||||
snprintf(gid, sizeof(gid), "%u", (unsigned)file_header->gid);
|
||||
group = gid;
|
||||
}
|
||||
printf("%s %s/%s %9u %4u-%02u-%02u %02u:%02u:%02u %s",
|
||||
bb_mode_string(file_header->mode),
|
||||
user,
|
||||
group,
|
||||
(unsigned int) file_header->size,
|
||||
1900 + mtime->tm_year,
|
||||
1 + mtime->tm_mon,
|
||||
mtime->tm_mday,
|
||||
mtime->tm_hour,
|
||||
mtime->tm_min,
|
||||
mtime->tm_sec,
|
||||
file_header->name);
|
||||
#else /* !FEATURE_TAR_UNAME_GNAME */
|
||||
printf("%s %d/%d %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
|
||||
bb_mode_string(file_header->mode),
|
||||
file_header->uid,
|
||||
@@ -22,6 +49,7 @@ void header_verbose_list(const file_header_t *file_header)
|
||||
mtime->tm_min,
|
||||
mtime->tm_sec,
|
||||
file_header->name);
|
||||
#endif /* FEATURE_TAR_UNAME_GNAME */
|
||||
|
||||
if (file_header->link_target) {
|
||||
printf(" -> %s", file_header->link_target);
|
||||
|
||||
@@ -15,10 +15,10 @@ int open_transformer(int src_fd,
|
||||
USE_DESKTOP(long long) int (*transformer)(int src_fd, int dst_fd),
|
||||
const char *transform_prog)
|
||||
{
|
||||
int fd_pipe[2];
|
||||
struct fd_pair fd_pipe;
|
||||
int pid;
|
||||
|
||||
xpipe(fd_pipe);
|
||||
xpiped_pair(fd_pipe);
|
||||
|
||||
#if BB_MMU
|
||||
pid = fork();
|
||||
@@ -30,12 +30,12 @@ int open_transformer(int src_fd,
|
||||
|
||||
if (pid == 0) {
|
||||
/* child process */
|
||||
close(fd_pipe[0]); /* We don't wan't to read from the parent */
|
||||
close(fd_pipe.rd); /* We don't want to read from the parent */
|
||||
// FIXME: error check?
|
||||
#if BB_MMU
|
||||
transformer(src_fd, fd_pipe[1]);
|
||||
transformer(src_fd, fd_pipe.wr);
|
||||
if (ENABLE_FEATURE_CLEAN_UP) {
|
||||
close(fd_pipe[1]); /* Send EOF */
|
||||
close(fd_pipe.wr); /* Send EOF */
|
||||
close(src_fd);
|
||||
}
|
||||
exit(0);
|
||||
@@ -43,7 +43,7 @@ int open_transformer(int src_fd,
|
||||
{
|
||||
char *argv[4];
|
||||
xmove_fd(src_fd, 0);
|
||||
xmove_fd(fd_pipe[1], 1);
|
||||
xmove_fd(fd_pipe.wr, 1);
|
||||
argv[0] = (char*)transform_prog;
|
||||
argv[1] = (char*)"-cf";
|
||||
argv[2] = (char*)"-";
|
||||
@@ -56,7 +56,7 @@ int open_transformer(int src_fd,
|
||||
}
|
||||
|
||||
/* parent process */
|
||||
close(fd_pipe[1]); /* Don't want to write to the child */
|
||||
close(fd_pipe.wr); /* Don't want to write to the child */
|
||||
|
||||
return fd_pipe[0];
|
||||
return fd_pipe.rd;
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "libbb.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
void seek_by_jump(const archive_handle_t *archive_handle, const unsigned int amount)
|
||||
void seek_by_jump(const archive_handle_t *archive_handle, unsigned amount)
|
||||
{
|
||||
if (lseek(archive_handle->src_fd, (off_t) amount, SEEK_CUR) == (off_t) -1) {
|
||||
#if ENABLE_FEATURE_UNARCHIVE_TAPE
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
#include "libbb.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
/* If we are reading through a pipe(), or from stdin then we can't lseek,
|
||||
/* If we are reading through a pipe, or from stdin then we can't lseek,
|
||||
* we must read and discard the data to skip over it.
|
||||
*/
|
||||
void seek_by_read(const archive_handle_t *archive_handle, const unsigned int jump_size)
|
||||
void seek_by_read(const archive_handle_t *archive_handle, unsigned jump_size)
|
||||
{
|
||||
if (jump_size)
|
||||
bb_copyfd_exact_size(archive_handle->src_fd, -1, jump_size);
|
||||
|
||||
+43
-18
@@ -28,8 +28,22 @@
|
||||
#include "libbb.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
/* FIXME: Stop using this non-standard feature */
|
||||
#ifndef FNM_LEADING_DIR
|
||||
#define FNM_LEADING_DIR 0
|
||||
#endif
|
||||
|
||||
|
||||
#define block_buf bb_common_bufsiz1
|
||||
|
||||
|
||||
#if !ENABLE_FEATURE_TAR_GZIP && !ENABLE_FEATURE_TAR_BZIP2
|
||||
/* Do not pass gzip flag to writeTarFile() */
|
||||
#define writeTarFile(tar_fd, verboseFlag, dereferenceFlag, include, exclude, gzip) \
|
||||
writeTarFile(tar_fd, verboseFlag, dereferenceFlag, include, exclude)
|
||||
#endif
|
||||
|
||||
|
||||
#if ENABLE_FEATURE_TAR_CREATE
|
||||
|
||||
/* Tar file constants */
|
||||
@@ -509,21 +523,26 @@ static int writeTarFile(const int tar_fd, const int verboseFlag,
|
||||
if (fstat(tbInfo.tarFd, &tbInfo.statBuf) < 0)
|
||||
bb_perror_msg_and_die("cannot stat tar file");
|
||||
|
||||
if ((ENABLE_FEATURE_TAR_GZIP || ENABLE_FEATURE_TAR_BZIP2) && gzip) {
|
||||
// On Linux, vfork never unpauses parent early, although standard
|
||||
// allows for that. Do we want to waste bytes checking for it?
|
||||
#if ENABLE_FEATURE_TAR_GZIP || ENABLE_FEATURE_TAR_BZIP2
|
||||
if (gzip) {
|
||||
#if ENABLE_FEATURE_TAR_GZIP && ENABLE_FEATURE_TAR_BZIP2
|
||||
const char *zip_exec = (gzip == 1) ? "gzip" : "bzip2";
|
||||
#elif ENABLE_FEATURE_TAR_GZIP
|
||||
const char *zip_exec = "gzip";
|
||||
#else /* only ENABLE_FEATURE_TAR_BZIP2 */
|
||||
const char *zip_exec = "bzip2";
|
||||
#endif
|
||||
// On Linux, vfork never unpauses parent early, although standard
|
||||
// allows for that. Do we want to waste bytes checking for it?
|
||||
#define WAIT_FOR_CHILD 0
|
||||
|
||||
volatile int vfork_exec_errno = 0;
|
||||
#if WAIT_FOR_CHILD
|
||||
struct { int rd; int wr; } gzipStatusPipe;
|
||||
struct fd_pair gzipStatusPipe;
|
||||
#endif
|
||||
struct { int rd; int wr; } gzipDataPipe;
|
||||
const char *zip_exec = (gzip == 1) ? "gzip" : "bzip2";
|
||||
|
||||
xpipe(&gzipDataPipe.rd);
|
||||
struct fd_pair gzipDataPipe;
|
||||
xpiped_pair(gzipDataPipe);
|
||||
#if WAIT_FOR_CHILD
|
||||
xpipe(&gzipStatusPipe.rd);
|
||||
xpiped_pair(gzipStatusPipe);
|
||||
#endif
|
||||
|
||||
signal(SIGPIPE, SIG_IGN); /* we only want EPIPE on errors */
|
||||
@@ -541,13 +560,16 @@ static int writeTarFile(const int tar_fd, const int verboseFlag,
|
||||
|
||||
if (gzipPid == 0) {
|
||||
/* child */
|
||||
xmove_fd(tbInfo.tarFd, 1);
|
||||
xmove_fd(gzipDataPipe.rd, 0);
|
||||
/* NB: close _first_, then move fds! */
|
||||
close(gzipDataPipe.wr);
|
||||
#if WAIT_FOR_CHILD
|
||||
close(gzipStatusPipe.rd);
|
||||
/* gzipStatusPipe.wr will close only on exec -
|
||||
* parent waits for this close to happen */
|
||||
fcntl(gzipStatusPipe.wr, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
xmove_fd(gzipDataPipe.rd, 0);
|
||||
xmove_fd(tbInfo.tarFd, 1);
|
||||
/* exec gzip/bzip2 program/applet */
|
||||
BB_EXECLP(zip_exec, zip_exec, "-f", NULL);
|
||||
vfork_exec_errno = errno;
|
||||
@@ -565,7 +587,7 @@ static int writeTarFile(const int tar_fd, const int verboseFlag,
|
||||
|
||||
/* Wait until child execs (or fails to) */
|
||||
n = full_read(gzipStatusPipe.rd, &buf, 1);
|
||||
if ((n < 0) && (/*errno == EAGAIN ||*/ errno == EINTR))
|
||||
if (n < 0 /* && errno == EAGAIN */)
|
||||
continue; /* try it again */
|
||||
|
||||
}
|
||||
@@ -576,6 +598,7 @@ static int writeTarFile(const int tar_fd, const int verboseFlag,
|
||||
bb_perror_msg_and_die("cannot exec %s", zip_exec);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
tbInfo.excludeList = exclude;
|
||||
|
||||
@@ -610,7 +633,7 @@ static int writeTarFile(const int tar_fd, const int verboseFlag,
|
||||
|
||||
if (gzipPid) {
|
||||
int status;
|
||||
if (waitpid(gzipPid, &status, 0) == -1)
|
||||
if (safe_waitpid(gzipPid, &status, 0) == -1)
|
||||
bb_perror_msg("waitpid");
|
||||
else if (!WIFEXITED(status) || WEXITSTATUS(status))
|
||||
/* gzip was killed or has exited with nonzero! */
|
||||
@@ -688,7 +711,7 @@ static void handle_SIGCHLD(int status)
|
||||
/* Actually, 'status' is a signo. We reuse it for other needs */
|
||||
|
||||
/* Wait for any child without blocking */
|
||||
if (waitpid(-1, &status, WNOHANG) < 0)
|
||||
if (wait_any_nohang(&status) < 0)
|
||||
/* wait failed?! I'm confused... */
|
||||
return;
|
||||
|
||||
@@ -926,11 +949,13 @@ int tar_main(int argc, char **argv)
|
||||
|
||||
/* create an archive */
|
||||
if (opt & OPT_CREATE) {
|
||||
#if ENABLE_FEATURE_TAR_GZIP || ENABLE_FEATURE_TAR_BZIP2
|
||||
int zipMode = 0;
|
||||
if (ENABLE_FEATURE_TAR_GZIP && get_header_ptr == get_header_tar_gz)
|
||||
if (ENABLE_FEATURE_TAR_GZIP && (opt & OPT_GZIP))
|
||||
zipMode = 1;
|
||||
if (ENABLE_FEATURE_TAR_BZIP2 && get_header_ptr == get_header_tar_bz2)
|
||||
if (ENABLE_FEATURE_TAR_BZIP2 && (opt & OPT_BZIP2))
|
||||
zipMode = 2;
|
||||
#endif
|
||||
/* NB: writeTarFile() closes tar_handle->src_fd */
|
||||
return writeTarFile(tar_handle->src_fd, verboseFlag, opt & OPT_DEREFERENCE,
|
||||
tar_handle->accept,
|
||||
@@ -938,7 +963,7 @@ int tar_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
while (get_header_ptr(tar_handle) == EXIT_SUCCESS)
|
||||
/* nothing */;
|
||||
continue;
|
||||
|
||||
/* Check that every file that should have been extracted was */
|
||||
while (tar_handle->accept) {
|
||||
|
||||
@@ -72,7 +72,7 @@ config RESIZE
|
||||
terminal.
|
||||
|
||||
config FEATURE_RESIZE_PRINT
|
||||
bool "print environment variables"
|
||||
bool "Print environment variables"
|
||||
default n
|
||||
depends on RESIZE
|
||||
help
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "libbb.h"
|
||||
|
||||
int clear_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int clear_main(int argc, char **argv)
|
||||
int clear_main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return printf("\033[H\033[J") != 6;
|
||||
}
|
||||
@@ -16,19 +16,15 @@
|
||||
enum { VT_DISALLOCATE = 0x5608 }; /* free memory associated to vt */
|
||||
|
||||
int deallocvt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int deallocvt_main(int argc, char **argv)
|
||||
int deallocvt_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
/* num = 0 deallocate all unused consoles */
|
||||
int num = 0;
|
||||
|
||||
switch (argc) {
|
||||
case 2:
|
||||
if (argv[1]) {
|
||||
if (argv[2])
|
||||
bb_show_usage();
|
||||
num = xatou_range(argv[1], 1, 63);
|
||||
/* Fallthrough */
|
||||
case 1:
|
||||
break;
|
||||
default:
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
/* double cast suppresses "cast to ptr from int of different size" */
|
||||
|
||||
@@ -167,7 +167,7 @@ static void loadnewfont(int fd)
|
||||
}
|
||||
|
||||
int loadfont_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int loadfont_main(int argc, char **argv)
|
||||
int loadfont_main(int argc, char **argv ATTRIBUTE_UNUSED)
|
||||
{
|
||||
int fd;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ struct kbentry {
|
||||
#define MAX_NR_KEYMAPS 256
|
||||
|
||||
int loadkmap_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int loadkmap_main(int argc, char **argv)
|
||||
int loadkmap_main(int argc, char **argv ATTRIBUTE_UNUSED)
|
||||
{
|
||||
struct kbentry ke;
|
||||
int i, j, fd;
|
||||
|
||||
@@ -27,9 +27,10 @@ int openvt_main(int argc, char **argv)
|
||||
/* grab new one */
|
||||
close(0);
|
||||
xopen(vtname, O_RDWR);
|
||||
dup2(0, STDOUT_FILENO);
|
||||
dup2(0, STDERR_FILENO);
|
||||
xdup2(0, STDOUT_FILENO);
|
||||
xdup2(0, STDERR_FILENO);
|
||||
|
||||
BB_EXECVP(argv[2], &argv[2]);
|
||||
argv += 2;
|
||||
BB_EXECVP(argv[0], argv);
|
||||
_exit(1);
|
||||
}
|
||||
+22
-5
@@ -8,14 +8,25 @@
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/* no options, no getopt */
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
/* BTW, which "standard" package has this utility? It doesn't seem
|
||||
* to be ncurses, coreutils, console-tools... then what? */
|
||||
|
||||
#if ENABLE_STTY
|
||||
int stty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
#endif
|
||||
|
||||
int reset_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int reset_main(int argc, char **argv)
|
||||
int reset_main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (isatty(1)) {
|
||||
static const char *const args[] = {
|
||||
"stty", "sane", NULL
|
||||
};
|
||||
|
||||
/* no options, no getopt */
|
||||
|
||||
if (isatty(0) && isatty(1)) {
|
||||
/* See 'man 4 console_codes' for details:
|
||||
* "ESC c" -- Reset
|
||||
* "ESC ( K" -- Select user mapping
|
||||
@@ -24,7 +35,13 @@ int reset_main(int argc, char **argv)
|
||||
* "ESC [ ? 25 h" -- Make cursor visible.
|
||||
*/
|
||||
printf("\033c\033(K\033[J\033[0m\033[?25h");
|
||||
/* http://bugs.busybox.net/view.php?id=1414:
|
||||
* people want it to reset echo etc: */
|
||||
#if ENABLE_STTY
|
||||
return stty_main(2, (char**)args);
|
||||
#else
|
||||
execvp("stty", (char**)args);
|
||||
#endif
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ onintr(int sig ATTRIBUTE_UNUSED)
|
||||
}
|
||||
|
||||
int resize_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int resize_main(int argc, char **argv)
|
||||
int resize_main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
||||
{
|
||||
struct termios new;
|
||||
struct winsize w = { 0,0,0,0 };
|
||||
struct winsize w = { 0, 0, 0, 0 };
|
||||
int ret;
|
||||
|
||||
/* We use _stderr_ in order to make resize usable
|
||||
@@ -37,10 +37,12 @@ int resize_main(int argc, char **argv)
|
||||
new = old_termios;
|
||||
new.c_cflag |= (CLOCAL | CREAD);
|
||||
new.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
|
||||
signal(SIGINT, onintr);
|
||||
signal(SIGQUIT, onintr);
|
||||
signal(SIGTERM, onintr);
|
||||
signal(SIGALRM, onintr);
|
||||
bb_signals(0
|
||||
+ (1 << SIGINT)
|
||||
+ (1 << SIGQUIT)
|
||||
+ (1 << SIGTERM)
|
||||
+ (1 << SIGALRM)
|
||||
, onintr);
|
||||
tcsetattr(STDERR_FILENO, TCSANOW, &new);
|
||||
|
||||
/* save_cursor_pos 7
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
/* From <linux/kd.h> */
|
||||
struct kbkeycode {
|
||||
unsigned int scancode, keycode;
|
||||
unsigned scancode, keycode;
|
||||
};
|
||||
enum {
|
||||
KDSETKEYCODE = 0x4B4D /* write kernel keycode table entry */
|
||||
@@ -33,7 +33,7 @@ int setkeycodes_main(int argc, char **argv)
|
||||
fd = get_console_fd();
|
||||
|
||||
while (argc > 2) {
|
||||
a.keycode = xatoul_range(argv[2], 0, 127);
|
||||
a.keycode = xatou_range(argv[2], 0, 127);
|
||||
a.scancode = sc = xstrtoul_range(argv[1], 16, 0, 255);
|
||||
if (a.scancode > 127) {
|
||||
a.scancode -= 0xe000;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "libbb.h"
|
||||
|
||||
int setlogcons_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int setlogcons_main(int argc, char **argv)
|
||||
int setlogcons_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
struct {
|
||||
char fn;
|
||||
@@ -22,8 +22,8 @@ int setlogcons_main(int argc, char **argv)
|
||||
arg.fn = 11; /* redirect kernel messages */
|
||||
arg.subarg = 0; /* to specified console (current as default) */
|
||||
|
||||
if (argc == 2)
|
||||
arg.subarg = xatoul_range(argv[1], 0, 63);
|
||||
if (argv[1])
|
||||
arg.subarg = xatou_range(argv[1], 0, 63);
|
||||
|
||||
xioctl(xopen(VC_1, O_RDONLY), TIOCLINUX, &arg);
|
||||
|
||||
|
||||
+17
-3
@@ -488,6 +488,14 @@ config RMDIR
|
||||
help
|
||||
rmdir is used to remove empty directories.
|
||||
|
||||
config FEATURE_RMDIR_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on RMDIR && GETOPT_LONG
|
||||
help
|
||||
Support long options for the rmdir applet, including
|
||||
--ignore-fail-on-non-empty for compatibility with GNU rmdir.
|
||||
|
||||
config SEQ
|
||||
bool "seq"
|
||||
default n
|
||||
@@ -520,7 +528,7 @@ config SORT
|
||||
sort is used to sort lines of text in specified files.
|
||||
|
||||
config FEATURE_SORT_BIG
|
||||
bool "full SuSv3 compliant sort (Support -ktcsbdfiozgM)"
|
||||
bool "Full SuSv3 compliant sort (support -ktcsbdfiozgM)"
|
||||
default y
|
||||
depends on SORT
|
||||
help
|
||||
@@ -538,7 +546,7 @@ config SPLIT
|
||||
split a file into pieces.
|
||||
|
||||
config FEATURE_SPLIT_FANCY
|
||||
bool "fancy extensions"
|
||||
bool "Fancy extensions"
|
||||
default n
|
||||
depends on SPLIT
|
||||
help
|
||||
@@ -579,6 +587,12 @@ config SYNC
|
||||
help
|
||||
sync is used to flush filesystem buffers.
|
||||
|
||||
config TAC
|
||||
bool "tac"
|
||||
default n
|
||||
help
|
||||
tac is used to concatenate and print files in reverse.
|
||||
|
||||
config TAIL
|
||||
bool "tail"
|
||||
default n
|
||||
@@ -602,7 +616,7 @@ config TEE
|
||||
to standard output and files.
|
||||
|
||||
config FEATURE_TEE_USE_BLOCK_IO
|
||||
bool "Enable block i/o (larger/faster) instead of byte i/o."
|
||||
bool "Enable block I/O (larger/faster) instead of byte I/O"
|
||||
default n
|
||||
depends on TEE
|
||||
help
|
||||
|
||||
@@ -12,6 +12,7 @@ lib-$(CONFIG_CAL) += cal.o
|
||||
lib-$(CONFIG_CAT) += cat.o
|
||||
lib-$(CONFIG_MORE) += cat.o # more uses it if stdout isn't a tty
|
||||
lib-$(CONFIG_LESS) += cat.o # less too
|
||||
lib-$(CONFIG_CRONTAB) += cat.o # crontab -l
|
||||
lib-$(CONFIG_CATV) += catv.o
|
||||
lib-$(CONFIG_CHGRP) += chgrp.o chown.o
|
||||
lib-$(CONFIG_CHMOD) += chmod.o
|
||||
@@ -66,6 +67,7 @@ lib-$(CONFIG_STAT) += stat.o
|
||||
lib-$(CONFIG_STTY) += stty.o
|
||||
lib-$(CONFIG_SUM) += sum.o
|
||||
lib-$(CONFIG_SYNC) += sync.o
|
||||
lib-$(CONFIG_TAC) += tac.o
|
||||
lib-$(CONFIG_TAIL) += tail.o
|
||||
lib-$(CONFIG_TEE) += tee.o
|
||||
lib-$(CONFIG_TEST) += test.o
|
||||
|
||||
+4
-8
@@ -17,20 +17,16 @@
|
||||
|
||||
int bb_cat(char **argv)
|
||||
{
|
||||
static const char *const argv_dash[] = { "-", NULL };
|
||||
|
||||
int fd;
|
||||
int retval = EXIT_SUCCESS;
|
||||
|
||||
if (!*argv)
|
||||
argv = (char**) &argv_dash;
|
||||
argv = (char**) &bb_argv_dash;
|
||||
|
||||
do {
|
||||
fd = STDIN_FILENO;
|
||||
if (!LONE_DASH(*argv))
|
||||
fd = open_or_warn(*argv, O_RDONLY);
|
||||
fd = open_or_warn_stdin(*argv);
|
||||
if (fd >= 0) {
|
||||
/* This is not an xfunc - never exits */
|
||||
/* This is not a xfunc - never exits */
|
||||
off_t r = bb_copyfd_eof(fd, STDOUT_FILENO);
|
||||
if (fd != STDIN_FILENO)
|
||||
close(fd);
|
||||
@@ -44,7 +40,7 @@ int bb_cat(char **argv)
|
||||
}
|
||||
|
||||
int cat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int cat_main(int argc, char **argv)
|
||||
int cat_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
getopt32(argv, "u");
|
||||
argv += optind;
|
||||
|
||||
+4
-8
@@ -13,7 +13,7 @@
|
||||
#include "libbb.h"
|
||||
|
||||
int catv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int catv_main(int argc, char **argv)
|
||||
int catv_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
int retval = EXIT_SUCCESS;
|
||||
int fd;
|
||||
@@ -27,18 +27,14 @@ int catv_main(int argc, char **argv)
|
||||
argv += optind;
|
||||
|
||||
/* Read from stdin if there's nothing else to do. */
|
||||
fd = 0;
|
||||
if (!argv[0]) {
|
||||
argv--;
|
||||
goto jump_in;
|
||||
}
|
||||
if (!argv[0])
|
||||
*--argv = (char*)"-";
|
||||
do {
|
||||
fd = open_or_warn(*argv, O_RDONLY);
|
||||
fd = open_or_warn_stdin(*argv);
|
||||
if (fd < 0) {
|
||||
retval = EXIT_FAILURE;
|
||||
continue;
|
||||
}
|
||||
jump_in:
|
||||
for (;;) {
|
||||
int i, res;
|
||||
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* param, i
|
||||
}
|
||||
|
||||
int chmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int chmod_main(int argc, char **argv)
|
||||
int chmod_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
int retval = EXIT_SUCCESS;
|
||||
char *arg, **argp;
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ typedef int (*chown_fptr)(const char *, uid_t, gid_t);
|
||||
static struct bb_uidgid_t ugid = { -1, -1 };
|
||||
|
||||
static int fileAction(const char *fileName, struct stat *statbuf,
|
||||
void *cf, int depth)
|
||||
void *cf, int depth ATTRIBUTE_UNUSED)
|
||||
{
|
||||
uid_t u = (ugid.uid == (uid_t)-1) ? statbuf->st_uid : ugid.uid;
|
||||
gid_t g = (ugid.gid == (gid_t)-1) ? statbuf->st_gid : ugid.gid;
|
||||
@@ -62,7 +62,7 @@ static int fileAction(const char *fileName, struct stat *statbuf,
|
||||
}
|
||||
|
||||
int chown_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int chown_main(int argc, char **argv)
|
||||
int chown_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
int retval = EXIT_SUCCESS;
|
||||
int flags;
|
||||
|
||||
+1
-3
@@ -19,9 +19,7 @@ int chroot_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
++argv;
|
||||
if (chroot(*argv)) {
|
||||
bb_perror_msg_and_die("cannot change root directory to %s", *argv);
|
||||
}
|
||||
xchroot(*argv);
|
||||
xchdir("/");
|
||||
|
||||
++argv;
|
||||
|
||||
+20
-18
@@ -9,46 +9,48 @@
|
||||
#include "libbb.h"
|
||||
|
||||
int cksum_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int cksum_main(int argc, char **argv)
|
||||
int cksum_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
uint32_t *crc32_table = crc32_filltable(NULL, 1);
|
||||
|
||||
FILE *fp;
|
||||
uint32_t crc;
|
||||
long length, filesize;
|
||||
int bytes_read;
|
||||
char *cp;
|
||||
uint8_t *cp;
|
||||
|
||||
int inp_stdin = (argc == optind) ? 1 : 0;
|
||||
#if ENABLE_DESKTOP
|
||||
getopt32(argv, ""); /* coreutils 6.9 compat */
|
||||
argv += optind;
|
||||
#else
|
||||
argv++;
|
||||
#endif
|
||||
|
||||
do {
|
||||
fp = fopen_or_warn_stdin((inp_stdin) ? bb_msg_standard_input : *++argv);
|
||||
int fd = open_or_warn_stdin(*argv ? *argv : bb_msg_standard_input);
|
||||
|
||||
if (fd < 0)
|
||||
continue;
|
||||
crc = 0;
|
||||
length = 0;
|
||||
|
||||
#define read_buf bb_common_bufsiz1
|
||||
while ((bytes_read = fread(read_buf, 1, BUFSIZ, fp)) > 0) {
|
||||
while ((bytes_read = safe_read(fd, read_buf, sizeof(read_buf))) > 0) {
|
||||
cp = read_buf;
|
||||
length += bytes_read;
|
||||
while (bytes_read--)
|
||||
crc = (crc << 8) ^ crc32_table[((crc >> 24) ^ (*cp++)) & 0xffL];
|
||||
do {
|
||||
crc = (crc << 8) ^ crc32_table[(crc >> 24) ^ *cp++];
|
||||
} while (--bytes_read);
|
||||
}
|
||||
close(fd);
|
||||
|
||||
filesize = length;
|
||||
|
||||
for (; length; length >>= 8)
|
||||
crc = (crc << 8) ^ crc32_table[((crc >> 24) ^ length) & 0xffL];
|
||||
crc = (crc << 8) ^ crc32_table[((crc >> 24) ^ length) & 0xff];
|
||||
crc ^= 0xffffffffL;
|
||||
|
||||
if (inp_stdin) {
|
||||
printf("%" PRIu32 " %li\n", crc, filesize);
|
||||
break;
|
||||
}
|
||||
|
||||
printf("%" PRIu32 " %li %s\n", crc, filesize, *argv);
|
||||
fclose(fp);
|
||||
} while (*(argv + 1));
|
||||
printf((*argv ? "%" PRIu32 " %li %s\n" : "%" PRIu32 " %li\n"),
|
||||
crc, filesize, *argv);
|
||||
} while (*argv && *++argv);
|
||||
|
||||
fflush_stdout_and_exit(EXIT_SUCCESS);
|
||||
}
|
||||
+1
-1
@@ -36,7 +36,7 @@ static void writeline(char *line, int class, int flags)
|
||||
}
|
||||
|
||||
int comm_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int comm_main(int argc, char **argv)
|
||||
int comm_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
#define LINE_LEN 100
|
||||
#define BB_EOF_0 0x1
|
||||
|
||||
+6
-13
@@ -162,7 +162,7 @@ static void cut_file(FILE *file, char delim)
|
||||
}
|
||||
|
||||
int cut_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int cut_main(int argc, char **argv)
|
||||
int cut_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
char delim = '\t'; /* delimiter, default is tab */
|
||||
char *sopt, *ltok;
|
||||
@@ -205,7 +205,7 @@ int cut_main(int argc, char **argv)
|
||||
char *ntok;
|
||||
int s = 0, e = 0;
|
||||
|
||||
/* take apart the lists, one by one (they are separated with commas */
|
||||
/* take apart the lists, one by one (they are separated with commas) */
|
||||
while ((ltok = strsep(&sopt, ",")) != NULL) {
|
||||
|
||||
/* it's actually legal to pass an empty list */
|
||||
@@ -258,25 +258,18 @@ int cut_main(int argc, char **argv)
|
||||
|
||||
{
|
||||
int retval = EXIT_SUCCESS;
|
||||
FILE *file = stdin;
|
||||
|
||||
if (!*argv) {
|
||||
argv--;
|
||||
goto jump_in;
|
||||
}
|
||||
if (!*argv)
|
||||
*--argv = (char *)"-";
|
||||
|
||||
do {
|
||||
file = stdin;
|
||||
if (NOT_LONE_DASH(*argv))
|
||||
file = fopen_or_warn(*argv, "r");
|
||||
FILE *file = fopen_or_warn_stdin(*argv);
|
||||
if (!file) {
|
||||
retval = EXIT_FAILURE;
|
||||
continue;
|
||||
}
|
||||
jump_in:
|
||||
cut_file(file, delim);
|
||||
if (NOT_LONE_DASH(*argv))
|
||||
fclose(file);
|
||||
fclose_if_not_stdin(file);
|
||||
} while (*++argv);
|
||||
|
||||
if (ENABLE_FEATURE_CLEAN_UP)
|
||||
|
||||
+33
-40
@@ -121,9 +121,6 @@ int dd_main(int argc, char **argv)
|
||||
off_t count;
|
||||
off_t seek, skip;
|
||||
const char *infile, *outfile;
|
||||
#if ENABLE_FEATURE_DD_SIGNAL_HANDLING
|
||||
struct sigaction sigact;
|
||||
#endif
|
||||
} Z;
|
||||
#define flags (Z.flags )
|
||||
#define oc (Z.oc )
|
||||
@@ -132,17 +129,13 @@ int dd_main(int argc, char **argv)
|
||||
#define skip (Z.skip )
|
||||
#define infile (Z.infile )
|
||||
#define outfile (Z.outfile)
|
||||
#define sigact (Z.sigact )
|
||||
|
||||
memset(&Z, 0, sizeof(Z));
|
||||
INIT_G();
|
||||
//fflush(NULL); - is this needed because of NOEXEC?
|
||||
|
||||
#if ENABLE_FEATURE_DD_SIGNAL_HANDLING
|
||||
sigact.sa_handler = dd_output_status;
|
||||
sigact.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sigact.sa_mask);
|
||||
sigaction(SIGUSR1, &sigact, NULL);
|
||||
signal_SA_RESTART_empty_mask(SIGUSR1, dd_output_status);
|
||||
#endif
|
||||
|
||||
for (n = 1; n < argc; n++) {
|
||||
@@ -164,40 +157,40 @@ int dd_main(int argc, char **argv)
|
||||
if (what == 0)
|
||||
bb_show_usage();
|
||||
arg += key_len;
|
||||
/* Must fit into positive ssize_t */
|
||||
#if ENABLE_FEATURE_DD_IBS_OBS
|
||||
if (what == OP_ibs) {
|
||||
ibs = xatoul_range_sfx(arg, 1, ((size_t)-1L)/2, dd_suffixes);
|
||||
continue;
|
||||
}
|
||||
if (what == OP_obs) {
|
||||
obs = xatoul_range_sfx(arg, 1, ((size_t)-1L)/2, dd_suffixes);
|
||||
continue;
|
||||
}
|
||||
if (what == OP_conv) {
|
||||
while (1) {
|
||||
/* find ',', replace them with nil so we can use arg for
|
||||
* index_in_strings() without copying.
|
||||
* We rely on arg being non-null, else strchr would fault.
|
||||
*/
|
||||
key = strchr(arg, ',');
|
||||
if (key)
|
||||
*key = '\0';
|
||||
what = index_in_strings(keywords, arg) + 1;
|
||||
if (what < OP_conv_notrunc)
|
||||
bb_error_msg_and_die(bb_msg_invalid_arg, arg, "conv");
|
||||
if (what == OP_conv_notrunc)
|
||||
flags |= FLAG_NOTRUNC;
|
||||
if (what == OP_conv_sync)
|
||||
flags |= FLAG_SYNC;
|
||||
if (what == OP_conv_noerror)
|
||||
flags |= FLAG_NOERROR;
|
||||
if (!key) /* no ',' left, so this was the last specifier */
|
||||
break;
|
||||
arg = key + 1; /* skip this keyword and ',' */
|
||||
}
|
||||
continue;
|
||||
if (what == OP_ibs) {
|
||||
/* Must fit into positive ssize_t */
|
||||
ibs = xatoul_range_sfx(arg, 1, ((size_t)-1L)/2, dd_suffixes);
|
||||
continue;
|
||||
}
|
||||
if (what == OP_obs) {
|
||||
obs = xatoul_range_sfx(arg, 1, ((size_t)-1L)/2, dd_suffixes);
|
||||
continue;
|
||||
}
|
||||
if (what == OP_conv) {
|
||||
while (1) {
|
||||
/* find ',', replace them with NUL so we can use arg for
|
||||
* index_in_strings() without copying.
|
||||
* We rely on arg being non-null, else strchr would fault.
|
||||
*/
|
||||
key = strchr(arg, ',');
|
||||
if (key)
|
||||
*key = '\0';
|
||||
what = index_in_strings(keywords, arg) + 1;
|
||||
if (what < OP_conv_notrunc)
|
||||
bb_error_msg_and_die(bb_msg_invalid_arg, arg, "conv");
|
||||
if (what == OP_conv_notrunc)
|
||||
flags |= FLAG_NOTRUNC;
|
||||
if (what == OP_conv_sync)
|
||||
flags |= FLAG_SYNC;
|
||||
if (what == OP_conv_noerror)
|
||||
flags |= FLAG_NOERROR;
|
||||
if (!key) /* no ',' left, so this was the last specifier */
|
||||
break;
|
||||
arg = key + 1; /* skip this keyword and ',' */
|
||||
}
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (what == OP_bs) {
|
||||
ibs = obs = xatoul_range_sfx(arg, 1, ((size_t)-1L)/2, dd_suffixes);
|
||||
|
||||
+19
-35
@@ -20,62 +20,49 @@ enum {
|
||||
};
|
||||
|
||||
/* if fn is NULL then input is stdin and output is stdout */
|
||||
static int convert(char *fn, int conv_type)
|
||||
static void convert(char *fn, int conv_type)
|
||||
{
|
||||
FILE *in, *out;
|
||||
int i;
|
||||
#define name_buf bb_common_bufsiz1
|
||||
char *name_buf = name_buf; /* for compiler */
|
||||
|
||||
in = stdin;
|
||||
out = stdout;
|
||||
if (fn != NULL) {
|
||||
in = xfopen(fn, "rw");
|
||||
in = xfopen(fn, "r");
|
||||
/*
|
||||
The file is then created with mode read/write and
|
||||
permissions 0666 for glibc 2.0.6 and earlier or
|
||||
0600 for glibc 2.0.7 and later.
|
||||
*/
|
||||
snprintf(name_buf, sizeof(name_buf), "%sXXXXXX", fn);
|
||||
i = mkstemp(&name_buf[0]);
|
||||
if (i == -1 || chmod(name_buf, 0600) == -1) {
|
||||
name_buf = xasprintf("%sXXXXXX", fn);
|
||||
i = mkstemp(name_buf);
|
||||
if (i == -1
|
||||
|| fchmod(i, 0600) == -1
|
||||
|| !(out = fdopen(i, "w+"))
|
||||
) {
|
||||
bb_perror_nomsg_and_die();
|
||||
}
|
||||
out = fdopen(i, "w+");
|
||||
if (!out) {
|
||||
close(i);
|
||||
remove(name_buf);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
while ((i = fgetc(in)) != EOF) {
|
||||
if (i == '\r')
|
||||
continue;
|
||||
if (i == '\n') {
|
||||
if (i == '\n')
|
||||
if (conv_type == CT_UNIX2DOS)
|
||||
fputc('\r', out);
|
||||
fputc('\n', out);
|
||||
continue;
|
||||
}
|
||||
fputc(i, out);
|
||||
}
|
||||
|
||||
if (fn != NULL) {
|
||||
if (fclose(in) < 0 || fclose(out) < 0) {
|
||||
bb_perror_nomsg();
|
||||
remove(name_buf);
|
||||
return -2;
|
||||
}
|
||||
/* Assume they are both on the same filesystem (which
|
||||
* should be true since we put them into the same directory
|
||||
* so we _should_ be ok, but you never know... */
|
||||
if (rename(name_buf, fn) < 0) {
|
||||
bb_perror_msg("cannot rename '%s' as '%s'", name_buf, fn);
|
||||
return -1;
|
||||
unlink(name_buf);
|
||||
bb_perror_nomsg_and_die();
|
||||
}
|
||||
// TODO: destroys symlinks. See how passwd handles this
|
||||
xrename(name_buf, fn);
|
||||
free(name_buf);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dos2unix_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
@@ -84,10 +71,9 @@ int dos2unix_main(int argc, char **argv)
|
||||
int o, conv_type;
|
||||
|
||||
/* See if we are supposed to be doing dos2unix or unix2dos */
|
||||
conv_type = CT_UNIX2DOS;
|
||||
if (applet_name[0] == 'd') {
|
||||
conv_type = CT_DOS2UNIX; /* 2 */
|
||||
} else {
|
||||
conv_type = CT_UNIX2DOS; /* 1 */
|
||||
conv_type = CT_DOS2UNIX;
|
||||
}
|
||||
|
||||
/* -u convert to unix, -d convert to dos */
|
||||
@@ -101,11 +87,9 @@ int dos2unix_main(int argc, char **argv)
|
||||
|
||||
do {
|
||||
/* might be convert(NULL) if there is no filename given */
|
||||
o = convert(argv[optind], conv_type);
|
||||
if (o < 0)
|
||||
break;
|
||||
convert(argv[optind], conv_type);
|
||||
optind++;
|
||||
} while (optind < argc);
|
||||
|
||||
return o;
|
||||
return 0;
|
||||
}
|
||||
+5
-10
@@ -141,12 +141,11 @@ static unsigned long du(const char *filename)
|
||||
}
|
||||
|
||||
int du_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int du_main(int argc, char **argv)
|
||||
int du_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
unsigned long total;
|
||||
int slink_depth_save;
|
||||
bool print_final_total;
|
||||
char *smax_print_depth;
|
||||
unsigned opt;
|
||||
|
||||
#if ENABLE_FEATURE_HUMAN_READABLE
|
||||
@@ -168,8 +167,8 @@ int du_main(int argc, char **argv)
|
||||
* ignore -a. This is consistent with -s being equivalent to -d 0.
|
||||
*/
|
||||
#if ENABLE_FEATURE_HUMAN_READABLE
|
||||
opt_complementary = "h-km:k-hm:m-hk:H-L:L-H:s-d:d-s";
|
||||
opt = getopt32(argv, "aHkLsx" "d:" "lc" "hm", &smax_print_depth);
|
||||
opt_complementary = "h-km:k-hm:m-hk:H-L:L-H:s-d:d-s:d+";
|
||||
opt = getopt32(argv, "aHkLsx" "d:" "lc" "hm", &G.max_print_depth);
|
||||
argv += optind;
|
||||
if (opt & (1 << 9)) {
|
||||
/* -h opt */
|
||||
@@ -184,8 +183,8 @@ int du_main(int argc, char **argv)
|
||||
G.disp_hr = 1024;
|
||||
}
|
||||
#else
|
||||
opt_complementary = "H-L:L-H:s-d:d-s";
|
||||
opt = getopt32(argv, "aHkLsx" "d:" "lc", &smax_print_depth);
|
||||
opt_complementary = "H-L:L-H:s-d:d-s:d+";
|
||||
opt = getopt32(argv, "aHkLsx" "d:" "lc", &G.max_print_depth);
|
||||
argv += optind;
|
||||
#if !ENABLE_FEATURE_DU_DEFAULT_BLOCKSIZE_1K
|
||||
if (opt & (1 << 2)) {
|
||||
@@ -211,10 +210,6 @@ int du_main(int argc, char **argv)
|
||||
G.max_print_depth = 0;
|
||||
}
|
||||
G.one_file_system = opt & (1 << 5); /* -x opt */
|
||||
if (opt & (1 << 6)) {
|
||||
/* -d opt */
|
||||
G.max_print_depth = xatoi_u(smax_print_depth);
|
||||
}
|
||||
if (opt & (1 << 7)) {
|
||||
/* -l opt */
|
||||
G.count_hardlinks = MAXINT(nlink_t);
|
||||
|
||||
+10
-8
@@ -27,11 +27,9 @@
|
||||
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
/* argc is unused, but removing it precludes compiler from
|
||||
* using call -> jump optimization */
|
||||
/* NB: can be used by shell even if not enabled as applet */
|
||||
|
||||
int echo_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int echo_main(int argc, char **argv)
|
||||
int echo_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
const char *arg;
|
||||
#if !ENABLE_FEATURE_FANCY_ECHO
|
||||
@@ -110,15 +108,19 @@ int echo_main(int argc, char **argv)
|
||||
}
|
||||
#if !ENABLE_FEATURE_FANCY_ECHO
|
||||
/* SUSv3 specifies that octal escapes must begin with '0'. */
|
||||
if ( (((unsigned char)*arg) - '1') >= 7)
|
||||
if ( ((int)(unsigned char)(*arg) - '0') >= 8) /* '8' or bigger */
|
||||
#endif
|
||||
{
|
||||
/* Since SUSv3 mandates a first digit of 0, 4-digit octals
|
||||
* of the form \0### are accepted. */
|
||||
if (*arg == '0' && ((unsigned char)(arg[1]) - '0') < 8) {
|
||||
arg++;
|
||||
if (*arg == '0') {
|
||||
/* NB: don't turn "...\0" into "...\" */
|
||||
if (arg[1] && ((unsigned char)(arg[1]) - '0') < 8) {
|
||||
arg++;
|
||||
}
|
||||
}
|
||||
/* bb_process_escape_sequence can handle nul correctly */
|
||||
/* bb_process_escape_sequence handles NUL correctly
|
||||
* ("...\" case). */
|
||||
c = bb_process_escape_sequence(&arg);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -30,8 +30,6 @@
|
||||
*/
|
||||
|
||||
#include <getopt.h> /* struct option */
|
||||
extern char **environ;
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
#if ENABLE_FEATURE_ENV_LONG_OPTIONS
|
||||
@@ -42,7 +40,7 @@ static const char env_longopts[] ALIGN1 =
|
||||
#endif
|
||||
|
||||
int env_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int env_main(int argc, char **argv)
|
||||
int env_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
/* cleanenv was static - why? */
|
||||
char *cleanenv[1];
|
||||
|
||||
+8
-17
@@ -126,7 +126,7 @@ static void unexpand(FILE *file, unsigned int tab_size, unsigned opt)
|
||||
#endif
|
||||
|
||||
int expand_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int expand_main(int argc, char **argv)
|
||||
int expand_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
/* Default 8 spaces for 1 tab */
|
||||
const char *opt_t = "8";
|
||||
@@ -154,7 +154,7 @@ int expand_main(int argc, char **argv)
|
||||
if (ENABLE_EXPAND && (!ENABLE_UNEXPAND || applet_name[0] == 'e')) {
|
||||
USE_FEATURE_EXPAND_LONG_OPTIONS(applet_long_options = expand_longopts);
|
||||
opt = getopt32(argv, "it:", &opt_t);
|
||||
} else if (ENABLE_UNEXPAND) {
|
||||
} else {
|
||||
USE_FEATURE_UNEXPAND_LONG_OPTIONS(applet_long_options = unexpand_longopts);
|
||||
/* -t NUM sets also -a */
|
||||
opt_complementary = "ta";
|
||||
@@ -166,32 +166,23 @@ int expand_main(int argc, char **argv)
|
||||
|
||||
argv += optind;
|
||||
|
||||
/* If no args are given, read from stdin */
|
||||
if (!*argv) {
|
||||
*--argv = (char*)bb_msg_standard_input;
|
||||
goto use_stdin;
|
||||
}
|
||||
|
||||
do {
|
||||
if (NOT_LONE_CHAR(*argv, '-')) {
|
||||
file = fopen_or_warn(*argv, "r");
|
||||
if (!file) {
|
||||
exit_status = EXIT_FAILURE;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
use_stdin:
|
||||
file = stdin;
|
||||
file = fopen_or_warn_stdin(*argv);
|
||||
if (!file) {
|
||||
exit_status = EXIT_FAILURE;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ENABLE_EXPAND && (!ENABLE_UNEXPAND || applet_name[0] == 'e'))
|
||||
USE_EXPAND(expand(file, tab_size, opt));
|
||||
else if (ENABLE_UNEXPAND)
|
||||
else
|
||||
USE_UNEXPAND(unexpand(file, tab_size, opt));
|
||||
|
||||
/* Check and close the file */
|
||||
/* We do want all of them to execute, thus | instead of || */
|
||||
if (ferror(file) | fclose_if_not_stdin(file)) {
|
||||
if (fclose_if_not_stdin(file)) {
|
||||
bb_simple_perror_msg(*argv);
|
||||
exit_status = EXIT_FAILURE;
|
||||
}
|
||||
|
||||
+13
-16
@@ -12,18 +12,17 @@
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
static unsigned long flags;
|
||||
#define FLAG_COUNT_BYTES 1
|
||||
#define FLAG_BREAK_SPACES 2
|
||||
#define FLAG_WIDTH 4
|
||||
/* Must match getopt32 call */
|
||||
#define FLAG_COUNT_BYTES 1
|
||||
#define FLAG_BREAK_SPACES 2
|
||||
#define FLAG_WIDTH 4
|
||||
|
||||
/* Assuming the current column is COLUMN, return the column that
|
||||
printing C will move the cursor to.
|
||||
The first column is 0. */
|
||||
|
||||
static int adjust_column(int column, char c)
|
||||
{
|
||||
if (!(flags & FLAG_COUNT_BYTES)) {
|
||||
if (!(option_mask32 & FLAG_COUNT_BYTES)) {
|
||||
if (c == '\b') {
|
||||
if (column > 0)
|
||||
column--;
|
||||
@@ -54,29 +53,27 @@ int fold_main(int argc, char **argv)
|
||||
char const *a = argv[i];
|
||||
|
||||
if (*a++ == '-') {
|
||||
if (*a == '-' && !a[1])
|
||||
if (*a == '-' && !a[1]) /* "--" */
|
||||
break;
|
||||
if (isdigit(*a)) {
|
||||
if (isdigit(*a))
|
||||
argv[i] = xasprintf("-w%s", a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flags = getopt32(argv, "bsw:", &w_opt);
|
||||
if (flags & FLAG_WIDTH)
|
||||
getopt32(argv, "bsw:", &w_opt);
|
||||
if (option_mask32 & FLAG_WIDTH)
|
||||
width = xatoul_range(w_opt, 1, 10000);
|
||||
|
||||
argv += optind;
|
||||
if (!*argv) {
|
||||
if (!*argv)
|
||||
*--argv = (char*)"-";
|
||||
}
|
||||
|
||||
do {
|
||||
FILE *istream = fopen_or_warn_stdin(*argv);
|
||||
int c;
|
||||
int column = 0; /* Screen column where next char will go. */
|
||||
int offset_out = 0; /* Index in `line_out' for next char. */
|
||||
int offset_out = 0; /* Index in 'line_out' for next char. */
|
||||
|
||||
if (istream == NULL) {
|
||||
errs |= EXIT_FAILURE;
|
||||
@@ -102,7 +99,7 @@ int fold_main(int argc, char **argv)
|
||||
/* This character would make the line too long.
|
||||
Print the line plus a newline, and make this character
|
||||
start the next line. */
|
||||
if (flags & FLAG_BREAK_SPACES) {
|
||||
if (option_mask32 & FLAG_BREAK_SPACES) {
|
||||
/* Look for the last blank. */
|
||||
int logical_end;
|
||||
|
||||
@@ -144,7 +141,7 @@ int fold_main(int argc, char **argv)
|
||||
fwrite(line_out, sizeof(char), (size_t) offset_out, stdout);
|
||||
}
|
||||
|
||||
if (ferror(istream) || fclose_if_not_stdin(istream)) {
|
||||
if (fclose_if_not_stdin(istream)) {
|
||||
bb_simple_perror_msg(*argv); /* Avoid multibyte problems. */
|
||||
errs |= EXIT_FAILURE;
|
||||
}
|
||||
|
||||
+5
-5
@@ -91,19 +91,19 @@ int head_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (!*argv) {
|
||||
if (!*argv)
|
||||
*--argv = (char*)"-";
|
||||
}
|
||||
|
||||
fmt = header_fmt_str + 1;
|
||||
#if ENABLE_FEATURE_FANCY_HEAD
|
||||
if (argc - optind <= header_threshhold) {
|
||||
if (argc <= header_threshhold) {
|
||||
header_threshhold = 0;
|
||||
}
|
||||
#else
|
||||
if (argc <= optind + 1) {
|
||||
fmt += 11;
|
||||
if (argc <= 1) {
|
||||
fmt += 11; /* "" */
|
||||
}
|
||||
/* Now define some things here to avoid #ifdefs in the code below.
|
||||
* These should optimize out of the if conditions below. */
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ static int printf_full(unsigned int id, const char *arg, const char prefix)
|
||||
}
|
||||
|
||||
int id_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int id_main(int argc, char **argv)
|
||||
int id_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
struct passwd *p;
|
||||
uid_t uid;
|
||||
|
||||
@@ -11,6 +11,6 @@ typedef int (*stat_func)(const char *fn, struct stat *ps);
|
||||
int cp_mv_stat2(const char *fn, struct stat *fn_stat, stat_func sf);
|
||||
int cp_mv_stat(const char *fn, struct stat *fn_stat);
|
||||
|
||||
mode_t getopt_mk_fifo_nod(int argc, char **argv);
|
||||
mode_t getopt_mk_fifo_nod(char **argv);
|
||||
|
||||
#endif
|
||||
@@ -27,6 +27,12 @@ int cp_mv_stat2(const char *fn, struct stat *fn_stat, stat_func sf)
|
||||
{
|
||||
if (sf(fn, fn_stat) < 0) {
|
||||
if (errno != ENOENT) {
|
||||
#if ENABLE_FEATURE_VERBOSE_CP_MESSAGE
|
||||
if (errno == ENOTDIR) {
|
||||
bb_error_msg("cannot stat '%s': Path has non-directory component", fn);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
bb_perror_msg("cannot stat '%s'", fn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "libbb.h"
|
||||
#include "coreutils.h"
|
||||
|
||||
mode_t getopt_mk_fifo_nod(int argc, char **argv)
|
||||
mode_t getopt_mk_fifo_nod(char **argv)
|
||||
{
|
||||
mode_t mode = 0666;
|
||||
char *smode = NULL;
|
||||
|
||||
+2
-7
@@ -799,8 +799,6 @@ int ls_main(int argc, char **argv)
|
||||
int ac;
|
||||
int i;
|
||||
char **av;
|
||||
USE_FEATURE_AUTOWIDTH(char *tabstops_str = NULL;)
|
||||
USE_FEATURE_AUTOWIDTH(char *terminal_width_str = NULL;)
|
||||
USE_FEATURE_LS_COLOR(char *color_opt;)
|
||||
|
||||
#if ENABLE_FEATURE_LS_TIMESTAMPS
|
||||
@@ -820,12 +818,9 @@ int ls_main(int argc, char **argv)
|
||||
/* process options */
|
||||
USE_FEATURE_LS_COLOR(applet_long_options = ls_color_opt;)
|
||||
#if ENABLE_FEATURE_AUTOWIDTH
|
||||
opt = getopt32(argv, ls_options, &tabstops_str, &terminal_width_str
|
||||
opt_complementary = "T+:w+"; /* -T N, -w N */
|
||||
opt = getopt32(argv, ls_options, &tabstops, &terminal_width
|
||||
USE_FEATURE_LS_COLOR(, &color_opt));
|
||||
if (tabstops_str)
|
||||
tabstops = xatou(tabstops_str);
|
||||
if (terminal_width_str)
|
||||
terminal_width = xatou(terminal_width_str);
|
||||
#else
|
||||
opt = getopt32(argv, ls_options USE_FEATURE_LS_COLOR(, &color_opt));
|
||||
#endif
|
||||
|
||||
+14
-23
@@ -36,12 +36,9 @@ static uint8_t *hash_file(const char *filename, hash_algo_t hash_algo)
|
||||
void (*update)(const void*, size_t, void*);
|
||||
void (*final)(void*, void*);
|
||||
|
||||
src_fd = STDIN_FILENO;
|
||||
if (NOT_LONE_DASH(filename)) {
|
||||
src_fd = open_or_warn(filename, O_RDONLY);
|
||||
if (src_fd < 0) {
|
||||
return NULL;
|
||||
}
|
||||
src_fd = open_or_warn_stdin(filename);
|
||||
if (src_fd < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* figure specific hash algorithims */
|
||||
@@ -78,7 +75,7 @@ static uint8_t *hash_file(const char *filename, hash_algo_t hash_algo)
|
||||
}
|
||||
|
||||
int md5_sha1_sum_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int md5_sha1_sum_main(int argc, char **argv)
|
||||
int md5_sha1_sum_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
int return_value = EXIT_SUCCESS;
|
||||
uint8_t *hash_value;
|
||||
@@ -90,6 +87,10 @@ int md5_sha1_sum_main(int argc, char **argv)
|
||||
if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK)
|
||||
flags = getopt32(argv, "scw");
|
||||
else optind = 1;
|
||||
argv += optind;
|
||||
//argc -= optind;
|
||||
if (!*argv)
|
||||
*--argv = (char*)"-";
|
||||
|
||||
if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && !(flags & FLAG_CHECK)) {
|
||||
if (flags & FLAG_SILENT) {
|
||||
@@ -101,26 +102,18 @@ int md5_sha1_sum_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (argc == optind) {
|
||||
argv[argc++] = (char*)"-";
|
||||
}
|
||||
|
||||
if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && (flags & FLAG_CHECK)) {
|
||||
FILE *pre_computed_stream;
|
||||
int count_total = 0;
|
||||
int count_failed = 0;
|
||||
char *file_ptr = argv[optind];
|
||||
char *line;
|
||||
|
||||
if (optind + 1 != argc) {
|
||||
if (argv[1]) {
|
||||
bb_error_msg_and_die
|
||||
("only one argument may be specified when using -c");
|
||||
}
|
||||
|
||||
pre_computed_stream = stdin;
|
||||
if (NOT_LONE_DASH(file_ptr)) {
|
||||
pre_computed_stream = xfopen(file_ptr, "r");
|
||||
}
|
||||
pre_computed_stream = xfopen_stdin(argv[0]);
|
||||
|
||||
while ((line = xmalloc_getline(pre_computed_stream)) != NULL) {
|
||||
char *filename_ptr;
|
||||
@@ -168,17 +161,15 @@ int md5_sha1_sum_main(int argc, char **argv)
|
||||
}
|
||||
*/
|
||||
} else {
|
||||
while (optind < argc) {
|
||||
char *file_ptr = argv[optind++];
|
||||
|
||||
hash_value = hash_file(file_ptr, hash_algo);
|
||||
do {
|
||||
hash_value = hash_file(*argv, hash_algo);
|
||||
if (hash_value == NULL) {
|
||||
return_value = EXIT_FAILURE;
|
||||
} else {
|
||||
printf("%s %s\n", hash_value, file_ptr);
|
||||
printf("%s %s\n", hash_value, *argv);
|
||||
free(hash_value);
|
||||
}
|
||||
}
|
||||
} while (*++argv);
|
||||
}
|
||||
return return_value;
|
||||
}
|
||||
+2
-2
@@ -14,12 +14,12 @@
|
||||
#include "libcoreutils/coreutils.h"
|
||||
|
||||
int mkfifo_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int mkfifo_main(int argc, char **argv)
|
||||
int mkfifo_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
mode_t mode;
|
||||
int retval = EXIT_SUCCESS;
|
||||
|
||||
mode = getopt_mk_fifo_nod(argc, argv);
|
||||
mode = getopt_mk_fifo_nod(argv);
|
||||
|
||||
argv += optind;
|
||||
if (!*argv) {
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ int mknod_main(int argc, char **argv)
|
||||
dev_t dev;
|
||||
const char *name;
|
||||
|
||||
mode = getopt_mk_fifo_nod(argc, argv);
|
||||
mode = getopt_mk_fifo_nod(argv);
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
|
||||
|
||||
+33
-15
@@ -12,21 +12,41 @@
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
/* Compat info: nohup (GNU coreutils 6.8) does this:
|
||||
# nohup true
|
||||
nohup: ignoring input and appending output to `nohup.out'
|
||||
# nohup true 1>/dev/null
|
||||
nohup: ignoring input and redirecting stderr to stdout
|
||||
# nohup true 2>zz
|
||||
# cat zz
|
||||
nohup: ignoring input and appending output to `nohup.out'
|
||||
# nohup true 2>zz 1>/dev/null
|
||||
# cat zz
|
||||
nohup: ignoring input
|
||||
# nohup true </dev/null 1>/dev/null
|
||||
nohup: redirecting stderr to stdout
|
||||
# nohup true </dev/null 2>zz 1>/dev/null
|
||||
# cat zz
|
||||
(nothing)
|
||||
#
|
||||
*/
|
||||
|
||||
int nohup_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int nohup_main(int argc, char **argv)
|
||||
{
|
||||
int nullfd;
|
||||
const char *nohupout;
|
||||
char *home = NULL;
|
||||
char *home;
|
||||
|
||||
xfunc_error_retval = 127;
|
||||
|
||||
if (argc < 2) bb_show_usage();
|
||||
|
||||
nullfd = xopen(bb_dev_null, O_WRONLY|O_APPEND);
|
||||
/* If stdin is a tty, detach from it. */
|
||||
if (isatty(STDIN_FILENO))
|
||||
dup2(nullfd, STDIN_FILENO);
|
||||
if (isatty(STDIN_FILENO)) {
|
||||
/* bb_error_msg("ignoring input"); */
|
||||
close(STDIN_FILENO);
|
||||
xopen(bb_dev_null, O_RDONLY); /* will be fd 0 (STDIN_FILENO) */
|
||||
}
|
||||
|
||||
nohupout = "nohup.out";
|
||||
/* Redirect stdout to nohup.out, either in "." or in "$HOME". */
|
||||
@@ -37,24 +57,22 @@ int nohup_main(int argc, char **argv)
|
||||
if (home) {
|
||||
nohupout = concat_path_file(home, nohupout);
|
||||
xopen3(nohupout, O_CREAT|O_WRONLY|O_APPEND, S_IRUSR|S_IWUSR);
|
||||
} else {
|
||||
xopen(bb_dev_null, O_RDONLY); /* will be fd 1 */
|
||||
}
|
||||
}
|
||||
} else dup2(nullfd, STDOUT_FILENO);
|
||||
bb_error_msg("appending output to %s", nohupout);
|
||||
}
|
||||
|
||||
/* If we have a tty on stderr, announce filename and redirect to stdout.
|
||||
* Else redirect to /dev/null.
|
||||
*/
|
||||
/* If we have a tty on stderr, redirect to stdout. */
|
||||
if (isatty(STDERR_FILENO)) {
|
||||
bb_error_msg("appending to %s", nohupout);
|
||||
/* if (stdout_wasnt_a_tty)
|
||||
bb_error_msg("redirecting stderr to stdout"); */
|
||||
dup2(STDOUT_FILENO, STDERR_FILENO);
|
||||
} else dup2(nullfd, STDERR_FILENO);
|
||||
}
|
||||
|
||||
if (nullfd > 2)
|
||||
close(nullfd);
|
||||
signal(SIGHUP, SIG_IGN);
|
||||
|
||||
BB_EXECVP(argv[1], argv+1);
|
||||
if (ENABLE_FEATURE_CLEAN_UP && home)
|
||||
free((char*)nohupout);
|
||||
bb_simple_perror_msg_and_die(argv[1]);
|
||||
}
|
||||
+15
-24
@@ -17,7 +17,7 @@
|
||||
|
||||
/* Written by Jim Meyering. */
|
||||
|
||||
/* Busyboxed by Denis Vlasenko
|
||||
/* Busyboxed by Denys Vlasenko
|
||||
|
||||
Based on od.c from coreutils-5.2.1
|
||||
Top bloat sources:
|
||||
@@ -188,7 +188,7 @@ static off_t pseudo_offset;
|
||||
a multiple of the least common multiple of the sizes associated with
|
||||
the specified output types. It should be as large as possible, but
|
||||
no larger than 16 -- unless specified with the -w option. */
|
||||
static size_t bytes_per_block;
|
||||
static unsigned bytes_per_block = 32; /* have to use unsigned, not size_t */
|
||||
|
||||
/* A NULL-terminated list of the file-arguments from the command line. */
|
||||
static const char *const *file_list;
|
||||
@@ -360,7 +360,7 @@ print_long_double(size_t n_bytes, const char *block, const char *fmt_string)
|
||||
}
|
||||
|
||||
/* print_[named]_ascii are optimized for speed.
|
||||
* Remember, someday you may want to pump gigabytes thru this thing.
|
||||
* Remember, someday you may want to pump gigabytes through this thing.
|
||||
* Saving a dozen of .text bytes here is counter-productive */
|
||||
|
||||
static void
|
||||
@@ -723,7 +723,7 @@ decode_one_format(const char *s_orig, const char *s, const char **next,
|
||||
|
||||
/* Decode the modern od format string S. Append the decoded
|
||||
representation to the global array SPEC, reallocating SPEC if
|
||||
necessary. Return zero if S is valid, nonzero otherwise. */
|
||||
necessary. */
|
||||
|
||||
static void
|
||||
decode_format_string(const char *s)
|
||||
@@ -776,18 +776,18 @@ skip(off_t n_skip)
|
||||
as large as the size of the current file, we can
|
||||
decrement n_skip and go on to the next file. */
|
||||
if (fstat(fileno(in_stream), &file_stats) == 0
|
||||
&& S_ISREG(file_stats.st_mode) && file_stats.st_size >= 0
|
||||
&& S_ISREG(file_stats.st_mode) && file_stats.st_size > 0
|
||||
) {
|
||||
if (file_stats.st_size < n_skip) {
|
||||
n_skip -= file_stats.st_size;
|
||||
/* take check&close / open_next route */
|
||||
/* take "check & close / open_next" route */
|
||||
} else {
|
||||
if (fseeko(in_stream, n_skip, SEEK_CUR) != 0)
|
||||
ioerror = 1;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
/* If it's not a regular file with nonnegative size,
|
||||
/* If it's not a regular file with positive size,
|
||||
position the file pointer by reading. */
|
||||
char buf[1024];
|
||||
size_t n_bytes_to_read = 1024;
|
||||
@@ -1000,9 +1000,7 @@ parse_old_offset(const char *s, off_t *offset)
|
||||
spec, extend the input block with zero bytes until its length is a
|
||||
multiple of all format spec sizes. Write the final block. Finally,
|
||||
write on a line by itself the offset of the byte after the last byte
|
||||
read. Accumulate return values from calls to read_block and
|
||||
check_and_close, and if any was nonzero, return nonzero.
|
||||
Otherwise, return zero. */
|
||||
read. */
|
||||
|
||||
static void
|
||||
dump(off_t current_offset, off_t end_offset)
|
||||
@@ -1078,8 +1076,7 @@ dump(off_t current_offset, off_t end_offset)
|
||||
and INPUT_FILENAME so they correspond to the next file in the list.
|
||||
Then try to read a byte from the newly opened file. Repeat if
|
||||
necessary until EOF is reached for the last file in FILE_LIST, then
|
||||
set *C to EOF and return. Subsequent calls do likewise. The return
|
||||
value is nonzero if any errors occured, zero otherwise. */
|
||||
set *C to EOF and return. Subsequent calls do likewise. */
|
||||
|
||||
static void
|
||||
read_char(int *c)
|
||||
@@ -1112,8 +1109,7 @@ read_char(int *c)
|
||||
A string constant is a run of at least 'string_min' ASCII
|
||||
graphic (or formatting) characters terminated by a null.
|
||||
Based on a function written by Richard Stallman for a
|
||||
traditional version of od. Return nonzero if an error
|
||||
occurs. Otherwise, return zero. */
|
||||
traditional version of od. */
|
||||
|
||||
static void
|
||||
dump_strings(off_t address, off_t end_offset)
|
||||
@@ -1181,7 +1177,6 @@ dump_strings(off_t address, off_t end_offset)
|
||||
int od_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int od_main(int argc, char **argv)
|
||||
{
|
||||
static char const *const default_file_list[] = { "-", NULL };
|
||||
static const struct suffix_mult bkm[] = {
|
||||
{ "b", 512 },
|
||||
{ "k", 1024 },
|
||||
@@ -1222,7 +1217,6 @@ int od_main(int argc, char **argv)
|
||||
;
|
||||
#endif
|
||||
char *str_A, *str_N, *str_j, *str_S;
|
||||
char *str_w = NULL;
|
||||
llist_t *lst_t = NULL;
|
||||
unsigned opt;
|
||||
int l_c_m;
|
||||
@@ -1243,7 +1237,7 @@ int od_main(int argc, char **argv)
|
||||
/* flag_dump_strings = 0; - already is */
|
||||
|
||||
/* Parse command line */
|
||||
opt_complementary = "t::"; // list
|
||||
opt_complementary = "w+:t::"; /* -w N, -t is a list */
|
||||
#if ENABLE_GETOPT_LONG
|
||||
applet_long_options = od_longopts;
|
||||
#endif
|
||||
@@ -1252,7 +1246,7 @@ int od_main(int argc, char **argv)
|
||||
// -S was -s and also had optional parameter
|
||||
// but in coreutils 6.3 it was renamed and now has
|
||||
// _mandatory_ parameter
|
||||
&str_A, &str_N, &str_j, &lst_t, &str_S, &str_w);
|
||||
&str_A, &str_N, &str_j, &lst_t, &str_S, &bytes_per_block);
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (opt & OPT_A) {
|
||||
@@ -1388,7 +1382,7 @@ int od_main(int argc, char **argv)
|
||||
/* If no files were listed on the command line,
|
||||
set the global pointer FILE_LIST so that it
|
||||
references the null-terminated list of one name: "-". */
|
||||
file_list = default_file_list;
|
||||
file_list = bb_argv_dash;
|
||||
if (argc > 0) {
|
||||
/* Set the global pointer FILE_LIST so that it
|
||||
references the first file-argument on the command-line. */
|
||||
@@ -1408,12 +1402,9 @@ int od_main(int argc, char **argv)
|
||||
l_c_m = get_lcm();
|
||||
|
||||
if (opt & OPT_w) { /* -w: width */
|
||||
bytes_per_block = 32;
|
||||
if (str_w)
|
||||
bytes_per_block = xatou(str_w);
|
||||
if (!bytes_per_block || bytes_per_block % l_c_m != 0) {
|
||||
bb_error_msg("warning: invalid width %zu; using %d instead",
|
||||
bytes_per_block, l_c_m);
|
||||
bb_error_msg("warning: invalid width %u; using %d instead",
|
||||
(unsigned)bytes_per_block, l_c_m);
|
||||
bytes_per_block = l_c_m;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -9,13 +9,12 @@
|
||||
*/
|
||||
|
||||
#include "libbb.h"
|
||||
extern char **environ;
|
||||
|
||||
int printenv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int printenv_main(int argc, char **argv)
|
||||
int printenv_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
/* no variables specified, show whole env */
|
||||
if (argc == 1) {
|
||||
if (!argv[1]) {
|
||||
int e = 0;
|
||||
while (environ[e])
|
||||
puts(environ[e++]);
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
int pwd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int pwd_main(int argc, char **argv)
|
||||
int pwd_main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char *buf;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "libbb.h"
|
||||
|
||||
int readlink_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int readlink_main(int argc, char **argv)
|
||||
int readlink_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
char *buf;
|
||||
char *fname;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "libbb.h"
|
||||
|
||||
int realpath_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int realpath_main(int argc, char **argv)
|
||||
int realpath_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
int retval = EXIT_SUCCESS;
|
||||
|
||||
@@ -25,19 +25,18 @@ int realpath_main(int argc, char **argv)
|
||||
# define resolved_path_MUST_FREE 0
|
||||
#endif
|
||||
|
||||
if (--argc == 0) {
|
||||
if (!*++argv) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
do {
|
||||
argv++;
|
||||
if (realpath(*argv, resolved_path) != NULL) {
|
||||
puts(resolved_path);
|
||||
} else {
|
||||
retval = EXIT_FAILURE;
|
||||
bb_simple_perror_msg(*argv);
|
||||
}
|
||||
} while (--argc);
|
||||
} while (*++argv);
|
||||
|
||||
#if ENABLE_FEATURE_CLEAN_UP && resolved_path_MUST_FREE
|
||||
RELEASE_CONFIG_BUFFER(resolved_path);
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
int rm_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int rm_main(int argc, char **argv)
|
||||
int rm_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
int status = 0;
|
||||
int flags = 0;
|
||||
|
||||
+22
-13
@@ -10,20 +10,30 @@
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/rmdir.html */
|
||||
|
||||
#include <libgen.h>
|
||||
#include "libbb.h"
|
||||
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
|
||||
#define PARENTS 0x01
|
||||
#define IGNORE_NON_EMPTY 0x02
|
||||
|
||||
int rmdir_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int rmdir_main(int argc, char **argv)
|
||||
int rmdir_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
int status = EXIT_SUCCESS;
|
||||
int flags;
|
||||
int do_dot;
|
||||
char *path;
|
||||
|
||||
#if ENABLE_FEATURE_RMDIR_LONG_OPTIONS
|
||||
static const char rmdir_longopts[] ALIGN1 =
|
||||
"parents\0" No_argument "p"
|
||||
/* Debian etch: many packages fail to be purged or installed
|
||||
* because they desperately want this option: */
|
||||
"ignore-fail-on-non-empty\0" No_argument "\xff"
|
||||
;
|
||||
applet_long_options = rmdir_longopts;
|
||||
#endif
|
||||
flags = getopt32(argv, "p");
|
||||
argv += optind;
|
||||
|
||||
@@ -34,27 +44,26 @@ int rmdir_main(int argc, char **argv)
|
||||
do {
|
||||
path = *argv;
|
||||
|
||||
/* Record if the first char was a '.' so we can use dirname later. */
|
||||
do_dot = (*path == '.');
|
||||
|
||||
while (1) {
|
||||
if (rmdir(path) < 0) {
|
||||
#if ENABLE_FEATURE_RMDIR_LONG_OPTIONS
|
||||
if ((flags & IGNORE_NON_EMPTY) && errno == ENOTEMPTY)
|
||||
break;
|
||||
#endif
|
||||
bb_perror_msg("'%s'", path); /* Match gnu rmdir msg. */
|
||||
status = EXIT_FAILURE;
|
||||
} else if (flags) {
|
||||
/* Note: path was not empty or null since rmdir succeeded. */
|
||||
} else if (flags & PARENTS) {
|
||||
/* Note: path was not "" since rmdir succeeded. */
|
||||
path = dirname(path);
|
||||
/* Path is now just the parent component. Note that dirname
|
||||
* returns "." if there are no parents. We must distinguish
|
||||
* this from the case of the original path starting with '.'.
|
||||
/* Path is now just the parent component. Dirname
|
||||
* returns "." if there are no parents.
|
||||
*/
|
||||
if (do_dot || (*path != '.') || path[1]) {
|
||||
if (NOT_LONE_CHAR(path, '.')) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
} while (*++argv);
|
||||
|
||||
return status;
|
||||
|
||||
+6
-11
@@ -34,17 +34,16 @@ static const struct suffix_mult sfx[] = {
|
||||
#endif
|
||||
|
||||
int sleep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int sleep_main(int argc, char **argv)
|
||||
int sleep_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
unsigned duration;
|
||||
|
||||
++argv;
|
||||
if (!*argv)
|
||||
bb_show_usage();
|
||||
|
||||
#if ENABLE_FEATURE_FANCY_SLEEP
|
||||
|
||||
if (argc < 2) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
++argv;
|
||||
duration = 0;
|
||||
do {
|
||||
duration += xatoul_range_sfx(*argv, 0, UINT_MAX-duration, sfx);
|
||||
@@ -52,11 +51,7 @@ int sleep_main(int argc, char **argv)
|
||||
|
||||
#else /* FEATURE_FANCY_SLEEP */
|
||||
|
||||
if (argc != 2) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
duration = xatou(argv[1]);
|
||||
duration = xatou(*argv);
|
||||
|
||||
#endif /* FEATURE_FANCY_SLEEP */
|
||||
|
||||
|
||||
+14
-9
@@ -32,7 +32,7 @@ enum {
|
||||
FLAG_u = 8, /* Unique */
|
||||
FLAG_c = 0x10, /* Check: no output, exit(!ordered) */
|
||||
FLAG_s = 0x20, /* Stable sort, no ascii fallback at end */
|
||||
FLAG_z = 0x40, /* Input is null terminated, not \n */
|
||||
FLAG_z = 0x40, /* Input and output is NUL terminated, not \n */
|
||||
/* These can be applied to search keys, the previous four can't */
|
||||
FLAG_b = 0x80, /* Ignore leading blanks */
|
||||
FLAG_r = 0x100, /* Reverse */
|
||||
@@ -275,7 +275,7 @@ static unsigned str2u(char **str)
|
||||
#endif
|
||||
|
||||
int sort_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int sort_main(int argc, char **argv)
|
||||
int sort_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
FILE *fp, *outfile = stdout;
|
||||
char *line, **lines = NULL;
|
||||
@@ -351,10 +351,13 @@ int sort_main(int argc, char **argv)
|
||||
if (option_mask32 & FLAG_b) option_mask32 |= FLAG_bb;
|
||||
|
||||
/* Open input files and read data */
|
||||
for (i = argv[optind] ? optind : optind-1; argv[i]; i++) {
|
||||
fp = stdin;
|
||||
if (i >= optind && NOT_LONE_DASH(argv[i]))
|
||||
fp = xfopen(argv[i], "r");
|
||||
argv += optind;
|
||||
if (!*argv)
|
||||
*--argv = (char*)"-";
|
||||
do {
|
||||
/* coreutils 6.9 compat: abort on first open error,
|
||||
* do not continue to next file: */
|
||||
fp = xfopen_stdin(*argv);
|
||||
for (;;) {
|
||||
line = GET_LINE(fp);
|
||||
if (!line) break;
|
||||
@@ -362,8 +365,9 @@ int sort_main(int argc, char **argv)
|
||||
lines = xrealloc(lines, sizeof(char *) * (linecount + 64));
|
||||
lines[linecount++] = line;
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
fclose_if_not_stdin(fp);
|
||||
} while (*++argv);
|
||||
|
||||
#if ENABLE_FEATURE_SORT_BIG
|
||||
/* if no key, perform alphabetic sort */
|
||||
if (!key_list)
|
||||
@@ -396,8 +400,9 @@ int sort_main(int argc, char **argv)
|
||||
if (linecount) linecount = flag+1;
|
||||
}
|
||||
/* Print it */
|
||||
flag = (option_mask32 & FLAG_z) ? '\0' : '\n';
|
||||
for (i = 0; i < linecount; i++)
|
||||
fprintf(outfile, "%s\n", lines[i]);
|
||||
fprintf(outfile, "%s%c", lines[i], flag);
|
||||
|
||||
fflush_stdout_and_exit(EXIT_SUCCESS);
|
||||
}
|
||||
+6
-8
@@ -56,7 +56,7 @@ enum { READ_BUFFER_SIZE = COMMON_BUFSIZE - 1 };
|
||||
#define SPLIT_OPT_a (1<<2)
|
||||
|
||||
int split_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int split_main(int argc, char **argv)
|
||||
int split_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
unsigned suffix_len = 2;
|
||||
char *pfx;
|
||||
@@ -68,15 +68,13 @@ int split_main(int argc, char **argv)
|
||||
ssize_t bytes_read, to_write;
|
||||
char *src;
|
||||
|
||||
opt_complementary = "?2";
|
||||
opt = getopt32(argv, "l:b:a:", &count_p, &count_p, &sfx);
|
||||
opt_complementary = "?2:a+"; /* max 2 args; -a N */
|
||||
opt = getopt32(argv, "l:b:a:", &count_p, &count_p, &suffix_len);
|
||||
|
||||
if (opt & SPLIT_OPT_l)
|
||||
cnt = xatoul(count_p);
|
||||
if (opt & SPLIT_OPT_b)
|
||||
cnt = xatoul_sfx(count_p, split_suffices);
|
||||
if (opt & SPLIT_OPT_a)
|
||||
suffix_len = xatou(sfx);
|
||||
cnt = XATOOFF(count_p);
|
||||
if (opt & SPLIT_OPT_b) // FIXME: also needs XATOOFF
|
||||
cnt = xatoull_sfx(count_p, split_suffices);
|
||||
sfx = "x";
|
||||
|
||||
argv += optind;
|
||||
|
||||
+18
-3
@@ -21,6 +21,12 @@
|
||||
#define OPT_DEREFERENCE (1 << 2)
|
||||
#define OPT_SELINUX (1 << 3)
|
||||
|
||||
#if ENABLE_FEATURE_STAT_FORMAT
|
||||
typedef bool (*statfunc_ptr)(const char *, const char *);
|
||||
#else
|
||||
typedef bool (*statfunc_ptr)(const char *);
|
||||
#endif
|
||||
|
||||
static const char *file_type(const struct stat *st)
|
||||
{
|
||||
/* See POSIX 1003.1-2001 XCU Table 4-8 lines 17093-17107
|
||||
@@ -338,8 +344,14 @@ static void print_it(const char *masterformat, const char *filename,
|
||||
#endif
|
||||
|
||||
/* Stat the file system and print what we find. */
|
||||
#if !ENABLE_FEATURE_STAT_FORMAT
|
||||
#define do_statfs(filename, format) do_statfs(filename)
|
||||
#endif
|
||||
static bool do_statfs(const char *filename, const char *format)
|
||||
{
|
||||
#if !ENABLE_FEATURE_STAT_FORMAT
|
||||
const char *format;
|
||||
#endif
|
||||
struct statfs statfsbuf;
|
||||
#if ENABLE_SELINUX
|
||||
security_context_t scontext = NULL;
|
||||
@@ -447,6 +459,9 @@ static bool do_statfs(const char *filename, const char *format)
|
||||
}
|
||||
|
||||
/* stat the file and print what we find */
|
||||
#if !ENABLE_FEATURE_STAT_FORMAT
|
||||
#define do_stat(filename, format) do_stat(filename)
|
||||
#endif
|
||||
static bool do_stat(const char *filename, const char *format)
|
||||
{
|
||||
struct stat statbuf;
|
||||
@@ -612,10 +627,10 @@ 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)
|
||||
{
|
||||
char *format = NULL;
|
||||
USE_FEATURE_STAT_FORMAT(char *format = NULL;)
|
||||
int i;
|
||||
int ok = 1;
|
||||
bool (*statfunc)(const char *, const char *) = do_stat;
|
||||
statfunc_ptr statfunc = do_stat;
|
||||
|
||||
getopt32(argv, "ftL"
|
||||
USE_SELINUX("Z")
|
||||
@@ -633,7 +648,7 @@ int stat_main(int argc, char **argv)
|
||||
}
|
||||
#endif /* ENABLE_SELINUX */
|
||||
for (i = optind; i < argc; ++i)
|
||||
ok &= statfunc(argv[i], format);
|
||||
ok &= statfunc(argv[i] USE_FEATURE_STAT_FORMAT(, format));
|
||||
|
||||
return (ok ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
+13
-14
@@ -21,20 +21,17 @@ enum { SUM_BSD, PRINT_NAME, SUM_SYSV };
|
||||
The checksum varies depending on sizeof (int). */
|
||||
/* SYSV: calculate and print the checksum and the size in 512-byte blocks */
|
||||
/* Return 1 if successful. */
|
||||
static unsigned sum_file(const char *file, const unsigned type)
|
||||
static unsigned sum_file(const char *file, unsigned type)
|
||||
{
|
||||
#define buf bb_common_bufsiz1
|
||||
unsigned long long total_bytes = 0;
|
||||
int fd = 0, r;
|
||||
|
||||
int fd, r;
|
||||
/* The sum of all the input bytes, modulo (UINT_MAX + 1). */
|
||||
unsigned s = 0;
|
||||
|
||||
if (NOT_LONE_DASH(file)) {
|
||||
fd = open(file, O_RDONLY);
|
||||
if (fd == -1)
|
||||
goto ret_bad;
|
||||
}
|
||||
fd = open_or_warn_stdin(file);
|
||||
if (fd == -1)
|
||||
return 0;
|
||||
|
||||
while (1) {
|
||||
size_t bytes_read = safe_read(fd, buf, BUFSIZ);
|
||||
@@ -44,7 +41,6 @@ static unsigned sum_file(const char *file, const unsigned type)
|
||||
if (!bytes_read && !r)
|
||||
/* no error */
|
||||
break;
|
||||
ret_bad:
|
||||
bb_perror_msg(file);
|
||||
return 0;
|
||||
}
|
||||
@@ -75,26 +71,29 @@ static unsigned sum_file(const char *file, const unsigned type)
|
||||
}
|
||||
|
||||
int sum_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int sum_main(int argc, char **argv)
|
||||
int sum_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
unsigned n;
|
||||
unsigned type = SUM_BSD;
|
||||
|
||||
n = getopt32(argv, "sr");
|
||||
argv += optind;
|
||||
if (n & 1) type = SUM_SYSV;
|
||||
/* give the bsd priority over sysv func */
|
||||
if (n & 2) type = SUM_BSD;
|
||||
|
||||
if (argc == optind) {
|
||||
if (!argv[0]) {
|
||||
/* Do not print the name */
|
||||
n = sum_file("-", type);
|
||||
} else {
|
||||
/* Need to print the name if either
|
||||
- more than one file given
|
||||
- doing sysv */
|
||||
type += argc - 1 > optind || type == SUM_SYSV;
|
||||
for (n = 1; optind < argc; optind++)
|
||||
n &= sum_file(argv[optind], type);
|
||||
type += (argv[1] || type == SUM_SYSV);
|
||||
n = 1;
|
||||
do {
|
||||
n &= sum_file(*argv, type);
|
||||
} while (*++argv);
|
||||
}
|
||||
return !n;
|
||||
}
|
||||
+2
-1
@@ -14,8 +14,9 @@
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
int sync_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int sync_main(int argc, char **argv)
|
||||
int sync_main(int argc, char **argv ATTRIBUTE_UNUSED)
|
||||
{
|
||||
/* coreutils-6.9 compat */
|
||||
bb_warn_ignoring_args(argc - 1);
|
||||
|
||||
sync();
|
||||
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* tac implementation for busybox
|
||||
*
|
||||
* Copyright (C) 2003 Yang Xiaopeng <yxp at hanwang.com.cn>
|
||||
* Copyright (C) 2007 Natanael Copa <natanael.copa@gmail.com>
|
||||
* Copyright (C) 2007 Tito Ragusa <farmatito@tiscali.it>
|
||||
*
|
||||
* Licensed under GPLv2, see file License in this tarball for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/* tac - concatenate and print files in reverse */
|
||||
|
||||
/* Based on Yang Xiaopeng's (yxp at hanwang.com.cn) patch
|
||||
* http://www.uclibc.org/lists/busybox/2003-July/008813.html
|
||||
*/
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
/* This is a NOEXEC applet. Be very careful! */
|
||||
|
||||
struct lstring {
|
||||
int size;
|
||||
char buf[1];
|
||||
};
|
||||
|
||||
int tac_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int tac_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
char **name;
|
||||
FILE *f;
|
||||
struct lstring *line = NULL;
|
||||
llist_t *list = NULL;
|
||||
int retval = EXIT_SUCCESS;
|
||||
|
||||
#if ENABLE_DESKTOP
|
||||
/* tac from coreutils 6.9 supports:
|
||||
-b, --before
|
||||
attach the separator before instead of after
|
||||
-r, --regex
|
||||
interpret the separator as a regular expression
|
||||
-s, --separator=STRING
|
||||
use STRING as the separator instead of newline
|
||||
We support none, but at least we will complain or handle "--":
|
||||
*/
|
||||
getopt32(argv, "");
|
||||
argv += optind;
|
||||
#else
|
||||
argv++;
|
||||
#endif
|
||||
if (!*argv)
|
||||
*--argv = (char *)"-";
|
||||
/* We will read from last file to first */
|
||||
name = argv;
|
||||
while (*name)
|
||||
name++;
|
||||
|
||||
do {
|
||||
int ch, i;
|
||||
|
||||
name--;
|
||||
f = fopen_or_warn_stdin(*name);
|
||||
if (f == NULL) {
|
||||
/* error message is printed by fopen_or_warn_stdin */
|
||||
retval = EXIT_FAILURE;
|
||||
continue;
|
||||
}
|
||||
|
||||
errno = i = 0;
|
||||
do {
|
||||
ch = fgetc(f);
|
||||
if (ch != EOF) {
|
||||
if (!(i & 0x7f))
|
||||
/* Grow on every 128th char */
|
||||
line = xrealloc(line, i + 0x7f + sizeof(int) + 1);
|
||||
line->buf[i++] = ch;
|
||||
}
|
||||
if (ch == '\n' || (ch == EOF && i != 0)) {
|
||||
line = xrealloc(line, i + sizeof(int));
|
||||
line->size = i;
|
||||
llist_add_to(&list, line);
|
||||
line = NULL;
|
||||
i = 0;
|
||||
}
|
||||
} while (ch != EOF);
|
||||
/* fgetc sets errno to ENOENT on EOF, we don't want
|
||||
* to warn on this non-error! */
|
||||
if (errno && errno != ENOENT) {
|
||||
bb_simple_perror_msg(*name);
|
||||
retval = EXIT_FAILURE;
|
||||
}
|
||||
} while (name != argv);
|
||||
|
||||
while (list) {
|
||||
line = (struct lstring *)list->data;
|
||||
xwrite(STDOUT_FILENO, line->buf, line->size);
|
||||
if (ENABLE_FEATURE_CLEAN_UP) {
|
||||
free(llist_pop(&list));
|
||||
} else {
|
||||
list = list->link;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
+50
-54
@@ -74,7 +74,7 @@ static unsigned eat_num(const char *p)
|
||||
p++;
|
||||
else if (*p == '+') {
|
||||
p++;
|
||||
G.status = EXIT_FAILURE;
|
||||
G.status = 1; /* mark that we saw "+" */
|
||||
}
|
||||
return xatou_sfx(p, tail_suffixes);
|
||||
}
|
||||
@@ -87,12 +87,11 @@ int tail_main(int argc, char **argv)
|
||||
bool from_top;
|
||||
int header_threshhold = 1;
|
||||
const char *str_c, *str_n;
|
||||
USE_FEATURE_FANCY_TAIL(const char *str_s;)
|
||||
|
||||
char *tailbuf;
|
||||
size_t tailbufsize;
|
||||
int taillen = 0;
|
||||
int newline = 0;
|
||||
int newlines_seen = 0;
|
||||
int nfiles, nread, nwrite, seen, i, opt;
|
||||
|
||||
int *fds;
|
||||
@@ -101,21 +100,18 @@ int tail_main(int argc, char **argv)
|
||||
|
||||
#if ENABLE_INCLUDE_SUSv2 || ENABLE_FEATURE_FANCY_TAIL
|
||||
/* Allow legacy syntax of an initial numeric option without -n. */
|
||||
if (argc >= 2 && (argv[1][0] == '+' || argv[1][0] == '-')
|
||||
if (argv[1] && (argv[1][0] == '+' || argv[1][0] == '-')
|
||||
&& isdigit(argv[1][1])
|
||||
) {
|
||||
/* replacing arg[0] with "-n" can segfault, so... */
|
||||
argv[1] = xasprintf("-n%s", argv[1]);
|
||||
#if 0 /* If we ever decide to make tail NOFORK */
|
||||
char *s = alloca(strlen(argv[1]) + 3);
|
||||
sprintf(s, "-n%s", argv[1]);
|
||||
argv[1] = s;
|
||||
#endif
|
||||
count = eat_num(&argv[1][1]);
|
||||
argv++;
|
||||
argc--;
|
||||
}
|
||||
#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(,&str_s));
|
||||
&str_c, &str_n USE_FEATURE_FANCY_TAIL(,&sleep_period));
|
||||
#define FOLLOW (opt & 0x1)
|
||||
#define COUNT_BYTES (opt & 0x2)
|
||||
//if (opt & 0x1) // -f
|
||||
@@ -123,18 +119,16 @@ int tail_main(int argc, char **argv)
|
||||
if (opt & 0x4) count = eat_num(str_n); // -n
|
||||
#if ENABLE_FEATURE_FANCY_TAIL
|
||||
if (opt & 0x8) header_threshhold = INT_MAX; // -q
|
||||
if (opt & 0x10) sleep_period = xatou(str_s); // -s
|
||||
if (opt & 0x20) header_threshhold = 0; // -v
|
||||
#endif
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
from_top = G.status;
|
||||
from_top = G.status; /* 1 if there was "-c +N" or "-n +N" */
|
||||
G.status = EXIT_SUCCESS;
|
||||
|
||||
/* open all the files */
|
||||
fds = xmalloc(sizeof(int) * (argc + 1));
|
||||
nfiles = i = 0;
|
||||
G.status = EXIT_SUCCESS;
|
||||
if (argc == 0) {
|
||||
if (!argv[0]) {
|
||||
struct stat statbuf;
|
||||
|
||||
if (!fstat(STDIN_FILENO, &statbuf) && S_ISFIFO(statbuf.st_mode)) {
|
||||
@@ -142,52 +136,59 @@ int tail_main(int argc, char **argv)
|
||||
}
|
||||
*argv = (char *) bb_msg_standard_input;
|
||||
}
|
||||
nfiles = i = 0;
|
||||
do {
|
||||
FILE* fil = fopen_or_warn_stdin(argv[i]);
|
||||
if (!fil) {
|
||||
int fd = open_or_warn_stdin(argv[i]);
|
||||
if (fd < 0) {
|
||||
G.status = EXIT_FAILURE;
|
||||
continue;
|
||||
}
|
||||
fds[nfiles] = fileno(fil);
|
||||
fds[nfiles] = fd;
|
||||
argv[nfiles++] = argv[i];
|
||||
} while (++i < argc);
|
||||
|
||||
if (!nfiles)
|
||||
bb_error_msg_and_die("no files");
|
||||
|
||||
/* prepare the buffer */
|
||||
tailbufsize = BUFSIZ;
|
||||
|
||||
/* tail the files */
|
||||
if (!from_top && COUNT_BYTES) {
|
||||
if (tailbufsize < count) {
|
||||
if (tailbufsize < count + BUFSIZ) {
|
||||
tailbufsize = count + BUFSIZ;
|
||||
}
|
||||
}
|
||||
tailbuf = xmalloc(tailbufsize);
|
||||
|
||||
buf = tailbuf = xmalloc(tailbufsize);
|
||||
|
||||
/* tail the files */
|
||||
fmt = header_fmt + 1; /* Skip header leading newline on first output. */
|
||||
i = 0;
|
||||
do {
|
||||
/* Be careful. It would be possible to optimize the count-bytes
|
||||
* case if the file is seekable. If you do though, remember that
|
||||
* starting file position may not be the beginning of the file.
|
||||
* Beware of backing up too far. See example in wc.c.
|
||||
*/
|
||||
if (!(count | from_top) && lseek(fds[i], 0, SEEK_END) >= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
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 (current > 0) {
|
||||
if (count == 0)
|
||||
continue; /* showing zero lines is easy :) */
|
||||
current -= count;
|
||||
if (current < 0)
|
||||
current = 0;
|
||||
xlseek(fds[i], current, SEEK_SET);
|
||||
bb_copyfd_size(fds[i], STDOUT_FILENO, count);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
buf = tailbuf;
|
||||
taillen = 0;
|
||||
seen = 1;
|
||||
newline = 0;
|
||||
|
||||
newlines_seen = 0;
|
||||
while ((nread = tail_read(fds[i], buf, tailbufsize-taillen)) > 0) {
|
||||
if (from_top) {
|
||||
nwrite = nread;
|
||||
@@ -215,34 +216,32 @@ int tail_main(int argc, char **argv)
|
||||
}
|
||||
} else {
|
||||
int k = nread;
|
||||
int nbuf = 0;
|
||||
int newlines_in_buf = 0;
|
||||
|
||||
while (k) {
|
||||
--k;
|
||||
do { /* count '\n' in last read */
|
||||
k--;
|
||||
if (buf[k] == '\n') {
|
||||
++nbuf;
|
||||
newlines_in_buf++;
|
||||
}
|
||||
}
|
||||
} while (k);
|
||||
|
||||
if (newline + nbuf < count) {
|
||||
newline += nbuf;
|
||||
if (newlines_seen + newlines_in_buf < count) {
|
||||
newlines_seen += newlines_in_buf;
|
||||
taillen += nread;
|
||||
} else {
|
||||
int extra = 0;
|
||||
int extra = (buf[nread-1] != '\n');
|
||||
|
||||
if (buf[nread-1] != '\n')
|
||||
extra = 1;
|
||||
k = newline + nbuf + extra - count;
|
||||
k = newlines_seen + newlines_in_buf + extra - count;
|
||||
s = tailbuf;
|
||||
while (k) {
|
||||
if (*s == '\n') {
|
||||
--k;
|
||||
k--;
|
||||
}
|
||||
++s;
|
||||
s++;
|
||||
}
|
||||
taillen += nread - (s - tailbuf);
|
||||
memmove(tailbuf, s, taillen);
|
||||
newline = count - extra;
|
||||
newlines_seen = count - extra;
|
||||
}
|
||||
if (tailbufsize < taillen + BUFSIZ) {
|
||||
tailbufsize = taillen + BUFSIZ;
|
||||
@@ -251,13 +250,10 @@ int tail_main(int argc, char **argv)
|
||||
}
|
||||
buf = tailbuf + taillen;
|
||||
}
|
||||
}
|
||||
|
||||
} /* while (tail_read() > 0) */
|
||||
if (!from_top) {
|
||||
xwrite(STDOUT_FILENO, tailbuf, taillen);
|
||||
}
|
||||
|
||||
taillen = 0;
|
||||
} while (++i < nfiles);
|
||||
|
||||
buf = xrealloc(tailbuf, BUFSIZ);
|
||||
|
||||
+2
-2
@@ -36,12 +36,12 @@ int tee_main(int argc, char **argv)
|
||||
mode += (retval & 2); /* Since 'a' is the 2nd option... */
|
||||
|
||||
if (retval & 1) {
|
||||
signal(SIGINT, SIG_IGN); /* TODO - switch to sigaction. */
|
||||
signal(SIGINT, SIG_IGN); /* TODO - switch to sigaction. (why?) */
|
||||
}
|
||||
retval = EXIT_SUCCESS;
|
||||
/* gnu tee ignores SIGPIPE in case one of the output files is a pipe
|
||||
* that doesn't consume all its input. Good idea... */
|
||||
signal(SIGPIPE, SIG_IGN); /* TODO - switch to sigaction. */
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
/* Allocate an array of FILE *'s, with one extra for a sentinal. */
|
||||
fp = files = xzalloc(sizeof(FILE *) * (argc + 2));
|
||||
|
||||
@@ -180,6 +180,7 @@ static struct statics *const ptr_to_statics __attribute__ ((section (".data")));
|
||||
|
||||
#define INIT_S() do { \
|
||||
(*(struct statics**)&ptr_to_statics) = xzalloc(sizeof(S)); \
|
||||
barrier(); \
|
||||
} while (0)
|
||||
#define DEINIT_S() do { \
|
||||
free(ptr_to_statics); \
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
int touch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int touch_main(int argc, char **argv)
|
||||
int touch_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
int fd;
|
||||
int status = EXIT_SUCCESS;
|
||||
|
||||
+1
-1
@@ -174,7 +174,7 @@ static int complement(char *buffer, int buffer_len)
|
||||
}
|
||||
|
||||
int tr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int tr_main(int argc, char **argv)
|
||||
int tr_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
int output_length = 0, input_length;
|
||||
int i;
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
int true_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int true_main(int argc, char **argv)
|
||||
int true_main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+5
-3
@@ -13,7 +13,7 @@
|
||||
#include "libbb.h"
|
||||
|
||||
int tty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int tty_main(int argc, char **argv)
|
||||
int tty_main(int argc, char **argv SKIP_INCLUDE_SUSv2(ATTRIBUTE_UNUSED))
|
||||
{
|
||||
const char *s;
|
||||
USE_INCLUDE_SUSv2(int silent;) /* Note: No longer relevant in SUSv3. */
|
||||
@@ -22,15 +22,17 @@ int tty_main(int argc, char **argv)
|
||||
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;)
|
||||
|
||||
/* gnu tty outputs a warning that it is ignoring all args. */
|
||||
bb_warn_ignoring_args(argc - optind);
|
||||
bb_warn_ignoring_args(argc);
|
||||
|
||||
retval = 0;
|
||||
|
||||
s = ttyname(0);
|
||||
if (s == NULL) {
|
||||
/* According to SUSv3, ttyname can on fail with EBADF or ENOTTY.
|
||||
/* According to SUSv3, ttyname can fail with EBADF or ENOTTY.
|
||||
* We know the file descriptor is good, so failure means not a tty. */
|
||||
s = "not a tty";
|
||||
retval = 1;
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ static FILE *xgetoptfile_uniq_s(char **argv, int read0write2)
|
||||
}
|
||||
|
||||
int uniq_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int uniq_main(int argc, char **argv)
|
||||
int uniq_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
FILE *in, *out;
|
||||
unsigned long dups, skip_fields, skip_chars, i;
|
||||
|
||||
+2
-2
@@ -14,9 +14,9 @@
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
int usleep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int usleep_main(int argc, char **argv)
|
||||
int usleep_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
if (argc != 2) {
|
||||
if (!argv[1]) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
|
||||
+41
-31
@@ -19,48 +19,57 @@ static void read_stduu(FILE *src_stream, FILE *dst_stream)
|
||||
char *line;
|
||||
|
||||
while ((line = xmalloc_getline(src_stream)) != NULL) {
|
||||
int length;
|
||||
char *line_ptr = line;
|
||||
int encoded_len, str_len;
|
||||
char *line_ptr, *dst;
|
||||
|
||||
if (strcmp(line, "end") == 0) {
|
||||
return;
|
||||
return; /* the only non-error exit */
|
||||
}
|
||||
length = ((*line_ptr - 0x20) & 0x3f)* 4 / 3;
|
||||
|
||||
if (length <= 0) {
|
||||
line_ptr = line;
|
||||
while (*line_ptr) {
|
||||
*line_ptr = (*line_ptr - 0x20) & 0x3f;
|
||||
line_ptr++;
|
||||
}
|
||||
str_len = line_ptr - line;
|
||||
|
||||
encoded_len = line[0] * 4 / 3;
|
||||
/* Check that line is not too short. (we tolerate
|
||||
* overly _long_ line to accomodate possible extra '`').
|
||||
* Empty line case is also caught here. */
|
||||
if (str_len <= encoded_len) {
|
||||
break; /* go to bb_error_msg_and_die("short file"); */
|
||||
}
|
||||
if (encoded_len <= 0) {
|
||||
/* Ignore the "`\n" line, why is it even in the encode file ? */
|
||||
free(line);
|
||||
continue;
|
||||
}
|
||||
if (length > 60) {
|
||||
if (encoded_len > 60) {
|
||||
bb_error_msg_and_die("line too long");
|
||||
}
|
||||
|
||||
line_ptr++;
|
||||
/* Tolerate an overly long line to accomodate a possible exta '`' */
|
||||
if (strlen(line_ptr) < (size_t)length) {
|
||||
bb_error_msg_and_die("short file");
|
||||
}
|
||||
|
||||
while (length > 0) {
|
||||
dst = line;
|
||||
line_ptr = line + 1;
|
||||
do {
|
||||
/* Merge four 6 bit chars to three 8 bit chars */
|
||||
fputc(((line_ptr[0] - 0x20) & 077) << 2 | ((line_ptr[1] - 0x20) & 077) >> 4, dst_stream);
|
||||
line_ptr++;
|
||||
length--;
|
||||
if (length == 0) {
|
||||
*dst++ = line_ptr[0] << 2 | line_ptr[1] >> 4;
|
||||
encoded_len--;
|
||||
if (encoded_len == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
fputc(((line_ptr[0] - 0x20) & 077) << 4 | ((line_ptr[1] - 0x20) & 077) >> 2, dst_stream);
|
||||
line_ptr++;
|
||||
length--;
|
||||
if (length == 0) {
|
||||
*dst++ = line_ptr[1] << 4 | line_ptr[2] >> 2;
|
||||
encoded_len--;
|
||||
if (encoded_len == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
fputc(((line_ptr[0] - 0x20) & 077) << 6 | ((line_ptr[1] - 0x20) & 077), dst_stream);
|
||||
line_ptr += 2;
|
||||
length -= 2;
|
||||
}
|
||||
*dst++ = line_ptr[2] << 6 | line_ptr[3];
|
||||
line_ptr += 4;
|
||||
encoded_len -= 2;
|
||||
} while (encoded_len > 0);
|
||||
fwrite(line, 1, dst - line, dst_stream);
|
||||
free(line);
|
||||
}
|
||||
bb_error_msg_and_die("short file");
|
||||
@@ -127,9 +136,9 @@ static void read_base64(FILE *src_stream, FILE *dst_stream)
|
||||
}
|
||||
|
||||
int uudecode_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int uudecode_main(int argc, char **argv)
|
||||
int uudecode_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
FILE *src_stream = stdin;
|
||||
FILE *src_stream;
|
||||
char *outname = NULL;
|
||||
char *line;
|
||||
|
||||
@@ -137,8 +146,9 @@ int uudecode_main(int argc, char **argv)
|
||||
getopt32(argv, "o:", &outname);
|
||||
argv += optind;
|
||||
|
||||
if (argv[0])
|
||||
src_stream = xfopen(argv[0], "r");
|
||||
if (!*argv)
|
||||
*--argv = (char*)"-";
|
||||
src_stream = xfopen_stdin(*argv);
|
||||
|
||||
/* Search for the start of the encoding */
|
||||
while ((line = xmalloc_getline(src_stream)) != NULL) {
|
||||
@@ -159,7 +169,7 @@ int uudecode_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* begin line found. decode and exit */
|
||||
mode = strtoul(line_ptr, NULL, 8);
|
||||
mode = bb_strtou(line_ptr, NULL, 8);
|
||||
if (outname == NULL) {
|
||||
outname = strchr(line_ptr, ' ');
|
||||
if ((outname == NULL) || (*outname == '\0')) {
|
||||
@@ -170,7 +180,7 @@ int uudecode_main(int argc, char **argv)
|
||||
dst_stream = stdout;
|
||||
if (NOT_LONE_DASH(outname)) {
|
||||
dst_stream = xfopen(outname, "w");
|
||||
chmod(outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO));
|
||||
fchmod(fileno(dst_stream), mode & (S_IRWXU | S_IRWXG | S_IRWXO));
|
||||
}
|
||||
free(line);
|
||||
decode_fn_ptr(src_stream, dst_stream);
|
||||
|
||||
+2
-2
@@ -69,11 +69,11 @@ enum {
|
||||
};
|
||||
|
||||
int wc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int wc_main(int argc, char **argv)
|
||||
int wc_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
FILE *fp;
|
||||
const char *s, *arg;
|
||||
const char *start_fmt = "%9"COUNT_FMT;
|
||||
const char *start_fmt = " %9"COUNT_FMT + 1;
|
||||
const char *fname_fmt = " %s\n";
|
||||
COUNT_T *pcounts;
|
||||
COUNT_T counts[4];
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ static void idle_string(char *str6, time_t t)
|
||||
}
|
||||
|
||||
int who_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int who_main(int argc, char **argv)
|
||||
int who_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
char str6[6];
|
||||
struct utmp *ut;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
int whoami_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int whoami_main(int argc, char **argv)
|
||||
int whoami_main(int argc, char **argv ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (argc > 1)
|
||||
bb_show_usage();
|
||||
|
||||
+4
-5
@@ -21,22 +21,21 @@
|
||||
int yes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int yes_main(int argc, char **argv)
|
||||
{
|
||||
char **first_arg;
|
||||
char **pp;
|
||||
|
||||
argv[0] = (char*)"y";
|
||||
if (argc != 1) {
|
||||
++argv;
|
||||
}
|
||||
|
||||
first_arg = argv;
|
||||
do {
|
||||
pp = argv;
|
||||
while (1) {
|
||||
fputs(*argv, stdout);
|
||||
if (!*++argv)
|
||||
fputs(*pp, stdout);
|
||||
if (!*++pp)
|
||||
break;
|
||||
putchar(' ');
|
||||
}
|
||||
argv = first_arg;
|
||||
} while (putchar('\n') != EOF);
|
||||
|
||||
bb_perror_nomsg_and_die();
|
||||
|
||||
@@ -50,7 +50,7 @@ config FEATURE_RUN_PARTS_FANCY
|
||||
|
||||
config START_STOP_DAEMON
|
||||
bool "start-stop-daemon"
|
||||
default y
|
||||
default n
|
||||
help
|
||||
start-stop-daemon is used to control the creation and
|
||||
termination of system-level processes, usually the ones
|
||||
@@ -58,7 +58,7 @@ config START_STOP_DAEMON
|
||||
|
||||
config FEATURE_START_STOP_DAEMON_FANCY
|
||||
bool "Support additional arguments"
|
||||
default y
|
||||
default n
|
||||
depends on START_STOP_DAEMON
|
||||
help
|
||||
Support additional arguments.
|
||||
|
||||
+17
-11
@@ -12,25 +12,31 @@
|
||||
#include "libbb.h"
|
||||
|
||||
int mktemp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int mktemp_main(int argc, char **argv)
|
||||
int mktemp_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
unsigned long flags = getopt32(argv, "dqt");
|
||||
// -d Make a directory instead of a file
|
||||
// -q Fail silently if an error occurs [bbox: ignored]
|
||||
// -t Generate a path rooted in temporary directory
|
||||
// -p DIR Use DIR as a temporary directory (implies -t)
|
||||
const char *path;
|
||||
char *chp;
|
||||
unsigned flags;
|
||||
|
||||
if (optind + 1 != argc)
|
||||
bb_show_usage();
|
||||
|
||||
opt_complementary = "=1"; /* exactly one arg */
|
||||
flags = getopt32(argv, "dqtp:", &path);
|
||||
chp = argv[optind];
|
||||
|
||||
if (flags & 4) {
|
||||
char *dir = getenv("TMPDIR");
|
||||
if (flags & (4|8)) { /* -t and/or -p */
|
||||
const char *dir = getenv("TMPDIR");
|
||||
if (dir && *dir != '\0')
|
||||
chp = concat_path_file(dir, chp);
|
||||
else
|
||||
chp = concat_path_file("/tmp/", chp);
|
||||
path = dir;
|
||||
else if (!(flags & 8)) /* No -p */
|
||||
path = "/tmp/";
|
||||
/* else path comes from -p DIR */
|
||||
chp = concat_path_file(path, chp);
|
||||
}
|
||||
|
||||
if (flags & 1) {
|
||||
if (flags & 1) { /* -d */
|
||||
if (mkdtemp(chp) == NULL)
|
||||
return EXIT_FAILURE;
|
||||
} else {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* Activity is indicated by a '.' to stderr
|
||||
*/
|
||||
int pipe_progress_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int pipe_progress_main(int argc, char **argv)
|
||||
int pipe_progress_main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
||||
{
|
||||
RESERVE_CONFIG_BUFFER(buf, PIPE_PROGRESS_SIZE);
|
||||
time_t t = time(NULL);
|
||||
|
||||
+21
-18
@@ -23,11 +23,11 @@
|
||||
* report mode. As the original run-parts support only long options, I've
|
||||
* broken compatibility because the BusyBox policy doesn't allow them.
|
||||
* The supported options are:
|
||||
* -t test. Print the name of the files to be executed, without
|
||||
* execute them.
|
||||
* -a ARG argument. Pass ARG as an argument the program executed. It can
|
||||
* be repeated to pass multiple arguments.
|
||||
* -u MASK umask. Set the umask of the program executed to MASK.
|
||||
* -t test. Print the name of the files to be executed, without
|
||||
* execute them.
|
||||
* -a ARG argument. Pass ARG as an argument the program executed. It can
|
||||
* be repeated to pass multiple arguments.
|
||||
* -u MASK umask. Set the umask of the program executed to MASK.
|
||||
*/
|
||||
|
||||
#include <getopt.h>
|
||||
@@ -47,14 +47,15 @@ struct globals {
|
||||
enum { NUM_CMD = (COMMON_BUFSIZE - sizeof(struct globals)) / sizeof(cmd[0]) };
|
||||
|
||||
enum {
|
||||
RUN_PARTS_OPT_a = (1 << 0),
|
||||
RUN_PARTS_OPT_u = (1 << 1),
|
||||
RUN_PARTS_OPT_t = (1 << 2),
|
||||
RUN_PARTS_OPT_l = (1 << 3) * ENABLE_FEATURE_RUN_PARTS_FANCY,
|
||||
OPT_r = (1 << 0),
|
||||
OPT_a = (1 << 1),
|
||||
OPT_u = (1 << 2),
|
||||
OPT_t = (1 << 3),
|
||||
OPT_l = (1 << 4) * ENABLE_FEATURE_RUN_PARTS_FANCY,
|
||||
};
|
||||
|
||||
#if ENABLE_FEATURE_RUN_PARTS_FANCY
|
||||
#define list_mode (option_mask32 & RUN_PARTS_OPT_l)
|
||||
#define list_mode (option_mask32 & OPT_l)
|
||||
#else
|
||||
#define list_mode 0
|
||||
#endif
|
||||
@@ -74,10 +75,11 @@ static bool invalid_name(const char *c)
|
||||
|
||||
static int bb_alphasort(const void *p1, const void *p2)
|
||||
{
|
||||
return strcmp(*(char **) p1, *(char **) p2);
|
||||
int r = strcmp(*(char **) p1, *(char **) p2);
|
||||
return (option_mask32 & OPT_r) ? -r : r;
|
||||
}
|
||||
|
||||
static int act(const char *file, struct stat *statbuf, void *args, int depth)
|
||||
static int act(const char *file, struct stat *statbuf, void *args ATTRIBUTE_UNUSED, int depth)
|
||||
{
|
||||
if (depth == 1)
|
||||
return TRUE;
|
||||
@@ -104,14 +106,14 @@ static const char runparts_longopts[] ALIGN1 =
|
||||
"test\0" No_argument "t"
|
||||
#if ENABLE_FEATURE_RUN_PARTS_FANCY
|
||||
"list\0" No_argument "l"
|
||||
//TODO: "reverse\0" No_argument "r"
|
||||
"reverse\0" No_argument "r"
|
||||
//TODO: "verbose\0" No_argument "v"
|
||||
#endif
|
||||
;
|
||||
#endif
|
||||
|
||||
int run_parts_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int run_parts_main(int argc, char **argv)
|
||||
int run_parts_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
const char *umask_p = "22";
|
||||
llist_t *arg_list = NULL;
|
||||
@@ -121,9 +123,10 @@ int run_parts_main(int argc, char **argv)
|
||||
#if ENABLE_FEATURE_RUN_PARTS_LONG_OPTIONS
|
||||
applet_long_options = runparts_longopts;
|
||||
#endif
|
||||
/* We require exactly one argument: the directory name */
|
||||
/* We require exactly one argument: the directory name */
|
||||
opt_complementary = "=1:a::";
|
||||
getopt32(argv, "a:u:t"USE_FEATURE_RUN_PARTS_FANCY("l"), &arg_list, &umask_p);
|
||||
getopt32(argv, "ra:u:t"USE_FEATURE_RUN_PARTS_FANCY("l"), &arg_list, &umask_p);
|
||||
|
||||
umask(xstrtou_range(umask_p, 8, 0, 07777));
|
||||
|
||||
@@ -155,7 +158,7 @@ int run_parts_main(int argc, char **argv)
|
||||
char *name = *names++;
|
||||
if (!name)
|
||||
break;
|
||||
if (option_mask32 & (RUN_PARTS_OPT_t | RUN_PARTS_OPT_l)) {
|
||||
if (option_mask32 & (OPT_t | OPT_l)) {
|
||||
puts(name);
|
||||
continue;
|
||||
}
|
||||
@@ -165,9 +168,9 @@ int run_parts_main(int argc, char **argv)
|
||||
continue;
|
||||
n = 1;
|
||||
if (ret < 0)
|
||||
bb_perror_msg("failed to exec %s", name);
|
||||
bb_perror_msg("can't exec %s", name);
|
||||
else /* ret > 0 */
|
||||
bb_error_msg("%s exited with return code %d", name, ret);
|
||||
bb_error_msg("%s exited with code %d", name, ret);
|
||||
}
|
||||
|
||||
return n;
|
||||
|
||||
@@ -11,47 +11,61 @@
|
||||
/* NB: we have a problem here with /proc/NN/exe usage, similar to
|
||||
* one fixed in killall/pidof */
|
||||
|
||||
#include <getopt.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
/* Override ENABLE_FEATURE_PIDFILE */
|
||||
#define WANT_PIDFILE 1
|
||||
#include "libbb.h"
|
||||
|
||||
static int signal_nr = 15;
|
||||
static int user_id = -1;
|
||||
static char *userspec;
|
||||
static char *cmdname;
|
||||
static char *execname;
|
||||
static char *pidfile;
|
||||
static smallint quiet;
|
||||
|
||||
struct pid_list {
|
||||
struct pid_list *next;
|
||||
pid_t pid;
|
||||
};
|
||||
|
||||
static struct pid_list *found;
|
||||
|
||||
static int pid_is_exec(pid_t pid, const char *name)
|
||||
struct globals {
|
||||
struct pid_list *found;
|
||||
char *userspec;
|
||||
char *cmdname;
|
||||
char *execname;
|
||||
char *pidfile;
|
||||
int user_id;
|
||||
smallint quiet;
|
||||
smallint signal_nr;
|
||||
struct stat execstat;
|
||||
};
|
||||
#define G (*(struct globals*)&bb_common_bufsiz1)
|
||||
#define found (G.found )
|
||||
#define userspec (G.userspec )
|
||||
#define cmdname (G.cmdname )
|
||||
#define execname (G.execname )
|
||||
#define pidfile (G.pidfile )
|
||||
#define user_id (G.user_id )
|
||||
#define quiet (G.quiet )
|
||||
#define signal_nr (G.signal_nr )
|
||||
#define execstat (G.execstat )
|
||||
#define INIT_G() \
|
||||
do { \
|
||||
user_id = -1; \
|
||||
signal_nr = 15; \
|
||||
} while (0)
|
||||
|
||||
|
||||
static int pid_is_exec(pid_t pid)
|
||||
{
|
||||
struct stat st;
|
||||
char buf[sizeof("/proc//exe") + sizeof(int)*3];
|
||||
char *execbuf;
|
||||
int n;
|
||||
|
||||
sprintf(buf, "/proc/%u/exe", pid);
|
||||
n = strlen(name) + 1;
|
||||
execbuf = xzalloc(n + 1);
|
||||
readlink(buf, execbuf, n);
|
||||
|
||||
/* if readlink fails, execbuf still contains "" */
|
||||
n = strcmp(execbuf, name);
|
||||
if (ENABLE_FEATURE_CLEAN_UP)
|
||||
free(execbuf);
|
||||
return !n; /* nonzero (true) if execbuf == name */
|
||||
if (stat(buf, &st) < 0)
|
||||
return 0;
|
||||
if (st.st_dev == execstat.st_dev
|
||||
&& st.st_ino == execstat.st_ino)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pid_is_user(int pid, int uid)
|
||||
static int pid_is_user(int pid)
|
||||
{
|
||||
struct stat sb;
|
||||
char buf[sizeof("/proc/") + sizeof(int)*3];
|
||||
@@ -59,42 +73,39 @@ static int pid_is_user(int pid, int uid)
|
||||
sprintf(buf, "/proc/%u", pid);
|
||||
if (stat(buf, &sb) != 0)
|
||||
return 0;
|
||||
return (sb.st_uid == uid);
|
||||
return (sb.st_uid == user_id);
|
||||
}
|
||||
|
||||
static int pid_is_cmd(pid_t pid, const char *name)
|
||||
static int pid_is_cmd(pid_t pid)
|
||||
{
|
||||
char fname[sizeof("/proc//stat") + sizeof(int)*3];
|
||||
char *buf;
|
||||
int r = 0;
|
||||
char buf[256]; /* is it big enough? */
|
||||
char *p, *pe;
|
||||
|
||||
sprintf(fname, "/proc/%u/stat", pid);
|
||||
buf = xmalloc_open_read_close(fname, NULL);
|
||||
if (buf) {
|
||||
char *p = strchr(buf, '(');
|
||||
if (p) {
|
||||
char *pe = strrchr(++p, ')');
|
||||
if (pe) {
|
||||
*pe = '\0';
|
||||
r = !strcmp(p, name);
|
||||
}
|
||||
}
|
||||
free(buf);
|
||||
}
|
||||
return r;
|
||||
sprintf(buf, "/proc/%u/stat", pid);
|
||||
if (open_read_close(buf, buf, sizeof(buf) - 1) < 0)
|
||||
return 0;
|
||||
buf[sizeof(buf) - 1] = '\0'; /* paranoia */
|
||||
p = strchr(buf, '(');
|
||||
if (!p)
|
||||
return 0;
|
||||
pe = strrchr(++p, ')');
|
||||
if (!pe)
|
||||
return 0;
|
||||
*pe = '\0';
|
||||
return !strcmp(p, cmdname);
|
||||
}
|
||||
|
||||
static void check(int pid)
|
||||
{
|
||||
struct pid_list *p;
|
||||
|
||||
if (execname && !pid_is_exec(pid, execname)) {
|
||||
if (execname && !pid_is_exec(pid)) {
|
||||
return;
|
||||
}
|
||||
if (userspec && !pid_is_user(pid, user_id)) {
|
||||
if (userspec && !pid_is_user(pid)) {
|
||||
return;
|
||||
}
|
||||
if (cmdname && !pid_is_cmd(pid, cmdname)) {
|
||||
if (cmdname && !pid_is_cmd(pid)) {
|
||||
return;
|
||||
}
|
||||
p = xmalloc(sizeof(*p));
|
||||
@@ -121,7 +132,7 @@ static void do_procinit(void)
|
||||
{
|
||||
DIR *procdir;
|
||||
struct dirent *entry;
|
||||
int foundany, pid;
|
||||
int pid;
|
||||
|
||||
if (pidfile) {
|
||||
do_pidfile();
|
||||
@@ -130,16 +141,22 @@ static void do_procinit(void)
|
||||
|
||||
procdir = xopendir("/proc");
|
||||
|
||||
foundany = 0;
|
||||
while ((entry = readdir(procdir)) != NULL) {
|
||||
pid = 0;
|
||||
while(1) {
|
||||
errno = 0; /* clear any previous error */
|
||||
entry = readdir(procdir);
|
||||
// TODO: check for exact errno(s) which mean that we got stale entry
|
||||
if (errno) /* Stale entry, process has died after opendir */
|
||||
continue;
|
||||
if (!entry) /* EOF, no more entries */
|
||||
break;
|
||||
pid = bb_strtou(entry->d_name, NULL, 10);
|
||||
if (errno)
|
||||
if (errno) /* NaN */
|
||||
continue;
|
||||
foundany++;
|
||||
check(pid);
|
||||
}
|
||||
closedir(procdir);
|
||||
if (!foundany)
|
||||
if (!pid)
|
||||
bb_error_msg_and_die("nothing in /proc - not mounted?");
|
||||
}
|
||||
|
||||
@@ -149,8 +166,6 @@ static int do_stop(void)
|
||||
struct pid_list *p;
|
||||
int killed = 0;
|
||||
|
||||
do_procinit();
|
||||
|
||||
if (cmdname) {
|
||||
if (ENABLE_FEATURE_CLEAN_UP) what = xstrdup(cmdname);
|
||||
if (!ENABLE_FEATURE_CLEAN_UP) what = cmdname;
|
||||
@@ -235,7 +250,7 @@ enum {
|
||||
};
|
||||
|
||||
int start_stop_daemon_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int start_stop_daemon_main(int argc, char **argv)
|
||||
int start_stop_daemon_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
unsigned opt;
|
||||
char *signame;
|
||||
@@ -246,6 +261,9 @@ int start_stop_daemon_main(int argc, char **argv)
|
||||
// int retries = -1;
|
||||
char *opt_N;
|
||||
#endif
|
||||
|
||||
INIT_G();
|
||||
|
||||
#if ENABLE_FEATURE_START_STOP_DAEMON_LONG_OPTIONS
|
||||
applet_long_options = start_stop_daemon_longopts;
|
||||
#endif
|
||||
@@ -274,7 +292,7 @@ int start_stop_daemon_main(int argc, char **argv)
|
||||
// if (retry_arg)
|
||||
// retries = xatoi_u(retry_arg);
|
||||
// )
|
||||
argc -= optind;
|
||||
//argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (userspec) {
|
||||
@@ -282,14 +300,16 @@ int start_stop_daemon_main(int argc, char **argv)
|
||||
if (errno)
|
||||
user_id = xuname2uid(userspec);
|
||||
}
|
||||
if (execname)
|
||||
xstat(execname, &execstat);
|
||||
|
||||
do_procinit(); /* Both start and stop needs to know current processes */
|
||||
|
||||
if (opt & CTX_STOP) {
|
||||
int i = do_stop();
|
||||
return (opt & OPT_OKNODO) ? 0 : (i <= 0);
|
||||
}
|
||||
|
||||
do_procinit();
|
||||
|
||||
if (found) {
|
||||
if (!quiet)
|
||||
printf("%s already running\n%d\n", execname, found->pid);
|
||||
|
||||
@@ -4,11 +4,39 @@
|
||||
|
||||
<h3>Download</h3>
|
||||
|
||||
<p>
|
||||
Source for the latest release can always be
|
||||
downloaded from <a href="downloads">http://www.busybox.net/downloads</a>.
|
||||
downloaded from <a href="downloads/">http://www.busybox.net/downloads/</a>.
|
||||
|
||||
<p>
|
||||
You can also obtain <a href= "downloads/snapshots/">Daily Snapshots</a> of
|
||||
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.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).
|
||||
|
||||
|
||||
+192
-4
@@ -1,6 +1,196 @@
|
||||
<!--#include file="header.html" -->
|
||||
|
||||
<ul>
|
||||
<li><b>21 March 2008 -- BusyBox 1.10.0 (unstable)</b>
|
||||
<p><a href=http://busybox.net/downloads/busybox-1.10.0.tar.bz2>BusyBox 1.10.0</a>.
|
||||
(<a href=http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_10_stable/>svn</a>,
|
||||
<a href=http://busybox.net/downloads/fixes-1.10.0/>patches</a>,
|
||||
<a href=http://busybox.net/fix.html>how to add a patch</a>)</p>
|
||||
|
||||
<p>Sizes of busybox-1.9.2 and busybox-1.10.0 (with almost full config, static uclibc build):<pre>
|
||||
text data bss dec hex filename
|
||||
781405 679 7500 789584 c0c50 busybox-1.9.2
|
||||
773551 640 7372 781563 becfb busybox-1.10.0
|
||||
</pre>
|
||||
<p>Top 10 stack users:<pre>
|
||||
busybox-1.9.2: busybox-1.10.0:
|
||||
echo_dg 4116 bb_full_fd_action 4112
|
||||
bb_full_fd_action 4112 find_list_entry2 4096
|
||||
discard_dg 4108 readlink_main 4096
|
||||
discard_dg 4096 ipaddr_list_or_flush 3900
|
||||
echo_stream 4096 iproute_list_or_flush 3680
|
||||
discard_stream 4096 insmod_main 3152
|
||||
find_list_entry2 4096 fallbackSort 2952
|
||||
readlink_main 4096 do_iproute 2492
|
||||
ipaddr_list_or_flush 3900 cal_main 2464
|
||||
iproute_list_or_flush 3680 readhere 2308
|
||||
</pre>
|
||||
|
||||
<p>New applets: brctl, chat (by Vladimir Dronnikov <dronnikov AT gmail.com>),
|
||||
findfs, ifenslave (closes bug 115), lpd (by Vladimir Dronnikov <dronnikov AT gmail.com>),
|
||||
lpr+lpq (by Walter Harms), script (by Pascal Bellard <pascal.bellard AT ads-lu.com>),
|
||||
sendmail (Vladimir Dronnikov <dronnikov AT gmail.com>), tac, tftpd.
|
||||
|
||||
<p>Made NOMMU-compatible: crond, crontab, ifupdown, inetd, init, runsv, svlogd, tcpsvd, udpsvd.
|
||||
|
||||
<p>Changes since previous release:
|
||||
<ul>
|
||||
<li>globally: add -Wunused-parameter
|
||||
<li>globally: add optimization barrier to all "G trick" locations
|
||||
<li>adduser/addgroup: check username for invalid chars (by Tito <farmatito AT tiscali.it>)
|
||||
<li>adduser: optional support for long options. Closes bug 2134
|
||||
<li>ash: handle "A=1 A=2 B=$A; echo $B". Closes bug 947
|
||||
<li>ash: make ash -c "if set -o barfoo 2>/dev/null; then echo foo; else echo bar; fi" work. Closes bug 1142
|
||||
<li>build system: don't use "gcc -o /dev/null", old gcc can delete /dev/null in this case
|
||||
<li>build system: fixes for cross-compiling on an OS X host
|
||||
<li>build system: make it do without "od -t"
|
||||
<li>build system: pass CFLAGS to link stage too. Closes bug 1376
|
||||
<li>build system: add CONFIG_NOMMU
|
||||
<li>cp: add ENABLE_FEATURE_VERBOSE_CP_MESSAGE. Closes bug 1470
|
||||
<li>crontab: almost complete rewrite
|
||||
<li>dnsd: properly set _src_ IP:port on outgoing UDP packets
|
||||
<li>dpkg: fix bug where existence check was reversed
|
||||
<li>eject: add -s for SCSI- and USB-devices (Nico Erfurth)
|
||||
<li>fdisk: fix a case where break was reached only for DOS labels
|
||||
<li>fsck: don't kill pid -1! (Roy Marples <roy at marples.name>)
|
||||
<li>fsck_minix: fix bug in map_block2: s/(blknr >= 256 * 256)/(blknr < 256 * 256)/
|
||||
<li>fuser: substantial rewrite
|
||||
<li>getopt: add support for "a+" specifier for nonnegative int parameters. By Vladimir Dronnikov <dronnikov at gmail.com>
|
||||
<li>getty: don't try to detect parity on local lines (Joakim Tjernlund <Joakim.Tjernlund at transmode.se>)
|
||||
<li>halt: write wtmp entry if wtmp support is enabled
|
||||
<li>httpd: "HEAD" support. Closes bug 1530
|
||||
<li>httpd: fix bug 2004: wrong argv when interpreter is invoked
|
||||
<li>httpd: fix bug where we did chdir("") if CGI path had only one "/"
|
||||
<li>httpd: fix for POST upload
|
||||
<li>httpd: support for "I:index.xml" syntax (Peter Korsgaard <jacmet AT uclibc.org>)
|
||||
<li>hush: fix a case where none of pipe members could be started because of fork failure
|
||||
<li>hush: more correct handling of piping
|
||||
<li>hush: reinstate `cmd` handling for NOMMU
|
||||
<li>hush: report [v]fork failures
|
||||
<li>hush: set CLOEXEC on script file being executed
|
||||
<li>hush: try to add a bit more of vfork-friendliness
|
||||
<li>inetd: make "udp nowait" work
|
||||
<li>inetd: make inetd IPv6-capable
|
||||
<li>init: add FEATURE_KILL_REMOVED (Eugene Bordenkircher <eugebo AT gmail.com>)
|
||||
<li>init: allow last line of config file to be not terminated by "\n"
|
||||
<li>init: do not die if "/dev/null" is missing
|
||||
<li>init: fix bug 1111: restart actions were not splitting words
|
||||
<li>init: wait for orphaned children too while waiting for sysinit-like processes (harald-tuxbox AT arcor.de)
|
||||
<li>ip route: "ip route" was misbehaving (extra argv+1 ate 1st env var)
|
||||
<li>last: do not go into endless loop on read error
|
||||
<li>less,klogd,syslogd,nc,tcpudp: exit on signal by killing itself, not exit(1)
|
||||
<li>less: "examine" command will not bomb out on bad file name now
|
||||
<li>less: fix bug where backspace wasn't actually deleting chars
|
||||
<li>less: make it a bit more resistant against status line corruption
|
||||
<li>less: improve search when data is not supplied fast enough by stdin - now will try reading for 1-2 seconds before declaring that there is no match. This fixes a very common annoyance with long manpages
|
||||
<li>less: update line input so that it doesn't interfere with screen update. Makes "man bash", [enter], [/], <enter search pattern>, [enter] more usable - manpage now draws even as you enter the pattern!
|
||||
<li>libbb: filename completion matches dangling symlinks too
|
||||
<li>libbb: fix getopt state corruption for NOFORK applets
|
||||
<li>libbb: full_read/write now will report partial data counts prior to error
|
||||
<li>libbb: intrduce and use safe_gethostname. By Tito <farmatito AT tiscali.it>
|
||||
<li>libbb: introduce and use nonblock_safe_read(). Yay! Our shells are immune from this nasty O_NONBLOCK now!
|
||||
<li>login,su: avoid clearing environment with some options, as was intended
|
||||
<li>microcom: read more than 1 byte from device, if possible
|
||||
<li>microcom: split -d (delay) option away from -t
|
||||
<li>mktemp: support -p DIR (Timo Teras <timo.teras at iki.fi>)
|
||||
<li>mount: #ifdef out MOUNT_LABEL code parts if it is not selected
|
||||
<li>mount: add another mount helper call method
|
||||
<li>mount: allow and ignore _netdev option
|
||||
<li>mount: make -f work even without mtab support (Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn at axis.com>)
|
||||
<li>mount: optional support for -vv verbosity
|
||||
<li>mount: plug a hole where FEATURE_MOUNT_HELPERS could allow execution of arbitrary command
|
||||
<li>mount: recognize "dirsync" (closes bug 835)
|
||||
<li>mount: sanitize environment if called by non-root
|
||||
<li>mount: support for mount by label. Closes bug 1143
|
||||
<li>mount: with -vv -f, say what mount() calls we were going to make
|
||||
<li>msh: create testsuite (based on hush one)
|
||||
<li>msh: don't use floating point in "times" builtin
|
||||
<li>msh: fix Ctrl-C handling with line editing
|
||||
<li>msh: fix for bug 846 ("break" didn't work second time)
|
||||
<li>msh: glob0/glob1/glob2/glob3 were just a sorting routine, removed
|
||||
<li>msh: instead of fixing "ls | cd", "cd | ls" etc disallow builtins in pipes. They make no sense there anyway
|
||||
<li>msh: stop trying to parse variables in "msh SCRIPT VAR=val param". They are passed as ordinary parameters
|
||||
<li>netstat: print control chars as "^C" etc
|
||||
<li>nmeter: fix bug where %[mf] behaves as %[mt]
|
||||
<li>nohup: compat patch by Christoph Gysin <mailinglist.cache at gmail.com>
|
||||
<li>od: handle /proc files (which have filesize 0) correctly
|
||||
<li>patch: don't trash permissions of patched file
|
||||
<li>ps: add conditional support for -o [e]time
|
||||
<li>ps: fix COMMAND column adjustment; overflow in USER and VSZ columns
|
||||
<li>reset: call "stty sane". Closes bug 1414
|
||||
<li>rmdir: optional long options support for Debian users. By Roberto Gordo Saez <roberto.gordo AT gmail.com>
|
||||
<li>run-parts: add --reverse
|
||||
<li>script: correctly handle buffered "tail" of output
|
||||
<li>sed: "n" command must reset "we had successful subst" flag. Closes bug 1214
|
||||
<li>sort: -z outputs NUL terminated lines. Closes bug 1591
|
||||
<li>stty: fix mishandling of control keywords (Ralf Friedl <Ralf.Friedl AT online.de>)
|
||||
<li>switch_root: stop at first non-option. Closes bug 1425
|
||||
<li>syslogd: avoid excessive time() system calls
|
||||
<li>syslogd: don't die if remote host's IP cannot be resolved. Retry resolutions every two minutes instead
|
||||
<li>syslogd: fix shmat error check
|
||||
<li>syslogd: optional support for dropping dups. Closes bug 436
|
||||
<li>syslogd: send "\n"-terminated messages over the network. Fully closes bug 1574
|
||||
<li>syslogd: tighten up hostname handling
|
||||
<li>tail: fix "tail -c 20 /dev/huge_disk" (was taking ages)
|
||||
<li>tar: compat: handle tarballs with only one zero block at the end
|
||||
<li>tar: autodetection of gz/bz2 compressed tarballs. Closes bug 992
|
||||
<li>tar: real support for -p. By Natanael Copa <natanael.copa at gmail.com>
|
||||
<li>tcpudp: narrow down time window where we have no wildcard socket
|
||||
<li>telnetd: use login always, not "sometimes login, sometimes shell"
|
||||
<li>test: fix mishandling of "test ! arg1 op arg2 more args"
|
||||
<li>trylink: instead of build error, disable --gc-sections if GLIBC and STATIC are selected
|
||||
<li>udhcp: make file paths configurable
|
||||
<li>udhcp: optional support for non-standard DHCP ports
|
||||
<li>udhcp: set correct op byte in the packet for DHCPDECLINE
|
||||
<li>udhcpc: filter unwanted packets in kernel (Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn AT axis.com>)
|
||||
<li>udhcpc: fix wrong options in decline and release packets (Jonas Danielsson <jonas.danielsson AT axis.com>)
|
||||
<li>umount: do not complain several times about the same mountpoint
|
||||
<li>umount: do not try to free loop device or erase mtab if remounted ro
|
||||
<li>umount: instead of non-standard -D, use -d with opposite meaning. Closes bug 1604
|
||||
<li>unlzma: shrink by Pascal Bellard <pascal.bellard AT ads-lu.com>
|
||||
<li>unzip: do not try to read entire compressed stream at once (it can be huge)
|
||||
<li>unzip: handle short reads correctly
|
||||
<li>vi: many fixes
|
||||
<li>zcip: don't chdir to root
|
||||
<li>zcip: open ARP socket before openlog (else we can thrash syslog socket)
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<li><b>21 March 2008 -- BusyBox stable releases</b>
|
||||
<p>
|
||||
Bugfix-only releases for four past branches. Links to locations
|
||||
for future hot patches are in parentheses.
|
||||
<p>
|
||||
<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>),
|
||||
<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>),
|
||||
<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>),
|
||||
<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>).
|
||||
<p>
|
||||
<a href=http://busybox.net/fix.html>How to add a patch.</a>
|
||||
<p>
|
||||
<a href=http://busybox.net/~vda/HOWTO_bbox_with_uclibc.txt>How to build static busybox against uclibc</a>
|
||||
<p>
|
||||
The email address gpl@busybox.net is the recommended way to contact
|
||||
the Software Freedom Law Center to report BusyBox license violations.
|
||||
</p>
|
||||
|
||||
<li><b>12 February 2008 -- BusyBox 1.9.1 (stable)</b>
|
||||
<p><a href=http://busybox.net/downloads/busybox-1.9.1.tar.bz2>BusyBox 1.9.1</a>.
|
||||
(<a href=http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_9_stable/>svn</a>,
|
||||
<a href=http://busybox.net/downloads/fixes-1.9.1/>patches</a>,
|
||||
<a href=http://busybox.net/fix.html>how to add a patch</a>)</p>
|
||||
|
||||
<p>This is a bugfix-only release, with fixes to fsck,
|
||||
iproute, mdev, mkswap, msh, nameif, stty, test, zcip.</p>
|
||||
<p>hush has `command` expansion re-enabled for NOMMU, although it is
|
||||
inherently unsafe (by virtue of NOMMU's use of vfork instead of fork).
|
||||
The plan is to make this less likely to bite people in future versions.</p>
|
||||
</li>
|
||||
|
||||
<li><b>24 December 2007 -- BusyBox 1.9.0 (unstable)</b>
|
||||
<p><a href=http://busybox.net/downloads/busybox-1.9.0.tar.bz2>BusyBox 1.9.0</a>.
|
||||
(<a href=http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_9_stable/>svn</a>,
|
||||
@@ -48,7 +238,7 @@ parse_prompt 4132 insmod_main 3152
|
||||
<li>[su]login: sanitize environment if called by non-root
|
||||
<li>udhcpc: support "bad" servers which send oversized packets
|
||||
(Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn at axis.com>)
|
||||
<li>udhcpc: -O option allows to specify which options to ask tor
|
||||
<li>udhcpc: -O option allows to specify which options to ask for
|
||||
(Stefan Hellermann <stefan at the2masters.de>)
|
||||
<li>udhcpc: optionally check whether given IP is really free (by ARP ping)
|
||||
(Jonas Danielsson <jonas.danielsson at axis.com>)
|
||||
@@ -67,9 +257,7 @@ parse_prompt 4132 insmod_main 3152
|
||||
<li>df: -i option (show inode info) (Pascal Bellard <pascal.bellard at ads-lu.com>)
|
||||
<li>hexdump: -R option (Pascal Bellard <pascal.bellard at ads-lu.com>)
|
||||
</ul>
|
||||
|
||||
<p><a href=http://busybox.net/~vda/HOWTO_bbox_with_uclibc.txt>How to build static busybox against uclibc</a>
|
||||
|
||||
</p>
|
||||
|
||||
<li><b>23 November 2007 -- BusyBox 1.8.2 (stable), BusyBox 1.7.4 (stable)</b>
|
||||
<p><a href=http://busybox.net/downloads/busybox-1.8.2.tar.bz2>BusyBox 1.8.2</a>.
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
|
||||
<h3>Patches</h3>
|
||||
|
||||
<p>If you don't want to mess with subversion, you can download
|
||||
<a href="/downloads/patches/">all BusyBox patches</a> or check the
|
||||
<a href="/downloads/patches/recent.html">most recent patches</a>.
|
||||
<p>You can <a href="/downloads/">download</a> fixes for particular releases
|
||||
of busybox, e.g. downloads/fixes-<em>major</em>-<em>minor</em>-<em>patch</em>/
|
||||
|
||||
<h3>Anonymous Subversion Access</h3>
|
||||
|
||||
@@ -21,7 +20,7 @@ svn co svn://busybox.net/trunk/busybox</pre>
|
||||
<p>
|
||||
The current <em>stable branch</em> can be obtained with
|
||||
<pre>
|
||||
svn co svn://busybox.net/branches/busybox_1_1_stable
|
||||
svn co svn://busybox.net/branches/busybox_1_9_stable
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
|
||||
+2
-2
@@ -145,7 +145,7 @@ PID (process ID), PGID (process group ID) and SID (session ID)
|
||||
of processes. With a shell that does not know about job control,
|
||||
like <code>ash</code>, each of its children will be in the same session
|
||||
and have the same process group as the shell. With a shell that knows
|
||||
about job control, like <code>bash</code>, the processes of one pipeline. like
|
||||
about job control, like <code>bash</code>, the processes of one pipeline, like
|
||||
</p><blockquote>
|
||||
<pre>% cat paper | ideal | pic | tbl | eqn | ditroff > out
|
||||
</pre>
|
||||
@@ -227,7 +227,7 @@ controlling tty. If there is none, this returns a random value
|
||||
larger than 1 that is not a process group ID.
|
||||
</p><p>A process can set the foreground process group in its session
|
||||
using <code>tcsetpgrp(fd,pgrp)</code>, where <code>fd</code> refers to its
|
||||
controlling tty, and <code>pgrp</code> is a process group in the
|
||||
controlling tty, and <code>pgrp</code> is a process group in
|
||||
its session, and this session still is associated to the controlling
|
||||
tty of the calling process.
|
||||
</p><p>How does one get <code>fd</code>? By definition, <code>/dev/tty</code>
|
||||
|
||||
Loaded 100 of 448 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user