From f3854f789c68cfdcfe760de064a291d5203a2499 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Fri, 3 Jun 2011 20:25:17 +0200 Subject: replace nonstandard unsigned typedefs Signed-off-by: Dan Fandrich Signed-off-by: Denys Vlasenko --- util-linux/ipcs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c index 33035c62e..ee7df5e33 100644 --- a/util-linux/ipcs.c +++ b/util-linux/ipcs.c @@ -55,11 +55,11 @@ #define SHM_INFO 14 struct shm_info { int used_ids; - ulong shm_tot; /* total allocated shm */ - ulong shm_rss; /* total resident shm */ - ulong shm_swp; /* total swapped shm */ - ulong swap_attempts; - ulong swap_successes; + unsigned long shm_tot; /* total allocated shm */ + unsigned long shm_rss; /* total resident shm */ + unsigned long shm_swp; /* total swapped shm */ + unsigned long swap_attempts; + unsigned long swap_successes; }; #endif @@ -267,7 +267,7 @@ static NOINLINE void do_sem(void) struct passwd *pw; union semun arg; - arg.array = (ushort *) (void *) &seminfo; + arg.array = (unsigned short *) (void *) &seminfo; maxid = semctl(0, 0, SEM_INFO, arg); if (maxid < 0) { printf("kernel not configured for %s\n", "semaphores"); @@ -277,7 +277,7 @@ static NOINLINE void do_sem(void) switch (format) { case LIMITS: printf("------ Semaphore %s --------\n", "Limits"); - arg.array = (ushort *) (void *) &seminfo; /* damn union */ + arg.array = (unsigned short *) (void *) &seminfo; /* damn union */ if ((semctl(0, 0, IPC_INFO, arg)) < 0) return; printf("max number of arrays = %d\n" -- cgit v1.2.3-55-g6feb From 2f5769151fda6cec0f1ef7b5d345fb597160446e Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Fri, 3 Jun 2011 20:28:14 +0200 Subject: only compile obscure.c when needed Signed-off-by: Dan Fandrich Signed-off-by: Denys Vlasenko --- libbb/Kbuild.src | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src index fa6e5b6e3..62bee9394 100644 --- a/libbb/Kbuild.src +++ b/libbb/Kbuild.src @@ -63,7 +63,6 @@ lib-y += hash_md5_sha.o #lib-y += hash_md5prime.o lib-y += messages.o lib-y += mode_string.o -lib-y += obscure.o lib-y += parse_mode.o lib-y += parse_config.o lib-y += perror_msg.o @@ -137,7 +136,7 @@ lib-$(CONFIG_ADDUSER) += update_passwd.o lib-$(CONFIG_DELGROUP) += update_passwd.o lib-$(CONFIG_DELUSER) += update_passwd.o -lib-$(CONFIG_PASSWD) += pw_encrypt.o update_passwd.o +lib-$(CONFIG_PASSWD) += pw_encrypt.o update_passwd.o obscure.o lib-$(CONFIG_CHPASSWD) += pw_encrypt.o update_passwd.o lib-$(CONFIG_CRYPTPW) += pw_encrypt.o lib-$(CONFIG_SULOGIN) += pw_encrypt.o -- cgit v1.2.3-55-g6feb From 71d73136250efa7dd5b5b023df76487f6e723830 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Fri, 3 Jun 2011 20:51:58 +0200 Subject: platform.h: support for build under Android Signed-off-by: Dan Fandrich Signed-off-by: Denys Vlasenko --- include/platform.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/platform.h b/include/platform.h index 2b84447bc..780568c2b 100644 --- a/include/platform.h +++ b/include/platform.h @@ -391,6 +391,12 @@ typedef unsigned smalluint; # undef HAVE_STPCPY #endif +#if defined(ANDROID) +# undef HAVE_DPRINTF +# undef HAVE_STPCPY +# undef HAVE_STRCHRNUL +#endif + /* * Now, define prototypes for all the functions defined in platform.c * These must come after all the HAVE_* macros are defined (or not) -- cgit v1.2.3-55-g6feb From fe86d6b6361d07529288fa20aa5cab5472b64344 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 3 Jun 2011 21:39:42 +0200 Subject: appletlib.c: do not use PAGE_SIZE for malloc tweaking Signed-off-by: Denys Vlasenko --- libbb/appletlib.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 0dac0ba14..1bc45c491 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c @@ -34,17 +34,6 @@ # include /* for mallopt */ #endif -/* Try to pull in PAGE_SIZE */ -#ifdef __linux__ -# include -#endif -#ifdef __GNU__ /* Hurd */ -# include -#endif -#ifndef PAGE_SIZE -# define PAGE_SIZE (4*1024) /* guess */ -#endif - /* Declare _main() */ #define PROTOTYPES @@ -788,13 +777,13 @@ int main(int argc UNUSED_PARAM, char **argv) * to keep before releasing to the OS * Default is way too big: 256k */ - mallopt(M_TRIM_THRESHOLD, 2 * PAGE_SIZE); + mallopt(M_TRIM_THRESHOLD, 8 * 1024); #endif #ifdef M_MMAP_THRESHOLD /* M_MMAP_THRESHOLD is the request size threshold for using mmap() * Default is too big: 256k */ - mallopt(M_MMAP_THRESHOLD, 8 * PAGE_SIZE - 256); + mallopt(M_MMAP_THRESHOLD, 32 * 1024 - 256); #endif #if !BB_MMU -- cgit v1.2.3-55-g6feb From 5d3aaceb790461dca3f770483bbccd161e78a728 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 4 Jun 2011 05:07:16 +0200 Subject: udhcpc: allow -O OPT take numeric params function old new delta udhcpc_main 2623 2654 +31 Signed-off-by: Denys Vlasenko --- networking/udhcp/dhcpc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 510c3a1d0..5d3291b8c 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c @@ -1134,8 +1134,11 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) client_config.no_default_options = 1; while (list_O) { char *optstr = llist_pop(&list_O); - unsigned n = udhcp_option_idx(optstr); - n = dhcp_optflags[n].code; + unsigned n = bb_strtou(optstr, NULL, 0); + if (errno || n > 254) { + n = udhcp_option_idx(optstr); + n = dhcp_optflags[n].code; + } client_config.opt_mask[n >> 3] |= 1 << (n & 7); } while (list_x) { -- cgit v1.2.3-55-g6feb From 9f7780250ce4bbee9c0a8f1044875e303479e196 Mon Sep 17 00:00:00 2001 From: Maksym Kryzhanovskyy Date: Sun, 5 Jun 2011 03:37:14 +0200 Subject: iostat: code shrink function old new delta iostat_main 2048 2400 +352 is_partition 48 - -48 print_stats_dev_struct 350 - -350 Signed-off-by: Maksym Kryzhanovskyy Signed-off-by: Denys Vlasenko --- procps/iostat.c | 237 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 117 insertions(+), 120 deletions(-) diff --git a/procps/iostat.c b/procps/iostat.c index cd233c72f..51c5fac08 100644 --- a/procps/iostat.c +++ b/procps/iostat.c @@ -7,23 +7,24 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ -//applet:IF_IOSTAT(APPLET(iostat, BB_DIR_BIN, BB_SUID_DROP)) - -//kbuild:lib-$(CONFIG_IOSTAT) += iostat.o - //config:config IOSTAT //config: bool "iostat" //config: default y //config: help //config: Report CPU and I/O statistics +//applet:IF_IOSTAT(APPLET(iostat, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_IOSTAT) += iostat.o + #include "libbb.h" -#include /* Need struct utsname */ +#include /* struct utsname */ //#define debug(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__) #define debug(fmt, ...) ((void)0) #define MAX_DEVICE_NAME 12 +#define MAX_DEVICE_NAME_STR "12" #if 1 typedef unsigned long long cputime_t; @@ -64,21 +65,27 @@ typedef struct { cputime_t itv; } stats_cpu_pair_t; -struct stats_dev { - char dname[MAX_DEVICE_NAME]; +typedef struct { unsigned long long rd_sectors; unsigned long long wr_sectors; unsigned long rd_ops; unsigned long wr_ops; -}; +} stats_dev_data_t; + +typedef struct stats_dev { + struct stats_dev *next; + char dname[MAX_DEVICE_NAME + 1]; + stats_dev_data_t prev_data; + stats_dev_data_t curr_data; +} stats_dev_t; /* Globals. Sort by size and access frequency. */ struct globals { smallint show_all; unsigned total_cpus; /* Number of CPUs */ unsigned clk_tck; /* Number of clock ticks per second */ - llist_t *dev_list; /* List of devices entered on the command line */ - struct stats_dev *saved_stats_dev; + llist_t *dev_name_list; /* List of devices entered on the command line */ + stats_dev_t *stats_dev_list; struct tm tmtime; struct { const char *str; @@ -114,7 +121,7 @@ static ALWAYS_INLINE int this_is_smp(void) static void print_header(void) { - char buf[16]; + char buf[32]; struct utsname uts; uname(&uts); /* never fails */ @@ -136,7 +143,7 @@ static void get_localtime(struct tm *ptm) static void print_timestamp(void) { - char buf[20]; + char buf[64]; /* %x: date representation for the current locale */ /* %X: time representation for the current locale */ strftime(buf, sizeof(buf), "%x %X", &G.tmtime); @@ -162,18 +169,22 @@ static cputime_t get_smp_uptime(void) static void get_cpu_statistics(stats_cpu_t *sc) { FILE *fp; - char buf[1024], *ibuf = buf + 4; + char buf[1024]; fp = xfopen_for_read("/proc/stat"); memset(sc, 0, sizeof(*sc)); while (fgets(buf, sizeof(buf), fp)) { - /* Does the line starts with "cpu "? */ + int i; + char *ibuf; + + /* Does the line start with "cpu "? */ if (!starts_with_cpu(buf) || buf[3] != ' ') { continue; } - for (int i = STATS_CPU_USER; i <= STATS_CPU_GUEST; i++) { + ibuf = buf + 4; + for (i = STATS_CPU_USER; i <= STATS_CPU_GUEST; i++) { ibuf = skip_whitespace(ibuf); sscanf(ibuf, "%"FMT_DATA"u", &sc->vector[i]); if (i != STATS_CPU_GUEST) { @@ -233,7 +244,7 @@ static void print_stats_cpu_struct(stats_cpu_pair_t *stats) { cputime_t *p = stats->prev->vector; cputime_t *c = stats->curr->vector; - printf(" %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f\n", + printf(" %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n", percent_value(p[STATS_CPU_USER] , c[STATS_CPU_USER] , stats->itv), percent_value(p[STATS_CPU_NICE] , c[STATS_CPU_NICE] , stats->itv), percent_value(p[STATS_CPU_SYSTEM] + p[STATS_CPU_SOFTIRQ] + p[STATS_CPU_IRQ], @@ -244,36 +255,40 @@ static void print_stats_cpu_struct(stats_cpu_pair_t *stats) ); } -static void print_stats_dev_struct(const struct stats_dev *p, - const struct stats_dev *c, cputime_t itv) +static void cpu_report(stats_cpu_pair_t *stats) { + /* Always print a header */ + puts("avg-cpu: %user %nice %system %iowait %steal %idle"); + + /* Print current statistics */ + print_stats_cpu_struct(stats); +} + +static void print_stats_dev_struct(stats_dev_t *stats_dev, cputime_t itv) +{ + stats_dev_data_t *p = &stats_dev->prev_data; + stats_dev_data_t *c = &stats_dev->curr_data; if (option_mask32 & OPT_z) if (p->rd_ops == c->rd_ops && p->wr_ops == c->wr_ops) return; - printf("%-13s %8.2f %12.2f %12.2f %10llu %10llu \n", c->dname, - percent_value(p->rd_ops + p->wr_ops , - /**/ c->rd_ops + c->wr_ops , itv), + printf("%-13s %8.2f %12.2f %12.2f %10llu %10llu\n", + stats_dev->dname, + percent_value(p->rd_ops + p->wr_ops, c->rd_ops + c->wr_ops, itv), percent_value(p->rd_sectors, c->rd_sectors, itv) / G.unit.div, percent_value(p->wr_sectors, c->wr_sectors, itv) / G.unit.div, (c->rd_sectors - p->rd_sectors) / G.unit.div, - (c->wr_sectors - p->wr_sectors) / G.unit.div); -} - -static void cpu_report(stats_cpu_pair_t *stats) -{ - /* Always print a header */ - puts("avg-cpu: %user %nice %system %iowait %steal %idle"); - - /* Print current statistics */ - print_stats_cpu_struct(stats); + (c->wr_sectors - p->wr_sectors) / G.unit.div + ); } static void print_devstat_header(void) { - printf("Device:%15s%6s%s/s%6s%s/s%6s%s%6s%s\n", "tps", + printf("Device:%15s%6s%s/s%6s%s/s%6s%s%6s%s\n", + "tps", G.unit.str, "_read", G.unit.str, "_wrtn", - G.unit.str, "_read", G.unit.str, "_wrtn"); + G.unit.str, "_read", G.unit.str, "_wrtn" + ); } /* @@ -285,61 +300,81 @@ static int is_partition(const char *dev) return ((dev[0] - 's') | (dev[1] - 'd') | (dev[2] - 'a')) == 0 && isdigit(dev[3]); } +static stats_dev_t *stats_dev_find_or_new(const char *dev_name) +{ + stats_dev_t **curr = &G.stats_dev_list; + + while (*curr != NULL) { + if (strcmp((*curr)->dname, dev_name) == 0) + return *curr; + curr = &(*curr)->next; + } + + *curr = xzalloc(sizeof(stats_dev_t)); + strncpy((*curr)->dname, dev_name, MAX_DEVICE_NAME); + return *curr; +} + +static void stats_dev_free(stats_dev_t *stats_dev) +{ + if (stats_dev) { + stats_dev_free(stats_dev->next); + free(stats_dev); + } +} + static void do_disk_statistics(cputime_t itv) { + char buf[128]; + char dev_name[MAX_DEVICE_NAME + 1]; + unsigned long long rd_sec_or_dummy; + unsigned long long wr_sec_or_dummy; + stats_dev_data_t *curr_data; + stats_dev_t *stats_dev; FILE *fp; int rc; - int i = 0; - char buf[128]; - unsigned major, minor; - unsigned long wr_ops, dummy; /* %*lu for suppress the conversion wouldn't work */ - unsigned long long rd_sec_or_wr_ops; - unsigned long long rd_sec_or_dummy, wr_sec_or_dummy, wr_sec; - struct stats_dev sd; fp = xfopen_for_read("/proc/diskstats"); - /* Read and possibly print stats from /proc/diskstats */ while (fgets(buf, sizeof(buf), fp)) { - rc = sscanf(buf, "%u %u %s %lu %llu %llu %llu %lu %lu %llu %lu %lu %lu %lu", - &major, &minor, sd.dname, &sd.rd_ops, - &rd_sec_or_dummy, &rd_sec_or_wr_ops, &wr_sec_or_dummy, - &wr_ops, &dummy, &wr_sec, &dummy, &dummy, &dummy, &dummy); - - switch (rc) { - case 14: - sd.wr_ops = wr_ops; - sd.rd_sectors = rd_sec_or_wr_ops; - sd.wr_sectors = wr_sec; - break; - case 7: - sd.rd_sectors = rd_sec_or_dummy; - sd.wr_ops = (unsigned long)rd_sec_or_wr_ops; - sd.wr_sectors = wr_sec_or_dummy; - break; - default: - break; + sscanf(buf, "%*s %*s %"MAX_DEVICE_NAME_STR"s", dev_name); + if (G.dev_name_list) { + /* Is device name in list? */ + if (!llist_find_str(G.dev_name_list, dev_name)) + continue; + } else if (is_partition(dev_name)) { + continue; } - if (!G.dev_list && !is_partition(sd.dname)) { - /* User didn't specify device */ - if (!G.show_all && !sd.rd_ops && !sd.wr_ops) { - /* Don't print unused device */ - continue; - } - print_stats_dev_struct(&G.saved_stats_dev[i], &sd, itv); - G.saved_stats_dev[i] = sd; - i++; - } else { - /* Is device in device list? */ - if (llist_find_str(G.dev_list, sd.dname)) { - /* Print current statistics */ - print_stats_dev_struct(&G.saved_stats_dev[i], &sd, itv); - G.saved_stats_dev[i] = sd; - i++; - } else - continue; + stats_dev = stats_dev_find_or_new(dev_name); + curr_data = &stats_dev->curr_data; + + rc = sscanf(buf, "%*s %*s %*s %lu %llu %llu %llu %lu %*s %llu", + &curr_data->rd_ops, + &rd_sec_or_dummy, + &curr_data->rd_sectors, + &wr_sec_or_dummy, + &curr_data->wr_ops, + &curr_data->wr_sectors); + if (rc != 6) { + curr_data->rd_sectors = rd_sec_or_dummy; + curr_data->wr_sectors = wr_sec_or_dummy; + //curr_data->rd_ops = ; + curr_data->wr_ops = (unsigned long)curr_data->rd_sectors; } + + if (!G.dev_name_list /* User didn't specify device */ + && !G.show_all + && curr_data->rd_ops == 0 + && curr_data->wr_ops == 0 + ) { + /* Don't print unused device */ + continue; + } + + /* Print current statistics */ + print_stats_dev_struct(stats_dev, itv); + stats_dev->prev_data = *curr_data; } fclose(fp); @@ -354,35 +389,6 @@ static void dev_report(cputime_t itv) do_disk_statistics(itv); } -static unsigned get_number_of_devices(void) -{ - FILE *fp; - char buf[128]; - int rv; - unsigned n = 0; - unsigned long rd_ops, wr_ops; - char dname[MAX_DEVICE_NAME]; - - fp = xfopen_for_read("/proc/diskstats"); - - while (fgets(buf, sizeof(buf), fp)) { - rv = sscanf(buf, "%*d %*d %s %lu %*u %*u %*u %lu", - dname, &rd_ops, &wr_ops); - if (rv == 2 || is_partition(dname)) - /* A partition */ - continue; - if (!rd_ops && !wr_ops) { - /* Unused device */ - if (!G.show_all) - continue; - } - n++; - } - - fclose(fp); - return n; -} - //usage:#define iostat_trivial_usage //usage: "[-c] [-d] [-t] [-z] [-k|-m] [ALL|BLOCKDEV...] [INTERVAL [COUNT]]" //usage:#define iostat_full_usage "\n\n" @@ -398,7 +404,7 @@ static unsigned get_number_of_devices(void) int iostat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int iostat_main(int argc UNUSED_PARAM, char **argv) { - int opt, dev_num; + int opt; unsigned interval; int count; stats_cpu_t stats_data[2]; @@ -427,14 +433,12 @@ int iostat_main(int argc UNUSED_PARAM, char **argv) argv += optind; /* Store device names into device list */ - dev_num = 0; while (*argv && !isdigit(*argv[0])) { if (strcmp(*argv, "ALL") != 0) { /* If not ALL, save device name */ char *dev_name = skip_dev_pfx(*argv); - if (!llist_find_str(G.dev_list, dev_name)) { - llist_add_to(&G.dev_list, dev_name); - dev_num++; + if (!llist_find_str(G.dev_name_list, dev_name)) { + llist_add_to(&G.dev_name_list, dev_name); } } else { G.show_all = 1; @@ -454,13 +458,6 @@ int iostat_main(int argc UNUSED_PARAM, char **argv) count = xatoi_positive(*argv); } - /* Allocate space for device stats */ - if (opt & OPT_d) { - G.saved_stats_dev = xzalloc(sizeof(G.saved_stats_dev[0]) * - (dev_num ? dev_num : get_number_of_devices()) - ); - } - if (opt & OPT_m) { G.unit.str = " MB"; G.unit.div = 2048; @@ -530,8 +527,8 @@ int iostat_main(int argc UNUSED_PARAM, char **argv) } if (ENABLE_FEATURE_CLEAN_UP) { - llist_free(G.dev_list, NULL); - free(G.saved_stats_dev); + llist_free(G.dev_name_list, NULL); + stats_dev_free(G.stats_dev_list); free(&G); } -- cgit v1.2.3-55-g6feb From 66426760beef7e87c4735f433d123daf911b5b4a Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 5 Jun 2011 03:58:28 +0200 Subject: *: remove "Options:" string from help texts function old new delta packed_usage 28706 28623 -83 Signed-off-by: Denys Vlasenko --- archival/ar.c | 1 - archival/bbunzip.c | 7 ------- archival/bzip2.c | 1 - archival/cpio.c | 1 - archival/dpkg.c | 1 - archival/dpkg_deb.c | 1 - archival/gzip.c | 1 - archival/lzop.c | 6 ++---- archival/rpm.c | 1 - archival/tar.c | 1 - archival/unzip.c | 1 - console-tools/kbd_mode.c | 1 - console-tools/loadfont.c | 1 - console-tools/openvt.c | 1 - console-tools/setconsole.c | 1 - console-tools/showkey.c | 1 - coreutils/cal.c | 1 - coreutils/catv.c | 1 - coreutils/chgrp.c | 1 - coreutils/chmod.c | 1 - coreutils/chown.c | 1 - coreutils/comm.c | 1 - coreutils/cp.c | 1 - coreutils/cut.c | 1 - coreutils/date.c | 1 - coreutils/dd.c | 1 - coreutils/df.c | 1 - coreutils/dos2unix.c | 2 -- coreutils/du.c | 1 - coreutils/echo.c | 1 - coreutils/env.c | 1 - coreutils/expand.c | 2 -- coreutils/fold.c | 1 - coreutils/fsync.c | 1 - coreutils/head.c | 1 - coreutils/id.c | 1 - coreutils/install.c | 1 - coreutils/ln.c | 1 - coreutils/ls.c | 1 - coreutils/md5_sha1_sum.c | 4 ---- coreutils/mkdir.c | 1 - coreutils/mkfifo.c | 1 - coreutils/mknod.c | 1 - coreutils/mv.c | 1 - coreutils/nice.c | 1 - coreutils/readlink.c | 1 - coreutils/rm.c | 1 - coreutils/rmdir.c | 1 - coreutils/seq.c | 1 - coreutils/sort.c | 1 - coreutils/split.c | 3 +-- coreutils/stat.c | 1 - coreutils/stty.c | 1 - coreutils/sum.c | 1 - coreutils/tail.c | 1 - coreutils/tee.c | 1 - coreutils/touch.c | 1 - coreutils/tr.c | 1 - coreutils/tty.c | 1 - coreutils/uname.c | 1 - coreutils/uniq.c | 1 - coreutils/uudecode.c | 1 - coreutils/uuencode.c | 1 - coreutils/wc.c | 1 - coreutils/who.c | 1 - debianutils/mktemp.c | 1 - debianutils/run_parts.c | 1 - e2fsprogs/chattr.c | 1 - e2fsprogs/fsck.c | 1 - e2fsprogs/lsattr.c | 1 - e2fsprogs/old_e2fsprogs/e2fsck.c | 1 - editors/awk.c | 3 +-- editors/cmp.c | 1 - editors/diff.c | 1 - editors/sed.c | 3 +-- editors/vi.c | 1 - findutils/find.c | 1 - findutils/grep.c | 1 - findutils/xargs.c | 1 - init/bootchartd.c | 1 - init/halt.c | 3 --- loginutils/addgroup.c | 1 - loginutils/adduser.c | 1 - loginutils/chpasswd.c | 1 - loginutils/cryptpw.c | 2 -- loginutils/getty.c | 1 - loginutils/login.c | 1 - loginutils/passwd.c | 1 - loginutils/su.c | 1 - loginutils/sulogin.c | 1 - loginutils/vlock.c | 1 - mailutils/makemime.c | 3 +-- mailutils/popmaildir.c | 1 - mailutils/reformime.c | 1 - miscutils/adjtimex.c | 1 - miscutils/beep.c | 3 +-- miscutils/chrt.c | 1 - miscutils/conspy.c | 1 - miscutils/devfsd.c | 1 - miscutils/eject.c | 1 - miscutils/fbsplash.c | 3 +-- miscutils/flash_eraseall.c | 1 - miscutils/flashcp.c | 1 - miscutils/hdparm.c | 3 +-- miscutils/ionice.c | 1 - miscutils/last.c | 1 - miscutils/less.c | 1 - miscutils/man.c | 3 +-- miscutils/microcom.c | 1 - miscutils/mountpoint.c | 1 - miscutils/nandwrite.c | 2 -- miscutils/setserial.c | 4 ++-- miscutils/strings.c | 1 - miscutils/taskset.c | 1 - miscutils/time.c | 1 - miscutils/ubi_tools.c | 10 ++-------- miscutils/watchdog.c | 1 - modutils/insmod.c | 1 - modutils/modinfo.c | 3 +-- modutils/modprobe-small.c | 5 +---- modutils/modprobe.c | 3 +-- modutils/rmmod.c | 1 - networking/arp.c | 1 - networking/arping.c | 1 - networking/dnsd.c | 1 - networking/ether-wake.c | 1 - networking/ftpd.c | 1 - networking/ftpgetput.c | 2 -- networking/hostname.c | 1 - networking/httpd.c | 1 - networking/ifconfig.c | 1 - networking/ifenslave.c | 1 - networking/ifplugd.c | 1 - networking/ifupdown.c | 6 ++---- networking/inetd.c | 3 +-- networking/ip.c | 2 +- networking/ipcalc.c | 1 - networking/isrv_identd.c | 1 - networking/nameif.c | 1 - networking/nc.c | 2 +- networking/nc_bloaty.c | 3 +-- networking/netstat.c | 1 - networking/ntpd.c | 1 - networking/ping.c | 2 -- networking/pscan.c | 1 - networking/route.c | 1 - networking/slattach.c | 1 - networking/telnet.c | 1 - networking/telnetd.c | 1 - networking/tftp.c | 2 -- networking/traceroute.c | 2 -- networking/tunctl.c | 1 - networking/udhcp/dumpleases.c | 1 - networking/vconfig.c | 1 - networking/wget.c | 1 - networking/whois.c | 1 - networking/zcip.c | 1 - printutils/lpr.c | 6 ++---- procps/fuser.c | 1 - procps/iostat.c | 1 - procps/kill.c | 3 --- procps/mpstat.c | 1 - procps/pgrep.c | 2 -- procps/pidof.c | 2 +- procps/pmap.c | 16 ++++++++-------- procps/ps.c | 2 -- procps/pstree.c | 1 - procps/renice.c | 1 - procps/sysctl.c | 1 - procps/watch.c | 1 - runit/chpst.c | 2 -- sysklogd/klogd.c | 1 - sysklogd/logger.c | 1 - sysklogd/logread.c | 1 - sysklogd/syslogd.c | 1 - util-linux/acpid.c | 1 - util-linux/blockdev.c | 3 +-- util-linux/dmesg.c | 1 - util-linux/fdformat.c | 1 - util-linux/fdisk.c | 1 - util-linux/flock.c | 1 - util-linux/fsck_minix.c | 1 - util-linux/getopt.c | 5 ++--- util-linux/hexdump.c | 1 - util-linux/hwclock.c | 1 - util-linux/ipcrm.c | 1 - util-linux/losetup.c | 3 +-- util-linux/mkfs_minix.c | 1 - util-linux/mkfs_reiser.c | 1 - util-linux/mkfs_vfat.c | 1 - util-linux/mkswap.c | 1 - util-linux/mount.c | 1 - util-linux/rdate.c | 1 - util-linux/readprofile.c | 3 +-- util-linux/script.c | 3 +-- util-linux/swaponoff.c | 2 -- util-linux/switch_root.c | 1 - util-linux/umount.c | 1 - 198 files changed, 40 insertions(+), 268 deletions(-) diff --git a/archival/ar.c b/archival/ar.c index e7973af94..acad20ff2 100644 --- a/archival/ar.c +++ b/archival/ar.c @@ -21,7 +21,6 @@ //usage: "[-o] [-v] [-p] [-t] [-x] ARCHIVE FILES" //usage:#define ar_full_usage "\n\n" //usage: "Extract or list FILES from an ar archive\n" -//usage: "\nOptions:" //usage: "\n -o Preserve original dates" //usage: "\n -p Extract to stdout" //usage: "\n -t List" diff --git a/archival/bbunzip.c b/archival/bbunzip.c index 734c9b269..bb1ec0e37 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c @@ -172,7 +172,6 @@ char* FAST_FUNC make_new_name_generic(char *filename, const char *expected_ext) //usage: "[-cf] [FILE]..." //usage:#define uncompress_full_usage "\n\n" //usage: "Decompress .Z file[s]\n" -//usage: "\nOptions:" //usage: "\n -c Write to stdout" //usage: "\n -f Overwrite" @@ -232,7 +231,6 @@ int uncompress_main(int argc UNUSED_PARAM, char **argv) //usage: "[-cft] [FILE]..." //usage:#define gunzip_full_usage "\n\n" //usage: "Decompress FILEs (or stdin)\n" -//usage: "\nOptions:" //usage: "\n -c Write to stdout" //usage: "\n -f Force" //usage: "\n -t Test file integrity" @@ -339,7 +337,6 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv) //usage: "[-cf] [FILE]..." //usage:#define bunzip2_full_usage "\n\n" //usage: "Decompress FILEs (or stdin)\n" -//usage: "\nOptions:" //usage: "\n -c Write to stdout" //usage: "\n -f Force" //usage:#define bzcat_trivial_usage @@ -380,7 +377,6 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv) //usage: "[-cf] [FILE]..." //usage:#define unlzma_full_usage "\n\n" //usage: "Decompress FILE (or stdin)\n" -//usage: "\nOptions:" //usage: "\n -c Write to stdout" //usage: "\n -f Force" //usage: @@ -388,7 +384,6 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv) //usage: "-d [-cf] [FILE]..." //usage:#define lzma_full_usage "\n\n" //usage: "Decompress FILE (or stdin)\n" -//usage: "\nOptions:" //usage: "\n -d Decompress" //usage: "\n -c Write to stdout" //usage: "\n -f Force" @@ -402,7 +397,6 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv) //usage: "[-cf] [FILE]..." //usage:#define unxz_full_usage "\n\n" //usage: "Decompress FILE (or stdin)\n" -//usage: "\nOptions:" //usage: "\n -c Write to stdout" //usage: "\n -f Force" //usage: @@ -410,7 +404,6 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv) //usage: "-d [-cf] [FILE]..." //usage:#define xz_full_usage "\n\n" //usage: "Decompress FILE (or stdin)\n" -//usage: "\nOptions:" //usage: "\n -d Decompress" //usage: "\n -c Write to stdout" //usage: "\n -f Force" diff --git a/archival/bzip2.c b/archival/bzip2.c index cfaf5fe20..e39d7f704 100644 --- a/archival/bzip2.c +++ b/archival/bzip2.c @@ -11,7 +11,6 @@ //usage: "[OPTIONS] [FILE]..." //usage:#define bzip2_full_usage "\n\n" //usage: "Compress FILEs (or stdin) with bzip2 algorithm\n" -//usage: "\nOptions:" //usage: "\n -1..9 Compression level" //usage: "\n -d Decompress" //usage: "\n -c Write to stdout" diff --git a/archival/cpio.c b/archival/cpio.c index c746a71fa..9674a046b 100644 --- a/archival/cpio.c +++ b/archival/cpio.c @@ -34,7 +34,6 @@ //usage: IF_FEATURE_CPIO_P( //usage: "\n -p DIR Copy files to DIR" //usage: ) -//usage: "\nOptions:" //usage: "\n -d Make leading directories" //usage: "\n -m Preserve mtime" //usage: "\n -v Verbose" diff --git a/archival/dpkg.c b/archival/dpkg.c index 8899d1719..2a6a7b3bf 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c @@ -32,7 +32,6 @@ //usage: "[-ilCPru] [-F OPT] PACKAGE" //usage:#define dpkg_full_usage "\n\n" //usage: "Install, remove and manage Debian packages\n" -//usage: "\nOptions:" //usage: IF_LONG_OPTS( //usage: "\n -i,--install Install the package" //usage: "\n -l,--list List of installed packages" diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c index 9e1e811ee..5d814d7ef 100644 --- a/archival/dpkg_deb.c +++ b/archival/dpkg_deb.c @@ -9,7 +9,6 @@ //usage: "[-cefxX] FILE [argument" //usage:#define dpkg_deb_full_usage "\n\n" //usage: "Perform actions on Debian packages (.debs)\n" -//usage: "\nOptions:" //usage: "\n -c List contents of filesystem tree" //usage: "\n -e Extract control files to [argument] directory" //usage: "\n -f Display control field name starting with [argument]" diff --git a/archival/gzip.c b/archival/gzip.c index a9b216afe..403eb4dcb 100644 --- a/archival/gzip.c +++ b/archival/gzip.c @@ -43,7 +43,6 @@ aa: 85.1% -- replaced with aa.gz //usage: "[-cfd] [FILE]..." //usage:#define gzip_full_usage "\n\n" //usage: "Compress FILEs (or stdin)\n" -//usage: "\nOptions:" //usage: "\n -d Decompress" //usage: "\n -c Write to stdout" //usage: "\n -f Force" diff --git a/archival/lzop.c b/archival/lzop.c index f4419910f..1326bd790 100644 --- a/archival/lzop.c +++ b/archival/lzop.c @@ -28,8 +28,7 @@ //usage:#define lzop_trivial_usage //usage: "[-cfvd123456789CF] [FILE]..." //usage:#define lzop_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -1..9 Compression level" +//usage: " -1..9 Compression level" //usage: "\n -d Decompress" //usage: "\n -c Write to stdout" //usage: "\n -f Force" @@ -46,8 +45,7 @@ //usage:#define unlzop_trivial_usage //usage: "[-cfvCF] [FILE]..." //usage:#define unlzop_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -c Write to stdout" +//usage: " -c Write to stdout" //usage: "\n -f Force" //usage: "\n -v Verbose" //usage: "\n -F Don't store or verify checksum" diff --git a/archival/rpm.c b/archival/rpm.c index 98a45d9cc..8174f4869 100644 --- a/archival/rpm.c +++ b/archival/rpm.c @@ -14,7 +14,6 @@ //usage: "\nCommands:" //usage: "\n -i Install package" //usage: "\n -qp Query package" -//usage: "\nOptions:" //usage: "\n -i Show information" //usage: "\n -l List contents" //usage: "\n -d List documents" diff --git a/archival/tar.c b/archival/tar.c index ebaa183b4..3e90d46cb 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -759,7 +759,6 @@ static void handle_SIGCHLD(int status) //usage: ) //usage: "\n x Extract" //usage: "\n t List" -//usage: "\nOptions:" //usage: "\n f Name of TARFILE ('-' for stdin/out)" //usage: "\n C Change to DIR before operation" //usage: "\n v Verbose" diff --git a/archival/unzip.c b/archival/unzip.c index 52b0a6414..4fa729326 100644 --- a/archival/unzip.c +++ b/archival/unzip.c @@ -23,7 +23,6 @@ //usage: "[-opts[modifiers]] FILE[.zip] [LIST] [-x XLIST] [-d DIR]" //usage:#define unzip_full_usage "\n\n" //usage: "Extract files from ZIP archives\n" -//usage: "\nOptions:" //usage: "\n -l List archive contents (with -q for short form)" //usage: "\n -n Never overwrite files (default)" //usage: "\n -o Overwrite" diff --git a/console-tools/kbd_mode.c b/console-tools/kbd_mode.c index 221a9f782..138536721 100644 --- a/console-tools/kbd_mode.c +++ b/console-tools/kbd_mode.c @@ -13,7 +13,6 @@ //usage: "[-a|k|s|u] [-C TTY]" //usage:#define kbd_mode_full_usage "\n\n" //usage: "Report or set the keyboard mode\n" -//usage: "\nOptions:" //usage: "\n -a Default (ASCII)" //usage: "\n -k Medium-raw (keyboard)" //usage: "\n -s Raw (scancode)" diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c index 597519f91..9e887f256 100644 --- a/console-tools/loadfont.c +++ b/console-tools/loadfont.c @@ -23,7 +23,6 @@ //usage: "FONT [-m MAPFILE] [-C TTY]" //usage:#define setfont_full_usage "\n\n" //usage: "Load a console font\n" -//usage: "\nOptions:" //usage: "\n -m MAPFILE Load console screen map" //usage: "\n -C TTY Affect TTY instead of /dev/tty" //usage: diff --git a/console-tools/openvt.c b/console-tools/openvt.c index de5cf93fe..e52356692 100644 --- a/console-tools/openvt.c +++ b/console-tools/openvt.c @@ -12,7 +12,6 @@ //usage: "[-c N] [-sw] [PROG ARGS]" //usage:#define openvt_full_usage "\n\n" //usage: "Start PROG on a new virtual terminal\n" -//usage: "\nOptions:" //usage: "\n -c N Use specified VT" //usage: "\n -s Switch to the VT" /* //usage: "\n -l Run PROG as login shell (by prepending '-')" */ diff --git a/console-tools/setconsole.c b/console-tools/setconsole.c index 771974ae3..c0051dcc8 100644 --- a/console-tools/setconsole.c +++ b/console-tools/setconsole.c @@ -12,7 +12,6 @@ //usage: "[-r" IF_FEATURE_SETCONSOLE_LONG_OPTIONS("|--reset") "] [DEVICE]" //usage:#define setconsole_full_usage "\n\n" //usage: "Redirect system console output to DEVICE (default: /dev/tty)\n" -//usage: "\nOptions:" //usage: "\n -r Reset output to /dev/console" #include "libbb.h" diff --git a/console-tools/showkey.c b/console-tools/showkey.c index 2c832c92c..69b785ec6 100644 --- a/console-tools/showkey.c +++ b/console-tools/showkey.c @@ -11,7 +11,6 @@ //usage: "[-a | -k | -s]" //usage:#define showkey_full_usage "\n\n" //usage: "Show keys pressed\n" -//usage: "\nOptions:" //usage: "\n -a Display decimal/octal/hex values of the keys" //usage: "\n -k Display interpreted keycodes (default)" //usage: "\n -s Display raw scan-codes" diff --git a/coreutils/cal.c b/coreutils/cal.c index ef1c29bb9..b470ad968 100644 --- a/coreutils/cal.c +++ b/coreutils/cal.c @@ -21,7 +21,6 @@ //usage: "[-jy] [[MONTH] YEAR]" //usage:#define cal_full_usage "\n\n" //usage: "Display a calendar\n" -//usage: "\nOptions:" //usage: "\n -j Use julian dates" //usage: "\n -y Display the entire year" diff --git a/coreutils/catv.c b/coreutils/catv.c index 37c7ed2d1..214b4311a 100644 --- a/coreutils/catv.c +++ b/coreutils/catv.c @@ -14,7 +14,6 @@ //usage: "[-etv] [FILE]..." //usage:#define catv_full_usage "\n\n" //usage: "Display nonprinting characters as ^x or M-x\n" -//usage: "\nOptions:" //usage: "\n -e End each line with $" //usage: "\n -t Show tabs as ^I" //usage: "\n -v Don't use ^x or M-x escapes" diff --git a/coreutils/chgrp.c b/coreutils/chgrp.c index bc9608362..7076db62f 100644 --- a/coreutils/chgrp.c +++ b/coreutils/chgrp.c @@ -15,7 +15,6 @@ //usage: "[-RhLHP"IF_DESKTOP("cvf")"]... GROUP FILE..." //usage:#define chgrp_full_usage "\n\n" //usage: "Change the group membership of each FILE to GROUP\n" -//usage: "\nOptions:" //usage: "\n -R Recurse" //usage: "\n -h Affect symlinks instead of symlink targets" //usage: "\n -L Traverse all symlinks to directories" diff --git a/coreutils/chmod.c b/coreutils/chmod.c index 0bcd6bb66..5ee45b942 100644 --- a/coreutils/chmod.c +++ b/coreutils/chmod.c @@ -19,7 +19,6 @@ //usage:#define chmod_full_usage "\n\n" //usage: "Each MODE is one or more of the letters ugoa, one of the\n" //usage: "symbols +-= and one or more of the letters rwxst\n" -//usage: "\nOptions:" //usage: "\n -R Recurse" //usage: IF_DESKTOP( //usage: "\n -c List changed files" diff --git a/coreutils/chown.c b/coreutils/chown.c index c4c182d3c..bb166d8fe 100644 --- a/coreutils/chown.c +++ b/coreutils/chown.c @@ -14,7 +14,6 @@ //usage: "[-RhLHP"IF_DESKTOP("cvf")"]... OWNER[<.|:>[GROUP]] FILE..." //usage:#define chown_full_usage "\n\n" //usage: "Change the owner and/or group of each FILE to OWNER and/or GROUP\n" -//usage: "\nOptions:" //usage: "\n -R Recurse" //usage: "\n -h Affect symlinks instead of symlink targets" //usage: "\n -L Traverse all symlinks to directories" diff --git a/coreutils/comm.c b/coreutils/comm.c index 7da6b25f9..cd450950b 100644 --- a/coreutils/comm.c +++ b/coreutils/comm.c @@ -11,7 +11,6 @@ //usage: "[-123] FILE1 FILE2" //usage:#define comm_full_usage "\n\n" //usage: "Compare FILE1 with FILE2\n" -//usage: "\nOptions:" //usage: "\n -1 Suppress lines unique to FILE1" //usage: "\n -2 Suppress lines unique to FILE2" //usage: "\n -3 Suppress lines common to both files" diff --git a/coreutils/cp.c b/coreutils/cp.c index 337054d7b..e48e21c97 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c @@ -19,7 +19,6 @@ //usage: "[OPTIONS] SOURCE DEST" //usage:#define cp_full_usage "\n\n" //usage: "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY\n" -//usage: "\nOptions:" //usage: "\n -a Same as -dpR" //usage: IF_SELINUX( //usage: "\n -c Preserve security context" diff --git a/coreutils/cut.c b/coreutils/cut.c index dfa1833b4..2c27b704f 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c @@ -13,7 +13,6 @@ //usage: "[OPTIONS] [FILE]..." //usage:#define cut_full_usage "\n\n" //usage: "Print selected fields from each input FILE to stdout\n" -//usage: "\nOptions:" //usage: "\n -b LIST Output only bytes from LIST" //usage: "\n -c LIST Output only characters from LIST" //usage: "\n -d CHAR Use CHAR instead of tab as the field delimiter" diff --git a/coreutils/date.c b/coreutils/date.c index db1b693aa..6a7d5fac3 100644 --- a/coreutils/date.c +++ b/coreutils/date.c @@ -98,7 +98,6 @@ //usage: "[OPTIONS] [+FMT] [TIME]" //usage:#define date_full_usage "\n\n" //usage: "Display time (using +FMT), or set time\n" -//usage: "\nOptions:" //usage: IF_NOT_LONG_OPTS( //usage: "\n [-s] TIME Set time to TIME" //usage: "\n -u Work in UTC (don't convert to local time)" diff --git a/coreutils/dd.c b/coreutils/dd.c index 8a2eaed72..96602ebdd 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c @@ -13,7 +13,6 @@ //usage: " [seek=N]" IF_FEATURE_DD_IBS_OBS(" [conv=notrunc|noerror|sync|fsync]") //usage:#define dd_full_usage "\n\n" //usage: "Copy a file with converting and formatting\n" -//usage: "\nOptions:" //usage: "\n if=FILE Read from FILE instead of stdin" //usage: "\n of=FILE Write to FILE instead of stdout" //usage: "\n bs=N Read and write N bytes at a time" diff --git a/coreutils/df.c b/coreutils/df.c index 518e856a2..846cb38ad 100644 --- a/coreutils/df.c +++ b/coreutils/df.c @@ -29,7 +29,6 @@ //usage: "] [FILESYSTEM]..." //usage:#define df_full_usage "\n\n" //usage: "Print filesystem usage statistics\n" -//usage: "\nOptions:" //usage: "\n -P POSIX output format" //usage: "\n -k 1024-byte blocks (default)" //usage: IF_FEATURE_HUMAN_READABLE( diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c index df2376bea..07398bdfa 100644 --- a/coreutils/dos2unix.c +++ b/coreutils/dos2unix.c @@ -17,7 +17,6 @@ //usage:#define dos2unix_full_usage "\n\n" //usage: "Convert FILE in-place from DOS to Unix format.\n" //usage: "When no file is given, use stdin/stdout.\n" -//usage: "\nOptions:" //usage: "\n -u dos2unix" //usage: "\n -d unix2dos" //usage: @@ -26,7 +25,6 @@ //usage:#define unix2dos_full_usage "\n\n" //usage: "Convert FILE in-place from Unix to DOS format.\n" //usage: "When no file is given, use stdin/stdout.\n" -//usage: "\nOptions:" //usage: "\n -u dos2unix" //usage: "\n -d unix2dos" diff --git a/coreutils/du.c b/coreutils/du.c index 7a6662d1e..b8bbe3d9e 100644 --- a/coreutils/du.c +++ b/coreutils/du.c @@ -31,7 +31,6 @@ //usage: IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("1024") //usage: IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("512") //usage: " bytes.\n" -//usage: "\nOptions:" //usage: "\n -a Show file sizes too" //usage: "\n -L Follow all symlinks" //usage: "\n -H Follow symlinks on command line" diff --git a/coreutils/echo.c b/coreutils/echo.c index 0895e2940..9663894ec 100644 --- a/coreutils/echo.c +++ b/coreutils/echo.c @@ -28,7 +28,6 @@ //usage:#define echo_full_usage "\n\n" //usage: "Print the specified ARGs to stdout" //usage: IF_FEATURE_FANCY_ECHO( "\n" -//usage: "\nOptions:" //usage: "\n -n Suppress trailing newline" //usage: "\n -e Interpret backslash escapes (i.e., \\t=tab)" //usage: "\n -E Don't interpret backslash escapes (default)" diff --git a/coreutils/env.c b/coreutils/env.c index 747c668da..807ef13e9 100644 --- a/coreutils/env.c +++ b/coreutils/env.c @@ -36,7 +36,6 @@ //usage:#define env_full_usage "\n\n" //usage: "Print the current environment or run PROG after setting up\n" //usage: "the specified environment\n" -//usage: "\nOptions:" //usage: "\n -, -i Start with an empty environment" //usage: "\n -u Remove variable from the environment" diff --git a/coreutils/expand.c b/coreutils/expand.c index 73ab0ece3..25bbffc66 100644 --- a/coreutils/expand.c +++ b/coreutils/expand.c @@ -25,7 +25,6 @@ //usage: "[-i] [-t N] [FILE]..." //usage:#define expand_full_usage "\n\n" //usage: "Convert tabs to spaces, writing to stdout\n" -//usage: "\nOptions:" //usage: IF_FEATURE_EXPAND_LONG_OPTIONS( //usage: "\n -i,--initial Don't convert tabs after non blanks" //usage: "\n -t,--tabs=N Tabstops every N chars" @@ -39,7 +38,6 @@ //usage: "[-fa][-t N] [FILE]..." //usage:#define unexpand_full_usage "\n\n" //usage: "Convert spaces to tabs, writing to stdout\n" -//usage: "\nOptions:" //usage: IF_FEATURE_UNEXPAND_LONG_OPTIONS( //usage: "\n -a,--all Convert all blanks" //usage: "\n -f,--first-only Convert only leading blanks" diff --git a/coreutils/fold.c b/coreutils/fold.c index 3fe668512..0e7306377 100644 --- a/coreutils/fold.c +++ b/coreutils/fold.c @@ -14,7 +14,6 @@ //usage: "[-bs] [-w WIDTH] [FILE]..." //usage:#define fold_full_usage "\n\n" //usage: "Wrap input lines in each FILE (or stdin), writing to stdout\n" -//usage: "\nOptions:" //usage: "\n -b Count bytes rather than columns" //usage: "\n -s Break at spaces" //usage: "\n -w Use WIDTH columns instead of 80" diff --git a/coreutils/fsync.c b/coreutils/fsync.c index 518c5642b..652a41c33 100644 --- a/coreutils/fsync.c +++ b/coreutils/fsync.c @@ -11,7 +11,6 @@ //usage: "[-d] FILE..." //usage:#define fsync_full_usage "\n\n" //usage: "Write files' buffered blocks to disk\n" -//usage: "\nOptions:" //usage: "\n -d Avoid syncing metadata" #include "libbb.h" diff --git a/coreutils/head.c b/coreutils/head.c index f49320ef4..ec4512765 100644 --- a/coreutils/head.c +++ b/coreutils/head.c @@ -16,7 +16,6 @@ //usage:#define head_full_usage "\n\n" //usage: "Print first 10 lines of each FILE (or stdin) to stdout.\n" //usage: "With more than one FILE, precede each with a filename header.\n" -//usage: "\nOptions:" //usage: "\n -n N[kbm] Print first N lines" //usage: IF_FEATURE_FANCY_HEAD( //usage: "\n -c N[kbm] Print first N bytes" diff --git a/coreutils/id.c b/coreutils/id.c index 42ed4c749..aa6ae4711 100644 --- a/coreutils/id.c +++ b/coreutils/id.c @@ -19,7 +19,6 @@ //usage: "[OPTIONS] [USER]" //usage:#define id_full_usage "\n\n" //usage: "Print information about USER or the current user\n" -//usage: "\nOptions:" //usage: IF_SELINUX( //usage: "\n -Z Security context" //usage: ) diff --git a/coreutils/install.c b/coreutils/install.c index fe5f26e79..445497f9a 100644 --- a/coreutils/install.c +++ b/coreutils/install.c @@ -11,7 +11,6 @@ //usage: "[-cdDsp] [-o USER] [-g GRP] [-m MODE] [SOURCE]... DEST" //usage:#define install_full_usage "\n\n" //usage: "Copy files and set attributes\n" -//usage: "\nOptions:" //usage: "\n -c Just copy (default)" //usage: "\n -d Create directories" //usage: "\n -D Create leading target directories" diff --git a/coreutils/ln.c b/coreutils/ln.c index 2da915a68..88a9a8f91 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c @@ -15,7 +15,6 @@ //usage: "[OPTIONS] TARGET... LINK|DIR" //usage:#define ln_full_usage "\n\n" //usage: "Create a link LINK or DIR/TARGET to the specified TARGET(s)\n" -//usage: "\nOptions:" //usage: "\n -s Make symlinks instead of hardlinks" //usage: "\n -f Remove existing destinations" //usage: "\n -n Don't dereference symlinks - treat like normal file" diff --git a/coreutils/ls.c b/coreutils/ls.c index e7b2e39e1..dec0f85f3 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -42,7 +42,6 @@ //usage: IF_FEATURE_AUTOWIDTH(" [-w WIDTH]") " [FILE]..." //usage:#define ls_full_usage "\n\n" //usage: "List directory contents\n" -//usage: "\nOptions:" //usage: "\n -1 One column output" //usage: "\n -a Include entries which start with ." //usage: "\n -A Like -a, but exclude . and .." diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c index 050d46701..53fd4d1a8 100644 --- a/coreutils/md5_sha1_sum.c +++ b/coreutils/md5_sha1_sum.c @@ -12,7 +12,6 @@ //usage:#define md5sum_full_usage "\n\n" //usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " MD5 checksums" //usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n" -//usage: "\nOptions:" //usage: "\n -c Check sums against given list" //usage: "\n -s Don't output anything, status code shows success" //usage: "\n -w Warn about improperly formatted checksum lines" @@ -34,7 +33,6 @@ //usage:#define sha1sum_full_usage "\n\n" //usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA1 checksums" //usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n" -//usage: "\nOptions:" //usage: "\n -c Check sums against given list" //usage: "\n -s Don't output anything, status code shows success" //usage: "\n -w Warn about improperly formatted checksum lines" @@ -46,7 +44,6 @@ //usage:#define sha256sum_full_usage "\n\n" //usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA256 checksums" //usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n" -//usage: "\nOptions:" //usage: "\n -c Check sums against given list" //usage: "\n -s Don't output anything, status code shows success" //usage: "\n -w Warn about improperly formatted checksum lines" @@ -58,7 +55,6 @@ //usage:#define sha512sum_full_usage "\n\n" //usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA512 checksums" //usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n" -//usage: "\nOptions:" //usage: "\n -c Check sums against given list" //usage: "\n -s Don't output anything, status code shows success" //usage: "\n -w Warn about improperly formatted checksum lines" diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index e425bbe5e..a4429b1cb 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c @@ -23,7 +23,6 @@ //usage: "[OPTIONS] DIRECTORY..." //usage:#define mkdir_full_usage "\n\n" //usage: "Create DIRECTORY\n" -//usage: "\nOptions:" //usage: "\n -m MODE Mode" //usage: "\n -p No error if exists; make parent directories as needed" //usage: IF_SELINUX( diff --git a/coreutils/mkfifo.c b/coreutils/mkfifo.c index 84d8d99dd..ef58325b3 100644 --- a/coreutils/mkfifo.c +++ b/coreutils/mkfifo.c @@ -14,7 +14,6 @@ //usage: "[-m MODE] " IF_SELINUX("[-Z] ") "NAME" //usage:#define mkfifo_full_usage "\n\n" //usage: "Create named pipe\n" -//usage: "\nOptions:" //usage: "\n -m MODE Mode (default a=rw)" //usage: IF_SELINUX( //usage: "\n -Z Set security context" diff --git a/coreutils/mknod.c b/coreutils/mknod.c index 50dbd62e3..32d3659ac 100644 --- a/coreutils/mknod.c +++ b/coreutils/mknod.c @@ -13,7 +13,6 @@ //usage: "[-m MODE] " IF_SELINUX("[-Z] ") "NAME TYPE MAJOR MINOR" //usage:#define mknod_full_usage "\n\n" //usage: "Create a special file (block, character, or pipe)\n" -//usage: "\nOptions:" //usage: "\n -m MODE Creation mode (default a=rw)" //usage: IF_SELINUX( //usage: "\n -Z Set security context" diff --git a/coreutils/mv.c b/coreutils/mv.c index 399f391b2..87f4cd5a5 100644 --- a/coreutils/mv.c +++ b/coreutils/mv.c @@ -21,7 +21,6 @@ //usage: "or: mv [-fin] SOURCE... DIRECTORY" //usage:#define mv_full_usage "\n\n" //usage: "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY\n" -//usage: "\nOptions:" //usage: "\n -f Don't prompt before overwriting" //usage: "\n -i Interactive, prompt before overwrite" //usage: "\n -n Don't overwrite an existing file" diff --git a/coreutils/nice.c b/coreutils/nice.c index 2763986e7..ce759916f 100644 --- a/coreutils/nice.c +++ b/coreutils/nice.c @@ -11,7 +11,6 @@ //usage: "[-n ADJUST] [PROG ARGS]" //usage:#define nice_full_usage "\n\n" //usage: "Change scheduling priority, run PROG\n" -//usage: "\nOptions:" //usage: "\n -n ADJUST Adjust priority by ADJUST" #include diff --git a/coreutils/readlink.c b/coreutils/readlink.c index 1a0eca646..f7ad791ec 100644 --- a/coreutils/readlink.c +++ b/coreutils/readlink.c @@ -12,7 +12,6 @@ //usage:#define readlink_full_usage "\n\n" //usage: "Display the value of a symlink" //usage: IF_FEATURE_READLINK_FOLLOW( "\n" -//usage: "\nOptions:" //usage: "\n -f Canonicalize by following all symlinks" //usage: "\n -n Don't add newline" //usage: "\n -v Verbose" diff --git a/coreutils/rm.c b/coreutils/rm.c index 8efd895cc..042fba162 100644 --- a/coreutils/rm.c +++ b/coreutils/rm.c @@ -19,7 +19,6 @@ //usage: "[-irf] FILE..." //usage:#define rm_full_usage "\n\n" //usage: "Remove (unlink) FILEs\n" -//usage: "\nOptions:" //usage: "\n -i Always prompt before removing" //usage: "\n -f Never prompt" //usage: "\n -R,-r Recurse" diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c index 0dbd940a1..2840d1cfa 100644 --- a/coreutils/rmdir.c +++ b/coreutils/rmdir.c @@ -14,7 +14,6 @@ //usage: "[OPTIONS] DIRECTORY..." //usage:#define rmdir_full_usage "\n\n" //usage: "Remove DIRECTORY if it is empty\n" -//usage: "\nOptions:" //usage: IF_FEATURE_RMDIR_LONG_OPTIONS( //usage: "\n -p|--parents Include parents" //usage: "\n --ignore-fail-on-non-empty" diff --git a/coreutils/seq.c b/coreutils/seq.c index b600266fd..898619293 100644 --- a/coreutils/seq.c +++ b/coreutils/seq.c @@ -12,7 +12,6 @@ //usage:#define seq_full_usage "\n\n" //usage: "Print numbers from FIRST to LAST, in steps of INC.\n" //usage: "FIRST, INC default to 1.\n" -//usage: "\nOptions:" //usage: "\n -w Pad to last with leading zeros" //usage: "\n -s SEP String separator" diff --git a/coreutils/sort.c b/coreutils/sort.c index f709ea1b3..1df07285c 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c @@ -18,7 +18,6 @@ //usage: "] [FILE]..." //usage:#define sort_full_usage "\n\n" //usage: "Sort lines of text\n" -//usage: "\nOptions:" //usage: IF_FEATURE_SORT_BIG( //usage: "\n -b Ignore leading blanks" //usage: "\n -c Check whether input is sorted" diff --git a/coreutils/split.c b/coreutils/split.c index f0077077e..11e640442 100644 --- a/coreutils/split.c +++ b/coreutils/split.c @@ -13,8 +13,7 @@ //usage:#define split_trivial_usage //usage: "[OPTIONS] [INPUT [PREFIX]]" //usage:#define split_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -b N[k|m] Split by N (kilo|mega)bytes" +//usage: " -b N[k|m] Split by N (kilo|mega)bytes" //usage: "\n -l N Split by N lines" //usage: "\n -a N Use N letters as suffix" //usage: diff --git a/coreutils/stat.c b/coreutils/stat.c index e85e51033..2797719dd 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c @@ -17,7 +17,6 @@ //usage: "[OPTIONS] FILE..." //usage:#define stat_full_usage "\n\n" //usage: "Display file (default) or filesystem status\n" -//usage: "\nOptions:" //usage: IF_FEATURE_STAT_FORMAT( //usage: "\n -c fmt Use the specified format" //usage: ) diff --git a/coreutils/stty.c b/coreutils/stty.c index af2347161..7f057ead2 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c @@ -26,7 +26,6 @@ //usage:#define stty_full_usage "\n\n" //usage: "Without arguments, prints baud rate, line discipline,\n" //usage: "and deviations from stty sane\n" -//usage: "\nOptions:" //usage: "\n -F DEVICE Open device instead of stdin" //usage: "\n -a Print all current settings in human-readable form" //usage: "\n -g Print in stty-readable form" diff --git a/coreutils/sum.c b/coreutils/sum.c index 9e6b0c5b1..95110a6da 100644 --- a/coreutils/sum.c +++ b/coreutils/sum.c @@ -17,7 +17,6 @@ //usage: "[-rs] [FILE]..." //usage:#define sum_full_usage "\n\n" //usage: "Checksum and count the blocks in a file\n" -//usage: "\nOptions:" //usage: "\n -r Use BSD sum algorithm (1K blocks)" //usage: "\n -s Use System V sum algorithm (512byte blocks)" diff --git a/coreutils/tail.c b/coreutils/tail.c index 4b42ebc52..454c25936 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c @@ -29,7 +29,6 @@ //usage:#define tail_full_usage "\n\n" //usage: "Print last 10 lines of each FILE (or stdin) to stdout.\n" //usage: "With more than one FILE, precede each with a filename header.\n" -//usage: "\nOptions:" //usage: "\n -f Print data as file grows" //usage: IF_FEATURE_FANCY_TAIL( //usage: "\n -s SECONDS Wait SECONDS between reads with -f" diff --git a/coreutils/tee.c b/coreutils/tee.c index 3e3164e70..48cc0508f 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c @@ -14,7 +14,6 @@ //usage: "[-ai] [FILE]..." //usage:#define tee_full_usage "\n\n" //usage: "Copy stdin to each FILE, and also to stdout\n" -//usage: "\nOptions:" //usage: "\n -a Append to the given FILEs, don't overwrite" //usage: "\n -i Ignore interrupt signals (SIGINT)" //usage: diff --git a/coreutils/touch.c b/coreutils/touch.c index c51fb70ca..0f980fd7b 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c @@ -34,7 +34,6 @@ //usage: "[-c]" IF_DESKTOP(" [-d DATE] [-r FILE]") " FILE [FILE]..." //usage:#define touch_full_usage "\n\n" //usage: "Update the last-modified date on the given FILE[s]\n" -//usage: "\nOptions:" //usage: "\n -c Don't create files" //usage: IF_DESKTOP( //usage: "\n -d DT Date/time to use" diff --git a/coreutils/tr.c b/coreutils/tr.c index 2f14a414f..e67948a36 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c @@ -51,7 +51,6 @@ //usage: "[-cds] STRING1 [STRING2]" //usage:#define tr_full_usage "\n\n" //usage: "Translate, squeeze, or delete characters from stdin, writing to stdout\n" -//usage: "\nOptions:" //usage: "\n -c Take complement of STRING1" //usage: "\n -d Delete input characters coded STRING1" //usage: "\n -s Squeeze multiple output characters of STRING2 into one character" diff --git a/coreutils/tty.c b/coreutils/tty.c index 67399cbf3..45175054e 100644 --- a/coreutils/tty.c +++ b/coreutils/tty.c @@ -15,7 +15,6 @@ //usage:#define tty_full_usage "\n\n" //usage: "Print file name of stdin's terminal" //usage: IF_INCLUDE_SUSv2( "\n" -//usage: "\nOptions:" //usage: "\n -s Print nothing, only return exit status" //usage: ) //usage: diff --git a/coreutils/uname.c b/coreutils/uname.c index 7a86b32a6..b96d76b6c 100644 --- a/coreutils/uname.c +++ b/coreutils/uname.c @@ -52,7 +52,6 @@ //usage: "[-amnrspv]" //usage:#define uname_full_usage "\n\n" //usage: "Print system information\n" -//usage: "\nOptions:" //usage: "\n -a Print all" //usage: "\n -m The machine (hardware) type" //usage: "\n -n Hostname" diff --git a/coreutils/uniq.c b/coreutils/uniq.c index 6e764d8a4..9208d34ec 100644 --- a/coreutils/uniq.c +++ b/coreutils/uniq.c @@ -14,7 +14,6 @@ //usage: "[-cdu][-f,s,w N] [INPUT [OUTPUT]]" //usage:#define uniq_full_usage "\n\n" //usage: "Discard duplicate lines\n" -//usage: "\nOptions:" //usage: "\n -c Prefix lines by the number of occurrences" //usage: "\n -d Only print duplicate lines" //usage: "\n -u Only print unique lines" diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index 47a155ecb..6ecfe6cef 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c @@ -158,7 +158,6 @@ int uudecode_main(int argc UNUSED_PARAM, char **argv) //usage: "[-d] [FILE]" //usage:#define base64_full_usage "\n\n" //usage: "Base64 encode or decode FILE to standard output" -//usage: "\nOptions:" //usage: "\n -d Decode data" ////usage: "\n -w COL Wrap lines at COL (default 76, 0 disables)" ////usage: "\n -i When decoding, ignore non-alphabet characters" diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c index b4cd0a9e6..84a489a11 100644 --- a/coreutils/uuencode.c +++ b/coreutils/uuencode.c @@ -12,7 +12,6 @@ //usage: "[-m] [INFILE] STORED_FILENAME" //usage:#define uuencode_full_usage "\n\n" //usage: "Uuencode a file to stdout\n" -//usage: "\nOptions:" //usage: "\n -m Use base64 encoding per RFC1521" //usage: //usage:#define uuencode_example_usage diff --git a/coreutils/wc.c b/coreutils/wc.c index 6e22c66c8..a410e407a 100644 --- a/coreutils/wc.c +++ b/coreutils/wc.c @@ -64,7 +64,6 @@ //usage: //usage:#define wc_full_usage "\n\n" //usage: "Count lines, words, and bytes for each FILE (or stdin)\n" -//usage: "\nOptions:" //usage: "\n -c Count bytes" //usage: IF_UNICODE_SUPPORT( //usage: "\n -m Count characters" diff --git a/coreutils/who.c b/coreutils/who.c index ec385bf95..9f37f65fd 100644 --- a/coreutils/who.c +++ b/coreutils/who.c @@ -22,7 +22,6 @@ //usage: "[-a]" //usage:#define who_full_usage "\n\n" //usage: "Show who is logged on\n" -//usage: "\nOptions:" //usage: "\n -a Show all" #include "libbb.h" diff --git a/debianutils/mktemp.c b/debianutils/mktemp.c index f4961af59..007cb1c5b 100644 --- a/debianutils/mktemp.c +++ b/debianutils/mktemp.c @@ -37,7 +37,6 @@ //usage: "Create a temporary file with name based on TEMPLATE and print its name.\n" //usage: "TEMPLATE must end with XXXXXX (e.g. [/dir/]nameXXXXXX).\n" //usage: "Without TEMPLATE, -t tmp.XXXXXX is assumed.\n" -//usage: "\nOptions:" //usage: "\n -d Make directory, not file" ////usage: "\n -q Fail silently on errors" - we ignore this opt //usage: "\n -t Prepend base directory name to TEMPLATE" diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c index 0c2302696..65cbfc338 100644 --- a/debianutils/run_parts.c +++ b/debianutils/run_parts.c @@ -34,7 +34,6 @@ //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: "\nOptions:" //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" diff --git a/e2fsprogs/chattr.c b/e2fsprogs/chattr.c index b1c77faad..f1cc8389f 100644 --- a/e2fsprogs/chattr.c +++ b/e2fsprogs/chattr.c @@ -39,7 +39,6 @@ //usage: "\n S Write file contents synchronously" //usage: "\n t Disable tail-merging of partial blocks with other files" //usage: "\n u Allow file to be undeleted" -//usage: "\nOptions:" //usage: "\n -R Recurse" //usage: "\n -v Set the file's version/generation number" diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index fcbdb5989..4b2f774f5 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c @@ -38,7 +38,6 @@ //usage: "[-ANPRTV] [-C FD] [-t FSTYPE] [FS_OPTS] [BLOCKDEV]..." //usage:#define fsck_full_usage "\n\n" //usage: "Check and repair filesystems\n" -//usage: "\nOptions:" //usage: "\n -A Walk /etc/fstab and check all filesystems" //usage: "\n -N Don't execute, just show what would be done" //usage: "\n -P With -A, check filesystems in parallel" diff --git a/e2fsprogs/lsattr.c b/e2fsprogs/lsattr.c index 964e8d026..1312fe754 100644 --- a/e2fsprogs/lsattr.c +++ b/e2fsprogs/lsattr.c @@ -22,7 +22,6 @@ //usage: "[-Radlv] [FILE]..." //usage:#define lsattr_full_usage "\n\n" //usage: "List file attributes on an ext2 fs\n" -//usage: "\nOptions:" //usage: "\n -R Recurse" //usage: "\n -a Don't hide entries starting with ." //usage: "\n -d List directory entries instead of contents" diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.c b/e2fsprogs/old_e2fsprogs/e2fsck.c index ad4ff348b..8fffa7f20 100644 --- a/e2fsprogs/old_e2fsprogs/e2fsck.c +++ b/e2fsprogs/old_e2fsprogs/e2fsck.c @@ -37,7 +37,6 @@ //usage: "[-E extended-options] device" //usage:#define e2fsck_full_usage "\n\n" //usage: "Check ext2/ext3 file system\n" -//usage: "\nOptions:" //usage: "\n -p Automatic repair (no questions)" //usage: "\n -n Make no changes to the filesystem" //usage: "\n -y Assume 'yes' to all questions" diff --git a/editors/awk.c b/editors/awk.c index 9d38b1f88..7685546e5 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -10,8 +10,7 @@ //usage:#define awk_trivial_usage //usage: "[OPTIONS] [AWK_PROGRAM] [FILE]..." //usage:#define awk_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -v VAR=VAL Set variable" +//usage: " -v VAR=VAL Set variable" //usage: "\n -F SEP Use SEP as field separator" //usage: "\n -f FILE Read program from FILE" diff --git a/editors/cmp.c b/editors/cmp.c index 3a0f5aa4f..fbe6b9753 100644 --- a/editors/cmp.c +++ b/editors/cmp.c @@ -14,7 +14,6 @@ //usage: "[-l] [-s] FILE1 [FILE2" IF_DESKTOP(" [SKIP1 [SKIP2]]") "]" //usage:#define cmp_full_usage "\n\n" //usage: "Compare FILE1 with FILE2 (or stdin)\n" -//usage: "\nOptions:" //usage: "\n -l Write the byte numbers (decimal) and values (octal)" //usage: "\n for all differing bytes" //usage: "\n -s Quiet" diff --git a/editors/diff.c b/editors/diff.c index 8b1e92783..8c0a31f47 100644 --- a/editors/diff.c +++ b/editors/diff.c @@ -81,7 +81,6 @@ //usage:#define diff_full_usage "\n\n" //usage: "Compare files line by line and output the differences between them.\n" //usage: "This implementation supports unified diffs only.\n" -//usage: "\nOptions:" //usage: "\n -a Treat all files as text" //usage: "\n -b Ignore changes in the amount of whitespace" //usage: "\n -B Ignore changes whose lines are all blank" diff --git a/editors/sed.c b/editors/sed.c index 99e56ff52..5c4e9cc3b 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -59,8 +59,7 @@ //usage:#define sed_trivial_usage //usage: "[-efinr] SED_CMD [FILE]..." //usage:#define sed_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -e CMD Add CMD to sed commands to be executed" +//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 -n Suppress automatic printing of pattern space" diff --git a/editors/vi.c b/editors/vi.c index e1f3724cc..3656fee95 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -25,7 +25,6 @@ //usage: "[OPTIONS] [FILE]..." //usage:#define vi_full_usage "\n\n" //usage: "Edit FILE\n" -//usage: "\nOptions:" //usage: IF_FEATURE_VI_COLON( //usage: "\n -c Initial command to run ($EXINIT also available)" //usage: ) diff --git a/findutils/find.c b/findutils/find.c index 050d6373e..babcda0ed 100644 --- a/findutils/find.c +++ b/findutils/find.c @@ -236,7 +236,6 @@ //usage: "Search for files and perform actions on them.\n" //usage: "First failed action stops processing of current file.\n" //usage: "Defaults: PATH is current directory, action is '-print'\n" -//usage: "\nOptions:" //usage: "\n -follow Follow symlinks" //usage: IF_FEATURE_FIND_XDEV( //usage: "\n -xdev Don't descend directories on other filesystems" diff --git a/findutils/grep.c b/findutils/grep.c index e7116e4c9..3acfa9197 100644 --- a/findutils/grep.c +++ b/findutils/grep.c @@ -72,7 +72,6 @@ //usage: "PATTERN/-e PATTERN.../-f FILE [FILE]..." //usage:#define grep_full_usage "\n\n" //usage: "Search for PATTERN in FILEs (or stdin)\n" -//usage: "\nOptions:" //usage: "\n -H Add 'filename:' prefix" //usage: "\n -h Do not add 'filename:' prefix" //usage: "\n -n Add 'line_no:' prefix" diff --git a/findutils/xargs.c b/findutils/xargs.c index 967737133..0d1bb43fc 100644 --- a/findutils/xargs.c +++ b/findutils/xargs.c @@ -349,7 +349,6 @@ static int xargs_ask_confirmation(void) //usage: "[OPTIONS] [PROG ARGS]" //usage:#define xargs_full_usage "\n\n" //usage: "Run PROG on every item given by stdin\n" -//usage: "\nOptions:" //usage: IF_FEATURE_XARGS_SUPPORT_CONFIRMATION( //usage: "\n -p Ask user whether to run each command" //usage: ) diff --git a/init/bootchartd.c b/init/bootchartd.c index 009e2690c..5f6121fa4 100644 --- a/init/bootchartd.c +++ b/init/bootchartd.c @@ -327,7 +327,6 @@ static void finalize(char *tempdir, const char *prog) //usage: "start [PROG ARGS]|stop|init" //usage:#define bootchartd_full_usage "\n\n" //usage: "Create /var/log/bootchart.tgz with boot chart data\n" -//usage: "\nOptions:" //usage: "\nstart: start background logging; with PROG, run PROG, then kill logging with USR1" //usage: "\nstop: send USR1 to all bootchartd processes" //usage: "\ninit: start background logging; stop when getty/xdm is seen (for init scripts)" diff --git a/init/halt.c b/init/halt.c index a84a72747..433326dd4 100644 --- a/init/halt.c +++ b/init/halt.c @@ -43,7 +43,6 @@ //usage: "[-d DELAY] [-n] [-f]" IF_FEATURE_WTMP(" [-w]") //usage:#define halt_full_usage "\n\n" //usage: "Halt the system\n" -//usage: "\nOptions:" //usage: "\n -d SEC Delay interval" //usage: "\n -n Do not sync" //usage: "\n -f Force (don't go through init)" @@ -55,7 +54,6 @@ //usage: "[-d DELAY] [-n] [-f]" //usage:#define poweroff_full_usage "\n\n" //usage: "Halt and shut off power\n" -//usage: "\nOptions:" //usage: "\n -d SEC Delay interval" //usage: "\n -n Do not sync" //usage: "\n -f Force (don't go through init)" @@ -64,7 +62,6 @@ //usage: "[-d DELAY] [-n] [-f]" //usage:#define reboot_full_usage "\n\n" //usage: "Reboot the system\n" -//usage: "\nOptions:" //usage: "\n -d SEC Delay interval" //usage: "\n -n Do not sync" //usage: "\n -f Force (don't go through init)" diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c index 2d6736f1a..b37270ff0 100644 --- a/loginutils/addgroup.c +++ b/loginutils/addgroup.c @@ -14,7 +14,6 @@ //usage: "[-g GID] " IF_FEATURE_ADDUSER_TO_GROUP("[USER] ") "GROUP" //usage:#define addgroup_full_usage "\n\n" //usage: "Add a group " IF_FEATURE_ADDUSER_TO_GROUP("or add a user to a group") "\n" -//usage: "\nOptions:" //usage: "\n -g GID Group id" //usage: "\n -S Create a system group" diff --git a/loginutils/adduser.c b/loginutils/adduser.c index 47c674bf4..1d082c876 100644 --- a/loginutils/adduser.c +++ b/loginutils/adduser.c @@ -12,7 +12,6 @@ //usage: "[OPTIONS] USER" //usage:#define adduser_full_usage "\n\n" //usage: "Add a user\n" -//usage: "\nOptions:" //usage: "\n -h DIR Home directory" //usage: "\n -g GECOS GECOS field" //usage: "\n -s SHELL Login shell" diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c index f4718c829..2262b792a 100644 --- a/loginutils/chpasswd.c +++ b/loginutils/chpasswd.c @@ -11,7 +11,6 @@ //usage: IF_LONG_OPTS("[--md5|--encrypted]") IF_NOT_LONG_OPTS("[-m|-e]") //usage:#define chpasswd_full_usage "\n\n" //usage: "Read user:password from stdin and update /etc/passwd\n" -//usage: "\nOptions:" //usage: IF_LONG_OPTS( //usage: "\n -e,--encrypted Supplied passwords are in encrypted form" //usage: "\n -m,--md5 Use MD5 encryption instead of DES" diff --git a/loginutils/cryptpw.c b/loginutils/cryptpw.c index b25a39ac9..b244f55e3 100644 --- a/loginutils/cryptpw.c +++ b/loginutils/cryptpw.c @@ -15,7 +15,6 @@ /* We do support -s, we just don't mention it */ //usage:#define cryptpw_full_usage "\n\n" //usage: "Crypt PASSWORD using crypt(3)\n" -//usage: "\nOptions:" //usage: IF_LONG_OPTS( //usage: "\n -P,--password-fd=N Read password from fd N" /* //usage: "\n -s,--stdin Use stdin; like -P0" */ @@ -35,7 +34,6 @@ /* We do support -s, we just don't mention it */ //usage:#define mkpasswd_full_usage "\n\n" //usage: "Crypt PASSWORD using crypt(3)\n" -//usage: "\nOptions:" //usage: IF_LONG_OPTS( //usage: "\n -P,--password-fd=N Read password from fd N" /* //usage: "\n -s,--stdin Use stdin; like -P0" */ diff --git a/loginutils/getty.c b/loginutils/getty.c index dfa15b3da..62456651b 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c @@ -105,7 +105,6 @@ struct globals { //usage: "[OPTIONS] BAUD_RATE[,BAUD_RATE]... TTY [TERMTYPE]" //usage:#define getty_full_usage "\n\n" //usage: "Open a tty, prompt for a login name, then invoke /bin/login\n" -//usage: "\nOptions:" //usage: "\n -h Enable hardware RTS/CTS flow control" //usage: "\n -L Set CLOCAL (ignore Carrier Detect state)" //usage: "\n -m Get baud rate from modem's CONNECT status message" diff --git a/loginutils/login.c b/loginutils/login.c index f2563dc09..2f7b9b212 100644 --- a/loginutils/login.c +++ b/loginutils/login.c @@ -7,7 +7,6 @@ //usage: "[-p] [-h HOST] [[-f] USER]" //usage:#define login_full_usage "\n\n" //usage: "Begin a new session on the system\n" -//usage: "\nOptions:" //usage: "\n -f Don't authenticate (user already authenticated)" //usage: "\n -h Name of the remote host" //usage: "\n -p Preserve environment" diff --git a/loginutils/passwd.c b/loginutils/passwd.c index b3ce646f1..1cfafaec3 100644 --- a/loginutils/passwd.c +++ b/loginutils/passwd.c @@ -8,7 +8,6 @@ //usage:#define passwd_full_usage "\n\n" //usage: "Change USER's password (default: current user)" //usage: "\n" -//usage: "\nOptions:" //usage: "\n -a ALG Encryption method" //usage: "\n -d Set password to ''" //usage: "\n -l Lock (disable) account" diff --git a/loginutils/su.c b/loginutils/su.c index 72dd0f06f..57ea738f4 100644 --- a/loginutils/su.c +++ b/loginutils/su.c @@ -12,7 +12,6 @@ //usage: "[OPTIONS] [-] [USER]" //usage:#define su_full_usage "\n\n" //usage: "Run shell under USER (by default, root)\n" -//usage: "\nOptions:" //usage: "\n -,-l Clear environment, run shell as login shell" //usage: "\n -p,-m Do not set new $HOME, $SHELL, $USER, $LOGNAME" //usage: "\n -c CMD Command to pass to 'sh -c'" diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c index 28edf067c..bd2b09eed 100644 --- a/loginutils/sulogin.c +++ b/loginutils/sulogin.c @@ -9,7 +9,6 @@ //usage: "[-t N] [TTY]" //usage:#define sulogin_full_usage "\n\n" //usage: "Single user login\n" -//usage: "\nOptions:" //usage: "\n -t N Timeout" #include "libbb.h" diff --git a/loginutils/vlock.c b/loginutils/vlock.c index efad63ff3..75af9390e 100644 --- a/loginutils/vlock.c +++ b/loginutils/vlock.c @@ -19,7 +19,6 @@ //usage: "[-a]" //usage:#define vlock_full_usage "\n\n" //usage: "Lock a virtual terminal. A password is required to unlock.\n" -//usage: "\nOptions:" //usage: "\n -a Lock all VTs" #include "libbb.h" diff --git a/mailutils/makemime.c b/mailutils/makemime.c index 628619bb8..4dc53a3b2 100644 --- a/mailutils/makemime.c +++ b/mailutils/makemime.c @@ -132,12 +132,11 @@ Content-Transfer-Encoding: 7bit //usage:#define makemime_full_usage "\n\n" //usage: "Create multipart MIME-encoded message from FILEs\n" /* //usage: "Transfer encoding is base64, disposition is inline (not attachment)\n" */ -//usage: "\nOptions:" //usage: "\n -o FILE Output. Default: stdout" //usage: "\n -a HDR Add header. Examples:" //usage: "\n \"From: user@host.org\", \"Date: `date -R`\"" //usage: "\n -c CT Content type. Default: text/plain" -//usage: "\n -C CS Charset. Default: " CONFIG_FEATURE_MIME_CHARSET +//usage: "\n -C CS Charset. Default: " CONFIG_FEATURE_MIME_CHARSET /* //usage: "\n -e ENC Transfer encoding. Ignored. base64 is assumed" */ //usage: "\n" //usage: "\nOther options are silently ignored" diff --git a/mailutils/popmaildir.c b/mailutils/popmaildir.c index c9d22aa28..62030331e 100644 --- a/mailutils/popmaildir.c +++ b/mailutils/popmaildir.c @@ -16,7 +16,6 @@ //usage: "[OPTIONS] MAILDIR [CONN_HELPER ARGS]" //usage:#define popmaildir_full_usage "\n\n" //usage: "Fetch content of remote mailbox to local maildir\n" -//usage: "\nOptions:" /* //usage: "\n -b Binary mode. Ignored" */ /* //usage: "\n -d Debug. Ignored" */ /* //usage: "\n -m Show used memory. Ignored" */ diff --git a/mailutils/reformime.c b/mailutils/reformime.c index aa5e3b1c0..5e28ef729 100644 --- a/mailutils/reformime.c +++ b/mailutils/reformime.c @@ -234,7 +234,6 @@ static int parse(const char *boundary, char **argv) //usage: "[OPTIONS]" //usage:#define reformime_full_usage "\n\n" //usage: "Parse MIME-encoded message on stdin\n" -//usage: "\nOptions:" //usage: "\n -x PREFIX Extract content of MIME sections to files" //usage: "\n -X PROG ARGS Filter content of MIME sections through PROG" //usage: "\n Must be the last option" diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c index e1edbbebc..98b6ccfbf 100644 --- a/miscutils/adjtimex.c +++ b/miscutils/adjtimex.c @@ -15,7 +15,6 @@ //usage: "[-q] [-o OFF] [-f FREQ] [-p TCONST] [-t TICK]" //usage:#define adjtimex_full_usage "\n\n" //usage: "Read and optionally set system timebase parameters. See adjtimex(2)\n" -//usage: "\nOptions:" //usage: "\n -q Quiet" //usage: "\n -o OFF Time offset, microseconds" //usage: "\n -f FREQ Frequency adjust, integer kernel units (65536 is 1ppm)" diff --git a/miscutils/beep.c b/miscutils/beep.c index c7699ffe1..910e03e1b 100644 --- a/miscutils/beep.c +++ b/miscutils/beep.c @@ -11,8 +11,7 @@ //usage:#define beep_trivial_usage //usage: "-f FREQ -l LEN -d DELAY -r COUNT -n" //usage:#define beep_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -f Frequency in Hz" +//usage: " -f Frequency in Hz" //usage: "\n -l Length in ms" //usage: "\n -d Delay in ms" //usage: "\n -r Repetitions" diff --git a/miscutils/chrt.c b/miscutils/chrt.c index 7e40b9f13..91b5397c4 100644 --- a/miscutils/chrt.c +++ b/miscutils/chrt.c @@ -10,7 +10,6 @@ //usage: "[-prfom] [PRIO] [PID | PROG ARGS]" //usage:#define chrt_full_usage "\n\n" //usage: "Change scheduling priority and class for a process\n" -//usage: "\nOptions:" //usage: "\n -p Operate on PID" //usage: "\n -r Set SCHED_RR class" //usage: "\n -f Set SCHED_FIFO class" diff --git a/miscutils/conspy.c b/miscutils/conspy.c index 90ef91c5c..433c3e829 100644 --- a/miscutils/conspy.c +++ b/miscutils/conspy.c @@ -30,7 +30,6 @@ //usage: "A text-mode VNC like program for Linux virtual consoles." //usage: "\nTo exit, quickly press ESC 3 times." //usage: "\n" -//usage: "\nOptions:" //usage: "\n -v Don't send keystrokes to the console" //usage: "\n -c Create missing devices in /dev" //usage: "\n -s Open a SHELL session" diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index 706276015..6493fe4f1 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c @@ -58,7 +58,6 @@ //usage: "mntpnt [-v]" IF_DEVFSD_FG_NP("[-fg][-np]") //usage:#define devfsd_full_usage "\n\n" //usage: "Manage devfs permissions and old device name symlinks\n" -//usage: "\nOptions:" //usage: "\n mntpnt The mount point where devfs is mounted" //usage: "\n -v Print the protocol version numbers for devfsd" //usage: "\n and the kernel-side protocol version and exit" diff --git a/miscutils/eject.c b/miscutils/eject.c index 184ccc5d7..a20e04b7f 100644 --- a/miscutils/eject.c +++ b/miscutils/eject.c @@ -17,7 +17,6 @@ //usage: "[-t] [-T] [DEVICE]" //usage:#define eject_full_usage "\n\n" //usage: "Eject DEVICE or default /dev/cdrom\n" -//usage: "\nOptions:" //usage: IF_FEATURE_EJECT_SCSI( //usage: "\n -s SCSI device" //usage: ) diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c index c761a88ca..51ba4729e 100644 --- a/miscutils/fbsplash.c +++ b/miscutils/fbsplash.c @@ -24,8 +24,7 @@ //usage:#define fbsplash_trivial_usage //usage: "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]" //usage:#define fbsplash_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -s Image" +//usage: " -s Image" //usage: "\n -c Hide cursor" //usage: "\n -d Framebuffer device (default /dev/fb0)" //usage: "\n -i Config file (var=value):" diff --git a/miscutils/flash_eraseall.c b/miscutils/flash_eraseall.c index 33803f87d..0598371d5 100644 --- a/miscutils/flash_eraseall.c +++ b/miscutils/flash_eraseall.c @@ -14,7 +14,6 @@ //usage: "[-jq] MTD_DEVICE" //usage:#define flash_eraseall_full_usage "\n\n" //usage: "Erase an MTD device\n" -//usage: "\nOptions:" //usage: "\n -j Format the device for jffs2" //usage: "\n -q Don't display progress messages" diff --git a/miscutils/flashcp.c b/miscutils/flashcp.c index e4bb3a902..790f9c01f 100644 --- a/miscutils/flashcp.c +++ b/miscutils/flashcp.c @@ -11,7 +11,6 @@ //usage: "-v FILE MTD_DEVICE" //usage:#define flashcp_full_usage "\n\n" //usage: "Copy an image to MTD device\n" -//usage: "\nOptions:" //usage: "\n -v Verbose" #include "libbb.h" diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index 7608408dd..f30e7dec6 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c @@ -15,8 +15,7 @@ //usage:#define hdparm_trivial_usage //usage: "[OPTIONS] [DEVICE]" //usage:#define hdparm_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -a Get/set fs readahead" +//usage: " -a Get/set fs readahead" //usage: "\n -A Set drive read-lookahead flag (0/1)" //usage: "\n -b Get/set bus state (0 == off, 1 == on, 2 == tristate)" //usage: "\n -B Set Advanced Power Management setting (1-255)" diff --git a/miscutils/ionice.c b/miscutils/ionice.c index 2bc83c5eb..bd300605f 100644 --- a/miscutils/ionice.c +++ b/miscutils/ionice.c @@ -11,7 +11,6 @@ //usage: "[-c 1-3] [-n 0-7] [-p PID] [PROG]" //usage:#define ionice_full_usage "\n\n" //usage: "Change I/O priority and class\n" -//usage: "\nOptions:" //usage: "\n -c Class. 1:realtime 2:best-effort 3:idle" //usage: "\n -n Priority" diff --git a/miscutils/last.c b/miscutils/last.c index 27f5a35ce..d52780374 100644 --- a/miscutils/last.c +++ b/miscutils/last.c @@ -12,7 +12,6 @@ //usage:#define last_full_usage "\n\n" //usage: "Show listing of the last users that logged into the system" //usage: IF_FEATURE_LAST_FANCY( "\n" -//usage: "\nOptions:" /* //usage: "\n -H Show header line" */ //usage: "\n -W Display with no host column truncation" //usage: "\n -f FILE Read from FILE instead of /var/log/wtmp" diff --git a/miscutils/less.c b/miscutils/less.c index 77fd5a8de..46024f9f7 100644 --- a/miscutils/less.c +++ b/miscutils/less.c @@ -25,7 +25,6 @@ //usage: "[-EMNmh~I?] [FILE]..." //usage:#define less_full_usage "\n\n" //usage: "View FILE (or stdin) one screenful at a time\n" -//usage: "\nOptions:" //usage: "\n -E Quit once the end of a file is reached" //usage: "\n -M,-m Display status line with line numbers" //usage: "\n and percentage through the file" diff --git a/miscutils/man.c b/miscutils/man.c index 2c6b25ceb..3bf7e84b6 100644 --- a/miscutils/man.c +++ b/miscutils/man.c @@ -7,8 +7,7 @@ //usage: "[-aw] [MANPAGE]..." //usage:#define man_full_usage "\n\n" //usage: "Format and display manual page\n" -//usage: "\nOptions:" -//usage: "\n -a Display all pages" +//usage: "\n -a Display all pages" //usage: "\n -w Show page locations" #include "libbb.h" diff --git a/miscutils/microcom.c b/miscutils/microcom.c index edaeb6fa5..5e29a1acd 100644 --- a/miscutils/microcom.c +++ b/miscutils/microcom.c @@ -12,7 +12,6 @@ //usage: "[-d DELAY] [-t TIMEOUT] [-s SPEED] [-X] TTY" //usage:#define microcom_full_usage "\n\n" //usage: "Copy bytes for stdin to TTY and from TTY to stdout\n" -//usage: "\nOptions:" //usage: "\n -d Wait up to DELAY ms for TTY output before sending every" //usage: "\n next byte to it" //usage: "\n -t Exit if both stdin and TTY are silent for TIMEOUT ms" diff --git a/miscutils/mountpoint.c b/miscutils/mountpoint.c index a1a5b396a..7041f7c59 100644 --- a/miscutils/mountpoint.c +++ b/miscutils/mountpoint.c @@ -13,7 +13,6 @@ //usage: "[-q] <[-dn] DIR | -x DEVICE>" //usage:#define mountpoint_full_usage "\n\n" //usage: "Check if the directory is a mountpoint\n" -//usage: "\nOptions:" //usage: "\n -q Quiet" //usage: "\n -d Print major/minor device number of the filesystem" //usage: "\n -n Print device name of the filesystem" diff --git a/miscutils/nandwrite.c b/miscutils/nandwrite.c index c7fbe7d9c..768aed116 100644 --- a/miscutils/nandwrite.c +++ b/miscutils/nandwrite.c @@ -32,7 +32,6 @@ //usage: "[-p] [-s ADDR] MTD_DEVICE [FILE]" //usage:#define nandwrite_full_usage "\n\n" //usage: "Write to the specified MTD device\n" -//usage: "\nOptions:" //usage: "\n -p Pad to page size" //usage: "\n -s ADDR Start address" @@ -40,7 +39,6 @@ //usage: "[-o] [-b] [-s ADDR] [-f FILE] MTD_DEVICE" //usage:#define nanddump_full_usage "\n\n" //usage: "Dump the sepcified MTD device\n" -//usage: "\nOptions:" //usage: "\n -o Omit oob data" //usage: "\n -b Omit bad block from the dump" //usage: "\n -s ADDR Start address" diff --git a/miscutils/setserial.c b/miscutils/setserial.c index 2951b987d..1574e3afd 100644 --- a/miscutils/setserial.c +++ b/miscutils/setserial.c @@ -212,8 +212,8 @@ struct serial_struct { //usage:#define setserial_trivial_usage //usage: "[-gabGvzV] DEVICE [PARAMETER [ARG]]..." //usage:#define setserial_full_usage "\n\n" -//usage: "Request or set Linux serial port information\n\n" -//usage: "Options:\n" +//usage: "Request or set Linux serial port information\n" +//usage: "\n" //usage: " -g Interpret parameters as list of devices for reporting" //usage: " -a Print all available information\n" //usage: " -b Print summary information\n" diff --git a/miscutils/strings.c b/miscutils/strings.c index 6e8b9aefc..9f5018244 100644 --- a/miscutils/strings.c +++ b/miscutils/strings.c @@ -11,7 +11,6 @@ //usage: "[-afo] [-n LEN] [FILE]..." //usage:#define strings_full_usage "\n\n" //usage: "Display printable strings in a binary file\n" -//usage: "\nOptions:" //usage: "\n -a Scan whole file (default)" //usage: "\n -f Precede strings with filenames" //usage: "\n -n LEN At least LEN characters form a string (default 4)" diff --git a/miscutils/taskset.c b/miscutils/taskset.c index 77fc8643d..4a9e3230d 100644 --- a/miscutils/taskset.c +++ b/miscutils/taskset.c @@ -10,7 +10,6 @@ //usage: "[-p] [MASK] [PID | PROG ARGS]" //usage:#define taskset_full_usage "\n\n" //usage: "Set or get CPU affinity\n" -//usage: "\nOptions:" //usage: "\n -p Operate on an existing PID" //usage: //usage:#define taskset_example_usage diff --git a/miscutils/time.c b/miscutils/time.c index dcd89f8fc..945f15f0d 100644 --- a/miscutils/time.c +++ b/miscutils/time.c @@ -13,7 +13,6 @@ //usage: "[-v] PROG ARGS" //usage:#define time_full_usage "\n\n" //usage: "Run PROG, display resource usage when it exits\n" -//usage: "\nOptions:" //usage: "\n -v Verbose" #include "libbb.h" diff --git a/miscutils/ubi_tools.c b/miscutils/ubi_tools.c index fc7f38c5d..2a426dbdc 100644 --- a/miscutils/ubi_tools.c +++ b/miscutils/ubi_tools.c @@ -81,7 +81,6 @@ //usage: "-m MTD_NUM [-d UBI_NUM] UBI_CTRL_DEV" //usage:#define ubiattach_full_usage "\n\n" //usage: "Attach MTD device to UBI\n" -//usage: "\nOptions:" //usage: "\n -m MTD_NUM MTD device number to attach" //usage: "\n -d UBI_NUM UBI device number to assign" //usage: @@ -89,14 +88,12 @@ //usage: "-d UBI_NUM UBI_CTRL_DEV" //usage:#define ubidetach_full_usage "\n\n" //usage: "Detach MTD device from UBI\n" -//usage: "\nOptions:" //usage: "\n -d UBI_NUM UBI device number" //usage: //usage:#define ubimkvol_trivial_usage //usage: "UBI_DEVICE -N NAME -s SIZE" //usage:#define ubimkvol_full_usage "\n\n" //usage: "Create UBI volume\n" -//usage: "\nOptions:" //usage: "\n -a ALIGNMENT Volume alignment (default 1)" //usage: "\n -n VOLID Volume ID, if not specified, it" //usage: "\n will be assigned automatically" @@ -108,14 +105,12 @@ //usage: "UBI_DEVICE -n VOLID" //usage:#define ubirmvol_full_usage "\n\n" //usage: "Remove UBI volume\n" -//usage: "\nOptions:" //usage: "\n -n VOLID Volume ID" //usage: //usage:#define ubirsvol_trivial_usage //usage: "UBI_DEVICE -n VOLID -s SIZE" //usage:#define ubirsvol_full_usage "\n\n" //usage: "Resize UBI volume\n" -//usage: "\nOptions:" //usage: "\n -n VOLID Volume ID to resize" //usage: "\n -s SIZE Size in bytes" //usage: @@ -123,9 +118,8 @@ //usage: "UBI_DEVICE [IMG_FILE]" //usage:#define ubiupdatevol_full_usage "\n\n" //usage: "Update UBI volume\n" -//usage: "\nOptions:" -//usage: "\n -t Truncate UBI volume" -//usage: "\n -s SIZE Bytes in input (if reading stdin)" +//usage: "\n -t Truncate UBI volume" +//usage: "\n -s SIZE Bytes in input (if reading stdin)" int ubi_tools_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c index b24dd4b82..ee28dc30d 100644 --- a/miscutils/watchdog.c +++ b/miscutils/watchdog.c @@ -13,7 +13,6 @@ //usage: "[-t N[ms]] [-T N[ms]] [-F] DEV" //usage:#define watchdog_full_usage "\n\n" //usage: "Periodically write to watchdog device DEV\n" -//usage: "\nOptions:" //usage: "\n -T N Reboot after N seconds if not reset (default 60)" //usage: "\n -t N Reset every N seconds (default 30)" //usage: "\n -F Run in foreground" diff --git a/modutils/insmod.c b/modutils/insmod.c index 94e4e2863..887d9f2a3 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c @@ -23,7 +23,6 @@ //usage:#define insmod_full_usage "\n\n" //usage: "Load the specified kernel modules into the kernel" //usage: IF_FEATURE_2_4_MODULES( "\n" -//usage: "\nOptions:" //usage: "\n -f Force module to load into the wrong kernel version" //usage: "\n -k Make module autoclean-able" //usage: "\n -v Verbose" diff --git a/modutils/modinfo.c b/modutils/modinfo.c index db134bd00..410b6fbe4 100644 --- a/modutils/modinfo.c +++ b/modutils/modinfo.c @@ -108,8 +108,7 @@ static void modinfo(const char *path, const char *version, //usage:#define modinfo_trivial_usage //usage: "[-adlp0] [-F keyword] MODULE" //usage:#define modinfo_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -a Shortcut for '-F author'" +//usage: " -a Shortcut for '-F author'" //usage: "\n -d Shortcut for '-F description'" //usage: "\n -l Shortcut for '-F license'" //usage: "\n -p Shortcut for '-F parm'" diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c index 2a69eb513..f5b283b47 100644 --- a/modutils/modprobe-small.c +++ b/modutils/modprobe-small.c @@ -711,7 +711,6 @@ The following options are useful for people managing distributions: //usage:#define insmod_full_usage "\n\n" //usage: "Load the specified kernel modules into the kernel" //usage: IF_FEATURE_2_4_MODULES( "\n" -//usage: "\nOptions:" //usage: "\n -f Force module to load into the wrong kernel version" //usage: "\n -k Make module autoclean-able" //usage: "\n -v Verbose" @@ -727,7 +726,6 @@ The following options are useful for people managing distributions: //usage: "[-wfa] [MODULE]..." //usage:#define rmmod_full_usage "\n\n" //usage: "Unload kernel modules\n" -//usage: "\nOptions:" //usage: "\n -w Wait until the module is no longer used" //usage: "\n -f Force unload" //usage: "\n -a Remove all unused modules (recursively)" @@ -738,8 +736,7 @@ The following options are useful for people managing distributions: //usage:#define modprobe_trivial_usage //usage: "[-qfwrsv] MODULE [symbol=value]..." //usage:#define modprobe_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -r Remove MODULE (stacks) or do autoclean" +//usage: " -r Remove MODULE (stacks) or do autoclean" //usage: "\n -q Quiet" //usage: "\n -v Verbose" //usage: "\n -f Force" diff --git a/modutils/modprobe.c b/modutils/modprobe.c index 7ae459826..678f4bea5 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c @@ -89,8 +89,7 @@ //usage: "[-alrqvsD" IF_FEATURE_MODPROBE_BLACKLIST("b") "]" //usage: " MODULE [symbol=value]..." //usage:#define modprobe_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -a Load multiple MODULEs" +//usage: " -a Load multiple MODULEs" //usage: "\n -l List (MODULE is a pattern)" //usage: "\n -r Remove MODULE (stacks) or do autoclean" //usage: "\n -q Quiet" diff --git a/modutils/rmmod.c b/modutils/rmmod.c index 65a4911cd..4a4a91982 100644 --- a/modutils/rmmod.c +++ b/modutils/rmmod.c @@ -15,7 +15,6 @@ //usage: "[-wfa] [MODULE]..." //usage:#define rmmod_full_usage "\n\n" //usage: "Unload kernel modules\n" -//usage: "\nOptions:" //usage: "\n -w Wait until the module is no longer used" //usage: "\n -f Force unload" //usage: "\n -a Remove all unused modules (recursively)" diff --git a/networking/arp.c b/networking/arp.c index 3f68f5cf7..696c402e0 100644 --- a/networking/arp.c +++ b/networking/arp.c @@ -21,7 +21,6 @@ //usage: "\n[-v] [-H HWTYPE] [-i IF] -Ds HOSTNAME IFACE [netmask MASK] pub" //usage:#define arp_full_usage "\n\n" //usage: "Manipulate ARP cache\n" -//usage: "\nOptions:" //usage: "\n -a Display (all) hosts" //usage: "\n -s Set new ARP entry" //usage: "\n -d Delete a specified entry" diff --git a/networking/arping.c b/networking/arping.c index 357dcaaf0..a4421edcb 100644 --- a/networking/arping.c +++ b/networking/arping.c @@ -10,7 +10,6 @@ //usage: "[-fqbDUA] [-c CNT] [-w TIMEOUT] [-I IFACE] [-s SRC_IP] DST_IP" //usage:#define arping_full_usage "\n\n" //usage: "Send ARP requests/replies\n" -//usage: "\nOptions:" //usage: "\n -f Quit on first ARP reply" //usage: "\n -q Quiet" //usage: "\n -b Keep broadcasting, don't go unicast" diff --git a/networking/dnsd.c b/networking/dnsd.c index 65eae9670..d80306d3d 100644 --- a/networking/dnsd.c +++ b/networking/dnsd.c @@ -21,7 +21,6 @@ //usage: "[-dvs] [-c CONFFILE] [-t TTL_SEC] [-p PORT] [-i ADDR]" //usage:#define dnsd_full_usage "\n\n" //usage: "Small static DNS server daemon\n" -//usage: "\nOptions:" //usage: "\n -c FILE Config file" //usage: "\n -t SEC TTL" //usage: "\n -p PORT Listen on PORT" diff --git a/networking/ether-wake.c b/networking/ether-wake.c index 7bb9aa5a7..260ba2463 100644 --- a/networking/ether-wake.c +++ b/networking/ether-wake.c @@ -70,7 +70,6 @@ //usage: "Send a magic packet to wake up sleeping machines.\n" //usage: "MAC must be a station address (00:11:22:33:44:55) or\n" //usage: "a hostname with a known 'ethers' entry.\n" -//usage: "\nOptions:" //usage: "\n -b Send wake-up packet to the broadcast address" //usage: "\n -i iface Interface to use (default eth0)" //usage: "\n -p pass Append four or six byte password PW to the packet" diff --git a/networking/ftpd.c b/networking/ftpd.c index fae634ec4..e38138c0a 100644 --- a/networking/ftpd.c +++ b/networking/ftpd.c @@ -22,7 +22,6 @@ //usage: " 21 stream tcp nowait root ftpd ftpd /files/to/serve\n" //usage: "It also can be ran from tcpsvd:\n" //usage: " tcpsvd -vE 0.0.0.0 21 ftpd /files/to/serve\n" -//usage: "\nOptions:" //usage: "\n -w Allow upload" //usage: "\n -v Log errors to stderr. -vv: verbose log" //usage: "\n -S Log errors to syslog. -SS: verbose log" diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index f63df55f4..abdf94c45 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c @@ -17,7 +17,6 @@ //usage: "[OPTIONS] HOST [LOCAL_FILE] REMOTE_FILE" //usage:#define ftpget_full_usage "\n\n" //usage: "Retrieve a remote file via FTP\n" -//usage: "\nOptions:" //usage: IF_FEATURE_FTPGETPUT_LONG_OPTIONS( //usage: "\n -c,--continue Continue previous transfer" //usage: "\n -v,--verbose Verbose" @@ -37,7 +36,6 @@ //usage: "[OPTIONS] HOST [REMOTE_FILE] LOCAL_FILE" //usage:#define ftpput_full_usage "\n\n" //usage: "Store a local file on a remote machine via FTP\n" -//usage: "\nOptions:" //usage: IF_FEATURE_FTPGETPUT_LONG_OPTIONS( //usage: "\n -v,--verbose Verbose" //usage: "\n -u,--username Username" diff --git a/networking/hostname.c b/networking/hostname.c index 49a3e89bb..5f663908c 100644 --- a/networking/hostname.c +++ b/networking/hostname.c @@ -14,7 +14,6 @@ //usage: "[OPTIONS] [HOSTNAME | -F FILE]" //usage:#define hostname_full_usage "\n\n" //usage: "Get or set hostname or DNS domain name\n" -//usage: "\nOptions:" //usage: "\n -s Short" //usage: "\n -i Addresses for the hostname" //usage: "\n -d DNS domain name" diff --git a/networking/httpd.c b/networking/httpd.c index d77342a2a..ba5eebad5 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -107,7 +107,6 @@ //usage: "or httpd -d/-e" IF_FEATURE_HTTPD_AUTH_MD5("/-m") " STRING" //usage:#define httpd_full_usage "\n\n" //usage: "Listen for incoming HTTP requests\n" -//usage: "\nOptions:" //usage: "\n -i Inetd mode" //usage: "\n -f Don't daemonize" //usage: "\n -v[v] Verbose" diff --git a/networking/ifconfig.c b/networking/ifconfig.c index 220b02126..2a56da561 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c @@ -30,7 +30,6 @@ //usage: IF_FEATURE_IFCONFIG_STATUS("[-a]") " interface [address]" //usage:#define ifconfig_full_usage "\n\n" //usage: "Configure a network interface\n" -//usage: "\nOptions:" //usage: "\n" //usage: IF_FEATURE_IPV6( //usage: " [add ADDRESS[/PREFIXLEN]]\n") diff --git a/networking/ifenslave.c b/networking/ifenslave.c index 208623e7d..ae7719f52 100644 --- a/networking/ifenslave.c +++ b/networking/ifenslave.c @@ -102,7 +102,6 @@ //usage: "[-cdf] MASTER_IFACE SLAVE_IFACE..." //usage:#define ifenslave_full_usage "\n\n" //usage: "Configure network interfaces for parallel routing\n" -//usage: "\nOptions:" //usage: "\n -c,--change-active Change active slave" //usage: "\n -d,--detach Remove slave interface from bonding device" //usage: "\n -f,--force Force, even if interface is not Ethernet" diff --git a/networking/ifplugd.c b/networking/ifplugd.c index 421611aae..57d04e67b 100644 --- a/networking/ifplugd.c +++ b/networking/ifplugd.c @@ -11,7 +11,6 @@ //usage: "[OPTIONS]" //usage:#define ifplugd_full_usage "\n\n" //usage: "Network interface plug detection daemon\n" -//usage: "\nOptions:" //usage: "\n -n Don't daemonize" //usage: "\n -s Don't log to syslog" //usage: "\n -i IFACE Interface" diff --git a/networking/ifupdown.c b/networking/ifupdown.c index b48abb7dc..382033038 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c @@ -20,8 +20,7 @@ //usage:#define ifup_trivial_usage //usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..." //usage:#define ifup_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -a De/configure all interfaces automatically" +//usage: " -a De/configure all interfaces automatically" //usage: "\n -i FILE Use FILE for interface definitions" //usage: "\n -n Print out what would happen, but don't do it" //usage: IF_FEATURE_IFUPDOWN_MAPPING( @@ -34,8 +33,7 @@ //usage:#define ifdown_trivial_usage //usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..." //usage:#define ifdown_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -a De/configure all interfaces automatically" +//usage: " -a De/configure all interfaces automatically" //usage: "\n -i FILE Use FILE for interface definitions" //usage: "\n -n Print out what would happen, but don't do it" //usage: IF_FEATURE_IFUPDOWN_MAPPING( diff --git a/networking/inetd.c b/networking/inetd.c index 58ae089d1..26348fa93 100644 --- a/networking/inetd.c +++ b/networking/inetd.c @@ -158,10 +158,9 @@ //usage: "[-fe] [-q N] [-R N] [CONFFILE]" //usage:#define inetd_full_usage "\n\n" //usage: "Listen for network connections and launch programs\n" -//usage: "\nOptions:" //usage: "\n -f Run in foreground" //usage: "\n -e Log to stderr" -//usage: "\n -q N Socket listen queue (default: 128)" +//usage: "\n -q N Socket listen queue (default: 128)" //usage: "\n -R N Pause services after N connects/min" //usage: "\n (default: 0 - disabled)" diff --git a/networking/ip.c b/networking/ip.c index 98d583325..fb2f5e2da 100644 --- a/networking/ip.c +++ b/networking/ip.c @@ -55,7 +55,7 @@ //usage:#define iproute_full_usage "\n\n" //usage: "iproute { list | flush } SELECTOR\n" //usage: "iproute get ADDRESS [from ADDRESS iif STRING]\n" -//usage: " [oif STRING] [tos TOS]\n" +//usage: " [oif STRING] [tos TOS]\n" //usage: "iproute { add | del | change | append | replace | monitor } ROUTE\n" //usage: " SELECTOR := [root PREFIX] [match PREFIX] [proto RTPROTO]\n" //usage: " ROUTE := [TYPE] PREFIX [tos TOS] [proto RTPROTO]\n" diff --git a/networking/ipcalc.c b/networking/ipcalc.c index f96c73912..3c8b8bfc9 100644 --- a/networking/ipcalc.c +++ b/networking/ipcalc.c @@ -16,7 +16,6 @@ //usage: "[OPTIONS] ADDRESS[[/]NETMASK] [NETMASK]" //usage:#define ipcalc_full_usage "\n\n" //usage: "Calculate IP network settings from a IP address\n" -//usage: "\nOptions:" //usage: IF_FEATURE_IPCALC_LONG_OPTIONS( //usage: "\n -b,--broadcast Display calculated broadcast address" //usage: "\n -n,--network Display calculated network address" diff --git a/networking/isrv_identd.c b/networking/isrv_identd.c index 199e11225..a41405c33 100644 --- a/networking/isrv_identd.c +++ b/networking/isrv_identd.c @@ -11,7 +11,6 @@ //usage: "[-fiw] [-b ADDR] [STRING]" //usage:#define fakeidentd_full_usage "\n\n" //usage: "Provide fake ident (auth) service\n" -//usage: "\nOptions:" //usage: "\n -f Run in foreground" //usage: "\n -i Inetd mode" //usage: "\n -w Inetd 'wait' mode" diff --git a/networking/nameif.c b/networking/nameif.c index 78719edac..9a16b0fbc 100644 --- a/networking/nameif.c +++ b/networking/nameif.c @@ -61,7 +61,6 @@ //usage: "\n [mac=]XX:XX:XX:XX:XX:XX" //usage: ) //usage: "\n" -//usage: "\nOptions:" //usage: "\n -c FILE Configuration file (default: /etc/mactab)" //usage: "\n -s Log to syslog" //usage: diff --git a/networking/nc.c b/networking/nc.c index 31d450dda..1b32e3aa3 100644 --- a/networking/nc.c +++ b/networking/nc.c @@ -49,7 +49,7 @@ //usage:#if !ENABLE_NC_110_COMPAT //usage: //usage:#if ENABLE_NC_SERVER || ENABLE_NC_EXTRA -//usage:#define NC_OPTIONS_STR "\n\nOptions:" +//usage:#define NC_OPTIONS_STR "\n" //usage:#else //usage:#define NC_OPTIONS_STR //usage:#endif diff --git a/networking/nc_bloaty.c b/networking/nc_bloaty.c index 29f99e76b..1daad1358 100644 --- a/networking/nc_bloaty.c +++ b/networking/nc_bloaty.c @@ -60,8 +60,7 @@ //usage: "nc [OPTIONS] -l -p PORT [HOST] [PORT] - listen" //usage: ) //usage:#define nc_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -e PROG Run PROG after connect (must be last)" +//usage: " -e PROG Run PROG after connect (must be last)" //usage: IF_NC_SERVER( //usage: "\n -l Listen mode, for inbound connects" //usage: ) diff --git a/networking/netstat.c b/networking/netstat.c index 356fb53cb..9c239579f 100644 --- a/networking/netstat.c +++ b/networking/netstat.c @@ -21,7 +21,6 @@ //usage: "[-"IF_ROUTE("r")"al] [-tuwx] [-en"IF_FEATURE_NETSTAT_WIDE("W")IF_FEATURE_NETSTAT_PRG("p")"]" //usage:#define netstat_full_usage "\n\n" //usage: "Display networking information\n" -//usage: "\nOptions:" //usage: IF_ROUTE( //usage: "\n -r Routing table" //usage: ) diff --git a/networking/ntpd.c b/networking/ntpd.c index 165673a1e..206af00c7 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c @@ -32,7 +32,6 @@ //usage: "[-dnqNw"IF_FEATURE_NTPD_SERVER("l")"] [-S PROG] [-p PEER]..." //usage:#define ntpd_full_usage "\n\n" //usage: "NTP client/server\n" -//usage: "\nOptions:" //usage: "\n -d Verbose" //usage: "\n -n Do not daemonize" //usage: "\n -q Quit after clock is set" diff --git a/networking/ping.c b/networking/ping.c index 7a9c2d1f0..d75747984 100644 --- a/networking/ping.c +++ b/networking/ping.c @@ -73,7 +73,6 @@ //usage: "[OPTIONS] HOST" //usage:# define ping_full_usage "\n\n" //usage: "Send ICMP ECHO_REQUEST packets to network hosts\n" -//usage: "\nOptions:" //usage: "\n -4,-6 Force IP or IPv6 name resolution" //usage: "\n -c CNT Send only CNT pings" //usage: "\n -s SIZE Send SIZE data bytes in packets (default:56)" @@ -90,7 +89,6 @@ //usage: "[OPTIONS] HOST" //usage:# define ping6_full_usage "\n\n" //usage: "Send ICMP ECHO_REQUEST packets to network hosts\n" -//usage: "\nOptions:" //usage: "\n -c CNT Send only CNT pings" //usage: "\n -s SIZE Send SIZE data bytes in packets (default:56)" //usage: "\n -I IFACE/IP Use interface or IP address as source" diff --git a/networking/pscan.c b/networking/pscan.c index 5595148fc..28005ad57 100644 --- a/networking/pscan.c +++ b/networking/pscan.c @@ -10,7 +10,6 @@ //usage: "[-cb] [-p MIN_PORT] [-P MAX_PORT] [-t TIMEOUT] [-T MIN_RTT] HOST" //usage:#define pscan_full_usage "\n\n" //usage: "Scan a host, print all open ports\n" -//usage: "\nOptions:" //usage: "\n -c Show closed ports too" //usage: "\n -b Show blocked ports too" //usage: "\n -p Scan from this port (default 1)" diff --git a/networking/route.c b/networking/route.c index 6699a1c32..b7b5a02e6 100644 --- a/networking/route.c +++ b/networking/route.c @@ -29,7 +29,6 @@ //usage: "[{add|del|delete}]" //usage:#define route_full_usage "\n\n" //usage: "Edit kernel routing tables\n" -//usage: "\nOptions:" //usage: "\n -n Don't resolve names" //usage: "\n -e Display other/more information" //usage: "\n -A inet" IF_FEATURE_IPV6("{6}") " Select address family" diff --git a/networking/slattach.c b/networking/slattach.c index d1221b11a..a500da6d0 100644 --- a/networking/slattach.c +++ b/networking/slattach.c @@ -17,7 +17,6 @@ //usage: "[-cehmLF] [-s SPEED] [-p PROTOCOL] DEVICE" //usage:#define slattach_full_usage "\n\n" //usage: "Attach network interface(s) to serial line(s)\n" -//usage: "\nOptions:" //usage: "\n -p PROT Set protocol (slip, cslip, slip6, clisp6 or adaptive)" //usage: "\n -s SPD Set line speed" //usage: "\n -e Exit after initializing device" diff --git a/networking/telnet.c b/networking/telnet.c index 1f0d85107..6dd0de53a 100644 --- a/networking/telnet.c +++ b/networking/telnet.c @@ -26,7 +26,6 @@ //usage: "[-a] [-l USER] HOST [PORT]" //usage:#define telnet_full_usage "\n\n" //usage: "Connect to telnet server\n" -//usage: "\nOptions:" //usage: "\n -a Automatic login with $USER variable" //usage: "\n -l USER Automatic login as USER" //usage: diff --git a/networking/telnetd.c b/networking/telnetd.c index 4404064fc..33020f1b4 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c @@ -26,7 +26,6 @@ //usage:#define telnetd_full_usage "\n\n" //usage: "Handle incoming telnet connections" //usage: IF_NOT_FEATURE_TELNETD_STANDALONE(" via inetd") "\n" -//usage: "\nOptions:" //usage: "\n -l LOGIN Exec LOGIN on connect" //usage: "\n -f ISSUE_FILE Display ISSUE_FILE instead of /etc/issue" //usage: "\n -K Close connection as soon as login exits" diff --git a/networking/tftp.c b/networking/tftp.c index 648441016..17485a527 100644 --- a/networking/tftp.c +++ b/networking/tftp.c @@ -23,7 +23,6 @@ //usage: "[OPTIONS] HOST [PORT]" //usage:#define tftp_full_usage "\n\n" //usage: "Transfer a file from/to tftp server\n" -//usage: "\nOptions:" //usage: "\n -l FILE Local FILE" //usage: "\n -r FILE Remote FILE" //usage: IF_FEATURE_TFTP_GET( @@ -46,7 +45,6 @@ //usage: " 69 dgram udp nowait root tftpd tftpd -l /files/to/serve\n" //usage: "It also can be ran from udpsvd:\n" //usage: " udpsvd -vE 0.0.0.0 69 tftpd /files/to/serve\n" -//usage: "\nOptions:" //usage: "\n -r Prohibit upload" //usage: "\n -c Allow file creation via upload" //usage: "\n -u Access files as USER" diff --git a/networking/traceroute.c b/networking/traceroute.c index 85181ab8d..c32103519 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c @@ -216,7 +216,6 @@ //usage: " [-z PAUSE_MSEC] HOST [BYTES]" //usage:#define traceroute_full_usage "\n\n" //usage: "Trace the route to HOST\n" -//usage: "\nOptions:" //usage: IF_TRACEROUTE6( //usage: "\n -4,-6 Force IP or IPv6 name resolution" //usage: ) @@ -242,7 +241,6 @@ //usage: " HOST [BYTES]" //usage:#define traceroute6_full_usage "\n\n" //usage: "Trace the route to HOST\n" -//usage: "\nOptions:" //usage: "\n -d Set SO_DEBUG options to socket" //usage: "\n -n Print numeric addresses" //usage: "\n -r Bypass routing tables, send directly to HOST" diff --git a/networking/tunctl.c b/networking/tunctl.c index 8cb733b68..3a0870eb5 100644 --- a/networking/tunctl.c +++ b/networking/tunctl.c @@ -14,7 +14,6 @@ //usage: "[-f device] ([-t name] | -d name)" IF_FEATURE_TUNCTL_UG(" [-u owner] [-g group] [-b]") //usage:#define tunctl_full_usage "\n\n" //usage: "Create or delete tun interfaces\n" -//usage: "\nOptions:" //usage: "\n -f name tun device (/dev/net/tun)" //usage: "\n -t name Create iface 'name'" //usage: "\n -d name Delete iface 'name'" diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c index ec07192c1..64cd73ec7 100644 --- a/networking/udhcp/dumpleases.c +++ b/networking/udhcp/dumpleases.c @@ -7,7 +7,6 @@ //usage: "[-r|-a] [-f LEASEFILE]" //usage:#define dumpleases_full_usage "\n\n" //usage: "Display DHCP leases granted by udhcpd\n" -//usage: "\nOptions:" //usage: IF_LONG_OPTS( //usage: "\n -f,--file=FILE Lease file" //usage: "\n -r,--remaining Show remaining time" diff --git a/networking/vconfig.c b/networking/vconfig.c index 4fa341ac3..48b45d9af 100644 --- a/networking/vconfig.c +++ b/networking/vconfig.c @@ -13,7 +13,6 @@ //usage: "COMMAND [OPTIONS]" //usage:#define vconfig_full_usage "\n\n" //usage: "Create and remove virtual ethernet devices\n" -//usage: "\nOptions:" //usage: "\n add [interface-name] [vlan_id]" //usage: "\n rem [vlan-name]" //usage: "\n set_flag [interface-name] [flag-num] [0 | 1]" diff --git a/networking/wget.c b/networking/wget.c index df6d36358..6443705fd 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -22,7 +22,6 @@ //usage: ) //usage:#define wget_full_usage "\n\n" //usage: "Retrieve files via HTTP or FTP\n" -//usage: "\nOptions:" //usage: "\n -s Spider mode - only check file existence" //usage: "\n -c Continue retrieval of aborted transfer" //usage: "\n -q Quiet" diff --git a/networking/whois.c b/networking/whois.c index 4eab9e5fe..bf330334a 100644 --- a/networking/whois.c +++ b/networking/whois.c @@ -24,7 +24,6 @@ //usage: "[-h SERVER] [-p PORT] NAME..." //usage:#define whois_full_usage "\n\n" //usage: "Query WHOIS info about NAME\n" -//usage: "\nOptions:" //usage: "\n -h,-p Server to query" #include "libbb.h" diff --git a/networking/zcip.c b/networking/zcip.c index 7250fb2fd..6b7f2144f 100644 --- a/networking/zcip.c +++ b/networking/zcip.c @@ -27,7 +27,6 @@ //usage: "[OPTIONS] IFACE SCRIPT" //usage:#define zcip_full_usage "\n\n" //usage: "Manage a ZeroConf IPv4 link-local address\n" -//usage: "\nOptions:" //usage: "\n -f Run in foreground" //usage: "\n -q Quit after obtaining address" //usage: "\n -r 169.254.x.x Request this address first" diff --git a/printutils/lpr.c b/printutils/lpr.c index f8ee9a11b..fc6bca9e8 100644 --- a/printutils/lpr.c +++ b/printutils/lpr.c @@ -17,8 +17,7 @@ /* -C CLASS exists too, not shown. * CLASS is supposed to be printed on banner page, if one is requested */ //usage:#define lpr_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -P lp service to connect to (else uses $PRINTER)" +//usage: " -P lp service to connect to (else uses $PRINTER)" //usage: "\n -m Send mail on completion" //usage: "\n -h Print banner page too" //usage: "\n -V Verbose" @@ -26,8 +25,7 @@ //usage:#define lpq_trivial_usage //usage: "[-P queue[@host[:port]]] [-U USERNAME] [-d JOBID]... [-fs]" //usage:#define lpq_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -P lp service to connect to (else uses $PRINTER)" +//usage: " -P lp service to connect to (else uses $PRINTER)" //usage: "\n -d Delete jobs" //usage: "\n -f Force any waiting job to be printed" //usage: "\n -s Short display" diff --git a/procps/fuser.c b/procps/fuser.c index 8d63a7313..05b52abb1 100644 --- a/procps/fuser.c +++ b/procps/fuser.c @@ -11,7 +11,6 @@ //usage: "[OPTIONS] FILE or PORT/PROTO" //usage:#define fuser_full_usage "\n\n" //usage: "Find processes which use FILEs or PORTs\n" -//usage: "\nOptions:" //usage: "\n -m Find processes which use same fs as FILEs" //usage: "\n -4,-6 Search only IPv4/IPv6 space" //usage: "\n -s Don't display PIDs" diff --git a/procps/iostat.c b/procps/iostat.c index 51c5fac08..978d23430 100644 --- a/procps/iostat.c +++ b/procps/iostat.c @@ -393,7 +393,6 @@ static void dev_report(cputime_t itv) //usage: "[-c] [-d] [-t] [-z] [-k|-m] [ALL|BLOCKDEV...] [INTERVAL [COUNT]]" //usage:#define iostat_full_usage "\n\n" //usage: "Report CPU and I/O statistics\n" -//usage: "\nOptions:" //usage: "\n -c Show CPU utilization" //usage: "\n -d Show device utilization" //usage: "\n -t Print current time" diff --git a/procps/kill.c b/procps/kill.c index 6776d9546..224e5ad1a 100644 --- a/procps/kill.c +++ b/procps/kill.c @@ -12,7 +12,6 @@ //usage: "[-l] [-SIG] PID..." //usage:#define kill_full_usage "\n\n" //usage: "Send a signal (default: TERM) to given PIDs\n" -//usage: "\nOptions:" //usage: "\n -l List all signal names and numbers" /* //usage: "\n -s SIG Yet another way of specifying SIG" */ //usage: @@ -30,7 +29,6 @@ //usage: "[-l] [-q] [-SIG] PROCESS_NAME..." //usage:#define killall_full_usage "\n\n" //usage: "Send a signal (default: TERM) to given processes\n" -//usage: "\nOptions:" //usage: "\n -l List all signal names and numbers" /* //usage: "\n -s SIG Yet another way of specifying SIG" */ //usage: "\n -q Don't complain if no processes were killed" @@ -42,7 +40,6 @@ //usage: "[-l] [-SIG] [-o PID]..." //usage:#define killall5_full_usage "\n\n" //usage: "Send a signal (default: TERM) to all processes outside current session\n" -//usage: "\nOptions:" //usage: "\n -l List all signal names and numbers" //usage: "\n -o PID Don't signal this PID" /* //usage: "\n -s SIG Yet another way of specifying SIG" */ diff --git a/procps/mpstat.c b/procps/mpstat.c index da8f34dab..aa5a5c73f 100644 --- a/procps/mpstat.c +++ b/procps/mpstat.c @@ -844,7 +844,6 @@ static int get_irqcpu_nr(const char *f, int max_irqs) //usage: "[-A] [-I SUM|CPU|ALL|SCPU] [-u] [-P num|ALL] [INTERVAL [COUNT]]" //usage:#define mpstat_full_usage "\n\n" //usage: "Per-processor statistics\n" -//usage: "\nOptions:" //usage: "\n -A Same as -I ALL -u -P ALL" //usage: "\n -I SUM|CPU|ALL|SCPU Report interrupt statistics" //usage: "\n -P num|ALL Processor to monitor" diff --git a/procps/pgrep.c b/procps/pgrep.c index 902a3a75e..156b4ad69 100644 --- a/procps/pgrep.c +++ b/procps/pgrep.c @@ -11,7 +11,6 @@ //usage: "[-flnovx] [-s SID|-P PPID|PATTERN]" //usage:#define pgrep_full_usage "\n\n" //usage: "Display process(es) selected by regex PATTERN\n" -//usage: "\nOptions:" //usage: "\n -l Show command name too" //usage: "\n -f Match against entire command line" //usage: "\n -n Show the newest process only" @@ -25,7 +24,6 @@ //usage: "[-l|-SIGNAL] [-fnovx] [-s SID|-P PPID|PATTERN]" //usage:#define pkill_full_usage "\n\n" //usage: "Send a signal to process(es) selected by regex PATTERN\n" -//usage: "\nOptions:" //usage: "\n -l List all signals" //usage: "\n -f Match against entire command line" //usage: "\n -n Signal the newest process only" diff --git a/procps/pidof.c b/procps/pidof.c index e102a31c6..6d7b59109 100644 --- a/procps/pidof.c +++ b/procps/pidof.c @@ -10,7 +10,7 @@ //usage:#if (ENABLE_FEATURE_PIDOF_SINGLE || ENABLE_FEATURE_PIDOF_OMIT) //usage:#define pidof_trivial_usage //usage: "[OPTIONS] [NAME]..." -//usage:#define USAGE_PIDOF "\n\nOptions:" +//usage:#define USAGE_PIDOF "\n" //usage:#else //usage:#define pidof_trivial_usage //usage: "[NAME]..." diff --git a/procps/pmap.c b/procps/pmap.c index 7f7f391b9..fd995a54d 100644 --- a/procps/pmap.c +++ b/procps/pmap.c @@ -8,22 +8,22 @@ * for details. */ -//applet:IF_PMAP(APPLET(pmap, BB_DIR_USR_BIN, BB_SUID_DROP)) -//kbuild:lib-$(CONFIG_PMAP) += pmap.o - //config:config PMAP //config: bool "pmap" //config: default y //config: help //config: Display processes' memory mappings. +//applet:IF_PMAP(APPLET(pmap, BB_DIR_USR_BIN, BB_SUID_DROP)) +//kbuild:lib-$(CONFIG_PMAP) += pmap.o + //usage:#define pmap_trivial_usage -//usage: "[-x][-q] PID" +//usage: "[-xq] PID" //usage:#define pmap_full_usage "\n\n" -//usage: "Display detailed precesses' memory usage\n" -//usage: "\nOptions:" -//usage: "\n -x show details" -//usage: "\n -q quiet" +//usage: "Display detailed process memory usage" +//usage: "\n" +//usage: "\n -x Show details" +//usage: "\n -q Quiet" #include "libbb.h" diff --git a/procps/ps.c b/procps/ps.c index 7f273d0a6..213695f16 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -15,7 +15,6 @@ //usage: "[-o COL1,COL2=HEADER]" IF_FEATURE_SHOW_THREADS(" [-T]") //usage:#define ps_full_usage "\n\n" //usage: "Show list of processes\n" -//usage: "\nOptions:" //usage: "\n -o COL1,COL2=HEADER Select columns for display" //usage: IF_FEATURE_SHOW_THREADS( //usage: "\n -T Show threads" @@ -26,7 +25,6 @@ //usage:#if !ENABLE_SELINUX && !ENABLE_FEATURE_PS_WIDE //usage:#define USAGE_PS "\nThis version of ps accepts no options" //usage:#else -//usage:#define USAGE_PS "\nOptions:" //usage:#endif //usage: //usage:#define ps_trivial_usage diff --git a/procps/pstree.c b/procps/pstree.c index 16649cfaa..8ba30795d 100644 --- a/procps/pstree.c +++ b/procps/pstree.c @@ -24,7 +24,6 @@ //usage: "[-p] [PID|USER]" //usage:#define pstree_full_usage "\n\n" //usage: "Display process tree, optionally start from USER or PID\n" -//usage: "\nOptions:" //usage: "\n -p Show pids" #include "libbb.h" diff --git a/procps/renice.c b/procps/renice.c index 067c8f75a..77f400a1d 100644 --- a/procps/renice.c +++ b/procps/renice.c @@ -23,7 +23,6 @@ //usage: "{{-n INCREMENT} | PRIORITY} [[-p | -g | -u] ID...]" //usage:#define renice_full_usage "\n\n" //usage: "Change scheduling priority for a running process\n" -//usage: "\nOptions:" //usage: "\n -n Adjust current nice value (smaller is faster)" //usage: "\n -p Process id(s) (default)" //usage: "\n -g Process group id(s)" diff --git a/procps/sysctl.c b/procps/sysctl.c index f36548f87..cb3b6a25a 100644 --- a/procps/sysctl.c +++ b/procps/sysctl.c @@ -15,7 +15,6 @@ //usage: "[OPTIONS] [VALUE]..." //usage:#define sysctl_full_usage "\n\n" //usage: "Configure kernel parameters at runtime\n" -//usage: "\nOptions:" //usage: "\n -n Don't print key names" //usage: "\n -e Don't warn about unknown keys" //usage: "\n -w Change sysctl setting" diff --git a/procps/watch.c b/procps/watch.c index e289bf8cb..36af1cca7 100644 --- a/procps/watch.c +++ b/procps/watch.c @@ -15,7 +15,6 @@ //usage: "[-n SEC] [-t] PROG ARGS" //usage:#define watch_full_usage "\n\n" //usage: "Run PROG periodically\n" -//usage: "\nOptions:" //usage: "\n -n Loop period in seconds (default 2)" //usage: "\n -t Don't print header" //usage: diff --git a/runit/chpst.c b/runit/chpst.c index 63da4797f..185706089 100644 --- a/runit/chpst.c +++ b/runit/chpst.c @@ -34,7 +34,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //usage: " [-p N] [-f BYTES] [-c BYTES] PROG ARGS" //usage:#define chpst_full_usage "\n\n" //usage: "Change the process state, run PROG\n" -//usage: "\nOptions:" //usage: "\n -u USER[:GRP] Set uid and gid" //usage: "\n -U USER[:GRP] Set $UID and $GID in environment" //usage: "\n -e DIR Set environment variables as specified by files" @@ -76,7 +75,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //usage: " PROG ARGS" //usage:#define softlimit_full_usage "\n\n" //usage: "Set soft resource limits, then run PROG\n" -//usage: "\nOptions:" //usage: "\n -a BYTES Limit total size of all segments" //usage: "\n -m BYTES Same as -d BYTES -s BYTES -l BYTES -a BYTES" //usage: "\n -d BYTES Limit data segment" diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c index 27995e570..efa0e537a 100644 --- a/sysklogd/klogd.c +++ b/sysklogd/klogd.c @@ -21,7 +21,6 @@ //usage: "[-c N] [-n]" //usage:#define klogd_full_usage "\n\n" //usage: "Kernel logger\n" -//usage: "\nOptions:" //usage: "\n -c N Print to console messages more urgent than prio N (1-8)" //usage: "\n -n Run in foreground" diff --git a/sysklogd/logger.c b/sysklogd/logger.c index 0fabd97ca..5a7027731 100644 --- a/sysklogd/logger.c +++ b/sysklogd/logger.c @@ -11,7 +11,6 @@ //usage: "[OPTIONS] [MESSAGE]" //usage:#define logger_full_usage "\n\n" //usage: "Write MESSAGE (or stdin) to syslog\n" -//usage: "\nOptions:" //usage: "\n -s Log to stderr as well as the system log" //usage: "\n -t TAG Log using the specified tag (defaults to user name)" //usage: "\n -p PRIO Priority (numeric or facility.level pair)" diff --git a/sysklogd/logread.c b/sysklogd/logread.c index ae0b2194b..993956904 100644 --- a/sysklogd/logread.c +++ b/sysklogd/logread.c @@ -13,7 +13,6 @@ //usage: "[-f]" //usage:#define logread_full_usage "\n\n" //usage: "Show messages in syslogd's circular buffer\n" -//usage: "\nOptions:" //usage: "\n -f Output data as log grows" #include "libbb.h" diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index c5c2a2e86..2f0ca6ac5 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c @@ -20,7 +20,6 @@ //usage: IF_NOT_FEATURE_SYSLOGD_CFG( //usage: "(this version of syslogd ignores /etc/syslog.conf)\n" //usage: ) -//usage: "\nOptions:" //usage: "\n -n Run in foreground" //usage: "\n -O FILE Log to FILE (default:/var/log/messages)" //usage: "\n -l N Log only messages more urgent than prio N (1-8)" diff --git a/util-linux/acpid.c b/util-linux/acpid.c index 4b7e5cacb..2f27cfd1c 100644 --- a/util-linux/acpid.c +++ b/util-linux/acpid.c @@ -11,7 +11,6 @@ //usage: "[-d] [-c CONFDIR] [-l LOGFILE] [-a ACTIONFILE] [-M MAPFILE] [-e PROC_EVENT_FILE] [-p PIDFILE]" //usage:#define acpid_full_usage "\n\n" //usage: "Listen to ACPI events and spawn specific helpers on event arrival\n" -//usage: "\nOptions:" //usage: "\n -c DIR Config directory [/etc/acpi]" //usage: "\n -d Don't daemonize, (implies -f)" //usage: "\n -e FILE /proc event file [/proc/acpi/event]" diff --git a/util-linux/blockdev.c b/util-linux/blockdev.c index 4aed02982..e25e529db 100644 --- a/util-linux/blockdev.c +++ b/util-linux/blockdev.c @@ -19,8 +19,7 @@ //usage:#define blockdev_trivial_usage //usage: "OPTION BLOCKDEV" //usage:#define blockdev_full_usage "\n\n" -//usage: "Options:" -//usage: "\n --setro Set ro" +//usage: " --setro Set ro" //usage: "\n --setrw Set rw" //usage: "\n --getro Get ro" //usage: "\n --getss Get sector size" diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c index 412bf024b..6505da54b 100644 --- a/util-linux/dmesg.c +++ b/util-linux/dmesg.c @@ -13,7 +13,6 @@ //usage: "[-c] [-n LEVEL] [-s SIZE]" //usage:#define dmesg_full_usage "\n\n" //usage: "Print or control the kernel ring buffer\n" -//usage: "\nOptions:" //usage: "\n -c Clear ring buffer after printing" //usage: "\n -n LEVEL Set console logging level" //usage: "\n -s SIZE Buffer size" diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c index bf7098e71..2f0854a30 100644 --- a/util-linux/fdformat.c +++ b/util-linux/fdformat.c @@ -9,7 +9,6 @@ //usage: "[-n] DEVICE" //usage:#define fdformat_full_usage "\n\n" //usage: "Format floppy disk\n" -//usage: "\nOptions:" //usage: "\n -n Don't verify after format" #include "libbb.h" diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index f4fd4d31d..b86b13bdc 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c @@ -18,7 +18,6 @@ //usage: "[-C CYLINDERS] [-H HEADS] [-S SECTORS] [-b SSZ] DISK" //usage:#define fdisk_full_usage "\n\n" //usage: "Change partition table\n" -//usage: "\nOptions:" //usage: "\n -u Start and End are in sectors (instead of cylinders)" //usage: "\n -l Show partition table for each DISK, then exit" //usage: IF_FEATURE_FDISK_BLKSIZE( diff --git a/util-linux/flock.c b/util-linux/flock.c index 8fecb54d4..e9be4eee9 100644 --- a/util-linux/flock.c +++ b/util-linux/flock.c @@ -8,7 +8,6 @@ //usage: "[-sxun] FD|{FILE [-c] PROG ARGS}" //usage:#define flock_full_usage "\n\n" //usage: "[Un]lock file descriptor, or lock FILE, run PROG\n" -//usage: "\nOptions:" //usage: "\n -s Shared lock" //usage: "\n -x Exclusive lock (default)" //usage: "\n -u Unlock FD" diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index b53c97248..1508ecb03 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c @@ -91,7 +91,6 @@ //usage: "[-larvsmf] BLOCKDEV" //usage:#define fsck_minix_full_usage "\n\n" //usage: "Check MINIX filesystem\n" -//usage: "\nOptions:" //usage: "\n -l List all filenames" //usage: "\n -r Perform interactive repairs" //usage: "\n -a Perform automatic repairs" diff --git a/util-linux/getopt.c b/util-linux/getopt.c index 85ff76189..c45edf8ca 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c @@ -34,9 +34,8 @@ //usage:#define getopt_trivial_usage //usage: "[OPTIONS]" //usage:#define getopt_full_usage "\n\n" -//usage: "Options:" //usage: IF_LONG_OPTS( -//usage: "\n -a,--alternative Allow long options starting with single -" +//usage: " -a,--alternative Allow long options starting with single -" //usage: "\n -l,--longoptions=longopts Long options to be recognized" //usage: "\n -n,--name=progname The name under which errors are reported" //usage: "\n -o,--options=optstring Short options to be recognized" @@ -47,7 +46,7 @@ //usage: "\n -u,--unquoted Don't quote the output" //usage: ) //usage: IF_NOT_LONG_OPTS( -//usage: "\n -a Allow long options starting with single -" +//usage: " -a Allow long options starting with single -" //usage: "\n -l longopts Long options to be recognized" //usage: "\n -n progname The name under which errors are reported" //usage: "\n -o optstring Short options to be recognized" diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c index 1f5d57d74..9a312f95c 100644 --- a/util-linux/hexdump.c +++ b/util-linux/hexdump.c @@ -13,7 +13,6 @@ //usage: "[-bcCdefnosvx" IF_FEATURE_HEXDUMP_REVERSE("R") "] [FILE]..." //usage:#define hexdump_full_usage "\n\n" //usage: "Display FILEs (or stdin) in a user specified format\n" -//usage: "\nOptions:" //usage: "\n -b One-byte octal display" //usage: "\n -c One-byte character display" //usage: "\n -C Canonical hex+ASCII, 16 bytes per line" diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c index 54e97e5bb..ee68be8c5 100644 --- a/util-linux/hwclock.c +++ b/util-linux/hwclock.c @@ -263,7 +263,6 @@ static void set_system_clock_timezone(int utc) //usage: ) //usage:#define hwclock_full_usage "\n\n" //usage: "Query and set hardware clock (RTC)\n" -//usage: "\nOptions:" //usage: "\n -r Show hardware clock time" //usage: "\n -s Set system time from hardware clock" //usage: "\n -w Set hardware clock from system time" diff --git a/util-linux/ipcrm.c b/util-linux/ipcrm.c index bdd019f6f..274050cdf 100644 --- a/util-linux/ipcrm.c +++ b/util-linux/ipcrm.c @@ -13,7 +13,6 @@ //usage:#define ipcrm_full_usage "\n\n" //usage: "Upper-case options MQS remove an object by shmkey value.\n" //usage: "Lower-case options remove an object by shmid value.\n" -//usage: "\nOptions:" //usage: "\n -mM Remove memory segment after last detach" //usage: "\n -qQ Remove message queue" //usage: "\n -sS Remove semaphore" diff --git a/util-linux/losetup.c b/util-linux/losetup.c index 7e11e292d..9b7c49f50 100644 --- a/util-linux/losetup.c +++ b/util-linux/losetup.c @@ -12,8 +12,7 @@ //usage: " losetup -d LOOPDEV - disassociate\n" //usage: " losetup [-f] - show" //usage:#define losetup_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -o OFS Start OFS bytes into FILE" +//usage: " -o OFS Start OFS bytes into FILE" //usage: "\n -f Show first free loop device" //usage: //usage:#define losetup_notes_usage diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index a8bc4b80d..59d7d23d4 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c @@ -67,7 +67,6 @@ //usage: "[-c | -l FILE] [-nXX] [-iXX] BLOCKDEV [KBYTES]" //usage:#define mkfs_minix_full_usage "\n\n" //usage: "Make a MINIX filesystem\n" -//usage: "\nOptions:" //usage: "\n -c Check device for bad blocks" //usage: "\n -n [14|30] Maximum length of filenames" //usage: "\n -i INODES Number of inodes for the filesystem" diff --git a/util-linux/mkfs_reiser.c b/util-linux/mkfs_reiser.c index 463ae1e2a..b4efb9e9f 100644 --- a/util-linux/mkfs_reiser.c +++ b/util-linux/mkfs_reiser.c @@ -11,7 +11,6 @@ //usage: "[-f] [-l LABEL] BLOCKDEV [4K-BLOCKS]" //usage:#define mkfs_reiser_full_usage "\n\n" //usage: "Make a ReiserFS V3 filesystem\n" -//usage: "\nOptions:" //usage: "\n -f Force" //usage: "\n -l LBL Volume label" diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c index e83ae7510..7d81ed06d 100644 --- a/util-linux/mkfs_vfat.c +++ b/util-linux/mkfs_vfat.c @@ -18,7 +18,6 @@ */ //usage:#define mkfs_vfat_full_usage "\n\n" //usage: "Make a FAT32 filesystem\n" -//usage: "\nOptions:" /* //usage: "\n -c Check device for bad blocks" */ //usage: "\n -v Verbose" /* //usage: "\n -I Allow to use entire disk device (e.g. /dev/hda)" */ diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index ef6932c6c..b5d2c49b6 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c @@ -10,7 +10,6 @@ //usage: "[-L LBL] BLOCKDEV [KBYTES]" //usage:#define mkswap_full_usage "\n\n" //usage: "Prepare BLOCKDEV to be used as swap partition\n" -//usage: "\nOptions:" //usage: "\n -L LBL Label" #include "libbb.h" diff --git a/util-linux/mount.c b/util-linux/mount.c index 6a154e2b2..05e532cda 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -21,7 +21,6 @@ //usage: "[OPTIONS] [-o OPTS] DEVICE NODE" //usage:#define mount_full_usage "\n\n" //usage: "Mount a filesystem. Filesystem autodetection requires /proc.\n" -//usage: "\nOptions:" //usage: "\n -a Mount all filesystems in fstab" //usage: IF_FEATURE_MOUNT_FAKE( //usage: IF_FEATURE_MTAB_SUPPORT( diff --git a/util-linux/rdate.c b/util-linux/rdate.c index 628df0da7..1f36d8f37 100644 --- a/util-linux/rdate.c +++ b/util-linux/rdate.c @@ -12,7 +12,6 @@ //usage: "[-sp] HOST" //usage:#define rdate_full_usage "\n\n" //usage: "Get and possibly set the system date and time from a remote HOST\n" -//usage: "\nOptions:" //usage: "\n -s Set the system date and time (default)" //usage: "\n -p Print the date and time" diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c index 7b7aa7c9f..4ed801137 100644 --- a/util-linux/readprofile.c +++ b/util-linux/readprofile.c @@ -35,8 +35,7 @@ //usage:#define readprofile_trivial_usage //usage: "[OPTIONS]" //usage:#define readprofile_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -m mapfile (Default: /boot/System.map)" +//usage: " -m mapfile (Default: /boot/System.map)" //usage: "\n -p profile (Default: /proc/profile)" //usage: "\n -M NUM Set the profiling multiplier to NUM" //usage: "\n -i Print only info about the sampling step" diff --git a/util-linux/script.c b/util-linux/script.c index 26f16ebf5..8fb991d15 100644 --- a/util-linux/script.c +++ b/util-linux/script.c @@ -14,8 +14,7 @@ //usage:#define script_trivial_usage //usage: "[-afq" IF_SCRIPTREPLAY("t") "] [-c PROG] [OUTFILE]" //usage:#define script_full_usage "\n\n" -//usage: "Options:" -//usage: "\n -a Append output" +//usage: " -a Append output" //usage: "\n -c PROG Run PROG, not shell" //usage: "\n -f Flush output after each write" //usage: "\n -q Quiet" diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index b7cf69833..dbefa4cf2 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c @@ -11,7 +11,6 @@ //usage: "[-a]" IF_FEATURE_SWAPON_PRI(" [-p PRI]") " [DEVICE]" //usage:#define swapon_full_usage "\n\n" //usage: "Start swapping on DEVICE\n" -//usage: "\nOptions:" //usage: "\n -a Start swapping on all swap devices" //usage: IF_FEATURE_SWAPON_PRI( //usage: "\n -p PRI Set swap device priority" @@ -21,7 +20,6 @@ //usage: "[-a] [DEVICE]" //usage:#define swapoff_full_usage "\n\n" //usage: "Stop swapping on DEVICE\n" -//usage: "\nOptions:" //usage: "\n -a Stop swapping on all swap devices" #include "libbb.h" diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c index 7794de18d..db6ae3542 100644 --- a/util-linux/switch_root.c +++ b/util-linux/switch_root.c @@ -12,7 +12,6 @@ //usage: "Free initramfs and switch to another root fs:\n" //usage: "chroot to NEW_ROOT, delete all in /, move NEW_ROOT to /,\n" //usage: "execute NEW_INIT. PID must be 1. NEW_ROOT must be a mountpoint.\n" -//usage: "\nOptions:" //usage: "\n -c DEV Reopen stdio to DEV after switch" #include diff --git a/util-linux/umount.c b/util-linux/umount.c index 1e576ca4e..5b716c688 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c @@ -12,7 +12,6 @@ //usage: "[OPTIONS] FILESYSTEM|DIRECTORY" //usage:#define umount_full_usage "\n\n" //usage: "Unmount file systems\n" -//usage: "\nOptions:" //usage: IF_FEATURE_UMOUNT_ALL( //usage: "\n -a Unmount all file systems" IF_FEATURE_MTAB_SUPPORT(" in /etc/mtab") //usage: ) -- cgit v1.2.3-55-g6feb From d7efa06b83a629d17b57ba42b36a412deb9af984 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 5 Jun 2011 15:07:31 +0200 Subject: fix breakage caused by 'remove "Options:" string from help texts' commit Signed-off-by: Denys Vlasenko --- procps/ps.c | 1 + 1 file changed, 1 insertion(+) diff --git a/procps/ps.c b/procps/ps.c index 213695f16..279f25e88 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -25,6 +25,7 @@ //usage:#if !ENABLE_SELINUX && !ENABLE_FEATURE_PS_WIDE //usage:#define USAGE_PS "\nThis version of ps accepts no options" //usage:#else +//usage:#define USAGE_PS "" //usage:#endif //usage: //usage:#define ps_trivial_usage -- cgit v1.2.3-55-g6feb From 972e04607004bc265c0b894e48996232b95dbfef Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 6 Jun 2011 04:21:39 +0200 Subject: fbset: apply modelines. Closes 3823 Signed-off-by: Denys Vlasenko --- util-linux/fbset.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util-linux/fbset.c b/util-linux/fbset.c index 3be342481..196c2aa24 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c @@ -385,7 +385,7 @@ int fbset_main(int argc, char **argv) OPT_CHANGE = (1 << 0), OPT_SHOW = (1 << 1), OPT_READMODE = (1 << 2), - OPT_ALL = (1 << 9), + OPT_ALL = (1 << 3), }; struct fb_var_screeninfo var_old, var_set; int fh, i; @@ -490,6 +490,7 @@ int fbset_main(int argc, char **argv) if (!read_mode_db(&var_old, modefile, mode)) { bb_error_msg_and_die("unknown video mode '%s'", mode); } + options |= OPT_CHANGE; #endif } -- cgit v1.2.3-55-g6feb From d488f5e8dbdcd1f5f0ebb2ee9c1f2fb4a5374290 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 7 Jun 2011 10:01:58 +0200 Subject: build system: delete generated files on "make mrproper" Signed-off-by: Denys Vlasenko --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index d9204f411..c58097d1f 100644 --- a/Makefile +++ b/Makefile @@ -963,10 +963,14 @@ CLEAN_FILES += busybox busybox_unstripped* busybox.links \ # Directories & files removed with 'make mrproper' MRPROPER_DIRS += include/config include2 MRPROPER_FILES += .config .config.old include/asm .version .old_version \ + include/NUM_APPLETS.h \ include/autoconf.h \ include/bbconfigopts.h \ + include/bbconfigopts_bz2.h \ include/usage_compressed.h \ include/applet_tables.h \ + include/applets.h \ + include/usage.h \ applets/usage \ .kernelrelease Module.symvers tags TAGS cscope* \ busybox_old -- cgit v1.2.3-55-g6feb From f533ec876716415ed0e6ba28d13dfb6263068e82 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Fri, 10 Jun 2011 05:17:59 +0200 Subject: *: simplify Ethernet header includes Signed-off-by: Dan Fandrich Signed-off-by: Denys Vlasenko --- include/platform.h | 13 ++++++++++--- networking/ether-wake.c | 4 +--- networking/ifconfig.c | 12 ++++-------- networking/ifplugd.c | 4 +++- networking/interface.c | 9 ++++----- networking/libiproute/ll_proto.c | 6 +----- networking/udhcp/dhcpc.c | 10 ++-------- networking/udhcp/packet.c | 13 +++---------- networking/udhcp/socket.c | 11 +---------- networking/zcip.c | 4 +--- 10 files changed, 30 insertions(+), 56 deletions(-) diff --git a/include/platform.h b/include/platform.h index 780568c2b..429220b0d 100644 --- a/include/platform.h +++ b/include/platform.h @@ -332,8 +332,8 @@ typedef unsigned smalluint; /* ---- Who misses what? ------------------------------------ */ -/* Assume all these functions exist by default. Platforms where it is not - * true will #undef them below. +/* Assume all these functions and header files exist by default. + * Platforms where it is not true will #undef them below. */ #define HAVE_CLEARENV 1 #define HAVE_FDATASYNC 1 @@ -349,9 +349,14 @@ typedef unsigned smalluint; #define HAVE_STRSEP 1 #define HAVE_STRSIGNAL 1 #define HAVE_VASPRINTF 1 +#define HAVE_XTABS 1 #define HAVE_MNTENT_H 1 +#define HAVE_NET_ETHERNET_H 1 #define HAVE_SYS_STATFS_H 1 -#define HAVE_XTABS 1 + +#if defined(__GLIBC__) && (__GLIBC__ < 2 || __GLIBC_MINOR__ < 1) +# undef HAVE_NET_ETHERNET_H +#endif #if defined(__dietlibc__) # undef HAVE_STRCHRNUL @@ -368,6 +373,7 @@ typedef unsigned smalluint; # undef HAVE_STRSEP # undef HAVE_STRSIGNAL # undef HAVE_VASPRINTF +# undef HAVE_NET_ETHERNET_H #endif #if defined(__FreeBSD__) @@ -395,6 +401,7 @@ typedef unsigned smalluint; # undef HAVE_DPRINTF # undef HAVE_STPCPY # undef HAVE_STRCHRNUL +# undef HAVE_NET_ETHERNET_H #endif /* diff --git a/networking/ether-wake.c b/networking/ether-wake.c index 260ba2463..6a88279f4 100644 --- a/networking/ether-wake.c +++ b/networking/ether-wake.c @@ -74,13 +74,11 @@ //usage: "\n -i iface Interface to use (default eth0)" //usage: "\n -p pass Append four or six byte password PW to the packet" +#include "libbb.h" #include -#include #include #include -#include "libbb.h" - /* Note: PF_INET, SOCK_DGRAM, IPPROTO_UDP would allow SIOCGIFHWADDR to * work as non-root, but we need SOCK_PACKET to specify the Ethernet * destination address. diff --git a/networking/ifconfig.c b/networking/ifconfig.c index 2a56da561..b6604f5d1 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c @@ -46,18 +46,14 @@ //usage: " [mem_start NN] [io_addr NN] [irq NN]\n") //usage: " [up|down] ..." +#include "libbb.h" +#include "inet_common.h" #include #include #include -#if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1 -#include -#include -#else -#include -#include +#ifdef HAVE_NET_ETHERNET_H +# include #endif -#include "libbb.h" -#include "inet_common.h" #if ENABLE_FEATURE_IFCONFIG_SLIP # include diff --git a/networking/ifplugd.c b/networking/ifplugd.c index 57d04e67b..d8358cdfd 100644 --- a/networking/ifplugd.c +++ b/networking/ifplugd.c @@ -37,7 +37,9 @@ #include #include #include -#include +#ifdef HAVE_NET_ETHERNET_H +# include +#endif #include #include #include diff --git a/networking/interface.c b/networking/interface.c index bea54c180..79c322ec0 100644 --- a/networking/interface.c +++ b/networking/interface.c @@ -30,15 +30,14 @@ * 20001008 - Bernd Eckenfels, Patch from RH for setting mtu * (default AF was wrong) */ + +#include "libbb.h" +#include "inet_common.h" #include #include -#ifndef __UCLIBC__ +#ifdef HAVE_NET_ETHERNET_H # include -#else -# include #endif -#include "libbb.h" -#include "inet_common.h" #if ENABLE_FEATURE_HWIB /* #include */ diff --git a/networking/libiproute/ll_proto.c b/networking/libiproute/ll_proto.c index 04925ecf6..7aac8364d 100644 --- a/networking/libiproute/ll_proto.c +++ b/networking/libiproute/ll_proto.c @@ -12,11 +12,7 @@ #include "rt_names.h" #include "utils.h" -#if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1 -#include -#else -#include -#endif +#include #if !ENABLE_WERROR #warning de-bloat diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 5d3291b8c..4d755e6b8 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c @@ -25,14 +25,8 @@ #include "dhcpd.h" #include "dhcpc.h" -#include -#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION) -# include -# include -#else -# include -# include -#endif +#include +#include #include /* struct client_config_t client_config is in bb_common_bufsiz1 */ diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c index 2b7528cc7..66b42c5e1 100644 --- a/networking/udhcp/packet.c +++ b/networking/udhcp/packet.c @@ -6,18 +6,11 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ -#include -#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION -# include -# include -#else -# include -# include -# include -#endif - #include "common.h" #include "dhcpd.h" +#include +#include +#include void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type) { diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c index 39f1cec54..a5220ba74 100644 --- a/networking/udhcp/socket.c +++ b/networking/udhcp/socket.c @@ -22,17 +22,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION -# include -# include -#else -# include -# include -# include -#endif - #include "common.h" +#include int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac) { diff --git a/networking/zcip.c b/networking/zcip.c index 6b7f2144f..8a35eca5d 100644 --- a/networking/zcip.c +++ b/networking/zcip.c @@ -35,14 +35,12 @@ //usage: "\nWith no -q, runs continuously monitoring for ARP conflicts," //usage: "\nexits only on I/O errors (link down etc)" +#include "libbb.h" #include -#include #include #include -#include #include -#include "libbb.h" #include /* We don't need more than 32 bits of the counter */ -- cgit v1.2.3-55-g6feb From 6295d273add9e72f7074d44eeee7a2c281bac975 Mon Sep 17 00:00:00 2001 From: Daniel Fandrich Date: Thu, 9 Jun 2011 15:44:44 -0700 Subject: Replaced __u32 etc. with standard uint32_t style types Signed-off-by: Daniel Fandrich Signed-off-by: Denys Vlasenko --- networking/nameif.c | 28 ++++++++++++++-------------- networking/tc.c | 20 ++++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/networking/nameif.c b/networking/nameif.c index 9a16b0fbc..5d7e8f9a4 100644 --- a/networking/nameif.c +++ b/networking/nameif.c @@ -121,20 +121,20 @@ struct ethtool_drvinfo { }; struct ethtool_cmd { - __u32 cmd; - __u32 supported; /* Features this interface supports */ - __u32 advertising; /* Features this interface advertises */ - __u16 speed; /* The forced speed, 10Mb, 100Mb, gigabit */ - __u8 duplex; /* Duplex, half or full */ - __u8 port; /* Which connector port */ - __u8 phy_address; - __u8 transceiver; /* Which transceiver to use */ - __u8 autoneg; /* Enable or disable autonegotiation */ - __u32 maxtxpkt; /* Tx pkts before generating tx int */ - __u32 maxrxpkt; /* Rx pkts before generating rx int */ - __u16 speed_hi; - __u16 reserved2; - __u32 reserved[3]; + uint32_t cmd; + uint32_t supported; /* Features this interface supports */ + uint32_t advertising; /* Features this interface advertises */ + uint16_t speed; /* The forced speed, 10Mb, 100Mb, gigabit */ + uint8_t duplex; /* Duplex, half or full */ + uint8_t port; /* Which connector port */ + uint8_t phy_address; + uint8_t transceiver; /* Which transceiver to use */ + uint8_t autoneg; /* Enable or disable autonegotiation */ + uint32_t maxtxpkt; /* Tx pkts before generating tx int */ + uint32_t maxrxpkt; /* Rx pkts before generating rx int */ + uint16_t speed_hi; + uint16_t reserved2; + uint32_t reserved[3]; }; #define ETHTOOL_GSET 0x00000001 /* Get settings. */ diff --git a/networking/tc.c b/networking/tc.c index e9848a86b..1574353a5 100644 --- a/networking/tc.c +++ b/networking/tc.c @@ -58,10 +58,10 @@ struct globals { int filter_ifindex; - __u32 filter_qdisc; - __u32 filter_parent; - __u32 filter_prio; - __u32 filter_proto; + uint32_t filter_qdisc; + uint32_t filter_parent; + uint32_t filter_prio; + uint32_t filter_proto; } FIX_ALIASING; #define G (*(struct globals*)&bb_common_bufsiz1) struct BUG_G_too_big { @@ -94,8 +94,8 @@ static char* print_tc_classid(uint32_t cid) } /* Get a qdisc handle. Return 0 on success, !0 otherwise. */ -static int get_qdisc_handle(__u32 *h, const char *str) { - __u32 maj; +static int get_qdisc_handle(uint32_t *h, const char *str) { + uint32_t maj; char *p; maj = TC_H_UNSPEC; @@ -113,8 +113,8 @@ static int get_qdisc_handle(__u32 *h, const char *str) { } /* Get class ID. Return 0 on success, !0 otherwise. */ -static int get_tc_classid(__u32 *h, const char *str) { - __u32 maj, min; +static int get_tc_classid(uint32_t *h, const char *str) { + uint32_t maj, min; char *p; maj = TC_H_ROOT; @@ -513,7 +513,7 @@ int tc_main(int argc UNUSED_PARAM, char **argv) if (obj == OBJ_filter) filter_parent = TC_H_ROOT; } else if (arg == ARG_parent) { - __u32 handle; + uint32_t handle; if (msg.tcm_parent) duparg(*argv, "parent"); if (get_tc_classid(&handle, *argv)) @@ -530,7 +530,7 @@ int tc_main(int argc UNUSED_PARAM, char **argv) *slash = '\0'; */ msg.tcm_handle = get_u32(*argv, "handle"); - /* if (slash) {if (get_u32(__u32 &mask, slash+1, NULL)) inv mask; addattr32(n, MAX_MSG, TCA_FW_MASK, mask); */ + /* if (slash) {if (get_u32(uint32_t &mask, slash+1, NULL)) inv mask; addattr32(n, MAX_MSG, TCA_FW_MASK, mask); */ } else if (arg == ARG_classid && obj == OBJ_class && cmd == CMD_change){ } else if (arg == ARG_pref || arg == ARG_prio) { /* filter::list */ if (filter_prio) -- cgit v1.2.3-55-g6feb From 000ae5cefe204aec44e7997440c4ea7eca5d4893 Mon Sep 17 00:00:00 2001 From: Wade Berrier Date: Wed, 8 Jun 2011 15:46:55 -0600 Subject: pkill/pgrep: support extended regular expressions Done by enabling the REG_EXTENDED and REG_NOSUB regex flags, which also increases compatibility with the procps versions. Signed-off-by: Wade Berrier Signed-off-by: Denys Vlasenko --- procps/pgrep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/procps/pgrep.c b/procps/pgrep.c index 156b4ad69..dc7ffff48 100644 --- a/procps/pgrep.c +++ b/procps/pgrep.c @@ -128,7 +128,7 @@ int pgrep_main(int argc UNUSED_PARAM, char **argv) bb_show_usage(); if (argv[0]) - xregcomp(&re_buffer, argv[0], 0); + xregcomp(&re_buffer, argv[0], REG_EXTENDED | REG_NOSUB); matched_pid = 0; cmd_last = NULL; -- cgit v1.2.3-55-g6feb From b307eabf4d47cbe224e35711838c8545f610205b Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 12 Jun 2011 17:15:16 +0200 Subject: iplink: tweak includes to work on android Signed-off-by: Denys Vlasenko --- networking/libiproute/iplink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c index 82ab979a5..bad2017fe 100644 --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include "ip_common.h" /* #include "libbb.h" is inside */ #include "rt_names.h" -- cgit v1.2.3-55-g6feb From f194cc1f3376a26158940d91d0179a3e70233e10 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 13 Jun 2011 02:13:42 +0200 Subject: ls: make -v and -X actually work as intended function old new delta strverscmp - 236 +236 sortcmp 186 254 +68 static.result_type - 60 +60 static.next_state 12 16 +4 Signed-off-by: Denys Vlasenko --- coreutils/ls.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/coreutils/ls.c b/coreutils/ls.c index dec0f85f3..ee734734e 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -874,19 +874,27 @@ static int sortcmp(const void *a, const void *b) // instead of branch forest if (sort_opts == SORT_SIZE) { dif = (d2->dn_size - d1->dn_size); - } else if (sort_opts == SORT_ATIME) { + } else + if (sort_opts == SORT_ATIME) { dif = (d2->dn_atime - d1->dn_atime); - } else if (sort_opts == SORT_CTIME) { + } else + if (sort_opts == SORT_CTIME) { dif = (d2->dn_ctime - d1->dn_ctime); - } else if (sort_opts == SORT_MTIME) { + } else + if (sort_opts == SORT_MTIME) { dif = (d2->dn_mtime - d1->dn_mtime); - } else if (sort_opts == SORT_DIR) { + } else + if (sort_opts == SORT_DIR) { dif = S_ISDIR(d2->dn_mode) - S_ISDIR(d1->dn_mode); - /* } else if (sort_opts == SORT_VERSION) { */ - /* } else if (sort_opts == SORT_EXT) { */ + } else + if (sort_opts == SORT_VERSION) { + dif = strverscmp(d1->name, d2->name); + } else + if (sort_opts == SORT_EXT) { + dif = strcmp(strchrnul(d1->name, '.'), strchrnul(d2->name, '.')); } if (dif == 0) { - /* sort by name, or tie_breaker for other sorts */ + /* sort by name, use as tie breaker for other sorts */ if (ENABLE_LOCALE_SUPPORT) dif = strcoll(d1->name, d2->name); else -- cgit v1.2.3-55-g6feb From 8ea683d5dfefa933cde9a691f14e788e1eb4b290 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 13 Jun 2011 02:24:18 +0200 Subject: ls: fix comment about -p (it's compatible now) Signed-off-by: Denys Vlasenko --- coreutils/ls.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/coreutils/ls.c b/coreutils/ls.c index ee734734e..c42f5f3d2 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -182,11 +182,10 @@ LIST_LONG = LIST_MODEBITS | LIST_NLINKS | LIST_ID_NAME | LIST_SIZE | \ /* -Q GNU option, busybox always supports */ /* -k SELinux option, busybox always supports (ignores if !SELinux) */ /* Std has -k which means "show sizes in kbytes" */ -/* -FLHRctur Std options, busybox optionally supports */ -/* -p Std option, busybox optionally supports */ -/* Not fully compatible - we show not only '/' but other chars too */ +/* -LHRctur Std options, busybox optionally supports */ +/* -Fp Std options, busybox optionally supports */ /* -SXvhTw GNU options, busybox optionally supports */ -/* -T TABWIDTH is ignored (we don't use tabs on output) */ +/* -T WIDTH Ignored (we don't use tabs on output) */ /* -KZ SELinux mandated options, busybox optionally supports */ /* (coreutils 8.4 has no -K, remove it?) */ /* -e I think we made this one up (looks similar to GNU --full-time) */ -- cgit v1.2.3-55-g6feb From 901a53baecd5b8a580f63eb23d481f553de72634 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 15 Jun 2011 09:38:43 +0200 Subject: inetd: check if RPC is available It would be better to have FEATURE_HAVE_RPC be user-selectable and depend mount.nfs and inetd-rpc on it instead of the current, backward, way. Signed-off-by: Bernhard Reutner-Fischer --- networking/inetd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/networking/inetd.c b/networking/inetd.c index 26348fa93..873fd9528 100644 --- a/networking/inetd.c +++ b/networking/inetd.c @@ -170,8 +170,11 @@ #include "libbb.h" #if ENABLE_FEATURE_INETD_RPC -#include -#include +# if defined(__UCLIBC__) && ! defined(__UCLIBC_HAS_RPC__) +# error "You need to build uClibc with UCLIBC_HAS_RPC for NFS support" +# endif +# include +# include #endif #if !BB_MMU -- cgit v1.2.3-55-g6feb From a1a448347e71c9899ad1500cbd8739fd82e1bb91 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 17 Jun 2011 03:37:43 +0200 Subject: libbb: split bb_get_chunk_from_file and bb_get_chunk_with_continuation This also moves bb_get_chunk_with_continuation into its sole user, parse_config.c. This allows to optimize both functions separately, they need to be optimized for speed. (this need was highlighted by slow modprobe caused in part by slow bb_get_chunk_with_continuation in config parser). function old new delta bb_get_chunk_from_file 7 130 +123 config_read 457 558 +101 bb_get_chunk_with_continuation 194 - -194 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 2/0 up/down: 224/-194) Total: 30 bytes Signed-off-by: Denys Vlasenko --- include/libbb.h | 6 +++++- libbb/get_line_from_file.c | 42 +++++++------------------------------ libbb/parse_config.c | 52 ++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 56 insertions(+), 44 deletions(-) diff --git a/include/libbb.h b/include/libbb.h index 2d46061da..5d2b4c8c1 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -730,8 +730,12 @@ extern void xclose(int fd) FAST_FUNC; /* Reads and prints to stdout till eof, then closes FILE. Exits on error: */ extern void xprint_and_close_file(FILE *file) FAST_FUNC; +/* Reads a line from a text file, up to a newline or NUL byte, inclusive. + * Returns malloc'ed char*. If end is NULL '\n' isn't considered + * end of line. If end isn't NULL, length of the chunk is stored in it. + * Returns NULL if EOF/error. + */ extern char *bb_get_chunk_from_file(FILE *file, int *end) FAST_FUNC; -extern char *bb_get_chunk_with_continuation(FILE *file, int *end, int *lineno) FAST_FUNC; /* Reads up to (and including) TERMINATING_STRING: */ extern char *xmalloc_fgets_str(FILE *file, const char *terminating_string) FAST_FUNC RETURNS_MALLOC; /* Same, with limited max size, and returns the length (excluding NUL): */ diff --git a/libbb/get_line_from_file.c b/libbb/get_line_from_file.c index 9be10687b..a98dd35eb 100644 --- a/libbb/get_line_from_file.c +++ b/libbb/get_line_from_file.c @@ -11,45 +11,24 @@ #include "libbb.h" -/* This function reads an entire line from a text file, up to a newline - * or NUL byte, inclusive. It returns a malloc'ed char * which - * must be free'ed by the caller. If end is NULL '\n' isn't considered - * end of line. If end isn't NULL, length of the chunk is stored in it. - * If lineno is not NULL, *lineno is incremented for each line, - * and also trailing '\' is recognized as line continuation. - * - * Returns NULL if EOF/error. */ -char* FAST_FUNC bb_get_chunk_with_continuation(FILE *file, int *end, int *lineno) +char* FAST_FUNC bb_get_chunk_from_file(FILE *file, int *end) { int ch; - int idx = 0; + unsigned idx = 0; char *linebuf = NULL; - int linebufsz = 0; while ((ch = getc(file)) != EOF) { /* grow the line buffer as necessary */ - if (idx >= linebufsz) { - linebufsz += 256; - linebuf = xrealloc(linebuf, linebufsz); - } + if (!(idx & 0xff)) + linebuf = xrealloc(linebuf, idx + 0x100); linebuf[idx++] = (char) ch; - if (!ch) + if (ch == '\0') + break; + if (end && ch == '\n') break; - if (end && ch == '\n') { - if (lineno == NULL) - break; - (*lineno)++; - if (idx < 2 || linebuf[idx-2] != '\\') - break; - idx -= 2; - } } - if (end) { + if (end) *end = idx; - /* handle corner case when the file is not ended with '\n' */ - if (ch == EOF && lineno != NULL) - (*lineno)++; - } if (linebuf) { // huh, does fgets discard prior data on error like this? // I don't think so.... @@ -63,11 +42,6 @@ char* FAST_FUNC bb_get_chunk_with_continuation(FILE *file, int *end, int *lineno return linebuf; } -char* FAST_FUNC bb_get_chunk_from_file(FILE *file, int *end) -{ - return bb_get_chunk_with_continuation(file, end, NULL); -} - /* Get line, including trailing \n if any */ char* FAST_FUNC xmalloc_fgets(FILE *file) { diff --git a/libbb/parse_config.c b/libbb/parse_config.c index 4b0236028..769ae5103 100644 --- a/libbb/parse_config.c +++ b/libbb/parse_config.c @@ -104,6 +104,44 @@ void FAST_FUNC config_close(parser_t *parser) } } +/* This function reads an entire line from a text file, up to a newline + * or NUL byte, exclusive. It returns a malloc'ed char*. + * *lineno is incremented for each line. + * Trailing '\' is recognized as line continuation. + * Returns NULL if EOF/error. + */ +static char* get_line_with_continuation(FILE *file, int *lineno) +{ + int ch; + unsigned idx = 0; + char *linebuf = NULL; + + while ((ch = getc(file)) != EOF) { + /* grow the line buffer as necessary */ + if (!(idx & 0xff)) + linebuf = xrealloc(linebuf, idx + 0x101); + if (ch == '\n') + ch = '\0'; + linebuf[idx] = (char) ch; + if (ch == '\0') { + (*lineno)++; + if (idx == 0 || linebuf[idx-1] != '\\') + break; + idx--; /* go back to '/' */ + continue; + } + idx++; + } + if (ch == EOF) { + /* handle corner case when the file is not ended with '\n' */ + (*lineno)++; + if (linebuf) + linebuf[idx] = '\0'; + } + return linebuf; +} + + /* 0. If parser is NULL return 0. 1. Read a line from config file. If nothing to read then return 0. @@ -132,28 +170,24 @@ int FAST_FUNC config_read(parser_t *parser, char **tokens, unsigned flags, const { char *line; int ntokens, mintokens; - int t, len; + int t; + + if (!parser) + return 0; ntokens = (uint8_t)flags; mintokens = (uint8_t)(flags >> 8); - if (parser == NULL) - return 0; - again: memset(tokens, 0, sizeof(tokens[0]) * ntokens); config_free_data(parser); /* Read one line (handling continuations with backslash) */ - line = bb_get_chunk_with_continuation(parser->fp, &len, &parser->lineno); + line = get_line_with_continuation(parser->fp, &parser->lineno); if (line == NULL) return 0; parser->line = line; - /* Strip trailing line-feed if any */ - if (len && line[len-1] == '\n') - line[len-1] = '\0'; - /* Skip token in the start of line? */ if (flags & PARSE_TRIM) line += strspn(line, delims + 1); -- cgit v1.2.3-55-g6feb From 3a649363aa34742b641125f51713493de4d3c7ef Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 18 Jun 2011 09:23:09 +0200 Subject: parse_config: make test applet easier to enable; fix its code Signed-off-by: Denys Vlasenko --- Config.in | 3 --- libbb/Kbuild.src | 1 - libbb/parse_config.c | 60 +++++++++++++++++++++++++--------------------------- 3 files changed, 29 insertions(+), 35 deletions(-) diff --git a/Config.in b/Config.in index 8f4d64274..1e7181261 100644 --- a/Config.in +++ b/Config.in @@ -681,9 +681,6 @@ config EFENCE endchoice -### config PARSE -### bool "Uniform config file parser debugging applet: parse" - endmenu menu 'Installation Options ("make install" behavior)' diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src index 62bee9394..a6e80e692 100644 --- a/libbb/Kbuild.src +++ b/libbb/Kbuild.src @@ -64,7 +64,6 @@ lib-y += hash_md5_sha.o lib-y += messages.o lib-y += mode_string.o lib-y += parse_mode.o -lib-y += parse_config.o lib-y += perror_msg.o lib-y += perror_nomsg.o lib-y += perror_nomsg_and_die.o diff --git a/libbb/parse_config.c b/libbb/parse_config.c index 769ae5103..c0c34f312 100644 --- a/libbb/parse_config.c +++ b/libbb/parse_config.c @@ -8,11 +8,27 @@ * Also for use in uClibc (http://uclibc.org/) licensed under LGPLv2.1 or later. */ -/* +/* Uncomment to enable test applet */ +////config:config PARSE +////config: bool "Uniform config file parser debugging applet: parse" +////config: default n +////config: help +////config: Typical usage of parse API: +////config: char *t[3]; +////config: parser_t *p = config_open(filename); +////config: while (config_read(p, t, 3, 0, delimiters, flags)) { // 1..3 tokens +////config: bb_error_msg("TOKENS: '%s''%s''%s'", t[0], t[1], t[2]); +////config: } +////config: config_close(p); + +////applet:IF_PARSE(APPLET(parse, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-y += parse_config.o + //usage:#define parse_trivial_usage -//usage: "[-n MAXTOKENS] [-m MINTOKENS] [-d DELIMS] [-f FLAGS] FILE..." -//usage:#define parse_full_usage "" -*/ +//usage: "[-x] [-n MAXTOKENS] [-m MINTOKENS] [-d DELIMS] [-f FLAGS] FILE..." +//usage:#define parse_full_usage "\n\n" +//usage: " -x Suppress output (for benchmarking)" #include "libbb.h" @@ -21,52 +37,34 @@ int parse_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int parse_main(int argc UNUSED_PARAM, char **argv) { const char *delims = "# \t"; + char **t; unsigned flags = PARSE_NORMAL; int mintokens = 0, ntokens = 128; + unsigned noout; opt_complementary = "-1:n+:m+:f+"; - getopt32(argv, "n:m:d:f:", &ntokens, &mintokens, &delims, &flags); + noout = 1 & getopt32(argv, "xn:m:d:f:", &ntokens, &mintokens, &delims, &flags); //argc -= optind; argv += optind; + + t = xmalloc(sizeof(t[0]) * ntokens); while (*argv) { + int n; parser_t *p = config_open(*argv); - if (p) { - int n; - char **t = xmalloc(sizeof(char *) * ntokens); - while ((n = config_read(p, t, ntokens, mintokens, delims, flags)) != 0) { + while ((n = config_read(p, t, ntokens, mintokens, delims, flags)) != 0) { + if (!noout) { for (int i = 0; i < n; ++i) printf("[%s]", t[i]); puts(""); } - config_close(p); } + config_close(p); argv++; } return EXIT_SUCCESS; } #endif -/* - -Typical usage: - ------ CUT ----- - char *t[3]; // tokens placeholder - parser_t *p = config_open(filename); - if (p) { - // parse line-by-line - while (config_read(p, t, 3, 0, delimiters, flags)) { // 1..3 tokens - // use tokens - bb_error_msg("TOKENS: [%s][%s][%s]", t[0], t[1], t[2]); - } - ... - // free parser - config_close(p); - } ------ CUT ----- - -*/ - parser_t* FAST_FUNC config_open2(const char *filename, FILE* FAST_FUNC (*fopen_func)(const char *path)) { FILE* fp; -- cgit v1.2.3-55-g6feb From da947607625bc5510ec56b27e04445db300f4418 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 18 Jun 2011 09:29:21 +0200 Subject: fix false positive in parse test Signed-off-by: Denys Vlasenko --- testsuite/parse.tests | 1 + 1 file changed, 1 insertion(+) diff --git a/testsuite/parse.tests b/testsuite/parse.tests index 9899b73bf..904e1a17a 100755 --- a/testsuite/parse.tests +++ b/testsuite/parse.tests @@ -96,6 +96,7 @@ cat >$FILE.res < Date: Sat, 18 Jun 2011 15:49:47 +0200 Subject: procps: remove PSSCAN_STAT define, users were using it incorrectly Also contains small cleanups ps. Signed-off-by: Denys Vlasenko --- include/libbb.h | 7 ------- libbb/procps.c | 9 ++++++++- procps/ps.c | 23 +++++++++++------------ 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/include/libbb.h b/include/libbb.h index 5d2b4c8c1..2cac7e60c 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1545,13 +1545,6 @@ enum { PSSCAN_NICE = (1 << 20) * ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS, PSSCAN_RUIDGID = (1 << 21) * ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS, PSSCAN_TASKS = (1 << 22) * ENABLE_FEATURE_SHOW_THREADS, - /* These are all retrieved from proc/NN/stat in one go: */ - PSSCAN_STAT = PSSCAN_PPID | PSSCAN_PGID | PSSCAN_SID - /**/ | PSSCAN_COMM | PSSCAN_STATE - /**/ | PSSCAN_VSZ | PSSCAN_RSS - /**/ | PSSCAN_STIME | PSSCAN_UTIME | PSSCAN_START_TIME - /**/ | PSSCAN_TTY | PSSCAN_NICE - /**/ | PSSCAN_CPU }; //procps_status_t* alloc_procps_scan(void) FAST_FUNC; void free_procps_scan(procps_status_t* sp) FAST_FUNC; diff --git a/libbb/procps.c b/libbb/procps.c index 5833a1f0d..9207e9254 100644 --- a/libbb/procps.c +++ b/libbb/procps.c @@ -357,7 +357,14 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) sp->gid = sb.st_gid; } - if (flags & PSSCAN_STAT) { + /* These are all retrieved from proc/NN/stat in one go: */ + if (flags & (PSSCAN_PPID | PSSCAN_PGID | PSSCAN_SID + | PSSCAN_COMM | PSSCAN_STATE + | PSSCAN_VSZ | PSSCAN_RSS + | PSSCAN_STIME | PSSCAN_UTIME | PSSCAN_START_TIME + | PSSCAN_TTY | PSSCAN_NICE + | PSSCAN_CPU) + ) { char *cp, *comm1; int tty; #if !ENABLE_FEATURE_FAST_TOP diff --git a/procps/ps.c b/procps/ps.c index 279f25e88..7537118f6 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -87,13 +87,6 @@ enum { MAX_WIDTH = 2*1024 }; * TIME The cumulative execution time for the process * CMD The command name; the full command line is shown with -f */ -#if ENABLE_SELINUX -# define SELINUX_O_PREFIX "label," -# define DEFAULT_O_STR (SELINUX_O_PREFIX "pid,user" IF_FEATURE_PS_TIME(",time") ",args") -#else -# define DEFAULT_O_STR ("pid,user" IF_FEATURE_PS_TIME(",time") ",args") -#endif - typedef struct { uint16_t width; char name6[6]; @@ -113,7 +106,6 @@ struct globals { unsigned kernel_HZ; unsigned long long seconds_since_boot; #endif - char default_o[sizeof(DEFAULT_O_STR)]; } FIX_ALIASING; #define G (*(struct globals*)&bb_common_bufsiz1) #define out (G.out ) @@ -124,7 +116,6 @@ struct globals { #define terminal_width (G.terminal_width ) #define kernel_HZ (G.kernel_HZ ) #define seconds_since_boot (G.seconds_since_boot) -#define default_o (G.default_o ) #define INIT_G() do { } while (0) #if ENABLE_FEATURE_PS_TIME @@ -250,7 +241,7 @@ static void func_comm(char *buf, int size, const procps_status_t *ps) safe_strncpy(buf, ps->comm, size+1); } -static void func_stat(char *buf, int size, const procps_status_t *ps) +static void func_state(char *buf, int size, const procps_status_t *ps) { safe_strncpy(buf, ps->state, size+1); } @@ -394,7 +385,7 @@ static const ps_out_t out_spec[] = { { 6 , "tty" ,"TT" ,func_tty ,PSSCAN_TTY }, { 4 , "vsz" ,"VSZ" ,func_vsz ,PSSCAN_VSZ }, /* Not mandated, but useful: */ - { 4 , "stat" ,"STAT" ,func_stat ,PSSCAN_STAT }, + { 4 , "stat" ,"STAT" ,func_state ,PSSCAN_STATE }, { 4 , "rss" ,"RSS" ,func_rss ,PSSCAN_RSS }, #if ENABLE_SELINUX { 35 , "label" ,"LABEL" ,func_label ,PSSCAN_CONTEXT }, @@ -531,11 +522,19 @@ static void format_process(const procps_status_t *ps) printf("%.*s\n", terminal_width, buffer); } +#if ENABLE_SELINUX +# define SELINUX_O_PREFIX "label," +# define DEFAULT_O_STR (SELINUX_O_PREFIX "pid,user" IF_FEATURE_PS_TIME(",time") ",args") +#else +# define DEFAULT_O_STR ("pid,user" IF_FEATURE_PS_TIME(",time") ",args") +#endif + int ps_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int ps_main(int argc UNUSED_PARAM, char **argv) { procps_status_t *p; llist_t* opt_o = NULL; + char default_o[sizeof(DEFAULT_O_STR)]; int opt; enum { OPT_Z = (1 << 0), @@ -573,7 +572,7 @@ int ps_main(int argc UNUSED_PARAM, char **argv) parse_o(llist_pop(&opt_o)); } while (opt_o); } else { - /* Below: parse_o() needs char*, NOT const char*... */ + /* Below: parse_o() needs char*, NOT const char*, can't give it default_o */ #if ENABLE_SELINUX if (!(opt & OPT_Z) || !is_selinux_enabled()) { /* no -Z or no SELinux: do not show LABEL */ -- cgit v1.2.3-55-g6feb From 5331e382f72a606c026424e95fcc7dc50a25608c Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 18 Jun 2011 15:51:16 +0200 Subject: libbb/read_cmdline: prepend {comm} if different from argv0. Closes 3835. function old new delta read_cmdline 114 233 +119 Signed-off-by: Denys Vlasenko --- libbb/procps.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/libbb/procps.c b/libbb/procps.c index 9207e9254..1dea61518 100644 --- a/libbb/procps.c +++ b/libbb/procps.c @@ -566,18 +566,47 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) void FAST_FUNC read_cmdline(char *buf, int col, unsigned pid, const char *comm) { int sz; - char filename[sizeof("/proc//cmdline") + sizeof(int)*3]; + char filename[sizeof("/proc/%u/cmdline") + sizeof(int)*3]; sprintf(filename, "/proc/%u/cmdline", pid); sz = open_read_close(filename, buf, col - 1); if (sz > 0) { + const char *base; + int comm_len; + buf[sz] = '\0'; while (--sz >= 0 && buf[sz] == '\0') continue; - do { + base = bb_basename(buf); /* before we replace argv0's NUL with space */ + while (sz >= 0) { if ((unsigned char)(buf[sz]) < ' ') buf[sz] = ' '; - } while (--sz >= 0); + sz--; + } + + /* If comm differs from argv0, prepend "{comm} ". + * It allows to see thread names set by prctl(PR_SET_NAME). + */ + if (base[0] == '-') /* "-sh" (login shell)? */ + base++; + comm_len = strlen(comm); + /* Why compare up to comm_len, not COMM_LEN-1? + * Well, some processes rewrite argv, and use _spaces_ there + * while rewriting. (KDE is observed to do it). + * I prefer to still treat argv0 "process foo bar" + * as 'equal' to comm "process". + */ + if (strncmp(base, comm, comm_len) != 0) { + comm_len += 3; + if (col > comm_len) + memmove(buf + comm_len, buf, col - comm_len); + snprintf(buf, col, "{%s}", comm); + if (col <= comm_len) + return; + buf[comm_len - 1] = ' '; + buf[col - 1] = '\0'; + } + } else { snprintf(buf, col, "[%s]", comm); } -- cgit v1.2.3-55-g6feb From 416e978ce80997088d3f0f2dd532554863d95ab5 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 19 Jun 2011 01:40:31 +0200 Subject: diff: disable debug code; remove unsupported --dry-run from help text function old new delta packed_usage 28623 28602 -21 do_line 121 91 -30 patch_main 2086 1923 -163 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-214) Total: -214 bytes Signed-off-by: Denys Vlasenko --- editors/patch.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/editors/patch.c b/editors/patch.c index 6d3f319b0..ec5b8e7ad 100644 --- a/editors/patch.c +++ b/editors/patch.c @@ -15,22 +15,23 @@ * -D define wrap #ifdef and #ifndef around changes * -o outfile output here instead of in place * -r rejectfile write rejected hunks to this file + * --dry-run (regression!) * * -f force (no questions asked) * -F fuzz (number, default 2) * [file] which file to patch */ -//applet:IF_PATCH(APPLET(patch, BB_DIR_USR_BIN, BB_SUID_DROP)) - -//kbuild:lib-$(CONFIG_PATCH) += patch.o - //config:config PATCH //config: bool "patch" //config: default y //config: help //config: Apply a unified diff formatted patch. +//applet:IF_PATCH(APPLET(patch, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_PATCH) += patch.o + //usage:#define patch_trivial_usage //usage: "[OPTIONS] [ORIGFILE [PATCHFILE]]" //usage:#define patch_full_usage "\n\n" @@ -39,7 +40,7 @@ //usage: "\n -i,--input DIFF Read DIFF instead of stdin" //usage: "\n -R,--reverse Reverse patch" //usage: "\n -N,--forward Ignore already applied patches" -//usage: "\n --dry-run Don't actually change files" +/*usage: "\n --dry-run Don't actually change files" - TODO */ //usage: "\n -E,--remove-empty-files Remove output files if they become empty" //usage: ) //usage: IF_NOT_LONG_OPTS( @@ -49,6 +50,8 @@ //usage: "\n -N Ignore already applied patches" //usage: "\n -E Remove output files if they become empty" //usage: ) +/* -u "interpret as unified diff" is supported but not documented: this info is not useful for --help */ +/* -x "debug" is supported but does nothing */ //usage: //usage:#define patch_example_usage //usage: "$ patch -p1 < example.diff\n" @@ -130,8 +133,8 @@ struct globals { #define FLAG_INPUT (1 << 3) #define FLAG_IGNORE (1 << 4) #define FLAG_RMEMPTY (1 << 5) -//non-standard: -#define FLAG_DEBUG (1 << 6) +/* Enable this bit and use -x for debug output: */ +#define FLAG_DEBUG (0 << 6) // Dispose of a line of input, either by writing it out or discarding it. -- cgit v1.2.3-55-g6feb From e12e0acb92329f95a77121f489b491d84b6a2c33 Mon Sep 17 00:00:00 2001 From: Timo Teras Date: Mon, 20 Jun 2011 09:38:13 +0200 Subject: modprobe: use hash table. speeds up significantly if modprobe.dep is large function old new delta helper_get_module 106 157 +51 config_file_action 413 431 +18 modprobe_main 690 706 +16 do_modprobe 580 588 +8 add_probe 81 83 +2 load_modules_dep 192 190 -2 get_or_add_modentry 10 - -10 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 5/1 up/down: 95/-12) Total: 83 bytes Signed-off-by: Timo Teras Signed-off-by: Denys Vlasenko --- modutils/modprobe.c | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/modutils/modprobe.c b/modutils/modprobe.c index 678f4bea5..c1a1828d7 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c @@ -157,20 +157,21 @@ struct module_entry { /* I'll call it ME. */ llist_t *deps; /* strings. modules we depend on */ }; +#define DB_HASH_SIZE 256 + struct globals { - llist_t *db; /* MEs of all modules ever seen (caching for speed) */ llist_t *probes; /* MEs of module(s) requested on cmdline */ char *cmdline_mopts; /* module options from cmdline */ int num_unresolved_deps; /* bool. "Did we have 'symbol:FOO' requested on cmdline?" */ smallint need_symbols; struct utsname uts; + llist_t *db[DB_HASH_SIZE]; /* MEs of all modules ever seen (caching for speed) */ } FIX_ALIASING; -#define G (*(struct globals*)&bb_common_bufsiz1) -#define INIT_G() do { } while (0) -struct BUG_G_too_big { - char BUG_G_too_big[sizeof(G) <= COMMON_BUFSIZE ? 1 : -1]; -}; +#define G (*ptr_to_globals) +#define INIT_G() do { \ + SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ +} while (0) static int read_config(const char *path); @@ -190,14 +191,26 @@ static char *gather_options_str(char *opts, const char *append) return opts; } +/* These three functions called many times, optimizing for speed. + * Users reported minute-long delays when they runn iptables repeatedly + * (iptables use modprobe to install needed kernel modules). + */ static struct module_entry *helper_get_module(const char *module, int create) { char modname[MODULE_NAME_LEN]; struct module_entry *e; llist_t *l; + unsigned i; + unsigned hash; filename2modname(module, modname); - for (l = G.db; l != NULL; l = l->link) { + + hash = 0; + for (i = 0; modname[i]; i++) + hash = ((hash << 5) + hash) + modname[i]; + hash %= DB_HASH_SIZE; + + for (l = G.db[hash]; l; l = l->link) { e = (struct module_entry *) l->data; if (strcmp(e->modname, modname) == 0) return e; @@ -207,15 +220,15 @@ static struct module_entry *helper_get_module(const char *module, int create) e = xzalloc(sizeof(*e)); e->modname = xstrdup(modname); - llist_add_to(&G.db, e); + llist_add_to(&G.db[hash], e); return e; } -static struct module_entry *get_or_add_modentry(const char *module) +static ALWAYS_INLINE struct module_entry *get_or_add_modentry(const char *module) { return helper_get_module(module, 1); } -static struct module_entry *get_modentry(const char *module) +static ALWAYS_INLINE struct module_entry *get_modentry(const char *module) { return helper_get_module(module, 0); } @@ -275,7 +288,7 @@ static int FAST_FUNC config_file_action(const char *filename, continue; filename2modname(tokens[1], wildcard); - for (l = G.probes; l != NULL; l = l->link) { + for (l = G.probes; l; l = l->link) { m = (struct module_entry *) l->data; if (fnmatch(wildcard, m->modname, 0) != 0) continue; @@ -377,7 +390,6 @@ static char *parse_and_add_kcmdline_module_options(char *options, const char *mo static int do_modprobe(struct module_entry *m) { int rc, first; - llist_t *l; if (!(m->flags & MODULE_FLAG_FOUND_IN_MODDEP)) { if (!(option_mask32 & INSMOD_OPT_SILENT)) @@ -390,8 +402,11 @@ static int do_modprobe(struct module_entry *m) if (!(option_mask32 & OPT_REMOVE)) m->deps = llist_rev(m->deps); - for (l = m->deps; l != NULL; l = l->link) - DBG("dep: %s", l->data); + if (0) { + llist_t *l; + for (l = m->deps; l; l = l->link) + DBG("dep: %s", l->data); + } first = 1; rc = 0; -- cgit v1.2.3-55-g6feb From adcabf3235a13e77a32ff2a7b7cf80be8ee3dfe3 Mon Sep 17 00:00:00 2001 From: Timo Teras Date: Mon, 20 Jun 2011 09:49:56 +0200 Subject: parse_config: use getline. BIG speedup with glibc (~40%). function old new delta config_read 559 604 +45 getline - 23 +23 config_close 29 49 +20 find_pair 169 187 +18 showmode 330 338 +8 hash_find 233 234 +1 builtin_umask 133 132 -1 lzo1x_optimize 1434 1429 -5 test_main 253 247 -6 buffer_fill_and_print 196 179 -17 create_J 1849 1826 -23 config_free_data 37 - -37 ------------------------------------------------------------------------------ (add/remove: 3/1 grow/shrink: 5/5 up/down: 138/-89) Total: 26 bytes Signed-off-by: Timo Teras Signed-off-by: Denys Vlasenko --- include/libbb.h | 3 +- libbb/parse_config.c | 92 ++++++++++++++++++++++++---------------------------- 2 files changed, 45 insertions(+), 50 deletions(-) diff --git a/include/libbb.h b/include/libbb.h index 2cac7e60c..953bec334 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1184,8 +1184,9 @@ enum { }; typedef struct parser_t { FILE *fp; - char *line; char *data; + char *line, *nline; + size_t line_alloc, nline_alloc; int lineno; } parser_t; parser_t* config_open(const char *filename) FAST_FUNC; diff --git a/libbb/parse_config.c b/libbb/parse_config.c index c0c34f312..cf5ba4deb 100644 --- a/libbb/parse_config.c +++ b/libbb/parse_config.c @@ -83,60 +83,55 @@ parser_t* FAST_FUNC config_open(const char *filename) return config_open2(filename, fopen_or_warn_stdin); } -static void config_free_data(parser_t *parser) -{ - free(parser->line); - parser->line = NULL; - if (PARSE_KEEP_COPY) { /* compile-time constant */ - free(parser->data); - parser->data = NULL; - } -} - void FAST_FUNC config_close(parser_t *parser) { if (parser) { - config_free_data(parser); + if (PARSE_KEEP_COPY) /* compile-time constant */ + free(parser->data); fclose(parser->fp); + free(parser->line); + free(parser->nline); free(parser); } } -/* This function reads an entire line from a text file, up to a newline - * or NUL byte, exclusive. It returns a malloc'ed char*. - * *lineno is incremented for each line. +/* This function reads an entire line from a text file, + * up to a newline, exclusive. * Trailing '\' is recognized as line continuation. - * Returns NULL if EOF/error. + * Returns -1 if EOF/error. */ -static char* get_line_with_continuation(FILE *file, int *lineno) +static int get_line_with_continuation(parser_t *parser) { - int ch; - unsigned idx = 0; - char *linebuf = NULL; - - while ((ch = getc(file)) != EOF) { - /* grow the line buffer as necessary */ - if (!(idx & 0xff)) - linebuf = xrealloc(linebuf, idx + 0x101); - if (ch == '\n') - ch = '\0'; - linebuf[idx] = (char) ch; - if (ch == '\0') { - (*lineno)++; - if (idx == 0 || linebuf[idx-1] != '\\') - break; - idx--; /* go back to '/' */ - continue; + ssize_t len, nlen; + char *line; + + len = getline(&parser->line, &parser->line_alloc, parser->fp); + if (len <= 0) + return len; + + line = parser->line; + for (;;) { + parser->lineno++; + if (line[len - 1] == '\n') + len--; + if (len == 0 || line[len - 1] != '\\') + break; + len--; + + nlen = getline(&parser->nline, &parser->nline_alloc, parser->fp); + if (nlen <= 0) + break; + + if (parser->line_alloc < len + nlen + 1) { + parser->line_alloc = len + nlen + 1; + line = parser->line = xrealloc(line, parser->line_alloc); } - idx++; - } - if (ch == EOF) { - /* handle corner case when the file is not ended with '\n' */ - (*lineno)++; - if (linebuf) - linebuf[idx] = '\0'; + memcpy(&line[len], parser->nline, nlen); + len += nlen; } - return linebuf; + + line[len] = '\0'; + return len; } @@ -176,15 +171,14 @@ int FAST_FUNC config_read(parser_t *parser, char **tokens, unsigned flags, const ntokens = (uint8_t)flags; mintokens = (uint8_t)(flags >> 8); -again: + again: memset(tokens, 0, sizeof(tokens[0]) * ntokens); - config_free_data(parser); /* Read one line (handling continuations with backslash) */ - line = get_line_with_continuation(parser->fp, &parser->lineno); - if (line == NULL) + if (get_line_with_continuation(parser) < 0) return 0; - parser->line = line; + + line = parser->line; /* Skip token in the start of line? */ if (flags & PARSE_TRIM) @@ -193,8 +187,10 @@ again: if (line[0] == '\0' || line[0] == delims[0]) goto again; - if (flags & PARSE_KEEP_COPY) + if (flags & PARSE_KEEP_COPY) { + free(parser->data); parser->data = xstrdup(line); + } /* Tokenize the line */ t = 0; @@ -240,8 +236,6 @@ again: parser->lineno, t, mintokens); if (flags & PARSE_MIN_DIE) xfunc_die(); - if (flags & PARSE_KEEP_COPY) - free(parser->data); goto again; } -- cgit v1.2.3-55-g6feb From 06448912e6af33a1ac95f985448f83cbd39bac44 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 20 Jun 2011 10:06:28 +0200 Subject: libbb: use _unlocked variants of stdio I/O. Signed-off-by: Denys Vlasenko --- include/libbb.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/include/libbb.h b/include/libbb.h index 953bec334..963ae1e47 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -160,6 +160,44 @@ int sysinfo(struct sysinfo* info); #endif +/* Busybox does not use threads, we can speed up stdio. + * But don't define foo to foo_unlocked if foo_unlocked + * is a macro (it might be defined back to foo!). + */ +#ifndef getc_unlocked +# undef getc +# define getc(stream) getc_unlocked(stream) +#endif +#ifndef getchar_unlocked +# undef getchar +# define getchar() getchar_unlocked() +#endif +#ifndef putc_unlocked +# undef putc +# define putc(c, stream) putc_unlocked(c, stream) +#endif +#ifndef putchar_unlocked +# undef putchar +# define putchar(c) putchar_unlocked(c) +#endif +#ifndef fgetc_unlocked +# undef fgetc +# define fgetc(stream) fgetc_unlocked(stream) +#endif +#ifndef fputc_unlocked +# undef fputc +# define fputc(c, stream) fputc_unlocked(c, stream) +#endif +#ifndef fgets_unlocked +# undef fgets +# define fgets(s, n, stream) fgets_unlocked(s, n, stream) +#endif +#ifndef fputs_unlocked +# undef fputs +# define fputs(s, stream) fputs_unlocked(s, stream) +#endif + + /* Make all declarations hidden (-fvisibility flag only affects definitions) */ /* (don't include system headers after this until corresponding pop!) */ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN -- cgit v1.2.3-55-g6feb From 040b5a2e29743e21698d98c427fe033ffcc94eeb Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Mon, 20 Jun 2011 10:22:18 +0200 Subject: setserial: added missing \n in help text Signed-off-by: Dan Fandrich Signed-off-by: Denys Vlasenko --- miscutils/setserial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miscutils/setserial.c b/miscutils/setserial.c index 1574e3afd..26902a273 100644 --- a/miscutils/setserial.c +++ b/miscutils/setserial.c @@ -214,7 +214,7 @@ struct serial_struct { //usage:#define setserial_full_usage "\n\n" //usage: "Request or set Linux serial port information\n" //usage: "\n" -//usage: " -g Interpret parameters as list of devices for reporting" +//usage: " -g Interpret parameters as list of devices for reporting\n" //usage: " -a Print all available information\n" //usage: " -b Print summary information\n" //usage: " -G Print in form which can be fed back\n" -- cgit v1.2.3-55-g6feb From 561f9c8585e7cb0882472297f4fd2ed763dc085a Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 21 Jun 2011 16:38:29 +0200 Subject: Add HAVE_STRVERSCMP, guard the only usage of strverscmp with #ifdef Signed-off-by: Denys Vlasenko --- coreutils/ls.c | 2 ++ include/platform.h | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/coreutils/ls.c b/coreutils/ls.c index c42f5f3d2..6080f59b6 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -886,9 +886,11 @@ static int sortcmp(const void *a, const void *b) if (sort_opts == SORT_DIR) { dif = S_ISDIR(d2->dn_mode) - S_ISDIR(d1->dn_mode); } else +#ifdef HAVE_STRVERSCMP && HAVE_STRVERSCMP == 1 if (sort_opts == SORT_VERSION) { dif = strverscmp(d1->name, d2->name); } else +#endif if (sort_opts == SORT_EXT) { dif = strcmp(strchrnul(d1->name, '.'), strchrnul(d2->name, '.')); } diff --git a/include/platform.h b/include/platform.h index 429220b0d..d6b748844 100644 --- a/include/platform.h +++ b/include/platform.h @@ -348,6 +348,7 @@ typedef unsigned smalluint; #define HAVE_STRCHRNUL 1 #define HAVE_STRSEP 1 #define HAVE_STRSIGNAL 1 +#define HAVE_STRVERSCMP 1 #define HAVE_VASPRINTF 1 #define HAVE_XTABS 1 #define HAVE_MNTENT_H 1 @@ -372,6 +373,7 @@ typedef unsigned smalluint; # undef HAVE_STRCHRNUL # undef HAVE_STRSEP # undef HAVE_STRSIGNAL +# undef HAVE_STRVERSCMP # undef HAVE_VASPRINTF # undef HAVE_NET_ETHERNET_H #endif @@ -389,18 +391,21 @@ typedef unsigned smalluint; # undef HAVE_PTSNAME_R # undef HAVE_SYS_STATFS_H # undef HAVE_SIGHANDLER_T +# undef HAVE_STRVERSCMP # undef HAVE_XTABS # undef HAVE_DPRINTF #endif #if defined(__digital__) && defined(__unix__) # undef HAVE_STPCPY +# undef HAVE_STRVERSCMP #endif #if defined(ANDROID) # undef HAVE_DPRINTF # undef HAVE_STPCPY # undef HAVE_STRCHRNUL +# undef HAVE_STRVERSCMP # undef HAVE_NET_ETHERNET_H #endif -- cgit v1.2.3-55-g6feb From 33092f1003982fc26339c0fda66283805cfbcfb1 Mon Sep 17 00:00:00 2001 From: Tito Ragusa Date: Tue, 21 Jun 2011 17:11:40 +0200 Subject: groups: new applet Signed-off-by: Tito Ragusa Signed-off-by: Denys Vlasenko --- coreutils/Config.src | 6 ------ coreutils/Kbuild.src | 1 - coreutils/id.c | 40 ++++++++++++++++++++++++++++++++++++---- include/applets.src.h | 1 - 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/coreutils/Config.src b/coreutils/Config.src index 1843e8b0e..9aa04e946 100644 --- a/coreutils/Config.src +++ b/coreutils/Config.src @@ -276,12 +276,6 @@ config HOSTID hostid prints the numeric identifier (in hexadecimal) for the current host. -config ID - bool "id" - default y - help - id displays the current user and group ID names. - config INSTALL bool "install" default y diff --git a/coreutils/Kbuild.src b/coreutils/Kbuild.src index 6a41c8318..0681e44b0 100644 --- a/coreutils/Kbuild.src +++ b/coreutils/Kbuild.src @@ -37,7 +37,6 @@ lib-$(CONFIG_FOLD) += fold.o lib-$(CONFIG_FSYNC) += fsync.o lib-$(CONFIG_HEAD) += head.o lib-$(CONFIG_HOSTID) += hostid.o -lib-$(CONFIG_ID) += id.o lib-$(CONFIG_INSTALL) += install.o #lib-$(CONFIG_LENGTH) += length.o lib-$(CONFIG_LN) += ln.o diff --git a/coreutils/id.c b/coreutils/id.c index aa6ae4711..71acce4a2 100644 --- a/coreutils/id.c +++ b/coreutils/id.c @@ -15,6 +15,24 @@ * Added -G option Tito Ragusa (C) 2008 for SUSv3. */ +//config:config ID +//config: bool "id" +//config: default y +//config: help +//config: id displays the current user and group ID names. + +//config:config GROUPS +//config: bool "groups" +//config: default y +//config: help +//config: Print the group names associated with current user id. + +//kbuild:lib-$(CONFIG_GROUPS) += id.o +//kbuild:lib-$(CONFIG_ID) += id.o + +//applet:IF_GROUPS(APPLET_ODDNAME(groups, id, BB_DIR_USR_BIN, BB_SUID_DROP, groups)) +//applet:IF_ID(APPLET_NOEXEC(id, id, BB_DIR_USR_BIN, BB_SUID_DROP, id)) + //usage:#define id_trivial_usage //usage: "[OPTIONS] [USER]" //usage:#define id_full_usage "\n\n" @@ -32,6 +50,15 @@ //usage: "$ id\n" //usage: "uid=1000(andersen) gid=1000(andersen)\n" +//usage:#define groups_trivial_usage +//usage: "[USER]" +//usage:#define groups_full_usage "\n\n" +//usage: "Print the group memberships of USER or for the current process" +//usage: +//usage:#define groups_example_usage +//usage: "$ groups\n" +//usage: "andersen lp dialout cdrom floppy\n" + #include "libbb.h" /* This is a NOEXEC applet. Be very careful! */ @@ -135,11 +162,16 @@ int id_main(int argc UNUSED_PARAM, char **argv) #if ENABLE_SELINUX security_context_t scontext = NULL; #endif - /* 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 (ENABLE_GROUPS && (!ENABLE_ID || applet_name[0] == 'g')) { + option_mask32 = opt = getopt32(argv, "") | JUST_ALL_GROUPS | NAME_NOT_NUMBER; + } else { + /* 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"); - opt = getopt32(argv, "rnugG" IF_SELINUX("Z")); + opt = getopt32(argv, "rnugG" IF_SELINUX("Z")); + } username = argv[optind]; if (username) { diff --git a/include/applets.src.h b/include/applets.src.h index 133f376a3..c6d99fe8c 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -180,7 +180,6 @@ IF_HOSTID(APPLET_NOFORK(hostid, hostid, BB_DIR_USR_BIN, BB_SUID_DROP, hostid)) IF_HOSTNAME(APPLET(hostname, BB_DIR_BIN, BB_SUID_DROP)) IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP)) -IF_ID(APPLET_NOEXEC(id, id, BB_DIR_USR_BIN, BB_SUID_DROP, id)) 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)) -- cgit v1.2.3-55-g6feb From 1e18a01fa2965ef967b99d519018e21c9b5f15af Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 21 Jun 2011 17:12:52 +0200 Subject: ls: fix HAVE_STRVERSCMP check; add check for older uclibc versions Signed-off-by: Denys Vlasenko --- coreutils/ls.c | 2 +- include/platform.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/coreutils/ls.c b/coreutils/ls.c index 6080f59b6..f11eb4358 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -886,7 +886,7 @@ static int sortcmp(const void *a, const void *b) if (sort_opts == SORT_DIR) { dif = S_ISDIR(d2->dn_mode) - S_ISDIR(d1->dn_mode); } else -#ifdef HAVE_STRVERSCMP && HAVE_STRVERSCMP == 1 +#if defined(HAVE_STRVERSCMP) && HAVE_STRVERSCMP == 1 if (sort_opts == SORT_VERSION) { dif = strverscmp(d1->name, d2->name); } else diff --git a/include/platform.h b/include/platform.h index d6b748844..cbe85f469 100644 --- a/include/platform.h +++ b/include/platform.h @@ -359,6 +359,16 @@ typedef unsigned smalluint; # undef HAVE_NET_ETHERNET_H #endif +#if defined(__UCLIBC_MAJOR__) +# if __UCLIBC_MAJOR__ == 0 \ + && ( __UCLIBC_MINOR__ < 9 \ + || (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ < 31) \ + ) +# undef HAVE_STRVERSCMP +# endif +#endif + + #if defined(__dietlibc__) # undef HAVE_STRCHRNUL #endif -- cgit v1.2.3-55-g6feb From d5ac9c88a7f620f6b775e404b145017827a10480 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 22 Jun 2011 04:17:49 +0200 Subject: groups: make it NOEXEC Signed-off-by: Denys Vlasenko --- coreutils/id.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/coreutils/id.c b/coreutils/id.c index 71acce4a2..bb950f9ec 100644 --- a/coreutils/id.c +++ b/coreutils/id.c @@ -30,8 +30,8 @@ //kbuild:lib-$(CONFIG_GROUPS) += id.o //kbuild:lib-$(CONFIG_ID) += id.o -//applet:IF_GROUPS(APPLET_ODDNAME(groups, id, BB_DIR_USR_BIN, BB_SUID_DROP, groups)) -//applet:IF_ID(APPLET_NOEXEC(id, id, BB_DIR_USR_BIN, BB_SUID_DROP, id)) +//applet:IF_GROUPS(APPLET_NOEXEC(groups, id, BB_DIR_USR_BIN, BB_SUID_DROP, groups)) +//applet:IF_ID( APPLET_NOEXEC(id, id, BB_DIR_USR_BIN, BB_SUID_DROP, id )) //usage:#define id_trivial_usage //usage: "[OPTIONS] [USER]" @@ -164,7 +164,13 @@ int id_main(int argc UNUSED_PARAM, char **argv) #endif if (ENABLE_GROUPS && (!ENABLE_ID || applet_name[0] == 'g')) { - option_mask32 = opt = getopt32(argv, "") | JUST_ALL_GROUPS | NAME_NOT_NUMBER; + /* TODO: coreutils groups prepend "USER : " prefix, + * and accept many usernames. Example: + * # groups root root + * root : root + * root : root + */ + opt = option_mask32 = getopt32(argv, "") | JUST_ALL_GROUPS | NAME_NOT_NUMBER; } else { /* Don't allow -n -r -nr -ug -rug -nug -rnug -uZ -gZ -GZ*/ /* Don't allow more than one username */ -- cgit v1.2.3-55-g6feb From 52f4fe9db6cedfba332ee0923182f5b2e9d9673b Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 22 Jun 2011 16:42:36 +0200 Subject: id: correct getgroups usage Signed-off-by: Denys Vlasenko --- coreutils/id.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/coreutils/id.c b/coreutils/id.c index bb950f9ec..399d25e34 100644 --- a/coreutils/id.c +++ b/coreutils/id.c @@ -117,7 +117,7 @@ static int print_user(uid_t id, const char *prefix) /* On error set *n < 0 and return >= 0 * If *n is too small, update it and return < 0 - * (ok to trash groups[] in both cases) + * (ok to trash groups[] in both cases) * Otherwise fill in groups[] and return >= 0 */ static int get_groups(const char *username, gid_t rgid, gid_t *groups, int *n) @@ -131,20 +131,19 @@ static int get_groups(const char *username, gid_t rgid, gid_t *groups, int *n) m = getgrouplist(username, rgid, groups, n); /* I guess *n < 0 might indicate error. Anyway, * malloc'ing -1 bytes won't be good, so: */ - //if (*n < 0) - // return 0; - //return m; - //commented out here, happens below anyway - } else { - /* On error -1 is returned, which ends up in *n */ - int nn = getgroups(*n, groups); - /* 0: nn <= *n, groups[] was big enough; -1 otherwise */ - m = - (nn > *n); - *n = nn; + if (*n < 0) + return 0; + return m; } - if (*n < 0) - return 0; /* error, don't return < 0! */ - return m; + + *n = getgroups(*n, groups); + if (*n >= 0) + return *n; + /* Error */ + if (errno == EINVAL) /* *n is too small? */ + *n = getgroups(0, groups); /* get needed *n */ + /* if *n >= 0, return -1 (got new *n), else return 0 (error): */ + return -(*n >= 0); } int id_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; @@ -214,11 +213,11 @@ int id_main(int argc UNUSED_PARAM, char **argv) /* We are supplying largish buffer, trying * to not run get_groups() twice. That might be slow * ("user database in remote SQL server" case) */ - groups = xmalloc(64 * sizeof(gid_t)); + groups = xmalloc(64 * sizeof(groups[0])); n = 64; if (get_groups(username, rgid, groups, &n) < 0) { /* Need bigger buffer after all */ - groups = xrealloc(groups, n * sizeof(gid_t)); + groups = xrealloc(groups, n * sizeof(groups[0])); get_groups(username, rgid, groups, &n); } if (n > 0) { -- cgit v1.2.3-55-g6feb From b9ba580917b59e4770ba99db7c61288f2476eb61 Mon Sep 17 00:00:00 2001 From: Walter Harms Date: Mon, 27 Jun 2011 02:59:37 +0200 Subject: vi: fix regex search, make it selectable in config function old new delta char_search 134 214 +80 find_pair 187 169 -18 mycmp 37 - -37 Signed-off-by: Walter Harms Signed-off-by: Denys Vlasenko --- editors/Config.src | 117 -------------------------- editors/Kbuild.src | 1 - editors/vi.c | 221 +++++++++++++++++++++++++++++++++++++++++--------- include/applets.src.h | 1 - 4 files changed, 181 insertions(+), 159 deletions(-) diff --git a/editors/Config.src b/editors/Config.src index 201ee6eb9..af1e1de5e 100644 --- a/editors/Config.src +++ b/editors/Config.src @@ -67,123 +67,6 @@ config SED sed is used to perform text transformations on a file or input from a pipeline. -config VI - bool "vi" - default y - help - 'vi' is a text editor. More specifically, it is the One True - text editor . It does, however, have a rather steep - learning curve. If you are not already comfortable with 'vi' - you may wish to use something else. - -config FEATURE_VI_MAX_LEN - int "Maximum screen width in vi" - range 256 16384 - default 4096 - depends on VI - help - Contrary to what you may think, this is not eating much. - Make it smaller than 4k only if you are very limited on memory. - -config FEATURE_VI_8BIT - bool "Allow vi to display 8-bit chars (otherwise shows dots)" - default n - depends on VI - help - If your terminal can display characters with high bit set, - you may want to enable this. Note: vi is not Unicode-capable. - If your terminal combines several 8-bit bytes into one character - (as in Unicode mode), this will not work properly. - -config FEATURE_VI_COLON - bool "Enable \":\" colon commands (no \"ex\" mode)" - default y - depends on VI - help - Enable a limited set of colon commands for vi. This does not - provide an "ex" mode. - -config FEATURE_VI_YANKMARK - bool "Enable yank/put commands and mark cmds" - default y - depends on VI - help - This will enable you to use yank and put, as well as mark in - busybox vi. - -config FEATURE_VI_SEARCH - bool "Enable search and replace cmds" - default y - depends on VI - help - Select this if you wish to be able to do search and replace in - busybox vi. - -config FEATURE_VI_USE_SIGNALS - bool "Catch signals" - default y - depends on VI - help - Selecting this option will make busybox vi signal aware. This will - make busybox vi support SIGWINCH to deal with Window Changes, catch - Ctrl-Z and Ctrl-C and alarms. - -config FEATURE_VI_DOT_CMD - bool "Remember previous cmd and \".\" cmd" - default y - depends on VI - help - Make busybox vi remember the last command and be able to repeat it. - -config FEATURE_VI_READONLY - bool "Enable -R option and \"view\" mode" - default y - depends on VI - help - Enable the read-only command line option, which allows the user to - open a file in read-only mode. - -config FEATURE_VI_SETOPTS - bool "Enable set-able options, ai ic showmatch" - default y - depends on VI - help - Enable the editor to set some (ai, ic, showmatch) options. - -config FEATURE_VI_SET - bool "Support for :set" - default y - depends on VI - help - Support for ":set". - -config FEATURE_VI_WIN_RESIZE - bool "Handle window resize" - default y - depends on VI - help - Make busybox vi behave nicely with terminals that get resized. - -config FEATURE_VI_ASK_TERMINAL - bool "Use 'tell me cursor position' ESC sequence to measure window" - default y - depends on VI - help - If terminal size can't be retrieved and $LINES/$COLUMNS are not set, - this option makes vi perform a last-ditch effort to find it: - vi positions cursor to 999,999 and asks terminal to report real - cursor position using "ESC [ 6 n" escape sequence, then reads stdin. - - This is not clean but helps a lot on serial lines and such. - -config FEATURE_VI_OPTIMIZE_CURSOR - bool "Optimize cursor movement" - default y - depends on VI - help - This will make the cursor movement faster, but requires more memory - and it makes the applet a tiny bit larger. - config FEATURE_ALLOW_EXEC bool "Allow vi and awk to execute shell commands" default y diff --git a/editors/Kbuild.src b/editors/Kbuild.src index 2f23ae12f..8888cba12 100644 --- a/editors/Kbuild.src +++ b/editors/Kbuild.src @@ -12,4 +12,3 @@ lib-$(CONFIG_CMP) += cmp.o lib-$(CONFIG_DIFF) += diff.o lib-$(CONFIG_ED) += ed.o lib-$(CONFIG_SED) += sed.o -lib-$(CONFIG_VI) += vi.o diff --git a/editors/vi.c b/editors/vi.c index 3656fee95..3f4ccdcdd 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -21,6 +21,134 @@ * An "ex" line oriented mode- maybe using "cmdedit" */ +//config:config VI +//config: bool "vi" +//config: default y +//config: help +//config: 'vi' is a text editor. More specifically, it is the One True +//config: text editor . It does, however, have a rather steep +//config: learning curve. If you are not already comfortable with 'vi' +//config: you may wish to use something else. +//config: +//config:config FEATURE_VI_MAX_LEN +//config: int "Maximum screen width in vi" +//config: range 256 16384 +//config: default 4096 +//config: depends on VI +//config: help +//config: Contrary to what you may think, this is not eating much. +//config: Make it smaller than 4k only if you are very limited on memory. +//config: +//config:config FEATURE_VI_8BIT +//config: bool "Allow vi to display 8-bit chars (otherwise shows dots)" +//config: default n +//config: depends on VI +//config: help +//config: If your terminal can display characters with high bit set, +//config: you may want to enable this. Note: vi is not Unicode-capable. +//config: If your terminal combines several 8-bit bytes into one character +//config: (as in Unicode mode), this will not work properly. +//config: +//config:config FEATURE_VI_COLON +//config: bool "Enable \":\" colon commands (no \"ex\" mode)" +//config: default y +//config: depends on VI +//config: help +//config: Enable a limited set of colon commands for vi. This does not +//config: provide an "ex" mode. +//config: +//config:config FEATURE_VI_YANKMARK +//config: bool "Enable yank/put commands and mark cmds" +//config: default y +//config: depends on VI +//config: help +//config: This will enable you to use yank and put, as well as mark in +//config: busybox vi. +//config: +//config:config FEATURE_VI_SEARCH +//config: bool "Enable search and replace cmds" +//config: default y +//config: depends on VI +//config: help +//config: Select this if you wish to be able to do search and replace in +//config: busybox vi. +//config: +//config:config FEATURE_VI_REGEX_SEARCH +//config: bool "Enable regex in search and replace" +//config: default n # Uses GNU regex, which may be unavailable. FIXME +//config: depends on FEATURE_VI_SEARCH +//config: help +//config: Use extended regex search. +//config: +//config:config FEATURE_VI_USE_SIGNALS +//config: bool "Catch signals" +//config: default y +//config: depends on VI +//config: help +//config: Selecting this option will make busybox vi signal aware. This will +//config: make busybox vi support SIGWINCH to deal with Window Changes, catch +//config: Ctrl-Z and Ctrl-C and alarms. +//config: +//config:config FEATURE_VI_DOT_CMD +//config: bool "Remember previous cmd and \".\" cmd" +//config: default y +//config: depends on VI +//config: help +//config: Make busybox vi remember the last command and be able to repeat it. +//config: +//config:config FEATURE_VI_READONLY +//config: bool "Enable -R option and \"view\" mode" +//config: default y +//config: depends on VI +//config: help +//config: Enable the read-only command line option, which allows the user to +//config: open a file in read-only mode. +//config: +//config:config FEATURE_VI_SETOPTS +//config: bool "Enable set-able options, ai ic showmatch" +//config: default y +//config: depends on VI +//config: help +//config: Enable the editor to set some (ai, ic, showmatch) options. +//config: +//config:config FEATURE_VI_SET +//config: bool "Support for :set" +//config: default y +//config: depends on VI +//config: help +//config: Support for ":set". +//config: +//config:config FEATURE_VI_WIN_RESIZE +//config: bool "Handle window resize" +//config: default y +//config: depends on VI +//config: help +//config: Make busybox vi behave nicely with terminals that get resized. +//config: +//config:config FEATURE_VI_ASK_TERMINAL +//config: bool "Use 'tell me cursor position' ESC sequence to measure window" +//config: default y +//config: depends on VI +//config: help +//config: If terminal size can't be retrieved and $LINES/$COLUMNS are not set, +//config: this option makes vi perform a last-ditch effort to find it: +//config: vi positions cursor to 999,999 and asks terminal to report real +//config: cursor position using "ESC [ 6 n" escape sequence, then reads 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)) + +//kbuild:lib-$(CONFIG_VI) += vi.o + //usage:#define vi_trivial_usage //usage: "[OPTIONS] [FILE]..." //usage:#define vi_full_usage "\n\n" @@ -33,6 +161,7 @@ //usage: ) //usage: "\n -H Short help regarding available features" +#include #include "libbb.h" /* the CRASHME code is unmaintained, and doesn't currently build */ @@ -366,7 +495,6 @@ static void Hit_Return(void); #if ENABLE_FEATURE_VI_SEARCH static char *char_search(char *, const char *, int, int); // search for pattern starting at p -static int mycmp(const char *, const char *, int); // string cmp based in "ignorecase" #endif #if ENABLE_FEATURE_VI_COLON static char *get_one_address(char *, int *); // get colon addr, if present @@ -1561,48 +1689,16 @@ static char *new_screen(int ro, int co) } #if ENABLE_FEATURE_VI_SEARCH -static int mycmp(const char *s1, const char *s2, int len) -{ - if (ENABLE_FEATURE_VI_SETOPTS && ignorecase) { - return strncasecmp(s1, s2, len); - } - return strncmp(s1, s2, len); -} + +# if ENABLE_FEATURE_VI_REGEX_SEARCH // search for pattern starting at p static char *char_search(char *p, const char *pat, int dir, int range) { -#ifndef REGEX_SEARCH - char *start, *stop; - int len; - - len = strlen(pat); - if (dir == FORWARD) { - stop = end - 1; // assume range is p - end-1 - if (range == LIMITED) - stop = next_line(p); // range is to next line - for (start = p; start < stop; start++) { - if (mycmp(start, pat, len) == 0) { - return start; - } - } - } else if (dir == BACK) { - stop = text; // assume range is text - p - if (range == LIMITED) - stop = prev_line(p); // range is to prev line - for (start = p - len; start >= stop; start--) { - if (mycmp(start, pat, len) == 0) { - return start; - } - } - } - // pattern not found - return NULL; -#else /* REGEX_SEARCH */ char *q; struct re_pattern_buffer preg; int i; - int size, range; + int size; re_syntax_options = RE_SYNTAX_POSIX_EXTENDED; preg.translate = 0; @@ -1625,7 +1721,7 @@ static char *char_search(char *p, const char *pat, int dir, int range) // RANGE could be negative if we are searching backwards range = q - p; - q = re_compile_pattern(pat, strlen(pat), &preg); + q = (char *)re_compile_pattern(pat, strlen(pat), (struct re_pattern_buffer *)&preg); if (q != 0) { // The pattern was not compiled status_line_bold("bad search pattern: \"%s\": %s", pat, q); @@ -1659,8 +1755,53 @@ static char *char_search(char *p, const char *pat, int dir, int range) p = p - i; } return p; -#endif /* REGEX_SEARCH */ } + +# else + +# if ENABLE_FEATURE_VI_SETOPTS +static int mycmp(const char *s1, const char *s2, int len) +{ + if (ignorecase) { + return strncasecmp(s1, s2, len); + } + return strncmp(s1, s2, len); +} +# else +# define mycmp strncmp +# endif + +static char *char_search(char *p, const char *pat, int dir, int range) +{ + char *start, *stop; + int len; + + len = strlen(pat); + if (dir == FORWARD) { + stop = end - 1; // assume range is p - end-1 + if (range == LIMITED) + stop = next_line(p); // range is to next line + for (start = p; start < stop; start++) { + if (mycmp(start, pat, len) == 0) { + return start; + } + } + } else if (dir == BACK) { + stop = text; // assume range is text - p + if (range == LIMITED) + stop = prev_line(p); // range is to prev line + for (start = p - len; start >= stop; start--) { + if (mycmp(start, pat, len) == 0) { + return start; + } + } + } + // pattern not found + return NULL; +} + +# endif + #endif /* FEATURE_VI_SEARCH */ static char *char_insert(char *p, char c) // insert the char c at 'p' @@ -2022,8 +2163,8 @@ static void show_help(void) "\n\tNamed buffers with \"x" #endif #if ENABLE_FEATURE_VI_READONLY - "\n\tReadonly if vi is called as \"view\"" - "\n\tReadonly with -R command line arg" + //not implemented: "\n\tReadonly if vi is called as \"view\"" + //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 \':\'" diff --git a/include/applets.src.h b/include/applets.src.h index c6d99fe8c..2d55ffec7 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -399,7 +399,6 @@ IF_USLEEP(APPLET_NOFORK(usleep, usleep, BB_DIR_BIN, BB_SUID_DROP, usleep)) IF_UUDECODE(APPLET(uudecode, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_UUENCODE(APPLET(uuencode, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_VCONFIG(APPLET(vconfig, BB_DIR_SBIN, BB_SUID_DROP)) -IF_VI(APPLET(vi, BB_DIR_BIN, BB_SUID_DROP)) /* Needs to be run by root or be suid root - needs to change uid and gid: */ IF_VLOCK(APPLET(vlock, BB_DIR_USR_BIN, BB_SUID_REQUIRE)) IF_VOLNAME(APPLET(volname, BB_DIR_USR_BIN, BB_SUID_DROP)) -- cgit v1.2.3-55-g6feb From 0a5b310067abfde9bf74a42352fc421e1c27e2b9 Mon Sep 17 00:00:00 2001 From: Timo Teras Date: Wed, 29 Jun 2011 02:19:58 +0200 Subject: platform.c: provide getline implementation Signed-off-by: Timo Teras Signed-off-by: Denys Vlasenko --- include/platform.h | 5 +++++ libbb/platform.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/include/platform.h b/include/platform.h index cbe85f469..eafc3fcfe 100644 --- a/include/platform.h +++ b/include/platform.h @@ -350,6 +350,7 @@ typedef unsigned smalluint; #define HAVE_STRSIGNAL 1 #define HAVE_STRVERSCMP 1 #define HAVE_VASPRINTF 1 +#define HAVE_GETLINE 1 #define HAVE_XTABS 1 #define HAVE_MNTENT_H 1 #define HAVE_NET_ETHERNET_H 1 @@ -470,4 +471,8 @@ extern char *strsep(char **stringp, const char *delim) FAST_FUNC; extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; #endif +#ifndef HAVE_GETLINE +extern ssize_t getline(char **lineptr, size_t *n, FILE *stream) FAST_FUNC; +#endif + #endif diff --git a/libbb/platform.c b/libbb/platform.c index 04b8961de..2bf34f5bc 100644 --- a/libbb/platform.c +++ b/libbb/platform.c @@ -145,3 +145,32 @@ char* FAST_FUNC stpcpy(char *p, const char *to_add) return p; } #endif + +#ifndef HAVE_GETLINE +ssize_t FAST_FUNC getline(char **lineptr, size_t *n, FILE *stream) +{ + int ch; + char *line = *lineptr; + size_t alloced = *n; + size_t len = 0; + + do { + ch = fgetc(stream); + if (ch == EOF) + break; + if (len + 1 >= alloced) { + alloced += alloced/4 + 64; + line = xrealloc(line, alloced); + } + line[len++] = ch; + } while (ch != '\n'); + + if (len == 0) + return -1; + + line[len] = '\0'; + *lineptr = line; + *n = alloced; + return len; +} +#endif -- cgit v1.2.3-55-g6feb From 0e79e7bb420c58fa8e5d2d88c5d3a26f94c761af Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Tue, 28 Jun 2011 23:03:27 -0700 Subject: Use the built-in getline on more systems that don't have it Signed-off-by: Dan Fandrich Signed-off-by: Denys Vlasenko --- include/platform.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/include/platform.h b/include/platform.h index eafc3fcfe..d186e4911 100644 --- a/include/platform.h +++ b/include/platform.h @@ -376,6 +376,7 @@ typedef unsigned smalluint; #if defined(__WATCOMC__) # undef HAVE_DPRINTF +# undef HAVE_GETLINE # undef HAVE_MEMRCHR # undef HAVE_MKDTEMP # undef HAVE_SETBIT @@ -389,15 +390,13 @@ typedef unsigned smalluint; # undef HAVE_NET_ETHERNET_H #endif -#if defined(__FreeBSD__) -# undef HAVE_STRCHRNUL -#endif - +/* These BSD-derived OSes share many similarities */ #if (defined __digital__ && defined __unix__) \ || defined __APPLE__ \ || defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ # undef HAVE_CLEARENV # undef HAVE_FDATASYNC +# undef HAVE_GETLINE # undef HAVE_MNTENT_H # undef HAVE_PTSNAME_R # undef HAVE_SYS_STATFS_H @@ -407,13 +406,21 @@ typedef unsigned smalluint; # undef HAVE_DPRINTF #endif +#if defined(__FreeBSD__) +# undef HAVE_STRCHRNUL +#endif + +#if defined(__NetBSD__) +# define HAVE_GETLINE 1 /* Recent NetBSD versions have getline() */ +#endif + #if defined(__digital__) && defined(__unix__) # undef HAVE_STPCPY -# undef HAVE_STRVERSCMP #endif #if defined(ANDROID) # undef HAVE_DPRINTF +# undef HAVE_GETLINE # undef HAVE_STPCPY # undef HAVE_STRCHRNUL # undef HAVE_STRVERSCMP @@ -472,6 +479,7 @@ extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC #endif #ifndef HAVE_GETLINE +#include /* for FILE */ extern ssize_t getline(char **lineptr, size_t *n, FILE *stream) FAST_FUNC; #endif -- cgit v1.2.3-55-g6feb From 0c4cf42c1e4fbb5af8952cfbec926fe7d7b318d5 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 30 Jun 2011 02:44:27 +0200 Subject: libbb.h: tweak _unlocked hack Signed-off-by: Denys Vlasenko --- include/libbb.h | 54 ++++++++++++++++++------------------------------------ 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/include/libbb.h b/include/libbb.h index 963ae1e47..efb925eaf 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -160,42 +160,24 @@ int sysinfo(struct sysinfo* info); #endif -/* Busybox does not use threads, we can speed up stdio. - * But don't define foo to foo_unlocked if foo_unlocked - * is a macro (it might be defined back to foo!). - */ -#ifndef getc_unlocked -# undef getc -# define getc(stream) getc_unlocked(stream) -#endif -#ifndef getchar_unlocked -# undef getchar -# define getchar() getchar_unlocked() -#endif -#ifndef putc_unlocked -# undef putc -# define putc(c, stream) putc_unlocked(c, stream) -#endif -#ifndef putchar_unlocked -# undef putchar -# define putchar(c) putchar_unlocked(c) -#endif -#ifndef fgetc_unlocked -# undef fgetc -# define fgetc(stream) fgetc_unlocked(stream) -#endif -#ifndef fputc_unlocked -# undef fputc -# define fputc(c, stream) fputc_unlocked(c, stream) -#endif -#ifndef fgets_unlocked -# undef fgets -# define fgets(s, n, stream) fgets_unlocked(s, n, stream) -#endif -#ifndef fputs_unlocked -# undef fputs -# define fputs(s, stream) fputs_unlocked(s, stream) -#endif +/* Busybox does not use threads, we can speed up stdio. */ +#undef getc +#define getc(stream) getc_unlocked(stream) +#undef getchar +#define getchar() getchar_unlocked() +#undef putc +#define putc(c, stream) putc_unlocked(c, stream) +#undef putchar +#define putchar(c) putchar_unlocked(c) +#undef fgetc +#define fgetc(stream) getc_unlocked(stream) +#undef fputc +#define fputc(c, stream) putc_unlocked(c, stream) +/* Above functions are required by POSIX.1-2008, below ones are extensions */ +#undef fgets +#define fgets(s, n, stream) fgets_unlocked(s, n, stream) +#undef fputs +#define fputs(s, stream) fputs_unlocked(s, stream) /* Make all declarations hidden (-fvisibility flag only affects definitions) */ -- cgit v1.2.3-55-g6feb From 75214cfe00c72c51c67c9ac2541f06b0540136f1 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Thu, 30 Jun 2011 02:59:17 +0200 Subject: Use the _unlocked stdio macros only when they're all available Signed-off-by: Dan Fandrich Signed-off-by: Denys Vlasenko --- include/libbb.h | 36 ++++++++++++++++++++---------------- include/platform.h | 10 +++++----- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/include/libbb.h b/include/libbb.h index efb925eaf..1502272f6 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -161,23 +161,27 @@ int sysinfo(struct sysinfo* info); /* Busybox does not use threads, we can speed up stdio. */ -#undef getc -#define getc(stream) getc_unlocked(stream) -#undef getchar -#define getchar() getchar_unlocked() -#undef putc -#define putc(c, stream) putc_unlocked(c, stream) -#undef putchar -#define putchar(c) putchar_unlocked(c) -#undef fgetc -#define fgetc(stream) getc_unlocked(stream) -#undef fputc -#define fputc(c, stream) putc_unlocked(c, stream) +#ifdef HAVE_UNLOCKED_STDIO +# undef getc +# define getc(stream) getc_unlocked(stream) +# undef getchar +# define getchar() getchar_unlocked() +# undef putc +# define putc(c, stream) putc_unlocked(c, stream) +# undef putchar +# define putchar(c) putchar_unlocked(c) +# undef fgetc +# define fgetc(stream) getc_unlocked(stream) +# undef fputc +# define fputc(c, stream) putc_unlocked(c, stream) +#endif /* Above functions are required by POSIX.1-2008, below ones are extensions */ -#undef fgets -#define fgets(s, n, stream) fgets_unlocked(s, n, stream) -#undef fputs -#define fputs(s, stream) fputs_unlocked(s, stream) +#ifdef HAVE_UNLOCKED_LINE_OPS +# undef fgets +# define fgets(s, n, stream) fgets_unlocked(s, n, stream) +# undef fputs +# define fputs(s, stream) fputs_unlocked(s, stream) +#endif /* Make all declarations hidden (-fvisibility flag only affects definitions) */ diff --git a/include/platform.h b/include/platform.h index d186e4911..60864c929 100644 --- a/include/platform.h +++ b/include/platform.h @@ -350,16 +350,14 @@ typedef unsigned smalluint; #define HAVE_STRSIGNAL 1 #define HAVE_STRVERSCMP 1 #define HAVE_VASPRINTF 1 +#define HAVE_UNLOCKED_STDIO 1 +#define HAVE_UNLOCKED_LINE_OPS 1 #define HAVE_GETLINE 1 #define HAVE_XTABS 1 #define HAVE_MNTENT_H 1 #define HAVE_NET_ETHERNET_H 1 #define HAVE_SYS_STATFS_H 1 -#if defined(__GLIBC__) && (__GLIBC__ < 2 || __GLIBC_MINOR__ < 1) -# undef HAVE_NET_ETHERNET_H -#endif - #if defined(__UCLIBC_MAJOR__) # if __UCLIBC_MAJOR__ == 0 \ && ( __UCLIBC_MINOR__ < 9 \ @@ -369,7 +367,6 @@ typedef unsigned smalluint; # endif #endif - #if defined(__dietlibc__) # undef HAVE_STRCHRNUL #endif @@ -387,6 +384,8 @@ typedef unsigned smalluint; # undef HAVE_STRSIGNAL # undef HAVE_STRVERSCMP # undef HAVE_VASPRINTF +# undef HAVE_UNLOCKED_STDIO +# undef HAVE_UNLOCKED_LINE_OPS # undef HAVE_NET_ETHERNET_H #endif @@ -424,6 +423,7 @@ typedef unsigned smalluint; # undef HAVE_STPCPY # undef HAVE_STRCHRNUL # undef HAVE_STRVERSCMP +# undef HAVE_UNLOCKED_LINE_OPS # undef HAVE_NET_ETHERNET_H #endif -- cgit v1.2.3-55-g6feb From 104e01409de48057f34fa8abe3fcae11820a651c Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 3 Jul 2011 01:46:02 +0200 Subject: halt/reboot: better message if /sbin/telinit is not found Signed-off-by: Denys Vlasenko --- init/halt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/init/halt.c b/init/halt.c index 433326dd4..1aac0faf9 100644 --- a/init/halt.c +++ b/init/halt.c @@ -154,11 +154,13 @@ int halt_main(int argc UNUSED_PARAM, char **argv) /* runlevels: * 0 == shutdown * 6 == reboot */ - rc = execlp(CONFIG_TELINIT_PATH, + execlp(CONFIG_TELINIT_PATH, CONFIG_TELINIT_PATH, which == 2 ? "6" : "0", (char *)NULL ); + perror_msg_and_die("can't execute '%s'", + CONFIG_TELINIT_PATH); } } } else { -- cgit v1.2.3-55-g6feb From 066f39956641300c1e5c6bfe6c11a115cea3e2cf Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 3 Jul 2011 03:19:43 +0200 Subject: vi: tweak regex.h include Signed-off-by: Denys Vlasenko --- editors/vi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/editors/vi.c b/editors/vi.c index 3f4ccdcdd..55092f921 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -161,8 +161,11 @@ //usage: ) //usage: "\n -H Short help regarding available features" -#include #include "libbb.h" +/* Should be after libbb.h: on some systems regex.h needs sys/types.h: */ +#if ENABLE_FEATURE_VI_REGEX_SEARCH +# include +#endif /* the CRASHME code is unmaintained, and doesn't currently build */ #define ENABLE_FEATURE_VI_CRASHME 0 @@ -181,9 +184,9 @@ /* 0x9b is Meta-ESC */ #if ENABLE_FEATURE_VI_8BIT -#define Isprint(c) ((unsigned char)(c) >= ' ' && (c) != 0x7f && (unsigned char)(c) != 0x9b) +# define Isprint(c) ((unsigned char)(c) >= ' ' && (c) != 0x7f && (unsigned char)(c) != 0x9b) #else -#define Isprint(c) ((unsigned char)(c) >= ' ' && (unsigned char)(c) < 0x7f) +# define Isprint(c) ((unsigned char)(c) >= ' ' && (unsigned char)(c) < 0x7f) #endif #endif -- cgit v1.2.3-55-g6feb