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