aboutsummaryrefslogtreecommitdiff
path: root/consent.c
diff options
context:
space:
mode:
Diffstat (limited to 'consent.c')
-rw-r--r--consent.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/consent.c b/consent.c
index 61710b0..882ac79 100644
--- a/consent.c
+++ b/consent.c
@@ -10,27 +10,29 @@
int main_consent(int secure) {
if (!secure) {
- printf("WARNING: The terminal you are about to enter passwords is insecure.\n");
+ fprintf(stderr, "WARNING: The terminal you are about to enter passwords is insecure.\n");
} else {
- printf("\033[r\033[H\033[J");
+ fprintf(stderr, "\033[r\033[H\033[J");
}
- printf("Program %s from user %d (process %d: '%s'), is asking for authorization.\n",
+ fprintf(stderr, "Program %s from user %d (process %d: '%s'), is asking for authorization.\n"
+ "It prompts that:\n\n%s\n\n",
a_env.exe,
a_env.usr,
a_env.pid,
- "todo");
+ "todo",
+ a_env.prompt);
switch (a_env.mode) {
case mode_consent: {
- printf("Consent '%s'? (Y / N) ", a_env.prompt);
+ fprintf(stderr, "Consent? (Y / N) ");
char buf[5];
if (read(STDIN_FILENO, buf, sizeof(buf) - 1) < 0) {
int r = errno;
LOGFV("read: %m", r);
if (secure) {
- printf("Cannot read response: %m. Press any key to return.\n",
+ fprintf(stderr, "Cannot read response: %m. Press any key to return.\n",
errno);
fgetc(stdin);
- printf("\033[r\033[H\033[J");
+ fprintf(stderr, "\033[r\033[H\033[J");
}
return r;
}
@@ -42,18 +44,18 @@ int main_consent(int secure) {
break;
}
case mode_password: {
- printf("Enter password for '%s'. "
+ fprintf(stderr, "Please enter password. "
"The program will know your password.\n"
- "Password: ", a_env.prompt);
+ "Password: ");
char buf[10];
if (!fgets(buf, sizeof(buf) - 1, stdin)) {
int r = errno;
LOGFV("read: %m", r);
if (secure) {
- printf("Cannot read your response: %m. Press any key to return.\n",
+ fprintf(stderr, "Cannot read your response: %m. Press any key to return.\n",
errno);
fgetc(stdin);
- printf("\033[r\033[H\033[J");
+ fprintf(stderr, "\033[r\033[H\033[J");
}
return r;
}