diff options
author | Ron Yorston <rmy@pobox.com> | 2024-06-05 09:22:08 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-06-05 09:22:08 +0100 |
commit | 0fc9f646c3f5df129adde5c0ebab274a123fba03 (patch) | |
tree | 8ccc6b1483bd3a9a79d3dd78a745f6b081f92548 | |
parent | 48f5ecaf27d900ffea77dbda762202d73223ec32 (diff) | |
download | busybox-w32-0fc9f646c3f5df129adde5c0ebab274a123fba03.tar.gz busybox-w32-0fc9f646c3f5df129adde5c0ebab274a123fba03.tar.bz2 busybox-w32-0fc9f646c3f5df129adde5c0ebab274a123fba03.zip |
make: restore check for c:/path target
Commit f9d10b2b6 (make: fix detection of target rules (take 2))
failed to include the function find_colon() which is used to skip
targets of the form c:/path when checking for a target rule.
Restore the function so Windows paths can be used as targets.
Adds 48 bytes.
-rw-r--r-- | miscutils/make.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/miscutils/make.c b/miscutils/make.c index 0235d9877..06917a867 100644 --- a/miscutils/make.c +++ b/miscutils/make.c | |||
@@ -1243,6 +1243,28 @@ find_char(const char *str, int c) | |||
1243 | return NULL; | 1243 | return NULL; |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | #if ENABLE_PLATFORM_MINGW32 | ||
1247 | /* | ||
1248 | * Check for a target rule by searching for a colon that isn't | ||
1249 | * part of a Windows path. Return a pointer to the colon or NULL. | ||
1250 | */ | ||
1251 | static char * | ||
1252 | find_colon(char *p) | ||
1253 | { | ||
1254 | char *q; | ||
1255 | |||
1256 | for (q = p; (q = strchr(q, ':')); ++q) { | ||
1257 | if (posix && !(pragma & P_WINDOWS)) | ||
1258 | break; | ||
1259 | if (q == p || !isalpha(q[-1]) || q[1] != '/') | ||
1260 | break; | ||
1261 | } | ||
1262 | return q; | ||
1263 | } | ||
1264 | #else | ||
1265 | # define find_colon(s) find_char(s, ':') | ||
1266 | #endif | ||
1267 | |||
1246 | /* | 1268 | /* |
1247 | * Recursively expand any macros in str to an allocated string. | 1269 | * Recursively expand any macros in str to an allocated string. |
1248 | */ | 1270 | */ |
@@ -2115,7 +2137,7 @@ input(FILE *fd, int ilevel) | |||
2115 | p = expanded = expand_macros(str, FALSE); | 2137 | p = expanded = expand_macros(str, FALSE); |
2116 | 2138 | ||
2117 | // Look for colon separator | 2139 | // Look for colon separator |
2118 | q = find_char(p, ':'); | 2140 | q = find_colon(p); |
2119 | if (q == NULL) | 2141 | if (q == NULL) |
2120 | error("expected separator"); | 2142 | error("expected separator"); |
2121 | 2143 | ||