24 #pragma warning( disable: 4251 )
47 #ifndef NO_SWORD_NAMESPACE
50 using sword::ZipCompress;
59 int main(
int argc,
char **argv) {
61 const char * helptext =
"addld 1.0 Lexicon & Dictionary module creation tool for the SWORD Project\nUse -a to add a new LD entry from standard input or a file, -d to delete an\nentry, -l to link two LD entries, -c to create a new module.\n usage:\n %s -a <filename> <key> [</path/to/file/with/entry>]\n %s -d <filename> <key>\n %s -l <filename> <first key (already assigned)> <second key>\n %s -c <filename>\nTo use 4-byte LD instead of 2-byte, insert a 4 immediately after the '-'.\nTo use zLD instead of 2-byte, insert a z immediately after the '-'.\n";
64 bool fourbyte =
false;
69 fprintf(stderr, helptext, argv[0], argv[0], argv[0], argv[0]);
73 if (argv[1][1] ==
'4') {
77 else if (argv[1][1] ==
'z') {
85 if ((mode ==
'a') && (argc == 4 || argc == 5)) {
100 if (argc == 5) infile = fopen(argv[4],
"r");
104 entrysize = fread(buffer,
sizeof(
char),
sizeof(buffer), infile);
120 if (argc == 5) infile = fopen(argv[4],
"r");
124 entrysize = fread(buffer,
sizeof(
char),
sizeof(buffer), infile);
127 fprintf(stderr,
"error: %s: SWORD library not built with ZIP compression support.\n", argv[0]);
143 if (argc == 5) infile = fopen(argv[4],
"r");
147 entrysize = fread(buffer,
sizeof(
char),
sizeof(buffer), infile);
153 else if ((mode ==
'l') && argc == 5) {
162 SWKey tmpkey = argv[4];
173 SWKey tmpkey = argv[4];
184 SWKey tmpkey = argv[4];
188 else if ((mode ==
'd') && argc == 4) {
207 else if ((mode ==
'c') && argc == 3) {
212 fprintf(stderr,
"error: %s: couldn't create module at path: %s \n", argv[0], argv[2]);
218 fprintf(stderr,
"error: %s: couldn't create module at path: %s \n", argv[0], argv[2]);
224 fprintf(stderr,
"error: %s: couldn't create module at path: %s \n", argv[0], argv[2]);
232 fprintf(stderr, helptext, argv[0], argv[0], argv[0], argv[0]);
virtual void setEntry(const char *inbuf, long len=-1)
virtual void deleteEntry()
virtual char setKey(const SWKey *ikey)
static char createModule(const char *path)
void setPersist(bool ipersist)
virtual void setEntry(const char *inbuf, long len=-1)
static char createModule(const char *path)
virtual void setEntry(const char *inbuf, long len=-1)
virtual void deleteEntry()
static char createModule(const char *path)
virtual SWKey * createKey() const
virtual void deleteEntry()