0
|
1 /*
|
|
2 * $Id: wnntouch.c,v 1.8 2004/07/19 18:24:26 hiroo Exp $
|
|
3 */
|
|
4
|
|
5 /*
|
|
6 * FreeWnn is a network-extensible Kana-to-Kanji conversion system.
|
|
7 * This file is part of FreeWnn.
|
|
8 *
|
|
9 * Copyright Kyoto University Research Institute for Mathematical Sciences
|
|
10 * 1987, 1988, 1989, 1990, 1991, 1992
|
|
11 * Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999
|
|
12 * Copyright ASTEC, Inc. 1987, 1988, 1989, 1990, 1991, 1992
|
|
13 * Copyright FreeWnn Project 1999, 2000, 2002, 2004
|
|
14 *
|
|
15 * Maintainer: FreeWnn Project <freewnn@tomo.gr.jp>
|
|
16 *
|
|
17 * This program is free software; you can redistribute it and/or modify
|
|
18 * it under the terms of the GNU General Public License as published by
|
|
19 * the Free Software Foundation; either version 2 of the License, or
|
|
20 * (at your option) any later version.
|
|
21 *
|
|
22 * This program is distributed in the hope that it will be useful,
|
|
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
25 * GNU General Public License for more details.
|
|
26 *
|
|
27 * You should have received a copy of the GNU General Public License
|
|
28 * along with this program; if not, write to the Free Software
|
|
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
30 */
|
|
31
|
|
32 /*
|
|
33 * 辞書のヘッダを書き換えて、辞書の inode と合わせるプログラム。
|
|
34 */
|
|
35
|
|
36 #ifndef lint
|
|
37 static char *rcs_id = "$Id: wnntouch.c,v 1.8 2004/07/19 18:24:26 hiroo Exp $";
|
|
38 #endif /* lint */
|
|
39
|
|
40 #ifdef HAVE_CONFIG_H
|
|
41 # include <config.h>
|
|
42 #endif
|
|
43
|
|
44 #include <stdio.h>
|
|
45 #if STDC_HEADERS
|
|
46 # include <stdlib.h>
|
|
47 #endif /* STDC_HEADERS */
|
|
48 #if HAVE_UNISTD_H
|
|
49 # include <unistd.h>
|
|
50 #endif
|
|
51 #include "jslib.h"
|
|
52 #include "commonhd.h"
|
|
53 #include "getopt.h" /* GNU getopt in the stock */
|
|
54
|
|
55 extern int input_file_header (), check_inode (), change_file_uniq ();
|
|
56 static void usage (void);
|
|
57
|
|
58 char *com_name;
|
|
59 struct wnn_file_head fh;
|
|
60
|
|
61 static void
|
|
62 parse_options (int argc, char** argv)
|
|
63 {
|
|
64 int c;
|
|
65
|
|
66 while ((c = getopt (argc, argv, "")) != EOF)
|
|
67 {
|
|
68 }
|
|
69 if (optind)
|
|
70 {
|
|
71 optind--;
|
|
72 argc -= optind;
|
|
73 argv += optind;
|
|
74 }
|
|
75 if (argc < 2)
|
|
76 {
|
|
77 usage ();
|
|
78 }
|
|
79 }
|
|
80
|
|
81 static void
|
|
82 usage (void)
|
|
83 {
|
|
84 fprintf (stderr, "Usage: %s Wnn_file_name* \n", com_name);
|
|
85 exit (1);
|
|
86 }
|
|
87
|
|
88 int
|
|
89 main (int argc, char** argv)
|
|
90 {
|
|
91 FILE *ifpter;
|
|
92 int k;
|
|
93
|
|
94 com_name = argv[0];
|
|
95 parse_options (argc, argv);
|
|
96
|
|
97 for (k = 1; k < argc; k++)
|
|
98 {
|
|
99 if ((ifpter = fopen (argv[k], "r")) == NULL)
|
|
100 {
|
|
101 fprintf (stderr, "Can't open the input file %s.\n", argv[k]);
|
|
102 perror ("");
|
|
103 exit (1);
|
|
104 }
|
|
105 if (input_file_header (ifpter, &fh) == -1)
|
|
106 {
|
|
107 fprintf (stderr, "%s %s: It's not a Wnn File.\n", com_name, argv[k]);
|
|
108 exit (1);
|
|
109 }
|
|
110 if (check_inode (ifpter, &fh) == -1)
|
|
111 {
|
|
112 if (change_file_uniq (&fh, argv[k]) == -1)
|
|
113 {
|
|
114 fprintf (stderr, "%s %s: Can't change file_uniq.\n", com_name, argv[k]);
|
|
115 perror ("");
|
|
116 exit (1);
|
|
117 }
|
|
118 }
|
|
119 fclose (ifpter);
|
|
120 }
|
|
121 exit (0);
|
|
122 }
|