1 
2 /*
3  * getsdir.h
4  *
5  *	Datatypes and constants for getsdir() - a function to get and
6  *	return a sorted directory listing.
7  *
8  *	$Id: getsdir.h,v 1.4 2007-10-10 20:18:20 al-guest Exp $
9  *
10  *	Copyright (c) 1998 by James S. Seymour (jseymour@jimsun.LinxNet.com)
11  *
12  *	This code is free software; you can redistribute it and/or
13  *	modify it under the terms of the GNU General Public License
14  *	as published by the Free Software Foundation; either version
15  *	2 of the License, or (at your option) any later version.
16  *
17  *  You should have received a copy of the GNU General Public License along
18  *  with this program; if not, write to the Free Software Foundation, Inc.,
19  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  *	Note: getsdir() uses "wildmat.c", which has different copyright
22  *	and licensing conditions.  See the source, Luke.
23  */
24 
25 #include <dirent.h>
26 #include <sys/syslimits.h>
27 
28 #define MAXNAMLEN	NAME_MAX
29 
30 typedef struct dirEntry {		/* structure of data item */
31   char fname[MAXNAMLEN + 1];		/* filename + terminating null */
32   time_t time;				/* last modification date */
33   mode_t mode;				/* file mode (dir? etc.) */
34   ushort cflags;			/* caller field for convenience */
35 } GETSDIR_ENTRY;
36 
37 #define GETSDIR_PARNT    0x01		/* include parent dir (..) */
38 #define GETSDIR_NSORT    0x02		/* sort by name */
39 #define GETSDIR_TSORT    0x04		/* sort by time (NSORT wins) */
40 /*
41  * the following are only meaningful if NSORT or TSORT are specified
42  */
43 #define GETSDIR_DIRSF    0x08		/* dirs first */
44 #define GETSDIR_DIRSL    0x10		/* dirs last */
45 #define GETSDIR_RSORT    0x20		/* reverse sort (does not affect
46 					   DIRSF/DIRSL */
47 
48 extern int getsdir(const char *dirpath, const char *pattern, int sortflags,
49                    mode_t modemask, GETSDIR_ENTRY **datptr, int *len);
50 
51