merge in hp300 support from Utah
[unix-history] / usr / src / include / fts.h
CommitLineData
4dedc488
KB
1/*
2 * Copyright (c) 1989 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * advertising materials, and other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley. The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16 *
17 * @(#)fts.h 5.1 (Berkeley) %G%
18 */
19
20typedef struct fts {
21 struct ftsent *cur; /* current node */
22 struct ftsent *child; /* linked list of children */
23 struct ftsent *savelink; /* saved link if node had a cycle */
24 struct ftsent **array; /* sort array */
25 char *path; /* path for this descent */
26 char *wd; /* starting directory */
27 int pathlen; /* sizeof(path) */
28 int nitems; /* elements in the sort array */
29 int (*compar)(); /* compare function */
30#define FTS__STOP 0x001 /* private: unrecoverable error */
31#define FTS_LOGICAL 0x002 /* user: use stat(2) */
32#define FTS_MULTIPLE 0x004 /* user: multiple args */
33#define FTS_NOCHDIR 0x008 /* user: don't use chdir(2) */
34#define FTS_NOSTAT 0x010 /* user: don't require stat info */
35#define FTS_PHYSICAL 0x020 /* user: use lstat(2) */
36#define FTS_SEEDOT 0x040 /* user: return dot and dot-dot */
37 int options; /* openfts() options */
38} FTS;
39
40typedef struct ftsent {
41 struct ftsent *parent; /* parent directory */
42 struct ftsent *link; /* next/cycle node */
43 union {
44 long number; /* local numeric value */
45 void *pointer; /* local address value */
46 } local;
47 char *accpath; /* path from current directory */
48 char *path; /* path from starting directory */
49 short pathlen; /* strlen(path) */
50 short namelen; /* strlen(name) */
51 short level; /* depth (-1 to N) */
52#define FTS_D 1 /* preorder directory */
53#define FTS_DC 2 /* directory that causes cycles */
54#define FTS_DNR 3 /* unreadable directory */
55#define FTS_DNX 4 /* unsearchable directory */
56#define FTS_DP 5 /* postorder directory */
57#define FTS_ERR 6 /* error; errno is set */
58#define FTS_F 7 /* regular file */
59#define FTS_NS 8 /* no stat(2) information */
60#define FTS_SL 9 /* symbolic link */
61#define FTS_SLNONE 10 /* symbolic link without target */
62#define FTS_DEFAULT 11 /* none of the above */
63 u_short info; /* file information */
64#define FTS_AGAIN 1 /* user: read node again */
65#define FTS_SKIP 2 /* user: discard node */
66#define FTS_FOLLOW 3 /* user: follow symbolic link */
67 short instr; /* setfts() instructions */
68 struct stat statb; /* stat(2) information */
69 char name[1]; /* file name */
70} FTSENT;
71
72FTS *ftsopen();
73FTSENT *ftschildren(), *ftsread();
74int ftsclose(), ftsset();