When the initial glob() attempt on a path specified with "source" statement
yields no result, then retry the globbing on the same path with the directory
part of the currently processed file prepended.
This allows us to reference Config.in files relative to their parent instead
of relative to the top dir.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
SVN-Revision: 43652
glob_t gl;
int err;
int i;
glob_t gl;
int err;
int i;
+ char path[PATH_MAX], *p;
err = glob(name, GLOB_ERR | GLOB_MARK, NULL, &gl);
err = glob(name, GLOB_ERR | GLOB_MARK, NULL, &gl);
+ if (err == GLOB_NOMATCH) {
+ p = strdup(current_file->name);
+ if (p) {
+ snprintf(path, sizeof(path), "%s/%s", dirname(p), name);
+ err = glob(path, GLOB_ERR | GLOB_MARK, NULL, &gl);
+ free(p);
+ }
+ }
+
if (err) {
const char *reason = "unknown error";
if (err) {
const char *reason = "unknown error";
glob_t gl;
int err;
int i;
glob_t gl;
int err;
int i;
+ char path[PATH_MAX], *p;
err = glob(name, GLOB_ERR | GLOB_MARK, NULL, &gl);
err = glob(name, GLOB_ERR | GLOB_MARK, NULL, &gl);
+ if (err == GLOB_NOMATCH) {
+ p = strdup(current_file->name);
+ if (p) {
+ snprintf(path, sizeof(path), "%s/%s", dirname(p), name);
+ fprintf(stderr, "TRY:%s\n", path);
+ err = glob(path, GLOB_ERR | GLOB_MARK, NULL, &gl);
+ free(p);
+ }
+ }
+
if (err) {
const char *reason = "unknown error";
if (err) {
const char *reason = "unknown error";