/* $NetBSD: dir.h,v 1.49 2024/07/07 07:50:57 rillig Exp $ */12/*3* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.4*5* This code is derived from software contributed to Berkeley by6* Adam de Boor.7*8* Redistribution and use in source and binary forms, with or without9* modification, are permitted provided that the following conditions10* are met:11* 1. Redistributions of source code must retain the above copyright12* notice, this list of conditions and the following disclaimer.13* 2. Redistributions in binary form must reproduce the above copyright14* notice, this list of conditions and the following disclaimer in the15* documentation and/or other materials provided with the distribution.16* 3. Neither the name of the University nor the names of its contributors17* may be used to endorse or promote products derived from this software18* without specific prior written permission.19*20* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND21* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE22* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE23* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE24* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL25* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS26* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)27* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT28* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY29* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF30* SUCH DAMAGE.31*32* from: @(#)dir.h 8.1 (Berkeley) 6/6/9333*/3435/*36* Copyright (c) 1988, 1989 by Adam de Boor37* Copyright (c) 1989 by Berkeley Softworks38* All rights reserved.39*40* This code is derived from software contributed to Berkeley by41* Adam de Boor.42*43* Redistribution and use in source and binary forms, with or without44* modification, are permitted provided that the following conditions45* are met:46* 1. Redistributions of source code must retain the above copyright47* notice, this list of conditions and the following disclaimer.48* 2. Redistributions in binary form must reproduce the above copyright49* notice, this list of conditions and the following disclaimer in the50* documentation and/or other materials provided with the distribution.51* 3. All advertising materials mentioning features or use of this software52* must display the following acknowledgement:53* This product includes software developed by the University of54* California, Berkeley and its contributors.55* 4. Neither the name of the University nor the names of its contributors56* may be used to endorse or promote products derived from this software57* without specific prior written permission.58*59* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND60* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE61* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE62* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE63* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL64* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS65* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)66* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT67* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY68* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF69* SUCH DAMAGE.70*71* from: @(#)dir.h 8.1 (Berkeley) 6/6/9372*/7374#ifndef MAKE_DIR_H75#define MAKE_DIR_H7677typedef struct CachedDir CachedDir;7879void Dir_Init(void);80void Dir_InitCur(const char *);81void Dir_InitDot(void);82#ifdef CLEANUP83void Dir_End(void);84#endif85void Dir_SetPATH(void);86void Dir_SetSYSPATH(void);87bool Dir_HasWildcards(const char *) MAKE_ATTR_USE;88void SearchPath_Expand(SearchPath *, const char *, StringList *);89char *Dir_FindFile(const char *, SearchPath *) MAKE_ATTR_USE;90char *Dir_FindInclude(const char *, SearchPath *) MAKE_ATTR_USE;91char *Dir_FindHereOrAbove(const char *, const char *) MAKE_ATTR_USE;92void Dir_UpdateMTime(GNode *, bool);93CachedDir *SearchPath_Add(SearchPath *, const char *);94char *SearchPath_ToFlags(SearchPath *, const char *) MAKE_ATTR_USE;95void SearchPath_Clear(SearchPath *);96void SearchPath_AddAll(SearchPath *, SearchPath *);97void Dir_PrintDirectories(void);98void SearchPath_Print(const SearchPath *);99SearchPath *Dir_CopyDirSearchPath(void) MAKE_ATTR_USE;100101/* Stripped-down variant of struct stat. */102struct cached_stat {103time_t cst_mtime;104mode_t cst_mode;105};106107int cached_lstat(const char *, struct cached_stat *);108int cached_stat(const char *, struct cached_stat *);109110#endif111112113