pinentry-dmenu

a pinentry program based on dmenu
git clone anongit@rnpnr.xyz:pinentry-dmenu.git
Log | Files | Refs | Feed | README | LICENSE

Commit: b1dc580b60bbac8cacaa47d1cb2b8a6765c5d143
Parent: 07617d3e3239dcc1f7c75c0eae5af9645a57d1da
Author: Randy Palamar
Date:   Thu,  3 Nov 2022 20:21:29 -0600

remove config file support

just edit a personal `config.h`

Diffstat:
MMakefile | 2+-
Mconfig.h | 1-
Mpinentry-dmenu.1 | 79-------------------------------------------------------------------------------
Mpinentry-dmenu.c | 91-------------------------------------------------------------------------------
4 files changed, 1 insertion(+), 172 deletions(-)

diff --git a/Makefile b/Makefile @@ -30,7 +30,7 @@ pinentry: pinentry-dmenu: pinentry pinentry-dmenu.o drw.o util.o @echo CC -o $@ - @${CC} -o $@ ${OBJ} ${OBJ_PIN} ${LDFLAGS} -lassuan -lgpgme -lgpg-error -lconfig + @${CC} -o $@ ${OBJ} ${OBJ_PIN} ${LDFLAGS} -lassuan -lgpgme -lgpg-error clean: @echo cleaning diff --git a/config.h b/config.h @@ -6,7 +6,6 @@ static int embedded = 0; static int minpwlen = 32; static int mon = -1; static int lineheight = 0; -static int min_lineheight = 8; static const char *asterisk = "*"; static const char *fonts[] = { diff --git a/pinentry-dmenu.1 b/pinentry-dmenu.1 @@ -19,66 +19,6 @@ to .B pinentry-dmenu to use the program as the regular dialog for .BR gpg-agent . -.PP -The configuration is placed in -.IR ~/.gnupg/pinentry-dmenu.conf . -You can change the path to the config file with the environment variable -.IR GNUPGHOME . - - -.SH OPTIONS -.TP -.BI "asterisk =" " *" -Defines the symbol which is showed for each typed character. -.TP -.BI "bottom =" " false" -pinentry-dmenu appears at the bottom of the screen. -.TP -.BI "min_password_length =" " 32" -The minimal space of the password field. This value has affect to the description field after the password field. -.TP -.BI "height =" " 8" -Height of pinentry-dmenu in pixels (no less than 8) -.TP -.BI "monitor =" " -1" -pinentry-dmenu is displayed on the monitor number supplied. Monitor numbers are starting from 0. -.TP -.BI "prompt =" " """" -Defines the prompt to be displayed to the left of the input field. -.TP -.BI "font =" " monospace:size=10" -Defines the font or font set used. -.TP -.BI "prompt_bg =" " #bbbbbb" -Defines the prompt background color. -.IR #RGB , -.I #RRGGBB -and X color names are supported. -.TP -.BI "prompt_fg =" " #222222" -Defines the prompt foreground color. -.TP -.BI "normal_bg =" " #bbbbbb" -Defines the normal background color. -.TP -.BI "normal_fg =" " #222222" -Defines the normal foreground color. -.TP -.BI "select_bg =" " #eeeeee" -Defines the selected background color. -.TP -.BI "select_fg =" " #005577" -Defines the selected foreground color. -.TP -.BI "desc_bg =" " #bbbbbb" -Defines the description background color. -.TP -.BI "desc_fg =" " #222222" -Defines the description foreground color. -.TP -.BI "embedded =" " false" -Embed into window. - .SH USAGE pinentry-dmenu is completely controlled by the keyboard. @@ -187,25 +127,6 @@ Delete line left Paste from primary X selection -.SH EXAMPLES -.sp -.if n \{ -.RS 4 -.\} -.nf -asterisk= "# "; -prompt = "$"; -font = "Noto Sans UI:size=13"; -prompt_fg = "#eeeeee"; -prompt_bg = "#d9904a"; -normal_fg = "#ffffff"; -normal_bg = "#000000"; -select_fg = "#eeeeee"; -select_bg = "#d9904a"; -desc_fg = "#eeeeee"; -desc_bg = "#d9904a"; - - .SH AUTHORS .B pinentry-dmenu is a fork of diff --git a/pinentry-dmenu.c b/pinentry-dmenu.c @@ -1,6 +1,5 @@ /* See LICENSE file for copyright and license details. */ #include <ctype.h> -#include <libconfig.h> #include <locale.h> #include <signal.h> #include <stdio.h> @@ -702,94 +701,6 @@ pinentry_cmd_handler_t pinentry_cmd_handler = cmdhandler; 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); @@ -797,7 +708,5 @@ main(int argc, char *argv[]) { return 1; } - config_destroy(&cfg); - return 0; }