diff options
| author | Mike Frysinger <vapier@gentoo.org> | 2005-05-12 22:41:13 +0000 |
|---|---|---|
| committer | Mike Frysinger <vapier@gentoo.org> | 2005-05-12 22:41:13 +0000 |
| commit | b3a6ec3e623d120eee39bd003c8efdff85c0497a (patch) | |
| tree | 5c9d40532b5fcc7f3f853a77fd2172f519ae3498 /coreutils | |
| parent | 3ba93c04383e8ede9608fa91ed3058db1d213244 (diff) | |
| download | busybox-w32-b3a6ec3e623d120eee39bd003c8efdff85c0497a.tar.gz busybox-w32-b3a6ec3e623d120eee39bd003c8efdff85c0497a.tar.bz2 busybox-w32-b3a6ec3e623d120eee39bd003c8efdff85c0497a.zip | |
err, added 2 to the wrong var :) also touchup the option detection to shrink size
Diffstat (limited to 'coreutils')
| -rw-r--r-- | coreutils/comm.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/coreutils/comm.c b/coreutils/comm.c index f390490e2..2354bac0b 100644 --- a/coreutils/comm.c +++ b/coreutils/comm.c | |||
| @@ -38,7 +38,7 @@ static int only_file_2; | |||
| 38 | static int both; | 38 | static int both; |
| 39 | 39 | ||
| 40 | /* writeline outputs the input given, appropriately aligned according to class */ | 40 | /* writeline outputs the input given, appropriately aligned according to class */ |
| 41 | static void writeline (char *line, int class) | 41 | static void writeline(char *line, int class) |
| 42 | { | 42 | { |
| 43 | switch (class) { | 43 | switch (class) { |
| 44 | case 1: | 44 | case 1: |
| @@ -133,24 +133,18 @@ static int cmp_files(char **infiles) | |||
| 133 | return 0; | 133 | return 0; |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | int comm_main (int argc, char **argv) | 136 | int comm_main(int argc, char **argv) |
| 137 | { | 137 | { |
| 138 | unsigned long opt; | 138 | unsigned long flags; |
| 139 | only_file_1 = 1; | ||
| 140 | only_file_2 = 1; | ||
| 141 | both = 1; | ||
| 142 | 139 | ||
| 143 | opt = bb_getopt_ulflags(argc, argv, "123"); | 140 | flags = bb_getopt_ulflags(argc, argv, "123"); |
| 144 | 141 | ||
| 145 | if (optind != argc + 2) | 142 | if (optind + 2 != argc) |
| 146 | bb_show_usage(); | 143 | bb_show_usage(); |
| 147 | 144 | ||
| 148 | if (opt & COMM_OPT_1) | 145 | only_file_1 = !(flags & COMM_OPT_1); |
| 149 | only_file_1 = 0; | 146 | only_file_2 = !(flags & COMM_OPT_2); |
| 150 | if (opt & COMM_OPT_2) | 147 | both = !(flags & COMM_OPT_3); |
| 151 | only_file_2 = 0; | ||
| 152 | if (opt & COMM_OPT_3) | ||
| 153 | both = 0; | ||
| 154 | 148 | ||
| 155 | exit(cmp_files(argv + optind) == 0 ? EXIT_SUCCESS : EXIT_FAILURE); | 149 | exit(cmp_files(argv + optind) == 0 ? EXIT_SUCCESS : EXIT_FAILURE); |
| 156 | } | 150 | } |
