Blame src/getsdir.h

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