File: uxputty.c

package info (click to toggle)
putty 0.74-1%2Bdeb11u2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,020 kB
  • sloc: ansic: 114,140; python: 4,372; perl: 3,511; sh: 1,563; makefile: 167
file content (93 lines) | stat: -rw-r--r-- 2,113 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
 * Unix PuTTY main program.
 */

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <assert.h>
#include <unistd.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>

#define MAY_REFER_TO_GTK_IN_HEADERS

#include "putty.h"
#include "storage.h"

#include "gtkcompat.h"

/*
 * Stubs to avoid uxpty.c needing to be linked in.
 */
const bool use_pty_argv = false;
char **pty_argv;                       /* never used */
char *pty_osx_envrestore_prefix;

/*
 * Clean up and exit.
 */
void cleanup_exit(int code)
{
    /*
     * Clean up.
     */
    sk_cleanup();
    random_save_seed();
    exit(code);
}

const struct BackendVtable *select_backend(Conf *conf)
{
    const struct BackendVtable *vt =
        backend_vt_from_proto(conf_get_int(conf, CONF_protocol));
    assert(vt != NULL);
    return vt;
}

void initial_config_box(Conf *conf, post_dialog_fn_t after, void *afterctx)
{
    char *title = dupcat(appname, " Configuration");
    create_config_box(title, conf, false, 0, after, afterctx);
    sfree(title);
}

const bool use_event_log = true, new_session = true, saved_sessions = true;
const bool dup_check_launchable = true;

char *make_default_wintitle(char *hostname)
{
    return dupcat(hostname, " - ", appname);
}

/*
 * X11-forwarding-related things suitable for Gtk app.
 */

char *platform_get_x_display(void) {
    const char *display;
    /* Try to take account of --display and what have you. */
    if (!(display = gdk_get_display()))
        /* fall back to traditional method */
        display = getenv("DISPLAY");
    return dupstr(display);
}

const bool share_can_be_downstream = true;
const bool share_can_be_upstream = true;

void setup(bool single)
{
    sk_init();
    flags = FLAG_VERBOSE | FLAG_INTERACTIVE;
    cmdline_tooltype |= TOOLTYPE_HOST_ARG | TOOLTYPE_PORT_ARG;
    default_protocol = be_default_protocol;
    /* Find the appropriate default port. */
    {
        const struct BackendVtable *vt =
            backend_vt_from_proto(default_protocol);
        default_port = 0; /* illegal */
        if (vt)
            default_port = vt->default_port;
    }
}