1249293Sed/* $NetBSD: extern.h,v 1.38 2013/02/03 19:15:17 christos Exp $ */ 2244541Sbrooks 3244541Sbrooks/*- 4244541Sbrooks * Copyright (c) 1991, 1993 5244541Sbrooks * The Regents of the University of California. All rights reserved. 6244541Sbrooks * 7244541Sbrooks * Redistribution and use in source and binary forms, with or without 8244541Sbrooks * modification, are permitted provided that the following conditions 9244541Sbrooks * are met: 10244541Sbrooks * 1. Redistributions of source code must retain the above copyright 11244541Sbrooks * notice, this list of conditions and the following disclaimer. 12244541Sbrooks * 2. Redistributions in binary form must reproduce the above copyright 13244541Sbrooks * notice, this list of conditions and the following disclaimer in the 14244541Sbrooks * documentation and/or other materials provided with the distribution. 15244541Sbrooks * 3. Neither the name of the University nor the names of its contributors 16244541Sbrooks * may be used to endorse or promote products derived from this software 17244541Sbrooks * without specific prior written permission. 18244541Sbrooks * 19244541Sbrooks * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20244541Sbrooks * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21244541Sbrooks * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22244541Sbrooks * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23244541Sbrooks * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24244541Sbrooks * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25244541Sbrooks * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26244541Sbrooks * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27244541Sbrooks * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28244541Sbrooks * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29244541Sbrooks * SUCH DAMAGE. 30244541Sbrooks * 31244541Sbrooks * @(#)extern.h 8.1 (Berkeley) 6/6/93 32244541Sbrooks */ 33244541Sbrooks 34244541Sbrooks#include "mtree.h" 35244541Sbrooks 36244541Sbrooks#if HAVE_NBTOOL_CONFIG_H 37244541Sbrooks#include "nbtool_config.h" 38244541Sbrooks#else 39244541Sbrooks#define HAVE_STRUCT_STAT_ST_FLAGS 1 40244541Sbrooks#endif 41244541Sbrooks 42244541Sbrooks#include <err.h> 43244541Sbrooks#include <fts.h> 44244541Sbrooks#include <util.h> 45249293Sed#include <stdbool.h> 46244541Sbrooks 47244541Sbrooks#if HAVE_NETDB_H 48244541Sbrooks/* For MAXHOSTNAMELEN on some platforms. */ 49244541Sbrooks#include <netdb.h> 50244541Sbrooks#endif 51244541Sbrooks 52244541Sbrooks#ifndef MAXHOSTNAMELEN 53244541Sbrooks#define MAXHOSTNAMELEN 256 54244541Sbrooks#endif 55244541Sbrooks 56244541Sbrooksenum flavor { 57244541Sbrooks F_MTREE, 58244541Sbrooks F_FREEBSD9, 59244541Sbrooks F_NETBSD6 60244541Sbrooks}; 61244541Sbrooks 62244541Sbrooksvoid addtag(slist_t *, char *); 63244541Sbrooksint check_excludes(const char *, const char *); 64244541Sbrooksint compare(NODE *, FTSENT *); 65244541Sbrooksint crc(int, u_int32_t *, u_int32_t *); 66244541Sbrooksvoid cwalk(void); 67244541Sbrooksvoid dump_nodes(const char *, NODE *, int); 68244541Sbrooksvoid init_excludes(void); 69244541Sbrooksint matchtags(NODE *); 70244541Sbrooks__dead __printflike(1,2) void mtree_err(const char *, ...); 71244541Sbrooksconst char *nodetype(u_int); 72244541Sbrooksu_int parsekey(const char *, int *); 73244541Sbrooksvoid parsetags(slist_t *, char *); 74244541Sbrooksu_int parsetype(const char *); 75244541Sbrooksvoid read_excludes_file(const char *); 76244541Sbrooksconst char *rlink(const char *); 77244541Sbrooksint verify(FILE *); 78249293Sedvoid load_only(const char *fname); 79249293Sedbool find_only(const char *path); 80244541Sbrooks 81244541Sbrooksextern int bflag, dflag, eflag, iflag, jflag, lflag, mflag, 82244541Sbrooks nflag, qflag, rflag, sflag, tflag, uflag; 83244541Sbrooksextern int mtree_Mflag, mtree_Sflag, mtree_Wflag; 84244541Sbrooksextern size_t mtree_lineno; 85244541Sbrooksextern enum flavor flavor; 86244541Sbrooksextern u_int32_t crc_total; 87244541Sbrooksextern int ftsoptions, keys; 88244541Sbrooksextern char fullpath[]; 89244541Sbrooksextern slist_t includetags, excludetags; 90244541Sbrooks 91