Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1704a3474 | ||
|
|
868530ade2 |
No files matched your search
@@ -146,10 +146,6 @@ Rob Sullivan <cogito.ergo.cogito@gmail.com>
|
||||
Linus Torvalds
|
||||
mkswap, fsck.minix, mkfs.minix
|
||||
|
||||
Linus Walleij
|
||||
fbset and fbsplash config RGBA parsing
|
||||
rewrite of mdev helper to create devices from /sys/dev
|
||||
|
||||
Mark Whitley <markw@codepoet.org>
|
||||
grep, sed, cut, xargs(previous),
|
||||
style-guide, new-applet-HOWTO, bug fixes, etc.
|
||||
|
||||
@@ -11,18 +11,15 @@ config HAVE_DOT_CONFIG
|
||||
|
||||
menu "Busybox Settings"
|
||||
|
||||
menu "General Configuration"
|
||||
|
||||
config DESKTOP
|
||||
bool "Enable options for full-blown desktop systems"
|
||||
default y
|
||||
help
|
||||
Enable options and features which are not essential.
|
||||
Select this if you plan to use busybox on full-blown desktop machine
|
||||
with common Linux distro, which needs higher level of command-line
|
||||
compatibility.
|
||||
|
||||
If you are preparing your build to be used on an embedded box
|
||||
where you have tighter control over the entire set of userspace
|
||||
tools, you can unselect this option for smaller code size.
|
||||
Select this only if you plan to use busybox on full-blown
|
||||
desktop machine with common Linux distro, not on an embedded box.
|
||||
|
||||
config EXTRA_COMPAT
|
||||
bool "Provide compatible behavior for rare corner cases (bigger code)"
|
||||
@@ -61,6 +58,30 @@ config PLATFORM_LINUX
|
||||
Answering 'N' here will disable such applets and hide the
|
||||
corresponding configuration options.
|
||||
|
||||
choice
|
||||
prompt "Buffer allocation policy"
|
||||
default FEATURE_BUFFERS_USE_MALLOC
|
||||
help
|
||||
There are 3 ways BusyBox can handle buffer allocations:
|
||||
- Use malloc. This costs code size for the call to xmalloc.
|
||||
- Put them on stack. For some very small machines with limited stack
|
||||
space, this can be deadly. For most folks, this works just fine.
|
||||
- Put them in BSS. This works beautifully for computers with a real
|
||||
MMU (and OS support), but wastes runtime RAM for uCLinux. This
|
||||
behavior was the only one available for BusyBox versions 0.48 and
|
||||
earlier.
|
||||
|
||||
config FEATURE_BUFFERS_USE_MALLOC
|
||||
bool "Allocate with Malloc"
|
||||
|
||||
config FEATURE_BUFFERS_GO_ON_STACK
|
||||
bool "Allocate on the Stack"
|
||||
|
||||
config FEATURE_BUFFERS_GO_IN_BSS
|
||||
bool "Allocate in the .bss section"
|
||||
|
||||
endchoice
|
||||
|
||||
config SHOW_USAGE
|
||||
bool "Show applet usage messages"
|
||||
default y
|
||||
@@ -123,6 +144,131 @@ config INSTALL_NO_USR
|
||||
will install applets only to /bin and /sbin,
|
||||
never to /usr/bin or /usr/sbin.
|
||||
|
||||
config LOCALE_SUPPORT
|
||||
bool "Enable locale support (system needs locale for this to work)"
|
||||
default n
|
||||
help
|
||||
Enable this if your system has locale support and you would like
|
||||
busybox to support locale settings.
|
||||
|
||||
config UNICODE_SUPPORT
|
||||
bool "Support Unicode"
|
||||
default y
|
||||
help
|
||||
This makes various applets aware that one byte is not
|
||||
one character on screen.
|
||||
|
||||
Busybox aims to eventually work correctly with Unicode displays.
|
||||
Any older encodings are not guaranteed to work.
|
||||
Probably by the time when busybox will be fully Unicode-clean,
|
||||
other encodings will be mainly of historic interest.
|
||||
|
||||
config UNICODE_USING_LOCALE
|
||||
bool "Use libc routines for Unicode (else uses internal ones)"
|
||||
default n
|
||||
depends on UNICODE_SUPPORT && LOCALE_SUPPORT
|
||||
help
|
||||
With this option on, Unicode support is implemented using libc
|
||||
routines. Otherwise, internal implementation is used.
|
||||
Internal implementation is smaller.
|
||||
|
||||
config FEATURE_CHECK_UNICODE_IN_ENV
|
||||
bool "Check $LC_ALL, $LC_CTYPE and $LANG environment variables"
|
||||
default n
|
||||
depends on UNICODE_SUPPORT && !UNICODE_USING_LOCALE
|
||||
help
|
||||
With this option on, Unicode support is activated
|
||||
only if locale-related variables have the value of the form
|
||||
"xxxx.utf8"
|
||||
|
||||
Otherwise, Unicode support will be always enabled and active.
|
||||
|
||||
config SUBST_WCHAR
|
||||
int "Character code to substitute unprintable characters with"
|
||||
depends on UNICODE_SUPPORT
|
||||
default 63
|
||||
help
|
||||
Typical values are 63 for '?' (works with any output device),
|
||||
30 for ASCII substitute control code,
|
||||
65533 (0xfffd) for Unicode replacement character.
|
||||
|
||||
config LAST_SUPPORTED_WCHAR
|
||||
int "Range of supported Unicode characters"
|
||||
depends on UNICODE_SUPPORT
|
||||
default 767
|
||||
help
|
||||
Any character with Unicode value bigger than this is assumed
|
||||
to be non-printable on output device. Many applets replace
|
||||
such chars with substitution character.
|
||||
|
||||
The idea is that many valid printable Unicode chars are
|
||||
nevertheless are not displayed correctly. Think about
|
||||
combining charachers, double-wide hieroglyphs, obscure
|
||||
characters in dozens of ancient scripts...
|
||||
Many terminals, terminal emulators, xterms etc will fail
|
||||
to handle them correctly. Choose the smallest value
|
||||
which suits your needs.
|
||||
|
||||
Typical values are:
|
||||
126 - ASCII only
|
||||
767 (0x2ff) - there are no combining chars in [0..767] range
|
||||
(the range includes Latin 1, Latin Ext. A and B),
|
||||
code is ~700 bytes smaller for this case.
|
||||
4351 (0x10ff) - there are no double-wide chars in [0..4351] range,
|
||||
code is ~300 bytes smaller for this case.
|
||||
12799 (0x31ff) - nearly all non-ideographic characters are
|
||||
available in [0..12799] range, including
|
||||
East Asian scripts like katakana, hiragana, hangul,
|
||||
bopomofo...
|
||||
0 - off, any valid printable Unicode character will be printed.
|
||||
|
||||
config UNICODE_COMBINING_WCHARS
|
||||
bool "Allow zero-width Unicode characters on output"
|
||||
default n
|
||||
depends on UNICODE_SUPPORT
|
||||
help
|
||||
With this option off, any Unicode char with width of 0
|
||||
is substituted on output.
|
||||
|
||||
config UNICODE_WIDE_WCHARS
|
||||
bool "Allow wide Unicode characters on output"
|
||||
default n
|
||||
depends on UNICODE_SUPPORT
|
||||
help
|
||||
With this option off, any Unicode char with width > 1
|
||||
is substituted on output.
|
||||
|
||||
config UNICODE_BIDI_SUPPORT
|
||||
bool "Bidirectional character-aware line input"
|
||||
default n
|
||||
depends on UNICODE_SUPPORT && !UNICODE_USING_LOCALE
|
||||
help
|
||||
With this option on, right-to-left Unicode characters
|
||||
are treated differently on input (e.g. cursor movement).
|
||||
|
||||
config UNICODE_NEUTRAL_TABLE
|
||||
bool "In bidi input, support non-ASCII neutral chars too"
|
||||
default n
|
||||
depends on UNICODE_BIDI_SUPPORT
|
||||
help
|
||||
In most cases it's enough to treat only ASCII non-letters
|
||||
(i.e. punctuation, numbers and space) as characters
|
||||
with neutral directionality.
|
||||
With this option on, more extensive (and bigger) table
|
||||
of neutral chars will be used.
|
||||
|
||||
config UNICODE_PRESERVE_BROKEN
|
||||
bool "Make it possible to enter sequences of chars which are not Unicode"
|
||||
default n
|
||||
depends on UNICODE_SUPPORT
|
||||
help
|
||||
With this option on, on line-editing input (such as used by shells)
|
||||
invalid UTF-8 bytes are not substituted with the selected
|
||||
substitution character.
|
||||
For example, this means that entering 'l', 's', ' ', 0xff, [Enter]
|
||||
at shell prompt will list file named 0xff (single char name
|
||||
with char value 255), not file named '?'.
|
||||
|
||||
config PAM
|
||||
bool "Support for PAM (Pluggable Authentication Modules)"
|
||||
default n
|
||||
@@ -130,6 +276,19 @@ config PAM
|
||||
Use PAM in some busybox applets (currently login and httpd) instead
|
||||
of direct access to password database.
|
||||
|
||||
config FEATURE_USE_SENDFILE
|
||||
bool "Use sendfile system call"
|
||||
default y
|
||||
select PLATFORM_LINUX
|
||||
help
|
||||
When enabled, busybox will use the kernel sendfile() function
|
||||
instead of read/write loops to copy data between file descriptors
|
||||
(for example, cp command does this a lot).
|
||||
If sendfile() doesn't work, copying code falls back to read/write
|
||||
loop. sendfile() was originally implemented for faster I/O
|
||||
from files to sockets, but since Linux 2.6.33 it was extended
|
||||
to work for many more file types.
|
||||
|
||||
config LONG_OPTS
|
||||
bool "Support for --long-options"
|
||||
default y
|
||||
@@ -338,7 +497,9 @@ config FEATURE_HAVE_RPC
|
||||
# This is automatically selected if any of enabled applets need it.
|
||||
# You do not need to select it manually.
|
||||
|
||||
comment 'Build Options'
|
||||
endmenu
|
||||
|
||||
menu 'Build Options'
|
||||
|
||||
config STATIC
|
||||
bool "Build BusyBox as a static binary (no shared libs)"
|
||||
@@ -513,73 +674,9 @@ config EXTRA_LDLIBS
|
||||
help
|
||||
Additional LDLIBS to pass to the linker with -l.
|
||||
|
||||
comment 'Installation Options ("make install" behavior)'
|
||||
endmenu
|
||||
|
||||
choice
|
||||
prompt "What kind of applet links to install"
|
||||
default INSTALL_APPLET_SYMLINKS
|
||||
help
|
||||
Choose what kind of links to applets are created by "make install".
|
||||
|
||||
config INSTALL_APPLET_SYMLINKS
|
||||
bool "as soft-links"
|
||||
help
|
||||
Install applets as soft-links to the busybox binary. This needs some
|
||||
free inodes on the filesystem, but might help with filesystem
|
||||
generators that can't cope with hard-links.
|
||||
|
||||
config INSTALL_APPLET_HARDLINKS
|
||||
bool "as hard-links"
|
||||
help
|
||||
Install applets as hard-links to the busybox binary. This might
|
||||
count on a filesystem with few inodes.
|
||||
|
||||
config INSTALL_APPLET_SCRIPT_WRAPPERS
|
||||
bool "as script wrappers"
|
||||
help
|
||||
Install applets as script wrappers that call the busybox binary.
|
||||
|
||||
config INSTALL_APPLET_DONT
|
||||
bool "not installed"
|
||||
help
|
||||
Do not install applet links. Useful when you plan to use
|
||||
busybox --install for installing links, or plan to use
|
||||
a standalone shell and thus don't need applet links.
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "/bin/sh applet link"
|
||||
default INSTALL_SH_APPLET_SYMLINK
|
||||
depends on INSTALL_APPLET_SCRIPT_WRAPPERS
|
||||
help
|
||||
Choose how you install /bin/sh applet link.
|
||||
|
||||
config INSTALL_SH_APPLET_SYMLINK
|
||||
bool "as soft-link"
|
||||
help
|
||||
Install /bin/sh applet as soft-link to the busybox binary.
|
||||
|
||||
config INSTALL_SH_APPLET_HARDLINK
|
||||
bool "as hard-link"
|
||||
help
|
||||
Install /bin/sh applet as hard-link to the busybox binary.
|
||||
|
||||
config INSTALL_SH_APPLET_SCRIPT_WRAPPER
|
||||
bool "as script wrapper"
|
||||
help
|
||||
Install /bin/sh applet as script wrapper that calls
|
||||
the busybox binary.
|
||||
|
||||
endchoice
|
||||
|
||||
config PREFIX
|
||||
string "BusyBox installation prefix"
|
||||
default "./_install"
|
||||
help
|
||||
Define your directory to install BusyBox files/subdirs in.
|
||||
|
||||
comment 'Debugging Options'
|
||||
menu 'Debugging Options'
|
||||
|
||||
config DEBUG
|
||||
bool "Build BusyBox with extra Debugging symbols"
|
||||
@@ -673,8 +770,78 @@ endchoice
|
||||
|
||||
endmenu
|
||||
|
||||
menu 'Installation Options ("make install" behavior)'
|
||||
|
||||
choice
|
||||
prompt "What kind of applet links to install"
|
||||
default INSTALL_APPLET_SYMLINKS
|
||||
help
|
||||
Choose what kind of links to applets are created by "make install".
|
||||
|
||||
config INSTALL_APPLET_SYMLINKS
|
||||
bool "as soft-links"
|
||||
help
|
||||
Install applets as soft-links to the busybox binary. This needs some
|
||||
free inodes on the filesystem, but might help with filesystem
|
||||
generators that can't cope with hard-links.
|
||||
|
||||
config INSTALL_APPLET_HARDLINKS
|
||||
bool "as hard-links"
|
||||
help
|
||||
Install applets as hard-links to the busybox binary. This might
|
||||
count on a filesystem with few inodes.
|
||||
|
||||
config INSTALL_APPLET_SCRIPT_WRAPPERS
|
||||
bool "as script wrappers"
|
||||
help
|
||||
Install applets as script wrappers that call the busybox binary.
|
||||
|
||||
config INSTALL_APPLET_DONT
|
||||
bool "not installed"
|
||||
help
|
||||
Do not install applet links. Useful when you plan to use
|
||||
busybox --install for installing links, or plan to use
|
||||
a standalone shell and thus don't need applet links.
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "/bin/sh applet link"
|
||||
default INSTALL_SH_APPLET_SYMLINK
|
||||
depends on INSTALL_APPLET_SCRIPT_WRAPPERS
|
||||
help
|
||||
Choose how you install /bin/sh applet link.
|
||||
|
||||
config INSTALL_SH_APPLET_SYMLINK
|
||||
bool "as soft-link"
|
||||
help
|
||||
Install /bin/sh applet as soft-link to the busybox binary.
|
||||
|
||||
config INSTALL_SH_APPLET_HARDLINK
|
||||
bool "as hard-link"
|
||||
help
|
||||
Install /bin/sh applet as hard-link to the busybox binary.
|
||||
|
||||
config INSTALL_SH_APPLET_SCRIPT_WRAPPER
|
||||
bool "as script wrapper"
|
||||
help
|
||||
Install /bin/sh applet as script wrapper that calls
|
||||
the busybox binary.
|
||||
|
||||
endchoice
|
||||
|
||||
config PREFIX
|
||||
string "BusyBox installation prefix"
|
||||
default "./_install"
|
||||
help
|
||||
Define your directory to install BusyBox files/subdirs in.
|
||||
|
||||
endmenu
|
||||
|
||||
source libbb/Config.in
|
||||
|
||||
endmenu
|
||||
|
||||
comment "Applets"
|
||||
|
||||
source archival/Config.in
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
VERSION = 1
|
||||
PATCHLEVEL = 26
|
||||
SUBLEVEL = 2
|
||||
PATCHLEVEL = 25
|
||||
SUBLEVEL = 1
|
||||
EXTRAVERSION =
|
||||
NAME = Unnamed
|
||||
|
||||
|
||||
+5
-15
@@ -29,7 +29,7 @@ applets/applets.o: include/usage_compressed.h include/applet_tables.h
|
||||
|
||||
applets/applet_tables: .config include/applets.h
|
||||
applets/usage: .config include/applets.h
|
||||
applets/usage_pod: .config include/applets.h include/applet_tables.h
|
||||
applets/usage_pod: .config include/applet_tables.h include/applets.h
|
||||
|
||||
quiet_cmd_gen_usage_compressed = GEN include/usage_compressed.h
|
||||
cmd_gen_usage_compressed = $(srctree_slash)applets/usage_compressed include/usage_compressed.h applets
|
||||
@@ -37,21 +37,11 @@ quiet_cmd_gen_usage_compressed = GEN include/usage_compressed.h
|
||||
include/usage_compressed.h: applets/usage $(srctree_slash)applets/usage_compressed
|
||||
$(call cmd,gen_usage_compressed)
|
||||
|
||||
quiet_cmd_gen_applet_tables = GEN include/applet_tables.h include/NUM_APPLETS.h
|
||||
quiet_cmd_gen_applet_tables = GEN include/applet_tables.h
|
||||
cmd_gen_applet_tables = applets/applet_tables include/applet_tables.h include/NUM_APPLETS.h
|
||||
|
||||
include/applet_tables.h: applets/applet_tables
|
||||
$(call cmd,gen_applet_tables)
|
||||
|
||||
include/NUM_APPLETS.h: applets/applet_tables
|
||||
$(call cmd,gen_applet_tables)
|
||||
|
||||
# In fact, include/applet_tables.h depends only on applets/applet_tables,
|
||||
# and is generated by it. But specifying only it can run
|
||||
# applets/applet_tables twice, possibly in parallel.
|
||||
# We say that it also needs NUM_APPLETS.h
|
||||
#
|
||||
# Unfortunately, we need to list the same command,
|
||||
# and it can be executed twice (sequentially).
|
||||
# The alternative is to not list any command,
|
||||
# and then if include/applet_tables.h is deleted, it won't be rebuilt.
|
||||
#
|
||||
include/applet_tables.h: include/NUM_APPLETS.h applets/applet_tables
|
||||
$(call cmd,gen_applet_tables)
|
||||
+11
-14
@@ -143,9 +143,7 @@ int main(int argc, char **argv)
|
||||
printf("};\n");
|
||||
printf("#endif\n\n");
|
||||
|
||||
#if ENABLE_FEATURE_PREFER_APPLETS \
|
||||
|| ENABLE_FEATURE_SH_STANDALONE \
|
||||
|| ENABLE_FEATURE_SH_NOFORK
|
||||
#if ENABLE_FEATURE_PREFER_APPLETS
|
||||
printf("const uint8_t applet_flags[] ALIGN1 = {\n");
|
||||
i = 0;
|
||||
while (i < NUM_APPLETS) {
|
||||
@@ -192,28 +190,27 @@ int main(int argc, char **argv)
|
||||
printf("};\n");
|
||||
#endif
|
||||
//printf("#endif /* SKIP_definitions */\n");
|
||||
|
||||
// printf("\n");
|
||||
// printf("#define MAX_APPLET_NAME_LEN %u\n", MAX_APPLET_NAME_LEN);
|
||||
|
||||
if (argv[2]) {
|
||||
FILE *fp;
|
||||
char line_old[80];
|
||||
char line_new[80];
|
||||
// char line_old[80];
|
||||
FILE *fp;
|
||||
|
||||
line_old[0] = 0;
|
||||
fp = fopen(argv[2], "r");
|
||||
if (fp) {
|
||||
fgets(line_old, sizeof(line_old), fp);
|
||||
fclose(fp);
|
||||
}
|
||||
sprintf(line_new, "#define NUM_APPLETS %u\n", NUM_APPLETS);
|
||||
// line_old[0] = 0;
|
||||
// fp = fopen(argv[2], "r");
|
||||
// if (fp) {
|
||||
// fgets(line_old, sizeof(line_old), fp);
|
||||
// fclose(fp);
|
||||
// }
|
||||
// if (strcmp(line_old, line_new) != 0) {
|
||||
if (strcmp(line_old, line_new) != 0) {
|
||||
fp = fopen(argv[2], "w");
|
||||
if (!fp)
|
||||
return 1;
|
||||
fputs(line_new, fp);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -90,8 +90,6 @@ int main(void)
|
||||
printf("%s\n\n", usage_array[i].aname);
|
||||
}
|
||||
}
|
||||
printf("=back\n\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ config FEATURE_SEAMLESS_GZ
|
||||
Make tar, rpm, modprobe etc understand .gz data.
|
||||
|
||||
config FEATURE_SEAMLESS_Z
|
||||
bool "Make tar, rpm, modprobe etc understand .Z data"
|
||||
bool "tar, rpm, modprobe etc understand .Z data"
|
||||
default n # it is ancient
|
||||
help
|
||||
Make tar, rpm, modprobe etc understand .Z data.
|
||||
|
||||
+27
-68
@@ -9,12 +9,6 @@
|
||||
|
||||
/* lzop_main() uses bbunpack(), need this: */
|
||||
//kbuild:lib-$(CONFIG_LZOP) += bbunzip.o
|
||||
//kbuild:lib-$(CONFIG_LZOPCAT) += bbunzip.o
|
||||
//kbuild:lib-$(CONFIG_UNLZOP) += bbunzip.o
|
||||
/* bzip2_main() too: */
|
||||
//kbuild:lib-$(CONFIG_BZIP2) += bbunzip.o
|
||||
/* gzip_main() too: */
|
||||
//kbuild:lib-$(CONFIG_GZIP) += bbunzip.o
|
||||
|
||||
/* Note: must be kept in sync with archival/lzop.c */
|
||||
enum {
|
||||
@@ -196,10 +190,7 @@ int FAST_FUNC bbunpack(char **argv,
|
||||
return exitcode;
|
||||
}
|
||||
|
||||
#if ENABLE_UNCOMPRESS \
|
||||
|| ENABLE_BUNZIP2 || ENABLE_BZCAT \
|
||||
|| ENABLE_UNLZMA || ENABLE_LZCAT || ENABLE_LZMA \
|
||||
|| ENABLE_UNXZ || ENABLE_XZCAT || ENABLE_XZ
|
||||
#if ENABLE_UNCOMPRESS || ENABLE_BUNZIP2 || ENABLE_UNLZMA || ENABLE_UNXZ
|
||||
static
|
||||
char* FAST_FUNC make_new_name_generic(char *filename, const char *expected_ext)
|
||||
{
|
||||
@@ -300,24 +291,18 @@ int uncompress_main(int argc UNUSED_PARAM, char **argv)
|
||||
//config: You can use the `-t' option to test the integrity of
|
||||
//config: an archive, without decompressing it.
|
||||
//config:
|
||||
//config:config ZCAT
|
||||
//config: bool "zcat"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: Alias to "gunzip -c".
|
||||
//config:
|
||||
//config:config FEATURE_GUNZIP_LONG_OPTIONS
|
||||
//config: bool "Enable long options"
|
||||
//config: default y
|
||||
//config: depends on (GUNZIP || ZCAT) && LONG_OPTS
|
||||
//config: depends on GUNZIP && LONG_OPTS
|
||||
//config: help
|
||||
//config: Enable use of long options.
|
||||
|
||||
//applet:IF_GUNZIP(APPLET(gunzip, BB_DIR_BIN, BB_SUID_DROP))
|
||||
//applet:IF_ZCAT(APPLET_ODDNAME(zcat, gunzip, BB_DIR_BIN, BB_SUID_DROP, zcat))
|
||||
//applet:IF_GUNZIP(APPLET_ODDNAME(zcat, gunzip, BB_DIR_BIN, BB_SUID_DROP, zcat))
|
||||
//kbuild:lib-$(CONFIG_GZIP) += bbunzip.o
|
||||
//kbuild:lib-$(CONFIG_GUNZIP) += bbunzip.o
|
||||
//kbuild:lib-$(CONFIG_ZCAT) += bbunzip.o
|
||||
#if ENABLE_GUNZIP || ENABLE_ZCAT
|
||||
#if ENABLE_GUNZIP
|
||||
static
|
||||
char* FAST_FUNC make_new_name_gunzip(char *filename, const char *expected_ext UNUSED_PARAM)
|
||||
{
|
||||
@@ -380,7 +365,7 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv)
|
||||
* Normally, "zcat" is just "gunzip -c".
|
||||
* But if seamless magic is enabled, then we are much more clever.
|
||||
*/
|
||||
if (ENABLE_ZCAT && applet_name[1] == 'c')
|
||||
if (applet_name[1] == 'c')
|
||||
option_mask32 |= OPT_STDOUT | SEAMLESS_MAGIC;
|
||||
|
||||
return bbunpack(argv, unpack_gz_stream, make_new_name_gunzip, /*unused:*/ NULL);
|
||||
@@ -417,24 +402,18 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv)
|
||||
//config:
|
||||
//config: Unless you have a specific application which requires bunzip2, you
|
||||
//config: should probably say N here.
|
||||
//config:
|
||||
//config:config BZCAT
|
||||
//config: bool "bzcat"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: Alias to "bunzip2 -c".
|
||||
|
||||
//applet:IF_BUNZIP2(APPLET(bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
//applet:IF_BZCAT(APPLET_ODDNAME(bzcat, bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP, bzcat))
|
||||
//applet:IF_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP, bzcat))
|
||||
//kbuild:lib-$(CONFIG_BZIP2) += bbunzip.o
|
||||
//kbuild:lib-$(CONFIG_BUNZIP2) += bbunzip.o
|
||||
//kbuild:lib-$(CONFIG_BZCAT) += bbunzip.o
|
||||
#if ENABLE_BUNZIP2 || ENABLE_BZCAT
|
||||
#if ENABLE_BUNZIP2
|
||||
int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int bunzip2_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
getopt32(argv, "cfvqdt");
|
||||
argv += optind;
|
||||
if (ENABLE_BZCAT && applet_name[2] == 'c') /* bzcat */
|
||||
if (applet_name[2] == 'c') /* bzcat */
|
||||
option_mask32 |= OPT_STDOUT;
|
||||
|
||||
return bbunpack(argv, unpack_bz2_stream, make_new_name_generic, "bz2");
|
||||
@@ -502,40 +481,27 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv)
|
||||
//config: The BusyBox unlzma applet is limited to decompression only.
|
||||
//config: On an x86 system, this applet adds about 4K.
|
||||
//config:
|
||||
//config:config LZCAT
|
||||
//config: bool "lzcat"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: unlzma is a compression utility using the Lempel-Ziv-Markov chain
|
||||
//config: compression algorithm, and range coding. Compression
|
||||
//config: is generally considerably better than that achieved by the bzip2
|
||||
//config: compressors.
|
||||
//config:
|
||||
//config: The BusyBox unlzma applet is limited to decompression only.
|
||||
//config: On an x86 system, this applet adds about 4K.
|
||||
//config:
|
||||
//config:config LZMA
|
||||
//config: bool "lzma -d"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: Enable this option if you want commands like "lzma -d" to work.
|
||||
//config: IOW: you'll get lzma applet, but it will always require -d option.
|
||||
//config:
|
||||
//config:config FEATURE_LZMA_FAST
|
||||
//config: bool "Optimize unlzma for speed"
|
||||
//config: default n
|
||||
//config: depends on UNLZMA || LZCAT || LZMA
|
||||
//config: depends on UNLZMA
|
||||
//config: help
|
||||
//config: This option reduces decompression time by about 25% at the cost of
|
||||
//config: a 1K bigger binary.
|
||||
//config:
|
||||
//config:config LZMA
|
||||
//config: bool "Provide lzma alias which supports only unpacking"
|
||||
//config: default y
|
||||
//config: depends on UNLZMA
|
||||
//config: help
|
||||
//config: Enable this option if you want commands like "lzma -d" to work.
|
||||
//config: IOW: you'll get lzma applet, but it will always require -d option.
|
||||
|
||||
//applet:IF_UNLZMA(APPLET(unlzma, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
//applet:IF_LZCAT(APPLET_ODDNAME(lzcat, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzcat))
|
||||
//applet:IF_UNLZMA(APPLET_ODDNAME(lzcat, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzcat))
|
||||
//applet:IF_LZMA(APPLET_ODDNAME(lzma, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzma))
|
||||
//kbuild:lib-$(CONFIG_UNLZMA) += bbunzip.o
|
||||
//kbuild:lib-$(CONFIG_LZCAT) += bbunzip.o
|
||||
//kbuild:lib-$(CONFIG_LZMA) += bbunzip.o
|
||||
#if ENABLE_UNLZMA || ENABLE_LZCAT || ENABLE_LZMA
|
||||
#if ENABLE_UNLZMA
|
||||
int unlzma_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int unlzma_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
@@ -546,7 +512,7 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv)
|
||||
bb_show_usage();
|
||||
# endif
|
||||
/* lzcat? */
|
||||
if (ENABLE_LZCAT && applet_name[2] == 'c')
|
||||
if (applet_name[2] == 'c')
|
||||
option_mask32 |= OPT_STDOUT;
|
||||
|
||||
argv += optind;
|
||||
@@ -561,26 +527,19 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv)
|
||||
//config: help
|
||||
//config: unxz is a unlzma successor.
|
||||
//config:
|
||||
//config:config XZCAT
|
||||
//config: bool "xzcat"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: Alias to "unxz -c".
|
||||
//config:
|
||||
//config:config XZ
|
||||
//config: bool "xz -d"
|
||||
//config: bool "Provide xz alias which supports only unpacking"
|
||||
//config: default y
|
||||
//config: depends on UNXZ
|
||||
//config: help
|
||||
//config: Enable this option if you want commands like "xz -d" to work.
|
||||
//config: IOW: you'll get xz applet, but it will always require -d option.
|
||||
|
||||
//applet:IF_UNXZ(APPLET(unxz, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
//applet:IF_XZCAT(APPLET_ODDNAME(xzcat, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xzcat))
|
||||
//applet:IF_UNXZ(APPLET_ODDNAME(xzcat, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xzcat))
|
||||
//applet:IF_XZ(APPLET_ODDNAME(xz, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xz))
|
||||
//kbuild:lib-$(CONFIG_UNXZ) += bbunzip.o
|
||||
//kbuild:lib-$(CONFIG_XZCAT) += bbunzip.o
|
||||
//kbuild:lib-$(CONFIG_XZ) += bbunzip.o
|
||||
#if ENABLE_UNXZ || ENABLE_XZCAT || ENABLE_XZ
|
||||
#if ENABLE_UNXZ
|
||||
int unxz_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int unxz_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
@@ -591,7 +550,7 @@ int unxz_main(int argc UNUSED_PARAM, char **argv)
|
||||
bb_show_usage();
|
||||
# endif
|
||||
/* xzcat? */
|
||||
if (ENABLE_XZCAT && applet_name[2] == 'c')
|
||||
if (applet_name[2] == 'c')
|
||||
option_mask32 |= OPT_STDOUT;
|
||||
|
||||
argv += optind;
|
||||
|
||||
+4
-4
@@ -23,7 +23,7 @@
|
||||
//config: cpio has 110 bytes of overheads for every stored file.
|
||||
//config:
|
||||
//config: This implementation of cpio can extract cpio archives created in the
|
||||
//config: "newc" or "crc" format.
|
||||
//config: "newc" or "crc" format, it cannot create or modify them.
|
||||
//config:
|
||||
//config: Unless you have a specific application which requires cpio, you
|
||||
//config: should probably say N here.
|
||||
@@ -51,10 +51,10 @@
|
||||
//usage: " [-ti"IF_FEATURE_CPIO_O("o")"]" IF_FEATURE_CPIO_P(" [-p DIR]")
|
||||
//usage: " [EXTR_FILE]..."
|
||||
//usage:#define cpio_full_usage "\n\n"
|
||||
//usage: "Extract (-i) or list (-t) files from a cpio archive"
|
||||
//usage: "Extract or list files from a cpio archive"
|
||||
//usage: IF_FEATURE_CPIO_O(", or"
|
||||
//usage: "\ntake file list from stdin and create an archive (-o)"
|
||||
//usage: IF_FEATURE_CPIO_P(" or copy files (-p)")
|
||||
//usage: "\ncreate an archive" IF_FEATURE_CPIO_P(" (-o) or copy files (-p)")
|
||||
//usage: " using file list on stdin"
|
||||
//usage: )
|
||||
//usage: "\n"
|
||||
//usage: "\nMain operation mode:"
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
|
||||
//config:config DPKG
|
||||
//config: bool "dpkg"
|
||||
//config: default y
|
||||
//config: default n
|
||||
//config: select FEATURE_SEAMLESS_GZ
|
||||
//config: help
|
||||
//config: dpkg is a medium-level tool to install, build, remove and manage
|
||||
|
||||
+54
-36
@@ -7,7 +7,7 @@
|
||||
|
||||
//config:config DPKG_DEB
|
||||
//config: bool "dpkg_deb"
|
||||
//config: default y
|
||||
//config: default n
|
||||
//config: select FEATURE_SEAMLESS_GZ
|
||||
//config: help
|
||||
//config: dpkg-deb unpacks and provides information about Debian archives.
|
||||
@@ -16,20 +16,29 @@
|
||||
//config:
|
||||
//config: Unless you have a specific application which requires dpkg-deb,
|
||||
//config: say N here.
|
||||
//config:
|
||||
//config:config FEATURE_DPKG_DEB_EXTRACT_ONLY
|
||||
//config: bool "Extract only (-x)"
|
||||
//config: default n
|
||||
//config: depends on DPKG_DEB
|
||||
//config: help
|
||||
//config: This reduces dpkg-deb to the equivalent of
|
||||
//config: "ar -p <deb> data.tar.gz | tar -zx". However it saves space as none
|
||||
//config: of the extra dpkg-deb, ar or tar options are needed, they are linked
|
||||
//config: to internally.
|
||||
|
||||
//applet:IF_DPKG_DEB(APPLET_ODDNAME(dpkg-deb, dpkg_deb, BB_DIR_USR_BIN, BB_SUID_DROP, dpkg_deb))
|
||||
|
||||
//kbuild:lib-$(CONFIG_DPKG_DEB) += dpkg_deb.o
|
||||
|
||||
//usage:#define dpkg_deb_trivial_usage
|
||||
//usage: "[-cefxX] FILE [DIR]"
|
||||
//usage: "[-cefxX] FILE [argument]"
|
||||
//usage:#define dpkg_deb_full_usage "\n\n"
|
||||
//usage: "Perform actions on Debian packages (.deb)\n"
|
||||
//usage: "\n -c List files"
|
||||
//usage: "\n -f Print control fields"
|
||||
//usage: "\n -e Extract control files to DIR (default: ./DEBIAN)"
|
||||
//usage: "\n -x Extract files to DIR (no default)"
|
||||
//usage: "\n -X Verbose -x"
|
||||
//usage: "Perform actions on Debian packages (.debs)\n"
|
||||
//usage: "\n -c List contents of filesystem tree"
|
||||
//usage: "\n -e Extract control files to [argument] directory"
|
||||
//usage: "\n -f Display control field name starting with [argument]"
|
||||
//usage: "\n -x Extract packages filesystem tree to directory"
|
||||
//usage: "\n -X Verbose extract"
|
||||
//usage:
|
||||
//usage:#define dpkg_deb_example_usage
|
||||
//usage: "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n"
|
||||
@@ -40,17 +49,18 @@
|
||||
#define DPKG_DEB_OPT_CONTENTS 1
|
||||
#define DPKG_DEB_OPT_CONTROL 2
|
||||
#define DPKG_DEB_OPT_FIELD 4
|
||||
#define DPKG_DEB_OPT_EXTRACT_VERBOSE 8
|
||||
#define DPKG_DEB_OPT_EXTRACT 16
|
||||
#define DPKG_DEB_OPT_EXTRACT 8
|
||||
#define DPKG_DEB_OPT_EXTRACT_VERBOSE 16
|
||||
|
||||
int dpkg_deb_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int dpkg_deb_main(int argc UNUSED_PARAM, char **argv)
|
||||
int dpkg_deb_main(int argc, char **argv)
|
||||
{
|
||||
archive_handle_t *ar_archive;
|
||||
archive_handle_t *tar_archive;
|
||||
llist_t *control_tar_llist = NULL;
|
||||
unsigned opt;
|
||||
const char *extract_dir;
|
||||
int need_args;
|
||||
|
||||
/* Setup the tar archive handle */
|
||||
tar_archive = init_handle();
|
||||
@@ -79,45 +89,53 @@ int dpkg_deb_main(int argc UNUSED_PARAM, char **argv)
|
||||
llist_add_to(&control_tar_llist, (char*)"control.tar.xz");
|
||||
#endif
|
||||
|
||||
/* Must have 1 or 2 args */
|
||||
opt_complementary = "-1:?2:c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX";
|
||||
opt_complementary = "c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX";
|
||||
opt = getopt32(argv, "cefXx");
|
||||
argv += optind;
|
||||
//argc -= optind;
|
||||
argc -= optind;
|
||||
|
||||
extract_dir = argv[1];
|
||||
if (opt & DPKG_DEB_OPT_CONTENTS) { // -c
|
||||
if (opt & DPKG_DEB_OPT_CONTENTS) {
|
||||
tar_archive->action_header = header_verbose_list;
|
||||
if (extract_dir)
|
||||
bb_show_usage();
|
||||
}
|
||||
if (opt & DPKG_DEB_OPT_FIELD) { // -f
|
||||
/* Print the entire control file */
|
||||
//TODO: standard tool accepts an optional list of fields to print
|
||||
extract_dir = NULL;
|
||||
need_args = 1;
|
||||
if (opt & DPKG_DEB_OPT_CONTROL) {
|
||||
ar_archive->accept = control_tar_llist;
|
||||
tar_archive->action_data = data_extract_all;
|
||||
if (1 == argc) {
|
||||
extract_dir = "./DEBIAN";
|
||||
} else {
|
||||
need_args++;
|
||||
}
|
||||
}
|
||||
if (opt & DPKG_DEB_OPT_FIELD) {
|
||||
/* Print the entire control file
|
||||
* it should accept a second argument which specifies a
|
||||
* specific field to print */
|
||||
ar_archive->accept = control_tar_llist;
|
||||
llist_add_to(&(tar_archive->accept), (char*)"./control");
|
||||
tar_archive->filter = filter_accept_list;
|
||||
tar_archive->action_data = data_extract_to_stdout;
|
||||
if (extract_dir)
|
||||
bb_show_usage();
|
||||
}
|
||||
if (opt & DPKG_DEB_OPT_CONTROL) { // -e
|
||||
ar_archive->accept = control_tar_llist;
|
||||
tar_archive->action_data = data_extract_all;
|
||||
if (!extract_dir)
|
||||
extract_dir = "./DEBIAN";
|
||||
if (opt & DPKG_DEB_OPT_EXTRACT) {
|
||||
tar_archive->action_header = header_list;
|
||||
}
|
||||
if (opt & (DPKG_DEB_OPT_EXTRACT_VERBOSE | DPKG_DEB_OPT_EXTRACT)) { // -Xx
|
||||
if (opt & DPKG_DEB_OPT_EXTRACT_VERBOSE)
|
||||
tar_archive->action_header = header_list;
|
||||
if (opt & (DPKG_DEB_OPT_EXTRACT_VERBOSE | DPKG_DEB_OPT_EXTRACT)) {
|
||||
tar_archive->action_data = data_extract_all;
|
||||
if (!extract_dir)
|
||||
bb_show_usage();
|
||||
need_args = 2;
|
||||
}
|
||||
|
||||
/* Standard tool supports "-" */
|
||||
tar_archive->src_fd = ar_archive->src_fd = xopen_stdin(argv[0]);
|
||||
if (need_args != argc) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
tar_archive->src_fd = ar_archive->src_fd = xopen(argv[0], O_RDONLY);
|
||||
|
||||
/* Work out where to extract the files */
|
||||
/* 2nd argument is a dir name */
|
||||
if (argv[1]) {
|
||||
extract_dir = argv[1];
|
||||
}
|
||||
if (extract_dir) {
|
||||
mkdir(extract_dir, 0777); /* bb_make_directory(extract_dir, 0777, 0) */
|
||||
xchdir(extract_dir);
|
||||
|
||||
@@ -48,23 +48,16 @@ lib-$(CONFIG_CPIO) += get_header_cpio.o
|
||||
lib-$(CONFIG_TAR) += get_header_tar.o unsafe_prefix.o
|
||||
lib-$(CONFIG_FEATURE_TAR_TO_COMMAND) += data_extract_to_command.o
|
||||
lib-$(CONFIG_LZOP) += lzo1x_1.o lzo1x_1o.o lzo1x_d.o
|
||||
lib-$(CONFIG_UNLZOP) += lzo1x_1.o lzo1x_1o.o lzo1x_d.o
|
||||
lib-$(CONFIG_LZOPCAT) += lzo1x_1.o lzo1x_1o.o lzo1x_d.o
|
||||
lib-$(CONFIG_LZOP_COMPR_HIGH) += lzo1x_9x.o
|
||||
lib-$(CONFIG_BUNZIP2) += open_transformer.o decompress_bunzip2.o
|
||||
lib-$(CONFIG_BZCAT) += open_transformer.o decompress_bunzip2.o
|
||||
lib-$(CONFIG_UNLZMA) += open_transformer.o decompress_unlzma.o
|
||||
lib-$(CONFIG_LZCAT) += open_transformer.o decompress_unlzma.o
|
||||
lib-$(CONFIG_LZMA) += open_transformer.o decompress_unlzma.o
|
||||
lib-$(CONFIG_UNXZ) += open_transformer.o decompress_unxz.o
|
||||
lib-$(CONFIG_XZCAT) += open_transformer.o decompress_unxz.o
|
||||
lib-$(CONFIG_XZ) += open_transformer.o decompress_unxz.o
|
||||
lib-$(CONFIG_GUNZIP) += open_transformer.o decompress_gunzip.o
|
||||
lib-$(CONFIG_ZCAT) += open_transformer.o decompress_gunzip.o
|
||||
lib-$(CONFIG_UNCOMPRESS) += open_transformer.o decompress_uncompress.o
|
||||
lib-$(CONFIG_UNZIP) += open_transformer.o decompress_gunzip.o unsafe_prefix.o
|
||||
lib-$(CONFIG_RPM2CPIO) += open_transformer.o decompress_gunzip.o get_header_cpio.o
|
||||
lib-$(CONFIG_RPM) += open_transformer.o decompress_gunzip.o get_header_cpio.o
|
||||
|
||||
lib-$(CONFIG_GZIP) += open_transformer.o
|
||||
lib-$(CONFIG_BZIP2) += open_transformer.o
|
||||
lib-$(CONFIG_LZOP) += open_transformer.o
|
||||
|
||||
@@ -113,19 +113,11 @@ static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int g
|
||||
value = end + 1;
|
||||
|
||||
# if ENABLE_FEATURE_TAR_GNU_EXTENSIONS
|
||||
if (!global) {
|
||||
if (is_prefixed_with(value, "path=")) {
|
||||
value += sizeof("path=") - 1;
|
||||
free(archive_handle->tar__longname);
|
||||
archive_handle->tar__longname = xstrdup(value);
|
||||
continue;
|
||||
}
|
||||
if (is_prefixed_with(value, "linkpath=")) {
|
||||
value += sizeof("linkpath=") - 1;
|
||||
free(archive_handle->tar__linkname);
|
||||
archive_handle->tar__linkname = xstrdup(value);
|
||||
continue;
|
||||
}
|
||||
if (!global && is_prefixed_with(value, "path=")) {
|
||||
value += sizeof("path=") - 1;
|
||||
free(archive_handle->tar__longname);
|
||||
archive_handle->tar__longname = xstrdup(value);
|
||||
continue;
|
||||
}
|
||||
# endif
|
||||
|
||||
@@ -187,13 +179,7 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
|
||||
* the message and we don't check whether we indeed
|
||||
* saw zero block directly before this. */
|
||||
if (i == 0) {
|
||||
/* GNU tar 1.29 will be silent if tar archive ends abruptly
|
||||
* (if there are no zero blocks at all, and last read returns zero,
|
||||
* not short read 0 < len < 512). Complain only if
|
||||
* the very first read fails. Grrr.
|
||||
*/
|
||||
if (archive_handle->offset == 0)
|
||||
bb_error_msg("short read");
|
||||
bb_error_msg("short read");
|
||||
/* this merely signals end of archive, not exit(1): */
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -209,11 +195,7 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
|
||||
archive_handle->offset += i;
|
||||
|
||||
/* If there is no filename its an empty header */
|
||||
if (tar.name[0] == 0 && tar.prefix[0] == 0
|
||||
/* Have seen a tar archive with pax 'x' header supplying UTF8 filename,
|
||||
* with actual file having all name fields NUL-filled. Check this: */
|
||||
&& !p_longname
|
||||
) {
|
||||
if (tar.name[0] == 0 && tar.prefix[0] == 0) {
|
||||
if (archive_handle->tar__end) {
|
||||
/* Second consecutive empty header - end of archive.
|
||||
* Read until the end to empty the pipe from gz or bz2
|
||||
|
||||
@@ -17,10 +17,6 @@ archive_handle_t* FAST_FUNC init_handle(void)
|
||||
archive_handle->action_data = data_skip;
|
||||
archive_handle->filter = filter_accept_all;
|
||||
archive_handle->seek = seek_by_jump;
|
||||
#if ENABLE_CPIO || ENABLE_RPM2CPIO || ENABLE_RPM
|
||||
archive_handle->cpio__owner.uid = (uid_t)-1L;
|
||||
archive_handle->cpio__owner.gid = (gid_t)-1L;
|
||||
#endif
|
||||
|
||||
return archive_handle;
|
||||
}
|
||||
+9
-23
@@ -31,33 +31,19 @@
|
||||
//config: help
|
||||
//config: Lzop compression/decompresion.
|
||||
//config:
|
||||
//config:config UNLZOP
|
||||
//config: bool "unlzop"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: Lzop decompresion.
|
||||
//config:
|
||||
//config:config LZOPCAT
|
||||
//config: bool "lzopcat"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: Alias to "unlzop -c".
|
||||
//config:
|
||||
//config:config LZOP_COMPR_HIGH
|
||||
//config: bool "lzop compression levels 7,8,9 (not very useful)"
|
||||
//config: default n
|
||||
//config: depends on LZOP || UNLZOP || LZOPCAT
|
||||
//config: depends on LZOP
|
||||
//config: help
|
||||
//config: High levels (7,8,9) of lzop compression. These levels
|
||||
//config: are actually slower than gzip at equivalent compression ratios
|
||||
//config: and take up 3.2K of code.
|
||||
|
||||
//applet:IF_LZOP(APPLET(lzop, BB_DIR_BIN, BB_SUID_DROP))
|
||||
//applet:IF_UNLZOP(APPLET_ODDNAME(unlzop, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, unlzop))
|
||||
//applet:IF_LZOPCAT(APPLET_ODDNAME(lzopcat, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, lzopcat))
|
||||
//applet:IF_LZOP(APPLET_ODDNAME(lzopcat, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, lzopcat))
|
||||
//applet:IF_LZOP(APPLET_ODDNAME(unlzop, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, unlzop))
|
||||
//kbuild:lib-$(CONFIG_LZOP) += lzop.o
|
||||
//kbuild:lib-$(CONFIG_UNLZOP) += lzop.o
|
||||
//kbuild:lib-$(CONFIG_LZOPCAT) += lzop.o
|
||||
|
||||
//usage:#define lzop_trivial_usage
|
||||
//usage: "[-cfvd123456789CF] [FILE]..."
|
||||
@@ -71,18 +57,18 @@
|
||||
//usage: "\n -C Also write checksum of compressed block"
|
||||
//usage:
|
||||
//usage:#define lzopcat_trivial_usage
|
||||
//usage: "[-vF] [FILE]..."
|
||||
//usage: "[-vCF] [FILE]..."
|
||||
//usage:#define lzopcat_full_usage "\n\n"
|
||||
//usage: " -v Verbose"
|
||||
//usage: "\n -F Don't verify checksum"
|
||||
//usage: "\n -F Don't store or verify checksum"
|
||||
//usage:
|
||||
//usage:#define unlzop_trivial_usage
|
||||
//usage: "[-cfvF] [FILE]..."
|
||||
//usage: "[-cfvCF] [FILE]..."
|
||||
//usage:#define unlzop_full_usage "\n\n"
|
||||
//usage: " -c Write to stdout"
|
||||
//usage: "\n -f Force"
|
||||
//usage: "\n -v Verbose"
|
||||
//usage: "\n -F Don't verify checksum"
|
||||
//usage: "\n -F Don't store or verify checksum"
|
||||
|
||||
#include "libbb.h"
|
||||
#include "common_bufsiz.h"
|
||||
@@ -1125,10 +1111,10 @@ int lzop_main(int argc UNUSED_PARAM, char **argv)
|
||||
getopt32(argv, OPTION_STRING);
|
||||
argv += optind;
|
||||
/* lzopcat? */
|
||||
if (ENABLE_LZOPCAT && applet_name[4] == 'c')
|
||||
if (applet_name[4] == 'c')
|
||||
option_mask32 |= (OPT_STDOUT | OPT_DECOMPRESS);
|
||||
/* unlzop? */
|
||||
if (ENABLE_UNLZOP && applet_name[4] == 'o')
|
||||
if (applet_name[4] == 'o')
|
||||
option_mask32 |= OPT_DECOMPRESS;
|
||||
|
||||
global_crc32_table = crc32_filltable(NULL, 0);
|
||||
|
||||
+8
-7
@@ -980,6 +980,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
|
||||
/* Prepend '-' to the first argument if required */
|
||||
opt_complementary = "--:" // first arg is options
|
||||
"tt:vv:" // count -t,-v
|
||||
IF_FEATURE_TAR_FROM("X::T::") // cumulative lists
|
||||
#if ENABLE_FEATURE_TAR_LONG_OPTIONS && ENABLE_FEATURE_TAR_FROM
|
||||
"\xff::" // --exclude=PATTERN is a list
|
||||
#endif
|
||||
@@ -1031,13 +1032,13 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
|
||||
#endif
|
||||
opt = getopt32(argv,
|
||||
"txC:f:Oopvk"
|
||||
IF_FEATURE_TAR_CREATE( "ch" )
|
||||
IF_FEATURE_SEAMLESS_BZ2( "j" )
|
||||
IF_FEATURE_SEAMLESS_LZMA("a" )
|
||||
IF_FEATURE_TAR_FROM( "T:*X:*")
|
||||
IF_FEATURE_SEAMLESS_GZ( "z" )
|
||||
IF_FEATURE_SEAMLESS_XZ( "J" )
|
||||
IF_FEATURE_SEAMLESS_Z( "Z" )
|
||||
IF_FEATURE_TAR_CREATE( "ch" )
|
||||
IF_FEATURE_SEAMLESS_BZ2( "j" )
|
||||
IF_FEATURE_SEAMLESS_LZMA("a" )
|
||||
IF_FEATURE_TAR_FROM( "T:X:")
|
||||
IF_FEATURE_SEAMLESS_GZ( "z" )
|
||||
IF_FEATURE_SEAMLESS_XZ( "J" )
|
||||
IF_FEATURE_SEAMLESS_Z( "Z" )
|
||||
IF_FEATURE_TAR_NOPRESERVE_TIME("m")
|
||||
IF_FEATURE_TAR_LONG_OPTIONS("\xf9:") // --strip-components
|
||||
, &base_dir // -C dir
|
||||
|
||||
+197
-245
@@ -16,6 +16,7 @@
|
||||
* TODO
|
||||
* Zip64 + other methods
|
||||
*/
|
||||
|
||||
//config:config UNZIP
|
||||
//config: bool "unzip"
|
||||
//config: default y
|
||||
@@ -23,17 +24,8 @@
|
||||
//config: unzip will list or extract files from a ZIP archive,
|
||||
//config: commonly found on DOS/WIN systems. The default behavior
|
||||
//config: (with no options) is to extract the archive into the
|
||||
//config: current directory.
|
||||
//config:
|
||||
//config:config FEATURE_UNZIP_CDF
|
||||
//config: bool "Read and use Central Directory data"
|
||||
//config: default y
|
||||
//config: depends on UNZIP
|
||||
//config: help
|
||||
//config: If you know that you only need to deal with simple
|
||||
//config: ZIP files without deleted/updated files, SFX archives etc,
|
||||
//config: you can reduce code size by unselecting this option.
|
||||
//config: To support less trivial ZIPs, say Y.
|
||||
//config: current directory. Use the `-d' option to extract to a
|
||||
//config: directory of your choice.
|
||||
|
||||
//applet:IF_UNZIP(APPLET(unzip, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
//kbuild:lib-$(CONFIG_UNZIP) += unzip.o
|
||||
@@ -62,8 +54,8 @@
|
||||
enum {
|
||||
#if BB_BIG_ENDIAN
|
||||
ZIP_FILEHEADER_MAGIC = 0x504b0304,
|
||||
ZIP_CDF_MAGIC = 0x504b0102, /* CDF item */
|
||||
ZIP_CDE_MAGIC = 0x504b0506, /* End of CDF */
|
||||
ZIP_CDF_MAGIC = 0x504b0102, /* central directory's file header */
|
||||
ZIP_CDE_MAGIC = 0x504b0506, /* "end of central directory" record */
|
||||
ZIP_DD_MAGIC = 0x504b0708,
|
||||
#else
|
||||
ZIP_FILEHEADER_MAGIC = 0x04034b50,
|
||||
@@ -88,20 +80,30 @@ typedef union {
|
||||
uint32_t ucmpsize PACKED; /* 18-21 */
|
||||
uint16_t filename_len; /* 22-23 */
|
||||
uint16_t extra_len; /* 24-25 */
|
||||
/* filename follows (not NUL terminated) */
|
||||
/* extra field follows */
|
||||
/* data follows */
|
||||
} fmt PACKED;
|
||||
} formatted PACKED;
|
||||
} zip_header_t; /* PACKED - gcc 4.2.1 doesn't like it (spews warning) */
|
||||
|
||||
#define FIX_ENDIANNESS_ZIP(zip) \
|
||||
do { if (BB_BIG_ENDIAN) { \
|
||||
(zip).fmt.crc32 = SWAP_LE32((zip).fmt.crc32 ); \
|
||||
(zip).fmt.cmpsize = SWAP_LE32((zip).fmt.cmpsize ); \
|
||||
(zip).fmt.ucmpsize = SWAP_LE32((zip).fmt.ucmpsize ); \
|
||||
(zip).fmt.filename_len = SWAP_LE16((zip).fmt.filename_len); \
|
||||
(zip).fmt.extra_len = SWAP_LE16((zip).fmt.extra_len ); \
|
||||
}} while (0)
|
||||
/* Check the offset of the last element, not the length. This leniency
|
||||
* allows for poor packing, whereby the overall struct may be too long,
|
||||
* even though the elements are all in the right place.
|
||||
*/
|
||||
struct BUG_zip_header_must_be_26_bytes {
|
||||
char BUG_zip_header_must_be_26_bytes[
|
||||
offsetof(zip_header_t, formatted.extra_len) + 2
|
||||
== ZIP_HEADER_LEN ? 1 : -1];
|
||||
};
|
||||
|
||||
#define FIX_ENDIANNESS_ZIP(zip_header) do { \
|
||||
(zip_header).formatted.version = SWAP_LE16((zip_header).formatted.version ); \
|
||||
(zip_header).formatted.method = SWAP_LE16((zip_header).formatted.method ); \
|
||||
(zip_header).formatted.modtime = SWAP_LE16((zip_header).formatted.modtime ); \
|
||||
(zip_header).formatted.moddate = SWAP_LE16((zip_header).formatted.moddate ); \
|
||||
(zip_header).formatted.crc32 = SWAP_LE32((zip_header).formatted.crc32 ); \
|
||||
(zip_header).formatted.cmpsize = SWAP_LE32((zip_header).formatted.cmpsize ); \
|
||||
(zip_header).formatted.ucmpsize = SWAP_LE32((zip_header).formatted.ucmpsize ); \
|
||||
(zip_header).formatted.filename_len = SWAP_LE16((zip_header).formatted.filename_len); \
|
||||
(zip_header).formatted.extra_len = SWAP_LE16((zip_header).formatted.extra_len ); \
|
||||
} while (0)
|
||||
|
||||
#define CDF_HEADER_LEN 42
|
||||
|
||||
@@ -113,44 +115,44 @@ typedef union {
|
||||
uint16_t version_needed; /* 2-3 */
|
||||
uint16_t cdf_flags; /* 4-5 */
|
||||
uint16_t method; /* 6-7 */
|
||||
uint16_t modtime; /* 8-9 */
|
||||
uint16_t moddate; /* 10-11 */
|
||||
uint16_t mtime; /* 8-9 */
|
||||
uint16_t mdate; /* 10-11 */
|
||||
uint32_t crc32; /* 12-15 */
|
||||
uint32_t cmpsize; /* 16-19 */
|
||||
uint32_t ucmpsize; /* 20-23 */
|
||||
uint16_t filename_len; /* 24-25 */
|
||||
uint16_t extra_len; /* 26-27 */
|
||||
uint16_t file_name_length; /* 24-25 */
|
||||
uint16_t extra_field_length; /* 26-27 */
|
||||
uint16_t file_comment_length; /* 28-29 */
|
||||
uint16_t disk_number_start; /* 30-31 */
|
||||
uint16_t internal_attributes; /* 32-33 */
|
||||
uint32_t external_attributes PACKED; /* 34-37 */
|
||||
uint16_t internal_file_attributes; /* 32-33 */
|
||||
uint32_t external_file_attributes PACKED; /* 34-37 */
|
||||
uint32_t relative_offset_of_local_header PACKED; /* 38-41 */
|
||||
/* filename follows (not NUL terminated) */
|
||||
/* extra field follows */
|
||||
/* file comment follows */
|
||||
} fmt PACKED;
|
||||
} formatted PACKED;
|
||||
} cdf_header_t;
|
||||
|
||||
#define FIX_ENDIANNESS_CDF(cdf) \
|
||||
do { if (BB_BIG_ENDIAN) { \
|
||||
(cdf).fmt.version_made_by = SWAP_LE16((cdf).fmt.version_made_by); \
|
||||
(cdf).fmt.version_needed = SWAP_LE16((cdf).fmt.version_needed); \
|
||||
(cdf).fmt.method = SWAP_LE16((cdf).fmt.method ); \
|
||||
(cdf).fmt.modtime = SWAP_LE16((cdf).fmt.modtime ); \
|
||||
(cdf).fmt.moddate = SWAP_LE16((cdf).fmt.moddate ); \
|
||||
(cdf).fmt.crc32 = SWAP_LE32((cdf).fmt.crc32 ); \
|
||||
(cdf).fmt.cmpsize = SWAP_LE32((cdf).fmt.cmpsize ); \
|
||||
(cdf).fmt.ucmpsize = SWAP_LE32((cdf).fmt.ucmpsize ); \
|
||||
(cdf).fmt.filename_len = SWAP_LE16((cdf).fmt.filename_len); \
|
||||
(cdf).fmt.extra_len = SWAP_LE16((cdf).fmt.extra_len ); \
|
||||
(cdf).fmt.file_comment_length = SWAP_LE16((cdf).fmt.file_comment_length); \
|
||||
(cdf).fmt.external_attributes = SWAP_LE32((cdf).fmt.external_attributes); \
|
||||
}} while (0)
|
||||
struct BUG_cdf_header_must_be_42_bytes {
|
||||
char BUG_cdf_header_must_be_42_bytes[
|
||||
offsetof(cdf_header_t, formatted.relative_offset_of_local_header) + 4
|
||||
== CDF_HEADER_LEN ? 1 : -1];
|
||||
};
|
||||
|
||||
#define CDE_LEN 16
|
||||
#define FIX_ENDIANNESS_CDF(cdf_header) do { \
|
||||
(cdf_header).formatted.crc32 = SWAP_LE32((cdf_header).formatted.crc32 ); \
|
||||
(cdf_header).formatted.cmpsize = SWAP_LE32((cdf_header).formatted.cmpsize ); \
|
||||
(cdf_header).formatted.ucmpsize = SWAP_LE32((cdf_header).formatted.ucmpsize ); \
|
||||
(cdf_header).formatted.file_name_length = SWAP_LE16((cdf_header).formatted.file_name_length); \
|
||||
(cdf_header).formatted.extra_field_length = SWAP_LE16((cdf_header).formatted.extra_field_length); \
|
||||
(cdf_header).formatted.file_comment_length = SWAP_LE16((cdf_header).formatted.file_comment_length); \
|
||||
IF_DESKTOP( \
|
||||
(cdf_header).formatted.version_made_by = SWAP_LE16((cdf_header).formatted.version_made_by); \
|
||||
(cdf_header).formatted.external_file_attributes = SWAP_LE32((cdf_header).formatted.external_file_attributes); \
|
||||
) \
|
||||
} while (0)
|
||||
|
||||
#define CDE_HEADER_LEN 16
|
||||
|
||||
typedef union {
|
||||
uint8_t raw[CDE_LEN];
|
||||
uint8_t raw[CDE_HEADER_LEN];
|
||||
struct {
|
||||
/* uint32_t signature; 50 4b 05 06 */
|
||||
uint16_t this_disk_no;
|
||||
@@ -159,43 +161,25 @@ typedef union {
|
||||
uint16_t cdf_entries_total;
|
||||
uint32_t cdf_size;
|
||||
uint32_t cdf_offset;
|
||||
/* uint16_t archive_comment_length; */
|
||||
/* archive comment follows */
|
||||
} fmt PACKED;
|
||||
} cde_t;
|
||||
/* uint16_t file_comment_length; */
|
||||
/* .ZIP file comment (variable size) */
|
||||
} formatted PACKED;
|
||||
} cde_header_t;
|
||||
|
||||
#define FIX_ENDIANNESS_CDE(cde) \
|
||||
do { if (BB_BIG_ENDIAN) { \
|
||||
(cde).fmt.cdf_offset = SWAP_LE32((cde).fmt.cdf_offset); \
|
||||
}} while (0)
|
||||
|
||||
struct BUG {
|
||||
/* Check the offset of the last element, not the length. This leniency
|
||||
* allows for poor packing, whereby the overall struct may be too long,
|
||||
* even though the elements are all in the right place.
|
||||
*/
|
||||
char BUG_zip_header_must_be_26_bytes[
|
||||
offsetof(zip_header_t, fmt.extra_len) + 2
|
||||
== ZIP_HEADER_LEN ? 1 : -1];
|
||||
char BUG_cdf_header_must_be_42_bytes[
|
||||
offsetof(cdf_header_t, fmt.relative_offset_of_local_header) + 4
|
||||
== CDF_HEADER_LEN ? 1 : -1];
|
||||
char BUG_cde_must_be_16_bytes[
|
||||
sizeof(cde_t) == CDE_LEN ? 1 : -1];
|
||||
struct BUG_cde_header_must_be_16_bytes {
|
||||
char BUG_cde_header_must_be_16_bytes[
|
||||
sizeof(cde_header_t) == CDE_HEADER_LEN ? 1 : -1];
|
||||
};
|
||||
|
||||
#define FIX_ENDIANNESS_CDE(cde_header) do { \
|
||||
(cde_header).formatted.cdf_offset = SWAP_LE32((cde_header).formatted.cdf_offset); \
|
||||
} while (0)
|
||||
|
||||
enum { zip_fd = 3 };
|
||||
|
||||
|
||||
/* This value means that we failed to find CDF */
|
||||
#define BAD_CDF_OFFSET ((uint32_t)0xffffffff)
|
||||
#if ENABLE_DESKTOP
|
||||
|
||||
#if !ENABLE_FEATURE_UNZIP_CDF
|
||||
|
||||
# define find_cdf_offset() BAD_CDF_OFFSET
|
||||
|
||||
#else
|
||||
/* Seen in the wild:
|
||||
* Self-extracting PRO2K3XP_32.exe contains 19078464 byte zip archive,
|
||||
* where CDE was nearly 48 kbytes before EOF.
|
||||
@@ -204,31 +188,30 @@ enum { zip_fd = 3 };
|
||||
* To make extraction work, bumped PEEK_FROM_END from 16k to 64k.
|
||||
*/
|
||||
#define PEEK_FROM_END (64*1024)
|
||||
|
||||
/* This value means that we failed to find CDF */
|
||||
#define BAD_CDF_OFFSET ((uint32_t)0xffffffff)
|
||||
|
||||
/* NB: does not preserve file position! */
|
||||
static uint32_t find_cdf_offset(void)
|
||||
{
|
||||
cde_t cde;
|
||||
unsigned char *buf;
|
||||
cde_header_t cde_header;
|
||||
unsigned char *p;
|
||||
off_t end;
|
||||
unsigned char *buf = xzalloc(PEEK_FROM_END);
|
||||
uint32_t found;
|
||||
|
||||
end = lseek(zip_fd, 0, SEEK_END);
|
||||
if (end == (off_t) -1)
|
||||
return BAD_CDF_OFFSET;
|
||||
|
||||
end = xlseek(zip_fd, 0, SEEK_END);
|
||||
end -= PEEK_FROM_END;
|
||||
if (end < 0)
|
||||
end = 0;
|
||||
|
||||
dbg("Looking for cdf_offset starting from 0x%"OFF_FMT"x", end);
|
||||
xlseek(zip_fd, end, SEEK_SET);
|
||||
buf = xzalloc(PEEK_FROM_END);
|
||||
full_read(zip_fd, buf, PEEK_FROM_END);
|
||||
|
||||
found = BAD_CDF_OFFSET;
|
||||
p = buf;
|
||||
while (p <= buf + PEEK_FROM_END - CDE_LEN - 4) {
|
||||
while (p <= buf + PEEK_FROM_END - CDE_HEADER_LEN - 4) {
|
||||
if (*p != 'P') {
|
||||
p++;
|
||||
continue;
|
||||
@@ -240,19 +223,19 @@ static uint32_t find_cdf_offset(void)
|
||||
if (*++p != 6)
|
||||
continue;
|
||||
/* we found CDE! */
|
||||
memcpy(cde.raw, p + 1, CDE_LEN);
|
||||
FIX_ENDIANNESS_CDE(cde);
|
||||
memcpy(cde_header.raw, p + 1, CDE_HEADER_LEN);
|
||||
FIX_ENDIANNESS_CDE(cde_header);
|
||||
/*
|
||||
* I've seen .ZIP files with seemingly valid CDEs
|
||||
* where cdf_offset points past EOF - ??
|
||||
* This check ignores such CDEs:
|
||||
*/
|
||||
if (cde.fmt.cdf_offset < end + (p - buf)) {
|
||||
found = cde.fmt.cdf_offset;
|
||||
if (cde_header.formatted.cdf_offset < end + (p - buf)) {
|
||||
found = cde_header.formatted.cdf_offset;
|
||||
dbg("Possible cdf_offset:0x%x at 0x%"OFF_FMT"x",
|
||||
(unsigned)found, end + (p-3 - buf));
|
||||
dbg(" cdf_offset+cdf_size:0x%x",
|
||||
(unsigned)(found + SWAP_LE32(cde.fmt.cdf_size)));
|
||||
(unsigned)(found + SWAP_LE32(cde_header.formatted.cdf_size)));
|
||||
/*
|
||||
* We do not "break" here because only the last CDE is valid.
|
||||
* I've seen a .zip archive which contained a .zip file,
|
||||
@@ -266,36 +249,33 @@ static uint32_t find_cdf_offset(void)
|
||||
return found;
|
||||
};
|
||||
|
||||
static uint32_t read_next_cdf(uint32_t cdf_offset, cdf_header_t *cdf)
|
||||
static uint32_t read_next_cdf(uint32_t cdf_offset, cdf_header_t *cdf_ptr)
|
||||
{
|
||||
uint32_t magic;
|
||||
off_t org;
|
||||
|
||||
if (cdf_offset == BAD_CDF_OFFSET)
|
||||
return cdf_offset;
|
||||
org = xlseek(zip_fd, 0, SEEK_CUR);
|
||||
|
||||
dbg("Reading CDF at 0x%x", (unsigned)cdf_offset);
|
||||
xlseek(zip_fd, cdf_offset, SEEK_SET);
|
||||
xread(zip_fd, &magic, 4);
|
||||
/* Central Directory End? Assume CDF has ended.
|
||||
* (more correct method is to use cde.cdf_entries_total counter)
|
||||
*/
|
||||
if (magic == ZIP_CDE_MAGIC) {
|
||||
dbg("got ZIP_CDE_MAGIC");
|
||||
return 0; /* EOF */
|
||||
if (!cdf_offset)
|
||||
cdf_offset = find_cdf_offset();
|
||||
|
||||
if (cdf_offset != BAD_CDF_OFFSET) {
|
||||
dbg("Reading CDF at 0x%x", (unsigned)cdf_offset);
|
||||
xlseek(zip_fd, cdf_offset + 4, SEEK_SET);
|
||||
xread(zip_fd, cdf_ptr->raw, CDF_HEADER_LEN);
|
||||
FIX_ENDIANNESS_CDF(*cdf_ptr);
|
||||
dbg(" file_name_length:%u extra_field_length:%u file_comment_length:%u",
|
||||
(unsigned)cdf_ptr->formatted.file_name_length,
|
||||
(unsigned)cdf_ptr->formatted.extra_field_length,
|
||||
(unsigned)cdf_ptr->formatted.file_comment_length
|
||||
);
|
||||
cdf_offset += 4 + CDF_HEADER_LEN
|
||||
+ cdf_ptr->formatted.file_name_length
|
||||
+ cdf_ptr->formatted.extra_field_length
|
||||
+ cdf_ptr->formatted.file_comment_length;
|
||||
}
|
||||
xread(zip_fd, cdf->raw, CDF_HEADER_LEN);
|
||||
|
||||
FIX_ENDIANNESS_CDF(*cdf);
|
||||
dbg(" filename_len:%u extra_len:%u file_comment_length:%u",
|
||||
(unsigned)cdf->fmt.filename_len,
|
||||
(unsigned)cdf->fmt.extra_len,
|
||||
(unsigned)cdf->fmt.file_comment_length
|
||||
);
|
||||
cdf_offset += 4 + CDF_HEADER_LEN
|
||||
+ cdf->fmt.filename_len
|
||||
+ cdf->fmt.extra_len
|
||||
+ cdf->fmt.file_comment_length;
|
||||
|
||||
dbg("Returning file position to 0x%"OFF_FMT"x", org);
|
||||
xlseek(zip_fd, org, SEEK_SET);
|
||||
return cdf_offset;
|
||||
};
|
||||
#endif
|
||||
@@ -317,34 +297,33 @@ static void unzip_create_leading_dirs(const char *fn)
|
||||
free(name);
|
||||
}
|
||||
|
||||
static void unzip_extract(zip_header_t *zip, int dst_fd)
|
||||
static void unzip_extract(zip_header_t *zip_header, int dst_fd)
|
||||
{
|
||||
if (zip->fmt.method == 0) {
|
||||
if (zip_header->formatted.method == 0) {
|
||||
/* Method 0 - stored (not compressed) */
|
||||
off_t size = zip->fmt.ucmpsize;
|
||||
off_t size = zip_header->formatted.ucmpsize;
|
||||
if (size)
|
||||
bb_copyfd_exact_size(zip_fd, dst_fd, size);
|
||||
} else {
|
||||
/* Method 8 - inflate */
|
||||
transformer_state_t xstate;
|
||||
init_transformer_state(&xstate);
|
||||
xstate.bytes_in = zip->fmt.cmpsize;
|
||||
xstate.bytes_in = zip_header->formatted.cmpsize;
|
||||
xstate.src_fd = zip_fd;
|
||||
xstate.dst_fd = dst_fd;
|
||||
if (inflate_unzip(&xstate) < 0)
|
||||
bb_error_msg_and_die("inflate error");
|
||||
/* Validate decompression - crc */
|
||||
if (zip->fmt.crc32 != (xstate.crc32 ^ 0xffffffffL)) {
|
||||
if (zip_header->formatted.crc32 != (xstate.crc32 ^ 0xffffffffL)) {
|
||||
bb_error_msg_and_die("crc error");
|
||||
}
|
||||
/* Validate decompression - size */
|
||||
if (zip->fmt.ucmpsize != xstate.bytes_out) {
|
||||
if (zip_header->formatted.ucmpsize != xstate.bytes_out) {
|
||||
/* Don't die. Who knows, maybe len calculation
|
||||
* was botched somewhere. After all, crc matched! */
|
||||
bb_error_msg("bad length");
|
||||
}
|
||||
}
|
||||
/* TODO? method 12: bzip2, method 14: LZMA */
|
||||
}
|
||||
|
||||
static void my_fgets80(char *buf80)
|
||||
@@ -360,12 +339,15 @@ int unzip_main(int argc, char **argv)
|
||||
{
|
||||
enum { O_PROMPT, O_NEVER, O_ALWAYS };
|
||||
|
||||
zip_header_t zip_header;
|
||||
smallint quiet = 0;
|
||||
IF_NOT_FEATURE_UNZIP_CDF(const) smallint verbose = 0;
|
||||
IF_NOT_DESKTOP(const) smallint verbose = 0;
|
||||
smallint listing = 0;
|
||||
smallint overwrite = O_PROMPT;
|
||||
smallint x_opt_seen;
|
||||
#if ENABLE_DESKTOP
|
||||
uint32_t cdf_offset;
|
||||
#endif
|
||||
unsigned long total_usize;
|
||||
unsigned long total_size;
|
||||
unsigned total_entries;
|
||||
@@ -448,7 +430,7 @@ int unzip_main(int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'v': /* Verbose list */
|
||||
IF_FEATURE_UNZIP_CDF(verbose++;)
|
||||
IF_DESKTOP(verbose++;)
|
||||
listing = 1;
|
||||
break;
|
||||
|
||||
@@ -563,118 +545,91 @@ int unzip_main(int argc, char **argv)
|
||||
total_usize = 0;
|
||||
total_size = 0;
|
||||
total_entries = 0;
|
||||
cdf_offset = find_cdf_offset(); /* try to seek to the end, find CDE and CDF start */
|
||||
#if ENABLE_DESKTOP
|
||||
cdf_offset = 0;
|
||||
#endif
|
||||
while (1) {
|
||||
zip_header_t zip;
|
||||
uint32_t magic;
|
||||
mode_t dir_mode = 0777;
|
||||
#if ENABLE_FEATURE_UNZIP_CDF
|
||||
#if ENABLE_DESKTOP
|
||||
mode_t file_mode = 0666;
|
||||
#endif
|
||||
|
||||
if (!ENABLE_FEATURE_UNZIP_CDF || cdf_offset == BAD_CDF_OFFSET) {
|
||||
/* Normally happens when input is unseekable.
|
||||
*
|
||||
* Valid ZIP file has Central Directory at the end
|
||||
* with central directory file headers (CDFs).
|
||||
* After it, there is a Central Directory End structure.
|
||||
* CDFs identify what files are in the ZIP and where
|
||||
* they are located. This allows ZIP readers to load
|
||||
* the list of files without reading the entire ZIP archive.
|
||||
* ZIP files may be appended to, only files specified in
|
||||
* the CD are valid. Scanning for local file headers is
|
||||
* not a correct algorithm.
|
||||
*
|
||||
* We try to do the above, and resort to "linear" reading
|
||||
* of ZIP file only if seek failed or CDE wasn't found.
|
||||
*/
|
||||
uint32_t magic;
|
||||
|
||||
/* Check magic number */
|
||||
xread(zip_fd, &magic, 4);
|
||||
/* CDF item? Assume there are no more files, exit */
|
||||
if (magic == ZIP_CDF_MAGIC) {
|
||||
dbg("got ZIP_CDF_MAGIC");
|
||||
break;
|
||||
}
|
||||
/* Data descriptor? It was a streaming file, go on */
|
||||
if (magic == ZIP_DD_MAGIC) {
|
||||
dbg("got ZIP_DD_MAGIC");
|
||||
/* skip over duplicate crc32, cmpsize and ucmpsize */
|
||||
unzip_skip(3 * 4);
|
||||
continue;
|
||||
}
|
||||
if (magic != ZIP_FILEHEADER_MAGIC)
|
||||
bb_error_msg_and_die("invalid zip magic %08X", (int)magic);
|
||||
dbg("got ZIP_FILEHEADER_MAGIC");
|
||||
|
||||
xread(zip_fd, zip.raw, ZIP_HEADER_LEN);
|
||||
FIX_ENDIANNESS_ZIP(zip);
|
||||
if ((zip.fmt.method != 0)
|
||||
&& (zip.fmt.method != 8)
|
||||
) {
|
||||
/* TODO? method 12: bzip2, method 14: LZMA */
|
||||
bb_error_msg_and_die("unsupported method %d", zip.fmt.method);
|
||||
}
|
||||
if (zip.fmt.zip_flags & SWAP_LE16(0x0009)) {
|
||||
bb_error_msg_and_die("zip flags 1 and 8 are not supported");
|
||||
}
|
||||
/* Check magic number */
|
||||
xread(zip_fd, &magic, 4);
|
||||
/* Central directory? It's at the end, so exit */
|
||||
if (magic == ZIP_CDF_MAGIC) {
|
||||
dbg("got ZIP_CDF_MAGIC");
|
||||
break;
|
||||
}
|
||||
#if ENABLE_FEATURE_UNZIP_CDF
|
||||
else {
|
||||
/* cdf_offset is valid (and we know the file is seekable) */
|
||||
cdf_header_t cdf;
|
||||
cdf_offset = read_next_cdf(cdf_offset, &cdf);
|
||||
if (cdf_offset == 0) /* EOF? */
|
||||
break;
|
||||
# if 1
|
||||
xlseek(zip_fd,
|
||||
SWAP_LE32(cdf.fmt.relative_offset_of_local_header) + 4,
|
||||
SEEK_SET);
|
||||
xread(zip_fd, zip.raw, ZIP_HEADER_LEN);
|
||||
FIX_ENDIANNESS_ZIP(zip);
|
||||
if (zip.fmt.zip_flags & SWAP_LE16(0x0008)) {
|
||||
/* 0x0008 - streaming. [u]cmpsize can be reliably gotten
|
||||
* only from Central Directory.
|
||||
*/
|
||||
zip.fmt.crc32 = cdf.fmt.crc32;
|
||||
zip.fmt.cmpsize = cdf.fmt.cmpsize;
|
||||
zip.fmt.ucmpsize = cdf.fmt.ucmpsize;
|
||||
}
|
||||
# else
|
||||
/* CDF has the same data as local header, no need to read the latter...
|
||||
* ...not really. An archive was seen with cdf.extra_len == 6 but
|
||||
* zip.extra_len == 0.
|
||||
*/
|
||||
memcpy(&zip.fmt.version,
|
||||
&cdf.fmt.version_needed, ZIP_HEADER_LEN);
|
||||
xlseek(zip_fd,
|
||||
SWAP_LE32(cdf.fmt.relative_offset_of_local_header) + 4 + ZIP_HEADER_LEN,
|
||||
SEEK_SET);
|
||||
# endif
|
||||
if ((cdf.fmt.version_made_by >> 8) == 3) {
|
||||
/* This archive is created on Unix */
|
||||
dir_mode = file_mode = (cdf.fmt.external_attributes >> 16);
|
||||
}
|
||||
#if ENABLE_DESKTOP
|
||||
/* Data descriptor? It was a streaming file, go on */
|
||||
if (magic == ZIP_DD_MAGIC) {
|
||||
dbg("got ZIP_DD_MAGIC");
|
||||
/* skip over duplicate crc32, cmpsize and ucmpsize */
|
||||
unzip_skip(3 * 4);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (magic != ZIP_FILEHEADER_MAGIC)
|
||||
bb_error_msg_and_die("invalid zip magic %08X", (int)magic);
|
||||
dbg("got ZIP_FILEHEADER_MAGIC");
|
||||
|
||||
if (zip.fmt.zip_flags & SWAP_LE16(0x0001)) {
|
||||
/* Read the file header */
|
||||
xread(zip_fd, zip_header.raw, ZIP_HEADER_LEN);
|
||||
FIX_ENDIANNESS_ZIP(zip_header);
|
||||
if ((zip_header.formatted.method != 0) && (zip_header.formatted.method != 8)) {
|
||||
bb_error_msg_and_die("unsupported method %d", zip_header.formatted.method);
|
||||
}
|
||||
#if !ENABLE_DESKTOP
|
||||
if (zip_header.formatted.zip_flags & SWAP_LE16(0x0009)) {
|
||||
bb_error_msg_and_die("zip flags 1 and 8 are not supported");
|
||||
}
|
||||
#else
|
||||
if (zip_header.formatted.zip_flags & SWAP_LE16(0x0001)) {
|
||||
/* 0x0001 - encrypted */
|
||||
bb_error_msg_and_die("zip flag 1 (encryption) is not supported");
|
||||
}
|
||||
|
||||
if (cdf_offset != BAD_CDF_OFFSET) {
|
||||
cdf_header_t cdf_header;
|
||||
cdf_offset = read_next_cdf(cdf_offset, &cdf_header);
|
||||
/*
|
||||
* Note: cdf_offset can become BAD_CDF_OFFSET after the above call.
|
||||
*/
|
||||
if (zip_header.formatted.zip_flags & SWAP_LE16(0x0008)) {
|
||||
/* 0x0008 - streaming. [u]cmpsize can be reliably gotten
|
||||
* only from Central Directory. See unzip_doc.txt
|
||||
*/
|
||||
zip_header.formatted.crc32 = cdf_header.formatted.crc32;
|
||||
zip_header.formatted.cmpsize = cdf_header.formatted.cmpsize;
|
||||
zip_header.formatted.ucmpsize = cdf_header.formatted.ucmpsize;
|
||||
}
|
||||
if ((cdf_header.formatted.version_made_by >> 8) == 3) {
|
||||
/* This archive is created on Unix */
|
||||
dir_mode = file_mode = (cdf_header.formatted.external_file_attributes >> 16);
|
||||
}
|
||||
}
|
||||
if (cdf_offset == BAD_CDF_OFFSET
|
||||
&& (zip_header.formatted.zip_flags & SWAP_LE16(0x0008))
|
||||
) {
|
||||
/* If it's a streaming zip, we _require_ CDF */
|
||||
bb_error_msg_and_die("can't find file table");
|
||||
}
|
||||
#endif
|
||||
dbg("File cmpsize:0x%x extra_len:0x%x ucmpsize:0x%x",
|
||||
(unsigned)zip.fmt.cmpsize,
|
||||
(unsigned)zip.fmt.extra_len,
|
||||
(unsigned)zip.fmt.ucmpsize
|
||||
(unsigned)zip_header.formatted.cmpsize,
|
||||
(unsigned)zip_header.formatted.extra_len,
|
||||
(unsigned)zip_header.formatted.ucmpsize
|
||||
);
|
||||
|
||||
/* Read filename */
|
||||
free(dst_fn);
|
||||
dst_fn = xzalloc(zip.fmt.filename_len + 1);
|
||||
xread(zip_fd, dst_fn, zip.fmt.filename_len);
|
||||
dst_fn = xzalloc(zip_header.formatted.filename_len + 1);
|
||||
xread(zip_fd, dst_fn, zip_header.formatted.filename_len);
|
||||
|
||||
/* Skip extra header bytes */
|
||||
unzip_skip(zip.fmt.extra_len);
|
||||
unzip_skip(zip_header.formatted.extra_len);
|
||||
|
||||
/* Guard against "/abspath", "/../" and similar attacks */
|
||||
overlapping_strcpy(dst_fn, strip_unsafe_prefix(dst_fn));
|
||||
@@ -689,32 +644,32 @@ int unzip_main(int argc, char **argv)
|
||||
/* List entry */
|
||||
char dtbuf[sizeof("mm-dd-yyyy hh:mm")];
|
||||
sprintf(dtbuf, "%02u-%02u-%04u %02u:%02u",
|
||||
(zip.fmt.moddate >> 5) & 0xf, // mm: 0x01e0
|
||||
(zip.fmt.moddate) & 0x1f, // dd: 0x001f
|
||||
(zip.fmt.moddate >> 9) + 1980, // yy: 0xfe00
|
||||
(zip.fmt.modtime >> 11), // hh: 0xf800
|
||||
(zip.fmt.modtime >> 5) & 0x3f // mm: 0x07e0
|
||||
// seconds/2 not shown, encoded in -- 0x001f
|
||||
(zip_header.formatted.moddate >> 5) & 0xf, // mm: 0x01e0
|
||||
(zip_header.formatted.moddate) & 0x1f, // dd: 0x001f
|
||||
(zip_header.formatted.moddate >> 9) + 1980, // yy: 0xfe00
|
||||
(zip_header.formatted.modtime >> 11), // hh: 0xf800
|
||||
(zip_header.formatted.modtime >> 5) & 0x3f // mm: 0x07e0
|
||||
// seconds/2 are not shown, encoded in ----------- 0x001f
|
||||
);
|
||||
if (!verbose) {
|
||||
// " Length Date Time Name\n"
|
||||
// "--------- ---------- ----- ----"
|
||||
printf( "%9u " "%s " "%s\n",
|
||||
(unsigned)zip.fmt.ucmpsize,
|
||||
(unsigned)zip_header.formatted.ucmpsize,
|
||||
dtbuf,
|
||||
dst_fn);
|
||||
} else {
|
||||
unsigned long percents = zip.fmt.ucmpsize - zip.fmt.cmpsize;
|
||||
unsigned long percents = zip_header.formatted.ucmpsize - zip_header.formatted.cmpsize;
|
||||
if ((int32_t)percents < 0)
|
||||
percents = 0; /* happens if ucmpsize < cmpsize */
|
||||
percents = percents * 100;
|
||||
if (zip.fmt.ucmpsize)
|
||||
percents /= zip.fmt.ucmpsize;
|
||||
if (zip_header.formatted.ucmpsize)
|
||||
percents /= zip_header.formatted.ucmpsize;
|
||||
// " Length Method Size Cmpr Date Time CRC-32 Name\n"
|
||||
// "-------- ------ ------- ---- ---------- ----- -------- ----"
|
||||
printf( "%8u %s" "%9u%4u%% " "%s " "%08x " "%s\n",
|
||||
(unsigned)zip.fmt.ucmpsize,
|
||||
zip.fmt.method == 0 ? "Stored" : "Defl:N", /* Defl is method 8 */
|
||||
(unsigned)zip_header.formatted.ucmpsize,
|
||||
zip_header.formatted.method == 0 ? "Stored" : "Defl:N", /* Defl is method 8 */
|
||||
/* TODO: show other methods?
|
||||
* 1 - Shrunk
|
||||
* 2 - Reduced with compression factor 1
|
||||
@@ -727,16 +682,15 @@ int unzip_main(int argc, char **argv)
|
||||
* 10 - PKWARE Data Compression Library Imploding
|
||||
* 11 - Reserved by PKWARE
|
||||
* 12 - BZIP2
|
||||
* 14 - LZMA
|
||||
*/
|
||||
(unsigned)zip.fmt.cmpsize,
|
||||
(unsigned)zip_header.formatted.cmpsize,
|
||||
(unsigned)percents,
|
||||
dtbuf,
|
||||
zip.fmt.crc32,
|
||||
zip_header.formatted.crc32,
|
||||
dst_fn);
|
||||
total_size += zip.fmt.cmpsize;
|
||||
total_size += zip_header.formatted.cmpsize;
|
||||
}
|
||||
total_usize += zip.fmt.ucmpsize;
|
||||
total_usize += zip_header.formatted.ucmpsize;
|
||||
i = 'n';
|
||||
} else if (dst_fd == STDOUT_FILENO) {
|
||||
/* Extracting to STDOUT */
|
||||
@@ -797,18 +751,16 @@ int unzip_main(int argc, char **argv)
|
||||
overwrite = O_ALWAYS;
|
||||
case 'y': /* Open file and fall into unzip */
|
||||
unzip_create_leading_dirs(dst_fn);
|
||||
#if ENABLE_FEATURE_UNZIP_CDF
|
||||
#if ENABLE_DESKTOP
|
||||
dst_fd = xopen3(dst_fn, O_WRONLY | O_CREAT | O_TRUNC, file_mode);
|
||||
#else
|
||||
dst_fd = xopen(dst_fn, O_WRONLY | O_CREAT | O_TRUNC);
|
||||
#endif
|
||||
case -1: /* Unzip */
|
||||
if (!quiet) {
|
||||
printf(/* zip.fmt.method == 0
|
||||
? " extracting: %s\n"
|
||||
: */ " inflating: %s\n", dst_fn);
|
||||
printf(" inflating: %s\n", dst_fn);
|
||||
}
|
||||
unzip_extract(&zip, dst_fd);
|
||||
unzip_extract(&zip_header, dst_fd);
|
||||
if (dst_fd != STDOUT_FILENO) {
|
||||
/* closing STDOUT is potentially bad for future business */
|
||||
close(dst_fd);
|
||||
@@ -819,7 +771,7 @@ int unzip_main(int argc, char **argv)
|
||||
overwrite = O_NEVER;
|
||||
case 'n':
|
||||
/* Skip entry data */
|
||||
unzip_skip(zip.fmt.cmpsize);
|
||||
unzip_skip(zip_header.formatted.cmpsize);
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
|
||||
@@ -118,6 +118,7 @@ CONFIG_FEATURE_CPIO_O=y
|
||||
CONFIG_FEATURE_CPIO_P=y
|
||||
CONFIG_DPKG=y
|
||||
CONFIG_DPKG_DEB=y
|
||||
CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY=y
|
||||
CONFIG_GUNZIP=y
|
||||
CONFIG_GZIP=y
|
||||
CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
|
||||
@@ -759,6 +760,7 @@ CONFIG_TFTP_DEBUG=y
|
||||
CONFIG_TRACEROUTE=y
|
||||
CONFIG_TRACEROUTE6=y
|
||||
CONFIG_FEATURE_TRACEROUTE_VERBOSE=y
|
||||
CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE=y
|
||||
CONFIG_FEATURE_TRACEROUTE_USE_ICMP=y
|
||||
CONFIG_UDHCPD=y
|
||||
CONFIG_DHCPRELAY=y
|
||||
|
||||
@@ -130,6 +130,7 @@ CONFIG_FEATURE_SEAMLESS_Z=y
|
||||
# CONFIG_FEATURE_CPIO_P is not set
|
||||
# CONFIG_DPKG is not set
|
||||
# CONFIG_DPKG_DEB is not set
|
||||
# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
|
||||
# CONFIG_GUNZIP is not set
|
||||
# CONFIG_GZIP is not set
|
||||
# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set
|
||||
@@ -761,6 +762,7 @@ CONFIG_IFUPDOWN_IFSTATE_PATH=""
|
||||
# CONFIG_TRACEROUTE is not set
|
||||
# CONFIG_TRACEROUTE6 is not set
|
||||
# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
|
||||
# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set
|
||||
# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
|
||||
# CONFIG_TUNCTL is not set
|
||||
# CONFIG_FEATURE_TUNCTL_UG is not set
|
||||
|
||||
@@ -128,6 +128,7 @@ CONFIG_FEATURE_CPIO_O=y
|
||||
CONFIG_FEATURE_CPIO_P=y
|
||||
# CONFIG_DPKG is not set
|
||||
# CONFIG_DPKG_DEB is not set
|
||||
# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
|
||||
CONFIG_GUNZIP=y
|
||||
CONFIG_GZIP=y
|
||||
CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
|
||||
@@ -777,6 +778,7 @@ CONFIG_FEATURE_TFTP_PROGRESS_BAR=y
|
||||
CONFIG_TRACEROUTE=y
|
||||
CONFIG_TRACEROUTE6=y
|
||||
CONFIG_FEATURE_TRACEROUTE_VERBOSE=y
|
||||
# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set
|
||||
# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
|
||||
CONFIG_TUNCTL=y
|
||||
CONFIG_FEATURE_TUNCTL_UG=y
|
||||
|
||||
@@ -134,6 +134,7 @@ CONFIG_FEATURE_CPIO_O=y
|
||||
CONFIG_FEATURE_CPIO_P=y
|
||||
CONFIG_DPKG=y
|
||||
CONFIG_DPKG_DEB=y
|
||||
# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
|
||||
CONFIG_GUNZIP=y
|
||||
CONFIG_GZIP=y
|
||||
# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set
|
||||
@@ -813,6 +814,7 @@ CONFIG_TCPSVD=y
|
||||
# CONFIG_TRACEROUTE is not set
|
||||
# CONFIG_TRACEROUTE6 is not set
|
||||
# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
|
||||
# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set
|
||||
# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
|
||||
CONFIG_TUNCTL=y
|
||||
CONFIG_FEATURE_TUNCTL_UG=y
|
||||
|
||||
@@ -224,6 +224,7 @@ CONFIG_FEATURE_CPIO_O=y
|
||||
CONFIG_FEATURE_CPIO_P=y
|
||||
# CONFIG_DPKG is not set
|
||||
# CONFIG_DPKG_DEB is not set
|
||||
# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
|
||||
CONFIG_GZIP=y
|
||||
CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
|
||||
CONFIG_GZIP_FAST=0
|
||||
@@ -958,6 +959,7 @@ CONFIG_FEATURE_TFTP_PROGRESS_BAR=y
|
||||
CONFIG_TRACEROUTE=y
|
||||
CONFIG_TRACEROUTE6=y
|
||||
CONFIG_FEATURE_TRACEROUTE_VERBOSE=y
|
||||
# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set
|
||||
# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
|
||||
CONFIG_TUNCTL=y
|
||||
CONFIG_FEATURE_TUNCTL_UG=y
|
||||
|
||||
@@ -154,6 +154,7 @@ CONFIG_FEATURE_CPIO_O=y
|
||||
CONFIG_FEATURE_CPIO_P=y
|
||||
CONFIG_DPKG=y
|
||||
CONFIG_DPKG_DEB=y
|
||||
# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
|
||||
CONFIG_GUNZIP=y
|
||||
CONFIG_GZIP=y
|
||||
# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set
|
||||
@@ -842,6 +843,7 @@ CONFIG_FEATURE_TFTP_PROGRESS_BAR=y
|
||||
CONFIG_TRACEROUTE=y
|
||||
# CONFIG_TRACEROUTE6 is not set
|
||||
CONFIG_FEATURE_TRACEROUTE_VERBOSE=y
|
||||
# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set
|
||||
# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
|
||||
CONFIG_TUNCTL=y
|
||||
CONFIG_FEATURE_TUNCTL_UG=y
|
||||
|
||||
@@ -151,6 +151,7 @@ CONFIG_FEATURE_CPIO_O=y
|
||||
CONFIG_FEATURE_CPIO_P=y
|
||||
CONFIG_DPKG=y
|
||||
CONFIG_DPKG_DEB=y
|
||||
# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
|
||||
CONFIG_GZIP=y
|
||||
# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set
|
||||
CONFIG_GZIP_FAST=0
|
||||
@@ -868,6 +869,7 @@ CONFIG_FEATURE_TFTP_PROGRESS_BAR=y
|
||||
CONFIG_TRACEROUTE=y
|
||||
# CONFIG_TRACEROUTE6 is not set
|
||||
CONFIG_FEATURE_TRACEROUTE_VERBOSE=y
|
||||
# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set
|
||||
# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
|
||||
CONFIG_TUNCTL=y
|
||||
CONFIG_FEATURE_TUNCTL_UG=y
|
||||
|
||||
@@ -134,6 +134,7 @@ CONFIG_FEATURE_CPIO_O=y
|
||||
CONFIG_FEATURE_CPIO_P=y
|
||||
# CONFIG_DPKG is not set
|
||||
# CONFIG_DPKG_DEB is not set
|
||||
# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
|
||||
CONFIG_GUNZIP=y
|
||||
CONFIG_GZIP=y
|
||||
CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
|
||||
@@ -813,6 +814,7 @@ CONFIG_FEATURE_TFTP_PROGRESS_BAR=y
|
||||
# CONFIG_TRACEROUTE is not set
|
||||
# CONFIG_TRACEROUTE6 is not set
|
||||
# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
|
||||
# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set
|
||||
# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
|
||||
# CONFIG_TUNCTL is not set
|
||||
# CONFIG_FEATURE_TUNCTL_UG is not set
|
||||
|
||||
@@ -132,6 +132,7 @@ CONFIG_CPIO=y
|
||||
# CONFIG_FEATURE_CPIO_P is not set
|
||||
# CONFIG_DPKG is not set
|
||||
# CONFIG_DPKG_DEB is not set
|
||||
# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
|
||||
CONFIG_GUNZIP=y
|
||||
CONFIG_GZIP=y
|
||||
CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
|
||||
@@ -794,6 +795,7 @@ CONFIG_FEATURE_TFTP_PROGRESS_BAR=y
|
||||
# CONFIG_TRACEROUTE is not set
|
||||
# CONFIG_TRACEROUTE6 is not set
|
||||
# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
|
||||
# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set
|
||||
# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
|
||||
# CONFIG_TUNCTL is not set
|
||||
# CONFIG_FEATURE_TUNCTL_UG is not set
|
||||
|
||||
@@ -7,4 +7,170 @@ menu "Console Utilities"
|
||||
|
||||
INSERT
|
||||
|
||||
config CHVT
|
||||
bool "chvt"
|
||||
default y
|
||||
select PLATFORM_LINUX
|
||||
help
|
||||
This program is used to change to another terminal.
|
||||
Example: chvt 4 (change to terminal /dev/tty4)
|
||||
|
||||
config FGCONSOLE
|
||||
bool "fgconsole"
|
||||
default y
|
||||
select PLATFORM_LINUX
|
||||
help
|
||||
This program prints active (foreground) console number.
|
||||
|
||||
config CLEAR
|
||||
bool "clear"
|
||||
default y
|
||||
help
|
||||
This program clears the terminal screen.
|
||||
|
||||
config DEALLOCVT
|
||||
bool "deallocvt"
|
||||
default y
|
||||
select PLATFORM_LINUX
|
||||
help
|
||||
This program deallocates unused virtual consoles.
|
||||
|
||||
config DUMPKMAP
|
||||
bool "dumpkmap"
|
||||
default y
|
||||
select PLATFORM_LINUX
|
||||
help
|
||||
This program dumps the kernel's keyboard translation table to
|
||||
stdout, in binary format. You can then use loadkmap to load it.
|
||||
|
||||
config KBD_MODE
|
||||
bool "kbd_mode"
|
||||
default y
|
||||
select PLATFORM_LINUX
|
||||
help
|
||||
This program reports and sets keyboard mode.
|
||||
|
||||
config LOADFONT
|
||||
bool "loadfont"
|
||||
default y
|
||||
select PLATFORM_LINUX
|
||||
help
|
||||
This program loads a console font from standard input.
|
||||
|
||||
config LOADKMAP
|
||||
bool "loadkmap"
|
||||
default y
|
||||
select PLATFORM_LINUX
|
||||
help
|
||||
This program loads a keyboard translation table from
|
||||
standard input.
|
||||
|
||||
config OPENVT
|
||||
bool "openvt"
|
||||
default y
|
||||
select PLATFORM_LINUX
|
||||
help
|
||||
This program is used to start a command on an unused
|
||||
virtual terminal.
|
||||
|
||||
config RESET
|
||||
bool "reset"
|
||||
default y
|
||||
help
|
||||
This program is used to reset the terminal screen, if it
|
||||
gets messed up.
|
||||
|
||||
config RESIZE
|
||||
bool "resize"
|
||||
default y
|
||||
help
|
||||
This program is used to (re)set the width and height of your current
|
||||
terminal.
|
||||
|
||||
config FEATURE_RESIZE_PRINT
|
||||
bool "Print environment variables"
|
||||
default y
|
||||
depends on RESIZE
|
||||
help
|
||||
Prints the newly set size (number of columns and rows) of
|
||||
the terminal.
|
||||
E.g.:
|
||||
COLUMNS=80;LINES=44;export COLUMNS LINES;
|
||||
|
||||
config SETCONSOLE
|
||||
bool "setconsole"
|
||||
default y
|
||||
select PLATFORM_LINUX
|
||||
help
|
||||
This program redirects the system console to another device,
|
||||
like the current tty while logged in via telnet.
|
||||
|
||||
config FEATURE_SETCONSOLE_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default y
|
||||
depends on SETCONSOLE && LONG_OPTS
|
||||
help
|
||||
Support long options for the setconsole applet.
|
||||
|
||||
config SETFONT
|
||||
bool "setfont"
|
||||
default y
|
||||
select PLATFORM_LINUX
|
||||
help
|
||||
Allows to load console screen map. Useful for i18n.
|
||||
|
||||
config FEATURE_SETFONT_TEXTUAL_MAP
|
||||
bool "Support reading textual screen maps"
|
||||
default y
|
||||
depends on SETFONT
|
||||
help
|
||||
Support reading textual screen maps.
|
||||
|
||||
config DEFAULT_SETFONT_DIR
|
||||
string "Default directory for console-tools files"
|
||||
default ""
|
||||
depends on SETFONT
|
||||
help
|
||||
Directory to use if setfont's params are simple filenames
|
||||
(not /path/to/file or ./file). Default is "" (no default directory).
|
||||
|
||||
config SETKEYCODES
|
||||
bool "setkeycodes"
|
||||
default y
|
||||
select PLATFORM_LINUX
|
||||
help
|
||||
This program loads entries into the kernel's scancode-to-keycode
|
||||
map, allowing unusual keyboards to generate usable keycodes.
|
||||
|
||||
config SETLOGCONS
|
||||
bool "setlogcons"
|
||||
default y
|
||||
select PLATFORM_LINUX
|
||||
help
|
||||
This program redirects the output console of kernel messages.
|
||||
|
||||
config SHOWKEY
|
||||
bool "showkey"
|
||||
default y
|
||||
select PLATFORM_LINUX
|
||||
help
|
||||
Shows keys pressed.
|
||||
|
||||
comment "Common options for loadfont and setfont"
|
||||
depends on LOADFONT || SETFONT
|
||||
|
||||
config FEATURE_LOADFONT_PSF2
|
||||
bool "Support for PSF2 console fonts"
|
||||
default y
|
||||
depends on LOADFONT || SETFONT
|
||||
help
|
||||
Support PSF2 console fonts.
|
||||
|
||||
config FEATURE_LOADFONT_RAW
|
||||
bool "Support for old (raw) console fonts"
|
||||
default y
|
||||
depends on LOADFONT || SETFONT
|
||||
help
|
||||
Support old (raw) console fonts.
|
||||
|
||||
endmenu
|
||||
@@ -7,3 +7,19 @@
|
||||
lib-y:=
|
||||
|
||||
INSERT
|
||||
lib-$(CONFIG_CHVT) += chvt.o
|
||||
lib-$(CONFIG_FGCONSOLE) += fgconsole.o
|
||||
lib-$(CONFIG_CLEAR) += clear.o
|
||||
lib-$(CONFIG_DEALLOCVT) += deallocvt.o
|
||||
lib-$(CONFIG_DUMPKMAP) += dumpkmap.o
|
||||
lib-$(CONFIG_SETCONSOLE) += setconsole.o
|
||||
lib-$(CONFIG_KBD_MODE) += kbd_mode.o
|
||||
lib-$(CONFIG_LOADFONT) += loadfont.o
|
||||
lib-$(CONFIG_LOADKMAP) += loadkmap.o
|
||||
lib-$(CONFIG_OPENVT) += openvt.o
|
||||
lib-$(CONFIG_RESET) += reset.o
|
||||
lib-$(CONFIG_RESIZE) += resize.o
|
||||
lib-$(CONFIG_SETFONT) += loadfont.o
|
||||
lib-$(CONFIG_SETKEYCODES) += setkeycodes.o
|
||||
lib-$(CONFIG_SETLOGCONS) += setlogcons.o
|
||||
lib-$(CONFIG_SHOWKEY) += showkey.o
|
||||
@@ -6,17 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config CHVT
|
||||
//config: bool "chvt"
|
||||
//config: default y
|
||||
//config: select PLATFORM_LINUX
|
||||
//config: help
|
||||
//config: This program is used to change to another terminal.
|
||||
//config: Example: chvt 4 (change to terminal /dev/tty4)
|
||||
|
||||
//applet:IF_CHVT(APPLET(chvt, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_CHVT) += chvt.o
|
||||
|
||||
//usage:#define chvt_trivial_usage
|
||||
//usage: "N"
|
||||
|
||||
@@ -6,15 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config CLEAR
|
||||
//config: bool "clear"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: This program clears the terminal screen.
|
||||
|
||||
//applet:IF_CLEAR(APPLET(clear, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_CLEAR) += clear.o
|
||||
|
||||
//usage:#define clear_trivial_usage
|
||||
//usage: ""
|
||||
|
||||
@@ -7,16 +7,8 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config DEALLOCVT
|
||||
//config: bool "deallocvt"
|
||||
//config: default y
|
||||
//config: select PLATFORM_LINUX
|
||||
//config: help
|
||||
//config: This program deallocates unused virtual consoles.
|
||||
|
||||
//applet:IF_DEALLOCVT(APPLET(deallocvt, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_DEALLOCVT) += deallocvt.o
|
||||
/* no options, no getopt */
|
||||
|
||||
//usage:#define deallocvt_trivial_usage
|
||||
//usage: "[N]"
|
||||
|
||||
@@ -7,17 +7,7 @@
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*
|
||||
*/
|
||||
//config:config DUMPKMAP
|
||||
//config: bool "dumpkmap"
|
||||
//config: default y
|
||||
//config: select PLATFORM_LINUX
|
||||
//config: help
|
||||
//config: This program dumps the kernel's keyboard translation table to
|
||||
//config: stdout, in binary format. You can then use loadkmap to load it.
|
||||
|
||||
//applet:IF_DUMPKMAP(APPLET(dumpkmap, BB_DIR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_DUMPKMAP) += dumpkmap.o
|
||||
/* no options, no getopt */
|
||||
|
||||
//usage:#define dumpkmap_trivial_usage
|
||||
//usage: "> keymap"
|
||||
|
||||
@@ -6,16 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config FGCONSOLE
|
||||
//config: bool "fgconsole"
|
||||
//config: default y
|
||||
//config: select PLATFORM_LINUX
|
||||
//config: help
|
||||
//config: This program prints active (foreground) console number.
|
||||
|
||||
//applet:IF_FGCONSOLE(APPLET(fgconsole, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_FGCONSOLE) += fgconsole.o
|
||||
|
||||
//usage:#define fgconsole_trivial_usage
|
||||
//usage: ""
|
||||
|
||||
@@ -8,16 +8,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config KBD_MODE
|
||||
//config: bool "kbd_mode"
|
||||
//config: default y
|
||||
//config: select PLATFORM_LINUX
|
||||
//config: help
|
||||
//config: This program reports and sets keyboard mode.
|
||||
|
||||
//applet:IF_KBD_MODE(APPLET(kbd_mode, BB_DIR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_KBD_MODE) += kbd_mode.o
|
||||
|
||||
//usage:#define kbd_mode_trivial_usage
|
||||
//usage: "[-a|k|s|u] [-C TTY]"
|
||||
|
||||
@@ -9,57 +9,6 @@
|
||||
*
|
||||
* Licensed under GPLv2, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config LOADFONT
|
||||
//config: bool "loadfont"
|
||||
//config: default y
|
||||
//config: select PLATFORM_LINUX
|
||||
//config: help
|
||||
//config: This program loads a console font from standard input.
|
||||
//config:
|
||||
//config:config SETFONT
|
||||
//config: bool "setfont"
|
||||
//config: default y
|
||||
//config: select PLATFORM_LINUX
|
||||
//config: help
|
||||
//config: Allows to load console screen map. Useful for i18n.
|
||||
//config:
|
||||
//config:config FEATURE_SETFONT_TEXTUAL_MAP
|
||||
//config: bool "Support reading textual screen maps"
|
||||
//config: default y
|
||||
//config: depends on SETFONT
|
||||
//config: help
|
||||
//config: Support reading textual screen maps.
|
||||
//config:
|
||||
//config:config DEFAULT_SETFONT_DIR
|
||||
//config: string "Default directory for console-tools files"
|
||||
//config: default ""
|
||||
//config: depends on SETFONT
|
||||
//config: help
|
||||
//config: Directory to use if setfont's params are simple filenames
|
||||
//config: (not /path/to/file or ./file). Default is "" (no default directory).
|
||||
//config:
|
||||
//config:comment "Common options for loadfont and setfont"
|
||||
//config: depends on LOADFONT || SETFONT
|
||||
//config:
|
||||
//config:config FEATURE_LOADFONT_PSF2
|
||||
//config: bool "Support for PSF2 console fonts"
|
||||
//config: default y
|
||||
//config: depends on LOADFONT || SETFONT
|
||||
//config: help
|
||||
//config: Support PSF2 console fonts.
|
||||
//config:
|
||||
//config:config FEATURE_LOADFONT_RAW
|
||||
//config: bool "Support for old (raw) console fonts"
|
||||
//config: default y
|
||||
//config: depends on LOADFONT || SETFONT
|
||||
//config: help
|
||||
//config: Support old (raw) console fonts.
|
||||
|
||||
//applet:IF_LOADFONT(APPLET(loadfont, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
//applet:IF_SETFONT(APPLET(setfont, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_LOADFONT) += loadfont.o
|
||||
//kbuild:lib-$(CONFIG_SETFONT) += loadfont.o
|
||||
|
||||
//usage:#define loadfont_trivial_usage
|
||||
//usage: "< font"
|
||||
@@ -370,10 +319,8 @@ int loadfont_main(int argc UNUSED_PARAM, char **argv)
|
||||
* We used to look at the length of the input file
|
||||
* with stat(); now that we accept compressed files,
|
||||
* just read the entire file.
|
||||
* Len was 32k, but latarcyrheb-sun32.psfu is 34377 bytes
|
||||
* (it has largish Unicode map).
|
||||
*/
|
||||
len = 128*1024;
|
||||
len = 32*1024; // can't be larger
|
||||
buffer = xmalloc_read(STDIN_FILENO, &len);
|
||||
// xmalloc_open_zipped_read_close(filename, &len);
|
||||
if (!buffer)
|
||||
@@ -458,7 +405,7 @@ int setfont_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
}
|
||||
// load font
|
||||
len = 128*1024;
|
||||
len = 32*1024; // can't be larger
|
||||
buffer = xmalloc_open_zipped_read_close(*argv, &len);
|
||||
if (!buffer)
|
||||
bb_simple_perror_msg_and_die(*argv);
|
||||
|
||||
@@ -6,17 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config LOADKMAP
|
||||
//config: bool "loadkmap"
|
||||
//config: default y
|
||||
//config: select PLATFORM_LINUX
|
||||
//config: help
|
||||
//config: This program loads a keyboard translation table from
|
||||
//config: standard input.
|
||||
|
||||
//applet:IF_LOADKMAP(APPLET(loadkmap, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_LOADKMAP) += loadkmap.o
|
||||
|
||||
//usage:#define loadkmap_trivial_usage
|
||||
//usage: "< keymap"
|
||||
|
||||
@@ -7,17 +7,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config OPENVT
|
||||
//config: bool "openvt"
|
||||
//config: default y
|
||||
//config: select PLATFORM_LINUX
|
||||
//config: help
|
||||
//config: This program is used to start a command on an unused
|
||||
//config: virtual terminal.
|
||||
|
||||
//applet:IF_OPENVT(APPLET(openvt, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_OPENVT) += openvt.o
|
||||
|
||||
//usage:#define openvt_trivial_usage
|
||||
//usage: "[-c N] [-sw] [PROG ARGS]"
|
||||
|
||||
+2
-11
@@ -7,18 +7,9 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
/* "Standard" version of this tool is in ncurses package */
|
||||
|
||||
//config:config RESET
|
||||
//config: bool "reset"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: This program is used to reset the terminal screen, if it
|
||||
//config: gets messed up.
|
||||
|
||||
//applet:IF_RESET(APPLET(reset, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_RESET) += reset.o
|
||||
/* BTW, which "standard" package has this utility? It doesn't seem
|
||||
* to be ncurses, coreutils, console-tools... then what? */
|
||||
|
||||
//usage:#define reset_trivial_usage
|
||||
//usage: ""
|
||||
|
||||
+1
-20
@@ -6,26 +6,7 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config RESIZE
|
||||
//config: bool "resize"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: This program is used to (re)set the width and height of your current
|
||||
//config: terminal.
|
||||
//config:
|
||||
//config:config FEATURE_RESIZE_PRINT
|
||||
//config: bool "Print environment variables"
|
||||
//config: default y
|
||||
//config: depends on RESIZE
|
||||
//config: help
|
||||
//config: Prints the newly set size (number of columns and rows) of
|
||||
//config: the terminal.
|
||||
//config: E.g.:
|
||||
//config: COLUMNS=80;LINES=44;export COLUMNS LINES;
|
||||
|
||||
//applet:IF_RESIZE(APPLET(resize, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_RESIZE) += resize.o
|
||||
/* no options, no getopt */
|
||||
|
||||
//usage:#define resize_trivial_usage
|
||||
//usage: ""
|
||||
|
||||
@@ -7,24 +7,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config SETCONSOLE
|
||||
//config: bool "setconsole"
|
||||
//config: default y
|
||||
//config: select PLATFORM_LINUX
|
||||
//config: help
|
||||
//config: This program redirects the system console to another device,
|
||||
//config: like the current tty while logged in via telnet.
|
||||
//config:
|
||||
//config:config FEATURE_SETCONSOLE_LONG_OPTIONS
|
||||
//config: bool "Enable long options"
|
||||
//config: default y
|
||||
//config: depends on SETCONSOLE && LONG_OPTS
|
||||
//config: help
|
||||
//config: Support long options for the setconsole applet.
|
||||
|
||||
//applet:IF_SETCONSOLE(APPLET(setconsole, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_SETCONSOLE) += setconsole.o
|
||||
|
||||
//usage:#define setconsole_trivial_usage
|
||||
//usage: "[-r" IF_FEATURE_SETCONSOLE_LONG_OPTIONS("|--reset") "] [DEVICE]"
|
||||
|
||||
@@ -8,17 +8,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config SETKEYCODES
|
||||
//config: bool "setkeycodes"
|
||||
//config: default y
|
||||
//config: select PLATFORM_LINUX
|
||||
//config: help
|
||||
//config: This program loads entries into the kernel's scancode-to-keycode
|
||||
//config: map, allowing unusual keyboards to generate usable keycodes.
|
||||
|
||||
//applet:IF_SETKEYCODES(APPLET(setkeycodes, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_SETKEYCODES) += setkeycodes.o
|
||||
|
||||
//usage:#define setkeycodes_trivial_usage
|
||||
//usage: "SCANCODE KEYCODE..."
|
||||
|
||||
@@ -8,16 +8,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config SETLOGCONS
|
||||
//config: bool "setlogcons"
|
||||
//config: default y
|
||||
//config: select PLATFORM_LINUX
|
||||
//config: help
|
||||
//config: This program redirects the output console of kernel messages.
|
||||
|
||||
//applet:IF_SETLOGCONS(APPLET(setlogcons, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_SETLOGCONS) += setlogcons.o
|
||||
|
||||
//usage:#define setlogcons_trivial_usage
|
||||
//usage: "[N]"
|
||||
|
||||
@@ -6,16 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config SHOWKEY
|
||||
//config: bool "showkey"
|
||||
//config: default y
|
||||
//config: select PLATFORM_LINUX
|
||||
//config: help
|
||||
//config: Shows keys pressed.
|
||||
|
||||
//applet:IF_SHOWKEY(APPLET(showkey, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_SHOWKEY) += showkey.o
|
||||
|
||||
//usage:#define showkey_trivial_usage
|
||||
//usage: "[-a | -k | -s]"
|
||||
|
||||
@@ -7,6 +7,686 @@ menu "Coreutils"
|
||||
|
||||
INSERT
|
||||
|
||||
config CAL
|
||||
bool "cal"
|
||||
default y
|
||||
help
|
||||
cal is used to display a monthly calendar.
|
||||
|
||||
config CATV
|
||||
bool "catv"
|
||||
default y
|
||||
help
|
||||
Display nonprinting characters as escape sequences (like some
|
||||
implementations' cat -v option).
|
||||
|
||||
config CHGRP
|
||||
bool "chgrp"
|
||||
default y
|
||||
help
|
||||
chgrp is used to change the group ownership of files.
|
||||
|
||||
config CHMOD
|
||||
bool "chmod"
|
||||
default y
|
||||
help
|
||||
chmod is used to change the access permission of files.
|
||||
|
||||
config CHOWN
|
||||
bool "chown"
|
||||
default y
|
||||
help
|
||||
chown is used to change the user and/or group ownership
|
||||
of files.
|
||||
|
||||
config FEATURE_CHOWN_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default y
|
||||
depends on CHOWN && LONG_OPTS
|
||||
help
|
||||
Enable use of long options
|
||||
|
||||
config CHROOT
|
||||
bool "chroot"
|
||||
default y
|
||||
help
|
||||
chroot is used to change the root directory and run a command.
|
||||
The default command is `/bin/sh'.
|
||||
|
||||
config CKSUM
|
||||
bool "cksum"
|
||||
default y
|
||||
help
|
||||
cksum is used to calculate the CRC32 checksum of a file.
|
||||
|
||||
config COMM
|
||||
bool "comm"
|
||||
default y
|
||||
help
|
||||
comm is used to compare two files line by line and return
|
||||
a three-column output.
|
||||
|
||||
config CP
|
||||
bool "cp"
|
||||
default y
|
||||
help
|
||||
cp is used to copy files and directories.
|
||||
|
||||
config FEATURE_CP_LONG_OPTIONS
|
||||
bool "Enable long options for cp"
|
||||
default y
|
||||
depends on CP && LONG_OPTS
|
||||
help
|
||||
Enable long options for cp.
|
||||
Also add support for --parents option.
|
||||
|
||||
config CUT
|
||||
bool "cut"
|
||||
default y
|
||||
help
|
||||
cut is used to print selected parts of lines from
|
||||
each file to stdout.
|
||||
|
||||
config DF
|
||||
bool "df"
|
||||
default y
|
||||
help
|
||||
df reports the amount of disk space used and available
|
||||
on filesystems.
|
||||
|
||||
config FEATURE_DF_FANCY
|
||||
bool "Enable -a, -i, -B"
|
||||
default y
|
||||
depends on DF
|
||||
help
|
||||
This option enables -a, -i and -B.
|
||||
|
||||
-a Show all filesystems
|
||||
-i Inodes
|
||||
-B <SIZE> Blocksize
|
||||
|
||||
config DIRNAME
|
||||
bool "dirname"
|
||||
default y
|
||||
help
|
||||
dirname is used to strip a non-directory suffix from
|
||||
a file name.
|
||||
|
||||
config DOS2UNIX
|
||||
bool "dos2unix/unix2dos"
|
||||
default y
|
||||
help
|
||||
dos2unix is used to convert a text file from DOS format to
|
||||
UNIX format, and vice versa.
|
||||
|
||||
config UNIX2DOS
|
||||
bool
|
||||
default y
|
||||
depends on DOS2UNIX
|
||||
help
|
||||
unix2dos is used to convert a text file from UNIX format to
|
||||
DOS format, and vice versa.
|
||||
|
||||
config DU
|
||||
bool "du (default blocksize of 512 bytes)"
|
||||
default y
|
||||
help
|
||||
du is used to report the amount of disk space used
|
||||
for specified files.
|
||||
|
||||
config FEATURE_DU_DEFAULT_BLOCKSIZE_1K
|
||||
bool "Use a default blocksize of 1024 bytes (1K)"
|
||||
default y
|
||||
depends on DU
|
||||
help
|
||||
Use a blocksize of (1K) instead of the default 512b.
|
||||
|
||||
config ECHO
|
||||
bool "echo (basic SuSv3 version taking no options)"
|
||||
default y
|
||||
help
|
||||
echo is used to print a specified string to stdout.
|
||||
|
||||
# this entry also appears in shell/Config.in, next to the echo builtin
|
||||
config FEATURE_FANCY_ECHO
|
||||
bool "Enable echo options (-n and -e)"
|
||||
default y
|
||||
depends on ECHO || ASH_BUILTIN_ECHO || HUSH
|
||||
help
|
||||
This adds options (-n and -e) to echo.
|
||||
|
||||
config ENV
|
||||
bool "env"
|
||||
default y
|
||||
help
|
||||
env is used to set an environment variable and run
|
||||
a command; without options it displays the current
|
||||
environment.
|
||||
|
||||
config FEATURE_ENV_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default y
|
||||
depends on ENV && LONG_OPTS
|
||||
help
|
||||
Support long options for the env applet.
|
||||
|
||||
config EXPAND
|
||||
bool "expand"
|
||||
default y
|
||||
help
|
||||
By default, convert all tabs to spaces.
|
||||
|
||||
config FEATURE_EXPAND_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default y
|
||||
depends on EXPAND && LONG_OPTS
|
||||
help
|
||||
Support long options for the expand applet.
|
||||
|
||||
config EXPR
|
||||
bool "expr"
|
||||
default y
|
||||
help
|
||||
expr is used to calculate numbers and print the result
|
||||
to standard output.
|
||||
|
||||
config EXPR_MATH_SUPPORT_64
|
||||
bool "Extend Posix numbers support to 64 bit"
|
||||
default y
|
||||
depends on EXPR
|
||||
help
|
||||
Enable 64-bit math support in the expr applet. This will make
|
||||
the applet slightly larger, but will allow computation with very
|
||||
large numbers.
|
||||
|
||||
config FALSE
|
||||
bool "false"
|
||||
default y
|
||||
help
|
||||
false returns an exit code of FALSE (1).
|
||||
|
||||
config FOLD
|
||||
bool "fold"
|
||||
default y
|
||||
help
|
||||
Wrap text to fit a specific width.
|
||||
|
||||
config FSYNC
|
||||
bool "fsync"
|
||||
default y
|
||||
help
|
||||
fsync is used to flush file-related cached blocks to disk.
|
||||
|
||||
config HEAD
|
||||
bool "head"
|
||||
default y
|
||||
help
|
||||
head is used to print the first specified number of lines
|
||||
from files.
|
||||
|
||||
config FEATURE_FANCY_HEAD
|
||||
bool "Enable head options (-c, -q, and -v)"
|
||||
default y
|
||||
depends on HEAD
|
||||
help
|
||||
This enables the head options (-c, -q, and -v).
|
||||
|
||||
config INSTALL
|
||||
bool "install"
|
||||
default y
|
||||
help
|
||||
Copy files and set attributes.
|
||||
|
||||
config FEATURE_INSTALL_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default y
|
||||
depends on INSTALL && LONG_OPTS
|
||||
help
|
||||
Support long options for the install applet.
|
||||
|
||||
####config LENGTH
|
||||
#### bool "length"
|
||||
#### default y
|
||||
#### help
|
||||
#### length is used to print out the length of a specified string.
|
||||
|
||||
config LN
|
||||
bool "ln"
|
||||
default y
|
||||
help
|
||||
ln is used to create hard or soft links between files.
|
||||
|
||||
config LOGNAME
|
||||
bool "logname"
|
||||
default y
|
||||
help
|
||||
logname is used to print the current user's login name.
|
||||
|
||||
config LS
|
||||
bool "ls"
|
||||
default y
|
||||
help
|
||||
ls is used to list the contents of directories.
|
||||
|
||||
config FEATURE_LS_FILETYPES
|
||||
bool "Enable filetyping options (-p and -F)"
|
||||
default y
|
||||
depends on LS
|
||||
help
|
||||
Enable the ls options (-p and -F).
|
||||
|
||||
config FEATURE_LS_FOLLOWLINKS
|
||||
bool "Enable symlinks dereferencing (-L)"
|
||||
default y
|
||||
depends on LS
|
||||
help
|
||||
Enable the ls option (-L).
|
||||
|
||||
config FEATURE_LS_RECURSIVE
|
||||
bool "Enable recursion (-R)"
|
||||
default y
|
||||
depends on LS
|
||||
help
|
||||
Enable the ls option (-R).
|
||||
|
||||
config FEATURE_LS_SORTFILES
|
||||
bool "Sort the file names"
|
||||
default y
|
||||
depends on LS
|
||||
help
|
||||
Allow ls to sort file names alphabetically.
|
||||
|
||||
config FEATURE_LS_TIMESTAMPS
|
||||
bool "Show file timestamps"
|
||||
default y
|
||||
depends on LS
|
||||
help
|
||||
Allow ls to display timestamps for files.
|
||||
|
||||
config FEATURE_LS_USERNAME
|
||||
bool "Show username/groupnames"
|
||||
default y
|
||||
depends on LS
|
||||
help
|
||||
Allow ls to display username/groupname for files.
|
||||
|
||||
config FEATURE_LS_COLOR
|
||||
bool "Allow use of color to identify file types"
|
||||
default y
|
||||
depends on LS && LONG_OPTS
|
||||
help
|
||||
This enables the --color option to ls.
|
||||
|
||||
config FEATURE_LS_COLOR_IS_DEFAULT
|
||||
bool "Produce colored ls output by default"
|
||||
default y
|
||||
depends on FEATURE_LS_COLOR
|
||||
help
|
||||
Saying yes here will turn coloring on by default,
|
||||
even if no "--color" option is given to the ls command.
|
||||
This is not recommended, since the colors are not
|
||||
configurable, and the output may not be legible on
|
||||
many output screens.
|
||||
|
||||
config MD5SUM
|
||||
bool "md5sum"
|
||||
default y
|
||||
help
|
||||
md5sum is used to print or check MD5 checksums.
|
||||
|
||||
config MKDIR
|
||||
bool "mkdir"
|
||||
default y
|
||||
help
|
||||
mkdir is used to create directories with the specified names.
|
||||
|
||||
config FEATURE_MKDIR_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default y
|
||||
depends on MKDIR && LONG_OPTS
|
||||
help
|
||||
Support long options for the mkdir applet.
|
||||
|
||||
config MKFIFO
|
||||
bool "mkfifo"
|
||||
default y
|
||||
help
|
||||
mkfifo is used to create FIFOs (named pipes).
|
||||
The `mknod' program can also create FIFOs.
|
||||
|
||||
config MKNOD
|
||||
bool "mknod"
|
||||
default y
|
||||
help
|
||||
mknod is used to create FIFOs or block/character special
|
||||
files with the specified names.
|
||||
|
||||
config MV
|
||||
bool "mv"
|
||||
default y
|
||||
help
|
||||
mv is used to move or rename files or directories.
|
||||
|
||||
config FEATURE_MV_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default y
|
||||
depends on MV && LONG_OPTS
|
||||
help
|
||||
Support long options for the mv applet.
|
||||
|
||||
config NICE
|
||||
bool "nice"
|
||||
default y
|
||||
help
|
||||
nice runs a program with modified scheduling priority.
|
||||
|
||||
config NOHUP
|
||||
bool "nohup"
|
||||
default y
|
||||
help
|
||||
run a command immune to hangups, with output to a non-tty.
|
||||
|
||||
config OD
|
||||
bool "od"
|
||||
default y
|
||||
help
|
||||
od is used to dump binary files in octal and other formats.
|
||||
|
||||
config PRINTENV
|
||||
bool "printenv"
|
||||
default y
|
||||
help
|
||||
printenv is used to print all or part of environment.
|
||||
|
||||
config PRINTF
|
||||
bool "printf"
|
||||
default y
|
||||
help
|
||||
printf is used to format and print specified strings.
|
||||
It's similar to `echo' except it has more options.
|
||||
|
||||
config PWD
|
||||
bool "pwd"
|
||||
default y
|
||||
help
|
||||
pwd is used to print the current directory.
|
||||
|
||||
config READLINK
|
||||
bool "readlink"
|
||||
default y
|
||||
help
|
||||
This program reads a symbolic link and returns the name
|
||||
of the file it points to
|
||||
|
||||
config FEATURE_READLINK_FOLLOW
|
||||
bool "Enable canonicalization by following all symlinks (-f)"
|
||||
default y
|
||||
depends on READLINK
|
||||
help
|
||||
Enable the readlink option (-f).
|
||||
|
||||
config REALPATH
|
||||
bool "realpath"
|
||||
default y
|
||||
help
|
||||
Return the canonicalized absolute pathname.
|
||||
This isn't provided by GNU shellutils, but where else does it belong.
|
||||
|
||||
config RM
|
||||
bool "rm"
|
||||
default y
|
||||
help
|
||||
rm is used to remove files or directories.
|
||||
|
||||
config RMDIR
|
||||
bool "rmdir"
|
||||
default y
|
||||
help
|
||||
rmdir is used to remove empty directories.
|
||||
|
||||
config FEATURE_RMDIR_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default y
|
||||
depends on RMDIR && LONG_OPTS
|
||||
help
|
||||
Support long options for the rmdir applet, including
|
||||
--ignore-fail-on-non-empty for compatibility with GNU rmdir.
|
||||
|
||||
config SEQ
|
||||
bool "seq"
|
||||
default y
|
||||
help
|
||||
print a sequence of numbers
|
||||
|
||||
config SHA1SUM
|
||||
bool "sha1sum"
|
||||
default y
|
||||
help
|
||||
Compute and check SHA1 message digest
|
||||
|
||||
config SHA256SUM
|
||||
bool "sha256sum"
|
||||
default y
|
||||
help
|
||||
Compute and check SHA256 message digest
|
||||
|
||||
config SHA512SUM
|
||||
bool "sha512sum"
|
||||
default y
|
||||
help
|
||||
Compute and check SHA512 message digest
|
||||
|
||||
config SHA3SUM
|
||||
bool "sha3sum"
|
||||
default y
|
||||
help
|
||||
Compute and check SHA3 (512-bit) message digest
|
||||
|
||||
config SLEEP
|
||||
bool "sleep"
|
||||
default y
|
||||
help
|
||||
sleep is used to pause for a specified number of seconds.
|
||||
It comes in 3 versions:
|
||||
- small: takes one integer parameter
|
||||
- fancy: takes multiple integer arguments with suffixes:
|
||||
sleep 1d 2h 3m 15s
|
||||
- fancy with fractional numbers:
|
||||
sleep 2.3s 4.5h sleeps for 16202.3 seconds
|
||||
Last one is "the most compatible" with coreutils sleep,
|
||||
but it adds around 1k of code.
|
||||
|
||||
config FEATURE_FANCY_SLEEP
|
||||
bool "Enable multiple arguments and s/m/h/d suffixes"
|
||||
default y
|
||||
depends on SLEEP
|
||||
help
|
||||
Allow sleep to pause for specified minutes, hours, and days.
|
||||
|
||||
config FEATURE_FLOAT_SLEEP
|
||||
bool "Enable fractional arguments"
|
||||
default y
|
||||
depends on FEATURE_FANCY_SLEEP
|
||||
help
|
||||
Allow for fractional numeric parameters.
|
||||
|
||||
config SORT
|
||||
bool "sort"
|
||||
default y
|
||||
help
|
||||
sort is used to sort lines of text in specified files.
|
||||
|
||||
config FEATURE_SORT_BIG
|
||||
bool "Full SuSv3 compliant sort (support -ktcsbdfiozgM)"
|
||||
default y
|
||||
depends on SORT
|
||||
help
|
||||
Without this, sort only supports -r, -u, and an integer version
|
||||
of -n. Selecting this adds sort keys, floating point support, and
|
||||
more. This adds a little over 3k to a nonstatic build on x86.
|
||||
|
||||
The SuSv3 sort standard is available at:
|
||||
http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html
|
||||
|
||||
config SPLIT
|
||||
bool "split"
|
||||
default y
|
||||
help
|
||||
split a file into pieces.
|
||||
|
||||
config FEATURE_SPLIT_FANCY
|
||||
bool "Fancy extensions"
|
||||
default y
|
||||
depends on SPLIT
|
||||
help
|
||||
Add support for features not required by SUSv3.
|
||||
Supports additional suffixes 'b' for 512 bytes,
|
||||
'g' for 1GiB for the -b option.
|
||||
|
||||
config STTY
|
||||
bool "stty"
|
||||
default y
|
||||
help
|
||||
stty is used to change and print terminal line settings.
|
||||
|
||||
config SUM
|
||||
bool "sum"
|
||||
default y
|
||||
help
|
||||
checksum and count the blocks in a file
|
||||
|
||||
config TAC
|
||||
bool "tac"
|
||||
default y
|
||||
help
|
||||
tac is used to concatenate and print files in reverse.
|
||||
|
||||
config TAIL
|
||||
bool "tail"
|
||||
default y
|
||||
help
|
||||
tail is used to print the last specified number of lines
|
||||
from files.
|
||||
|
||||
config FEATURE_FANCY_TAIL
|
||||
bool "Enable extra tail options (-q, -s, -v, and -F)"
|
||||
default y
|
||||
depends on TAIL
|
||||
help
|
||||
The options (-q, -s, -v and -F) are provided by GNU tail, but
|
||||
are not specific in the SUSv3 standard.
|
||||
|
||||
-q Never output headers giving file names
|
||||
-s SEC Wait SEC seconds between reads with -f
|
||||
-v Always output headers giving file names
|
||||
-F Same as -f, but keep retrying
|
||||
|
||||
config TEE
|
||||
bool "tee"
|
||||
default y
|
||||
help
|
||||
tee is used to read from standard input and write
|
||||
to standard output and files.
|
||||
|
||||
config FEATURE_TEE_USE_BLOCK_IO
|
||||
bool "Enable block I/O (larger/faster) instead of byte I/O"
|
||||
default y
|
||||
depends on TEE
|
||||
help
|
||||
Enable this option for a faster tee, at expense of size.
|
||||
|
||||
config TRUE
|
||||
bool "true"
|
||||
default y
|
||||
help
|
||||
true returns an exit code of TRUE (0).
|
||||
|
||||
config TTY
|
||||
bool "tty"
|
||||
default y
|
||||
help
|
||||
tty is used to print the name of the current terminal to
|
||||
standard output.
|
||||
|
||||
config UNAME
|
||||
bool "uname"
|
||||
default y
|
||||
help
|
||||
uname is used to print system information.
|
||||
|
||||
config UNAME_OSNAME
|
||||
string "Operating system name"
|
||||
default "GNU/Linux"
|
||||
depends on UNAME
|
||||
help
|
||||
Sets the operating system name reported by uname -o. The
|
||||
default is "GNU/Linux".
|
||||
|
||||
config UNEXPAND
|
||||
bool "unexpand"
|
||||
default y
|
||||
help
|
||||
By default, convert only leading sequences of blanks to tabs.
|
||||
|
||||
config FEATURE_UNEXPAND_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default y
|
||||
depends on UNEXPAND && LONG_OPTS
|
||||
help
|
||||
Support long options for the unexpand applet.
|
||||
|
||||
config UNIQ
|
||||
bool "uniq"
|
||||
default y
|
||||
help
|
||||
uniq is used to remove duplicate lines from a sorted file.
|
||||
|
||||
config USLEEP
|
||||
bool "usleep"
|
||||
default y
|
||||
help
|
||||
usleep is used to pause for a specified number of microseconds.
|
||||
|
||||
config UUDECODE
|
||||
bool "uudecode"
|
||||
default y
|
||||
help
|
||||
uudecode is used to decode a uuencoded file.
|
||||
|
||||
config UUENCODE
|
||||
bool "uuencode"
|
||||
default y
|
||||
help
|
||||
uuencode is used to uuencode a file.
|
||||
|
||||
config WC
|
||||
bool "wc"
|
||||
default y
|
||||
help
|
||||
wc is used to print the number of bytes, words, and lines,
|
||||
in specified files.
|
||||
|
||||
config FEATURE_WC_LARGE
|
||||
bool "Support very large files in wc"
|
||||
default y
|
||||
depends on WC
|
||||
help
|
||||
Use "unsigned long long" in wc for counter variables.
|
||||
|
||||
config WHOAMI
|
||||
bool "whoami"
|
||||
default y
|
||||
help
|
||||
whoami is used to print the username of the current
|
||||
user id (same as id -un).
|
||||
|
||||
config YES
|
||||
bool "yes"
|
||||
default y
|
||||
help
|
||||
yes is used to repeatedly output a specific string, or
|
||||
the default string `y'.
|
||||
|
||||
comment "Common options"
|
||||
|
||||
config FEATURE_VERBOSE
|
||||
@@ -51,4 +731,17 @@ config FEATURE_HUMAN_READABLE
|
||||
help
|
||||
Allow df, du, and ls to have human readable output.
|
||||
|
||||
comment "Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum"
|
||||
depends on MD5SUM || SHA1SUM || SHA256SUM || SHA512SUM || SHA3SUM
|
||||
|
||||
config FEATURE_MD5_SHA1_SUM_CHECK
|
||||
bool "Enable -c, -s and -w options"
|
||||
default y
|
||||
depends on MD5SUM || SHA1SUM || SHA256SUM || SHA512SUM || SHA3SUM
|
||||
help
|
||||
Enabling the -c options allows files to be checked
|
||||
against pre-calculated hash values.
|
||||
|
||||
-s and -w are useful options when verifying checksums.
|
||||
|
||||
endmenu
|
||||
+71
-13
@@ -9,17 +9,75 @@ libs-y += libcoreutils/
|
||||
lib-y:=
|
||||
|
||||
INSERT
|
||||
|
||||
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_ADDUSER) += chown.o # used by adduser
|
||||
lib-$(CONFIG_ADDGROUP) += chown.o # used by adduser
|
||||
lib-$(CONFIG_ASH) += echo.o # used by ash
|
||||
lib-$(CONFIG_SH_IS_ASH) += echo.o # used by ash
|
||||
lib-$(CONFIG_BASH_IS_ASH) += echo.o # used by ash
|
||||
lib-$(CONFIG_HUSH) += echo.o # used by hush
|
||||
lib-$(CONFIG_SH_IS_HUSH) += echo.o # used by hush
|
||||
lib-$(CONFIG_BASH_IS_HUSH) += echo.o # used by hush
|
||||
lib-$(CONFIG_FTPD) += ls.o # used by ftpd
|
||||
lib-$(CONFIG_CAL) += cal.o
|
||||
lib-$(CONFIG_CATV) += catv.o
|
||||
lib-$(CONFIG_CHGRP) += chgrp.o chown.o
|
||||
lib-$(CONFIG_CHMOD) += chmod.o
|
||||
lib-$(CONFIG_CHOWN) += chown.o
|
||||
lib-$(CONFIG_ADDUSER) += chown.o # used by adduser
|
||||
lib-$(CONFIG_ADDGROUP) += chown.o # used by adduser
|
||||
lib-$(CONFIG_CHROOT) += chroot.o
|
||||
lib-$(CONFIG_CKSUM) += cksum.o
|
||||
lib-$(CONFIG_COMM) += comm.o
|
||||
lib-$(CONFIG_CP) += cp.o
|
||||
lib-$(CONFIG_CUT) += cut.o
|
||||
lib-$(CONFIG_DD) += dd.o
|
||||
lib-$(CONFIG_DF) += df.o
|
||||
lib-$(CONFIG_DIRNAME) += dirname.o
|
||||
lib-$(CONFIG_DOS2UNIX) += dos2unix.o
|
||||
lib-$(CONFIG_DU) += du.o
|
||||
lib-$(CONFIG_ECHO) += echo.o
|
||||
lib-$(CONFIG_ASH) += echo.o # used by ash
|
||||
lib-$(CONFIG_HUSH) += echo.o # used by hush
|
||||
lib-$(CONFIG_ENV) += env.o
|
||||
lib-$(CONFIG_EXPR) += expr.o
|
||||
lib-$(CONFIG_EXPAND) += expand.o
|
||||
lib-$(CONFIG_FALSE) += false.o
|
||||
lib-$(CONFIG_FOLD) += fold.o
|
||||
lib-$(CONFIG_FSYNC) += fsync.o
|
||||
lib-$(CONFIG_INSTALL) += install.o
|
||||
#lib-$(CONFIG_LENGTH) += length.o
|
||||
lib-$(CONFIG_LN) += ln.o
|
||||
lib-$(CONFIG_LOGNAME) += logname.o
|
||||
lib-$(CONFIG_LS) += ls.o
|
||||
lib-$(CONFIG_FTPD) += ls.o
|
||||
lib-$(CONFIG_MD5SUM) += md5_sha1_sum.o
|
||||
lib-$(CONFIG_MKDIR) += mkdir.o
|
||||
lib-$(CONFIG_MKFIFO) += mkfifo.o
|
||||
lib-$(CONFIG_MKNOD) += mknod.o
|
||||
lib-$(CONFIG_MV) += mv.o
|
||||
lib-$(CONFIG_NICE) += nice.o
|
||||
lib-$(CONFIG_NOHUP) += nohup.o
|
||||
lib-$(CONFIG_OD) += od.o
|
||||
lib-$(CONFIG_PRINTENV) += printenv.o
|
||||
lib-$(CONFIG_PRINTF) += printf.o
|
||||
lib-$(CONFIG_ASH_BUILTIN_PRINTF) += printf.o
|
||||
lib-$(CONFIG_PWD) += pwd.o
|
||||
lib-$(CONFIG_READLINK) += readlink.o
|
||||
lib-$(CONFIG_REALPATH) += realpath.o
|
||||
lib-$(CONFIG_RM) += rm.o
|
||||
lib-$(CONFIG_RMDIR) += rmdir.o
|
||||
lib-$(CONFIG_SEQ) += seq.o
|
||||
lib-$(CONFIG_SHA1SUM) += md5_sha1_sum.o
|
||||
lib-$(CONFIG_SHA256SUM) += md5_sha1_sum.o
|
||||
lib-$(CONFIG_SHA512SUM) += md5_sha1_sum.o
|
||||
lib-$(CONFIG_SHA3SUM) += md5_sha1_sum.o
|
||||
lib-$(CONFIG_SLEEP) += sleep.o
|
||||
lib-$(CONFIG_SPLIT) += split.o
|
||||
lib-$(CONFIG_SORT) += sort.o
|
||||
lib-$(CONFIG_STAT) += stat.o
|
||||
lib-$(CONFIG_STTY) += stty.o
|
||||
lib-$(CONFIG_SUM) += sum.o
|
||||
lib-$(CONFIG_TAC) += tac.o
|
||||
lib-$(CONFIG_TEE) += tee.o
|
||||
lib-$(CONFIG_TRUE) += true.o
|
||||
lib-$(CONFIG_TTY) += tty.o
|
||||
lib-$(CONFIG_UNAME) += uname.o
|
||||
lib-$(CONFIG_UNEXPAND) += expand.o
|
||||
lib-$(CONFIG_UNIQ) += uniq.o
|
||||
lib-$(CONFIG_USLEEP) += usleep.o
|
||||
lib-$(CONFIG_UUDECODE) += uudecode.o
|
||||
lib-$(CONFIG_UUENCODE) += uuencode.o
|
||||
lib-$(CONFIG_WC) += wc.o
|
||||
lib-$(CONFIG_WHOAMI) += whoami.o
|
||||
lib-$(CONFIG_YES) += yes.o
|
||||
@@ -14,6 +14,12 @@
|
||||
* 2) Don't check for options, as per SUSv3.
|
||||
* 3) Save some space by using strcmp(). Calling strncmp() here was silly.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/basename.html */
|
||||
|
||||
//kbuild:lib-$(CONFIG_BASENAME) += basename.o
|
||||
|
||||
//config:config BASENAME
|
||||
//config: bool "basename"
|
||||
//config: default y
|
||||
@@ -22,13 +28,6 @@
|
||||
//config: leaving just the filename itself. Enable this option if you wish
|
||||
//config: to enable the 'basename' utility.
|
||||
|
||||
//applet:IF_BASENAME(APPLET_NOFORK(basename, basename, BB_DIR_USR_BIN, BB_SUID_DROP, basename))
|
||||
|
||||
//kbuild:lib-$(CONFIG_BASENAME) += basename.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/basename.html */
|
||||
|
||||
//usage:#define basename_trivial_usage
|
||||
//usage: "FILE [SUFFIX]"
|
||||
//usage:#define basename_full_usage "\n\n"
|
||||
|
||||
+5
-13
@@ -6,25 +6,17 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
||||
*
|
||||
* Major size reduction... over 50% (>1.5k) on i386.
|
||||
*/
|
||||
//config:config CAL
|
||||
//config: bool "cal"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: cal is used to display a monthly calendar.
|
||||
|
||||
//applet:IF_CAL(APPLET(cal, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_CAL) += cal.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant with -j and -y extensions (from util-linux). */
|
||||
/* BB_AUDIT BUG: The output of 'cal -j 1752' is incorrect. The upstream
|
||||
* BB_AUDIT BUG: version in util-linux seems to be broken as well. */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/cal.html */
|
||||
|
||||
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
||||
*
|
||||
* Major size reduction... over 50% (>1.5k) on i386.
|
||||
*/
|
||||
|
||||
//usage:#define cal_trivial_usage
|
||||
//usage: "[-jy] [[MONTH] YEAR]"
|
||||
//usage:#define cal_full_usage "\n\n"
|
||||
|
||||
+9
-7
@@ -6,6 +6,15 @@
|
||||
*
|
||||
* Licensed under GPLv2, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/cat.html */
|
||||
|
||||
//kbuild:lib-$(CONFIG_CAT) += cat.o
|
||||
//kbuild:lib-$(CONFIG_MORE) += cat.o # more uses it if stdout isn't a tty
|
||||
//kbuild:lib-$(CONFIG_LESS) += cat.o # less too
|
||||
//kbuild:lib-$(CONFIG_CRONTAB) += cat.o # crontab -l
|
||||
|
||||
//config:config CAT
|
||||
//config: bool "cat"
|
||||
//config: default y
|
||||
@@ -13,13 +22,6 @@
|
||||
//config: cat is used to concatenate files and print them to the standard
|
||||
//config: output. Enable this option if you wish to enable the 'cat' utility.
|
||||
|
||||
//applet:IF_CAT(APPLET_NOFORK(cat, cat, BB_DIR_BIN, BB_SUID_DROP, cat))
|
||||
|
||||
//kbuild:lib-$(CONFIG_CAT) += cat.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/cat.html */
|
||||
|
||||
//usage:#define cat_trivial_usage
|
||||
//usage: "[FILE]..."
|
||||
//usage:#define cat_full_usage "\n\n"
|
||||
|
||||
@@ -10,17 +10,6 @@
|
||||
/* See "Cat -v considered harmful" at
|
||||
* http://cm.bell-labs.com/cm/cs/doc/84/kp.ps.gz */
|
||||
|
||||
//config:config CATV
|
||||
//config: bool "catv"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: Display nonprinting characters as escape sequences (like some
|
||||
//config: implementations' cat -v option).
|
||||
|
||||
//applet:IF_CATV(APPLET(catv, BB_DIR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_CATV) += catv.o
|
||||
|
||||
//usage:#define catv_trivial_usage
|
||||
//usage: "[-etv] [FILE]..."
|
||||
//usage:#define catv_full_usage "\n\n"
|
||||
|
||||
@@ -6,15 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config CHGRP
|
||||
//config: bool "chgrp"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: chgrp is used to change the group ownership of files.
|
||||
|
||||
//applet:IF_CHGRP(APPLET_NOEXEC(chgrp, chgrp, BB_DIR_BIN, BB_SUID_DROP, chgrp))
|
||||
|
||||
//kbuild:lib-$(CONFIG_CHGRP) += chgrp.o chown.o
|
||||
|
||||
/* BB_AUDIT SUSv3 defects - none? */
|
||||
/* BB_AUDIT GNU defects - unsupported long options. */
|
||||
|
||||
@@ -9,15 +9,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config CHMOD
|
||||
//config: bool "chmod"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: chmod is used to change the access permission of files.
|
||||
|
||||
//applet:IF_CHMOD(APPLET_NOEXEC(chmod, chmod, BB_DIR_BIN, BB_SUID_DROP, chmod))
|
||||
|
||||
//kbuild:lib-$(CONFIG_CHMOD) += chmod.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* BB_AUDIT GNU defects - unsupported long options. */
|
||||
|
||||
@@ -6,23 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config CHOWN
|
||||
//config: bool "chown"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: chown is used to change the user and/or group ownership
|
||||
//config: of files.
|
||||
//config:
|
||||
//config:config FEATURE_CHOWN_LONG_OPTIONS
|
||||
//config: bool "Enable long options"
|
||||
//config: default y
|
||||
//config: depends on CHOWN && LONG_OPTS
|
||||
//config: help
|
||||
//config: Enable use of long options
|
||||
|
||||
//applet:IF_CHOWN(APPLET_NOEXEC(chown, chown, BB_DIR_BIN, BB_SUID_DROP, chown))
|
||||
|
||||
//kbuild:lib-$(CONFIG_CHOWN) += chown.o
|
||||
|
||||
/* BB_AUDIT SUSv3 defects - none? */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/chown.html */
|
||||
|
||||
@@ -6,16 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config CHROOT
|
||||
//config: bool "chroot"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: chroot is used to change the root directory and run a command.
|
||||
//config: The default command is `/bin/sh'.
|
||||
|
||||
//applet:IF_CHROOT(APPLET(chroot, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_CHROOT) += chroot.o
|
||||
|
||||
/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
|
||||
|
||||
|
||||
@@ -6,15 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config CKSUM
|
||||
//config: bool "cksum"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: cksum is used to calculate the CRC32 checksum of a file.
|
||||
|
||||
//applet:IF_CKSUM(APPLET_NOEXEC(cksum, cksum, BB_DIR_USR_BIN, BB_SUID_DROP, cksum))
|
||||
|
||||
//kbuild:lib-$(CONFIG_CKSUM) += cksum.o
|
||||
|
||||
//usage:#define cksum_trivial_usage
|
||||
//usage: "FILES..."
|
||||
|
||||
@@ -6,16 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config COMM
|
||||
//config: bool "comm"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: comm is used to compare two files line by line and return
|
||||
//config: a three-column output.
|
||||
|
||||
//applet:IF_COMM(APPLET(comm, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_COMM) += comm.o
|
||||
|
||||
//usage:#define comm_trivial_usage
|
||||
//usage: "[-123] FILE1 FILE2"
|
||||
|
||||
+3
-19
@@ -7,29 +7,13 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/cp.html */
|
||||
|
||||
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
||||
*
|
||||
* Size reduction.
|
||||
*/
|
||||
//config:config CP
|
||||
//config: bool "cp"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: cp is used to copy files and directories.
|
||||
//config:
|
||||
//config:config FEATURE_CP_LONG_OPTIONS
|
||||
//config: bool "Enable long options for cp"
|
||||
//config: default y
|
||||
//config: depends on CP && LONG_OPTS
|
||||
//config: help
|
||||
//config: Enable long options for cp.
|
||||
//config: Also add support for --parents option.
|
||||
|
||||
//applet:IF_CP(APPLET_NOEXEC(cp, cp, BB_DIR_BIN, BB_SUID_DROP, cp))
|
||||
|
||||
//kbuild:lib-$(CONFIG_CP) += cp.o
|
||||
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/cp.html */
|
||||
|
||||
//usage:#define cp_trivial_usage
|
||||
//usage: "[OPTIONS] SOURCE... DEST"
|
||||
|
||||
@@ -8,16 +8,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config CUT
|
||||
//config: bool "cut"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: cut is used to print selected parts of lines from
|
||||
//config: each file to stdout.
|
||||
|
||||
//applet:IF_CUT(APPLET_NOEXEC(cut, cut, BB_DIR_USR_BIN, BB_SUID_DROP, cut))
|
||||
|
||||
//kbuild:lib-$(CONFIG_CUT) += cut.o
|
||||
|
||||
//usage:#define cut_trivial_usage
|
||||
//usage: "[OPTIONS] [FILE]..."
|
||||
|
||||
+6
-5
@@ -8,7 +8,8 @@
|
||||
* bugfixes and cleanup by Bernhard Reutner-Fischer
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
*/
|
||||
|
||||
/* This 'date' command supports only 2 time setting formats,
|
||||
all the GNU strftime stuff (its in libc, lets use it),
|
||||
setting time using UTC and displaying it, as well as
|
||||
@@ -18,6 +19,10 @@
|
||||
/* Input parsing code is always bulky - used heavy duty libc stuff as
|
||||
much as possible, missed out a lot of bounds checking */
|
||||
|
||||
//applet:IF_DATE(APPLET(date, BB_DIR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_DATE) += date.o
|
||||
|
||||
//config:config DATE
|
||||
//config: bool "date"
|
||||
//config: default y
|
||||
@@ -58,10 +63,6 @@
|
||||
//config: the same format. With it on, 'date DATE' additionally supports
|
||||
//config: MMDDhhmm[[YY]YY][.ss] format.
|
||||
|
||||
//applet:IF_DATE(APPLET(date, BB_DIR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_DATE) += date.o
|
||||
|
||||
/* GNU coreutils 6.9 man page:
|
||||
* date [OPTION]... [+FORMAT]
|
||||
* date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
|
||||
|
||||
+2
-4
@@ -2,10 +2,12 @@
|
||||
/*
|
||||
* Mini dd implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2000,2001 Matt Kraai
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
//config:config DD
|
||||
//config: bool "dd"
|
||||
//config: default y
|
||||
@@ -51,10 +53,6 @@
|
||||
//config: help
|
||||
//config: Enables support for status=noxfer/none option.
|
||||
|
||||
//applet:IF_DD(APPLET_NOEXEC(dd, dd, BB_DIR_BIN, BB_SUID_DROP, dd))
|
||||
|
||||
//kbuild:lib-$(CONFIG_DD) += dd.o
|
||||
|
||||
//usage:#define dd_trivial_usage
|
||||
//usage: "[if=FILE] [of=FILE] " IF_FEATURE_DD_IBS_OBS("[ibs=N] [obs=N] ") "[bs=N] [count=N] [skip=N]\n"
|
||||
//usage: " [seek=N]" IF_FEATURE_DD_IBS_OBS(" [conv=notrunc|noerror|sync|fsync] [iflag=skip_bytes]")
|
||||
|
||||
+16
-52
@@ -7,6 +7,10 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 _NOT_ compliant -- option -t missing. */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/df.html */
|
||||
|
||||
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
||||
*
|
||||
* Size reduction. Removed floating point dependency. Added error checking
|
||||
@@ -17,30 +21,6 @@
|
||||
*
|
||||
* Implement -P and -B; better coreutils compat; cleanup
|
||||
*/
|
||||
//config:config DF
|
||||
//config: bool "df"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: df reports the amount of disk space used and available
|
||||
//config: on filesystems.
|
||||
//config:
|
||||
//config:config FEATURE_DF_FANCY
|
||||
//config: bool "Enable -a, -i, -B"
|
||||
//config: default y
|
||||
//config: depends on DF
|
||||
//config: help
|
||||
//config: This option enables -a, -i and -B.
|
||||
//config:
|
||||
//config: -a Show all filesystems
|
||||
//config: -i Inodes
|
||||
//config: -B <SIZE> Blocksize
|
||||
|
||||
//applet:IF_DF(APPLET(df, BB_DIR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_DF) += df.o
|
||||
|
||||
/* BB_AUDIT SUSv3 _NOT_ compliant -- option -t missing. */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/df.html */
|
||||
|
||||
//usage:#define df_trivial_usage
|
||||
//usage: "[-Pk"
|
||||
@@ -129,19 +109,8 @@ int df_main(int argc UNUSED_PARAM, char **argv)
|
||||
if (opt & OPT_MEGA)
|
||||
df_disp_hr = 1024*1024;
|
||||
|
||||
if (opt & OPT_BSIZE) {
|
||||
/* GNU coreutils 8.25 accepts "-BMiB" form too */
|
||||
int i;
|
||||
for (i = 0; kmg_i_suffixes[i].suffix[0]; i++) {
|
||||
if (strcmp(kmg_i_suffixes[i].suffix, chp) == 0) {
|
||||
df_disp_hr = kmg_i_suffixes[i].mult;
|
||||
goto got_it;
|
||||
}
|
||||
}
|
||||
/* Range used to disallow 0 */
|
||||
df_disp_hr = xatoul_range_sfx(chp, 1, ULONG_MAX, kmg_i_suffixes);
|
||||
got_it: ;
|
||||
}
|
||||
if (opt & OPT_BSIZE)
|
||||
df_disp_hr = xatoul_range(chp, 1, ULONG_MAX); /* disallow 0 */
|
||||
|
||||
/* From the manpage of df from coreutils-6.10:
|
||||
* Disk space is shown in 1K blocks by default, unless the environment
|
||||
@@ -214,17 +183,12 @@ int df_main(int argc UNUSED_PARAM, char **argv)
|
||||
bb_simple_perror_msg(mount_point);
|
||||
goto set_error;
|
||||
}
|
||||
/* Some uclibc versions were seen to lose f_frsize
|
||||
* (kernel does return it, but then uclibc does not copy it)
|
||||
*/
|
||||
if (s.f_frsize == 0)
|
||||
s.f_frsize = s.f_bsize;
|
||||
|
||||
if ((s.f_blocks > 0) || !mount_table || (opt & OPT_ALL)) {
|
||||
if (opt & OPT_INODE) {
|
||||
s.f_blocks = s.f_files;
|
||||
s.f_bavail = s.f_bfree = s.f_ffree;
|
||||
s.f_frsize = 1;
|
||||
s.f_bsize = 1;
|
||||
|
||||
if (df_disp_hr)
|
||||
df_disp_hr = 1;
|
||||
@@ -282,26 +246,26 @@ int df_main(int argc UNUSED_PARAM, char **argv)
|
||||
|
||||
#if ENABLE_FEATURE_HUMAN_READABLE
|
||||
printf(" %9s ",
|
||||
/* f_blocks x f_frsize / df_disp_hr, show one fractional,
|
||||
/* f_blocks x f_bsize / df_disp_hr, show one fractional,
|
||||
* use suffixes if df_disp_hr == 0 */
|
||||
make_human_readable_str(s.f_blocks, s.f_frsize, df_disp_hr));
|
||||
make_human_readable_str(s.f_blocks, s.f_bsize, df_disp_hr));
|
||||
|
||||
printf(" %9s " + 1,
|
||||
/* EXPR x f_frsize / df_disp_hr, show one fractional,
|
||||
/* EXPR x f_bsize / df_disp_hr, show one fractional,
|
||||
* use suffixes if df_disp_hr == 0 */
|
||||
make_human_readable_str((s.f_blocks - s.f_bfree),
|
||||
s.f_frsize, df_disp_hr));
|
||||
s.f_bsize, df_disp_hr));
|
||||
|
||||
printf("%9s %3u%% %s\n",
|
||||
/* f_bavail x f_frsize / df_disp_hr, show one fractional,
|
||||
/* f_bavail x f_bsize / df_disp_hr, show one fractional,
|
||||
* use suffixes if df_disp_hr == 0 */
|
||||
make_human_readable_str(s.f_bavail, s.f_frsize, df_disp_hr),
|
||||
make_human_readable_str(s.f_bavail, s.f_bsize, df_disp_hr),
|
||||
blocks_percent_used, mount_point);
|
||||
#else
|
||||
printf(" %9lu %9lu %9lu %3u%% %s\n",
|
||||
kscale(s.f_blocks, s.f_frsize),
|
||||
kscale(s.f_blocks - s.f_bfree, s.f_frsize),
|
||||
kscale(s.f_bavail, s.f_frsize),
|
||||
kscale(s.f_blocks, s.f_bsize),
|
||||
kscale(s.f_blocks - s.f_bfree, s.f_bsize),
|
||||
kscale(s.f_bavail, s.f_bsize),
|
||||
blocks_percent_used, mount_point);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -6,16 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config DIRNAME
|
||||
//config: bool "dirname"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: dirname is used to strip a non-directory suffix from
|
||||
//config: a file name.
|
||||
|
||||
//applet:IF_DIRNAME(APPLET_NOFORK(dirname, dirname, BB_DIR_USR_BIN, BB_SUID_DROP, dirname))
|
||||
|
||||
//kbuild:lib-$(CONFIG_DIRNAME) += dirname.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/dirname.html */
|
||||
|
||||
+3
-25
@@ -10,26 +10,7 @@
|
||||
* dos2unix filters reading input from stdin and writing output to stdout.
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config DOS2UNIX
|
||||
//config: bool "dos2unix"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: dos2unix is used to convert a text file from DOS format to
|
||||
//config: UNIX format, and vice versa.
|
||||
//config:
|
||||
//config:config UNIX2DOS
|
||||
//config: bool "unix2dos"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: unix2dos is used to convert a text file from UNIX format to
|
||||
//config: DOS format, and vice versa.
|
||||
|
||||
//applet:IF_DOS2UNIX(APPLET_NOEXEC(dos2unix, dos2unix, BB_DIR_USR_BIN, BB_SUID_DROP, dos2unix))
|
||||
//applet:IF_UNIX2DOS(APPLET_NOEXEC(unix2dos, dos2unix, BB_DIR_USR_BIN, BB_SUID_DROP, unix2dos))
|
||||
|
||||
//kbuild:lib-$(CONFIG_DOS2UNIX) += dos2unix.o
|
||||
//kbuild:lib-$(CONFIG_UNIX2DOS) += dos2unix.o
|
||||
*/
|
||||
|
||||
//usage:#define dos2unix_trivial_usage
|
||||
//usage: "[-ud] [FILE]"
|
||||
@@ -111,12 +92,9 @@ int dos2unix_main(int argc UNUSED_PARAM, char **argv)
|
||||
int o, conv_type;
|
||||
|
||||
/* See if we are supposed to be doing dos2unix or unix2dos */
|
||||
if (ENABLE_DOS2UNIX
|
||||
&& (!ENABLE_UNIX2DOS || applet_name[0] == 'd')
|
||||
) {
|
||||
conv_type = CT_UNIX2DOS;
|
||||
if (applet_name[0] == 'd') {
|
||||
conv_type = CT_DOS2UNIX;
|
||||
} else {
|
||||
conv_type = CT_UNIX2DOS;
|
||||
}
|
||||
|
||||
/* -u convert to unix, -d convert to dos */
|
||||
|
||||
+8
-24
@@ -8,6 +8,10 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant (unless default blocksize set to 1k) */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/du.html */
|
||||
|
||||
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
||||
*
|
||||
* Mostly rewritten for SUSv3 compliance and to fix bugs/defects.
|
||||
@@ -18,26 +22,6 @@
|
||||
* 3) Added error checking of output.
|
||||
* 4) Fixed busybox bug #1284 involving long overflow with human_readable.
|
||||
*/
|
||||
//config:config DU
|
||||
//config: bool "du (default blocksize of 512 bytes)"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: du is used to report the amount of disk space used
|
||||
//config: for specified files.
|
||||
//config:
|
||||
//config:config FEATURE_DU_DEFAULT_BLOCKSIZE_1K
|
||||
//config: bool "Use a default blocksize of 1024 bytes (1K)"
|
||||
//config: default y
|
||||
//config: depends on DU
|
||||
//config: help
|
||||
//config: Use a blocksize of (1K) instead of the default 512b.
|
||||
|
||||
//applet:IF_DU(APPLET(du, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_DU) += du.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant (unless default blocksize set to 1k) */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/du.html */
|
||||
|
||||
//usage:#define du_trivial_usage
|
||||
//usage: "[-aHLdclsx" IF_FEATURE_HUMAN_READABLE("hm") "k] [FILE]..."
|
||||
@@ -242,8 +226,8 @@ int du_main(int argc UNUSED_PARAM, 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", &G.max_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 & OPT_h_for_humans) {
|
||||
G.disp_unit = 0;
|
||||
@@ -255,8 +239,8 @@ int du_main(int argc UNUSED_PARAM, char **argv)
|
||||
G.disp_unit = 1024;
|
||||
}
|
||||
#else
|
||||
opt_complementary = "H-L:L-H:s-d:d-s";
|
||||
opt = getopt32(argv, "aHkLsx" "d:+" "lc", &G.max_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 & OPT_k_kbytes) {
|
||||
|
||||
+4
-20
@@ -9,6 +9,10 @@
|
||||
*
|
||||
* Original copyright notice is retained at the end of this file.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant -- unless configured as fancy echo. */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/echo.html */
|
||||
|
||||
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
||||
*
|
||||
* Because of behavioral differences, implemented configurable SUSv3
|
||||
@@ -18,26 +22,6 @@
|
||||
* 2) SUSv3 specifies that octal escapes are of the form \0{#{#{#}}}.
|
||||
* The previous version did not allow 4-digit octals.
|
||||
*/
|
||||
//config:config ECHO
|
||||
//config: bool "echo (basic SuSv3 version taking no options)"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: echo is used to print a specified string to stdout.
|
||||
//config:
|
||||
//config:# this entry also appears in shell/Config.in, next to the echo builtin
|
||||
//config:config FEATURE_FANCY_ECHO
|
||||
//config: bool "Enable echo options (-n and -e)"
|
||||
//config: default y
|
||||
//config: depends on ECHO || ASH_BUILTIN_ECHO || HUSH
|
||||
//config: help
|
||||
//config: This adds options (-n and -e) to echo.
|
||||
|
||||
//applet:IF_ECHO(APPLET_NOFORK(echo, echo, BB_DIR_BIN, BB_SUID_DROP, echo))
|
||||
|
||||
//kbuild:lib-$(CONFIG_ECHO) += echo.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant -- unless configured as fancy echo. */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/echo.html */
|
||||
|
||||
//usage:#define echo_trivial_usage
|
||||
//usage: IF_FEATURE_FANCY_ECHO("[-neE] ") "[ARG]..."
|
||||
|
||||
+8
-21
@@ -11,11 +11,16 @@
|
||||
*
|
||||
* Modified for BusyBox by Erik Andersen <andersen@codepoet.org>
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/env.html */
|
||||
|
||||
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
||||
*
|
||||
* Fixed bug involving exit return codes if execvp fails. Also added
|
||||
* output error checking.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by Vladimir Oleynik <dzo@simtreas.ru> (C) 2003
|
||||
* - correct "-" option usage
|
||||
@@ -23,27 +28,8 @@
|
||||
* - GNU long option support
|
||||
* - use xfunc_error_retval
|
||||
*/
|
||||
//config:config ENV
|
||||
//config: bool "env"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: env is used to set an environment variable and run
|
||||
//config: a command; without options it displays the current
|
||||
//config: environment.
|
||||
//config:
|
||||
//config:config FEATURE_ENV_LONG_OPTIONS
|
||||
//config: bool "Enable long options"
|
||||
//config: default y
|
||||
//config: depends on ENV && LONG_OPTS
|
||||
//config: help
|
||||
//config: Support long options for the env applet.
|
||||
|
||||
//applet:IF_ENV(APPLET_NOEXEC(env, env, BB_DIR_USR_BIN, BB_SUID_DROP, env))
|
||||
|
||||
//kbuild:lib-$(CONFIG_ENV) += env.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/env.html */
|
||||
/* This is a NOEXEC applet. Be very careful! */
|
||||
|
||||
//usage:#define env_trivial_usage
|
||||
//usage: "[-iu] [-] [name=value]... [PROG ARGS]"
|
||||
@@ -68,10 +54,11 @@ int env_main(int argc UNUSED_PARAM, char **argv)
|
||||
unsigned opts;
|
||||
llist_t *unset_env = NULL;
|
||||
|
||||
opt_complementary = "u::";
|
||||
#if ENABLE_FEATURE_ENV_LONG_OPTIONS
|
||||
applet_long_options = env_longopts;
|
||||
#endif
|
||||
opts = getopt32(argv, "+iu:+", &unset_env);
|
||||
opts = getopt32(argv, "+iu:", &unset_env);
|
||||
argv += optind;
|
||||
if (argv[0] && LONE_DASH(argv[0])) {
|
||||
opts |= 1;
|
||||
|
||||
@@ -20,37 +20,6 @@
|
||||
*
|
||||
* Caveat: this versions of expand and unexpand don't accept tab lists.
|
||||
*/
|
||||
//config:config EXPAND
|
||||
//config: bool "expand"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: By default, convert all tabs to spaces.
|
||||
//config:
|
||||
//config:config FEATURE_EXPAND_LONG_OPTIONS
|
||||
//config: bool "Enable long options"
|
||||
//config: default y
|
||||
//config: depends on EXPAND && LONG_OPTS
|
||||
//config: help
|
||||
//config: Support long options for the expand applet.
|
||||
//config:
|
||||
//config:config UNEXPAND
|
||||
//config: bool "unexpand"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: By default, convert only leading sequences of blanks to tabs.
|
||||
//config:
|
||||
//config:config FEATURE_UNEXPAND_LONG_OPTIONS
|
||||
//config: bool "Enable long options"
|
||||
//config: default y
|
||||
//config: depends on UNEXPAND && LONG_OPTS
|
||||
//config: help
|
||||
//config: Support long options for the unexpand applet.
|
||||
|
||||
//applet:IF_EXPAND(APPLET(expand, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
//applet:IF_UNEXPAND(APPLET_ODDNAME(unexpand, expand, BB_DIR_USR_BIN, BB_SUID_DROP, unexpand))
|
||||
|
||||
//kbuild:lib-$(CONFIG_EXPAND) += expand.o
|
||||
//kbuild:lib-$(CONFIG_UNEXPAND) += expand.o
|
||||
|
||||
//usage:#define expand_trivial_usage
|
||||
//usage: "[-i] [-t N] [FILE]..."
|
||||
|
||||
+5
-22
@@ -13,6 +13,7 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
/* This program evaluates expressions. Each token (operator, operand,
|
||||
* parenthesis) of the expression must be a separate argument. The
|
||||
* parser used is a reasonably general one, though any incarnation of
|
||||
@@ -20,27 +21,9 @@
|
||||
*
|
||||
* No parse tree is needed; a new node is evaluated immediately.
|
||||
* One function can handle multiple operators all of equal precedence,
|
||||
* provided they all associate ((x op x) op x).
|
||||
*/
|
||||
//config:config EXPR
|
||||
//config: bool "expr"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: expr is used to calculate numbers and print the result
|
||||
//config: to standard output.
|
||||
//config:
|
||||
//config:config EXPR_MATH_SUPPORT_64
|
||||
//config: bool "Extend Posix numbers support to 64 bit"
|
||||
//config: default y
|
||||
//config: depends on EXPR
|
||||
//config: help
|
||||
//config: Enable 64-bit math support in the expr applet. This will make
|
||||
//config: the applet slightly larger, but will allow computation with very
|
||||
//config: large numbers.
|
||||
* provided they all associate ((x op x) op x). */
|
||||
|
||||
//applet:IF_EXPR(APPLET(expr, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_EXPR) += expr.o
|
||||
/* no getopt needed */
|
||||
|
||||
//usage:#define expr_trivial_usage
|
||||
//usage: "EXPRESSION"
|
||||
@@ -131,7 +114,7 @@ static VALUE *int_value(arith_t i)
|
||||
VALUE *v;
|
||||
|
||||
v = xzalloc(sizeof(VALUE));
|
||||
if (INTEGER) /* otherwise xzalloc did it already */
|
||||
if (INTEGER) /* otherwise xzaaloc did it already */
|
||||
v->type = INTEGER;
|
||||
v->u.i = i;
|
||||
return v;
|
||||
@@ -144,7 +127,7 @@ static VALUE *str_value(const char *s)
|
||||
VALUE *v;
|
||||
|
||||
v = xzalloc(sizeof(VALUE));
|
||||
if (STRING) /* otherwise xzalloc did it already */
|
||||
if (STRING) /* otherwise xzaaloc did it already */
|
||||
v->type = STRING;
|
||||
v->u.s = xstrdup(s);
|
||||
return v;
|
||||
|
||||
@@ -6,15 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config FALSE
|
||||
//config: bool "false"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: false returns an exit code of FALSE (1).
|
||||
|
||||
//applet:IF_FALSE(APPLET_NOFORK(false, false, BB_DIR_BIN, BB_SUID_DROP, false))
|
||||
|
||||
//kbuild:lib-$(CONFIG_FALSE) += false.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/000095399/utilities/false.html */
|
||||
|
||||
@@ -9,15 +9,6 @@
|
||||
|
||||
Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config FOLD
|
||||
//config: bool "fold"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: Wrap text to fit a specific width.
|
||||
|
||||
//applet:IF_FOLD(APPLET_NOEXEC(fold, fold, BB_DIR_USR_BIN, BB_SUID_DROP, fold))
|
||||
|
||||
//kbuild:lib-$(CONFIG_FOLD) += fold.o
|
||||
|
||||
//usage:#define fold_trivial_usage
|
||||
//usage: "[-bs] [-w WIDTH] [FILE]..."
|
||||
|
||||
@@ -6,15 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config FSYNC
|
||||
//config: bool "fsync"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: fsync is used to flush file-related cached blocks to disk.
|
||||
|
||||
//applet:IF_FSYNC(APPLET_NOFORK(fsync, fsync, BB_DIR_BIN, BB_SUID_DROP, fsync))
|
||||
|
||||
//kbuild:lib-$(CONFIG_FSYNC) += fsync.o
|
||||
|
||||
//usage:#define fsync_trivial_usage
|
||||
//usage: "[-d] FILE..."
|
||||
|
||||
+2
-17
@@ -6,28 +6,13 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config HEAD
|
||||
//config: bool "head"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: head is used to print the first specified number of lines
|
||||
//config: from files.
|
||||
//config:
|
||||
//config:config FEATURE_FANCY_HEAD
|
||||
//config: bool "Enable head options (-c, -q, and -v)"
|
||||
//config: default y
|
||||
//config: depends on HEAD
|
||||
//config: help
|
||||
//config: This enables the head options (-c, -q, and -v).
|
||||
|
||||
//applet:IF_HEAD(APPLET_NOEXEC(head, head, BB_DIR_USR_BIN, BB_SUID_DROP, head))
|
||||
|
||||
//kbuild:lib-$(CONFIG_HEAD) += head.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* BB_AUDIT GNU compatible -c, -q, and -v options in 'fancy' configuration. */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/head.html */
|
||||
|
||||
//kbuild:lib-$(CONFIG_HEAD) += head.o
|
||||
|
||||
//usage:#define head_trivial_usage
|
||||
//usage: "[OPTIONS] [FILE]..."
|
||||
//usage:#define head_full_usage "\n\n"
|
||||
|
||||
+3
-2
@@ -6,6 +6,9 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
|
||||
|
||||
//config:config HOSTID
|
||||
//config: bool "hostid"
|
||||
//config: default y
|
||||
@@ -17,8 +20,6 @@
|
||||
|
||||
//kbuild:lib-$(CONFIG_HOSTID) += hostid.o
|
||||
|
||||
/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
|
||||
|
||||
//usage:#define hostid_trivial_usage
|
||||
//usage: ""
|
||||
//usage:#define hostid_full_usage "\n\n"
|
||||
|
||||
+6
-5
@@ -7,30 +7,31 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant. */
|
||||
/* Hacked by Tito Ragusa (C) 2004 to handle usernames of whatever
|
||||
* length and to be more similar to GNU id.
|
||||
* -Z option support: by Yuichi Nakamura <ynakam@hitachisoft.jp>
|
||||
* Added -G option Tito Ragusa (C) 2008 for SUSv3.
|
||||
*/
|
||||
|
||||
//config:config ID
|
||||
//config: bool "id"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: id displays the current user and group ID names.
|
||||
//config:
|
||||
|
||||
//config:config GROUPS
|
||||
//config: bool "groups"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: Print the group names associated with current user id.
|
||||
|
||||
//applet:IF_GROUPS(APPLET_NOEXEC(groups, id, BB_DIR_USR_BIN, BB_SUID_DROP, groups))
|
||||
//applet:IF_ID( APPLET_NOEXEC(id, id, BB_DIR_USR_BIN, BB_SUID_DROP, id ))
|
||||
|
||||
//kbuild:lib-$(CONFIG_GROUPS) += id.o
|
||||
//kbuild:lib-$(CONFIG_ID) += id.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant. */
|
||||
//applet:IF_GROUPS(APPLET_NOEXEC(groups, id, BB_DIR_USR_BIN, BB_SUID_DROP, groups))
|
||||
//applet:IF_ID( APPLET_NOEXEC(id, id, BB_DIR_USR_BIN, BB_SUID_DROP, id ))
|
||||
|
||||
//usage:#define id_trivial_usage
|
||||
//usage: "[OPTIONS] [USER]"
|
||||
|
||||
+1
-18
@@ -5,22 +5,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config INSTALL
|
||||
//config: bool "install"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: Copy files and set attributes.
|
||||
//config:
|
||||
//config:config FEATURE_INSTALL_LONG_OPTIONS
|
||||
//config: bool "Enable long options"
|
||||
//config: default y
|
||||
//config: depends on INSTALL && LONG_OPTS
|
||||
//config: help
|
||||
//config: Support long options for the install applet.
|
||||
|
||||
//applet:IF_INSTALL(APPLET(install, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_INSTALL) += install.o
|
||||
|
||||
/* -v, -b, -c are ignored */
|
||||
//usage:#define install_trivial_usage
|
||||
@@ -211,8 +195,7 @@ int install_main(int argc, char **argv)
|
||||
char *ddir = xstrdup(dest);
|
||||
bb_make_directory(dirname(ddir), 0755, mkdir_flags);
|
||||
/* errors are not checked. copy_file
|
||||
* will fail if dir is not created.
|
||||
*/
|
||||
* will fail if dir is not created. */
|
||||
free(ddir);
|
||||
}
|
||||
if (isdir)
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Licensed under GPLv2, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */
|
||||
|
||||
//usage:#define length_trivial_usage
|
||||
//usage: "STRING"
|
||||
//usage:#define length_full_usage "\n\n"
|
||||
//usage: "Print STRING's length"
|
||||
//usage:
|
||||
//usage:#define length_example_usage
|
||||
//usage: "$ length Hello\n"
|
||||
//usage: "5\n"
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
int length_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int length_main(int argc, char **argv)
|
||||
{
|
||||
if ((argc != 2) || (**(++argv) == '-')) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
printf("%u\n", (unsigned)strlen(*argv));
|
||||
|
||||
return fflush_all();
|
||||
}
|
||||
@@ -6,15 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config LN
|
||||
//config: bool "ln"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: ln is used to create hard or soft links between files.
|
||||
|
||||
//applet:IF_LN(APPLET_NOEXEC(ln, ln, BB_DIR_BIN, BB_SUID_DROP, ln))
|
||||
|
||||
//kbuild:lib-$(CONFIG_LN) += ln.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* BB_AUDIT GNU options missing: -d, -F, -i, and -v. */
|
||||
|
||||
+4
-12
@@ -6,6 +6,10 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/logname.html */
|
||||
|
||||
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
||||
*
|
||||
* SUSv3 specifies the string used is that returned from getlogin().
|
||||
@@ -15,18 +19,6 @@
|
||||
* correct course of action wrt SUSv3 for a failing getlogin() is
|
||||
* a diagnostic message and an error return.
|
||||
*/
|
||||
//config:config LOGNAME
|
||||
//config: bool "logname"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: logname is used to print the current user's login name.
|
||||
|
||||
//applet:IF_LOGNAME(APPLET_NOFORK(logname, logname, BB_DIR_USR_BIN, BB_SUID_DROP, logname))
|
||||
|
||||
//kbuild:lib-$(CONFIG_LOGNAME) += logname.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/logname.html */
|
||||
|
||||
//usage:#define logname_trivial_usage
|
||||
//usage: ""
|
||||
|
||||
+1
-69
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
/* [date unknown. Perhaps before year 2000]
|
||||
* To achieve a small memory footprint, this version of 'ls' doesn't do any
|
||||
* file sorting, and only has the most essential command line switches
|
||||
@@ -27,75 +28,6 @@
|
||||
* [2009-03]
|
||||
* ls sorts listing now, and supports almost all options.
|
||||
*/
|
||||
//config:config LS
|
||||
//config: bool "ls"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: ls is used to list the contents of directories.
|
||||
//config:
|
||||
//config:config FEATURE_LS_FILETYPES
|
||||
//config: bool "Enable filetyping options (-p and -F)"
|
||||
//config: default y
|
||||
//config: depends on LS
|
||||
//config: help
|
||||
//config: Enable the ls options (-p and -F).
|
||||
//config:
|
||||
//config:config FEATURE_LS_FOLLOWLINKS
|
||||
//config: bool "Enable symlinks dereferencing (-L)"
|
||||
//config: default y
|
||||
//config: depends on LS
|
||||
//config: help
|
||||
//config: Enable the ls option (-L).
|
||||
//config:
|
||||
//config:config FEATURE_LS_RECURSIVE
|
||||
//config: bool "Enable recursion (-R)"
|
||||
//config: default y
|
||||
//config: depends on LS
|
||||
//config: help
|
||||
//config: Enable the ls option (-R).
|
||||
//config:
|
||||
//config:config FEATURE_LS_SORTFILES
|
||||
//config: bool "Sort the file names"
|
||||
//config: default y
|
||||
//config: depends on LS
|
||||
//config: help
|
||||
//config: Allow ls to sort file names alphabetically.
|
||||
//config:
|
||||
//config:config FEATURE_LS_TIMESTAMPS
|
||||
//config: bool "Show file timestamps"
|
||||
//config: default y
|
||||
//config: depends on LS
|
||||
//config: help
|
||||
//config: Allow ls to display timestamps for files.
|
||||
//config:
|
||||
//config:config FEATURE_LS_USERNAME
|
||||
//config: bool "Show username/groupnames"
|
||||
//config: default y
|
||||
//config: depends on LS
|
||||
//config: help
|
||||
//config: Allow ls to display username/groupname for files.
|
||||
//config:
|
||||
//config:config FEATURE_LS_COLOR
|
||||
//config: bool "Allow use of color to identify file types"
|
||||
//config: default y
|
||||
//config: depends on LS && LONG_OPTS
|
||||
//config: help
|
||||
//config: This enables the --color option to ls.
|
||||
//config:
|
||||
//config:config FEATURE_LS_COLOR_IS_DEFAULT
|
||||
//config: bool "Produce colored ls output by default"
|
||||
//config: default y
|
||||
//config: depends on FEATURE_LS_COLOR
|
||||
//config: help
|
||||
//config: Saying yes here will turn coloring on by default,
|
||||
//config: even if no "--color" option is given to the ls command.
|
||||
//config: This is not recommended, since the colors are not
|
||||
//config: configurable, and the output may not be legible on
|
||||
//config: many output screens.
|
||||
|
||||
//applet:IF_LS(APPLET_NOEXEC(ls, ls, BB_DIR_BIN, BB_SUID_DROP, ls))
|
||||
|
||||
//kbuild:lib-$(CONFIG_LS) += ls.o
|
||||
|
||||
//usage:#define ls_trivial_usage
|
||||
//usage: "[-1AaCxd"
|
||||
|
||||
+25
-120
@@ -5,60 +5,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config MD5SUM
|
||||
//config: bool "md5sum"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: md5sum is used to print or check MD5 checksums.
|
||||
//config:
|
||||
//config:config SHA1SUM
|
||||
//config: bool "sha1sum"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: Compute and check SHA1 message digest
|
||||
//config:
|
||||
//config:config SHA256SUM
|
||||
//config: bool "sha256sum"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: Compute and check SHA256 message digest
|
||||
//config:
|
||||
//config:config SHA512SUM
|
||||
//config: bool "sha512sum"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: Compute and check SHA512 message digest
|
||||
//config:
|
||||
//config:config SHA3SUM
|
||||
//config: bool "sha3sum"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: Compute and check SHA3 message digest
|
||||
//config:
|
||||
//config:comment "Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum"
|
||||
//config: depends on MD5SUM || SHA1SUM || SHA256SUM || SHA512SUM || SHA3SUM
|
||||
//config:
|
||||
//config:config FEATURE_MD5_SHA1_SUM_CHECK
|
||||
//config: bool "Enable -c, -s and -w options"
|
||||
//config: default y
|
||||
//config: depends on MD5SUM || SHA1SUM || SHA256SUM || SHA512SUM || SHA3SUM
|
||||
//config: help
|
||||
//config: Enabling the -c options allows files to be checked
|
||||
//config: against pre-calculated hash values.
|
||||
//config:
|
||||
//config: -s and -w are useful options when verifying checksums.
|
||||
|
||||
//applet:IF_MD5SUM(APPLET_NOEXEC(md5sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, md5sum))
|
||||
//applet:IF_SHA1SUM(APPLET_NOEXEC(sha1sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, sha1sum))
|
||||
//applet:IF_SHA3SUM(APPLET_NOEXEC(sha3sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, sha3sum))
|
||||
//applet:IF_SHA256SUM(APPLET_NOEXEC(sha256sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, sha256sum))
|
||||
//applet:IF_SHA512SUM(APPLET_NOEXEC(sha512sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, sha512sum))
|
||||
|
||||
//kbuild:lib-$(CONFIG_MD5SUM) += md5_sha1_sum.o
|
||||
//kbuild:lib-$(CONFIG_SHA1SUM) += md5_sha1_sum.o
|
||||
//kbuild:lib-$(CONFIG_SHA256SUM) += md5_sha1_sum.o
|
||||
//kbuild:lib-$(CONFIG_SHA512SUM) += md5_sha1_sum.o
|
||||
//kbuild:lib-$(CONFIG_SHA3SUM) += md5_sha1_sum.o
|
||||
|
||||
//usage:#define md5sum_trivial_usage
|
||||
//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK("[-c[sw]] ")"[FILE]..."
|
||||
@@ -111,20 +57,15 @@
|
||||
//usage: )
|
||||
//usage:
|
||||
//usage:#define sha3sum_trivial_usage
|
||||
//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK("[-c[sw]] ")"[-a BITS] [FILE]..."
|
||||
//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK("[-c[sw]] ")"[FILE]..."
|
||||
//usage:#define sha3sum_full_usage "\n\n"
|
||||
//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA3 checksums"
|
||||
//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA3-512 checksums"
|
||||
//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n"
|
||||
//usage: "\n -c Check sums against list in FILEs"
|
||||
//usage: "\n -s Don't output anything, status code shows success"
|
||||
//usage: "\n -w Warn about improperly formatted checksum lines"
|
||||
//usage: "\n -a BITS 224 (default), 256, 384, 512"
|
||||
//usage: )
|
||||
|
||||
//FIXME: GNU coreutils 8.25 has no -s option, it has only these two long opts:
|
||||
// --quiet don't print OK for each successfully verified file
|
||||
// --status don't output anything, status code shows success
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
/* This is a NOEXEC applet. Be very careful! */
|
||||
@@ -152,10 +93,7 @@ static unsigned char *hash_bin_to_hex(unsigned char *hash_value,
|
||||
return (unsigned char *)hex_value;
|
||||
}
|
||||
|
||||
#if !ENABLE_SHA3SUM
|
||||
# define hash_file(f,w) hash_file(f)
|
||||
#endif
|
||||
static uint8_t *hash_file(const char *filename, unsigned sha3_width)
|
||||
static uint8_t *hash_file(const char *filename)
|
||||
{
|
||||
int src_fd, hash_len, count;
|
||||
union _ctx_ {
|
||||
@@ -183,47 +121,27 @@ static uint8_t *hash_file(const char *filename, unsigned sha3_width)
|
||||
update = (void*)md5_hash;
|
||||
final = (void*)md5_end;
|
||||
hash_len = 16;
|
||||
}
|
||||
else if (ENABLE_SHA1SUM && hash_algo == HASH_SHA1) {
|
||||
} else if (ENABLE_SHA1SUM && hash_algo == HASH_SHA1) {
|
||||
sha1_begin(&context.sha1);
|
||||
update = (void*)sha1_hash;
|
||||
final = (void*)sha1_end;
|
||||
hash_len = 20;
|
||||
}
|
||||
else if (ENABLE_SHA256SUM && hash_algo == HASH_SHA256) {
|
||||
} else if (ENABLE_SHA256SUM && hash_algo == HASH_SHA256) {
|
||||
sha256_begin(&context.sha256);
|
||||
update = (void*)sha256_hash;
|
||||
final = (void*)sha256_end;
|
||||
hash_len = 32;
|
||||
}
|
||||
else if (ENABLE_SHA512SUM && hash_algo == HASH_SHA512) {
|
||||
} else if (ENABLE_SHA512SUM && hash_algo == HASH_SHA512) {
|
||||
sha512_begin(&context.sha512);
|
||||
update = (void*)sha512_hash;
|
||||
final = (void*)sha512_end;
|
||||
hash_len = 64;
|
||||
}
|
||||
#if ENABLE_SHA3SUM
|
||||
else if (ENABLE_SHA3SUM && hash_algo == HASH_SHA3) {
|
||||
} else if (ENABLE_SHA3SUM && hash_algo == HASH_SHA3) {
|
||||
sha3_begin(&context.sha3);
|
||||
update = (void*)sha3_hash;
|
||||
final = (void*)sha3_end;
|
||||
/*
|
||||
* Should support 224, 256, 384, 512.
|
||||
* We allow any value which does not blow the algorithm up.
|
||||
*/
|
||||
if (sha3_width >= 1600/2 /* input block can't be <= 0 */
|
||||
|| sha3_width == 0 /* hash len can't be 0 */
|
||||
|| (sha3_width & 0x1f) /* should be multiple of 32 */
|
||||
/* (because input uses up to 8 byte wide word XORs. 32/4=8) */
|
||||
) {
|
||||
bb_error_msg_and_die("bad -a%u", sha3_width);
|
||||
}
|
||||
sha3_width /= 4;
|
||||
context.sha3.input_block_bytes = 1600/8 - sha3_width;
|
||||
hash_len = sha3_width/2;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
hash_len = 64;
|
||||
} else {
|
||||
xfunc_die(); /* can't reach this */
|
||||
}
|
||||
|
||||
@@ -254,33 +172,28 @@ int md5_sha1_sum_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
int return_value = EXIT_SUCCESS;
|
||||
unsigned flags;
|
||||
#if ENABLE_SHA3SUM
|
||||
unsigned sha3_width = 224;
|
||||
#endif
|
||||
|
||||
if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK) {
|
||||
/* -s and -w require -c */
|
||||
opt_complementary = "s?c:w?c";
|
||||
/* -b "binary", -t "text" are ignored (shaNNNsum compat) */
|
||||
#if ENABLE_SHA3SUM
|
||||
if (applet_name[3] == HASH_SHA3)
|
||||
flags = getopt32(argv, "scwbta:+", &sha3_width);
|
||||
else
|
||||
#endif
|
||||
flags = getopt32(argv, "scwbt");
|
||||
flags = getopt32(argv, "scwbt");
|
||||
argv += optind;
|
||||
//argc -= optind;
|
||||
} else {
|
||||
#if ENABLE_SHA3SUM
|
||||
if (applet_name[3] == HASH_SHA3)
|
||||
getopt32(argv, "a:+", &sha3_width);
|
||||
else
|
||||
#endif
|
||||
getopt32(argv, "");
|
||||
argv += 1;
|
||||
//argc -= 1;
|
||||
}
|
||||
argv += optind;
|
||||
//argc -= optind;
|
||||
if (!*argv)
|
||||
*--argv = (char*)"-";
|
||||
|
||||
if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && !(flags & FLAG_CHECK)) {
|
||||
if (flags & FLAG_SILENT) {
|
||||
bb_error_msg_and_die("-%c is meaningful only with -c", 's');
|
||||
}
|
||||
if (flags & FLAG_WARN) {
|
||||
bb_error_msg_and_die("-%c is meaningful only with -c", 'w');
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && (flags & FLAG_CHECK)) {
|
||||
FILE *pre_computed_stream;
|
||||
@@ -312,7 +225,7 @@ int md5_sha1_sum_main(int argc UNUSED_PARAM, char **argv)
|
||||
*filename_ptr = '\0';
|
||||
filename_ptr += 2;
|
||||
|
||||
hash_value = hash_file(filename_ptr, sha3_width);
|
||||
hash_value = hash_file(filename_ptr);
|
||||
|
||||
if (hash_value && (strcmp((char*)hash_value, line) == 0)) {
|
||||
if (!(flags & FLAG_SILENT))
|
||||
@@ -331,17 +244,9 @@ int md5_sha1_sum_main(int argc UNUSED_PARAM, char **argv)
|
||||
bb_error_msg("WARNING: %d of %d computed checksums did NOT match",
|
||||
count_failed, count_total);
|
||||
}
|
||||
if (count_total == 0) {
|
||||
return_value = EXIT_FAILURE;
|
||||
/*
|
||||
* md5sum from GNU coreutils 8.25 says:
|
||||
* md5sum: <FILE>: no properly formatted MD5 checksum lines found
|
||||
*/
|
||||
bb_error_msg("%s: no checksum lines found", *argv);
|
||||
}
|
||||
fclose_if_not_stdin(pre_computed_stream);
|
||||
} else {
|
||||
uint8_t *hash_value = hash_file(*argv, sha3_width);
|
||||
uint8_t *hash_value = hash_file(*argv);
|
||||
if (hash_value == NULL) {
|
||||
return_value = EXIT_FAILURE;
|
||||
} else {
|
||||
|
||||
+5
-19
@@ -6,32 +6,18 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/mkdir.html */
|
||||
|
||||
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
||||
*
|
||||
* Fixed broken permission setting when -p was used; especially in
|
||||
* conjunction with -m.
|
||||
*/
|
||||
|
||||
/* Nov 28, 2006 Yoshinori Sato <ysato@users.sourceforge.jp>: Add SELinux Support.
|
||||
*/
|
||||
//config:config MKDIR
|
||||
//config: bool "mkdir"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: mkdir is used to create directories with the specified names.
|
||||
//config:
|
||||
//config:config FEATURE_MKDIR_LONG_OPTIONS
|
||||
//config: bool "Enable long options"
|
||||
//config: default y
|
||||
//config: depends on MKDIR && LONG_OPTS
|
||||
//config: help
|
||||
//config: Support long options for the mkdir applet.
|
||||
|
||||
//applet:IF_MKDIR(APPLET_NOFORK(mkdir, mkdir, BB_DIR_BIN, BB_SUID_DROP, mkdir))
|
||||
|
||||
//kbuild:lib-$(CONFIG_MKDIR) += mkdir.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/mkdir.html */
|
||||
|
||||
//usage:#define mkdir_trivial_usage
|
||||
//usage: "[OPTIONS] DIRECTORY..."
|
||||
|
||||
@@ -6,16 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config MKFIFO
|
||||
//config: bool "mkfifo"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: mkfifo is used to create FIFOs (named pipes).
|
||||
//config: The 'mknod' program can also create FIFOs.
|
||||
|
||||
//applet:IF_MKFIFO(APPLET_NOEXEC(mkfifo, mkfifo, BB_DIR_USR_BIN, BB_SUID_DROP, mkfifo))
|
||||
|
||||
//kbuild:lib-$(CONFIG_MKFIFO) += mkfifo.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/mkfifo.html */
|
||||
|
||||
@@ -6,16 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config MKNOD
|
||||
//config: bool "mknod"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: mknod is used to create FIFOs or block/character special
|
||||
//config: files with the specified names.
|
||||
|
||||
//applet:IF_MKNOD(APPLET_NOEXEC(mknod, mknod, BB_DIR_BIN, BB_SUID_DROP, mknod))
|
||||
|
||||
//kbuild:lib-$(CONFIG_MKNOD) += mknod.o
|
||||
|
||||
/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
|
||||
|
||||
|
||||
+3
-18
@@ -7,26 +7,14 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
||||
*
|
||||
* Size reduction and improved error checking.
|
||||
*/
|
||||
//config:config MV
|
||||
//config: bool "mv"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: mv is used to move or rename files or directories.
|
||||
//config:
|
||||
//config:config FEATURE_MV_LONG_OPTIONS
|
||||
//config: bool "Enable long options"
|
||||
//config: default y
|
||||
//config: depends on MV && LONG_OPTS
|
||||
//config: help
|
||||
//config: Support long options for the mv applet.
|
||||
|
||||
//applet:IF_MV(APPLET(mv, BB_DIR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_MV) += mv.o
|
||||
#include "libbb.h"
|
||||
#include "libcoreutils/coreutils.h"
|
||||
|
||||
//usage:#define mv_trivial_usage
|
||||
//usage: "[-fin] SOURCE DEST\n"
|
||||
@@ -40,9 +28,6 @@
|
||||
//usage:#define mv_example_usage
|
||||
//usage: "$ mv /tmp/foo /bin/bar\n"
|
||||
|
||||
#include "libbb.h"
|
||||
#include "libcoreutils/coreutils.h"
|
||||
|
||||
#if ENABLE_FEATURE_MV_LONG_OPTIONS
|
||||
static const char mv_longopts[] ALIGN1 =
|
||||
"interactive\0" No_argument "i"
|
||||
|
||||
@@ -6,15 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config NICE
|
||||
//config: bool "nice"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: nice runs a program with modified scheduling priority.
|
||||
|
||||
//applet:IF_NICE(APPLET(nice, BB_DIR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_NICE) += nice.o
|
||||
|
||||
//usage:#define nice_trivial_usage
|
||||
//usage: "[-n ADJUST] [PROG ARGS]"
|
||||
|
||||
@@ -9,15 +9,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config NOHUP
|
||||
//config: bool "nohup"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: run a command immune to hangups, with output to a non-tty.
|
||||
|
||||
//applet:IF_NOHUP(APPLET(nohup, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_NOHUP) += nohup.o
|
||||
|
||||
//usage:#define nohup_trivial_usage
|
||||
//usage: "PROG ARGS"
|
||||
|
||||
@@ -10,15 +10,6 @@
|
||||
*
|
||||
* Original copyright notice is retained at the end of this file.
|
||||
*/
|
||||
//config:config OD
|
||||
//config: bool "od"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: od is used to dump binary files in octal and other formats.
|
||||
|
||||
//applet:IF_OD(APPLET(od, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_OD) += od.o
|
||||
|
||||
//usage:#if !ENABLE_DESKTOP
|
||||
//usage:#define od_trivial_usage
|
||||
|
||||
@@ -62,7 +62,7 @@ enum {
|
||||
};
|
||||
|
||||
#define OD_GETOPT32() getopt32(argv, \
|
||||
"A:N:abcdfhij:lot:*vxsS:w:+:", \
|
||||
"A:N:abcdfhij:lot:vxsS:w::", \
|
||||
/* -w with optional param */ \
|
||||
/* -S was -s and also had optional parameter */ \
|
||||
/* but in coreutils 6.3 it was renamed and now has */ \
|
||||
@@ -1212,6 +1212,7 @@ int od_main(int argc UNUSED_PARAM, char **argv)
|
||||
address_pad_len_char = '7';
|
||||
|
||||
/* Parse command line */
|
||||
opt_complementary = "w+:t::"; /* -w N, -t is a list */
|
||||
#if ENABLE_LONG_OPTS
|
||||
applet_long_options = od_longopts;
|
||||
#endif
|
||||
|
||||
@@ -7,15 +7,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config PRINTENV
|
||||
//config: bool "printenv"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: printenv is used to print all or part of environment.
|
||||
|
||||
//applet:IF_PRINTENV(APPLET_NOFORK(printenv, printenv, BB_DIR_BIN, BB_SUID_DROP, printenv))
|
||||
|
||||
//kbuild:lib-$(CONFIG_PRINTENV) += printenv.o
|
||||
|
||||
//usage:#define printenv_trivial_usage
|
||||
//usage: "[VARIABLE]..."
|
||||
|
||||
@@ -38,17 +38,6 @@
|
||||
|
||||
/* 19990508 Busy Boxed! Dave Cinege */
|
||||
|
||||
//config:config PRINTF
|
||||
//config: bool "printf"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: printf is used to format and print specified strings.
|
||||
//config: It's similar to `echo' except it has more options.
|
||||
|
||||
//applet:IF_PRINTF(APPLET_NOFORK(printf, printf, BB_DIR_USR_BIN, BB_SUID_DROP, printf))
|
||||
|
||||
//kbuild:lib-$(CONFIG_PRINTF) += printf.o
|
||||
|
||||
//usage:#define printf_trivial_usage
|
||||
//usage: "FORMAT [ARG]..."
|
||||
//usage:#define printf_full_usage "\n\n"
|
||||
|
||||
+2
-9
@@ -6,15 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config PWD
|
||||
//config: bool "pwd"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: pwd is used to print the current directory.
|
||||
|
||||
//applet:IF_PWD(APPLET_NOFORK(pwd, pwd, BB_DIR_BIN, BB_SUID_DROP, pwd))
|
||||
|
||||
//kbuild:lib-$(CONFIG_PWD) += pwd.o
|
||||
|
||||
//usage:#define pwd_trivial_usage
|
||||
//usage: ""
|
||||
@@ -27,6 +18,8 @@
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
static int logical_getcwd(void)
|
||||
{
|
||||
struct stat st1;
|
||||
|
||||
@@ -6,23 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config READLINK
|
||||
//config: bool "readlink"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: This program reads a symbolic link and returns the name
|
||||
//config: of the file it points to
|
||||
//config:
|
||||
//config:config FEATURE_READLINK_FOLLOW
|
||||
//config: bool "Enable canonicalization by following all symlinks (-f)"
|
||||
//config: default y
|
||||
//config: depends on READLINK
|
||||
//config: help
|
||||
//config: Enable the readlink option (-f).
|
||||
|
||||
//applet:IF_READLINK(APPLET(readlink, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_READLINK) += readlink.o
|
||||
|
||||
//usage:#define readlink_trivial_usage
|
||||
//usage: IF_FEATURE_READLINK_FOLLOW("[-fnv] ") "FILE"
|
||||
|
||||
+3
-12
@@ -1,4 +1,7 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
|
||||
/* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */
|
||||
|
||||
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
||||
*
|
||||
* Now does proper error checking on output and returns a failure exit code
|
||||
@@ -6,18 +9,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config REALPATH
|
||||
//config: bool "realpath"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: Return the canonicalized absolute pathname.
|
||||
//config: This isn't provided by GNU shellutils, but where else does it belong.
|
||||
|
||||
//applet:IF_REALPATH(APPLET(realpath, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_REALPATH) += realpath.o
|
||||
|
||||
/* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */
|
||||
|
||||
//usage:#define realpath_trivial_usage
|
||||
//usage: "FILE..."
|
||||
|
||||
+4
-12
@@ -6,22 +6,14 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/rm.html */
|
||||
|
||||
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
||||
*
|
||||
* Size reduction.
|
||||
*/
|
||||
//config:config RM
|
||||
//config: bool "rm"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: rm is used to remove files or directories.
|
||||
|
||||
//applet:IF_RM(APPLET_NOFORK(rm, rm, BB_DIR_BIN, BB_SUID_DROP, rm))
|
||||
|
||||
//kbuild:lib-$(CONFIG_RM) += rm.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/rm.html */
|
||||
|
||||
//usage:#define rm_trivial_usage
|
||||
//usage: "[-irf] FILE..."
|
||||
|
||||
@@ -6,23 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config RMDIR
|
||||
//config: bool "rmdir"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: rmdir is used to remove empty directories.
|
||||
//config:
|
||||
//config:config FEATURE_RMDIR_LONG_OPTIONS
|
||||
//config: bool "Enable long options"
|
||||
//config: default y
|
||||
//config: depends on RMDIR && LONG_OPTS
|
||||
//config: help
|
||||
//config: Support long options for the rmdir applet, including
|
||||
//config: --ignore-fail-on-non-empty for compatibility with GNU rmdir.
|
||||
|
||||
//applet:IF_RMDIR(APPLET_NOFORK(rmdir, rmdir, BB_DIR_BIN, BB_SUID_DROP, rmdir))
|
||||
|
||||
//kbuild:lib-$(CONFIG_RMDIR) += rmdir.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/rmdir.html */
|
||||
|
||||
@@ -6,15 +6,6 @@
|
||||
*
|
||||
* Licensed under GPLv2, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config SEQ
|
||||
//config: bool "seq"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: print a sequence of numbers
|
||||
|
||||
//applet:IF_SEQ(APPLET_NOFORK(seq, seq, BB_DIR_USR_BIN, BB_SUID_DROP, seq))
|
||||
|
||||
//kbuild:lib-$(CONFIG_SEQ) += seq.o
|
||||
|
||||
//usage:#define seq_trivial_usage
|
||||
//usage: "[-w] [-s SEP] [FIRST [INC]] LAST"
|
||||
|
||||
+8
-36
@@ -6,48 +6,17 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* BB_AUDIT GNU issues -- fancy version matches except args must be ints. */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/sleep.html */
|
||||
|
||||
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
||||
*
|
||||
* Rewritten to do proper arg and error checking.
|
||||
* Also, added a 'fancy' configuration to accept multiple args with
|
||||
* time suffixes for seconds, minutes, hours, and days.
|
||||
*/
|
||||
//config:config SLEEP
|
||||
//config: bool "sleep"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: sleep is used to pause for a specified number of seconds.
|
||||
//config: It comes in 3 versions:
|
||||
//config: - small: takes one integer parameter
|
||||
//config: - fancy: takes multiple integer arguments with suffixes:
|
||||
//config: sleep 1d 2h 3m 15s
|
||||
//config: - fancy with fractional numbers:
|
||||
//config: sleep 2.3s 4.5h sleeps for 16202.3 seconds
|
||||
//config: Last one is "the most compatible" with coreutils sleep,
|
||||
//config: but it adds around 1k of code.
|
||||
//config:
|
||||
//config:config FEATURE_FANCY_SLEEP
|
||||
//config: bool "Enable multiple arguments and s/m/h/d suffixes"
|
||||
//config: default y
|
||||
//config: depends on SLEEP
|
||||
//config: help
|
||||
//config: Allow sleep to pause for specified minutes, hours, and days.
|
||||
//config:
|
||||
//config:config FEATURE_FLOAT_SLEEP
|
||||
//config: bool "Enable fractional arguments"
|
||||
//config: default y
|
||||
//config: depends on FEATURE_FANCY_SLEEP
|
||||
//config: help
|
||||
//config: Allow for fractional numeric parameters.
|
||||
|
||||
/* Do not make this applet NOFORK. It breaks ^C-ing of pauses in shells */
|
||||
//applet:IF_SLEEP(APPLET(sleep, BB_DIR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_SLEEP) += sleep.o
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* BB_AUDIT GNU issues -- fancy version matches except args must be ints. */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/sleep.html */
|
||||
|
||||
//usage:#define sleep_trivial_usage
|
||||
//usage: IF_FEATURE_FANCY_SLEEP("[") "N" IF_FEATURE_FANCY_SLEEP("]...")
|
||||
@@ -66,6 +35,9 @@
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
/* Do not make this applet NOFORK. It breaks ^C-ing of pauses in shells */
|
||||
|
||||
|
||||
#if ENABLE_FEATURE_FANCY_SLEEP || ENABLE_FEATURE_FLOAT_SLEEP
|
||||
static const struct suffix_mult sfx[] = {
|
||||
{ "s", 1 },
|
||||
|
||||
+3
-23
@@ -11,27 +11,6 @@
|
||||
* See SuS3 sort standard at:
|
||||
* http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html
|
||||
*/
|
||||
//config:config SORT
|
||||
//config: bool "sort"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: sort is used to sort lines of text in specified files.
|
||||
//config:
|
||||
//config:config FEATURE_SORT_BIG
|
||||
//config: bool "Full SuSv3 compliant sort (support -ktcsbdfiozgM)"
|
||||
//config: default y
|
||||
//config: depends on SORT
|
||||
//config: help
|
||||
//config: Without this, sort only supports -r, -u, and an integer version
|
||||
//config: of -n. Selecting this adds sort keys, floating point support, and
|
||||
//config: more. This adds a little over 3k to a nonstatic build on x86.
|
||||
//config:
|
||||
//config: The SuSv3 sort standard is available at:
|
||||
//config: http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html
|
||||
|
||||
//applet:IF_SORT(APPLET_NOEXEC(sort, sort, BB_DIR_USR_BIN, BB_SUID_DROP, sort))
|
||||
|
||||
//kbuild:lib-$(CONFIG_SORT) += sort.o
|
||||
|
||||
//usage:#define sort_trivial_usage
|
||||
//usage: "[-nru"
|
||||
@@ -94,7 +73,7 @@
|
||||
*/
|
||||
|
||||
/* These are sort types */
|
||||
static const char OPT_STR[] ALIGN1 = "ngMucszbrdfimS:T:o:k:*t:";
|
||||
static const char OPT_STR[] ALIGN1 = "ngMucszbrdfimS:T:o:k:t:";
|
||||
enum {
|
||||
FLAG_n = 1, /* Numeric sort */
|
||||
FLAG_g = 2, /* Sort using strtod() */
|
||||
@@ -379,7 +358,8 @@ int sort_main(int argc UNUSED_PARAM, char **argv)
|
||||
|
||||
/* Parse command line options */
|
||||
/* -o and -t can be given at most once */
|
||||
opt_complementary = "o--o:t--t"; /* -t, -o: at most one of each */
|
||||
opt_complementary = "o--o:t--t:" /* -t, -o: at most one of each */
|
||||
"k::"; /* -k takes list */
|
||||
opts = getopt32(argv, OPT_STR, &str_ignored, &str_ignored, &str_o, &lst_k, &str_t);
|
||||
/* global b strips leading and trailing spaces */
|
||||
if (opts & FLAG_b)
|
||||
|
||||
+2
-21
@@ -5,25 +5,6 @@
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
//config:config SPLIT
|
||||
//config: bool "split"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: split a file into pieces.
|
||||
//config:
|
||||
//config:config FEATURE_SPLIT_FANCY
|
||||
//config: bool "Fancy extensions"
|
||||
//config: default y
|
||||
//config: depends on SPLIT
|
||||
//config: help
|
||||
//config: Add support for features not required by SUSv3.
|
||||
//config: Supports additional suffixes 'b' for 512 bytes,
|
||||
//config: 'g' for 1GiB for the -b option.
|
||||
|
||||
//applet:IF_SPLIT(APPLET(split, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_SPLIT) += split.o
|
||||
|
||||
/* BB_AUDIT: SUSv3 compliant
|
||||
* SUSv3 requirements:
|
||||
* http://www.opengroup.org/onlinepubs/009695399/utilities/split.html
|
||||
@@ -100,8 +81,8 @@ int split_main(int argc UNUSED_PARAM, char **argv)
|
||||
|
||||
setup_common_bufsiz();
|
||||
|
||||
opt_complementary = "?2"; /* max 2 args; -a N */
|
||||
opt = getopt32(argv, "l:b:a:+", &count_p, &count_p, &suffix_len);
|
||||
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 = XATOOFF(count_p);
|
||||
|
||||
@@ -36,9 +36,6 @@
|
||||
//config: Without this, stat will not support the '-f' option to display
|
||||
//config: information about filesystem status.
|
||||
|
||||
//applet:IF_STAT(APPLET(stat, BB_DIR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_STAT) += stat.o
|
||||
|
||||
//usage:#define stat_trivial_usage
|
||||
//usage: "[OPTIONS] FILE..."
|
||||
|
||||
+1
-9
@@ -18,16 +18,8 @@
|
||||
David MacKenzie <djm@gnu.ai.mit.edu>
|
||||
|
||||
Special for busybox ported by Vladimir Oleynik <dzo@simtreas.ru> 2001
|
||||
*/
|
||||
//config:config STTY
|
||||
//config: bool "stty"
|
||||
//config: default y
|
||||
//config: help
|
||||
//config: stty is used to change and print terminal line settings.
|
||||
|
||||
//applet:IF_STTY(APPLET(stty, BB_DIR_BIN, BB_SUID_DROP))
|
||||
|
||||
//kbuild:lib-$(CONFIG_STTY) += stty.o
|
||||
*/
|
||||
|
||||
//usage:#define stty_trivial_usage
|
||||
//usage: "[-a|g] [-F DEVICE] [SETTING]..."
|
||||
|
||||
Loaded 100 of 804 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user