mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
pterm.exe: run command-line options through cmdline.c.
This makes pterm.exe support the same (very small) subset of the standard option collection that Unix pterm does. Namely, -load (which won't do anything useful with a hostname to connect to, but is still useful if you have a saved session containing configuration like colours or default size or what have you), and also -sessionlog. To make this work, I've had to move the 'tooltype' definition out of window.c into {putty,pterm}.c, so that it can be defined differently in the two.
This commit is contained in:
parent
1a0d076dfb
commit
e06a3dda45
@ -1,6 +1,10 @@
|
|||||||
#include "putty.h"
|
#include "putty.h"
|
||||||
#include "storage.h"
|
#include "storage.h"
|
||||||
|
|
||||||
|
const unsigned cmdline_tooltype =
|
||||||
|
TOOLTYPE_NONNETWORK |
|
||||||
|
TOOLTYPE_NO_VERBOSE_OPTION;
|
||||||
|
|
||||||
void gui_term_process_cmdline(Conf *conf, char *cmdline)
|
void gui_term_process_cmdline(Conf *conf, char *cmdline)
|
||||||
{
|
{
|
||||||
do_defaults(NULL, conf);
|
do_defaults(NULL, conf);
|
||||||
@ -16,8 +20,16 @@ void gui_term_process_cmdline(Conf *conf, char *cmdline)
|
|||||||
split_into_argv(cmdline, &argc, &argv, &argstart);
|
split_into_argv(cmdline, &argc, &argv, &argstart);
|
||||||
|
|
||||||
for (int i = 0; i < argc; i++) {
|
for (int i = 0; i < argc; i++) {
|
||||||
const char *arg = argv[i];
|
char *arg = argv[i];
|
||||||
if (!strcmp(arg, "-e")) {
|
int retd = cmdline_process_param(
|
||||||
|
arg, i+1<argc?argv[i+1]:NULL, 1, conf);
|
||||||
|
if (retd == -2) {
|
||||||
|
cmdline_error("option \"%s\" requires an argument", arg);
|
||||||
|
} else if (retd == 2) {
|
||||||
|
i++; /* skip next argument */
|
||||||
|
} else if (retd == 1) {
|
||||||
|
continue; /* nothing further needs doing */
|
||||||
|
} else if (!strcmp(arg, "-e")) {
|
||||||
if (i+1 < argc) {
|
if (i+1 < argc) {
|
||||||
/* The command to execute is taken to be the unparsed
|
/* The command to execute is taken to be the unparsed
|
||||||
* version of the whole remainder of the command line. */
|
* version of the whole remainder of the command line. */
|
||||||
@ -33,6 +45,8 @@ void gui_term_process_cmdline(Conf *conf, char *cmdline)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmdline_run_saved(conf);
|
||||||
|
|
||||||
conf_set_int(conf, CONF_sharrow_type, SHARROW_BITMAP);
|
conf_set_int(conf, CONF_sharrow_type, SHARROW_BITMAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,11 @@ extern const char *dialog_box_demo_screenshot_filename;
|
|||||||
static strbuf *demo_terminal_data = NULL;
|
static strbuf *demo_terminal_data = NULL;
|
||||||
static const char *terminal_demo_screenshot_filename;
|
static const char *terminal_demo_screenshot_filename;
|
||||||
|
|
||||||
|
const unsigned cmdline_tooltype =
|
||||||
|
TOOLTYPE_HOST_ARG |
|
||||||
|
TOOLTYPE_PORT_ARG |
|
||||||
|
TOOLTYPE_NO_VERBOSE_OPTION;
|
||||||
|
|
||||||
void gui_term_process_cmdline(Conf *conf, char *cmdline)
|
void gui_term_process_cmdline(Conf *conf, char *cmdline)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
@ -520,11 +520,6 @@ char *terminal_window_class_a(void)
|
|||||||
return classname;
|
return classname;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned cmdline_tooltype =
|
|
||||||
TOOLTYPE_HOST_ARG |
|
|
||||||
TOOLTYPE_PORT_ARG |
|
|
||||||
TOOLTYPE_NO_VERBOSE_OPTION;
|
|
||||||
|
|
||||||
HINSTANCE hinst;
|
HINSTANCE hinst;
|
||||||
|
|
||||||
int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||||
|
Loading…
Reference in New Issue
Block a user