From f317b91b1b4b8d030fc2ab188b6aa526e9e7cb84 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 24 Nov 2010 09:43:04 +0000 Subject: [PATCH] roken: Prototype getopt Add a prototype for getopt to the roken.h header, and fix the function definition in getopt.c to be ANSI, rather than K&Rs style. --- lib/roken/getopt.c | 5 +---- lib/roken/roken.h.in | 9 +++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/roken/getopt.c b/lib/roken/getopt.c index ceb5439e5..f035f7497 100644 --- a/lib/roken/getopt.c +++ b/lib/roken/getopt.c @@ -55,10 +55,7 @@ ROKEN_LIB_VARIABLE char *optarg; /* argument associated with option */ #define EMSG "" ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL -getopt(nargc, nargv, ostr) - int nargc; - char * const *nargv; - const char *ostr; +getopt(int nargc, char * const *nargv, const char *ostr) { static char *place = EMSG; /* option letter processing */ char *oli; /* option letter list index */ diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in index 598faa9e3..5ff10864e 100644 --- a/lib/roken/roken.h.in +++ b/lib/roken/roken.h.in @@ -765,6 +765,15 @@ ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL get_window_size(int fd, struct winsize *); ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL vsyslog(int, const char *, va_list); #endif +#ifndef HAVE_GETOPT +#define getopt rk_getopt +#define optarg rk_optarg +#define optind rk_optind +#define opterr rk_opterr +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +getopt(int nargc, char * const *nargv, const char *ostr); +#endif + #if !HAVE_DECL_OPTARG ROKEN_LIB_VARIABLE extern char *optarg; #endif