err, added 2 to the wrong var :) also touchup the option detection to shrink size
This commit is contained in:
parent
3ba93c0438
commit
b3a6ec3e62
@ -135,22 +135,16 @@ static int cmp_files(char **infiles)
|
|||||||
|
|
||||||
int comm_main(int argc, char **argv)
|
int comm_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
unsigned long opt;
|
unsigned long flags;
|
||||||
only_file_1 = 1;
|
|
||||||
only_file_2 = 1;
|
|
||||||
both = 1;
|
|
||||||
|
|
||||||
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();
|
bb_show_usage();
|
||||||
|
|
||||||
if (opt & COMM_OPT_1)
|
only_file_1 = !(flags & COMM_OPT_1);
|
||||||
only_file_1 = 0;
|
only_file_2 = !(flags & COMM_OPT_2);
|
||||||
if (opt & COMM_OPT_2)
|
both = !(flags & COMM_OPT_3);
|
||||||
only_file_2 = 0;
|
|
||||||
if (opt & COMM_OPT_3)
|
|
||||||
both = 0;
|
|
||||||
|
|
||||||
exit(cmp_files(argv + optind) == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
exit(cmp_files(argv + optind) == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user