mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -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:
@ -467,6 +467,11 @@ static void close_session(void *ignored_context)
|
||||
|
||||
extern LogPolicy win_gui_logpolicy[1]; /* defined in windlg.c */
|
||||
|
||||
const unsigned cmdline_tooltype =
|
||||
TOOLTYPE_HOST_ARG |
|
||||
TOOLTYPE_PORT_ARG |
|
||||
TOOLTYPE_NO_VERBOSE_OPTION;
|
||||
|
||||
int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
{
|
||||
MSG msg;
|
||||
@ -477,8 +482,6 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
|
||||
hinst = inst;
|
||||
hwnd = NULL;
|
||||
cmdline_tooltype |= TOOLTYPE_HOST_ARG | TOOLTYPE_PORT_ARG |
|
||||
TOOLTYPE_NO_VERBOSE_OPTION;
|
||||
|
||||
sk_init();
|
||||
|
||||
|
@ -225,6 +225,12 @@ void stdouterr_sent(struct handle *h, size_t new_backlog, int err)
|
||||
const bool share_can_be_downstream = true;
|
||||
const bool share_can_be_upstream = true;
|
||||
|
||||
const unsigned cmdline_tooltype =
|
||||
TOOLTYPE_HOST_ARG |
|
||||
TOOLTYPE_HOST_ARG_CAN_BE_SESSION |
|
||||
TOOLTYPE_HOST_ARG_PROTOCOL_PREFIX |
|
||||
TOOLTYPE_HOST_ARG_FROM_LAUNCHABLE_LOAD;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
bool sending;
|
||||
@ -249,12 +255,6 @@ int main(int argc, char **argv)
|
||||
default_protocol = PROT_SSH;
|
||||
default_port = 22;
|
||||
|
||||
cmdline_tooltype |=
|
||||
(TOOLTYPE_HOST_ARG |
|
||||
TOOLTYPE_HOST_ARG_CAN_BE_SESSION |
|
||||
TOOLTYPE_HOST_ARG_PROTOCOL_PREFIX |
|
||||
TOOLTYPE_HOST_ARG_FROM_LAUNCHABLE_LOAD);
|
||||
|
||||
/*
|
||||
* Process the command line.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user