summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2016-12-02 15:03:10 +0100
committerLars-Dominik Braun <lars@6xq.net>2016-12-02 15:03:10 +0100
commit18f39b5ac22fe0ab85203f7a471f511d2bf96e28 (patch)
tree5070bbd97d4259160c090798f2ed1ffd1fc3d66f /src
parentfd5bbd8d823d8f284c482aa8cace9e09fd1eac78 (diff)
downloadpianobar-18f39b5ac22fe0ab85203f7a471f511d2bf96e28.tar.gz
pianobar-18f39b5ac22fe0ab85203f7a471f511d2bf96e28.tar.bz2
pianobar-18f39b5ac22fe0ab85203f7a471f511d2bf96e28.zip
Exit when no email/password was entered or ^C was pressed
Fixes #600.
Diffstat (limited to 'src')
-rw-r--r--src/main.c9
1 files changed, 7 insertions, 2 deletions
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);