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:
@ -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);
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user