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 retrieving revision 1.7 retrieving revision 1.8 diff -u -p -r1.7 -r1.8 --- src/lib/libc/gen/glob.c 1997/07/21 14:07:17 1.7 +++ src/lib/libc/gen/glob.c 1997/10/21 00:56:55 1.8 @@ -1,4 +1,4 @@ -/* $NetBSD: glob.c,v 1.7 1997/07/21 14:07:17 jtc Exp $ */ +/* $NetBSD: glob.c,v 1.8 1997/10/21 00:56:55 fvdl Exp $ */ /* * Copyright (c) 1989, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93"; #else -__RCSID("$NetBSD: glob.c,v 1.7 1997/07/21 14:07:17 jtc Exp $"); +__RCSID("$NetBSD: glob.c,v 1.8 1997/10/21 00:56:55 fvdl Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -84,6 +84,12 @@ __RCSID("$NetBSD: glob.c,v 1.7 1997/07/2 #include #include +#undef glob +#undef globfree +#undef fstat +#undef lstat +#undef stat + #ifdef __weak_alias __weak_alias(glob,_glob); __weak_alias(globfree,_globfree); @@ -141,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 *)); @@ -165,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; @@ -215,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; @@ -239,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; @@ -346,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; @@ -407,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; @@ -499,7 +505,7 @@ compare(p, q) static int glob1(pattern, pglob) Char *pattern; - glob_t *pglob; + glob12_t *pglob; { Char pathbuf[MAXPATHLEN+1]; @@ -517,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; @@ -568,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; @@ -632,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 @@ -641,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; @@ -733,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; @@ -753,7 +759,7 @@ globfree(pglob) static DIR * g_opendir(str, pglob) register Char *str; - glob_t *pglob; + glob12_t *pglob; { char buf[MAXPATHLEN]; @@ -771,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]; @@ -785,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];