xref: /minix3/usr.sbin/mtree/extern.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: extern.h,v 1.39 2014/04/24 17:22:41 christos Exp $	*/
2d433a562SThomas Veerman 
3d433a562SThomas Veerman /*-
4d433a562SThomas Veerman  * Copyright (c) 1991, 1993
5d433a562SThomas Veerman  *	The Regents of the University of California.  All rights reserved.
6d433a562SThomas Veerman  *
7d433a562SThomas Veerman  * Redistribution and use in source and binary forms, with or without
8d433a562SThomas Veerman  * modification, are permitted provided that the following conditions
9d433a562SThomas Veerman  * are met:
10d433a562SThomas Veerman  * 1. Redistributions of source code must retain the above copyright
11d433a562SThomas Veerman  *    notice, this list of conditions and the following disclaimer.
12d433a562SThomas Veerman  * 2. Redistributions in binary form must reproduce the above copyright
13d433a562SThomas Veerman  *    notice, this list of conditions and the following disclaimer in the
14d433a562SThomas Veerman  *    documentation and/or other materials provided with the distribution.
15d433a562SThomas Veerman  * 3. Neither the name of the University nor the names of its contributors
16d433a562SThomas Veerman  *    may be used to endorse or promote products derived from this software
17d433a562SThomas Veerman  *    without specific prior written permission.
18d433a562SThomas Veerman  *
19d433a562SThomas Veerman  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20d433a562SThomas Veerman  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21d433a562SThomas Veerman  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22d433a562SThomas Veerman  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23d433a562SThomas Veerman  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24d433a562SThomas Veerman  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25d433a562SThomas Veerman  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26d433a562SThomas Veerman  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27d433a562SThomas Veerman  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28d433a562SThomas Veerman  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29d433a562SThomas Veerman  * SUCH DAMAGE.
30d433a562SThomas Veerman  *
31d433a562SThomas Veerman  *	@(#)extern.h	8.1 (Berkeley) 6/6/93
32d433a562SThomas Veerman  */
33d433a562SThomas Veerman 
34d433a562SThomas Veerman #include "mtree.h"
35d433a562SThomas Veerman 
36d433a562SThomas Veerman #if HAVE_NBTOOL_CONFIG_H
37d433a562SThomas Veerman #include "nbtool_config.h"
38d433a562SThomas Veerman #else
39d433a562SThomas Veerman #define HAVE_STRUCT_STAT_ST_FLAGS 1
40d433a562SThomas Veerman #endif
41d433a562SThomas Veerman 
42d433a562SThomas Veerman #include <err.h>
43d433a562SThomas Veerman #include <fts.h>
44d433a562SThomas Veerman #include <util.h>
4584d9c625SLionel Sambuc #include <stdbool.h>
46d433a562SThomas Veerman 
47d433a562SThomas Veerman #if HAVE_NETDB_H
48d433a562SThomas Veerman /* For MAXHOSTNAMELEN on some platforms. */
49d433a562SThomas Veerman #include <netdb.h>
50d433a562SThomas Veerman #endif
51d433a562SThomas Veerman 
52d433a562SThomas Veerman #ifndef MAXHOSTNAMELEN
53d433a562SThomas Veerman #define MAXHOSTNAMELEN 256
54d433a562SThomas Veerman #endif
55d433a562SThomas Veerman 
5684d9c625SLionel Sambuc enum flavor {
5784d9c625SLionel Sambuc 	F_MTREE,
5884d9c625SLionel Sambuc 	F_FREEBSD9,
5984d9c625SLionel Sambuc 	F_NETBSD6
6084d9c625SLionel Sambuc };
6184d9c625SLionel Sambuc 
62d433a562SThomas Veerman void	 addtag(slist_t *, char *);
63d433a562SThomas Veerman int	 check_excludes(const char *, const char *);
64d433a562SThomas Veerman int	 compare(NODE *, FTSENT *);
65d433a562SThomas Veerman int	 crc(int, u_int32_t *, u_int32_t *);
66*0a6a1f1dSLionel Sambuc void	 cwalk(FILE *);
67*0a6a1f1dSLionel Sambuc void	 dump_nodes(FILE *, const char *, NODE *, int);
68d433a562SThomas Veerman void	 init_excludes(void);
69d433a562SThomas Veerman int	 matchtags(NODE *);
70d433a562SThomas Veerman __dead __printflike(1,2) void	 mtree_err(const char *, ...);
71d433a562SThomas Veerman const char *nodetype(u_int);
72d433a562SThomas Veerman u_int	 parsekey(const char *, int *);
73d433a562SThomas Veerman void	 parsetags(slist_t *, char *);
74d433a562SThomas Veerman u_int	 parsetype(const char *);
75d433a562SThomas Veerman void	 read_excludes_file(const char *);
76d433a562SThomas Veerman const char *rlink(const char *);
77a8ef0910SBen Gras int	 verify(FILE *);
7884d9c625SLionel Sambuc void	 load_only(const char *fname);
7984d9c625SLionel Sambuc bool	 find_only(const char *path);
80d433a562SThomas Veerman 
8184d9c625SLionel Sambuc extern int	bflag, dflag, eflag, iflag, jflag, lflag, mflag,
82a8ef0910SBen Gras 		nflag, qflag, rflag, sflag, tflag, uflag;
83d433a562SThomas Veerman extern int	mtree_Mflag, mtree_Sflag, mtree_Wflag;
84d433a562SThomas Veerman extern size_t	mtree_lineno;
8584d9c625SLionel Sambuc extern enum flavor	flavor;
86d433a562SThomas Veerman extern u_int32_t crc_total;
87d433a562SThomas Veerman extern int	ftsoptions, keys;
88d433a562SThomas Veerman extern char	fullpath[];
89d433a562SThomas Veerman extern slist_t	includetags, excludetags;
90d433a562SThomas Veerman 
91