cvsimport
[findutils.git] / lib / savedirinfo.h
blob365f144f23bf1a30d5ca0d1a21837786bdebaeaf
1 /* Save the list of files in a directory, with additional information.
3 Copyright 1997, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 /* Written by James Youngman <jay@gnu.org>.
20 * Based on savedir.h by David MacKenzie <djm@gnu.org>.
23 #if !defined SAVEDIRINFO_H_
24 # define SAVEDIRINFO_H_
27 typedef enum tagSaveDirControlFlags
29 SavedirSort = 1
31 SaveDirControlFlags;
34 typedef enum tagSaveDirDataFlags
36 SavedirHaveFileType = 1
38 SaveDirDataFlags;
41 /* We keep the name and the type in a structure together
42 * to allow us to sort them together.
44 struct savedir_direntry
46 int flags; /* from SaveDirDataFlags */
47 char *name; /* the name of the directory entry */
48 mode_t type_info; /* the type (or zero if unknown) */
51 struct savedir_dirinfo
53 char *buffer; /* The names are stored here. */
54 size_t size; /* The total number of results. */
55 struct savedir_direntry *entries; /* The results themselves */
59 struct savedir_extrainfo
61 mode_t type_info;
64 /* savedirinfo() is the old interface. */
65 char *savedirinfo (const char *dir, struct savedir_extrainfo **extra);
67 /* savedir() is the 'new' interface, but the function has the same name
68 * as the function from findutils 4.1.7 and 4.1.20.
70 struct savedir_dirinfo * xsavedir(const char *dir, int flags);
71 void free_dirinfo(struct savedir_dirinfo *p);
73 #endif