Convert to ANSI C

This commit is contained in:
Todd C. Miller
2010-02-27 09:23:25 -05:00
parent 9e5ff964ad
commit 488c1531eb
22 changed files with 86 additions and 262 deletions

View File

@@ -19,7 +19,7 @@
*/ */
static struct cclass { static struct cclass {
const char *name; const char *name;
int (*isctype) __P((int)); int (*isctype)(int);
} cclasses[] = { } cclasses[] = {
{ "alnum", isalnum }, { "alnum", isalnum },
{ "alpha", isalpha }, { "alpha", isalpha },

View File

@@ -60,8 +60,7 @@
* This is the expensive (ballback) method. * This is the expensive (ballback) method.
*/ */
void void
closefrom_fallback(lowfd) closefrom_fallback(int lowfd)
int lowfd;
{ {
long fd, maxfd; long fd, maxfd;
@@ -88,8 +87,7 @@ closefrom_fallback(lowfd)
*/ */
#ifdef HAVE_FCNTL_CLOSEM #ifdef HAVE_FCNTL_CLOSEM
void void
closefrom(lowfd) closefrom(int lowfd)
int lowfd;
{ {
if (fcntl(lowfd, F_CLOSEM, 0) == -1) if (fcntl(lowfd, F_CLOSEM, 0) == -1)
closefrom_fallback(lowfd); closefrom_fallback(lowfd);
@@ -97,8 +95,7 @@ closefrom(lowfd)
#else #else
# ifdef HAVE_DIRFD # ifdef HAVE_DIRFD
void void
closefrom(lowfd) closefrom(int lowfd)
int lowfd;
{ {
struct dirent *dent; struct dirent *dent;
DIR *dirp; DIR *dirp;

View File

@@ -63,13 +63,11 @@
__unused static const char rcsid[] = "$OpenBSD: fnmatch.c,v 1.6 1998/03/19 00:29:59 millert Exp $"; __unused static const char rcsid[] = "$OpenBSD: fnmatch.c,v 1.6 1998/03/19 00:29:59 millert Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
static int rangematch __P((const char *, int, int, char **)); static int rangematch(const char *, int, int, char **);
static int classmatch __P((const char *, int, int, const char **)); static int classmatch(const char *, int, int, const char **);
int int
fnmatch(pattern, string, flags) fnmatch(const char *pattern, const char *string, int flags)
const char *pattern, *string;
int flags;
{ {
const char *stringstart; const char *stringstart;
char *newp; char *newp;
@@ -169,15 +167,7 @@ fnmatch(pattern, string, flags)
} }
static int static int
#ifdef __STDC__
rangematch(const char *pattern, int test, int flags, char **newp) rangematch(const char *pattern, int test, int flags, char **newp)
#else
rangematch(pattern, test, flags, newp)
const char *pattern;
int test;
int flags;
char **newp;
#endif
{ {
int negate, ok, rv; int negate, ok, rv;
char c, c2; char c, c2;
@@ -242,15 +232,7 @@ rangematch(pattern, test, flags, newp)
} }
static int static int
#ifdef __STDC__
classmatch(const char *pattern, int test, int foldcase, const char **ep) classmatch(const char *pattern, int test, int foldcase, const char **ep)
#else
classmatch(pattern, test, foldcase, ep)
const char *pattern;
int test;
int foldcase;
const char **ep;
#endif
{ {
struct cclass *cc; struct cclass *cc;
const char *colon; const char *colon;

View File

@@ -41,6 +41,6 @@
#define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */ #define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */
#define FNM_CASEFOLD 0x10 /* Case insensitive search. */ #define FNM_CASEFOLD 0x10 /* Case insensitive search. */
int fnmatch __P((const char *, const char *, int)); int fnmatch(const char *, const char *, int);
#endif /* !_FNMATCH_H_ */ #endif /* !_FNMATCH_H_ */

View File

@@ -79,9 +79,7 @@
(dp->d_name[1] == '.' && dp->d_name[2] == '\0'))) (dp->d_name[1] == '.' && dp->d_name[2] == '\0')))
char * char *
getcwd(pt, size) getcwd(char *pt, size_t size)
char *pt;
size_t size;
{ {
struct dirent *dp; struct dirent *dp;
DIR *dir = NULL; DIR *dir = NULL;

View File

@@ -45,10 +45,7 @@
#ifdef HAVE_FGETLN #ifdef HAVE_FGETLN
ssize_t ssize_t
getline(bufp, bufsizep, fp) getline(char **bufp, size_t *bufsizep, FILE *fp)
char **bufp;
size_t *bufsizep;
FILE *fp;
{ {
char *buf; char *buf;
size_t bufsize; size_t bufsize;
@@ -69,10 +66,7 @@ getline(bufp, bufsizep, fp)
} }
#else #else
ssize_t ssize_t
getline(bufp, bufsizep, fp) getline(char **bufp, size_t *bufsizep, FILE *fp)
char **bufp;
size_t *bufsizep;
FILE *fp;
{ {
char *buf; char *buf;
size_t bufsize; size_t bufsize;

View File

@@ -25,7 +25,7 @@
#include <compat.h> #include <compat.h>
const char * const char *
getprogname() getprogname(void)
{ {
static const char *progname; static const char *progname;
extern int Argc; extern int Argc;

View File

@@ -151,34 +151,32 @@ typedef char Char;
#define ismeta(c) (((c)&M_QUOTE) != 0) #define ismeta(c) (((c)&M_QUOTE) != 0)
static int compare __P((const void *, const void *)); static int compare(const void *, const void *);
static int g_Ctoc __P((const Char *, char *, unsigned int)); static int g_Ctoc(const Char *, char *, unsigned int);
static int g_lstat __P((Char *, struct stat *, glob_t *)); static int g_lstat(Char *, struct stat *, glob_t *);
static DIR *g_opendir __P((Char *, glob_t *)); static DIR *g_opendir(Char *, glob_t *);
static Char *g_strchr __P((const Char *, int)); static Char *g_strchr(const Char *, int);
static int g_strncmp __P((const Char *, const char *, size_t)); static int g_strncmp(const Char *, const char *, size_t);
static int g_stat __P((Char *, struct stat *, glob_t *)); static int g_stat(Char *, struct stat *, glob_t *);
static int glob0 __P((const Char *, glob_t *)); static int glob0(const Char *, glob_t *);
static int glob1 __P((Char *, Char *, glob_t *)); static int glob1(Char *, Char *, glob_t *);
static int glob2 __P((Char *, Char *, Char *, Char *, Char *, Char *, static int glob2(Char *, Char *, Char *, Char *, Char *, Char *,
glob_t *)); glob_t *);
static int glob3 __P((Char *, Char *, Char *, Char *, Char *, Char *, static int glob3(Char *, Char *, Char *, Char *, Char *, Char *,
Char *, Char *, glob_t *)); Char *, Char *, glob_t *);
static int globextend __P((const Char *, glob_t *)); static int globextend(const Char *, glob_t *);
static const Char * static const Char *
globtilde __P((const Char *, Char *, size_t, glob_t *)); globtilde(const Char *, Char *, size_t, glob_t *);
static int globexp1 __P((const Char *, glob_t *)); static int globexp1(const Char *, glob_t *);
static int globexp2 __P((const Char *, const Char *, glob_t *, int *)); static int globexp2(const Char *, const Char *, glob_t *, int *);
static int match __P((Char *, Char *, Char *)); static int match(Char *, Char *, Char *);
#ifdef DEBUG #ifdef DEBUG
static void qprintf __P((const char *, Char *)); static void qprintf(const char *, Char *);
#endif #endif
int int
glob(pattern, flags, errfunc, pglob) glob(const char *pattern, int flags, int (*errfunc)(const char *, int),
const char *pattern; glob_t *pglob)
int flags, (*errfunc) __P((const char *, int));
glob_t *pglob;
{ {
const unsigned char *patnext; const unsigned char *patnext;
int c; int c;
@@ -226,9 +224,7 @@ glob(pattern, flags, errfunc, pglob)
* characters * characters
*/ */
static int static int
globexp1(pattern, pglob) globexp1(const Char *pattern, glob_t *pglob)
const Char *pattern;
glob_t *pglob;
{ {
const Char* ptr = pattern; const Char* ptr = pattern;
int rv; int rv;
@@ -251,10 +247,7 @@ globexp1(pattern, pglob)
* If it fails then it tries to glob the rest of the pattern and returns. * If it fails then it tries to glob the rest of the pattern and returns.
*/ */
static int static int
globexp2(ptr, pattern, pglob, rv) globexp2(const Char *ptr, *pattern, glob_t *pglob, int *rv)
const Char *ptr, *pattern;
glob_t *pglob;
int *rv;
{ {
int i; int i;
Char *lm, *ls; Char *lm, *ls;
@@ -359,11 +352,7 @@ globexp2(ptr, pattern, pglob, rv)
* expand tilde from the passwd file. * expand tilde from the passwd file.
*/ */
static const Char * static const Char *
globtilde(pattern, patbuf, patbuf_len, pglob) globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
const Char *pattern;
Char *patbuf;
size_t patbuf_len;
glob_t *pglob;
{ {
struct passwd *pwd; struct passwd *pwd;
char *h; char *h;
@@ -415,10 +404,7 @@ globtilde(pattern, patbuf, patbuf_len, pglob)
} }
static int static int
g_strncmp(s1, s2, n) g_strncmp(const Char *s1, const char *s2, size_t n)
const Char *s1;
const char *s2;
size_t n;
{ {
int rv = 0; int rv = 0;
@@ -433,9 +419,7 @@ g_strncmp(s1, s2, n)
} }
static int static int
g_charclass(patternp, bufnextp) g_charclass(const Char **patternp, Char **bufnextp)
const Char **patternp;
Char **bufnextp;
{ {
const Char *pattern = *patternp + 1; const Char *pattern = *patternp + 1;
Char *bufnext = *bufnextp; Char *bufnext = *bufnextp;
@@ -469,9 +453,7 @@ g_charclass(patternp, bufnextp)
* to find no matches. * to find no matches.
*/ */
static int static int
glob0(pattern, pglob) glob0(const Char *pattern, glob_t *pglob)
const Char *pattern;
glob_t *pglob;
{ {
const Char *qpatnext; const Char *qpatnext;
int c, err, oldpathc; int c, err, oldpathc;
@@ -567,16 +549,13 @@ glob0(pattern, pglob)
} }
static int static int
compare(p, q) compare(const void *p, const void *q)
const void *p, *q;
{ {
return(strcmp(*(char **)p, *(char **)q)); return(strcmp(*(char **)p, *(char **)q));
} }
static int static int
glob1(pattern, pattern_last, pglob) glob1(Char *pattern, Char *pattern_last, glob_t *pglob)
Char *pattern, *pattern_last;
glob_t *pglob;
{ {
Char pathbuf[PATH_MAX]; Char pathbuf[PATH_MAX];
@@ -594,11 +573,8 @@ glob1(pattern, pattern_last, pglob)
* meta characters. * meta characters.
*/ */
static int static int
glob2(pathbuf, pathbuf_last, pathend, pathend_last, pattern, pattern_last, pglob) glob2(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last,
Char *pathbuf, *pathbuf_last; Char *pattern, Char *pattern_last, glob_t *pglob)
Char *pathend, *pathend_last;
Char *pattern, *pattern_last;
glob_t *pglob;
{ {
struct stat sb; struct stat sb;
Char *p, *q; Char *p, *q;
@@ -657,11 +633,9 @@ glob2(pathbuf, pathbuf_last, pathend, pathend_last, pattern, pattern_last, pglob
} }
static int static int
glob3(pathbuf, pathbuf_last, pathend, pathend_last, pattern, pattern_last, glob3(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last,
restpattern, restpattern_last, pglob) Char *pattern, Char *pattern_last, Char *restpattern,
Char *pathbuf, *pathbuf_last, *pathend, *pathend_last; Char *restpattern_last, glob_t *pglob)
Char *pattern, *pattern_last, *restpattern, *restpattern_last;
glob_t *pglob;
{ {
struct dirent *dp; struct dirent *dp;
DIR *dirp; DIR *dirp;
@@ -734,9 +708,7 @@ glob3(pathbuf, pathbuf_last, pathend, pathend_last, pattern, pattern_last,
* gl_pathv points to (gl_offs + gl_pathc + 1) items. * gl_pathv points to (gl_offs + gl_pathc + 1) items.
*/ */
static int static int
globextend(path, pglob) globextend(const Char *path, glob_t *pglob)
const Char *path;
glob_t *pglob;
{ {
char **pathv; char **pathv;
int i; int i;
@@ -784,8 +756,7 @@ globextend(path, pglob)
* pattern causes a recursion level. * pattern causes a recursion level.
*/ */
static int static int
match(name, pat, patend) match(Char *name, Char *pat, Char *patend)
Char *name, *pat, *patend;
{ {
int ok, negate_range; int ok, negate_range;
Char c, k; Char c, k;
@@ -840,8 +811,7 @@ match(name, pat, patend)
/* Free allocated data belonging to a glob_t structure. */ /* Free allocated data belonging to a glob_t structure. */
void void
globfree(pglob) globfree(glob_t *pglob)
glob_t *pglob;
{ {
int i; int i;
char **pp; char **pp;
@@ -857,9 +827,7 @@ globfree(pglob)
} }
static DIR * static DIR *
g_opendir(str, pglob) g_opendir(Char *str, glob_t *pglob)
Char *str;
glob_t *pglob;
{ {
char buf[PATH_MAX]; char buf[PATH_MAX];
@@ -874,10 +842,7 @@ g_opendir(str, pglob)
} }
static int static int
g_lstat(fn, sb, pglob) g_lstat(Char *fn, struct stat *sb, glob_t *pglob)
Char *fn;
struct stat *sb;
glob_t *pglob;
{ {
char buf[PATH_MAX]; char buf[PATH_MAX];
@@ -887,10 +852,7 @@ g_lstat(fn, sb, pglob)
} }
static int static int
g_stat(fn, sb, pglob) g_stat(Char *fn, struct stat *sb, glob_t *pglob)
Char *fn;
struct stat *sb;
glob_t *pglob;
{ {
char buf[PATH_MAX]; char buf[PATH_MAX];
@@ -900,9 +862,7 @@ g_stat(fn, sb, pglob)
} }
static Char * static Char *
g_strchr(str, ch) g_strchr(const Char *str, int ch)
const Char *str;
int ch;
{ {
do { do {
if (*str == ch) if (*str == ch)
@@ -912,10 +872,7 @@ g_strchr(str, ch)
} }
static int static int
g_Ctoc(str, buf, len) g_Ctoc(const Char *str, char *buf, unsigned int len)
const Char *str;
char *buf;
unsigned int len;
{ {
while (len--) { while (len--) {
@@ -927,9 +884,7 @@ g_Ctoc(str, buf, len)
#ifdef DEBUG #ifdef DEBUG
static void static void
qprintf(str, s) qprintf(const char *str, Char *s)
const char *str;
Char *s;
{ {
Char *p; Char *p;

View File

@@ -45,11 +45,7 @@ typedef struct {
int gl_flags; /* Copy of flags parameter to glob. */ int gl_flags; /* Copy of flags parameter to glob. */
char **gl_pathv; /* List of paths matching pattern. */ char **gl_pathv; /* List of paths matching pattern. */
/* Copy of errfunc parameter to glob. */ /* Copy of errfunc parameter to glob. */
#ifdef __STDC__
int (*gl_errfunc)(const char *, int); int (*gl_errfunc)(const char *, int);
#else
int (*gl_errfunc)();
#endif
} glob_t; } glob_t;
/* Flags */ /* Flags */
@@ -73,12 +69,7 @@ typedef struct {
#define GLOB_NOSYS (-4) /* Function not supported. */ #define GLOB_NOSYS (-4) /* Function not supported. */
#define GLOB_ABEND GLOB_ABORTED #define GLOB_ABEND GLOB_ABORTED
#ifdef __STDC__
int glob(const char *, int, int (*)(const char *, int), glob_t *); int glob(const char *, int, int (*)(const char *, int), glob_t *);
void globfree(glob_t *); void globfree(glob_t *);
#else
int glob();
void globfree();
#endif
#endif /* !_GLOB_H_ */ #endif /* !_GLOB_H_ */

View File

@@ -19,8 +19,7 @@
#undef isblank #undef isblank
int int
isblank(ch) isblank(int ch)
int ch;
{ {
return(ch == ' ' || ch == '\t'); return(ch == ' ' || ch == '\t');
} }

View File

@@ -26,10 +26,7 @@
* Find the last occurrence of 'c' in the buffer 's' of size 'n'. * Find the last occurrence of 'c' in the buffer 's' of size 'n'.
*/ */
void * void *
memrchr(s, c, n) memrchr(const void *s, int c, size_t n)
const void *s;
int c;
size_t n;
{ {
const unsigned char *cp; const unsigned char *cp;

View File

@@ -31,12 +31,11 @@
#include <compat.h> #include <compat.h>
static unsigned int get_random __P((void)); static unsigned int get_random(void);
static void seed_random __P((void)); static void seed_random(void);
int int
mkstemp(path) mkstemp(char *path)
char *path;
{ {
char *start, *cp; char *start, *cp;
int fd, r; int fd, r;
@@ -84,7 +83,7 @@ mkstemp(path)
#endif #endif
static void static void
seed_random() seed_random(void)
{ {
SEED_T seed; SEED_T seed;
struct timespec ts; struct timespec ts;
@@ -99,7 +98,7 @@ seed_random()
} }
static unsigned int static unsigned int
get_random() get_random(void)
{ {
static int initialized; static int initialized;

View File

@@ -32,9 +32,7 @@
#include "compat.h" #include "compat.h"
int int
nanosleep(ts, rts) nanosleep(const struct timespec *ts, struct timespec *rts)
const struct timespec *ts;
struct timespec *rts;
{ {
struct timeval timeout, endtime, now; struct timeval timeout, endtime, now;
int rval; int rval;

View File

@@ -24,10 +24,7 @@
#include <compat.h> #include <compat.h>
int int
sigaction(signo, sa, osa) sigaction(int signo, const sigaction_t *sa, sigaction_t *osa)
int signo;
const sigaction_t *sa;
sigaction_t *osa;
{ {
sigaction_t nsa; sigaction_t nsa;
int error; int error;
@@ -47,8 +44,7 @@ sigaction(signo, sa, osa)
} }
int int
sigemptyset(set) sigemptyset(sigset_t *set)
sigset_t *set;
{ {
*set = 0; *set = 0;
@@ -56,8 +52,7 @@ sigemptyset(set)
} }
int int
sigfillset(set) sigfillset(sigset_t *set)
sigset_t *set;
{ {
*set = ~0;; *set = ~0;;
@@ -65,9 +60,7 @@ sigfillset(set)
} }
int int
sigaddset(set, signo) sigaddset(sigset_t *set, int signo)
sigset_t *set;
int signo;
{ {
if (signo <= 0 || signo >= NSIG) { if (signo <= 0 || signo >= NSIG) {
@@ -80,9 +73,7 @@ sigaddset(set, signo)
} }
int int
sigdelset(set, signo) sigdelset(sigset_t *set, int signo)
sigset_t *set;
int signo;
{ {
if (signo <= 0 || signo >= NSIG) { if (signo <= 0 || signo >= NSIG) {
@@ -95,19 +86,14 @@ sigdelset(set, signo)
} }
int int
sigismember(set, signo) sigismember(sigset_t *set, int signo)
sigset_t *set;
int signo;
{ {
return(ISSET(*set, sigmask(signo))); return(ISSET(*set, sigmask(signo)));
} }
int int
sigprocmask(how, set, oset) sigprocmask(int how, const sigset_t *set, sigset_t *oset)
int how;
const sigset_t *set;
sigset_t *oset;
{ {
int mask; int mask;

View File

@@ -69,16 +69,11 @@
# include <malloc.h> # include <malloc.h>
#endif /* HAVE_MALLOC_H && !STDC_HEADERS */ #endif /* HAVE_MALLOC_H && !STDC_HEADERS */
#include <limits.h> #include <limits.h>
#include <stdarg.h>
#ifdef __STDC__
# include <stdarg.h>
#else
# include <varargs.h>
#endif
#include <compat.h> #include <compat.h>
static int xxxprintf __P((char **, size_t, int, const char *, va_list)); static int xxxprintf(char **, size_t, int, const char *, va_list);
/* /*
* Some systems may not have these defined in <limits.h> * Some systems may not have these defined in <limits.h>
@@ -129,10 +124,7 @@ static int xxxprintf __P((char **, size_t, int, const char *, va_list));
#ifndef HAVE_MEMCHR #ifndef HAVE_MEMCHR
void * void *
memchr(s, c, n) memchr(const void *s, unsigned char c, size_t n)
const void *s;
unsigned char c;
size_t n;
{ {
if (n != 0) { if (n != 0) {
const unsigned char *p = s; const unsigned char *p = s;
@@ -153,11 +145,7 @@ memchr(s, c, n)
* use the given digits. * use the given digits.
*/ */
static char * static char *
__ultoa(val, endp, base, octzero, xdigs) __ultoa(unsigned long val, char *endp, int base, int octzero, char *xdigs)
unsigned long val;
char *endp;
int base, octzero;
char *xdigs;
{ {
char *cp = endp; char *cp = endp;
long sval; long sval;
@@ -217,11 +205,7 @@ __ultoa(val, endp, base, octzero, xdigs)
# define __uqtoa(v, e, b, o, x) __ultoa((unsigned long)(v), (e), (b), (o), (x)) # define __uqtoa(v, e, b, o, x) __ultoa((unsigned long)(v), (e), (b), (o), (x))
# else # else
static char * static char *
__uqtoa(val, endp, base, octzero, xdigs) __uqtoa(unsigned long long val, char *endp, int base, int octzero, char *xdigs)
unsigned long long val;
char *endp;
int base, octzero;
char *xdigs;
{ {
char *cp = endp; char *cp = endp;
long long sval; long long sval;
@@ -275,12 +259,7 @@ __uqtoa(val, endp, base, octzero, xdigs)
* Actual printf innards. * Actual printf innards.
*/ */
static int static int
xxxprintf(strp, strsize, alloc, fmt0, ap) xxxprintf(char **strp, size_t strsize, int alloc, const char *fmt0, va_list ap)
char **strp;
size_t strsize;
int alloc;
const char *fmt0;
va_list ap;
{ {
char *fmt; /* format string */ char *fmt; /* format string */
int ch; /* character from fmt */ int ch; /* character from fmt */
@@ -699,11 +678,7 @@ done:
#ifndef HAVE_VSNPRINTF #ifndef HAVE_VSNPRINTF
int int
vsnprintf(str, n, fmt, ap) vsnprintf(char *str, size_t n, const char *fmt, va_list ap)
char *str;
size_t n;
const char *fmt;
va_list ap;
{ {
return (xxxprintf(&str, n, 0, fmt, ap)); return (xxxprintf(&str, n, 0, fmt, ap));
@@ -712,24 +687,12 @@ vsnprintf(str, n, fmt, ap)
#ifndef HAVE_SNPRINTF #ifndef HAVE_SNPRINTF
int int
#ifdef __STDC__
snprintf(char *str, size_t n, char const *fmt, ...) snprintf(char *str, size_t n, char const *fmt, ...)
#else
snprintf(str, n, fmt, va_alist)
char *str;
size_t n;
char const *fmt;
va_dcl
#endif
{ {
int ret; int ret;
va_list ap; va_list ap;
#ifdef __STDC__
va_start(ap, fmt); va_start(ap, fmt);
#else
va_start(ap);
#endif
ret = xxxprintf(&str, n, 0, fmt, ap); ret = xxxprintf(&str, n, 0, fmt, ap);
va_end(ap); va_end(ap);
return (ret); return (ret);
@@ -738,10 +701,7 @@ snprintf(str, n, fmt, va_alist)
#ifndef HAVE_VASPRINTF #ifndef HAVE_VASPRINTF
int int
vasprintf(str, fmt, ap) vasprintf(char **str, const char *fmt, va_list ap)
char **str;
const char *fmt;
va_list ap;
{ {
return (xxxprintf(str, 0, 1, fmt, ap)); return (xxxprintf(str, 0, 1, fmt, ap));
@@ -750,23 +710,12 @@ vasprintf(str, fmt, ap)
#ifndef HAVE_ASPRINTF #ifndef HAVE_ASPRINTF
int int
#ifdef __STDC__
asprintf(char **str, char const *fmt, ...) asprintf(char **str, char const *fmt, ...)
#else
asprintf(str, fmt, va_alist)
char **str;
char const *fmt;
va_dcl
#endif
{ {
int ret; int ret;
va_list ap; va_list ap;
#ifdef __STDC__
va_start(ap, fmt); va_start(ap, fmt);
#else
va_start(ap);
#endif
ret = xxxprintf(str, 0, 1, fmt, ap); ret = xxxprintf(str, 0, 1, fmt, ap);
va_end(ap); va_end(ap);
return (ret); return (ret);

View File

@@ -59,9 +59,7 @@ static const char ichars[256] = {
}; };
int int
strcasecmp(s1, s2) strcasecmp(const char *s1, const char *s2)
const char *s1;
const char *s2;
{ {
const unsigned char *us1 = (const unsigned char *) s1; const unsigned char *us1 = (const unsigned char *) s1;
const unsigned char *us2 = (const unsigned char *) s2; const unsigned char *us2 = (const unsigned char *) s2;
@@ -74,10 +72,7 @@ strcasecmp(s1, s2)
} }
int int
strncasecmp(s1, s2, n) strncasecmp(const char *s1, const char *s2, size_t n)
const char *s1;
const char *s2;
size_t n;
{ {
const unsigned char *us1 = (const unsigned char *) s1; const unsigned char *us1 = (const unsigned char *) s1;
const unsigned char *us2 = (const unsigned char *) s2; const unsigned char *us2 = (const unsigned char *) s2;

View File

@@ -28,8 +28,7 @@
* Map errno -> error string. * Map errno -> error string.
*/ */
char * char *
strerror(n) strerror(int n)
int n;
{ {
extern int sys_nerr; extern int sys_nerr;
extern char *sys_errlist[]; extern char *sys_errlist[];

View File

@@ -31,10 +31,7 @@
* If retval >= siz, truncation occurred. * If retval >= siz, truncation occurred.
*/ */
size_t size_t
strlcat(dst, src, siz) strlcat(char *dst, const char *src, size_t siz)
char *dst;
const char *src;
size_t siz;
{ {
char *d = dst; char *d = dst;
const char *s = src; const char *s = src;

View File

@@ -27,10 +27,7 @@
* Returns strlen(src); if retval >= siz, truncation occurred. * Returns strlen(src); if retval >= siz, truncation occurred.
*/ */
size_t size_t
strlcpy(dst, src, siz) strlcpy(char *dst, const char *src, size_t siz)
char *dst;
const char *src;
size_t siz;
{ {
char *d = dst; char *d = dst;
const char *s = src; const char *s = src;

View File

@@ -24,8 +24,7 @@
* Get signal description string * Get signal description string
*/ */
char * char *
strsignal(signo) strsignal(int signo)
int signo;
{ {
extern const char *const sys_siglist[]; extern const char *const sys_siglist[];

View File

@@ -22,10 +22,6 @@ struct utimbuf {
time_t modtime; /* mod time */ time_t modtime; /* mod time */
}; };
#ifdef __STDC__
int utime(const char *, const struct utimbuf *); int utime(const char *, const struct utimbuf *);
#else
int utime();
#endif
#endif /* _UTIME_H */ #endif /* _UTIME_H */

View File

@@ -36,9 +36,7 @@
* Emulate utimes() via utime() * Emulate utimes() via utime()
*/ */
int int
utimes(file, times) utimes(const char *file, const struct timeval *times)
const char *file;
const struct timeval *times;
{ {
if (times != NULL) { if (times != NULL) {
struct utimbuf utb; struct utimbuf utb;
@@ -56,9 +54,7 @@ utimes(file, times)
* Emulate futimes() via futime() * Emulate futimes() via futime()
*/ */
int int
futimes(fd, times) futimes(int fd, const struct timeval *times)
int fd;
const struct timeval *times;
{ {
if (times != NULL) { if (times != NULL) {
struct utimbuf utb; struct utimbuf utb;