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

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