56 const char * helptext =
"addvs 1.1 Bible & Commentary module creation tool for the SWORD Project\nUse -a to add a new verse from standard input or a file, -d to delete a verse,\n-l to link two verses, -c to create a new module.\n usage:\n %s -a </path/to/module> <verse> [</path/to/file/with/verse>]\n %s -d </path/to/module> <key>\n %s -l </path/to/module> <first verse (already assigned)> <second verse>\n %s -c </path/to/module>\n";
60 fprintf(stderr, helptext, argv[0], argv[0], argv[0], argv[0]);
63 if (!strcmp(argv[1],
"-a") && (argc == 4 || argc == 5)) {
90 if (argc == 5) infile = fopen(argv[4],
"r");
94 entrysize = fread(buffer,
sizeof(
char),
sizeof(buffer), infile);
101 bool havefirst =
false;
103 for (i = 0; i < listkey.
getCount(); i++) {
108 std::cout << mod->
getKeyText() <<
"-" << (
const char*)finalkey << std::endl;
111 firstverse = *mod->
getKey();
115 if (argc == 5) infile = fopen(argv[4],
"r");
119 entrysize = fread(buffer,
sizeof(
char),
sizeof(buffer), infile);
122 std::cout <<
"f" << (
const char*)firstverse << std::endl;
125 while (*mod->
getKey() <= finalkey) {
140 firstverse = *mod->
getKey();
144 if (argc == 5) infile = fopen(argv[4],
"r");
148 entrysize = fread(buffer,
sizeof(
char),
sizeof(buffer), infile);
151 std::cout <<
"f" << (
const char*)firstverse << std::endl;
159 else if (!strcmp(argv[1],
"-l") && argc == 5) {
169 else if (!strcmp(argv[1],
"-d") && argc == 4) {
199 else if (!strcmp(argv[1],
"-c") && argc == 3) {
203 fprintf(stderr,
"error: %s: couldn't create module at path: %s \n", argv[0], argv[2]);
210 fprintf(stderr, helptext, argv[0], argv[0], argv[0], argv[0]);
virtual int getCount() const
virtual void deleteEntry()
static char createModule(const char *path, const char *v11n="KJV")
virtual void setEntry(const char *inbuf, long len=-1)
VerseKey & getLowerBound() const
virtual SWKey * getKey() const
virtual char setKey(const SWKey *ikey)
virtual SWKey * getElement(int pos=-1)
void setPersist(bool ipersist)
virtual void setIntros(bool val)
virtual int getChapter() const
virtual ListKey parseVerseList(const char *buf, const char *defaultKey=0, bool expandRange=false, bool useChapterAsVerse=false)
virtual void setVerse(int iverse)
virtual int getVerse() const
VerseKey & getUpperBound() const
#define SWDYNAMIC_CAST(className, object)
virtual const char * getKeyText() const
virtual void setAutoNormalize(bool iautonorm)