4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / usr.sbin / mtree / mtree.h
CommitLineData
cbe4b98c 1/*-
47d3c023
KB
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
9dedc618 4 *
cbe4b98c 5 * %sccs.include.redist.c%
9dedc618 6 *
47d3c023 7 * @(#)mtree.h 8.1 (Berkeley) %G%
9dedc618
KB
8 */
9
cbe4b98c
KB
10#include <string.h>
11#include <stdlib.h>
12
275bb093
KB
13#define KEYDEFAULT \
14 (F_GID | F_MODE | F_NLINK | F_SIZE | F_SLINK | F_TIME | F_UID)
15
16#define MISMATCHEXIT 2
17
6e4c29b1
KB
18typedef struct _node {
19 struct _node *parent, *child; /* up, down */
20 struct _node *prev, *next; /* left, right */
21 off_t st_size; /* size */
c2bd878c 22 struct timespec st_mtimespec; /* last modification time */
6e4c29b1
KB
23 u_long cksum; /* check sum */
24 char *slink; /* symbolic link reference */
275bb093
KB
25 uid_t st_uid; /* uid */
26 gid_t st_gid; /* gid */
6e4c29b1
KB
27#define MBITS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
28 mode_t st_mode; /* mode */
29 nlink_t st_nlink; /* link count */
30
0af6fb71
KB
31#define F_CKSUM 0x0001 /* check sum */
32#define F_DONE 0x0002 /* directory done */
275bb093
KB
33#define F_GID 0x0004 /* gid */
34#define F_GNAME 0x0008 /* group name */
35#define F_IGN 0x0010 /* ignore */
36#define F_MAGIC 0x0020 /* name has magic chars */
37#define F_MODE 0x0040 /* mode */
38#define F_NLINK 0x0080 /* number of links */
0af6fb71
KB
39#define F_SIZE 0x0100 /* size */
40#define F_SLINK 0x0200 /* link count */
41#define F_TIME 0x0400 /* modification time */
42#define F_TYPE 0x0800 /* file type */
275bb093
KB
43#define F_UID 0x1000 /* uid */
44#define F_UNAME 0x2000 /* user name */
45#define F_VISIT 0x4000 /* file visited */
bff504a2 46 u_short flags; /* items set */
9dedc618 47
275bb093
KB
48#define F_BLOCK 0x001 /* block special */
49#define F_CHAR 0x002 /* char special */
50#define F_DIR 0x004 /* directory */
51#define F_FIFO 0x008 /* fifo */
52#define F_FILE 0x010 /* regular file */
53#define F_LINK 0x020 /* symbolic link */
54#define F_SOCK 0x040 /* socket */
55 u_char type; /* file type */
56
7e5e86d9 57 char name[1]; /* file name (must be last) */
6e4c29b1 58} NODE;
bff504a2 59
df2e43d5
KB
60#define RP(p) \
61 ((p)->fts_path[0] == '.' && (p)->fts_path[1] == '/' ? \
62 (p)->fts_path + 2 : (p)->fts_path)