1 /*
2 * Copyright (c) 1991-1994 Sony Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 *
23 * Except as contained in this notice, the name of Sony Corporation
24 * shall not be used in advertising or otherwise to promote the sale, use
25 * or other dealings in this Software without prior written authorization
26 * from Sony Corporation.
27 *
28 */
29
30 /*
31 * $SonyRCSfile: dictdisp.c,v $
32 * $SonyRevision: 1.1 $
33 * $SonyDate: 1994/06/03 08:03:34 $
34 */
35
36
37
38
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <string.h>
42 #include <ctype.h>
43
44 #include "sj3dic.h"
45
46 void
dictdisp(char * output)47 dictdisp(char *output)
48 {
49 unsigned char buf[BUFSIZ];
50 unsigned char *p;
51 FILE *fp;
52 int flg;
53 int i;
54
55 if (output && *output) {
56 fp = fopen(output, "w");
57 if (!fp) {
58 error_out("%s \244\254\245\252\241\274\245\327\245\363\244\307\244\255\244\336\244\273\244\363", output);
59 exit(1);
60 }
61 }
62 else
63 fp = stdout;
64
65 flg = sj3_getdict_mb(buf);
66 while (flg == 0) {
67 p = buf;
68 printout_mb(fp, p);
69 i = strlen(p);
70 if (i < 24)
71 while (i < 24) {
72 printout_mb(fp, "\t");
73 i += 8;
74 }
75 else
76 printout_mb(fp, " ");
77 while (*p++) ;
78 printout_mb(fp, p);
79 i = strlen(p);
80 if (i < 24)
81 while (i < 24) {
82 printout_mb(fp, "\t");
83 i += 8;
84 }
85 else
86 printout_mb(fp, " ");
87 while (*p++) ;
88 printout(fp, hns2str(*p));
89 printout_mb(fp, ":\n");
90
91 flg = sj3_nextdict_mb(buf);
92 }
93
94 if (fp != stdout) fclose(fp);
95 }
96