summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/patch/getopt.c
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2002-04-28 01:33:45 +0000
committergad <gad@FreeBSD.org>2002-04-28 01:33:45 +0000
commitb200c6709f032c3ceaac65a061b2f1198173bd0c (patch)
tree7f720dcbd2c5958c3ebe9655a3d746b461a5aac7 /gnu/usr.bin/patch/getopt.c
parent69091a8284855bbf8bc967d6baf599b1fbc7f077 (diff)
downloadFreeBSD-src-b200c6709f032c3ceaac65a061b2f1198173bd0c.zip
FreeBSD-src-b200c6709f032c3ceaac65a061b2f1198173bd0c.tar.gz
Add many prototypes and ANSI-ize 'patch. Not a complete job of it, but it gets
our patch to look a little more like NetBSD's, and has the nice characteristic that the object code is exactly the same after the change as before it (even in patch.c and pch.c, which have pesky 'assert' statements in them). Reviewed by: /sbin/md5 on i386, alpha, sparc64 MFC after: 3 days
Diffstat (limited to 'gnu/usr.bin/patch/getopt.c')
-rw-r--r--gnu/usr.bin/patch/getopt.c25
1 files changed, 7 insertions, 18 deletions
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,
OpenPOWER on IntegriCloud