diff options
author | 1999-02-28 21:30:22 +0000 | |
---|---|---|
committer | 1999-02-28 21:30:22 +0000 | |
commit | c71bc7e269286e43816004eb0fcd7a55f036cd69 (patch) | |
tree | 794eb682ed86bb344bf2e65b4bee5ea179297b82 /gnu/usr.bin/cvs/src/diff.c | |
parent | conditionalize use of sbus_testdma() (diff) | |
download | wireguard-openbsd-c71bc7e269286e43816004eb0fcd7a55f036cd69.tar.xz wireguard-openbsd-c71bc7e269286e43816004eb0fcd7a55f036cd69.zip |
Latest version from Cyclic
Diffstat (limited to 'gnu/usr.bin/cvs/src/diff.c')
-rw-r--r-- | gnu/usr.bin/cvs/src/diff.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/gnu/usr.bin/cvs/src/diff.c b/gnu/usr.bin/cvs/src/diff.c index 341c04c248f..aa35885af30 100644 --- a/gnu/usr.bin/cvs/src/diff.c +++ b/gnu/usr.bin/cvs/src/diff.c @@ -40,7 +40,13 @@ static enum diff_file diff_file_nodiff PROTO ((struct file_info *finfo, static int diff_fileproc PROTO ((void *callerdat, struct file_info *finfo)); static void diff_mark_errors PROTO((int err)); + +/* Global variables. Would be cleaner if we just put this stuff in a + struct like log.c does. */ + +/* Command line tags, from -r option. Points into argv. */ static char *diff_rev1, *diff_rev2; +/* Command line dates, from -D option. Malloc'd. */ static char *diff_date1, *diff_date2; static char *use_rev1, *use_rev2; static int have_rev1_label, have_rev2_label; @@ -224,15 +230,19 @@ diff (argc, argv) * non-recursive/recursive diff. */ - /* For server, need to be able to do this command more than once - (according to the protocol spec, even if the current client - doesn't use it). */ + /* Clean out our global variables (multiroot can call us multiple + times and the server can too, if the client sends several + diff commands). */ if (opts == NULL) { opts_allocated = 1; opts = xmalloc (opts_allocated); } opts[0] = '\0'; + diff_rev1 = NULL; + diff_rev2 = NULL; + diff_date1 = NULL; + diff_date2 = NULL; optind = 0; while ((c = getopt_long (argc, argv, @@ -353,17 +363,18 @@ diff (argc, argv) if (diff_date2) client_senddate (diff_date2); - send_file_names (argc, argv, SEND_EXPAND_WILD); - /* Send the current files unless diffing two revs from the archive */ if (diff_rev2 == NULL && diff_date2 == NULL) send_files (argc, argv, local, 0, 0); else send_files (argc, argv, local, 0, SEND_NO_CONTENTS); + send_file_names (argc, argv, SEND_EXPAND_WILD); + send_to_server ("diff\012", 0); err = get_responses_and_close (); free (options); + options = NULL; return (err); } #endif @@ -386,6 +397,13 @@ diff (argc, argv) /* clean up */ free (options); + options = NULL; + + if (diff_date1 != NULL) + free (diff_date1); + if (diff_date2 != NULL) + free (diff_date2); + return (err); } |