mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
console_get_line() returns failure iff console_batch_mode is set, whereas
before is would return success and the empty string. IMO this makes `-batch' much more useful; before, utilities such as Plink in `-batch' mode would attempt to plough on using empty strings for usernames, passwords, and so on. [originally from svn r4832]
This commit is contained in:
parent
b66d69ee25
commit
739de21c6d
@ -280,6 +280,7 @@ int console_get_line(const char *prompt, char *str,
|
||||
if (console_batch_mode) {
|
||||
if (maxlen > 0)
|
||||
str[0] = '\0';
|
||||
return 0;
|
||||
} else {
|
||||
tcgetattr(0, &oldmode);
|
||||
newmode = oldmode;
|
||||
@ -302,8 +303,9 @@ int console_get_line(const char *prompt, char *str,
|
||||
|
||||
if (is_pw)
|
||||
fputs("\n", stdout);
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void frontend_keypress(void *handle)
|
||||
|
@ -282,6 +282,7 @@ int console_get_line(const char *prompt, char *str,
|
||||
if (console_batch_mode) {
|
||||
if (maxlen > 0)
|
||||
str[0] = '\0';
|
||||
return 0;
|
||||
} else {
|
||||
hin = GetStdHandle(STD_INPUT_HANDLE);
|
||||
hout = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
@ -312,8 +313,8 @@ int console_get_line(const char *prompt, char *str,
|
||||
if (is_pw)
|
||||
WriteFile(hout, "\r\n", 2, &i, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void frontend_keypress(void *handle)
|
||||
|
Loading…
Reference in New Issue
Block a user