dir.h revision 241146
11590Srgrimes/*	$NetBSD: dir.h,v 1.15 2012/04/07 18:29:08 christos Exp $	*/
21590Srgrimes
31590Srgrimes/*
41590Srgrimes * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
51590Srgrimes *
61590Srgrimes * This code is derived from software contributed to Berkeley by
71590Srgrimes * Adam de Boor.
81590Srgrimes *
91590Srgrimes * Redistribution and use in source and binary forms, with or without
101590Srgrimes * modification, are permitted provided that the following conditions
111590Srgrimes * are met:
121590Srgrimes * 1. Redistributions of source code must retain the above copyright
131590Srgrimes *    notice, this list of conditions and the following disclaimer.
141590Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
151590Srgrimes *    notice, this list of conditions and the following disclaimer in the
161590Srgrimes *    documentation and/or other materials provided with the distribution.
171590Srgrimes * 3. Neither the name of the University nor the names of its contributors
181590Srgrimes *    may be used to endorse or promote products derived from this software
191590Srgrimes *    without specific prior written permission.
201590Srgrimes *
211590Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
221590Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
231590Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
241590Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
251590Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
261590Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
271590Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
281590Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
291590Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
301590Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
311590Srgrimes * SUCH DAMAGE.
321590Srgrimes *
331590Srgrimes *	from: @(#)dir.h	8.1 (Berkeley) 6/6/93
341590Srgrimes */
3527313Scharnier
3627327Scharnier/*
3727313Scharnier * Copyright (c) 1988, 1989 by Adam de Boor
3827313Scharnier * Copyright (c) 1989 by Berkeley Softworks
3950477Speter * All rights reserved.
401590Srgrimes *
411590Srgrimes * This code is derived from software contributed to Berkeley by
4227313Scharnier * Adam de Boor.
431590Srgrimes *
441590Srgrimes * Redistribution and use in source and binary forms, with or without
451590Srgrimes * modification, are permitted provided that the following conditions
461590Srgrimes * are met:
471590Srgrimes * 1. Redistributions of source code must retain the above copyright
481590Srgrimes *    notice, this list of conditions and the following disclaimer.
491590Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
501590Srgrimes *    notice, this list of conditions and the following disclaimer in the
511590Srgrimes *    documentation and/or other materials provided with the distribution.
521590Srgrimes * 3. All advertising materials mentioning features or use of this software
531590Srgrimes *    must display the following acknowledgement:
541590Srgrimes *	This product includes software developed by the University of
551590Srgrimes *	California, Berkeley and its contributors.
561590Srgrimes * 4. Neither the name of the University nor the names of its contributors
571590Srgrimes *    may be used to endorse or promote products derived from this software
581590Srgrimes *    without specific prior written permission.
591590Srgrimes *
601590Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
611590Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
621590Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
631590Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
6491018Sbde * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
651590Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
661590Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
671590Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
681590Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
691590Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
701590Srgrimes * SUCH DAMAGE.
711590Srgrimes *
721590Srgrimes *	from: @(#)dir.h	8.1 (Berkeley) 6/6/93
731590Srgrimes */
741590Srgrimes
7591018Sbde/* dir.h --
761590Srgrimes */
771590Srgrimes
781590Srgrimes#ifndef	_DIR
791590Srgrimes#define	_DIR
801590Srgrimes
811590Srgrimestypedef struct Path {
821590Srgrimes    char         *name;	    	/* Name of directory */
831590Srgrimes    int	    	  refCount; 	/* Number of paths with this directory */
841590Srgrimes    int		  hits;	    	/* the number of times a file in this
851590Srgrimes				 * directory has been found */
861590Srgrimes    Hash_Table    files;    	/* Hash table of files in directory */
871590Srgrimes} Path;
881590Srgrimes
891590Srgrimesvoid Dir_Init(const char *);
901590Srgrimesvoid Dir_InitCur(const char *);
911590Srgrimesvoid Dir_InitDot(void);
921590Srgrimesvoid Dir_End(void);
931590Srgrimesvoid Dir_SetPATH(void);
941590SrgrimesBoolean Dir_HasWildcards(char *);
951590Srgrimesvoid Dir_Expand(const char *, Lst, Lst);
961590Srgrimeschar *Dir_FindFile(const char *, Lst);
971590Srgrimesint Dir_FindHereOrAbove(char *, char *, char *, int);
981590Srgrimesint Dir_MTime(GNode *, Boolean);
991590SrgrimesPath *Dir_AddDir(Lst, const char *);
1001590Srgrimeschar *Dir_MakeFlags(const char *, Lst);
1011590Srgrimesvoid Dir_ClearPath(Lst);
1021590Srgrimesvoid Dir_Concat(Lst, Lst);
1031590Srgrimesvoid Dir_PrintDirectories(void);
1041590Srgrimesvoid Dir_PrintPath(Lst);
1051590Srgrimesvoid Dir_Destroy(void *);
1061590Srgrimesvoid * Dir_CopyDir(void *);
1071590Srgrimes
1081590Srgrimes#endif /* _DIR */
1091590Srgrimes