2 * Copyright (c) 1995-2000, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.11 2000-07-04 08:53:22 adam
10 * Revision 1.10 2000/02/29 13:44:55 adam
11 * Check for config.h (currently not generated).
13 * Revision 1.9 1999/11/30 13:47:12 adam
14 * Improved installation. Moved header files to include/yaz.
16 * Revision 1.8 1999/05/26 07:49:35 adam
19 * Revision 1.7 1998/02/11 11:53:36 adam
20 * Changed code so that it compiles as C++.
22 * Revision 1.6 1997/12/12 06:32:33 adam
23 * Added include of string.h.
25 * Revision 1.5 1997/09/24 13:29:40 adam
26 * Added verbose option -v to marcdump utility.
28 * Revision 1.4 1995/11/01 13:55:05 quinn
31 * Revision 1.3 1995/05/16 08:51:12 quinn
32 * License, documentation, and memory fixes
34 * Revision 1.2 1995/05/15 11:56:56 quinn
35 * Debuggng & adjustments.
37 * Revision 1.1 1995/04/10 10:28:47 quinn
38 * Added copy of CCL and MARC display
50 #include <yaz/marcdisp.h>
51 #include <yaz/xmalloc.h>
52 #include <yaz/options.h>
61 int main (int argc, char **argv)
73 while ((ret = options("v", argv, argc, &arg)) != -2)
79 inf = fopen (arg, "r");
82 fprintf (stderr, "%s: cannot open %s:%s\n",
83 prog, arg, strerror (errno));
86 if (fseek (inf, 0L, SEEK_END))
88 fprintf (stderr, "%s: cannot seek in %s:%s\n",
89 prog, arg, strerror (errno));
92 file_size = ftell (inf);
93 if (fseek (inf, 0L, SEEK_SET))
95 fprintf (stderr, "%s: cannot seek in %s:%s\n",
96 prog, arg, strerror (errno));
99 buf = (char *)xmalloc (file_size);
102 fprintf (stderr, "%s: cannot xmalloc: %s\n",
103 prog, strerror (errno));
106 if ((long) fread (buf, 1, file_size, inf) != file_size)
108 fprintf (stderr, "%s: cannot read %s: %s\n",
109 prog, arg, strerror (errno));
112 for (p = buf; (ret = marc_display_ex (p, stdout, verbose)) > 0;)
124 fprintf (stderr, "Usage: %s [-v] file...\n", prog);
130 fprintf (stderr, "Usage: %s [-v] file...\n", prog);