Julien Jehannet avatar Julien Jehannet committed 1a1c3c8

import debian patches + new 08_print_only.diff

Comments (0)

Files changed (6)

+Description: Allow '-file -' to cause stdin to be read as the file
+Forwarded: yes
+Author: Andrew Stribblehill <ads@debian.org>
+Origin: vendor
+Last-Update: 2003-09-02
+
+diff --git a/9menu.1 b/9menu.1
+--- a/9menu.1
++++ b/9menu.1
+@@ -97,11 +97,11 @@ instead of the default display.
+ Read items to display from
+ .IR filename ,
+ in addition to any other command line arguments.  This is intended for use
+ with
+ .B #!
+-in scripts.
++in scripts. If the filename is "-" read from stdin.
+ .TP
+ .BI \-fg " foreground-color"
+ Set the foreground color to
+ .IR foreground-color .
+ By default, the foreground color is black.
+diff --git a/9menu.c b/9menu.c
+--- a/9menu.c
++++ b/9menu.c
+@@ -262,11 +262,15 @@ char **argv;
+ 	if (filename) {
+ 		/* Read options and labels from file */
+ 		char fbuf[1024];
+ 		FILE *fp;
+ 
+-		fp = fopen(filename, "r");
++                if (strcmp(filename, "-") == 0) {
++                        fp = stdin;
++                } else {
++                        fp = fopen(filename, "r");
++                }
+ 		if (fp == NULL) {
+ 			fprintf(stderr, "%s: couldn't open '%s'\n", progname,
+ 				filename);
+ 			exit(1);
+ 		}

04_signedness.diff

+Description: popup-exec patch rolled in
+Forwarded: yes
+Author: Andrew Stribblehill <ads@debian.org>
+Origin: vendor
+Last-Update: 2005-09-05 
+
+--- a/9menu.c
++++ b/9menu.c
+@@ -101,7 +101,7 @@
+ /* the 9menu icon, for garish window managers */
+ #define nine_menu_width 40
+ #define nine_menu_height 40
+-static unsigned char nine_menu_bits[] = {
++static char nine_menu_bits[] = {
+    0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x04, 0x00,
+    0x80, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00,
+    0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x04,
+@@ -781,7 +781,7 @@
+ 	Window wdummy;
+ 
+ 	if (XQueryPointer(dpy, menuwin, &wdummy, &wdummy, &x, &y,
+-			       &dummy, &dummy, &dummy))
++			       &dummy, &dummy, (unsigned int *)&dummy))
+ 		XMoveWindow(dpy, menuwin, x-wide/2, y-cur*high-high/2);
+ }
+ 
+@@ -800,7 +800,7 @@
+ 	offset += 6;	/* fudge factor */
+ 
+ 	if (XQueryPointer(dpy, menuwin, &wdummy, &wdummy, &savex, &savey,
+-			       &dummy, &dummy, &dummy))
++			       &dummy, &dummy, (unsigned int *)&dummy))
+ 		XWarpPointer(dpy, None, menuwin, 0, 0, 0, 0,
+ 				wide/2, cur*high-high/2+offset);
+ }
+Description: Add more keys, especially Keypad Enter
+Forwarded: yes
+Author: Andrew Stribblehill <ads@debian.org>
+Origin: vendor
+Last-Update: 2009-04-24
+
+--- a/9menu.c
++++ b/9menu.c
+@@ -124,6 +124,14 @@
+ #define CONFIG_MENU_UP_KEY  XK_Up
+ #define CONFIG_MENU_DOWN_KEY    XK_Down
+ #define CONFIG_MENU_SELECT_KEY  XK_Return
++#define CONFIG_MENU_VI_UP_KEY  XK_k
++#define CONFIG_MENU_VI_DOWN_KEY  XK_j
++#define CONFIG_MENU_EMACS_UP_KEY  XK_p
++#define CONFIG_MENU_EMACS_DOWN_KEY  XK_n
++#define CONFIG_MENU_ALTERNATE_UP_KEY  XK_KP_Up
++#define CONFIG_MENU_ALTERNATE_DOWN_KEY  XK_KP_Down
++#define CONFIG_MENU_ALTERNATE_SELECT_KEY  XK_KP_Enter
++#define CONFIG_MENU_ABORT_KEY XK_Escape
+ 
+ char *progname;		/* my name */
+ char *displayname;	/* X display */
+@@ -573,13 +581,21 @@
+ 			key = XKeycodeToKeysym(dpy, ev.xkey.keycode, 0);	
+ 			if (key != CONFIG_MENU_UP_KEY
+ 			    && key != CONFIG_MENU_DOWN_KEY
+-			    && key != CONFIG_MENU_SELECT_KEY)
++			    && key != CONFIG_MENU_SELECT_KEY
++			    && key != CONFIG_MENU_ALTERNATE_DOWN_KEY
++			    && key != CONFIG_MENU_ALTERNATE_UP_KEY
++			    && key != CONFIG_MENU_ALTERNATE_SELECT_KEY
++			    && key != CONFIG_MENU_EMACS_DOWN_KEY
++			    && key != CONFIG_MENU_EMACS_UP_KEY
++			    && key != CONFIG_MENU_VI_DOWN_KEY
++			    && key != CONFIG_MENU_VI_UP_KEY
++			    && key != CONFIG_MENU_ABORT_KEY)
+ 				break;
+ 
+-			if (key == CONFIG_MENU_UP_KEY) {
++			if (key == CONFIG_MENU_UP_KEY || key == CONFIG_MENU_EMACS_UP_KEY || key == CONFIG_MENU_VI_UP_KEY || key == CONFIG_MENU_ALTERNATE_UP_KEY) {
+ 				old = cur;
+ 				cur--;
+-			} else if (key == CONFIG_MENU_DOWN_KEY) {
++			} else if (key == CONFIG_MENU_DOWN_KEY || key == CONFIG_MENU_EMACS_DOWN_KEY || key == CONFIG_MENU_VI_DOWN_KEY || key == CONFIG_MENU_ALTERNATE_DOWN_KEY) {
+ 				old = cur;
+ 				cur++;
+ 			}
+@@ -589,7 +605,10 @@
+ 		
+ 			cur %= numitems;
+ 
+-			if (key == CONFIG_MENU_UP_KEY || key == CONFIG_MENU_DOWN_KEY) {
++			if (key == CONFIG_MENU_UP_KEY || key == CONFIG_MENU_DOWN_KEY
++			    || key == CONFIG_MENU_EMACS_UP_KEY || key == CONFIG_MENU_EMACS_DOWN_KEY
++			    || key == CONFIG_MENU_VI_UP_KEY || key == CONFIG_MENU_VI_DOWN_KEY
++			    || key == CONFIG_MENU_ALTERNATE_UP_KEY || key == CONFIG_MENU_ALTERNATE_DOWN_KEY) {
+ 				if (cur == old)
+ 					break;
+ 				if (old >= 0 && old < numitems && cur != -1)
+@@ -601,7 +620,13 @@
+ 
+ 			if (warp)
+ 				restoremouse();
+-			if (key == CONFIG_MENU_SELECT_KEY) {
++			if (key == CONFIG_MENU_ABORT_KEY) {
++				if (commands[cur] != labels[cur]) {
++					spawn(commands[cur]);
++				}
++				return;
++			}
++			if (key == CONFIG_MENU_SELECT_KEY || key == CONFIG_MENU_ALTERNATE_SELECT_KEY) {
+ 				if (strcmp(labels[cur], "exit") == 0) {
+ 					if (commands[cur] != labels[cur]) {
+ 						spawn(commands[cur]);

06_Imakefile.diff

+Description: Fix dpkg-shlibdeps: warning: dependency on libXext.so.6
+Forwarded: yes
+Author: Daniel Echeverry <epsilon77@gmail.com>
+Origin: vendor
+Last-Update: 2010-11-06
+--- a/Imakefile
++++ b/Imakefile
+@@ -1,6 +1,6 @@
+        INCLUDES = -I$(TOP)
+-        DEPLIBS = $(DEPXLIB)
+-LOCAL_LIBRARIES = $(XLIB)
++        DEPLIBS = $(DEPXLIBONLY)
++LOCAL_LIBRARIES = $(XLIBONLY)
+         DEFINES = -DSHAPE #-DDEBUG -DDEBUG_EV
+            SRCS = 9menu.c
+            OBJS = 9menu.o

07_remove-resource-leak.diff

+Description: Fix resource leak:fp
+Forwarded: yes
+Author: Daniel Echeverry <epsilon77@gmail.com>
+Origin: vendor
+Last-Update: 2010-12-16
+
+--- a/9menu.c
++++ b/9menu.c
+@@ -326,6 +326,7 @@
+ 			strcpy(f_argv[nlabels], s);
+ 			++nlabels;
+ 		}
++	fclose(fp);
+ 	}
+ 
+ 	labels = (char **) malloc((numitems + nlabels) * sizeof(char *));

08_print_only.diff

+# HG changeset patch
+# Parent 66f628989313665f448cb5d7ae116c40c21cc21b
+Description: add -print option to avoid command execution
+Author: Julien Jehannet <julien@smaf.org>
+Last-Update: 2012-01-14
+
+diff --git a/9menu.1 b/9menu.1
+--- a/9menu.1
++++ b/9menu.1
+@@ -168,10 +168,13 @@ This option is particularly useful when 
+ .B \-version
+ This option prints the version of
+ .I 9menu
+ on the standard output, and then exits with an exit value of zero.
+ .TP
++.BR \-print
++Print only to stdout (no command execution).
++.TP
+ .B \-warp
+ Warp the mouse to the menu when the menu is uniconified.
+ After the selection is made, restore the mouse to where it was.
+ This option is particularly useful when combined with
+ .BR \-popdown .
+diff --git a/9menu.c b/9menu.c
+--- a/9menu.c
++++ b/9menu.c
+@@ -42,10 +42,16 @@
+  * spawn() changed to do exec directly if -popup, based on
+  * suggestion from
+  * Andrew Stribblehill
+  * a.d.stribblehill@durham.ac.uk
+  * June, 2004
++ *
++ * Code added for -print options.
++ * Julien Jehannet
++ * julien@smaf.org
++ * January, 2012
++ *
+  */
+ 
+ #include <stdio.h>
+ #include <fcntl.h>
+ #include <signal.h>
+@@ -141,10 +147,11 @@ char *filename;		/* file to read options
+ int popup;		/* true if we're a popup window */
+ int popdown;		/* autohide after running a command */
+ int iconic;		/* start iconified */
+ int teleport;		/* teleport the menu */
+ int warp;		/* warp the mouse */
++int print;		/* print only to stdout */
+ 
+ char **labels;		/* list of labels and commands */
+ char **commands;
+ int numitems;
+ 
+@@ -197,10 +204,12 @@ char **argv;
+ 			i++;
+ 		} else if (strcmp(argv[i], "-popup") == 0)
+ 			popup++;
+ 		else if (strcmp(argv[i], "-popdown") == 0)
+ 			popdown++;
++		else if (strcmp(argv[i], "-print") == 0)
++			print++;
+ 		else if (strcmp(argv[i], "-fg") == 0)
+ 			fgcname = argv[++i];
+ 		else if (strcmp(argv[i], "-bg") == 0)
+ 			bgcname = argv[++i];
+ 		else if (strcmp(argv[i], "-iconic") == 0)
+@@ -462,10 +471,14 @@ char *com;
+ 			com += 5;
+ 		}
+ 	}
+ 
+ 	close(ConnectionNumber(dpy));
++	if (print) {
++		printf("%s\n", com);
++		exit(0);
++	}
+ 	execl(shell, sh_base, "-c", com, NULL);
+ 	execl("/bin/sh", "sh", "-c", com, NULL);
+ 	_exit(1);
+ }
+ 
+@@ -485,11 +498,11 @@ void
+ usage()
+ {
+ 	fprintf(stderr, "usage: %s [-display displayname] [-font fname] ", progname);
+ 	fprintf(stderr, "[-file filename] [-path]");
+ 	fprintf(stderr, "[-geometry geom] [-shell shell]  [-label name] ");
+-	fprintf(stderr, "[-popup] [-popdown] [-iconic]  [-teleport] ");
++	fprintf(stderr, "[-popup] [-popdown] [-iconic] [-teleport] [-print]");
+ 	fprintf(stderr, "[-warp]  [-version] menitem:command ...\n");
+ 	exit(0);
+ }
+ 
+ /* run_menu --- put up the window, execute selected commands */
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.