Look for include files in the directory of the including file.

Looking in the diretory dtc is invoked from is not very useful behavior.

As part of the code reorganization to implement this, I removed the
uniquifying of name storage -- it seemed a rather dubious optimization
given likely usage, and some aspects of it would have been mildly awkward
to integrate with the new code.

Signed-off-by: Scott Wood <scottwood@freescale.com>
This commit is contained in:
Scott Wood 2008-01-03 17:43:31 -06:00 committed by Jon Loeliger
parent f77fe6a20e
commit 910efac4b4
5 changed files with 136 additions and 102 deletions

14
dtc.c
View file

@ -118,7 +118,7 @@ int main(int argc, char *argv[])
int force = 0, check = 0;
const char *arg;
int opt;
FILE *inf = NULL;
struct dtc_file *inf = NULL;
FILE *outf = NULL;
int outversion = DEFAULT_FDT_VERSION;
int boot_cpuid_phys = 0xfeedbeef;
@ -192,14 +192,18 @@ int main(int argc, char *argv[])
} else if (streq(inform, "fs")) {
bi = dt_from_fs(arg);
} else if(streq(inform, "dtb")) {
inf = dtc_open_file(arg);
bi = dt_from_blob(inf);
inf = dtc_open_file(arg, NULL);
if (!inf)
die("Couldn't open \"%s\": %s\n", arg,
strerror(errno));
bi = dt_from_blob(inf->file);
} else {
die("Unknown input format \"%s\"\n", inform);
}
if (inf && (inf != stdin))
fclose(inf);
if (inf && inf->file != stdin)
fclose(inf->file);
if (! bi || ! bi->dt)
die("Couldn't read input tree\n");