Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/lib/libc/gen/glob.c,v rcsdiff: /ftp/cvs/cvsroot/src/lib/libc/gen/glob.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.5.4.1 retrieving revision 1.8 diff -u -p -r1.5.4.1 -r1.8 --- src/lib/libc/gen/glob.c 1996/09/16 18:40:29 1.5.4.1 +++ src/lib/libc/gen/glob.c 1997/10/21 00:56:55 1.8 @@ -1,4 +1,4 @@ -/* $NetBSD: glob.c,v 1.5.4.1 1996/09/16 18:40:29 jtc Exp $ */ +/* $NetBSD: glob.c,v 1.8 1997/10/21 00:56:55 fvdl Exp $ */ /* * Copyright (c) 1989, 1993 @@ -36,11 +36,12 @@ * SUCH DAMAGE. */ +#include #if defined(LIBC_SCCS) && !defined(lint) #if 0 static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93"; #else -static char rcsid[] = "$NetBSD: glob.c,v 1.5.4.1 1996/09/16 18:40:29 jtc Exp $"; +__RCSID("$NetBSD: glob.c,v 1.8 1997/10/21 00:56:55 fvdl Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -83,6 +84,17 @@ static char rcsid[] = "$NetBSD: glob.c,v #include #include +#undef glob +#undef globfree +#undef fstat +#undef lstat +#undef stat + +#ifdef __weak_alias +__weak_alias(glob,_glob); +__weak_alias(globfree,_globfree); +#endif + #define DOLLAR '$' #define DOT '.' #define EOS '\0' @@ -135,21 +147,21 @@ typedef char Char; static int compare __P((const void *, const void *)); static void g_Ctoc __P((const Char *, char *)); -static int g_lstat __P((Char *, struct stat *, glob_t *)); -static DIR *g_opendir __P((Char *, glob_t *)); +static int g_lstat __P((Char *, struct stat12 *, glob12_t *)); +static DIR *g_opendir __P((Char *, glob12_t *)); static Char *g_strchr __P((Char *, int)); #ifdef notdef static Char *g_strcat __P((Char *, const Char *)); #endif -static int g_stat __P((Char *, struct stat *, glob_t *)); -static int glob0 __P((const Char *, glob_t *)); -static int glob1 __P((Char *, glob_t *)); -static int glob2 __P((Char *, Char *, Char *, glob_t *)); -static int glob3 __P((Char *, Char *, Char *, Char *, glob_t *)); -static int globextend __P((const Char *, glob_t *)); -static const Char * globtilde __P((const Char *, Char *, glob_t *)); -static int globexp1 __P((const Char *, glob_t *)); -static int globexp2 __P((const Char *, const Char *, glob_t *, int *)); +static int g_stat __P((Char *, struct stat12 *, glob12_t *)); +static int glob0 __P((const Char *, glob12_t *)); +static int glob1 __P((Char *, glob12_t *)); +static int glob2 __P((Char *, Char *, Char *, glob12_t *)); +static int glob3 __P((Char *, Char *, Char *, Char *, glob12_t *)); +static int globextend __P((const Char *, glob12_t *)); +static const Char * globtilde __P((const Char *, Char *, glob12_t *)); +static int globexp1 __P((const Char *, glob12_t *)); +static int globexp2 __P((const Char *, const Char *, glob12_t *, int *)); static int match __P((Char *, Char *, Char *)); #ifdef DEBUG static void qprintf __P((const char *, Char *)); @@ -159,7 +171,7 @@ int glob(pattern, flags, errfunc, pglob) const char *pattern; int flags, (*errfunc) __P((const char *, int)); - glob_t *pglob; + glob12_t *pglob; { const u_char *patnext; int c; @@ -209,7 +221,7 @@ glob(pattern, flags, errfunc, pglob) */ static int globexp1(pattern, pglob) const Char *pattern; - glob_t *pglob; + glob12_t *pglob; { const Char* ptr = pattern; int rv; @@ -233,7 +245,7 @@ static int globexp1(pattern, pglob) */ static int globexp2(ptr, pattern, pglob, rv) const Char *ptr, *pattern; - glob_t *pglob; + glob12_t *pglob; int *rv; { int i; @@ -340,7 +352,7 @@ static const Char * globtilde(pattern, patbuf, pglob) const Char *pattern; Char *patbuf; - glob_t *pglob; + glob12_t *pglob; { struct passwd *pwd; char *h; @@ -401,7 +413,7 @@ globtilde(pattern, patbuf, pglob) static int glob0(pattern, pglob) const Char *pattern; - glob_t *pglob; + glob12_t *pglob; { const Char *qpatnext; int c, err, oldpathc; @@ -493,7 +505,7 @@ compare(p, q) static int glob1(pattern, pglob) Char *pattern; - glob_t *pglob; + glob12_t *pglob; { Char pathbuf[MAXPATHLEN+1]; @@ -511,9 +523,9 @@ glob1(pattern, pglob) static int glob2(pathbuf, pathend, pattern, pglob) Char *pathbuf, *pathend, *pattern; - glob_t *pglob; + glob12_t *pglob; { - struct stat sb; + struct stat12 sb; Char *p, *q; int anymeta; @@ -562,7 +574,7 @@ glob2(pathbuf, pathend, pattern, pglob) static int glob3(pathbuf, pathend, pattern, restpattern, pglob) Char *pathbuf, *pathend, *pattern, *restpattern; - glob_t *pglob; + glob12_t *pglob; { register struct dirent *dp; DIR *dirp; @@ -575,7 +587,7 @@ glob3(pathbuf, pathend, pattern, restpat * and dirent.h as taking pointers to differently typed opaque * structures. */ - struct dirent *(*readdirfunc)(); + struct dirent *(*readdirfunc) __P((void *)); *pathend = EOS; errno = 0; @@ -597,7 +609,7 @@ glob3(pathbuf, pathend, pattern, restpat if (pglob->gl_flags & GLOB_ALTDIRFUNC) readdirfunc = pglob->gl_readdir; else - readdirfunc = readdir; + readdirfunc = (struct dirent *(*)__P((void *))) readdir; while ((dp = (*readdirfunc)(dirp))) { register u_char *sc; register Char *dc; @@ -626,7 +638,7 @@ glob3(pathbuf, pathend, pattern, restpat /* - * Extend the gl_pathv member of a glob_t structure to accomodate a new item, + * Extend the gl_pathv member of a glob12_t structure to accomodate a new item, * add the new item, and update gl_pathc. * * This assumes the BSD realloc, which only copies the block when its size @@ -635,14 +647,14 @@ glob3(pathbuf, pathend, pattern, restpat * * Return 0 if new item added, error code if memory couldn't be allocated. * - * Invariant of the glob_t structure: + * Invariant of the glob12_t structure: * Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and * gl_pathv points to (gl_offs + gl_pathc + 1) items. */ static int globextend(path, pglob) const Char *path; - glob_t *pglob; + glob12_t *pglob; { register char **pathv; register int i; @@ -727,10 +739,10 @@ match(name, pat, patend) return(*name == EOS); } -/* Free allocated data belonging to a glob_t structure. */ +/* Free allocated data belonging to a glob12_t structure. */ void globfree(pglob) - glob_t *pglob; + glob12_t *pglob; { register int i; register char **pp; @@ -747,7 +759,7 @@ globfree(pglob) static DIR * g_opendir(str, pglob) register Char *str; - glob_t *pglob; + glob12_t *pglob; { char buf[MAXPATHLEN]; @@ -765,8 +777,8 @@ g_opendir(str, pglob) static int g_lstat(fn, sb, pglob) register Char *fn; - struct stat *sb; - glob_t *pglob; + struct stat12 *sb; + glob12_t *pglob; { char buf[MAXPATHLEN]; @@ -779,8 +791,8 @@ g_lstat(fn, sb, pglob) static int g_stat(fn, sb, pglob) register Char *fn; - struct stat *sb; - glob_t *pglob; + struct stat12 *sb; + glob12_t *pglob; { char buf[MAXPATHLEN];