2 * Unix PuTTY main program.
16 * Stubs to avoid uxpty.c needing to be linked in.
18 const int use_pty_argv
= FALSE
;
19 char **pty_argv
; /* never used */
24 void cleanup_exit(int code
)
34 Backend
*select_backend(Conf
*conf
)
36 Backend
*back
= backend_from_proto(conf_get_int(conf
, CONF_protocol
));
41 int cfgbox(Conf
*conf
)
43 char *title
= dupcat(appname
, " Configuration", NULL
);
44 int ret
= do_config_box(title
, conf
, 0, 0);
49 static int got_host
= 0;
51 const int use_event_log
= 1, new_session
= 1, saved_sessions
= 1;
53 int process_nonoption_arg(char *arg
, Conf
*conf
, int *allow_launch
)
59 * If we already have a host name, treat this argument as a
60 * port number. NB we have to treat this as a saved -P
61 * argument, so that it will be deferred until it's a good
64 int ret
= cmdline_process_param("-P", arg
, 1, conf
);
66 } else if (!strncmp(q
, "telnet:", 7)) {
68 * If the hostname starts with "telnet:",
69 * set the protocol to Telnet and process
70 * the string as a Telnet URL.
75 if (q
[0] == '/' && q
[1] == '/')
77 conf_set_int(conf
, CONF_protocol
, PROT_TELNET
);
79 while (*p
&& *p
!= ':' && *p
!= '/')
85 conf_set_int(conf
, CONF_port
, atoi(p
));
87 conf_set_int(conf
, CONF_port
, -1);
88 conf_set_str(conf
, CONF_host
, q
);
92 * Otherwise, treat this argument as a host name.
95 while (*p
&& !isspace((unsigned char)*p
))
99 conf_set_str(conf
, CONF_host
, q
);
103 *allow_launch
= TRUE
;
107 char *make_default_wintitle(char *hostname
)
109 return dupcat(hostname
, " - ", appname
, NULL
);
113 * X11-forwarding-related things suitable for Gtk app.
116 char *platform_get_x_display(void) {
118 /* Try to take account of --display and what have you. */
119 if (!(display
= gdk_get_display()))
120 /* fall back to traditional method */
121 display
= getenv("DISPLAY");
122 return dupstr(display
);
125 int main(int argc
, char **argv
)
127 extern int pt_main(int argc
, char **argv
);
129 flags
= FLAG_VERBOSE
| FLAG_INTERACTIVE
;
130 default_protocol
= be_default_protocol
;
131 /* Find the appropriate default port. */
133 Backend
*b
= backend_from_proto(default_protocol
);
134 default_port
= 0; /* illegal */
136 default_port
= b
->default_port
;
138 return pt_main(argc
, argv
);