diff options
author | Daniel Glassey <wdg@debian.org> | 2015-09-07 11:14:57 +0100 |
---|---|---|
committer | Daniel Glassey <wdg@debian.org> | 2015-09-07 11:14:57 +0100 |
commit | 7b6c8b08e9d29332dcd0a1029e7421334bfb6f61 (patch) | |
tree | dc263ee8b6c923716a8e0fed64756b7af1238dc7 /utilities/diatheke/diatheke.cpp | |
parent | 7a00574163029c0c2b649878c95d5acbd083564a (diff) |
Imported Upstream version 1.7.3+dfsg
Diffstat (limited to 'utilities/diatheke/diatheke.cpp')
-rw-r--r-- | utilities/diatheke/diatheke.cpp | 53 |
1 files changed, 38 insertions, 15 deletions
diff --git a/utilities/diatheke/diatheke.cpp b/utilities/diatheke/diatheke.cpp index 159e3a5..1649169 100644 --- a/utilities/diatheke/diatheke.cpp +++ b/utilities/diatheke/diatheke.cpp @@ -2,9 +2,9 @@ * * diatheke.cpp - * - * $Id: diatheke.cpp 2903 2013-07-16 11:11:18Z chrislit $ + * $Id: diatheke.cpp 3170 2014-04-17 04:14:38Z greg.hellings $ * - * Copyright 1999-2013 CrossWire Bible Society (http://www.crosswire.org) + * Copyright 1999-2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -21,7 +21,7 @@ */ /****************************************************************************** - * Diatheke 4.6 by Chris Little <chrislit@crosswire.org> + * Diatheke 4.7 by Chris Little <chrislit@crosswire.org> * http://www.crosswire.org/sword/diatheke */ @@ -37,8 +37,8 @@ using std::cout; void printsyntax() { //if we got this far without exiting, something went wrong, so print syntax - fprintf (stderr, "Diatheke command-line SWORD frontend Version 4.6\n"); - fprintf (stderr, "Copyright 1999-2013 by the CrossWire Bible Society\n"); + fprintf (stderr, "Diatheke command-line SWORD frontend Version 4.7\n"); + fprintf (stderr, "Copyright 1999-2014 by the CrossWire Bible Society\n"); fprintf (stderr, "http://www.crosswire.org/sword/diatheke/\n"); fprintf (stderr, "\n"); fprintf (stderr, "usage: diatheke <-b module_name> [-s search_type] [-r search_range]\n"); @@ -49,8 +49,9 @@ void printsyntax() { fprintf (stderr, "If <book> is \"system\" you may use these system keys: \"modulelist\",\n"); fprintf (stderr, "\"modulelistnames\", and \"localelist\"."); fprintf (stderr, "\n"); - fprintf (stderr, "Valid search_type values are: regex, multiword, and phrase(def).\n"); - fprintf (stderr, "Valid option_filters values are: n (Strong's numbers),\n"); + fprintf (stderr, "Valid search_type values are: phrase (default), regex, multiword,\n"); + fprintf (stderr, " attribute, lucene, multilemma.\n"); + fprintf (stderr, "Valid (output) option_filters values are: n (Strong's numbers),\n"); fprintf (stderr, " f (Footnotes), m (Morphology), h (Section Headings),\n"); fprintf (stderr, " c (Cantillation), v (Hebrew Vowels), a (Greek Accents), p (Arabic Vowels)\n"); fprintf (stderr, " l (Lemmas), s (Scripture Crossrefs), r (Arabic Shaping),\n"); @@ -70,6 +71,8 @@ void printsyntax() { 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) @@ -94,19 +97,30 @@ int main(int argc, char **argv) } else if (!::stricmp("-s", argv[i])) { if (i+1 <= argc) { - if (!::stricmp("phrase", argv[i+1])) { + i++; + if (!::stricmp("phrase", argv[i])) { searchtype = ST_PHRASE; - i++; } - else if (!::stricmp("regex", argv[i+1])) { + else if (!::stricmp("regex", argv[i])) { searchtype = ST_REGEX; - i++; } - else if (!::stricmp("multiword", argv[i+1])) { + else if (!::stricmp("multiword", argv[i])) { searchtype = ST_MULTIWORD; - i++; } - else i++; + else if (!::stricmp("lucene", argv[i])) { + searchtype = ST_CLUCENE; + } + else if (!::stricmp("attribute", argv[i])) { + searchtype = ST_ENTRYATTRIB; + } + else if (!::stricmp("multilemma", argv[i])) { + searchtype = ST_MULTILEMMA; + } + else { + fprintf (stderr, "Unknown search_type: %s\n", argv[i]); + fprintf (stderr, "Try diatheke --help\n"); + return 0; + } } } else if (!::stricmp("-r", argv[i])) { @@ -233,8 +247,11 @@ int main(int argc, char **argv) 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)) @@ -257,12 +274,18 @@ int main(int argc, char **argv) } } */ + else { + // unexpected argument, so print the syntax + // -h, --help, /?, etc. will trigger this + printsyntax(); + } } if (runquery == (RQ_BOOK | RQ_REF)) { doquery(maxverses, outputformat, outputencoding, optionfilters, searchtype, range, text, locale, ref, &cout, script, variants); } + //if we got this far without exiting, something went wrong, so print syntax else printsyntax(); return 0; |