mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-05 21:42:47 -05:00
Having created and used uxsel, it actually turns out to be
practically trivial to put all the pieces together and create a working prototype of Unix PuTTY! It's missing a lot of things - notably GUI request boxes for host keys and logfiles and so forth, the Event Log, mid-session reconfiguration, session loading and saving, sensible population of the character sets drop-down list and probably other fiddly little things too - but it will put up a config box and then create a GUI window containing an SSH connection to the host you specified, so it's _basically_ there. Woo! [originally from svn r3020]
This commit is contained in:
23
unix/pterm.c
23
unix/pterm.c
@ -1948,6 +1948,7 @@ int do_cmdline(int argc, char **argv, int do_everything, Config *cfg)
|
||||
{
|
||||
int err = 0;
|
||||
extern char **pty_argv; /* declared in pty.c */
|
||||
extern int use_pty_argv;
|
||||
|
||||
/*
|
||||
* Macros to make argument handling easier. Note that because
|
||||
@ -2054,7 +2055,7 @@ int do_cmdline(int argc, char **argv, int do_everything, Config *cfg)
|
||||
cfg->colours[index][2] = col.blue / 256;
|
||||
}
|
||||
|
||||
} else if (!strcmp(p, "-e")) {
|
||||
} else if (use_pty_argv && !strcmp(p, "-e")) {
|
||||
/* This option swallows all further arguments. */
|
||||
if (!do_everything)
|
||||
break;
|
||||
@ -2219,9 +2220,10 @@ void uxsel_input_remove(int id) {
|
||||
gdk_input_remove(id);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int pt_main(int argc, char **argv)
|
||||
{
|
||||
extern void pty_pre_init(void); /* declared in pty.c */
|
||||
extern Backend *select_backend(Config *cfg);
|
||||
extern int cfgbox(Config *cfg);
|
||||
struct gui_data *inst;
|
||||
int font_charset;
|
||||
|
||||
@ -2229,8 +2231,6 @@ int main(int argc, char **argv)
|
||||
* it */
|
||||
block_signal(SIGCHLD, 1);
|
||||
|
||||
pty_pre_init();
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
/*
|
||||
@ -2246,6 +2246,9 @@ int main(int argc, char **argv)
|
||||
if (do_cmdline(argc, argv, 1, &inst->cfg))
|
||||
exit(1); /* post-defaults, do everything */
|
||||
|
||||
if (!cfgbox(&inst->cfg))
|
||||
exit(0); /* config box hit Cancel */
|
||||
|
||||
inst->fonts[0] = gdk_font_load(inst->cfg.font.name);
|
||||
if (!inst->fonts[0]) {
|
||||
fprintf(stderr, "pterm: unable to load font \"%s\"\n",
|
||||
@ -2397,9 +2400,13 @@ int main(int argc, char **argv)
|
||||
|
||||
uxsel_init();
|
||||
|
||||
inst->back = &pty_backend;
|
||||
inst->back->init((void *)inst->term, &inst->backhandle, &inst->cfg,
|
||||
NULL, 0, NULL, 0);
|
||||
inst->back = select_backend(&inst->cfg);
|
||||
{
|
||||
char *realhost; /* FIXME: don't ignore this! */
|
||||
inst->back->init((void *)inst->term, &inst->backhandle, &inst->cfg,
|
||||
inst->cfg.host, inst->cfg.port, &realhost,
|
||||
inst->cfg.tcp_nodelay);
|
||||
}
|
||||
inst->back->provide_logctx(inst->backhandle, inst->logctx);
|
||||
|
||||
term_provide_resize_fn(inst->term, inst->back->size, inst->backhandle);
|
||||
|
Reference in New Issue
Block a user