diff -C2 -N patch-2.0.12u2/ChangeLog patch-2.0.12u3/ChangeLog *** patch-2.0.12u2/ChangeLog Mon Jan 7 06:22:26 1991 --- patch-2.0.12u3/ChangeLog Sun Jan 20 21:00:00 1991 *************** *** 1,2 **** --- 1,20 ---- + Sun Jan 20 20:18:58 1991 David J. MacKenzie (djm at geech.ai.mit.edu) + + * Makefile.SH (all): Don't make a dummy `all' file. + + * patchlevel.h: PATCHLEVEL 12u3. + + * patch.c (nextarg): New function. + (get_some_switches): Use it, to prevent dereferencing a null + pointer if an option that takes an arg is not given one (is last + on the command line). From Paul Eggert. + + * pch.c (another_hunk): Fix from Wayne Davison to recognize + single-line hunks in unified diffs (with a single line number + instead of a range). + + * inp.c (rev_in_string): Don't use `s' before defining it. From + Wayne Davison. + Mon Jan 7 06:25:11 1991 David J. MacKenzie (djm at geech.ai.mit.edu) diff -C2 -N patch-2.0.12u2/Makedist patch-2.0.12u3/Makedist *** patch-2.0.12u2/Makedist Mon Jan 7 06:21:07 1991 --- patch-2.0.12u3/Makedist Sun Jan 20 20:59:37 1991 *************** *** 1,8 **** #!/bin/sh ! # Make distribution tar file for patch with unidiff changes. files='ChangeLog Configure EXTERN.h INTERN.h MANIFEST Makedist Makefile.SH README common.h config.H config.h.SH inp.c inp.h malloc.c patch.c patch.man patchlevel.h pch.c pch.h util.c util.h version.c version.h' ! distdir=patch-2.0.12u2 mkdir $distdir && --- 1,8 ---- #!/bin/sh ! # Make distribution tar file for patch with unified diff changes. files='ChangeLog Configure EXTERN.h INTERN.h MANIFEST Makedist Makefile.SH README common.h config.H config.h.SH inp.c inp.h malloc.c patch.c patch.man patchlevel.h pch.c pch.h util.c util.h version.c version.h' ! distdir=patch-2.0.12u3 mkdir $distdir && diff -C2 -N patch-2.0.12u2/Makefile.SH patch-2.0.12u3/Makefile.SH *** patch-2.0.12u2/Makefile.SH Wed Aug 15 01:13:36 1990 --- patch-2.0.12u3/Makefile.SH Sun Jan 20 21:04:52 1991 *************** *** 55,59 **** all: $(public) $(private) $(util) ! touch all patch: $(obj) --- 55,59 ---- all: $(public) $(private) $(util) ! @echo Done. patch: $(obj) diff -C2 -N patch-2.0.12u2/inp.c patch-2.0.12u3/inp.c *** patch-2.0.12u2/inp.c Wed Aug 15 01:13:38 1990 --- patch-2.0.12u3/inp.c Sun Jan 20 20:12:22 1991 *************** *** 307,311 **** return TRUE; patlen = strlen(revision); ! if (strnEQ(string,revision,patlen) && isspace(s[patlen])) return TRUE; for (s = string; *s; s++) { --- 307,311 ---- return TRUE; patlen = strlen(revision); ! if (strnEQ(string,revision,patlen) && isspace(string[patlen])) return TRUE; for (s = string; *s; s++) { diff -C2 -N patch-2.0.12u2/patch.c patch-2.0.12u3/patch.c *** patch-2.0.12u2/patch.c Mon Dec 3 00:25:15 1990 --- patch-2.0.12u3/patch.c Sun Jan 20 20:35:19 1991 *************** *** 396,399 **** --- 396,407 ---- } + static char * + nextarg() + { + if (!--Argc) + fatal2("patch: missing argument after `%s'\n", *Argv); + return *++Argv; + } + /* Process switches and filenames up to next '+' or end of list. */ *************** *** 421,430 **** switch (*++s) { case 'b': ! origext = savestr(Argv[1]); ! Argc--,Argv++; break; case 'B': ! origprae = savestr(Argv[1]); ! Argc--,Argv++; break; case 'c': --- 429,436 ---- switch (*++s) { case 'b': ! origext = savestr(nextarg()); break; case 'B': ! origprae = savestr(nextarg()); break; case 'c': *************** *** 432,439 **** break; case 'd': ! if (!*++s) { ! Argc--,Argv++; ! s = Argv[0]; ! } if (chdir(s) < 0) fatal2("Can't cd to %s.\n", s); --- 438,443 ---- break; case 'd': ! if (!*++s) ! s = nextarg(); if (chdir(s) < 0) fatal2("Can't cd to %s.\n", s); *************** *** 441,448 **** case 'D': do_defines = TRUE; ! if (!*++s) { ! Argc--,Argv++; ! s = Argv[0]; ! } if (!isalpha(*s) && '_' != *s) fatal1("Argument to -D not an identifier.\n"); --- 445,450 ---- case 'D': do_defines = TRUE; ! if (!*++s) ! s = nextarg(); if (!isalpha(*s) && '_' != *s) fatal1("Argument to -D not an identifier.\n"); *************** *** 472,477 **** break; case 'o': ! outname = savestr(Argv[1]); ! Argc--,Argv++; break; case 'p': --- 474,478 ---- break; case 'o': ! outname = savestr(nextarg()); break; case 'p': *************** *** 481,486 **** break; case 'r': ! Strcpy(rejname, Argv[1]); ! Argc--,Argv++; break; case 'R': --- 482,486 ---- break; case 'r': ! Strcpy(rejname, nextarg()); break; case 'R': diff -C2 -N patch-2.0.12u2/patchlevel.h patch-2.0.12u3/patchlevel.h *** patch-2.0.12u2/patchlevel.h Mon Jan 7 06:22:06 1991 --- patch-2.0.12u3/patchlevel.h Sun Jan 20 20:37:31 1991 *************** *** 1 **** ! #define PATCHLEVEL "12u2" --- 1 ---- ! #define PATCHLEVEL "12u3" diff -C2 -N patch-2.0.12u2/pch.c patch-2.0.12u3/pch.c *** patch-2.0.12u2/pch.c Mon Jan 7 06:19:12 1991 --- patch-2.0.12u3/pch.c Sun Jan 20 20:12:15 1991 *************** *** 166,170 **** say3(" %sooks like %s to me...\n", (p_base == 0L ? "L" : "The next patch l"), ! diff_type == UNI_DIFF ? "a unidiff" : diff_type == CONTEXT_DIFF ? "a context diff" : diff_type == NEW_CONTEXT_DIFF ? "a new-style context diff" : --- 166,170 ---- say3(" %sooks like %s to me...\n", (p_base == 0L ? "L" : "The next patch l"), ! diff_type == UNI_DIFF ? "a unified diff" : diff_type == CONTEXT_DIFF ? "a context diff" : diff_type == NEW_CONTEXT_DIFF ? "a new-style context diff" : *************** *** 762,769 **** p_first = (LINENUM) atol(s); while (isdigit(*s)) s++; ! if (*s != ',' || !*++s) ! malformed (); ! p_ptrn_lines = (LINENUM) atol(s); ! while (isdigit(*s)) s++; if (*s == ' ') s++; if (*s != '+' || !*++s) --- 762,770 ---- p_first = (LINENUM) atol(s); while (isdigit(*s)) s++; ! if (*s == ',') { ! p_ptrn_lines = (LINENUM) atol(++s); ! while (isdigit(*s)) s++; ! } else ! p_ptrn_lines = 1; if (*s == ' ') s++; if (*s != '+' || !*++s) *************** *** 771,778 **** p_newfirst = (LINENUM) atol(s); while (isdigit(*s)) s++; ! if (*s != ',' || !*++s) ! malformed (); ! p_repl_lines = (LINENUM) atol(s); ! while (isdigit(*s)) s++; if (*s == ' ') s++; if (*s != '@') --- 772,780 ---- p_newfirst = (LINENUM) atol(s); while (isdigit(*s)) s++; ! if (*s == ',') { ! p_repl_lines = (LINENUM) atol(++s); ! while (isdigit(*s)) s++; ! } else ! p_repl_lines = 1; if (*s == ' ') s++; if (*s != '@')