source: gsdl/trunk/trunk/mg/src/images/mgticdump.c@ 16583

Last change on this file since 16583 was 16583, checked in by davidb, 16 years ago

Undoing change commited in r16582

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1/**************************************************************************
2 *
3 * mgticdump.c -- Program to dump out a library in a human readable form
4 * Copyright (C) 1994 Stuart Inglis
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 * $Id: mgticdump.c 16583 2008-07-29 10:20:36Z davidb $
21 *
22 **************************************************************************/
23
24#include "sysfuncs.h"
25
26#include "marklist.h"
27#include "pbmtools.h"
28#include "extractor.h"
29#include "utils.h"
30
31
32void
33usage ()
34{
35 fprintf (stderr, "usage:\n"
36 "\tmgticdump libraryfile\n");
37 exit (1);
38}
39
40
41
42void
43main (int argc, char *args[])
44{
45 FILE *lib;
46 int count, i;
47 marktype d;
48 char *libraryname = NULL;
49 FILE *outf = (stdout);
50
51 if (argc < 2)
52 usage ();
53
54 for (i = 1; i < argc; i++)
55 {
56 if (!strcmp (args[i], "-h"))
57 usage ();
58 else if (args[i][0] == '-')
59 error_msg (args[0], "unknown switch:", args[i]);
60 else if (!libraryname)
61 libraryname = args[i];
62 else
63 error_msg (args[0], "too many filenames", "");
64 }
65
66 if (!libraryname)
67 error_msg (args[0], "please specify a library file", "");
68
69
70 lib = fopen (libraryname, "rb");
71 if (lib == NULL)
72 error_msg (args[0], "trouble opening library file:", libraryname);
73
74 count = 0;
75 while (!isEOF (lib))
76 {
77 read_library_mark (lib, &d);
78
79 write_library_mark (outf, d);
80 count++;
81
82 pbm_freearray (&d.bitmap, d.h);
83 }
84 fprintf (stderr, "count=%d", count);
85 fclose (lib);
86}
Note: See TracBrowser for help on using the repository browser.