sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dmenu-password-4.9.diff (2933B)


      1 diff -up dmenu-4.9/dmenu.1 dmenu-4.9-orig/dmenu.1
      2 --- dmenu-4.9/dmenu.1	2019-09-25 12:55:42.666319316 -0600
      3 +++ dmenu-4.9-orig/dmenu.1	2019-09-25 12:48:38.848249931 -0600
      4 @@ -3,7 +3,7 @@
      5  dmenu \- dynamic menu
      6  .SH SYNOPSIS
      7  .B dmenu
      8 -.RB [ \-bfivP ]
      9 +.RB [ \-bfiv ]
     10  .RB [ \-l
     11  .IR lines ]
     12  .RB [ \-m
     13 @@ -47,9 +47,6 @@ is faster, but will lock up X until stdi
     14  .B \-i
     15  dmenu matches menu items case insensitively.
     16  .TP
     17 -.B \-P
     18 -dmenu will not directly display the keyboard input, but instead replace it with dots. All data from stdin will be ignored.
     19 -.TP
     20  .BI \-l " lines"
     21  dmenu lists items vertically, with the given number of lines.
     22  .TP
     23 diff -up dmenu-4.9/dmenu.c dmenu-4.9-orig/dmenu.c
     24 --- dmenu-4.9/dmenu.c	2019-09-25 12:48:55.756173240 -0600
     25 +++ dmenu-4.9-orig/dmenu.c	2019-09-25 12:48:38.848249931 -0600
     26 @@ -37,7 +37,7 @@ struct item {
     27  static char text[BUFSIZ] = "";
     28  static char *embed;
     29  static int bh, mw, mh;
     30 -static int inputw = 0, promptw, passwd = 0;
     31 +static int inputw = 0, promptw;
     32  static int lrpad; /* sum of left and right padding */
     33  static size_t cursor;
     34  static struct item *items = NULL;
     35 @@ -132,7 +132,6 @@ drawmenu(void)
     36  	unsigned int curpos;
     37  	struct item *item;
     38  	int x = 0, y = 0, w;
     39 - char *censort;
     40  
     41  	drw_setscheme(drw, scheme[SchemeNorm]);
     42  	drw_rect(drw, 0, 0, mw, mh, 1, 1);
     43 @@ -144,12 +143,7 @@ drawmenu(void)
     44  	/* draw input field */
     45  	w = (lines > 0 || !matches) ? mw - x : inputw;
     46  	drw_setscheme(drw, scheme[SchemeNorm]);
     47 -	if (passwd) {
     48 -	        censort = ecalloc(1, sizeof(text));
     49 -		memset(censort, '.', strlen(text));
     50 -		drw_text(drw, x, 0, w, bh, lrpad / 2, censort, 0);
     51 -		free(censort);
     52 -	} else drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
     53 +	drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
     54  
     55  	curpos = TEXTW(text) - TEXTW(&text[cursor]);
     56  	if ((curpos += lrpad / 2 - 1) < w) {
     57 @@ -531,11 +525,6 @@ readstdin(void)
     58  	size_t i, imax = 0, size = 0;
     59  	unsigned int tmpmax = 0;
     60  
     61 -  if(passwd){
     62 -    inputw = lines = 0;
     63 -    return;
     64 -  }
     65 -
     66  	/* read each line from stdin and add it to the item list */
     67  	for (i = 0; fgets(buf, sizeof buf, stdin); i++) {
     68  		if (i + 1 >= size / sizeof *items)
     69 @@ -693,7 +682,7 @@ setup(void)
     70  static void
     71  usage(void)
     72  {
     73 -	fputs("usage: dmenu [-bfiPv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
     74 +	fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
     75  	      "             [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr);
     76  	exit(1);
     77  }
     78 @@ -716,9 +705,7 @@ main(int argc, char *argv[])
     79  		else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
     80  			fstrncmp = strncasecmp;
     81  			fstrstr = cistrstr;
     82 -		} else if (!strcmp(argv[i], "-P"))   /* is the input a password */
     83 -		        passwd = 1;
     84 -		else if (i + 1 == argc)
     85 +		} else if (i + 1 == argc)
     86  			usage();
     87  		/* these options take one argument */
     88  		else if (!strcmp(argv[i], "-l"))   /* number of lines in vertical list */