[BACK]Return to glob.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / gen

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libc/gen/glob.c between version 1.7 and 1.8

version 1.7, 1997/07/21 14:07:17 version 1.8, 1997/10/21 00:56:55
Line 84  __RCSID("$NetBSD$");
Line 84  __RCSID("$NetBSD$");
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
   
   #undef glob
   #undef globfree
   #undef fstat
   #undef lstat
   #undef stat
   
 #ifdef __weak_alias  #ifdef __weak_alias
 __weak_alias(glob,_glob);  __weak_alias(glob,_glob);
 __weak_alias(globfree,_globfree);  __weak_alias(globfree,_globfree);
Line 141  typedef char Char;
Line 147  typedef char Char;
   
 static int       compare __P((const void *, const void *));  static int       compare __P((const void *, const void *));
 static void      g_Ctoc __P((const Char *, char *));  static void      g_Ctoc __P((const Char *, char *));
 static int       g_lstat __P((Char *, struct stat *, glob_t *));  static int       g_lstat __P((Char *, struct stat12 *, glob12_t *));
 static DIR      *g_opendir __P((Char *, glob_t *));  static DIR      *g_opendir __P((Char *, glob12_t *));
 static Char     *g_strchr __P((Char *, int));  static Char     *g_strchr __P((Char *, int));
 #ifdef notdef  #ifdef notdef
 static Char     *g_strcat __P((Char *, const Char *));  static Char     *g_strcat __P((Char *, const Char *));
 #endif  #endif
 static int       g_stat __P((Char *, struct stat *, glob_t *));  static int       g_stat __P((Char *, struct stat12 *, glob12_t *));
 static int       glob0 __P((const Char *, glob_t *));  static int       glob0 __P((const Char *, glob12_t *));
 static int       glob1 __P((Char *, glob_t *));  static int       glob1 __P((Char *, glob12_t *));
 static int       glob2 __P((Char *, Char *, Char *, glob_t *));  static int       glob2 __P((Char *, Char *, Char *, glob12_t *));
 static int       glob3 __P((Char *, Char *, Char *, Char *, glob_t *));  static int       glob3 __P((Char *, Char *, Char *, Char *, glob12_t *));
 static int       globextend __P((const Char *, glob_t *));  static int       globextend __P((const Char *, glob12_t *));
 static const Char *      globtilde __P((const Char *, Char *, glob_t *));  static const Char *      globtilde __P((const Char *, Char *, glob12_t *));
 static int       globexp1 __P((const Char *, glob_t *));  static int       globexp1 __P((const Char *, glob12_t *));
 static int       globexp2 __P((const Char *, const Char *, glob_t *, int *));  static int       globexp2 __P((const Char *, const Char *, glob12_t *, int *));
 static int       match __P((Char *, Char *, Char *));  static int       match __P((Char *, Char *, Char *));
 #ifdef DEBUG  #ifdef DEBUG
 static void      qprintf __P((const char *, Char *));  static void      qprintf __P((const char *, Char *));
Line 165  int
Line 171  int
 glob(pattern, flags, errfunc, pglob)  glob(pattern, flags, errfunc, pglob)
         const char *pattern;          const char *pattern;
         int flags, (*errfunc) __P((const char *, int));          int flags, (*errfunc) __P((const char *, int));
         glob_t *pglob;          glob12_t *pglob;
 {  {
         const u_char *patnext;          const u_char *patnext;
         int c;          int c;
Line 215  glob(pattern, flags, errfunc, pglob)
Line 221  glob(pattern, flags, errfunc, pglob)
  */   */
 static int globexp1(pattern, pglob)  static int globexp1(pattern, pglob)
         const Char *pattern;          const Char *pattern;
         glob_t *pglob;          glob12_t *pglob;
 {  {
         const Char* ptr = pattern;          const Char* ptr = pattern;
         int rv;          int rv;
Line 239  static int globexp1(pattern, pglob)
Line 245  static int globexp1(pattern, pglob)
  */   */
 static int globexp2(ptr, pattern, pglob, rv)  static int globexp2(ptr, pattern, pglob, rv)
         const Char *ptr, *pattern;          const Char *ptr, *pattern;
         glob_t *pglob;          glob12_t *pglob;
         int *rv;          int *rv;
 {  {
         int     i;          int     i;
Line 346  static const Char *
Line 352  static const Char *
 globtilde(pattern, patbuf, pglob)  globtilde(pattern, patbuf, pglob)
         const Char *pattern;          const Char *pattern;
         Char *patbuf;          Char *patbuf;
         glob_t *pglob;          glob12_t *pglob;
 {  {
         struct passwd *pwd;          struct passwd *pwd;
         char *h;          char *h;
Line 407  globtilde(pattern, patbuf, pglob)
Line 413  globtilde(pattern, patbuf, pglob)
 static int  static int
 glob0(pattern, pglob)  glob0(pattern, pglob)
         const Char *pattern;          const Char *pattern;
         glob_t *pglob;          glob12_t *pglob;
 {  {
         const Char *qpatnext;          const Char *qpatnext;
         int c, err, oldpathc;          int c, err, oldpathc;
Line 499  compare(p, q)
Line 505  compare(p, q)
 static int  static int
 glob1(pattern, pglob)  glob1(pattern, pglob)
         Char *pattern;          Char *pattern;
         glob_t *pglob;          glob12_t *pglob;
 {  {
         Char pathbuf[MAXPATHLEN+1];          Char pathbuf[MAXPATHLEN+1];
   
Line 517  glob1(pattern, pglob)
Line 523  glob1(pattern, pglob)
 static int  static int
 glob2(pathbuf, pathend, pattern, pglob)  glob2(pathbuf, pathend, pattern, pglob)
         Char *pathbuf, *pathend, *pattern;          Char *pathbuf, *pathend, *pattern;
         glob_t *pglob;          glob12_t *pglob;
 {  {
         struct stat sb;          struct stat12 sb;
         Char *p, *q;          Char *p, *q;
         int anymeta;          int anymeta;
   
Line 568  glob2(pathbuf, pathend, pattern, pglob)
Line 574  glob2(pathbuf, pathend, pattern, pglob)
 static int  static int
 glob3(pathbuf, pathend, pattern, restpattern, pglob)  glob3(pathbuf, pathend, pattern, restpattern, pglob)
         Char *pathbuf, *pathend, *pattern, *restpattern;          Char *pathbuf, *pathend, *pattern, *restpattern;
         glob_t *pglob;          glob12_t *pglob;
 {  {
         register struct dirent *dp;          register struct dirent *dp;
         DIR *dirp;          DIR *dirp;
Line 632  glob3(pathbuf, pathend, pattern, restpat
Line 638  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.   * add the new item, and update gl_pathc.
  *   *
  * This assumes the BSD realloc, which only copies the block when its size   * This assumes the BSD realloc, which only copies the block when its size
Line 641  glob3(pathbuf, pathend, pattern, restpat
Line 647  glob3(pathbuf, pathend, pattern, restpat
  *   *
  * Return 0 if new item added, error code if memory couldn't be allocated.   * 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   *      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.   *      gl_pathv points to (gl_offs + gl_pathc + 1) items.
  */   */
 static int  static int
 globextend(path, pglob)  globextend(path, pglob)
         const Char *path;          const Char *path;
         glob_t *pglob;          glob12_t *pglob;
 {  {
         register char **pathv;          register char **pathv;
         register int i;          register int i;
Line 733  match(name, pat, patend)
Line 739  match(name, pat, patend)
         return(*name == EOS);          return(*name == EOS);
 }  }
   
 /* Free allocated data belonging to a glob_t structure. */  /* Free allocated data belonging to a glob12_t structure. */
 void  void
 globfree(pglob)  globfree(pglob)
         glob_t *pglob;          glob12_t *pglob;
 {  {
         register int i;          register int i;
         register char **pp;          register char **pp;
Line 753  globfree(pglob)
Line 759  globfree(pglob)
 static DIR *  static DIR *
 g_opendir(str, pglob)  g_opendir(str, pglob)
         register Char *str;          register Char *str;
         glob_t *pglob;          glob12_t *pglob;
 {  {
         char buf[MAXPATHLEN];          char buf[MAXPATHLEN];
   
Line 771  g_opendir(str, pglob)
Line 777  g_opendir(str, pglob)
 static int  static int
 g_lstat(fn, sb, pglob)  g_lstat(fn, sb, pglob)
         register Char *fn;          register Char *fn;
         struct stat *sb;          struct stat12 *sb;
         glob_t *pglob;          glob12_t *pglob;
 {  {
         char buf[MAXPATHLEN];          char buf[MAXPATHLEN];
   
Line 785  g_lstat(fn, sb, pglob)
Line 791  g_lstat(fn, sb, pglob)
 static int  static int
 g_stat(fn, sb, pglob)  g_stat(fn, sb, pglob)
         register Char *fn;          register Char *fn;
         struct stat *sb;          struct stat12 *sb;
         glob_t *pglob;          glob12_t *pglob;
 {  {
         char buf[MAXPATHLEN];          char buf[MAXPATHLEN];
   

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

CVSweb <webmaster@jp.NetBSD.org>