2 * Copyright (c) 1995-2001, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.13 2001-02-10 01:21:59 adam
8 * Dumper only keeps one record at a time in memory.
10 * Revision 1.12 2000/10/02 11:07:45 adam
11 * Added peer_name member for bend_init handler. Changed the YAZ
12 * client so that tcp: can be avoided in target spec.
14 * Revision 1.11 2000/07/04 08:53:22 adam
17 * Revision 1.10 2000/02/29 13:44:55 adam
18 * Check for config.h (currently not generated).
20 * Revision 1.9 1999/11/30 13:47:12 adam
21 * Improved installation. Moved header files to include/yaz.
23 * Revision 1.8 1999/05/26 07:49:35 adam
26 * Revision 1.7 1998/02/11 11:53:36 adam
27 * Changed code so that it compiles as C++.
29 * Revision 1.6 1997/12/12 06:32:33 adam
30 * Added include of string.h.
32 * Revision 1.5 1997/09/24 13:29:40 adam
33 * Added verbose option -v to marcdump utility.
35 * Revision 1.4 1995/11/01 13:55:05 quinn
38 * Revision 1.3 1995/05/16 08:51:12 quinn
39 * License, documentation, and memory fixes
41 * Revision 1.2 1995/05/15 11:56:56 quinn
42 * Debuggng & adjustments.
44 * Revision 1.1 1995/04/10 10:28:47 quinn
45 * Added copy of CCL and MARC display
57 #include <yaz/marcdisp.h>
58 #include <yaz/yaz-util.h>
59 #include <yaz/xmalloc.h>
60 #include <yaz/options.h>
69 int main (int argc, char **argv)
80 while ((r = options("vc:", argv, argc, &arg)) != -2)
89 cfile = fopen (arg, "w");
92 inf = fopen (arg, "r");
96 fprintf (stderr, "%s: cannot open %s:%s\n",
97 prog, arg, strerror (errno));
101 fprintf (cfile, "char *marc_records[] = {\n");
106 r = fread (buf, 1, 5, inf);
109 len = atoi_n(buf, 5);
110 if (len < 25 || len > 100000)
113 r = fread (buf + 5, 1, len, inf);
116 r = marc_display_ex (buf, stdout, verbose);
124 fprintf (cfile, ",");
125 fprintf (cfile, "{\n");
126 for (i = 0; i < r; i++)
129 fprintf (cfile, " \"");
130 fprintf (cfile, "\\x%02X", p[i] & 255);
132 if (i < r - 1 && (i & 15) == 15)
133 fprintf (cfile, "\"\n");
136 fprintf (cfile, "\"\n}");
141 fprintf (cfile, "};\n");
147 fprintf (stderr, "Usage: %s [-c cfile] [-v] file...\n", prog);
155 fprintf (stderr, "Usage: %s [-v] file...\n", prog);