=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/patch/patch.c,v retrieving revision 1.27 retrieving revision 1.28 diff -c -r1.27 -r1.28 *** src/usr.bin/patch/patch.c 2003/07/25 02:12:45 1.27 --- src/usr.bin/patch/patch.c 2003/07/28 16:13:53 1.28 *************** *** 1,4 **** ! /* $OpenBSD: patch.c,v 1.27 2003/07/25 02:12:45 millert Exp $ */ /* * patch - a program to apply diffs to original files --- 1,4 ---- ! /* $OpenBSD: patch.c,v 1.28 2003/07/28 16:13:53 millert Exp $ */ /* * patch - a program to apply diffs to original files *************** *** 27,33 **** */ #ifndef lint ! static const char rcsid[] = "$OpenBSD: patch.c,v 1.27 2003/07/25 02:12:45 millert Exp $"; #endif /* not lint */ #include --- 27,33 ---- */ #ifndef lint ! static const char rcsid[] = "$OpenBSD: patch.c,v 1.28 2003/07/28 16:13:53 millert Exp $"; #endif /* not lint */ #include *************** *** 82,88 **** int main(int argc, char *argv[]) { ! int hunk = 0, failed = 0, failtotal = 0, patch_seen = 0, i; LINENUM where, newwhere, fuzz, mymaxfuzz; char *tmpdir, *v; --- 82,88 ---- int main(int argc, char *argv[]) { ! int error = 0, hunk, failed, patch_seen = 0, i; LINENUM where, newwhere, fuzz, mymaxfuzz; char *tmpdir, *v; *************** *** 310,316 **** fclose(rejfp); rejfp = NULL; if (failed) { ! failtotal += failed; if (!*rejname) { if (strlcpy(rejname, outname, sizeof(rejname)) >= sizeof(rejname)) --- 310,316 ---- fclose(rejfp); rejfp = NULL; if (failed) { ! error = 1; if (!*rejname) { if (strlcpy(rejname, outname, sizeof(rejname)) >= sizeof(rejname)) *************** *** 331,339 **** } set_signals(1); } ! if (!patch_seen) ! failtotal++; ! my_exit(failtotal); /* NOTREACHED */ } --- 331,337 ---- } set_signals(1); } ! my_exit(error); /* NOTREACHED */ } *************** *** 534,540 **** " [-Fmax-fuzz] [-o out-file] [-p[strip-count]] [-r rej-name]\n" " [-V {numbered,existing,simple}] [-z backup-ext]\n" " [origfile [patchfile]]\n"); ! my_exit(1); } /* --- 532,538 ---- " [-Fmax-fuzz] [-o out-file] [-p[strip-count]] [-r rej-name]\n" " [-V {numbered,existing,simple}] [-z backup-ext]\n" " [origfile [patchfile]]\n"); ! my_exit(EXIT_SUCCESS); } /* *************** *** 692,698 **** say("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) { --- 690,696 ---- say("oldchar = '%c', newchar = '%c'\n", pch_char(old), pch_char(new)); #endif ! my_exit(2); } else if (pch_char(new) == '!') { copy_till(where + old - 1); if (R_do_defines) {