| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: dir.c,v 1.131 2020/09/02 03:15:21 rillig Exp $ */ | | 1 | /* $NetBSD: dir.c,v 1.132 2020/09/02 03:28:12 rillig Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | | 4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to Berkeley by | | 7 | * This code is derived from software contributed to Berkeley by |
8 | * Adam de Boor. | | 8 | * Adam de Boor. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -60,34 +60,34 @@ | | | @@ -60,34 +60,34 @@ |
60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
69 | * SUCH DAMAGE. | | 69 | * SUCH DAMAGE. |
70 | */ | | 70 | */ |
71 | | | 71 | |
72 | #ifndef MAKE_NATIVE | | 72 | #ifndef MAKE_NATIVE |
73 | static char rcsid[] = "$NetBSD: dir.c,v 1.131 2020/09/02 03:15:21 rillig Exp $"; | | 73 | static char rcsid[] = "$NetBSD: dir.c,v 1.132 2020/09/02 03:28:12 rillig Exp $"; |
74 | #else | | 74 | #else |
75 | #include <sys/cdefs.h> | | 75 | #include <sys/cdefs.h> |
76 | #ifndef lint | | 76 | #ifndef lint |
77 | #if 0 | | 77 | #if 0 |
78 | static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; | | 78 | static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; |
79 | #else | | 79 | #else |
80 | __RCSID("$NetBSD: dir.c,v 1.131 2020/09/02 03:15:21 rillig Exp $"); | | 80 | __RCSID("$NetBSD: dir.c,v 1.132 2020/09/02 03:28:12 rillig Exp $"); |
81 | #endif | | 81 | #endif |
82 | #endif /* not lint */ | | 82 | #endif /* not lint */ |
83 | #endif | | 83 | #endif |
84 | | | 84 | |
85 | /*- | | 85 | /*- |
86 | * dir.c -- | | 86 | * dir.c -- |
87 | * Directory searching using wildcards and/or normal names... | | 87 | * Directory searching using wildcards and/or normal names... |
88 | * Used both for source wildcarding in the Makefile and for finding | | 88 | * Used both for source wildcarding in the Makefile and for finding |
89 | * implicit sources. | | 89 | * implicit sources. |
90 | * | | 90 | * |
91 | * The interface for this module is: | | 91 | * The interface for this module is: |
92 | * Dir_Init Initialize the module. | | 92 | * Dir_Init Initialize the module. |
93 | * | | 93 | * |
| @@ -327,33 +327,33 @@ cached_stats(Hash_Table *htp, const char | | | @@ -327,33 +327,33 @@ cached_stats(Hash_Table *htp, const char |
327 | if (flags & CST_LSTAT) { | | 327 | if (flags & CST_LSTAT) { |
328 | cst->lmtime = st->st_mtime; | | 328 | cst->lmtime = st->st_mtime; |
329 | } else { | | 329 | } else { |
330 | cst->mtime = st->st_mtime; | | 330 | cst->mtime = st->st_mtime; |
331 | } | | 331 | } |
332 | cst->mode = st->st_mode; | | 332 | cst->mode = st->st_mode; |
333 | DIR_DEBUG2(" Caching %s for %s\n", | | 333 | DIR_DEBUG2(" Caching %s for %s\n", |
334 | Targ_FmtTime(st->st_mtime), pathname); | | 334 | Targ_FmtTime(st->st_mtime), pathname); |
335 | | | 335 | |
336 | return 0; | | 336 | return 0; |
337 | } | | 337 | } |
338 | | | 338 | |
339 | int | | 339 | int |
340 | cached_stat(const char *pathname, void *st) | | 340 | cached_stat(const char *pathname, struct stat *st) |
341 | { | | 341 | { |
342 | return cached_stats(&mtimes, pathname, st, 0); | | 342 | return cached_stats(&mtimes, pathname, st, 0); |
343 | } | | 343 | } |
344 | | | 344 | |
345 | int | | 345 | int |
346 | cached_lstat(const char *pathname, void *st) | | 346 | cached_lstat(const char *pathname, struct stat *st) |
347 | { | | 347 | { |
348 | return cached_stats(&lmtimes, pathname, st, CST_LSTAT); | | 348 | return cached_stats(&lmtimes, pathname, st, CST_LSTAT); |
349 | } | | 349 | } |
350 | | | 350 | |
351 | /* Initialize things for this module. */ | | 351 | /* Initialize things for this module. */ |
352 | void | | 352 | void |
353 | Dir_Init(void) | | 353 | Dir_Init(void) |
354 | { | | 354 | { |
355 | dirSearchPath = Lst_Init(); | | 355 | dirSearchPath = Lst_Init(); |
356 | openDirectories = Lst_Init(); | | 356 | openDirectories = Lst_Init(); |
357 | Hash_InitTable(&mtimes, 0); | | 357 | Hash_InitTable(&mtimes, 0); |
358 | Hash_InitTable(&lmtimes, 0); | | 358 | Hash_InitTable(&lmtimes, 0); |
359 | } | | 359 | } |