mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-18 19:41:01 -05:00
Handle the -batch option centrally in cmdline.c.
This removes one case from several of the individual tools' command-line parsers, and moves it into a central place where it will automatically be supported by any tool containing console.c. In order to make that not cause a link failure, there's now a stubs/no-console.c which GUI clients of cmdline.c must include.
This commit is contained in:
16
cmdline.c
16
cmdline.c
@ -130,10 +130,15 @@ SeatPromptResult cmdline_get_passwd_input(
|
||||
return SPR_OK;
|
||||
}
|
||||
|
||||
static void cmdline_report_unavailable(const char *p)
|
||||
{
|
||||
cmdline_error("option \"%s\" not available in this tool", p);
|
||||
}
|
||||
|
||||
static bool cmdline_check_unavailable(int flag, const char *p)
|
||||
{
|
||||
if (cmdline_tooltype & flag) {
|
||||
cmdline_error("option \"%s\" not available in this tool", p);
|
||||
cmdline_report_unavailable(p);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -906,6 +911,15 @@ int cmdline_process_param(const char *p, char *value,
|
||||
conf_set_str(conf, CONF_proxy_telnet_command, value);
|
||||
}
|
||||
|
||||
if (!strcmp(p, "-batch")) {
|
||||
RETURN(1);
|
||||
SAVEABLE(0);
|
||||
if (!console_set_batch_mode(true)) {
|
||||
cmdline_report_unavailable(p);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS
|
||||
/*
|
||||
* Cross-tool options only available on Windows.
|
||||
|
Reference in New Issue
Block a user