home *** CD-ROM | disk | FTP | other *** search
/ Serving the Web / ServingTheWeb1995.disc1of1.iso / linux / slacksrce / d / libc / libc-4.6 / libc-4 / libc-linux / compat / glob.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-02-17  |  2.7 KB  |  69 lines

  1. /* Copyright (C) 1991 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. #ifndef    _GLOB_H
  20.  
  21. #define    _GLOB_H    1
  22.  
  23. #include <features.h>
  24.  
  25. /* Bits set in the FLAGS argument to `glob'.  */
  26. #define    GLOB_ERR    (1 << 0)/* Return on read errors.  */
  27. #define    GLOB_MARK    (1 << 1)/* Append a slash to each name.  */
  28. #define    GLOB_NOSORT    (1 << 2)/* Don't sort the names.  */
  29. #define    GLOB_DOOFFS    (1 << 3)/* Insert PGLOB->gl_offs NULLs.  */
  30. #define    GLOB_NOCHECK    (1 << 4)/* If nothing matches, return the pattern.  */
  31. #define    GLOB_APPEND    (1 << 5)/* Append to results of a previous call.  */
  32. #define    GLOB_NOESCAPE    (1 << 6)/* Backslashes don't quote metacharacters.  */
  33. #define    GLOB_PERIOD    (1 << 7)/* Leading `.' can be matched by metachars.  */
  34. #define    __GLOB_FLAGS    (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \
  35.              GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND|GLOB_PERIOD)
  36.  
  37. /* Error returns from `glob'.  */
  38. #define    GLOB_NOSPACE    1    /* Ran out of memory.  */
  39. #define    GLOB_ABEND    2    /* Read error.  */
  40. #define    GLOB_NOMATCH    3    /* No matches found.  */
  41.  
  42. /* Structure describing a globbing run.  */
  43. typedef struct
  44.   {
  45.     int gl_pathc;    /* Count of paths matched by the pattern.  */
  46.     char **gl_pathv;    /* List of matched pathnames.  */
  47.     int gl_offs;    /* Slots to reserve in `gl_pathv'.  */
  48.   } glob_t;
  49.  
  50. __BEGIN_DECLS
  51.  
  52. /* Do glob searching for PATTERN, placing results in PGLOB.
  53.    The bits defined above may be set in FLAGS.
  54.    If a directory cannot be opened or read and ERRFUNC is not nil,
  55.    it is called with the pathname that caused the error, and the
  56.    `errno' value from the failing call; if it returns non-zero
  57.    `glob' returns GLOB_ABEND; if it returns zero, the error is ignored.
  58.    If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
  59.    Otherwise, `glob' returns zero.  */
  60. extern int glob __P ((const char *__pattern, int __flags,
  61.         int (*__errfunc)(const char *, int), glob_t *__pglob));
  62.  
  63. /* Free storage allocated in PGLOB by a previous `glob' call.  */
  64. extern void globfree __P ((glob_t *__pglob));
  65.  
  66. __END_DECLS
  67.  
  68. #endif    /* glob.h  */
  69.