$OpenBSD: patch-src_main_c,v 1.21 2016/12/05 10:33:30 dcoppa Exp $

commit 18f39b5ac22fe0ab85203f7a471f511d2bf96e28
Author: Lars-Dominik Braun <lars@6xq.net>
Date:   Fri Dec 2 15:03:10 2016 +0100

Exit when no email/password was entered or ^C was pressed

--- src/main.c.orig	Thu Jun  2 08:49:26 2016
+++ src/main.c	Mon Dec  5 11:28:33 2016
@@ -86,7 +86,9 @@ static bool BarMainGetLoginCredentials (BarSettings_t 
 		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 
 
 		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);
