summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/cvs/diff/diff.c
diff options
context:
space:
mode:
authortholo <tholo@openbsd.org>2001-02-10 18:57:18 +0000
committertholo <tholo@openbsd.org>2001-02-10 18:57:18 +0000
commite77048c1007676349fedef3cd7d0b6b93f74c675 (patch)
tree58c9fb5b629efa79fcb3f91e38071f89cbb04e1f /gnu/usr.bin/cvs/diff/diff.c
parentinstall wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc (diff)
downloadwireguard-openbsd-e77048c1007676349fedef3cd7d0b6b93f74c675.tar.xz
wireguard-openbsd-e77048c1007676349fedef3cd7d0b6b93f74c675.zip
Latest from Cyclic Software
Diffstat (limited to 'gnu/usr.bin/cvs/diff/diff.c')
-rw-r--r--gnu/usr.bin/cvs/diff/diff.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/gnu/usr.bin/cvs/diff/diff.c b/gnu/usr.bin/cvs/diff/diff.c
index e5f7e42bfcd..aa91913fe61 100644
--- a/gnu/usr.bin/cvs/diff/diff.c
+++ b/gnu/usr.bin/cvs/diff/diff.c
@@ -247,11 +247,21 @@ diff_run (argc, argv, out, callbacks_arg)
/* Do our initializations. */
initialize_main (&argc, &argv);
-
- /* Decode the options. */
-
optind_old = optind;
optind = 0;
+
+ /* Set the jump buffer, so that diff may abort execution without
+ terminating the process. */
+ val = setjmp (diff_abort_buf);
+ if (val != 0)
+ {
+ optind = optind_old;
+ if (opened_file)
+ fclose (outfile);
+ return val;
+ }
+
+ /* Decode the options. */
while ((c = getopt_long (argc, argv,
"0123456789abBcC:dD:efF:hHiI:lL:nNpPqrsS:tTuU:vwW:x:X:y",
longopts, 0)) != EOF)
@@ -686,17 +696,6 @@ diff_run (argc, argv, out, callbacks_arg)
}
}
- /* Set the jump buffer, so that diff may abort execution without
- terminating the process. */
- val = setjmp (diff_abort_buf);
- if (val != 0)
- {
- optind = optind_old;
- if (opened_file)
- fclose (outfile);
- return val;
- }
-
val = compare_files (0, argv[optind], 0, argv[optind + 1], 0);
/* Print any messages that were saved up for last. */
@@ -1147,13 +1146,15 @@ compare_files (dir0, name0, dir1, name1, depth)
failed = 1;
}
if (inf[1].desc == -2)
- if (same_files)
- inf[1].desc = inf[0].desc;
- else if ((inf[1].desc = open (inf[1].name, O_RDONLY, 0)) < 0)
- {
- perror_with_name (inf[1].name);
- failed = 1;
- }
+ {
+ if (same_files)
+ inf[1].desc = inf[0].desc;
+ else if ((inf[1].desc = open (inf[1].name, O_RDONLY, 0)) < 0)
+ {
+ perror_with_name (inf[1].name);
+ failed = 1;
+ }
+ }
#if HAVE_SETMODE
if (binary_I_O)