diff options
author | danglassey <danglassey> | 2002-08-14 09:57:17 +0000 |
---|---|---|
committer | danglassey <danglassey> | 2002-08-14 09:57:17 +0000 |
commit | daa67ff1f728c07f2a116ee9a9f4505479ca6808 (patch) | |
tree | c224a537d30480002ae0560cc9104b543b4d1b5e /utilities/mod2imp.cpp | |
parent | 6d6973e035aac5ec1676efccd5b8ada70c40b639 (diff) | |
download | sword-sf-cvs-import-1.1.1.tar.gz |
Initial import from crosswire CVS for syncingimport-1.1.1
Diffstat (limited to 'utilities/mod2imp.cpp')
-rw-r--r-- | utilities/mod2imp.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/utilities/mod2imp.cpp b/utilities/mod2imp.cpp new file mode 100644 index 0000000..1bc5ece --- /dev/null +++ b/utilities/mod2imp.cpp @@ -0,0 +1,65 @@ +// Compression on variable granularity + +#include <fcntl.h> +#include <iostream> +#include <fstream> +#include <string> + +#ifndef __GNUC__ +#include <io.h> +#else +#include <unistd.h> +#endif + +#include <ztext.h> +#include <zld.h> +#include <zcom.h> +#include <swmgr.h> +#include <lzsscomprs.h> +#include <zipcomprs.h> +#include <versekey.h> +#include <stdio.h> + +void errorOutHelp(char *appName) { + cerr << appName << " - a tool to output a Sword module in SWORD's 'imp' import format\n"; + cerr << "usage: "<< appName << " <modname> \n"; + cerr << "\n\n"; + exit(-1); +} + + +int main(int argc, char **argv) +{ + SWModule *inModule = 0; + + if ((argc != 2)) { + errorOutHelp(argv[0]); + } + + if ((!strcmp(argv[1], "-h")) || (!strcmp(argv[1], "--help")) || (!strcmp(argv[1], "/?")) || (!strcmp(argv[1], "-?")) || (!strcmp(argv[1], "-help"))) { + errorOutHelp(argv[0]); + } + + SWMgr mgr; + + ModMap::iterator it = mgr.Modules.find(argv[1]); + if (it == mgr.Modules.end()) { + fprintf(stderr, "error: %s: couldn't find module: %s \n", argv[0], argv[1]); + exit(-2); + } + + inModule = it->second; + + SWKey *key = (SWKey *)*inModule; + VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key); + + if (vkey) + vkey->Headings(1); + + for ((*inModule) = TOP; !inModule->Error(); (*inModule)++) { + cout << "$$$" << inModule->KeyText() << endl; + cout << inModule->getRawEntry() << endl; + } + return 0; +} + |