diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2016-12-02 15:03:10 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2016-12-02 15:03:10 +0100 |
commit | 18f39b5ac22fe0ab85203f7a471f511d2bf96e28 (patch) | |
tree | 5070bbd97d4259160c090798f2ed1ffd1fc3d66f /src | |
parent | fd5bbd8d823d8f284c482aa8cace9e09fd1eac78 (diff) | |
download | pianobar-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.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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); |