1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 09:58:01 +00:00
putty-source/unix/uxpterm.c
Simon Tatham 575ee4f8fc Make cmdline_tooltype a const int.
Another ugly mutable global variable gone: now, instead of this
variable being defined in cmdline.c and written to by everyone's
main(), it's defined _alongside_ everyone's main() as a constant, and
cmdline.c just refers to it.

A bonus is that now nocmdline.c doesn't have to define it anyway for
tools that don't use cmdline.c. But mostly, it didn't need to be
mutable, so better for it not to be.

While I'm at it, I've also fiddled with the bit flags that go in it,
to define their values automatically using a list macro instead of
manually specifying each one to be a different power of 2.
2020-01-30 06:40:22 +00:00

56 lines
1.3 KiB
C

/*
* pterm main program.
*/
#include <stdio.h>
#include <stdlib.h>
#include "putty.h"
const char *const appname = "pterm";
const bool use_event_log = false; /* pterm doesn't need it */
const bool new_session = false, saved_sessions = false; /* or these */
const bool dup_check_launchable = false; /* no need to check host name
* in conf */
const bool use_pty_argv = true;
const unsigned cmdline_tooltype = TOOLTYPE_NONNETWORK;
/* gtkwin.c will call this, and in pterm it's not needed */
void noise_ultralight(NoiseSourceId id, unsigned long data) { }
const struct BackendVtable *select_backend(Conf *conf)
{
return &pty_backend;
}
void initial_config_box(Conf *conf, post_dialog_fn_t after, void *afterctx)
{
/*
* This is a no-op in pterm, except that we'll ensure the protocol
* is set to -1 to inhibit the useless Connection panel in the
* config box. So we do that and then just immediately call the
* post-dialog function with a positive result.
*/
conf_set_int(conf, CONF_protocol, -1);
after(afterctx, 1);
}
void cleanup_exit(int code)
{
exit(code);
}
char *make_default_wintitle(char *hostname)
{
return dupstr("pterm");
}
void setup(bool single)
{
default_protocol = -1;
if (single)
pty_pre_init();
}