aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/patch/patch.c
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2015-05-27 01:19:58 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2015-05-27 01:19:58 +0000
commit98e0ffaefb0f241cda3a72395d3be04192ae0d47 (patch)
tree55c065b6730aaac2afb6c29933ee6ec5fa4c4249 /usr.bin/patch/patch.c
parentb17ff922d4072ae132ece458f5b5d74a236880ac (diff)
parente81032ad243db32b8fd615b2d55ee94b9f6a5b6a (diff)
Notes
Diffstat (limited to 'usr.bin/patch/patch.c')
-rw-r--r--usr.bin/patch/patch.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c
index 85daf7ff33887..22f302741aea1 100644
--- a/usr.bin/patch/patch.c
+++ b/usr.bin/patch/patch.c
@@ -23,7 +23,7 @@
* -C option added in 1998, original code by Marc Espie, based on FreeBSD
* behaviour
*
- * $OpenBSD: patch.c,v 1.50 2012/05/15 19:32:02 millert Exp $
+ * $OpenBSD: patch.c,v 1.54 2014/12/13 10:31:07 tobias Exp $
* $FreeBSD$
*
*/
@@ -150,8 +150,8 @@ main(int argc, char *argv[])
const char *tmpdir;
char *v;
- setlinebuf(stdout);
- setlinebuf(stderr);
+ setvbuf(stdout, NULL, _IOLBF, 0);
+ setvbuf(stderr, NULL, _IOLBF, 0);
for (i = 0; i < MAXFILEC; i++)
filearg[i] = NULL;
@@ -215,13 +215,13 @@ main(int argc, char *argv[])
for (open_patch_file(filearg[1]); there_is_another_patch();
reinitialize_almost_everything()) {
/* for each patch in patch file */
-
+
patch_seen = true;
warn_on_invalid_line = true;
if (outname == NULL)
- outname = savestr(filearg[0]);
+ outname = xstrdup(filearg[0]);
/* for ed script just up and do it and exit */
if (diff_type == ED_DIFF) {
@@ -416,7 +416,7 @@ main(int argc, char *argv[])
}
set_signals(1);
}
-
+
if (!patch_seen)
error = 2;
@@ -514,10 +514,10 @@ get_some_switches(void)
/* FALLTHROUGH */
case 'z':
/* must directly follow 'b' case for backwards compat */
- simple_backup_suffix = savestr(optarg);
+ simple_backup_suffix = xstrdup(optarg);
break;
case 'B':
- origprae = savestr(optarg);
+ origprae = xstrdup(optarg);
break;
case 'c':
diff_type = CONTEXT_DIFF;
@@ -555,7 +555,7 @@ get_some_switches(void)
case 'i':
if (++filec == MAXFILEC)
fatal("too many file arguments\n");
- filearg[filec] = savestr(optarg);
+ filearg[filec] = xstrdup(optarg);
break;
case 'l':
canonicalize = true;
@@ -567,7 +567,7 @@ get_some_switches(void)
noreverse = true;
break;
case 'o':
- outname = savestr(optarg);
+ outname = xstrdup(optarg);
break;
case 'p':
strippath = atoi(optarg);
@@ -611,12 +611,12 @@ get_some_switches(void)
Argv += optind;
if (Argc > 0) {
- filearg[0] = savestr(*Argv++);
+ filearg[0] = xstrdup(*Argv++);
Argc--;
while (Argc > 0) {
if (++filec == MAXFILEC)
fatal("too many file arguments\n");
- filearg[filec] = savestr(*Argv++);
+ filearg[filec] = xstrdup(*Argv++);
Argc--;
}
}
@@ -634,7 +634,7 @@ usage(void)
" [-r rej-name] [-V t | nil | never] [-x number] [-z backup-ext]\n"
" [--posix] [origfile [patchfile]]\n"
" patch <patchfile\n");
- my_exit(EXIT_SUCCESS);
+ my_exit(EXIT_FAILURE);
}
/*