- int stage1, stage2, i;
-
- read_cache();
- while (1 < ac && av[1][0] == '-') {
- const char *arg = av[1];
- if (!strcmp(arg, "-r"))
- ; /* as usual */
- else if (!strcmp(arg, "-p"))
- diff_output_format = DIFF_FORMAT_PATCH;
- else if (!strncmp(arg, "-B", 2)) {
- if ((diff_break_opt = diff_scoreopt_parse(arg)) == -1)
- usage(diff_stages_usage);
- }
- else if (!strncmp(arg, "-M", 2)) {
- detect_rename = DIFF_DETECT_RENAME;
- if ((diff_score_opt = diff_scoreopt_parse(arg)) == -1)
- usage(diff_stages_usage);
- }
- else if (!strncmp(arg, "-C", 2)) {
- detect_rename = DIFF_DETECT_COPY;
- if ((diff_score_opt = diff_scoreopt_parse(arg)) == -1)
- usage(diff_stages_usage);
- }
- else if (!strcmp(arg, "-z"))
- diff_output_format = DIFF_FORMAT_MACHINE;
- else if (!strcmp(arg, "-R"))
- diff_setup_opt |= DIFF_SETUP_REVERSE;
- else if (!strncmp(arg, "-S", 2))
- pickaxe = arg + 2;
- else if (!strncmp(arg, "-O", 2))
- orderfile = arg + 2;
- else if (!strcmp(arg, "--pickaxe-all"))
- pickaxe_opts = DIFF_PICKAXE_ALL;
- else
- usage(diff_stages_usage);
- ac--; av++;
- }
-
- if (ac < 3 ||
- sscanf(av[1], "%d", &stage1) != 1 ||
- ! (0 <= stage1 && stage1 <= 3) ||
- sscanf(av[2], "%d", &stage2) != 1 ||
- ! (0 <= stage2 && stage2 <= 3))
- usage(diff_stages_usage);
-
- av += 3; /* The rest from av[0] are for paths restriction. */
- diff_setup(diff_setup_opt);
-
- i = 0;