summaryrefslogtreecommitdiff
path: root/dtc.c
diff options
context:
space:
mode:
authorJon Loeliger <jdl@freescale.com>2007-03-23 15:18:41 -0500
committerJon Loeliger <jdl@freescale.com>2007-03-26 08:36:07 -0500
commite45e6fd274826991c2b7e01fde4d73110487e0e0 (patch)
tree5770119a61cc0c2767757a507e074ddd4e80e34e /dtc.c
parentb29597d9a343761f768a9d78a63f1c09e71b43d2 (diff)
downloaddtc-e45e6fd274826991c2b7e01fde4d73110487e0e0.tar.gz
DTC: Add support for a C-like #include "file" mechanism.
Keeps track of open files in a stack, and assigns a filenum to source positions for each lexical token. Modified error reporting to show source file as well. No policy on file directory basis has been decided. Still handles stdin. Tested on all arch/powerpc/boot/dts DTS files Signed-off-by: Jon Loeliger <jdl@freescale.com>
Diffstat (limited to 'dtc.c')
-rw-r--r--dtc.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/dtc.c b/dtc.c
index 051a68b..a009605 100644
--- a/dtc.c
+++ b/dtc.c
@@ -19,6 +19,7 @@
*/
#include "dtc.h"
+#include "srcpos.h"
char *join_path(char *path, char *name)
{
@@ -61,21 +62,6 @@ void fill_fullpaths(struct node *tree, char *prefix)
fill_fullpaths(child, tree->fullpath);
}
-static FILE *dtc_open_file(char *fname)
-{
- FILE *f;
-
- if (streq(fname, "-"))
- f = stdin;
- else
- f = fopen(fname, "r");
-
- if (! f)
- die("Couldn't open \"%s\": %s\n", fname, strerror(errno));
-
- return f;
-}
-
static void usage(void)
{
fprintf(stderr, "Usage:\n");
@@ -166,8 +152,7 @@ int main(int argc, char *argv[])
inform, outform, arg);
if (streq(inform, "dts")) {
- inf = dtc_open_file(arg);
- bi = dt_from_source(inf);
+ bi = dt_from_source(arg);
} else if (streq(inform, "fs")) {
bi = dt_from_fs(arg);
} else if(streq(inform, "dtb")) {