shuf: simplify check that we have at least one FILE
function old new delta .rodata 103190 103194 +4 packed_usage 33541 33537 -4 shred_main 354 337 -17 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 4/-21) Total: -17 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
		| @@ -15,7 +15,7 @@ | |||||||
| //kbuild:lib-$(CONFIG_SHRED) += shred.o | //kbuild:lib-$(CONFIG_SHRED) += shred.o | ||||||
|  |  | ||||||
| //usage:#define shred_trivial_usage | //usage:#define shred_trivial_usage | ||||||
| //usage:       "FILE..." | //usage:       "[-fuz] [-n N] FILE..." | ||||||
| //usage:#define shred_full_usage "\n\n" | //usage:#define shred_full_usage "\n\n" | ||||||
| //usage:       "Overwrite/delete FILEs\n" | //usage:       "Overwrite/delete FILEs\n" | ||||||
| //usage:     "\n	-f	Chmod to ensure writability" | //usage:     "\n	-f	Chmod to ensure writability" | ||||||
| @@ -54,16 +54,13 @@ int shred_main(int argc UNUSED_PARAM, char **argv) | |||||||
| 		OPT_x = (1 << 5), | 		OPT_x = (1 << 5), | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	opt = getopt32(argv, "fuzn:+vx", &num_iter); | 	opt = getopt32(argv, "^" "fuzn:+vx" "\0" "-1"/*min 1 arg*/, &num_iter); | ||||||
| 	argv += optind; | 	argv += optind; | ||||||
|  |  | ||||||
| 	zero_fd = xopen("/dev/zero", O_RDONLY); | 	zero_fd = xopen("/dev/zero", O_RDONLY); | ||||||
| 	if (num_iter != 0) | 	if (num_iter != 0) | ||||||
| 		rand_fd = xopen("/dev/urandom", O_RDONLY); | 		rand_fd = xopen("/dev/urandom", O_RDONLY); | ||||||
|  |  | ||||||
| 	if (!*argv) |  | ||||||
| 		bb_show_usage(); |  | ||||||
|  |  | ||||||
| 	for (;;) { | 	for (;;) { | ||||||
| 		struct stat sb; | 		struct stat sb; | ||||||
| 		const char *fname; | 		const char *fname; | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ | |||||||
| //kbuild:lib-$(CONFIG_STRINGS) += strings.o | //kbuild:lib-$(CONFIG_STRINGS) += strings.o | ||||||
|  |  | ||||||
| //usage:#define strings_trivial_usage | //usage:#define strings_trivial_usage | ||||||
| //usage:       "[-fo] [-t o/d/x] [-n LEN] [FILE]..." | //usage:       "[-fo] [-t o|d|x] [-n LEN] [FILE]..." | ||||||
| //usage:#define strings_full_usage "\n\n" | //usage:#define strings_full_usage "\n\n" | ||||||
| //usage:       "Display printable strings in a binary file\n" | //usage:       "Display printable strings in a binary file\n" | ||||||
| //We usually don't bother user with "nop" options. They work, but are not shown: | //We usually don't bother user with "nop" options. They work, but are not shown: | ||||||
| @@ -26,7 +26,7 @@ | |||||||
| //unimplemented alternative is -d: Only strings from initialized, loaded data sections | //unimplemented alternative is -d: Only strings from initialized, loaded data sections | ||||||
| //usage:     "\n	-f		Precede strings with filenames" | //usage:     "\n	-f		Precede strings with filenames" | ||||||
| //usage:     "\n	-o		Precede strings with octal offsets" | //usage:     "\n	-o		Precede strings with octal offsets" | ||||||
| //usage:     "\n	-t o/d/x	Precede strings with offsets in base 8/10/16" | //usage:     "\n	-t o|d|x	Precede strings with offsets in base 8/10/16" | ||||||
| //usage:     "\n	-n LEN		At least LEN characters form a string (default 4)" | //usage:     "\n	-n LEN		At least LEN characters form a string (default 4)" | ||||||
|  |  | ||||||
| #include "libbb.h" | #include "libbb.h" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user