1
0
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:
Jacob Nevins 2004-11-19 21:05:31 +00:00
parent b66d69ee25
commit 739de21c6d
2 changed files with 5 additions and 2 deletions

View File

@ -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)

View File

@ -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)