version 1.84, 2007/09/17 08:36:57 |
version 1.85, 2007/09/17 09:28:36 |
|
|
|
|
/* Handle non-system non-absolute files... */ |
/* Handle non-system non-absolute files... */ |
if (!isSystem && file[0] != '/') { |
if (!isSystem && file[0] != '/') { |
/* ... by looking first under the same directory as the |
/* ... by looking first under the same directory as the |
* current file */ |
* current file */ |
char *slash; |
char *slash; |
const char *fname; |
const char *fname; |
|
|
if (slash != NULL) { |
if (slash != NULL) { |
char *newName; |
char *newName; |
|
|
newName = Str_concati(fname, slash, file, |
newName = Str_concati(fname, slash, file, |
strchr(file, '\0'), '/'); |
strchr(file, '\0'), '/'); |
fullname = Dir_FindFile(newName, parseIncPath); |
fullname = Dir_FindFile(newName, parseIncPath); |
if (fullname == NULL) |
if (fullname == NULL) |
|
|
} |
} |
|
|
static void |
static void |
handle_include_file(const char *name, const char *ename, bool isSystem, |
handle_include_file(const char *name, const char *ename, bool isSystem, |
bool errIfNotFound) |
bool errIfNotFound) |
{ |
{ |
char *file; |
char *file; |
|
|
static bool |
static bool |
lookup_bsd_include(const char *file) |
lookup_bsd_include(const char *file) |
{ |
{ |
char endc; |
char endc; |
const char *efile; |
const char *efile; |
bool isSystem; |
bool isSystem; |
|
|
|
|
|
|
|
|
static void |
static void |
lookup_sysv_style_include(const char *file, const char *directive, |
lookup_sysv_style_include(const char *file, const char *directive, |
bool errIfMissing) |
bool errIfMissing) |
{ |
{ |
const char *efile; |
const char *efile; |
|
|
break; |
break; |
} |
} |
if ((*p != '\0' && *p != '#') || type == POISON_INVALID) { |
if ((*p != '\0' && *p != '#') || type == POISON_INVALID) { |
Parse_Error(PARSE_WARNING, "Invalid syntax for .poison: %s", |
Parse_Error(PARSE_WARNING, "Invalid syntax for .poison: %s", |
line); |
line); |
return false; |
return false; |
} else { |
} else { |
|
|
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case COND_PARSE: |
case COND_PARSE: |
return true; |
return true; |
case COND_ISFOR: |
case COND_ISFOR: |
return handle_for_loop(linebuf, line); |
return handle_for_loop(linebuf, line); |
case COND_ISINCLUDE: |
case COND_ISINCLUDE: |
return lookup_bsd_include(line + 7); |
return lookup_bsd_include(line + 7); |
case COND_ISPOISON: |
case COND_ISPOISON: |
return handle_poison(line+6); |
return handle_poison(line+6); |
case COND_ISUNDEF: |
case COND_ISUNDEF: |
return handle_undef(line + 5); |
return handle_undef(line + 5); |
default: |
default: |
break; |
break; |
|
|
} else { |
} else { |
char *stripped; |
char *stripped; |
stripped = strip_comments(©, line); |
stripped = strip_comments(©, line); |
if (*stripped == '.' && handle_bsd_command(&buf, ©, |
if (*stripped == '.' && handle_bsd_command(&buf, ©, |
stripped+1)) |
stripped+1)) |
; |
; |
else if (FEATURES(FEATURE_SYSVINCLUDE) && |
else if (FEATURES(FEATURE_SYSVINCLUDE) && |
strncmp(stripped, "include", 7) == 0 && |
strncmp(stripped, "include", 7) == 0 && |
isspace(stripped[7]) && |
isspace(stripped[7]) && |
strchr(stripped, ':') == NULL) { |
strchr(stripped, ':') == NULL) { |
/* It's an S3/S5-style "include". */ |
/* It's an S3/S5-style "include". */ |
lookup_sysv_include(stripped + 7, "include"); |
lookup_sysv_include(stripped + 7, "include"); |
} else if (FEATURES(FEATURE_CONDINCLUDE) && |
} else if (FEATURES(FEATURE_CONDINCLUDE) && |
strncmp(stripped, "sinclude", 8) == 0 && |
strncmp(stripped, "sinclude", 8) == 0 && |
isspace(stripped[8]) && |
isspace(stripped[8]) && |
strchr(stripped, ':') == NULL) { |
strchr(stripped, ':') == NULL) { |
lookup_conditional_include(stripped+8, "sinclude"); |
lookup_conditional_include(stripped+8, "sinclude"); |
} else if (FEATURES(FEATURE_CONDINCLUDE) && |
} else if (FEATURES(FEATURE_CONDINCLUDE) && |
strncmp(stripped, "-include", 8) == 0 && |
strncmp(stripped, "-include", 8) == 0 && |
isspace(stripped[8]) && |
isspace(stripped[8]) && |
strchr(stripped, ':') == NULL) { |
strchr(stripped, ':') == NULL) { |
lookup_conditional_include(stripped+8, "-include"); |
lookup_conditional_include(stripped+8, "-include"); |