summaryrefslogtreecommitdiff
path: root/dtc.c
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2008-01-03 17:43:31 -0600
committerJon Loeliger <jdl@freescale.com>2008-01-04 08:20:10 -0600
commit910efac4b49f43cb1b66eef5aa0bbd020920bf2a (patch)
tree0e6c49941be4b2003d0bc1dae80849a236abc9ad /dtc.c
parentf77fe6a20e75a2289faf86f9b6b529044a07b072 (diff)
downloaddtc-910efac4b49f43cb1b66eef5aa0bbd020920bf2a.tar.gz
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>
Diffstat (limited to 'dtc.c')
-rw-r--r--dtc.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/dtc.c b/dtc.c
index 6295b39..fb716f3 100644
--- a/dtc.c
+++ b/dtc.c
@@ -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");