summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gnu/usr.bin/patch/backupfile.c64
-rw-r--r--gnu/usr.bin/patch/backupfile.h12
-rw-r--r--gnu/usr.bin/patch/common.h2
-rw-r--r--gnu/usr.bin/patch/getopt.c25
-rw-r--r--gnu/usr.bin/patch/getopt.h2
-rw-r--r--gnu/usr.bin/patch/inp.c44
-rw-r--r--gnu/usr.bin/patch/inp.h12
-rw-r--r--gnu/usr.bin/patch/patch.c77
-rw-r--r--gnu/usr.bin/patch/pch.c146
-rw-r--r--gnu/usr.bin/patch/pch.h46
-rw-r--r--gnu/usr.bin/patch/util.c24
-rw-r--r--gnu/usr.bin/patch/util.h24
-rw-r--r--gnu/usr.bin/patch/version.c4
-rw-r--r--gnu/usr.bin/patch/version.h2
14 files changed, 221 insertions, 263 deletions
diff --git a/gnu/usr.bin/patch/backupfile.c b/gnu/usr.bin/patch/backupfile.c
index c6d93c9..d4edebb4 100644
--- a/gnu/usr.bin/patch/backupfile.c
+++ b/gnu/usr.bin/patch/backupfile.c
@@ -76,21 +76,22 @@ enum backup_type backup_type = none;
to numbered) backup file name. */
char *simple_backup_suffix = "~";
-char *basename ();
-char *dirname ();
-static char *concat ();
-char *find_backup_file_name ();
-static char *make_version_name ();
-static int max_backup_version ();
-static int version_number ();
+int argmatch(char *_arg, char **_optlist);
+const char *basename(const char *_name);
+char *dirname(const char *_path);
+static char *concat(const char *_str1, const char *_str2);
+char *find_backup_file_name(char *_file);
+static char *make_version_name (char *_file, int _version);
+static int max_backup_version(char *_file, char *_dir);
+static int version_number(char *base, char *backup, int base_length);
+void invalid_arg(const char *_kind, char *_value, int _problem);
/* Return NAME with any leading path stripped off. */
-char *
-basename (name)
- char *name;
+const char *
+basename(const char *name)
{
- char *r = name, *p = name;
+ const char *r = name, *p = name;
while (*p)
if (*p++ == '/')
@@ -105,8 +106,7 @@ basename (name)
Do not call this function if backup_type == none. */
char *
-find_backup_file_name (file)
- char *file;
+find_backup_file_name(char *file)
{
char *dir;
char *base_versions;
@@ -142,8 +142,7 @@ find_backup_file_name (file)
FILE should already have ".~" appended to it. */
static int
-max_backup_version (file, dir)
- char *file, *dir;
+max_backup_version(char *file, char *dir)
{
DIR *dirp;
struct dirent *dp;
@@ -175,9 +174,7 @@ max_backup_version (file, dir)
"FILE.~VERSION~". Return 0 if out of memory. */
static char *
-make_version_name (file, version)
- char *file;
- int version;
+make_version_name(char *file, int version)
{
char *backup_name;
@@ -193,10 +190,7 @@ make_version_name (file, version)
BASE should already have ".~" appended to it. */
static int
-version_number (base, backup, base_length)
- char *base;
- char *backup;
- int base_length;
+version_number(char *base, char *backup, int base_length)
{
int version;
char *p;
@@ -216,8 +210,7 @@ version_number (base, backup, base_length)
If out of memory, return 0. */
static char *
-concat (str1, str2)
- char *str1, *str2;
+concat(const char *str1, const char *str2)
{
char *newstr;
char str1_length = strlen (str1);
@@ -236,11 +229,10 @@ concat (str1, str2)
removed. */
char *
-dirname (path)
- char *path;
+dirname(const char *path)
{
char *newpath;
- char *slash;
+ const char *slash;
int length; /* Length of result, not including NUL. */
slash = basename (path);
@@ -272,9 +264,7 @@ dirname (path)
or -2 if it is ambiguous (is a prefix of more than one element). */
int
-argmatch (arg, optlist)
- char *arg;
- char **optlist;
+argmatch(char *arg, char **optlist)
{
int i; /* Temporary index in OPTLIST. */
int arglen; /* Length of ARG. */
@@ -311,10 +301,7 @@ argmatch (arg, optlist)
PROBLEM is the return value from argmatch. */
void
-invalid_arg (kind, value, problem)
- char *kind;
- char *value;
- int problem;
+invalid_arg(const char *kind, char *value, int problem)
{
fprintf (stderr, "patch: ");
if (problem == -1)
@@ -324,7 +311,7 @@ invalid_arg (kind, value, problem)
fprintf (stderr, " %s `%s'\n", kind, value);
}
-static char *backup_args[] =
+static const char *backup_args[] =
{
"never", "simple", "nil", "existing", "t", "numbered", 0
};
@@ -338,8 +325,7 @@ static enum backup_type backup_types[] =
Unique abbreviations are accepted. */
enum backup_type
-get_version (version)
- char *version;
+get_version(char *version)
{
int i;
@@ -357,9 +343,7 @@ get_version (version)
in which case just append the character E. */
void
-addext (filename, ext, e)
- char *filename, *ext;
- int e;
+addext(char *filename, char *ext, int e)
{
char *s = basename (filename);
int slen = strlen (s), extlen = strlen (ext);
diff --git a/gnu/usr.bin/patch/backupfile.h b/gnu/usr.bin/patch/backupfile.h
index bb7b5e6..7600714 100644
--- a/gnu/usr.bin/patch/backupfile.h
+++ b/gnu/usr.bin/patch/backupfile.h
@@ -39,12 +39,6 @@ enum backup_type
extern enum backup_type backup_type;
extern char *simple_backup_suffix;
-#ifdef __STDC__
-char *find_backup_file_name (char *file);
-enum backup_type get_version (char *version);
-void addext (char *, char *, int);
-#else
-char *find_backup_file_name ();
-enum backup_type get_version ();
-void addext ();
-#endif
+char *find_backup_file_name (char *_file);
+enum backup_type get_version(char *_version);
+void addext(char *_filename, char *_ext, int _e);
diff --git a/gnu/usr.bin/patch/common.h b/gnu/usr.bin/patch/common.h
index 161dad0..5267e17 100644
--- a/gnu/usr.bin/patch/common.h
+++ b/gnu/usr.bin/patch/common.h
@@ -172,7 +172,7 @@ char *getenv();
char *strcpy();
char *strcat();
#endif
-char *mktemp();
+char *mktemp(char *);
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#else
diff --git a/gnu/usr.bin/patch/getopt.c b/gnu/usr.bin/patch/getopt.c
index 9fb6225..d496ca0 100644
--- a/gnu/usr.bin/patch/getopt.c
+++ b/gnu/usr.bin/patch/getopt.c
@@ -106,7 +106,7 @@ char *alloca ();
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
-char *optarg = 0;
+char *optarg = NULL;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
@@ -190,12 +190,10 @@ static enum
/* Avoid depending on library functions or files
whose names are inconsistent. */
-char *getenv ();
+char *getenv(const char *_name);
static char *
-my_index (str, chr)
- const char *str;
- int chr;
+my_index(const char *str, int chr)
{
while (*str)
{
@@ -237,8 +235,7 @@ static int last_nonopt;
the new indices of the non-options in ARGV after they are moved. */
static void
-exchange (argv)
- char **argv;
+exchange(char **argv)
{
int nonopts_size = (last_nonopt - first_nonopt) * sizeof (char *);
char **temp = (char **) __alloca (nonopts_size);
@@ -315,13 +312,8 @@ exchange (argv)
long-named options. */
int
-_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
- int argc;
- char *const *argv;
- const char *optstring;
- const struct option *longopts;
- int *longind;
- int long_only;
+_getopt_internal(int argc, char *const *argv, const char *optstring,
+ const struct option *longopts, int *longind, int long_only)
{
int option_index;
@@ -649,10 +641,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
}
int
-getopt (argc, argv, optstring)
- int argc;
- char *const *argv;
- const char *optstring;
+getopt(int argc, char *const *argv, const char *optstring)
{
return _getopt_internal (argc, argv, optstring,
(const struct option *) 0,
diff --git a/gnu/usr.bin/patch/getopt.h b/gnu/usr.bin/patch/getopt.h
index 627d223..e41e1a8 100644
--- a/gnu/usr.bin/patch/getopt.h
+++ b/gnu/usr.bin/patch/getopt.h
@@ -105,7 +105,7 @@ struct option
errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */
-extern int getopt ();
+extern int getopt(int _argc, char *const *_argv, const char *_optstring);
#endif /* not __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
diff --git a/gnu/usr.bin/patch/inp.c b/gnu/usr.bin/patch/inp.c
index 8aa7223..dbc9bf9 100644
--- a/gnu/usr.bin/patch/inp.c
+++ b/gnu/usr.bin/patch/inp.c
@@ -28,10 +28,11 @@ static LINENUM tiline[2] = {-1, -1}; /* 1st line in each buffer */
static LINENUM lines_per_buf; /* how many lines per buffer */
static int tireclen; /* length of records in tmp file */
-/* New patch--prepare to edit another file. */
-
+/*
+ * New patch--prepare to edit another file.
+ */
void
-re_input()
+re_input(void)
{
if (using_plan_a) {
i_size = 0;
@@ -56,11 +57,11 @@ re_input()
}
}
-/* Constuct the line index, somehow or other. */
-
+/*
+ * Constuct the line index, somehow or other.
+ */
void
-scan_input(filename)
-char *filename;
+scan_input(char *filename)
{
if (!plan_a(filename))
plan_b(filename);
@@ -70,11 +71,11 @@ char *filename;
}
}
-/* Try keeping everything in memory. */
-
+/*
+ * Try keeping everything in memory.
+ */
bool
-plan_a(filename)
-char *filename;
+plan_a(char *filename)
{
int ifd, statfailed;
Reg1 char *s;
@@ -247,11 +248,11 @@ char *filename;
return TRUE; /* plan a will work */
}
-/* Keep (virtually) nothing in memory. */
-
+/*
+ * Keep (virtually) nothing in memory.
+ */
void
-plan_b(filename)
-char *filename;
+plan_b(char *filename)
{
Reg3 FILE *ifp;
Reg1 int i = 0;
@@ -320,8 +321,9 @@ char *filename;
}
}
-/* Fetch a line from the input file, \n terminated, not necessarily \0. */
-
+/*
+ * Fetch a line from the input file, \n terminated, not necessarily \0.
+ */
char *
ifetch(line,whichbuf)
Reg1 LINENUM line;
@@ -351,11 +353,11 @@ int whichbuf; /* ignored when file in memory */
}
}
-/* True if the string argument contains the revision number we want. */
-
+/*
+ * True if the string argument contains the revision number we want.
+ */
bool
-rev_in_string(string)
-char *string;
+rev_in_string(char *string)
{
Reg1 char *s;
Reg2 int patlen;
diff --git a/gnu/usr.bin/patch/inp.h b/gnu/usr.bin/patch/inp.h
index f653a87..f1f0386 100644
--- a/gnu/usr.bin/patch/inp.h
+++ b/gnu/usr.bin/patch/inp.h
@@ -9,10 +9,10 @@
EXT LINENUM input_lines INIT(0); /* how long is input file in lines */
EXT LINENUM last_frozen_line INIT(0); /* how many input lines have been */
/* irretractibly output */
-
-bool rev_in_string();
-void scan_input();
-bool plan_a(); /* returns false if insufficient memory */
-void plan_b();
-char *ifetch();
+void re_input(void);
+void scan_input(char *_filename);
+bool plan_a(char *_filename);
+void plan_b(char *_filename);
+bool rev_in_string(char *_string);
+char *ifetch(LINENUM _line, int _whichbuf);
diff --git a/gnu/usr.bin/patch/patch.c b/gnu/usr.bin/patch/patch.c
index 76ddd8a..df64421 100644
--- a/gnu/usr.bin/patch/patch.c
+++ b/gnu/usr.bin/patch/patch.c
@@ -102,20 +102,20 @@ char rcsid[] =
/* procedures */
-void reinitialize_almost_everything();
-void get_some_switches();
-LINENUM locate_hunk();
-void abort_hunk();
-void apply_hunk();
-void init_output();
-void init_reject();
-void copy_till();
-void spew_output();
-void dump_line();
-bool patch_match();
-bool similar();
-void re_input();
-void my_exit();
+void reinitialize_almost_everything(void);
+void get_some_switches(void);
+LINENUM locate_hunk(LINENUM _fuzz);
+void abort_hunk(void);
+void apply_hunk(LINENUM _where);
+void init_output(char *_name);
+void init_reject(char *_name);
+void copy_till(LINENUM _lastline);
+void spew_output(void);
+void dump_line(LINENUM _line);
+bool patch_match(LINENUM _base, LINENUM _offset, LINENUM _fuzz);
+bool similar(char *_a, char *_b, int _len);
+void my_exit(int _status);
+
/* TRUE if -E was specified on command line. */
static int remove_empty_files = FALSE;
@@ -412,7 +412,7 @@ char **argv;
/* Prepare to find the next patch to do in the patch file. */
void
-reinitialize_almost_everything()
+reinitialize_almost_everything(void)
{
re_patch();
re_input();
@@ -485,7 +485,7 @@ static struct option longopts[] =
/* Process switches and filenames up to next '+' or end of list. */
void
-get_some_switches()
+get_some_switches(void)
{
Reg1 int optc;
@@ -626,11 +626,11 @@ Options:\n\
}
}
-/* Attempt to find the right place to apply this hunk of patch. */
-
+/*
+ * Attempt to find the right place to apply this hunk of patch.
+ */
LINENUM
-locate_hunk(fuzz)
-LINENUM fuzz;
+locate_hunk(LINENUM fuzz)
{
Reg1 LINENUM first_guess = pch_first() + last_offset;
Reg2 LINENUM offset;
@@ -674,7 +674,7 @@ LINENUM fuzz;
/* We did not find the pattern, dump out the hunk so they can handle it. */
void
-abort_hunk()
+abort_hunk(void)
{
Reg1 LINENUM i;
Reg2 LINENUM pat_end = pch_end();
@@ -717,11 +717,11 @@ abort_hunk()
}
}
-/* We found where to apply it (we hope), so do it. */
-
+/*
+ * We found where to apply it (we hope), so do it.
+ */
void
-apply_hunk(where)
-LINENUM where;
+apply_hunk(LINENUM where)
{
Reg1 LINENUM old = 1;
Reg2 LINENUM lastline = pch_ptrn_lines();
@@ -840,8 +840,7 @@ LINENUM where;
/* Open the new file. */
void
-init_output(name)
-char *name;
+init_output(char *name)
{
ofp = fopen(name, "w");
if (ofp == Nullfp)
@@ -851,8 +850,7 @@ char *name;
/* Open a file to put hunks we can't locate. */
void
-init_reject(name)
-char *name;
+init_reject(char *name)
{
rejfp = fopen(name, "w");
if (rejfp == Nullfp)
@@ -862,8 +860,7 @@ char *name;
/* Copy input file to output, up to wherever hunk is to be applied. */
void
-copy_till(lastline)
-Reg1 LINENUM lastline;
+copy_till(LINENUM lastline)
{
Reg2 LINENUM R_last_frozen_line = last_frozen_line;
@@ -878,7 +875,7 @@ Reg1 LINENUM lastline;
/* Finish copying the input file to the output file. */
void
-spew_output()
+spew_output(void)
{
#ifdef DEBUGGING
if (debug & 256)
@@ -893,8 +890,7 @@ spew_output()
/* Copy one line from input to output. */
void
-dump_line(line)
-LINENUM line;
+dump_line(LINENUM line)
{
Reg1 char *s;
Reg2 char R_newline = '\n';
@@ -906,10 +902,7 @@ LINENUM line;
/* Does the patch pattern match at line base+offset? */
bool
-patch_match(base, offset, fuzz)
-LINENUM base;
-LINENUM offset;
-LINENUM fuzz;
+patch_match(LINENUM base, LINENUM offset, LINENUM fuzz)
{
Reg1 LINENUM pline = 1 + fuzz;
Reg2 LINENUM iline;
@@ -933,10 +926,7 @@ LINENUM fuzz;
/* Do two lines match with canonicalized white space? */
bool
-similar(a,b,len)
-Reg1 char *a;
-Reg2 char *b;
-Reg3 int len;
+similar(char *a, char *b, int len)
{
while (len) {
if (isspace((unsigned char)*b)) { /* whitespace (or \n) to match? */
@@ -961,8 +951,7 @@ Reg3 int len;
/* Exit with cleanup. */
void
-my_exit(status)
-int status;
+my_exit(int status)
{
Unlink(TMPINNAME);
if (!toutkeep) {
diff --git a/gnu/usr.bin/patch/pch.c b/gnu/usr.bin/patch/pch.c
index c9ab9ce..52790b9 100644
--- a/gnu/usr.bin/patch/pch.c
+++ b/gnu/usr.bin/patch/pch.c
@@ -62,10 +62,11 @@ static LINENUM p_hunk_beg; /* line number of current hunk */
static LINENUM p_efake = -1; /* end of faked up lines--don't free */
static LINENUM p_bfake = -1; /* beg of faked up lines */
-/* Prepare to look for the next patch in the patch file. */
-
+/*
+ * Prepare to look for the next patch in the patch file.
+ */
void
-re_patch()
+re_patch(void)
{
p_first = Nulline;
p_newfirst = Nulline;
@@ -79,8 +80,7 @@ re_patch()
/* Open the patch file at the beginning of time. */
void
-open_patch_file(filename)
-char *filename;
+open_patch_file(char *filename)
{
if (filename == Nullch || !*filename || strEQ(filename, "-")) {
pfp = fopen(TMPPATNAME, "w");
@@ -103,7 +103,7 @@ char *filename;
/* Make sure our dynamically realloced tables are malloced to begin with. */
void
-set_hunkmax()
+set_hunkmax(void)
{
#ifndef lint
if (p_line == Null(char**))
@@ -118,7 +118,7 @@ set_hunkmax()
/* Enlarge the arrays containing the current hunk of patch. */
void
-grow_hunkmax()
+grow_hunkmax(void)
{
hunkmax *= 2;
/*
@@ -140,10 +140,11 @@ grow_hunkmax()
/* from within plan_a(), of all places */
}
-/* True if the remainder of the patch file contains a diff of some sort. */
-
+/*
+ * True if the remainder of the patch file contains a diff of some sort.
+ */
bool
-there_is_another_patch()
+there_is_another_patch(void)
{
if (p_base != 0L && p_base >= p_filesize) {
if (verbose)
@@ -203,10 +204,11 @@ there_is_another_patch()
return TRUE;
}
-/* Determine what kind of diff is in the remaining part of the patch file. */
-
+/*
+ * Determine what kind of diff is in the remaining part of the patch file.
+ */
int
-intuit_diff_type()
+intuit_diff_type(void)
{
Reg4 long this_line = 0;
Reg5 long previous_line;
@@ -390,23 +392,21 @@ intuit_diff_type()
return retval;
}
-/* Remember where this patch ends so we know where to start up again. */
-
+/*
+ * Remember where this patch ends so we know where to start up again.
+ */
void
-next_intuit_at(file_pos,file_line)
-long file_pos;
-long file_line;
+next_intuit_at(long file_pos, long file_line)
{
p_base = file_pos;
p_bline = file_line;
}
-/* Basically a verbose fseek() to the actual diff listing. */
-
+/*
+ * Basically a verbose fseek() to the actual diff listing.
+ */
void
-skip_to(file_pos,file_line)
-long file_pos;
-long file_line;
+skip_to(long file_pos, long file_line)
{
char *ret;
@@ -428,7 +428,7 @@ long file_line;
/* Make this a function for better debugging. */
static void
-malformed ()
+malformed(void)
{
fatal3("malformed patch at line %ld: %s", p_input_line, buf);
/* about as informative as "Syntax error" in C */
@@ -461,7 +461,7 @@ remove_special_line(void)
/* True if there is more of the current diff listing to process. */
bool
-another_hunk()
+another_hunk(void)
{
Reg1 char *s;
Reg8 char *ret;
@@ -1095,13 +1095,11 @@ another_hunk()
return TRUE;
}
-/* Input a line from the patch file, worrying about indentation. */
-
+/*
+ * Input a line from the patch file, worrying about indentation.
+ */
char *
-pgets(bf,sz,fp)
-char *bf;
-int sz;
-FILE *fp;
+pgets(char *bf, int sz, FILE *fp)
{
char *ret = fgets(bf, sz, fp);
Reg1 char *s;
@@ -1121,10 +1119,12 @@ FILE *fp;
return ret;
}
-/* Reverse the old and new portions of the current hunk. */
+/*
+ * Reverse the old and new portions of the current hunk.
+ */
bool
-pch_swap()
+pch_swap(void)
{
char **tp_line; /* the text of the hunk */
short *tp_len; /* length of each line */
@@ -1226,93 +1226,101 @@ pch_swap()
return TRUE;
}
-/* Return the specified line position in the old file of the old context. */
-
+/*
+ * Return the specified line position in the old file of the old context.
+ */
LINENUM
-pch_first()
+pch_first(void)
{
return p_first;
}
-/* Return the number of lines of old context. */
-
+/*
+ * Return the number of lines of old context.
+ */
LINENUM
-pch_ptrn_lines()
+pch_ptrn_lines(void)
{
return p_ptrn_lines;
}
-/* Return the probable line position in the new file of the first line. */
-
+/*
+ * Return the probable line position in the new file of the first line.
+ */
LINENUM
-pch_newfirst()
+pch_newfirst(void)
{
return p_newfirst;
}
-/* Return the number of lines in the replacement text including context. */
-
+/*
+ * Return the number of lines in the replacement text including context.
+ */
LINENUM
-pch_repl_lines()
+pch_repl_lines(void)
{
return p_repl_lines;
}
-/* Return the number of lines in the whole hunk. */
-
+/*
+ * Return the number of lines in the whole hunk.
+ */
LINENUM
-pch_end()
+pch_end(void)
{
return p_end;
}
-/* Return the number of context lines before the first changed line. */
-
+/*
+ * Return the number of context lines before the first changed line.
+ */
LINENUM
-pch_context()
+pch_context(void)
{
return p_context;
}
-/* Return the length of a particular patch line. */
-
+/*
+ * Return the length of a particular patch line.
+ */
short
-pch_line_len(line)
-LINENUM line;
+pch_line_len(LINENUM line)
{
return p_len[line];
}
-/* Return the control character (+, -, *, !, etc) for a patch line. */
-
+/*
+ * Return the control character (+, -, *, !, etc) for a patch line.
+ */
char
-pch_char(line)
-LINENUM line;
+pch_char(LINENUM line)
{
return p_Char[line];
}
-/* Return a pointer to a particular patch line. */
-
+/*
+ * Return a pointer to a particular patch line.
+ */
char *
-pfetch(line)
-LINENUM line;
+pfetch(LINENUM line)
{
return p_line[line];
}
-/* Return where in the patch file this hunk began, for error messages. */
-
+/*
+ * Return where in the patch file this hunk began, for error messages.
+ */
LINENUM
-pch_hunk_beg()
+pch_hunk_beg(void)
{
return p_hunk_beg;
}
-/* Apply an ed script by feeding ed itself. */
-
+/*
+ * Apply an ed script by feeding ed itself.
+ */
void
-do_ed_script()
+do_ed_script(void)
{
Reg1 char *t;
Reg2 long beginning_of_this_line;
diff --git a/gnu/usr.bin/patch/pch.h b/gnu/usr.bin/patch/pch.h
index dc5aecb..d815fe8 100644
--- a/gnu/usr.bin/patch/pch.h
+++ b/gnu/usr.bin/patch/pch.h
@@ -11,26 +11,26 @@
EXT FILE *pfp INIT(Nullfp); /* patch file pointer */
-void re_patch();
-void open_patch_file();
-void set_hunkmax();
-void grow_hunkmax();
-bool there_is_another_patch();
-int intuit_diff_type();
-void next_intuit_at();
-void skip_to();
-bool another_hunk();
-bool pch_swap();
-char *pfetch();
-short pch_line_len();
-LINENUM pch_first();
-LINENUM pch_ptrn_lines();
-LINENUM pch_newfirst();
-LINENUM pch_repl_lines();
-LINENUM pch_end();
-LINENUM pch_context();
-LINENUM pch_hunk_beg();
-char pch_char();
-char *pfetch();
-char *pgets();
-void do_ed_script();
+void re_patch(void);
+void open_patch_file(char *_filename);
+void set_hunkmax(void);
+void grow_hunkmax(void);
+bool there_is_another_patch(void);
+int intuit_diff_type(void);
+void next_intuit_at(long _file_pos, long _file_line);
+void skip_to(long _file_pos, long _file_line);
+bool another_hunk(void);
+bool pch_swap(void);
+char *pfetch(LINENUM _line);
+short pch_line_len(LINENUM _line);
+LINENUM pch_first(void);
+LINENUM pch_ptrn_lines(void);
+LINENUM pch_newfirst(void);
+LINENUM pch_repl_lines(void);
+LINENUM pch_end(void);
+LINENUM pch_context(void);
+LINENUM pch_hunk_beg(void);
+char pch_char(LINENUM _line);
+char *pfetch(LINENUM _line);
+char *pgets(char *_bf, int _sz, FILE *_fp);
+void do_ed_script(void);
diff --git a/gnu/usr.bin/patch/util.c b/gnu/usr.bin/patch/util.c
index 277440c..175952c 100644
--- a/gnu/usr.bin/patch/util.c
+++ b/gnu/usr.bin/patch/util.c
@@ -8,7 +8,7 @@
#include "util.h"
#include "backupfile.h"
-void my_exit();
+void my_exit(int _status); /* in patch.c */
#ifndef HAVE_STRERROR
static char *
@@ -28,8 +28,7 @@ private_strerror (errnum)
/* Rename a file, copying it if necessary. */
int
-move_file(from,to)
-char *from, *to;
+move_file(char *from, char *to)
{
char bakname[512];
Reg1 char *s;
@@ -131,8 +130,7 @@ char *from, *to;
/* Copy a file. */
void
-copy_file(from,to)
-char *from, *to;
+copy_file(char *from, char *to)
{
Reg3 int tofd;
Reg2 int fromfd;
@@ -154,8 +152,7 @@ char *from, *to;
/* Allocate a unique area for a string. */
char *
-savestr(s)
-Reg1 char *s;
+savestr(char *s)
{
Reg3 char *rv;
Reg2 char *t;
@@ -285,8 +282,7 @@ long arg1,arg2,arg3;
/* How to handle certain events when not in a critical region. */
void
-set_signals(reset)
-int reset;
+set_signals(int reset)
{
#ifndef lint
static RETSIGTYPE (*hupval)(),(*intval)();
@@ -307,7 +303,7 @@ int reset;
/* How to handle certain events when in a critical region. */
void
-ignore_signals()
+ignore_signals(void)
{
#ifndef lint
Signal(SIGHUP, SIG_IGN);
@@ -367,10 +363,7 @@ bool striplast;
/* Make filenames more reasonable. */
char *
-fetchname(at,strip_leading,assume_exists)
-char *at;
-int strip_leading;
-int assume_exists;
+fetchname(char *at, int strip_leading, int assume_exists)
{
char *fullname;
char *name;
@@ -434,8 +427,7 @@ int assume_exists;
}
char *
-xmalloc (size)
- unsigned size;
+xmalloc(unsigned int size)
{
register char *p = (char *) malloc (size);
if (!p)
diff --git a/gnu/usr.bin/patch/util.h b/gnu/usr.bin/patch/util.h
index 0576826..f31f2e2 100644
--- a/gnu/usr.bin/patch/util.h
+++ b/gnu/usr.bin/patch/util.h
@@ -74,15 +74,15 @@
EXT char serrbuf[BUFSIZ]; /* buffer for stderr */
-char *fetchname();
-int move_file();
-void copy_file();
-void say();
-void fatal();
-void pfatal();
-int ask();
-char *savestr();
-void set_signals();
-void ignore_signals();
-void makedirs();
-char *basename();
+char *fetchname(char *_at, int _strip_leading, int _assume_exists);
+int move_file(char *_from, char *_to);
+void copy_file(char *_from, char *_to);
+void say(/*const char *pat, long _arg1, long _arg2, long _arg3*/);
+void fatal();
+void pfatal();
+int ask(/*const char *pat, long _arg1, long _arg2, long _arg3*/);
+char *savestr(char *_s);
+void set_signals(int _reset);
+void ignore_signals(void);
+void makedirs(/*char *_filename, bool _striplast*/);
+char *basename();
diff --git a/gnu/usr.bin/patch/version.c b/gnu/usr.bin/patch/version.c
index a951a7e..753dbfb 100644
--- a/gnu/usr.bin/patch/version.c
+++ b/gnu/usr.bin/patch/version.c
@@ -13,12 +13,12 @@
#include "patchlevel.h"
#include "version.h"
-void my_exit();
+void my_exit(int _status); /* in patch.c */
/* Print out the version number and die. */
void
-version()
+version(void)
{
fprintf(stderr, "Patch version %s\n", PATCH_VERSION);
my_exit(0);
diff --git a/gnu/usr.bin/patch/version.h b/gnu/usr.bin/patch/version.h
index ab7a0fa..faddf7c 100644
--- a/gnu/usr.bin/patch/version.h
+++ b/gnu/usr.bin/patch/version.h
@@ -6,4 +6,4 @@
*
*/
-void version();
+void version(void);
OpenPOWER on IntegriCloud