X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fkdump.c;h=40ab26fc5edb7cf0f4b0fc3b6663748bf2df837e;hb=3db15cf883ad80b6a4b0e960f3c3b59c86b59c6b;hp=bef8c27ff00af25c7480299a56585c63164a918e;hpb=f4c557cfebb4fa779a858c7d305081d4d92578da;p=idzebra-moved-to-github.git diff --git a/index/kdump.c b/index/kdump.c index bef8c27..40ab26f 100644 --- a/index/kdump.c +++ b/index/kdump.c @@ -4,7 +4,28 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: kdump.c,v $ - * Revision 1.8 1996-06-04 10:18:59 adam + * Revision 1.14 1997-10-27 14:33:04 adam + * Moved towards generic character mapping depending on "structure" + * field in abstract syntax file. Fixed a few memory leaks. Fixed + * bug with negative integers when doing searches with relational + * operators. + * + * Revision 1.13 1997/09/09 13:38:07 adam + * Partial port to WIN95/NT. + * + * Revision 1.12 1997/09/05 09:52:32 adam + * Extra argument added to function chr_read_maptab (tab path). + * + * Revision 1.11 1996/10/29 14:06:49 adam + * Include zebrautl.h instead of alexutil.h. + * + * Revision 1.10 1996/06/04 14:56:12 quinn + * Fix + * + * Revision 1.9 1996/06/04 14:18:53 quinn + * Charmap work + * + * Revision 1.8 1996/06/04 10:18:59 adam * Minor changes - removed include of ctype.h. * * Revision 1.7 1995/10/10 12:24:38 adam @@ -32,11 +53,16 @@ * */ #include +#include #include +#ifdef WINDOWS +#include +#else #include +#endif #include -#include +#include #include "index.h" char *prog; @@ -108,12 +134,13 @@ int main (int argc, char **argv) char key_info[256]; FILE *inf; struct it_key prevk; + chrmaptab map = 0; prevk.sysno = 0; prevk.seqno = 0; prog = *argv; - while ((ret = options ("v:", argv, argc, &arg)) != -2) + while ((ret = options ("m:v:", argv, argc, &arg)) != -2) { if (ret == 0) { @@ -123,6 +150,14 @@ int main (int argc, char **argv) { log_init (log_mask_str(arg), prog, NULL); } + else if (ret == 'm') + { + if (!(map = chrmaptab_create (NULL, arg, 0))) + { + logf(LOG_FATAL, "Failed to open maptab"); + exit(1); + } + } else { logf (LOG_FATAL, "Unknown option '-%s'", arg); @@ -131,7 +166,7 @@ int main (int argc, char **argv) } if (!key_fname) { - fprintf (stderr, "kdump [-v log] file\n"); + fprintf (stderr, "kdump [-m maptab -v log] file\n"); exit (1); } if (!(inf = fopen (key_fname, "r"))) @@ -143,11 +178,26 @@ int main (int argc, char **argv) { struct it_key k; int op; + char keybuf[IT_MAX_WORD+1]; op = key_info[0]; memcpy (&k, 1+key_info, sizeof(k)); + if (map) + { + char *to = keybuf, *from = key_string; + + while (*from) + { + char *res = chr_map_output(map, from, 1); + while (*res) + *(to++) = *(res++); + } + *to = '\0'; + } + else + strcpy(keybuf, key_string); printf ("%7d op=%d s=%-5d %s\n", k.sysno, op, k.seqno, - key_string); + keybuf); } if (fclose (inf)) {