1da2e3ebdSchin 2da2e3ebdSchin /* : : generated by proto : : */ 3da2e3ebdSchin /*********************************************************************** 4da2e3ebdSchin * * 5da2e3ebdSchin * This software is part of the ast package * 6*3e14f97fSRoger A. Faulkner * Copyright (c) 1985-2010 AT&T Intellectual Property * 7da2e3ebdSchin * and is licensed under the * 8da2e3ebdSchin * Common Public License, Version 1.0 * 97c2fbfb3SApril Chin * by AT&T Intellectual Property * 10da2e3ebdSchin * * 11da2e3ebdSchin * A copy of the License is available at * 12da2e3ebdSchin * http://www.opensource.org/licenses/cpl1.0.txt * 13da2e3ebdSchin * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * 14da2e3ebdSchin * * 15da2e3ebdSchin * Information and Software Systems Research * 16da2e3ebdSchin * AT&T Research * 17da2e3ebdSchin * Florham Park NJ * 18da2e3ebdSchin * * 19da2e3ebdSchin * Glenn Fowler <gsf@research.att.com> * 20da2e3ebdSchin * David Korn <dgk@research.att.com> * 21da2e3ebdSchin * Phong Vo <kpv@research.att.com> * 22da2e3ebdSchin * * 23da2e3ebdSchin ***********************************************************************/ 24da2e3ebdSchin 25da2e3ebdSchin /* 26da2e3ebdSchin * posix glob interface definitions with gnu extensions 27da2e3ebdSchin */ 28da2e3ebdSchin 29da2e3ebdSchin #ifndef _GLOB_H 30da2e3ebdSchin #if !defined(__PROTO__) 31da2e3ebdSchin #include <prototyped.h> 32da2e3ebdSchin #endif 33da2e3ebdSchin #if !defined(__LINKAGE__) 34da2e3ebdSchin #define __LINKAGE__ /* 2004-08-11 transition */ 35da2e3ebdSchin #endif 36da2e3ebdSchin 37da2e3ebdSchin #define _GLOB_H 38da2e3ebdSchin 39da2e3ebdSchin #define GLOB_VERSION 20060717L 40da2e3ebdSchin 41da2e3ebdSchin #include <stdlib.h> 42da2e3ebdSchin 43da2e3ebdSchin struct dirent; 44da2e3ebdSchin struct stat; 45da2e3ebdSchin 46da2e3ebdSchin struct _glob_; 47da2e3ebdSchin struct _globlist_; 48da2e3ebdSchin 49da2e3ebdSchin typedef struct _glob_ glob_t; 50da2e3ebdSchin typedef struct _globlist_ globlist_t; 51da2e3ebdSchin 52da2e3ebdSchin struct _globlist_ 53da2e3ebdSchin { 54da2e3ebdSchin globlist_t* gl_next; 55da2e3ebdSchin char* gl_begin; 56da2e3ebdSchin unsigned char gl_flags; 57da2e3ebdSchin char gl_path[1]; 58da2e3ebdSchin }; 59da2e3ebdSchin 60da2e3ebdSchin struct _glob_ 61da2e3ebdSchin { 62da2e3ebdSchin size_t gl_pathc; 63da2e3ebdSchin char** gl_pathv; 64da2e3ebdSchin size_t gl_offs; 65da2e3ebdSchin globlist_t* gl_list; 66da2e3ebdSchin int gl_flags; 67da2e3ebdSchin 68da2e3ebdSchin /* GLOB_DISC data -- memset(&gl,0,sizeof(gl)) before using! */ 69da2e3ebdSchin 70da2e3ebdSchin const char* gl_fignore; 71da2e3ebdSchin const char* gl_suffix; 72da2e3ebdSchin unsigned char* gl_intr; 73da2e3ebdSchin 74da2e3ebdSchin int gl_delim; 75da2e3ebdSchin 76da2e3ebdSchin __V_* gl_handle; 77da2e3ebdSchin __V_* (*gl_diropen) __PROTO__((glob_t*, const char*)); 78da2e3ebdSchin char* (*gl_dirnext) __PROTO__((glob_t*, __V_*)); 79da2e3ebdSchin void (*gl_dirclose) __PROTO__((glob_t*, __V_*)); 807c2fbfb3SApril Chin int (*gl_type) __PROTO__((glob_t*, const char*, int)); 817c2fbfb3SApril Chin int (*gl_attr) __PROTO__((glob_t*, const char*, int)); 82da2e3ebdSchin 83da2e3ebdSchin /* gnu extensions -- but how do you synthesize dirent and stat? */ 84da2e3ebdSchin 85da2e3ebdSchin __V_* (*gl_opendir) __PROTO__((const char*)); 86da2e3ebdSchin struct dirent* (*gl_readdir) __PROTO__((__V_*)); 87da2e3ebdSchin void (*gl_closedir) __PROTO__((__V_*)); 88da2e3ebdSchin int (*gl_stat) __PROTO__((const char*, struct stat*)); 89da2e3ebdSchin int (*gl_lstat) __PROTO__((const char*, struct stat*)); 90da2e3ebdSchin 91da2e3ebdSchin /* ast additions */ 92da2e3ebdSchin 93da2e3ebdSchin char* (*gl_nextdir) __PROTO__((glob_t*, char*)); 94da2e3ebdSchin unsigned long gl_status; 95da2e3ebdSchin unsigned long gl_version; 96da2e3ebdSchin unsigned short gl_extra; 97da2e3ebdSchin 98da2e3ebdSchin #ifdef _GLOB_PRIVATE_ 99da2e3ebdSchin _GLOB_PRIVATE_ 100da2e3ebdSchin #else 101da2e3ebdSchin char* gl_pad[23]; 102da2e3ebdSchin #endif 103da2e3ebdSchin 104da2e3ebdSchin }; 105da2e3ebdSchin 106da2e3ebdSchin /* standard interface */ 107da2e3ebdSchin #define GLOB_APPEND 0x0001 /* append to previous */ 108da2e3ebdSchin #define GLOB_DOOFFS 0x0002 /* gl_offs defines argv offset */ 109da2e3ebdSchin #define GLOB_ERR 0x0004 /* abort on error */ 110da2e3ebdSchin #define GLOB_MARK 0x0008 /* append / to directories */ 111da2e3ebdSchin #define GLOB_NOCHECK 0x0010 /* nomatch is original pattern */ 112da2e3ebdSchin #define GLOB_NOESCAPE 0x0020 /* don't treat \ specially */ 113da2e3ebdSchin #define GLOB_NOSORT 0x0040 /* don't sort the list */ 114da2e3ebdSchin 115da2e3ebdSchin /* extended interface */ 116da2e3ebdSchin #define GLOB_STARSTAR 0x0080 /* enable [/]**[/] expansion */ 117da2e3ebdSchin #define GLOB_BRACE 0x0100 /* enable {...} expansion */ 118da2e3ebdSchin #define GLOB_ICASE 0x0200 /* ignore case on match */ 119da2e3ebdSchin #define GLOB_COMPLETE 0x0400 /* shell file completeion */ 120da2e3ebdSchin #define GLOB_AUGMENTED 0x0800 /* augmented shell patterns */ 121da2e3ebdSchin #define GLOB_STACK 0x1000 /* allocate on current stack */ 122da2e3ebdSchin #define GLOB_LIST 0x2000 /* just create gl_list */ 123da2e3ebdSchin #define GLOB_ALTDIRFUNC 0x4000 /* gnu discipline functions */ 124da2e3ebdSchin #define GLOB_DISC 0x8000 /* discipline initialized */ 125da2e3ebdSchin 126da2e3ebdSchin /* gl_status */ 127da2e3ebdSchin #define GLOB_NOTDIR 0x0001 /* last gl_dirnext() not a dir */ 128da2e3ebdSchin 129da2e3ebdSchin /* gl_type return */ 130da2e3ebdSchin #define GLOB_NOTFOUND 0 /* does not exist */ 131da2e3ebdSchin #define GLOB_DEV 1 /* exists but not DIR EXE REG */ 132da2e3ebdSchin #define GLOB_DIR 2 /* directory */ 133da2e3ebdSchin #define GLOB_EXE 3 /* executable regular file */ 134da2e3ebdSchin #define GLOB_REG 4 /* regular file */ 135da2e3ebdSchin 136da2e3ebdSchin /* error return values */ 137da2e3ebdSchin #define GLOB_ABORTED 1 138da2e3ebdSchin #define GLOB_NOMATCH 2 139da2e3ebdSchin #define GLOB_NOSPACE 3 140da2e3ebdSchin #define GLOB_INTR 4 141da2e3ebdSchin #define GLOB_APPERR 5 142da2e3ebdSchin #define GLOB_NOSYS 6 143da2e3ebdSchin 144da2e3ebdSchin #if _BLD_ast && defined(__EXPORT__) 145da2e3ebdSchin #undef __MANGLE__ 146da2e3ebdSchin #define __MANGLE__ __LINKAGE__ __EXPORT__ 147da2e3ebdSchin #endif 148da2e3ebdSchin 149da2e3ebdSchin extern __MANGLE__ int glob __PROTO__((const char*, int, int(*)(const char*,int), glob_t*)); 150da2e3ebdSchin extern __MANGLE__ void globfree __PROTO__((glob_t*)); 151da2e3ebdSchin 152da2e3ebdSchin #undef __MANGLE__ 153da2e3ebdSchin #define __MANGLE__ __LINKAGE__ 154da2e3ebdSchin 155da2e3ebdSchin #endif /* _GLOB_H */ 156