*/
static struct cclass {
const char *name;
- int (*isctype) __P((int));
+ int (*isctype)(int);
} cclasses[] = {
{ "alnum", isalnum },
{ "alpha", isalpha },
* This is the expensive (ballback) method.
*/
void
-closefrom_fallback(lowfd)
- int lowfd;
+closefrom_fallback(int lowfd)
{
long fd, maxfd;
*/
#ifdef HAVE_FCNTL_CLOSEM
void
-closefrom(lowfd)
- int lowfd;
+closefrom(int lowfd)
{
if (fcntl(lowfd, F_CLOSEM, 0) == -1)
closefrom_fallback(lowfd);
#else
# ifdef HAVE_DIRFD
void
-closefrom(lowfd)
- int lowfd;
+closefrom(int lowfd)
{
struct dirent *dent;
DIR *dirp;
__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 */
-static int rangematch __P((const char *, int, int, char **));
-static int classmatch __P((const char *, int, int, const char **));
+static int rangematch(const char *, int, int, char **);
+static int classmatch(const char *, int, int, const char **);
int
-fnmatch(pattern, string, flags)
- const char *pattern, *string;
- int flags;
+fnmatch(const char *pattern, const char *string, int flags)
{
const char *stringstart;
char *newp;
}
static int
-#ifdef __STDC__
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;
char c, c2;
}
static int
-#ifdef __STDC__
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;
const char *colon;
#define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */
#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_ */
(dp->d_name[1] == '.' && dp->d_name[2] == '\0')))
char *
-getcwd(pt, size)
- char *pt;
- size_t size;
+getcwd(char *pt, size_t size)
{
struct dirent *dp;
DIR *dir = NULL;
#ifdef HAVE_FGETLN
ssize_t
-getline(bufp, bufsizep, fp)
- char **bufp;
- size_t *bufsizep;
- FILE *fp;
+getline(char **bufp, size_t *bufsizep, FILE *fp)
{
char *buf;
size_t bufsize;
}
#else
ssize_t
-getline(bufp, bufsizep, fp)
- char **bufp;
- size_t *bufsizep;
- FILE *fp;
+getline(char **bufp, size_t *bufsizep, FILE *fp)
{
char *buf;
size_t bufsize;
#include <compat.h>
const char *
-getprogname()
+getprogname(void)
{
static const char *progname;
extern int Argc;
#define ismeta(c) (((c)&M_QUOTE) != 0)
-static int compare __P((const void *, const void *));
-static int g_Ctoc __P((const Char *, char *, unsigned int));
-static int g_lstat __P((Char *, struct stat *, glob_t *));
-static DIR *g_opendir __P((Char *, glob_t *));
-static Char *g_strchr __P((const Char *, int));
-static int g_strncmp __P((const Char *, const char *, size_t));
-static int g_stat __P((Char *, struct stat *, glob_t *));
-static int glob0 __P((const Char *, glob_t *));
-static int glob1 __P((Char *, Char *, glob_t *));
-static int glob2 __P((Char *, Char *, Char *, Char *, Char *, Char *,
- glob_t *));
-static int glob3 __P((Char *, Char *, Char *, Char *, Char *, Char *,
- Char *, Char *, glob_t *));
-static int globextend __P((const Char *, glob_t *));
+static int compare(const void *, const void *);
+static int g_Ctoc(const Char *, char *, unsigned int);
+static int g_lstat(Char *, struct stat *, glob_t *);
+static DIR *g_opendir(Char *, glob_t *);
+static Char *g_strchr(const Char *, int);
+static int g_strncmp(const Char *, const char *, size_t);
+static int g_stat(Char *, struct stat *, glob_t *);
+static int glob0(const Char *, glob_t *);
+static int glob1(Char *, Char *, glob_t *);
+static int glob2(Char *, Char *, Char *, Char *, Char *, Char *,
+ glob_t *);
+static int glob3(Char *, Char *, Char *, Char *, Char *, Char *,
+ Char *, Char *, glob_t *);
+static int globextend(const Char *, glob_t *);
static const Char *
- globtilde __P((const Char *, Char *, size_t, glob_t *));
-static int globexp1 __P((const Char *, glob_t *));
-static int globexp2 __P((const Char *, const Char *, glob_t *, int *));
-static int match __P((Char *, Char *, Char *));
+ globtilde(const Char *, Char *, size_t, glob_t *);
+static int globexp1(const Char *, glob_t *);
+static int globexp2(const Char *, const Char *, glob_t *, int *);
+static int match(Char *, Char *, Char *);
#ifdef DEBUG
-static void qprintf __P((const char *, Char *));
+static void qprintf(const char *, Char *);
#endif
int
-glob(pattern, flags, errfunc, pglob)
- const char *pattern;
- int flags, (*errfunc) __P((const char *, int));
- glob_t *pglob;
+glob(const char *pattern, int flags, int (*errfunc)(const char *, int),
+ glob_t *pglob)
{
const unsigned char *patnext;
int c;
* characters
*/
static int
-globexp1(pattern, pglob)
- const Char *pattern;
- glob_t *pglob;
+globexp1(const Char *pattern, glob_t *pglob)
{
const Char* ptr = pattern;
int rv;
* If it fails then it tries to glob the rest of the pattern and returns.
*/
static int
-globexp2(ptr, pattern, pglob, rv)
- const Char *ptr, *pattern;
- glob_t *pglob;
- int *rv;
+globexp2(const Char *ptr, *pattern, glob_t *pglob, int *rv)
{
int i;
Char *lm, *ls;
* expand tilde from the passwd file.
*/
static const Char *
-globtilde(pattern, patbuf, patbuf_len, pglob)
- const Char *pattern;
- Char *patbuf;
- size_t patbuf_len;
- glob_t *pglob;
+globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
{
struct passwd *pwd;
char *h;
}
static int
-g_strncmp(s1, s2, n)
- const Char *s1;
- const char *s2;
- size_t n;
+g_strncmp(const Char *s1, const char *s2, size_t n)
{
int rv = 0;
}
static int
-g_charclass(patternp, bufnextp)
- const Char **patternp;
- Char **bufnextp;
+g_charclass(const Char **patternp, Char **bufnextp)
{
const Char *pattern = *patternp + 1;
Char *bufnext = *bufnextp;
* to find no matches.
*/
static int
-glob0(pattern, pglob)
- const Char *pattern;
- glob_t *pglob;
+glob0(const Char *pattern, glob_t *pglob)
{
const Char *qpatnext;
int c, err, oldpathc;
}
static int
-compare(p, q)
- const void *p, *q;
+compare(const void *p, const void *q)
{
return(strcmp(*(char **)p, *(char **)q));
}
static int
-glob1(pattern, pattern_last, pglob)
- Char *pattern, *pattern_last;
- glob_t *pglob;
+glob1(Char *pattern, Char *pattern_last, glob_t *pglob)
{
Char pathbuf[PATH_MAX];
* meta characters.
*/
static int
-glob2(pathbuf, pathbuf_last, pathend, pathend_last, pattern, pattern_last, pglob)
- Char *pathbuf, *pathbuf_last;
- Char *pathend, *pathend_last;
- Char *pattern, *pattern_last;
- glob_t *pglob;
+glob2(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last,
+ Char *pattern, Char *pattern_last, glob_t *pglob)
{
struct stat sb;
Char *p, *q;
}
static int
-glob3(pathbuf, pathbuf_last, pathend, pathend_last, pattern, pattern_last,
- restpattern, restpattern_last, pglob)
- Char *pathbuf, *pathbuf_last, *pathend, *pathend_last;
- Char *pattern, *pattern_last, *restpattern, *restpattern_last;
- glob_t *pglob;
+glob3(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last,
+ Char *pattern, Char *pattern_last, Char *restpattern,
+ Char *restpattern_last, glob_t *pglob)
{
struct dirent *dp;
DIR *dirp;
* gl_pathv points to (gl_offs + gl_pathc + 1) items.
*/
static int
-globextend(path, pglob)
- const Char *path;
- glob_t *pglob;
+globextend(const Char *path, glob_t *pglob)
{
char **pathv;
int i;
* pattern causes a recursion level.
*/
static int
-match(name, pat, patend)
- Char *name, *pat, *patend;
+match(Char *name, Char *pat, Char *patend)
{
int ok, negate_range;
Char c, k;
/* Free allocated data belonging to a glob_t structure. */
void
-globfree(pglob)
- glob_t *pglob;
+globfree(glob_t *pglob)
{
int i;
char **pp;
}
static DIR *
-g_opendir(str, pglob)
- Char *str;
- glob_t *pglob;
+g_opendir(Char *str, glob_t *pglob)
{
char buf[PATH_MAX];
}
static int
-g_lstat(fn, sb, pglob)
- Char *fn;
- struct stat *sb;
- glob_t *pglob;
+g_lstat(Char *fn, struct stat *sb, glob_t *pglob)
{
char buf[PATH_MAX];
}
static int
-g_stat(fn, sb, pglob)
- Char *fn;
- struct stat *sb;
- glob_t *pglob;
+g_stat(Char *fn, struct stat *sb, glob_t *pglob)
{
char buf[PATH_MAX];
}
static Char *
-g_strchr(str, ch)
- const Char *str;
- int ch;
+g_strchr(const Char *str, int ch)
{
do {
if (*str == ch)
}
static int
-g_Ctoc(str, buf, len)
- const Char *str;
- char *buf;
- unsigned int len;
+g_Ctoc(const Char *str, char *buf, unsigned int len)
{
while (len--) {
#ifdef DEBUG
static void
-qprintf(str, s)
- const char *str;
- Char *s;
+qprintf(const char *str, Char *s)
{
Char *p;
int gl_flags; /* Copy of flags parameter to glob. */
char **gl_pathv; /* List of paths matching pattern. */
/* Copy of errfunc parameter to glob. */
-#ifdef __STDC__
int (*gl_errfunc)(const char *, int);
-#else
- int (*gl_errfunc)();
-#endif
} glob_t;
/* Flags */
#define GLOB_NOSYS (-4) /* Function not supported. */
#define GLOB_ABEND GLOB_ABORTED
-#ifdef __STDC__
int glob(const char *, int, int (*)(const char *, int), glob_t *);
void globfree(glob_t *);
-#else
-int glob();
-void globfree();
-#endif
#endif /* !_GLOB_H_ */
#undef isblank
int
-isblank(ch)
- int ch;
+isblank(int ch)
{
return(ch == ' ' || ch == '\t');
}
* Find the last occurrence of 'c' in the buffer 's' of size 'n'.
*/
void *
-memrchr(s, c, n)
- const void *s;
- int c;
- size_t n;
+memrchr(const void *s, int c, size_t n)
{
const unsigned char *cp;
#include <compat.h>
-static unsigned int get_random __P((void));
-static void seed_random __P((void));
+static unsigned int get_random(void);
+static void seed_random(void);
int
-mkstemp(path)
- char *path;
+mkstemp(char *path)
{
char *start, *cp;
int fd, r;
#endif
static void
-seed_random()
+seed_random(void)
{
SEED_T seed;
struct timespec ts;
}
static unsigned int
-get_random()
+get_random(void)
{
static int initialized;
#include "compat.h"
int
-nanosleep(ts, rts)
- const struct timespec *ts;
- struct timespec *rts;
+nanosleep(const struct timespec *ts, struct timespec *rts)
{
struct timeval timeout, endtime, now;
int rval;
#include <compat.h>
int
-sigaction(signo, sa, osa)
- int signo;
- const sigaction_t *sa;
- sigaction_t *osa;
+sigaction(int signo, const sigaction_t *sa, sigaction_t *osa)
{
sigaction_t nsa;
int error;
}
int
-sigemptyset(set)
- sigset_t *set;
+sigemptyset(sigset_t *set)
{
*set = 0;
}
int
-sigfillset(set)
- sigset_t *set;
+sigfillset(sigset_t *set)
{
*set = ~0;;
}
int
-sigaddset(set, signo)
- sigset_t *set;
- int signo;
+sigaddset(sigset_t *set, int signo)
{
if (signo <= 0 || signo >= NSIG) {
}
int
-sigdelset(set, signo)
- sigset_t *set;
- int signo;
+sigdelset(sigset_t *set, int signo)
{
if (signo <= 0 || signo >= NSIG) {
}
int
-sigismember(set, signo)
- sigset_t *set;
- int signo;
+sigismember(sigset_t *set, int signo)
{
return(ISSET(*set, sigmask(signo)));
}
int
-sigprocmask(how, set, oset)
- int how;
- const sigset_t *set;
- sigset_t *oset;
+sigprocmask(int how, const sigset_t *set, sigset_t *oset)
{
int mask;
# include <malloc.h>
#endif /* HAVE_MALLOC_H && !STDC_HEADERS */
#include <limits.h>
-
-#ifdef __STDC__
-# include <stdarg.h>
-#else
-# include <varargs.h>
-#endif
+#include <stdarg.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>
#ifndef HAVE_MEMCHR
void *
-memchr(s, c, n)
- const void *s;
- unsigned char c;
- size_t n;
+memchr(const void *s, unsigned char c, size_t n)
{
if (n != 0) {
const unsigned char *p = s;
* use the given digits.
*/
static char *
-__ultoa(val, endp, base, octzero, xdigs)
- unsigned long val;
- char *endp;
- int base, octzero;
- char *xdigs;
+__ultoa(unsigned long val, char *endp, int base, int octzero, char *xdigs)
{
char *cp = endp;
long sval;
# define __uqtoa(v, e, b, o, x) __ultoa((unsigned long)(v), (e), (b), (o), (x))
# else
static char *
-__uqtoa(val, endp, base, octzero, xdigs)
- unsigned long long val;
- char *endp;
- int base, octzero;
- char *xdigs;
+__uqtoa(unsigned long long val, char *endp, int base, int octzero, char *xdigs)
{
char *cp = endp;
long long sval;
* Actual printf innards.
*/
static int
-xxxprintf(strp, strsize, alloc, fmt0, ap)
- char **strp;
- size_t strsize;
- int alloc;
- const char *fmt0;
- va_list ap;
+xxxprintf(char **strp, size_t strsize, int alloc, const char *fmt0, va_list ap)
{
char *fmt; /* format string */
int ch; /* character from fmt */
#ifndef HAVE_VSNPRINTF
int
-vsnprintf(str, n, fmt, ap)
- char *str;
- size_t n;
- const char *fmt;
- va_list ap;
+vsnprintf(char *str, size_t n, const char *fmt, va_list ap)
{
return (xxxprintf(&str, n, 0, fmt, ap));
#ifndef HAVE_SNPRINTF
int
-#ifdef __STDC__
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;
va_list ap;
-#ifdef __STDC__
va_start(ap, fmt);
-#else
- va_start(ap);
-#endif
ret = xxxprintf(&str, n, 0, fmt, ap);
va_end(ap);
return (ret);
#ifndef HAVE_VASPRINTF
int
-vasprintf(str, fmt, ap)
- char **str;
- const char *fmt;
- va_list ap;
+vasprintf(char **str, const char *fmt, va_list ap)
{
return (xxxprintf(str, 0, 1, fmt, ap));
#ifndef HAVE_ASPRINTF
int
-#ifdef __STDC__
asprintf(char **str, char const *fmt, ...)
-#else
-asprintf(str, fmt, va_alist)
- char **str;
- char const *fmt;
- va_dcl
-#endif
{
int ret;
va_list ap;
-#ifdef __STDC__
va_start(ap, fmt);
-#else
- va_start(ap);
-#endif
ret = xxxprintf(str, 0, 1, fmt, ap);
va_end(ap);
return (ret);
};
int
-strcasecmp(s1, s2)
- const char *s1;
- const char *s2;
+strcasecmp(const char *s1, const char *s2)
{
const unsigned char *us1 = (const unsigned char *) s1;
const unsigned char *us2 = (const unsigned char *) s2;
}
int
-strncasecmp(s1, s2, n)
- const char *s1;
- const char *s2;
- size_t n;
+strncasecmp(const char *s1, const char *s2, size_t n)
{
const unsigned char *us1 = (const unsigned char *) s1;
const unsigned char *us2 = (const unsigned char *) s2;
* Map errno -> error string.
*/
char *
-strerror(n)
- int n;
+strerror(int n)
{
extern int sys_nerr;
extern char *sys_errlist[];
* If retval >= siz, truncation occurred.
*/
size_t
-strlcat(dst, src, siz)
- char *dst;
- const char *src;
- size_t siz;
+strlcat(char *dst, const char *src, size_t siz)
{
char *d = dst;
const char *s = src;
* Returns strlen(src); if retval >= siz, truncation occurred.
*/
size_t
-strlcpy(dst, src, siz)
- char *dst;
- const char *src;
- size_t siz;
+strlcpy(char *dst, const char *src, size_t siz)
{
char *d = dst;
const char *s = src;
* Get signal description string
*/
char *
-strsignal(signo)
- int signo;
+strsignal(int signo)
{
extern const char *const sys_siglist[];
time_t modtime; /* mod time */
};
-#ifdef __STDC__
int utime(const char *, const struct utimbuf *);
-#else
-int utime();
-#endif
#endif /* _UTIME_H */
* Emulate utimes() via utime()
*/
int
-utimes(file, times)
- const char *file;
- const struct timeval *times;
+utimes(const char *file, const struct timeval *times)
{
if (times != NULL) {
struct utimbuf utb;
* Emulate futimes() via futime()
*/
int
-futimes(fd, times)
- int fd;
- const struct timeval *times;
+futimes(int fd, const struct timeval *times)
{
if (times != NULL) {
struct utimbuf utb;