From 18f39b5ac22fe0ab85203f7a471f511d2bf96e28 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 2 Dec 2016 15:03:10 +0100 Subject: Exit when no email/password was entered or ^C was pressed Fixes #600. --- src/main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index a85949a..229c606 100644 --- a/src/main.c +++ b/src/main.c @@ -86,7 +86,9 @@ static bool BarMainGetLoginCredentials (BarSettings_t *settings, char nameBuf[100]; BarUiMsg (settings, MSG_QUESTION, "Email: "); - BarReadlineStr (nameBuf, sizeof (nameBuf), input, BAR_RL_DEFAULT); + if (BarReadlineStr (nameBuf, sizeof (nameBuf), input, BAR_RL_DEFAULT) == 0) { + return false; + } settings->username = strdup (nameBuf); usernameFromConfig = false; } @@ -100,7 +102,10 @@ static bool BarMainGetLoginCredentials (BarSettings_t *settings, if (settings->passwordCmd == NULL) { BarUiMsg (settings, MSG_QUESTION, "Password: "); - BarReadlineStr (passBuf, sizeof (passBuf), input, BAR_RL_NOECHO); + if (BarReadlineStr (passBuf, sizeof (passBuf), input, BAR_RL_NOECHO) == 0) { + puts (""); + return false; + } /* write missing newline */ puts (""); settings->password = strdup (passBuf); -- cgit v1.2.3