From 904a60f7f92600390e170edcc5d024206420f1a3 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Tue, 17 Apr 2012 05:43:46 -0300 Subject: [PATCH] genex/genex.c: new option -d to dump the tree instead of making a PDF --- genex/genex.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/genex/genex.c b/genex/genex.c index 29cd9f5..9649ace 100644 --- a/genex/genex.c +++ b/genex/genex.c @@ -22,7 +22,8 @@ static void usage(const char *name) { fprintf(stderr, -"usage: %s [-L libdir ...] [-l lib ...] hierarchy [descriptions ...]\n\n" +"usage: %s [-d] [-L libdir ...] [-l lib ...] hierarchy [descriptions ...]\n\n" +" -d dump the tree instead of generating a PDF\n" " -L libdir search all libraries in the specified directory\n" " -l lib search the specified component library\n" , name); @@ -34,10 +35,14 @@ int main(int argc, char **argv) { FILE *file; int c; + int dump = 0; char **arg; - while ((c = getopt(argc, argv, "L:l:")) != EOF) + while ((c = getopt(argc, argv, "dL:l:")) != EOF) switch (c) { + case 'd': + dump = 1; + break; case 'L': add_libdir(optarg); break; @@ -74,7 +79,9 @@ int main(int argc, char **argv) read_desc(file); fclose(file); } -// dump_tree(); - make_pdf(); + if (dump) + dump_tree(); + else + make_pdf(); return 0; }