Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /trunk/teraterm/ttpset/ttset.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9432 - (hide annotations) (download) (as text)
Sun Sep 19 15:14:27 2021 UTC (2 years, 6 months ago) by zmatsuo
File MIME type: text/x-csrc
File size: 139350 byte(s)
plugin AddValueToList() を利用しているところを Unicode化

- iniファイル内のリスト(キュー)に値を追加
- AddHostToList()
- teraterm/broadcast.cpp
1 doda 6806 /*
2     * Copyright (C) 1994-1998 T. Teranishi
3 nmaya 9048 * (C) 2004- TeraTerm Project
4 doda 6806 * All rights reserved.
5     *
6 doda 6841 * Redistribution and use in source and binary forms, with or without
7     * modification, are permitted provided that the following conditions
8     * are met:
9 doda 6806 *
10 doda 6841 * 1. Redistributions of source code must retain the above copyright
11     * notice, this list of conditions and the following disclaimer.
12     * 2. Redistributions in binary form must reproduce the above copyright
13     * notice, this list of conditions and the following disclaimer in the
14     * documentation and/or other materials provided with the distribution.
15     * 3. The name of the author may not be used to endorse or promote products
16     * derived from this software without specific prior written permission.
17 doda 6806 *
18 doda 6841 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
19     * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20     * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21     * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22     * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23     * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27     * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 doda 6806 */
29 maya 3227 /* IPv6 modification is Copyright(C) 2000 Jun-ya kato <kato@win6.jp> */
30    
31     /* TTSET.DLL, setup file routines*/
32     #include <winsock2.h>
33     #include <ws2tcpip.h>
34     #include "teraterm.h"
35     #include "tttypes.h"
36     #include <stdio.h>
37     #include <string.h>
38     #include <direct.h>
39 doda 4217 #include <ctype.h>
40 maya 6121 #include <errno.h>
41 zmatsuo 9301 #define _CRTDBG_MAP_ALLOC
42     #include <stdlib.h>
43     #include <crtdbg.h>
44    
45 maya 3227 #include "ttlib.h"
46     #include "tt_res.h"
47 doda 7091 #include "servicenames.h"
48 zmatsuo 9242 #include "codeconv.h"
49 zmatsuo 9306 #include "win32helper.h"
50 zmatsuo 9429 #include "inifile_com.h"
51 maya 3227
52 zmatsuo 8279 #define DllExport __declspec(dllexport)
53     #include "ttset.h"
54    
55 maya 4874 #ifndef CLEARTYPE_QUALITY
56     #define CLEARTYPE_QUALITY 5
57     #endif
58    
59 maya 3227 #define Section "Tera Term"
60 zmatsuo 9306 #define SectionW L"Tera Term"
61 maya 3227
62 atsue 5126 #define MaxStrLen (LONG)512
63    
64 maya 3227 static PCHAR far TermList[] =
65     { "VT100", "VT100J", "VT101", "VT102", "VT102J", "VT220J", "VT282",
66 doda 4084 "VT320", "VT382", "VT420", "VT520", "VT525", NULL };
67 maya 3227
68     static PCHAR far RussList[] =
69     { "Windows", "KOI8-R", "CP-866", "ISO-8859-5", NULL };
70     static PCHAR far RussList2[] = { "Windows", "KOI8-R", NULL };
71    
72 yutakapon 8205
73     /*
74     * �V���A���|�[�g���A���������`
75     */
76     #define IDENDMARK 0xFFFF
77    
78     typedef struct id_str_pair {
79     WORD id;
80     char *str;
81     } id_str_pair_t;
82    
83     static id_str_pair_t serial_conf_databit[] = {
84     {IdDataBit7, "7"},
85     {IdDataBit8, "8"},
86     {IDENDMARK, NULL},
87     };
88    
89     static id_str_pair_t serial_conf_parity[] = {
90     {IdParityNone, "none"},
91     {IdParityOdd, "odd"},
92     {IdParityEven, "even"},
93     {IdParityMark, "mark"},
94     {IdParitySpace, "space"},
95     {IDENDMARK, NULL},
96     };
97    
98     static id_str_pair_t serial_conf_stopbit[] = {
99     {IdStopBit1, "1"},
100     {IdStopBit2, "2"},
101     {IDENDMARK, NULL},
102     };
103    
104     static id_str_pair_t serial_conf_flowctrl[] = {
105     {IdFlowX, "x"},
106     {IdFlowHard, "hard"},
107     {IdFlowHard, "rtscts"},
108     {IdFlowNone, "none"},
109     {IdFlowHardDsrDtr, "dsrdtr"},
110     {IDENDMARK, NULL},
111     };
112    
113    
114     /*
115     * �V���A���|�[�g���A������
116     * Id���������������������B
117     *
118     * return
119     * TRUE: ��������
120     * FALSE: �������s
121     */
122 zmatsuo 8279 int WINAPI SerialPortConfconvertId2Str(enum serial_port_conf type, WORD id, PCHAR str, int strlen)
123 yutakapon 8205 {
124     id_str_pair_t *conf;
125     int ret = FALSE;
126     int i;
127    
128     switch (type) {
129     case COM_DATABIT:
130     conf = serial_conf_databit;
131     break;
132     case COM_PARITY:
133     conf = serial_conf_parity;
134     break;
135     case COM_STOPBIT:
136     conf = serial_conf_stopbit;
137     break;
138     case COM_FLOWCTRL:
139     conf = serial_conf_flowctrl;
140     break;
141     default:
142     conf = NULL;
143     break;
144     }
145     if (conf == NULL)
146     goto error;
147    
148     for (i = 0 ; ; i++) {
149     if (conf[i].id == IDENDMARK)
150     goto error;
151     if (conf[i].id == id) {
152     strncpy_s(str, strlen, conf[i].str, _TRUNCATE);
153     break;
154     }
155     }
156    
157     ret = TRUE;
158    
159     error:
160     return (ret);
161     }
162    
163 zmatsuo 9242 #undef GetPrivateProfileInt
164     #undef GetPrivateProfileString
165 zmatsuo 9429 #define GetPrivateProfileInt(p1, p2, p3, p4) GetPrivateProfileIntAFileW(p1, p2, p3, p4)
166 zmatsuo 9242 #define GetPrivateProfileString(p1, p2, p3, p4, p5, p6) GetPrivateProfileStringAFileW(p1, p2, p3, p4, p5, p6)
167     #define GetPrivateProfileStringA(p1, p2, p3, p4, p5, p6) GetPrivateProfileStringAFileW(p1, p2, p3, p4, p5, p6)
168     #define WritePrivateProfileStringA(p1, p2, p3, p4) WritePrivateProfileStringAFileW(p1, p2, p3, p4)
169    
170 yutakapon 8205 /*
171     * �V���A���|�[�g���A������
172     * ����������Id�����������B
173     *
174     * return
175     * TRUE: ��������
176     * FALSE: �������s
177     */
178     static int SerialPortConfconvertStr2Id(enum serial_port_conf type, PCHAR str, WORD *id)
179     {
180     id_str_pair_t *conf;
181     int ret = FALSE;
182     int i;
183    
184     switch (type) {
185     case COM_DATABIT:
186     conf = serial_conf_databit;
187     break;
188     case COM_PARITY:
189     conf = serial_conf_parity;
190     break;
191     case COM_STOPBIT:
192     conf = serial_conf_stopbit;
193     break;
194     case COM_FLOWCTRL:
195     conf = serial_conf_flowctrl;
196     break;
197     default:
198     conf = NULL;
199     break;
200     }
201     if (conf == NULL)
202     goto error;
203    
204     for (i = 0 ; ; i++) {
205     if (conf[i].id == IDENDMARK)
206     goto error;
207     if (_stricmp(conf[i].str, str) == 0) {
208     *id = conf[i].id;
209     break;
210     }
211     }
212    
213     ret = TRUE;
214    
215     error:
216     return (ret);
217     }
218    
219    
220 maya 3227 WORD str2id(PCHAR far * List, PCHAR str, WORD DefId)
221     {
222     WORD i;
223     i = 0;
224     while ((List[i] != NULL) && (_stricmp(List[i], str) != 0))
225     i++;
226     if (List[i] == NULL)
227     i = DefId;
228     else
229     i++;
230    
231     return i;
232     }
233    
234     void id2str(PCHAR far * List, WORD Id, WORD DefId, PCHAR str, int destlen)
235     {
236     int i;
237    
238     if (Id == 0)
239     i = DefId - 1;
240     else {
241     i = 0;
242     while ((List[i] != NULL) && (i < Id - 1))
243     i++;
244     if (List[i] == NULL)
245     i = DefId - 1;
246     }
247     strncpy_s(str, destlen, List[i], _TRUNCATE);
248     }
249    
250     int IconName2IconId(const char *name) {
251     int id;
252    
253     if (_stricmp(name, "tterm") == 0) {
254     id = IDI_TTERM;
255     }
256     else if (_stricmp(name, "vt") == 0) {
257     id = IDI_VT;
258     }
259     else if (_stricmp(name, "tek") == 0) {
260     id = IDI_TEK;
261     }
262     else if (_stricmp(name, "tterm_classic") == 0) {
263     id = IDI_TTERM_CLASSIC;
264     }
265     else if (_stricmp(name, "vt_classic") == 0) {
266     id = IDI_VT_CLASSIC;
267     }
268 maya 6386 else if (_stricmp(name, "tterm_3d") == 0) {
269     id = IDI_TTERM_3D;
270     }
271     else if (_stricmp(name, "vt_3d") == 0) {
272     id = IDI_VT_3D;
273     }
274 maya 3227 else if (_stricmp(name, "cygterm") == 0) {
275     id = IDI_CYGTERM;
276     }
277     else {
278     id = IdIconDefault;
279     }
280     return id;
281     }
282    
283     void IconId2IconName(char *name, int len, int id) {
284     char *icon;
285     switch (id) {
286     case IDI_TTERM:
287     icon = "tterm";
288     break;
289     case IDI_VT:
290     icon = "vt";
291     break;
292     case IDI_TEK:
293     icon = "tek";
294     break;
295     case IDI_TTERM_CLASSIC:
296     icon = "tterm_classic";
297     break;
298     case IDI_VT_CLASSIC:
299     icon = "vt_classic";
300     break;
301 maya 6386 case IDI_TTERM_3D:
302     icon = "tterm_3d";
303     break;
304     case IDI_VT_3D:
305     icon = "vt_3d";
306     break;
307 maya 3227 case IDI_CYGTERM:
308     icon = "cygterm";
309     break;
310     default:
311     icon = "Default";
312     }
313     strncpy_s(name, len, icon, _TRUNCATE);
314     }
315    
316 zmatsuo 9242 static WORD GetOnOff(PCHAR Sect, PCHAR Key, const wchar_t *FName, BOOL Default)
317 maya 3227 {
318     char Temp[4];
319     GetPrivateProfileString(Sect, Key, "", Temp, sizeof(Temp), FName);
320     if (Default) {
321     if (_stricmp(Temp, "off") == 0)
322     return 0;
323     else
324     return 1;
325     }
326     else {
327     if (_stricmp(Temp, "on") == 0)
328     return 1;
329     else
330     return 0;
331     }
332     }
333    
334 zmatsuo 9242 void WriteOnOff(PCHAR Sect, PCHAR Key, const wchar_t *FName, WORD Flag)
335 maya 3227 {
336 zmatsuo 9242 const char *on_off = (Flag != 0) ? "on" : "off";
337     WritePrivateProfileStringA(Sect, Key, on_off, FName);
338 maya 3227 }
339    
340 zmatsuo 9242 void WriteInt(PCHAR Sect, PCHAR Key, const wchar_t *FName, int i)
341 maya 3227 {
342     char Temp[15];
343     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", i);
344 zmatsuo 9242 WritePrivateProfileStringA(Sect, Key, Temp, FName);
345 maya 3227 }
346    
347 zmatsuo 9242 void WriteUint(PCHAR Sect, PCHAR Key, const wchar_t *FName, UINT i)
348 maya 3227 {
349     char Temp[15];
350     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%u", i);
351 zmatsuo 9242 WritePrivateProfileStringA(Sect, Key, Temp, FName);
352 maya 3227 }
353    
354 zmatsuo 9242 void WriteInt2(PCHAR Sect, PCHAR Key, const wchar_t *FName, int i1, int i2)
355 maya 3227 {
356     char Temp[32];
357     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d", i1, i2);
358 zmatsuo 9242 WritePrivateProfileStringA(Sect, Key, Temp, FName);
359 maya 3227 }
360    
361 zmatsuo 9242 void WriteInt4(PCHAR Sect, PCHAR Key, const wchar_t *FName,
362 maya 3227 int i1, int i2, int i3, int i4)
363     {
364     char Temp[64];
365     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d",
366     i1, i2, i3, i4);
367 zmatsuo 9242 WritePrivateProfileStringA(Sect, Key, Temp, FName);
368 maya 3227 }
369    
370 zmatsuo 9242 void WriteInt6(PCHAR Sect, PCHAR Key, const wchar_t *FName,
371 maya 3227 int i1, int i2, int i3, int i4, int i5, int i6)
372     {
373     char Temp[96];
374     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d,%d,%d",
375     i1, i2,i3, i4, i5, i6);
376 zmatsuo 9242 WritePrivateProfileStringA(Sect, Key, Temp, FName);
377 maya 3227 }
378    
379 zmatsuo 7705 // �t�H���g�������������A4�p�����[�^��
380 zmatsuo 9242 static void WriteFont(PCHAR Sect, PCHAR Key, const wchar_t *FName,
381 zmatsuo 7705 PCHAR Name, int x, int y, int charset)
382 maya 3227 {
383     char Temp[80];
384     if (Name[0] != 0)
385     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%s,%d,%d,%d",
386     Name, x, y, charset);
387     else
388     Temp[0] = 0;
389 zmatsuo 9242 WritePrivateProfileStringA(Sect, Key, Temp, FName);
390 maya 3227 }
391    
392 zmatsuo 7705 // �t�H���g�������������A4�p�����[�^��
393     static void ReadFont(
394 zmatsuo 9242 const char *Sect, const char *Key, const char *Default, const wchar_t *FName,
395     char *FontName, size_t FontNameLen, POINT *FontSize, int *FontCharSet)
396 zmatsuo 7705 {
397     char Temp[MAX_PATH];
398     GetPrivateProfileString(Sect, Key, Default,
399     Temp, _countof(Temp), FName);
400     if (Temp[0] == 0) {
401     // �f�t�H���g���Z�b�g������������ & ini���G���g���[����������
402     FontName[0] = 0;
403     FontSize->x = 0;
404     FontSize->y = 0;
405 zmatsuo 7706 *FontCharSet = 0;
406 zmatsuo 7705 } else {
407     GetNthString(Temp, 1, FontNameLen, FontName);
408     GetNthNum(Temp, 2, &(FontSize->x));
409     GetNthNum(Temp, 3, &(FontSize->y));
410     GetNthNum(Temp, 4, FontCharSet);
411 zmatsuo 7706 // TODO ���������p�[�X����
412 zmatsuo 7705 }
413     }
414 yutakapon 6119
415 zmatsuo 7706 // �t�H���g�������������A3�p�����[�^��
416     static void ReadFont3(
417 zmatsuo 9242 const char *Sect, const char *Key, const char *Default, const wchar_t *FName,
418     char *FontName, size_t FontNameLen, int *FontPoint, int *FontCharSet)
419 zmatsuo 7706 {
420     char Temp[MAX_PATH];
421     GetPrivateProfileString(Sect, Key, Default,
422     Temp, _countof(Temp), FName);
423     if (Temp[0] == 0) {
424     // �f�t�H���g���Z�b�g������������ & ini���G���g���[����������
425     FontName[0] = 0;
426     *FontPoint = 0;
427     *FontCharSet = 0;
428     } else {
429     GetNthString(Temp, 1, FontNameLen, FontName);
430     GetNthNum(Temp, 2, FontPoint);
431     GetNthNum(Temp, 3, FontCharSet);
432     // TODO ���������p�[�X����
433     }
434     }
435    
436 yutakapon 6119 #define CYGTERM_FILE "cygterm.cfg" // CygTerm configuration file
437 yutakapon 6126 #define CYGTERM_FILE_MAXLINE 100
438 yutakapon 6119
439     static void ReadCygtermConfFile(PTTSet ts)
440     {
441     char *cfgfile = CYGTERM_FILE; // CygTerm configuration file
442     char cfg[MAX_PATH];
443     FILE *fp;
444     char buf[256], *head, *body;
445     cygterm_t settings;
446    
447     // try to read CygTerm config file
448     memset(&settings, 0, sizeof(settings));
449     _snprintf_s(settings.term, sizeof(settings.term), _TRUNCATE, "ttermpro.exe %%s %%d /E /KR=SJIS /KT=SJIS /VTICON=CygTerm /nossh");
450     _snprintf_s(settings.term_type, sizeof(settings.term_type), _TRUNCATE, "vt100");
451     _snprintf_s(settings.port_start, sizeof(settings.port_start), _TRUNCATE, "20000");
452     _snprintf_s(settings.port_range, sizeof(settings.port_range), _TRUNCATE, "40");
453     _snprintf_s(settings.shell, sizeof(settings.shell), _TRUNCATE, "auto");
454     _snprintf_s(settings.env1, sizeof(settings.env1), _TRUNCATE, "MAKE_MODE=unix");
455     _snprintf_s(settings.env2, sizeof(settings.env2), _TRUNCATE, "");
456     settings.login_shell = FALSE;
457     settings.home_chdir = FALSE;
458     settings.agent_proxy = FALSE;
459    
460     strncpy_s(cfg, sizeof(cfg), ts->HomeDir, _TRUNCATE);
461     AppendSlash(cfg, sizeof(cfg));
462     strncat_s(cfg, sizeof(cfg), cfgfile, _TRUNCATE);
463    
464     fp = fopen(cfg, "r");
465     if (fp != NULL) {
466     while (fgets(buf, sizeof(buf), fp) != NULL) {
467 zmatsuo 9242 size_t len = strlen(buf);
468 yutakapon 6119
469     if (buf[len - 1] == '\n')
470     buf[len - 1] = '\0';
471    
472     split_buffer(buf, '=', &head, &body);
473     if (head == NULL || body == NULL)
474     continue;
475    
476     if (_stricmp(head, "TERM") == 0) {
477     _snprintf_s(settings.term, sizeof(settings.term), _TRUNCATE, "%s", body);
478    
479     }
480     else if (_stricmp(head, "TERM_TYPE") == 0) {
481     _snprintf_s(settings.term_type, sizeof(settings.term_type), _TRUNCATE, "%s", body);
482    
483     }
484     else if (_stricmp(head, "PORT_START") == 0) {
485     _snprintf_s(settings.port_start, sizeof(settings.port_start), _TRUNCATE, "%s", body);
486    
487     }
488     else if (_stricmp(head, "PORT_RANGE") == 0) {
489     _snprintf_s(settings.port_range, sizeof(settings.port_range), _TRUNCATE, "%s", body);
490    
491     }
492     else if (_stricmp(head, "SHELL") == 0) {
493     _snprintf_s(settings.shell, sizeof(settings.shell), _TRUNCATE, "%s", body);
494    
495     }
496     else if (_stricmp(head, "ENV_1") == 0) {
497     _snprintf_s(settings.env1, sizeof(settings.env1), _TRUNCATE, "%s", body);
498    
499     }
500     else if (_stricmp(head, "ENV_2") == 0) {
501     _snprintf_s(settings.env2, sizeof(settings.env2), _TRUNCATE, "%s", body);
502    
503     }
504     else if (_stricmp(head, "LOGIN_SHELL") == 0) {
505     if (strchr("YyTt", *body)) {
506     settings.login_shell = TRUE;
507     }
508    
509     }
510     else if (_stricmp(head, "HOME_CHDIR") == 0) {
511     if (strchr("YyTt", *body)) {
512     settings.home_chdir = TRUE;
513     }
514    
515     }
516     else if (_stricmp(head, "SSH_AGENT_PROXY") == 0) {
517     if (strchr("YyTt", *body)) {
518     settings.agent_proxy = TRUE;
519     }
520    
521     }
522     else {
523     // TODO: error check
524    
525     }
526     }
527     fclose(fp);
528     }
529    
530     memcpy(&ts->CygtermSettings, &settings, sizeof(cygterm_t));
531     }
532    
533     static void WriteCygtermConfFile(PTTSet ts)
534     {
535     char *cfgfile = CYGTERM_FILE; // CygTerm configuration file
536     char *tmpfile = "cygterm.tmp";
537     char cfg[MAX_PATH];
538     char tmp[MAX_PATH];
539     FILE *fp;
540     FILE *tmp_fp;
541     char buf[256], *head, *body;
542     char uimsg[MAX_UIMSG];
543     cygterm_t settings;
544 yutakapon 6126 char *line[CYGTERM_FILE_MAXLINE];
545 zmatsuo 9242 int i, linenum;
546 yutakapon 6119
547     // Cygwin���������X�������������������A�t�@�C�����������������B
548     if (ts->CygtermSettings.update_flag == FALSE)
549     return;
550     // �t���O���������ASave setup�����x�����x�������������������������B
551     ts->CygtermSettings.update_flag = FALSE;
552    
553     memcpy(&settings, &ts->CygtermSettings, sizeof(cygterm_t));
554    
555     strncpy_s(cfg, sizeof(cfg), ts->HomeDir, _TRUNCATE);
556     AppendSlash(cfg, sizeof(cfg));
557     strncat_s(cfg, sizeof(cfg), cfgfile, _TRUNCATE);
558    
559     strncpy_s(tmp, sizeof(tmp), ts->HomeDir, _TRUNCATE);
560     AppendSlash(tmp, sizeof(tmp));
561     strncat_s(tmp, sizeof(tmp), tmpfile, _TRUNCATE);
562    
563 yutakapon 6126 // cygterm.cfg �������������A�������������������������������B
564     memset(line, 0, sizeof(line));
565     linenum = 0;
566 yutakapon 6119 fp = fopen(cfg, "r");
567 yutakapon 6126 if (fp) {
568     i = 0;
569     while (fgets(buf, sizeof(buf), fp) != NULL) {
570 zmatsuo 9242 size_t len = strlen(buf);
571 yutakapon 6126 if (buf[len - 1] == '\n')
572     buf[len - 1] = '\0';
573     if (i < CYGTERM_FILE_MAXLINE)
574 yutakapon 6127 line[i++] = _strdup(buf);
575 yutakapon 6126 else
576     break;
577     }
578     linenum = i;
579     fclose(fp);
580     }
581    
582     tmp_fp = fopen(cfg, "w");
583 yutakapon 6119 if (tmp_fp == NULL) {
584     get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts->UILanguageFile);
585     get_lang_msg("MSG_CYGTERM_CONF_WRITEFILE_ERROR", ts->UIMsg, sizeof(ts->UIMsg),
586     "Can't write CygTerm configuration file (%d).", ts->UILanguageFile);
587     _snprintf_s(buf, sizeof(buf), _TRUNCATE, ts->UIMsg, GetLastError());
588     MessageBox(NULL, buf, uimsg, MB_ICONEXCLAMATION);
589     }
590     else {
591 yutakapon 6126 if (linenum > 0) {
592     for (i = 0; i < linenum; i++) {
593     split_buffer(line[i], '=', &head, &body);
594 yutakapon 6119 if (head == NULL || body == NULL) {
595 yutakapon 6126 fprintf(tmp_fp, "%s\n", line[i]);
596 yutakapon 6119 }
597     else if (_stricmp(head, "TERM") == 0) {
598     fprintf(tmp_fp, "TERM = %s\n", settings.term);
599     settings.term[0] = '\0';
600     }
601     else if (_stricmp(head, "TERM_TYPE") == 0) {
602     fprintf(tmp_fp, "TERM_TYPE = %s\n", settings.term_type);
603     settings.term_type[0] = '\0';
604     }
605     else if (_stricmp(head, "PORT_START") == 0) {
606     fprintf(tmp_fp, "PORT_START = %s\n", settings.port_start);
607     settings.port_start[0] = '\0';
608     }
609     else if (_stricmp(head, "PORT_RANGE") == 0) {
610     fprintf(tmp_fp, "PORT_RANGE = %s\n", settings.port_range);
611     settings.port_range[0] = '\0';
612     }
613     else if (_stricmp(head, "SHELL") == 0) {
614     fprintf(tmp_fp, "SHELL = %s\n", settings.shell);
615     settings.shell[0] = '\0';
616     }
617     else if (_stricmp(head, "ENV_1") == 0) {
618     fprintf(tmp_fp, "ENV_1 = %s\n", settings.env1);
619     settings.env1[0] = '\0';
620     }
621     else if (_stricmp(head, "ENV_2") == 0) {
622     fprintf(tmp_fp, "ENV_2 = %s\n", settings.env2);
623     settings.env2[0] = '\0';
624     }
625     else if (_stricmp(head, "LOGIN_SHELL") == 0) {
626     fprintf(tmp_fp, "LOGIN_SHELL = %s\n", (settings.login_shell == TRUE) ? "yes" : "no");
627     settings.login_shell = FALSE;
628     }
629     else if (_stricmp(head, "HOME_CHDIR") == 0) {
630     fprintf(tmp_fp, "HOME_CHDIR = %s\n", (settings.home_chdir == TRUE) ? "yes" : "no");
631     settings.home_chdir = FALSE;
632     }
633     else if (_stricmp(head, "SSH_AGENT_PROXY") == 0) {
634     fprintf(tmp_fp, "SSH_AGENT_PROXY = %s\n", (settings.agent_proxy == TRUE) ? "yes" : "no");
635     settings.agent_proxy = FALSE;
636     }
637     else {
638     fprintf(tmp_fp, "%s = %s\n", head, body);
639     }
640     }
641     }
642     else {
643     fputs("# CygTerm setting\n", tmp_fp);
644     fputs("\n", tmp_fp);
645     }
646     if (settings.term[0] != '\0') {
647     fprintf(tmp_fp, "TERM = %s\n", settings.term);
648     }
649     if (settings.term_type[0] != '\0') {
650     fprintf(tmp_fp, "TERM_TYPE = %s\n", settings.term_type);
651     }
652     if (settings.port_start[0] != '\0') {
653     fprintf(tmp_fp, "PORT_START = %s\n", settings.port_start);
654     }
655     if (settings.port_range[0] != '\0') {
656     fprintf(tmp_fp, "PORT_RANGE = %s\n", settings.port_range);
657     }
658     if (settings.shell[0] != '\0') {
659     fprintf(tmp_fp, "SHELL = %s\n", settings.shell);
660     }
661     if (settings.env1[0] != '\0') {
662     fprintf(tmp_fp, "ENV_1 = %s\n", settings.env1);
663     }
664     if (settings.env2[0] != '\0') {
665     fprintf(tmp_fp, "ENV_2 = %s\n", settings.env2);
666     }
667     if (settings.login_shell) {
668     fprintf(tmp_fp, "LOGIN_SHELL = yes\n");
669     }
670     if (settings.home_chdir) {
671     fprintf(tmp_fp, "HOME_CHDIR = yes\n");
672     }
673     if (settings.agent_proxy) {
674     fprintf(tmp_fp, "SSH_AGENT_PROXY = yes\n");
675     }
676     fclose(tmp_fp);
677    
678 yutakapon 6126 // �_�C���N�g���t�@�C���������������������������A���L�������s�v�B
679     #if 0
680 yutakapon 6119 if (remove(cfg) != 0 && errno != ENOENT) {
681     get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts->UILanguageFile);
682     get_lang_msg("MSG_CYGTERM_CONF_REMOVEFILE_ERROR", ts->UIMsg, sizeof(ts->UIMsg),
683     "Can't remove old CygTerm configuration file (%d).", ts->UILanguageFile);
684     _snprintf_s(buf, sizeof(buf), _TRUNCATE, ts->UIMsg, GetLastError());
685     MessageBox(NULL, buf, uimsg, MB_ICONEXCLAMATION);
686     }
687     else if (rename(tmp, cfg) != 0) {
688     get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts->UILanguageFile);
689     get_lang_msg("MSG_CYGTERM_CONF_RENAMEFILE_ERROR", ts->UIMsg, sizeof(ts->UIMsg),
690     "Can't rename CygTerm configuration file (%d).", ts->UILanguageFile);
691     _snprintf_s(buf, sizeof(buf), _TRUNCATE, ts->UIMsg, GetLastError());
692     MessageBox(NULL, buf, uimsg, MB_ICONEXCLAMATION);
693     }
694     else {
695     // cygterm.cfg �t�@�C�����������������������A���b�Z�[�W�_�C�A���O���\�������B
696     // �������ASave setup�����s�����K�v�������������������N�����B
697     // (2012.5.1 yutaka)
698     // Save setup ���s�����ACygTerm�������������������������������������A
699     // �_�C�A���O�\�����s�v�����������A���������B
700     // (2015.11.12 yutaka)
701     get_lang_msg("MSG_TT_NOTICE", uimsg, sizeof(uimsg), "MSG_TT_NOTICE", ts->UILanguageFile);
702     get_lang_msg("MSG_CYGTERM_CONF_SAVED_NOTICE", ts->UIMsg, sizeof(ts->UIMsg),
703     "%s has been saved. Do not do save setup.", ts->UILanguageFile);
704     _snprintf_s(buf, sizeof(buf), _TRUNCATE, ts->UIMsg, CYGTERM_FILE);
705     MessageBox(NULL, buf, uimsg, MB_OK | MB_ICONINFORMATION);
706 yutakapon 6126 }
707 yutakapon 6119 #endif
708     }
709 yutakapon 6126
710     // �Y�������������t���[���������B
711     for (i = 0; i < linenum; i++) {
712     free(line[i]);
713     }
714    
715 yutakapon 6119 }
716    
717 zmatsuo 9429 void PASCAL ReadIniFile(const wchar_t *FName, PTTSet ts)
718 maya 3227 {
719     int i;
720     HDC TmpDC;
721 doda 8386 char Temp[MAX_PATH], Temp2[MAX_PATH], *p;
722 maya 3227
723     ts->Minimize = 0;
724     ts->HideWindow = 0;
725     ts->LogFlag = 0; // Log flags
726     ts->FTFlag = 0; // File transfer flags
727     ts->MenuFlag = 0; // Menu flags
728     ts->TermFlag = 0; // Terminal flag
729     ts->ColorFlag = 0; // ANSI/Attribute color flags
730 doda 3666 ts->FontFlag = 0; // Font flag
731 maya 3227 ts->PortFlag = 0; // Port flags
732 doda 3485 ts->WindowFlag = 0; // Window flags
733 doda 4700 ts->CtrlFlag = 0; // Control sequence flags
734 doda 6594 ts->PasteFlag = 0; // Clipboard Paste flags
735 maya 3227 ts->TelPort = 23;
736    
737 doda 3388 ts->DisableTCPEchoCR = FALSE;
738    
739 doda 8386 /*
740     * Version number
741     * �����t�@�C���������o�[�W������ Tera Term �����������������\��
742     * �����t�@�C�����������������l���������A������ Tera Term ���o�[�W�������g������
743     */
744     GetPrivateProfileString(Section, "Version", TT_VERSION_STR("."), Temp, sizeof(Temp), FName);
745     p = strchr(Temp, '.');
746     if (p) {
747     *p++ = 0;
748     ts->ConfigVersion = atoi(Temp) * 10000 + atoi(p);
749     }
750     else {
751     ts->ConfigVersion = 0;
752     }
753 maya 3227
754 doda 8387 // TTX �� �m�F�����������ATera Term ���o�[�W�������i�[��������
755     ts->RunningVersion = TT_VERSION_MAJOR * 10000 + TT_VERSION_MINOR;
756    
757 maya 3227 /* Language */
758     GetPrivateProfileString(Section, "Language", "",
759     Temp, sizeof(Temp), FName);
760     if (_stricmp(Temp, "Japanese") == 0)
761     ts->Language = IdJapanese;
762     else if (_stricmp(Temp, "Russian") == 0)
763     ts->Language = IdRussian;
764     else if (_stricmp(Temp, "English") == 0)
765     ts->Language = IdEnglish;
766     else if (_stricmp(Temp,"Korean") == 0) // HKS
767     ts->Language = IdKorean;
768 maya 3401 else if (_stricmp(Temp,"UTF-8") == 0)
769     ts->Language = IdUtf8;
770 maya 3227 else {
771     switch (PRIMARYLANGID(GetSystemDefaultLangID())) {
772     case LANG_JAPANESE:
773     ts->Language = IdJapanese;
774     break;
775     case LANG_RUSSIAN:
776     ts->Language = IdRussian;
777     break;
778 doda 3354 case LANG_KOREAN: // HKS
779 doda 6435 ts->Language = IdKorean;
780     break;
781 maya 3227 default:
782     ts->Language = IdEnglish;
783     }
784     }
785    
786     /* Port type */
787     GetPrivateProfileString(Section, "Port", "",
788     Temp, sizeof(Temp), FName);
789 doda 6696 if (_stricmp(Temp, "serial") == 0)
790 maya 3227 ts->PortType = IdSerial;
791     else {
792     ts->PortType = IdTCPIP;
793     }
794    
795     /* VT win position */
796     GetPrivateProfileString(Section, "VTPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */
797     GetNthNum(Temp, 1, (int far *) (&ts->VTPos.x));
798     GetNthNum(Temp, 2, (int far *) (&ts->VTPos.y));
799    
800     /* TEK win position */
801     GetPrivateProfileString(Section, "TEKPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */
802     GetNthNum(Temp, 1, (int far *) &(ts->TEKPos.x));
803     GetNthNum(Temp, 2, (int far *) &(ts->TEKPos.y));
804    
805     /* Save VT Window position */
806     ts->SaveVTWinPos = GetOnOff(Section, "SaveVTWinPos", FName, FALSE);
807    
808     /* VT terminal size */
809     GetPrivateProfileString(Section, "TerminalSize", "80,24",
810     Temp, sizeof(Temp), FName);
811     GetNthNum(Temp, 1, &ts->TerminalWidth);
812     GetNthNum(Temp, 2, &ts->TerminalHeight);
813 doda 6784 if (ts->TerminalWidth <= 0)
814     ts->TerminalWidth = 80;
815     else if (ts->TerminalWidth > TermWidthMax)
816     ts->TerminalWidth = TermWidthMax;
817     if (ts->TerminalHeight <= 0)
818     ts->TerminalHeight = 24;
819     else if (ts->TerminalHeight > TermHeightMax)
820     ts->TerminalHeight = TermHeightMax;
821 maya 3227
822     /* Terminal size = Window size */
823     ts->TermIsWin = GetOnOff(Section, "TermIsWin", FName, FALSE);
824    
825     /* Auto window resize flag */
826     ts->AutoWinResize = GetOnOff(Section, "AutoWinResize", FName, FALSE);
827    
828     /* CR Receive */
829     GetPrivateProfileString(Section, "CRReceive", "",
830     Temp, sizeof(Temp), FName);
831     if (_stricmp(Temp, "CRLF") == 0) {
832     ts->CRReceive = IdCRLF;
833     }
834     else if (_stricmp(Temp, "LF") == 0) {
835     ts->CRReceive = IdLF;
836     }
837 maya 4893 else if (_stricmp(Temp, "AUTO") == 0) {
838     ts->CRReceive = IdAUTO;
839     }
840 maya 3227 else {
841     ts->CRReceive = IdCR;
842     }
843     /* CR Send */
844     GetPrivateProfileString(Section, "CRSend", "",
845     Temp, sizeof(Temp), FName);
846 maya 6369 if (_stricmp(Temp, "CRLF") == 0) {
847 maya 3227 ts->CRSend = IdCRLF;
848 maya 6369 }
849     else if (_stricmp(Temp, "LF") == 0) {
850     ts->CRSend = IdLF;
851     }
852     else {
853 maya 3227 ts->CRSend = IdCR;
854 maya 6369 }
855 maya 3227 ts->CRSend_ini = ts->CRSend;
856    
857     /* Local echo */
858     ts->LocalEcho = GetOnOff(Section, "LocalEcho", FName, FALSE);
859     ts->LocalEcho_ini = ts->LocalEcho;
860    
861     /* Answerback */
862     GetPrivateProfileString(Section, "Answerback", "", Temp,
863     sizeof(Temp), FName);
864     ts->AnswerbackLen =
865     Hex2Str(Temp, ts->Answerback, sizeof(ts->Answerback));
866    
867     /* Kanji Code (receive) */
868     GetPrivateProfileString(Section, "KanjiReceive", "",
869     Temp, sizeof(Temp), FName);
870     if (_stricmp(Temp, "EUC") == 0)
871     ts->KanjiCode = IdEUC;
872     else if (_stricmp(Temp, "JIS") == 0)
873     ts->KanjiCode = IdJIS;
874     else if (_stricmp(Temp, "UTF-8") == 0)
875     ts->KanjiCode = IdUTF8;
876     else if (_stricmp(Temp, "UTF-8m") == 0)
877     ts->KanjiCode = IdUTF8m;
878 doda 3420 else if (_stricmp(Temp, "KS5601") == 0)
879     ts->KanjiCode = IdSJIS;
880 maya 3227 else
881     ts->KanjiCode = IdSJIS;
882 maya 3401 // KanjiCode/KanjiCodeSend �������� Language �����������l���u��������
883     {
884     WORD KanjiCode = ts->KanjiCode;
885     ts->KanjiCode = KanjiCodeTranslate(ts->Language,KanjiCode);
886     }
887 maya 3227
888     /* Katakana (receive) */
889     GetPrivateProfileString(Section, "KatakanaReceive", "",
890     Temp, sizeof(Temp), FName);
891     if (_stricmp(Temp, "7") == 0)
892     ts->JIS7Katakana = 1;
893     else
894     ts->JIS7Katakana = 0;
895    
896     /* Kanji Code (transmit) */
897     GetPrivateProfileString(Section, "KanjiSend", "",
898     Temp, sizeof(Temp), FName);
899     if (_stricmp(Temp, "EUC") == 0)
900     ts->KanjiCodeSend = IdEUC;
901     else if (_stricmp(Temp, "JIS") == 0)
902     ts->KanjiCodeSend = IdJIS;
903     else if (_stricmp(Temp, "UTF-8") == 0)
904     ts->KanjiCodeSend = IdUTF8;
905 doda 3420 else if (_stricmp(Temp, "KS5601") == 0)
906     ts->KanjiCode = IdSJIS;
907 maya 3227 else
908     ts->KanjiCodeSend = IdSJIS;
909 maya 3401 // KanjiCode/KanjiCodeSend �������� Language �����������l���u��������
910     {
911     WORD KanjiCodeSend = ts->KanjiCodeSend;
912     ts->KanjiCodeSend = KanjiCodeTranslate(ts->Language,KanjiCodeSend);
913     }
914 maya 3227
915     /* Katakana (receive) */
916     GetPrivateProfileString(Section, "KatakanaSend", "",
917     Temp, sizeof(Temp), FName);
918     if (_stricmp(Temp, "7") == 0)
919     ts->JIS7KatakanaSend = 1;
920     else
921     ts->JIS7KatakanaSend = 0;
922    
923     /* KanjiIn */
924     GetPrivateProfileString(Section, "KanjiIn", "",
925     Temp, sizeof(Temp), FName);
926     if (_stricmp(Temp, "@") == 0)
927     ts->KanjiIn = IdKanjiInA;
928     else
929     ts->KanjiIn = IdKanjiInB;
930    
931     /* KanjiOut */
932     GetPrivateProfileString(Section, "KanjiOut", "",
933     Temp, sizeof(Temp), FName);
934     if (_stricmp(Temp, "B") == 0)
935     ts->KanjiOut = IdKanjiOutB;
936     else if (_stricmp(Temp, "H") == 0)
937     ts->KanjiOut = IdKanjiOutH;
938     else
939     ts->KanjiOut = IdKanjiOutJ;
940    
941     /* Auto Win Switch VT<->TEK */
942     ts->AutoWinSwitch = GetOnOff(Section, "AutoWinSwitch", FName, FALSE);
943    
944     /* Terminal ID */
945     GetPrivateProfileString(Section, "TerminalID", "",
946     Temp, sizeof(Temp), FName);
947     ts->TerminalID = str2id(TermList, Temp, IdVT100);
948    
949     /* Russian character set (host) */
950     GetPrivateProfileString(Section, "RussHost", "",
951     Temp, sizeof(Temp), FName);
952     ts->RussHost = str2id(RussList, Temp, IdKOI8);
953    
954     /* Russian character set (client) */
955     GetPrivateProfileString(Section, "RussClient", "",
956     Temp, sizeof(Temp), FName);
957     ts->RussClient = str2id(RussList, Temp, IdWindows);
958    
959     /* Title String */
960     GetPrivateProfileString(Section, "Title", "Tera Term",
961     ts->Title, sizeof(ts->Title), FName);
962    
963     /* Cursor shape */
964     GetPrivateProfileString(Section, "CursorShape", "",
965     Temp, sizeof(Temp), FName);
966     if (_stricmp(Temp, "vertical") == 0)
967     ts->CursorShape = IdVCur;
968     else if (_stricmp(Temp, "horizontal") == 0)
969     ts->CursorShape = IdHCur;
970     else
971     ts->CursorShape = IdBlkCur;
972    
973     /* Hide title */
974     ts->HideTitle = GetOnOff(Section, "HideTitle", FName, FALSE);
975    
976     /* Popup menu */
977     ts->PopupMenu = GetOnOff(Section, "PopupMenu", FName, FALSE);
978    
979     /* PC-Style bold color mapping */
980     if (GetOnOff(Section, "PcBoldColor", FName, FALSE))
981     ts->ColorFlag |= CF_PCBOLD16;
982    
983     /* aixterm style 16 colors mode */
984     if (GetOnOff(Section, "Aixterm16Color", FName, FALSE))
985     ts->ColorFlag |= CF_AIXTERM16;
986    
987     /* xterm style 256 colors mode */
988     if (GetOnOff(Section, "Xterm256Color", FName, TRUE))
989     ts->ColorFlag |= CF_XTERM256;
990    
991     /* Enable scroll buffer */
992     ts->EnableScrollBuff =
993     GetOnOff(Section, "EnableScrollBuff", FName, TRUE);
994    
995     /* Scroll buffer size */
996     ts->ScrollBuffSize =
997     GetPrivateProfileInt(Section, "ScrollBuffSize", 100, FName);
998    
999     /* VT Color */
1000     GetPrivateProfileString(Section, "VTColor", "0,0,0,255,255,255",
1001     Temp, sizeof(Temp), FName);
1002     for (i = 0; i <= 5; i++)
1003     GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
1004     for (i = 0; i <= 1; i++)
1005     ts->VTColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
1006     (BYTE) ts->TmpColor[0][i * 3 + 1],
1007     (BYTE) ts->TmpColor[0][i * 3 + 2]);
1008    
1009     /* VT Bold Color */
1010     GetPrivateProfileString(Section, "VTBoldColor", "0,0,255,255,255,255",
1011     Temp, sizeof(Temp), FName);
1012     for (i = 0; i <= 5; i++)
1013     GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
1014     for (i = 0; i <= 1; i++)
1015     ts->VTBoldColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
1016     (BYTE) ts->TmpColor[0][i * 3 + 1],
1017     (BYTE) ts->TmpColor[0][i * 3 + 2]);
1018     if (GetOnOff(Section, "EnableBoldAttrColor", FName, TRUE))
1019     ts->ColorFlag |= CF_BOLDCOLOR;
1020    
1021     /* VT Blink Color */
1022     GetPrivateProfileString(Section, "VTBlinkColor", "255,0,0,255,255,255",
1023     Temp, sizeof(Temp), FName);
1024     for (i = 0; i <= 5; i++)
1025     GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
1026     for (i = 0; i <= 1; i++)
1027     ts->VTBlinkColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
1028     (BYTE) ts->TmpColor[0][i * 3 + 1],
1029     (BYTE) ts->TmpColor[0][i * 3 + 2]);
1030     if (GetOnOff(Section, "EnableBlinkAttrColor", FName, TRUE))
1031     ts->ColorFlag |= CF_BLINKCOLOR;
1032    
1033     /* VT Reverse Color */
1034     GetPrivateProfileString(Section, "VTReverseColor", "255,255,255,0,0,0",
1035     Temp, sizeof(Temp), FName);
1036     for (i = 0; i <= 5; i++)
1037     GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
1038     for (i = 0; i <= 1; i++)
1039     ts->VTReverseColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
1040     (BYTE) ts->TmpColor[0][i * 3 + 1],
1041     (BYTE) ts->TmpColor[0][i * 3 + 2]);
1042     if (GetOnOff(Section, "EnableReverseAttrColor", FName, FALSE))
1043     ts->ColorFlag |= CF_REVERSECOLOR;
1044    
1045     ts->EnableClickableUrl =
1046     GetOnOff(Section, "EnableClickableUrl", FName, FALSE);
1047    
1048     /* URL Color */
1049     GetPrivateProfileString(Section, "URLColor", "0,255,0,255,255,255",
1050     Temp, sizeof(Temp), FName);
1051     for (i = 0; i <= 5; i++)
1052     GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
1053     for (i = 0; i <= 1; i++)
1054     ts->URLColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
1055     (BYTE) ts->TmpColor[0][i * 3 + 1],
1056     (BYTE) ts->TmpColor[0][i * 3 + 2]);
1057     if (GetOnOff(Section, "EnableURLColor", FName, TRUE))
1058     ts->ColorFlag |= CF_URLCOLOR;
1059    
1060 doda 3660 if (GetOnOff(Section, "URLUnderline", FName, TRUE))
1061 doda 3666 ts->FontFlag |= FF_URLUNDERLINE;
1062 doda 3660
1063 maya 3227 /* TEK Color */
1064     GetPrivateProfileString(Section, "TEKColor", "0,0,0,255,255,255",
1065     Temp, sizeof(Temp), FName);
1066     for (i = 0; i <= 5; i++)
1067     GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
1068     for (i = 0; i <= 1; i++)
1069     ts->TEKColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
1070     (BYTE) ts->TmpColor[0][i * 3 + 1],
1071     (BYTE) ts->TmpColor[0][i * 3 + 2]);
1072    
1073     /* ANSI color definition (in the case FullColor=on) -- special option
1074     o UseTextColor should be off, or the background and foreground color of
1075     VTColor are assigned to color-number 0 and 7 respectively, even if
1076     they are specified in ANSIColor.
1077     o ANSIColor is a set of 4 values that are color-number(0--15),
1078     red-value(0--255), green-value(0--255) and blue-value(0--255). */
1079     GetPrivateProfileString(Section, "ANSIColor",
1080     " 0, 0, 0, 0,"
1081     " 1,255, 0, 0,"
1082     " 2, 0,255, 0,"
1083     " 3,255,255, 0,"
1084     " 4, 0, 0,255,"
1085     " 5,255, 0,255,"
1086     " 6, 0,255,255,"
1087     " 7,255,255,255,"
1088     " 8,128,128,128,"
1089     " 9,128, 0, 0,"
1090     "10, 0,128, 0,"
1091     "11,128,128, 0,"
1092     "12, 0, 0,128,"
1093     "13,128, 0,128,"
1094     "14, 0,128,128,"
1095     "15,192,192,192", Temp, sizeof(Temp), FName);
1096     {
1097     char *t;
1098     int n = 1;
1099     for (t = Temp; *t; t++)
1100     if (*t == ',')
1101     n++;
1102     n /= 4;
1103 doda 4640 for (i = 0; i < n; i++) {
1104 maya 3227 int colorid, r, g, b;
1105     GetNthNum(Temp, i * 4 + 1, (int far *) &colorid);
1106     GetNthNum(Temp, i * 4 + 2, (int far *) &r);
1107     GetNthNum(Temp, i * 4 + 3, (int far *) &g);
1108     GetNthNum(Temp, i * 4 + 4, (int far *) &b);
1109     ts->ANSIColor[colorid & 15] =
1110     RGB((BYTE) r, (BYTE) g, (BYTE) b);
1111     }
1112     }
1113    
1114     TmpDC = GetDC(0); /* Get screen device context */
1115     for (i = 0; i <= 1; i++)
1116     ts->VTColor[i] = GetNearestColor(TmpDC, ts->VTColor[i]);
1117     for (i = 0; i <= 1; i++)
1118     ts->VTBoldColor[i] = GetNearestColor(TmpDC, ts->VTBoldColor[i]);
1119     for (i = 0; i <= 1; i++)
1120     ts->VTBlinkColor[i] = GetNearestColor(TmpDC, ts->VTBlinkColor[i]);
1121     for (i = 0; i <= 1; i++)
1122     ts->TEKColor[i] = GetNearestColor(TmpDC, ts->TEKColor[i]);
1123     /* begin - ishizaki */
1124     for (i = 0; i <= 1; i++)
1125     ts->URLColor[i] = GetNearestColor(TmpDC, ts->URLColor[i]);
1126     /* end - ishizaki */
1127     for (i = 0; i < 16; i++)
1128     ts->ANSIColor[i] = GetNearestColor(TmpDC, ts->ANSIColor[i]);
1129     ReleaseDC(0, TmpDC);
1130     if (GetOnOff(Section, "EnableANSIColor", FName, TRUE))
1131     ts->ColorFlag |= CF_ANSICOLOR;
1132    
1133     /* TEK color emulation */
1134     ts->TEKColorEmu = GetOnOff(Section, "TEKColorEmulation", FName, FALSE);
1135    
1136     /* VT Font */
1137 zmatsuo 7705 ReadFont(Section, "VTFont", "Terminal,0,-13,1", FName,
1138     ts->VTFont, _countof(ts->VTFont),
1139     &ts->VTFontSize, &(ts->VTFontCharSet));
1140 maya 3227
1141     /* Bold font flag */
1142 doda 3666 if (GetOnOff(Section, "EnableBold", FName, TRUE))
1143     ts->FontFlag |= FF_BOLD;
1144 maya 3227
1145     /* Russian character set (font) */
1146     GetPrivateProfileString(Section, "RussFont", "",
1147     Temp, sizeof(Temp), FName);
1148     ts->RussFont = str2id(RussList, Temp, IdWindows);
1149    
1150     /* TEK Font */
1151 zmatsuo 7705 ReadFont(Section, "TEKFont", "Courier,0,-13,0", FName,
1152     ts->TEKFont, _countof(ts->TEKFont),
1153     &ts->TEKFontSize, &(ts->TEKFontCharSet));
1154 maya 3227
1155     /* BS key */
1156     GetPrivateProfileString(Section, "BSKey", "",
1157     Temp, sizeof(Temp), FName);
1158     if (_stricmp(Temp, "DEL") == 0)
1159     ts->BSKey = IdDEL;
1160     else
1161     ts->BSKey = IdBS;
1162     /* Delete key */
1163     ts->DelKey = GetOnOff(Section, "DeleteKey", FName, FALSE);
1164    
1165     /* Meta Key */
1166 doda 4414 GetPrivateProfileString(Section, "MetaKey", "off", Temp, sizeof(Temp), FName);
1167     if (_stricmp(Temp, "on") == 0)
1168     ts->MetaKey = IdMetaOn;
1169     else if (_stricmp(Temp, "left") == 0)
1170     ts->MetaKey = IdMetaLeft;
1171     else if (_stricmp(Temp, "right") == 0)
1172     ts->MetaKey = IdMetaRight;
1173     else
1174     ts->MetaKey = IdMetaOff;
1175 maya 3227
1176 doda 4414 // Windows95 �n�����E�� Alt ��������������
1177 yutakapon 6286 if (!IsWindowsNTKernel() && ts->MetaKey != IdMetaOff) {
1178 doda 4414 ts->MetaKey = IdMetaOn;
1179     }
1180    
1181 maya 3227 /* Application Keypad */
1182     ts->DisableAppKeypad =
1183     GetOnOff(Section, "DisableAppKeypad", FName, FALSE);
1184    
1185     /* Application Cursor */
1186     ts->DisableAppCursor =
1187     GetOnOff(Section, "DisableAppCursor", FName, FALSE);
1188    
1189     /* Russian keyboard type */
1190     GetPrivateProfileString(Section, "RussKeyb", "",
1191     Temp, sizeof(Temp), FName);
1192     ts->RussKeyb = str2id(RussList2, Temp, IdWindows);
1193    
1194     /* Serial port ID */
1195     ts->ComPort = GetPrivateProfileInt(Section, "ComPort", 1, FName);
1196    
1197     /* Baud rate */
1198 maya 3874 ts->Baud = GetPrivateProfileInt(Section, "BaudRate", 9600, FName);
1199 maya 3227
1200     /* Parity */
1201     GetPrivateProfileString(Section, "Parity", "",
1202     Temp, sizeof(Temp), FName);
1203 yutakapon 8205 if (!SerialPortConfconvertStr2Id(COM_PARITY, Temp, &ts->Parity)) {
1204 maya 3227 ts->Parity = IdParityNone;
1205 yutakapon 8205 }
1206 maya 3227
1207     /* Data bit */
1208     GetPrivateProfileString(Section, "DataBit", "",
1209     Temp, sizeof(Temp), FName);
1210 yutakapon 8205 if (!SerialPortConfconvertStr2Id(COM_DATABIT, Temp, &ts->DataBit)) {
1211 maya 3227 ts->DataBit = IdDataBit8;
1212 yutakapon 8205 }
1213 maya 3227
1214     /* Stop bit */
1215     GetPrivateProfileString(Section, "StopBit", "",
1216     Temp, sizeof(Temp), FName);
1217 yutakapon 8205 if (!SerialPortConfconvertStr2Id(COM_STOPBIT, Temp, &ts->StopBit)) {
1218 maya 3227 ts->StopBit = IdStopBit1;
1219 yutakapon 8205 }
1220 maya 3227
1221     /* Flow control */
1222     GetPrivateProfileString(Section, "FlowCtrl", "",
1223     Temp, sizeof(Temp), FName);
1224 yutakapon 8205 if (!SerialPortConfconvertStr2Id(COM_FLOWCTRL, Temp, &ts->Flow)) {
1225 maya 3227 ts->Flow = IdFlowNone;
1226 yutakapon 8205 }
1227 maya 3227
1228     /* Delay per character */
1229     ts->DelayPerChar =
1230     GetPrivateProfileInt(Section, "DelayPerChar", 0, FName);
1231    
1232     /* Delay per line */
1233     ts->DelayPerLine =
1234     GetPrivateProfileInt(Section, "DelayPerLine", 0, FName);
1235    
1236     /* Telnet flag */
1237     ts->Telnet = GetOnOff(Section, "Telnet", FName, TRUE);
1238    
1239     /* Telnet terminal type */
1240     GetPrivateProfileString(Section, "TermType", "xterm", ts->TermType,
1241     sizeof(ts->TermType), FName);
1242    
1243     /* TCP port num */
1244     ts->TCPPort =
1245     GetPrivateProfileInt(Section, "TCPPort", ts->TelPort, FName);
1246    
1247     /* Auto window close flag */
1248     ts->AutoWinClose = GetOnOff(Section, "AutoWinClose", FName, TRUE);
1249    
1250     /* History list */
1251     ts->HistoryList = GetOnOff(Section, "HistoryList", FName, FALSE);
1252    
1253     /* File transfer binary flag */
1254     ts->TransBin = GetOnOff(Section, "TransBin", FName, FALSE);
1255    
1256 doda 3887 /* Log binary flag */
1257     ts->LogBinary = GetOnOff(Section, "LogBinary", FName, FALSE);
1258    
1259 maya 3227 /* Log append */
1260     ts->Append = GetOnOff(Section, "LogAppend", FName, FALSE);
1261    
1262     /* Log plain text (2005.5.7 yutaka) */
1263     ts->LogTypePlainText =
1264     GetOnOff(Section, "LogTypePlainText", FName, FALSE);
1265    
1266     /* Log with timestamp (2006.7.23 maya) */
1267     ts->LogTimestamp = GetOnOff(Section, "LogTimestamp", FName, FALSE);
1268    
1269     /* Log without transfer dialog */
1270     ts->LogHideDialog = GetOnOff(Section, "LogHideDialog", FName, FALSE);
1271    
1272 yutakapon 5444 ts->LogAllBuffIncludedInFirst = GetOnOff(Section, "LogIncludeScreenBuffer", FName, FALSE);
1273 yutakapon 5392
1274 maya 6767 /* Timestamp format of Log each line */
1275 maya 6795 GetPrivateProfileString(Section, "LogTimestampFormat", "%Y-%m-%d %H:%M:%S.%N",
1276 maya 6767 ts->LogTimestampFormat, sizeof(ts->LogTimestampFormat),
1277     FName);
1278    
1279 doda 6947 /* Timestamp type */
1280     GetPrivateProfileString(Section, "LogTimestampType", "", Temp, sizeof(Temp), FName);
1281     if (_stricmp(Temp, "UTC") == 0)
1282     ts->LogTimestampType = TIMESTAMP_UTC;
1283     else if (_stricmp(Temp, "LoggingElapsed") == 0)
1284     ts->LogTimestampType = TIMESTAMP_ELAPSED_LOGSTART;
1285     else if (_stricmp(Temp, "ConnectionElapsed") == 0)
1286     ts->LogTimestampType = TIMESTAMP_ELAPSED_CONNECTED;
1287     else if (_stricmp(Temp, "") == 0 && GetOnOff(Section, "LogTimestampUTC", FName, FALSE))
1288     // LogTimestampType ���������������� LogTimestampUTC ���l���Q������
1289     ts->LogTimestampType = TIMESTAMP_UTC;
1290     else
1291     ts->LogTimestampType = TIMESTAMP_LOCAL;
1292 maya 6768
1293 doda 5312 /* File Transfer dialog visibility */
1294     ts->FTHideDialog = GetOnOff(Section, "FTHideDialog", FName, FALSE);
1295    
1296 maya 3227 /* Default Log file name (2006.8.28 maya) */
1297     GetPrivateProfileString(Section, "LogDefaultName", "teraterm.log",
1298     ts->LogDefaultName, sizeof(ts->LogDefaultName),
1299     FName);
1300    
1301     /* Default Log file path (2007.5.30 maya) */
1302     GetPrivateProfileString(Section, "LogDefaultPath", "",
1303     ts->LogDefaultPath, sizeof(ts->LogDefaultPath),
1304     FName);
1305    
1306     /* Auto start logging (2007.5.31 maya) */
1307     ts->LogAutoStart = GetOnOff(Section, "LogAutoStart", FName, FALSE);
1308    
1309 yutakapon 5171 /* Log Rotate (2013.3.24 yutaka) */
1310     ts->LogRotate = GetPrivateProfileInt(Section, "LogRotate", 0, FName);
1311     ts->LogRotateSize = GetPrivateProfileInt(Section, "LogRotateSize", 0, FName);
1312     ts->LogRotateSizeType = GetPrivateProfileInt(Section, "LogRotateSizeType", 0, FName);
1313     ts->LogRotateStep = GetPrivateProfileInt(Section, "LogRotateStep", 0, FName);
1314    
1315 yutakapon 5206 /* Deferred Log Write Mode (2013.4.20 yutaka) */
1316     ts->DeferredLogWriteMode = GetOnOff(Section, "DeferredLogWriteMode", FName, TRUE);
1317 yutakapon 5171
1318 yutakapon 5206
1319 maya 3227 /* XMODEM option */
1320     GetPrivateProfileString(Section, "XmodemOpt", "",
1321     Temp, sizeof(Temp), FName);
1322     if (_stricmp(Temp, "crc") == 0)
1323     ts->XmodemOpt = XoptCRC;
1324     else if (_stricmp(Temp, "1k") == 0)
1325 doda 6219 ts->XmodemOpt = Xopt1kCRC;
1326 doda 6328 else if (_stricmp(Temp, "1ksum") == 0)
1327     ts->XmodemOpt = Xopt1kCksum;
1328 maya 3227 else
1329     ts->XmodemOpt = XoptCheck;
1330    
1331     /* XMODEM binary file */
1332     ts->XmodemBin = GetOnOff(Section, "XmodemBin", FName, TRUE);
1333    
1334     /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
1335     GetPrivateProfileString(Section, "XModemRcvCommand", "",
1336     ts->XModemRcvCommand,
1337     sizeof(ts->XModemRcvCommand), FName);
1338    
1339     /* Default directory for file transfer */
1340     GetPrivateProfileString(Section, "FileDir", "",
1341     ts->FileDir, sizeof(ts->FileDir), FName);
1342     if (strlen(ts->FileDir) == 0)
1343 maya 6749 GetDownloadFolder(ts->FileDir, sizeof(ts->FileDir));
1344 maya 3227 else {
1345 maya 7951 char FileDirExpanded[MAX_PATH];
1346     ExpandEnvironmentStrings(ts->FileDir, FileDirExpanded, sizeof(FileDirExpanded));
1347 maya 3227 _getcwd(Temp, sizeof(Temp));
1348 maya 7951 if (_chdir(FileDirExpanded) != 0)
1349 maya 6749 GetDownloadFolder(ts->FileDir, sizeof(ts->FileDir));
1350 maya 3227 _chdir(Temp);
1351     }
1352    
1353     /* filter on file send (2007.6.5 maya) */
1354     GetPrivateProfileString(Section, "FileSendFilter", "",
1355     ts->FileSendFilter, sizeof(ts->FileSendFilter),
1356     FName);
1357    
1358 yutakapon 4880 /* SCP���M���p�X (2012.4.6 yutaka) */
1359 doda 6457 GetPrivateProfileString(Section, "ScpSendDir", "",
1360 yutakapon 4880 ts->ScpSendDir, sizeof(ts->ScpSendDir), FName);
1361    
1362    
1363 maya 3227 /*--------------------------------------------------*/
1364     /* 8 bit control code flag -- special option */
1365     if (GetOnOff(Section, "Accept8BitCtrl", FName, TRUE))
1366     ts->TermFlag |= TF_ACCEPT8BITCTRL;
1367    
1368     /* Wrong sequence flag -- special option */
1369     if (GetOnOff(Section, "AllowWrongSequence", FName, FALSE))
1370     ts->TermFlag |= TF_ALLOWWRONGSEQUENCE;
1371    
1372     if (((ts->TermFlag & TF_ALLOWWRONGSEQUENCE) == 0) &&
1373     (ts->KanjiOut == IdKanjiOutH))
1374     ts->KanjiOut = IdKanjiOutJ;
1375    
1376 maya 6083 // Detect disconnect/reconnect of serial port --- special option
1377 maya 6115 ts->AutoComPortReconnect = GetOnOff(Section, "AutoComPortReconnect", FName, TRUE);
1378 maya 6083
1379 maya 3227 // Auto file renaming --- special option
1380     if (GetOnOff(Section, "AutoFileRename", FName, FALSE))
1381     ts->FTFlag |= FT_RENAME;
1382    
1383     // Auto invoking (character set->G0->GL) --- special option
1384     if (GetOnOff(Section, "AutoInvoke", FName, FALSE))
1385     ts->TermFlag |= TF_AUTOINVOKE;
1386    
1387     // Auto text copy --- special option
1388     ts->AutoTextCopy = GetOnOff(Section, "AutoTextCopy", FName, TRUE);
1389    
1390     /* Back wrap -- special option */
1391     if (GetOnOff(Section, "BackWrap", FName, FALSE))
1392     ts->TermFlag |= TF_BACKWRAP;
1393    
1394     /* Beep type -- special option */
1395 doda 4082 GetPrivateProfileString(Section, "Beep", "", Temp, sizeof(Temp), FName);
1396 maya 3227 if (_stricmp(Temp, "off") == 0)
1397     ts->Beep = IdBeepOff;
1398     else if (_stricmp(Temp, "visual") == 0)
1399     ts->Beep = IdBeepVisual;
1400     else
1401     ts->Beep = IdBeepOn;
1402    
1403     /* Beep on connection & disconnection -- special option */
1404     if (GetOnOff(Section, "BeepOnConnect", FName, FALSE))
1405     ts->PortFlag |= PF_BEEPONCONNECT;
1406    
1407     /* Auto B-Plus activation -- special option */
1408     if (GetOnOff(Section, "BPAuto", FName, FALSE))
1409     ts->FTFlag |= FT_BPAUTO;
1410     if ((ts->FTFlag & FT_BPAUTO) != 0) { /* Answerback */
1411     strncpy_s(ts->Answerback, sizeof(ts->Answerback), "\020++\0200",
1412     _TRUNCATE);
1413     ts->AnswerbackLen = 5;
1414     }
1415    
1416     /* B-Plus ESCCTL flag -- special option */
1417     if (GetOnOff(Section, "BPEscCtl", FName, FALSE))
1418     ts->FTFlag |= FT_BPESCCTL;
1419    
1420     /* B-Plus log -- special option */
1421     if (GetOnOff(Section, "BPLog", FName, FALSE))
1422     ts->LogFlag |= LOG_BP;
1423    
1424     /* Clear serial port buffer when port opening -- special option */
1425     ts->ClearComBuffOnOpen =
1426     GetOnOff(Section, "ClearComBuffOnOpen", FName, TRUE);
1427    
1428 salarm 6349 /* When serial port is specified with with /C= option and the port does not exist, Tera Term will wait for port connection. */
1429     ts->WaitCom = GetOnOff(Section, "WaitCom", FName, FALSE);
1430    
1431 maya 3227 /* Confirm disconnection -- special option */
1432     if (GetOnOff(Section, "ConfirmDisconnect", FName, TRUE))
1433     ts->PortFlag |= PF_CONFIRMDISCONN;
1434    
1435     /* Ctrl code in Kanji -- special option */
1436     if (GetOnOff(Section, "CtrlInKanji", FName, TRUE))
1437     ts->TermFlag |= TF_CTRLINKANJI;
1438    
1439     /* Debug flag -- special option */
1440     ts->Debug = GetOnOff(Section, "Debug", FName, FALSE);
1441    
1442     /* Delimiter list -- special option */
1443     GetPrivateProfileString(Section, "DelimList",
1444     "$20!\"#$24%&\'()*+,-./:;<=>?@[\\]^`{|}~",
1445     Temp, sizeof(Temp), FName);
1446     Hex2Str(Temp, ts->DelimList, sizeof(ts->DelimList));
1447    
1448     /* regard DBCS characters as delimiters -- special option */
1449     ts->DelimDBCS = GetOnOff(Section, "DelimDBCS", FName, TRUE);
1450    
1451     // Enable popup menu -- special option
1452     if (!GetOnOff(Section, "EnablePopupMenu", FName, TRUE))
1453     ts->MenuFlag |= MF_NOPOPUP;
1454    
1455     // Enable "Show menu" -- special option
1456     if (!GetOnOff(Section, "EnableShowMenu", FName, TRUE))
1457     ts->MenuFlag |= MF_NOSHOWMENU;
1458    
1459     // Enable the status line -- special option
1460     if (GetOnOff(Section, "EnableStatusLine", FName, TRUE))
1461     ts->TermFlag |= TF_ENABLESLINE;
1462    
1463 maya 6079 // Enable multiple bytes send -- special option
1464 maya 6115 ts->FileSendHighSpeedMode = GetOnOff(Section, "FileSendHighSpeedMode", FName, TRUE);
1465 maya 6079
1466 maya 3227 // fixed JIS --- special
1467     if (GetOnOff(Section, "FixedJIS", FName, FALSE))
1468     ts->TermFlag |= TF_FIXEDJIS;
1469    
1470     /* IME Flag -- special option */
1471     ts->UseIME = GetOnOff(Section, "IME", FName, TRUE);
1472    
1473     /* IME-inline Flag -- special option */
1474     ts->IMEInline = GetOnOff(Section, "IMEInline", FName, TRUE);
1475    
1476     /* Kermit log -- special option */
1477     if (GetOnOff(Section, "KmtLog", FName, FALSE))
1478     ts->LogFlag |= LOG_KMT;
1479 yutakapon 4810 if (GetOnOff(Section, "KmtLongPacket", FName, FALSE))
1480     ts->KermitOpt |= KmtOptLongPacket;
1481     if (GetOnOff(Section, "KmtFileAttr", FName, FALSE))
1482     ts->KermitOpt |= KmtOptFileAttr;
1483 maya 3227
1484     // Enable language selection -- special option
1485     if (!GetOnOff(Section, "LanguageSelection", FName, TRUE))
1486     ts->MenuFlag |= MF_NOLANGUAGE;
1487    
1488     /* Maximum scroll buffer size -- special option */
1489     ts->ScrollBuffMax =
1490     GetPrivateProfileInt(Section, "MaxBuffSize", 10000, FName);
1491     if (ts->ScrollBuffMax < 24)
1492     ts->ScrollBuffMax = 10000;
1493    
1494     /* Max com port number -- special option */
1495 doda 6467 ts->MaxComPort = GetPrivateProfileInt(Section, "MaxComPort", 256, FName);
1496 maya 3227 if (ts->MaxComPort < 4)
1497     ts->MaxComPort = 4;
1498     if (ts->MaxComPort > MAXCOMPORT)
1499     ts->MaxComPort = MAXCOMPORT;
1500     if ((ts->ComPort < 1) || (ts->ComPort > ts->MaxComPort))
1501     ts->ComPort = 1;
1502    
1503     /* Non-blinking cursor -- special option */
1504     ts->NonblinkingCursor =
1505     GetOnOff(Section, "NonblinkingCursor", FName, FALSE);
1506    
1507     // �t�H�[�J�X���������|���S���J�[�\�� (2008.1.24 yutaka)
1508     ts->KillFocusCursor =
1509     GetOnOff(Section, "KillFocusCursor", FName, TRUE);
1510    
1511     /* Delay for pass-thru printing activation */
1512     /* -- special option */
1513     ts->PassThruDelay =
1514     GetPrivateProfileInt(Section, "PassThruDelay", 3, FName);
1515    
1516     /* Printer port for pass-thru printing */
1517     /* -- special option */
1518     GetPrivateProfileString(Section, "PassThruPort", "",
1519     ts->PrnDev, sizeof(ts->PrnDev), FName);
1520    
1521 doda 4397 /* �v�����^�p�����R�[�h�������t������ */
1522     if (GetOnOff(Section, "PrinterCtrlSequence", FName, TRUE))
1523     ts->TermFlag |= TF_PRINTERCTRL;
1524 yutakapon 4393
1525 maya 3227 /* Printer Font --- special option */
1526 zmatsuo 7705 ReadFont(Section, "PrnFont", NULL, FName,
1527     ts->PrnFont, _countof(ts->PrnFont),
1528     &ts->PrnFontSize, &(ts->PrnFontCharSet));
1529 maya 3227
1530     // Page margins (left, right, top, bottom) for printing
1531     // -- special option
1532     GetPrivateProfileString(Section, "PrnMargin", "50,50,50,50",
1533     Temp, sizeof(Temp), FName);
1534     for (i = 0; i <= 3; i++)
1535     GetNthNum(Temp, 1 + i, &ts->PrnMargin[i]);
1536    
1537 maya 6921 /* Disable (convert to NL) Form Feed when printing */
1538     /* --- special option */
1539     ts->PrnConvFF =
1540     GetOnOff(Section, "PrnConvFF", FName, FALSE);
1541    
1542 maya 3227 /* Quick-VAN log -- special option */
1543     if (GetOnOff(Section, "QVLog", FName, FALSE))
1544     ts->LogFlag |= LOG_QV;
1545    
1546     /* Quick-VAN window size -- special */
1547     ts->QVWinSize = GetPrivateProfileInt(Section, "QVWinSize", 8, FName);
1548    
1549     /* Russian character set (print) -- special option */
1550     GetPrivateProfileString(Section, "RussPrint", "",
1551     Temp, sizeof(Temp), FName);
1552     ts->RussPrint = str2id(RussList, Temp, IdWindows);
1553    
1554     /* Scroll threshold -- special option */
1555     ts->ScrollThreshold =
1556     GetPrivateProfileInt(Section, "ScrollThreshold", 12, FName);
1557    
1558     ts->MouseWheelScrollLine =
1559     GetPrivateProfileInt(Section, "MouseWheelScrollLine", 3, FName);
1560    
1561     // Select on activate -- special option
1562     ts->SelOnActive = GetOnOff(Section, "SelectOnActivate", FName, TRUE);
1563    
1564     /* Send 8bit control sequence -- special option */
1565     ts->Send8BitCtrl = GetOnOff(Section, "Send8BitCtrl", FName, FALSE);
1566    
1567 maya 5694 /* SendBreak time (in msec) -- special option */
1568     ts->SendBreakTime =
1569     GetPrivateProfileInt(Section, "SendBreakTime", 1000, FName);
1570    
1571 maya 3227 /* Startup macro -- special option */
1572 zmatsuo 9306 hGetPrivateProfileStringW(SectionW, L"StartupMacro", L"", FName, &ts->MacroFNW);
1573     WideCharToACP_t(ts->MacroFNW, ts->MacroFN, sizeof(ts->MacroFN));
1574 maya 3227
1575     /* TEK GIN Mouse keycode -- special option */
1576     ts->GINMouseCode =
1577     GetPrivateProfileInt(Section, "TEKGINMouseCode", 32, FName);
1578    
1579     /* Telnet Auto Detect -- special option */
1580     ts->TelAutoDetect = GetOnOff(Section, "TelAutoDetect", FName, TRUE);
1581    
1582     /* Telnet binary flag -- special option */
1583     ts->TelBin = GetOnOff(Section, "TelBin", FName, FALSE);
1584    
1585     /* Telnet Echo flag -- special option */
1586     ts->TelEcho = GetOnOff(Section, "TelEcho", FName, FALSE);
1587    
1588     /* Telnet log -- special option */
1589     if (GetOnOff(Section, "TelLog", FName, FALSE))
1590     ts->LogFlag |= LOG_TEL;
1591    
1592     /* TCP port num for telnet -- special option */
1593     ts->TelPort = GetPrivateProfileInt(Section, "TelPort", 23, FName);
1594    
1595     /* Telnet keep-alive packet(NOP command) interval -- special option */
1596     ts->TelKeepAliveInterval =
1597     GetPrivateProfileInt(Section, "TelKeepAliveInterval", 300, FName);
1598    
1599     /* Max number of broadcast commad history */
1600     ts->MaxBroadcatHistory =
1601     GetPrivateProfileInt(Section, "MaxBroadcatHistory", 99, FName);
1602    
1603     /* Local echo for non-telnet */
1604     ts->TCPLocalEcho = GetOnOff(Section, "TCPLocalEcho", FName, FALSE);
1605    
1606     /* "new-line (transmit)" option for non-telnet -- special option */
1607     GetPrivateProfileString(Section, "TCPCRSend", "",
1608     Temp, sizeof(Temp), FName);
1609     if (_stricmp(Temp, "CR") == 0)
1610     ts->TCPCRSend = IdCR;
1611     else if (_stricmp(Temp, "CRLF") == 0)
1612     ts->TCPCRSend = IdCRLF;
1613     else
1614     ts->TCPCRSend = 0; // disabled
1615    
1616     /* Use text (background) color for "white (black)" --- special option */
1617     if (GetOnOff(Section, "UseTextColor", FName, FALSE))
1618     ts->ColorFlag |= CF_USETEXTCOLOR;
1619    
1620     /* Title format -- special option */
1621     ts->TitleFormat =
1622 maya 6170 GetPrivateProfileInt(Section, "TitleFormat", 13, FName);
1623 maya 3227
1624     /* VT Compatible Tab -- special option */
1625     ts->VTCompatTab = GetOnOff(Section, "VTCompatTab", FName, FALSE);
1626    
1627     /* VT Font space --- special option */
1628     GetPrivateProfileString(Section, "VTFontSpace", "0,0,0,0",
1629     Temp, sizeof(Temp), FName);
1630     GetNthNum(Temp, 1, &ts->FontDX);
1631     GetNthNum(Temp, 2, &ts->FontDW);
1632     GetNthNum(Temp, 3, &ts->FontDY);
1633     GetNthNum(Temp, 4, &ts->FontDH);
1634     if (ts->FontDX < 0)
1635     ts->FontDX = 0;
1636     if (ts->FontDW < 0)
1637     ts->FontDW = 0;
1638     ts->FontDW = ts->FontDW + ts->FontDX;
1639     if (ts->FontDY < 0)
1640     ts->FontDY = 0;
1641     if (ts->FontDH < 0)
1642     ts->FontDH = 0;
1643     ts->FontDH = ts->FontDH + ts->FontDY;
1644    
1645     // VT-print scaling factors (pixels per inch) --- special option
1646     GetPrivateProfileString(Section, "VTPPI", "0,0",
1647     Temp, sizeof(Temp), FName);
1648     GetNthNum(Temp, 1, (int far *) &ts->VTPPI.x);
1649     GetNthNum(Temp, 2, (int far *) &ts->VTPPI.y);
1650    
1651     // TEK-print scaling factors (pixels per inch) --- special option
1652     GetPrivateProfileString(Section, "TEKPPI", "0,0",
1653     Temp, sizeof(Temp), FName);
1654     GetNthNum(Temp, 1, (int far *) &ts->TEKPPI.x);
1655     GetNthNum(Temp, 2, (int far *) &ts->TEKPPI.y);
1656    
1657     // Show "Window" menu -- special option
1658     if (GetOnOff(Section, "WindowMenu", FName, TRUE))
1659     ts->MenuFlag |= MF_SHOWWINMENU;
1660    
1661     /* XMODEM log -- special option */
1662     if (GetOnOff(Section, "XmodemLog", FName, FALSE))
1663     ts->LogFlag |= LOG_X;
1664    
1665     /* YMODEM log -- special option */
1666     if (GetOnOff(Section, "YmodemLog", FName, FALSE))
1667     ts->LogFlag |= LOG_Y;
1668    
1669 yutakapon 3815 /* YMODEM ���M�R�}���h (2010.3.23 yutaka) */
1670     GetPrivateProfileString(Section, "YModemRcvCommand", "rb",
1671     ts->YModemRcvCommand, sizeof(ts->YModemRcvCommand), FName);
1672    
1673 maya 3227 /* Auto ZMODEM activation -- special option */
1674     if (GetOnOff(Section, "ZmodemAuto", FName, FALSE))
1675     ts->FTFlag |= FT_ZAUTO;
1676    
1677     /* ZMODEM data subpacket length for sending -- special */
1678     ts->ZmodemDataLen =
1679     GetPrivateProfileInt(Section, "ZmodemDataLen", 1024, FName);
1680     /* ZMODEM window size for sending -- special */
1681     ts->ZmodemWinSize =
1682     GetPrivateProfileInt(Section, "ZmodemWinSize", 32767, FName);
1683    
1684     /* ZMODEM ESCCTL flag -- special option */
1685     if (GetOnOff(Section, "ZmodemEscCtl", FName, FALSE))
1686     ts->FTFlag |= FT_ZESCCTL;
1687    
1688     /* ZMODEM log -- special option */
1689     if (GetOnOff(Section, "ZmodemLog", FName, FALSE))
1690     ts->LogFlag |= LOG_Z;
1691    
1692     /* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */
1693     GetPrivateProfileString(Section, "ZModemRcvCommand", "rz",
1694     ts->ZModemRcvCommand, sizeof(ts->ZModemRcvCommand), FName);
1695    
1696     /* Enable continued-line copy -- special option */
1697     ts->EnableContinuedLineCopy =
1698     GetOnOff(Section, "EnableContinuedLineCopy", FName, FALSE);
1699    
1700 doda 6594 if (GetOnOff(Section, "DisablePasteMouseRButton", FName, FALSE))
1701     ts->PasteFlag |= CPF_DISABLE_RBUTTON;
1702 maya 3227
1703 doda 6594 if (GetOnOff(Section, "DisablePasteMouseMButton", FName, TRUE))
1704     ts->PasteFlag |= CPF_DISABLE_MBUTTON;
1705 maya 3227
1706 doda 6594 if (GetOnOff(Section, "ConfirmPasteMouseRButton", FName, FALSE))
1707     ts->PasteFlag |= CPF_CONFIRM_RBUTTON;
1708 maya 3227
1709 doda 6594 if (GetOnOff(Section, "ConfirmChangePaste", FName, TRUE))
1710     ts->PasteFlag |= CPF_CONFIRM_CHANGEPASTE;
1711    
1712     if (GetOnOff(Section, "ConfirmChangePasteCR", FName, TRUE))
1713     ts->PasteFlag |= CPF_CONFIRM_CHANGEPASTE_CR;
1714    
1715 yutakapon 3535 GetPrivateProfileString(Section, "ConfirmChangePasteStringFile", "",
1716     Temp, sizeof(Temp), FName);
1717 doda 6594
1718 yutakapon 3535 strncpy_s(ts->ConfirmChangePasteStringFile, sizeof(ts->ConfirmChangePasteStringFile), Temp,
1719     _TRUNCATE);
1720 maya 3227
1721     // added ScrollWindowClearScreen (2008.5.3 yutaka)
1722     ts->ScrollWindowClearScreen =
1723     GetOnOff(Section, "ScrollWindowClearScreen", FName, TRUE);
1724    
1725     // added SelectOnlyByLButton (2007.11.20 maya)
1726     ts->SelectOnlyByLButton =
1727     GetOnOff(Section, "SelectOnlyByLButton", FName, TRUE);
1728    
1729     // added DisableAcceleratorSendBreak (2007.3.17 maya)
1730     ts->DisableAcceleratorSendBreak =
1731     GetOnOff(Section, "DisableAcceleratorSendBreak", FName, FALSE);
1732    
1733     // WinSock connecting timeout value (2007.1.11 yutaka)
1734     ts->ConnectingTimeout =
1735     GetPrivateProfileInt(Section, "ConnectingTimeout", 0, FName);
1736    
1737 doda 6435 // mouse cursor
1738 maya 3227 GetPrivateProfileString(Section, "MouseCursor", "IBEAM",
1739     Temp, sizeof(Temp), FName);
1740     strncpy_s(ts->MouseCursorName, sizeof(ts->MouseCursorName), Temp,
1741     _TRUNCATE);
1742    
1743     // Translucent window
1744 zmatsuo 7390 ts->AlphaBlendInactive =
1745     GetPrivateProfileInt(Section, "AlphaBlend", 255, FName);
1746     ts->AlphaBlendInactive = max(0, ts->AlphaBlendInactive);
1747     ts->AlphaBlendInactive = min(255, ts->AlphaBlendInactive);
1748     ts->AlphaBlendActive =
1749 doda 7447 GetPrivateProfileInt(Section, "AlphaBlendActive", ts->AlphaBlendInactive, FName);
1750 zmatsuo 7390 ts->AlphaBlendActive = max(0, ts->AlphaBlendActive);
1751     ts->AlphaBlendActive = min(255, ts->AlphaBlendActive);
1752 maya 3227
1753     // Cygwin install path
1754     GetPrivateProfileString(Section, "CygwinDirectory ", "c:\\cygwin",
1755     Temp, sizeof(Temp), FName);
1756     strncpy_s(ts->CygwinDirectory, sizeof(ts->CygwinDirectory), Temp,
1757     _TRUNCATE);
1758    
1759     // Viewlog Editor path
1760 doda 4198 if (GetWindowsDirectory(Temp, sizeof(Temp)) + 13 < sizeof(Temp)) { // "\\notepad.exe"(12) + NUL(1)
1761     strncat_s(Temp, sizeof(Temp), "\\notepad.exe", _TRUNCATE);
1762     }
1763     else {
1764     Temp[0] = '\0';
1765     }
1766     GetPrivateProfileString(Section, "ViewlogEditor ", Temp,
1767     ts->ViewlogEditor, sizeof(ts->ViewlogEditor), FName);
1768 maya 3227
1769 zmatsuo 7674 // UI language message file (�����p�X)
1770 zmatsuo 9306 hGetPrivateProfileStringW(SectionW, L"UILanguageFile", NULL, FName, &ts->UILanguageFileW_ini);
1771 zmatsuo 9381 if (ts->UILanguageFileW_ini[0] == 0) {
1772     free(ts->UILanguageFileW_ini);
1773 zmatsuo 9318 ts->UILanguageFileW_ini = _wcsdup(L"lang\\Default.lng");
1774 zmatsuo 9306 }
1775     WideCharToACP_t(ts->UILanguageFileW_ini, ts->UILanguageFile_ini, sizeof(ts->UILanguageFile_ini));
1776 maya 3227
1777 zmatsuo 7674 // UI language message file (full path)
1778 zmatsuo 9306 ts->UILanguageFileW = GetUILanguageFileFullW(ts->HomeDirW, ts->UILanguageFileW_ini);
1779     WideCharToACP_t(ts->UILanguageFileW, ts->UILanguageFile, sizeof(ts->UILanguageFile));
1780 maya 3227
1781 zmatsuo 9306
1782 maya 3227 // Broadcast Command History (2007.3.3 maya)
1783     ts->BroadcastCommandHistory =
1784     GetOnOff(Section, "BroadcastCommandHistory", FName, FALSE);
1785    
1786     // 337: 2007/03/20 Accept Broadcast
1787     ts->AcceptBroadcast =
1788     GetOnOff(Section, "AcceptBroadcast", FName, TRUE);
1789    
1790     // Confirm send a file when drag and drop (2007.12.28 maya)
1791     ts->ConfirmFileDragAndDrop =
1792     GetOnOff(Section, "ConfirmFileDragAndDrop", FName, TRUE);
1793    
1794     // Translate mouse wheel to cursor key when application cursor mode
1795     ts->TranslateWheelToCursor =
1796     GetOnOff(Section, "TranslateWheelToCursor", FName, TRUE);
1797    
1798     // Display "New Connection" dialog on startup (2008.1.18 maya)
1799     ts->HostDialogOnStartup =
1800     GetOnOff(Section, "HostDialogOnStartup", FName, TRUE);
1801    
1802     // Mouse event tracking
1803     ts->MouseEventTracking =
1804     GetOnOff(Section, "MouseEventTracking", FName, TRUE);
1805    
1806     // Maximized bug tweak
1807 doda 6730 GetPrivateProfileString(Section, "MaximizedBugTweak", "2", Temp,
1808 doda 6671 sizeof(Temp), FName);
1809     if (_stricmp(Temp, "on") == 0) {
1810 doda 6730 ts->MaximizedBugTweak = 2;
1811 doda 6671 }
1812     else {
1813     ts->MaximizedBugTweak = atoi(Temp);
1814     }
1815 maya 3227
1816     // Convert Unicode symbol characters to DEC Special characters
1817     ts->UnicodeDecSpMapping =
1818     GetPrivateProfileInt(Section, "UnicodeToDecSpMapping", 3, FName);
1819    
1820     // VT Window Icon
1821     GetPrivateProfileString(Section, "VTIcon", "Default",
1822     Temp, sizeof(Temp), FName);
1823     ts->VTIcon = IconName2IconId(Temp);
1824    
1825     // Tek Window Icon
1826     GetPrivateProfileString(Section, "TEKIcon", "Default",
1827     Temp, sizeof(Temp), FName);
1828     ts->TEKIcon = IconName2IconId(Temp);
1829    
1830     // Unknown Unicode Character
1831     ts->UnknownUnicodeCharaAsWide =
1832     GetOnOff(Section, "UnknownUnicodeCharacterAsWide", FName, FALSE);
1833    
1834     #ifdef USE_NORMAL_BGCOLOR
1835     // UseNormalBGColor
1836     ts->UseNormalBGColor =
1837     GetOnOff(Section, "UseNormalBGColor", FName, FALSE);
1838     // 2006/03/11 by 337
1839     if (ts->UseNormalBGColor) {
1840     ts->VTBoldColor[1] =
1841     ts->VTBlinkColor[1] = ts->URLColor[1] = ts->VTColor[1];
1842     }
1843     #endif
1844    
1845     // AutoScrollOnlyInBottomLine
1846     ts->AutoScrollOnlyInBottomLine =
1847     GetOnOff(Section, "AutoScrollOnlyInBottomLine", FName, FALSE);
1848    
1849     // Accept remote-controlled window title changing
1850     GetPrivateProfileString(Section, "AcceptTitleChangeRequest", "overwrite",
1851     Temp, sizeof(Temp), FName);
1852     if (_stricmp(Temp, "overwrite") == 0 || _stricmp(Temp, "on") == 0)
1853     ts->AcceptTitleChangeRequest = IdTitleChangeRequestOverwrite;
1854     else if (_stricmp(Temp, "ahead") == 0)
1855     ts->AcceptTitleChangeRequest = IdTitleChangeRequestAhead;
1856     else if (_stricmp(Temp, "last") == 0)
1857     ts->AcceptTitleChangeRequest = IdTitleChangeRequestLast;
1858     else
1859     ts->AcceptTitleChangeRequest = IdTitleChangeRequestOff;
1860    
1861     // Size of paste confirm dialog
1862     GetPrivateProfileString(Section, "PasteDialogSize", "330,220",
1863     Temp, sizeof(Temp), FName);
1864     GetNthNum(Temp, 1, &ts->PasteDialogSize.cx);
1865     GetNthNum(Temp, 2, &ts->PasteDialogSize.cy);
1866     if (ts->PasteDialogSize.cx < 0)
1867     ts->PasteDialogSize.cx = 330;
1868     if (ts->PasteDialogSize.cy < 0)
1869     ts->PasteDialogSize.cy = 220;
1870    
1871     // Disable mouse event tracking when Control-Key is pressed.
1872     ts->DisableMouseTrackingByCtrl =
1873     GetOnOff(Section, "DisableMouseTrackingByCtrl", FName, TRUE);
1874    
1875     // Disable TranslateWheelToCursor setting when Control-Key is pressed.
1876     ts->DisableWheelToCursorByCtrl =
1877     GetOnOff(Section, "DisableWheelToCursorByCtrl", FName, TRUE);
1878    
1879     // Strict Key Mapping.
1880     ts->StrictKeyMapping =
1881     GetOnOff(Section, "StrictKeyMapping", FName, FALSE);
1882    
1883     // added Wait4allMacroCommand (2009.3.23 yutaka)
1884     ts->Wait4allMacroCommand =
1885     GetOnOff(Section, "Wait4allMacroCommand", FName, FALSE);
1886 maya 3279
1887 maya 3283 // added DisableMenuSendBreak (2009.4.6 maya)
1888     ts->DisableMenuSendBreak =
1889     GetOnOff(Section, "DisableMenuSendBreak", FName, FALSE);
1890 maya 3282
1891 maya 3283 // added ClearScreenOnCloseConnection (2009.4.6 maya)
1892     ts->ClearScreenOnCloseConnection =
1893     GetOnOff(Section, "ClearScreenOnCloseConnection", FName, FALSE);
1894    
1895     // added DisableAcceleratorDuplicateSession (2009.4.6 maya)
1896 maya 3282 ts->DisableAcceleratorDuplicateSession =
1897     GetOnOff(Section, "DisableAcceleratorDuplicateSession", FName, FALSE);
1898 maya 3306
1899 maya 5684 ts->AcceleratorNewConnection =
1900     GetOnOff(Section, "AcceleratorNewConnection", FName, TRUE);
1901    
1902     ts->AcceleratorCygwinConnection =
1903     GetOnOff(Section, "AcceleratorCygwinConnection", FName, TRUE);
1904    
1905 maya 3964 // added DisableMenuDuplicateSession (2010.8.3 maya)
1906     ts->DisableMenuDuplicateSession =
1907     GetOnOff(Section, "DisableMenuDuplicateSession", FName, FALSE);
1908    
1909 maya 3965 // added DisableMenuNewConnection (2010.8.4 maya)
1910     ts->DisableMenuNewConnection =
1911     GetOnOff(Section, "DisableMenuNewConnection", FName, FALSE);
1912    
1913 maya 3306 // added PasteDelayPerLine (2009.4.12 maya)
1914     ts->PasteDelayPerLine =
1915     GetPrivateProfileInt(Section, "PasteDelayPerLine", 10, FName);
1916 maya 3315 {
1917     int tmp = min(max(0, ts->PasteDelayPerLine), 5000);
1918     ts->PasteDelayPerLine = tmp;
1919     }
1920 doda 3395
1921     // Font scaling -- test
1922     ts->FontScaling = GetOnOff(Section, "FontScaling", FName, FALSE);
1923 doda 3441
1924     // Meta sets MSB
1925 doda 3507 GetPrivateProfileString(Section, "Meta8Bit", "off", Temp, sizeof(Temp), FName);
1926     if (_stricmp(Temp, "raw") == 0 || _stricmp(Temp, "on") == 0)
1927     ts->Meta8Bit = IdMeta8BitRaw;
1928     else if (_stricmp(Temp, "text") == 0)
1929     ts->Meta8Bit = IdMeta8BitText;
1930     else
1931     ts->Meta8Bit = IdMeta8BitOff;
1932    
1933 maya 3479 // Window control sequence
1934 doda 3485 if (GetOnOff(Section, "WindowCtrlSequence", FName, TRUE))
1935     ts->WindowFlag |= WF_WINDOWCHANGE;
1936 maya 3479
1937     // Cursor control sequence
1938 doda 3485 if (GetOnOff(Section, "CursorCtrlSequence", FName, FALSE))
1939     ts->WindowFlag |= WF_CURSORCHANGE;
1940    
1941     // Window report sequence
1942     if (GetOnOff(Section, "WindowReportSequence", FName, TRUE))
1943     ts->WindowFlag |= WF_WINDOWREPORT;
1944    
1945 doda 3749 // Title report sequence
1946 doda 3747 GetPrivateProfileString(Section, "TitleReportSequence", "Empty", Temp, sizeof(Temp), FName);
1947 doda 3774 if (_stricmp(Temp, "accept") == 0)
1948     ts->WindowFlag |= IdTitleReportAccept;
1949     else if (_stricmp(Temp, "ignore") == 0 || _stricmp(Temp, "off") == 0)
1950 doda 3747 ts->WindowFlag &= ~WF_TITLEREPORT;
1951     else // empty
1952     ts->WindowFlag |= IdTitleReportEmpty;
1953 doda 3501
1954     // Line at a time mode
1955     ts->EnableLineMode = GetOnOff(Section, "EnableLineMode", FName, TRUE);
1956 doda 3721
1957     // Clear window on resize
1958     if (GetOnOff(Section, "ClearOnResize", FName, TRUE))
1959     ts->TermFlag |= TF_CLEARONRESIZE;
1960 doda 3743
1961     // Alternate Screen Buffer
1962     if (GetOnOff(Section, "AlternateScreenBuffer", FName, TRUE))
1963     ts->TermFlag |= TF_ALTSCR;
1964 doda 3969
1965     // IME status related cursor style
1966     if (GetOnOff(Section, "IMERelatedCursor", FName, FALSE))
1967     ts->WindowFlag |= WF_IMECURSORCHANGE;
1968 doda 4217
1969     // Terminal Unique ID
1970     GetPrivateProfileString(Section, "TerminalUID", "FFFFFFFF", Temp, sizeof(Temp), FName);
1971     if (strlen(Temp) == 8) {
1972 doda 4228 for (i=0; i<8 && isxdigit((unsigned char)Temp[i]); i++) {
1973 doda 4217 if (islower(Temp[i])) {
1974     ts->TerminalUID[i] = toupper(Temp[i]);
1975     }
1976     else {
1977     ts->TerminalUID[i] = Temp[i];
1978     }
1979     }
1980     if (i == 8) {
1981     ts->TerminalUID[i] = 0;
1982     }
1983     else {
1984     strncpy_s(ts->TerminalUID, sizeof(ts->TerminalUID), "FFFFFFFF", _TRUNCATE);
1985     }
1986     }
1987     else {
1988     strncpy_s(ts->TerminalUID, sizeof(ts->TerminalUID), "FFFFFFFF", _TRUNCATE);
1989     }
1990 doda 4225
1991     // Lock Terminal UID
1992     if (GetOnOff(Section, "LockTUID", FName, TRUE))
1993     ts->TermFlag |= TF_LOCKTUID;
1994 doda 6435
1995 doda 4480 // Jump List
1996     ts->JumpList = GetOnOff(Section, "JumpList", FName, TRUE);
1997    
1998 doda 4699 // TabStopModifySequence
1999 doda 4687 GetPrivateProfileString(Section, "TabStopModifySequence", "on", Temp, sizeof(Temp), FName);
2000     if (_stricmp(Temp, "on") == 0 || _stricmp(Temp, "all") == 0)
2001     ts->TabStopFlag = TABF_ALL;
2002     else if (_stricmp(Temp, "off") == 0 || _stricmp(Temp, "none") == 0)
2003     ts->TabStopFlag = TABF_NONE;
2004     else {
2005     ts->TabStopFlag = TABF_NONE;
2006     for (i=1; GetNthString(Temp, i, sizeof(Temp2), Temp2); i++) {
2007     if (_stricmp(Temp2, "HTS") == 0)
2008     ts->TabStopFlag |= TABF_HTS;
2009     else if (_stricmp(Temp2, "HTS7") == 0)
2010     ts->TabStopFlag |= TABF_HTS7;
2011     else if (_stricmp(Temp2, "HTS8") == 0)
2012     ts->TabStopFlag |= TABF_HTS8;
2013     else if (_stricmp(Temp2, "TBC") == 0)
2014     ts->TabStopFlag |= TABF_TBC;
2015     else if (_stricmp(Temp2, "TBC0") == 0)
2016     ts->TabStopFlag |= TABF_TBC0;
2017     else if (_stricmp(Temp2, "TBC3") == 0)
2018     ts->TabStopFlag |= TABF_TBC3;
2019     }
2020     }
2021    
2022 doda 4700 // Clipboard Access from Remote
2023 doda 8384 ts->CtrlFlag &= ~CSF_CBMASK;
2024 doda 4700 GetPrivateProfileString(Section, "ClipboardAccessFromRemote", "off", Temp, sizeof(Temp), FName);
2025     if (_stricmp(Temp, "on") == 0 || _stricmp(Temp, "readwrite") == 0)
2026     ts->CtrlFlag |= CSF_CBRW;
2027     else if (_stricmp(Temp, "read") == 0)
2028     ts->CtrlFlag |= CSF_CBREAD;
2029     else if (_stricmp(Temp, "write") == 0)
2030     ts->CtrlFlag |= CSF_CBWRITE;
2031 doda 8384 else
2032     ts->CtrlFlag |= CSF_CBNONE; // ��������������
2033 doda 4700
2034 doda 6666 // Notify Clipboard Access from Remote
2035     ts->NotifyClipboardAccess = GetOnOff(Section, "NotifyClipboardAccess", FName, TRUE);
2036    
2037 doda 4281 // Use invalid DECRPSS (for testing)
2038     if (GetOnOff(Section, "UseInvalidDECRQSSResponse", FName, FALSE))
2039     ts->TermFlag |= TF_INVALIDDECRPSS;
2040 maya 4704
2041     // ClickableUrlBrowser
2042     GetPrivateProfileString(Section, "ClickableUrlBrowser", "",
2043     ts->ClickableUrlBrowser, sizeof(ts->ClickableUrlBrowser), FName);
2044     GetPrivateProfileString(Section, "ClickableUrlBrowserArg", "",
2045     ts->ClickableUrlBrowserArg, sizeof(ts->ClickableUrlBrowserArg), FName);
2046 maya 4786
2047     // Exclusive Lock when open the log file
2048     ts->LogLockExclusive = GetOnOff(Section, "LogLockExclusive", FName, TRUE);
2049 maya 4874
2050     // Font quality
2051     GetPrivateProfileString(Section, "FontQuality", "default",
2052     Temp, sizeof(Temp), FName);
2053     if (_stricmp(Temp, "nonantialiased") == 0)
2054     ts->FontQuality = NONANTIALIASED_QUALITY;
2055     else if (_stricmp(Temp, "antialiased") == 0)
2056     ts->FontQuality = ANTIALIASED_QUALITY;
2057     else if (_stricmp(Temp, "cleartype") == 0)
2058     ts->FontQuality = CLEARTYPE_QUALITY;
2059     else
2060     ts->FontQuality = DEFAULT_QUALITY;
2061 doda 5316
2062     // Beep Over Used
2063     ts->BeepOverUsedCount =
2064     GetPrivateProfileInt(Section, "BeepOverUsedCount", 5, FName);
2065     ts->BeepOverUsedTime =
2066     GetPrivateProfileInt(Section, "BeepOverUsedTime", 2, FName);
2067     ts->BeepSuppressTime =
2068     GetPrivateProfileInt(Section, "BeepSuppressTime", 5, FName);
2069 doda 5410
2070     // Max OSC string buffer size
2071     ts->MaxOSCBufferSize =
2072     GetPrivateProfileInt(Section, "MaxOSCBufferSize", 4096, FName);
2073 doda 5428
2074 doda 5438 ts->JoinSplitURL = GetOnOff(Section, "JoinSplitURL", FName, FALSE);
2075 doda 5428
2076 doda 5438 GetPrivateProfileString(Section, "JoinSplitURLIgnoreEOLChar", "\\", Temp, sizeof(Temp), FName);
2077     ts->JoinSplitURLIgnoreEOLChar = Temp[0];
2078 doda 5590
2079     // Debug modes.
2080     GetPrivateProfileString(Section, "DebugModes", "all", Temp, sizeof(Temp), FName);
2081     if (_stricmp(Temp, "on") == 0 || _stricmp(Temp, "all") == 0)
2082     ts->DebugModes = DBGF_ALL;
2083     else if (_stricmp(Temp, "off") == 0 || _stricmp(Temp, "none") == 0) {
2084     ts->DebugModes = DBGF_NONE;
2085     ts->Debug = FALSE;
2086     }
2087     else {
2088     ts->DebugModes = DBGF_NONE;
2089     for (i=1; GetNthString(Temp, i, sizeof(Temp2), Temp2); i++) {
2090     if (_stricmp(Temp2, "normal") == 0)
2091     ts->DebugModes |= DBGF_NORM;
2092     else if (_stricmp(Temp2, "hex") == 0)
2093     ts->DebugModes |= DBGF_HEXD;
2094     else if (_stricmp(Temp2, "noout") == 0)
2095     ts->DebugModes |= DBGF_NOUT;
2096     }
2097     if (ts->DebugModes == DBGF_NONE)
2098     ts->Debug = FALSE;
2099     }
2100 yutakapon 6119
2101 doda 6318 // Xmodem Timeout
2102     GetPrivateProfileString(Section, "XmodemTimeouts", "10,3,10,20,60", Temp, sizeof(Temp), FName);
2103     ts->XmodemTimeOutInit = GetNthNum2(Temp, 1, 10);
2104     if (ts->XmodemTimeOutInit < 1)
2105     ts->XmodemTimeOutInit = 1;
2106     ts->XmodemTimeOutInitCRC = GetNthNum2(Temp, 2, 3);
2107     if (ts->XmodemTimeOutInitCRC < 1)
2108     ts->XmodemTimeOutInitCRC = 1;
2109     ts->XmodemTimeOutShort = GetNthNum2(Temp, 3, 10);
2110     if (ts->XmodemTimeOutShort < 1)
2111     ts->XmodemTimeOutShort = 1;
2112     ts->XmodemTimeOutLong = GetNthNum2(Temp, 4, 20);
2113     if (ts->XmodemTimeOutLong < 1)
2114     ts->XmodemTimeOutLong = 1;
2115     ts->XmodemTimeOutVLong = GetNthNum2(Temp, 5, 60);
2116     if (ts->XmodemTimeOutVLong < 1)
2117     ts->XmodemTimeOutVLong = 1;
2118    
2119 maya 6319 // Ymodem Timeout
2120     GetPrivateProfileString(Section, "YmodemTimeouts", "10,3,10,20,60", Temp, sizeof(Temp), FName);
2121     ts->YmodemTimeOutInit = GetNthNum2(Temp, 1, 10);
2122     if (ts->YmodemTimeOutInit < 1)
2123     ts->YmodemTimeOutInit = 1;
2124     ts->YmodemTimeOutInitCRC = GetNthNum2(Temp, 2, 3);
2125     if (ts->YmodemTimeOutInitCRC < 1)
2126     ts->YmodemTimeOutInitCRC = 1;
2127     ts->YmodemTimeOutShort = GetNthNum2(Temp, 3, 10);
2128     if (ts->YmodemTimeOutShort < 1)
2129     ts->YmodemTimeOutShort = 1;
2130     ts->YmodemTimeOutLong = GetNthNum2(Temp, 4, 20);
2131     if (ts->YmodemTimeOutLong < 1)
2132     ts->YmodemTimeOutLong = 1;
2133     ts->YmodemTimeOutVLong = GetNthNum2(Temp, 5, 60);
2134     if (ts->YmodemTimeOutVLong < 1)
2135     ts->YmodemTimeOutVLong = 1;
2136    
2137     // Zmodem Timeout
2138     GetPrivateProfileString(Section, "ZmodemTimeouts", "10,0,10,3", Temp, sizeof(Temp), FName);
2139     ts->ZmodemTimeOutNormal = GetNthNum2(Temp, 1, 10);
2140     if (ts->ZmodemTimeOutNormal < 1)
2141     ts->ZmodemTimeOutNormal = 1;
2142     ts->ZmodemTimeOutTCPIP = GetNthNum2(Temp, 2, 0);
2143     if (ts->ZmodemTimeOutTCPIP < 0)
2144     ts->ZmodemTimeOutTCPIP = 0;
2145     ts->ZmodemTimeOutInit = GetNthNum2(Temp, 3, 10);
2146     if (ts->ZmodemTimeOutInit < 1)
2147     ts->ZmodemTimeOutInit = 1;
2148     ts->ZmodemTimeOutFin = GetNthNum2(Temp, 4, 3);
2149     if (ts->ZmodemTimeOutFin < 1)
2150     ts->ZmodemTimeOutFin = 1;
2151    
2152 doda 6418 // Trim trailing new line character when pasting
2153 doda 6594 if (GetOnOff(Section, "TrimTrailingNLonPaste", FName, FALSE))
2154     ts->PasteFlag |= CPF_TRIM_TRAILING_NL;
2155 doda 6418
2156 doda 6856 // List Inactive Font
2157     ts->ListHiddenFonts = GetOnOff(Section, "ListHiddenFonts", FName, FALSE);
2158    
2159 doda 6916 // ISO2022ShiftFunction
2160     GetPrivateProfileString(Section, "ISO2022ShiftFunction", "on", Temp, sizeof(Temp), FName);
2161 doda 6915 ts->ISO2022Flag = ISO2022_SHIFT_NONE;
2162     for (i=1; GetNthString(Temp, i, sizeof(Temp2), Temp2); i++) {
2163     BOOL add=TRUE;
2164 doda 6918 char *p = Temp2, *p2;
2165 doda 6915 int mask = 0;
2166    
2167 doda 6918 while (*p == ' ' || *p == '\t') {
2168     p++;
2169     }
2170     p2 = p + strlen(p);
2171     while (p2 > p) {
2172     p2--;
2173     if (*p2 != ' ' && *p2 != '\t') {
2174     break;
2175     }
2176     }
2177     *++p2 = 0;
2178    
2179 doda 6915 if (*p == '-') {
2180     p++;
2181     add=FALSE;
2182 doda 6913 }
2183 doda 6918 else if (*p == '+') {
2184     p++;
2185     }
2186    
2187 doda 6915 if (_stricmp(p, "on") == 0 || _stricmp(p, "all") == 0)
2188     ts->ISO2022Flag = ISO2022_SHIFT_ALL;
2189     else if (_stricmp(p, "off") == 0