updated on Thu Jan 19 20:01:47 UTC 2012
[aur-mirror.git] / xjdic / xjdic24-xjdrc.patch
bloba3f01f4540a3f767491bdc9239b12c64c7af593f
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 @@
4 extern int KImode;
5 #endif
7 - strcpy(DicDir,ENVname); /* added by nakahara@debian.org */
8 - while(TRUE)
9 - {
10 - if (strlen(cl_rcfile) > 0)
11 - {
12 - fm = fopen(cl_rcfile,"r");
13 - if (fm != NULL) break;
14 + strcpy(DicDir,DEFAULT_DICDIR);
15 + while(TRUE) {
16 + if (strlen(cl_rcfile) > 0) {
17 + if((fm = fopen(cl_rcfile, "r")) != NULL)
18 + break;
19 else
20 - {
21 - printf("Control file: %s cannot be accessed!\n",cl_rcfile);
22 - }
23 + fprintf(stderr, "Control file %s cannot be accessed!\n", cl_rcfile);
25 - xjdicdir[0] = '\0';
26 - if (strlen(ENVname) > 2)
27 - {
28 - strcpy(xjdicdir,ENVname);
29 - strcat(xjdicdir,"/");
30 - }
31 - else
32 - {
33 - strcpy(xjdicdir,getenv("HOME"));
34 - strcat(xjdicdir,"/");
35 - }
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)
43 - {
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)
53 + break;
55 - printf("No control file detected!\n");
57 + strcpy(xjdicdir, ENVname);
58 + strcat(xjdicdir, "/xjdicrc");
59 + if((fm = fopen(xjdicdir, "r")) != NULL)
60 + break;
62 + fprintf(stderr, "No control file detected!\n");
63 return;
65 - if (fm != NULL)
66 + while(fgets(rcstr,79,fm) != NULL)
68 - while(fgets(rcstr,79,fm) != NULL)
69 - {
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)
74 - {
75 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
76 - strcpy(DicDir,rcwd);
77 - continue;
78 - }
79 + if( stringcomp((unsigned char *)"dicdir",rcwd) == 0)
80 + {
81 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
82 + strcpy(DicDir,rcwd);
83 + continue;
84 + }
85 #ifdef XJDCLSERV
86 - if( stringcomp((unsigned char *)"port",rcwd) == 0)
87 - {
88 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
89 - portno = atoi(rcwd);
90 - continue;
91 - }
92 - if( stringcomp((unsigned char *)"server",rcwd) == 0)
93 - {
94 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
95 - strcpy(host,rcwd);
96 - continue;
97 - }
98 + if( stringcomp((unsigned char *)"port",rcwd) == 0)
99 + {
100 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
101 + portno = atoi(rcwd);
102 + continue;
104 + if( stringcomp((unsigned char *)"server",rcwd) == 0)
106 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
107 + strcpy(host,rcwd);
108 + continue;
110 #endif
111 #ifdef XJDFRONTEND
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;
119 - continue;
121 - if( stringcomp((unsigned char *)"kanamode",rcwd) == 0)
123 - KImode = 0;
124 - continue;
126 - if( stringcomp((unsigned char *)"exactmatch",rcwd) == 0)
128 - EMtoggle ();
129 - continue;
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;
138 + continue;
140 + if( stringcomp((unsigned char *)"kanamode",rcwd) == 0)
142 + KImode = 0;
143 + continue;
145 + if( stringcomp((unsigned char *)"exactmatch",rcwd) == 0)
147 + EMtoggle ();
148 + continue;
150 #endif
151 #ifdef XJDDIC
152 - if( stringcomp((unsigned char *)"dicfile",rcwd) == 0)
153 + if( stringcomp((unsigned char *)"dicfile",rcwd) == 0)
155 + if (thisdic == 0)
157 - if (thisdic == 0)
159 - thisdic = 1;
161 - else
163 - thisdic++;
164 - NoDics++;
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");
170 - continue;
171 + thisdic = 1;
173 + else
175 + thisdic++;
176 + NoDics++;
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");
182 + continue;
184 #endif
185 #ifdef XJDFRONTEND
186 - if( stringcomp((unsigned char *)"gnufile",rcwd) == 0)
188 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
189 - strcpy(GPL_File,rcwd);
190 - continue;
192 + if( stringcomp((unsigned char *)"gnufile",rcwd) == 0)
194 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
195 + strcpy(GPL_File,rcwd);
196 + continue;
198 #endif
199 #ifdef XJDFRONTEND
200 - if( stringcomp((unsigned char *)"clipfile",rcwd) == 0)
202 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
203 - strcpy(Clip_File,rcwd);
204 - continue;
206 + if( stringcomp((unsigned char *)"clipfile",rcwd) == 0)
208 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
209 + strcpy(Clip_File,rcwd);
210 + continue;
212 #endif
213 #ifdef XJDFRONTEND
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");
220 - continue;
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");
228 + continue;
230 #endif
231 #ifdef XJDFRONTEND
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;
237 - continue;
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;
244 + continue;
246 #endif
247 #ifdef XJDFRONTEND
248 - if( stringcomp((unsigned char *)"kdnoshow",rcwd) == 0)
250 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
251 - strcpy(KDNSlist,rcwd);
252 - continue;
254 + if( stringcomp((unsigned char *)"kdnoshow",rcwd) == 0)
256 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
257 + strcpy(KDNSlist,rcwd);
258 + continue;
260 #endif
261 #ifdef XJDDIC
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");
268 - continue;
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");
276 + continue;
278 #endif
279 #ifdef XJDFRONTEND
280 - if( stringcomp((unsigned char *)"radkfile",rcwd) == 0)
282 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
283 - strcpy(RKname,rcwd);
284 - continue;
286 - if( stringcomp((unsigned char *)"radfile",rcwd) == 0)
288 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
289 - strcpy(Rname,rcwd);
290 - continue;
292 - if( stringcomp((unsigned char *)"verbfile",rcwd) == 0)
294 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
295 - strcpy(Vname,rcwd);
296 - continue;
298 - if( stringcomp((unsigned char *)"romfile",rcwd) == 0)
300 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
301 - strcpy(ROMname,rcwd);
302 - continue;
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;
309 - continue;
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;
319 - filttype[fn] = ft;
320 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
321 - filton[fn] = FALSE;
322 - if(stringcomp((unsigned char *)"on",rcwd) == 0)
324 - filton[fn] = TRUE;
325 - nofilts = TRUE;
327 - rcwd = (unsigned char *)strtok(NULL,"\"");
328 - strcpy(filtnames[fn],rcwd);
329 - ft=0;
330 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
331 - while(rcwd != NULL)
333 - strcpy(filtcodes[fn][ft],rcwd);
334 - ft++;
335 - rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
337 - if(ft==0)continue;
338 - filtcoden[fn] = ft;
339 - filtact[fn] = TRUE;
340 - continue;
342 -#endif
343 + if( stringcomp((unsigned char *)"radkfile",rcwd) == 0)
345 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
346 + strcpy(RKname,rcwd);
347 + continue;
350 - else
352 - printf("No .xjdicrc file detected\n");
353 - return;
354 + if( stringcomp((unsigned char *)"radfile",rcwd) == 0)
356 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
357 + strcpy(Rname,rcwd);
358 + continue;
360 + if( stringcomp((unsigned char *)"verbfile",rcwd) == 0)
362 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
363 + strcpy(Vname,rcwd);
364 + continue;
366 + if( stringcomp((unsigned char *)"romfile",rcwd) == 0)
368 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
369 + strcpy(ROMname,rcwd);
370 + continue;
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;
377 + continue;
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;
387 + filttype[fn] = ft;
388 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
389 + filton[fn] = FALSE;
390 + if(stringcomp((unsigned char *)"on",rcwd) == 0)
392 + filton[fn] = TRUE;
393 + nofilts = TRUE;
395 + rcwd = (unsigned char *)strtok(NULL,"\"");
396 + strcpy(filtnames[fn],rcwd);
397 + ft=0;
398 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
399 + while(rcwd != NULL)
401 + strcpy(filtcodes[fn][ft],rcwd);
402 + ft++;
403 + rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
405 + if(ft==0)continue;
406 + filtcoden[fn] = ft;
407 + filtact[fn] = TRUE;
408 + continue;
410 +#endif
412 fclose(fm);