Ilya Zakharevich on Sun, 17 Jan 1999 18:40:02 -0500


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PATCH] Better cmd-line options


This patch makes usage message more informative, and adds new option
--version.  Note that another options --help is documented too, but it was
available before as well  ;-).

Maybe it is good to add line "Send bug reports to..." too?

Enjoy,
Ilya

--- ./src/gp/gp.c.orig	Fri Nov  6 10:08:32 1998
+++ ./src/gp/gp.c	Sun Jan 17 18:21:16 1999
@@ -64,7 +66,17 @@ static void
 usage(char *s)
 {
   printf("### Usage: "); printf(s);
-  printf(" [-f] [-s stacksize] [-p primelimit] [-b buffersize]\n\n");
+  printf(" [options]\n");
+  printf(" Options are:\n");
+  printf("\t[-b buffersize]\tDeprecated\n");
+  printf("\t[-emacs]\tRun as if in Emacs shell\n");
+  printf("\t[-f]\t\tFaststart: do not read .gprc\n");
+  printf("\t[--help]\tPrint this message\n");
+  printf("\t[-q]\t\tQuiet mode: do not print banner and history numbers\n");
+  printf("\t[-p primelimit]\tPrecalculate primes up to the limit\n");
+  printf("\t[-s stacksize]\tStart with the PARI stack of given size (in bytes)\n");
+  printf("\t[-test]\t\tTest mode.  As -q, plus wrap long lines\n");
+  printf("\t[--version]\tOutput version info and exit\n\n");
   exit(0);
 }
 
@@ -2613,6 +2625,12 @@ read_opt(long argc, char **argv)
         disable_color = 1; test_mode = 1; /* fall through */
       case 'f':
 	pre = NULL; break;
+      case '-':
+        if (strcmp(t, "version") == 0) {
+ 	    print_version();
+	    exit(0);
+        }
+	/* fall through */
       default:
 	usage(argv[0]);
     }