/*
- * Copyright (C) 1994-1995, Index Data I/S
+ * Copyright (C) 1994-1996, Index Data I/S
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: kdump.c,v $
- * Revision 1.7 1995-10-10 12:24:38 adam
+ * 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
* Temporary sort files are compressed.
*
* Revision 1.6 1995/09/29 14:01:42 adam
#include <unistd.h>
#include <assert.h>
-#include <alexutil.h>
+#include <charmap.h>
#include "index.h"
char *prog;
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)
{
{
log_init (log_mask_str(arg), prog, NULL);
}
+ else if (ret == 'm')
+ {
+ if (!(map = chr_read_maptab(arg)))
+ {
+ logf(LOG_FATAL, "Failed to open maptab");
+ exit(1);
+ }
+ }
else
{
logf (LOG_FATAL, "Unknown option '-%s'", arg);
}
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")))
{
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 = (char*)map->output[(unsigned char) *(from++)];
+ 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))
{