1 | /* Save the list of files in a directory, with additional information.
|
---|
2 |
|
---|
3 | Copyright 1997, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
|
---|
4 |
|
---|
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.
|
---|
9 |
|
---|
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.
|
---|
14 |
|
---|
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. */
|
---|
18 |
|
---|
19 | /* Written by James Youngman <jay@gnu.org>.
|
---|
20 | * Based on savedir.h by David MacKenzie <djm@gnu.org>.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #if !defined SAVEDIRINFO_H_
|
---|
24 | # define SAVEDIRINFO_H_
|
---|
25 |
|
---|
26 |
|
---|
27 | typedef enum tagSaveDirControlFlags
|
---|
28 | {
|
---|
29 | SavedirSort = 1
|
---|
30 | }
|
---|
31 | SaveDirControlFlags;
|
---|
32 |
|
---|
33 |
|
---|
34 | typedef enum tagSaveDirDataFlags
|
---|
35 | {
|
---|
36 | SavedirHaveFileType = 1
|
---|
37 | }
|
---|
38 | SaveDirDataFlags;
|
---|
39 |
|
---|
40 |
|
---|
41 | /* We keep the name and the type in a structure together
|
---|
42 | * to allow us to sort them together.
|
---|
43 | */
|
---|
44 | struct savedir_direntry
|
---|
45 | {
|
---|
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) */
|
---|
49 | };
|
---|
50 |
|
---|
51 | struct savedir_dirinfo
|
---|
52 | {
|
---|
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 */
|
---|
56 | };
|
---|
57 |
|
---|
58 |
|
---|
59 | struct savedir_extrainfo
|
---|
60 | {
|
---|
61 | mode_t type_info;
|
---|
62 | };
|
---|
63 |
|
---|
64 | /* savedirinfo() is the old interface. */
|
---|
65 | char *savedirinfo (const char *dir, struct savedir_extrainfo **extra);
|
---|
66 |
|
---|
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.
|
---|
69 | */
|
---|
70 | struct savedir_dirinfo * xsavedir(const char *dir, int flags);
|
---|
71 | void free_dirinfo(struct savedir_dirinfo *p);
|
---|
72 |
|
---|
73 | #endif
|
---|