Home | History | Annotate | Line # | Download | only in make
dir.h revision 1.36
      1  1.36    rillig /*	$NetBSD: dir.h,v 1.36 2020/11/28 22:13:56 rillig Exp $	*/
      2   1.3  christos 
      3   1.1       cgd /*
      4   1.1       cgd  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
      5  1.10       agc  *
      6  1.10       agc  * This code is derived from software contributed to Berkeley by
      7  1.10       agc  * Adam de Boor.
      8  1.10       agc  *
      9  1.10       agc  * Redistribution and use in source and binary forms, with or without
     10  1.10       agc  * modification, are permitted provided that the following conditions
     11  1.10       agc  * are met:
     12  1.10       agc  * 1. Redistributions of source code must retain the above copyright
     13  1.10       agc  *    notice, this list of conditions and the following disclaimer.
     14  1.10       agc  * 2. Redistributions in binary form must reproduce the above copyright
     15  1.10       agc  *    notice, this list of conditions and the following disclaimer in the
     16  1.10       agc  *    documentation and/or other materials provided with the distribution.
     17  1.10       agc  * 3. Neither the name of the University nor the names of its contributors
     18  1.10       agc  *    may be used to endorse or promote products derived from this software
     19  1.10       agc  *    without specific prior written permission.
     20  1.10       agc  *
     21  1.10       agc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     22  1.10       agc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23  1.10       agc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24  1.10       agc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     25  1.10       agc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26  1.10       agc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27  1.10       agc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28  1.10       agc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29  1.10       agc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30  1.10       agc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31  1.10       agc  * SUCH DAMAGE.
     32  1.10       agc  *
     33  1.10       agc  *	from: @(#)dir.h	8.1 (Berkeley) 6/6/93
     34  1.10       agc  */
     35  1.10       agc 
     36  1.10       agc /*
     37   1.1       cgd  * Copyright (c) 1988, 1989 by Adam de Boor
     38   1.1       cgd  * Copyright (c) 1989 by Berkeley Softworks
     39   1.1       cgd  * All rights reserved.
     40   1.1       cgd  *
     41   1.1       cgd  * This code is derived from software contributed to Berkeley by
     42   1.1       cgd  * Adam de Boor.
     43   1.1       cgd  *
     44   1.1       cgd  * Redistribution and use in source and binary forms, with or without
     45   1.1       cgd  * modification, are permitted provided that the following conditions
     46   1.1       cgd  * are met:
     47   1.1       cgd  * 1. Redistributions of source code must retain the above copyright
     48   1.1       cgd  *    notice, this list of conditions and the following disclaimer.
     49   1.1       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     50   1.1       cgd  *    notice, this list of conditions and the following disclaimer in the
     51   1.1       cgd  *    documentation and/or other materials provided with the distribution.
     52   1.1       cgd  * 3. All advertising materials mentioning features or use of this software
     53   1.1       cgd  *    must display the following acknowledgement:
     54   1.1       cgd  *	This product includes software developed by the University of
     55   1.1       cgd  *	California, Berkeley and its contributors.
     56   1.1       cgd  * 4. Neither the name of the University nor the names of its contributors
     57   1.1       cgd  *    may be used to endorse or promote products derived from this software
     58   1.1       cgd  *    without specific prior written permission.
     59   1.1       cgd  *
     60   1.1       cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     61   1.1       cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     62   1.1       cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     63   1.1       cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     64   1.1       cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     65   1.1       cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     66   1.1       cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     67   1.1       cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     68   1.1       cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     69   1.1       cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     70   1.1       cgd  * SUCH DAMAGE.
     71   1.1       cgd  *
     72   1.4  christos  *	from: @(#)dir.h	8.1 (Berkeley) 6/6/93
     73   1.1       cgd  */
     74   1.1       cgd 
     75  1.18      maya #ifndef	MAKE_DIR_H
     76  1.18      maya #define	MAKE_DIR_H
     77   1.1       cgd 
     78  1.27    rillig /* A cache for the filenames in a directory. */
     79  1.24    rillig typedef struct CachedDir {
     80  1.27    rillig     char *name;			/* Name of directory, either absolute or
     81  1.27    rillig 				 * relative to the current directory.
     82  1.27    rillig 				 * The name is not normalized in any way,
     83  1.27    rillig 				 * that is, "." and "./." are different.
     84  1.27    rillig 				 *
     85  1.27    rillig 				 * Not sure what happens when .CURDIR is
     86  1.27    rillig 				 * assigned a new value; see Parse_DoVar. */
     87  1.27    rillig     int refCount;		/* Number of SearchPaths with this directory */
     88  1.27    rillig     int hits;			/* The number of times a file in this
     89   1.1       cgd 				 * directory has been found */
     90  1.35    rillig     HashSet files;		/* The files in the directory. */
     91  1.24    rillig } CachedDir;
     92   1.1       cgd 
     93  1.19    rillig void Dir_Init(void);
     94  1.19    rillig void Dir_InitDir(const char *);
     95   1.8       sjg void Dir_InitCur(const char *);
     96   1.7       wiz void Dir_InitDot(void);
     97   1.7       wiz void Dir_End(void);
     98   1.8       sjg void Dir_SetPATH(void);
     99  1.21    rillig Boolean Dir_HasWildcards(const char *);
    100  1.25    rillig void Dir_Expand(const char *, SearchPath *, StringList *);
    101  1.25    rillig char *Dir_FindFile(const char *, SearchPath *);
    102  1.29    rillig char *Dir_FindHereOrAbove(const char *, const char *);
    103  1.33    rillig void Dir_UpdateMTime(GNode *, Boolean);
    104  1.25    rillig CachedDir *Dir_AddDir(SearchPath *, const char *);
    105  1.36    rillig char *SearchPath_ToFlags(const char *, SearchPath *);
    106  1.36    rillig void SearchPath_Clear(SearchPath *);
    107  1.36    rillig void SearchPath_AddAll(SearchPath *, SearchPath *);
    108   1.7       wiz void Dir_PrintDirectories(void);
    109  1.36    rillig void SearchPath_Print(SearchPath *);
    110  1.14       dsl void Dir_Destroy(void *);
    111  1.32    rillig SearchPath *Dir_CopyDirSearchPath(void);
    112   1.1       cgd 
    113  1.27    rillig /* Stripped-down variant of struct stat. */
    114  1.34    rillig struct cached_stat {
    115  1.34    rillig     time_t cst_mtime;
    116  1.34    rillig     mode_t cst_mode;
    117  1.27    rillig };
    118  1.27    rillig 
    119  1.34    rillig int cached_lstat(const char *, struct cached_stat *);
    120  1.34    rillig int cached_stat(const char *, struct cached_stat *);
    121  1.23    rillig 
    122  1.18      maya #endif /* MAKE_DIR_H */
    123