1 /* 2 * $Id: LTglob.h,v 1.1 2004/08/28 19:23:30 dannybackx Exp $ 3 * 4 * Copyright (C) 1991, 1992 Free Software Foundation, Inc. 5 * Copyright (C) 1995-2000 LessTif Development Team 6 * 7 * This file is part of the GNU LessTif Library. 8 * 9 * This library is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU Library General Public 11 * License as published by the Free Software Foundation; either 12 * version 2 of the License, or (at your option) any later version. 13 * 14 * This library is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * Library General Public License for more details. 18 * 19 * You should have received a copy of the GNU Library General Public 20 * License along with this library; if not, write to the Free 21 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 * 23 **/ 24 25 26 #ifndef _LTGLOB_H 27 #define _LTGLOB_H 28 29 30 /* Begin of "<LTfnmatch.h>" */ 31 /* We #undef these before defining them because some losing systems 32 (HP-UX A.08.07 for example) define these in <unistd.h>. */ 33 #undef FNM_PATHNAME 34 #undef FNM_NOESCAPE 35 #undef FNM_PERIOD 36 37 /* Bits set in the FLAGS argument to `fnmatch'. */ 38 #define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ 39 #define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ 40 #define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ 41 42 #if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE) 43 #define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ 44 #define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ 45 #define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ 46 #endif 47 48 /* The 9 lines under this are to make us work on RedHat 5.0 which doesn't 49 * seem to trigger the stuff above. 50 * Remove these lines if they bother you; please send me mail about it 51 * if this happens. <lesstif@lesstif.org>. 52 * Danny 4/2/1998 53 */ 54 #ifndef FNM_FILE_NAME 55 #define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ 56 #endif 57 #ifndef FNM_LEADING_DIR 58 #define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ 59 #endif 60 #ifndef FNM_CASEFOLD 61 #define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ 62 #endif 63 64 /* Value returned by `fnmatch' if STRING does not match PATTERN. */ 65 #define FNM_NOMATCH 1 66 67 /* End of "<LTfnmatch.h>" */ 68 69 70 /* Some system header files erroneously define these. 71 We want our own definitions to take precedence. */ 72 #undef GLOB_ERR 73 #undef GLOB_MARK 74 #undef GLOB_NOSORT 75 #undef GLOB_DOOFFS 76 #undef GLOB_NOCHECK 77 #undef GLOB_APPEND 78 #undef GLOB_NOESCAPE 79 #undef GLOB_PERIOD 80 81 /* Bits set in the FLAGS argument to `glob'. */ 82 #define GLOB_ERR (1 << 0)/* Return on read errors. */ 83 #define GLOB_MARK (1 << 1)/* Append a slash to each name. */ 84 #define GLOB_NOSORT (1 << 2)/* Don't sort the names. */ 85 #define GLOB_DOOFFS (1 << 3)/* Insert PGLOB->gl_offs NULLs. */ 86 #define GLOB_NOCHECK (1 << 4)/* If nothing matches, return the pattern. */ 87 #define GLOB_APPEND (1 << 5)/* Append to results of a previous call. */ 88 #define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */ 89 #define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */ 90 #define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ 91 GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND|GLOB_PERIOD) 92 93 /* This is not POSIX, so don't try to be too clever ... */ 94 #ifndef GLOB_MAGCHAR 95 #define GLOB_MAGCHAR (1 << 8) /* Set in gl_flags if any metachars seen. */ 96 #endif 97 98 /* Error returns from `glob'. */ 99 #define GLOB_NOSPACE 1 /* Ran out of memory. */ 100 #define GLOB_ABEND 2 /* Read error. */ 101 #define GLOB_NOMATCH 3 /* No matches found. */ 102 103 /* Structure describing a globbing run. */ 104 typedef struct 105 { 106 int gl_pathc; /* Count of paths matched by the pattern. */ 107 char **gl_pathv; /* List of matched pathnames. */ 108 int gl_offs; /* Slots to reserve in `gl_pathv'. */ 109 int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */ 110 } glob_t; 111 112 /* Do glob searching for PATTERN, placing results in PGLOB. 113 The bits defined above may be set in FLAGS. 114 If a directory cannot be opened or read and ERRFUNC is not nil, 115 it is called with the pathname that caused the error, and the 116 `errno' value from the failing call; if it returns non-zero 117 `glob' returns GLOB_ABEND; if it returns zero, the error is ignored. 118 If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned. 119 Otherwise, `glob' returns zero. */ 120 int _Lesstif_glob (const char *__pattern, int __flags, 121 int (*__errfunc) (const char *, int), 122 glob_t *__pglob); 123 124 /* Free storage allocated in PGLOB by a previous `glob' call. */ 125 void _Lesstif_globfree (glob_t *__pglob); 126 127 128 #if 0 129 /* We don't use these hooks ... */ 130 /* If they are non-NULL our `glob()' uses these functions 131 to read directories. */ 132 extern void * (*__glob_opendir_hook) (const char *__directory); 133 extern const char *(*__glob_readdir_hook) (void * __stream); 134 extern void (*__glob_closedir_hook) (void * __stream); 135 #endif 136 137 #endif /* _LTGLOB_H */ 138