mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-18 19:41:01 -05:00
Make cmdline_tooltype a const int.
Another ugly mutable global variable gone: now, instead of this variable being defined in cmdline.c and written to by everyone's main(), it's defined _alongside_ everyone's main() as a constant, and cmdline.c just refers to it. A bonus is that now nocmdline.c doesn't have to define it anyway for tools that don't use cmdline.c. But mostly, it didn't need to be mutable, so better for it not to be. While I'm at it, I've also fiddled with the bit flags that go in it, to define their values automatically using a list macro instead of manually specifying each one to be a different power of 2.
This commit is contained in:
12
cmdline.c
12
cmdline.c
@ -109,18 +109,6 @@ int cmdline_get_passwd_input(prompts_t *p)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Here we have a flags word which describes the capabilities of
|
||||
* the particular tool on whose behalf we're running. We will
|
||||
* refuse certain command-line options if a particular tool
|
||||
* inherently can't do anything sensible. For example, the file
|
||||
* transfer tools (psftp, pscp) can't do a great deal with protocol
|
||||
* selections (ever tried running scp over telnet?) or with port
|
||||
* forwarding (even if it wasn't a hideously bad idea, they don't
|
||||
* have the select/poll infrastructure to make them work).
|
||||
*/
|
||||
int cmdline_tooltype = 0;
|
||||
|
||||
static bool cmdline_check_unavailable(int flag, const char *p)
|
||||
{
|
||||
if (cmdline_tooltype & flag) {
|
||||
|
Reference in New Issue
Block a user