Blame SOURCES/graphviz-2.30.1-lefty-help.patch

a2d586
diff -up graphviz-2.30.1/cmd/lefty/lefty.c.orig8 graphviz-2.30.1/cmd/lefty/lefty.c
a2d586
--- graphviz-2.30.1/cmd/lefty/lefty.c.orig8	2013-02-14 14:27:39.000000000 +0100
a2d586
+++ graphviz-2.30.1/cmd/lefty/lefty.c	2013-07-12 12:46:23.730664708 +0200
a2d586
@@ -86,6 +86,8 @@ static void processargs (int, char **);
a2d586
 static void processstr (char *);
a2d586
 static void printusage (void);
a2d586
 
a2d586
+static char *cmd;
a2d586
+
a2d586
 #if defined(FEATURE_X11) || defined(FEATURE_NONE)
a2d586
 
a2d586
 int main (int argc, char **argv) {
a2d586
@@ -100,6 +102,8 @@ int main (int argc, char **argv) {
a2d586
     stime = time (NULL);
a2d586
 #endif
a2d586
 
a2d586
+    cmd = argv[0];
a2d586
+
a2d586
     idlerunmode = 0;
a2d586
     exprstr = NULL;
a2d586
     fp = NULL;
a2d586
@@ -393,6 +397,25 @@ static int processinput (int waitflag) {
a2d586
     return rtn;
a2d586
 }
a2d586
 
a2d586
+static char* usestr =
a2d586
+"   acceptable options are:\n\
a2d586
+    -x    - exit after processing the input file.\n\
a2d586
+    -e E  - parse and execute expression E.\n\
a2d586
+    -el N - set error reporting level. (0)\n\
a2d586
+    -sd N - how much of the stack to show if error is printed. (2)\n\
a2d586
+    -sb N - how much of each function in the stack show if error is printed. (2)\n\
a2d586
+    -df S - set default font.\n\
a2d586
+    -ps F - specify a default file name for postscript files.\n\
a2d586
+    -?    - show help.\n\
a2d586
+    -V    - print version.\n";
a2d586
+
a2d586
+static void usage(char *cmd, int eval)
a2d586
+{
a2d586
+    fprintf (stderr, "Usage: %s [options] [file]\n", cmd);
a2d586
+    fputs (usestr, stderr);
a2d586
+    exit (eval);
a2d586
+}
a2d586
+
a2d586
 static void processstr (char *buf) {
a2d586
     char *words[100];
a2d586
     char *s, *s1;
a2d586
@@ -441,11 +466,19 @@ static void processargs (int argc, char
a2d586
             fprintf (stderr, "lefty version %s\n", LEFTYVERSION);
a2d586
             fprintf (stderr, "graphviz version %s (%s)\n", VERSION, BUILDDATE);
a2d586
 	}
a2d586
+        else if (strcmp (argv[0], "-?") == 0)
a2d586
+            usage(cmd, 0);
a2d586
         else if (strcmp (argv[0], "-") == 0)
a2d586
             fp = stdin;
a2d586
+        else if (argv[0][0] == '-') {
a2d586
+            fprintf (stderr, "option %s unrecognized - ignored\n", argv[0]);
a2d586
+            usage (cmd, 1);
a2d586
+        }
a2d586
         else {
a2d586
-            if ((fp = fopen (argv[0], "r")) == NULL)
a2d586
-                panic1 (POS, "main", "cannot open input file: %s", argv[0]);
a2d586
+            if ((fp = fopen (argv[0], "r")) == NULL) {
a2d586
+                fprintf (stderr, "cannot open input file: %s", argv[0]);
a2d586
+                exit(2);
a2d586
+            }
a2d586
         }
a2d586
         argv++, argc--;
a2d586
     }
a2d586
diff -up graphviz-2.30.1/cmd/lefty/lefty.1.orig8 graphviz-2.30.1/cmd/lefty/lefty.1
a2d586
--- graphviz-2.30.1/cmd/lefty/lefty.1.orig8	2013-02-14 14:27:39.000000000 +0100
a2d586
+++ graphviz-2.30.1/cmd/lefty/lefty.1	2013-07-12 12:48:37.829553144 +0200
a2d586
@@ -115,6 +115,9 @@ call. The default file name is
a2d586
 .TP
a2d586
 .B -V
a2d586
 Prints the version.
a2d586
+.TP
a2d586
+.B -?
a2d586
+Prints the usage and exits.
a2d586
 .SH SEE ALSO
a2d586
 .I lefty
a2d586
 user guide.