/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1985-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* David Korn <[email protected]> *18* Phong Vo <[email protected]> *19* *20***********************************************************************/21#pragma prototyped22/*23* posix glob interface definitions with gnu extensions24*/2526#ifndef _GLOB_H27#define _GLOB_H2829#define GLOB_VERSION 20060717L3031#include <stdlib.h>3233struct dirent;34struct stat;3536struct _glob_;37struct _globlist_;3839typedef struct _glob_ glob_t;40typedef struct _globlist_ globlist_t;4142struct _globlist_43{44globlist_t* gl_next;45char* gl_begin;46unsigned char gl_flags;47char gl_path[1];48};4950struct _glob_51{52size_t gl_pathc;53char** gl_pathv;54size_t gl_offs;55globlist_t* gl_list;56int gl_flags;5758/* GLOB_DISC data -- memset(&gl,0,sizeof(gl)) before using! */5960const char* gl_fignore;61const char* gl_suffix;62unsigned char* gl_intr;6364int gl_delim;6566void* gl_handle;67void* (*gl_diropen)(glob_t*, const char*);68char* (*gl_dirnext)(glob_t*, void*);69void (*gl_dirclose)(glob_t*, void*);70int (*gl_type)(glob_t*, const char*, int);71int (*gl_attr)(glob_t*, const char*, int);7273/* gnu extensions -- but how do you synthesize dirent and stat? */7475void* (*gl_opendir)(const char*);76struct dirent* (*gl_readdir)(void*);77void (*gl_closedir)(void*);78int (*gl_stat)(const char*, struct stat*);79int (*gl_lstat)(const char*, struct stat*);8081/* ast additions */8283char* (*gl_nextdir)(glob_t*, char*);84unsigned long gl_status;85unsigned long gl_version;86unsigned short gl_extra;8788#ifdef _GLOB_PRIVATE_89_GLOB_PRIVATE_90#else91char* gl_pad[23];92#endif9394};9596/* standard interface */97#define GLOB_APPEND 0x0001 /* append to previous */98#define GLOB_DOOFFS 0x0002 /* gl_offs defines argv offset */99#define GLOB_ERR 0x0004 /* abort on error */100#define GLOB_MARK 0x0008 /* append / to directories */101#define GLOB_NOCHECK 0x0010 /* nomatch is original pattern */102#define GLOB_NOESCAPE 0x0020 /* don't treat \ specially */103#define GLOB_NOSORT 0x0040 /* don't sort the list */104105/* extended interface */106#define GLOB_STARSTAR 0x0080 /* enable [/]**[/] expansion */107#define GLOB_BRACE 0x0100 /* enable {...} expansion */108#define GLOB_ICASE 0x0200 /* ignore case on match */109#define GLOB_COMPLETE 0x0400 /* shell file completeion */110#define GLOB_AUGMENTED 0x0800 /* augmented shell patterns */111#define GLOB_STACK 0x1000 /* allocate on current stack */112#define GLOB_LIST 0x2000 /* just create gl_list */113#define GLOB_ALTDIRFUNC 0x4000 /* gnu discipline functions */114#define GLOB_DISC 0x8000 /* discipline initialized */115116#define GLOB_GROUP 0x10000 /* REG_SHELL_GROUP */117118/* gl_status */119#define GLOB_NOTDIR 0x0001 /* last gl_dirnext() not a dir */120121/* gl_type return */122#define GLOB_NOTFOUND 0 /* does not exist */123#define GLOB_DEV 1 /* exists but not DIR EXE REG */124#define GLOB_DIR 2 /* directory */125#define GLOB_EXE 3 /* executable regular file */126#define GLOB_REG 4 /* regular file */127128/* error return values */129#define GLOB_ABORTED 1130#define GLOB_NOMATCH 2131#define GLOB_NOSPACE 3132#define GLOB_INTR 4133#define GLOB_APPERR 5134#define GLOB_NOSYS 6135136#if _BLD_ast && defined(__EXPORT__)137#define extern __EXPORT__138#endif139140extern int glob(const char*, int, int(*)(const char*,int), glob_t*);141extern void globfree(glob_t*);142143#undef extern144145#endif /* _GLOB_H */146147148