diff --git a/genex/genex.c b/genex/genex.c index e23b739..d3b6c8d 100644 --- a/genex/genex.c +++ b/genex/genex.c @@ -23,11 +23,12 @@ static void usage(const char *name) { fprintf(stderr, -"usage: %s [-d] [-P] [-L libdir ...] [-l lib ...] hierarchy\n" +"usage: %s [-d] [-p] [-P] [-L libdir ...] [-l lib ...] hierarchy\n" " %*s [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" +" -p use portrait orientation; default: landscape\n" " -P generate Postscript instead of PDF (mainly for debugging)\n" , name, (int) strlen(name), ""); exit(1); @@ -38,10 +39,10 @@ int main(int argc, char **argv) { FILE *file; int c; - int dump = 0, postscript = 0; + int dump = 0, postscript = 0, portrait = 0; char **arg; - while ((c = getopt(argc, argv, "dL:l:P")) != EOF) + while ((c = getopt(argc, argv, "dL:l:Pp")) != EOF) switch (c) { case 'd': dump = 1; @@ -55,6 +56,9 @@ int main(int argc, char **argv) case 'P': postscript = 1; break; + case 'p': + portrait = 1; + break; default: usage(*argv); } @@ -88,6 +92,6 @@ int main(int argc, char **argv) if (dump) dump_tree(); else - make_pdf(!postscript); + make_pdf(!postscript, portrait); return 0; } diff --git a/genex/pdf.c b/genex/pdf.c index 55b7d5c..9a9f5a8 100644 --- a/genex/pdf.c +++ b/genex/pdf.c @@ -30,7 +30,7 @@ static struct format { } name, path, lib, comment; int comment_line_skip; } landscape = { - .file_setup = "", + .file_setup = "%%Orientation: Landscape", .overlay_setup = "90 rotate", .comp_setup = "", .left = 20, @@ -211,15 +211,15 @@ static void convert_tree(const struct node *node, FILE *out) } -void make_pdf(int pdf) +void make_pdf(int pdf, int use_portrait) { FILE *out; int res; - if (0) - format = landscape; - else + if (use_portrait) format = portrait; + else + format = landscape; if (pdf) out = popen( "gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=- " diff --git a/genex/pdf.h b/genex/pdf.h index 0a19830..1f2816b 100644 --- a/genex/pdf.h +++ b/genex/pdf.h @@ -12,6 +12,6 @@ #ifndef PDF_H #define PDF_H -void make_pdf(int pdf); +void make_pdf(int pdf, int use_portrait); #endif /* !PDF_H */