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