[sword-svn] r3110 - trunk/utilities/diatheke

chrislit at crosswire.org chrislit at crosswire.org
Wed Mar 12 04:01:18 MST 2014


Author: chrislit
Date: 2014-03-12 04:01:18 -0700 (Wed, 12 Mar 2014)
New Revision: 3110

Modified:
   trunk/utilities/diatheke/diatheke.cpp
Log:
added more cases that cause diatheke to print its syntax (including --help & -h switches or any unexpected switch prior to -k)


Modified: trunk/utilities/diatheke/diatheke.cpp
===================================================================
--- trunk/utilities/diatheke/diatheke.cpp	2014-03-12 10:24:27 UTC (rev 3109)
+++ trunk/utilities/diatheke/diatheke.cpp	2014-03-12 11:01:18 UTC (rev 3110)
@@ -73,6 +73,8 @@
 	fprintf (stderr, "  diatheke -b KJV -o fmnx -k Jn 3:16\n");
 	fprintf (stderr, "  diatheke -b WHNU -t Latin -o mn -k Mt 24\n");
 	fprintf (stderr, "  diatheke -b KJV -s phrase -r Mt -k love\n");
+
+	exit(EXIT_FAILURE);
 }
 
 int main(int argc, char **argv)
@@ -246,8 +248,11 @@
 			if (i < argc) {
 				SWBuf key = argv[i];
 				i++;
-				for (; i < argc; i++)
+				for (; i < argc; i++) {
+					if (!::stricmp("-h", argv[i]) || !::stricmp("--help", argv[i]))
+						printsyntax();
 					key = key + " " + argv[i];
+				}
 				ref = new char[key.length() + 1];
 				strcpy (ref, key.c_str());
 				if (strlen(ref))
@@ -270,6 +275,11 @@
 			}
 		}
 		*/
+		else {
+			// unexpected argument, so print the syntax
+			// -h, --help, /?, etc. will trigger this
+			printsyntax();
+		}
 	}
 	
 	




More information about the sword-cvs mailing list