Matthew Talbert wrote:

> If this gets fixed, I think searching and results should be added to
> the test suite. It would be simple to add; just run mkfastmod, then
> the search program (it would be nice to be able to change the search
> type without re-compiling so that different search types could be
> done).

Seems reasonable.  I just created a trivially enhanced search.cpp which
checks for the existence of SEARCH_TYPE as an enviroment variable and
uses it if present.  svn diff attached.  So now you can do

  SEARCH_TYPE=-4 ./search KJV "swift hear slow speak"

and so on and so forth.  Patch is below.

Jonathan


Index: search.cpp
===================================================================
--- search.cpp  (revision 2449)
+++ search.cpp  (working copy)
@@ -26,6 +26,7 @@
 #include <markupfiltmgr.h>
 #include <regex.h> // GNU
 #include <iostream>
+#include <cstdlib> // For getenv() and atoi()

 #ifndef NO_SWORD_NAMESPACE
 using namespace sword;
@@ -72,6 +73,13 @@
                exit(-1);
        }

+       // Override compiled in SEARCH_TYPE from environment variable.
+       char *envpointer;
+       std::string envstring = "SEARCH_TYPE";
+       if ((envpointer = getenv(envstring.c_str()))) {
+         SEARCH_TYPE = atoi(envpointer);
+         std::cout << "SEARCH_TYPE is : " << envpointer << std::endl ;
+       }

        SWBuf searchTerm = argv[2];
        manager.setGlobalOption("Greek Accents", "Off");


_______________________________________________
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Reply via email to