1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Author: Steffen Moeller <moeller@debian.org>
Last-Update: Sun, 11 Jul 2010 06:27:12 +0200
Description: Add -h argument for help
--- a/w9/dotterMain.c
+++ b/w9/dotterMain.c
@@ -230,6 +230,16 @@ int main(int argc, char **argv)
usage = messalloc(strlen(usageText) + strlen(dotterVersion) + strlen(cc_date) + 20);
sprintf(usage, "%s%s, compiled %s\n", usageText, dotterVersion, cc_date);
+ // check if any argument is --help or -help
+ int i;
+ for(i=1; i<argc; i++) {
+ if (0 == strncmp("--help",argv[i],6) || 0 == strncmp("-help",argv[i],5)) {
+ fprintf(stderr,"%s\n",usage);
+ exit(0);
+ }
+ }
+
+
while ((optc = getopt(argc, argv, optstring)) != EOF)
switch (optc)
|