1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Add and use cmdline_arg_to_filename().

Converting a CmdlineArg straight to a Filename allows us to make the
filename out of the wide-character version of the string on Windows.
So now filenames specified on the command line should generally be
able to handle pathnames containing Unicode characters not in the
system code page.

This change also involves making some char pointers _into_ Filename
structs where they weren't previously: for example, the
'openssh_config_file' variable in Windows Pageant's WinMain().
This commit is contained in:
Simon Tatham
2024-09-24 17:50:19 +01:00
parent b57fb48b27
commit 74150633f1
12 changed files with 61 additions and 41 deletions

View File

@ -476,10 +476,9 @@ bool do_cmdline(int argc, char **argv, bool do_everything, Conf *conf)
conf_set_str(conf, CONF_wintitle, val);
} else if (!strcmp(p, "-log")) {
Filename *fn;
EXPECTS_ARG;
SECOND_PASS_ONLY;
fn = filename_from_str(val);
Filename *fn = cmdline_arg_to_filename(nextarg);
conf_set_filename(conf, CONF_logfilename, fn);
conf_set_int(conf, CONF_logtype, LGTYP_DEBUG);
filename_free(fn);

View File

@ -124,6 +124,15 @@ const char *cmdline_arg_to_utf8(CmdlineArg *argp)
return NULL;
}
Filename *cmdline_arg_to_filename(CmdlineArg *argp)
{
if (!argp)
return NULL;
CmdlineArgUnix *arg = container_of(argp, CmdlineArgUnix, argp);
return filename_from_str(arg->value);
}
void cmdline_arg_wipe(CmdlineArg *argp)
{
if (!argp)