2003-03-29 19:52:50 +00:00
|
|
|
/*
|
|
|
|
* pterm main program.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2003-04-01 18:10:25 +00:00
|
|
|
#include <stdlib.h>
|
2003-03-29 19:52:50 +00:00
|
|
|
|
|
|
|
#include "putty.h"
|
|
|
|
|
2003-04-05 16:05:00 +00:00
|
|
|
const char *const appname = "pterm";
|
2003-04-09 18:46:45 +00:00
|
|
|
const int use_event_log = 0; /* pterm doesn't need it */
|
2003-04-12 17:37:15 +00:00
|
|
|
const int new_session = 0, saved_sessions = 0; /* or these */
|
2005-02-06 15:52:00 +00:00
|
|
|
const int use_pty_argv = TRUE;
|
2003-04-05 16:05:00 +00:00
|
|
|
|
Post-release destabilisation! Completely remove the struct type
'Config' in putty.h, which stores all PuTTY's settings and includes an
arbitrary length limit on every single one of those settings which is
stored in string form. In place of it is 'Conf', an opaque data type
everywhere outside the new file conf.c, which stores a list of (key,
value) pairs in which every key contains an integer identifying a
configuration setting, and for some of those integers the key also
contains extra parts (so that, for instance, CONF_environmt is a
string-to-string mapping). Everywhere that a Config was previously
used, a Conf is now; everywhere there was a Config structure copy,
conf_copy() is called; every lookup, adjustment, load and save
operation on a Config has been rewritten; and there's a mechanism for
serialising a Conf into a binary blob and back for use with Duplicate
Session.
User-visible effects of this change _should_ be minimal, though I
don't doubt I've introduced one or two bugs here and there which will
eventually be found. The _intended_ visible effects of this change are
that all arbitrary limits on configuration strings and lists (e.g.
limit on number of port forwardings) should now disappear; that list
boxes in the configuration will now be displayed in a sorted order
rather than the arbitrary order in which they were added to the list
(since the underlying data structure is now a sorted tree234 rather
than an ad-hoc comma-separated string); and one more specific change,
which is that local and dynamic port forwardings on the same port
number are now mutually exclusive in the configuration (putting 'D' in
the key rather than the value was a mistake in the first place).
One other reorganisation as a result of this is that I've moved all
the dialog.c standard handlers (dlg_stdeditbox_handler and friends)
out into config.c, because I can't really justify calling them generic
any more. When they took a pointer to an arbitrary structure type and
the offset of a field within that structure, they were independent of
whether that structure was a Config or something completely different,
but now they really do expect to talk to a Conf, which can _only_ be
used for PuTTY configuration, so I've renamed them all things like
conf_editbox_handler and moved them out of the nominally independent
dialog-box management module into the PuTTY-specific config.c.
[originally from svn r9214]
2011-07-14 18:52:21 +00:00
|
|
|
Backend *select_backend(Conf *conf)
|
2003-03-29 19:52:50 +00:00
|
|
|
{
|
|
|
|
return &pty_backend;
|
|
|
|
}
|
|
|
|
|
Post-release destabilisation! Completely remove the struct type
'Config' in putty.h, which stores all PuTTY's settings and includes an
arbitrary length limit on every single one of those settings which is
stored in string form. In place of it is 'Conf', an opaque data type
everywhere outside the new file conf.c, which stores a list of (key,
value) pairs in which every key contains an integer identifying a
configuration setting, and for some of those integers the key also
contains extra parts (so that, for instance, CONF_environmt is a
string-to-string mapping). Everywhere that a Config was previously
used, a Conf is now; everywhere there was a Config structure copy,
conf_copy() is called; every lookup, adjustment, load and save
operation on a Config has been rewritten; and there's a mechanism for
serialising a Conf into a binary blob and back for use with Duplicate
Session.
User-visible effects of this change _should_ be minimal, though I
don't doubt I've introduced one or two bugs here and there which will
eventually be found. The _intended_ visible effects of this change are
that all arbitrary limits on configuration strings and lists (e.g.
limit on number of port forwardings) should now disappear; that list
boxes in the configuration will now be displayed in a sorted order
rather than the arbitrary order in which they were added to the list
(since the underlying data structure is now a sorted tree234 rather
than an ad-hoc comma-separated string); and one more specific change,
which is that local and dynamic port forwardings on the same port
number are now mutually exclusive in the configuration (putting 'D' in
the key rather than the value was a mistake in the first place).
One other reorganisation as a result of this is that I've moved all
the dialog.c standard handlers (dlg_stdeditbox_handler and friends)
out into config.c, because I can't really justify calling them generic
any more. When they took a pointer to an arbitrary structure type and
the offset of a field within that structure, they were independent of
whether that structure was a Config or something completely different,
but now they really do expect to talk to a Conf, which can _only_ be
used for PuTTY configuration, so I've renamed them all things like
conf_editbox_handler and moved them out of the nominally independent
dialog-box management module into the PuTTY-specific config.c.
[originally from svn r9214]
2011-07-14 18:52:21 +00:00
|
|
|
int cfgbox(Conf *conf)
|
2003-03-29 19:52:50 +00:00
|
|
|
{
|
2003-04-26 14:35:34 +00:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
Post-release destabilisation! Completely remove the struct type
'Config' in putty.h, which stores all PuTTY's settings and includes an
arbitrary length limit on every single one of those settings which is
stored in string form. In place of it is 'Conf', an opaque data type
everywhere outside the new file conf.c, which stores a list of (key,
value) pairs in which every key contains an integer identifying a
configuration setting, and for some of those integers the key also
contains extra parts (so that, for instance, CONF_environmt is a
string-to-string mapping). Everywhere that a Config was previously
used, a Conf is now; everywhere there was a Config structure copy,
conf_copy() is called; every lookup, adjustment, load and save
operation on a Config has been rewritten; and there's a mechanism for
serialising a Conf into a binary blob and back for use with Duplicate
Session.
User-visible effects of this change _should_ be minimal, though I
don't doubt I've introduced one or two bugs here and there which will
eventually be found. The _intended_ visible effects of this change are
that all arbitrary limits on configuration strings and lists (e.g.
limit on number of port forwardings) should now disappear; that list
boxes in the configuration will now be displayed in a sorted order
rather than the arbitrary order in which they were added to the list
(since the underlying data structure is now a sorted tree234 rather
than an ad-hoc comma-separated string); and one more specific change,
which is that local and dynamic port forwardings on the same port
number are now mutually exclusive in the configuration (putting 'D' in
the key rather than the value was a mistake in the first place).
One other reorganisation as a result of this is that I've moved all
the dialog.c standard handlers (dlg_stdeditbox_handler and friends)
out into config.c, because I can't really justify calling them generic
any more. When they took a pointer to an arbitrary structure type and
the offset of a field within that structure, they were independent of
whether that structure was a Config or something completely different,
but now they really do expect to talk to a Conf, which can _only_ be
used for PuTTY configuration, so I've renamed them all things like
conf_editbox_handler and moved them out of the nominally independent
dialog-box management module into the PuTTY-specific config.c.
[originally from svn r9214]
2011-07-14 18:52:21 +00:00
|
|
|
conf_set_int(conf, CONF_protocol, -1);
|
2003-04-26 14:35:34 +00:00
|
|
|
return 1;
|
2003-03-29 19:52:50 +00:00
|
|
|
}
|
|
|
|
|
2003-04-01 18:10:25 +00:00
|
|
|
void cleanup_exit(int code)
|
|
|
|
{
|
|
|
|
exit(code);
|
|
|
|
}
|
|
|
|
|
2015-05-15 10:15:42 +00:00
|
|
|
int process_nonoption_arg(const char *arg, Conf *conf, int *allow_launch)
|
2003-03-31 12:10:53 +00:00
|
|
|
{
|
|
|
|
return 0; /* pterm doesn't have any. */
|
|
|
|
}
|
|
|
|
|
2003-03-31 11:42:45 +00:00
|
|
|
char *make_default_wintitle(char *hostname)
|
|
|
|
{
|
|
|
|
return dupstr("pterm");
|
|
|
|
}
|
|
|
|
|
2003-03-29 19:52:50 +00:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
extern int pt_main(int argc, char **argv);
|
|
|
|
extern void pty_pre_init(void); /* declared in pty.c */
|
2013-07-19 17:44:47 +00:00
|
|
|
int ret;
|
2003-03-29 19:52:50 +00:00
|
|
|
|
2003-03-31 12:10:53 +00:00
|
|
|
cmdline_tooltype = TOOLTYPE_NONNETWORK;
|
2003-04-26 14:35:34 +00:00
|
|
|
default_protocol = -1;
|
2003-03-31 12:10:53 +00:00
|
|
|
|
2003-03-29 19:52:50 +00:00
|
|
|
pty_pre_init();
|
|
|
|
|
2013-07-19 17:44:47 +00:00
|
|
|
ret = pt_main(argc, argv);
|
|
|
|
cleanup_exit(ret);
|
|
|
|
return ret; /* not reached, but placates optimisers */
|
2003-03-29 19:52:50 +00:00
|
|
|
}
|