Add some missing calls to cleanup_exit.
[sgt/putty] / unix / uxpterm.c
1 /*
2 * pterm main program.
3 */
4
5 #include <stdio.h>
6 #include <stdlib.h>
7
8 #include "putty.h"
9
10 const char *const appname = "pterm";
11 const int use_event_log = 0; /* pterm doesn't need it */
12 const int new_session = 0, saved_sessions = 0; /* or these */
13 const int use_pty_argv = TRUE;
14
15 Backend *select_backend(Conf *conf)
16 {
17 return &pty_backend;
18 }
19
20 void net_pending_errors(void)
21 {
22 /*
23 * Stub version of net_pending_errors(), because gtkwin.c has to
24 * be prepared to call it when linked into PuTTY and therefore we
25 * have to avoid a link failure when linking gtkwin.c in turn into
26 * a non-networked application.
27 */
28 }
29
30 int cfgbox(Conf *conf)
31 {
32 /*
33 * This is a no-op in pterm, except that we'll ensure the
34 * protocol is set to -1 to inhibit the useless Connection
35 * panel in the config box.
36 */
37 conf_set_int(conf, CONF_protocol, -1);
38 return 1;
39 }
40
41 void cleanup_exit(int code)
42 {
43 exit(code);
44 }
45
46 int process_nonoption_arg(char *arg, Conf *conf, int *allow_launch)
47 {
48 return 0; /* pterm doesn't have any. */
49 }
50
51 char *make_default_wintitle(char *hostname)
52 {
53 return dupstr("pterm");
54 }
55
56 int main(int argc, char **argv)
57 {
58 extern int pt_main(int argc, char **argv);
59 extern void pty_pre_init(void); /* declared in pty.c */
60 int ret;
61
62 cmdline_tooltype = TOOLTYPE_NONNETWORK;
63 default_protocol = -1;
64
65 pty_pre_init();
66
67 ret = pt_main(argc, argv);
68 cleanup_exit(ret);
69 return ret; /* not reached, but placates optimisers */
70 }