aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-12-26 02:51:29 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-12-26 02:51:29 +0000
commit0de9375ee6e766cf15942c6582c79b0ac6d310f5 (patch)
tree69a866577fc99e3e0c3153f486f22a2e675028a0
parentc4f623ef2a7980a63de7c9f1d539a656b83f10e7 (diff)
downloadbusybox-w32-0de9375ee6e766cf15942c6582c79b0ac6d310f5.tar.gz
busybox-w32-0de9375ee6e766cf15942c6582c79b0ac6d310f5.tar.bz2
busybox-w32-0de9375ee6e766cf15942c6582c79b0ac6d310f5.zip
leftover of e2fsck surgery
-rw-r--r--Makefile4
-rw-r--r--e2fsprogs/fsck.c118
-rw-r--r--include/applets.h18
-rw-r--r--include/libbb.h1
-rw-r--r--include/usage.h8
-rw-r--r--libbb/dump.c4
-rw-r--r--libbb/skip_whitespace.c9
7 files changed, 61 insertions, 101 deletions
diff --git a/Makefile b/Makefile
index d218caf8e..d4cc766dd 100644
--- a/Makefile
+++ b/Makefile
@@ -429,10 +429,6 @@ libs-y := \
429 coreutils/libcoreutils/ \ 429 coreutils/libcoreutils/ \
430 debianutils/ \ 430 debianutils/ \
431 e2fsprogs/ \ 431 e2fsprogs/ \
432 e2fsprogs/blkid/ \
433 e2fsprogs/e2p/ \
434 e2fsprogs/ext2fs/ \
435 e2fsprogs/uuid/ \
436 editors/ \ 432 editors/ \
437 findutils/ \ 433 findutils/ \
438 init/ \ 434 init/ \
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c
index d59206ca2..396174ef5 100644
--- a/e2fsprogs/fsck.c
+++ b/e2fsprogs/fsck.c
@@ -27,7 +27,6 @@
27 */ 27 */
28 28
29#include "busybox.h" 29#include "busybox.h"
30/*#include "e2fs_lib.h"*/
31 30
32#define EXIT_OK 0 31#define EXIT_OK 0
33#define EXIT_NONDESTRUCT 1 32#define EXIT_NONDESTRUCT 1
@@ -41,9 +40,6 @@
41#define DEFAULT_FSTYPE "ext2" 40#define DEFAULT_FSTYPE "ext2"
42#endif 41#endif
43 42
44#define MAX_DEVICES 32
45#define MAX_ARGS 32
46
47/* 43/*
48 * Internal structure for mount tabel entries. 44 * Internal structure for mount tabel entries.
49 */ 45 */
@@ -76,7 +72,7 @@ struct fsck_instance {
76 struct fsck_instance *next; 72 struct fsck_instance *next;
77}; 73};
78 74
79static const char * const ignored_types[] = { 75static const char *const ignored_types[] = {
80 "ignore", 76 "ignore",
81 "iso9660", 77 "iso9660",
82 "nfs", 78 "nfs",
@@ -88,7 +84,8 @@ static const char * const ignored_types[] = {
88 NULL 84 NULL
89}; 85};
90 86
91static const char * const really_wanted[] = { 87#if 0
88static const char *const really_wanted[] = {
92 "minix", 89 "minix",
93 "ext2", 90 "ext2",
94 "ext3", 91 "ext3",
@@ -98,16 +95,15 @@ static const char * const really_wanted[] = {
98 "xfs", 95 "xfs",
99 NULL 96 NULL
100}; 97};
98#endif
101 99
102#define BASE_MD "/dev/md" 100#define BASE_MD "/dev/md"
103 101
104/* 102static volatile int cancel_requested;
105 * Global variables for options 103
106 */
107static char **devices; 104static char **devices;
108static char **args; 105static char **args;
109static int num_devices, num_args; 106static int num_devices, num_args;
110
111static int verbose; 107static int verbose;
112static int doall; 108static int doall;
113static int noexecute; 109static int noexecute;
@@ -121,13 +117,10 @@ static int progress_fd;
121static int force_all_parallel; 117static int force_all_parallel;
122static int num_running; 118static int num_running;
123static int max_running; 119static int max_running;
124static volatile int cancel_requested;
125static int kill_sent;
126static char *fstype; 120static char *fstype;
127static struct fs_info *filesys_info, *filesys_last; 121static struct fs_info *filesys_info;
122static struct fs_info *filesys_last;
128static struct fsck_instance *instance_list; 123static struct fsck_instance *instance_list;
129/*static char *fsck_path;*/
130/*static blkid_cache cache;*/
131 124
132#define FS_TYPE_FLAG_NORMAL 0 125#define FS_TYPE_FLAG_NORMAL 0
133#define FS_TYPE_FLAG_OPT 1 126#define FS_TYPE_FLAG_OPT 1
@@ -439,11 +432,10 @@ static void load_fs_info(const char *filename)
439 fclose(f); 432 fclose(f);
440 433
441 if (old_fstab) { 434 if (old_fstab) {
442 fputs("\007\007\007" 435 fputs("\007"
443 "WARNING: Your /etc/fstab does not contain the fsck passno\n" 436"WARNING: Your /etc/fstab does not contain the fsck passno field.\n"
444 " field. I will kludge around things for you, but you\n" 437"I will kludge around things for you, but you should fix\n"
445 " should fix your /etc/fstab file as soon as you can.\n\n", stderr); 438"your /etc/fstab file as soon as you can.\n\n", stderr);
446
447 for (fs = filesys_info; fs; fs = fs->next) { 439 for (fs = filesys_info; fs; fs = fs->next) {
448 fs->passno = 1; 440 fs->passno = 1;
449 } 441 }
@@ -455,10 +447,6 @@ static struct fs_info *lookup(char *filesys)
455{ 447{
456 struct fs_info *fs; 448 struct fs_info *fs;
457 449
458 /* No filesys name given. */
459 if (filesys == NULL)
460 return NULL;
461
462 for (fs = filesys_info; fs; fs = fs->next) { 450 for (fs = filesys_info; fs; fs = fs->next) {
463 if (strcmp(filesys, fs->device) == 0 451 if (strcmp(filesys, fs->device) == 0
464 || (fs->mountpt && strcmp(filesys, fs->mountpt) == 0) 452 || (fs->mountpt && strcmp(filesys, fs->mountpt) == 0)
@@ -469,29 +457,6 @@ static struct fs_info *lookup(char *filesys)
469 return fs; 457 return fs;
470} 458}
471 459
472#if 0
473/* Find fsck program for a given fs type. */
474static char *find_fsck(char *type)
475{
476 char *s;
477 const char *tpl;
478 char *p = xstrdup(fsck_path);
479 struct stat st;
480
481 /* Are we looking for a program or just a type? */
482 tpl = (strncmp(type, "fsck.", 5) ? "%s/fsck.%s" : "%s/%s");
483
484 for (s = strtok(p, ":"); s; s = strtok(NULL, ":")) {
485 s = xasprintf(tpl, s, type);
486 if (stat(s, &st) == 0)
487 break;
488 free(s);
489 }
490 free(p);
491 return s;
492}
493#endif
494
495static int progress_active(void) 460static int progress_active(void)
496{ 461{
497 struct fsck_instance *inst; 462 struct fsck_instance *inst;
@@ -588,18 +553,21 @@ static int execute(const char *type, const char *device, const char *mntpt,
588/* 553/*
589 * Send a signal to all outstanding fsck child processes 554 * Send a signal to all outstanding fsck child processes
590 */ 555 */
591static int kill_all(int signum) 556static void kill_all_if_cancel_requested(void)
592{ 557{
558 static int kill_sent;
559
593 struct fsck_instance *inst; 560 struct fsck_instance *inst;
594 int n = 0; 561
562 if (!cancel_requested || kill_sent)
563 return;
595 564
596 for (inst = instance_list; inst; inst = inst->next) { 565 for (inst = instance_list; inst; inst = inst->next) {
597 if (inst->flags & FLAG_DONE) 566 if (inst->flags & FLAG_DONE)
598 continue; 567 continue;
599 kill(inst->pid, signum); 568 kill(inst->pid, SIGTERM);
600 n++;
601 } 569 }
602 return n; 570 kill_sent = 1;
603} 571}
604 572
605/* 573/*
@@ -637,14 +605,11 @@ static struct fsck_instance *wait_one(int flags)
637 605
638 do { 606 do {
639 pid = waitpid(-1, &status, flags); 607 pid = waitpid(-1, &status, flags);
640 if (cancel_requested && !kill_sent) { 608 kill_all_if_cancel_requested();
641 kill_all(SIGTERM); 609 if (pid == 0 && (flags & WNOHANG))
642 kill_sent++;
643 }
644 if ((pid == 0) && (flags & WNOHANG))
645 return NULL; 610 return NULL;
646 if (pid < 0) { 611 if (pid < 0) {
647 if ((errno == EINTR) || (errno == EAGAIN)) 612 if (errno == EINTR || errno == EAGAIN)
648 continue; 613 continue;
649 if (errno == ECHILD) { 614 if (errno == ECHILD) {
650 bb_error_msg("wait: no more child process?!?"); 615 bb_error_msg("wait: no more child process?!?");
@@ -704,7 +669,7 @@ static struct fsck_instance *wait_one(int flags)
704 break; 669 break;
705 } 670 }
706 } 671 }
707ret_inst: 672 ret_inst:
708 if (prev) 673 if (prev)
709 prev->next = inst->next; 674 prev->next = inst->next;
710 else 675 else
@@ -758,16 +723,16 @@ static void fsck_device(struct fs_info *fs, int interactive)
758 723
759 interpret_type(fs); 724 interpret_type(fs);
760 725
726 type = DEFAULT_FSTYPE;
761 if (strcmp(fs->type, "auto") != 0) 727 if (strcmp(fs->type, "auto") != 0)
762 type = fs->type; 728 type = fs->type;
763 else if (fstype 729 else if (fstype
764 && strncmp(fstype, "no", 2) 730 && (fstype[0] != 'n' || fstype[1] != 'o') /* != "no" */
765 && strncmp(fstype, "opts=", 5) && strncmp(fstype, "loop", 4) 731 && strncmp(fstype, "opts=", 5) != 0
732 && strncmp(fstype, "loop", 4) != 0
766 && !strchr(fstype, ',') 733 && !strchr(fstype, ',')
767 ) 734 )
768 type = fstype; 735 type = fstype;
769 else
770 type = DEFAULT_FSTYPE;
771 736
772 num_running++; 737 num_running++;
773 retval = execute(type, fs->device, fs->mountpt, interactive); 738 retval = execute(type, fs->device, fs->mountpt, interactive);
@@ -1078,17 +1043,14 @@ static int check_all(void)
1078 } else 1043 } else
1079 not_done_yet++; 1044 not_done_yet++;
1080 } 1045 }
1081 if (cancel_requested && !kill_sent) { 1046 kill_all_if_cancel_requested();
1082 kill_all(SIGTERM);
1083 kill_sent++;
1084 }
1085 status |= wait_many(FLAG_WAIT_ATLEAST_ONE); 1047 status |= wait_many(FLAG_WAIT_ATLEAST_ONE);
1086 return status; 1048 return status;
1087} 1049}
1088 1050
1089static void signal_cancel(int sig ATTRIBUTE_UNUSED) 1051static void signal_cancel(int sig ATTRIBUTE_UNUSED)
1090{ 1052{
1091 cancel_requested++; 1053 cancel_requested = 1;
1092} 1054}
1093 1055
1094static int string_to_int(const char *s) 1056static int string_to_int(const char *s)
@@ -1126,9 +1088,6 @@ static void parse_args(int argc, char *argv[])
1126 for (i = 1; i < argc; i++) { 1088 for (i = 1; i < argc; i++) {
1127 arg = argv[i]; 1089 arg = argv[i];
1128 if ((arg[0] == '/' && !opts_for_fsck) || strchr(arg, '=')) { 1090 if ((arg[0] == '/' && !opts_for_fsck) || strchr(arg, '=')) {
1129 if (num_devices >= MAX_DEVICES) {
1130 bb_error_msg_and_die("too many devices");
1131 }
1132#if 0 1091#if 0
1133 char *dev; 1092 char *dev;
1134 dev = blkid_get_devname(cache, arg, NULL); 1093 dev = blkid_get_devname(cache, arg, NULL);
@@ -1138,8 +1097,8 @@ static void parse_args(int argc, char *argv[])
1138 * /proc/partitions isn't found. 1097 * /proc/partitions isn't found.
1139 */ 1098 */
1140 if (access("/proc/partitions", R_OK) < 0) { 1099 if (access("/proc/partitions", R_OK) < 0) {
1141 bb_perror_msg_and_die("cannot open /proc/partitions " 1100 bb_perror_msg_and_die(
1142 "(is /proc mounted?)"); 1101"cannot open /proc/partitions (is /proc mounted?)");
1143 } 1102 }
1144 /* 1103 /*
1145 * Check to see if this is because 1104 * Check to see if this is because
@@ -1147,10 +1106,10 @@ static void parse_args(int argc, char *argv[])
1147 */ 1106 */
1148 if (geteuid()) 1107 if (geteuid())
1149 bb_error_msg_and_die( 1108 bb_error_msg_and_die(
1150 "must be root to scan for matching filesystems: %s\n", arg); 1109"must be root to scan for matching filesystems: %s\n", arg);
1151 else 1110 else
1152 bb_error_msg_and_die( 1111 bb_error_msg_and_die(
1153 "cannot find matching filesystem: %s", arg); 1112"cannot find matching filesystem: %s", arg);
1154 } 1113 }
1155 devices = xrealloc(devices, (num_devices+1) * sizeof(devices[0])); 1114 devices = xrealloc(devices, (num_devices+1) * sizeof(devices[0]));
1156 devices[num_devices++] = dev ? dev : xstrdup(arg); 1115 devices[num_devices++] = dev ? dev : xstrdup(arg);
@@ -1271,8 +1230,6 @@ int fsck_main(int argc, char *argv[])
1271 fstab = "/etc/fstab"; 1230 fstab = "/etc/fstab";
1272 load_fs_info(fstab); 1231 load_fs_info(fstab);
1273 1232
1274 /*fsck_path = e2fs_set_sbin_path();*/
1275
1276 if (num_devices == 1 || serialize) 1233 if (num_devices == 1 || serialize)
1277 interactive = 1; 1234 interactive = 1;
1278 1235
@@ -1286,12 +1243,9 @@ int fsck_main(int argc, char *argv[])
1286 return check_all(); 1243 return check_all();
1287 } 1244 }
1288 1245
1289 for (i = 0 ; i < num_devices; i++) { 1246 for (i = 0; i < num_devices; i++) {
1290 if (cancel_requested) { 1247 if (cancel_requested) {
1291 if (!kill_sent) { 1248 kill_all_if_cancel_requested();
1292 kill_all(SIGTERM);
1293 kill_sent++;
1294 }
1295 break; 1249 break;
1296 } 1250 }
1297 fs = lookup(devices[i]); 1251 fs = lookup(devices[i]);
diff --git a/include/applets.h b/include/applets.h
index d4a5564b1..8586ffc86 100644
--- a/include/applets.h
+++ b/include/applets.h
@@ -102,8 +102,8 @@ USE_DPKG_DEB(APPLET_ODDNAME(dpkg-deb, dpkg_deb, _BB_DIR_USR_BIN, _BB_SUID_NEVER,
102USE_DU(APPLET(du, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) 102USE_DU(APPLET(du, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
103USE_DUMPKMAP(APPLET(dumpkmap, _BB_DIR_BIN, _BB_SUID_NEVER)) 103USE_DUMPKMAP(APPLET(dumpkmap, _BB_DIR_BIN, _BB_SUID_NEVER))
104USE_APP_DUMPLEASES(APPLET(dumpleases, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) 104USE_APP_DUMPLEASES(APPLET(dumpleases, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
105USE_E2FSCK(APPLET(e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER)) 105//USE_E2FSCK(APPLET(e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER))
106USE_E2LABEL(APPLET_NOUSAGE(e2label, tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER)) 106//USE_E2LABEL(APPLET_NOUSAGE(e2label, tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
107USE_ECHO(APPLET(echo, _BB_DIR_BIN, _BB_SUID_NEVER)) 107USE_ECHO(APPLET(echo, _BB_DIR_BIN, _BB_SUID_NEVER))
108USE_ED(APPLET(ed, _BB_DIR_BIN, _BB_SUID_NEVER)) 108USE_ED(APPLET(ed, _BB_DIR_BIN, _BB_SUID_NEVER))
109USE_FEATURE_GREP_EGREP_ALIAS(APPLET_NOUSAGE(egrep, grep, _BB_DIR_BIN, _BB_SUID_NEVER)) 109USE_FEATURE_GREP_EGREP_ALIAS(APPLET_NOUSAGE(egrep, grep, _BB_DIR_BIN, _BB_SUID_NEVER))
@@ -121,13 +121,13 @@ USE_FDFORMAT(APPLET(fdformat, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
121USE_FDISK(APPLET(fdisk, _BB_DIR_SBIN, _BB_SUID_NEVER)) 121USE_FDISK(APPLET(fdisk, _BB_DIR_SBIN, _BB_SUID_NEVER))
122USE_FEATURE_GREP_FGREP_ALIAS(APPLET_NOUSAGE(fgrep, grep, _BB_DIR_BIN, _BB_SUID_NEVER)) 122USE_FEATURE_GREP_FGREP_ALIAS(APPLET_NOUSAGE(fgrep, grep, _BB_DIR_BIN, _BB_SUID_NEVER))
123USE_FIND(APPLET(find, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) 123USE_FIND(APPLET(find, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
124USE_FINDFS(APPLET_NOUSAGE(findfs, tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER)) 124//USE_FINDFS(APPLET_NOUSAGE(findfs, tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
125USE_FOLD(APPLET(fold, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) 125USE_FOLD(APPLET(fold, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
126USE_FREE(APPLET(free, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) 126USE_FREE(APPLET(free, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
127USE_FREERAMDISK(APPLET(freeramdisk, _BB_DIR_SBIN, _BB_SUID_NEVER)) 127USE_FREERAMDISK(APPLET(freeramdisk, _BB_DIR_SBIN, _BB_SUID_NEVER))
128USE_FSCK(APPLET(fsck, _BB_DIR_SBIN, _BB_SUID_NEVER)) 128USE_FSCK(APPLET(fsck, _BB_DIR_SBIN, _BB_SUID_NEVER))
129USE_E2FSCK(APPLET_NOUSAGE(fsck.ext2, e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER)) 129//USE_E2FSCK(APPLET_NOUSAGE(fsck.ext2, e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER))
130USE_E2FSCK(APPLET_NOUSAGE(fsck.ext3, e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER)) 130//USE_E2FSCK(APPLET_NOUSAGE(fsck.ext3, e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER))
131USE_FSCK_MINIX(APPLET_ODDNAME(fsck.minix, fsck_minix, _BB_DIR_SBIN, _BB_SUID_NEVER, fsck_minix)) 131USE_FSCK_MINIX(APPLET_ODDNAME(fsck.minix, fsck_minix, _BB_DIR_SBIN, _BB_SUID_NEVER, fsck_minix))
132USE_FTPGET(APPLET_ODDNAME(ftpget, ftpgetput, _BB_DIR_USR_BIN, _BB_SUID_NEVER,ftpget)) 132USE_FTPGET(APPLET_ODDNAME(ftpget, ftpgetput, _BB_DIR_USR_BIN, _BB_SUID_NEVER,ftpget))
133USE_FTPPUT(APPLET_ODDNAME(ftpput, ftpgetput, _BB_DIR_USR_BIN, _BB_SUID_NEVER,ftpput)) 133USE_FTPPUT(APPLET_ODDNAME(ftpput, ftpgetput, _BB_DIR_USR_BIN, _BB_SUID_NEVER,ftpput))
@@ -191,10 +191,10 @@ USE_MD5SUM(APPLET_ODDNAME(md5sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER,
191USE_MDEV(APPLET(mdev, _BB_DIR_SBIN, _BB_SUID_NEVER)) 191USE_MDEV(APPLET(mdev, _BB_DIR_SBIN, _BB_SUID_NEVER))
192USE_MESG(APPLET(mesg, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) 192USE_MESG(APPLET(mesg, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
193USE_MKDIR(APPLET(mkdir, _BB_DIR_BIN, _BB_SUID_NEVER)) 193USE_MKDIR(APPLET(mkdir, _BB_DIR_BIN, _BB_SUID_NEVER))
194USE_MKE2FS(APPLET(mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER)) 194//USE_MKE2FS(APPLET(mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
195USE_MKFIFO(APPLET(mkfifo, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) 195USE_MKFIFO(APPLET(mkfifo, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
196USE_MKE2FS(APPLET_NOUSAGE(mkfs.ext2, mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER)) 196//USE_MKE2FS(APPLET_NOUSAGE(mkfs.ext2, mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
197USE_MKE2FS(APPLET_NOUSAGE(mkfs.ext3, mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER)) 197//USE_MKE2FS(APPLET_NOUSAGE(mkfs.ext3, mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
198USE_MKFS_MINIX(APPLET_ODDNAME(mkfs.minix, mkfs_minix, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_minix)) 198USE_MKFS_MINIX(APPLET_ODDNAME(mkfs.minix, mkfs_minix, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_minix))
199USE_MKNOD(APPLET(mknod, _BB_DIR_BIN, _BB_SUID_NEVER)) 199USE_MKNOD(APPLET(mknod, _BB_DIR_BIN, _BB_SUID_NEVER))
200USE_MKSWAP(APPLET(mkswap, _BB_DIR_SBIN, _BB_SUID_NEVER)) 200USE_MKSWAP(APPLET(mkswap, _BB_DIR_SBIN, _BB_SUID_NEVER))
@@ -294,7 +294,7 @@ USE_TR(APPLET(tr, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
294USE_TRACEROUTE(APPLET(traceroute, _BB_DIR_USR_BIN, _BB_SUID_MAYBE)) 294USE_TRACEROUTE(APPLET(traceroute, _BB_DIR_USR_BIN, _BB_SUID_MAYBE))
295USE_TRUE(APPLET(true, _BB_DIR_BIN, _BB_SUID_NEVER)) 295USE_TRUE(APPLET(true, _BB_DIR_BIN, _BB_SUID_NEVER))
296USE_TTY(APPLET(tty, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) 296USE_TTY(APPLET(tty, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
297USE_TUNE2FS(APPLET(tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER)) 297//USE_TUNE2FS(APPLET(tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
298USE_APP_UDHCPC(APPLET(udhcpc, _BB_DIR_SBIN, _BB_SUID_NEVER)) 298USE_APP_UDHCPC(APPLET(udhcpc, _BB_DIR_SBIN, _BB_SUID_NEVER))
299USE_APP_UDHCPD(APPLET(udhcpd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) 299USE_APP_UDHCPD(APPLET(udhcpd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
300USE_UMOUNT(APPLET(umount, _BB_DIR_BIN, _BB_SUID_NEVER)) 300USE_UMOUNT(APPLET(umount, _BB_DIR_BIN, _BB_SUID_NEVER))
diff --git a/include/libbb.h b/include/libbb.h
index d94dd598e..68e4851db 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -190,6 +190,7 @@ extern int sysinfo(struct sysinfo* info);
190extern void chomp(char *s); 190extern void chomp(char *s);
191extern void trim(char *s); 191extern void trim(char *s);
192extern char *skip_whitespace(const char *); 192extern char *skip_whitespace(const char *);
193extern char *skip_non_whitespace(const char *);
193 194
194extern const char *bb_mode_string(int mode); 195extern const char *bb_mode_string(int mode);
195extern int is_directory(const char *name, int followLinks, struct stat *statBuf); 196extern int is_directory(const char *name, int followLinks, struct stat *statBuf);
diff --git a/include/usage.h b/include/usage.h
index 59b052826..42b51fa81 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -932,7 +932,7 @@
932 "$ freeramdisk /dev/ram2\n" 932 "$ freeramdisk /dev/ram2\n"
933 933
934#define fsck_trivial_usage \ 934#define fsck_trivial_usage \
935 "[-ANPRTV] [ -C [ fd ] ] [-t fstype] [fs-options] [filesys ...]" 935 "[-ANPRTV] [ -C fd ] [-t fstype] [fs-options] [filesys ...]"
936#define fsck_full_usage \ 936#define fsck_full_usage \
937 "Check and repair filesystems" \ 937 "Check and repair filesystems" \
938 "\n\nOptions:\n" \ 938 "\n\nOptions:\n" \
@@ -941,9 +941,9 @@
941 " -P When using -A, check filesystems in parallel\n" \ 941 " -P When using -A, check filesystems in parallel\n" \
942 " -R When using -A, skip the root filesystem\n" \ 942 " -R When using -A, skip the root filesystem\n" \
943 " -T Don't show title on startup\n" \ 943 " -T Don't show title on startup\n" \
944 " -V Verbose mode\n" \ 944 " -V Verbose\n" \
945 " -C Write status information to specified filedescriptor\n" \ 945 " -C n Write status information to specified filedescriptor\n" \
946 " -t List of filesystem types to check" 946 " -t type List of filesystem types to check"
947 947
948#define fsck_minix_trivial_usage \ 948#define fsck_minix_trivial_usage \
949 "[-larvsmf] /dev/name" 949 "[-larvsmf] /dev/name"
diff --git a/libbb/dump.c b/libbb/dump.c
index d6e31b9b1..06b73c955 100644
--- a/libbb/dump.c
+++ b/libbb/dump.c
@@ -724,7 +724,9 @@ void bb_dump_add(const char *fmt)
724 724
725 /* byte count */ 725 /* byte count */
726 if (isdigit(*p)) { 726 if (isdigit(*p)) {
727 for (savep = p; isdigit(*p); ++p); 727// TODO: use bb_strtou
728 savep = p;
729 do p++; while(isdigit(*p));
728 if (!isspace(*p)) { 730 if (!isspace(*p)) {
729 bb_error_msg_and_die("bad format {%s}", fmt); 731 bb_error_msg_and_die("bad format {%s}", fmt);
730 } 732 }
diff --git a/libbb/skip_whitespace.c b/libbb/skip_whitespace.c
index 02c1f5828..bdfb97d70 100644
--- a/libbb/skip_whitespace.c
+++ b/libbb/skip_whitespace.c
@@ -7,12 +7,19 @@
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 */ 8 */
9 9
10#include <ctype.h>
11#include "libbb.h" 10#include "libbb.h"
12 11
13char *skip_whitespace(const char *s) 12char *skip_whitespace(const char *s)
14{ 13{
14 /* NB: isspace('0') returns 0 */
15 while (isspace(*s)) ++s; 15 while (isspace(*s)) ++s;
16 16
17 return (char *) s; 17 return (char *) s;
18} 18}
19
20char *skip_non_whitespace(const char *s)
21{
22 while (*s && !isspace(*s)) ++s;
23
24 return (char *) s;
25}