Develop and Download Open Source Software

Browse Subversion Repository

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2643 - (show annotations) (download) (as text)
Sun Jan 25 15:46:18 2009 UTC (15 years, 2 months ago) by doda
Original Path: teraterm/trunk/ttpset/ttset.c
File MIME type: text/x-csrc
File size: 89877 byte(s)
幾つかの特殊キー等にシーケンスを割り当てた。

1 /* Tera Term
2 Copyright(C) 1994-1998 T. Teranishi
3 All rights reserved. */
4 /* IPv6 modification is Copyright(C) 2000 Jun-ya kato <kato@win6.jp> */
5
6 /* TTSET.DLL, setup file routines*/
7 #ifndef NO_INET6
8 #include <winsock2.h>
9 #include <ws2tcpip.h>
10 #endif /* NO_INET6 */
11 #include "teraterm.h"
12 #include "tttypes.h"
13 #include <stdio.h>
14 #include <string.h>
15 #include <direct.h>
16 #include "ttlib.h"
17 #include "tt_res.h"
18
19 #define Section "Tera Term"
20
21 static PCHAR far TermList[] =
22 { "VT100", "VT100J", "VT101", "VT102", "VT102J", "VT220J", "VT282",
23 "VT320", "VT382", NULL };
24 // expansion (2005.11.30 yutaka)
25 static PCHAR BaudList[] =
26 { "110", "300", "600", "1200", "2400", "4800", "9600",
27 "14400", "19200", "38400", "57600", "115200",
28 "230400", "460800", "921600", NULL
29 };
30
31 static PCHAR far RussList[] =
32 { "Windows", "KOI8-R", "CP-866", "ISO-8859-5", NULL };
33 static PCHAR far RussList2[] = { "Windows", "KOI8-R", NULL };
34
35 WORD str2id(PCHAR far * List, PCHAR str, WORD DefId)
36 {
37 WORD i;
38 i = 0;
39 while ((List[i] != NULL) && (_stricmp(List[i], str) != 0))
40 i++;
41 if (List[i] == NULL)
42 i = DefId;
43 else
44 i++;
45
46 return i;
47 }
48
49 void id2str(PCHAR far * List, WORD Id, WORD DefId, PCHAR str, int destlen)
50 {
51 int i;
52
53 if (Id == 0)
54 i = DefId - 1;
55 else {
56 i = 0;
57 while ((List[i] != NULL) && (i < Id - 1))
58 i++;
59 if (List[i] == NULL)
60 i = DefId - 1;
61 }
62 strncpy_s(str, destlen, List[i], _TRUNCATE);
63 }
64
65 int IconName2IconId(const char *name) {
66 int id;
67
68 if (_stricmp(name, "tterm") == 0) {
69 id = IDI_TTERM;
70 }
71 else if (_stricmp(name, "vt") == 0) {
72 id = IDI_VT;
73 }
74 else if (_stricmp(name, "tek") == 0) {
75 id = IDI_TEK;
76 }
77 else if (_stricmp(name, "tterm_classic") == 0) {
78 id = IDI_TTERM_CLASSIC;
79 }
80 else if (_stricmp(name, "vt_classic") == 0) {
81 id = IDI_VT_CLASSIC;
82 }
83 else if (_stricmp(name, "cygterm") == 0) {
84 id = IDI_CYGTERM;
85 }
86 else {
87 id = IdIconDefault;
88 }
89 return id;
90 }
91
92 void IconId2IconName(char *name, int len, int id) {
93 char *icon;
94 switch (id) {
95 case IDI_TTERM:
96 icon = "tterm";
97 break;
98 case IDI_VT:
99 icon = "vt";
100 break;
101 case IDI_TEK:
102 icon = "tek";
103 break;
104 case IDI_TTERM_CLASSIC:
105 icon = "tterm_classic";
106 break;
107 case IDI_VT_CLASSIC:
108 icon = "vt_classic";
109 break;
110 case IDI_CYGTERM:
111 icon = "cygterm";
112 break;
113 default:
114 icon = "Default";
115 }
116 strncpy_s(name, len, icon, _TRUNCATE);
117 }
118
119 WORD GetOnOff(PCHAR Sect, PCHAR Key, PCHAR FName, BOOL Default)
120 {
121 char Temp[4];
122 GetPrivateProfileString(Sect, Key, "", Temp, sizeof(Temp), FName);
123 if (Default) {
124 if (_stricmp(Temp, "off") == 0)
125 return 0;
126 else
127 return 1;
128 }
129 else {
130 if (_stricmp(Temp, "on") == 0)
131 return 1;
132 else
133 return 0;
134 }
135 }
136
137 void WriteOnOff(PCHAR Sect, PCHAR Key, PCHAR FName, WORD Flag)
138 {
139 char Temp[4];
140
141 if (Flag != 0)
142 strncpy_s(Temp, sizeof(Temp), "on", _TRUNCATE);
143 else
144 strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
145 WritePrivateProfileString(Sect, Key, Temp, FName);
146 }
147
148 void WriteInt(PCHAR Sect, PCHAR Key, PCHAR FName, int i)
149 {
150 char Temp[15];
151 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", i);
152 WritePrivateProfileString(Sect, Key, Temp, FName);
153 }
154
155 void WriteUint(PCHAR Sect, PCHAR Key, PCHAR FName, UINT i)
156 {
157 char Temp[15];
158 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%u", i);
159 WritePrivateProfileString(Sect, Key, Temp, FName);
160 }
161
162 void WriteInt2(PCHAR Sect, PCHAR Key, PCHAR FName, int i1, int i2)
163 {
164 char Temp[32];
165 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d", i1, i2);
166 WritePrivateProfileString(Sect, Key, Temp, FName);
167 }
168
169 void WriteInt4(PCHAR Sect, PCHAR Key, PCHAR FName,
170 int i1, int i2, int i3, int i4)
171 {
172 char Temp[64];
173 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d",
174 i1, i2, i3, i4);
175 WritePrivateProfileString(Sect, Key, Temp, FName);
176 }
177
178 void WriteInt6(PCHAR Sect, PCHAR Key, PCHAR FName,
179 int i1, int i2, int i3, int i4, int i5, int i6)
180 {
181 char Temp[96];
182 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d,%d,%d",
183 i1, i2,i3, i4, i5, i6);
184 WritePrivateProfileString(Sect, Key, Temp, FName);
185 }
186
187 void WriteFont(PCHAR Sect, PCHAR Key, PCHAR FName,
188 PCHAR Name, int x, int y, int charset)
189 {
190 char Temp[80];
191 if (Name[0] != 0)
192 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%s,%d,%d,%d",
193 Name, x, y, charset);
194 else
195 Temp[0] = 0;
196 WritePrivateProfileString(Sect, Key, Temp, FName);
197 }
198
199 void FAR PASCAL ReadIniFile(PCHAR FName, PTTSet ts)
200 {
201 int i;
202 HDC TmpDC;
203 char Temp[MAXPATHLEN];
204
205 ts->Minimize = 0;
206 ts->HideWindow = 0;
207 ts->LogFlag = 0; // Log flags
208 ts->FTFlag = 0; // File transfer flags
209 ts->MenuFlag = 0; // Menu flags
210 ts->TermFlag = 0; // Terminal flag
211 ts->ColorFlag = 0; // ANSI color flags
212 ts->PortFlag = 0; // Port flags
213 ts->TelPort = 23;
214
215 /* Version number */
216 /* GetPrivateProfileString(Section,"Version","",
217 Temp,sizeof(Temp),FName); */
218
219 /* Language */
220 GetPrivateProfileString(Section, "Language", "",
221 Temp, sizeof(Temp), FName);
222 if (_stricmp(Temp, "Japanese") == 0)
223 ts->Language = IdJapanese;
224 else if (_stricmp(Temp, "Russian") == 0)
225 ts->Language = IdRussian;
226 else if (_stricmp(Temp, "English") == 0)
227 ts->Language = IdEnglish;
228 else if (_stricmp(Temp,"Korean") == 0) // HKS
229 ts->Language = IdKorean;
230 else {
231 switch (PRIMARYLANGID(GetSystemDefaultLangID())) {
232 case LANG_JAPANESE:
233 ts->Language = IdJapanese;
234 break;
235 case LANG_RUSSIAN:
236 ts->Language = IdRussian;
237 break;
238 case LANG_KOREAN: // HKS
239 ts->Language = IdKorean;
240 break;
241 default:
242 ts->Language = IdEnglish;
243 }
244 }
245
246 /* Port type */
247 GetPrivateProfileString(Section, "Port", "",
248 Temp, sizeof(Temp), FName);
249 if (_stricmp(Temp, "tcpip") == 0)
250 ts->PortType = IdTCPIP;
251 else if (_stricmp(Temp, "serial") == 0)
252 ts->PortType = IdSerial;
253 else {
254 ts->PortType = IdTCPIP;
255 }
256
257 /* VT win position */
258 GetPrivateProfileString(Section, "VTPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */
259 GetNthNum(Temp, 1, (int far *) (&ts->VTPos.x));
260 GetNthNum(Temp, 2, (int far *) (&ts->VTPos.y));
261
262 /* TEK win position */
263 GetPrivateProfileString(Section, "TEKPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */
264 GetNthNum(Temp, 1, (int far *) &(ts->TEKPos.x));
265 GetNthNum(Temp, 2, (int far *) &(ts->TEKPos.y));
266
267 /* Save VT Window position */
268 ts->SaveVTWinPos = GetOnOff(Section, "SaveVTWinPos", FName, FALSE);
269
270 /* VT terminal size */
271 GetPrivateProfileString(Section, "TerminalSize", "80,24",
272 Temp, sizeof(Temp), FName);
273 GetNthNum(Temp, 1, &ts->TerminalWidth);
274 GetNthNum(Temp, 2, &ts->TerminalHeight);
275 if (ts->TerminalWidth < 0)
276 ts->TerminalWidth = 1;
277 if (ts->TerminalHeight < 0)
278 ts->TerminalHeight = 1;
279
280 /* Terminal size = Window size */
281 ts->TermIsWin = GetOnOff(Section, "TermIsWin", FName, FALSE);
282
283 /* Auto window resize flag */
284 ts->AutoWinResize = GetOnOff(Section, "AutoWinResize", FName, FALSE);
285
286 /* CR Receive */
287 GetPrivateProfileString(Section, "CRReceive", "",
288 Temp, sizeof(Temp), FName);
289 if (_stricmp(Temp, "CRLF") == 0) {
290 ts->CRReceive = IdCRLF;
291 }
292 else if (_stricmp(Temp, "LF") == 0) {
293 ts->CRReceive = IdLF;
294 }
295 else {
296 ts->CRReceive = IdCR;
297 }
298 /* CR Send */
299 GetPrivateProfileString(Section, "CRSend", "",
300 Temp, sizeof(Temp), FName);
301 if (_stricmp(Temp, "CRLF") == 0)
302 ts->CRSend = IdCRLF;
303 else
304 ts->CRSend = IdCR;
305 ts->CRSend_ini = ts->CRSend;
306
307 /* Local echo */
308 ts->LocalEcho = GetOnOff(Section, "LocalEcho", FName, FALSE);
309 ts->LocalEcho_ini = ts->LocalEcho;
310
311 /* Answerback */
312 GetPrivateProfileString(Section, "Answerback", "", Temp,
313 sizeof(Temp), FName);
314 ts->AnswerbackLen =
315 Hex2Str(Temp, ts->Answerback, sizeof(ts->Answerback));
316
317 /* Kanji Code (receive) */
318 GetPrivateProfileString(Section, "KanjiReceive", "",
319 Temp, sizeof(Temp), FName);
320 if (_stricmp(Temp, "EUC") == 0)
321 ts->KanjiCode = IdEUC;
322 else if (_stricmp(Temp, "JIS") == 0)
323 ts->KanjiCode = IdJIS;
324 else if (_stricmp(Temp, "UTF-8") == 0)
325 ts->KanjiCode = IdUTF8;
326 else if (_stricmp(Temp, "UTF-8m") == 0)
327 ts->KanjiCode = IdUTF8m;
328 else
329 ts->KanjiCode = IdSJIS;
330
331 /* Katakana (receive) */
332 GetPrivateProfileString(Section, "KatakanaReceive", "",
333 Temp, sizeof(Temp), FName);
334 if (_stricmp(Temp, "7") == 0)
335 ts->JIS7Katakana = 1;
336 else
337 ts->JIS7Katakana = 0;
338
339 /* Kanji Code (transmit) */
340 GetPrivateProfileString(Section, "KanjiSend", "",
341 Temp, sizeof(Temp), FName);
342 if (_stricmp(Temp, "EUC") == 0)
343 ts->KanjiCodeSend = IdEUC;
344 else if (_stricmp(Temp, "JIS") == 0)
345 ts->KanjiCodeSend = IdJIS;
346 else if (_stricmp(Temp, "UTF-8") == 0)
347 ts->KanjiCodeSend = IdUTF8;
348 else
349 ts->KanjiCodeSend = IdSJIS;
350
351 /* Katakana (receive) */
352 GetPrivateProfileString(Section, "KatakanaSend", "",
353 Temp, sizeof(Temp), FName);
354 if (_stricmp(Temp, "7") == 0)
355 ts->JIS7KatakanaSend = 1;
356 else
357 ts->JIS7KatakanaSend = 0;
358
359 /* KanjiIn */
360 GetPrivateProfileString(Section, "KanjiIn", "",
361 Temp, sizeof(Temp), FName);
362 if (_stricmp(Temp, "@") == 0)
363 ts->KanjiIn = IdKanjiInA;
364 else
365 ts->KanjiIn = IdKanjiInB;
366
367 /* KanjiOut */
368 GetPrivateProfileString(Section, "KanjiOut", "",
369 Temp, sizeof(Temp), FName);
370 if (_stricmp(Temp, "B") == 0)
371 ts->KanjiOut = IdKanjiOutB;
372 else if (_stricmp(Temp, "H") == 0)
373 ts->KanjiOut = IdKanjiOutH;
374 else
375 ts->KanjiOut = IdKanjiOutJ;
376
377 /* Auto Win Switch VT<->TEK */
378 ts->AutoWinSwitch = GetOnOff(Section, "AutoWinSwitch", FName, FALSE);
379
380 /* Terminal ID */
381 GetPrivateProfileString(Section, "TerminalID", "",
382 Temp, sizeof(Temp), FName);
383 ts->TerminalID = str2id(TermList, Temp, IdVT100);
384
385 /* Russian character set (host) */
386 GetPrivateProfileString(Section, "RussHost", "",
387 Temp, sizeof(Temp), FName);
388 ts->RussHost = str2id(RussList, Temp, IdKOI8);
389
390 /* Russian character set (client) */
391 GetPrivateProfileString(Section, "RussClient", "",
392 Temp, sizeof(Temp), FName);
393 ts->RussClient = str2id(RussList, Temp, IdWindows);
394
395 /* Title String */
396 GetPrivateProfileString(Section, "Title", "Tera Term",
397 ts->Title, sizeof(ts->Title), FName);
398
399 /* Cursor shape */
400 GetPrivateProfileString(Section, "CursorShape", "",
401 Temp, sizeof(Temp), FName);
402 if (_stricmp(Temp, "vertical") == 0)
403 ts->CursorShape = IdVCur;
404 else if (_stricmp(Temp, "horizontal") == 0)
405 ts->CursorShape = IdHCur;
406 else
407 ts->CursorShape = IdBlkCur;
408
409 /* Hide title */
410 ts->HideTitle = GetOnOff(Section, "HideTitle", FName, FALSE);
411
412 /* Popup menu */
413 ts->PopupMenu = GetOnOff(Section, "PopupMenu", FName, FALSE);
414
415 /* PC-Style bold color mapping */
416 ts->ColorFlag |=
417 CF_PCBOLD16 * GetOnOff(Section, "PcBoldColor", FName, FALSE);
418
419 /* aixterm style 16 colors mode */
420 ts->ColorFlag |=
421 CF_AIXTERM16 * GetOnOff(Section, "Aixterm16Color", FName, FALSE);
422
423 /* xterm style 256 colors mode */
424 ts->ColorFlag |=
425 CF_XTERM256 * GetOnOff(Section, "Xterm256Color", FName, TRUE);
426
427 /* Enable scroll buffer */
428 ts->EnableScrollBuff =
429 GetOnOff(Section, "EnableScrollBuff", FName, TRUE);
430
431 /* Scroll buffer size */
432 ts->ScrollBuffSize =
433 GetPrivateProfileInt(Section, "ScrollBuffSize", 100, FName);
434
435 /* VT Color */
436 GetPrivateProfileString(Section, "VTColor", "0,0,0,255,255,255",
437 Temp, sizeof(Temp), FName);
438 for (i = 0; i <= 5; i++)
439 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
440 for (i = 0; i <= 1; i++)
441 ts->VTColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
442 (BYTE) ts->TmpColor[0][i * 3 + 1],
443 (BYTE) ts->TmpColor[0][i * 3 + 2]);
444
445 /* VT Bold Color */
446 GetPrivateProfileString(Section, "VTBoldColor", "0,0,255,255,255,255",
447 Temp, sizeof(Temp), FName);
448 for (i = 0; i <= 5; i++)
449 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
450 for (i = 0; i <= 1; i++)
451 ts->VTBoldColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
452 (BYTE) ts->TmpColor[0][i * 3 + 1],
453 (BYTE) ts->TmpColor[0][i * 3 + 2]);
454
455 /* VT Blink Color */
456 GetPrivateProfileString(Section, "VTBlinkColor", "255,0,0,255,255,255",
457 Temp, sizeof(Temp), FName);
458 for (i = 0; i <= 5; i++)
459 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
460 for (i = 0; i <= 1; i++)
461 ts->VTBlinkColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
462 (BYTE) ts->TmpColor[0][i * 3 + 1],
463 (BYTE) ts->TmpColor[0][i * 3 + 2]);
464
465 /* VT Reverse Color */
466 GetPrivateProfileString(Section, "VTReverseColor", "255,255,255,0,0,0",
467 Temp, sizeof(Temp), FName);
468 for (i = 0; i <= 5; i++)
469 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
470 for (i = 0; i <= 1; i++)
471 ts->VTReverseColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
472 (BYTE) ts->TmpColor[0][i * 3 + 1],
473 (BYTE) ts->TmpColor[0][i * 3 + 2]);
474
475 /* begin - ishizaki */
476 ts->EnableClickableUrl =
477 GetOnOff(Section, "EnableClickableUrl", FName, FALSE);
478
479 /* URL Color */
480 GetPrivateProfileString(Section, "URLColor", "0,255,0,255,255,255",
481 Temp, sizeof(Temp), FName);
482 for (i = 0; i <= 5; i++)
483 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
484 for (i = 0; i <= 1; i++)
485 ts->URLColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
486 (BYTE) ts->TmpColor[0][i * 3 + 1],
487 (BYTE) ts->TmpColor[0][i * 3 + 2]);
488 /* end - ishizaki */
489
490 /* TEK Color */
491 GetPrivateProfileString(Section, "TEKColor", "0,0,0,255,255,255",
492 Temp, sizeof(Temp), FName);
493 for (i = 0; i <= 5; i++)
494 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
495 for (i = 0; i <= 1; i++)
496 ts->TEKColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
497 (BYTE) ts->TmpColor[0][i * 3 + 1],
498 (BYTE) ts->TmpColor[0][i * 3 + 2]);
499
500 #ifndef NO_ANSI_COLOR_EXTENSION
501 /* ANSI color definition (in the case FullColor=on) -- special option
502 o UseTextColor should be off, or the background and foreground color of
503 VTColor are assigned to color-number 0 and 7 respectively, even if
504 they are specified in ANSIColor.
505 o ANSIColor is a set of 4 values that are color-number(0--15),
506 red-value(0--255), green-value(0--255) and blue-value(0--255). */
507 GetPrivateProfileString(Section, "ANSIColor",
508 " 0, 0, 0, 0,"
509 " 1,255, 0, 0,"
510 " 2, 0,255, 0,"
511 " 3,255,255, 0,"
512 " 4, 0, 0,255,"
513 " 5,255, 0,255,"
514 " 6, 0,255,255,"
515 " 7,255,255,255,"
516 " 8,128,128,128,"
517 " 9,128, 0, 0,"
518 "10, 0,128, 0,"
519 "11,128,128, 0,"
520 "12, 0, 0,128,"
521 "13,128, 0,128,"
522 "14, 0,128,128,"
523 "15,192,192,192", Temp, sizeof(Temp), FName);
524 {
525 char *t;
526 int n = 1;
527 for (t = Temp; *t; t++)
528 if (*t == ',')
529 n++;
530 n /= 4;
531 for (i = 0; i <= n; i++) {
532 int colorid, r, g, b;
533 GetNthNum(Temp, i * 4 + 1, (int far *) &colorid);
534 GetNthNum(Temp, i * 4 + 2, (int far *) &r);
535 GetNthNum(Temp, i * 4 + 3, (int far *) &g);
536 GetNthNum(Temp, i * 4 + 4, (int far *) &b);
537 ts->ANSIColor[colorid & 15] =
538 RGB((BYTE) r, (BYTE) g, (BYTE) b);
539 }
540 }
541 #endif /* NO_ANSI_COLOR_EXTENSION */
542
543 TmpDC = GetDC(0); /* Get screen device context */
544 for (i = 0; i <= 1; i++)
545 ts->VTColor[i] = GetNearestColor(TmpDC, ts->VTColor[i]);
546 for (i = 0; i <= 1; i++)
547 ts->VTBoldColor[i] = GetNearestColor(TmpDC, ts->VTBoldColor[i]);
548 for (i = 0; i <= 1; i++)
549 ts->VTBlinkColor[i] = GetNearestColor(TmpDC, ts->VTBlinkColor[i]);
550 for (i = 0; i <= 1; i++)
551 ts->TEKColor[i] = GetNearestColor(TmpDC, ts->TEKColor[i]);
552 /* begin - ishizaki */
553 for (i = 0; i <= 1; i++)
554 ts->URLColor[i] = GetNearestColor(TmpDC, ts->URLColor[i]);
555 /* end - ishizaki */
556 #ifndef NO_ANSI_COLOR_EXTENSION
557 for (i = 0; i < 16; i++)
558 ts->ANSIColor[i] = GetNearestColor(TmpDC, ts->ANSIColor[i]);
559 #endif /* NO_ANSI_COLOR_EXTENSION */
560 ReleaseDC(0, TmpDC);
561
562 /* TEK color emulation */
563 ts->TEKColorEmu = GetOnOff(Section, "TEKColorEmulation", FName, FALSE);
564
565 /* VT Font */
566 GetPrivateProfileString(Section, "VTFont", "Terminal,0,-13,1",
567 Temp, sizeof(Temp), FName);
568 GetNthString(Temp, 1, sizeof(ts->VTFont), ts->VTFont);
569 GetNthNum(Temp, 2, (int far *) &(ts->VTFontSize.x));
570 GetNthNum(Temp, 3, (int far *) &(ts->VTFontSize.y));
571 GetNthNum(Temp, 4, &(ts->VTFontCharSet));
572
573 /* Bold font flag */
574 ts->EnableBold = GetOnOff(Section, "EnableBold", FName, TRUE);
575
576 /* Russian character set (font) */
577 GetPrivateProfileString(Section, "RussFont", "",
578 Temp, sizeof(Temp), FName);
579 ts->RussFont = str2id(RussList, Temp, IdWindows);
580
581 /* TEK Font */
582 GetPrivateProfileString(Section, "TEKFont", "Courier,0,-13,0",
583 Temp, sizeof(Temp), FName);
584 GetNthString(Temp, 1, sizeof(ts->TEKFont), ts->TEKFont);
585 GetNthNum(Temp, 2, (int far *) &(ts->TEKFontSize.x));
586 GetNthNum(Temp, 3, (int far *) &(ts->TEKFontSize.y));
587 GetNthNum(Temp, 4, &(ts->TEKFontCharSet));
588
589 /* BS key */
590 GetPrivateProfileString(Section, "BSKey", "",
591 Temp, sizeof(Temp), FName);
592 if (_stricmp(Temp, "DEL") == 0)
593 ts->BSKey = IdDEL;
594 else
595 ts->BSKey = IdBS;
596 /* Delete key */
597 ts->DelKey = GetOnOff(Section, "DeleteKey", FName, FALSE);
598
599 /* Meta Key */
600 ts->MetaKey = GetOnOff(Section, "MetaKey", FName, FALSE);
601
602 /* Application Keypad */
603 ts->DisableAppKeypad =
604 GetOnOff(Section, "DisableAppKeypad", FName, FALSE);
605
606 /* Application Cursor */
607 ts->DisableAppCursor =
608 GetOnOff(Section, "DisableAppCursor", FName, FALSE);
609
610 /* Russian keyboard type */
611 GetPrivateProfileString(Section, "RussKeyb", "",
612 Temp, sizeof(Temp), FName);
613 ts->RussKeyb = str2id(RussList2, Temp, IdWindows);
614
615 /* Serial port ID */
616 ts->ComPort = GetPrivateProfileInt(Section, "ComPort", 1, FName);
617
618 /* Baud rate */
619 GetPrivateProfileString(Section, "BaudRate", "9600",
620 Temp, sizeof(Temp), FName);
621 ts->Baud = str2id(BaudList, Temp, IdBaud9600);
622
623 /* Parity */
624 GetPrivateProfileString(Section, "Parity", "",
625 Temp, sizeof(Temp), FName);
626 if (_stricmp(Temp, "even") == 0)
627 ts->Parity = IdParityEven;
628 else if (_stricmp(Temp, "odd") == 0)
629 ts->Parity = IdParityOdd;
630 else
631 ts->Parity = IdParityNone;
632
633 /* Data bit */
634 GetPrivateProfileString(Section, "DataBit", "",
635 Temp, sizeof(Temp), FName);
636 if (_stricmp(Temp, "7") == 0)
637 ts->DataBit = IdDataBit7;
638 else
639 ts->DataBit = IdDataBit8;
640
641 /* Stop bit */
642 GetPrivateProfileString(Section, "StopBit", "",
643 Temp, sizeof(Temp), FName);
644 if (_stricmp(Temp, "2") == 0)
645 ts->StopBit = IdStopBit2;
646 else
647 ts->StopBit = IdStopBit1;
648
649 /* Flow control */
650 GetPrivateProfileString(Section, "FlowCtrl", "",
651 Temp, sizeof(Temp), FName);
652 if (_stricmp(Temp, "x") == 0)
653 ts->Flow = IdFlowX;
654 else if (_stricmp(Temp, "hard") == 0)
655 ts->Flow = IdFlowHard;
656 else
657 ts->Flow = IdFlowNone;
658
659 /* Delay per character */
660 ts->DelayPerChar =
661 GetPrivateProfileInt(Section, "DelayPerChar", 0, FName);
662
663 /* Delay per line */
664 ts->DelayPerLine =
665 GetPrivateProfileInt(Section, "DelayPerLine", 0, FName);
666
667 /* Telnet flag */
668 ts->Telnet = GetOnOff(Section, "Telnet", FName, TRUE);
669
670 /* Telnet terminal type */
671 GetPrivateProfileString(Section, "TermType", "xterm", ts->TermType,
672 sizeof(ts->TermType), FName);
673
674 /* TCP port num */
675 ts->TCPPort =
676 GetPrivateProfileInt(Section, "TCPPort", ts->TelPort, FName);
677
678 /* Auto window close flag */
679 ts->AutoWinClose = GetOnOff(Section, "AutoWinClose", FName, TRUE);
680
681 /* History list */
682 ts->HistoryList = GetOnOff(Section, "HistoryList", FName, FALSE);
683
684 /* File transfer binary flag */
685 ts->TransBin = GetOnOff(Section, "TransBin", FName, FALSE);
686
687 /* Log append */
688 ts->Append = GetOnOff(Section, "LogAppend", FName, FALSE);
689
690 /* Log plain text (2005.5.7 yutaka) */
691 ts->LogTypePlainText =
692 GetOnOff(Section, "LogTypePlainText", FName, FALSE);
693
694 /* Log with timestamp (2006.7.23 maya) */
695 ts->LogTimestamp = GetOnOff(Section, "LogTimestamp", FName, FALSE);
696
697 /* Log without transfer dialog */
698 ts->LogHideDialog = GetOnOff(Section, "LogHideDialog", FName, FALSE);
699
700 /* Default Log file name (2006.8.28 maya) */
701 GetPrivateProfileString(Section, "LogDefaultName", "teraterm.log",
702 ts->LogDefaultName, sizeof(ts->LogDefaultName),
703 FName);
704
705 /* Default Log file path (2007.5.30 maya) */
706 GetPrivateProfileString(Section, "LogDefaultPath", "",
707 ts->LogDefaultPath, sizeof(ts->LogDefaultPath),
708 FName);
709
710 /* Auto start logging (2007.5.31 maya) */
711 ts->LogAutoStart = GetOnOff(Section, "LogAutoStart", FName, FALSE);
712
713 /* XMODEM option */
714 GetPrivateProfileString(Section, "XmodemOpt", "",
715 Temp, sizeof(Temp), FName);
716 if (_stricmp(Temp, "crc") == 0)
717 ts->XmodemOpt = XoptCRC;
718 else if (_stricmp(Temp, "1k") == 0)
719 ts->XmodemOpt = Xopt1K;
720 else
721 ts->XmodemOpt = XoptCheck;
722
723 /* XMODEM binary file */
724 ts->XmodemBin = GetOnOff(Section, "XmodemBin", FName, TRUE);
725
726 /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
727 GetPrivateProfileString(Section, "XModemRcvCommand", "",
728 ts->XModemRcvCommand,
729 sizeof(ts->XModemRcvCommand), FName);
730
731 /* Default directory for file transfer */
732 GetPrivateProfileString(Section, "FileDir", "",
733 ts->FileDir, sizeof(ts->FileDir), FName);
734 if (strlen(ts->FileDir) == 0)
735 strncpy_s(ts->FileDir, sizeof(ts->FileDir), ts->HomeDir, _TRUNCATE);
736 else {
737 _getcwd(Temp, sizeof(Temp));
738 if (_chdir(ts->FileDir) != 0)
739 strncpy_s(ts->FileDir, sizeof(ts->FileDir), ts->HomeDir, _TRUNCATE);
740 _chdir(Temp);
741 }
742
743 /* filter on file send (2007.6.5 maya) */
744 GetPrivateProfileString(Section, "FileSendFilter", "",
745 ts->FileSendFilter, sizeof(ts->FileSendFilter),
746 FName);
747
748 /*--------------------------------------------------*/
749 /* 8 bit control code flag -- special option */
750 ts->TermFlag |=
751 TF_ACCEPT8BITCTRL *
752 GetOnOff(Section, "Accept8BitCtrl", FName, TRUE);
753
754 /* Wrong sequence flag -- special option */
755 ts->TermFlag |=
756 TF_ALLOWWRONGSEQUENCE *
757 GetOnOff(Section, "AllowWrongSequence", FName, FALSE);
758
759 if (((ts->TermFlag & TF_ALLOWWRONGSEQUENCE) == 0) &&
760 (ts->KanjiOut == IdKanjiOutH))
761 ts->KanjiOut = IdKanjiOutJ;
762
763 // Auto file renaming --- special option
764 ts->FTFlag |=
765 FT_RENAME * GetOnOff(Section, "AutoFileRename", FName, FALSE);
766
767 // Auto invoking (character set->G0->GL) --- special option
768 ts->TermFlag |=
769 TF_AUTOINVOKE * GetOnOff(Section, "AutoInvoke", FName, FALSE);
770
771 // Auto text copy --- special option
772 ts->AutoTextCopy = GetOnOff(Section, "AutoTextCopy", FName, TRUE);
773
774 /* Back wrap -- special option */
775 ts->TermFlag |=
776 TF_BACKWRAP * GetOnOff(Section, "BackWrap", FName, FALSE);
777
778 /* Beep type -- special option */
779 GetPrivateProfileString(Section, "Beep", "", Temp, sizeof(Temp), FName);
780 if (_stricmp(Temp, "off") == 0)
781 ts->Beep = IdBeepOff;
782 else if (_stricmp(Temp, "visual") == 0)
783 ts->Beep = IdBeepVisual;
784 else
785 ts->Beep = IdBeepOn;
786
787 /* Beep on connection & disconnection -- special option */
788 ts->PortFlag |=
789 PF_BEEPONCONNECT * GetOnOff(Section, "BeepOnConnect", FName,
790 FALSE);
791
792 /* Auto B-Plus activation -- special option */
793 ts->FTFlag |= FT_BPAUTO * GetOnOff(Section, "BPAuto", FName, FALSE);
794 if ((ts->FTFlag & FT_BPAUTO) != 0) { /* Answerback */
795 strncpy_s(ts->Answerback, sizeof(ts->Answerback), "\020++\0200",
796 _TRUNCATE);
797 ts->AnswerbackLen = 5;
798 }
799
800 /* B-Plus ESCCTL flag -- special option */
801 ts->FTFlag |=
802 FT_BPESCCTL * GetOnOff(Section, "BPEscCtl", FName, FALSE);
803
804 /* B-Plus log -- special option */
805 ts->LogFlag |= LOG_BP * GetOnOff(Section, "BPLog", FName, FALSE);
806
807 /* Clear serial port buffer when port opening -- special option */
808 ts->ClearComBuffOnOpen =
809 GetOnOff(Section, "ClearComBuffOnOpen", FName, TRUE);
810
811 /* Confirm disconnection -- special option */
812 ts->PortFlag |=
813 PF_CONFIRMDISCONN * GetOnOff(Section, "ConfirmDisconnect",
814 FName, TRUE);
815
816 /* Ctrl code in Kanji -- special option */
817 ts->TermFlag |=
818 TF_CTRLINKANJI * GetOnOff(Section, "CtrlInKanji", FName, TRUE);
819
820 /* Debug flag -- special option */
821 ts->Debug = GetOnOff(Section, "Debug", FName, FALSE);
822
823 /* Delimiter list -- special option */
824 GetPrivateProfileString(Section, "DelimList",
825 "$20!\"#$24%&\'()*+,-./:;<=>?@[\\]^`{|}~",
826 Temp, sizeof(Temp), FName);
827 Hex2Str(Temp, ts->DelimList, sizeof(ts->DelimList));
828
829 /* regard DBCS characters as delimiters -- special option */
830 ts->DelimDBCS = GetOnOff(Section, "DelimDBCS", FName, TRUE);
831
832 // Enable popup menu -- special option
833 if (GetOnOff(Section, "EnablePopupMenu", FName, TRUE) == 0)
834 ts->MenuFlag |= MF_NOPOPUP;
835
836 // Enable "Show menu" -- special option
837 if (GetOnOff(Section, "EnableShowMenu", FName, TRUE) == 0)
838 ts->MenuFlag |= MF_NOSHOWMENU;
839
840 // Enable the status line -- special option
841 ts->TermFlag |=
842 TF_ENABLESLINE * GetOnOff(Section, "EnableStatusLine", FName, TRUE);
843
844 // fixed JIS --- special
845 ts->TermFlag |=
846 TF_FIXEDJIS * GetOnOff(Section, "FixedJIS", FName, FALSE);
847
848 /* IME Flag -- special option */
849 ts->UseIME = GetOnOff(Section, "IME", FName, TRUE);
850
851 /* IME-inline Flag -- special option */
852 ts->IMEInline = GetOnOff(Section, "IMEInline", FName, TRUE);
853
854 /* Kermit log -- special option */
855 ts->LogFlag |= LOG_KMT * GetOnOff(Section, "KmtLog", FName, FALSE);
856
857 // Enable language selection -- special option
858 if (GetOnOff(Section, "LanguageSelection", FName, TRUE) == 0)
859 ts->MenuFlag |= MF_NOLANGUAGE;
860
861 /* Maximum scroll buffer size -- special option */
862 ts->ScrollBuffMax =
863 GetPrivateProfileInt(Section, "MaxBuffSize", 10000, FName);
864 if (ts->ScrollBuffMax < 24)
865 ts->ScrollBuffMax = 10000;
866
867 /* Max com port number -- special option */
868 ts->MaxComPort = GetPrivateProfileInt(Section, "MaxComPort", 4, FName);
869 if (ts->MaxComPort < 4)
870 ts->MaxComPort = 4;
871 // COM16����99���g�� (2005.11.30 yutaka)
872 // 99����200���g�� (2007.7.23 maya)
873 if (ts->MaxComPort > MAXCOMPORT)
874 ts->MaxComPort = MAXCOMPORT;
875 if ((ts->ComPort < 1) || (ts->ComPort > ts->MaxComPort))
876 ts->ComPort = 1;
877
878 /* Non-blinking cursor -- special option */
879 ts->NonblinkingCursor =
880 GetOnOff(Section, "NonblinkingCursor", FName, FALSE);
881
882 // �t�H�[�J�X���������|���S���J�[�\�� (2008.1.24 yutaka)
883 ts->KillFocusCursor =
884 GetOnOff(Section, "KillFocusCursor", FName, TRUE);
885
886 /* Delay for pass-thru printing activation */
887 /* -- special option */
888 ts->PassThruDelay =
889 GetPrivateProfileInt(Section, "PassThruDelay", 3, FName);
890
891 /* Printer port for pass-thru printing */
892 /* -- special option */
893 GetPrivateProfileString(Section, "PassThruPort", "",
894 ts->PrnDev, sizeof(ts->PrnDev), FName);
895
896 /* Printer Font --- special option */
897 GetPrivateProfileString(Section, "PrnFont", "",
898 Temp, sizeof(Temp), FName);
899 if (strlen(Temp) == 0) {
900 ts->PrnFont[0] = 0;
901 ts->PrnFontSize.x = 0;
902 ts->PrnFontSize.y = 0;
903 ts->PrnFontCharSet = 0;
904 }
905 else {
906 GetNthString(Temp, 1, sizeof(ts->PrnFont), ts->PrnFont);
907 GetNthNum(Temp, 2, (int far *) &(ts->PrnFontSize.x));
908 GetNthNum(Temp, 3, (int far *) &(ts->PrnFontSize.y));
909 GetNthNum(Temp, 4, &(ts->PrnFontCharSet));
910 }
911
912 // Page margins (left, right, top, bottom) for printing
913 // -- special option
914 GetPrivateProfileString(Section, "PrnMargin", "50,50,50,50",
915 Temp, sizeof(Temp), FName);
916 for (i = 0; i <= 3; i++)
917 GetNthNum(Temp, 1 + i, &ts->PrnMargin[i]);
918
919 /* Quick-VAN log -- special option */
920 ts->LogFlag |= LOG_QV * GetOnOff(Section, "QVLog", FName, FALSE);
921
922 /* Quick-VAN window size -- special */
923 ts->QVWinSize = GetPrivateProfileInt(Section, "QVWinSize", 8, FName);
924
925 /* Russian character set (print) -- special option */
926 GetPrivateProfileString(Section, "RussPrint", "",
927 Temp, sizeof(Temp), FName);
928 ts->RussPrint = str2id(RussList, Temp, IdWindows);
929
930 /* Scroll threshold -- special option */
931 ts->ScrollThreshold =
932 GetPrivateProfileInt(Section, "ScrollThreshold", 12, FName);
933
934 ts->MouseWheelScrollLine =
935 GetPrivateProfileInt(Section, "MouseWheelScrollLine", 3, FName);
936
937 // Select on activate -- special option
938 ts->SelOnActive = GetOnOff(Section, "SelectOnActivate", FName, TRUE);
939
940 /* Send 8bit control sequence -- special option */
941 ts->Send8BitCtrl = GetOnOff(Section, "Send8BitCtrl", FName, FALSE);
942
943 /* Startup macro -- special option */
944 GetPrivateProfileString(Section, "StartupMacro", "",
945 ts->MacroFN, sizeof(ts->MacroFN), FName);
946
947 /* TEK GIN Mouse keycode -- special option */
948 ts->GINMouseCode =
949 GetPrivateProfileInt(Section, "TEKGINMouseCode", 32, FName);
950
951 /* Telnet Auto Detect -- special option */
952 ts->TelAutoDetect = GetOnOff(Section, "TelAutoDetect", FName, TRUE);
953
954 /* Telnet binary flag -- special option */
955 ts->TelBin = GetOnOff(Section, "TelBin", FName, FALSE);
956
957 /* Telnet Echo flag -- special option */
958 ts->TelEcho = GetOnOff(Section, "TelEcho", FName, FALSE);
959
960 /* Telnet log -- special option */
961 ts->LogFlag |= LOG_TEL * GetOnOff(Section, "TelLog", FName, FALSE);
962
963 /* TCP port num for telnet -- special option */
964 ts->TelPort = GetPrivateProfileInt(Section, "TelPort", 23, FName);
965
966 /* Telnet keep-alive packet(NOP command) interval -- special option */
967 ts->TelKeepAliveInterval =
968 GetPrivateProfileInt(Section, "TelKeepAliveInterval", 300, FName);
969
970 /* Max number of broadcast commad history */
971 ts->MaxBroadcatHistory =
972 GetPrivateProfileInt(Section, "MaxBroadcatHistory", 99, FName);
973
974 /* Local echo for non-telnet */
975 ts->TCPLocalEcho = GetOnOff(Section, "TCPLocalEcho", FName, FALSE);
976
977 /* "new-line (transmit)" option for non-telnet -- special option */
978 GetPrivateProfileString(Section, "TCPCRSend", "",
979 Temp, sizeof(Temp), FName);
980 if (_stricmp(Temp, "CR") == 0)
981 ts->TCPCRSend = IdCR;
982 else if (_stricmp(Temp, "CRLF") == 0)
983 ts->TCPCRSend = IdCRLF;
984 else
985 ts->TCPCRSend = 0; // disabled
986
987 /* Use text (background) color for "white (black)"
988 --- special option */
989 ts->ColorFlag |=
990 CF_USETEXTCOLOR * GetOnOff(Section, "UseTextColor", FName, FALSE);
991
992 /* Title format -- special option */
993 ts->TitleFormat =
994 GetPrivateProfileInt(Section, "TitleFormat", 5, FName);
995
996 /* VT Compatible Tab -- special option */
997 ts->VTCompatTab = GetOnOff(Section, "VTCompatTab", FName, FALSE);
998
999 /* VT Font space --- special option */
1000 GetPrivateProfileString(Section, "VTFontSpace", "0,0,0,0",
1001 Temp, sizeof(Temp), FName);
1002 GetNthNum(Temp, 1, &ts->FontDX);
1003 GetNthNum(Temp, 2, &ts->FontDW);
1004 GetNthNum(Temp, 3, &ts->FontDY);
1005 GetNthNum(Temp, 4, &ts->FontDH);
1006 if (ts->FontDX < 0)
1007 ts->FontDX = 0;
1008 if (ts->FontDW < 0)
1009 ts->FontDW = 0;
1010 ts->FontDW = ts->FontDW + ts->FontDX;
1011 if (ts->FontDY < 0)
1012 ts->FontDY = 0;
1013 if (ts->FontDH < 0)
1014 ts->FontDH = 0;
1015 ts->FontDH = ts->FontDH + ts->FontDY;
1016
1017 // VT-print scaling factors (pixels per inch) --- special option
1018 GetPrivateProfileString(Section, "VTPPI", "0,0",
1019 Temp, sizeof(Temp), FName);
1020 GetNthNum(Temp, 1, (int far *) &ts->VTPPI.x);
1021 GetNthNum(Temp, 2, (int far *) &ts->VTPPI.y);
1022
1023 // TEK-print scaling factors (pixels per inch) --- special option
1024 GetPrivateProfileString(Section, "TEKPPI", "0,0",
1025 Temp, sizeof(Temp), FName);
1026 GetNthNum(Temp, 1, (int far *) &ts->TEKPPI.x);
1027 GetNthNum(Temp, 2, (int far *) &ts->TEKPPI.y);
1028
1029 // Show "Window" menu -- special option
1030 ts->MenuFlag |=
1031 MF_SHOWWINMENU * GetOnOff(Section, "WindowMenu", FName, TRUE);
1032
1033 /* XMODEM log -- special option */
1034 ts->LogFlag |= LOG_X * GetOnOff(Section, "XmodemLog", FName, FALSE);
1035
1036 /* YMODEM log -- special option */
1037 ts->LogFlag |= LOG_Y * GetOnOff(Section, "YmodemLog", FName, FALSE);
1038
1039 /* Auto ZMODEM activation -- special option */
1040 ts->FTFlag |= FT_ZAUTO * GetOnOff(Section, "ZmodemAuto", FName, FALSE);
1041
1042 /* ZMODEM data subpacket length for sending -- special */
1043 ts->ZmodemDataLen =
1044 GetPrivateProfileInt(Section, "ZmodemDataLen", 1024, FName);
1045 /* ZMODEM window size for sending -- special */
1046 ts->ZmodemWinSize =
1047 GetPrivateProfileInt(Section, "ZmodemWinSize", 32767, FName);
1048
1049 /* ZMODEM ESCCTL flag -- special option */
1050 ts->FTFlag |=
1051 FT_ZESCCTL * GetOnOff(Section, "ZmodemEscCtl", FName, FALSE);
1052
1053 /* ZMODEM log -- special option */
1054 ts->LogFlag |= LOG_Z * GetOnOff(Section, "ZmodemLog", FName, FALSE);
1055
1056 /* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */
1057 GetPrivateProfileString(Section, "ZModemRcvCommand", "rz",
1058 ts->ZModemRcvCommand, sizeof(ts->ZModemRcvCommand), FName);
1059
1060 #ifndef NO_COPYLINE_FIX
1061
1062 /* Enable continued-line copy -- special option */
1063 ts->EnableContinuedLineCopy =
1064 GetOnOff(Section, "EnableContinuedLineCopy", FName, FALSE);
1065 #endif /* NO_COPYLINE_FIX */
1066
1067 ts->DisablePasteMouseRButton =
1068 GetOnOff(Section, "DisablePasteMouseRButton", FName, FALSE);
1069
1070 // added DisablePasteMouseMButton (2008.3.2 maya)
1071 ts->DisablePasteMouseMButton =
1072 GetOnOff(Section, "DisablePasteMouseMButton", FName, TRUE);
1073
1074 // added ConfirmPasteMouseRButton (2007.3.17 maya)
1075 ts->ConfirmPasteMouseRButton =
1076 GetOnOff(Section, "ConfirmPasteMouseRButton", FName, FALSE);
1077
1078 // added ConfirmChangePaste (2008.2.3 yutaka)
1079 ts->ConfirmChangePaste =
1080 GetOnOff(Section, "ConfirmChangePaste", FName, FALSE);
1081
1082 // added ScrollWindowClearScreen (2008.5.3 yutaka)
1083 ts->ScrollWindowClearScreen =
1084 GetOnOff(Section, "ScrollWindowClearScreen", FName, TRUE);
1085
1086 // added SelectOnlyByLButton (2007.11.20 maya)
1087 ts->SelectOnlyByLButton =
1088 GetOnOff(Section, "SelectOnlyByLButton", FName, TRUE);
1089
1090 // added DisableAcceleratorSendBreak (2007.3.17 maya)
1091 ts->DisableAcceleratorSendBreak =
1092 GetOnOff(Section, "DisableAcceleratorSendBreak", FName, FALSE);
1093
1094 // WinSock connecting timeout value (2007.1.11 yutaka)
1095 ts->ConnectingTimeout =
1096 GetPrivateProfileInt(Section, "ConnectingTimeout", 0, FName);
1097
1098 // mouse cursor
1099 GetPrivateProfileString(Section, "MouseCursor", "IBEAM",
1100 Temp, sizeof(Temp), FName);
1101 strncpy_s(ts->MouseCursorName, sizeof(ts->MouseCursorName), Temp,
1102 _TRUNCATE);
1103
1104 // Translucent window
1105 ts->AlphaBlend =
1106 GetPrivateProfileInt(Section, "AlphaBlend ", 255, FName);
1107 ts->AlphaBlend = max(0, ts->AlphaBlend);
1108 ts->AlphaBlend = min(255, ts->AlphaBlend);
1109
1110 // Cygwin install path
1111 GetPrivateProfileString(Section, "CygwinDirectory ", "c:\\cygwin",
1112 Temp, sizeof(Temp), FName);
1113 strncpy_s(ts->CygwinDirectory, sizeof(ts->CygwinDirectory), Temp,
1114 _TRUNCATE);
1115
1116 // Viewlog Editor path
1117 GetPrivateProfileString(Section, "ViewlogEditor ", "notepad.exe",
1118 Temp, sizeof(Temp), FName);
1119 strncpy_s(ts->ViewlogEditor, sizeof(ts->ViewlogEditor), Temp,
1120 _TRUNCATE);
1121
1122 // Locale for UTF-8
1123 GetPrivateProfileString(Section, "Locale ", DEFAULT_LOCALE,
1124 Temp, sizeof(Temp), FName);
1125 strncpy_s(ts->Locale, sizeof(ts->Locale), Temp, _TRUNCATE);
1126
1127 // CodePage
1128 ts->CodePage =
1129 GetPrivateProfileInt(Section, "CodePage ", DEFAULT_CODEPAGE,
1130 FName);
1131
1132 // UI language message file
1133 GetPrivateProfileString(Section, "UILanguageFile", "lang\\Default.lng",
1134 Temp, sizeof(Temp), FName);
1135 {
1136 char CurDir[MAX_PATH];
1137
1138 // �t���p�X�������O������������������������������
1139 strncpy_s(ts->UILanguageFile_ini, sizeof(ts->UILanguageFile_ini), Temp, _TRUNCATE);
1140
1141 GetCurrentDirectory(sizeof(CurDir), CurDir);
1142 SetCurrentDirectory(ts->HomeDir);
1143 _fullpath(ts->UILanguageFile, Temp, sizeof(ts->UILanguageFile));
1144 SetCurrentDirectory(CurDir);
1145 }
1146
1147 // Broadcast Command History (2007.3.3 maya)
1148 ts->BroadcastCommandHistory =
1149 GetOnOff(Section, "BroadcastCommandHistory", FName, FALSE);
1150
1151 // 337: 2007/03/20 Accept Broadcast
1152 ts->AcceptBroadcast =
1153 GetOnOff(Section, "AcceptBroadcast", FName, TRUE);
1154
1155 // Confirm send a file when drag and drop (2007.12.28 maya)
1156 ts->ConfirmFileDragAndDrop =
1157 GetOnOff(Section, "ConfirmFileDragAndDrop", FName, TRUE);
1158
1159 // Translate mouse wheel to cursor key when application cursor mode
1160 ts->TranslateWheelToCursor =
1161 GetOnOff(Section, "TranslateWheelToCursor", FName, TRUE);
1162
1163 // Display "New Connection" dialog on startup (2008.1.18 maya)
1164 ts->HostDialogOnStartup =
1165 GetOnOff(Section, "HostDialogOnStartup", FName, TRUE);
1166
1167 // Mouse event tracking
1168 ts->MouseEventTracking =
1169 GetOnOff(Section, "MouseEventTracking", FName, TRUE);
1170
1171 // Maximized bug tweak
1172 ts->MaximizedBugTweak =
1173 GetOnOff(Section, "MaximizedBugTweak", FName, TRUE);
1174
1175 // Convert Unicode symbol characters to DEC Special characters
1176 ts->UnicodeDecSpMapping =
1177 GetPrivateProfileInt(Section, "UnicodeToDecSpMapping", 3, FName);
1178
1179 // VT Window Icon
1180 GetPrivateProfileString(Section, "VTIcon", "Default",
1181 Temp, sizeof(Temp), FName);
1182 ts->VTIcon = IconName2IconId(Temp);
1183
1184 // Tek Window Icon
1185 GetPrivateProfileString(Section, "TEKIcon", "Default",
1186 Temp, sizeof(Temp), FName);
1187 ts->TEKIcon = IconName2IconId(Temp);
1188
1189 // Unknown Unicode Character
1190 ts->UnknownUnicodeCharaAsWide =
1191 GetOnOff(Section, "UnknownUnicodeCharacterAsWide", FName, FALSE);
1192
1193 #ifdef USE_NORMAL_BGCOLOR
1194 // UseNormalBGColor
1195 ts->UseNormalBGColor =
1196 GetOnOff(Section, "UseNormalBGColor", FName, FALSE);
1197 // 2006/03/11 by 337
1198 if (ts->UseNormalBGColor) {
1199 ts->VTBoldColor[1] =
1200 ts->VTBlinkColor[1] = ts->URLColor[1] = ts->VTColor[1];
1201 }
1202 #endif
1203
1204 // AutoScrollOnlyInBottomLine
1205 ts->AutoScrollOnlyInBottomLine =
1206 GetOnOff(Section, "AutoScrollOnlyInBottomLine", FName, FALSE);
1207
1208 // Accept remote-controlled window title changing
1209 GetPrivateProfileString(Section, "AcceptTitleChangeRequest", "overwrite",
1210 Temp, sizeof(Temp), FName);
1211 if (_stricmp(Temp, "overwrite") == 0 || _stricmp(Temp, "on") == 0)
1212 ts->AcceptTitleChangeRequest = IdTitleChangeRequestOverwrite;
1213 else if (_stricmp(Temp, "ahead") == 0)
1214 ts->AcceptTitleChangeRequest = IdTitleChangeRequestAhead;
1215 else if (_stricmp(Temp, "last") == 0)
1216 ts->AcceptTitleChangeRequest = IdTitleChangeRequestLast;
1217 else
1218 ts->AcceptTitleChangeRequest = IdTitleChangeRequestOff;
1219
1220 // Size of paste confirm dialog
1221 GetPrivateProfileString(Section, "PasteDialogSize", "330,220",
1222 Temp, sizeof(Temp), FName);
1223 GetNthNum(Temp, 1, &ts->PasteDialogSize.cx);
1224 GetNthNum(Temp, 2, &ts->PasteDialogSize.cy);
1225 if (ts->PasteDialogSize.cx < 0)
1226 ts->PasteDialogSize.cx = 330;
1227 if (ts->PasteDialogSize.cy < 0)
1228 ts->PasteDialogSize.cy = 220;
1229
1230 // Disable mouse event tracking when Control-Key is pressed.
1231 ts->DisableMouseTrackingByCtrl =
1232 GetOnOff(Section, "DisableMouseTrackingByCtrl", FName, FALSE);
1233
1234 // Disable TranslateWheelToCursor setting when Control-Key is pressed.
1235 ts->DisableWheelToCursorByCtrl =
1236 GetOnOff(Section, "DisableWheelToCursorByCtrl", FName, FALSE);
1237
1238 // Strict Key Mapping.
1239 ts->StrictKeyMapping =
1240 GetOnOff(Section, "StrictKeyMapping", FName, FALSE);
1241 }
1242
1243 void FAR PASCAL WriteIniFile(PCHAR FName, PTTSet ts)
1244 {
1245 int i;
1246 char Temp[MAXPATHLEN];
1247 char buf[20];
1248
1249 /* version */
1250 WritePrivateProfileString(Section, "Version", "2.3", FName);
1251
1252 /* Language */
1253 if (ts->Language == IdJapanese)
1254 strncpy_s(Temp, sizeof(Temp), "Japanese", _TRUNCATE);
1255 else if (ts->Language == IdRussian)
1256 strncpy_s(Temp, sizeof(Temp), "Russian", _TRUNCATE);
1257 else if (ts->Language == IdKorean) //HKS
1258 strncpy_s(Temp, sizeof(Temp), "Korean", _TRUNCATE);
1259 else
1260 strncpy_s(Temp, sizeof(Temp), "English", _TRUNCATE);
1261 WritePrivateProfileString(Section, "Language", Temp, FName);
1262
1263 /* Port type */
1264 if (ts->PortType == IdSerial)
1265 strncpy_s(Temp, sizeof(Temp), "serial", _TRUNCATE);
1266 else /* IdFile -> IdTCPIP */
1267 strncpy_s(Temp, sizeof(Temp), "tcpip", _TRUNCATE);
1268
1269 WritePrivateProfileString(Section, "Port", Temp, FName);
1270
1271 /* Save win position */
1272 if (ts->SaveVTWinPos) {
1273 /* VT win position */
1274 WriteInt2(Section, "VTPos", FName, ts->VTPos.x, ts->VTPos.y);
1275 }
1276
1277 /* VT terminal size */
1278 WriteInt2(Section, "TerminalSize", FName,
1279 ts->TerminalWidth, ts->TerminalHeight);
1280
1281 /* Terminal size = Window size */
1282 WriteOnOff(Section, "TermIsWin", FName, ts->TermIsWin);
1283
1284 /* Auto window resize flag */
1285 WriteOnOff(Section, "AutoWinResize", FName, ts->AutoWinResize);
1286
1287 /* CR Receive */
1288 if (ts->CRReceive == IdCRLF) {
1289 strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1290 }
1291 else if (ts->CRReceive == IdLF) {
1292 strncpy_s(Temp, sizeof(Temp), "LF", _TRUNCATE);
1293 }
1294 else {
1295 strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1296 }
1297 WritePrivateProfileString(Section, "CRReceive", Temp, FName);
1298
1299 /* CR Send */
1300 if (ts->CRSend == IdCRLF)
1301 strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1302 else
1303 strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1304 WritePrivateProfileString(Section, "CRSend", Temp, FName);
1305
1306 /* Local echo */
1307 WriteOnOff(Section, "LocalEcho", FName, ts->LocalEcho);
1308
1309 /* Answerback */
1310 if ((ts->FTFlag & FT_BPAUTO) == 0) {
1311 Str2Hex(ts->Answerback, Temp, ts->AnswerbackLen,
1312 sizeof(Temp) - 1, TRUE);
1313 WritePrivateProfileString(Section, "Answerback", Temp, FName);
1314 }
1315
1316 /* Kanji Code (receive) */
1317 switch (ts->KanjiCode) {
1318 case IdEUC:
1319 strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1320 break;
1321 case IdJIS:
1322 strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1323 break;
1324 case IdUTF8:
1325 strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1326 break;
1327 case IdUTF8m:
1328 strncpy_s(Temp, sizeof(Temp), "UTF-8m", _TRUNCATE);
1329 break;
1330 default:
1331 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1332 }
1333 WritePrivateProfileString(Section, "KanjiReceive", Temp, FName);
1334
1335 /* Katakana (receive) */
1336 if (ts->JIS7Katakana == 1)
1337 strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1338 else
1339 strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1340
1341 WritePrivateProfileString(Section, "KatakanaReceive", Temp, FName);
1342
1343 /* Kanji Code (transmit) */
1344 switch (ts->KanjiCodeSend) {
1345 case IdEUC:
1346 strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1347 break;
1348 case IdJIS:
1349 strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1350 break;
1351 case IdUTF8:
1352 strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1353 break;
1354 default:
1355 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1356 }
1357 WritePrivateProfileString(Section, "KanjiSend", Temp, FName);
1358
1359 /* Katakana (transmit) */
1360 if (ts->JIS7KatakanaSend == 1)
1361 strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1362 else
1363 strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1364
1365 WritePrivateProfileString(Section, "KatakanaSend", Temp, FName);
1366
1367 /* KanjiIn */
1368 if (ts->KanjiIn == IdKanjiInA)
1369 strncpy_s(Temp, sizeof(Temp), "@", _TRUNCATE);
1370 else
1371 strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
1372
1373 WritePrivateProfileString(Section, "KanjiIn", Temp, FName);
1374
1375 /* KanjiOut */
1376 switch (ts->KanjiOut) {
1377 case IdKanjiOutB:
1378 strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
1379 break;
1380 case IdKanjiOutH:
1381 strncpy_s(Temp, sizeof(Temp), "H", _TRUNCATE);
1382 break;
1383 default:
1384 strncpy_s(Temp, sizeof(Temp), "J", _TRUNCATE);
1385 }
1386 WritePrivateProfileString(Section, "KanjiOut", Temp, FName);
1387
1388 // new configuration
1389 WriteInt(Section, "ConnectingTimeout", FName, ts->ConnectingTimeout);
1390
1391 WriteOnOff(Section, "DisablePasteMouseRButton", FName,
1392 ts->DisablePasteMouseRButton);
1393
1394 // added DisablePasteMouseMButton (2008.3.2 maya)
1395 WriteOnOff(Section, "DisablePasteMouseMButton", FName,
1396 ts->DisablePasteMouseMButton);
1397
1398 // added ConfirmPasteMouseRButton (2007.3.17 maya)
1399 WriteOnOff(Section, "ConfirmPasteMouseRButton", FName,
1400 ts->ConfirmPasteMouseRButton);
1401
1402 // added ConfirmChangePaste
1403 WriteOnOff(Section, "ConfirmChangePaste", FName,
1404 ts->ConfirmChangePaste);
1405
1406 // added ScrollWindowClearScreen
1407 WriteOnOff(Section, "ScrollWindowClearScreen", FName,
1408 ts->ScrollWindowClearScreen);
1409
1410 // added SelectOnlyByLButton (2007.11.20 maya)
1411 WriteOnOff(Section, "SelectOnlyByLButton", FName,
1412 ts->SelectOnlyByLButton);
1413 // added DisableAcceleratorSendBreak (2007.3.17 maya)
1414 WriteOnOff(Section, "DisableAcceleratorSendBreak", FName,
1415 ts->DisableAcceleratorSendBreak);
1416 WriteOnOff(Section, "EnableContinuedLineCopy", FName,
1417 ts->EnableContinuedLineCopy);
1418 WritePrivateProfileString(Section, "MouseCursor", ts->MouseCursorName,
1419 FName);
1420 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->AlphaBlend);
1421 WritePrivateProfileString(Section, "AlphaBlend", Temp, FName);
1422 WritePrivateProfileString(Section, "CygwinDirectory",
1423 ts->CygwinDirectory, FName);
1424 WritePrivateProfileString(Section, "ViewlogEditor", ts->ViewlogEditor,
1425 FName);
1426 WritePrivateProfileString(Section, "Locale", ts->Locale, FName);
1427 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->CodePage);
1428 WritePrivateProfileString(Section, "CodePage", Temp, FName);
1429
1430 // ANSI color(2004.9.5 yutaka)
1431 Temp[0] = '\0';
1432 for (i = 0; i < 15; i++) {
1433 _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d, ",
1434 i,
1435 GetRValue(ts->ANSIColor[i]),
1436 GetGValue(ts->ANSIColor[i]),
1437 GetBValue(ts->ANSIColor[i])
1438 );
1439 strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
1440 }
1441 i = 15;
1442 _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d",
1443 i,
1444 GetRValue(ts->ANSIColor[i]),
1445 GetGValue(ts->ANSIColor[i]),
1446 GetBValue(ts->ANSIColor[i])
1447 );
1448 strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
1449 WritePrivateProfileString(Section, "ANSIColor", Temp, FName);
1450
1451 /* AutoWinChange VT<->TEK */
1452 WriteOnOff(Section, "AutoWinSwitch", FName, ts->AutoWinSwitch);
1453
1454 /* Terminal ID */
1455 id2str(TermList, ts->TerminalID, IdVT100, Temp, sizeof(Temp));
1456 WritePrivateProfileString(Section, "TerminalID", Temp, FName);
1457
1458 /* Russian character set (host) */
1459 id2str(RussList, ts->RussHost, IdKOI8, Temp, sizeof(Temp));
1460 WritePrivateProfileString(Section, "RussHost", Temp, FName);
1461
1462 /* Russian character set (client) */
1463 id2str(RussList, ts->RussClient, IdWindows, Temp, sizeof(Temp));
1464 WritePrivateProfileString(Section, "RussClient", Temp, FName);
1465
1466 /* Title text */
1467 WritePrivateProfileString(Section, "Title", ts->Title, FName);
1468
1469 /* Cursor shape */
1470 switch (ts->CursorShape) {
1471 case IdVCur:
1472 strncpy_s(Temp, sizeof(Temp), "vertical", _TRUNCATE);
1473 break;
1474 case IdHCur:
1475 strncpy_s(Temp, sizeof(Temp), "horizontal", _TRUNCATE);
1476 break;
1477 default:
1478 strncpy_s(Temp, sizeof(Temp), "block", _TRUNCATE);
1479 }
1480 WritePrivateProfileString(Section, "CursorShape", Temp, FName);
1481
1482 /* Hide title */
1483 WriteOnOff(Section, "HideTitle", FName, ts->HideTitle);
1484
1485 /* Popup menu */
1486 WriteOnOff(Section, "PopupMenu", FName, ts->PopupMenu);
1487
1488 /* PC-Style bold color mapping */
1489 WriteOnOff(Section, "PcBoldColor", FName,
1490 (WORD) (ts->ColorFlag & CF_PCBOLD16));
1491
1492 /* aixterm 16 colors mode */
1493 WriteOnOff(Section, "Aixterm16Color", FName,
1494 (WORD) (ts->ColorFlag & CF_AIXTERM16));
1495
1496 /* xterm 256 colors mode */
1497 WriteOnOff(Section, "Xterm256Color", FName,
1498 (WORD) (ts->ColorFlag & CF_XTERM256));
1499
1500 /* Enable scroll buffer */
1501 WriteOnOff(Section, "EnableScrollBuff", FName, ts->EnableScrollBuff);
1502
1503 /* Scroll buffer size */
1504 WriteInt(Section, "ScrollBuffSize", FName, ts->ScrollBuffSize);
1505
1506 /* VT Color */
1507 for (i = 0; i <= 1; i++) {
1508 ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
1509 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
1510 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
1511 }
1512 WriteInt6(Section, "VTColor", FName,
1513 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1514 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1515
1516 /* VT Bold Color */
1517 for (i = 0; i <= 1; i++) {
1518 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[i]);
1519 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[i]);
1520 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[i]);
1521 }
1522 WriteInt6(Section, "VTBoldColor", FName,
1523 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1524 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1525
1526 /* VT Blink Color */
1527 for (i = 0; i <= 1; i++) {
1528 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[i]);
1529 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[i]);
1530 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[i]);
1531 }
1532 WriteInt6(Section, "VTBlinkColor", FName,
1533 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1534 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1535
1536 /* VT Reverse Color */
1537 for (i = 0; i <= 1; i++) {
1538 ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
1539 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
1540 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
1541 }
1542 WriteInt6(Section, "VTBlinkColor", FName,
1543 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1544 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1545
1546 /* start - ishizaki */
1547 WriteOnOff(Section, "EnableClickableUrl", FName,
1548 ts->EnableClickableUrl);
1549
1550 /* URL color */
1551 for (i = 0; i <= 1; i++) {
1552 ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[i]);
1553 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[i]);
1554 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[i]);
1555 }
1556 WriteInt6(Section, "URLColor", FName,
1557 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1558 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1559 /* end - ishizaki */
1560
1561 /* TEK Color */
1562 for (i = 0; i <= 1; i++) {
1563 ts->TmpColor[0][i * 3] = GetRValue(ts->TEKColor[i]);
1564 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->TEKColor[i]);
1565 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->TEKColor[i]);
1566 }
1567 WriteInt6(Section, "TEKColor", FName,
1568 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1569 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1570
1571 /* TEK color emulation */
1572 WriteOnOff(Section, "TEKColorEmulation", FName, ts->TEKColorEmu);
1573
1574 /* VT Font */
1575 WriteFont(Section, "VTFont", FName,
1576 ts->VTFont, ts->VTFontSize.x, ts->VTFontSize.y,
1577 ts->VTFontCharSet);
1578
1579 /* Enable bold font flag */
1580 WriteOnOff(Section, "EnableBold", FName, ts->EnableBold);
1581
1582 /* Russian character set (font) */
1583 id2str(RussList, ts->RussFont, IdWindows, Temp, sizeof(Temp));
1584 WritePrivateProfileString(Section, "RussFont", Temp, FName);
1585
1586 /* TEK Font */
1587 WriteFont(Section, "TEKFont", FName,
1588 ts->TEKFont, ts->TEKFontSize.x, ts->TEKFontSize.y,
1589 ts->TEKFontCharSet);
1590
1591 /* BS key */
1592 if (ts->BSKey == IdDEL)
1593 strncpy_s(Temp, sizeof(Temp), "DEL", _TRUNCATE);
1594 else
1595 strncpy_s(Temp, sizeof(Temp), "BS", _TRUNCATE);
1596 WritePrivateProfileString(Section, "BSKey", Temp, FName);
1597
1598 /* Delete key */
1599 WriteOnOff(Section, "DeleteKey", FName, ts->DelKey);
1600
1601 /* Meta key */
1602 WriteOnOff(Section, "MetaKey", FName, ts->MetaKey);
1603
1604 /* Application Keypad */
1605 WriteOnOff(Section, "DisableAppKeypad", FName, ts->DisableAppKeypad);
1606
1607 /* Application Cursor */
1608 WriteOnOff(Section, "DisableAppCursor", FName, ts->DisableAppCursor);
1609
1610 /* Russian keyboard type */
1611 id2str(RussList2, ts->RussKeyb, IdWindows, Temp, sizeof(Temp));
1612 WritePrivateProfileString(Section, "RussKeyb", Temp, FName);
1613
1614 /* Serial port ID */
1615 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->ComPort);
1616 WritePrivateProfileString(Section, "ComPort", Temp, FName);
1617
1618 /* Baud rate */
1619 id2str(BaudList, ts->Baud, IdBaud9600, Temp, sizeof(Temp));
1620 WritePrivateProfileString(Section, "BaudRate", Temp, FName);
1621
1622 /* Parity */
1623 switch (ts->Parity) {
1624 case IdParityEven:
1625 strncpy_s(Temp, sizeof(Temp), "even", _TRUNCATE);
1626 break;
1627 case IdParityOdd:
1628 strncpy_s(Temp, sizeof(Temp), "odd", _TRUNCATE);
1629 break;
1630 default:
1631 strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
1632 }
1633 WritePrivateProfileString(Section, "Parity", Temp, FName);
1634
1635 /* Data bit */
1636 if (ts->DataBit == IdDataBit7)
1637 strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1638 else
1639 strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1640
1641 WritePrivateProfileString(Section, "DataBit", Temp, FName);
1642
1643 /* Stop bit */
1644 if (ts->StopBit == IdStopBit2)
1645 strncpy_s(Temp, sizeof(Temp), "2", _TRUNCATE);
1646 else
1647 strncpy_s(Temp, sizeof(Temp), "1", _TRUNCATE);
1648
1649 WritePrivateProfileString(Section, "StopBit", Temp, FName);
1650
1651 /* Flow control */
1652 switch (ts->Flow) {
1653 case IdFlowX:
1654 strncpy_s(Temp, sizeof(Temp), "x", _TRUNCATE);
1655 break;
1656 case IdFlowHard:
1657 strncpy_s(Temp, sizeof(Temp), "hard", _TRUNCATE);
1658 break;
1659 default:
1660 strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
1661 }
1662 WritePrivateProfileString(Section, "FlowCtrl", Temp, FName);
1663
1664 /* Delay per character */
1665 WriteInt(Section, "DelayPerChar", FName, ts->DelayPerChar);
1666
1667 /* Delay per line */
1668 WriteInt(Section, "DelayPerLine", FName, ts->DelayPerLine);
1669
1670 /* Telnet flag */
1671 WriteOnOff(Section, "Telnet", FName, ts->Telnet);
1672
1673 /* Telnet terminal type */
1674 WritePrivateProfileString(Section, "TermType", ts->TermType, FName);
1675
1676 /* TCP port num for non-telnet */
1677 WriteUint(Section, "TCPPort", FName, ts->TCPPort);
1678
1679 /* Auto close flag */
1680 WriteOnOff(Section, "AutoWinClose", FName, ts->AutoWinClose);
1681
1682 /* History list */
1683 WriteOnOff(Section, "Historylist", FName, ts->HistoryList);
1684
1685 /* File transfer binary flag */
1686 WriteOnOff(Section, "TransBin", FName, ts->TransBin);
1687
1688 /* Log append */
1689 WriteOnOff(Section, "LogAppend", FName, ts->Append);
1690
1691 /* File transfer binary flag */
1692 WriteOnOff(Section, "LogTypePlainText", FName, ts->LogTypePlainText);
1693
1694 /* Log with timestamp (2006.7.23 maya) */
1695 WriteOnOff(Section, "LogTimestamp", FName, ts->LogTimestamp);
1696
1697 /* Log without transfer dialog */
1698 WriteOnOff(Section, "LogHideDialog", FName, ts->LogHideDialog);
1699
1700 /* Default Log file name (2006.8.28 maya) */
1701 WritePrivateProfileString(Section, "LogDefaultName",
1702 ts->LogDefaultName, FName);
1703
1704 /* Default Log file path (2007.5.30 maya) */
1705 WritePrivateProfileString(Section, "LogDefaultPath",
1706 ts->LogDefaultPath, FName);
1707
1708 /* Auto start logging (2007.5.31 maya) */
1709 WriteOnOff(Section, "LogAutoStart", FName, ts->LogAutoStart);
1710
1711 /* XMODEM option */
1712 switch (ts->XmodemOpt) {
1713 case XoptCRC:
1714 strncpy_s(Temp, sizeof(Temp), "crc", _TRUNCATE);
1715 break;
1716 case Xopt1K:
1717 strncpy_s(Temp, sizeof(Temp), "1k", _TRUNCATE);
1718 break;
1719 default:
1720 strncpy_s(Temp, sizeof(Temp), "checksum", _TRUNCATE);
1721 }
1722 WritePrivateProfileString(Section, "XmodemOpt", Temp, FName);
1723
1724 /* XMODEM binary flag */
1725 WriteOnOff(Section, "XmodemBin", FName, ts->XmodemBin);
1726
1727 /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
1728 WritePrivateProfileString(Section, "XmodemRcvCommand",
1729 ts->XModemRcvCommand, FName);
1730
1731 /* Default directory for file transfer */
1732 WritePrivateProfileString(Section, "FileDir", ts->FileDir, FName);
1733
1734 /* filter on file send (2007.6.5 maya) */
1735 WritePrivateProfileString(Section, "FileSendFilter",
1736 ts->FileSendFilter, FName);
1737
1738 /*------------------------------------------------------------------*/
1739 /* 8 bit control code flag -- special option */
1740 WriteOnOff(Section, "Accept8BitCtrl", FName,
1741 (WORD) (ts->TermFlag & TF_ACCEPT8BITCTRL));
1742
1743 /* Wrong sequence flag -- special option */
1744 WriteOnOff(Section, "AllowWrongSequence", FName,
1745 (WORD) (ts->TermFlag & TF_ALLOWWRONGSEQUENCE));
1746
1747 /* Auto file renaming --- special option */
1748 WriteOnOff(Section, "AutoFileRename", FName,
1749 (WORD) (ts->FTFlag & FT_RENAME));
1750
1751 /* Auto text copy --- special option */
1752 WriteOnOff(Section, "AutoTextCopy", FName, ts->AutoTextCopy);
1753
1754 /* Back wrap -- special option */
1755 WriteOnOff(Section, "BackWrap", FName,
1756 (WORD) (ts->TermFlag & TF_BACKWRAP));
1757
1758 /* Beep type -- special option */
1759 WriteOnOff(Section, "Beep", FName, ts->Beep);
1760 switch (ts->Beep) {
1761 case IdBeepOff:
1762 WritePrivateProfileString(Section, "Beep", "Off", FName);
1763 break;
1764 case IdBeepOn:
1765 WritePrivateProfileString(Section, "Beep", "On", FName);
1766 break;
1767 case IdBeepVisual:
1768 WritePrivateProfileString(Section, "Beep", "Visual", FName);
1769 break;
1770 }
1771
1772 /* Beep on connection & disconnection -- special option */
1773 WriteOnOff(Section, "BeepOnConnect", FName,
1774 (WORD) (ts->PortFlag & PF_BEEPONCONNECT));
1775
1776 /* Auto B-Plus activation -- special option */
1777 WriteOnOff(Section, "BPAuto", FName, (WORD) (ts->FTFlag & FT_BPAUTO));
1778
1779 /* B-Plus ESCCTL flag -- special option */
1780 WriteOnOff(Section, "BPEscCtl", FName,
1781 (WORD) (ts->FTFlag & FT_BPESCCTL));
1782
1783 /* B-Plus log -- special option */
1784 WriteOnOff(Section, "BPLog", FName, (WORD) (ts->LogFlag & LOG_BP));
1785
1786 /* Clear serial port buffer when port opening -- special option */
1787 WriteOnOff(Section, "ClearComBuffOnOpen", FName, ts->ClearComBuffOnOpen);
1788
1789 /* Confirm disconnection -- special option */
1790 WriteOnOff(Section, "ConfirmDisconnect", FName,
1791 (WORD) (ts->PortFlag & PF_CONFIRMDISCONN));
1792
1793 /* Ctrl code in Kanji -- special option */
1794 WriteOnOff(Section, "CtrlInKanji", FName,
1795 (WORD) (ts->TermFlag & TF_CTRLINKANJI));
1796
1797 /* Debug flag -- special option */
1798 WriteOnOff(Section, "Debug", FName, ts->Debug);
1799
1800 /* Delimiter list -- special option */
1801 Str2Hex(ts->DelimList, Temp, strlen(ts->DelimList),
1802 sizeof(Temp) - 1, TRUE);
1803 WritePrivateProfileString(Section, "DelimList", Temp, FName);
1804
1805 /* regard DBCS characters as delimiters -- special option */
1806 WriteOnOff(Section, "DelimDBCS", FName, ts->DelimDBCS);
1807
1808 // Enable popup menu -- special option
1809 if ((ts->MenuFlag & MF_NOPOPUP) == 0)
1810 WriteOnOff(Section, "EnablePopupMenu", FName, 1);
1811 else
1812 WriteOnOff(Section, "EnablePopupMenu", FName, 0);
1813
1814 // Enable "Show menu" -- special option
1815 if ((ts->MenuFlag & MF_NOSHOWMENU) == 0)
1816 WriteOnOff(Section, "EnableShowMenu", FName, 1);
1817 else
1818 WriteOnOff(Section, "EnableShowMenu", FName, 0);
1819
1820 /* Enable the status line -- special option */
1821 WriteOnOff(Section, "EnableStatusLine", FName,
1822 (WORD) (ts->TermFlag & TF_ENABLESLINE));
1823
1824 /* IME Flag -- special option */
1825 WriteOnOff(Section, "IME", FName, ts->UseIME);
1826
1827 /* IME-inline Flag -- special option */
1828 WriteOnOff(Section, "IMEInline", FName, ts->IMEInline);
1829
1830 /* Kermit log -- special option */
1831 WriteOnOff(Section, "KmtLog", FName, (WORD) (ts->LogFlag & LOG_KMT));
1832
1833 // Enable language selection -- special option
1834 if ((ts->MenuFlag & MF_NOLANGUAGE) == 0)
1835 WriteOnOff(Section, "LanguageSelection", FName, 1);
1836 else
1837 WriteOnOff(Section, "LanguageSelection", FName, 0);
1838
1839 /* Maximum scroll buffer size -- special option */
1840 WriteInt(Section, "MaxBuffSize", FName, ts->ScrollBuffMax);
1841
1842 /* Max com port number -- special option */
1843 WriteInt(Section, "MaxComPort", FName, ts->MaxComPort);
1844
1845 /* Non-blinking cursor -- special option */
1846 WriteOnOff(Section, "NonblinkingCursor", FName, ts->NonblinkingCursor);
1847
1848 WriteOnOff(Section, "KillFocusCursor", FName, ts->KillFocusCursor);
1849
1850 /* Delay for pass-thru printing activation */
1851 /* -- special option */
1852 WriteUint(Section, "PassThruDelay", FName, ts->PassThruDelay);
1853
1854 /* Printer port for pass-thru printing */
1855 /* -- special option */
1856 WritePrivateProfileString(Section, "PassThruPort", ts->PrnDev, FName);
1857
1858 /* Printer Font --- special option */
1859 WriteFont(Section, "PrnFont", FName,
1860 ts->PrnFont, ts->PrnFontSize.x, ts->PrnFontSize.y,
1861 ts->PrnFontCharSet);
1862
1863 // Page margins (left, right, top, bottom) for printing
1864 // -- special option
1865 WriteInt4(Section, "PrnMargin", FName,
1866 ts->PrnMargin[0], ts->PrnMargin[1],
1867 ts->PrnMargin[2], ts->PrnMargin[3]);
1868
1869 /* Quick-VAN log -- special option */
1870 WriteOnOff(Section, "QVLog", FName, (WORD) (ts->LogFlag & LOG_QV));
1871
1872 /* Quick-VAN window size -- special */
1873 WriteInt(Section, "QVWinSize", FName, ts->QVWinSize);
1874
1875 /* Russian character set (print) -- special option */
1876 id2str(RussList, ts->RussPrint, IdWindows, Temp, sizeof(Temp));
1877 WritePrivateProfileString(Section, "RussPrint", Temp, FName);
1878
1879 /* Scroll threshold -- special option */
1880 WriteInt(Section, "ScrollThreshold", FName, ts->ScrollThreshold);
1881
1882 WriteInt(Section, "MouseWheelScrollLine", FName, ts->MouseWheelScrollLine);
1883
1884 // Select on activate -- special option
1885 WriteOnOff(Section, "SelectOnActivate", FName, ts->SelOnActive);
1886
1887 /* Send 8bit control sequence -- special option */
1888 WriteOnOff(Section, "Send8BitCtrl", FName, ts->Send8BitCtrl);
1889
1890 /* Startup macro -- special option */
1891 WritePrivateProfileString(Section, "StartupMacro", ts->MacroFN, FName);
1892
1893 /* TEK GIN Mouse keycode -- special option */
1894 WriteInt(Section, "TEKGINMouseCode", FName, ts->GINMouseCode);
1895
1896 /* Telnet Auto Detect -- special option */
1897 WriteOnOff(Section, "TelAutoDetect", FName, ts->TelAutoDetect);
1898
1899 /* Telnet binary flag -- special option */
1900 WriteOnOff(Section, "TelBin", FName, ts->TelBin);
1901
1902 /* Telnet Echo flag -- special option */
1903 WriteOnOff(Section, "TelEcho", FName, ts->TelEcho);
1904
1905 /* Telnet log -- special option */
1906 WriteOnOff(Section, "TelLog", FName, (WORD) (ts->LogFlag & LOG_TEL));
1907
1908 /* TCP port num for telnet -- special option */
1909 WriteUint(Section, "TelPort", FName, ts->TelPort);
1910
1911 /* Telnet keep-alive packet(NOP command) interval -- special option */
1912 WriteUint(Section, "TelKeepAliveInterval", FName,
1913 ts->TelKeepAliveInterval);
1914
1915 /* Max number of broadcast commad history */
1916 WriteUint(Section, "MaxBroadcatHistory", FName,
1917 ts->MaxBroadcatHistory);
1918
1919 /* Local echo for non-telnet */
1920 WriteOnOff(Section, "TCPLocalEcho", FName, ts->TCPLocalEcho);
1921
1922 /* "new-line (transmit)" option for non-telnet -- special option */
1923 if (ts->TCPCRSend == IdCRLF)
1924 strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1925 else if (ts->TCPCRSend == IdCR)
1926 strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1927 else
1928 Temp[0] = 0;
1929 WritePrivateProfileString(Section, "TCPCRSend", Temp, FName);
1930
1931 /* Use text (background) color for "white (black)"
1932 --- special option */
1933 WriteOnOff(Section, "UseTextColor", FName,
1934 (WORD) (ts->ColorFlag & CF_USETEXTCOLOR));
1935
1936 /* Title format -- special option */
1937 WriteUint(Section, "TitleFormat", FName, ts->TitleFormat);
1938
1939 /* VT Compatible Tab -- special option */
1940 WriteOnOff(Section, "VTCompatTab", FName, ts->VTCompatTab);
1941
1942 /* VT Font space --- special option */
1943 WriteInt4(Section, "VTFontSpace", FName,
1944 ts->FontDX, ts->FontDW - ts->FontDX,
1945 ts->FontDY, ts->FontDH - ts->FontDY);
1946
1947 // VT-print scaling factors (pixels per inch) --- special option
1948 WriteInt2(Section, "VTPPI", FName, ts->VTPPI.x, ts->VTPPI.y);
1949
1950 // TEK-print scaling factors (pixels per inch) --- special option
1951 WriteInt2(Section, "TEKPPI", FName, ts->TEKPPI.x, ts->TEKPPI.y);
1952
1953 // Show "Window" menu -- special option
1954 WriteOnOff(Section, "WindowMenu", FName,
1955 (WORD) (ts->MenuFlag & MF_SHOWWINMENU));
1956
1957 /* XMODEM log -- special option */
1958 WriteOnOff(Section, "XmodemLog", FName, (WORD) (ts->LogFlag & LOG_X));
1959
1960 /* YMODEM log -- special option */
1961 WriteOnOff(Section, "YmodemLog", FName, (WORD) (ts->LogFlag & LOG_Y));
1962
1963 /* Auto ZMODEM activation -- special option */
1964 WriteOnOff(Section, "ZmodemAuto", FName,
1965 (WORD) (ts->FTFlag & FT_ZAUTO));
1966
1967 /* ZMODEM data subpacket length for sending -- special */
1968 WriteInt(Section, "ZmodemDataLen", FName, ts->ZmodemDataLen);
1969 /* ZMODEM window size for sending -- special */
1970 WriteInt(Section, "ZmodemWinSize", FName, ts->ZmodemWinSize);
1971
1972 /* ZMODEM ESCCTL flag -- special option */
1973 WriteOnOff(Section, "ZmodemEscCtl", FName,
1974 (WORD) (ts->FTFlag & FT_ZESCCTL));
1975
1976 /* ZMODEM log -- special option */
1977 WriteOnOff(Section, "ZmodemLog", FName, (WORD) (ts->LogFlag & LOG_Z));
1978
1979 /* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */
1980 WritePrivateProfileString(Section, "ZmodemRcvCommand", ts->ZModemRcvCommand, FName);
1981
1982 /* update file */
1983 WritePrivateProfileString(NULL, NULL, NULL, FName);
1984
1985 // Eterm lookfeel alphablend (2005.4.24 yutaka)
1986 #define ETERM_SECTION "BG"
1987 WriteOnOff(ETERM_SECTION, "BGEnable", FName,
1988 ts->EtermLookfeel.BGEnable);
1989 WriteOnOff(ETERM_SECTION, "BGUseAlphaBlendAPI", FName,
1990 ts->EtermLookfeel.BGUseAlphaBlendAPI);
1991 WritePrivateProfileString(ETERM_SECTION, "BGSPIPath",
1992 ts->EtermLookfeel.BGSPIPath, FName);
1993 WriteOnOff(ETERM_SECTION, "BGFastSizeMove", FName,
1994 ts->EtermLookfeel.BGFastSizeMove);
1995 WriteOnOff(ETERM_SECTION, "BGFlickerlessMove", FName,
1996 ts->EtermLookfeel.BGNoCopyBits);
1997 WriteOnOff(ETERM_SECTION, "BGNoFrame", FName,
1998 ts->EtermLookfeel.BGNoFrame);
1999 WritePrivateProfileString(ETERM_SECTION, "BGThemeFile",
2000 ts->EtermLookfeel.BGThemeFile, FName);
2001
2002 #ifdef USE_NORMAL_BGCOLOR
2003 // UseNormalBGColor
2004 WriteOnOff(Section, "UseNormalBGColor", FName, ts->UseNormalBGColor);
2005 #endif
2006
2007 // UI language message file
2008 WritePrivateProfileString(Section, "UILanguageFile",
2009 ts->UILanguageFile_ini, FName);
2010
2011 // Broadcast Command History (2007.3.3 maya)
2012 WriteOnOff(Section, "BroadcastCommandHistory", FName,
2013 ts->BroadcastCommandHistory);
2014
2015 // 337: 2007/03/20 Accept Broadcast
2016 WriteOnOff(Section, "AcceptBroadcast", FName, ts->AcceptBroadcast);
2017
2018 // Confirm send a file when drag and drop (2007.12.28 maya)
2019 WriteOnOff(Section, "ConfirmFileDragAndDrop", FName,
2020 ts->ConfirmFileDragAndDrop);
2021
2022 // Translate mouse wheel to cursor key when application cursor mode
2023 WriteOnOff(Section, "TranslateWheelToCursor", FName,
2024 ts->TranslateWheelToCursor);
2025
2026 // Display "New Connection" dialog on startup (2008.1.18 maya)
2027 WriteOnOff(Section, "HostDialogOnStartup", FName,
2028 ts->HostDialogOnStartup);
2029
2030 // Mouse event tracking
2031 WriteOnOff(Section, "MouseEventTracking", FName,
2032 ts->MouseEventTracking);
2033
2034 // Maximized bug tweak
2035 WriteOnOff(Section, "MaximizedBugTweak", FName, ts->MaximizedBugTweak);
2036
2037 // Convert Unicode symbol characters to DEC Special characters
2038 WriteUint(Section, "UnicodeToDecSpMapping", FName, ts->UnicodeDecSpMapping);
2039
2040 // VT Window Icon
2041 IconId2IconName(Temp, sizeof(Temp), ts->VTIcon);
2042 WritePrivateProfileString(Section, "VTIcon", Temp, FName);
2043
2044 // Tek Window Icon
2045 IconId2IconName(Temp, sizeof(Temp), ts->TEKIcon);
2046 WritePrivateProfileString(Section, "TEKIcon", Temp, FName);
2047
2048 // AutoScrollOnlyInBottomLine
2049 WriteOnOff(Section, "AutoScrollOnlyInBottomLine", FName,
2050 ts->AutoScrollOnlyInBottomLine);
2051
2052 // Unknown Unicode Character
2053 WriteOnOff(Section, "UnknownUnicodeCharacterAsWide", FName,
2054 ts->UnknownUnicodeCharaAsWide);
2055
2056 // Accept remote-controlled window title changing
2057 if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestOff)
2058 strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
2059 else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestOverwrite)
2060 strncpy_s(Temp, sizeof(Temp), "overwrite", _TRUNCATE);
2061 else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestAhead)
2062 strncpy_s(Temp, sizeof(Temp), "ahead", _TRUNCATE);
2063 else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestLast)
2064 strncpy_s(Temp, sizeof(Temp), "last", _TRUNCATE);
2065 else
2066 Temp[0] = 0;
2067 WritePrivateProfileString(Section, "AcceptTitleChangeRequest", Temp, FName);
2068
2069 // Size of paste confirm dialog
2070 WriteInt2(Section, "PasteDialogSize", FName,
2071 ts->PasteDialogSize.cx, ts->PasteDialogSize.cy);
2072
2073 // Disable mouse event tracking when Control-Key is pressed.
2074 WriteOnOff(Section, "DisableMouseTrackingByCtrl", FName,
2075 ts->DisableMouseTrackingByCtrl);
2076
2077 // Disable TranslateWHeelToCursor when Control-Key is pressed.
2078 WriteOnOff(Section, "DisableWheelToCursorByCtrl", FName,
2079 ts->DisableWheelToCursorByCtrl);
2080
2081 // Strict Key Mapping.
2082 WriteOnOff(Section, "StrictKeyMapping", FName,
2083 ts->StrictKeyMapping);
2084 }
2085
2086 #define VTEditor "VT editor keypad"
2087 #define VTNumeric "VT numeric keypad"
2088 #define VTFunction "VT function keys"
2089 #define XFunction "X function keys"
2090 #define ShortCut "Shortcut keys"
2091
2092 void GetInt(PKeyMap KeyMap, int KeyId, PCHAR Sect, PCHAR Key, PCHAR FName)
2093 {
2094 char Temp[11];
2095 WORD Num;
2096
2097 GetPrivateProfileString(Sect, Key, "", Temp, sizeof(Temp), FName);
2098 if (Temp[0] == 0)
2099 Num = 0xFFFF;
2100 else if (_stricmp(Temp, "off") == 0)
2101 Num = 0xFFFF;
2102 else if (sscanf(Temp, "%d", &Num) != 1)
2103 Num = 0xFFFF;
2104
2105 KeyMap->Map[KeyId - 1] = Num;
2106 }
2107
2108 void FAR PASCAL ReadKeyboardCnf
2109 (PCHAR FName, PKeyMap KeyMap, BOOL ShowWarning) {
2110 int i, j, Ptr;
2111 char EntName[7];
2112 char TempStr[221];
2113 char KStr[201];
2114
2115 // clear key map
2116 for (i = 0; i <= IdKeyMax - 1; i++)
2117 KeyMap->Map[i] = 0xFFFF;
2118 for (i = 0; i <= NumOfUserKey - 1; i++) {
2119 KeyMap->UserKeyPtr[i] = 0;
2120 KeyMap->UserKeyLen[i] = 0;
2121 }
2122
2123 // VT editor keypad
2124 GetInt(KeyMap, IdUp, VTEditor, "Up", FName);
2125
2126 GetInt(KeyMap, IdDown, VTEditor, "Down", FName);
2127
2128 GetInt(KeyMap, IdRight, VTEditor, "Right", FName);
2129
2130 GetInt(KeyMap, IdLeft, VTEditor, "Left", FName);
2131
2132 GetInt(KeyMap, IdFind, VTEditor, "Find", FName);
2133
2134 GetInt(KeyMap, IdInsert, VTEditor, "Insert", FName);
2135
2136 GetInt(KeyMap, IdRemove, VTEditor, "Remove", FName);
2137
2138 GetInt(KeyMap, IdSelect, VTEditor, "Select", FName);
2139
2140 GetInt(KeyMap, IdPrev, VTEditor, "Prev", FName);
2141
2142 GetInt(KeyMap, IdNext, VTEditor, "Next", FName);
2143
2144 // VT numeric keypad
2145 GetInt(KeyMap, Id0, VTNumeric, "Num0", FName);
2146
2147 GetInt(KeyMap, Id1, VTNumeric, "Num1", FName);
2148
2149 GetInt(KeyMap, Id2, VTNumeric, "Num2", FName);
2150
2151 GetInt(KeyMap, Id3, VTNumeric, "Num3", FName);
2152
2153 GetInt(KeyMap, Id4, VTNumeric, "Num4", FName);
2154
2155 GetInt(KeyMap, Id5, VTNumeric, "Num5", FName);
2156
2157 GetInt(KeyMap, Id6, VTNumeric, "Num6", FName);
2158
2159 GetInt(KeyMap, Id7, VTNumeric, "Num7", FName);
2160
2161 GetInt(KeyMap, Id8, VTNumeric, "Num8", FName);
2162
2163 GetInt(KeyMap, Id9, VTNumeric, "Num9", FName);
2164
2165 GetInt(KeyMap, IdMinus, VTNumeric, "NumMinus", FName);
2166
2167 GetInt(KeyMap, IdComma, VTNumeric, "NumComma", FName);
2168
2169 GetInt(KeyMap, IdPeriod, VTNumeric, "NumPeriod", FName);
2170
2171 GetInt(KeyMap, IdEnter, VTNumeric, "NumEnter", FName);
2172
2173 GetInt(KeyMap, IdSlash, VTNumeric, "NumSlash", FName);
2174
2175 GetInt(KeyMap, IdAsterisk, VTNumeric, "NumAsterisk", FName);
2176
2177 GetInt(KeyMap, IdPlus, VTNumeric, "NumPlus", FName);
2178
2179 GetInt(KeyMap, IdPF1, VTNumeric, "PF1", FName);
2180
2181 GetInt(KeyMap, IdPF2, VTNumeric, "PF2", FName);
2182
2183 GetInt(KeyMap, IdPF3, VTNumeric, "PF3", FName);
2184
2185 GetInt(KeyMap, IdPF4, VTNumeric, "PF4", FName);
2186
2187 // VT function keys
2188 GetInt(KeyMap, IdHold, VTFunction, "Hold", FName);
2189
2190 GetInt(KeyMap, IdPrint, VTFunction, "Print", FName);
2191
2192 GetInt(KeyMap, IdBreak, VTFunction, "Break", FName);
2193
2194 GetInt(KeyMap, IdF6, VTFunction, "F6", FName);
2195
2196 GetInt(KeyMap, IdF7, VTFunction, "F7", FName);
2197
2198 GetInt(KeyMap, IdF8, VTFunction, "F8", FName);
2199
2200 GetInt(KeyMap, IdF9, VTFunction, "F9", FName);
2201
2202 GetInt(KeyMap, IdF10, VTFunction, "F10", FName);
2203
2204 GetInt(KeyMap, IdF11, VTFunction, "F11", FName);
2205
2206 GetInt(KeyMap, IdF12, VTFunction, "F12", FName);
2207
2208 GetInt(KeyMap, IdF13, VTFunction, "F13", FName);
2209
2210 GetInt(KeyMap, IdF14, VTFunction, "F14", FName);
2211
2212 GetInt(KeyMap, IdHelp, VTFunction, "Help", FName);
2213
2214 GetInt(KeyMap, IdDo, VTFunction, "Do", FName);
2215
2216 GetInt(KeyMap, IdF17, VTFunction, "F17", FName);
2217
2218 GetInt(KeyMap, IdF18, VTFunction, "F18", FName);
2219
2220 GetInt(KeyMap, IdF19, VTFunction, "F19", FName);
2221
2222 GetInt(KeyMap, IdF20, VTFunction, "F20", FName);
2223
2224 // UDK
2225 GetInt(KeyMap, IdUDK6, VTFunction, "UDK6", FName);
2226
2227 GetInt(KeyMap, IdUDK7, VTFunction, "UDK7", FName);
2228
2229 GetInt(KeyMap, IdUDK8, VTFunction, "UDK8", FName);
2230
2231 GetInt(KeyMap, IdUDK9, VTFunction, "UDK9", FName);
2232
2233 GetInt(KeyMap, IdUDK10, VTFunction, "UDK10", FName);
2234
2235 GetInt(KeyMap, IdUDK11, VTFunction, "UDK11", FName);
2236
2237 GetInt(KeyMap, IdUDK12, VTFunction, "UDK12", FName);
2238
2239 GetInt(KeyMap, IdUDK13, VTFunction, "UDK13", FName);
2240
2241 GetInt(KeyMap, IdUDK14, VTFunction, "UDK14", FName);
2242
2243 GetInt(KeyMap, IdUDK15, VTFunction, "UDK15", FName);
2244
2245 GetInt(KeyMap, IdUDK16, VTFunction, "UDK16", FName);
2246
2247 GetInt(KeyMap, IdUDK17, VTFunction, "UDK17", FName);
2248
2249 GetInt(KeyMap, IdUDK18, VTFunction, "UDK18", FName);
2250
2251 GetInt(KeyMap, IdUDK19, VTFunction, "UDK19", FName);
2252
2253 GetInt(KeyMap, IdUDK20, VTFunction, "UDK20", FName);
2254
2255 // XTERM function keys
2256 GetInt(KeyMap, IdXF1, XFunction, "XF1", FName);
2257
2258 GetInt(KeyMap, IdXF2, XFunction, "XF2", FName);
2259
2260 GetInt(KeyMap, IdXF3, XFunction, "XF3", FName);
2261
2262 GetInt(KeyMap, IdXF4, XFunction, "XF4", FName);
2263
2264 GetInt(KeyMap, IdXF5, XFunction, "XF5", FName);
2265
2266 // accelerator keys
2267 GetInt(KeyMap, IdCmdEditCopy, ShortCut, "EditCopy", FName);
2268
2269 GetInt(KeyMap, IdCmdEditPaste, ShortCut, "EditPaste", FName);
2270
2271 GetInt(KeyMap, IdCmdEditPasteCR, ShortCut, "EditPasteCR", FName);
2272
2273 GetInt(KeyMap, IdCmdEditCLS, ShortCut, "EditCLS", FName);
2274
2275 GetInt(KeyMap, IdCmdEditCLB, ShortCut, "EditCLB", FName);
2276
2277 GetInt(KeyMap, IdCmdCtrlOpenTEK, ShortCut, "ControlOpenTEK", FName);
2278
2279 GetInt(KeyMap, IdCmdCtrlCloseTEK, ShortCut, "ControlCloseTEK", FName);
2280
2281 GetInt(KeyMap, IdCmdLineUp, ShortCut, "LineUp", FName);
2282
2283 GetInt(KeyMap, IdCmdLineDown, ShortCut, "LineDown", FName);
2284
2285 GetInt(KeyMap, IdCmdPageUp, ShortCut, "PageUp", FName);
2286
2287 GetInt(KeyMap, IdCmdPageDown, ShortCut, "PageDown", FName);
2288
2289 GetInt(KeyMap, IdCmdBuffTop, ShortCut, "BuffTop", FName);
2290
2291 GetInt(KeyMap, IdCmdBuffBottom, ShortCut, "BuffBottom", FName);
2292
2293 GetInt(KeyMap, IdCmdNextWin, ShortCut, "NextWin", FName);
2294
2295 GetInt(KeyMap, IdCmdPrevWin, ShortCut, "PrevWin", FName);
2296
2297 GetInt(KeyMap, IdCmdLocalEcho, ShortCut, "LocalEcho", FName);
2298
2299 GetInt(KeyMap, IdScrollLock, ShortCut, "ScrollLock", FName);
2300
2301 /* user keys */
2302
2303 Ptr = 0;
2304
2305 i = IdUser1;
2306 do {
2307 _snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "User%d", i - IdUser1 + 1);
2308 GetPrivateProfileString("User keys", EntName, "",
2309 TempStr, sizeof(TempStr), FName);
2310 if (strlen(TempStr) > 0) {
2311 /* scan code */
2312 GetNthString(TempStr, 1, sizeof(KStr), KStr);
2313 if (_stricmp(KStr, "off") == 0)
2314 KeyMap->Map[i - 1] = 0xFFFF;
2315 else {
2316 GetNthNum(TempStr, 1, &j);
2317 KeyMap->Map[i - 1] = (WORD) j;
2318 }
2319 /* conversion flag */
2320 GetNthNum(TempStr, 2, &j);
2321 KeyMap->UserKeyType[i - IdUser1] = (BYTE) j;
2322 /* key string */
2323 /* GetNthString(TempStr,3,sizeof(KStr),KStr); */
2324 KeyMap->UserKeyPtr[i - IdUser1] = Ptr;
2325 /* KeyMap->UserKeyLen[i-IdUser1] =
2326 Hex2Str(KStr,&(KeyMap->UserKeyStr[Ptr]),KeyStrMax-Ptr+1);
2327 */
2328 GetNthString(TempStr, 3, KeyStrMax - Ptr + 1,
2329 &(KeyMap->UserKeyStr[Ptr]));
2330 KeyMap->UserKeyLen[i - IdUser1] =
2331 strlen(&(KeyMap->UserKeyStr[Ptr]));
2332 Ptr = Ptr + KeyMap->UserKeyLen[i - IdUser1];
2333 }
2334
2335 i++;
2336 }
2337 while ((i <= IdKeyMax) && (strlen(TempStr) > 0) && (Ptr <= KeyStrMax));
2338
2339 for (j = 1; j <= IdKeyMax - 1; j++)
2340 if (KeyMap->Map[j] != 0xFFFF)
2341 for (i = 0; i <= j - 1; i++)
2342 if (KeyMap->Map[i] == KeyMap->Map[j]) {
2343 if (ShowWarning) {
2344 _snprintf_s(TempStr, sizeof(TempStr), _TRUNCATE,
2345 "Keycode %d is used more than once",
2346 KeyMap->Map[j]);
2347 MessageBox(0, TempStr,
2348 "Tera Term: Error in keyboard setup file",
2349 MB_ICONEXCLAMATION);
2350 }
2351 KeyMap->Map[i] = 0xFFFF;
2352 }
2353 }
2354
2355 void FAR PASCAL CopySerialList(PCHAR IniSrc, PCHAR IniDest, PCHAR section,
2356 PCHAR key, int MaxList)
2357 {
2358 int i;
2359 char EntName[10];
2360 char TempHost[HostNameMaxLength + 1];
2361
2362 if (_stricmp(IniSrc, IniDest) == 0)
2363 return;
2364
2365 WritePrivateProfileString(section, NULL, NULL, IniDest);
2366
2367 i = 1;
2368 do {
2369 _snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "%s%i", key, i);
2370
2371 /* Get one hostname from file IniSrc */
2372 GetPrivateProfileString(section, EntName, "",
2373 TempHost, sizeof(TempHost), IniSrc);
2374 /* Copy it to the file IniDest */
2375 if (strlen(TempHost) > 0)
2376 WritePrivateProfileString(section, EntName, TempHost, IniDest);
2377 i++;
2378 }
2379 while ((i <= MaxList) && (strlen(TempHost) > 0));
2380
2381 /* update file */
2382 WritePrivateProfileString(NULL, NULL, NULL, IniDest);
2383 }
2384
2385 void FAR PASCAL AddValueToList(PCHAR FName, PCHAR Host, PCHAR section,
2386 PCHAR key, int MaxList)
2387 {
2388 HANDLE MemH;
2389 PCHAR MemP;
2390 char EntName[13];
2391 int i, j, Len;
2392 BOOL Update;
2393
2394 if ((FName[0] == 0) || (Host[0] == 0))
2395 return;
2396 MemH = GlobalAlloc(GHND, (HostNameMaxLength + 1) * MaxList);
2397 if (MemH == NULL)
2398 return;
2399 MemP = GlobalLock(MemH);
2400 if (MemP != NULL) {
2401 strncpy_s(MemP, (HostNameMaxLength + 1) * MaxList, Host, _TRUNCATE);
2402 j = strlen(Host) + 1;
2403 i = 1;
2404 Update = TRUE;
2405 do {
2406 _snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "%s%i", key, i);
2407
2408 /* Get a hostname */
2409 GetPrivateProfileString(section, EntName, "",
2410 &MemP[j], HostNameMaxLength + 1,
2411 FName);
2412 Len = strlen(&MemP[j]);
2413 if (_stricmp(&MemP[j], Host) == 0) {
2414 if (i == 1)
2415 Update = FALSE;
2416 }
2417 else
2418 j = j + Len + 1;
2419 i++;
2420 } while ((i <= MaxList) && (Len != 0) && Update);
2421
2422 if (Update) {
2423 WritePrivateProfileString(section, NULL, NULL, FName);
2424
2425 j = 0;
2426 i = 1;
2427 do {
2428 _snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "%s%i", key, i);
2429
2430 if (MemP[j] != 0)
2431 WritePrivateProfileString(section, EntName, &MemP[j],
2432 FName);
2433 j = j + strlen(&MemP[j]) + 1;
2434 i++;
2435 } while ((i <= MaxList) && (MemP[j] != 0));
2436 /* update file */
2437 WritePrivateProfileString(NULL, NULL, NULL, FName);
2438 }
2439 GlobalUnlock(MemH);
2440 }
2441 GlobalFree(MemH);
2442 }
2443
2444 /* copy hostlist from source IniFile to dest IniFile */
2445 void FAR PASCAL CopyHostList(PCHAR IniSrc, PCHAR IniDest)
2446 {
2447 CopySerialList(IniSrc, IniDest, "Hosts", "Host", MAXHOSTLIST);
2448 }
2449
2450 void FAR PASCAL AddHostToList(PCHAR FName, PCHAR Host)
2451 {
2452 AddValueToList(FName, Host, "Hosts", "Host", MAXHOSTLIST);
2453 }
2454
2455 BOOL NextParam(PCHAR Param, int *i, PCHAR Temp, int Size)
2456 {
2457 int j;
2458 char c;
2459 BOOL Quoted;
2460
2461 if ((unsigned int) (*i) >= strlen(Param))
2462 return FALSE;
2463 j = 0;
2464
2465 while (Param[*i] == ' ')
2466 (*i)++;
2467
2468 Quoted = FALSE;
2469 c = Param[*i];
2470 (*i)++;
2471 while ((c != 0) && (Quoted || (c != ' ')) &&
2472 (Quoted || (c != ';')) && (j < Size - 1)) {
2473 if (c == '"')
2474 Quoted = !Quoted;
2475 Temp[j] = c;
2476 j++;
2477 c = Param[*i];
2478 (*i)++;
2479 }
2480 if (!Quoted && (c == ';'))
2481 (*i)--;
2482
2483 Temp[j] = 0;
2484 return (strlen(Temp) > 0);
2485 }
2486
2487 void Dequote(PCHAR Source, PCHAR Dest)
2488 {
2489 int i, j;
2490 char q, c;
2491
2492 Dest[0] = 0;
2493 if (Source[0] == 0)
2494 return;
2495 i = 0;
2496 /* quoting char */
2497 q = Source[i];
2498 /* only '"' is used as quoting char */
2499 if (q != '"')
2500 q = 0;
2501 else
2502 i++;
2503
2504 c = Source[i];
2505 i++;
2506 j = 0;
2507 while ((c != 0) && (c != q)) {
2508 Dest[j] = c;
2509 j++;
2510 c = Source[i];
2511 i++;
2512 }
2513
2514 Dest[j] = 0;
2515 }
2516
2517
2518 #ifndef NO_INET6
2519 static void ParseHostName(char *HostStr, WORD * port)
2520 {
2521 /*
2522 * hostname.domain.com
2523 * hostname.domain.com:23
2524 * [3ffe:1234:1234::1] IPv6 raw address
2525 * [3ffe:1234:1234::1]:23 IPv6 raw address and port#
2526 * telnet://hostname.domain.com/
2527 * telnet://hostname.domain.com:23/
2528 * telnet://[3ffe:1234:1234::1]/
2529 * telnet://[3ffe:1234:1234::1]:23/
2530 * tn3270:// .... /
2531 */
2532
2533 int i, is_telnet_handler = 0, is_port = 0;
2534 char *s;
2535 char b;
2536
2537 /* strlen("telnet://") == 9 */
2538 if ((_strnicmp(HostStr, "telnet://", 9) == 0) ||
2539 (_strnicmp(HostStr, "tn3270://", 9) == 0)) {
2540 /* trim "telnet://" and tail "/" */
2541 memmove(HostStr, &(HostStr[9]), strlen(HostStr) - 8);
2542 i = strlen(HostStr);
2543 if (i > 0 && (HostStr[i - 1] == '/'))
2544 HostStr[i - 1] = '\0';
2545 is_telnet_handler = 1;
2546 }
2547
2548 /* parsing string enclosed by [ ] */
2549 s = HostStr;
2550 if (*s == '[') {
2551 BOOL inet6found = FALSE;
2552 s++;
2553 while (*s) {
2554 if (*s == ']') {
2555 /* found IPv6 raw address */
2556 /* triming [ ] */
2557 int len = strlen(HostStr);
2558 char *lastptr = &HostStr[len - 1];
2559 memmove(HostStr, HostStr + 1, len - 1);
2560 s = s - 1;
2561 lastptr = lastptr - 1;
2562 memmove(s, s + 1, lastptr - s);
2563 /* because of triming 2 characters */
2564 HostStr[len - 2] = '\0';
2565
2566
2567 inet6found = TRUE;
2568 break;
2569 }
2570 s++;
2571 }
2572 if (inet6found == FALSE)
2573 s = HostStr;
2574 }
2575
2576 /* parsing port# */
2577 /*
2578 * s points:
2579 * [3ffe:1234:1234::1]:XXX....
2580 * 3ffe:1234:1234::1:XXX....
2581 * |
2582 * s
2583 *
2584 * hostname.domain.com
2585 * |
2586 * s
2587 */
2588 i = 0;
2589 do {
2590 b = s[i];
2591 i++;
2592 } while (b != '\0' && b != ':');
2593 if (b == ':') {
2594 s[i - 1] = '\0';
2595 if (sscanf(&(s[i]), "%d", port) != 1)
2596 *port = 65535;
2597 is_port = 1;
2598 }
2599 if (is_telnet_handler == 1 && is_port == 0) {
2600 *port = 23;
2601 }
2602 }
2603 #endif /* NO_INET6 */
2604
2605
2606 void FAR PASCAL ParseParam(PCHAR Param, PTTSet ts, PCHAR DDETopic)
2607 {
2608 int i, pos, c;
2609 #ifdef NO_INET6
2610 BYTE b;
2611 #endif /* NO_INET6 */
2612 char Temp[MAXPATHLEN + 3];
2613 char Temp2[MAXPATHLEN];
2614 char TempDir[MAXPATHLEN];
2615 WORD ParamPort = 0;
2616 WORD ParamCom = 0;
2617 WORD ParamTCP = 65535;
2618 WORD ParamTel = 2;
2619 WORD ParamBin = 2;
2620 WORD ParamBaud = IdBaudNone;
2621 BOOL HostNameFlag = FALSE;
2622 BOOL JustAfterHost = FALSE;
2623 WORD DisableTCPEchoCR = FALSE;
2624
2625 ts->HostName[0] = 0;
2626 ts->KeyCnfFN[0] = 0;
2627 /* Set AutoConnect true as default (2008.2.16 by steven)*/
2628 ts->ComAutoConnect = TRUE;
2629
2630 #ifndef NO_INET6
2631 /* user specifies the protocol connecting to the host */
2632 /* ts->ProtocolFamily = AF_UNSPEC; */
2633 #endif /* NO_INET6 */
2634
2635 /* Get command line parameters */
2636 if (DDETopic != NULL)
2637 DDETopic[0] = 0;
2638 i = 0;
2639 /* the first term shuld be executable filename of Tera Term */
2640 NextParam(Param, &i, Temp, sizeof(Temp));
2641 while (NextParam(Param, &i, Temp, sizeof(Temp))) {
2642 if (HostNameFlag) {
2643 JustAfterHost = TRUE;
2644 HostNameFlag = FALSE;
2645 }
2646
2647 if (_strnicmp(Temp, "/BAUD=", 6) == 0) { /* Serial port baud rate */
2648 ParamPort = IdSerial;
2649 ParamBaud = str2id(BaudList, &Temp[6], IdBaudNone);
2650 }
2651 else if (_strnicmp(Temp, "/B", 2) == 0) { /* telnet binary */
2652 ParamPort = IdTCPIP;
2653 ParamBin = 1;
2654 }
2655 else if (_strnicmp(Temp, "/C=", 3) == 0) { /* COM port num */
2656 ParamPort = IdSerial;
2657 ParamCom = atoi(&Temp[3]);
2658 if ((ParamCom < 1) || (ParamCom > ts->MaxComPort))
2659 ParamCom = 0;
2660 }
2661 else if (_strnicmp(Temp, "/D=", 3) == 0) {
2662 if (DDETopic != NULL)
2663 strncpy_s(DDETopic, 21, &Temp[3], _TRUNCATE); // 21 = sizeof(TopicName)
2664 }
2665 // "New connection" �_�C�A���O���\�������� (2008.11.14 maya)
2666 else if (_strnicmp(Temp, "/DS", 3) == 0) {
2667 ts->HostDialogOnStartup = FALSE;
2668 }
2669 // TCPLocalEcho/TCPCRSend ������������ (maya 2007.4.25)
2670 else if (_strnicmp(Temp, "/E", 2) == 0) {
2671 DisableTCPEchoCR = TRUE;
2672 }
2673 else if (_strnicmp(Temp, "/F=", 3) == 0) { /* setup filename */
2674 Dequote(&Temp[3], Temp2);
2675 if (strlen(Temp2) > 0) {
2676 ConvFName(ts->HomeDir, Temp2, sizeof(Temp2), ".INI", Temp,
2677 sizeof(Temp));
2678 if (_stricmp(ts->SetupFName, Temp) != 0) {
2679 strncpy_s(ts->SetupFName, sizeof(ts->SetupFName), Temp,
2680 _TRUNCATE);
2681 ReadIniFile(ts->SetupFName, ts);
2682 }
2683 }
2684 }
2685 else if (_strnicmp(Temp, "/FD=", 4) == 0) { /* file transfer directory */
2686 Dequote(&Temp[4], Temp2);
2687 if (strlen(Temp2) > 0) {
2688 _getcwd(TempDir, sizeof(TempDir));
2689 if (_chdir(Temp2) == 0)
2690 strncpy_s(ts->FileDir, sizeof(ts->FileDir), Temp2,
2691 _TRUNCATE);
2692 _chdir(TempDir);
2693 }
2694 }
2695 else if (_strnicmp(Temp, "/H", 2) == 0) /* hide title bar */
2696 ts->HideTitle = 1;
2697 else if (_strnicmp(Temp, "/I", 2) == 0) /* iconize */
2698 ts->Minimize = 1;
2699 else if (_strnicmp(Temp, "/K=", 3) == 0) { /* Keyboard setup file */
2700 Dequote(&Temp[3], Temp2);
2701 ConvFName(ts->HomeDir, Temp2, sizeof(Temp2), ".CNF",
2702 ts->KeyCnfFN, sizeof(ts->KeyCnfFN));
2703 }
2704 else if ((_strnicmp(Temp, "/KR=", 4) == 0) ||
2705 (_strnicmp(Temp, "/KT=", 4) == 0)) { /* kanji code */
2706 if (_strnicmp(&Temp[4], "UTF8m", 5) == 0 ||
2707 _strnicmp(&Temp[4], "UTF-8m", 6) == 0)
2708 c = IdUTF8m;
2709 else if (_strnicmp(&Temp[4], "UTF8", 4) == 0 ||
2710 _strnicmp(&Temp[4], "UTF-8", 5) == 0)
2711 c = IdUTF8;
2712 else if (_strnicmp(&Temp[4], "SJIS", 4) == 0)
2713 c = IdSJIS;
2714 else if (_strnicmp(&Temp[4], "EUC", 3) == 0)
2715 c = IdEUC;
2716 else if (_strnicmp(&Temp[4], "JIS", 3) == 0)
2717 c = IdJIS;
2718 else
2719 c = -1;
2720 if (c != -1) {
2721 if (_strnicmp(Temp, "/KR=", 4) == 0)
2722 ts->KanjiCode = c;
2723 else
2724 ts->KanjiCodeSend = c;
2725 }
2726 }
2727 else if (_strnicmp(Temp, "/L=", 3) == 0) { /* log file */
2728 Dequote(&Temp[3], Temp2);
2729 strncpy_s(ts->LogFN, sizeof(ts->LogFN), Temp2, _TRUNCATE);
2730 }
2731 else if (_strnicmp(Temp, "/LA=", 4) == 0) { /* language */
2732 if (_strnicmp(&Temp[4], "E", 1) == 0)
2733 ts->Language = IdEnglish;
2734 else if (_strnicmp(&Temp[4], "J", 1) == 0)
2735 ts->Language = IdJapanese;
2736 else if (_strnicmp(&Temp[4], "R", 1) == 0)
2737 ts->Language = IdRussian;
2738 }
2739 else if (_strnicmp(Temp, "/M=", 3) == 0) { /* macro filename */
2740 if ((Temp[3] == 0) || (Temp[3] == '*'))
2741 strncpy_s(ts->MacroFN, sizeof(ts->MacroFN), "*",
2742 _TRUNCATE);
2743 else {
2744 Dequote(&Temp[3], Temp2);
2745 ConvFName(ts->HomeDir, Temp2, sizeof(Temp2), ".TTL",
2746 ts->MacroFN, sizeof(ts->MacroFN));
2747 }
2748 /* Disable auto connect to serial when macro mode (2006.9.15 maya) */
2749 ts->ComAutoConnect = FALSE;
2750 }
2751 else if (_strnicmp(Temp, "/M", 2) == 0) { /* macro option without file name */
2752 strncpy_s(ts->MacroFN, sizeof(ts->MacroFN), "*", _TRUNCATE);
2753 /* Disable auto connect to serial when macro mode (2006.9.15 maya) */
2754 ts->ComAutoConnect = FALSE;
2755 }
2756 else if (_strnicmp(Temp, "/P=", 3) == 0) { /* TCP port num */
2757 ParamPort = IdTCPIP;
2758 if (sscanf(&Temp[3], "%d", &ParamTCP) != 1)
2759 ParamTCP = 65535;
2760 }
2761 else if (_strnicmp(Temp, "/R=", 3) == 0) { /* Replay filename */
2762 Dequote(&Temp[3], Temp2);
2763 ConvFName(ts->HomeDir, Temp2, sizeof(Temp2), "", ts->HostName,
2764 sizeof(ts->HostName));
2765 if (strlen(ts->HostName) > 0)
2766 ParamPort = IdFile;
2767 }
2768 else if (_strnicmp(Temp, "/T=0", 4) == 0) { /* telnet disable */
2769 ParamPort = IdTCPIP;
2770 ParamTel = 0;
2771 }
2772 else if (_strnicmp(Temp, "/T=1", 4) == 0) { /* telnet enable */
2773 ParamPort = IdTCPIP;
2774 ParamTel = 1;
2775 }
2776 else if (_strnicmp(Temp, "/TEKICON=", 9) == 0) { /* Tek window icon */
2777 ts->TEKIcon = IconName2IconId(&Temp[9]);
2778 }
2779 else if (_strnicmp(Temp, "/VTICON=", 8) == 0) { /* VT window icon */
2780 ts->VTIcon = IconName2IconId(&Temp[8]);
2781 }
2782 else if (_strnicmp(Temp, "/V", 2) == 0) { /* invisible */
2783 ts->HideWindow = 1;
2784 }
2785 else if (_strnicmp(Temp, "/W=", 3) == 0) { /* Window title */
2786 Dequote(&Temp[3], ts->Title);
2787 }
2788 else if (_strnicmp(Temp, "/X=", 3) == 0) { /* Window pos (X) */
2789 if (sscanf(&Temp[3], "%d", &pos) == 1) {
2790 ts->VTPos.x = pos;
2791 if (ts->VTPos.y == CW_USEDEFAULT)
2792 ts->VTPos.y = 0;
2793 }
2794 }
2795 else if (_strnicmp(Temp, "/Y=", 3) == 0) { /* Window pos (Y) */
2796 if (sscanf(&Temp[3], "%d", &pos) == 1) {
2797 ts->VTPos.y = pos;
2798 if (ts->VTPos.x == CW_USEDEFAULT)
2799 ts->VTPos.x = 0;
2800 }
2801 }
2802 #ifndef NO_INET6
2803 else if (_strnicmp(Temp, "/4", 2) == 0) /* Protocol Tera Term speaking */
2804 ts->ProtocolFamily = AF_INET;
2805 else if (_strnicmp(Temp, "/6", 2) == 0)
2806 ts->ProtocolFamily = AF_INET6;
2807 #endif
2808 else if (_strnicmp(Temp, "/DUPLICATE", 9) == 0) { // duplicate session (2004.12.7. yutaka)
2809 ts->DuplicateSession = 1;
2810
2811 }
2812 else if (_strnicmp(Temp, "/TIMEOUT=", 9) == 0) { // Connecting Timeout value (2007.1.11. yutaka)
2813 if (sscanf(&Temp[9], "%d", &pos) == 1) {
2814 if (pos >= 0)
2815 ts->ConnectingTimeout = pos;
2816 }
2817
2818 }
2819 else if ((Temp[0] != '/') && (strlen(Temp) > 0)) {
2820 if (JustAfterHost && (sscanf(Temp, "%d", &c) == 1))
2821 ParamTCP = c;
2822 else {
2823 ParamPort = IdTCPIP;
2824 strncpy_s(ts->HostName, sizeof(ts->HostName), Temp, _TRUNCATE); /* host name */
2825 HostNameFlag = TRUE;
2826