From 910efac4b49f43cb1b66eef5aa0bbd020920bf2a Mon Sep 17 00:00:00 2001 From: Scott Wood Date: Thu, 3 Jan 2008 17:43:31 -0600 Subject: 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 --- dtc.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'dtc.c') 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"); -- cgit v1.2.1