mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 09:58:01 +00:00
53f7da8ce7
This commit replaces all those fiddly little linking modules (be_all.c, be_none.c, be_ssh.c etc) with a single source file controlled by ifdefs, and introduces a function be_list() in setup.cmake that makes it easy to compile a version of it appropriate to each application. This is a net reduction in code according to 'git diff --stat', even though I've introduced more comments. It also gets rid of another pile of annoying little source files in the top-level directory that didn't deserve to take up so much room in 'ls'. More concretely, doing this has some maintenance advantages. Centralisation means less to maintain (e.g. n_ui_backends is worked out once in a way that makes sense everywhere), and also, 'appname' can now be reliably set per program. Previously, some programs got the wrong appname due to sharing the same linking module (e.g. Plink had appname="PuTTY"), which was a latent bug that would have manifested if I'd wanted to reuse the same string in another context. One thing I've changed in this rework is that Windows pterm no longer has the ConPTY backend in its backends[]: it now has an empty one. The special be_conpty.c module shouldn't really have been there in the first place: it was used in the very earliest uncommitted drafts of the ConPTY work, where I was using another method of selecting that backend, but now that Windows pterm has a dedicated backend_vt_from_conf() that refers to conpty_backend by name, it has no need to live in backends[] at all, just as it doesn't have to in Unix pterm.
50 lines
1.2 KiB
C
50 lines
1.2 KiB
C
/*
|
|
* pterm main program.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "putty.h"
|
|
|
|
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);
|
|
}
|
|
|
|
void setup(bool single)
|
|
{
|
|
settings_set_default_protocol(-1);
|
|
|
|
if (single)
|
|
pty_pre_init();
|
|
}
|