| ︙ | | |
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
|
{
return XGetDefault(GDK_DISPLAY(), app_name, key);
}
/*
* Default settings that are specific to pterm.
*/
char *platform_default_s(const char *name)
FontSpec platform_default_fontspec(const char *name)
{
FontSpec ret;
if (!strcmp(name, "Font"))
strcpy(ret.name, "fixed");
else
*ret.name = '\0';
return "fixed";
return ret;
}
Filename platform_default_filename(const char *name)
{
Filename ret;
if (!strcmp(name, "LogFileName"))
strcpy(ret.path, "putty.log");
else
*ret.path = '\0';
return ret;
}
char *platform_default_s(const char *name)
{
return NULL;
}
int platform_default_i(const char *name, int def)
{
if (!strcmp(name, "CloseOnExit"))
return 2; /* maps to FORCE_ON after painful rearrangement :-( */
return def;
}
void ldisc_update(void *frontend, int echo, int edit)
{
/*
* This is a stub in pterm. If I ever produce a Unix
* command-line ssh/telnet/rlogin client (i.e. a port of plink)
* then it will require some termios manoeuvring analogous to
* that in the Windows plink.c, but here it's meaningless.
*/
}
int askappend(void *frontend, char *filename)
int askappend(void *frontend, Filename filename)
{
/*
* Logging in an xterm-alike is liable to be something you only
* do at serious diagnostic need. Hence, I'm going to take the
* easy option for now and assume we always want to overwrite
* log files. I can always make it properly configurable later.
*/
|
| ︙ | | |
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
|
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
|
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
|
char *val;
while (--argc > 0) {
char *p = *++argv;
if (!strcmp(p, "-fn") || !strcmp(p, "-font")) {
EXPECTS_ARG;
SECOND_PASS_ONLY;
strncpy(cfg->font, val, sizeof(cfg->font));
cfg->font[sizeof(cfg->font)-1] = '\0';
strncpy(cfg->font.name, val, sizeof(cfg->font.name));
cfg->font.name[sizeof(cfg->font.name)-1] = '\0';
} else if (!strcmp(p, "-fb")) {
EXPECTS_ARG;
SECOND_PASS_ONLY;
strncpy(cfg->boldfont, val, sizeof(cfg->boldfont));
cfg->boldfont[sizeof(cfg->boldfont)-1] = '\0';
strncpy(cfg->boldfont.name, val, sizeof(cfg->boldfont.name));
cfg->boldfont.name[sizeof(cfg->boldfont.name)-1] = '\0';
} else if (!strcmp(p, "-fw")) {
EXPECTS_ARG;
SECOND_PASS_ONLY;
strncpy(cfg->widefont, val, sizeof(cfg->widefont));
cfg->widefont[sizeof(cfg->widefont)-1] = '\0';
strncpy(cfg->widefont.name, val, sizeof(cfg->widefont.name));
cfg->widefont.name[sizeof(cfg->widefont.name)-1] = '\0';
} else if (!strcmp(p, "-fwb")) {
EXPECTS_ARG;
SECOND_PASS_ONLY;
strncpy(cfg->wideboldfont, val, sizeof(cfg->wideboldfont));
cfg->wideboldfont[sizeof(cfg->wideboldfont)-1] = '\0';
strncpy(cfg->wideboldfont.name, val, sizeof(cfg->wideboldfont.name));
cfg->wideboldfont.name[sizeof(cfg->wideboldfont.name)-1] = '\0';
} else if (!strcmp(p, "-cs")) {
EXPECTS_ARG;
SECOND_PASS_ONLY;
strncpy(cfg->line_codepage, val, sizeof(cfg->line_codepage));
cfg->line_codepage[sizeof(cfg->line_codepage)-1] = '\0';
|
| ︙ | | |
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
|
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
|
-
-
+
+
|
SECOND_PASS_ONLY;
strncpy(cfg->wintitle, val, sizeof(cfg->wintitle));
cfg->wintitle[sizeof(cfg->wintitle)-1] = '\0';
} else if (!strcmp(p, "-log")) {
EXPECTS_ARG;
SECOND_PASS_ONLY;
strncpy(cfg->logfilename, val, sizeof(cfg->logfilename));
cfg->logfilename[sizeof(cfg->logfilename)-1] = '\0';
strncpy(cfg->logfilename.path, val, sizeof(cfg->logfilename.path));
cfg->logfilename.path[sizeof(cfg->logfilename.path)-1] = '\0';
cfg->logtype = LGTYP_DEBUG;
} else if (!strcmp(p, "-ut-") || !strcmp(p, "+ut")) {
SECOND_PASS_ONLY;
cfg->stamp_utmp = 0;
} else if (!strcmp(p, "-ut")) {
|
| ︙ | | |
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
|
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
|
-
+
-
+
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
|
if (do_cmdline(argc, argv, 0, &inst->cfg))
exit(1); /* pre-defaults pass to get -class */
do_defaults(NULL, &inst->cfg);
if (do_cmdline(argc, argv, 1, &inst->cfg))
exit(1); /* post-defaults, do everything */
inst->fonts[0] = gdk_font_load(inst->cfg.font);
inst->fonts[0] = gdk_font_load(inst->cfg.font.name);
if (!inst->fonts[0]) {
fprintf(stderr, "pterm: unable to load font \"%s\"\n", inst->cfg.font);
fprintf(stderr, "pterm: unable to load font \"%s\"\n",
inst->cfg.font.name);
exit(1);
}
font_charset = set_font_info(inst, 0);
if (inst->cfg.boldfont[0]) {
inst->fonts[1] = gdk_font_load(inst->cfg.boldfont);
if (inst->cfg.boldfont.name[0]) {
inst->fonts[1] = gdk_font_load(inst->cfg.boldfont.name);
if (!inst->fonts[1]) {
fprintf(stderr, "pterm: unable to load bold font \"%s\"\n",
inst->cfg.boldfont);
inst->cfg.boldfont.name);
exit(1);
}
set_font_info(inst, 1);
} else
inst->fonts[1] = NULL;
if (inst->cfg.widefont[0]) {
inst->fonts[2] = gdk_font_load(inst->cfg.widefont);
if (inst->cfg.widefont.name[0]) {
inst->fonts[2] = gdk_font_load(inst->cfg.widefont.name);
if (!inst->fonts[2]) {
fprintf(stderr, "pterm: unable to load wide font \"%s\"\n",
inst->cfg.boldfont);
inst->cfg.widefont.name);
exit(1);
}
set_font_info(inst, 2);
} else
inst->fonts[2] = NULL;
if (inst->cfg.wideboldfont[0]) {
inst->fonts[3] = gdk_font_load(inst->cfg.wideboldfont);
if (inst->cfg.wideboldfont.name[0]) {
inst->fonts[3] = gdk_font_load(inst->cfg.wideboldfont.name);
if (!inst->fonts[3]) {
fprintf(stderr, "pterm: unable to load wide/bold font \"%s\"\n",
inst->cfg.boldfont);
inst->cfg.wideboldfont.name);
exit(1);
}
set_font_info(inst, 3);
} else
inst->fonts[3] = NULL;
inst->font_width = gdk_char_width(inst->fonts[0], ' ');
|
| ︙ | | |