summaryrefslogtreecommitdiff
path: root/coreutils/comm.c
diff options
context:
space:
mode:
authorMike Frysinger2005-05-12 22:41:13 +0000
committerMike Frysinger2005-05-12 22:41:13 +0000
commitb3a6ec3e623d120eee39bd003c8efdff85c0497a (patch)
tree5c9d40532b5fcc7f3f853a77fd2172f519ae3498 /coreutils/comm.c
parent3ba93c04383e8ede9608fa91ed3058db1d213244 (diff)
downloadbusybox-b3a6ec3e623d120eee39bd003c8efdff85c0497a.zip
busybox-b3a6ec3e623d120eee39bd003c8efdff85c0497a.tar.gz
err, added 2 to the wrong var :) also touchup the option detection to shrink size
Diffstat (limited to 'coreutils/comm.c')
-rw-r--r--coreutils/comm.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/coreutils/comm.c b/coreutils/comm.c
index f390490..2354bac 100644
--- a/coreutils/comm.c
+++ b/coreutils/comm.c
@@ -38,7 +38,7 @@ static int only_file_2;
static int both;
/* writeline outputs the input given, appropriately aligned according to class */
-static void writeline (char *line, int class)
+static void writeline(char *line, int class)
{
switch (class) {
case 1:
@@ -133,24 +133,18 @@ static int cmp_files(char **infiles)
return 0;
}
-int comm_main (int argc, char **argv)
+int comm_main(int argc, char **argv)
{
- unsigned long opt;
- only_file_1 = 1;
- only_file_2 = 1;
- both = 1;
+ unsigned long flags;
- opt = bb_getopt_ulflags(argc, argv, "123");
+ flags = bb_getopt_ulflags(argc, argv, "123");
- if (optind != argc + 2)
+ if (optind + 2 != argc)
bb_show_usage();
- if (opt & COMM_OPT_1)
- only_file_1 = 0;
- if (opt & COMM_OPT_2)
- only_file_2 = 0;
- if (opt & COMM_OPT_3)
- both = 0;
+ only_file_1 = !(flags & COMM_OPT_1);
+ only_file_2 = !(flags & COMM_OPT_2);
+ both = !(flags & COMM_OPT_3);
exit(cmp_files(argv + optind) == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}