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.
This commit is contained in:
Jeffrey Altman
2010-11-24 09:43:04 +00:00
committed by Simon Wilkinson
parent 0cc7b890e2
commit f317b91b1b
2 changed files with 10 additions and 4 deletions

View File

@@ -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 */

View File

@@ -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