Applied patch from Jim Meyering; rename dirfd to dir_fd to avoid shadowing problem
[findutils.git] / lib / savedirinfo.h
blobd915de64f67b1a69f081a55ebfdfbc4cf8ec15fc
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 3 of the License, or
8 (at your option) 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, see <http://www.gnu.org/licenses/>.
18 /* Written by James Youngman <jay@gnu.org>.
19 * Based on savedir.h by David MacKenzie <djm@gnu.org>.
22 #if !defined SAVEDIRINFO_H_
23 # define SAVEDIRINFO_H_
26 typedef enum tagSaveDirControlFlags
28 SavedirSort = 1
30 SaveDirControlFlags;
33 typedef enum tagSaveDirDataFlags
35 SavedirHaveFileType = 1
37 SaveDirDataFlags;
40 /* We keep the name and the type in a structure together
41 * to allow us to sort them together.
43 struct savedir_direntry
45 int flags; /* from SaveDirDataFlags */
46 char *name; /* the name of the directory entry */
47 mode_t type_info; /* the type (or zero if unknown) */
50 struct savedir_dirinfo
52 char *buffer; /* The names are stored here. */
53 size_t size; /* The total number of results. */
54 struct savedir_direntry *entries; /* The results themselves */
58 struct savedir_extrainfo
60 mode_t type_info;
63 /* savedirinfo() is the old interface. */
64 char *savedirinfo (const char *dir, struct savedir_extrainfo **extra);
66 /* savedir() is the 'new' interface, but the function has the same name
67 * as the function from findutils 4.1.7 and 4.1.20.
69 struct savedir_dirinfo * xsavedir(const char *dir, int flags);
70 void free_dirinfo(struct savedir_dirinfo *p);
72 #endif