2 * settings.c: read and write saved sessions.
12 * Tables of string <-> enum value mappings
14 struct keyval { char *s; int v; };
16 static const struct keyval ciphernames[] = {
17 { "aes", CIPHER_AES },
18 { "blowfish", CIPHER_BLOWFISH },
19 { "3des", CIPHER_3DES },
20 { "WARN", CIPHER_WARN },
24 static void gpps(void *handle, char *name, char *def, char *val, int len)
26 if (!read_setting_s(handle, name, val, len)) {
27 strncpy(val, def, len);
32 static void gppi(void *handle, char *name, int def, int *i)
34 *i = read_setting_i(handle, name, def);
37 static int key2val(const struct keyval *mapping, int nmaps, char *key)
40 for (i = 0; i < nmaps; i++)
41 if (!strcmp(mapping[i].s, key)) return mapping[i].v;
45 static const char *val2key(const struct keyval *mapping, int nmaps, int val)
48 for (i = 0; i < nmaps; i++)
49 if (mapping[i].v == val) return mapping[i].s;
54 * Helper function to parse a comma-separated list of strings into
55 * a preference list array of values. Any missing values are added
56 * to the end and duplicates are weeded.
57 * XXX: assumes vals in 'mapping' are small +ve integers
59 static void gprefs(void *sesskey, char *name, char *def,
60 const struct keyval *mapping, int nvals,
65 unsigned long seen = 0; /* bitmap for weeding dups etc */
66 gpps(sesskey, name, def, commalist, sizeof(commalist));
68 /* Grotty parsing of commalist. */
73 key = strtok(n==0 ? commalist : NULL, ","); /* sorry */
75 if (((v = key2val(mapping, nvals, key)) != -1) &&
82 /* Add any missing values (backward compatibility ect). */
85 for (i = 0; i < nvals; i++) {
86 if (!(seen & 1<<mapping[i].v)) {
87 array[n] = mapping[i].v;
95 * Write out a preference list.
97 static void wprefs(void *sesskey, char *name,
98 const struct keyval *mapping, int nvals,
101 char buf[80] = ""; /* XXX assumed big enough */
102 int l = sizeof(buf)-1, i;
104 for (i = 0; l > 0 && i < nvals; i++) {
105 const char *s = val2key(mapping, nvals, array[i]);
109 strncat(buf, ",", l);
116 write_setting_s(sesskey, name, buf);
119 void save_settings(char *section, int do_host, Config * cfg)
125 sesskey = open_settings_w(section);
129 write_setting_i(sesskey, "Present", 1);
131 write_setting_s(sesskey, "HostName", cfg->host);
132 write_setting_s(sesskey, "LogFileName", cfg->logfilename);
133 write_setting_i(sesskey, "LogType", cfg->logtype);
134 write_setting_i(sesskey, "LogFileClash", cfg->logxfovr);
137 for (i = 0; backends[i].name != NULL; i++)
138 if (backends[i].protocol == cfg->protocol) {
139 p = backends[i].name;
142 write_setting_s(sesskey, "Protocol", p);
143 write_setting_i(sesskey, "PortNumber", cfg->port);
144 write_setting_i(sesskey, "CloseOnExit", cfg->close_on_exit);
145 write_setting_i(sesskey, "WarnOnClose", !!cfg->warn_on_close);
146 write_setting_i(sesskey, "PingInterval", cfg->ping_interval / 60); /* minutes */
147 write_setting_i(sesskey, "PingIntervalSecs", cfg->ping_interval % 60); /* seconds */
148 write_setting_s(sesskey, "TerminalType", cfg->termtype);
149 write_setting_s(sesskey, "TerminalSpeed", cfg->termspeed);
151 char buf[2 * sizeof(cfg->environmt)], *p, *q;
157 if (c == '=' || c == ',' || c == '\\')
167 write_setting_s(sesskey, "Environment", buf);
169 write_setting_s(sesskey, "UserName", cfg->username);
170 write_setting_s(sesskey, "LocalUserName", cfg->localusername);
171 write_setting_i(sesskey, "NoPTY", cfg->nopty);
172 write_setting_i(sesskey, "Compression", cfg->compression);
173 write_setting_i(sesskey, "AgentFwd", cfg->agentfwd);
174 wprefs(sesskey, "Cipher", ciphernames, CIPHER_MAX,
175 cfg->ssh_cipherlist);
176 write_setting_i(sesskey, "AuthTIS", cfg->try_tis_auth);
177 write_setting_i(sesskey, "SshProt", cfg->sshprot);
178 write_setting_i(sesskey, "BuggyMAC", cfg->buggymac);
179 write_setting_s(sesskey, "PublicKeyFile", cfg->keyfile);
180 write_setting_s(sesskey, "RemoteCommand", cfg->remote_cmd);
181 write_setting_i(sesskey, "RFCEnviron", cfg->rfc_environ);
182 write_setting_i(sesskey, "PassiveTelnet", cfg->passive_telnet);
183 write_setting_i(sesskey, "BackspaceIsDelete", cfg->bksp_is_delete);
184 write_setting_i(sesskey, "RXVTHomeEnd", cfg->rxvt_homeend);
185 write_setting_i(sesskey, "LinuxFunctionKeys", cfg->funky_type);
186 write_setting_i(sesskey, "NoApplicationKeys", cfg->no_applic_k);
187 write_setting_i(sesskey, "NoApplicationCursors", cfg->no_applic_c);
188 write_setting_i(sesskey, "ApplicationCursorKeys", cfg->app_cursor);
189 write_setting_i(sesskey, "ApplicationKeypad", cfg->app_keypad);
190 write_setting_i(sesskey, "NetHackKeypad", cfg->nethack_keypad);
191 write_setting_i(sesskey, "AltF4", cfg->alt_f4);
192 write_setting_i(sesskey, "AltSpace", cfg->alt_space);
193 write_setting_i(sesskey, "AltOnly", cfg->alt_only);
194 write_setting_i(sesskey, "ComposeKey", cfg->compose_key);
195 write_setting_i(sesskey, "CtrlAltKeys", cfg->ctrlaltkeys);
196 write_setting_i(sesskey, "TelnetKey", cfg->telnet_keyboard);
197 write_setting_i(sesskey, "LocalEcho", cfg->localecho);
198 write_setting_i(sesskey, "LocalEdit", cfg->localedit);
199 write_setting_s(sesskey, "Answerback", cfg->answerback);
200 write_setting_i(sesskey, "AlwaysOnTop", cfg->alwaysontop);
201 write_setting_i(sesskey, "FullScreenOnAltEnter", cfg->fullscreenonaltenter);
202 write_setting_i(sesskey, "HideMousePtr", cfg->hide_mouseptr);
203 write_setting_i(sesskey, "SunkenEdge", cfg->sunken_edge);
204 write_setting_i(sesskey, "WindowBorder", cfg->window_border);
205 write_setting_i(sesskey, "CurType", cfg->cursor_type);
206 write_setting_i(sesskey, "BlinkCur", cfg->blink_cur);
207 write_setting_i(sesskey, "Beep", cfg->beep);
208 write_setting_i(sesskey, "BeepInd", cfg->beep_ind);
209 write_setting_s(sesskey, "BellWaveFile", cfg->bell_wavefile);
210 write_setting_i(sesskey, "BellOverload", cfg->bellovl);
211 write_setting_i(sesskey, "BellOverloadN", cfg->bellovl_n);
212 write_setting_i(sesskey, "BellOverloadT", cfg->bellovl_t);
213 write_setting_i(sesskey, "BellOverloadS", cfg->bellovl_s);
214 write_setting_i(sesskey, "ScrollbackLines", cfg->savelines);
215 write_setting_i(sesskey, "DECOriginMode", cfg->dec_om);
216 write_setting_i(sesskey, "AutoWrapMode", cfg->wrap_mode);
217 write_setting_i(sesskey, "LFImpliesCR", cfg->lfhascr);
218 write_setting_i(sesskey, "WinNameAlways", cfg->win_name_always);
219 write_setting_s(sesskey, "WinTitle", cfg->wintitle);
220 write_setting_i(sesskey, "TermWidth", cfg->width);
221 write_setting_i(sesskey, "TermHeight", cfg->height);
222 write_setting_s(sesskey, "Font", cfg->font);
223 write_setting_i(sesskey, "FontIsBold", cfg->fontisbold);
224 write_setting_i(sesskey, "FontCharSet", cfg->fontcharset);
225 write_setting_i(sesskey, "FontHeight", cfg->fontheight);
226 write_setting_i(sesskey, "FontVTMode", cfg->vtmode);
227 write_setting_i(sesskey, "TryPalette", cfg->try_palette);
228 write_setting_i(sesskey, "BoldAsColour", cfg->bold_colour);
229 for (i = 0; i < 22; i++) {
230 char buf[20], buf2[30];
231 sprintf(buf, "Colour%d", i);
232 sprintf(buf2, "%d,%d,%d", cfg->colours[i][0],
233 cfg->colours[i][1], cfg->colours[i][2]);
234 write_setting_s(sesskey, buf, buf2);
236 write_setting_i(sesskey, "RawCNP", cfg->rawcnp);
237 write_setting_i(sesskey, "PasteRTF", cfg->rtf_paste);
238 write_setting_i(sesskey, "MouseIsXterm", cfg->mouse_is_xterm);
239 write_setting_i(sesskey, "RectSelect", cfg->rect_select);
240 write_setting_i(sesskey, "MouseOverride", cfg->mouse_override);
241 for (i = 0; i < 256; i += 32) {
242 char buf[20], buf2[256];
244 sprintf(buf, "Wordness%d", i);
246 for (j = i; j < i + 32; j++) {
247 sprintf(buf2 + strlen(buf2), "%s%d",
248 (*buf2 ? "," : ""), cfg->wordness[j]);
250 write_setting_s(sesskey, buf, buf2);
252 write_setting_s(sesskey, "LineCodePage", cfg->line_codepage);
253 write_setting_i(sesskey, "CapsLockCyr", cfg->xlat_capslockcyr);
254 write_setting_i(sesskey, "ScrollBar", cfg->scrollbar);
255 write_setting_i(sesskey, "ScrollBarFullScreen", cfg->scrollbar_in_fullscreen);
256 write_setting_i(sesskey, "ScrollOnKey", cfg->scroll_on_key);
257 write_setting_i(sesskey, "ScrollOnDisp", cfg->scroll_on_disp);
258 write_setting_i(sesskey, "LockSize", cfg->resize_action);
259 write_setting_i(sesskey, "BCE", cfg->bce);
260 write_setting_i(sesskey, "BlinkText", cfg->blinktext);
261 write_setting_i(sesskey, "X11Forward", cfg->x11_forward);
262 write_setting_s(sesskey, "X11Display", cfg->x11_display);
263 write_setting_i(sesskey, "LocalPortAcceptAll", cfg->lport_acceptall);
265 char buf[2 * sizeof(cfg->portfwd)], *p, *q;
271 if (c == '=' || c == ',' || c == '\\')
281 write_setting_s(sesskey, "PortForwardings", buf);
284 close_settings_w(sesskey);
287 void load_settings(char *section, int do_host, Config * cfg)
293 sesskey = open_settings_r(section);
295 cfg->ssh_subsys = 0; /* FIXME: load this properly */
296 cfg->remote_cmd_ptr = cfg->remote_cmd;
297 cfg->remote_cmd_ptr2 = NULL;
300 gpps(sesskey, "HostName", "", cfg->host, sizeof(cfg->host));
302 cfg->host[0] = '\0'; /* blank hostname */
304 gpps(sesskey, "LogFileName", "putty.log",
305 cfg->logfilename, sizeof(cfg->logfilename));
306 gppi(sesskey, "LogType", 0, &cfg->logtype);
307 gppi(sesskey, "LogFileClash", LGXF_ASK, &cfg->logxfovr);
309 gpps(sesskey, "Protocol", "default", prot, 10);
310 cfg->protocol = default_protocol;
311 cfg->port = default_port;
312 for (i = 0; backends[i].name != NULL; i++)
313 if (!strcmp(prot, backends[i].name)) {
314 cfg->protocol = backends[i].protocol;
315 gppi(sesskey, "PortNumber", default_port, &cfg->port);
319 gppi(sesskey, "CloseOnExit", COE_NORMAL, &cfg->close_on_exit);
320 gppi(sesskey, "WarnOnClose", 1, &cfg->warn_on_close);
322 /* This is two values for backward compatibility with 0.50/0.51 */
323 int pingmin, pingsec;
324 gppi(sesskey, "PingInterval", 0, &pingmin);
325 gppi(sesskey, "PingIntervalSecs", 0, &pingsec);
326 cfg->ping_interval = pingmin * 60 + pingsec;
328 gpps(sesskey, "TerminalType", "xterm", cfg->termtype,
329 sizeof(cfg->termtype));
330 gpps(sesskey, "TerminalSpeed", "38400,38400", cfg->termspeed,
331 sizeof(cfg->termspeed));
333 char buf[2 * sizeof(cfg->environmt)], *p, *q;
334 gpps(sesskey, "Environment", "", buf, sizeof(buf));
338 while (*p && *p != ',') {
352 gpps(sesskey, "UserName", "", cfg->username, sizeof(cfg->username));
353 gpps(sesskey, "LocalUserName", "", cfg->localusername,
354 sizeof(cfg->localusername));
355 gppi(sesskey, "NoPTY", 0, &cfg->nopty);
356 gppi(sesskey, "Compression", 0, &cfg->compression);
357 gppi(sesskey, "AgentFwd", 0, &cfg->agentfwd);
358 gprefs(sesskey, "Cipher", "\0",
359 ciphernames, CIPHER_MAX, cfg->ssh_cipherlist);
360 gppi(sesskey, "SshProt", 1, &cfg->sshprot);
361 gppi(sesskey, "BuggyMAC", 0, &cfg->buggymac);
362 gppi(sesskey, "AuthTIS", 0, &cfg->try_tis_auth);
363 gpps(sesskey, "PublicKeyFile", "", cfg->keyfile, sizeof(cfg->keyfile));
364 gpps(sesskey, "RemoteCommand", "", cfg->remote_cmd,
365 sizeof(cfg->remote_cmd));
366 gppi(sesskey, "RFCEnviron", 0, &cfg->rfc_environ);
367 gppi(sesskey, "PassiveTelnet", 0, &cfg->passive_telnet);
368 gppi(sesskey, "BackspaceIsDelete", 1, &cfg->bksp_is_delete);
369 gppi(sesskey, "RXVTHomeEnd", 0, &cfg->rxvt_homeend);
370 gppi(sesskey, "LinuxFunctionKeys", 0, &cfg->funky_type);
371 gppi(sesskey, "NoApplicationKeys", 0, &cfg->no_applic_k);
372 gppi(sesskey, "NoApplicationCursors", 0, &cfg->no_applic_c);
373 gppi(sesskey, "ApplicationCursorKeys", 0, &cfg->app_cursor);
374 gppi(sesskey, "ApplicationKeypad", 0, &cfg->app_keypad);
375 gppi(sesskey, "NetHackKeypad", 0, &cfg->nethack_keypad);
376 gppi(sesskey, "AltF4", 1, &cfg->alt_f4);
377 gppi(sesskey, "AltSpace", 0, &cfg->alt_space);
378 gppi(sesskey, "AltOnly", 0, &cfg->alt_only);
379 gppi(sesskey, "ComposeKey", 0, &cfg->compose_key);
380 gppi(sesskey, "CtrlAltKeys", 1, &cfg->ctrlaltkeys);
381 gppi(sesskey, "TelnetKey", 0, &cfg->telnet_keyboard);
382 gppi(sesskey, "LocalEcho", LD_BACKEND, &cfg->localecho);
383 gppi(sesskey, "LocalEdit", LD_BACKEND, &cfg->localedit);
384 gpps(sesskey, "Answerback", "PuTTY", cfg->answerback,
385 sizeof(cfg->answerback));
386 gppi(sesskey, "AlwaysOnTop", 0, &cfg->alwaysontop);
387 gppi(sesskey, "FullScreenOnAltEnter", 0, &cfg->fullscreenonaltenter);
388 gppi(sesskey, "HideMousePtr", 0, &cfg->hide_mouseptr);
389 gppi(sesskey, "SunkenEdge", 0, &cfg->sunken_edge);
390 gppi(sesskey, "WindowBorder", 1, &cfg->window_border);
391 gppi(sesskey, "CurType", 0, &cfg->cursor_type);
392 gppi(sesskey, "BlinkCur", 0, &cfg->blink_cur);
393 /* pedantic compiler tells me I can't use &cfg->beep as an int * :-) */
394 gppi(sesskey, "Beep", 1, &i); cfg->beep = i;
395 gppi(sesskey, "BeepInd", 0, &i); cfg->beep_ind = i;
396 gpps(sesskey, "BellWaveFile", "", cfg->bell_wavefile,
397 sizeof(cfg->bell_wavefile));
398 gppi(sesskey, "BellOverload", 1, &cfg->bellovl);
399 gppi(sesskey, "BellOverloadN", 5, &cfg->bellovl_n);
400 gppi(sesskey, "BellOverloadT", 2000, &cfg->bellovl_t);
401 gppi(sesskey, "BellOverloadS", 5000, &cfg->bellovl_s);
402 gppi(sesskey, "ScrollbackLines", 200, &cfg->savelines);
403 gppi(sesskey, "DECOriginMode", 0, &cfg->dec_om);
404 gppi(sesskey, "AutoWrapMode", 1, &cfg->wrap_mode);
405 gppi(sesskey, "LFImpliesCR", 0, &cfg->lfhascr);
406 gppi(sesskey, "WinNameAlways", 0, &cfg->win_name_always);
407 gpps(sesskey, "WinTitle", "", cfg->wintitle, sizeof(cfg->wintitle));
408 gppi(sesskey, "TermWidth", 80, &cfg->width);
409 gppi(sesskey, "TermHeight", 24, &cfg->height);
410 gpps(sesskey, "Font", "Courier New", cfg->font, sizeof(cfg->font));
411 gppi(sesskey, "FontIsBold", 0, &cfg->fontisbold);
412 gppi(sesskey, "FontCharSet", ANSI_CHARSET, &cfg->fontcharset);
413 gppi(sesskey, "FontHeight", 10, &cfg->fontheight);
414 if (cfg->fontheight < 0) {
416 HDC hdc = GetDC(NULL);
417 int logpix = GetDeviceCaps(hdc, LOGPIXELSY);
418 ReleaseDC(NULL, hdc);
420 oldh = -cfg->fontheight;
421 newh = MulDiv(oldh, 72, logpix) + 1;
422 if (MulDiv(newh, logpix, 72) > oldh)
424 cfg->fontheight = newh;
426 gppi(sesskey, "FontVTMode", VT_UNICODE, (int *) &cfg->vtmode);
427 gppi(sesskey, "TryPalette", 0, &cfg->try_palette);
428 gppi(sesskey, "BoldAsColour", 1, &cfg->bold_colour);
429 for (i = 0; i < 22; i++) {
430 static char *defaults[] = {
431 "187,187,187", "255,255,255", "0,0,0", "85,85,85", "0,0,0",
432 "0,255,0", "0,0,0", "85,85,85", "187,0,0", "255,85,85",
433 "0,187,0", "85,255,85", "187,187,0", "255,255,85", "0,0,187",
434 "85,85,255", "187,0,187", "255,85,255", "0,187,187",
435 "85,255,255", "187,187,187", "255,255,255"
437 char buf[20], buf2[30];
439 sprintf(buf, "Colour%d", i);
440 gpps(sesskey, buf, defaults[i], buf2, sizeof(buf2));
441 if (sscanf(buf2, "%d,%d,%d", &c0, &c1, &c2) == 3) {
442 cfg->colours[i][0] = c0;
443 cfg->colours[i][1] = c1;
444 cfg->colours[i][2] = c2;
447 gppi(sesskey, "RawCNP", 0, &cfg->rawcnp);
448 gppi(sesskey, "PasteRTF", 0, &cfg->rtf_paste);
449 gppi(sesskey, "MouseIsXterm", 0, &cfg->mouse_is_xterm);
450 gppi(sesskey, "RectSelect", 0, &cfg->rect_select);
451 gppi(sesskey, "MouseOverride", 1, &cfg->mouse_override);
452 for (i = 0; i < 256; i += 32) {
453 static char *defaults[] = {
454 "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
455 "0,1,2,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1",
456 "1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,2",
457 "1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1",
458 "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1",
459 "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1",
460 "2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2",
461 "2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2"
463 char buf[20], buf2[256], *p;
465 sprintf(buf, "Wordness%d", i);
466 gpps(sesskey, buf, defaults[i / 32], buf2, sizeof(buf2));
468 for (j = i; j < i + 32; j++) {
470 while (*p && *p != ',')
474 cfg->wordness[j] = atoi(q);
478 * The empty default for LineCodePage will be converted later
479 * into a plausible default for the locale.
481 gpps(sesskey, "LineCodePage", "", cfg->line_codepage,
482 sizeof(cfg->line_codepage));
483 gppi (sesskey, "CapsLockCyr", 0, &cfg->xlat_capslockcyr);
484 gppi(sesskey, "ScrollBar", 1, &cfg->scrollbar);
485 gppi(sesskey, "ScrollBarFullScreen", 0, &cfg->scrollbar_in_fullscreen);
486 gppi(sesskey, "ScrollOnKey", 0, &cfg->scroll_on_key);
487 gppi(sesskey, "ScrollOnDisp", 1, &cfg->scroll_on_disp);
488 gppi(sesskey, "LockSize", 0, &cfg->resize_action);
489 gppi(sesskey, "BCE", 0, &cfg->bce);
490 gppi(sesskey, "BlinkText", 0, &cfg->blinktext);
491 gppi(sesskey, "X11Forward", 0, &cfg->x11_forward);
492 gpps(sesskey, "X11Display", "localhost:0", cfg->x11_display,
493 sizeof(cfg->x11_display));
495 gppi(sesskey, "LocalPortAcceptAll", 0, &cfg->lport_acceptall);
497 char buf[2 * sizeof(cfg->portfwd)], *p, *q;
498 gpps(sesskey, "PortForwardings", "", buf, sizeof(buf));
502 while (*p && *p != ',') {
517 close_settings_r(sesskey);
520 void do_defaults(char *session, Config * cfg)
523 load_settings(session, TRUE, cfg);
525 load_settings("Default Settings", FALSE, cfg);
528 static int sessioncmp(const void *av, const void *bv)
530 const char *a = *(const char *const *) av;
531 const char *b = *(const char *const *) bv;
534 * Alphabetical order, except that "Default Settings" is a
535 * special case and comes first.
537 if (!strcmp(a, "Default Settings"))
538 return -1; /* a comes first */
539 if (!strcmp(b, "Default Settings"))
540 return +1; /* b comes first */
542 * FIXME: perhaps we should ignore the first & in determining
545 return strcmp(a, b); /* otherwise, compare normally */
548 void get_sesslist(int allocate)
550 static char otherbuf[2048];
552 int buflen, bufsize, i;
558 if ((handle = enum_settings_start()) == NULL)
561 buflen = bufsize = 0;
564 ret = enum_settings_next(handle, otherbuf, sizeof(otherbuf));
566 int len = strlen(otherbuf) + 1;
567 if (bufsize < buflen + len) {
568 bufsize = buflen + len + 2048;
569 buffer = srealloc(buffer, bufsize);
571 strcpy(buffer + buflen, otherbuf);
572 buflen += strlen(buffer + buflen) + 1;
575 enum_settings_finish(handle);
576 buffer = srealloc(buffer, buflen + 1);
577 buffer[buflen] = '\0';
580 * Now set up the list of sessions. Note that "Default
581 * Settings" must always be claimed to exist, even if it
586 nsessions = 1; /* "Default Settings" counts as one */
588 if (strcmp(p, "Default Settings"))
595 sessions = smalloc((nsessions + 1) * sizeof(char *));
596 sessions[0] = "Default Settings";
600 if (strcmp(p, "Default Settings"))
607 qsort(sessions, i, sizeof(char *), sessioncmp);