Compare commits
199
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e73f3c1d3d | ||
|
|
64406a92a0 | ||
|
|
0cfba07fcd | ||
|
|
4609f477c7 | ||
|
|
31dc8603ee | ||
|
|
2f5b5beb28 | ||
|
|
81fa999540 | ||
|
|
2cfcc9e9d7 | ||
|
|
9980707efc | ||
|
|
9daf33fc52 | ||
|
|
7c4b13e019 | ||
|
|
5d78355d5a | ||
|
|
5ca853e5da | ||
|
|
20c5e5a626 | ||
|
|
e4f0f26bad | ||
|
|
5368fe541c | ||
|
|
406ea15e2c | ||
|
|
970aa6b5bd | ||
|
|
8fb3ab528e | ||
|
|
8e7312e12f | ||
|
|
5b7f50f372 | ||
|
|
ac4100e103 | ||
|
|
a55df27936 | ||
|
|
07a54e21dd | ||
|
|
6830ade6aa | ||
|
|
30a8652fbf | ||
|
|
60cb48ca50 | ||
|
|
b8173b603f | ||
|
|
b7841cf7b9 | ||
|
|
90801dadfa | ||
|
|
6928d9f049 | ||
|
|
6967578728 | ||
|
|
5218515508 | ||
|
|
07b419dbcb | ||
|
|
a58f7b7d2f | ||
|
|
cd776cf967 | ||
|
|
d189b598b4 | ||
|
|
3917fa32dc | ||
|
|
fb499c5752 | ||
|
|
a38f9faa9f | ||
|
|
12677acf0a | ||
|
|
393c395ca5 | ||
|
|
4d5955e9ec | ||
|
|
a8461173ba | ||
|
|
c71547ccfc | ||
|
|
4ba6c5d3ba | ||
|
|
e4b9451413 | ||
|
|
3f21044f20 | ||
|
|
a803bfa0f0 | ||
|
|
11181335f9 | ||
|
|
d2d5049c1d | ||
|
|
5694afd72a | ||
|
|
67dc7b21ca | ||
|
|
3aeb870b22 | ||
|
|
98f6b2d399 | ||
|
|
da0200a1e5 | ||
|
|
eab343e7e1 | ||
|
|
8dc6d1a813 | ||
|
|
fd77ea505e | ||
|
|
32711c4141 | ||
|
|
d527588882 | ||
|
|
f47ce07b26 | ||
|
|
1c7a58dfb8 | ||
|
|
d109798882 | ||
|
|
b2320370be | ||
|
|
9371043698 | ||
|
|
225cc1327a | ||
|
|
c4f2d997a4 | ||
|
|
73a1990897 | ||
|
|
06a98e32ae | ||
|
|
0b4980c252 | ||
|
|
ffe03f04cb | ||
|
|
42be921d48 | ||
|
|
2fb8d0dee9 | ||
|
|
3c62bbae94 | ||
|
|
0ffd63ca9a | ||
|
|
57f07bfcb2 | ||
|
|
aca464ddac | ||
|
|
6d463de46b | ||
|
|
2dc1a97272 | ||
|
|
9e71e3cea5 | ||
|
|
50157f3dec | ||
|
|
c439851438 | ||
|
|
d1d794fd48 | ||
|
|
9b80b903c7 | ||
|
|
b7812ce0f7 | ||
|
|
168f87c531 | ||
|
|
5f10fdf1dd | ||
|
|
c5a9fa2d2a | ||
|
|
8019b3a7ae | ||
|
|
11f2c0d4f8 | ||
|
|
405dafffbb | ||
|
|
a0fd4a789c | ||
|
|
41f7885f06 | ||
|
|
9c55143bbf | ||
|
|
45c35e9de0 | ||
|
|
dba7094d62 | ||
|
|
6567edd10b | ||
|
|
4919565c15 | ||
|
|
2ffd710656 | ||
|
|
ca81a93722 | ||
|
|
293c94564c | ||
|
|
0e941d5427 | ||
|
|
5cfb818181 | ||
|
|
71045cc819 | ||
|
|
d3a42391b1 | ||
|
|
32f774cd34 | ||
|
|
e565383fd5 | ||
|
|
37a79c092e | ||
|
|
dbed6c4b46 | ||
|
|
df8066a78c | ||
|
|
e1db338a51 | ||
|
|
3bb858765e | ||
|
|
566a313a7f | ||
|
|
b5c7220e7b | ||
|
|
5345b8db8b | ||
|
|
c5fe9f7b72 | ||
|
|
9ad8979ff1 | ||
|
|
ea664dde87 | ||
|
|
440a509849 | ||
|
|
d52c9510fd | ||
|
|
6ebb2b6b24 | ||
|
|
a396ade9f8 | ||
|
|
c9a13116a4 | ||
|
|
9ee4266490 | ||
|
|
1d7ad7a022 | ||
|
|
2bc495e4c4 | ||
|
|
dac8e79a19 | ||
|
|
e3e0d2b812 | ||
|
|
9b78e14dfb | ||
|
|
aacd448601 | ||
|
|
e0a6004ce8 | ||
|
|
6144124aac | ||
|
|
c5b01016e6 | ||
|
|
604499e5a9 | ||
|
|
bf146b8610 | ||
|
|
f5abc78579 | ||
|
|
ac42e3de90 | ||
|
|
6979325592 | ||
|
|
772f17a843 | ||
|
|
ac164dd2a7 | ||
|
|
70fc8c17e2 | ||
|
|
588e284f53 | ||
|
|
39f82d4309 | ||
|
|
0ccae4d8b3 | ||
|
|
d3dff879f0 | ||
|
|
04b52892ed | ||
|
|
4125a6b630 | ||
|
|
0a393cf7da | ||
|
|
93c32f2dd2 | ||
|
|
605f2641d8 | ||
|
|
c9677ed83c | ||
|
|
bd01f22986 | ||
|
|
3645195377 | ||
|
|
a1ec841913 | ||
|
|
64f763b42a | ||
|
|
49b8e72012 | ||
|
|
52de9c7141 | ||
|
|
cfc212cdff | ||
|
|
f451b2cfe0 | ||
|
|
37ca36a711 | ||
|
|
ba1d561d76 | ||
|
|
84406e459b | ||
|
|
c35545a100 | ||
|
|
21f6fbf545 | ||
|
|
21f620f6e5 | ||
|
|
085b293338 | ||
|
|
02112d8ae3 | ||
|
|
dfc2473b9e | ||
|
|
6e9284db78 | ||
|
|
25cb5aae2b | ||
|
|
aaf827203d | ||
|
|
0446104137 | ||
|
|
b6beada5a1 | ||
|
|
ea57f51819 | ||
|
|
8d11854678 | ||
|
|
516530c932 | ||
|
|
7c8aa2b47c | ||
|
|
0133921726 | ||
|
|
be1cfeea2e | ||
|
|
4a6a56c778 | ||
|
|
02b8b9b014 | ||
|
|
a5ee090e86 | ||
|
|
f1f8fcaad5 | ||
|
|
3698ed1ca1 | ||
|
|
8c3439554a | ||
|
|
44642d1ec1 | ||
|
|
556ac3633c | ||
|
|
3da46c8163 | ||
|
|
d133144d41 | ||
|
|
576b1d3c41 | ||
|
|
0c62f20454 | ||
|
|
deee356a62 | ||
|
|
9d75370238 | ||
|
|
eced0c78a5 | ||
|
|
b84dafb5e5 | ||
|
|
e39afe1fbd | ||
|
|
3a9365e273 | ||
|
|
b9d494453d |
No files matched your search
@@ -310,7 +310,18 @@ config FEATURE_PIDFILE
|
||||
default y
|
||||
help
|
||||
This option makes some applets (e.g. crond, syslogd, inetd) write
|
||||
a pidfile in /var/run. Some applications rely on them.
|
||||
a pidfile at the configured PID_FILE_PATH. It has no effect
|
||||
on applets which require pidfiles to run.
|
||||
|
||||
config PID_FILE_PATH
|
||||
string "Path to directory for pidfile"
|
||||
default "/var/run"
|
||||
depends on FEATURE_PIDFILE
|
||||
help
|
||||
This is the default path where pidfiles are created. Applets which
|
||||
allow you to set the pidfile path on the command line will override
|
||||
this value. The option has no effect on applets that require you to
|
||||
specify a pidfile path.
|
||||
|
||||
config FEATURE_SUID
|
||||
bool "Support for SUID/SGID handling"
|
||||
@@ -321,7 +332,7 @@ config FEATURE_SUID
|
||||
root-level operations even when run by ordinary users
|
||||
(for example, mounting of user mounts in fstab needs this).
|
||||
|
||||
Busybox will automatically drop priviledges for applets
|
||||
Busybox will automatically drop privileges for applets
|
||||
that don't need root access.
|
||||
|
||||
If you are really paranoid and don't want to do this, build two
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
VERSION = 1
|
||||
PATCHLEVEL = 20
|
||||
SUBLEVEL = 2
|
||||
PATCHLEVEL = 21
|
||||
SUBLEVEL = 1
|
||||
EXTRAVERSION =
|
||||
NAME = Unnamed
|
||||
|
||||
@@ -297,6 +297,7 @@ NM = $(CROSS_COMPILE)nm
|
||||
STRIP = $(CROSS_COMPILE)strip
|
||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
OBJDUMP = $(CROSS_COMPILE)objdump
|
||||
PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
|
||||
AWK = awk
|
||||
GENKSYMS = scripts/genksyms/genksyms
|
||||
DEPMOD = /sbin/depmod
|
||||
|
||||
+15
-1
@@ -25,6 +25,7 @@ CFLAGS += $(call cc-option,-Wstrict-prototypes,)
|
||||
CFLAGS += $(call cc-option,-Wunused -Wunused-parameter,)
|
||||
CFLAGS += $(call cc-option,-Wunused-function -Wunused-value,)
|
||||
CFLAGS += $(call cc-option,-Wmissing-prototypes -Wmissing-declarations,)
|
||||
CFLAGS += $(call cc-option,-Wno-format-security,)
|
||||
# warn about C99 declaration after statement
|
||||
CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
|
||||
# If you want to add more -Wsomething above, make sure that it is
|
||||
@@ -52,6 +53,9 @@ CFLAGS += $(call cc-option,-fno-builtin-strlen -finline-limit=0 -fomit-frame-poi
|
||||
CFLAGS += $(call cc-option,-fno-guess-branch-probability,)
|
||||
CFLAGS += $(call cc-option,-funsigned-char -static-libgcc,)
|
||||
CFLAGS += $(call cc-option,-falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1,)
|
||||
# Defeat .eh_frame bloat (gcc 4.6.3 x86-32 defconfig: 20% smaller busybox binary):
|
||||
CFLAGS += $(call cc-option,-fno-unwind-tables,)
|
||||
CFLAGS += $(call cc-option,-fno-asynchronous-unwind-tables,)
|
||||
|
||||
# FIXME: These warnings are at least partially to be concerned about and should
|
||||
# be fixed..
|
||||
@@ -74,6 +78,12 @@ ARCH_FPIC ?= -fpic
|
||||
ARCH_FPIE ?= -fpie
|
||||
ARCH_PIE ?= -pie
|
||||
|
||||
# Usage: $(eval $(call pkg_check_modules,VARIABLE-PREFIX,MODULES))
|
||||
define pkg_check_modules
|
||||
$(1)_CFLAGS := $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags $(2))
|
||||
$(1)_LIBS := $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs $(2))
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_BUILD_LIBBUSYBOX),y)
|
||||
# on i386: 14% smaller libbusybox.so
|
||||
# (code itself is 9% bigger, we save on relocs/PLT/GOT)
|
||||
@@ -85,6 +95,7 @@ endif
|
||||
|
||||
ifeq ($(CONFIG_STATIC),y)
|
||||
CFLAGS_busybox += -static
|
||||
PKG_CONFIG_FLAGS += --static
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PIE),y)
|
||||
@@ -127,7 +138,10 @@ LDLIBS += pam pam_misc pthread
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SELINUX),y)
|
||||
LDLIBS += selinux sepol
|
||||
SELINUX_PC_MODULES = libselinux libsepol
|
||||
$(eval $(call pkg_check_modules,SELINUX,$(SELINUX_PC_MODULES)))
|
||||
CPPFLAGS += $(SELINUX_CFLAGS)
|
||||
LDLIBS += $(if $(SELINUX_LIBS),$(SELINUX_LIBS:-l%=%),$(SELINUX_PC_MODULES:lib%=%))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EFENCE),y)
|
||||
|
||||
@@ -14,7 +14,7 @@ const char *applet_name;
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
applet_name = argv[0];
|
||||
return APPLET_main(argc,argv);
|
||||
return APPLET_main(argc, argv);
|
||||
}
|
||||
|
||||
void bb_show_usage(void)
|
||||
|
||||
+15
-15
@@ -253,24 +253,24 @@ static NOINLINE int cpio_o(void)
|
||||
}
|
||||
|
||||
bytes += printf("070701"
|
||||
"%08X%08X%08X%08X%08X%08X%08X"
|
||||
"%08X%08X%08X%08X" /* GNU cpio uses uppercase hex */
|
||||
"%08X%08X%08X%08X%08X%08X%08X"
|
||||
"%08X%08X%08X%08X" /* GNU cpio uses uppercase hex */
|
||||
/* strlen+1: */ "%08X"
|
||||
/* chksum: */ "00000000" /* (only for "070702" files) */
|
||||
/* name,NUL: */ "%s%c",
|
||||
(unsigned)(uint32_t) st.st_ino,
|
||||
(unsigned)(uint32_t) st.st_mode,
|
||||
(unsigned)(uint32_t) st.st_uid,
|
||||
(unsigned)(uint32_t) st.st_gid,
|
||||
(unsigned)(uint32_t) st.st_nlink,
|
||||
(unsigned)(uint32_t) st.st_mtime,
|
||||
(unsigned)(uint32_t) st.st_size,
|
||||
(unsigned)(uint32_t) major(st.st_dev),
|
||||
(unsigned)(uint32_t) minor(st.st_dev),
|
||||
(unsigned)(uint32_t) major(st.st_rdev),
|
||||
(unsigned)(uint32_t) minor(st.st_rdev),
|
||||
(unsigned)(strlen(name) + 1),
|
||||
name, '\0');
|
||||
(unsigned)(uint32_t) st.st_ino,
|
||||
(unsigned)(uint32_t) st.st_mode,
|
||||
(unsigned)(uint32_t) st.st_uid,
|
||||
(unsigned)(uint32_t) st.st_gid,
|
||||
(unsigned)(uint32_t) st.st_nlink,
|
||||
(unsigned)(uint32_t) st.st_mtime,
|
||||
(unsigned)(uint32_t) st.st_size,
|
||||
(unsigned)(uint32_t) major(st.st_dev),
|
||||
(unsigned)(uint32_t) minor(st.st_dev),
|
||||
(unsigned)(uint32_t) major(st.st_rdev),
|
||||
(unsigned)(uint32_t) minor(st.st_rdev),
|
||||
(unsigned)(strlen(name) + 1),
|
||||
name, '\0');
|
||||
bytes = cpio_pad4(bytes);
|
||||
|
||||
if (st.st_size) {
|
||||
|
||||
+12
-7
@@ -1026,8 +1026,8 @@ static int check_deps(deb_file_t **deb_file, int deb_start /*, int dep_max_count
|
||||
if (package_edge->type == EDGE_CONFLICTS) {
|
||||
const unsigned package_num =
|
||||
search_package_hashtable(package_edge->name,
|
||||
package_edge->version,
|
||||
package_edge->operator);
|
||||
package_edge->version,
|
||||
package_edge->operator);
|
||||
int result = 0;
|
||||
if (package_hashtable[package_num] != NULL) {
|
||||
status_num = search_status_hashtable(name_hashtable[package_hashtable[package_num]->name]);
|
||||
@@ -1114,7 +1114,7 @@ static int check_deps(deb_file_t **deb_file, int deb_start /*, int dep_max_count
|
||||
*/
|
||||
if (root_of_alternatives && package_edge->type != root_of_alternatives->type - 1)
|
||||
bb_error_msg_and_die("fatal error, package dependencies corrupt: %d != %d - 1",
|
||||
package_edge->type, root_of_alternatives->type);
|
||||
package_edge->type, root_of_alternatives->type);
|
||||
|
||||
if (package_hashtable[package_num] != NULL)
|
||||
result = !package_satisfies_dependency(package_num, package_edge->type);
|
||||
@@ -1665,20 +1665,25 @@ static void unpack_package(deb_file_t *deb_file)
|
||||
archive_handle = init_archive_deb_ar(deb_file->filename);
|
||||
init_archive_deb_data(archive_handle);
|
||||
archive_handle->dpkg__sub_archive->accept = conffile_list;
|
||||
/* Why ARCHIVE_REMEMBER_NAMES?
|
||||
* We want names collected in ->passed list even if conffile_list
|
||||
* is NULL (otherwise get_header_tar may optimize name saving out):
|
||||
*/
|
||||
archive_handle->dpkg__sub_archive->ah_flags |= ARCHIVE_REMEMBER_NAMES | ARCHIVE_UNLINK_OLD;
|
||||
archive_handle->dpkg__sub_archive->filter = filter_rename_config;
|
||||
archive_handle->dpkg__sub_archive->action_data = data_extract_all_prefix;
|
||||
archive_handle->dpkg__sub_archive->dpkg__buffer = (char*)"/"; /* huh? */
|
||||
archive_handle->dpkg__sub_archive->ah_flags |= ARCHIVE_UNLINK_OLD;
|
||||
unpack_ar_archive(archive_handle);
|
||||
|
||||
/* Create the list file */
|
||||
list_filename = xasprintf("/var/lib/dpkg/info/%s.%s", package_name, "list");
|
||||
out_stream = xfopen_for_write(list_filename);
|
||||
archive_handle->dpkg__sub_archive->passed = llist_rev(archive_handle->dpkg__sub_archive->passed);
|
||||
while (archive_handle->dpkg__sub_archive->passed) {
|
||||
char *filename = llist_pop(&archive_handle->dpkg__sub_archive->passed);
|
||||
/* the leading . has been stripped by data_extract_all_prefix already */
|
||||
fputs(archive_handle->dpkg__sub_archive->passed->data, out_stream);
|
||||
fputc('\n', out_stream);
|
||||
archive_handle->dpkg__sub_archive->passed = archive_handle->dpkg__sub_archive->passed->link;
|
||||
fprintf(out_stream, "%s\n", filename);
|
||||
free(filename);
|
||||
}
|
||||
fclose(out_stream);
|
||||
|
||||
|
||||
+8
-8
@@ -1179,7 +1179,7 @@ static void gen_codes(ct_data * tree, int max_code)
|
||||
* must be all ones.
|
||||
*/
|
||||
Assert(code + G2.bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1,
|
||||
"inconsistent bit counts");
|
||||
"inconsistent bit counts");
|
||||
Tracev((stderr, "\ngen_codes: max_code %d ", max_code));
|
||||
|
||||
for (n = 0; n <= max_code; n++) {
|
||||
@@ -1527,9 +1527,9 @@ static int ct_tally(int dist, int lc)
|
||||
}
|
||||
out_length >>= 3;
|
||||
Trace((stderr,
|
||||
"\nlast_lit %u, last_dist %u, in %ld, out ~%ld(%ld%%) ",
|
||||
G2.last_lit, G2.last_dist, in_length, out_length,
|
||||
100L - out_length * 100L / in_length));
|
||||
"\nlast_lit %u, last_dist %u, in %ld, out ~%ld(%ld%%) ",
|
||||
G2.last_lit, G2.last_dist, in_length, out_length,
|
||||
100L - out_length * 100L / in_length));
|
||||
if (G2.last_dist < G2.last_lit / 2 && out_length < in_length / 2)
|
||||
return 1;
|
||||
}
|
||||
@@ -1621,9 +1621,9 @@ static ulg flush_block(char *buf, ulg stored_len, int eof)
|
||||
static_lenb = (G2.static_len + 3 + 7) >> 3;
|
||||
|
||||
Trace((stderr,
|
||||
"\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u dist %u ",
|
||||
opt_lenb, G2.opt_len, static_lenb, G2.static_len, stored_len,
|
||||
G2.last_lit, G2.last_dist));
|
||||
"\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u dist %u ",
|
||||
opt_lenb, G2.opt_len, static_lenb, G2.static_len, stored_len,
|
||||
G2.last_lit, G2.last_dist));
|
||||
|
||||
if (static_lenb <= opt_lenb)
|
||||
opt_lenb = static_lenb;
|
||||
@@ -1661,7 +1661,7 @@ static ulg flush_block(char *buf, ulg stored_len, int eof)
|
||||
} else {
|
||||
send_bits((DYN_TREES << 1) + eof, 3);
|
||||
send_all_trees(G2.l_desc.max_code + 1, G2.d_desc.max_code + 1,
|
||||
max_blindex + 1);
|
||||
max_blindex + 1);
|
||||
compress_block((ct_data *) G2.dyn_ltree, (ct_data *) G2.dyn_dtree);
|
||||
G2.compressed_len += 3 + G2.opt_len;
|
||||
}
|
||||
|
||||
@@ -293,8 +293,8 @@ static unsigned fill_bitbuffer(STATE_PARAM unsigned bitbuffer, unsigned *current
|
||||
* m: maximum lookup bits, returns actual
|
||||
*/
|
||||
static int huft_build(const unsigned *b, const unsigned n,
|
||||
const unsigned s, const unsigned short *d,
|
||||
const unsigned char *e, huft_t **t, unsigned *m)
|
||||
const unsigned s, const unsigned short *d,
|
||||
const unsigned char *e, huft_t **t, unsigned *m)
|
||||
{
|
||||
unsigned a; /* counter for codes of length k */
|
||||
unsigned c[BMAX + 1]; /* bit length count table */
|
||||
|
||||
@@ -78,7 +78,6 @@ unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd)
|
||||
IF_DESKTOP(long long total_written = 0;)
|
||||
IF_DESKTOP(long long) int retval = -1;
|
||||
unsigned char *stackp;
|
||||
long code;
|
||||
int finchar;
|
||||
long oldcode;
|
||||
long incode;
|
||||
@@ -143,8 +142,10 @@ unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd)
|
||||
/* As above, initialize the first 256 entries in the table. */
|
||||
/*clear_tab_prefixof(); - done by xzalloc */
|
||||
|
||||
for (code = 255; code >= 0; --code) {
|
||||
tab_suffixof(code) = (unsigned char) code;
|
||||
{
|
||||
int i;
|
||||
for (i = 255; i >= 0; --i)
|
||||
tab_suffixof(i) = (unsigned char) i;
|
||||
}
|
||||
|
||||
do {
|
||||
@@ -175,6 +176,8 @@ unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd)
|
||||
(insize << 3) - (n_bits - 1));
|
||||
|
||||
while (inbits > posbits) {
|
||||
long code;
|
||||
|
||||
if (free_ent > maxcode) {
|
||||
posbits =
|
||||
((posbits - 1) +
|
||||
@@ -191,13 +194,12 @@ unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd)
|
||||
}
|
||||
{
|
||||
unsigned char *p = &inbuf[posbits >> 3];
|
||||
|
||||
code = ((((long) (p[0])) | ((long) (p[1]) << 8) |
|
||||
((long) (p[2]) << 16)) >> (posbits & 0x7)) & bitmask;
|
||||
code = ((p[0]
|
||||
| ((long) (p[1]) << 8)
|
||||
| ((long) (p[2]) << 16)) >> (posbits & 0x7)) & bitmask;
|
||||
}
|
||||
posbits += n_bits;
|
||||
|
||||
|
||||
if (oldcode == -1) {
|
||||
if (code >= 256)
|
||||
bb_error_msg_and_die("corrupted data"); /* %ld", code); */
|
||||
@@ -226,15 +228,16 @@ unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd)
|
||||
/* Special case for KwKwK string. */
|
||||
if (code >= free_ent) {
|
||||
if (code > free_ent) {
|
||||
/*
|
||||
unsigned char *p;
|
||||
|
||||
posbits -= n_bits;
|
||||
p = &inbuf[posbits >> 3];
|
||||
|
||||
bb_error_msg
|
||||
("insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)",
|
||||
insize, posbits, p[-1], p[0], p[1], p[2], p[3],
|
||||
(posbits & 07));
|
||||
insize, posbits, p[-1], p[0], p[1], p[2], p[3],
|
||||
(posbits & 07));
|
||||
*/
|
||||
bb_error_msg("corrupted data");
|
||||
goto err;
|
||||
}
|
||||
@@ -244,7 +247,7 @@ unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd)
|
||||
}
|
||||
|
||||
/* Generate output characters in reverse order */
|
||||
while ((long) code >= (long) 256) {
|
||||
while (code >= 256) {
|
||||
if (stackp <= &htabof(0))
|
||||
bb_error_msg_and_die("corrupted data");
|
||||
*--stackp = tab_suffixof(code);
|
||||
@@ -285,11 +288,10 @@ unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd)
|
||||
}
|
||||
|
||||
/* Generate the new entry. */
|
||||
code = free_ent;
|
||||
if (code < maxmaxcode) {
|
||||
tab_prefixof(code) = (unsigned short) oldcode;
|
||||
tab_suffixof(code) = (unsigned char) finchar;
|
||||
free_ent = code + 1;
|
||||
if (free_ent < maxmaxcode) {
|
||||
tab_prefixof(free_ent) = (unsigned short) oldcode;
|
||||
tab_suffixof(free_ent) = (unsigned char) finchar;
|
||||
free_ent++;
|
||||
}
|
||||
|
||||
/* Remember previous code. */
|
||||
|
||||
@@ -30,8 +30,8 @@ static uint32_t xz_crc32(const uint8_t *buf, size_t size, uint32_t crc)
|
||||
/* We use arch-optimized unaligned accessors */
|
||||
#define get_unaligned_le32(buf) ({ uint32_t v; move_from_unaligned32(v, buf); SWAP_LE32(v); })
|
||||
#define get_unaligned_be32(buf) ({ uint32_t v; move_from_unaligned32(v, buf); SWAP_BE32(v); })
|
||||
#define put_unaligned_le32(val, buf) move_to_unaligned16(buf, SWAP_LE32(val))
|
||||
#define put_unaligned_be32(val, buf) move_to_unaligned16(buf, SWAP_BE32(val))
|
||||
#define put_unaligned_le32(val, buf) move_to_unaligned32(buf, SWAP_LE32(val))
|
||||
#define put_unaligned_be32(val, buf) move_to_unaligned32(buf, SWAP_BE32(val))
|
||||
|
||||
#include "unxz/xz_dec_bcj.c"
|
||||
#include "unxz/xz_dec_lzma2.c"
|
||||
@@ -40,6 +40,7 @@ static uint32_t xz_crc32(const uint8_t *buf, size_t size, uint32_t crc)
|
||||
IF_DESKTOP(long long) int FAST_FUNC
|
||||
unpack_xz_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd)
|
||||
{
|
||||
enum xz_ret xz_result;
|
||||
struct xz_buf iobuf;
|
||||
struct xz_dec *state;
|
||||
unsigned char *membuf;
|
||||
@@ -63,9 +64,8 @@ unpack_xz_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd)
|
||||
/* Limit memory usage to about 64 MiB. */
|
||||
state = xz_dec_init(XZ_DYNALLOC, 64*1024*1024);
|
||||
|
||||
xz_result = X_OK;
|
||||
while (1) {
|
||||
enum xz_ret r;
|
||||
|
||||
if (iobuf.in_pos == iobuf.in_size) {
|
||||
int rd = safe_read(src_fd, membuf, BUFSIZ);
|
||||
if (rd < 0) {
|
||||
@@ -73,28 +73,57 @@ unpack_xz_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd)
|
||||
total = -1;
|
||||
break;
|
||||
}
|
||||
if (rd == 0 && xz_result == XZ_STREAM_END)
|
||||
break;
|
||||
iobuf.in_size = rd;
|
||||
iobuf.in_pos = 0;
|
||||
}
|
||||
if (xz_result == XZ_STREAM_END) {
|
||||
/*
|
||||
* Try to start decoding next concatenated stream.
|
||||
* Stream padding must always be a multiple of four
|
||||
* bytes to preserve four-byte alignment. To keep the
|
||||
* code slightly smaller, we aren't as strict here as
|
||||
* the .xz spec requires. We just skip all zero-bytes
|
||||
* without checking the alignment and thus can accept
|
||||
* files that aren't valid, e.g. the XZ utils test
|
||||
* files bad-0pad-empty.xz and bad-0catpad-empty.xz.
|
||||
*/
|
||||
do {
|
||||
if (membuf[iobuf.in_pos] != 0) {
|
||||
xz_dec_reset(state);
|
||||
goto do_run;
|
||||
}
|
||||
iobuf.in_pos++;
|
||||
} while (iobuf.in_pos < iobuf.in_size);
|
||||
}
|
||||
do_run:
|
||||
// bb_error_msg(">in pos:%d size:%d out pos:%d size:%d",
|
||||
// iobuf.in_pos, iobuf.in_size, iobuf.out_pos, iobuf.out_size);
|
||||
r = xz_dec_run(state, &iobuf);
|
||||
xz_result = xz_dec_run(state, &iobuf);
|
||||
// bb_error_msg("<in pos:%d size:%d out pos:%d size:%d r:%d",
|
||||
// iobuf.in_pos, iobuf.in_size, iobuf.out_pos, iobuf.out_size, r);
|
||||
// iobuf.in_pos, iobuf.in_size, iobuf.out_pos, iobuf.out_size, xz_result);
|
||||
if (iobuf.out_pos) {
|
||||
xwrite(dst_fd, iobuf.out, iobuf.out_pos);
|
||||
IF_DESKTOP(total += iobuf.out_pos;)
|
||||
iobuf.out_pos = 0;
|
||||
}
|
||||
if (r == XZ_STREAM_END) {
|
||||
break;
|
||||
if (xz_result == XZ_STREAM_END) {
|
||||
/*
|
||||
* Can just "break;" here, if not for concatenated
|
||||
* .xz streams.
|
||||
* Checking for padding may require buffer
|
||||
* replenishment. Can't do it here.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
if (r != XZ_OK && r != XZ_UNSUPPORTED_CHECK) {
|
||||
if (xz_result != XZ_OK && xz_result != XZ_UNSUPPORTED_CHECK) {
|
||||
bb_error_msg("corrupted data");
|
||||
total = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
xz_dec_end(state);
|
||||
free(membuf);
|
||||
|
||||
|
||||
@@ -24,11 +24,13 @@ char FAST_FUNC filter_accept_reject_list(archive_handle_t *archive_handle)
|
||||
if (reject_entry) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
accept_entry = find_list_entry2(archive_handle->accept, key);
|
||||
|
||||
/* Fail if an accept list was specified and the key wasnt in there */
|
||||
if ((accept_entry == NULL) && archive_handle->accept) {
|
||||
return EXIT_FAILURE;
|
||||
if (archive_handle->accept) {
|
||||
accept_entry = find_list_entry2(archive_handle->accept, key);
|
||||
if (!accept_entry) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Accepted */
|
||||
|
||||
@@ -452,9 +452,11 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
|
||||
if (cp)
|
||||
*cp = '\0';
|
||||
archive_handle->action_data(archive_handle);
|
||||
if (archive_handle->accept || archive_handle->reject)
|
||||
if (archive_handle->accept || archive_handle->reject
|
||||
|| (archive_handle->ah_flags & ARCHIVE_REMEMBER_NAMES)
|
||||
) {
|
||||
llist_add_to(&archive_handle->passed, file_header->name);
|
||||
else /* Caller isn't interested in list of unpacked files */
|
||||
} else /* Caller isn't interested in list of unpacked files */
|
||||
free(file_header->name);
|
||||
} else {
|
||||
data_skip(archive_handle);
|
||||
|
||||
@@ -644,7 +644,7 @@ static int len_of_coded_match(unsigned m_len, unsigned m_off, unsigned lit)
|
||||
|
||||
|
||||
static int min_gain(unsigned ahead, unsigned lit1,
|
||||
unsigned lit2, int l1, int l2, int l3)
|
||||
unsigned lit2, int l1, int l2, int l3)
|
||||
{
|
||||
int lazy_match_min_gain = 0;
|
||||
|
||||
@@ -673,7 +673,7 @@ static int min_gain(unsigned ahead, unsigned lit1,
|
||||
#if defined(SWD_BEST_OFF)
|
||||
|
||||
static void better_match(const lzo_swd_p swd,
|
||||
unsigned *m_len, unsigned *m_off)
|
||||
unsigned *m_len, unsigned *m_off)
|
||||
{
|
||||
if (*m_len <= M2_MIN_LEN)
|
||||
return;
|
||||
@@ -914,8 +914,8 @@ int lzo1x_999_compress_level(const uint8_t *in, unsigned in_len,
|
||||
|
||||
compression_level -= 7;
|
||||
return lzo1x_999_compress_internal(in, in_len, out, out_len, wrkmem,
|
||||
c[compression_level].good_length,
|
||||
c[compression_level].max_lazy,
|
||||
c[compression_level].max_chain,
|
||||
c[compression_level].use_best_off);
|
||||
c[compression_level].good_length,
|
||||
c[compression_level].max_lazy,
|
||||
c[compression_level].max_chain,
|
||||
c[compression_level].use_best_off);
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
The LZO library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
The LZO library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
|
||||
+5
-5
@@ -14,7 +14,7 @@
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
@@ -116,7 +116,7 @@ static NOINLINE int lzo1x_optimize(uint8_t *in, unsigned in_len,
|
||||
unsigned nl;
|
||||
unsigned long o_m1_a = 0, o_m1_b = 0, o_m2 = 0, o_m3_a = 0, o_m3_b = 0;
|
||||
|
||||
// LZO_UNUSED(wrkmem);
|
||||
// LZO_UNUSED(wrkmem);
|
||||
|
||||
*out_len = 0;
|
||||
|
||||
@@ -346,11 +346,11 @@ static NOINLINE int lzo1x_optimize(uint8_t *in, unsigned in_len,
|
||||
return LZO_E_EOF_NOT_FOUND;
|
||||
|
||||
eof_found:
|
||||
// LZO_UNUSED(o_m1_a); LZO_UNUSED(o_m1_b); LZO_UNUSED(o_m2);
|
||||
// LZO_UNUSED(o_m3_a); LZO_UNUSED(o_m3_b);
|
||||
// LZO_UNUSED(o_m1_a); LZO_UNUSED(o_m1_b); LZO_UNUSED(o_m2);
|
||||
// LZO_UNUSED(o_m3_a); LZO_UNUSED(o_m3_b);
|
||||
*out_len = pd(op, out);
|
||||
return (ip == ip_end ? LZO_E_OK :
|
||||
(ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
|
||||
(ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
+34
-16
@@ -60,8 +60,8 @@
|
||||
|
||||
#if !ENABLE_FEATURE_SEAMLESS_GZ && !ENABLE_FEATURE_SEAMLESS_BZ2
|
||||
/* Do not pass gzip flag to writeTarFile() */
|
||||
#define writeTarFile(tar_fd, verboseFlag, dereferenceFlag, include, exclude, gzip) \
|
||||
writeTarFile(tar_fd, verboseFlag, dereferenceFlag, include, exclude)
|
||||
#define writeTarFile(tar_fd, verboseFlag, recurseFlags, include, exclude, gzip) \
|
||||
writeTarFile(tar_fd, verboseFlag, recurseFlags, include, exclude)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -333,13 +333,13 @@ static int writeTarHeader(struct TarBallInfo *tbInfo,
|
||||
&& (filesize <= 0x3fffffffffffffffffffffffLL)
|
||||
#endif
|
||||
) {
|
||||
/* GNU tar uses "base-256 encoding" for very large numbers.
|
||||
* Encoding is binary, with highest bit always set as a marker
|
||||
* and sign in next-highest bit:
|
||||
* 80 00 .. 00 - zero
|
||||
* bf ff .. ff - largest positive number
|
||||
* ff ff .. ff - minus 1
|
||||
* c0 00 .. 00 - smallest negative number
|
||||
/* GNU tar uses "base-256 encoding" for very large numbers.
|
||||
* Encoding is binary, with highest bit always set as a marker
|
||||
* and sign in next-highest bit:
|
||||
* 80 00 .. 00 - zero
|
||||
* bf ff .. ff - largest positive number
|
||||
* ff ff .. ff - minus 1
|
||||
* c0 00 .. 00 - smallest negative number
|
||||
*/
|
||||
char *p8 = header.size + sizeof(header.size);
|
||||
do {
|
||||
@@ -598,7 +598,7 @@ static void NOINLINE vfork_compressor(int tar_fd, int gzip)
|
||||
|
||||
/* gcc 4.2.1 inlines it, making code bigger */
|
||||
static NOINLINE int writeTarFile(int tar_fd, int verboseFlag,
|
||||
int dereferenceFlag, const llist_t *include,
|
||||
int recurseFlags, const llist_t *include,
|
||||
const llist_t *exclude, int gzip)
|
||||
{
|
||||
int errorFlag = FALSE;
|
||||
@@ -621,8 +621,7 @@ static NOINLINE int writeTarFile(int tar_fd, int verboseFlag,
|
||||
|
||||
/* Read the directory/files and iterate over them one at a time */
|
||||
while (include) {
|
||||
if (!recursive_action(include->data, ACTION_RECURSE |
|
||||
(dereferenceFlag ? ACTION_FOLLOWLINKS : 0),
|
||||
if (!recursive_action(include->data, recurseFlags,
|
||||
writeFileToTarball, writeFileToTarball, &tbInfo, 0)
|
||||
) {
|
||||
errorFlag = TRUE;
|
||||
@@ -662,7 +661,7 @@ static NOINLINE int writeTarFile(int tar_fd, int verboseFlag,
|
||||
}
|
||||
#else
|
||||
int writeTarFile(int tar_fd, int verboseFlag,
|
||||
int dereferenceFlag, const llist_t *include,
|
||||
int recurseFlags, const llist_t *include,
|
||||
const llist_t *exclude, int gzip);
|
||||
#endif /* FEATURE_TAR_CREATE */
|
||||
|
||||
@@ -694,6 +693,7 @@ static llist_t *append_file_list_to_list(llist_t *list)
|
||||
//usage: "-[" IF_FEATURE_TAR_CREATE("c") "xt"
|
||||
//usage: IF_FEATURE_SEAMLESS_Z("Z")
|
||||
//usage: IF_FEATURE_SEAMLESS_GZ("z")
|
||||
//usage: IF_FEATURE_SEAMLESS_XZ("J")
|
||||
//usage: IF_FEATURE_SEAMLESS_BZ2("j")
|
||||
//usage: IF_FEATURE_SEAMLESS_LZMA("a")
|
||||
//usage: IF_FEATURE_TAR_CREATE("h")
|
||||
@@ -720,6 +720,9 @@ static llist_t *append_file_list_to_list(llist_t *list)
|
||||
//usage: IF_FEATURE_SEAMLESS_GZ(
|
||||
//usage: "\n z (De)compress using gzip"
|
||||
//usage: )
|
||||
//usage: IF_FEATURE_SEAMLESS_XZ(
|
||||
//usage: "\n J (De)compress using xz"
|
||||
//usage: )
|
||||
//usage: IF_FEATURE_SEAMLESS_BZ2(
|
||||
//usage: "\n j (De)compress using bzip2"
|
||||
//usage: )
|
||||
@@ -749,6 +752,7 @@ static llist_t *append_file_list_to_list(llist_t *list)
|
||||
// o no-same-owner
|
||||
// p same-permissions
|
||||
// k keep-old
|
||||
// no-recursion
|
||||
// numeric-owner
|
||||
// no-same-permissions
|
||||
// overwrite
|
||||
@@ -765,9 +769,11 @@ enum {
|
||||
IF_FEATURE_TAR_FROM( OPTBIT_INCLUDE_FROM,)
|
||||
IF_FEATURE_TAR_FROM( OPTBIT_EXCLUDE_FROM,)
|
||||
IF_FEATURE_SEAMLESS_GZ( OPTBIT_GZIP ,)
|
||||
IF_FEATURE_SEAMLESS_Z( OPTBIT_COMPRESS ,) // 16th bit
|
||||
IF_FEATURE_SEAMLESS_XZ( OPTBIT_XZ ,) // 16th bit
|
||||
IF_FEATURE_SEAMLESS_Z( OPTBIT_COMPRESS ,)
|
||||
IF_FEATURE_TAR_NOPRESERVE_TIME(OPTBIT_NOPRESERVE_TIME,)
|
||||
#if ENABLE_FEATURE_TAR_LONG_OPTIONS
|
||||
OPTBIT_NORECURSION,
|
||||
IF_FEATURE_TAR_TO_COMMAND(OPTBIT_2COMMAND ,)
|
||||
OPTBIT_NUMERIC_OWNER,
|
||||
OPTBIT_NOPRESERVE_PERM,
|
||||
@@ -789,14 +795,16 @@ enum {
|
||||
OPT_INCLUDE_FROM = IF_FEATURE_TAR_FROM( (1 << OPTBIT_INCLUDE_FROM)) + 0, // T
|
||||
OPT_EXCLUDE_FROM = IF_FEATURE_TAR_FROM( (1 << OPTBIT_EXCLUDE_FROM)) + 0, // X
|
||||
OPT_GZIP = IF_FEATURE_SEAMLESS_GZ( (1 << OPTBIT_GZIP )) + 0, // z
|
||||
OPT_XZ = IF_FEATURE_SEAMLESS_XZ( (1 << OPTBIT_XZ )) + 0, // J
|
||||
OPT_COMPRESS = IF_FEATURE_SEAMLESS_Z( (1 << OPTBIT_COMPRESS )) + 0, // Z
|
||||
OPT_NOPRESERVE_TIME = IF_FEATURE_TAR_NOPRESERVE_TIME((1 << OPTBIT_NOPRESERVE_TIME)) + 0, // m
|
||||
OPT_NORECURSION = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_NORECURSION )) + 0, // no-recursion
|
||||
OPT_2COMMAND = IF_FEATURE_TAR_TO_COMMAND( (1 << OPTBIT_2COMMAND )) + 0, // to-command
|
||||
OPT_NUMERIC_OWNER = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_NUMERIC_OWNER )) + 0, // numeric-owner
|
||||
OPT_NOPRESERVE_PERM = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_NOPRESERVE_PERM)) + 0, // no-same-permissions
|
||||
OPT_OVERWRITE = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_OVERWRITE )) + 0, // overwrite
|
||||
|
||||
OPT_ANY_COMPRESS = (OPT_BZIP2 | OPT_LZMA | OPT_GZIP | OPT_COMPRESS),
|
||||
OPT_ANY_COMPRESS = (OPT_BZIP2 | OPT_LZMA | OPT_GZIP | OPT_XZ | OPT_COMPRESS),
|
||||
};
|
||||
#if ENABLE_FEATURE_TAR_LONG_OPTIONS
|
||||
static const char tar_longopts[] ALIGN1 =
|
||||
@@ -829,12 +837,16 @@ static const char tar_longopts[] ALIGN1 =
|
||||
# if ENABLE_FEATURE_SEAMLESS_GZ
|
||||
"gzip\0" No_argument "z"
|
||||
# endif
|
||||
# if ENABLE_FEATURE_SEAMLESS_XZ
|
||||
"xz\0" No_argument "J"
|
||||
# endif
|
||||
# if ENABLE_FEATURE_SEAMLESS_Z
|
||||
"compress\0" No_argument "Z"
|
||||
# endif
|
||||
# if ENABLE_FEATURE_TAR_NOPRESERVE_TIME
|
||||
"touch\0" No_argument "m"
|
||||
# endif
|
||||
"no-recursion\0" No_argument "\xfa"
|
||||
# if ENABLE_FEATURE_TAR_TO_COMMAND
|
||||
"to-command\0" Required_argument "\xfb"
|
||||
# endif
|
||||
@@ -921,6 +933,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
|
||||
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")
|
||||
, &base_dir // -C dir
|
||||
@@ -1050,7 +1063,9 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
|
||||
zipMode = 2;
|
||||
#endif
|
||||
/* NB: writeTarFile() closes tar_handle->src_fd */
|
||||
return writeTarFile(tar_handle->src_fd, verboseFlag, opt & OPT_DEREFERENCE,
|
||||
return writeTarFile(tar_handle->src_fd, verboseFlag,
|
||||
(opt & OPT_DEREFERENCE ? ACTION_FOLLOWLINKS : 0)
|
||||
| (opt & OPT_NORECURSION ? 0 : ACTION_RECURSE),
|
||||
tar_handle->accept,
|
||||
tar_handle->reject, zipMode);
|
||||
}
|
||||
@@ -1071,6 +1086,9 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
|
||||
if (opt & OPT_LZMA)
|
||||
USE_FOR_MMU(xformer = unpack_lzma_stream;)
|
||||
USE_FOR_NOMMU(xformer_prog = "unlzma";)
|
||||
if (opt & OPT_XZ)
|
||||
USE_FOR_MMU(xformer = unpack_xz_stream;)
|
||||
USE_FOR_NOMMU(xformer_prog = "unxz";)
|
||||
|
||||
open_transformer_with_sig(tar_handle->src_fd, xformer, xformer_prog);
|
||||
/* Can't lseek over pipes */
|
||||
|
||||
+77
-74
@@ -20,16 +20,16 @@
|
||||
*/
|
||||
|
||||
//usage:#define unzip_trivial_usage
|
||||
//usage: "[-opts[modifiers]] FILE[.zip] [LIST] [-x XLIST] [-d DIR]"
|
||||
//usage: "[-lnopq] FILE[.zip] [FILE]... [-x FILE...] [-d DIR]"
|
||||
//usage:#define unzip_full_usage "\n\n"
|
||||
//usage: "Extract files from ZIP archives\n"
|
||||
//usage: "\n -l List archive contents (with -q for short form)"
|
||||
//usage: "\n -n Never overwrite files (default)"
|
||||
//usage: "Extract FILEs from ZIP archive\n"
|
||||
//usage: "\n -l List contents (with -q for short form)"
|
||||
//usage: "\n -n Never overwrite files (default: ask)"
|
||||
//usage: "\n -o Overwrite"
|
||||
//usage: "\n -p Send output to stdout"
|
||||
//usage: "\n -p Print to stdout"
|
||||
//usage: "\n -q Quiet"
|
||||
//usage: "\n -x XLST Exclude these files"
|
||||
//usage: "\n -d DIR Extract files into DIR"
|
||||
//usage: "\n -x FILE Exclude FILEs"
|
||||
//usage: "\n -d DIR Extract into DIR"
|
||||
|
||||
#include "libbb.h"
|
||||
#include "bb_archive.h"
|
||||
@@ -277,6 +277,7 @@ int unzip_main(int argc, char **argv)
|
||||
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
|
||||
@@ -290,7 +291,6 @@ int unzip_main(int argc, char **argv)
|
||||
llist_t *zreject = NULL;
|
||||
char *base_dir = NULL;
|
||||
int i, opt;
|
||||
int opt_range = 0;
|
||||
char key_buf[80];
|
||||
struct stat stat_buf;
|
||||
|
||||
@@ -335,81 +335,81 @@ int unzip_main(int argc, char **argv)
|
||||
* 204372 1 file
|
||||
*/
|
||||
|
||||
x_opt_seen = 0;
|
||||
/* '-' makes getopt return 1 for non-options */
|
||||
while ((opt = getopt(argc, argv, "-d:lnopqxv")) != -1) {
|
||||
switch (opt_range) {
|
||||
case 0: /* Options */
|
||||
switch (opt) {
|
||||
case 'l': /* List */
|
||||
listing = 1;
|
||||
break;
|
||||
switch (opt) {
|
||||
case 'd': /* Extract to base directory */
|
||||
base_dir = optarg;
|
||||
break;
|
||||
|
||||
case 'n': /* Never overwrite existing files */
|
||||
overwrite = O_NEVER;
|
||||
break;
|
||||
case 'l': /* List */
|
||||
listing = 1;
|
||||
break;
|
||||
|
||||
case 'o': /* Always overwrite existing files */
|
||||
overwrite = O_ALWAYS;
|
||||
break;
|
||||
case 'n': /* Never overwrite existing files */
|
||||
overwrite = O_NEVER;
|
||||
break;
|
||||
|
||||
case 'p': /* Extract files to stdout and fall through to set verbosity */
|
||||
dst_fd = STDOUT_FILENO;
|
||||
case 'o': /* Always overwrite existing files */
|
||||
overwrite = O_ALWAYS;
|
||||
break;
|
||||
|
||||
case 'q': /* Be quiet */
|
||||
quiet++;
|
||||
break;
|
||||
case 'p': /* Extract files to stdout and fall through to set verbosity */
|
||||
dst_fd = STDOUT_FILENO;
|
||||
|
||||
case 'v': /* Verbose list */
|
||||
IF_DESKTOP(verbose++;)
|
||||
listing = 1;
|
||||
break;
|
||||
case 'q': /* Be quiet */
|
||||
quiet++;
|
||||
break;
|
||||
|
||||
case 1: /* The zip file */
|
||||
case 'v': /* Verbose list */
|
||||
IF_DESKTOP(verbose++;)
|
||||
listing = 1;
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
x_opt_seen = 1;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (!src_fn) {
|
||||
/* The zip file */
|
||||
/* +5: space for ".zip" and NUL */
|
||||
src_fn = xmalloc(strlen(optarg) + 5);
|
||||
strcpy(src_fn, optarg);
|
||||
opt_range++;
|
||||
break;
|
||||
|
||||
default:
|
||||
bb_show_usage();
|
||||
} else if (!x_opt_seen) {
|
||||
/* Include files */
|
||||
llist_add_to(&zaccept, optarg);
|
||||
} else {
|
||||
/* Exclude files */
|
||||
llist_add_to(&zreject, optarg);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: /* Include files */
|
||||
if (opt == 1) {
|
||||
llist_add_to(&zaccept, optarg);
|
||||
break;
|
||||
}
|
||||
if (opt == 'd') {
|
||||
base_dir = optarg;
|
||||
opt_range += 2;
|
||||
break;
|
||||
}
|
||||
if (opt == 'x') {
|
||||
opt_range++;
|
||||
break;
|
||||
}
|
||||
bb_show_usage();
|
||||
|
||||
case 2 : /* Exclude files */
|
||||
if (opt == 1) {
|
||||
llist_add_to(&zreject, optarg);
|
||||
break;
|
||||
}
|
||||
if (opt == 'd') { /* Extract to base directory */
|
||||
base_dir = optarg;
|
||||
opt_range++;
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
|
||||
default:
|
||||
bb_show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (src_fn == NULL) {
|
||||
#ifndef __GLIBC__
|
||||
/*
|
||||
* This code is needed for non-GNU getopt
|
||||
* which doesn't understand "-" in option string.
|
||||
* The -x option won't work properly in this case:
|
||||
* "unzip a.zip q -x w e" will be interpreted as
|
||||
* "unzip a.zip q w e -x" = "unzip a.zip q w e"
|
||||
*/
|
||||
argv += optind;
|
||||
if (argv[0]) {
|
||||
/* +5: space for ".zip" and NUL */
|
||||
src_fn = xmalloc(strlen(argv[0]) + 5);
|
||||
strcpy(src_fn, argv[0]);
|
||||
while (*++argv)
|
||||
llist_add_to(&zaccept, *argv);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!src_fn) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
@@ -420,17 +420,20 @@ int unzip_main(int argc, char **argv)
|
||||
if (overwrite == O_PROMPT)
|
||||
overwrite = O_NEVER;
|
||||
} else {
|
||||
static const char extn[][5] = {"", ".zip", ".ZIP"};
|
||||
int orig_src_fn_len = strlen(src_fn);
|
||||
int src_fd = -1;
|
||||
static const char extn[][5] = { ".zip", ".ZIP" };
|
||||
char *ext = src_fn + strlen(src_fn);
|
||||
int src_fd;
|
||||
|
||||
for (i = 0; (i < 3) && (src_fd == -1); i++) {
|
||||
strcpy(src_fn + orig_src_fn_len, extn[i]);
|
||||
i = 0;
|
||||
for (;;) {
|
||||
src_fd = open(src_fn, O_RDONLY);
|
||||
}
|
||||
if (src_fd == -1) {
|
||||
src_fn[orig_src_fn_len] = '\0';
|
||||
bb_error_msg_and_die("can't open %s, %s.zip, %s.ZIP", src_fn, src_fn, src_fn);
|
||||
if (src_fd >= 0)
|
||||
break;
|
||||
if (++i > 2) {
|
||||
*ext = '\0';
|
||||
bb_error_msg_and_die("can't open %s[.zip]", src_fn);
|
||||
}
|
||||
strcpy(ext, extn[i - 1]);
|
||||
}
|
||||
xmove_fd(src_fd, zip_fd);
|
||||
}
|
||||
@@ -596,7 +599,7 @@ int unzip_main(int argc, char **argv)
|
||||
printf(" creating: %s\n", dst_fn);
|
||||
}
|
||||
unzip_create_leading_dirs(dst_fn);
|
||||
if (bb_make_directory(dst_fn, dir_mode, 0)) {
|
||||
if (bb_make_directory(dst_fn, dir_mode, FILEUTILS_IGNORE_CHMOD_ERR)) {
|
||||
xfunc_die();
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -341,7 +341,6 @@ CONFIG_FEATURE_VI_READONLY=y
|
||||
CONFIG_FEATURE_VI_SETOPTS=y
|
||||
CONFIG_FEATURE_VI_SET=y
|
||||
CONFIG_FEATURE_VI_WIN_RESIZE=y
|
||||
CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y
|
||||
CONFIG_FEATURE_ALLOW_EXEC=y
|
||||
|
||||
#
|
||||
|
||||
@@ -346,7 +346,6 @@ CONFIG_FEATURE_VI_MAX_LEN=0
|
||||
# CONFIG_FEATURE_VI_SET is not set
|
||||
# CONFIG_FEATURE_VI_WIN_RESIZE is not set
|
||||
# CONFIG_FEATURE_VI_ASK_TERMINAL is not set
|
||||
# CONFIG_FEATURE_VI_OPTIMIZE_CURSOR is not set
|
||||
# CONFIG_FEATURE_ALLOW_EXEC is not set
|
||||
|
||||
#
|
||||
|
||||
@@ -358,7 +358,6 @@ CONFIG_FEATURE_VI_READONLY=y
|
||||
CONFIG_FEATURE_VI_SETOPTS=y
|
||||
CONFIG_FEATURE_VI_SET=y
|
||||
CONFIG_FEATURE_VI_WIN_RESIZE=y
|
||||
CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y
|
||||
CONFIG_FEATURE_ALLOW_EXEC=y
|
||||
|
||||
#
|
||||
|
||||
@@ -363,7 +363,6 @@ CONFIG_FEATURE_VI_MAX_LEN=0
|
||||
# CONFIG_FEATURE_VI_SET is not set
|
||||
# CONFIG_FEATURE_VI_WIN_RESIZE is not set
|
||||
# CONFIG_FEATURE_VI_ASK_TERMINAL is not set
|
||||
# CONFIG_FEATURE_VI_OPTIMIZE_CURSOR is not set
|
||||
# CONFIG_AWK is not set
|
||||
# CONFIG_FEATURE_AWK_LIBM is not set
|
||||
CONFIG_CMP=y
|
||||
|
||||
@@ -386,7 +386,6 @@ CONFIG_FEATURE_VI_SETOPTS=y
|
||||
CONFIG_FEATURE_VI_SET=y
|
||||
CONFIG_FEATURE_VI_WIN_RESIZE=y
|
||||
CONFIG_FEATURE_VI_ASK_TERMINAL=y
|
||||
CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y
|
||||
CONFIG_AWK=y
|
||||
CONFIG_FEATURE_AWK_LIBM=y
|
||||
CONFIG_CMP=y
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Busybox version: 1.20.0.git
|
||||
# Fri Mar 2 16:53:26 2012
|
||||
# Busybox version: 1.21.0.git
|
||||
# Mon May 28 21:51:18 2012
|
||||
#
|
||||
CONFIG_HAVE_DOT_CONFIG=y
|
||||
|
||||
@@ -20,11 +20,11 @@ CONFIG_PLATFORM_LINUX=y
|
||||
CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
|
||||
# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set
|
||||
# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
|
||||
# CONFIG_SHOW_USAGE is not set
|
||||
# CONFIG_FEATURE_VERBOSE_USAGE is not set
|
||||
# CONFIG_FEATURE_COMPRESS_USAGE is not set
|
||||
# CONFIG_FEATURE_INSTALLER is not set
|
||||
# CONFIG_INSTALL_NO_USR is not set
|
||||
CONFIG_SHOW_USAGE=y
|
||||
CONFIG_FEATURE_VERBOSE_USAGE=y
|
||||
CONFIG_FEATURE_COMPRESS_USAGE=y
|
||||
CONFIG_FEATURE_INSTALLER=y
|
||||
CONFIG_INSTALL_NO_USR=y
|
||||
# CONFIG_LOCALE_SUPPORT is not set
|
||||
# CONFIG_UNICODE_SUPPORT is not set
|
||||
# CONFIG_UNICODE_USING_LOCALE is not set
|
||||
@@ -36,7 +36,7 @@ CONFIG_LAST_SUPPORTED_WCHAR=0
|
||||
# CONFIG_UNICODE_BIDI_SUPPORT is not set
|
||||
# CONFIG_UNICODE_NEUTRAL_TABLE is not set
|
||||
# CONFIG_UNICODE_PRESERVE_BROKEN is not set
|
||||
# CONFIG_LONG_OPTS is not set
|
||||
CONFIG_LONG_OPTS=y
|
||||
# CONFIG_FEATURE_DEVPTS is not set
|
||||
# CONFIG_FEATURE_CLEAN_UP is not set
|
||||
# CONFIG_FEATURE_UTMP is not set
|
||||
@@ -67,7 +67,6 @@ CONFIG_EXTRA_CFLAGS="-DANDROID -D__ANDROID__ -DSK_RELEASE -nostdlib -march=armv7
|
||||
CONFIG_EXTRA_LDFLAGS="-Xlinker -z -Xlinker muldefs -nostdlib -Bdynamic -Xlinker -dynamic-linker -Xlinker /system/bin/linker -Xlinker -z -Xlinker nocopyreloc -Xlinker --no-undefined ${SYSROOT}/usr/lib/crtbegin_dynamic.o ${SYSROOT}/usr/lib/crtend_android.o"
|
||||
CONFIG_EXTRA_LDLIBS="dl m c gcc"
|
||||
|
||||
|
||||
#
|
||||
# Debugging Options
|
||||
#
|
||||
@@ -112,7 +111,7 @@ CONFIG_FEATURE_EDITING_HISTORY=0
|
||||
# CONFIG_FEATURE_EDITING_FANCY_PROMPT is not set
|
||||
# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set
|
||||
# CONFIG_FEATURE_NON_POSIX_CP is not set
|
||||
# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set
|
||||
CONFIG_FEATURE_VERBOSE_CP_MESSAGE=y
|
||||
CONFIG_FEATURE_COPYBUF_KB=4
|
||||
# CONFIG_FEATURE_SKIP_ROOTFS is not set
|
||||
# CONFIG_MONOTONIC_SYSCALL is not set
|
||||
@@ -239,7 +238,7 @@ CONFIG_FEATURE_LS_RECURSIVE=y
|
||||
CONFIG_FEATURE_LS_SORTFILES=y
|
||||
CONFIG_FEATURE_LS_TIMESTAMPS=y
|
||||
CONFIG_FEATURE_LS_USERNAME=y
|
||||
# CONFIG_FEATURE_LS_COLOR is not set
|
||||
CONFIG_FEATURE_LS_COLOR=y
|
||||
# CONFIG_FEATURE_LS_COLOR_IS_DEFAULT is not set
|
||||
CONFIG_MD5SUM=y
|
||||
CONFIG_MKDIR=y
|
||||
@@ -372,7 +371,6 @@ CONFIG_FEATURE_VI_SETOPTS=y
|
||||
CONFIG_FEATURE_VI_SET=y
|
||||
CONFIG_FEATURE_VI_WIN_RESIZE=y
|
||||
CONFIG_FEATURE_VI_ASK_TERMINAL=y
|
||||
CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y
|
||||
CONFIG_AWK=y
|
||||
CONFIG_FEATURE_AWK_LIBM=y
|
||||
CONFIG_CMP=y
|
||||
@@ -516,7 +514,7 @@ CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y
|
||||
# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set
|
||||
# CONFIG_FEATURE_MODUTILS_ALIAS is not set
|
||||
# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set
|
||||
CONFIG_DEFAULT_MODULES_DIR="/lib/modules"
|
||||
CONFIG_DEFAULT_MODULES_DIR="/system/lib/modules"
|
||||
CONFIG_DEFAULT_DEPMOD_FILE="modules.dep"
|
||||
|
||||
#
|
||||
@@ -647,8 +645,8 @@ CONFIG_SETSERIAL=y
|
||||
# CONFIG_UBIRSVOL is not set
|
||||
# CONFIG_UBIUPDATEVOL is not set
|
||||
# CONFIG_ADJTIMEX is not set
|
||||
# CONFIG_BBCONFIG is not set
|
||||
# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set
|
||||
CONFIG_BBCONFIG=y
|
||||
CONFIG_FEATURE_COMPRESS_BBCONFIG=y
|
||||
CONFIG_BEEP=y
|
||||
CONFIG_FEATURE_BEEP_FREQ=4000
|
||||
CONFIG_FEATURE_BEEP_LENGTH_MS=30
|
||||
@@ -883,6 +881,7 @@ CONFIG_SENDMAIL=y
|
||||
# Process Utilities
|
||||
#
|
||||
CONFIG_IOSTAT=y
|
||||
CONFIG_LSOF=y
|
||||
CONFIG_MPSTAT=y
|
||||
CONFIG_NMETER=y
|
||||
CONFIG_PMAP=y
|
||||
|
||||
@@ -363,7 +363,6 @@ CONFIG_FEATURE_VI_SETOPTS=y
|
||||
CONFIG_FEATURE_VI_SET=y
|
||||
CONFIG_FEATURE_VI_WIN_RESIZE=y
|
||||
CONFIG_FEATURE_VI_ASK_TERMINAL=y
|
||||
CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y
|
||||
CONFIG_AWK=y
|
||||
CONFIG_FEATURE_AWK_LIBM=y
|
||||
CONFIG_CMP=y
|
||||
|
||||
@@ -367,7 +367,6 @@ CONFIG_FEATURE_VI_SETOPTS=y
|
||||
CONFIG_FEATURE_VI_SET=y
|
||||
CONFIG_FEATURE_VI_WIN_RESIZE=y
|
||||
CONFIG_FEATURE_VI_ASK_TERMINAL=y
|
||||
CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y
|
||||
CONFIG_FEATURE_ALLOW_EXEC=y
|
||||
|
||||
#
|
||||
|
||||
@@ -229,7 +229,7 @@ static void do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize,
|
||||
}
|
||||
|
||||
/* Note: after PIO_UNIMAPCLR and before PIO_UNIMAP
|
||||
this printf did not work on many kernels */
|
||||
* this printf did not work on many kernels */
|
||||
|
||||
advice.advised_hashsize = 0;
|
||||
advice.advised_hashstep = 0;
|
||||
|
||||
@@ -22,9 +22,10 @@ int setlogcons_main(int argc UNUSED_PARAM, char **argv)
|
||||
struct {
|
||||
char fn;
|
||||
char subarg;
|
||||
} arg = { 11, /* redirect kernel messages */
|
||||
0 /* to specified console (current as default) */
|
||||
};
|
||||
} arg = {
|
||||
11, /* redirect kernel messages */
|
||||
0 /* to specified console (current as default) */
|
||||
};
|
||||
|
||||
if (argv[1])
|
||||
arg.subarg = xatou_range(argv[1], 0, 63);
|
||||
|
||||
@@ -514,6 +514,12 @@ config SHA512SUM
|
||||
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
|
||||
@@ -766,13 +772,13 @@ config FEATURE_HUMAN_READABLE
|
||||
help
|
||||
Allow df, du, and ls to have human readable output.
|
||||
|
||||
comment "Common options for md5sum, sha1sum, sha256sum, sha512sum"
|
||||
depends on MD5SUM || SHA1SUM || SHA256SUM || SHA512SUM
|
||||
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
|
||||
depends on MD5SUM || SHA1SUM || SHA256SUM || SHA512SUM || SHA3SUM
|
||||
help
|
||||
Enabling the -c options allows files to be checked
|
||||
against pre-calculated hash values.
|
||||
|
||||
@@ -62,6 +62,7 @@ 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
|
||||
|
||||
+8
-7
@@ -43,7 +43,7 @@ static const unsigned char days_in_month[] ALIGN1 = {
|
||||
};
|
||||
|
||||
static const unsigned char sep1752[] ALIGN1 = {
|
||||
1, 2, 14, 15, 16,
|
||||
1, 2, 14, 15, 16,
|
||||
17, 18, 19, 20, 21, 22, 23,
|
||||
24, 25, 26, 27, 28, 29, 30
|
||||
};
|
||||
@@ -167,8 +167,8 @@ int cal_main(int argc UNUSED_PARAM, char **argv)
|
||||
day_array(month, year, dp);
|
||||
len = sprintf(lineout, "%s %d", month_names[month - 1], year);
|
||||
printf("%*s%s\n%s\n",
|
||||
((7*julian + WEEK_LEN) - len) / 2, "",
|
||||
lineout, day_headings);
|
||||
((7*julian + WEEK_LEN) - len) / 2, "",
|
||||
lineout, day_headings);
|
||||
for (row = 0; row < 6; row++) {
|
||||
build_row(lineout, dp)[0] = '\0';
|
||||
dp += 7;
|
||||
@@ -181,10 +181,11 @@ int cal_main(int argc UNUSED_PARAM, char **argv)
|
||||
|
||||
sprintf(lineout, "%u", year);
|
||||
center(lineout,
|
||||
(WEEK_LEN * 3 + HEAD_SEP * 2)
|
||||
+ julian * (J_WEEK_LEN * 2 + HEAD_SEP
|
||||
- (WEEK_LEN * 3 + HEAD_SEP * 2)),
|
||||
0);
|
||||
(WEEK_LEN * 3 + HEAD_SEP * 2)
|
||||
+ julian * (J_WEEK_LEN * 2 + HEAD_SEP
|
||||
- (WEEK_LEN * 3 + HEAD_SEP * 2)),
|
||||
0
|
||||
);
|
||||
puts("\n"); /* two \n's */
|
||||
for (i = 0; i < 12; i++) {
|
||||
day_array(i + 1, year, days[i]);
|
||||
|
||||
+2
-2
@@ -126,8 +126,8 @@ int chown_main(int argc UNUSED_PARAM, char **argv)
|
||||
/* This matches coreutils behavior (almost - see below) */
|
||||
param.chown_func = chown;
|
||||
if (OPT_NODEREF
|
||||
/* || (OPT_RECURSE && !OPT_TRAVERSE_TOP): */
|
||||
IF_DESKTOP( || (opt & (BIT_RECURSE|BIT_TRAVERSE_TOP)) == BIT_RECURSE)
|
||||
/* || (OPT_RECURSE && !OPT_TRAVERSE_TOP): */
|
||||
IF_DESKTOP( || (opt & (BIT_RECURSE|BIT_TRAVERSE_TOP)) == BIT_RECURSE)
|
||||
) {
|
||||
param.chown_func = lchown;
|
||||
}
|
||||
|
||||
+1
-1
@@ -212,7 +212,7 @@ int cut_main(int argc UNUSED_PARAM, char **argv)
|
||||
if (opt & CUT_OPT_SUPPRESS_FLGS) {
|
||||
bb_error_msg_and_die
|
||||
("suppressing non-delimited lines makes sense%s",
|
||||
_op_on_field);
|
||||
_op_on_field);
|
||||
}
|
||||
if (delim != '\t') {
|
||||
bb_error_msg_and_die
|
||||
|
||||
+4
-4
@@ -110,9 +110,9 @@ int df_main(int argc UNUSED_PARAM, char **argv)
|
||||
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
|
||||
variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.
|
||||
*/
|
||||
* Disk space is shown in 1K blocks by default, unless the environment
|
||||
* variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.
|
||||
*/
|
||||
if (getenv("POSIXLY_CORRECT")) /* TODO - a new libbb function? */
|
||||
df_disp_hr = 512;
|
||||
|
||||
@@ -221,7 +221,7 @@ int df_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
#else
|
||||
if (printf("\n%-20s" + 1, device) > 20 && !(opt & OPT_POSIX))
|
||||
printf("\n%-20s", "");
|
||||
printf("\n%-20s", "");
|
||||
#endif
|
||||
|
||||
#if ENABLE_FEATURE_HUMAN_READABLE
|
||||
|
||||
@@ -89,6 +89,10 @@ struct globals {
|
||||
#define INIT_G() do { } while (0)
|
||||
|
||||
|
||||
/* FIXME? coreutils' du rounds sizes up:
|
||||
* for example, 1025k file is shown as "2" by du -m.
|
||||
* We round to nearest.
|
||||
*/
|
||||
static void print(unsigned long long size, const char *filename)
|
||||
{
|
||||
/* TODO - May not want to defer error checking here. */
|
||||
|
||||
+1
-1
@@ -174,7 +174,7 @@ int id_main(int argc UNUSED_PARAM, char **argv)
|
||||
/* Don't allow -n -r -nr -ug -rug -nug -rnug -uZ -gZ -GZ*/
|
||||
/* Don't allow more than one username */
|
||||
opt_complementary = "?1:u--g:g--u:G--u:u--G:g--G:G--g:r?ugG:n?ugG"
|
||||
IF_SELINUX(":u--Z:Z--u:g--Z:Z--g:G--Z:Z--G");
|
||||
IF_SELINUX(":u--Z:Z--u:g--Z:Z--g:G--Z:Z--G");
|
||||
opt = getopt32(argv, "rnugG" IF_SELINUX("Z"));
|
||||
}
|
||||
|
||||
|
||||
+22
-6
@@ -20,6 +20,8 @@
|
||||
//usage: "\n -n Don't dereference symlinks - treat like normal file"
|
||||
//usage: "\n -b Make a backup of the target (if exists) before link operation"
|
||||
//usage: "\n -S suf Use suffix instead of ~ when making backup files"
|
||||
//usage: "\n -T 2nd arg must be a DIR"
|
||||
//usage: "\n -v Verbose"
|
||||
//usage:
|
||||
//usage:#define ln_example_usage
|
||||
//usage: "$ ln -s BusyBox /tmp/ls\n"
|
||||
@@ -31,11 +33,13 @@
|
||||
/* This is a NOEXEC applet. Be very careful! */
|
||||
|
||||
|
||||
#define LN_SYMLINK 1
|
||||
#define LN_FORCE 2
|
||||
#define LN_NODEREFERENCE 4
|
||||
#define LN_BACKUP 8
|
||||
#define LN_SUFFIX 16
|
||||
#define LN_SYMLINK (1 << 0)
|
||||
#define LN_FORCE (1 << 1)
|
||||
#define LN_NODEREFERENCE (1 << 2)
|
||||
#define LN_BACKUP (1 << 3)
|
||||
#define LN_SUFFIX (1 << 4)
|
||||
#define LN_VERBOSE (1 << 5)
|
||||
#define LN_LINKFILE (1 << 6)
|
||||
|
||||
int ln_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int ln_main(int argc, char **argv)
|
||||
@@ -50,10 +54,15 @@ int ln_main(int argc, char **argv)
|
||||
int (*link_func)(const char *, const char *);
|
||||
|
||||
opt_complementary = "-1"; /* min one arg */
|
||||
opts = getopt32(argv, "sfnbS:", &suffix);
|
||||
opts = getopt32(argv, "sfnbS:vT", &suffix);
|
||||
|
||||
last = argv[argc - 1];
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
|
||||
if ((opts & LN_LINKFILE) && argc > 2) {
|
||||
bb_error_msg_and_die("-T accepts 2 args max");
|
||||
}
|
||||
|
||||
if (!argv[1]) {
|
||||
/* "ln PATH/TO/FILE" -> "ln PATH/TO/FILE FILE" */
|
||||
@@ -72,6 +81,9 @@ int ln_main(int argc, char **argv)
|
||||
(opts & LN_NODEREFERENCE) ^ LN_NODEREFERENCE
|
||||
)
|
||||
) {
|
||||
if (opts & LN_LINKFILE) {
|
||||
bb_error_msg_and_die("'%s' is a directory", src);
|
||||
}
|
||||
src_name = xstrdup(*argv);
|
||||
src = concat_path_file(src, bb_get_last_path_component_strip(src_name));
|
||||
free(src_name);
|
||||
@@ -112,6 +124,10 @@ int ln_main(int argc, char **argv)
|
||||
link_func = symlink;
|
||||
}
|
||||
|
||||
if (opts & LN_VERBOSE) {
|
||||
printf("'%s' -> '%s'\n", src, *argv);
|
||||
}
|
||||
|
||||
if (link_func(*argv, src) != 0) {
|
||||
bb_simple_perror_msg(src);
|
||||
status = EXIT_FAILURE;
|
||||
|
||||
+2
-2
@@ -260,7 +260,7 @@ enum {
|
||||
|
||||
/* TODO: simple toggles may be stored as OPT_xxx bits instead */
|
||||
static const uint32_t opt_flags[] = {
|
||||
STYLE_COLUMNAR, /* C */
|
||||
STYLE_COLUMNAR, /* C */
|
||||
DISP_HIDDEN | DISP_DOT, /* a */
|
||||
DISP_NOLIST, /* d */
|
||||
LIST_INO, /* i */
|
||||
@@ -720,7 +720,7 @@ static struct dnode *my_stat(const char *fullname, const char *name, int force_f
|
||||
if ((option_mask32 & OPT_L) || force_follow) {
|
||||
#if ENABLE_SELINUX
|
||||
if (is_selinux_enabled()) {
|
||||
getfilecon(fullname, &cur->sid);
|
||||
getfilecon(fullname, &cur->sid);
|
||||
}
|
||||
#endif
|
||||
if (stat(fullname, &statbuf)) {
|
||||
|
||||
@@ -55,6 +55,16 @@
|
||||
//usage: "\n -s Don't output anything, status code shows success"
|
||||
//usage: "\n -w Warn about improperly formatted checksum lines"
|
||||
//usage: )
|
||||
//usage:
|
||||
//usage:#define sha3sum_trivial_usage
|
||||
//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-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: )
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
@@ -65,6 +75,7 @@ enum {
|
||||
HASH_MD5 = 's', /* "md5>s<um" */
|
||||
HASH_SHA1 = '1',
|
||||
HASH_SHA256 = '2',
|
||||
HASH_SHA3 = '3',
|
||||
HASH_SHA512 = '5',
|
||||
};
|
||||
|
||||
@@ -86,6 +97,7 @@ static uint8_t *hash_file(const char *filename)
|
||||
{
|
||||
int src_fd, hash_len, count;
|
||||
union _ctx_ {
|
||||
sha3_ctx_t sha3;
|
||||
sha512_ctx_t sha512;
|
||||
sha256_ctx_t sha256;
|
||||
sha1_ctx_t sha1;
|
||||
@@ -124,6 +136,11 @@ static uint8_t *hash_file(const char *filename)
|
||||
update = (void*)sha512_hash;
|
||||
final = (void*)sha512_end;
|
||||
hash_len = 64;
|
||||
} else if (ENABLE_SHA3SUM && hash_algo == HASH_SHA3) {
|
||||
sha3_begin(&context.sha3);
|
||||
update = (void*)sha3_hash;
|
||||
final = (void*)sha3_end;
|
||||
hash_len = 64;
|
||||
} else {
|
||||
xfunc_die(); /* can't reach this */
|
||||
}
|
||||
@@ -223,7 +240,7 @@ int md5_sha1_sum_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
if (count_failed && !(flags & FLAG_SILENT)) {
|
||||
bb_error_msg("WARNING: %d of %d computed checksums did NOT match",
|
||||
count_failed, count_total);
|
||||
count_failed, count_total);
|
||||
}
|
||||
fclose_if_not_stdin(pre_computed_stream);
|
||||
} else {
|
||||
|
||||
+2
-1
@@ -48,6 +48,7 @@ static const char mkdir_longopts[] ALIGN1 =
|
||||
#if ENABLE_SELINUX
|
||||
"context\0" Required_argument "Z"
|
||||
#endif
|
||||
"verbose\0" No_argument "v"
|
||||
;
|
||||
#endif
|
||||
|
||||
@@ -66,7 +67,7 @@ int mkdir_main(int argc UNUSED_PARAM, char **argv)
|
||||
#if ENABLE_FEATURE_MKDIR_LONG_OPTIONS
|
||||
applet_long_options = mkdir_longopts;
|
||||
#endif
|
||||
opt = getopt32(argv, "m:p" IF_SELINUX("Z:"), &smode IF_SELINUX(,&scontext));
|
||||
opt = getopt32(argv, "m:p" IF_SELINUX("Z:") "v", &smode IF_SELINUX(,&scontext));
|
||||
if (opt & 1) {
|
||||
mode_t mmode = 0777;
|
||||
if (!bb_parse_mode(smode, &mmode)) {
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ int mknod_main(int argc, char **argv)
|
||||
/* Autodetect what the system supports; these macros should
|
||||
* optimize out to two constants. */
|
||||
dev = makedev(xatoul_range(argv[2], 0, major(UINT_MAX)),
|
||||
xatoul_range(argv[3], 0, minor(UINT_MAX)));
|
||||
xatoul_range(argv[3], 0, minor(UINT_MAX)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-8
@@ -33,12 +33,13 @@ static const char mv_longopts[] ALIGN1 =
|
||||
"interactive\0" No_argument "i"
|
||||
"force\0" No_argument "f"
|
||||
"no-clobber\0" No_argument "n"
|
||||
"verbose\0" No_argument "v"
|
||||
;
|
||||
#endif
|
||||
|
||||
#define OPT_FILEUTILS_FORCE 1
|
||||
#define OPT_FILEUTILS_INTERACTIVE 2
|
||||
#define OPT_FILEUTILS_NOCLOBBER 4
|
||||
#define OPT_FORCE (1 << 0)
|
||||
#define OPT_INTERACTIVE (1 << 1)
|
||||
#define OPT_NOCLOBBER (1 << 2)
|
||||
|
||||
int mv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int mv_main(int argc, char **argv)
|
||||
@@ -56,9 +57,11 @@ int mv_main(int argc, char **argv)
|
||||
#endif
|
||||
/* Need at least two arguments.
|
||||
* If more than one of -f, -i, -n is specified , only the final one
|
||||
* takes effect (it unsets previous options). */
|
||||
* takes effect (it unsets previous options).
|
||||
* -v is accepted but ignored.
|
||||
*/
|
||||
opt_complementary = "-2:f-in:i-fn:n-fi";
|
||||
flags = getopt32(argv, "fin");
|
||||
flags = getopt32(argv, "finv");
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
last = argv[argc - 1];
|
||||
@@ -84,11 +87,11 @@ int mv_main(int argc, char **argv)
|
||||
|
||||
DO_MOVE:
|
||||
if (dest_exists) {
|
||||
if (flags & OPT_FILEUTILS_NOCLOBBER)
|
||||
if (flags & OPT_NOCLOBBER)
|
||||
goto RET_0;
|
||||
if (!(flags & OPT_FILEUTILS_FORCE)
|
||||
if (!(flags & OPT_FORCE)
|
||||
&& ((access(dest, W_OK) < 0 && isatty(0))
|
||||
|| (flags & OPT_FILEUTILS_INTERACTIVE))
|
||||
|| (flags & OPT_INTERACTIVE))
|
||||
) {
|
||||
if (fprintf(stderr, "mv: overwrite '%s'? ", dest) < 0) {
|
||||
goto RET_1; /* Ouch! fprintf failed! */
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
//usage:#if ENABLE_DESKTOP
|
||||
//usage:#define od_trivial_usage
|
||||
//usage: "[-abcdfhilovxs] [-t TYPE] [-A RADIX] [-N SIZE] [-j SKIP] [-S MINSTR] [-w WIDTH] [FILE...]"
|
||||
//usage: "[-abcdfhilovxs] [-t TYPE] [-A RADIX] [-N SIZE] [-j SKIP] [-S MINSTR] [-w WIDTH] [FILE]..."
|
||||
// We don't support:
|
||||
// ... [FILE] [[+]OFFSET[.][b]]
|
||||
// Support is buggy for:
|
||||
@@ -1021,12 +1021,12 @@ dump(off_t current_offset, off_t end_offset)
|
||||
l_c_m = get_lcm();
|
||||
|
||||
/* Make bytes_to_write the smallest multiple of l_c_m that
|
||||
is at least as large as n_bytes_read. */
|
||||
is at least as large as n_bytes_read. */
|
||||
bytes_to_write = l_c_m * ((n_bytes_read + l_c_m - 1) / l_c_m);
|
||||
|
||||
memset(block[idx] + n_bytes_read, 0, bytes_to_write - n_bytes_read);
|
||||
write_block(current_offset, bytes_to_write,
|
||||
block[idx ^ 1], block[idx]);
|
||||
block[idx ^ 1], block[idx]);
|
||||
current_offset += n_bytes_read;
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -30,8 +30,9 @@
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
|
||||
#define PARENTS 0x01
|
||||
#define IGNORE_NON_EMPTY 0x02
|
||||
#define PARENTS (1 << 0)
|
||||
//efine VERBOSE (1 << 1) //accepted but ignored
|
||||
#define IGNORE_NON_EMPTY (1 << 2)
|
||||
|
||||
int rmdir_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int rmdir_main(int argc UNUSED_PARAM, char **argv)
|
||||
@@ -43,13 +44,14 @@ int rmdir_main(int argc UNUSED_PARAM, char **argv)
|
||||
#if ENABLE_FEATURE_RMDIR_LONG_OPTIONS
|
||||
static const char rmdir_longopts[] ALIGN1 =
|
||||
"parents\0" No_argument "p"
|
||||
"verbose\0" No_argument "v"
|
||||
/* Debian etch: many packages fail to be purged or installed
|
||||
* because they desperately want this option: */
|
||||
"ignore-fail-on-non-empty\0" No_argument "\xff"
|
||||
;
|
||||
applet_long_options = rmdir_longopts;
|
||||
#endif
|
||||
flags = getopt32(argv, "p");
|
||||
flags = getopt32(argv, "pv");
|
||||
argv += optind;
|
||||
|
||||
if (!*argv) {
|
||||
|
||||
+1
-1
@@ -219,7 +219,7 @@ static int compare_keys(const void *xarg, const void *yarg)
|
||||
y = get_key(*(char **)yarg, key, flags);
|
||||
#else
|
||||
/* This curly bracket serves no purpose but to match the nesting
|
||||
level of the for () loop we're not using */
|
||||
* level of the for () loop we're not using */
|
||||
{
|
||||
x = *(char **)xarg;
|
||||
y = *(char **)yarg;
|
||||
|
||||
+40
-28
@@ -99,9 +99,15 @@ static const char *file_type(const struct stat *st)
|
||||
if (S_ISFIFO(st->st_mode)) return "fifo";
|
||||
if (S_ISLNK(st->st_mode)) return "symbolic link";
|
||||
if (S_ISSOCK(st->st_mode)) return "socket";
|
||||
#ifdef S_TYPEISMQ
|
||||
if (S_TYPEISMQ(st)) return "message queue";
|
||||
#endif
|
||||
#ifdef S_TYPEISSEM
|
||||
if (S_TYPEISSEM(st)) return "semaphore";
|
||||
#endif
|
||||
#ifdef S_TYPEISSHM
|
||||
if (S_TYPEISSHM(st)) return "shared memory object";
|
||||
#endif
|
||||
#ifdef S_TYPEISTMO
|
||||
if (S_TYPEISTMO(st)) return "typed memory object";
|
||||
#endif
|
||||
@@ -436,7 +442,7 @@ static bool do_statfs(const char *filename, const char *format)
|
||||
: getfilecon(filename, &scontext)
|
||||
) < 0
|
||||
) {
|
||||
bb_perror_msg(filename);
|
||||
bb_simple_perror_msg(filename);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -549,7 +555,7 @@ static bool do_stat(const char *filename, const char *format)
|
||||
: getfilecon(filename, &scontext)
|
||||
) < 0
|
||||
) {
|
||||
bb_perror_msg(filename);
|
||||
bb_simple_perror_msg(filename);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -585,37 +591,43 @@ static bool do_stat(const char *filename, const char *format)
|
||||
# else
|
||||
if (option_mask32 & OPT_TERSE) {
|
||||
format = (option_mask32 & OPT_SELINUX ?
|
||||
"%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o %C\n":
|
||||
"%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o\n");
|
||||
"%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o %C\n"
|
||||
:
|
||||
"%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o\n"
|
||||
);
|
||||
} else {
|
||||
if (S_ISBLK(statbuf.st_mode) || S_ISCHR(statbuf.st_mode)) {
|
||||
format = (option_mask32 & OPT_SELINUX ?
|
||||
" File: %N\n"
|
||||
" Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
|
||||
"Device: %Dh/%dd\tInode: %-10i Links: %-5h"
|
||||
" Device type: %t,%T\n"
|
||||
"Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"
|
||||
" S_Context: %C\n"
|
||||
"Access: %x\n" "Modify: %y\n" "Change: %z\n":
|
||||
" File: %N\n"
|
||||
" Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
|
||||
"Device: %Dh/%dd\tInode: %-10i Links: %-5h"
|
||||
" Device type: %t,%T\n"
|
||||
"Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"
|
||||
"Access: %x\n" "Modify: %y\n" "Change: %z\n");
|
||||
" File: %N\n"
|
||||
" Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
|
||||
"Device: %Dh/%dd\tInode: %-10i Links: %-5h"
|
||||
" Device type: %t,%T\n"
|
||||
"Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"
|
||||
" S_Context: %C\n"
|
||||
"Access: %x\n" "Modify: %y\n" "Change: %z\n"
|
||||
:
|
||||
" File: %N\n"
|
||||
" Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
|
||||
"Device: %Dh/%dd\tInode: %-10i Links: %-5h"
|
||||
" Device type: %t,%T\n"
|
||||
"Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"
|
||||
"Access: %x\n" "Modify: %y\n" "Change: %z\n"
|
||||
);
|
||||
} else {
|
||||
format = (option_mask32 & OPT_SELINUX ?
|
||||
" File: %N\n"
|
||||
" Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
|
||||
"Device: %Dh/%dd\tInode: %-10i Links: %h\n"
|
||||
"Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"
|
||||
"S_Context: %C\n"
|
||||
"Access: %x\n" "Modify: %y\n" "Change: %z\n":
|
||||
" File: %N\n"
|
||||
" Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
|
||||
"Device: %Dh/%dd\tInode: %-10i Links: %h\n"
|
||||
"Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"
|
||||
"Access: %x\n" "Modify: %y\n" "Change: %z\n");
|
||||
" File: %N\n"
|
||||
" Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
|
||||
"Device: %Dh/%dd\tInode: %-10i Links: %h\n"
|
||||
"Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"
|
||||
"S_Context: %C\n"
|
||||
"Access: %x\n" "Modify: %y\n" "Change: %z\n"
|
||||
:
|
||||
" File: %N\n"
|
||||
" Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
|
||||
"Device: %Dh/%dd\tInode: %-10i Links: %h\n"
|
||||
"Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"
|
||||
"Access: %x\n" "Modify: %y\n" "Change: %z\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
+1
-1
@@ -1056,7 +1056,7 @@ static void do_display(const struct termios *mode, int all)
|
||||
}
|
||||
#endif
|
||||
wrapf("%s = %s;", nth_string(control_name, i),
|
||||
visible(mode->c_cc[control_info[i].offset]));
|
||||
visible(mode->c_cc[control_info[i].offset]));
|
||||
}
|
||||
#if VEOF == VMIN
|
||||
if ((mode->c_lflag & ICANON) == 0)
|
||||
|
||||
+2
-2
@@ -94,8 +94,8 @@ int sum_main(int argc UNUSED_PARAM, char **argv)
|
||||
n = sum_file("-", type);
|
||||
} else {
|
||||
/* Need to print the name if either
|
||||
- more than one file given
|
||||
- doing sysv */
|
||||
* - more than one file given
|
||||
* - doing sysv */
|
||||
type += (argv[1] || type == SUM_SYSV);
|
||||
n = 1;
|
||||
do {
|
||||
|
||||
+1
-1
@@ -610,7 +610,7 @@ static int test_eaccess(char *path, int mode)
|
||||
return 0;
|
||||
|
||||
/* Root can execute any file that has any one of the execute
|
||||
bits set. */
|
||||
* bits set. */
|
||||
if (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))
|
||||
return 0;
|
||||
}
|
||||
|
||||
+19
-21
@@ -38,7 +38,7 @@
|
||||
//usage: "TEMPLATE must end with XXXXXX (e.g. [/dir/]nameXXXXXX).\n"
|
||||
//usage: "Without TEMPLATE, -t tmp.XXXXXX is assumed.\n"
|
||||
//usage: "\n -d Make directory, not file"
|
||||
////usage: "\n -q Fail silently on errors" - we ignore this opt
|
||||
//usage: "\n -q Fail silently on errors"
|
||||
//usage: "\n -t Prepend base directory name to TEMPLATE"
|
||||
//usage: "\n -p DIR Use DIR as a base directory (implies -t)"
|
||||
//usage: "\n -u Do not create anything; print a name"
|
||||
@@ -71,7 +71,6 @@ int mktemp_main(int argc UNUSED_PARAM, char **argv)
|
||||
if (!path || path[0] == '\0')
|
||||
path = "/tmp";
|
||||
|
||||
/* -q is ignored */
|
||||
opt_complementary = "?1"; /* 1 argument max */
|
||||
opts = getopt32(argv, "dqtp:u", &path);
|
||||
|
||||
@@ -83,33 +82,32 @@ int mktemp_main(int argc UNUSED_PARAM, char **argv)
|
||||
chp = xstrdup("tmp.XXXXXX");
|
||||
opts |= OPT_t;
|
||||
}
|
||||
|
||||
if (opts & OPT_u) {
|
||||
/* Remove (up to) 6 X's */
|
||||
unsigned len = strlen(chp);
|
||||
int cnt = len > 6 ? 6 : len;
|
||||
while (--cnt >= 0 && chp[--len] == 'X')
|
||||
chp[len] = '\0';
|
||||
|
||||
chp = tempnam(opts & (OPT_t|OPT_p) ? path : "./", chp);
|
||||
if (!chp)
|
||||
return EXIT_FAILURE;
|
||||
if (!(opts & (OPT_t|OPT_p)))
|
||||
chp += 2;
|
||||
goto ret;
|
||||
#if 0
|
||||
/* Don't allow directory separator in template */
|
||||
if ((opts & OPT_t) && bb_basename(chp) != chp) {
|
||||
errno = EINVAL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
#endif
|
||||
if (opts & (OPT_t|OPT_p))
|
||||
chp = concat_path_file(path, chp);
|
||||
|
||||
if (opts & OPT_d) {
|
||||
if (opts & OPT_u) {
|
||||
chp = mktemp(chp);
|
||||
if (chp[0] == '\0')
|
||||
goto error;
|
||||
} else if (opts & OPT_d) {
|
||||
if (mkdtemp(chp) == NULL)
|
||||
return EXIT_FAILURE;
|
||||
goto error;
|
||||
} else {
|
||||
if (mkstemp(chp) < 0)
|
||||
return EXIT_FAILURE;
|
||||
goto error;
|
||||
}
|
||||
ret:
|
||||
puts(chp);
|
||||
return EXIT_SUCCESS;
|
||||
error:
|
||||
if (opts & OPT_q)
|
||||
return EXIT_FAILURE;
|
||||
/* don't use chp as it gets mangled in case of error */
|
||||
bb_perror_nomsg_and_die();
|
||||
}
|
||||
@@ -4,14 +4,13 @@
|
||||
*
|
||||
* Copyright (C) 2007 Bernhard Reutner-Fischer
|
||||
*
|
||||
* Based on a older version that was in busybox which was 1k big..
|
||||
* Based on a older version that was in busybox which was 1k big.
|
||||
* Copyright (C) 2001 by Emanuele Aina <emanuele.aina@tiscali.it>
|
||||
*
|
||||
* Based on the Debian run-parts program, version 1.15
|
||||
* Copyright (C) 1996 Jeff Noxon <jeff@router.patch.net>,
|
||||
* Copyright (C) 1996-1999 Guy Maor <maor@debian.org>
|
||||
*
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
@@ -19,7 +18,7 @@
|
||||
* attempt to write a program! :-) . */
|
||||
|
||||
/* This piece of code is heavily based on the original version of run-parts,
|
||||
* taken from debian-utils. I've only removed the long options and a the
|
||||
* taken from debian-utils. I've only removed the long options and the
|
||||
* report mode. As the original run-parts support only long options, I've
|
||||
* broken compatibility because the BusyBox policy doesn't allow them.
|
||||
* The supported options are:
|
||||
@@ -31,15 +30,15 @@
|
||||
*/
|
||||
|
||||
//usage:#define run_parts_trivial_usage
|
||||
//usage: "[-t] "IF_FEATURE_RUN_PARTS_FANCY("[-l] ")"[-a ARG] [-u MASK] DIRECTORY"
|
||||
//usage: "[-t"IF_FEATURE_RUN_PARTS_FANCY("l")"] [-a ARG]... [-u MASK] DIRECTORY"
|
||||
//usage:#define run_parts_full_usage "\n\n"
|
||||
//usage: "Run a bunch of scripts in DIRECTORY\n"
|
||||
//usage: "\n -t Print what would be run, but don't actually run anything"
|
||||
//usage: "\n -a ARG Pass ARG as argument for every program"
|
||||
//usage: "\n -u MASK Set the umask to MASK before running every program"
|
||||
//usage: "\n -t Dry run"
|
||||
//usage: IF_FEATURE_RUN_PARTS_FANCY(
|
||||
//usage: "\n -l Print names of all matching files even if they are not executable"
|
||||
//usage: "\n -l Print names of matching files even if they are not executable"
|
||||
//usage: )
|
||||
//usage: "\n -a ARG Pass ARG as argument to programs"
|
||||
//usage: "\n -u MASK Set umask to MASK before running programs"
|
||||
//usage:
|
||||
//usage:#define run_parts_example_usage
|
||||
//usage: "$ run-parts -a start /etc/init.d\n"
|
||||
|
||||
+2
-2
@@ -478,7 +478,7 @@ static int wait_one(int flags)
|
||||
instance_list = inst->next;
|
||||
if (verbose > 1)
|
||||
printf("Finished with %s (exit status %d)\n",
|
||||
inst->device, status);
|
||||
inst->device, status);
|
||||
num_running--;
|
||||
free_instance(inst);
|
||||
|
||||
@@ -844,7 +844,7 @@ static int check_all(void)
|
||||
if (verbose > 1)
|
||||
printf("--waiting-- (pass %d)\n", passno);
|
||||
status |= wait_many(pass_done ? FLAG_WAIT_ALL :
|
||||
FLAG_WAIT_ATLEAST_ONE);
|
||||
FLAG_WAIT_ATLEAST_ONE);
|
||||
if (pass_done) {
|
||||
if (verbose > 1)
|
||||
puts("----------------------------------");
|
||||
|
||||
@@ -93,7 +93,7 @@ static int lsattr_dir_proc(const char *dir_name, struct dirent *de,
|
||||
path = concat_path_file(dir_name, de->d_name);
|
||||
|
||||
if (lstat(path, &st) == -1)
|
||||
bb_perror_msg(path);
|
||||
bb_simple_perror_msg(path);
|
||||
else {
|
||||
if (de->d_name[0] != '.' || (flags & OPT_ALL)) {
|
||||
list_attributes(path);
|
||||
|
||||
+32
-8
@@ -155,7 +155,7 @@ typedef struct tsplitter_s {
|
||||
|
||||
/* simple token classes */
|
||||
/* Order and hex values are very important!!! See next_token() */
|
||||
#define TC_SEQSTART 1 /* ( */
|
||||
#define TC_SEQSTART 1 /* ( */
|
||||
#define TC_SEQTERM (1 << 1) /* ) */
|
||||
#define TC_REGEXP (1 << 2) /* /.../ */
|
||||
#define TC_OUTRDR (1 << 3) /* | > >> */
|
||||
@@ -696,6 +696,10 @@ static char nextchar(char **s)
|
||||
pps = *s;
|
||||
if (c == '\\')
|
||||
c = bb_process_escape_sequence((const char**)s);
|
||||
/* Example awk statement:
|
||||
* s = "abc\"def"
|
||||
* we must treat \" as "
|
||||
*/
|
||||
if (c == '\\' && *s == pps) { /* unrecognized \z? */
|
||||
c = *(*s); /* yes, fetch z */
|
||||
if (c)
|
||||
@@ -704,6 +708,15 @@ static char nextchar(char **s)
|
||||
return c;
|
||||
}
|
||||
|
||||
/* TODO: merge with strcpy_and_process_escape_sequences()?
|
||||
*/
|
||||
static void unescape_string_in_place(char *s1)
|
||||
{
|
||||
char *s = s1;
|
||||
while ((*s1 = nextchar(&s)) != '\0')
|
||||
s1++;
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE int isalnum_(int c)
|
||||
{
|
||||
return (isalnum(c) || c == '_');
|
||||
@@ -1799,6 +1812,18 @@ static void handle_special(var *v)
|
||||
is_f0_split = FALSE;
|
||||
|
||||
} else if (v == intvar[FS]) {
|
||||
/*
|
||||
* The POSIX-2008 standard says that changing FS should have no effect on the
|
||||
* current input line, but only on the next one. The language is:
|
||||
*
|
||||
* > Before the first reference to a field in the record is evaluated, the record
|
||||
* > shall be split into fields, according to the rules in Regular Expressions,
|
||||
* > using the value of FS that was current at the time the record was read.
|
||||
*
|
||||
* So, split up current line before assignment to FS:
|
||||
*/
|
||||
split_f0();
|
||||
|
||||
mk_splitter(getvar_s(v), &fsplitter);
|
||||
|
||||
} else if (v == intvar[RS]) {
|
||||
@@ -2992,7 +3017,7 @@ static int awk_exit(int r)
|
||||
* otherwise return 0 */
|
||||
static int is_assignment(const char *expr)
|
||||
{
|
||||
char *exprc, *val, *s, *s1;
|
||||
char *exprc, *val;
|
||||
|
||||
if (!isalnum_(*expr) || (val = strchr(expr, '=')) == NULL) {
|
||||
return FALSE;
|
||||
@@ -3002,10 +3027,7 @@ static int is_assignment(const char *expr)
|
||||
val = exprc + (val - expr);
|
||||
*val++ = '\0';
|
||||
|
||||
s = s1 = val;
|
||||
while ((*s1 = nextchar(&s)) != '\0')
|
||||
s1++;
|
||||
|
||||
unescape_string_in_place(val);
|
||||
setvar_u(newvar(exprc), val);
|
||||
free(exprc);
|
||||
return TRUE;
|
||||
@@ -3118,8 +3140,10 @@ int awk_main(int argc, char **argv)
|
||||
opt = getopt32(argv, "F:v:f:W:", &opt_F, &list_v, &list_f, NULL);
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
if (opt & 0x1)
|
||||
setvar_s(intvar[FS], opt_F); // -F
|
||||
if (opt & 0x1) { /* -F */
|
||||
unescape_string_in_place(opt_F);
|
||||
setvar_s(intvar[FS], opt_F);
|
||||
}
|
||||
while (list_v) { /* -v */
|
||||
if (!is_assignment(llist_pop(&list_v)))
|
||||
bb_show_usage();
|
||||
|
||||
+1
-1
@@ -843,7 +843,7 @@ static void diffdir(char *p[2], const char *s_start)
|
||||
* add_to_dirlist will remove it. */
|
||||
list[i].len = strlen(p[i]);
|
||||
recursive_action(p[i], ACTION_RECURSE | ACTION_FOLLOWLINKS,
|
||||
add_to_dirlist, skip_dir, &list[i], 0);
|
||||
add_to_dirlist, skip_dir, &list[i], 0);
|
||||
/* Sort dl alphabetically.
|
||||
* GNU diff does this ignoring any number of trailing dots.
|
||||
* We don't, so for us dotted files almost always are
|
||||
|
||||
+93
-37
@@ -53,7 +53,9 @@
|
||||
* Todo:
|
||||
* - Create a wrapper around regex to make libc's regex conform with sed
|
||||
*
|
||||
* Reference http://www.opengroup.org/onlinepubs/007904975/utilities/sed.html
|
||||
* Reference
|
||||
* http://www.opengroup.org/onlinepubs/007904975/utilities/sed.html
|
||||
* http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html
|
||||
*/
|
||||
|
||||
//usage:#define sed_trivial_usage
|
||||
@@ -62,7 +64,8 @@
|
||||
//usage:#define sed_full_usage "\n\n"
|
||||
//usage: " -e CMD Add CMD to sed commands to be executed"
|
||||
//usage: "\n -f FILE Add FILE contents to sed commands to be executed"
|
||||
//usage: "\n -i Edit files in-place (else sends result to stdout)"
|
||||
//usage: "\n -i[SFX] Edit files in-place (otherwise sends to stdout)"
|
||||
//usage: "\n Optionally back files up, appending SFX"
|
||||
//usage: "\n -n Suppress automatic printing of pattern space"
|
||||
//usage: "\n -r Use extended regex syntax"
|
||||
//usage: "\n"
|
||||
@@ -491,8 +494,10 @@ static const char *parse_cmd_args(sed_cmd_t *sed_cmd, const char *cmdstr)
|
||||
}
|
||||
/* handle edit cmds: (a)ppend, (i)nsert, and (c)hange */
|
||||
else if (idx <= IDX_c) { /* a,i,c */
|
||||
if ((sed_cmd->end_line || sed_cmd->end_match) && sed_cmd->cmd != 'c')
|
||||
bb_error_msg_and_die("only a beginning address can be specified for edit commands");
|
||||
if (idx < IDX_c) { /* a,i */
|
||||
if (sed_cmd->end_line || sed_cmd->end_match)
|
||||
bb_error_msg_and_die("command '%c' uses only one address", sed_cmd->cmd);
|
||||
}
|
||||
for (;;) {
|
||||
if (*cmdstr == '\n' || *cmdstr == '\\') {
|
||||
cmdstr++;
|
||||
@@ -509,8 +514,10 @@ static const char *parse_cmd_args(sed_cmd_t *sed_cmd, const char *cmdstr)
|
||||
}
|
||||
/* handle file cmds: (r)ead */
|
||||
else if (idx <= IDX_w) { /* r,w */
|
||||
if (sed_cmd->end_line || sed_cmd->end_match)
|
||||
bb_error_msg_and_die("command only uses one address");
|
||||
if (idx < IDX_w) { /* r */
|
||||
if (sed_cmd->end_line || sed_cmd->end_match)
|
||||
bb_error_msg_and_die("command '%c' uses only one address", sed_cmd->cmd);
|
||||
}
|
||||
cmdstr += parse_file_cmd(/*sed_cmd,*/ cmdstr, &sed_cmd->string);
|
||||
if (sed_cmd->cmd == 'w') {
|
||||
sed_cmd->sw_file = xfopen_for_write(sed_cmd->string);
|
||||
@@ -672,7 +679,7 @@ static void do_subst_w_backrefs(char *line, char *replace)
|
||||
|
||||
/* go through the replacement string */
|
||||
for (i = 0; replace[i]; i++) {
|
||||
/* if we find a backreference (\1, \2, etc.) print the backref'ed * text */
|
||||
/* if we find a backreference (\1, \2, etc.) print the backref'ed text */
|
||||
if (replace[i] == '\\') {
|
||||
unsigned backref = replace[++i] - '0';
|
||||
if (backref <= 9) {
|
||||
@@ -706,8 +713,10 @@ static void do_subst_w_backrefs(char *line, char *replace)
|
||||
static int do_subst_command(sed_cmd_t *sed_cmd, char **line_p)
|
||||
{
|
||||
char *line = *line_p;
|
||||
int altered = 0;
|
||||
unsigned match_count = 0;
|
||||
bool altered = 0;
|
||||
bool prev_match_empty = 1;
|
||||
bool tried_at_eol = 0;
|
||||
regex_t *current_regex;
|
||||
|
||||
current_regex = sed_cmd->sub_match;
|
||||
@@ -734,50 +743,75 @@ static int do_subst_command(sed_cmd_t *sed_cmd, char **line_p)
|
||||
|
||||
/* Now loop through, substituting for matches */
|
||||
do {
|
||||
int start = G.regmatch[0].rm_so;
|
||||
int end = G.regmatch[0].rm_eo;
|
||||
int i;
|
||||
|
||||
/* Work around bug in glibc regexec, demonstrated by:
|
||||
* echo " a.b" | busybox sed 's [^ .]* x g'
|
||||
* The match_count check is so not to break
|
||||
* echo "hi" | busybox sed 's/^/!/g'
|
||||
*/
|
||||
if (!G.regmatch[0].rm_so && !G.regmatch[0].rm_eo && match_count) {
|
||||
pipe_putc(*line++);
|
||||
goto next;
|
||||
}
|
||||
|
||||
match_count++;
|
||||
|
||||
/* If we aren't interested in this match, output old line to
|
||||
end of match and continue */
|
||||
* end of match and continue */
|
||||
if (sed_cmd->which_match
|
||||
&& (sed_cmd->which_match != match_count)
|
||||
) {
|
||||
for (i = 0; i < G.regmatch[0].rm_eo; i++)
|
||||
for (i = 0; i < end; i++)
|
||||
pipe_putc(*line++);
|
||||
/* Null match? Print one more char */
|
||||
if (start == end && *line)
|
||||
pipe_putc(*line++);
|
||||
goto next;
|
||||
}
|
||||
|
||||
/* print everything before the match */
|
||||
for (i = 0; i < G.regmatch[0].rm_so; i++)
|
||||
/* Print everything before the match */
|
||||
for (i = 0; i < start; i++)
|
||||
pipe_putc(line[i]);
|
||||
|
||||
/* then print the substitution string */
|
||||
do_subst_w_backrefs(line, sed_cmd->string);
|
||||
/* Then print the substitution string,
|
||||
* unless we just matched empty string after non-empty one.
|
||||
* Example: string "cccd", pattern "c*", repl "R":
|
||||
* result is "RdR", not "RRdR": first match "ccc",
|
||||
* second is "" before "d", third is "" after "d".
|
||||
* Second match is NOT replaced!
|
||||
*/
|
||||
if (prev_match_empty || start != 0 || start != end) {
|
||||
//dbg("%d %d %d", prev_match_empty, start, end);
|
||||
dbg("inserting replacement at %d in '%s'", start, line);
|
||||
do_subst_w_backrefs(line, sed_cmd->string);
|
||||
/* Flag that something has changed */
|
||||
altered = 1;
|
||||
} else {
|
||||
dbg("NOT inserting replacement at %d in '%s'", start, line);
|
||||
}
|
||||
|
||||
/* advance past the match */
|
||||
line += G.regmatch[0].rm_eo;
|
||||
/* flag that something has changed */
|
||||
altered++;
|
||||
/* If matched string is empty (f.e. "c*" pattern),
|
||||
* copy verbatim one char after it before attempting more matches
|
||||
*/
|
||||
prev_match_empty = (start == end);
|
||||
if (prev_match_empty) {
|
||||
if (!line[end]) {
|
||||
tried_at_eol = 1;
|
||||
} else {
|
||||
pipe_putc(line[end]);
|
||||
end++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Advance past the match */
|
||||
dbg("line += %d", end);
|
||||
line += end;
|
||||
|
||||
/* if we're not doing this globally, get out now */
|
||||
if (sed_cmd->which_match != 0)
|
||||
break;
|
||||
next:
|
||||
if (*line == '\0')
|
||||
break;
|
||||
/* Exit if we are at EOL and already tried matching at it */
|
||||
if (*line == '\0') {
|
||||
if (tried_at_eol)
|
||||
break;
|
||||
tried_at_eol = 1;
|
||||
}
|
||||
|
||||
//maybe (G.regmatch[0].rm_eo ? REG_NOTBOL : 0) instead of unconditional REG_NOTBOL?
|
||||
//maybe (end ? REG_NOTBOL : 0) instead of unconditional REG_NOTBOL?
|
||||
} while (regexec(current_regex, line, 10, G.regmatch, REG_NOTBOL) != REG_NOMATCH);
|
||||
|
||||
/* Copy rest of string into output pipeline */
|
||||
@@ -1043,7 +1077,7 @@ static void process_files(void)
|
||||
/* or does this line matches our last address regex */
|
||||
|| (sed_cmd->end_match && old_matched
|
||||
&& (regexec(sed_cmd->end_match,
|
||||
pattern_space, 0, NULL, 0) == 0)
|
||||
pattern_space, 0, NULL, 0) == 0)
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -1126,7 +1160,7 @@ static void process_files(void)
|
||||
case 's':
|
||||
if (!do_subst_command(sed_cmd, &pattern_space))
|
||||
break;
|
||||
dbg("do_subst_command succeeeded:'%s'", pattern_space);
|
||||
dbg("do_subst_command succeeded:'%s'", pattern_space);
|
||||
substituted |= 1;
|
||||
|
||||
/* handle p option */
|
||||
@@ -1374,6 +1408,19 @@ int sed_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
unsigned opt;
|
||||
llist_t *opt_e, *opt_f;
|
||||
char *opt_i;
|
||||
|
||||
#if ENABLE_LONG_OPTS
|
||||
static const char sed_longopts[] ALIGN1 =
|
||||
/* name has_arg short */
|
||||
"in-place\0" Optional_argument "i"
|
||||
"regexp-extended\0" No_argument "r"
|
||||
"quiet\0" No_argument "n"
|
||||
"silent\0" No_argument "n"
|
||||
"expression\0" Required_argument "e"
|
||||
"file\0" Required_argument "f";
|
||||
#endif
|
||||
|
||||
int status = EXIT_SUCCESS;
|
||||
|
||||
INIT_G();
|
||||
@@ -1382,17 +1429,21 @@ int sed_main(int argc UNUSED_PARAM, char **argv)
|
||||
if (ENABLE_FEATURE_CLEAN_UP) atexit(sed_free_and_close_stuff);
|
||||
|
||||
/* Lie to autoconf when it starts asking stupid questions. */
|
||||
if (argv[1] && !strcmp(argv[1], "--version")) {
|
||||
if (argv[1] && strcmp(argv[1], "--version") == 0) {
|
||||
puts("This is not GNU sed version 4.0");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* do normal option parsing */
|
||||
opt_e = opt_f = NULL;
|
||||
opt_i = NULL;
|
||||
opt_complementary = "e::f::" /* can occur multiple times */
|
||||
"nn"; /* count -n */
|
||||
|
||||
IF_LONG_OPTS(applet_long_options = sed_longopts);
|
||||
|
||||
/* -i must be first, to match OPT_in_place definition */
|
||||
opt = getopt32(argv, "irne:f:", &opt_e, &opt_f,
|
||||
opt = getopt32(argv, "i::rne:f:", &opt_i, &opt_e, &opt_f,
|
||||
&G.be_quiet); /* counter for -n */
|
||||
//argc -= optind;
|
||||
argv += optind;
|
||||
@@ -1474,8 +1525,13 @@ int sed_main(int argc UNUSED_PARAM, char **argv)
|
||||
fclose(G.nonstdout);
|
||||
G.nonstdout = stdout;
|
||||
|
||||
/* unlink(argv[i]); */
|
||||
xrename(G.outname, argv[i]);
|
||||
if (opt_i) {
|
||||
char *backupname = xasprintf("%s%s", argv[i], opt_i);
|
||||
xrename(argv[i], backupname);
|
||||
free(backupname);
|
||||
}
|
||||
/* else unlink(argv[i]); - rename below does this */
|
||||
xrename(G.outname, argv[i]); //TODO: rollback backup on error?
|
||||
free(G.outname);
|
||||
G.outname = NULL;
|
||||
|
||||
|
||||
+76
-137
@@ -14,7 +14,7 @@
|
||||
* add :help command
|
||||
* :map macros
|
||||
* if mark[] values were line numbers rather than pointers
|
||||
* it would be easier to change the mark when add/delete lines
|
||||
* it would be easier to change the mark when add/delete lines
|
||||
* More intelligence in refresh()
|
||||
* ":r !cmd" and "!cmd" to filter text through an external command
|
||||
* A true "undo" facility
|
||||
@@ -136,14 +136,6 @@
|
||||
//config: cursor position using "ESC [ 6 n" escape sequence, then read stdin.
|
||||
//config:
|
||||
//config: This is not clean but helps a lot on serial lines and such.
|
||||
//config:
|
||||
//config:config FEATURE_VI_OPTIMIZE_CURSOR
|
||||
//config: bool "Optimize cursor movement"
|
||||
//config: default y
|
||||
//config: depends on VI
|
||||
//config: help
|
||||
//config: This will make the cursor movement faster, but requires more memory
|
||||
//config: and it makes the applet a tiny bit larger.
|
||||
|
||||
//applet:IF_VI(APPLET(vi, BB_DIR_BIN, BB_SUID_DROP))
|
||||
|
||||
@@ -154,12 +146,12 @@
|
||||
//usage:#define vi_full_usage "\n\n"
|
||||
//usage: "Edit FILE\n"
|
||||
//usage: IF_FEATURE_VI_COLON(
|
||||
//usage: "\n -c Initial command to run ($EXINIT also available)"
|
||||
//usage: "\n -c CMD Initial command to run ($EXINIT also available)"
|
||||
//usage: )
|
||||
//usage: IF_FEATURE_VI_READONLY(
|
||||
//usage: "\n -R Read-only"
|
||||
//usage: )
|
||||
//usage: "\n -H Short help regarding available features"
|
||||
//usage: "\n -H List available features"
|
||||
|
||||
#include "libbb.h"
|
||||
/* Should be after libbb.h: on some systems regex.h needs sys/types.h: */
|
||||
@@ -202,20 +194,29 @@ enum {
|
||||
MAX_SCR_ROWS = CONFIG_FEATURE_VI_MAX_LEN,
|
||||
};
|
||||
|
||||
/* vt102 typical ESC sequence */
|
||||
/* terminal standout start/normal ESC sequence */
|
||||
#define SOs "\033[7m"
|
||||
#define SOn "\033[0m"
|
||||
/* terminal bell sequence */
|
||||
#define bell "\007"
|
||||
/* Clear-end-of-line and Clear-end-of-screen ESC sequence */
|
||||
#define Ceol "\033[K"
|
||||
#define Ceos "\033[J"
|
||||
/* Cursor motion arbitrary destination ESC sequence */
|
||||
#define CMrc "\033[%u;%uH"
|
||||
/* Cursor motion up and down ESC sequence */
|
||||
#define CMup "\033[A"
|
||||
#define CMdown "\n"
|
||||
/* VT102 ESC sequences.
|
||||
* See "Xterm Control Sequences"
|
||||
* http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
|
||||
*/
|
||||
/* Inverse/Normal text */
|
||||
#define ESC_BOLD_TEXT "\033[7m"
|
||||
#define ESC_NORM_TEXT "\033[0m"
|
||||
/* Bell */
|
||||
#define ESC_BELL "\007"
|
||||
/* Clear-to-end-of-line */
|
||||
#define ESC_CLEAR2EOL "\033[K"
|
||||
/* Clear-to-end-of-screen.
|
||||
* (We use default param here.
|
||||
* Full sequence is "ESC [ <num> J",
|
||||
* <num> is 0/1/2 = "erase below/above/all".)
|
||||
*/
|
||||
#define ESC_CLEAR2EOS "\033[J"
|
||||
/* Cursor to given coordinate (1,1: top left) */
|
||||
#define ESC_SET_CURSOR_POS "\033[%u;%uH"
|
||||
//UNUSED
|
||||
///* Cursor up and down */
|
||||
//#define ESC_CURSOR_UP "\033[A"
|
||||
//#define ESC_CURSOR_DOWN "\n"
|
||||
|
||||
#if ENABLE_FEATURE_VI_DOT_CMD || ENABLE_FEATURE_VI_YANKMARK
|
||||
// cmds modifying text[]
|
||||
@@ -303,9 +304,6 @@ struct globals {
|
||||
int lmc_len; // length of last_modifying_cmd
|
||||
char *ioq, *ioq_start; // pointer to string for get_one_char to "read"
|
||||
#endif
|
||||
#if ENABLE_FEATURE_VI_OPTIMIZE_CURSOR
|
||||
int last_row; // where the cursor was last moved to
|
||||
#endif
|
||||
#if ENABLE_FEATURE_VI_USE_SIGNALS || ENABLE_FEATURE_VI_CRASHME
|
||||
int my_pid;
|
||||
#endif
|
||||
@@ -389,7 +387,6 @@ struct globals {
|
||||
#define lmc_len (G.lmc_len )
|
||||
#define ioq (G.ioq )
|
||||
#define ioq_start (G.ioq_start )
|
||||
#define last_row (G.last_row )
|
||||
#define my_pid (G.my_pid )
|
||||
#define last_search_pattern (G.last_search_pattern)
|
||||
|
||||
@@ -470,10 +467,7 @@ static int file_size(const char *); // what is the byte size of "fn"
|
||||
// file_insert might reallocate text[]!
|
||||
static int file_insert(const char *, char *, int);
|
||||
static int file_write(char *, char *, char *);
|
||||
#if !ENABLE_FEATURE_VI_OPTIMIZE_CURSOR
|
||||
#define place_cursor(a, b, optimize) place_cursor(a, b)
|
||||
#endif
|
||||
static void place_cursor(int, int, int);
|
||||
static void place_cursor(int, int);
|
||||
static void screen_erase(void);
|
||||
static void clear_to_eol(void);
|
||||
static void clear_to_eos(void);
|
||||
@@ -558,7 +552,8 @@ int vi_main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
vi_setops = VI_AUTOINDENT | VI_SHOWMATCH | VI_IGNORECASE;
|
||||
// autoindent is not default in vim 7.3
|
||||
vi_setops = /*VI_AUTOINDENT |*/ VI_SHOWMATCH | VI_IGNORECASE;
|
||||
// 1- process $HOME/.exrc file (not inplemented yet)
|
||||
// 2- process EXINIT variable from environment
|
||||
// 3- process command line args
|
||||
@@ -584,7 +579,7 @@ int vi_main(int argc, char **argv)
|
||||
#if ENABLE_FEATURE_VI_COLON
|
||||
case 'c': // cmd line vi command
|
||||
if (*optarg)
|
||||
initial_cmds[initial_cmds[0] != 0] = xstrndup(optarg, MAX_INPUT_LEN);
|
||||
initial_cmds[initial_cmds[0] != NULL] = xstrndup(optarg, MAX_INPUT_LEN);
|
||||
break;
|
||||
#endif
|
||||
case 'H':
|
||||
@@ -599,15 +594,19 @@ int vi_main(int argc, char **argv)
|
||||
// The argv array can be used by the ":next" and ":rewind" commands
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
save_argc = argc;
|
||||
optind = 0;
|
||||
|
||||
//----- This is the main file handling loop --------------
|
||||
save_argc = argc;
|
||||
optind = 0;
|
||||
// "Save cursor, use alternate screen buffer, clear screen"
|
||||
write1("\033[?1049h");
|
||||
while (1) {
|
||||
edit_file(argv[optind]); /* param might be NULL */
|
||||
if (++optind >= argc)
|
||||
break;
|
||||
}
|
||||
// "Use normal screen buffer, restore cursor"
|
||||
write1("\033[?1049l");
|
||||
//-----------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
@@ -1191,7 +1190,7 @@ static void colon(char *buf)
|
||||
char *argp;
|
||||
#endif
|
||||
i = 0; // offset into args
|
||||
// only blank is regarded as args delmiter. What about tab '\t' ?
|
||||
// only blank is regarded as args delimiter. What about tab '\t'?
|
||||
if (!args[0] || strcasecmp(args, "all") == 0) {
|
||||
// print out values of all options
|
||||
#if ENABLE_FEATURE_VI_SETOPTS
|
||||
@@ -1930,11 +1929,11 @@ static int find_range(char **start, char **stop, char c)
|
||||
dot_end(); // find NL
|
||||
q = dot;
|
||||
} else {
|
||||
// nothing -- this causes any other values of c to
|
||||
// represent the one-character range under the
|
||||
// cursor. this is correct for ' ' and 'l', but
|
||||
// perhaps no others.
|
||||
//
|
||||
// nothing -- this causes any other values of c to
|
||||
// represent the one-character range under the
|
||||
// cursor. this is correct for ' ' and 'l', but
|
||||
// perhaps no others.
|
||||
//
|
||||
}
|
||||
if (q < p) {
|
||||
t = q;
|
||||
@@ -2176,7 +2175,7 @@ static void show_help(void)
|
||||
"\n\tPattern searches with / and ?"
|
||||
#endif
|
||||
#if ENABLE_FEATURE_VI_DOT_CMD
|
||||
"\n\tLast command repeat with \'.\'"
|
||||
"\n\tLast command repeat with ."
|
||||
#endif
|
||||
#if ENABLE_FEATURE_VI_YANKMARK
|
||||
"\n\tLine marking with 'x"
|
||||
@@ -2187,7 +2186,7 @@ static void show_help(void)
|
||||
//redundant: usage text says this too: "\n\tReadonly with -R command line arg"
|
||||
#endif
|
||||
#if ENABLE_FEATURE_VI_SET
|
||||
"\n\tSome colon mode commands with \':\'"
|
||||
"\n\tSome colon mode commands with :"
|
||||
#endif
|
||||
#if ENABLE_FEATURE_VI_SETOPTS
|
||||
"\n\tSettable options with \":set\""
|
||||
@@ -2592,107 +2591,56 @@ static int file_write(char *fn, char *first, char *last)
|
||||
// 23,0 ... 23,79 <- status line
|
||||
|
||||
//----- Move the cursor to row x col (count from 0, not 1) -------
|
||||
static void place_cursor(int row, int col, int optimize)
|
||||
static void place_cursor(int row, int col)
|
||||
{
|
||||
char cm1[sizeof(CMrc) + sizeof(int)*3 * 2];
|
||||
#if ENABLE_FEATURE_VI_OPTIMIZE_CURSOR
|
||||
enum {
|
||||
SZ_UP = sizeof(CMup),
|
||||
SZ_DN = sizeof(CMdown),
|
||||
SEQ_SIZE = SZ_UP > SZ_DN ? SZ_UP : SZ_DN,
|
||||
};
|
||||
char cm2[SEQ_SIZE * 5 + 32]; // bigger than worst case size
|
||||
#endif
|
||||
char *cm;
|
||||
char cm1[sizeof(ESC_SET_CURSOR_POS) + sizeof(int)*3 * 2];
|
||||
|
||||
if (row < 0) row = 0;
|
||||
if (row >= rows) row = rows - 1;
|
||||
if (col < 0) col = 0;
|
||||
if (col >= columns) col = columns - 1;
|
||||
|
||||
//----- 1. Try the standard terminal ESC sequence
|
||||
sprintf(cm1, CMrc, row + 1, col + 1);
|
||||
cm = cm1;
|
||||
|
||||
#if ENABLE_FEATURE_VI_OPTIMIZE_CURSOR
|
||||
if (optimize && col < 16) {
|
||||
char *screenp;
|
||||
int Rrow = last_row;
|
||||
int diff = Rrow - row;
|
||||
|
||||
if (diff < -5 || diff > 5)
|
||||
goto skip;
|
||||
|
||||
//----- find the minimum # of chars to move cursor -------------
|
||||
//----- 2. Try moving with discreet chars (Newline, [back]space, ...)
|
||||
cm2[0] = '\0';
|
||||
|
||||
// move to the correct row
|
||||
while (row < Rrow) {
|
||||
// the cursor has to move up
|
||||
strcat(cm2, CMup);
|
||||
Rrow--;
|
||||
}
|
||||
while (row > Rrow) {
|
||||
// the cursor has to move down
|
||||
strcat(cm2, CMdown);
|
||||
Rrow++;
|
||||
}
|
||||
|
||||
// now move to the correct column
|
||||
strcat(cm2, "\r"); // start at col 0
|
||||
// just send out orignal source char to get to correct place
|
||||
screenp = &screen[row * columns]; // start of screen line
|
||||
strncat(cm2, screenp, col);
|
||||
|
||||
// pick the shortest cursor motion to send out
|
||||
if (strlen(cm2) < strlen(cm)) {
|
||||
cm = cm2;
|
||||
}
|
||||
skip: ;
|
||||
}
|
||||
last_row = row;
|
||||
#endif /* FEATURE_VI_OPTIMIZE_CURSOR */
|
||||
write1(cm);
|
||||
sprintf(cm1, ESC_SET_CURSOR_POS, row + 1, col + 1);
|
||||
write1(cm1);
|
||||
}
|
||||
|
||||
//----- Erase from cursor to end of line -----------------------
|
||||
static void clear_to_eol(void)
|
||||
{
|
||||
write1(Ceol); // Erase from cursor to end of line
|
||||
write1(ESC_CLEAR2EOL);
|
||||
}
|
||||
|
||||
static void go_bottom_and_clear_to_eol(void)
|
||||
{
|
||||
place_cursor(rows - 1, 0, FALSE); // go to bottom of screen
|
||||
clear_to_eol(); // erase to end of line
|
||||
place_cursor(rows - 1, 0);
|
||||
clear_to_eol();
|
||||
}
|
||||
|
||||
//----- Erase from cursor to end of screen -----------------------
|
||||
static void clear_to_eos(void)
|
||||
{
|
||||
write1(Ceos); // Erase from cursor to end of screen
|
||||
write1(ESC_CLEAR2EOS);
|
||||
}
|
||||
|
||||
//----- Start standout mode ------------------------------------
|
||||
static void standout_start(void) // send "start reverse video" sequence
|
||||
static void standout_start(void)
|
||||
{
|
||||
write1(SOs); // Start reverse video mode
|
||||
write1(ESC_BOLD_TEXT);
|
||||
}
|
||||
|
||||
//----- End standout mode --------------------------------------
|
||||
static void standout_end(void) // send "end reverse video" sequence
|
||||
static void standout_end(void)
|
||||
{
|
||||
write1(SOn); // End reverse video mode
|
||||
write1(ESC_NORM_TEXT);
|
||||
}
|
||||
|
||||
//----- Flash the screen --------------------------------------
|
||||
static void flash(int h)
|
||||
{
|
||||
standout_start(); // send "start reverse video" sequence
|
||||
standout_start();
|
||||
redraw(TRUE);
|
||||
mysleep(h);
|
||||
standout_end(); // send "end reverse video" sequence
|
||||
standout_end();
|
||||
redraw(TRUE);
|
||||
}
|
||||
|
||||
@@ -2703,7 +2651,7 @@ static void Indicate_Error(void)
|
||||
return; // generate a random command
|
||||
#endif
|
||||
if (!err_method) {
|
||||
write1(bell); // send out a bell character
|
||||
write1(ESC_BELL);
|
||||
} else {
|
||||
flash(10);
|
||||
}
|
||||
@@ -2749,7 +2697,7 @@ static void show_status_line(void)
|
||||
}
|
||||
have_status_msg = 0;
|
||||
}
|
||||
place_cursor(crow, ccol, FALSE); // put cursor back in correct place
|
||||
place_cursor(crow, ccol); // put cursor back in correct place
|
||||
}
|
||||
fflush_all();
|
||||
}
|
||||
@@ -2761,12 +2709,12 @@ static void status_line_bold(const char *format, ...)
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
strcpy(status_buffer, SOs); // Terminal standout mode on
|
||||
vsprintf(status_buffer + sizeof(SOs)-1, format, args);
|
||||
strcat(status_buffer, SOn); // Terminal standout mode off
|
||||
strcpy(status_buffer, ESC_BOLD_TEXT);
|
||||
vsprintf(status_buffer + sizeof(ESC_BOLD_TEXT)-1, format, args);
|
||||
strcat(status_buffer, ESC_NORM_TEXT);
|
||||
va_end(args);
|
||||
|
||||
have_status_msg = 1 + sizeof(SOs) + sizeof(SOn) - 2;
|
||||
have_status_msg = 1 + sizeof(ESC_BOLD_TEXT) + sizeof(ESC_NORM_TEXT) - 2;
|
||||
}
|
||||
|
||||
// format status buffer
|
||||
@@ -2798,8 +2746,8 @@ static void print_literal(char *buf, const char *s)
|
||||
c = *s;
|
||||
c_is_no_print = (c & 0x80) && !Isprint(c);
|
||||
if (c_is_no_print) {
|
||||
strcpy(d, SOn);
|
||||
d += sizeof(SOn)-1;
|
||||
strcpy(d, ESC_NORM_TEXT);
|
||||
d += sizeof(ESC_NORM_TEXT)-1;
|
||||
c = '.';
|
||||
}
|
||||
if (c < ' ' || c == 0x7f) {
|
||||
@@ -2811,8 +2759,8 @@ static void print_literal(char *buf, const char *s)
|
||||
*d++ = c;
|
||||
*d = '\0';
|
||||
if (c_is_no_print) {
|
||||
strcpy(d, SOs);
|
||||
d += sizeof(SOs)-1;
|
||||
strcpy(d, ESC_BOLD_TEXT);
|
||||
d += sizeof(ESC_BOLD_TEXT)-1;
|
||||
}
|
||||
if (*s == '\n') {
|
||||
*d++ = '$';
|
||||
@@ -2894,8 +2842,8 @@ static int format_edit_status(void)
|
||||
//----- Force refresh of all Lines -----------------------------
|
||||
static void redraw(int full_screen)
|
||||
{
|
||||
place_cursor(0, 0, FALSE); // put cursor in correct place
|
||||
clear_to_eos(); // tell terminal to erase display
|
||||
place_cursor(0, 0);
|
||||
clear_to_eos();
|
||||
screen_erase(); // erase the internal screen buffer
|
||||
last_status_cksum = 0; // force status update
|
||||
refresh(full_screen); // this will redraw the entire display
|
||||
@@ -3035,22 +2983,13 @@ static void refresh(int full_screen)
|
||||
if (changed) {
|
||||
// copy changed part of buffer to virtual screen
|
||||
memcpy(sp+cs, out_buf+cs, ce-cs+1);
|
||||
|
||||
// move cursor to column of first change
|
||||
//if (offset != old_offset) {
|
||||
// // place_cursor is still too stupid
|
||||
// // to handle offsets correctly
|
||||
// place_cursor(li, cs, FALSE);
|
||||
//} else {
|
||||
place_cursor(li, cs, TRUE);
|
||||
//}
|
||||
|
||||
place_cursor(li, cs);
|
||||
// write line out to terminal
|
||||
fwrite(&sp[cs], ce - cs + 1, 1, stdout);
|
||||
}
|
||||
}
|
||||
|
||||
place_cursor(crow, ccol, TRUE);
|
||||
place_cursor(crow, ccol);
|
||||
|
||||
old_offset = offset;
|
||||
#undef old_offset
|
||||
@@ -3220,9 +3159,9 @@ static void do_cmd(int c)
|
||||
break;
|
||||
case 12: // ctrl-L force redraw whole screen
|
||||
case 18: // ctrl-R force redraw
|
||||
place_cursor(0, 0, FALSE); // put cursor in correct place
|
||||
clear_to_eos(); // tel terminal to erase display
|
||||
mysleep(10);
|
||||
place_cursor(0, 0);
|
||||
clear_to_eos();
|
||||
//mysleep(10); // why???
|
||||
screen_erase(); // erase the internal screen buffer
|
||||
last_status_cksum = 0; // force status update
|
||||
refresh(TRUE); // this will redraw the entire display
|
||||
@@ -4141,7 +4080,7 @@ static void crash_test()
|
||||
|
||||
if (msg[0]) {
|
||||
printf("\n\n%d: \'%c\' %s\n\n\n%s[Hit return to continue]%s",
|
||||
totalcmds, last_input_char, msg, SOs, SOn);
|
||||
totalcmds, last_input_char, msg, ESC_BOLD_TEXT, ESC_NORM_TEXT);
|
||||
fflush_all();
|
||||
while (safe_read(STDIN_FILENO, d, 1) > 0) {
|
||||
if (d[0] == '\n' || d[0] == '\r')
|
||||
|
||||
+8
-2
@@ -7,8 +7,14 @@
|
||||
# instead of the default 0:0 660.
|
||||
#
|
||||
# Syntax:
|
||||
# %s %d:%d %s
|
||||
# devicename_regex user:group mode
|
||||
# [-]devicename_regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
|
||||
# [-]$ENVVAR=regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
|
||||
# [-]@maj,min[-min2] user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
|
||||
#
|
||||
# [-]: do not stop on this match, continue reading mdev.conf
|
||||
# =: move, >: move and create a symlink
|
||||
# !: do not create device node
|
||||
# @|$|*: run@cmd if $ACTION=add, $cmd if $ACTION=remove, *cmd in all cases
|
||||
|
||||
null 0:0 666
|
||||
zero 0:0 666
|
||||
|
||||
@@ -7,10 +7,14 @@
|
||||
# instead of the default 0:0 660.
|
||||
#
|
||||
# Syntax:
|
||||
# [-]devicename_regex user:group mode [>|=path] [@|$|*cmd args...]
|
||||
# [-]devicename_regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
|
||||
# [-]$ENVVAR=regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
|
||||
# [-]@maj,min[-min2] user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
|
||||
#
|
||||
# [-]: do not stop on this match, continue reading mdev.conf
|
||||
# =: move, >: move and create a symlink
|
||||
# @|$|*: run $cmd on delete, @cmd on create, *cmd on both
|
||||
# !: do not create device node
|
||||
# @|$|*: run cmd if $ACTION=remove, @cmd if $ACTION=add, *cmd in all cases
|
||||
|
||||
# support module loading on hotplug
|
||||
$MODALIAS=.* root:root 660 @modprobe "$MODALIAS"
|
||||
@@ -49,7 +53,6 @@ sr[0-9]* root:cdrom 660 @ln -sf $MDEV cdrom
|
||||
fd[0-9]* root:floppy 660
|
||||
|
||||
# net devices
|
||||
-net/.* root:root 600 @nameif
|
||||
tun[0-9]* root:root 600 =net/
|
||||
tap[0-9]* root:root 600 =net/
|
||||
|
||||
|
||||
+23
-16
@@ -728,10 +728,27 @@ static int FAST_FUNC fileAction(const char *fileName,
|
||||
int depth IF_NOT_FEATURE_FIND_MAXDEPTH(UNUSED_PARAM))
|
||||
{
|
||||
int r;
|
||||
int same_fs = 1;
|
||||
|
||||
#if ENABLE_FEATURE_FIND_XDEV
|
||||
if (S_ISDIR(statbuf->st_mode) && G.xdev_count) {
|
||||
int i;
|
||||
for (i = 0; i < G.xdev_count; i++) {
|
||||
if (G.xdev_dev[i] == statbuf->st_dev)
|
||||
goto found;
|
||||
}
|
||||
//bb_error_msg("'%s': not same fs", fileName);
|
||||
same_fs = 0;
|
||||
found: ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLE_FEATURE_FIND_MAXDEPTH
|
||||
if (depth < G.minmaxdepth[0])
|
||||
return TRUE; /* skip this, continue recursing */
|
||||
if (depth < G.minmaxdepth[0]) {
|
||||
if (same_fs)
|
||||
return TRUE; /* skip this, continue recursing */
|
||||
return SKIP; /* stop recursing */
|
||||
}
|
||||
if (depth > G.minmaxdepth[1])
|
||||
return SKIP; /* stop recursing */
|
||||
#endif
|
||||
@@ -747,21 +764,11 @@ static int FAST_FUNC fileAction(const char *fileName,
|
||||
return SKIP;
|
||||
}
|
||||
#endif
|
||||
#if ENABLE_FEATURE_FIND_XDEV
|
||||
/* -xdev stops on mountpoints, but AFTER mountpoit itself
|
||||
* is processed as usual */
|
||||
if (S_ISDIR(statbuf->st_mode)) {
|
||||
if (G.xdev_count) {
|
||||
int i;
|
||||
for (i = 0; i < G.xdev_count; i++) {
|
||||
if (G.xdev_dev[i] == statbuf->st_dev)
|
||||
goto found;
|
||||
}
|
||||
return SKIP;
|
||||
found: ;
|
||||
}
|
||||
if (!same_fs) {
|
||||
return SKIP;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Cannot return 0: our caller, recursive_action(),
|
||||
* will perror() and skip dirs (if called on dir) */
|
||||
@@ -871,8 +878,8 @@ static action*** parse_params(char **argv)
|
||||
IF_FEATURE_FIND_EXEC( "-exec\0" )
|
||||
IF_FEATURE_FIND_PAREN( "(\0" )
|
||||
/* All options/actions starting from here require argument */
|
||||
"-name\0"
|
||||
"-iname\0"
|
||||
"-name\0"
|
||||
"-iname\0"
|
||||
IF_FEATURE_FIND_PATH( "-path\0" )
|
||||
#if ENABLE_DESKTOP
|
||||
IF_FEATURE_FIND_PATH( "-wholename\0")
|
||||
|
||||
+33
-6
@@ -344,10 +344,34 @@ static int grep_file(FILE *file)
|
||||
while (pattern_ptr) {
|
||||
gl = (grep_list_data_t *)pattern_ptr->data;
|
||||
if (FGREP_FLAG) {
|
||||
found |= (((option_mask32 & OPT_i)
|
||||
? strcasestr(line, gl->pattern)
|
||||
: strstr(line, gl->pattern)
|
||||
) != NULL);
|
||||
char *match;
|
||||
char *str = line;
|
||||
opt_f_again:
|
||||
match = ((option_mask32 & OPT_i)
|
||||
? strcasestr(str, gl->pattern)
|
||||
: strstr(str, gl->pattern)
|
||||
);
|
||||
if (match) {
|
||||
if (option_mask32 & OPT_x) {
|
||||
if (match != str)
|
||||
goto opt_f_not_found;
|
||||
if (str[strlen(gl->pattern)] != '\0')
|
||||
goto opt_f_not_found;
|
||||
} else
|
||||
if (option_mask32 & OPT_w) {
|
||||
char c = (match != str) ? match[-1] : ' ';
|
||||
if (!isalnum(c) && c != '_') {
|
||||
c = match[strlen(gl->pattern)];
|
||||
if (!c || (!isalnum(c) && c != '_'))
|
||||
goto opt_f_found;
|
||||
}
|
||||
str = match + 1;
|
||||
goto opt_f_again;
|
||||
}
|
||||
opt_f_found:
|
||||
found = 1;
|
||||
opt_f_not_found: ;
|
||||
}
|
||||
} else {
|
||||
if (!(gl->flg_mem_alocated_compiled & COMPILED)) {
|
||||
gl->flg_mem_alocated_compiled |= COMPILED;
|
||||
@@ -376,7 +400,8 @@ static int grep_file(FILE *file)
|
||||
if (option_mask32 & OPT_x) {
|
||||
found = (gl->matched_range.rm_so == 0
|
||||
&& line[gl->matched_range.rm_eo] == '\0');
|
||||
} else if (!(option_mask32 & OPT_w)) {
|
||||
} else
|
||||
if (!(option_mask32 & OPT_w)) {
|
||||
found = 1;
|
||||
} else {
|
||||
char c = ' ';
|
||||
@@ -387,6 +412,8 @@ static int grep_file(FILE *file)
|
||||
if (!c || (!isalnum(c) && c != '_'))
|
||||
found = 1;
|
||||
}
|
||||
//BUG: "echo foop foo | grep -w foo" should match, but doesn't:
|
||||
//we bail out on first "mismatch" because it's not a word.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -638,7 +665,7 @@ int grep_main(int argc UNUSED_PARAM, char **argv)
|
||||
|
||||
if (opts & OPT_C) {
|
||||
/* -C unsets prev -A and -B, but following -A or -B
|
||||
may override it */
|
||||
* may override it */
|
||||
if (!(opts & OPT_A)) /* not overridden */
|
||||
lines_after = Copt;
|
||||
if (!(opts & OPT_B)) /* not overridden */
|
||||
|
||||
+21
-20
@@ -70,12 +70,12 @@ INSERT
|
||||
IF_TEST(APPLET_NOFORK([, test, BB_DIR_USR_BIN, BB_SUID_DROP, test))
|
||||
IF_TEST(APPLET_NOFORK([[, test, BB_DIR_USR_BIN, BB_SUID_DROP, test))
|
||||
IF_ACPID(APPLET(acpid, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_ADDGROUP(APPLET(addgroup, BB_DIR_BIN, BB_SUID_DROP))
|
||||
IF_ADDUSER(APPLET(adduser, BB_DIR_BIN, BB_SUID_DROP))
|
||||
IF_ADDGROUP(APPLET(addgroup, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_ADDUSER(APPLET(adduser, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_ADJTIMEX(APPLET(adjtimex, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_AR(APPLET(ar, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_ARP(APPLET(arp, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_ARPING(APPLET(arping, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_ARPING(APPLET(arping, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_AWK(APPLET_NOEXEC(awk, awk, BB_DIR_USR_BIN, BB_SUID_DROP, awk))
|
||||
IF_BASENAME(APPLET_NOFORK(basename, basename, BB_DIR_USR_BIN, BB_SUID_DROP, basename))
|
||||
IF_BBCONFIG(APPLET(bbconfig, BB_DIR_BIN, BB_SUID_DROP))
|
||||
@@ -86,7 +86,7 @@ IF_BZIP2(APPLET(bzip2, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_CAL(APPLET(cal, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_CAT(APPLET_NOFORK(cat, cat, BB_DIR_BIN, BB_SUID_DROP, cat))
|
||||
IF_CATV(APPLET(catv, BB_DIR_BIN, BB_SUID_DROP))
|
||||
IF_CHAT(APPLET(chat, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_CHAT(APPLET(chat, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_CHATTR(APPLET(chattr, BB_DIR_BIN, BB_SUID_DROP))
|
||||
IF_CHCON(APPLET(chcon, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_CHGRP(APPLET_NOEXEC(chgrp, chgrp, BB_DIR_BIN, BB_SUID_DROP, chgrp))
|
||||
@@ -111,8 +111,8 @@ IF_CUT(APPLET_NOEXEC(cut, cut, BB_DIR_USR_BIN, BB_SUID_DROP, cut))
|
||||
IF_DC(APPLET(dc, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_DD(APPLET_NOEXEC(dd, dd, BB_DIR_BIN, BB_SUID_DROP, dd))
|
||||
IF_DEALLOCVT(APPLET(deallocvt, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_DELGROUP(APPLET_ODDNAME(delgroup, deluser, BB_DIR_BIN, BB_SUID_DROP, delgroup))
|
||||
IF_DELUSER(APPLET(deluser, BB_DIR_BIN, BB_SUID_DROP))
|
||||
IF_DELGROUP(APPLET_ODDNAME(delgroup, deluser, BB_DIR_USR_SBIN, BB_SUID_DROP, delgroup))
|
||||
IF_DELUSER(APPLET(deluser, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_DEVFSD(APPLET(devfsd, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_DEVMEM(APPLET(devmem, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_DF(APPLET(df, BB_DIR_BIN, BB_SUID_DROP))
|
||||
@@ -136,7 +136,7 @@ IF_EJECT(APPLET(eject, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_ENV(APPLET_NOEXEC(env, env, BB_DIR_USR_BIN, BB_SUID_DROP, env))
|
||||
IF_ENVDIR(APPLET_ODDNAME(envdir, chpst, BB_DIR_USR_BIN, BB_SUID_DROP, envdir))
|
||||
IF_ENVUIDGID(APPLET_ODDNAME(envuidgid, chpst, BB_DIR_USR_BIN, BB_SUID_DROP, envuidgid))
|
||||
IF_ETHER_WAKE(APPLET_ODDNAME(ether-wake, ether_wake, BB_DIR_USR_BIN, BB_SUID_DROP, ether_wake))
|
||||
IF_ETHER_WAKE(APPLET_ODDNAME(ether-wake, ether_wake, BB_DIR_USR_SBIN, BB_SUID_DROP, ether_wake))
|
||||
IF_EXPAND(APPLET(expand, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_EXPR(APPLET(expr, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_FAKEIDENTD(APPLET(fakeidentd, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
@@ -144,7 +144,7 @@ IF_FALSE(APPLET_NOFORK(false, false, BB_DIR_BIN, BB_SUID_DROP, false))
|
||||
IF_FBSET(APPLET(fbset, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_FBSPLASH(APPLET(fbsplash, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_FDFLUSH(APPLET_ODDNAME(fdflush, freeramdisk, BB_DIR_BIN, BB_SUID_DROP, fdflush))
|
||||
IF_FDFORMAT(APPLET(fdformat, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_FDFORMAT(APPLET(fdformat, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_FDISK(APPLET(fdisk, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_FGCONSOLE(APPLET(fgconsole, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
/* Benefits from suid root: better access to /dev/BLOCKDEVs: */
|
||||
@@ -182,7 +182,7 @@ IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_IFCONFIG(APPLET(ifconfig, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_IFUPDOWN(APPLET_ODDNAME(ifdown, ifupdown, BB_DIR_SBIN, BB_SUID_DROP, ifdown))
|
||||
IF_IFENSLAVE(APPLET(ifenslave, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_IFPLUGD(APPLET(ifplugd, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_IFPLUGD(APPLET(ifplugd, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_IFUPDOWN(APPLET_ODDNAME(ifup, ifupdown, BB_DIR_SBIN, BB_SUID_DROP, ifup))
|
||||
IF_INETD(APPLET(inetd, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_INOTIFYD(APPLET(inotifyd, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
@@ -193,20 +193,20 @@ IF_IONICE(APPLET(ionice, BB_DIR_BIN, BB_SUID_DROP))
|
||||
|| ENABLE_FEATURE_IP_LINK \
|
||||
|| ENABLE_FEATURE_IP_TUNNEL \
|
||||
|| ENABLE_FEATURE_IP_RULE
|
||||
IF_IP(APPLET(ip, BB_DIR_BIN, BB_SUID_DROP))
|
||||
IF_IP(APPLET(ip, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
#endif
|
||||
IF_IPADDR(APPLET(ipaddr, BB_DIR_BIN, BB_SUID_DROP))
|
||||
IF_IPADDR(APPLET(ipaddr, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_IPCALC(APPLET(ipcalc, BB_DIR_BIN, BB_SUID_DROP))
|
||||
IF_IPCRM(APPLET(ipcrm, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_IPCS(APPLET(ipcs, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_IPLINK(APPLET(iplink, BB_DIR_BIN, BB_SUID_DROP))
|
||||
IF_IPROUTE(APPLET(iproute, BB_DIR_BIN, BB_SUID_DROP))
|
||||
IF_IPRULE(APPLET(iprule, BB_DIR_BIN, BB_SUID_DROP))
|
||||
IF_IPTUNNEL(APPLET(iptunnel, BB_DIR_BIN, BB_SUID_DROP))
|
||||
IF_KBD_MODE(APPLET(kbd_mode, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_IPLINK(APPLET(iplink, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_IPROUTE(APPLET(iproute, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_IPRULE(APPLET(iprule, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_IPTUNNEL(APPLET(iptunnel, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_KBD_MODE(APPLET(kbd_mode, BB_DIR_BIN, BB_SUID_DROP))
|
||||
IF_KILL(APPLET(kill, BB_DIR_BIN, BB_SUID_DROP))
|
||||
IF_KILLALL(APPLET_ODDNAME(killall, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall))
|
||||
IF_KILLALL5(APPLET_ODDNAME(killall5, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall5))
|
||||
IF_KILLALL5(APPLET_ODDNAME(killall5, kill, BB_DIR_USR_SBIN, BB_SUID_DROP, killall5))
|
||||
IF_KLOGD(APPLET(klogd, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_LAST(APPLET(last, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
//IF_LENGTH(APPLET_NOFORK(length, length, BB_DIR_USR_BIN, BB_SUID_DROP, length))
|
||||
@@ -288,7 +288,7 @@ IF_PWD(APPLET_NOFORK(pwd, pwd, BB_DIR_BIN, BB_SUID_DROP, pwd))
|
||||
IF_RAIDAUTORUN(APPLET(raidautorun, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_RDATE(APPLET(rdate, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_RDEV(APPLET(rdev, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_READAHEAD(APPLET(readahead, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_READAHEAD(APPLET(readahead, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_READLINK(APPLET(readlink, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_READPROFILE(APPLET(readprofile, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_REALPATH(APPLET(realpath, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
@@ -303,7 +303,7 @@ IF_RMDIR(APPLET_NOFORK(rmdir, rmdir, BB_DIR_BIN, BB_SUID_DROP, rmdir))
|
||||
IF_ROUTE(APPLET(route, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
IF_RPM(APPLET(rpm, BB_DIR_BIN, BB_SUID_DROP))
|
||||
IF_RPM2CPIO(APPLET(rpm2cpio, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_RTCWAKE(APPLET(rtcwake, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_RTCWAKE(APPLET(rtcwake, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_RUN_PARTS(APPLET_ODDNAME(run-parts, run_parts, BB_DIR_BIN, BB_SUID_DROP, run_parts))
|
||||
IF_RUNCON(APPLET(runcon, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_RUNLEVEL(APPLET(runlevel, BB_DIR_SBIN, BB_SUID_DROP))
|
||||
@@ -328,6 +328,7 @@ IF_SETSEBOOL(APPLET(setsebool, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_SETSID(APPLET(setsid, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_SETUIDGID(APPLET_ODDNAME(setuidgid, chpst, BB_DIR_USR_BIN, BB_SUID_DROP, setuidgid))
|
||||
IF_SHA1SUM(APPLET_NOEXEC(sha1sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, sha1sum))
|
||||
IF_SHA3SUM(APPLET_NOEXEC(sha3sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, sha3sum))
|
||||
IF_SHA256SUM(APPLET_NOEXEC(sha256sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, sha256sum))
|
||||
IF_SHA512SUM(APPLET_NOEXEC(sha512sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, sha512sum))
|
||||
IF_SHOWKEY(APPLET(showkey, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
@@ -365,7 +366,7 @@ IF_TELNETD(APPLET(telnetd, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_TEST(APPLET_NOFORK(test, test, BB_DIR_USR_BIN, BB_SUID_DROP, test))
|
||||
#if ENABLE_FEATURE_TFTP_GET || ENABLE_FEATURE_TFTP_PUT
|
||||
IF_TFTP(APPLET(tftp, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_TFTPD(APPLET(tftpd, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_TFTPD(APPLET(tftpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
#endif
|
||||
IF_TIME(APPLET(time, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
IF_TIMEOUT(APPLET(timeout, BB_DIR_USR_BIN, BB_SUID_DROP))
|
||||
|
||||
@@ -121,6 +121,7 @@ typedef struct archive_handle_t {
|
||||
#define ARCHIVE_DONT_RESTORE_PERM (1 << 6)
|
||||
#define ARCHIVE_NUMERIC_OWNER (1 << 7)
|
||||
#define ARCHIVE_O_TRUNC (1 << 8)
|
||||
#define ARCHIVE_REMEMBER_NAMES (1 << 9)
|
||||
|
||||
|
||||
/* POSIX tar Header Block, from POSIX 1003.1-1990 */
|
||||
@@ -219,9 +220,9 @@ IF_DESKTOP(long long) int unpack_xz_stream(transformer_aux_data_t *aux, int src_
|
||||
|
||||
char* append_ext(char *filename, const char *expected_ext) FAST_FUNC;
|
||||
int bbunpack(char **argv,
|
||||
IF_DESKTOP(long long) int FAST_FUNC (*unpacker)(transformer_aux_data_t *aux),
|
||||
char* FAST_FUNC (*make_new_name)(char *filename, const char *expected_ext),
|
||||
const char *expected_ext
|
||||
IF_DESKTOP(long long) int FAST_FUNC (*unpacker)(transformer_aux_data_t *aux),
|
||||
char* FAST_FUNC (*make_new_name)(char *filename, const char *expected_ext),
|
||||
const char *expected_ext
|
||||
) FAST_FUNC;
|
||||
|
||||
void check_errors_in_children(int signo);
|
||||
|
||||
+33
-10
@@ -406,21 +406,21 @@ struct ext2_super_block {
|
||||
* Performance hints. Directory preallocation should only
|
||||
* happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
|
||||
*/
|
||||
uint8_t s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
|
||||
uint8_t s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
|
||||
uint8_t s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
|
||||
uint8_t s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
|
||||
uint16_t s_reserved_gdt_blocks; /* Per group table for online growth */
|
||||
/*
|
||||
* Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
|
||||
*/
|
||||
uint8_t s_journal_uuid[16]; /* uuid of journal superblock */
|
||||
uint32_t s_journal_inum; /* inode number of journal file */
|
||||
/*D0*/ uint8_t s_journal_uuid[16]; /* uuid of journal superblock */
|
||||
/*E0*/ uint32_t s_journal_inum; /* inode number of journal file */
|
||||
uint32_t s_journal_dev; /* device number of journal file */
|
||||
uint32_t s_last_orphan; /* start of list of inodes to delete */
|
||||
uint32_t s_hash_seed[4]; /* HTREE hash seed */
|
||||
uint8_t s_def_hash_version; /* Default hash version to use */
|
||||
uint8_t s_jnl_backup_type; /* Default type of journal backup */
|
||||
uint16_t s_reserved_word_pad;
|
||||
uint32_t s_default_mount_opts;
|
||||
/*100*/ uint32_t s_default_mount_opts;
|
||||
uint32_t s_first_meta_bg; /* First metablock group */
|
||||
/* ext3 additions */
|
||||
uint32_t s_mkfs_time; /* When the filesystem was created */
|
||||
@@ -481,6 +481,7 @@ struct BUG_ext2_super_block {
|
||||
#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
|
||||
( EXT2_SB(sb)->s_feature_incompat & (mask) )
|
||||
|
||||
/* for s_feature_compat */
|
||||
#define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001
|
||||
#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002
|
||||
#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
|
||||
@@ -488,23 +489,45 @@ struct BUG_ext2_super_block {
|
||||
#define EXT2_FEATURE_COMPAT_RESIZE_INO 0x0010
|
||||
#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020
|
||||
|
||||
/* for s_feature_ro_compat */
|
||||
#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
|
||||
#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
|
||||
/* #define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 not used */
|
||||
#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 /* not used */
|
||||
#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008
|
||||
#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
|
||||
#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
|
||||
#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
|
||||
|
||||
/* for s_feature_incompat */
|
||||
#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001
|
||||
#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
|
||||
#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */
|
||||
#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
|
||||
#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004
|
||||
#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008
|
||||
#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010
|
||||
#define EXT3_FEATURE_INCOMPAT_EXTENTS 0x0040
|
||||
#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040
|
||||
#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
|
||||
#define EXT4_FEATURE_INCOMPAT_MMP 0x0100
|
||||
#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
|
||||
|
||||
|
||||
#define EXT2_FEATURE_COMPAT_SUPP 0
|
||||
#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE)
|
||||
#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
|
||||
EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
|
||||
EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
|
||||
#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \
|
||||
EXT2_FEATURE_INCOMPAT_META_BG)
|
||||
#define EXT2_FEATURE_INCOMPAT_UNSUPPORTED (~EXT2_FEATURE_INCOMPAT_SUPP)
|
||||
#define EXT2_FEATURE_RO_COMPAT_UNSUPPORTED (~EXT2_FEATURE_RO_COMPAT_SUPP)
|
||||
|
||||
#define EXT3_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
|
||||
EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
|
||||
EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
|
||||
#define EXT3_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \
|
||||
EXT3_FEATURE_INCOMPAT_RECOVER| \
|
||||
EXT2_FEATURE_INCOMPAT_META_BG)
|
||||
#define EXT3_FEATURE_INCOMPAT_UNSUPPORTED (~EXT3_FEATURE_INCOMPAT_SUPP)
|
||||
#define EXT3_FEATURE_RO_COMPAT_UNSUPPORTED (~EXT3_FEATURE_RO_COMPAT_SUPP)
|
||||
|
||||
|
||||
/*
|
||||
* Default values for user and/or group using reserved blocks
|
||||
|
||||
+2
-2
@@ -13,10 +13,10 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
|
||||
|
||||
/* Defined in appletlib.c (by including generated applet_tables.h) */
|
||||
/* Keep in sync with applets/applet_tables.c! */
|
||||
extern const char applet_names[];
|
||||
extern const char applet_names[] ALIGN1;
|
||||
extern int (*const applet_main[])(int argc, char **argv);
|
||||
extern const uint16_t applet_nameofs[];
|
||||
extern const uint8_t applet_install_loc[];
|
||||
extern const uint8_t applet_install_loc[] ALIGN1;
|
||||
|
||||
#if ENABLE_FEATURE_SUID || ENABLE_FEATURE_PREFER_APPLETS
|
||||
# define APPLET_NAME(i) (applet_names + (applet_nameofs[i] & 0x0fff))
|
||||
|
||||
+12
-12
@@ -64,7 +64,7 @@ extern struct group *fgetgrent(FILE *__stream);
|
||||
|
||||
/* Write the given entry onto the given stream. */
|
||||
extern int putgrent(const struct group *__restrict __p,
|
||||
FILE *__restrict __f);
|
||||
FILE *__restrict __f);
|
||||
#endif
|
||||
|
||||
/* Search for an entry with a matching group ID. */
|
||||
@@ -82,32 +82,32 @@ extern struct group *getgrnam(const char *__name);
|
||||
POSIX people would choose. */
|
||||
|
||||
extern int getgrent_r(struct group *__restrict __resultbuf,
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct group **__restrict __result);
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct group **__restrict __result);
|
||||
|
||||
/* Search for an entry with a matching group ID. */
|
||||
extern int getgrgid_r(gid_t __gid, struct group *__restrict __resultbuf,
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct group **__restrict __result);
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct group **__restrict __result);
|
||||
|
||||
/* Search for an entry with a matching group name. */
|
||||
extern int getgrnam_r(const char *__restrict __name,
|
||||
struct group *__restrict __resultbuf,
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct group **__restrict __result);
|
||||
struct group *__restrict __resultbuf,
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct group **__restrict __result);
|
||||
|
||||
/* Read a group entry from STREAM. This function is not standardized
|
||||
an probably never will. */
|
||||
extern int fgetgrent_r(FILE *__restrict __stream,
|
||||
struct group *__restrict __resultbuf,
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct group **__restrict __result);
|
||||
struct group *__restrict __resultbuf,
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct group **__restrict __result);
|
||||
|
||||
/* Store at most *NGROUPS members of the group set for USER into
|
||||
*GROUPS. Also include GROUP. The actual number of groups found is
|
||||
returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. */
|
||||
extern int getgrouplist(const char *__user, gid_t __group,
|
||||
gid_t *__groups, int *__ngroups);
|
||||
gid_t *__groups, int *__ngroups);
|
||||
|
||||
/* Initialize the group set for the current user
|
||||
by reading the group database and using all groups
|
||||
|
||||
+30
-22
@@ -333,6 +333,7 @@ enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */
|
||||
FILEUTILS_PRESERVE_SECURITY_CONTEXT = 1 << 9, /* -c */
|
||||
FILEUTILS_SET_SECURITY_CONTEXT = 1 << 10,
|
||||
#endif
|
||||
FILEUTILS_IGNORE_CHMOD_ERR = 1 << 11,
|
||||
};
|
||||
#define FILEUTILS_CP_OPTSTR "pdRfilsLH" IF_SELINUX("c")
|
||||
extern int remove_file(const char *path, int flags) FAST_FUNC;
|
||||
@@ -795,7 +796,6 @@ void qsort_string_vector(char **sv, unsigned count) FAST_FUNC;
|
||||
int safe_poll(struct pollfd *ufds, nfds_t nfds, int timeout_ms) FAST_FUNC;
|
||||
|
||||
char *safe_gethostname(void) FAST_FUNC;
|
||||
char *safe_getdomainname(void) FAST_FUNC;
|
||||
|
||||
/* Convert each alpha char in str to lower-case */
|
||||
char* str_tolower(char *str) FAST_FUNC;
|
||||
@@ -1248,7 +1248,7 @@ extern void run_shell(const char *shell, int loginshell, const char *command, co
|
||||
* Note that getpwuid result might need xstrdup'ing
|
||||
* if there is a possibility of intervening getpwxxx() calls.
|
||||
*/
|
||||
const char *get_shell_name(void);
|
||||
const char *get_shell_name(void) FAST_FUNC;
|
||||
|
||||
#if ENABLE_SELINUX
|
||||
extern void renew_current_security_context(void) FAST_FUNC;
|
||||
@@ -1286,6 +1286,7 @@ int sd_listen_fds(void);
|
||||
#define SETUP_ENV_CHANGEENV (1 << 0)
|
||||
#define SETUP_ENV_CLEARENV (1 << 1)
|
||||
#define SETUP_ENV_TO_TMP (1 << 2)
|
||||
#define SETUP_ENV_NO_CHDIR (1 << 4)
|
||||
extern void setup_environment(const char *shell, int flags, const struct passwd *pw) FAST_FUNC;
|
||||
extern int correct_password(const struct passwd *pw) FAST_FUNC;
|
||||
/* Returns a malloced string */
|
||||
@@ -1515,7 +1516,7 @@ struct smaprec {
|
||||
procps_read_smaps(pid, total)
|
||||
#endif
|
||||
int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total,
|
||||
void (*cb)(struct smaprec *, void *), void *data);
|
||||
void (*cb)(struct smaprec *, void *), void *data);
|
||||
|
||||
typedef struct procps_status_t {
|
||||
DIR *dir;
|
||||
@@ -1611,8 +1612,8 @@ unsigned get_cpu_count(void) FAST_FUNC;
|
||||
char *percent_decode_in_place(char *str, int strict) FAST_FUNC;
|
||||
|
||||
|
||||
extern const char bb_uuenc_tbl_base64[];
|
||||
extern const char bb_uuenc_tbl_std[];
|
||||
extern const char bb_uuenc_tbl_base64[] ALIGN1;
|
||||
extern const char bb_uuenc_tbl_std[] ALIGN1;
|
||||
void bb_uuencode(char *store, const void *s, int length, const char *tbl) FAST_FUNC;
|
||||
enum {
|
||||
BASE64_FLAG_UU_STOP = 0x100,
|
||||
@@ -1635,8 +1636,12 @@ typedef struct sha512_ctx_t {
|
||||
uint64_t hash[8];
|
||||
uint8_t wbuffer[128]; /* always correctly aligned for uint64_t */
|
||||
} sha512_ctx_t;
|
||||
typedef struct sha3_ctx_t {
|
||||
uint64_t state[25];
|
||||
unsigned bytes_queued;
|
||||
} sha3_ctx_t;
|
||||
void md5_begin(md5_ctx_t *ctx) FAST_FUNC;
|
||||
void md5_hash(md5_ctx_t *ctx, const void *data, size_t length) FAST_FUNC;
|
||||
void md5_hash(md5_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC;
|
||||
void md5_end(md5_ctx_t *ctx, void *resbuf) FAST_FUNC;
|
||||
void sha1_begin(sha1_ctx_t *ctx) FAST_FUNC;
|
||||
#define sha1_hash md5_hash
|
||||
@@ -1647,6 +1652,9 @@ void sha256_begin(sha256_ctx_t *ctx) FAST_FUNC;
|
||||
void sha512_begin(sha512_ctx_t *ctx) FAST_FUNC;
|
||||
void sha512_hash(sha512_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC;
|
||||
void sha512_end(sha512_ctx_t *ctx, void *resbuf) FAST_FUNC;
|
||||
void sha3_begin(sha3_ctx_t *ctx) FAST_FUNC;
|
||||
void sha3_hash(sha3_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC;
|
||||
void sha3_end(sha3_ctx_t *ctx, void *resbuf) FAST_FUNC;
|
||||
|
||||
extern uint32_t *global_crc32_table;
|
||||
uint32_t *crc32_filltable(uint32_t *tbl256, int endian) FAST_FUNC;
|
||||
@@ -1693,24 +1701,24 @@ extern const char *applet_name;
|
||||
* Therefore now we use #defines.
|
||||
*/
|
||||
/* "BusyBox vN.N.N (timestamp or extra_version)" */
|
||||
extern const char bb_banner[];
|
||||
extern const char bb_msg_memory_exhausted[];
|
||||
extern const char bb_msg_invalid_date[];
|
||||
extern const char bb_banner[] ALIGN1;
|
||||
extern const char bb_msg_memory_exhausted[] ALIGN1;
|
||||
extern const char bb_msg_invalid_date[] ALIGN1;
|
||||
#define bb_msg_read_error "read error"
|
||||
#define bb_msg_write_error "write error"
|
||||
extern const char bb_msg_unknown[];
|
||||
extern const char bb_msg_can_not_create_raw_socket[];
|
||||
extern const char bb_msg_perm_denied_are_you_root[];
|
||||
extern const char bb_msg_you_must_be_root[];
|
||||
extern const char bb_msg_requires_arg[];
|
||||
extern const char bb_msg_invalid_arg[];
|
||||
extern const char bb_msg_standard_input[];
|
||||
extern const char bb_msg_standard_output[];
|
||||
extern const char bb_msg_unknown[] ALIGN1;
|
||||
extern const char bb_msg_can_not_create_raw_socket[] ALIGN1;
|
||||
extern const char bb_msg_perm_denied_are_you_root[] ALIGN1;
|
||||
extern const char bb_msg_you_must_be_root[] ALIGN1;
|
||||
extern const char bb_msg_requires_arg[] ALIGN1;
|
||||
extern const char bb_msg_invalid_arg[] ALIGN1;
|
||||
extern const char bb_msg_standard_input[] ALIGN1;
|
||||
extern const char bb_msg_standard_output[] ALIGN1;
|
||||
|
||||
/* NB: (bb_hexdigits_upcase[i] | 0x20) -> lowercase hex digit */
|
||||
extern const char bb_hexdigits_upcase[];
|
||||
extern const char bb_hexdigits_upcase[] ALIGN1;
|
||||
|
||||
extern const char bb_path_wtmp_file[];
|
||||
extern const char bb_path_wtmp_file[] ALIGN1;
|
||||
|
||||
/* Busybox mount uses either /proc/mounts or /etc/mtab to
|
||||
* get the list of currently mounted filesystems */
|
||||
@@ -1724,10 +1732,10 @@ extern const char bb_path_wtmp_file[];
|
||||
#define bb_path_motd_file "/etc/motd"
|
||||
|
||||
#define bb_dev_null "/dev/null"
|
||||
extern const char bb_busybox_exec_path[];
|
||||
extern const char bb_busybox_exec_path[] ALIGN1;
|
||||
/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
|
||||
* but I want to save a few bytes here */
|
||||
extern const char bb_PATH_root_path[]; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */
|
||||
extern const char bb_PATH_root_path[] ALIGN1; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */
|
||||
#define bb_default_root_path (bb_PATH_root_path + sizeof("PATH"))
|
||||
#define bb_default_path (bb_PATH_root_path + sizeof("PATH=/sbin:/usr/sbin"))
|
||||
|
||||
@@ -1757,7 +1765,7 @@ extern struct globals *const ptr_to_globals;
|
||||
* If you change LIBBB_DEFAULT_LOGIN_SHELL,
|
||||
* don't forget to change increment constant. */
|
||||
#define LIBBB_DEFAULT_LOGIN_SHELL "-/bin/sh"
|
||||
extern const char bb_default_login_shell[];
|
||||
extern const char bb_default_login_shell[] ALIGN1;
|
||||
/* "/bin/sh" */
|
||||
#define DEFAULT_SHELL (bb_default_login_shell+1)
|
||||
/* "sh" */
|
||||
|
||||
+13
-3
@@ -205,6 +205,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
typedef int bb__aliased_int FIX_ALIASING;
|
||||
typedef long bb__aliased_long FIX_ALIASING;
|
||||
typedef uint16_t bb__aliased_uint16_t FIX_ALIASING;
|
||||
typedef uint32_t bb__aliased_uint32_t FIX_ALIASING;
|
||||
|
||||
@@ -212,7 +213,8 @@ typedef uint32_t bb__aliased_uint32_t FIX_ALIASING;
|
||||
* a lvalue. This makes it more likely to not swap them by mistake
|
||||
*/
|
||||
#if defined(i386) || defined(__x86_64__) || defined(__powerpc__)
|
||||
# define move_from_unaligned_int(v, intp) ((v) = *(bb__aliased_int*)(intp))
|
||||
# define move_from_unaligned_int(v, intp) ((v) = *(bb__aliased_int*)(intp))
|
||||
# define move_from_unaligned_long(v, longp) ((v) = *(bb__aliased_long*)(longp))
|
||||
# define move_from_unaligned16(v, u16p) ((v) = *(bb__aliased_uint16_t*)(u16p))
|
||||
# define move_from_unaligned32(v, u32p) ((v) = *(bb__aliased_uint32_t*)(u32p))
|
||||
# define move_to_unaligned16(u16p, v) (*(bb__aliased_uint16_t*)(u16p) = (v))
|
||||
@@ -221,11 +223,12 @@ typedef uint32_t bb__aliased_uint32_t FIX_ALIASING;
|
||||
#else
|
||||
/* performs reasonably well (gcc usually inlines memcpy here) */
|
||||
# define move_from_unaligned_int(v, intp) (memcpy(&(v), (intp), sizeof(int)))
|
||||
# define move_from_unaligned_long(v, longp) (memcpy(&(v), (longp), sizeof(long)))
|
||||
# define move_from_unaligned16(v, u16p) (memcpy(&(v), (u16p), 2))
|
||||
# define move_from_unaligned32(v, u32p) (memcpy(&(v), (u32p), 4))
|
||||
# define move_to_unaligned16(u16p, v) do { \
|
||||
uint16_t __t = (v); \
|
||||
memcpy((u16p), &__t, 4); \
|
||||
memcpy((u16p), &__t, 2); \
|
||||
} while (0)
|
||||
# define move_to_unaligned32(u32p, v) do { \
|
||||
uint32_t __t = (v); \
|
||||
@@ -284,7 +287,8 @@ typedef unsigned smalluint;
|
||||
#define fdprintf dprintf
|
||||
|
||||
/* Useful for defeating gcc's alignment of "char message[]"-like data */
|
||||
#if 1 /* if needed: !defined(arch1) && !defined(arch2) */
|
||||
#if !defined(__s390__)
|
||||
/* on s390[x], non-word-aligned data accesses require larger code */
|
||||
# define ALIGN1 __attribute__((aligned(1)))
|
||||
# define ALIGN2 __attribute__((aligned(2)))
|
||||
# define ALIGN4 __attribute__((aligned(4)))
|
||||
@@ -334,6 +338,12 @@ typedef unsigned smalluint;
|
||||
# define MAXSYMLINKS SYMLOOP_MAX
|
||||
#endif
|
||||
|
||||
#if defined(ANDROID) || defined(__ANDROID__)
|
||||
# define BB_ADDITIONAL_PATH ":/system/sbin:/system/bin:/system/xbin"
|
||||
# define SYS_ioprio_set __NR_ioprio_set
|
||||
# define SYS_ioprio_get __NR_ioprio_get
|
||||
#endif
|
||||
|
||||
|
||||
/* ---- Who misses what? ------------------------------------ */
|
||||
|
||||
|
||||
+12
-12
@@ -63,7 +63,7 @@ extern struct passwd *fgetpwent(FILE *__stream);
|
||||
|
||||
/* Write the given entry onto the given stream. */
|
||||
extern int putpwent(const struct passwd *__restrict __p,
|
||||
FILE *__restrict __f);
|
||||
FILE *__restrict __f);
|
||||
#endif
|
||||
|
||||
/* Search for an entry with a matching user ID. */
|
||||
@@ -81,25 +81,25 @@ extern struct passwd *getpwnam(const char *__name);
|
||||
POSIX people would choose. */
|
||||
|
||||
extern int getpwent_r(struct passwd *__restrict __resultbuf,
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct passwd **__restrict __result);
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct passwd **__restrict __result);
|
||||
|
||||
extern int getpwuid_r(uid_t __uid,
|
||||
struct passwd *__restrict __resultbuf,
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct passwd **__restrict __result);
|
||||
struct passwd *__restrict __resultbuf,
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct passwd **__restrict __result);
|
||||
|
||||
extern int getpwnam_r(const char *__restrict __name,
|
||||
struct passwd *__restrict __resultbuf,
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct passwd **__restrict __result);
|
||||
struct passwd *__restrict __resultbuf,
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct passwd **__restrict __result);
|
||||
|
||||
/* Read an entry from STREAM. This function is not standardized and
|
||||
probably never will. */
|
||||
extern int fgetpwent_r(FILE *__restrict __stream,
|
||||
struct passwd *__restrict __resultbuf,
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct passwd **__restrict __result);
|
||||
struct passwd *__restrict __resultbuf,
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct passwd **__restrict __result);
|
||||
|
||||
POP_SAVED_FUNCTION_VISIBILITY
|
||||
|
||||
|
||||
+7
-7
@@ -79,21 +79,21 @@ extern int putspent(const struct spwd *__p, FILE *__stream);
|
||||
|
||||
/* Reentrant versions of some of the functions above */
|
||||
extern int getspent_r(struct spwd *__result_buf, char *__buffer,
|
||||
size_t __buflen, struct spwd **__result);
|
||||
size_t __buflen, struct spwd **__result);
|
||||
#endif
|
||||
|
||||
extern int getspnam_r(const char *__name, struct spwd *__result_buf,
|
||||
char *__buffer, size_t __buflen,
|
||||
struct spwd **__result);
|
||||
char *__buffer, size_t __buflen,
|
||||
struct spwd **__result);
|
||||
|
||||
#ifdef UNUSED_FOR_NOW
|
||||
extern int sgetspent_r(const char *__string, struct spwd *__result_buf,
|
||||
char *__buffer, size_t __buflen,
|
||||
struct spwd **__result);
|
||||
char *__buffer, size_t __buflen,
|
||||
struct spwd **__result);
|
||||
|
||||
extern int fgetspent_r(FILE *__stream, struct spwd *__result_buf,
|
||||
char *__buffer, size_t __buflen,
|
||||
struct spwd **__result);
|
||||
char *__buffer, size_t __buflen,
|
||||
struct spwd **__result);
|
||||
/* Protect password file against multi writers */
|
||||
extern int lckpwdf(void);
|
||||
|
||||
|
||||
+1
-1
@@ -520,7 +520,7 @@ static pid_t run(const struct init_action *a)
|
||||
|
||||
/* Log the process name and args */
|
||||
message(L_LOG, "starting pid %d, tty '%s': '%s'",
|
||||
getpid(), a->terminal, a->command);
|
||||
getpid(), a->terminal, a->command);
|
||||
|
||||
/* Now run it. The new program will take over this PID,
|
||||
* so nothing further in init.c should be run. */
|
||||
|
||||
@@ -28,6 +28,16 @@ config MD5_SMALL
|
||||
2 3.0 5088
|
||||
3 (smallest) 5.1 4912
|
||||
|
||||
config SHA3_SMALL
|
||||
int "SHA3: Trade bytes for speed (0:fast, 1:slow)"
|
||||
default 1
|
||||
range 0 1
|
||||
help
|
||||
Trade binary size versus speed for the sha3sum algorithm.
|
||||
SHA3_SMALL=0 compared to SHA3_SMALL=1 (approximate):
|
||||
64-bit x86: +270 bytes of code, 45% faster
|
||||
32-bit x86: +450 bytes of code, 75% faster
|
||||
|
||||
config FEATURE_FAST_TOP
|
||||
bool "Faster /proc scanning code (+100 bytes)"
|
||||
default y
|
||||
|
||||
+16
-12
@@ -140,10 +140,9 @@ void FAST_FUNC bb_show_usage(void)
|
||||
}
|
||||
|
||||
#if NUM_APPLETS > 8
|
||||
/* NB: any char pointer will work as well, not necessarily applet_names */
|
||||
static int applet_name_compare(const void *name, const void *v)
|
||||
static int applet_name_compare(const void *name, const void *idx)
|
||||
{
|
||||
int i = (const char *)v - applet_names;
|
||||
int i = (int)(ptrdiff_t)idx - 1;
|
||||
return strcmp(name, APPLET_NAME(i));
|
||||
}
|
||||
#endif
|
||||
@@ -152,10 +151,12 @@ int FAST_FUNC find_applet_by_name(const char *name)
|
||||
#if NUM_APPLETS > 8
|
||||
/* Do a binary search to find the applet entry given the name. */
|
||||
const char *p;
|
||||
p = bsearch(name, applet_names, ARRAY_SIZE(applet_main), 1, applet_name_compare);
|
||||
if (!p)
|
||||
return -1;
|
||||
return p - applet_names;
|
||||
p = bsearch(name, (void*)(ptrdiff_t)1, ARRAY_SIZE(applet_main), 1, applet_name_compare);
|
||||
/*
|
||||
* if (!p) return -1;
|
||||
* ^^^^^^^^^^^^^^^^^^ the code below will do this if p == NULL :)
|
||||
*/
|
||||
return (int)(ptrdiff_t)p - 1;
|
||||
#else
|
||||
/* A version which does not pull in bsearch */
|
||||
int i = 0;
|
||||
@@ -627,11 +628,11 @@ static int busybox_main(char **argv)
|
||||
full_write2_str(bb_banner); /* reuse const string */
|
||||
full_write2_str(" multi-call binary.\n"); /* reuse */
|
||||
full_write2_str(
|
||||
"Copyright (C) 1998-2011 Erik Andersen, Rob Landley, Denys Vlasenko\n"
|
||||
"and others. Licensed under GPLv2.\n"
|
||||
"See source distribution for full notice.\n"
|
||||
"BusyBox is copyrighted by many authors between 1998-2012.\n"
|
||||
"Licensed under GPLv2. See source distribution for detailed\n"
|
||||
"copyright notices.\n"
|
||||
"\n"
|
||||
"Usage: busybox [function] [arguments]...\n"
|
||||
"Usage: busybox [function [arguments]...]\n"
|
||||
" or: busybox --list"IF_FEATURE_INSTALLER("[-full]")"\n"
|
||||
IF_FEATURE_INSTALLER(
|
||||
" or: busybox --install [-s] [DIR]\n"
|
||||
@@ -747,8 +748,11 @@ void FAST_FUNC run_applet_no_and_exit(int applet_no, char **argv)
|
||||
/* Special case. POSIX says "test --help"
|
||||
* should be no different from e.g. "test --foo". */
|
||||
//TODO: just compare applet_no with APPLET_NO_test
|
||||
if (!ENABLE_TEST || strcmp(applet_name, "test") != 0)
|
||||
if (!ENABLE_TEST || strcmp(applet_name, "test") != 0) {
|
||||
/* If you want "foo --help" to return 0: */
|
||||
/*xfunc_error_retval = 0;*/
|
||||
bb_show_usage();
|
||||
}
|
||||
}
|
||||
if (ENABLE_FEATURE_SUID)
|
||||
check_suid(applet_no);
|
||||
|
||||
@@ -41,12 +41,6 @@ int FAST_FUNC correct_password(const struct passwd *pw)
|
||||
char *unencrypted, *encrypted;
|
||||
const char *correct;
|
||||
int r;
|
||||
#if ENABLE_FEATURE_SHADOWPASSWDS
|
||||
/* Using _r function to avoid pulling in static buffers */
|
||||
struct spwd spw;
|
||||
char buffer[256];
|
||||
#endif
|
||||
|
||||
/* fake salt. crypt() can choke otherwise. */
|
||||
correct = "aa";
|
||||
if (!pw) {
|
||||
@@ -55,7 +49,10 @@ int FAST_FUNC correct_password(const struct passwd *pw)
|
||||
}
|
||||
correct = pw->pw_passwd;
|
||||
#if ENABLE_FEATURE_SHADOWPASSWDS
|
||||
/* Using _r function to avoid pulling in static buffers */
|
||||
if ((correct[0] == 'x' || correct[0] == '*') && !correct[1]) {
|
||||
struct spwd spw;
|
||||
char buffer[256];
|
||||
/* getspnam_r may return 0 yet set result to NULL.
|
||||
* At least glibc 2.4 does this. Be extra paranoid here. */
|
||||
struct spwd *result = NULL;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
const char *get_shell_name(void)
|
||||
const char* FAST_FUNC get_shell_name(void)
|
||||
{
|
||||
struct passwd *pw;
|
||||
char *shell;
|
||||
|
||||
+282
-12
@@ -31,6 +31,11 @@ static ALWAYS_INLINE uint64_t rotr64(uint64_t x, unsigned n)
|
||||
return (x >> n) | (x << (64 - n));
|
||||
}
|
||||
|
||||
/* rotl64 only used for sha3 currently */
|
||||
static ALWAYS_INLINE uint64_t rotl64(uint64_t x, unsigned n)
|
||||
{
|
||||
return (x << n) | (x >> (64 - n));
|
||||
}
|
||||
|
||||
/* Feed data through a temporary buffer.
|
||||
* The internal buffer remembers previous data until it has 64
|
||||
@@ -51,7 +56,7 @@ static void FAST_FUNC common64_hash(md5_ctx_t *ctx, const void *buffer, size_t l
|
||||
len -= remaining;
|
||||
buffer = (const char *)buffer + remaining;
|
||||
bufpos += remaining;
|
||||
/* clever way to do "if (bufpos != 64) break; ... ; bufpos = 0;" */
|
||||
/* Clever way to do "if (bufpos != N) break; ... ; bufpos = 0;" */
|
||||
bufpos -= 64;
|
||||
if (bufpos != 0)
|
||||
break;
|
||||
@@ -185,10 +190,9 @@ static void FAST_FUNC md5_process_block64(md5_ctx_t *ctx)
|
||||
int i;
|
||||
uint32_t temp;
|
||||
|
||||
# if BB_BIG_ENDIAN
|
||||
for (i = 0; i < 16; i++)
|
||||
words[i] = SWAP_LE32(words[i]);
|
||||
# endif
|
||||
if (BB_BIG_ENDIAN)
|
||||
for (i = 0; i < 16; i++)
|
||||
words[i] = SWAP_LE32(words[i]);
|
||||
|
||||
# if MD5_SMALL == 3
|
||||
pc = C_array;
|
||||
@@ -462,12 +466,13 @@ void FAST_FUNC md5_end(md5_ctx_t *ctx, void *resbuf)
|
||||
common64_end(ctx, /*swap_needed:*/ BB_BIG_ENDIAN);
|
||||
|
||||
/* The MD5 result is in little endian byte order */
|
||||
#if BB_BIG_ENDIAN
|
||||
ctx->hash[0] = SWAP_LE32(ctx->hash[0]);
|
||||
ctx->hash[1] = SWAP_LE32(ctx->hash[1]);
|
||||
ctx->hash[2] = SWAP_LE32(ctx->hash[2]);
|
||||
ctx->hash[3] = SWAP_LE32(ctx->hash[3]);
|
||||
#endif
|
||||
if (BB_BIG_ENDIAN) {
|
||||
ctx->hash[0] = SWAP_LE32(ctx->hash[0]);
|
||||
ctx->hash[1] = SWAP_LE32(ctx->hash[1]);
|
||||
ctx->hash[2] = SWAP_LE32(ctx->hash[2]);
|
||||
ctx->hash[3] = SWAP_LE32(ctx->hash[3]);
|
||||
}
|
||||
|
||||
memcpy(resbuf, ctx->hash, sizeof(ctx->hash[0]) * 4);
|
||||
}
|
||||
|
||||
@@ -834,7 +839,7 @@ void FAST_FUNC sha512_hash(sha512_ctx_t *ctx, const void *buffer, size_t len)
|
||||
len -= remaining;
|
||||
buffer = (const char *)buffer + remaining;
|
||||
bufpos += remaining;
|
||||
/* clever way to do "if (bufpos != 128) break; ... ; bufpos = 0;" */
|
||||
/* Clever way to do "if (bufpos != N) break; ... ; bufpos = 0;" */
|
||||
bufpos -= 128;
|
||||
if (bufpos != 0)
|
||||
break;
|
||||
@@ -896,3 +901,268 @@ void FAST_FUNC sha512_end(sha512_ctx_t *ctx, void *resbuf)
|
||||
}
|
||||
memcpy(resbuf, ctx->hash, sizeof(ctx->hash));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
|
||||
* Michael Peeters and Gilles Van Assche. For more information, feedback or
|
||||
* questions, please refer to our website: http://keccak.noekeon.org/
|
||||
*
|
||||
* Implementation by Ronny Van Keer,
|
||||
* hereby denoted as "the implementer".
|
||||
*
|
||||
* To the extent possible under law, the implementer has waived all copyright
|
||||
* and related or neighboring rights to the source code in this file.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*
|
||||
* Busybox modifications (C) Lauri Kasanen, under the GPLv2.
|
||||
*/
|
||||
|
||||
#if CONFIG_SHA3_SMALL < 0
|
||||
# define SHA3_SMALL 0
|
||||
#elif CONFIG_SHA3_SMALL > 1
|
||||
# define SHA3_SMALL 1
|
||||
#else
|
||||
# define SHA3_SMALL CONFIG_SHA3_SMALL
|
||||
#endif
|
||||
|
||||
enum {
|
||||
SHA3_IBLK_BYTES = 72, /* 576 bits / 8 */
|
||||
};
|
||||
|
||||
/*
|
||||
* In the crypto literature this function is usually called Keccak-f().
|
||||
*/
|
||||
static void sha3_process_block72(uint64_t *state)
|
||||
{
|
||||
enum { NROUNDS = 24 };
|
||||
|
||||
/* Elements should be 64-bit, but top half is always zero or 0x80000000.
|
||||
* We encode 63rd bits in a separate word below.
|
||||
* Same is true for 31th bits, which lets us use 16-bit table instead of 64-bit.
|
||||
* The speed penalty is lost in the noise.
|
||||
*/
|
||||
static const uint16_t IOTA_CONST[NROUNDS] = {
|
||||
0x0001,
|
||||
0x8082,
|
||||
0x808a,
|
||||
0x8000,
|
||||
0x808b,
|
||||
0x0001,
|
||||
0x8081,
|
||||
0x8009,
|
||||
0x008a,
|
||||
0x0088,
|
||||
0x8009,
|
||||
0x000a,
|
||||
0x808b,
|
||||
0x008b,
|
||||
0x8089,
|
||||
0x8003,
|
||||
0x8002,
|
||||
0x0080,
|
||||
0x800a,
|
||||
0x000a,
|
||||
0x8081,
|
||||
0x8080,
|
||||
0x0001,
|
||||
0x8008,
|
||||
};
|
||||
/* bit for CONST[0] is in msb: 0011 0011 0000 0111 1101 1101 */
|
||||
const uint32_t IOTA_CONST_bit63 = (uint32_t)(0x3307dd00);
|
||||
/* bit for CONST[0] is in msb: 0001 0110 0011 1000 0001 1011 */
|
||||
const uint32_t IOTA_CONST_bit31 = (uint32_t)(0x16381b00);
|
||||
|
||||
static const uint8_t ROT_CONST[24] = {
|
||||
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14,
|
||||
27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44,
|
||||
};
|
||||
static const uint8_t PI_LANE[24] = {
|
||||
10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4,
|
||||
15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1,
|
||||
};
|
||||
/*static const uint8_t MOD5[10] = { 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, };*/
|
||||
|
||||
unsigned x, y;
|
||||
unsigned round;
|
||||
|
||||
if (BB_BIG_ENDIAN) {
|
||||
for (x = 0; x < 25; x++) {
|
||||
state[x] = SWAP_LE64(state[x]);
|
||||
}
|
||||
}
|
||||
|
||||
for (round = 0; round < NROUNDS; ++round) {
|
||||
/* Theta */
|
||||
{
|
||||
uint64_t BC[10];
|
||||
for (x = 0; x < 5; ++x) {
|
||||
BC[x + 5] = BC[x] = state[x]
|
||||
^ state[x + 5] ^ state[x + 10]
|
||||
^ state[x + 15] ^ state[x + 20];
|
||||
}
|
||||
/* Using 2x5 vector above eliminates the need to use
|
||||
* BC[MOD5[x+N]] trick below to fetch BC[(x+N) % 5],
|
||||
* and the code is a bit _smaller_.
|
||||
*/
|
||||
for (x = 0; x < 5; ++x) {
|
||||
uint64_t temp = BC[x + 4] ^ rotl64(BC[x + 1], 1);
|
||||
state[x] ^= temp;
|
||||
state[x + 5] ^= temp;
|
||||
state[x + 10] ^= temp;
|
||||
state[x + 15] ^= temp;
|
||||
state[x + 20] ^= temp;
|
||||
}
|
||||
}
|
||||
|
||||
/* Rho Pi */
|
||||
if (SHA3_SMALL) {
|
||||
uint64_t t1 = state[1];
|
||||
for (x = 0; x < 24; ++x) {
|
||||
uint64_t t0 = state[PI_LANE[x]];
|
||||
state[PI_LANE[x]] = rotl64(t1, ROT_CONST[x]);
|
||||
t1 = t0;
|
||||
}
|
||||
} else {
|
||||
/* Especially large benefit for 32-bit arch (75% faster):
|
||||
* 64-bit rotations by non-constant usually are SLOW on those.
|
||||
* We resort to unrolling here.
|
||||
* This optimizes out PI_LANE[] and ROT_CONST[],
|
||||
* but generates 300-500 more bytes of code.
|
||||
*/
|
||||
uint64_t t0;
|
||||
uint64_t t1 = state[1];
|
||||
#define RhoPi_twice(x) \
|
||||
t0 = state[PI_LANE[x ]]; \
|
||||
state[PI_LANE[x ]] = rotl64(t1, ROT_CONST[x ]); \
|
||||
t1 = state[PI_LANE[x+1]]; \
|
||||
state[PI_LANE[x+1]] = rotl64(t0, ROT_CONST[x+1]);
|
||||
RhoPi_twice(0); RhoPi_twice(2);
|
||||
RhoPi_twice(4); RhoPi_twice(6);
|
||||
RhoPi_twice(8); RhoPi_twice(10);
|
||||
RhoPi_twice(12); RhoPi_twice(14);
|
||||
RhoPi_twice(16); RhoPi_twice(18);
|
||||
RhoPi_twice(20); RhoPi_twice(22);
|
||||
#undef RhoPi_twice
|
||||
}
|
||||
|
||||
/* Chi */
|
||||
for (y = 0; y <= 20; y += 5) {
|
||||
uint64_t BC0, BC1, BC2, BC3, BC4;
|
||||
BC0 = state[y + 0];
|
||||
BC1 = state[y + 1];
|
||||
BC2 = state[y + 2];
|
||||
state[y + 0] = BC0 ^ ((~BC1) & BC2);
|
||||
BC3 = state[y + 3];
|
||||
state[y + 1] = BC1 ^ ((~BC2) & BC3);
|
||||
BC4 = state[y + 4];
|
||||
state[y + 2] = BC2 ^ ((~BC3) & BC4);
|
||||
state[y + 3] = BC3 ^ ((~BC4) & BC0);
|
||||
state[y + 4] = BC4 ^ ((~BC0) & BC1);
|
||||
}
|
||||
|
||||
/* Iota */
|
||||
state[0] ^= IOTA_CONST[round]
|
||||
| (uint32_t)((IOTA_CONST_bit31 << round) & 0x80000000)
|
||||
| (uint64_t)((IOTA_CONST_bit63 << round) & 0x80000000) << 32;
|
||||
}
|
||||
|
||||
if (BB_BIG_ENDIAN) {
|
||||
for (x = 0; x < 25; x++) {
|
||||
state[x] = SWAP_LE64(state[x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FAST_FUNC sha3_begin(sha3_ctx_t *ctx)
|
||||
{
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
}
|
||||
|
||||
void FAST_FUNC sha3_hash(sha3_ctx_t *ctx, const void *buffer, size_t len)
|
||||
{
|
||||
#if SHA3_SMALL
|
||||
const uint8_t *data = buffer;
|
||||
unsigned bufpos = ctx->bytes_queued;
|
||||
|
||||
while (1) {
|
||||
unsigned remaining = SHA3_IBLK_BYTES - bufpos;
|
||||
if (remaining > len)
|
||||
remaining = len;
|
||||
len -= remaining;
|
||||
/* XOR data into buffer */
|
||||
while (remaining != 0) {
|
||||
uint8_t *buf = (uint8_t*)ctx->state;
|
||||
buf[bufpos] ^= *data++;
|
||||
bufpos++;
|
||||
remaining--;
|
||||
}
|
||||
/* Clever way to do "if (bufpos != N) break; ... ; bufpos = 0;" */
|
||||
bufpos -= SHA3_IBLK_BYTES;
|
||||
if (bufpos != 0)
|
||||
break;
|
||||
/* Buffer is filled up, process it */
|
||||
sha3_process_block72(ctx->state);
|
||||
/*bufpos = 0; - already is */
|
||||
}
|
||||
ctx->bytes_queued = bufpos + SHA3_IBLK_BYTES;
|
||||
#else
|
||||
/* +50 bytes code size, but a bit faster because of long-sized XORs */
|
||||
const uint8_t *data = buffer;
|
||||
unsigned bufpos = ctx->bytes_queued;
|
||||
|
||||
/* If already data in queue, continue queuing first */
|
||||
while (len != 0 && bufpos != 0) {
|
||||
uint8_t *buf = (uint8_t*)ctx->state;
|
||||
buf[bufpos] ^= *data++;
|
||||
len--;
|
||||
bufpos++;
|
||||
if (bufpos == SHA3_IBLK_BYTES) {
|
||||
bufpos = 0;
|
||||
goto do_block;
|
||||
}
|
||||
}
|
||||
|
||||
/* Absorb complete blocks */
|
||||
while (len >= SHA3_IBLK_BYTES) {
|
||||
/* XOR data onto beginning of state[].
|
||||
* We try to be efficient - operate one word at a time, not byte.
|
||||
* Careful wrt unaligned access: can't just use "*(long*)data"!
|
||||
*/
|
||||
unsigned count = SHA3_IBLK_BYTES / sizeof(long);
|
||||
long *buf = (long*)ctx->state;
|
||||
do {
|
||||
long v;
|
||||
move_from_unaligned_long(v, (long*)data);
|
||||
*buf++ ^= v;
|
||||
data += sizeof(long);
|
||||
} while (--count);
|
||||
len -= SHA3_IBLK_BYTES;
|
||||
do_block:
|
||||
sha3_process_block72(ctx->state);
|
||||
}
|
||||
|
||||
/* Queue remaining data bytes */
|
||||
while (len != 0) {
|
||||
uint8_t *buf = (uint8_t*)ctx->state;
|
||||
buf[bufpos] ^= *data++;
|
||||
bufpos++;
|
||||
len--;
|
||||
}
|
||||
|
||||
ctx->bytes_queued = bufpos;
|
||||
#endif
|
||||
}
|
||||
|
||||
void FAST_FUNC sha3_end(sha3_ctx_t *ctx, void *resbuf)
|
||||
{
|
||||
/* Padding */
|
||||
uint8_t *buf = (uint8_t*)ctx->state;
|
||||
buf[ctx->bytes_queued] ^= 1;
|
||||
buf[SHA3_IBLK_BYTES - 1] ^= 0x80;
|
||||
|
||||
sha3_process_block72(ctx->state);
|
||||
|
||||
/* Output */
|
||||
memcpy(resbuf, ctx->state, 64);
|
||||
}
|
||||
+2
-2
@@ -97,7 +97,7 @@ char* FAST_FUNC INET_rresolve(struct sockaddr_in *s_in, int numeric, uint32_t ne
|
||||
if (s_in->sin_family != AF_INET) {
|
||||
#ifdef DEBUG
|
||||
bb_error_msg("rresolve: unsupported address family %d!",
|
||||
s_in->sin_family);
|
||||
s_in->sin_family);
|
||||
#endif
|
||||
errno = EAFNOSUPPORT;
|
||||
return NULL;
|
||||
@@ -195,7 +195,7 @@ char* FAST_FUNC INET6_rresolve(struct sockaddr_in6 *sin6, int numeric)
|
||||
if (sin6->sin6_family != AF_INET6) {
|
||||
#ifdef DEBUG
|
||||
bb_error_msg("rresolve: unsupported address family %d!",
|
||||
sin6->sin6_family);
|
||||
sin6->sin6_family);
|
||||
#endif
|
||||
errno = EAFNOSUPPORT;
|
||||
return NULL;
|
||||
|
||||
@@ -20,18 +20,15 @@
|
||||
int FAST_FUNC get_linux_version_code(void)
|
||||
{
|
||||
struct utsname name;
|
||||
char *s;
|
||||
char *s, *t;
|
||||
int i, r;
|
||||
|
||||
if (uname(&name) == -1) {
|
||||
bb_perror_msg("can't get system information");
|
||||
return 0;
|
||||
}
|
||||
|
||||
uname(&name); /* never fails */
|
||||
s = name.release;
|
||||
r = 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
r = r * 256 + atoi(strtok(s, "."));
|
||||
t = strtok(s, ".");
|
||||
r = r * 256 + (t ? atoi(t) : 0);
|
||||
s = NULL;
|
||||
}
|
||||
return r;
|
||||
|
||||
+5
-4
@@ -2527,9 +2527,9 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman
|
||||
/* Delete word forward */
|
||||
int nc, sc = cursor;
|
||||
ctrl_right();
|
||||
nc = cursor;
|
||||
input_backward(cursor - sc);
|
||||
while (--nc >= cursor)
|
||||
nc = cursor - sc;
|
||||
input_backward(nc);
|
||||
while (--nc >= 0)
|
||||
input_delete(1);
|
||||
break;
|
||||
}
|
||||
@@ -2729,7 +2729,8 @@ int FAST_FUNC read_line_input(const char* prompt, char* command, int maxsize)
|
||||
{
|
||||
fputs(prompt, stdout);
|
||||
fflush_all();
|
||||
fgets(command, maxsize, stdin);
|
||||
if (!fgets(command, maxsize, stdin))
|
||||
return -1;
|
||||
return strlen(command);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -150,9 +150,9 @@ int FAST_FUNC set_loop(char **device, const char *file, unsigned long long offse
|
||||
}
|
||||
|
||||
/* If this block device already set up right, re-use it.
|
||||
(Yes this is racy, but associating two loop devices with the same
|
||||
file isn't pretty either. In general, mounting the same file twice
|
||||
without using losetup manually is problematic.)
|
||||
* (Yes this is racy, but associating two loop devices with the same
|
||||
* file isn't pretty either. In general, mounting the same file twice
|
||||
* without using losetup manually is problematic.)
|
||||
*/
|
||||
} else
|
||||
if (strcmp(file, (char *)loopinfo.lo_file_name) != 0
|
||||
|
||||
@@ -107,6 +107,10 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags)
|
||||
* an error. */
|
||||
if ((mode != -1) && (chmod(path, mode) < 0)) {
|
||||
fail_msg = "set permissions of";
|
||||
if (flags & FILEUTILS_IGNORE_CHMOD_ERR) {
|
||||
flags = 0;
|
||||
goto print_err;
|
||||
}
|
||||
break;
|
||||
}
|
||||
goto ret0;
|
||||
@@ -116,8 +120,9 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags)
|
||||
*s = c;
|
||||
} /* while (1) */
|
||||
|
||||
bb_perror_msg("can't %s directory '%s'", fail_msg, path);
|
||||
flags = -1;
|
||||
print_err:
|
||||
bb_perror_msg("can't %s directory '%s'", fail_msg, path);
|
||||
goto ret;
|
||||
ret0:
|
||||
flags = 0;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2012, Denys Vlasenko
|
||||
*
|
||||
* Licensed under GPLv2, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
//kbuild:lib-y += missing_syscalls.o
|
||||
|
||||
/*#include <linux/timex.h> - for struct timex, but may collide with <time.h> */
|
||||
#include <sys/syscall.h>
|
||||
#include "libbb.h"
|
||||
|
||||
#if defined(ANDROID) || defined(__ANDROID__)
|
||||
pid_t getsid(pid_t pid)
|
||||
{
|
||||
return syscall(__NR_getsid, pid);
|
||||
}
|
||||
|
||||
int stime(const time_t *t)
|
||||
{
|
||||
struct timeval tv;
|
||||
tv.tv_sec = *t;
|
||||
tv.tv_usec = 0;
|
||||
return settimeofday(&tv, NULL);
|
||||
}
|
||||
|
||||
int sethostname(const char *name, size_t len)
|
||||
{
|
||||
return syscall(__NR_sethostname, name, len);
|
||||
}
|
||||
|
||||
struct timex;
|
||||
int adjtimex(struct timex *buf)
|
||||
{
|
||||
return syscall(__NR_adjtimex, buf);
|
||||
}
|
||||
|
||||
int pivot_root(const char *new_root, const char *put_old)
|
||||
{
|
||||
return syscall(__NR_pivot_root, new_root, put_old);
|
||||
}
|
||||
#endif
|
||||
+4
-2
@@ -180,7 +180,7 @@ static char *skip_fields(char *str, int count)
|
||||
|
||||
#if ENABLE_FEATURE_TOPMEM || ENABLE_PMAP
|
||||
int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total,
|
||||
void (*cb)(struct smaprec *, void *), void *data)
|
||||
void (*cb)(struct smaprec *, void *), void *data)
|
||||
{
|
||||
FILE *file;
|
||||
struct smaprec currec;
|
||||
@@ -425,7 +425,7 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags)
|
||||
if (n < 11)
|
||||
continue; /* bogus data, get next /proc/XXX */
|
||||
# if ENABLE_FEATURE_TOP_SMP_PROCESS
|
||||
if (n < 11+15)
|
||||
if (n == 11)
|
||||
sp->last_seen_on_cpu = 0;
|
||||
# endif
|
||||
|
||||
@@ -583,6 +583,8 @@ void FAST_FUNC read_cmdline(char *buf, int col, unsigned pid, const char *comm)
|
||||
buf[sz] = '\0';
|
||||
while (--sz >= 0 && buf[sz] == '\0')
|
||||
continue;
|
||||
/* Prevent basename("process foo/bar") = "bar" */
|
||||
strchrnul(buf, ' ')[0] = '\0';
|
||||
base = bb_basename(buf); /* before we replace argv0's NUL with space */
|
||||
while (sz >= 0) {
|
||||
if ((unsigned char)(buf[sz]) < ' ')
|
||||
|
||||
+10
-5
@@ -15,7 +15,10 @@ int64_t FAST_FUNC read_key(int fd, char *buffer, int timeout)
|
||||
const char *seq;
|
||||
int n;
|
||||
|
||||
/* Known escape sequences for cursor and function keys */
|
||||
/* Known escape sequences for cursor and function keys.
|
||||
* See "Xterm Control Sequences"
|
||||
* http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
|
||||
*/
|
||||
static const char esccmds[] ALIGN1 = {
|
||||
'O','A' |0x80,KEYCODE_UP ,
|
||||
'O','B' |0x80,KEYCODE_DOWN ,
|
||||
@@ -44,6 +47,8 @@ int64_t FAST_FUNC read_key(int fd, char *buffer, int timeout)
|
||||
/* ESC [ 1 ; 4 x, where x = A/B/C/D: Alt-Shift-<arrow> */
|
||||
/* ESC [ 1 ; 5 x, where x = A/B/C/D: Ctrl-<arrow> - implemented below */
|
||||
/* ESC [ 1 ; 6 x, where x = A/B/C/D: Ctrl-Shift-<arrow> */
|
||||
/* ESC [ 1 ; 7 x, where x = A/B/C/D: Ctrl-Alt-<arrow> */
|
||||
/* ESC [ 1 ; 8 x, where x = A/B/C/D: Ctrl-Alt-Shift-<arrow> */
|
||||
'[','H' |0x80,KEYCODE_HOME , /* xterm */
|
||||
'[','F' |0x80,KEYCODE_END , /* xterm */
|
||||
/* [ESC] ESC [ [2] H - [Alt-][Shift-]Home (End similarly?) */
|
||||
@@ -64,10 +69,10 @@ int64_t FAST_FUNC read_key(int fd, char *buffer, int timeout)
|
||||
'[','7','~' |0x80,KEYCODE_HOME , /* vt100? linux vt? or what? */
|
||||
'[','8','~' |0x80,KEYCODE_END , /* vt100? linux vt? or what? */
|
||||
#if 0
|
||||
'[','1','1','~'|0x80,KEYCODE_FUN1 ,
|
||||
'[','1','2','~'|0x80,KEYCODE_FUN2 ,
|
||||
'[','1','3','~'|0x80,KEYCODE_FUN3 ,
|
||||
'[','1','4','~'|0x80,KEYCODE_FUN4 ,
|
||||
'[','1','1','~'|0x80,KEYCODE_FUN1 , /* old xterm, deprecated by ESC O P */
|
||||
'[','1','2','~'|0x80,KEYCODE_FUN2 , /* old xterm... */
|
||||
'[','1','3','~'|0x80,KEYCODE_FUN3 , /* old xterm... */
|
||||
'[','1','4','~'|0x80,KEYCODE_FUN4 , /* old xterm... */
|
||||
'[','1','5','~'|0x80,KEYCODE_FUN5 ,
|
||||
/* [ESC] ESC [ 1 5 [;2] ~ - [Alt-][Shift-]F5 */
|
||||
'[','1','7','~'|0x80,KEYCODE_FUN6 ,
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ int FAST_FUNC remove_file(const char *path, int flags)
|
||||
int status = 0;
|
||||
|
||||
if (!(flags & FILEUTILS_RECUR)) {
|
||||
bb_error_msg("%s: is a directory", path);
|
||||
bb_error_msg("'%s' is a directory", path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,25 +50,3 @@ char* FAST_FUNC safe_gethostname(void)
|
||||
uname(&uts);
|
||||
return xstrndup(!uts.nodename[0] ? "?" : uts.nodename, sizeof(uts.nodename));
|
||||
}
|
||||
|
||||
/*
|
||||
* On success return the current malloced and NUL terminated domainname.
|
||||
* On error return malloced and NUL terminated string "?".
|
||||
* This is an illegal first character for a domainname.
|
||||
* The returned malloced string must be freed by the caller.
|
||||
*/
|
||||
char* FAST_FUNC safe_getdomainname(void)
|
||||
{
|
||||
#if defined(__linux__)
|
||||
/* The field domainname of struct utsname is Linux specific. */
|
||||
struct utsname uts;
|
||||
uname(&uts);
|
||||
return xstrndup(!uts.domainname[0] ? "?" : uts.domainname, sizeof(uts.domainname));
|
||||
#else
|
||||
/* We really don't care about people with domain names wider than most screens */
|
||||
char buf[256];
|
||||
int r = getdomainname(buf, sizeof(buf));
|
||||
buf[sizeof(buf)-1] = '\0';
|
||||
return xstrdup(r < 0 ? "?" : buf);
|
||||
#endif
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <selinux/context.h>
|
||||
|
||||
context_t FAST_FUNC set_security_context_component(security_context_t cur_context,
|
||||
char *user, char *role, char *type, char *range)
|
||||
char *user, char *role, char *type, char *range)
|
||||
{
|
||||
context_t con = context_new(cur_context);
|
||||
if (!con)
|
||||
|
||||
@@ -37,9 +37,11 @@ void FAST_FUNC setup_environment(const char *shell, int flags, const struct pass
|
||||
|
||||
/* Change the current working directory to be the home directory
|
||||
* of the user */
|
||||
if (chdir(pw->pw_dir)) {
|
||||
xchdir((flags & SETUP_ENV_TO_TMP) ? "/tmp" : "/");
|
||||
bb_error_msg("can't chdir to home directory '%s'", pw->pw_dir);
|
||||
if (!(flags & SETUP_ENV_NO_CHDIR)) {
|
||||
if (chdir(pw->pw_dir) != 0) {
|
||||
bb_error_msg("can't change directory to '%s'", pw->pw_dir);
|
||||
xchdir((flags & SETUP_ENV_TO_TMP) ? "/tmp" : "/");
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & SETUP_ENV_CLEARENV) {
|
||||
|
||||
+3
-3
@@ -39,7 +39,7 @@ void FAST_FUNC bb_signals(int sigs, void (*f)(int))
|
||||
|
||||
while (sigs) {
|
||||
if (sigs & bit) {
|
||||
sigs &= ~bit;
|
||||
sigs -= bit;
|
||||
signal(sig_no, f);
|
||||
}
|
||||
sig_no++;
|
||||
@@ -60,7 +60,7 @@ void FAST_FUNC bb_signals_recursive_norestart(int sigs, void (*f)(int))
|
||||
|
||||
while (sigs) {
|
||||
if (sigs & bit) {
|
||||
sigs &= ~bit;
|
||||
sigs -= bit;
|
||||
sigaction_set(sig_no, &sa);
|
||||
}
|
||||
sig_no++;
|
||||
@@ -97,7 +97,7 @@ void FAST_FUNC kill_myself_with_sig(int sig)
|
||||
signal(sig, SIG_DFL);
|
||||
sig_unblock(sig);
|
||||
raise(sig);
|
||||
_exit(EXIT_FAILURE); /* Should not reach it */
|
||||
_exit(sig | 128); /* Should not reach it */
|
||||
}
|
||||
|
||||
void FAST_FUNC signal_SA_RESTART_empty_mask(int sig, void (*handler)(int))
|
||||
|
||||
@@ -59,7 +59,7 @@ unsigned type FAST_FUNC xstrtou(_range_sfx)(const char *numstr, int base,
|
||||
}
|
||||
|
||||
/* Note: trailing space is an error.
|
||||
It would be easy enough to allow though if desired. */
|
||||
* It would be easy enough to allow though if desired. */
|
||||
if (*e)
|
||||
goto inval;
|
||||
chk_range:
|
||||
|
||||
@@ -355,13 +355,13 @@ void FAST_FUNC xsetuid(uid_t uid)
|
||||
void FAST_FUNC xchdir(const char *path)
|
||||
{
|
||||
if (chdir(path))
|
||||
bb_perror_msg_and_die("chdir(%s)", path);
|
||||
bb_perror_msg_and_die("can't change directory to '%s'", path);
|
||||
}
|
||||
|
||||
void FAST_FUNC xchroot(const char *path)
|
||||
{
|
||||
if (chroot(path))
|
||||
bb_perror_msg_and_die("can't change root directory to %s", path);
|
||||
bb_perror_msg_and_die("can't change root directory to '%s'", path);
|
||||
xchdir("/");
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -300,8 +300,8 @@ struct group *getgrgid(gid_t gid)
|
||||
* to have been created as a reentrant version of the non-standard
|
||||
* functions getspuid. Why getspuid was added, I do not know. */
|
||||
int getspuid_r(uid_t uid, struct spwd *__restrict resultbuf,
|
||||
char *__restrict buffer, size_t buflen,
|
||||
struct spwd **__restrict result)
|
||||
char *__restrict buffer, size_t buflen,
|
||||
struct spwd **__restrict result)
|
||||
{
|
||||
int rv;
|
||||
struct passwd *pp;
|
||||
@@ -403,8 +403,8 @@ void endpwent(void)
|
||||
|
||||
|
||||
int getpwent_r(struct passwd *__restrict resultbuf,
|
||||
char *__restrict buffer, size_t buflen,
|
||||
struct passwd **__restrict result)
|
||||
char *__restrict buffer, size_t buflen,
|
||||
struct passwd **__restrict result)
|
||||
{
|
||||
int rv;
|
||||
|
||||
@@ -451,8 +451,8 @@ void endgrent(void)
|
||||
}
|
||||
|
||||
int getgrent_r(struct group *__restrict resultbuf,
|
||||
char *__restrict buffer, size_t buflen,
|
||||
struct group **__restrict result)
|
||||
char *__restrict buffer, size_t buflen,
|
||||
struct group **__restrict result)
|
||||
{
|
||||
int rv;
|
||||
|
||||
@@ -501,7 +501,7 @@ void endspent(void)
|
||||
}
|
||||
|
||||
int getspent_r(struct spwd *resultbuf, char *buffer,
|
||||
size_t buflen, struct spwd **result)
|
||||
size_t buflen, struct spwd **result)
|
||||
{
|
||||
int rv;
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
* for details.
|
||||
*/
|
||||
|
||||
//applet:IF_ADD_SHELL( APPLET_ODDNAME(add-shell , add_remove_shell, BB_DIR_USR_BIN, BB_SUID_DROP, add_shell ))
|
||||
//applet:IF_REMOVE_SHELL(APPLET_ODDNAME(remove-shell, add_remove_shell, BB_DIR_USR_BIN, BB_SUID_DROP, remove_shell))
|
||||
//applet:IF_ADD_SHELL( APPLET_ODDNAME(add-shell , add_remove_shell, BB_DIR_USR_SBIN, BB_SUID_DROP, add_shell ))
|
||||
//applet:IF_REMOVE_SHELL(APPLET_ODDNAME(remove-shell, add_remove_shell, BB_DIR_USR_SBIN, BB_SUID_DROP, remove_shell))
|
||||
|
||||
//kbuild:lib-$(CONFIG_ADD_SHELL) += add-remove-shell.o
|
||||
//kbuild:lib-$(CONFIG_REMOVE_SHELL) += add-remove-shell.o
|
||||
|
||||
+14
-8
@@ -9,9 +9,9 @@
|
||||
*/
|
||||
|
||||
//usage:#define adduser_trivial_usage
|
||||
//usage: "[OPTIONS] USER"
|
||||
//usage: "[OPTIONS] USER [GROUP]"
|
||||
//usage:#define adduser_full_usage "\n\n"
|
||||
//usage: "Add a user\n"
|
||||
//usage: "Create new user, or add USER to GROUP\n"
|
||||
//usage: "\n -h DIR Home directory"
|
||||
//usage: "\n -g GECOS GECOS field"
|
||||
//usage: "\n -s SHELL Login shell"
|
||||
@@ -80,7 +80,7 @@ static void passwd_study(struct passwd *p)
|
||||
}
|
||||
}
|
||||
|
||||
static void addgroup_wrapper(struct passwd *p, const char *group_name)
|
||||
static int addgroup_wrapper(struct passwd *p, const char *group_name)
|
||||
{
|
||||
char *argv[6];
|
||||
|
||||
@@ -110,7 +110,7 @@ static void addgroup_wrapper(struct passwd *p, const char *group_name)
|
||||
argv[5] = NULL;
|
||||
}
|
||||
|
||||
spawn_and_wait(argv);
|
||||
return spawn_and_wait(argv);
|
||||
}
|
||||
|
||||
static void passwd_wrapper(const char *login_name) NORETURN;
|
||||
@@ -162,9 +162,9 @@ int adduser_main(int argc UNUSED_PARAM, char **argv)
|
||||
pw.pw_shell = (char *)get_shell_name();
|
||||
pw.pw_dir = NULL;
|
||||
|
||||
/* exactly one non-option arg */
|
||||
/* at most two non-option args */
|
||||
/* disable interactive passwd for system accounts */
|
||||
opt_complementary = "=1:SD:u+";
|
||||
opt_complementary = "?2:SD:u+";
|
||||
if (sizeof(pw.pw_uid) == sizeof(int)) {
|
||||
opts = getopt32(argv, "h:g:s:G:DSHu:", &pw.pw_dir, &pw.pw_gecos, &pw.pw_shell, &usegroup, &pw.pw_uid);
|
||||
} else {
|
||||
@@ -175,9 +175,16 @@ int adduser_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
}
|
||||
argv += optind;
|
||||
pw.pw_name = argv[0];
|
||||
|
||||
if (!opts && argv[1]) {
|
||||
/* if called with two non-option arguments, adduser
|
||||
* will add an existing user to an existing group.
|
||||
*/
|
||||
return addgroup_wrapper(&pw, argv[1]);
|
||||
}
|
||||
|
||||
/* fill in the passwd struct */
|
||||
pw.pw_name = argv[0];
|
||||
die_if_bad_username(pw.pw_name);
|
||||
if (!pw.pw_dir) {
|
||||
/* create string for $HOME if not specified already */
|
||||
@@ -205,7 +212,6 @@ int adduser_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
if (ENABLE_FEATURE_CLEAN_UP)
|
||||
free(p);
|
||||
|
||||
#if ENABLE_FEATURE_SHADOWPASSWDS
|
||||
/* /etc/shadow fields:
|
||||
* 1. username
|
||||
|
||||
+8
-1
@@ -548,8 +548,15 @@ int getty_main(int argc UNUSED_PARAM, char **argv)
|
||||
* a session leader - which is quite possible for getty!
|
||||
*/
|
||||
pid = getpid();
|
||||
if (getsid(0) != pid)
|
||||
if (getsid(0) != pid) {
|
||||
//for debugging:
|
||||
//bb_perror_msg_and_die("setsid failed:"
|
||||
// " pid %d ppid %d"
|
||||
// " sid %d pgid %d",
|
||||
// pid, getppid(),
|
||||
// getsid(0), getpgid(0));
|
||||
bb_perror_msg_and_die("setsid");
|
||||
}
|
||||
/* Looks like we are already a session leader.
|
||||
* In this case (setsid failed) we may still have ctty,
|
||||
* and it may be different from tty we need to control!
|
||||
|
||||
+2
-1
@@ -37,7 +37,8 @@ static const struct pam_conv conv = {
|
||||
enum {
|
||||
TIMEOUT = 60,
|
||||
EMPTY_USERNAME_COUNT = 10,
|
||||
USERNAME_SIZE = 32,
|
||||
/* Some users found 32 chars limit to be too low: */
|
||||
USERNAME_SIZE = 64,
|
||||
TTYNAME_SIZE = 32,
|
||||
};
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include "libbb.h"
|
||||
#include <syslog.h>
|
||||
#include <sys/resource.h> /* setrlimit */
|
||||
|
||||
static void nuke_str(char *str)
|
||||
{
|
||||
|
||||
+2
-1
@@ -131,7 +131,8 @@ int su_main(int argc UNUSED_PARAM, char **argv)
|
||||
change_identity(pw);
|
||||
setup_environment(opt_shell,
|
||||
((flags & SU_OPT_l) / SU_OPT_l * SETUP_ENV_CLEARENV)
|
||||
+ (!(flags & SU_OPT_mp) * SETUP_ENV_CHANGEENV),
|
||||
+ (!(flags & SU_OPT_mp) * SETUP_ENV_CHANGEENV)
|
||||
+ (!(flags & SU_OPT_l) * SETUP_ENV_NO_CHDIR),
|
||||
pw);
|
||||
IF_SELINUX(set_current_security_context(NULL);)
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
|
||||
char *opt_from;
|
||||
char *s;
|
||||
llist_t *list = NULL;
|
||||
char *domain = sane_address(safe_getdomainname());
|
||||
char *host = sane_address(safe_gethostname());
|
||||
unsigned nheaders = 0;
|
||||
int code;
|
||||
|
||||
@@ -222,8 +222,9 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
|
||||
// we should start with modern EHLO
|
||||
if (250 != smtp_checkp("EHLO %s", domain, -1))
|
||||
smtp_checkp("HELO %s", domain, 250);
|
||||
if (250 != smtp_checkp("EHLO %s", host, -1))
|
||||
smtp_checkp("HELO %s", host, 250);
|
||||
free(host);
|
||||
|
||||
// perform authentication
|
||||
if (opts & OPT_a) {
|
||||
|
||||
+1
-1
@@ -885,7 +885,7 @@ int crond_main(int argc UNUSED_PARAM, char **argv)
|
||||
xsetenv("SHELL", DEFAULT_SHELL); /* once, for all future children */
|
||||
crondlog(LVL8 "crond (busybox "BB_VER") started, log level %d", G.log_level);
|
||||
rescan_crontab_dir();
|
||||
write_pidfile("/var/run/crond.pid");
|
||||
write_pidfile(CONFIG_PID_FILE_PATH "/crond.pid");
|
||||
|
||||
/* Main loop */
|
||||
t2 = time(NULL);
|
||||
|
||||
Loaded 100 of 218 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user