1*6eef5f0cSAntonio Huete Jimenez /* $NetBSD: dir.h,v 1.46 2021/12/15 12:08:25 rillig Exp $ */ 201e196c8SJohn Marino 301e196c8SJohn Marino /* 401e196c8SJohn Marino * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. 501e196c8SJohn Marino * 601e196c8SJohn Marino * This code is derived from software contributed to Berkeley by 701e196c8SJohn Marino * Adam de Boor. 801e196c8SJohn Marino * 901e196c8SJohn Marino * Redistribution and use in source and binary forms, with or without 1001e196c8SJohn Marino * modification, are permitted provided that the following conditions 1101e196c8SJohn Marino * are met: 1201e196c8SJohn Marino * 1. Redistributions of source code must retain the above copyright 1301e196c8SJohn Marino * notice, this list of conditions and the following disclaimer. 1401e196c8SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 1501e196c8SJohn Marino * notice, this list of conditions and the following disclaimer in the 1601e196c8SJohn Marino * documentation and/or other materials provided with the distribution. 1701e196c8SJohn Marino * 3. Neither the name of the University nor the names of its contributors 1801e196c8SJohn Marino * may be used to endorse or promote products derived from this software 1901e196c8SJohn Marino * without specific prior written permission. 2001e196c8SJohn Marino * 2101e196c8SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2201e196c8SJohn Marino * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2301e196c8SJohn Marino * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2401e196c8SJohn Marino * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2501e196c8SJohn Marino * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2601e196c8SJohn Marino * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2701e196c8SJohn Marino * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2801e196c8SJohn Marino * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2901e196c8SJohn Marino * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3001e196c8SJohn Marino * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3101e196c8SJohn Marino * SUCH DAMAGE. 3201e196c8SJohn Marino * 3301e196c8SJohn Marino * from: @(#)dir.h 8.1 (Berkeley) 6/6/93 3401e196c8SJohn Marino */ 3501e196c8SJohn Marino 3601e196c8SJohn Marino /* 3701e196c8SJohn Marino * Copyright (c) 1988, 1989 by Adam de Boor 3801e196c8SJohn Marino * Copyright (c) 1989 by Berkeley Softworks 3901e196c8SJohn Marino * All rights reserved. 4001e196c8SJohn Marino * 4101e196c8SJohn Marino * This code is derived from software contributed to Berkeley by 4201e196c8SJohn Marino * Adam de Boor. 4301e196c8SJohn Marino * 4401e196c8SJohn Marino * Redistribution and use in source and binary forms, with or without 4501e196c8SJohn Marino * modification, are permitted provided that the following conditions 4601e196c8SJohn Marino * are met: 4701e196c8SJohn Marino * 1. Redistributions of source code must retain the above copyright 4801e196c8SJohn Marino * notice, this list of conditions and the following disclaimer. 4901e196c8SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 5001e196c8SJohn Marino * notice, this list of conditions and the following disclaimer in the 5101e196c8SJohn Marino * documentation and/or other materials provided with the distribution. 5201e196c8SJohn Marino * 3. All advertising materials mentioning features or use of this software 5301e196c8SJohn Marino * must display the following acknowledgement: 5401e196c8SJohn Marino * This product includes software developed by the University of 5501e196c8SJohn Marino * California, Berkeley and its contributors. 5601e196c8SJohn Marino * 4. Neither the name of the University nor the names of its contributors 5701e196c8SJohn Marino * may be used to endorse or promote products derived from this software 5801e196c8SJohn Marino * without specific prior written permission. 5901e196c8SJohn Marino * 6001e196c8SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 6101e196c8SJohn Marino * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 6201e196c8SJohn Marino * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 6301e196c8SJohn Marino * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 6401e196c8SJohn Marino * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 6501e196c8SJohn Marino * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 6601e196c8SJohn Marino * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 6701e196c8SJohn Marino * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 6801e196c8SJohn Marino * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 6901e196c8SJohn Marino * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 7001e196c8SJohn Marino * SUCH DAMAGE. 7101e196c8SJohn Marino * 7201e196c8SJohn Marino * from: @(#)dir.h 8.1 (Berkeley) 6/6/93 7301e196c8SJohn Marino */ 7401e196c8SJohn Marino 75ca58f742SDaniel Fojt #ifndef MAKE_DIR_H 76ca58f742SDaniel Fojt #define MAKE_DIR_H 7701e196c8SJohn Marino 78a34d5fb1SAntonio Huete Jimenez typedef struct CachedDir CachedDir; 7901e196c8SJohn Marino 80a34d5fb1SAntonio Huete Jimenez void Dir_Init(void); 8101e196c8SJohn Marino void Dir_InitCur(const char *); 8201e196c8SJohn Marino void Dir_InitDot(void); 8301e196c8SJohn Marino void Dir_End(void); 8401e196c8SJohn Marino void Dir_SetPATH(void); 85*6eef5f0cSAntonio Huete Jimenez bool Dir_HasWildcards(const char *) MAKE_ATTR_USE; 86a34d5fb1SAntonio Huete Jimenez void SearchPath_Expand(SearchPath *, const char *, StringList *); 87*6eef5f0cSAntonio Huete Jimenez char *Dir_FindFile(const char *, SearchPath *) MAKE_ATTR_USE; 88*6eef5f0cSAntonio Huete Jimenez char *Dir_FindHereOrAbove(const char *, const char *) MAKE_ATTR_USE; 89*6eef5f0cSAntonio Huete Jimenez void Dir_UpdateMTime(GNode *, bool); 90a34d5fb1SAntonio Huete Jimenez CachedDir *SearchPath_Add(SearchPath *, const char *); 91*6eef5f0cSAntonio Huete Jimenez char *SearchPath_ToFlags(SearchPath *, const char *) MAKE_ATTR_USE; 92a34d5fb1SAntonio Huete Jimenez void SearchPath_Clear(SearchPath *); 93a34d5fb1SAntonio Huete Jimenez void SearchPath_AddAll(SearchPath *, SearchPath *); 9401e196c8SJohn Marino void Dir_PrintDirectories(void); 95a34d5fb1SAntonio Huete Jimenez void SearchPath_Print(const SearchPath *); 96*6eef5f0cSAntonio Huete Jimenez SearchPath *Dir_CopyDirSearchPath(void) MAKE_ATTR_USE; 97a34d5fb1SAntonio Huete Jimenez 98a34d5fb1SAntonio Huete Jimenez /* Stripped-down variant of struct stat. */ 99a34d5fb1SAntonio Huete Jimenez struct cached_stat { 100a34d5fb1SAntonio Huete Jimenez time_t cst_mtime; 101a34d5fb1SAntonio Huete Jimenez mode_t cst_mode; 102a34d5fb1SAntonio Huete Jimenez }; 103a34d5fb1SAntonio Huete Jimenez 104a34d5fb1SAntonio Huete Jimenez int cached_lstat(const char *, struct cached_stat *); 105a34d5fb1SAntonio Huete Jimenez int cached_stat(const char *, struct cached_stat *); 10601e196c8SJohn Marino 107*6eef5f0cSAntonio Huete Jimenez #endif 108