From 2ad6f3dee6bc54535003f4ab26bbc587b7efa38c Mon Sep 17 00:00:00 2001 From: rgrimes Date: Tue, 30 May 1995 05:05:38 +0000 Subject: Remove trailing whitespace. --- gnu/usr.bin/patch/EXTERN.h | 9 +++-- gnu/usr.bin/patch/INTERN.h | 9 +++-- gnu/usr.bin/patch/Makefile | 2 +- gnu/usr.bin/patch/backupfile.c | 12 +++---- gnu/usr.bin/patch/common.h | 12 ++++--- gnu/usr.bin/patch/config.h | 2 +- gnu/usr.bin/patch/inp.c | 16 +++++---- gnu/usr.bin/patch/inp.h | 9 +++-- gnu/usr.bin/patch/patch.c | 76 ++++++++++++++++++++++-------------------- gnu/usr.bin/patch/pch.c | 39 ++++++++++++---------- gnu/usr.bin/patch/pch.h | 11 +++--- gnu/usr.bin/patch/util.c | 6 ++-- gnu/usr.bin/patch/util.h | 9 +++-- gnu/usr.bin/patch/version.c | 9 +++-- gnu/usr.bin/patch/version.h | 9 +++-- 15 files changed, 133 insertions(+), 97 deletions(-) (limited to 'gnu/usr.bin/patch') diff --git a/gnu/usr.bin/patch/EXTERN.h b/gnu/usr.bin/patch/EXTERN.h index bdc1ef9..96dd888 100644 --- a/gnu/usr.bin/patch/EXTERN.h +++ b/gnu/usr.bin/patch/EXTERN.h @@ -1,9 +1,12 @@ -/* $Header: EXTERN.h,v 2.0 86/09/17 15:35:37 lwall Exp $ +/* $Header: /home/ncvs/src/gnu/usr.bin/patch/EXTERN.h,v 1.1.1.1 1993/06/19 14:21:52 paul Exp $ + * + * $Log: EXTERN.h,v $ + * Revision 1.1.1.1 1993/06/19 14:21:52 paul + * b-maked patch-2.10 * - * $Log: EXTERN.h,v $ * Revision 2.0 86/09/17 15:35:37 lwall * Baseline for netwide release. - * + * */ #ifdef EXT diff --git a/gnu/usr.bin/patch/INTERN.h b/gnu/usr.bin/patch/INTERN.h index 38574ef..b718b1d 100644 --- a/gnu/usr.bin/patch/INTERN.h +++ b/gnu/usr.bin/patch/INTERN.h @@ -1,9 +1,12 @@ -/* $Header: INTERN.h,v 2.0 86/09/17 15:35:58 lwall Exp $ +/* $Header: /home/ncvs/src/gnu/usr.bin/patch/INTERN.h,v 1.1.1.1 1993/06/19 14:21:52 paul Exp $ + * + * $Log: INTERN.h,v $ + * Revision 1.1.1.1 1993/06/19 14:21:52 paul + * b-maked patch-2.10 * - * $Log: INTERN.h,v $ * Revision 2.0 86/09/17 15:35:58 lwall * Baseline for netwide release. - * + * */ #ifdef EXT diff --git a/gnu/usr.bin/patch/Makefile b/gnu/usr.bin/patch/Makefile index d614e89..4d5fad2 100644 --- a/gnu/usr.bin/patch/Makefile +++ b/gnu/usr.bin/patch/Makefile @@ -1,6 +1,6 @@ PROG= patch SRCS = backupfile.c getopt.c getopt1.c inp.c patch.c pch.c util.c \ - version.c + version.c CFLAGS += -DHAVE_CONFIG_H MAN= patch.1 .include diff --git a/gnu/usr.bin/patch/backupfile.c b/gnu/usr.bin/patch/backupfile.c index d7eb5874..7779056 100644 --- a/gnu/usr.bin/patch/backupfile.c +++ b/gnu/usr.bin/patch/backupfile.c @@ -146,11 +146,11 @@ max_backup_version (file, dir) int highest_version; int this_version; int file_name_length; - + dirp = opendir (dir); if (!dirp) return 0; - + highest_version = 0; file_name_length = strlen (file); @@ -158,7 +158,7 @@ max_backup_version (file, dir) { if (!REAL_DIR_ENTRY (dp) || NLENGTH (dp) <= file_name_length) continue; - + this_version = version_number (file, dp->d_name, file_name_length); if (this_version > highest_version) highest_version = this_version; @@ -196,7 +196,7 @@ version_number (base, backup, base_length) { int version; char *p; - + version = 0; if (!strncmp (base, backup, base_length) && ISDIGIT (backup[base_length])) { @@ -276,9 +276,9 @@ argmatch (arg, optlist) int arglen; /* Length of ARG. */ int matchind = -1; /* Index of first nonexact match. */ int ambiguous = 0; /* If nonzero, multiple nonexact match(es). */ - + arglen = strlen (arg); - + /* Test all elements for either exact match or abbreviated matches. */ for (i = 0; optlist[i]; i++) { diff --git a/gnu/usr.bin/patch/common.h b/gnu/usr.bin/patch/common.h index 9bae5bd..4bb99e0 100644 --- a/gnu/usr.bin/patch/common.h +++ b/gnu/usr.bin/patch/common.h @@ -1,18 +1,22 @@ -/* $Header: /a/cvs/386BSD/src/gnu/patch/common.h,v 1.1.1.1 1993/06/19 14:21:52 paul Exp $ +/* $Header: /home/ncvs/src/gnu/usr.bin/patch/common.h,v 1.2 1993/09/22 16:51:03 rich Exp $ * * $Log: common.h,v $ + * Revision 1.2 1993/09/22 16:51:03 rich + * Increaed the fixed static buffer sizes and maximum hunk size that + * otherwise causes the XFree86 1.3 patch set to fail. + * * Revision 1.1.1.1 1993/06/19 14:21:52 paul * b-maked patch-2.10 * * Revision 2.0.1.2 88/06/22 20:44:53 lwall * patch12: sprintf was declared wrong - * + * * Revision 2.0.1.1 88/06/03 15:01:56 lwall * patch10: support for shorter extensions. - * + * * Revision 2.0 86/09/17 15:36:39 lwall * Baseline for netwide release. - * + * */ #define DEBUGGING diff --git a/gnu/usr.bin/patch/config.h b/gnu/usr.bin/patch/config.h index 71623d7..177a8c5 100644 --- a/gnu/usr.bin/patch/config.h +++ b/gnu/usr.bin/patch/config.h @@ -5,7 +5,7 @@ /* #undef const */ /* Define if the system supports file names longer than 14 characters. */ -#define HAVE_LONG_FILE_NAMES +#define HAVE_LONG_FILE_NAMES /* Define if the system has pathconf(). */ /* #undef HAVE_PATHCONF */ diff --git a/gnu/usr.bin/patch/inp.c b/gnu/usr.bin/patch/inp.c index 0d0e6af..e8e1531 100644 --- a/gnu/usr.bin/patch/inp.c +++ b/gnu/usr.bin/patch/inp.c @@ -1,15 +1,19 @@ -/* $Header: /home/ncvs/src/gnu/usr.bin/patch/inp.c,v 1.1.1.1 1993/06/19 14:21:52 paul Exp $ +/* $Header: /home/ncvs/src/gnu/usr.bin/patch/inp.c,v 1.2 1995/01/12 22:09:39 hsu Exp $ * * $Log: inp.c,v $ + * Revision 1.2 1995/01/12 22:09:39 hsu + * Fix bug that created new files even when running in -C check mode. + * Reviewed by: phk + * * Revision 1.1.1.1 1993/06/19 14:21:52 paul * b-maked patch-2.10 * * Revision 2.0.1.1 88/06/03 15:06:13 lwall * patch10: made a little smarter about sccs files - * + * * Revision 2.0 86/09/17 15:37:02 lwall * Baseline for netwide release. - * + * */ #include "EXTERN.h" @@ -210,7 +214,7 @@ char *filename; free((char *)i_womp); return FALSE; } - + /* now scan the buffer and build pointer array */ iline = 1; @@ -223,7 +227,7 @@ char *filename; /* now check for revision, if any */ - if (revision != Nullch) { + if (revision != Nullch) { if (!rev_in_string(i_womp)) { if (force) { if (verbose) @@ -369,7 +373,7 @@ char *string; if (strnEQ(string,revision,patlen) && isspace(string[patlen])) return TRUE; for (s = string; *s; s++) { - if (isspace(*s) && strnEQ(s+1, revision, patlen) && + if (isspace(*s) && strnEQ(s+1, revision, patlen) && isspace(s[patlen+1] )) { return TRUE; } diff --git a/gnu/usr.bin/patch/inp.h b/gnu/usr.bin/patch/inp.h index c6d2a91..ea07ee8 100644 --- a/gnu/usr.bin/patch/inp.h +++ b/gnu/usr.bin/patch/inp.h @@ -1,9 +1,12 @@ -/* $Header: inp.h,v 2.0 86/09/17 15:37:25 lwall Exp $ +/* $Header: /home/ncvs/src/gnu/usr.bin/patch/inp.h,v 1.1.1.1 1993/06/19 14:21:52 paul Exp $ + * + * $Log: inp.h,v $ + * Revision 1.1.1.1 1993/06/19 14:21:52 paul + * b-maked patch-2.10 * - * $Log: inp.h,v $ * Revision 2.0 86/09/17 15:37:25 lwall * Baseline for netwide release. - * + * */ EXT LINENUM input_lines INIT(0); /* how long is input file in lines */ diff --git a/gnu/usr.bin/patch/patch.c b/gnu/usr.bin/patch/patch.c index c34ca83..b03d065 100644 --- a/gnu/usr.bin/patch/patch.c +++ b/gnu/usr.bin/patch/patch.c @@ -1,5 +1,5 @@ char rcsid[] = - "$Header: /home/ncvs/src/gnu/usr.bin/patch/patch.c,v 1.4 1994/02/25 21:46:04 phk Exp $"; + "$Header: /home/ncvs/src/gnu/usr.bin/patch/patch.c,v 1.5 1995/01/12 22:09:40 hsu Exp $"; /* patch - a program to apply diffs to original files * @@ -9,6 +9,10 @@ char rcsid[] = * money off of it, or pretend that you wrote it. * * $Log: patch.c,v $ + * Revision 1.5 1995/01/12 22:09:40 hsu + * Fix bug that created new files even when running in -C check mode. + * Reviewed by: phk + * * Revision 1.4 1994/02/25 21:46:04 phk * added the -C/-check again. * @@ -25,83 +29,83 @@ char rcsid[] = * * Revision 2.0.2.0 90/05/01 22:17:50 davison * patch12u: unidiff support added - * + * * Revision 2.0.1.6 88/06/22 20:46:39 lwall * patch12: rindex() wasn't declared - * + * * Revision 2.0.1.5 88/06/03 15:09:37 lwall * patch10: exit code improved. * patch10: better support for non-flexfilenames. - * + * * Revision 2.0.1.4 87/02/16 14:00:04 lwall * Short replacement caused spurious "Out of sync" message. - * + * * Revision 2.0.1.3 87/01/30 22:45:50 lwall * Improved diagnostic on sync error. * Moved do_ed_script() to pch.c. - * + * * Revision 2.0.1.2 86/11/21 09:39:15 lwall * Fuzz factor caused offset of installed lines. - * + * * Revision 2.0.1.1 86/10/29 13:10:22 lwall * Backwards search could terminate prematurely. - * + * * Revision 2.0 86/09/17 15:37:32 lwall * Baseline for netwide release. - * + * * Revision 1.5 86/08/01 20:53:24 lwall * Changed some %d's to %ld's. * Linted. - * + * * Revision 1.4 86/08/01 19:17:29 lwall * Fixes for machines that can't vararg. * Added fuzz factor. * Generalized -p. * General cleanup. - * + * * 85/08/15 van%ucbmonet@berkeley * Changes for 4.3bsd diff -c. * * Revision 1.3 85/03/26 15:07:43 lwall * Frozen. - * + * * Revision 1.2.1.9 85/03/12 17:03:35 lwall * Changed pfp->_file to fileno(pfp). - * + * * Revision 1.2.1.8 85/03/12 16:30:43 lwall * Check i_ptr and i_womp to make sure they aren't null before freeing. * Also allow ed output to be suppressed. - * + * * Revision 1.2.1.7 85/03/12 15:56:13 lwall * Added -p option from jromine@uci-750a. - * + * * Revision 1.2.1.6 85/03/12 12:12:51 lwall * Now checks for normalness of file to patch. - * + * * Revision 1.2.1.5 85/03/12 11:52:12 lwall * Added -D (#ifdef) option from joe@fluke. - * + * * Revision 1.2.1.4 84/12/06 11:14:15 lwall * Made smarter about SCCS subdirectories. - * + * * Revision 1.2.1.3 84/12/05 11:18:43 lwall * Added -l switch to do loose string comparison. - * + * * Revision 1.2.1.2 84/12/04 09:47:13 lwall * Failed hunk count not reset on multiple patch file. - * + * * Revision 1.2.1.1 84/12/04 09:42:37 lwall * Branch for sdcrdcf changes. - * + * * Revision 1.2 84/11/29 13:29:51 lwall * Linted. Identifiers uniqified. Fixed i_ptr malloc() bug. Fixed * multiple calls to mktemp(). Will now work on machines that can only * read 32767 chars. Added -R option for diffs with new and old swapped. * Various cosmetic changes. - * + * * Revision 1.1 84/11/09 17:03:58 lwall * Initial revision - * + * */ #include "INTERN.h" @@ -214,7 +218,7 @@ char **argv; Argc = argc; Argv = argv; get_some_switches(); - + /* make sure we clean up /tmp in case of disaster */ set_signals(0); @@ -226,27 +230,27 @@ char **argv; if (outname == Nullch) outname = savestr(filearg[0]); - + /* for ed script just up and do it and exit */ if (diff_type == ED_DIFF) { do_ed_script(); continue; } - + /* initialize the patched file */ if (!skip_rest_of_patch) init_output(TMPOUTNAME); - + /* initialize reject file */ init_reject(TMPREJNAME); - + /* find out where all the lines are */ if (!skip_rest_of_patch) scan_input(filearg[0]); - + /* from here on, open no standard i/o files, because malloc */ /* might misfire and we can't catch it easily */ - + /* apply each hunk of patch */ hunk = 0; failed = 0; @@ -356,13 +360,13 @@ char **argv; rejfp = Nullfp; continue; } - + assert(hunk); - + /* finish spewing out the new file */ if (!skip_rest_of_patch) spew_output(); - + /* and put the output where desired */ ignore_signals(); if (!skip_rest_of_patch) { @@ -630,7 +634,7 @@ LINENUM fuzz; Reg2 LINENUM offset; LINENUM pat_lines = pch_ptrn_lines(); Reg3 LINENUM max_pos_offset = input_lines - first_guess - - pat_lines + 1; + - pat_lines + 1; Reg4 LINENUM max_neg_offset = first_guess - last_frozen_line - 1 + pch_context(); @@ -706,7 +710,7 @@ abort_hunk() fprintf(rejfp, "%c %s", pch_char(i), pfetch(i)); break; default: - fatal1("fatal internal error in abort_hunk\n"); + fatal1("fatal internal error in abort_hunk\n"); } } } @@ -731,7 +735,7 @@ LINENUM where; where--; while (pch_char(new) == '=' || pch_char(new) == '\n') new++; - + while (old <= lastline) { if (pch_char(old) == '-') { copy_till(where + old - 1); diff --git a/gnu/usr.bin/patch/pch.c b/gnu/usr.bin/patch/pch.c index 0a844f2..98f1dd4 100644 --- a/gnu/usr.bin/patch/pch.c +++ b/gnu/usr.bin/patch/pch.c @@ -1,6 +1,9 @@ -/* $Header: /home/cvs/386BSD/src/gnu/usr.bin/patch/pch.c,v 1.3 1994/02/17 22:20:36 jkh Exp $ +/* $Header: /home/ncvs/src/gnu/usr.bin/patch/pch.c,v 1.4 1994/02/25 21:46:07 phk Exp $ * * $Log: pch.c,v $ + * Revision 1.4 1994/02/25 21:46:07 phk + * added the -C/-check again. + * * Revision 1.3 1994/02/17 22:20:36 jkh * Put this back - I was somehow under the erroneous impression that patch was in * ports, until I saw the the commit messages, that is! :-) All changed backed out. @@ -18,29 +21,29 @@ * Revision 2.0.1.7 88/06/03 15:13:28 lwall * patch10: Can now find patches in shar scripts. * patch10: Hunks that swapped and then swapped back could core dump. - * + * * Revision 2.0.1.6 87/06/04 16:18:13 lwall * pch_swap didn't swap p_bfake and p_efake. - * + * * Revision 2.0.1.5 87/01/30 22:47:42 lwall * Improved responses to mangled patches. - * + * * Revision 2.0.1.4 87/01/05 16:59:53 lwall * New-style context diffs caused double call to free(). - * + * * Revision 2.0.1.3 86/11/14 10:08:33 lwall * Fixed problem where a long pattern wouldn't grow the hunk. * Also restored p_input_line when backtracking so error messages are right. - * + * * Revision 2.0.1.2 86/11/03 17:49:52 lwall * New-style delete triggers spurious assertion error. - * + * * Revision 2.0.1.1 86/10/29 15:52:08 lwall * Could falsely report new-style context diff. - * + * * Revision 2.0 86/09/17 15:39:37 lwall * Baseline for netwide release. - * + * */ #include "EXTERN.h" @@ -132,7 +135,7 @@ void grow_hunkmax() { hunkmax *= 2; - /* + /* * Note that on most systems, only the p_line array ever gets fresh memory * since p_len can move into p_line's old space, and p_Char can move into * p_len's old space. Not on PDP-11's however. But it doesn't matter. @@ -269,10 +272,10 @@ intuit_diff_type() else indent++; } - for (t=s; isdigit(*t) || *t == ','; t++) ; + for (t=s; isdigit(*t) || *t == ','; t++) ; this_is_a_command = (isdigit(*s) && (*t == 'd' || *t == 'c' || *t == 'a') ); - if (first_command_line < 0L && this_is_a_command) { + if (first_command_line < 0L && this_is_a_command) { first_command_line = this_line; fcl_line = p_input_line; p_indent = indent; /* assume this for now */ @@ -328,7 +331,7 @@ intuit_diff_type() retval = (*(s-1) == '*' ? NEW_CONTEXT_DIFF : CONTEXT_DIFF); goto scan_exit; } - if ((!diff_type || diff_type == NORMAL_DIFF) && + if ((!diff_type || diff_type == NORMAL_DIFF) && last_line_was_command && (strnEQ(s, "< ", 2) || strnEQ(s, "> ", 2)) ) { p_start = previous_line; @@ -698,19 +701,19 @@ another_hunk() else p_len[p_end] = 0; } - + hunk_done: if (p_end >=0 && !repl_beginning) fatal2("no --- found in patch at line %ld\n", pch_hunk_beg()); if (repl_missing) { - + /* reset state back to just after --- */ p_input_line = repl_patch_line; for (p_end--; p_end > repl_beginning; p_end--) free(p_line[p_end]); Fseek(pfp, repl_backtrack_position, 0); - + /* redundant 'new' context lines were omitted - set */ /* up to fill them in from the old file context */ if (!p_context && p_repl_lines == 1) { @@ -749,7 +752,7 @@ another_hunk() "the new style...)"); diff_type = NEW_CONTEXT_DIFF; } - + /* if there were omitted context lines, fill them in now */ if (fillcnt) { p_bfake = filldst; /* remember where not to free() */ @@ -1081,7 +1084,7 @@ pch_swap() i = p_first; p_first = p_newfirst; p_newfirst = i; - + /* make a scratch copy */ tp_line = p_line; diff --git a/gnu/usr.bin/patch/pch.h b/gnu/usr.bin/patch/pch.h index 97a5b28..4967081 100644 --- a/gnu/usr.bin/patch/pch.h +++ b/gnu/usr.bin/patch/pch.h @@ -1,12 +1,15 @@ -/* $Header: pch.h,v 2.0.1.1 87/01/30 22:47:16 lwall Exp $ +/* $Header: /home/ncvs/src/gnu/usr.bin/patch/pch.h,v 1.1.1.1 1993/06/19 14:21:52 paul Exp $ + * + * $Log: pch.h,v $ + * Revision 1.1.1.1 1993/06/19 14:21:52 paul + * b-maked patch-2.10 * - * $Log: pch.h,v $ * Revision 2.0.1.1 87/01/30 22:47:16 lwall * Added do_ed_script(). - * + * * Revision 2.0 86/09/17 15:39:57 lwall * Baseline for netwide release. - * + * */ EXT FILE *pfp INIT(Nullfp); /* patch file pointer */ diff --git a/gnu/usr.bin/patch/util.c b/gnu/usr.bin/patch/util.c index ecb85ff..56ce12e 100644 --- a/gnu/usr.bin/patch/util.c +++ b/gnu/usr.bin/patch/util.c @@ -69,7 +69,7 @@ char *from, *to; dev_t to_device = filestat.st_dev; ino_t to_inode = filestat.st_ino; char *simplename = bakname; - + for (s=bakname; *s; s++) { if (*s == '/') simplename = s+1; @@ -104,7 +104,7 @@ char *from, *to; #endif if (rename(from, to) < 0) { /* different file system? */ Reg4 int tofd; - + tofd = creat(to, 0666); if (tofd < 0) { say4("Can't create %s, output is in %s: %s\n", @@ -133,7 +133,7 @@ char *from, *to; Reg3 int tofd; Reg2 int fromfd; Reg1 int i; - + tofd = creat(to, 0666); if (tofd < 0) pfatal2("can't create %s", to); diff --git a/gnu/usr.bin/patch/util.h b/gnu/usr.bin/patch/util.h index d8e46bb..c56b4c3 100644 --- a/gnu/usr.bin/patch/util.h +++ b/gnu/usr.bin/patch/util.h @@ -1,9 +1,12 @@ -/* $Header: util.h,v 2.0 86/09/17 15:40:06 lwall Exp $ +/* $Header: /home/ncvs/src/gnu/usr.bin/patch/util.h,v 1.1.1.1 1993/06/19 14:21:52 paul Exp $ + * + * $Log: util.h,v $ + * Revision 1.1.1.1 1993/06/19 14:21:52 paul + * b-maked patch-2.10 * - * $Log: util.h,v $ * Revision 2.0 86/09/17 15:40:06 lwall * Baseline for netwide release. - * + * */ /* and for those machine that can't handle a variable argument list */ diff --git a/gnu/usr.bin/patch/version.c b/gnu/usr.bin/patch/version.c index f0b5223..dfd2e9a 100644 --- a/gnu/usr.bin/patch/version.c +++ b/gnu/usr.bin/patch/version.c @@ -1,9 +1,12 @@ -/* $Header: version.c,v 2.0 86/09/17 15:40:11 lwall Exp $ +/* $Header: /home/ncvs/src/gnu/usr.bin/patch/version.c,v 1.1.1.1 1993/06/19 14:21:52 paul Exp $ + * + * $Log: version.c,v $ + * Revision 1.1.1.1 1993/06/19 14:21:52 paul + * b-maked patch-2.10 * - * $Log: version.c,v $ * Revision 2.0 86/09/17 15:40:11 lwall * Baseline for netwide release. - * + * */ #include "EXTERN.h" diff --git a/gnu/usr.bin/patch/version.h b/gnu/usr.bin/patch/version.h index 08fe68d..f59ee26 100644 --- a/gnu/usr.bin/patch/version.h +++ b/gnu/usr.bin/patch/version.h @@ -1,9 +1,12 @@ -/* $Header: version.h,v 2.0 86/09/17 15:40:14 lwall Exp $ +/* $Header: /home/ncvs/src/gnu/usr.bin/patch/version.h,v 1.1.1.1 1993/06/19 14:21:52 paul Exp $ + * + * $Log: version.h,v $ + * Revision 1.1.1.1 1993/06/19 14:21:52 paul + * b-maked patch-2.10 * - * $Log: version.h,v $ * Revision 2.0 86/09/17 15:40:14 lwall * Baseline for netwide release. - * + * */ void version(); -- cgit v1.1