From e06a3dda4505dfd0fdeec5b183f21e79e13da0d1 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 21 May 2022 10:32:32 +0100 Subject: [PATCH] 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. --- windows/pterm.c | 18 ++++++++++++++++-- windows/putty.c | 5 +++++ windows/window.c | 5 ----- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/windows/pterm.c b/windows/pterm.c index 0df849f9..bb68245d 100644 --- a/windows/pterm.c +++ b/windows/pterm.c @@ -1,6 +1,10 @@ #include "putty.h" #include "storage.h" +const unsigned cmdline_tooltype = + TOOLTYPE_NONNETWORK | + TOOLTYPE_NO_VERBOSE_OPTION; + void gui_term_process_cmdline(Conf *conf, char *cmdline) { do_defaults(NULL, conf); @@ -16,8 +20,16 @@ void gui_term_process_cmdline(Conf *conf, char *cmdline) split_into_argv(cmdline, &argc, &argv, &argstart); for (int i = 0; i < argc; i++) { - const char *arg = argv[i]; - if (!strcmp(arg, "-e")) { + char *arg = argv[i]; + int retd = cmdline_process_param( + arg, i+1