version 1.59, 2015/10/09 01:37:08 |
version 1.60, 2015/10/16 07:33:47 |
|
|
#include "inp.h" |
#include "inp.h" |
#include "backupfile.h" |
#include "backupfile.h" |
#include "pathnames.h" |
#include "pathnames.h" |
|
#include "ed.h" |
|
|
mode_t filemode = 0644; |
mode_t filemode = 0644; |
|
|
|
|
const char *tmpdir; |
const char *tmpdir; |
char *v; |
char *v; |
|
|
if (pledge("stdio rpath wpath cpath tmppath fattr proc exec", NULL) == -1) |
if (pledge("stdio rpath wpath cpath tmppath fattr", NULL) == -1) |
perror("pledge"); |
perror("pledge"); |
|
|
setvbuf(stdout, NULL, _IOLBF, 0); |
setvbuf(stdout, NULL, _IOLBF, 0); |
|
|
if (outname == NULL) |
if (outname == NULL) |
outname = xstrdup(filearg[0]); |
outname = xstrdup(filearg[0]); |
|
|
/* for ed script just up and do it and exit */ |
|
if (diff_type == ED_DIFF) { |
|
do_ed_script(); |
|
continue; |
|
} |
|
/* initialize the patched file */ |
/* initialize the patched file */ |
if (!skip_rest_of_patch) |
if (!skip_rest_of_patch) |
init_output(TMPOUTNAME); |
init_output(TMPOUTNAME); |
|
|
/* find out where all the lines are */ |
/* find out where all the lines are */ |
if (!skip_rest_of_patch) |
if (!skip_rest_of_patch) |
scan_input(filearg[0]); |
scan_input(filearg[0]); |
|
|
|
/* for ed script just up and do it and exit */ |
|
if (diff_type == ED_DIFF) { |
|
do_ed_script(); |
|
continue; |
|
} |
|
|
/* from here on, open no standard i/o files, because malloc */ |
/* from here on, open no standard i/o files, because malloc */ |
/* might misfire and we can't catch it easily */ |
/* might misfire and we can't catch it easily */ |