| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: parse.c,v 1.415 2020/10/31 21:52:56 rillig Exp $ */ | | 1 | /* $NetBSD: parse.c,v 1.416 2020/10/31 23:01:23 rillig Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1988, 1989, 1990, 1993 | | 4 | * Copyright (c) 1988, 1989, 1990, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. 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. |
| @@ -107,27 +107,27 @@ | | | @@ -107,27 +107,27 @@ |
107 | #ifndef MAP_FILE | | 107 | #ifndef MAP_FILE |
108 | #define MAP_FILE 0 | | 108 | #define MAP_FILE 0 |
109 | #endif | | 109 | #endif |
110 | #ifndef MAP_COPY | | 110 | #ifndef MAP_COPY |
111 | #define MAP_COPY MAP_PRIVATE | | 111 | #define MAP_COPY MAP_PRIVATE |
112 | #endif | | 112 | #endif |
113 | | | 113 | |
114 | #include "make.h" | | 114 | #include "make.h" |
115 | #include "dir.h" | | 115 | #include "dir.h" |
116 | #include "job.h" | | 116 | #include "job.h" |
117 | #include "pathnames.h" | | 117 | #include "pathnames.h" |
118 | | | 118 | |
119 | /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ | | 119 | /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ |
120 | MAKE_RCSID("$NetBSD: parse.c,v 1.415 2020/10/31 21:52:56 rillig Exp $"); | | 120 | MAKE_RCSID("$NetBSD: parse.c,v 1.416 2020/10/31 23:01:23 rillig Exp $"); |
121 | | | 121 | |
122 | /* types and constants */ | | 122 | /* types and constants */ |
123 | | | 123 | |
124 | /* | | 124 | /* |
125 | * Structure for a file being read ("included file") | | 125 | * Structure for a file being read ("included file") |
126 | */ | | 126 | */ |
127 | typedef struct IFile { | | 127 | typedef struct IFile { |
128 | char *fname; /* name of file */ | | 128 | char *fname; /* name of file */ |
129 | Boolean fromForLoop; /* simulated .include by the .for loop */ | | 129 | Boolean fromForLoop; /* simulated .include by the .for loop */ |
130 | int lineno; /* current line number in file */ | | 130 | int lineno; /* current line number in file */ |
131 | int first_lineno; /* line number of start of text */ | | 131 | int first_lineno; /* line number of start of text */ |
132 | unsigned int cond_depth; /* 'if' nesting when file opened */ | | 132 | unsigned int cond_depth; /* 'if' nesting when file opened */ |
133 | Boolean depending; /* state of doing_depend on EOF */ | | 133 | Boolean depending; /* state of doing_depend on EOF */ |
| @@ -2356,27 +2356,27 @@ ParseSetParseFile(const char *filename) | | | @@ -2356,27 +2356,27 @@ ParseSetParseFile(const char *filename) |
2356 | static void | | 2356 | static void |
2357 | ParseTrackInput(const char *name) | | 2357 | ParseTrackInput(const char *name) |
2358 | { | | 2358 | { |
2359 | void *fp = NULL; | | 2359 | void *fp = NULL; |
2360 | | | 2360 | |
2361 | const char *old = Var_Value(MAKE_MAKEFILES, VAR_GLOBAL, &fp); | | 2361 | const char *old = Var_Value(MAKE_MAKEFILES, VAR_GLOBAL, &fp); |
2362 | if (old) { | | 2362 | if (old) { |
2363 | size_t name_len = strlen(name); | | 2363 | size_t name_len = strlen(name); |
2364 | const char *ep = old + strlen(old) - name_len; | | 2364 | const char *ep = old + strlen(old) - name_len; |
2365 | /* does it contain name? */ | | 2365 | /* does it contain name? */ |
2366 | for (; old != NULL; old = strchr(old, ' ')) { | | 2366 | for (; old != NULL; old = strchr(old, ' ')) { |
2367 | if (*old == ' ') | | 2367 | if (*old == ' ') |
2368 | old++; | | 2368 | old++; |
2369 | if (old >= ep) | | 2369 | if (old > ep) |
2370 | break; /* cannot contain name */ | | 2370 | break; /* cannot contain name */ |
2371 | if (memcmp(old, name, name_len) == 0 && | | 2371 | if (memcmp(old, name, name_len) == 0 && |
2372 | (old[name_len] == '\0' || old[name_len] == ' ')) | | 2372 | (old[name_len] == '\0' || old[name_len] == ' ')) |
2373 | goto cleanup; | | 2373 | goto cleanup; |
2374 | } | | 2374 | } |
2375 | } | | 2375 | } |
2376 | Var_Append(MAKE_MAKEFILES, name, VAR_GLOBAL); | | 2376 | Var_Append(MAKE_MAKEFILES, name, VAR_GLOBAL); |
2377 | cleanup: | | 2377 | cleanup: |
2378 | bmake_free(fp); | | 2378 | bmake_free(fp); |
2379 | } | | 2379 | } |
2380 | | | 2380 | |
2381 | | | 2381 | |
2382 | /* Start Parsing from the given source. | | 2382 | /* Start Parsing from the given source. |