1 --- src.orig/xjdcomm.c 2008-11-27 22:31:38.000000000 +0200
2 +++ src/xjdcomm.c 2008-12-01 16:34:17.000000000 +0200
3 @@ -187,235 +187,210 @@
7 - strcpy(DicDir,ENVname); /* added by nakahara@debian.org */
10 - if (strlen(cl_rcfile) > 0)
12 - fm = fopen(cl_rcfile,"r");
13 - if (fm != NULL) break;
14 + strcpy(DicDir,DEFAULT_DICDIR);
16 + if (strlen(cl_rcfile) > 0) {
17 + if((fm = fopen(cl_rcfile, "r")) != NULL)
21 - printf("Control file: %s cannot be accessed!\n",cl_rcfile);
23 + fprintf(stderr, "Control file %s cannot be accessed!\n", cl_rcfile);
26 - if (strlen(ENVname) > 2)
28 - strcpy(xjdicdir,ENVname);
29 - strcat(xjdicdir,"/");
33 - strcpy(xjdicdir,getenv("HOME"));
34 - strcat(xjdicdir,"/");
36 - strcat(xjdicdir,".xjdicrc");
37 - fm = fopen(xjdicdir,"r");
38 - if (fm != NULL) break;
39 - strcpy(xjdicdir,".xjdicrc");
40 - fm = fopen(xjdicdir,"r");
41 - if (fm != NULL) break;
42 - if (getenv("HOME") != NULL)
44 - strcpy(xjdicdir,getenv("HOME"));
45 - strcat(xjdicdir,"/");
46 - strcat(xjdicdir,".xjdicrc");
47 - fm = fopen(xjdicdir,"r");
48 - if (fm != NULL) break;
49 + if (getenv("HOME") != NULL) {
50 + strcpy(xjdicdir, getenv("HOME"));
51 + strcat(xjdicdir, "/.xjdicrc");
52 + if((fm = fopen(xjdicdir, "r")) != NULL)
55 - printf("No control file detected!\n");
57 + strcpy(xjdicdir, ENVname);
58 + strcat(xjdicdir, "/xjdicrc");
59 + if((fm = fopen(xjdicdir, "r")) != NULL)
62 + fprintf(stderr, "No control file detected!\n");
66 + while(fgets(rcstr,79,fm) != NULL)
68 - while(fgets(rcstr,79,fm) != NULL)
70 - rcwd = (unsigned char *)strtok(rcstr," \t");
71 + rcwd = (unsigned char *)strtok(rcstr," \t");
72 /* dicdir works for all modes */
73 - if( stringcomp((unsigned char *)"dicdir",rcwd) == 0)
75 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
76 - strcpy(DicDir,rcwd);
79 + if( stringcomp((unsigned char *)"dicdir",rcwd) == 0)
81 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
82 + strcpy(DicDir,rcwd);
86 - if( stringcomp((unsigned char *)"port",rcwd) == 0)
88 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
89 - portno = atoi(rcwd);
92 - if( stringcomp((unsigned char *)"server",rcwd) == 0)
94 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
98 + if( stringcomp((unsigned char *)"port",rcwd) == 0)
100 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
101 + portno = atoi(rcwd);
104 + if( stringcomp((unsigned char *)"server",rcwd) == 0)
106 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
112 - if( stringcomp((unsigned char *)"omode",rcwd) == 0)
114 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
115 - rcwd[0] = rcwd[0] | 0x20;
116 - if(rcwd[0] == 'j') Omode = 0;
117 - if(rcwd[0] == 'e') Omode = 1;
118 - if(rcwd[0] == 's') Omode = 2;
121 - if( stringcomp((unsigned char *)"kanamode",rcwd) == 0)
126 - if( stringcomp((unsigned char *)"exactmatch",rcwd) == 0)
131 + if( stringcomp((unsigned char *)"omode",rcwd) == 0)
133 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
134 + rcwd[0] = rcwd[0] | 0x20;
135 + if(rcwd[0] == 'j') Omode = 0;
136 + if(rcwd[0] == 'e') Omode = 1;
137 + if(rcwd[0] == 's') Omode = 2;
140 + if( stringcomp((unsigned char *)"kanamode",rcwd) == 0)
145 + if( stringcomp((unsigned char *)"exactmatch",rcwd) == 0)
152 - if( stringcomp((unsigned char *)"dicfile",rcwd) == 0)
153 + if( stringcomp((unsigned char *)"dicfile",rcwd) == 0)
166 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
167 - strcpy(Dnamet[thisdic],rcwd);
168 - strcpy(XJDXnamet[thisdic],rcwd);
169 - strcat(XJDXnamet[thisdic],".xjdx");
178 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
179 + strcpy(Dnamet[thisdic],rcwd);
180 + strcpy(XJDXnamet[thisdic],rcwd);
181 + strcat(XJDXnamet[thisdic],".xjdx");
186 - if( stringcomp((unsigned char *)"gnufile",rcwd) == 0)
188 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
189 - strcpy(GPL_File,rcwd);
192 + if( stringcomp((unsigned char *)"gnufile",rcwd) == 0)
194 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
195 + strcpy(GPL_File,rcwd);
200 - if( stringcomp((unsigned char *)"clipfile",rcwd) == 0)
202 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
203 - strcpy(Clip_File,rcwd);
206 + if( stringcomp((unsigned char *)"clipfile",rcwd) == 0)
208 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
209 + strcpy(Clip_File,rcwd);
214 - if( stringcomp((unsigned char *)"extfile",rcwd) == 0)
216 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
217 - strcpy(EXTname,rcwd);
218 - strcpy(EXTJDXname,rcwd);
219 - strcat(EXTJDXname, ".xjdx");
222 + if( stringcomp((unsigned char *)"extfile",rcwd) == 0)
224 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
225 + strcpy(EXTname,rcwd);
226 + strcpy(EXTJDXname,rcwd);
227 + strcat(EXTJDXname, ".xjdx");
232 - if( stringcomp((unsigned char *)"rvdisplay",rcwd) == 0)
234 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
235 - if( stringcomp((unsigned char *)"on",rcwd) == 0) RVACTIVE = TRUE;
236 - if( stringcomp((unsigned char *)"off",rcwd) == 0) RVACTIVE = FALSE;
239 + if( stringcomp((unsigned char *)"rvdisplay",rcwd) == 0)
241 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
242 + if( stringcomp((unsigned char *)"on",rcwd) == 0) RVACTIVE = TRUE;
243 + if( stringcomp((unsigned char *)"off",rcwd) == 0) RVACTIVE = FALSE;
248 - if( stringcomp((unsigned char *)"kdnoshow",rcwd) == 0)
250 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
251 - strcpy(KDNSlist,rcwd);
254 + if( stringcomp((unsigned char *)"kdnoshow",rcwd) == 0)
256 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
257 + strcpy(KDNSlist,rcwd);
262 - if( stringcomp((unsigned char *)"kdicfile",rcwd) == 0)
264 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
265 - strcpy(Dnamet[0],rcwd);
266 - strcpy(XJDXnamet[0],rcwd);
267 - strcat(XJDXnamet[0],".xjdx");
270 + if( stringcomp((unsigned char *)"kdicfile",rcwd) == 0)
272 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
273 + strcpy(Dnamet[0],rcwd);
274 + strcpy(XJDXnamet[0],rcwd);
275 + strcat(XJDXnamet[0],".xjdx");
280 - if( stringcomp((unsigned char *)"radkfile",rcwd) == 0)
282 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
283 - strcpy(RKname,rcwd);
286 - if( stringcomp((unsigned char *)"radfile",rcwd) == 0)
288 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
289 - strcpy(Rname,rcwd);
292 - if( stringcomp((unsigned char *)"verbfile",rcwd) == 0)
294 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
295 - strcpy(Vname,rcwd);
298 - if( stringcomp((unsigned char *)"romfile",rcwd) == 0)
300 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
301 - strcpy(ROMname,rcwd);
304 - if( stringcomp((unsigned char *)"jverb",rcwd) == 0)
306 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
307 - if(stringcomp(rcwd,(unsigned char *)"on") == 0) Jverb = TRUE;
308 - if(stringcomp(rcwd,(unsigned char *)"off") == 0) Jverb = FALSE;
311 - if( stringcomp((unsigned char *)"filt",rcwd) == 0)
313 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
314 - sscanf(rcwd,"%d",&fn);
315 - if ((fn < 0)||(fn > NOFILT)) continue;
316 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
317 - sscanf(rcwd,"%d",&ft);
318 - if (ft > 2) continue;
320 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
321 - filton[fn] = FALSE;
322 - if(stringcomp((unsigned char *)"on",rcwd) == 0)
327 - rcwd = (unsigned char *)strtok(NULL,"\"");
328 - strcpy(filtnames[fn],rcwd);
330 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
331 - while(rcwd != NULL)
333 - strcpy(filtcodes[fn][ft],rcwd);
335 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
338 - filtcoden[fn] = ft;
339 - filtact[fn] = TRUE;
343 + if( stringcomp((unsigned char *)"radkfile",rcwd) == 0)
345 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
346 + strcpy(RKname,rcwd);
352 - printf("No .xjdicrc file detected\n");
354 + if( stringcomp((unsigned char *)"radfile",rcwd) == 0)
356 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
357 + strcpy(Rname,rcwd);
360 + if( stringcomp((unsigned char *)"verbfile",rcwd) == 0)
362 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
363 + strcpy(Vname,rcwd);
366 + if( stringcomp((unsigned char *)"romfile",rcwd) == 0)
368 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
369 + strcpy(ROMname,rcwd);
372 + if( stringcomp((unsigned char *)"jverb",rcwd) == 0)
374 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
375 + if(stringcomp(rcwd,(unsigned char *)"on") == 0) Jverb = TRUE;
376 + if(stringcomp(rcwd,(unsigned char *)"off") == 0) Jverb = FALSE;
379 + if( stringcomp((unsigned char *)"filt",rcwd) == 0)
381 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
382 + sscanf(rcwd,"%d",&fn);
383 + if ((fn < 0)||(fn > NOFILT)) continue;
384 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
385 + sscanf(rcwd,"%d",&ft);
386 + if (ft > 2) continue;
388 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
389 + filton[fn] = FALSE;
390 + if(stringcomp((unsigned char *)"on",rcwd) == 0)
395 + rcwd = (unsigned char *)strtok(NULL,"\"");
396 + strcpy(filtnames[fn],rcwd);
398 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
399 + while(rcwd != NULL)
401 + strcpy(filtcodes[fn][ft],rcwd);
403 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
406 + filtcoden[fn] = ft;
407 + filtact[fn] = TRUE;