4
#include <markupfiltmgr.h>
5
#include <regex.h> // GNU
8
#ifndef NO_SWORD_NAMESPACE
12
void percentUpdate(char percent, void *userData) {
13
static char printed = 0;
14
char maxHashes = *((char *)userData);
16
while ((((float)percent)/100) * maxHashes > printed) {
22
std::cout << (int)percent << "% ";
28
int main(int argc, char **argv)
30
SWMgr manager(0, 0, true, new MarkupFilterMgr(FMT_RTF, ENC_RTF));
38
if ((argc != 3) && (argc != 4)) {
39
fprintf(stderr, "usage: %s <modname> <\"search string\"> [\"search_scope\"]\n", argv[0]);
43
it = manager.Modules.find(argv[1]);
44
if (it == manager.Modules.end()) {
45
fprintf(stderr, "Could not find module [%s]. Available modules:\n", argv[1]);
46
for (it = manager.Modules.begin(); it != manager.Modules.end(); it++) {
47
fprintf(stderr, "[%s]\t - %s\n", (*it).second->Name(), (*it).second->Description());
52
target = (*it).second;
54
if (argc == 4) { // if min / max specified
55
scope = parser.ParseVerseList(argv[3], parser, true);
57
target->setKey(scope);
60
std::cout << "[0=================================50===============================100]\n ";
62
listkey = target->Search(argv[2], -3, 0/*REG_ICASE*/, 0, 0, &percentUpdate, &lineLen);
64
while (!listkey.Error()) {
65
std::cout << (const char *)listkey << std::endl;