diff -C2 -N patch-2.0.12u/ChangeLog patch-2.0.12u2/ChangeLog *** patch-2.0.12u/ChangeLog --- patch-2.0.12u2/ChangeLog Mon Jan 7 06:22:26 1991 *************** *** 0 **** --- 1,42 ---- + Mon Jan 7 06:25:11 1991 David J. MacKenzie (djm at geech.ai.mit.edu) + + * patchlevel.h: PATCHLEVEL 12u2. + + * pch.c (intuit_diff_type): Recognize `+++' in diff headers, for + unified diff format. From unidiff patch 1. + + Mon Dec 3 00:14:25 1990 David J. MacKenzie (djm at albert.ai.mit.edu) + + * patch.c (get_some_switches): Make the usage message more + informative. + + Sun Dec 2 23:20:18 1990 David J. MacKenzie (djm at albert.ai.mit.edu) + + * Configure: When checking for C preprocessor, look for 'abc.*xyz' + instead of 'abc.xyz', so ANSI C preprocessors work. + + * Apply fix for -D from ksb@mentor.cc.purdue.edu (Kevin Braunsdorf). + + * Apply unidiff patches from davison@dri.com (Wayne Davison). + + Wed Mar 7 23:47:25 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu) + + * pch.c: Call malformed instead of goto malformed + (just allows easier debugging). + + Tue Jan 23 21:27:00 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu) + + * common.h (TMP*NAME): Make these char *, not char []. + patch.c (main): Use TMPDIR (if present) to set TMP*NAME. + common.h: Declare getenv. + + Sun Dec 17 17:29:48 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu) + + # patch.c (reverse_flag_specified): New variable. + (get_some_switches, reinitialize_almost_everything): Use it. + + # in place of * means change has been sent to Wall. + + Local Variables: + version-control: never + end: diff -C2 -N patch-2.0.12u/Configure patch-2.0.12u2/Configure *** patch-2.0.12u/Configure Fri Jun 5 01:07:47 1992 --- patch-2.0.12u2/Configure Sun Dec 2 23:46:47 1990 *************** *** 747,751 **** echo 'Maybe "'$cpp'" will work...' $cpp testcpp.out 2>&1 ! if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, it does." cppstdin="$cpp" --- 747,751 ---- echo 'Maybe "'$cpp'" will work...' $cpp testcpp.out 2>&1 ! if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, it does." cppstdin="$cpp" *************** *** 754,758 **** echo 'Nope, maybe "'$cpp' -" will work...' $cpp - testcpp.out 2>&1 ! if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, it does." cppstdin="$cpp" --- 754,758 ---- echo 'Nope, maybe "'$cpp' -" will work...' $cpp - testcpp.out 2>&1 ! if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, it does." cppstdin="$cpp" *************** *** 761,765 **** echo 'No such luck...maybe "cc -E" will work...' cc -E testcpp.out 2>&1 ! if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then echo "It works!" cppstdin='cc -E' --- 761,765 ---- echo 'No such luck...maybe "cc -E" will work...' cc -E testcpp.out 2>&1 ! if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "It works!" cppstdin='cc -E' *************** *** 768,772 **** echo 'Nixed again...maybe "cc -E -" will work...' cc -E - testcpp.out 2>&1 ! if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then echo "Hooray, it works! I was beginning to wonder." cppstdin='cc -E' --- 768,772 ---- echo 'Nixed again...maybe "cc -E -" will work...' cc -E - testcpp.out 2>&1 ! if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Hooray, it works! I was beginning to wonder." cppstdin='cc -E' *************** *** 775,779 **** echo 'Nope...maybe "cc -P" will work...' cc -P testcpp.out 2>&1 ! if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, that does." cppstdin='cc -P' --- 775,779 ---- echo 'Nope...maybe "cc -P" will work...' cc -P testcpp.out 2>&1 ! if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, that does." cppstdin='cc -P' *************** *** 782,786 **** echo 'Nope...maybe "cc -P -" will work...' cc -P - testcpp.out 2>&1 ! if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, that does." cppstdin='cc -P' --- 782,786 ---- echo 'Nope...maybe "cc -P -" will work...' cc -P - testcpp.out 2>&1 ! if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, that does." cppstdin='cc -P' *************** *** 792,796 **** *) $cppstdin $cppminus testcpp.out 2>&1;; esac ! if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then echo "Hooray, you did! I was beginning to wonder." else --- 792,796 ---- *) $cppstdin $cppminus testcpp.out 2>&1;; esac ! if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Hooray, you did! I was beginning to wonder." else *************** *** 800,804 **** cppminus=''; $cppstdin testcpp.out 2>&1 ! if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then echo "Eureka!." else --- 800,804 ---- cppminus=''; $cppstdin testcpp.out 2>&1 ! if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Eureka!." else *************** *** 809,813 **** cppstdin="$ans" $cppstdin testcpp.out 2>&1 ! if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then echo "OK, that will do." else --- 809,813 ---- cppstdin="$ans" $cppstdin testcpp.out 2>&1 ! if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "OK, that will do." else diff -C2 -N patch-2.0.12u/Makedist patch-2.0.12u2/Makedist *** patch-2.0.12u/Makedist --- patch-2.0.12u2/Makedist Mon Jan 7 06:21:07 1991 *************** *** 0 **** --- 1,11 ---- + #!/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 && + ln $files $distdir && + tar -cvz -f $distdir.tar.Z $distdir + rm -rf $distdir diff -C2 -N patch-2.0.12u/common.h patch-2.0.12u2/common.h *** patch-2.0.12u/common.h Sat Jul 4 00:21:53 1992 --- patch-2.0.12u2/common.h Sun Dec 2 23:18:09 1990 *************** *** 112,119 **** EXT char *origprae INIT(Nullch); ! EXT char TMPOUTNAME[] INIT("/tmp/patchoXXXXXX"); ! EXT char TMPINNAME[] INIT("/tmp/patchiXXXXXX"); /* might want /usr/tmp here */ ! EXT char TMPREJNAME[] INIT("/tmp/patchrXXXXXX"); ! EXT char TMPPATNAME[] INIT("/tmp/patchpXXXXXX"); EXT bool toutkeep INIT(FALSE); EXT bool trejkeep INIT(FALSE); --- 112,119 ---- EXT char *origprae INIT(Nullch); ! EXT char *TMPOUTNAME; ! EXT char *TMPINNAME; ! EXT char *TMPREJNAME; ! EXT char *TMPPATNAME; EXT bool toutkeep INIT(FALSE); EXT bool trejkeep INIT(FALSE); *************** *** 159,160 **** --- 159,161 ---- int sprintf(); #endif + char *getenv(); diff -C2 -N patch-2.0.12u/patch.c patch-2.0.12u2/patch.c *** patch-2.0.12u/patch.c Sat Jul 4 00:21:54 1992 --- patch-2.0.12u2/patch.c Mon Dec 3 00:25:15 1990 *************** *** 116,119 **** --- 116,122 ---- void my_exit(); + /* Nonzero if -R was specified on command line. */ + static int reverse_flag_specified = FALSE; + /* Apply a set of diffs as appropriate. */ *************** *** 134,141 **** for (i = 0; i pat_end) break; else if (pch_char(new) == '+') { copy_till(where + old - 1); --- 648,654 ---- old++; } ! else if (new > pat_end) { break; + } else if (pch_char(new) == '+') { copy_till(where + old - 1); *************** *** 626,670 **** new++; } ! else { ! if (pch_char(new) != pch_char(old)) { ! say3("Out-of-sync patch, lines %ld,%ld--mangled text or line numbers, maybe?\n", ! pch_hunk_beg() + old, ! pch_hunk_beg() + new); #ifdef DEBUGGING ! say3("oldchar = '%c', newchar = '%c'\n", ! pch_char(old), pch_char(new)); #endif ! my_exit(1); } ! if (pch_char(new) == '!') { ! copy_till(where + old - 1); ! if (R_do_defines) { ! fputs(not_defined, ofp); ! def_state = IN_IFNDEF; ! } ! while (pch_char(old) == '!') { ! if (R_do_defines) { ! fputs(pfetch(old), ofp); ! } ! last_frozen_line++; ! old++; ! } ! if (R_do_defines) { ! fputs(else_defined, ofp); ! def_state = IN_ELSE; ! } ! while (pch_char(new) == '!') { ! fputs(pfetch(new), ofp); ! new++; ! } if (R_do_defines) { ! fputs(end_defined, ofp); ! def_state = OUTSIDE; } ! } ! else { ! assert(pch_char(new) == ' '); old++; new++; } } --- 666,708 ---- new++; } ! else if (pch_char(new) != pch_char(old)) { ! say3("Out-of-sync patch, lines %ld,%ld--mangled text or line numbers, maybe?\n", ! pch_hunk_beg() + old, ! pch_hunk_beg() + new); #ifdef DEBUGGING ! say3("oldchar = '%c', newchar = '%c'\n", ! pch_char(old), pch_char(new)); #endif ! my_exit(1); ! } ! else if (pch_char(new) == '!') { ! copy_till(where + old - 1); ! if (R_do_defines) { ! fputs(not_defined, ofp); ! def_state = IN_IFNDEF; } ! while (pch_char(old) == '!') { if (R_do_defines) { ! fputs(pfetch(old), ofp); } ! last_frozen_line++; old++; + } + if (R_do_defines) { + fputs(else_defined, ofp); + def_state = IN_ELSE; + } + while (pch_char(new) == '!') { + fputs(pfetch(new), ofp); new++; + } + } + else { + assert(pch_char(new) == ' '); + old++; + new++; + if (R_do_defines && def_state != OUTSIDE) { + fputs(end_defined, ofp); + def_state = OUTSIDE; } } diff -C2 -N patch-2.0.12u/patch.man patch-2.0.12u2/patch.man *** patch-2.0.12u/patch.man Sat Jul 4 00:21:54 1992 --- patch-2.0.12u2/patch.man Sun Dec 2 23:18:13 1990 *************** *** 59,64 **** .ds L' ' .ds R' ' ! 'br\} ! .el\{\ .ds -- \(em\| .tr \*(Tr --- 59,64 ---- .ds L' ' .ds R' ' ! 'br \} ! .el \{\ .ds -- \(em\| .tr \*(Tr diff -C2 -N patch-2.0.12u/patchlevel.h patch-2.0.12u2/patchlevel.h *** patch-2.0.12u/patchlevel.h Sat Jul 4 00:21:52 1992 --- patch-2.0.12u2/patchlevel.h Mon Jan 7 06:22:06 1991 *************** *** 1 **** ! #define PATCHLEVEL "12u" --- 1 ---- ! #define PATCHLEVEL "12u2" diff -C2 -N patch-2.0.12u/pch.c patch-2.0.12u2/pch.c *** patch-2.0.12u/pch.c Sat Jul 4 00:21:55 1992 --- patch-2.0.12u2/pch.c Mon Jan 7 06:19:12 1991 *************** *** 270,273 **** --- 270,275 ---- else if (strnEQ(s, "--- ", 4)) newtmp = savestr(s+4); + else if (strnEQ(s, "+++ ", 4)) + oldtmp = savestr(s+4); /* pretend it is the old name */ else if (strnEQ(s, "Index:", 6)) indtmp = savestr(s+6); *************** *** 421,424 **** --- 423,434 ---- } + /* Make this a function for better debugging. */ + static void + malformed () + { + fatal3("Malformed patch at line %ld: %s", p_input_line, buf); + /* about as informative as "Syntax error" in C */ + } + /* True if there is more of the current diff listing to process. */ *************** *** 515,519 **** for (s=buf; *s && !isdigit(*s); s++) ; if (!*s) ! goto malformed; if (strnEQ(s,"0,0",3)) strcpy(s,s+2); --- 525,529 ---- for (s=buf; *s && !isdigit(*s); s++) ; if (!*s) ! malformed (); if (strnEQ(s,"0,0",3)) strcpy(s,s+2); *************** *** 523,527 **** for (; *s && !isdigit(*s); s++) ; if (!*s) ! goto malformed; p_ptrn_lines = ((LINENUM)atol(s)) - p_first + 1; } --- 533,537 ---- for (; *s && !isdigit(*s); s++) ; if (!*s) ! malformed (); p_ptrn_lines = ((LINENUM)atol(s)) - p_first + 1; } *************** *** 581,585 **** for (s=buf; *s && !isdigit(*s); s++) ; if (!*s) ! goto malformed; p_newfirst = (LINENUM) atol(s); while (isdigit(*s)) s++; --- 591,595 ---- for (s=buf; *s && !isdigit(*s); s++) ; if (!*s) ! malformed (); p_newfirst = (LINENUM) atol(s); while (isdigit(*s)) s++; *************** *** 587,591 **** for (; *s && !isdigit(*s); s++) ; if (!*s) ! goto malformed; p_repl_lines = ((LINENUM)atol(s)) - p_newfirst + 1; } --- 597,601 ---- for (; *s && !isdigit(*s); s++) ; if (!*s) ! malformed (); p_repl_lines = ((LINENUM)atol(s)) - p_newfirst + 1; } *************** *** 667,671 **** goto hunk_done; } ! goto malformed; } /* set up p_len for strncmp() so we don't have to */ --- 677,681 ---- goto hunk_done; } ! malformed (); } /* set up p_len for strncmp() so we don't have to */ *************** *** 749,757 **** s = buf+4; if (!*s) ! goto malformed; p_first = (LINENUM) atol(s); while (isdigit(*s)) s++; if (*s != ',' || !*++s) ! goto malformed; p_ptrn_lines = (LINENUM) atol(s); while (isdigit(*s)) s++; --- 759,767 ---- s = buf+4; if (!*s) ! malformed (); p_first = (LINENUM) atol(s); while (isdigit(*s)) s++; if (*s != ',' || !*++s) ! malformed (); p_ptrn_lines = (LINENUM) atol(s); while (isdigit(*s)) s++; *************** *** 758,766 **** if (*s == ' ') s++; if (*s != '+' || !*++s) ! goto malformed; p_newfirst = (LINENUM) atol(s); while (isdigit(*s)) s++; if (*s != ',' || !*++s) ! goto malformed; p_repl_lines = (LINENUM) atol(s); while (isdigit(*s)) s++; --- 768,776 ---- if (*s == ' ') s++; if (*s != '+' || !*++s) ! malformed (); p_newfirst = (LINENUM) atol(s); while (isdigit(*s)) s++; if (*s != ',' || !*++s) ! malformed (); p_repl_lines = (LINENUM) atol(s); while (isdigit(*s)) s++; *************** *** 767,771 **** if (*s == ' ') s++; if (*s != '@') ! goto malformed; if (!p_first && !p_ptrn_lines) p_first = 1; --- 777,781 ---- if (*s == ' ') s++; if (*s != '@') ! malformed (); if (!p_first && !p_ptrn_lines) p_first = 1; *************** *** 824,828 **** free(s); p_end = filldst-1; ! goto malformed; } p_char[fillsrc] = ch; --- 834,838 ---- free(s); p_end = filldst-1; ! malformed (); } p_char[fillsrc] = ch; *************** *** 839,843 **** free(p_line[filldst]); p_end = fillsrc-1; ! goto malformed; } context++; --- 849,853 ---- free(p_line[filldst]); p_end = fillsrc-1; ! malformed (); } context++; *************** *** 859,863 **** free(p_line[filldst]); p_end = fillsrc-1; ! goto malformed; } p_char[filldst] = ch; --- 869,873 ---- free(p_line[filldst]); p_end = fillsrc-1; ! malformed (); } p_char[filldst] = ch; *************** *** 867,871 **** default: p_end = filldst; ! goto malformed; } if (ch != ' ' && context > 0) { --- 877,881 ---- default: p_end = filldst; ! malformed (); } if (ch != ' ' && context > 0) { *************** *** 993,1001 **** p_char[p_end+1] = '^'; /* add a stopper for apply_hunk */ return TRUE; - - malformed: - fatal3("Malformed patch at line %ld: %s", p_input_line, buf); - /* about as informative as "Syntax error" in C */ - return FALSE; /* for lint */ } --- 1003,1006 ----