Commit Diff


commit - e1fc63e3d52c0a5de26e63bf10b49301412e2082
commit + af60b04af6a7bd8e5e18a7bc271f75af476ccccb
blob - a2343d4d732588321fdeeb634a47132d5a0a348f
blob + 0273ba4bad194dae94c9512b7712a776539e222e
--- Makefile
+++ Makefile
@@ -92,6 +92,6 @@ bin/slock: ${SRC_SLOCK} ${HDR_SLOCK}
 
 bin/pinentry-dmenu: ${SRC_PD} ${HDR_PD}
 	@mkdir -p bin
-	${CC} -o $@ ${SRC_PD} ${CFLAGS} `pkg-config --cflags --libs libassuan libconfig fontconfig freetype2 x11 xft xinerama`
+	${CC} -o $@ ${SRC_PD} ${CFLAGS} `pkg-config --cflags --libs libassuan fontconfig freetype2 x11 xft xinerama`
 
 .PHONY: all clean install
blob - 3086b4360be90e33ef88724728402486a52d9e1a
blob + de251d3641e1459a13c9aed3812599ba43d4b676
--- pinentry-dmenu/pinentry-dmenu.c
+++ pinentry-dmenu/pinentry-dmenu.c
@@ -25,8 +25,6 @@
 #include "pinentry/pinentry.h"
 #include "pinentry/memory.h"
 
-#define CONFIG_DIR "/.gnupg"
-#define CONFIG_FILE "/pinentry-dmenu.conf"
 #define INTERSECT(x, y, w, h, r) \
 		(MAX(0, MIN((x)+(w),(r).x_org+(r).width) - MAX((x),(r).x_org)) \
 		 && MAX(0, MIN((y)+(h),(r).y_org+(r).height) - MAX((y),(r).y_org)))
@@ -702,102 +700,7 @@ pinentry_cmd_handler_t pinentry_cmd_handler = cmdhandl
 
 int
 main(int argc, char *argv[]) {
-	Bool bval;
-	int i, val;
-	const char *str;
-	struct passwd *pw;
-	char path[PATH_MAX];
-	char *sudo_uid = getenv("SUDO_UID");
-	char *home = getenv("HOME");
-	char *gnupghome = getenv("GNUPGHOME");
-	config_t cfg;
-
-	if (gnupghome) {
-		i = strlen(gnupghome);
-		strcpy(path, gnupghome);
-	} else {
-		/* Get the home dir even if the user used sudo or logged in as root */
-		if (sudo_uid) {
-			i = atoi(sudo_uid);
-			pw = getpwuid(i);
-			home = pw->pw_dir;
-		}
-
-		i = strlen(home);
-		strcpy(path, home);
-		strcpy(&path[i], CONFIG_DIR);
-		i += strlen(CONFIG_DIR);
-	}
-
-	strcpy(&path[i], CONFIG_FILE);
-	endpwent();
-
-	config_init(&cfg);
-
-	/* Read the file. If there is an error, report it and exit. */
-	if (config_read_file(&cfg, path)) {
-		if (config_lookup_string(&cfg, "asterisk", &str)) {
-			asterisk = str;
-		}
-		if (config_lookup_bool(&cfg, "bottom", &bval)) {
-			bottom = bval;
-		}
-		if (config_lookup_int(&cfg, "min_password_length", &val)) {
-			minpwlen = val;
-		}
-		if (config_lookup_int(&cfg, "height", &val)) {
-			lineheight = MAX(val, min_lineheight);
-		}
-		if (config_lookup_int(&cfg, "monitor", &val)) {
-			mon = val;
-		}
-		if (config_lookup_string(&cfg, "prompt", &str)) {
-			prompt = str;
-		}
-		if (config_lookup_string(&cfg, "font", &str)) {
-			fonts[0] = str;
-		}
-		if (config_lookup_string(&cfg, "prompt_bg", &str)) {
-			colors[SchemePrompt][ColBg] = str;
-		}
-		if (config_lookup_string(&cfg, "prompt_fg", &str)) {
-			colors[SchemePrompt][ColFg] = str;
-		}
-		if (config_lookup_string(&cfg, "normal_bg", &str)) {
-			colors[SchemeNormal][ColBg] = str;
-		}
-		if (config_lookup_string(&cfg, "normal_fg", &str)) {
-			colors[SchemeNormal][ColFg] = str;
-		}
-		if (config_lookup_string(&cfg, "select_bg", &str)) {
-			colors[SchemeSelect][ColBg] = str;
-		}
-		if (config_lookup_string(&cfg, "select_fg", &str)) {
-			colors[SchemeSelect][ColFg] = str;
-		}
-		if (config_lookup_string(&cfg, "desc_bg", &str)) {
-			colors[SchemeDesc][ColBg] = str;
-		}
-		if (config_lookup_string(&cfg, "desc_fg", &str)) {
-			colors[SchemeDesc][ColFg] = str;
-		}
-		if (config_lookup_bool(&cfg, "embedded", &bval)) {
-			embedded = bval;
-		}
-	} else if ((str = config_error_file(&cfg))) {
-		fprintf(stderr, "%s:%d: %s\n", config_error_file(&cfg),
-		        config_error_line(&cfg), config_error_text(&cfg));
-		return(EXIT_FAILURE);
-	}
-
 	pinentry_init("pinentry-dmenu");
 	pinentry_parse_opts(argc, argv);
-
-	if (pinentry_loop()) {
-		return 1;
-	}
-
-	config_destroy(&cfg);
-
-	return 0;
+	return pinentry_loop();
 }