2 * Unix PuTTY main program.
17 * - Go through all the config options and ensure they can all be
18 * configured and reconfigured properly.
19 * + icon title appears to be a non-option on Unix.
20 * + Why the hell did I faff about disabling two of the vtmode
21 * options? The rest aren't used either in pterm! Work out
22 * whether they should be, and how they can be.
23 * + Refresh in the codepage combo is badly broken.
24 * + `Don't translate line drawing chars' ?? What is this crap?
25 * It does nothing at all, and where's the option to paste as
26 * lqqqk? What was I smoking?
28 * - Better control of the individual config box features.
29 * + SSH packet logging shouldn't be mentioned in pterm, and in
30 * fact not PuTTYtel either.
31 * + Keepalives, and the Connection panel in general, shouldn't
32 * crop up in pterm. (And perhaps also not mid-session in
39 void cleanup_exit(int code
)
49 Backend
*select_backend(Config
*cfg
)
53 for (i
= 0; backends
[i
].backend
!= NULL
; i
++)
54 if (backends
[i
].protocol
== cfg
->protocol
) {
55 back
= backends
[i
].backend
;
62 int cfgbox(Config
*cfg
)
64 return do_config_box("PuTTY Configuration", cfg
, 0);
67 static int got_host
= 0;
69 const int use_event_log
= 1, new_session
= 1, saved_sessions
= 1;
71 int process_nonoption_arg(char *arg
, Config
*cfg
)
77 * If we already have a host name, treat this argument as a
78 * port number. NB we have to treat this as a saved -P
79 * argument, so that it will be deferred until it's a good
82 int ret
= cmdline_process_param("-P", arg
, 1, cfg
);
84 } else if (!strncmp(q
, "telnet:", 7)) {
86 * If the hostname starts with "telnet:",
87 * set the protocol to Telnet and process
88 * the string as a Telnet URL.
93 if (q
[0] == '/' && q
[1] == '/')
95 cfg
->protocol
= PROT_TELNET
;
97 while (*p
&& *p
!= ':' && *p
!= '/')
106 strncpy(cfg
->host
, q
, sizeof(cfg
->host
) - 1);
107 cfg
->host
[sizeof(cfg
->host
) - 1] = '\0';
111 * Otherwise, treat this argument as a host name.
114 while (*p
&& !isspace((unsigned char)*p
))
118 strncpy(cfg
->host
, q
, sizeof(cfg
->host
) - 1);
119 cfg
->host
[sizeof(cfg
->host
) - 1] = '\0';
125 char *make_default_wintitle(char *hostname
)
127 return dupcat(hostname
, " - PuTTY", NULL
);
130 int main(int argc
, char **argv
)
132 extern int pt_main(int argc
, char **argv
);
134 flags
= FLAG_VERBOSE
| FLAG_INTERACTIVE
;
135 default_protocol
= be_default_protocol
;
136 /* Find the appropriate default port. */
139 default_port
= 0; /* illegal */
140 for (i
= 0; backends
[i
].backend
!= NULL
; i
++)
141 if (backends
[i
].protocol
== default_protocol
) {
142 default_port
= backends
[i
].backend
->default_port
;
146 return pt_main(argc
, argv
);