aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorvapier <vapier@69ca8d6d-28ef-0310-b511-8ec308f3f277>2005-05-12 22:41:13 +0000
committervapier <vapier@69ca8d6d-28ef-0310-b511-8ec308f3f277>2005-05-12 22:41:13 +0000
commit96f9e9bfa68e95864286671c2842fec333922eb8 (patch)
tree5c9d40532b5fcc7f3f853a77fd2172f519ae3498 /coreutils
parent3fb27f43ea37f24b879ca6c7265ab26c51910f05 (diff)
downloadbusybox-w32-96f9e9bfa68e95864286671c2842fec333922eb8.tar.gz
busybox-w32-96f9e9bfa68e95864286671c2842fec333922eb8.tar.bz2
busybox-w32-96f9e9bfa68e95864286671c2842fec333922eb8.zip
err, added 2 to the wrong var :) also touchup the option detection to shrink size
git-svn-id: svn://busybox.net/trunk/busybox@10316 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/comm.c22
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;
38static int both; 38static 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 */
41static void writeline (char *line, int class) 41static 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
136int comm_main (int argc, char **argv) 136int 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}