=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/patch/patch.c,v retrieving revision 1.31 retrieving revision 1.32 diff -c -r1.31 -r1.32 *** src/usr.bin/patch/patch.c 2003/07/29 20:10:17 1.31 --- src/usr.bin/patch/patch.c 2003/07/30 16:45:44 1.32 *************** *** 1,4 **** ! /* $OpenBSD: patch.c,v 1.31 2003/07/29 20:10:17 millert Exp $ */ /* * patch - a program to apply diffs to original files --- 1,4 ---- ! /* $OpenBSD: patch.c,v 1.32 2003/07/30 16:45:44 millert Exp $ */ /* * patch - a program to apply diffs to original files *************** *** 27,33 **** */ #ifndef lint ! static const char rcsid[] = "$OpenBSD: patch.c,v 1.31 2003/07/29 20:10:17 millert Exp $"; #endif /* not lint */ #include --- 27,33 ---- */ #ifndef lint ! static const char rcsid[] = "$OpenBSD: patch.c,v 1.32 2003/07/30 16:45:44 millert Exp $"; #endif /* not lint */ #include *************** *** 436,442 **** static void get_some_switches(void) { ! const char *options = "b::B:cCd:D:eEfF:lnNo:p::r:RstuvV:x:z:"; static struct option longopts[] = { {"backup", no_argument, 0, 'b'}, {"batch", no_argument, 0, 't'}, --- 436,442 ---- static void get_some_switches(void) { ! const char *options = "b::B:cCd:D:eEfF:i:lnNo:p::r:RstuvV:x:z:"; static struct option longopts[] = { {"backup", no_argument, 0, 'b'}, {"batch", no_argument, 0, 't'}, *************** *** 449,454 **** --- 449,455 ---- {"forward", no_argument, 0, 'N'}, {"fuzz", required_argument, 0, 'F'}, {"ifdef", required_argument, 0, 'D'}, + {"input", required_argument, 0, 'i'}, {"ignore-whitespace", no_argument, 0, 'l'}, {"normal", no_argument, 0, 'n'}, {"output", required_argument, 0, 'o'}, *************** *** 526,531 **** --- 527,537 ---- case 'F': maxfuzz = atoi(optarg); break; + case 'i': + if (++filec == MAXFILEC) + fatal("too many file arguments\n"); + filearg[filec] = savestr(optarg); + break; case 'l': canonicalize = TRUE; break; *************** *** 578,588 **** Argc -= optind; Argv += optind; ! while (Argc > 0) { ! if (filec == MAXFILEC) ! fatal("too many file arguments\n"); ! filearg[filec++] = savestr(*Argv++); Argc--; } } --- 584,598 ---- Argc -= optind; Argv += optind; ! if (Argc > 0) { ! filearg[0] = savestr(*Argv++); Argc--; + while (Argc > 0) { + if (++filec == MAXFILEC) + fatal("too many file arguments\n"); + filearg[filec] = savestr(*Argv++); + Argc--; + } } } *************** *** 591,598 **** { fprintf(stderr, "usage: patch [-bcCeEflnNRstuv] [-B backup-prefix] [-d directory] [-D symbol]\n" ! " [-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); } --- 601,608 ---- { fprintf(stderr, "usage: patch [-bcCeEflnNRstuv] [-B backup-prefix] [-d directory] [-D symbol]\n" ! " [-Fmax-fuzz] [-i patchfile] [-o out-file] [-p[strip-count]]\n" ! " [-r rej-name] [-V {numbered,existing,simple}] [-z backup-ext]\n" " [origfile [patchfile]]\n"); my_exit(EXIT_SUCCESS); }