├── 9menu.1 ├── 9menu.c ├── ChangeLog ├── Imakefile ├── Makefile ├── Makefile.noimake ├── README └── meson.build /9menu.1: -------------------------------------------------------------------------------- 1 | .TH 9MENU 1 "Feb 3 2023" 2 | .SH NAME 3 | 9menu \- create a menu to run commands 4 | .SH SYNOPSIS 5 | .B 9menu 6 | [ 7 | .BI \-bg " background-color" 8 | ] [ 9 | .BI \-display " displayname" 10 | ] [ 11 | .BI \-file " name" 12 | ] [ 13 | .BI \-fg " foreground-color" 14 | ] [ 15 | .BI \-font " fname" 16 | ] [ 17 | .BI \-geometry " geom" 18 | ] [ 19 | .B \-iconic 20 | ] [ 21 | .BI \-label " name" 22 | ] [ 23 | .B \-path 24 | ] [ 25 | .B \-popdown 26 | ] [ 27 | .B \-popup 28 | ] [ 29 | .BI \-shell " prog" 30 | ] [ 31 | .B \-teleport 32 | ] [ 33 | .B \-version 34 | ] [ 35 | .B \-warp 36 | ] 37 | .IR menuitem [: command ] 38 | \&... 39 | .SH DESCRIPTION 40 | .I 9menu 41 | is a simple program that accepts a list of menu item and command 42 | pairs on the command line. 43 | It creates a window that consists of nothing but a menu. 44 | When a particular item is selected, the corresponding command is executed. 45 | .PP 46 | Either 47 | .B Button1 48 | or 49 | .B Button3 50 | may be used to select an item. 51 | Alternatively, the UP-ARROW and DOWN-ARROW cursor keys may be used to 52 | highlight different items, with ENTER used to select the 53 | highlighted item. 54 | .PP 55 | Menu items and commands are separated by a colon. The colon and command 56 | are optional. If they are missing, then the menu item is assumed to be 57 | a command that can be executed directly. 58 | .PP 59 | A menu item consisting of the word 60 | .B exit 61 | causes 62 | .I 9menu 63 | to exit when it is selected. 64 | Otherwise, to stop 65 | .IR 9menu , 66 | delete it using the window manager. 67 | The 68 | .B exit 69 | menu item can be anywhere in the list, although by convention it is last. 70 | If a command is supplied along with the 71 | .B exit 72 | item, that command is executed before 73 | .I 9menu 74 | exits. 75 | .PP 76 | If a menu item's command starts with the word 77 | .BR exec , 78 | .I 9menu 79 | ceases operating after launching it. 80 | .PP 81 | .I 9menu 82 | accepts the following command line options, 83 | listed alphabetically: 84 | .TP 85 | .BI \-bg " background-color" 86 | Set the background color to 87 | .IR background-color . 88 | By default, the background color is white. 89 | .TP 90 | .BI \-display " displayname" 91 | Use the X display 92 | .IR displayname , 93 | instead of the default display. 94 | .TP 95 | .BI \-file " filename" 96 | Read items to display from 97 | .IR filename , 98 | in addition to any other command line arguments. This is intended for use 99 | with 100 | .B #! 101 | in scripts. 102 | A 103 | .I filename 104 | of 105 | .B - 106 | causes 107 | .I 9menu 108 | to read items from standard input. 109 | .TP 110 | .BI \-fg " foreground-color" 111 | Set the foreground color to 112 | .IR foreground-color . 113 | By default, the foreground color is black. 114 | .TP 115 | .BI \-font " fname" 116 | Use the font 117 | .IR fname , 118 | instead of one of the default fonts built into 119 | .IR 9wm . 120 | .TP 121 | .BI \-geometry " geom" 122 | Use 123 | .I geom 124 | (a geometry in standard X format) as the geometry of the menu. 125 | This is most useful for specifying the initial location of the menu. 126 | Note that 127 | .I 9menu 128 | overrides the size part of the geometry specification. The window is 129 | always just large enough to hold the menu. 130 | .TP 131 | .B \-iconic 132 | Start up in the iconified state. 133 | .TP 134 | .BI \-label " name" 135 | Change both the window and icon labels of the window to 136 | .IR name . 137 | The default label is the last component of the path used to run 138 | .IR 9menu , 139 | typically, 140 | .BR 9menu . 141 | .TP 142 | .B \-path 143 | Append the current directory to the command search path. 144 | .TP 145 | .B \-popdown 146 | Once an item is selected, automatically iconify the menu window. 147 | .TP 148 | .B \-popup 149 | Act like a pop-up menu. Once a menu item is selected, 150 | .I 9menu 151 | exits. 152 | This option overrides 153 | .BR \-popdown . 154 | .TP 155 | .BI \-shell " prog" 156 | Use 157 | .I prog 158 | as the shell to run commands, instead of 159 | .BR /bin/sh . 160 | A popular alternative shell is 161 | .IR rc (1). 162 | If the shell cannot be executed, 163 | .I 9menu 164 | then 165 | .I silently 166 | falls back to using 167 | .BR /bin/sh . 168 | .TP 169 | .B \-teleport 170 | Move the menu to where the mouse is when the menu is uniconified. 171 | This option is particularly useful when combined with 172 | .BR \-popdown . 173 | .TP 174 | .B \-version 175 | Print the version of 176 | .I 9menu 177 | on the standard output, and then exit with an exit value of zero. 178 | .TP 179 | .B \-warp 180 | Warp the mouse to the menu when the menu is uniconified. 181 | After the selection is made, restore the mouse to where it was. 182 | This option is particularly useful when combined with 183 | .BR \-popdown . 184 | .PP 185 | .I 9menu 186 | grabs the focus so that the UP and DOWN arrow keys will work. 187 | .SH EXAMPLES 188 | .ft B 189 | .nf 190 | 9menu \-label Remotes xterm 'acme:ssh acme xterm' 'herman:ssh herman 9term' & 191 | .sp 192 | 9menu \-label 'X progs' gv xdvi xeyes xneko exit & 193 | .ft 194 | .fi 195 | .SH SEE ALSO 196 | .IR sam (1), 197 | .IR 9term (1), 198 | .IR 9wm (1), 199 | .IR rc (1). 200 | .PP 201 | .IR "The Plan 9 Programmer's Manual" . 202 | .SH VERSION 203 | This man page documents 204 | .I 9menu 205 | version 1.11. 206 | .PP 207 | Source code is available from 208 | .BR ftp://ftp.freefriends.org/arnold/Source/9menu.shar.gz . 209 | .PP 210 | The code with full history is also available via Git from 211 | .BR http://github.com/arnoldrobbins/9menu . 212 | .SH BUGS 213 | This program has grown to have too many options. 214 | .SH AUTHORS 215 | The initial idea for this program was by Arnold Robbins, after having 216 | worked with John Mackin's GWM Blit emulation. 217 | Matty Farrow wrote a version using libXg, from which some ideas were borrowed. 218 | This code was written by David Hogan and Arnold Robbins. 219 | Rich Salz motivated the 220 | .B \-shell 221 | option. 222 | Christopher Platt motivated the 223 | .B \-teleport 224 | option. 225 | John O'Donnell supplied the basic code for the 226 | .B \-fg 227 | and 228 | .B \-bg 229 | options. 230 | Peter Seebach provided the base code for the 231 | .B \-file 232 | and 233 | .B \-path 234 | options. 235 | Matthias Bauer made it work with the keyboard. 236 | -------------------------------------------------------------------------------- /9menu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 9menu.c 3 | * 4 | * This program puts up a window that is just a menu, and executes 5 | * commands that correspond to the items selected. 6 | * 7 | * Initial idea: Arnold Robbins 8 | * Version using libXg: Matty Farrow (some ideas borrowed) 9 | * This code by: David Hogan and Arnold Robbins 10 | * 11 | * Copyright (c), Arnold Robbins and David Hogan 12 | * 13 | * Arnold Robbins 14 | * arnold@skeeve.com 15 | * October, 1994 16 | * 17 | * Code added to cause pop-up (unIconify) to move menu to mouse. 18 | * Christopher Platt 19 | * platt@coos.dartmouth.edu 20 | * May, 1995 21 | * 22 | * Said code moved to -teleport option, and -warp option added. 23 | * Arnold Robbins 24 | * June, 1995 25 | * 26 | * Code added to allow -fg and -bg colors. 27 | * John M. O'Donnell 28 | * odonnell@stpaul.lampf.lanl.gov 29 | * April, 1997 30 | * 31 | * Code added for -file and -path options. 32 | * Peter Seebach 33 | * seebs@plethora.net 34 | * October, 2001 35 | * 36 | * Code added to allow up and down arrow keys to go up 37 | * and down menu and RETURN to select an item. 38 | * Matthias Bauer 39 | * bauerm@immd1.informatik.uni-erlangen.de 40 | * June, 2003 41 | * 42 | * spawn() changed to do exec directly if -popup, based on 43 | * suggestion from 44 | * Andrew Stribblehill 45 | * a.d.stribblehill@durham.ac.uk 46 | * June, 2004 47 | * 48 | * Allow "-" to mean read info from stdin. 49 | * suggestion from 50 | * Peter Bailey, by way of 51 | * Andrew Stribblehill 52 | * a.d.stribblehill@durham.ac.uk 53 | * August, 2005 54 | * 55 | * Fix compile warnings (getcwd and getting a key sym). 56 | * Arnold Robbins 57 | * January, 2015. 58 | * 59 | * Let 9menu get the focus so that the arrow keys can be 60 | * used. Report and fix from Ullrich Horlacher. 61 | * framstag@rus.uni-stuttgart.de 62 | * January, 2023. 63 | */ 64 | 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | #include 72 | #include 73 | #include 74 | #include 75 | #include 76 | #include 77 | #include 78 | #include 79 | #include 80 | #include 81 | #include 82 | #include 83 | #include 84 | 85 | char version[] = "9menu version 1.11"; 86 | 87 | Display *dpy; /* lovely X stuff */ 88 | int screen; 89 | Window root; 90 | Window menuwin; 91 | GC gc; 92 | unsigned long black; 93 | unsigned long white; 94 | char *fgcname = NULL; 95 | char *bgcname = NULL; 96 | Colormap defcmap; 97 | XColor color; 98 | XFontStruct *font; 99 | Atom wm_protocols; 100 | Atom wm_delete_window; 101 | int g_argc; /* for XSetWMProperties to use */ 102 | char **g_argv; 103 | int f_argc; /* for labels read from files */ 104 | char **f_argv; 105 | char *geometry = ""; 106 | int savex, savey; 107 | Window savewindow; 108 | 109 | char *fontlist[] = { /* default font list if no -font */ 110 | "pelm.latin1.9", 111 | "lucm.latin1.9", 112 | "blit", 113 | "9x15bold", 114 | "9x15", 115 | "lucidasanstypewriter-12", 116 | "fixed", 117 | NULL 118 | }; 119 | 120 | /* the 9menu icon, for garish window managers */ 121 | #define nine_menu_width 40 122 | #define nine_menu_height 40 123 | static unsigned char nine_menu_bits[] = { 124 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x04, 0x00, 125 | 0x80, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 126 | 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x04, 127 | 0x00, 0x80, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0xfc, 0xff, 0xff, 128 | 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 129 | 0xfc, 0xff, 0xff, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x04, 0x00, 130 | 0x80, 0xe0, 0x01, 0x04, 0x00, 0x80, 0xe0, 0x00, 0xfc, 0xff, 0xff, 0xe0, 131 | 0x01, 0xfc, 0xff, 0xff, 0x20, 0x03, 0x04, 0x00, 0x80, 0x00, 0x06, 0x04, 132 | 0x00, 0x80, 0x00, 0x0c, 0xfc, 0xff, 0xff, 0x00, 0x08, 0xfc, 0xff, 0xff, 133 | 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 134 | 0xfc, 0xff, 0xff, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x04, 0x00, 135 | 0x80, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 136 | 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x04, 137 | 0x00, 0x80, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0xfc, 0xff, 0xff, 138 | 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 139 | 0xfc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 140 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 141 | 142 | /* Modify this to your liking */ 143 | #define CONFIG_MENU_UP_KEY XK_Up 144 | #define CONFIG_MENU_DOWN_KEY XK_Down 145 | #define CONFIG_MENU_SELECT_KEY XK_Return 146 | 147 | char *progname; /* my name */ 148 | char *displayname; /* X display */ 149 | char *fontname; /* font */ 150 | char *labelname; /* window and icon name */ 151 | char *filename; /* file to read options or labels from */ 152 | bool popup = false; /* true if we're a popup window */ 153 | bool popdown = false; /* autohide after running a command */ 154 | bool iconic = false; /* start iconified */ 155 | bool teleport = false; /* teleport the menu */ 156 | bool warp = false; /* warp the mouse */ 157 | 158 | char **labels; /* list of labels and commands */ 159 | char **commands; 160 | int numitems; 161 | 162 | char *shell = "/bin/sh"; /* default shell */ 163 | 164 | extern void usage(), run_menu(), spawn(char *com), ask_wm_for_delete(); 165 | extern void reap(int sig), set_wm_hints(int wide, int high); 166 | extern void redraw(int cur, int high, int wide); 167 | extern void teleportmenu(int cur, int wide, int high); 168 | extern void warpmouse(int cur, int wide, int high); 169 | extern void restoremouse(); 170 | extern void memory(char *msg); 171 | extern int args(int argc, char **argv); 172 | 173 | /* memory --- print the out of memory message and die */ 174 | 175 | void 176 | memory(char *s) 177 | { 178 | fprintf(stderr, "%s: couldn't allocate memory for %s: %s\n", progname, s, strerror(errno)); 179 | exit(1); 180 | } 181 | 182 | /* args --- go through the argument list, set options */ 183 | 184 | int 185 | args(int argc, char **argv) 186 | { 187 | int i; 188 | 189 | if (argc == 0 || argv == NULL || argv[0][0] == '\0') 190 | return -1; 191 | 192 | for (i = 0; i < argc && argv[i] != NULL; i++) { 193 | if (strcmp(argv[i], "-display") == 0) { 194 | displayname = argv[i+1]; 195 | i++; 196 | } else if (strcmp(argv[i], "-file") == 0) { 197 | filename = argv[i+1]; 198 | i++; 199 | } else if (strcmp(argv[i], "-font") == 0) { 200 | fontname = argv[i+1]; 201 | i++; 202 | } else if (strcmp(argv[i], "-geometry") == 0) { 203 | geometry = argv[i+1]; 204 | i++; 205 | } else if (strcmp(argv[i], "-label") == 0) { 206 | labelname = argv[i+1]; 207 | i++; 208 | } else if (strcmp(argv[i], "-shell") == 0) { 209 | shell = argv[i+1]; 210 | i++; 211 | } else if (strcmp(argv[i], "-popup") == 0) 212 | popup = true; 213 | else if (strcmp(argv[i], "-popdown") == 0) 214 | popdown = true; 215 | else if (strcmp(argv[i], "-fg") == 0) 216 | fgcname = argv[++i]; 217 | else if (strcmp(argv[i], "-bg") == 0) 218 | bgcname = argv[++i]; 219 | else if (strcmp(argv[i], "-iconic") == 0) 220 | iconic = true; 221 | else if (strcmp(argv[i], "-path") == 0) { 222 | char pathbuf[MAXPATHLEN]; 223 | char *s, *t; 224 | 225 | s = getenv("PATH"); 226 | if (s != NULL) { 227 | /* append current dir to PATH */ 228 | char *cp = getcwd(pathbuf, MAXPATHLEN); 229 | t = malloc(strlen(s) + strlen(pathbuf) + 7); 230 | sprintf(t, "PATH=%s:%s", pathbuf, s); 231 | putenv(t); 232 | } 233 | } else if (strcmp(argv[i], "-teleport") == 0) 234 | teleport = true; 235 | else if (strcmp(argv[i], "-warp") == 0) 236 | warp = true; 237 | else if (strcmp(argv[i], "-version") == 0) { 238 | printf("%s\n", version); 239 | exit(0); 240 | } else if (argv[i][0] == '-') 241 | usage(); 242 | else 243 | break; 244 | } 245 | return i; 246 | } 247 | 248 | /* main --- crack arguments, set up X stuff, run the main menu loop */ 249 | 250 | int 251 | main(int argc, char **argv) 252 | { 253 | int i, j; 254 | char *cp; 255 | XGCValues gv; 256 | unsigned long mask; 257 | int nlabels = 0; 258 | 259 | g_argc = argc; 260 | g_argv = argv; 261 | 262 | /* set default label name */ 263 | if ((cp = strrchr(argv[0], '/')) == NULL) 264 | labelname = argv[0]; 265 | else 266 | labelname = ++cp; 267 | 268 | ++argv; 269 | --argc; 270 | 271 | /* and program name for diagnostics */ 272 | progname = labelname; 273 | 274 | i = args(argc, argv); 275 | 276 | numitems = argc - i; 277 | 278 | if (numitems <= 0 && filename == NULL) 279 | usage(); 280 | 281 | if (filename) { 282 | /* Read options and labels from file */ 283 | char fbuf[1024]; 284 | FILE *fp; 285 | 286 | if (strcmp(filename, "-") == 0) { 287 | fp = stdin; 288 | } else { 289 | fp = fopen(filename, "r"); 290 | } 291 | 292 | if (fp == NULL) { 293 | fprintf(stderr, "%s: couldn't open '%s': %s\n", progname, 294 | filename, strerror(errno)); 295 | exit(1); 296 | } 297 | 298 | while (fgets(fbuf, sizeof fbuf, fp)) { 299 | char *s = fbuf; 300 | strtok(s, "\n"); 301 | if (s[0] == '-') { 302 | char *temp[3]; 303 | temp[0] = s; 304 | temp[1] = strchr(s, ' '); 305 | if (temp[1]) { 306 | *(temp[1]++) = '\0'; 307 | s = malloc(strlen(temp[1]) + 1); 308 | if (s == NULL) 309 | memory("temporary argument"); 310 | strcpy(s, temp[1]); 311 | temp[1] = s; 312 | } 313 | temp[2] = 0; 314 | args(temp[1] ? 2 : 1, temp); 315 | continue; 316 | } 317 | if (s[0] == '#') 318 | continue; 319 | /* allow - in menu items to be escaped */ 320 | if (s[0] == '\\') 321 | ++s; 322 | /* allocate space */ 323 | if (f_argc < nlabels + 1) { 324 | int k; 325 | char **temp = malloc(sizeof(char *) * (f_argc + 5)); 326 | if (temp == 0) 327 | memory("temporary item"); 328 | 329 | for (k = 0; k < nlabels; k++) 330 | temp[k] = f_argv[k]; 331 | 332 | free(f_argv); 333 | f_argv = temp; 334 | f_argc += 5; 335 | } 336 | f_argv[nlabels] = malloc(strlen(s) + 1); 337 | if (f_argv[nlabels] == NULL) 338 | memory("temporary text"); 339 | strcpy(f_argv[nlabels], s); 340 | ++nlabels; 341 | } 342 | } 343 | 344 | labels = (char **) malloc((numitems + nlabels) * sizeof(char *)); 345 | commands = (char **) malloc((numitems + nlabels) * sizeof(char *)); 346 | if (commands == NULL || labels == NULL) 347 | memory("command and label arrays"); 348 | 349 | for (j = 0; j < numitems; j++) { 350 | labels[j] = argv[i + j]; 351 | if ((cp = strchr(labels[j], ':')) != NULL) { 352 | *cp++ = '\0'; 353 | commands[j] = cp; 354 | } else 355 | commands[j] = labels[j]; 356 | } 357 | 358 | /* 359 | * Now we no longer need i (our offset into argv) so we recycle it, 360 | * while keeping the old value of j! 361 | */ 362 | for (i = 0; i < nlabels; i++) { 363 | labels[j] = f_argv[i]; 364 | if ((cp = strchr(labels[j], ':')) != NULL) { 365 | *cp++ = '\0'; 366 | commands[j] = cp; 367 | } else 368 | commands[j] = labels[j]; 369 | ++j; 370 | } 371 | 372 | /* And now we merge the totals */ 373 | numitems += nlabels; 374 | 375 | dpy = XOpenDisplay(displayname); 376 | if (dpy == NULL) { 377 | fprintf(stderr, "%s: cannot open display", progname); 378 | if (displayname != NULL) 379 | fprintf(stderr, " %s", displayname); 380 | fprintf(stderr, "\n"); 381 | exit(1); 382 | } 383 | 384 | screen = DefaultScreen(dpy); 385 | root = RootWindow(dpy, screen); 386 | 387 | /* 388 | * This used to be 389 | * black = BlackPixel(dpy, screen); 390 | * white = WhitePixel(dpy, screen); 391 | */ 392 | defcmap = DefaultColormap(dpy, screen); 393 | if (fgcname == NULL 394 | || XParseColor(dpy, defcmap, fgcname, &color) == 0 395 | || XAllocColor(dpy, defcmap, &color) == 0) 396 | black = BlackPixel(dpy, screen); 397 | else 398 | black = color.pixel; 399 | 400 | if (bgcname == NULL 401 | || XParseColor(dpy, defcmap, bgcname, &color) == 0 402 | || XAllocColor(dpy, defcmap, &color) == 0) 403 | white = WhitePixel(dpy, screen); 404 | else 405 | white = color.pixel; 406 | 407 | /* try user's font first */ 408 | if (fontname != NULL) { 409 | font = XLoadQueryFont(dpy, fontname); 410 | if (font == NULL) 411 | fprintf(stderr, "%s: warning: can't load font %s\n", 412 | progname, fontname); 413 | } 414 | 415 | /* if no user font, try one of our default fonts */ 416 | if (font == NULL) { 417 | for (i = 0; fontlist[i] != NULL; i++) { 418 | font = XLoadQueryFont(dpy, fontlist[i]); 419 | if (font != NULL) 420 | break; 421 | } 422 | } 423 | 424 | if (font == NULL) { 425 | fprintf(stderr, "%s: fatal: cannot load a font\n", progname); 426 | exit(1); 427 | } 428 | 429 | gv.foreground = black^white; 430 | gv.background = white; 431 | gv.font = font->fid; 432 | gv.function = GXxor; 433 | gv.line_width = 0; 434 | mask = GCForeground | GCBackground | GCFunction | GCFont | GCLineWidth; 435 | gc = XCreateGC(dpy, root, mask, &gv); 436 | 437 | signal(SIGCHLD, reap); 438 | 439 | run_menu(); 440 | 441 | XCloseDisplay(dpy); 442 | exit(0); 443 | } 444 | 445 | /* spawn --- run a command */ 446 | 447 | void 448 | spawn(char *com) 449 | { 450 | int pid; 451 | static char *sh_base = NULL; 452 | 453 | if (sh_base == NULL) { 454 | sh_base = strrchr(shell, '/'); 455 | if (sh_base != NULL) 456 | sh_base++; 457 | else 458 | sh_base = shell; 459 | } 460 | 461 | /* 462 | * Since -popup means run command and exit, just 463 | * fall straight into exec code. Thus only fork 464 | * if not popup. 465 | */ 466 | if (! popup) { 467 | if (strncmp(com, "exec ", 5) != 0) { 468 | pid = fork(); 469 | if (pid < 0) { 470 | fprintf(stderr, "%s: can't fork: %s\n", progname, strerror(errno)); 471 | return; 472 | } else if (pid > 0) 473 | return; 474 | } else { 475 | com += 5; 476 | } 477 | } 478 | 479 | close(ConnectionNumber(dpy)); 480 | execl(shell, sh_base, "-c", com, NULL); 481 | execl("/bin/sh", "sh", "-c", com, NULL); 482 | _exit(1); 483 | } 484 | 485 | /* reap --- collect dead children */ 486 | 487 | void 488 | reap(int sig) 489 | { 490 | (void) wait((int *) NULL); 491 | signal(sig, reap); 492 | } 493 | 494 | /* usage --- print a usage message and die */ 495 | 496 | void 497 | usage() 498 | { 499 | fprintf(stderr, "usage: %s [-display displayname] [-font fname] ", progname); 500 | fprintf(stderr, "[-file filename] [-path]"); 501 | fprintf(stderr, "[-geometry geom] [-shell shell] [-label name] "); 502 | fprintf(stderr, "[-popup] [-popdown] [-iconic] [-teleport] "); 503 | fprintf(stderr, "[-warp] [-version] menitem:command ...\n"); 504 | exit(0); 505 | } 506 | 507 | /* run_menu --- put up the window, execute selected commands */ 508 | 509 | void 510 | run_menu() 511 | { 512 | XEvent ev; 513 | XClientMessageEvent *cmsg; 514 | KeySym key; 515 | int i, cur, old, wide, high, ico, dx, dy; 516 | 517 | dx = 0; 518 | for (i = 0; i < numitems; i++) { 519 | wide = XTextWidth(font, labels[i], strlen(labels[i])) + 4; 520 | if (wide > dx) 521 | dx = wide; 522 | } 523 | wide = dx; 524 | 525 | old = cur = -1; 526 | 527 | high = font->ascent + font->descent + 1; 528 | dy = numitems * high; 529 | 530 | set_wm_hints(wide, dy); 531 | 532 | ask_wm_for_delete(); 533 | 534 | #define MenuMask (ButtonPressMask|ButtonReleaseMask\ 535 | |LeaveWindowMask|PointerMotionMask|ButtonMotionMask\ 536 | |ExposureMask|StructureNotifyMask|KeyPressMask) 537 | 538 | XSelectInput(dpy, menuwin, MenuMask); 539 | 540 | XMapWindow(dpy, menuwin); 541 | 542 | ico = 1; /* warp to first item */ 543 | i = 0; /* save menu Item position */ 544 | 545 | for (;;) { 546 | XNextEvent(dpy, &ev); 547 | switch (ev.type) { 548 | default: 549 | fprintf(stderr, "%s: unknown ev.type %d\n", 550 | progname, ev.type); 551 | break; 552 | case ButtonRelease: 553 | /* allow button 1 or button 3 */ 554 | if (ev.xbutton.button == Button2) 555 | break; 556 | i = ev.xbutton.y/high; 557 | if (ev.xbutton.x < 0 || ev.xbutton.x > wide) 558 | break; 559 | else if (i < 0 || i >= numitems) 560 | break; 561 | if (warp) 562 | restoremouse(); 563 | if (strcmp(labels[i], "exit") == 0) { 564 | if (commands[i] != labels[i]) { 565 | spawn(commands[i]); 566 | } 567 | return; 568 | } 569 | spawn(commands[i]); 570 | if (popup) 571 | return; 572 | if (cur >= 0 && cur < numitems) 573 | XFillRectangle(dpy, menuwin, gc, 0, cur*high, wide, high); 574 | if (popdown) 575 | XIconifyWindow(dpy, menuwin, screen); 576 | cur = -1; 577 | break; 578 | case ButtonPress: 579 | case MotionNotify: 580 | old = cur; 581 | cur = ev.xbutton.y/high; 582 | if (ev.xbutton.x < 0 || ev.xbutton.x > wide) 583 | cur = -1; 584 | else if (cur < 0 || cur >= numitems) 585 | cur = -1; 586 | if (cur == old) 587 | break; 588 | if (old >= 0 && old < numitems) 589 | XFillRectangle(dpy, menuwin, gc, 0, old*high, wide, high); 590 | if (cur >= 0 && cur < numitems) 591 | XFillRectangle(dpy, menuwin, gc, 0, cur*high, wide, high); 592 | break; 593 | case KeyPress: 594 | /* http://stackoverflow.com/questions/9838385/replace-of-xkeycodetokeysym */ 595 | key = XkbKeycodeToKeysym(dpy, ev.xkey.keycode, 0, 596 | ev.xkey.state & ShiftMask ? 1 : 0); 597 | if (key != CONFIG_MENU_UP_KEY 598 | && key != CONFIG_MENU_DOWN_KEY 599 | && key != CONFIG_MENU_SELECT_KEY) 600 | break; 601 | 602 | /* adjust i so mapping will work */ 603 | if (key == CONFIG_MENU_UP_KEY) { 604 | old = cur; 605 | cur--; 606 | i--; 607 | } else if (key == CONFIG_MENU_DOWN_KEY) { 608 | old = cur; 609 | cur++; 610 | i++; 611 | } 612 | 613 | while (cur < 0) 614 | cur += numitems; 615 | 616 | cur %= numitems; 617 | 618 | if (key == CONFIG_MENU_UP_KEY || key == CONFIG_MENU_DOWN_KEY) { 619 | if (cur == old) 620 | break; 621 | if (old >= 0 && old < numitems && cur != -1) 622 | XFillRectangle(dpy, menuwin, gc, 0, old*high, wide, high); 623 | if (cur >= 0 && cur < numitems && cur != -1) 624 | XFillRectangle(dpy, menuwin, gc, 0, cur*high, wide, high); 625 | break; 626 | } 627 | 628 | if (warp) 629 | restoremouse(); 630 | if (key == CONFIG_MENU_SELECT_KEY) { 631 | if (strcmp(labels[cur], "exit") == 0) { 632 | if (commands[cur] != labels[cur]) { 633 | spawn(commands[cur]); 634 | } 635 | return; 636 | } 637 | spawn(commands[cur]); 638 | } 639 | 640 | if (popup) 641 | return; 642 | if (popdown) 643 | XIconifyWindow(dpy, menuwin, screen); 644 | break; 645 | case LeaveNotify: 646 | cur = old = -1; 647 | XClearWindow(dpy, menuwin); 648 | redraw(cur, high, wide); 649 | break; 650 | case ReparentNotify: 651 | case ConfigureNotify: 652 | /* 653 | * ignore these, they come from XMoveWindow 654 | * and are enabled by Struct.. 655 | */ 656 | break; 657 | case UnmapNotify: 658 | ico = 1; 659 | XClearWindow(dpy, menuwin); 660 | break; 661 | case MapNotify: 662 | if (ico) { 663 | if (teleport) 664 | teleportmenu(i, wide, high); 665 | else if (warp) 666 | warpmouse(i, wide, high); 667 | } 668 | XClearWindow(dpy, menuwin); 669 | redraw(cur = i, high, wide); 670 | ico = 0; 671 | break; 672 | case Expose: 673 | XClearWindow(dpy, menuwin); 674 | redraw(cur, high, wide); 675 | break; 676 | case ClientMessage: 677 | cmsg = &ev.xclient; 678 | if (cmsg->message_type == wm_protocols 679 | && cmsg->data.l[0] == wm_delete_window) 680 | return; 681 | case MappingNotify: /* why do we get this? */ 682 | break; 683 | } 684 | } 685 | } 686 | 687 | /* set_wm_hints --- set all the window manager hints */ 688 | 689 | void 690 | set_wm_hints(int wide, int high) 691 | { 692 | Pixmap iconpixmap; 693 | XWMHints *wmhints; 694 | XSizeHints *sizehints; 695 | XClassHint *classhints; 696 | XTextProperty wname, iname; 697 | 698 | if ((sizehints = XAllocSizeHints()) == NULL) 699 | memory("size hints"); 700 | 701 | if ((wmhints = XAllocWMHints()) == NULL) 702 | memory("window manager hints"); 703 | 704 | if ((classhints = XAllocClassHint()) == NULL) 705 | memory("class hints"); 706 | 707 | /* fill in hints in order to parse geometry spec */ 708 | sizehints->width = sizehints->min_width = sizehints->max_width = wide; 709 | sizehints->height = sizehints->min_height = sizehints->max_height = high; 710 | sizehints->flags = USSize|PSize|PMinSize|PMaxSize; 711 | if (XWMGeometry(dpy, screen, geometry, "", 1, sizehints, 712 | &sizehints->x, &sizehints->y, 713 | &sizehints->width, &sizehints->height, 714 | &sizehints->win_gravity) & (XValue|YValue)) 715 | sizehints->flags |= USPosition; 716 | 717 | /* override -geometry for size of window */ 718 | sizehints->width = sizehints->min_width = sizehints->max_width = wide; 719 | sizehints->height = sizehints->min_height = sizehints->max_height = high; 720 | 721 | if (XStringListToTextProperty(& labelname, 1, & wname) == 0) 722 | memory("window name structure"); 723 | 724 | if (XStringListToTextProperty(& labelname, 1, & iname) == 0) 725 | memory("icon name structure"); 726 | 727 | menuwin = XCreateSimpleWindow(dpy, root, sizehints->x, sizehints->y, 728 | sizehints->width, sizehints->height, 1, black, white); 729 | 730 | iconpixmap = XCreateBitmapFromData(dpy, menuwin, 731 | nine_menu_bits, 732 | nine_menu_width, 733 | nine_menu_height); 734 | 735 | wmhints->icon_pixmap = iconpixmap; 736 | wmhints->input = True; // grab focus so can use arrow keys 737 | if (iconic) 738 | wmhints->initial_state = IconicState; 739 | else 740 | wmhints->initial_state = NormalState; 741 | 742 | wmhints->flags = IconPixmapHint | StateHint | InputHint; 743 | 744 | classhints->res_name = progname; 745 | classhints->res_class = "9menu"; 746 | 747 | #ifdef SET_PROPERTIES_MANUALLY 748 | /* 749 | * For some reason, XSetWMProperties (see below) is failing 750 | * John O'Donnell replaces it with the following commands 751 | * (this leaves out XSetWMClientMachine, 752 | * and also environment variable checking from ClassHint) 753 | */ 754 | XSetWMName(dpy, menuwin, &wname); 755 | XSetWMIconName(dpy, menuwin, &iname); 756 | XSetCommand(dpy, menuwin, g_argv, g_argc); 757 | XSetWMHints(dpy, menuwin, wmhints); 758 | XSetClassHint(dpy, menuwin, classhints); 759 | XSetWMNormalHints(dpy, menuwin, sizehints); 760 | #else 761 | XSetWMProperties(dpy, menuwin, & wname, & iname, 762 | g_argv, g_argc, sizehints, wmhints, classhints); 763 | #endif 764 | } 765 | 766 | /* ask_wm_for_delete --- jump through hoops to ask WM to delete us */ 767 | 768 | void 769 | ask_wm_for_delete() 770 | { 771 | int status; 772 | 773 | wm_protocols = XInternAtom(dpy, "WM_PROTOCOLS", False); 774 | wm_delete_window = XInternAtom(dpy, "WM_DELETE_WINDOW", False); 775 | status = XSetWMProtocols(dpy, menuwin, & wm_delete_window, 1); 776 | 777 | if (status != True) 778 | fprintf(stderr, "%s: could not ask for clean delete\n", 779 | progname); 780 | } 781 | 782 | /* redraw --- actually redraw the menu */ 783 | 784 | void 785 | redraw(int cur, int high, int wide) 786 | { 787 | int tx, ty, i; 788 | 789 | for (i = 0; i < numitems; i++) { 790 | tx = (wide - XTextWidth(font, labels[i], strlen(labels[i]))) / 2; 791 | ty = i*high + font->ascent + 1; 792 | XDrawString(dpy, menuwin, gc, tx, ty, labels[i], strlen(labels[i])); 793 | } 794 | if (cur >= 0 && cur < numitems) 795 | XFillRectangle(dpy, menuwin, gc, 0, cur*high, wide, high); 796 | } 797 | 798 | /* teleportmenu --- move the menu to the right place */ 799 | 800 | void 801 | teleportmenu(int cur, int wide, int high) 802 | { 803 | int x, y, dummy; 804 | Window wdummy; 805 | 806 | if (XQueryPointer(dpy, menuwin, &wdummy, &wdummy, &x, &y, 807 | &dummy, &dummy, &dummy)) 808 | XMoveWindow(dpy, menuwin, x-wide/2, y-cur*high-high/2); 809 | } 810 | 811 | /* warpmouse --- bring the mouse to the menu */ 812 | 813 | void 814 | warpmouse(int cur, int wide, int high) 815 | { 816 | int dummy; 817 | Window wdummy; 818 | int offset; 819 | 820 | /* move tip of pointer into middle of menu item */ 821 | offset = (font->ascent + font->descent + 1) / 2; 822 | offset += 6; /* fudge factor */ 823 | 824 | if (XQueryPointer(dpy, menuwin, &wdummy, &wdummy, &savex, &savey, 825 | &dummy, &dummy, &dummy)) 826 | XWarpPointer(dpy, None, menuwin, 0, 0, 0, 0, 827 | wide/2, cur*high-high/2+offset); 828 | } 829 | 830 | /* restoremouse --- put the mouse back where it was */ 831 | 832 | void 833 | restoremouse() 834 | { 835 | XWarpPointer(dpy, menuwin, root, 0, 0, 0, 0, 836 | savex, savey); 837 | } 838 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 2023-02-03 Arnold D. Robbins 2 | 3 | * 9menu.c (set_wm_hints): Let 9menu get the focus so that the 4 | arrow keys can be used. Report and fix from Ullrich Horlacher. 5 | 6 | (version): Bump to 1.11. 7 | 8 | 2021-02-04 Anderson Torres 9 | 10 | * meson.build: New file. For people who prefer meson to make / 11 | imake / xmkmf. 12 | 13 | 2020-07-30 Arnold D. Robbins 14 | 15 | * 9menu.1: Some minor cleanups in troff usage and in wording. 16 | 17 | 2020-04-16 Arnold D. Robbins 18 | 19 | * 9menu.c (version): Bump to 1.10 (finally). 20 | (usage): Clean up white space in error messages. 21 | (args): Fix comparison in first int. Thanks to GCC. 22 | General: Change a number of variables from int to bool, and 23 | use . Use strerror(errno) in all relevant error messages. 24 | * 9menu.1: Increment the version. 25 | 26 | 2018-04-25 Arnold D. Robbins 27 | 28 | Updates suggested by Eric Lindblad . 29 | 30 | * 9menu.c (version): Remove the @(#) SCCS marker. Hasn't been 31 | necessary for decades, really. 32 | * 9menu.1: Update the Examples. 33 | 34 | 2016-01-07 Arnold D. Robbins 35 | 36 | * 9menu.c: Convert forward declarations to use prototypes. 37 | (run_menu): Bug fix. Increment/decrement `i' when keypress 38 | moves things up and down so that mouse moves to the right 39 | place upon remapping the window. 40 | 41 | 2015-06-25 Arnold D. Robbins 42 | 43 | * 9menu.1: Updated. 44 | 45 | 2015-03-19 Arnold D. Robbins 46 | 47 | * ChangeLog: Reconstituted from check-in logs and diffs. 48 | * 9menu.c: Typo fix. Convert all function signatures to 49 | ANSI style. 50 | * README: Update the date. 51 | 52 | 2015-01-14 Arnold D. Robbins 53 | 54 | * 9menu.c (main): Fix compile warnings. 55 | (run_menu): Call XkbKeycodeToKeysym() instead of XKeycodeToKeysym(). 56 | 57 | 2011-01-13 Arnold D. Robbins 58 | 59 | Allow - as input filename. Suggestion from Peter Bailey, by way of 60 | Andrew Stribblehill . From email 61 | August 2005. 62 | 63 | * 9menu.c (main): Allow - as input filename to mean stdin. 64 | (version): Increment to 1.9. 65 | * 9menu.1: Document same. 66 | * Makefile (CXXDEBUGFLAGS): Add -Wall. 67 | * Imakefile: Improved some. 68 | 69 | 2004-06-01 Arnold D. Robbins 70 | 71 | * README: Update the date. 72 | * 9menu.1: Update version to 1.8. 73 | * 9menu.c (main): Fix so -popup execs directly. 74 | Suggestion from Andrew Stribblehill . 75 | (version): Increment to 1.8. 76 | 77 | 2003-06-15 Arnold D. Robbins 78 | 79 | * README: Update the date. 80 | * 9menu.1: Update version to 1.7. Lots of editing and cleanup. 81 | * 9menu.c (run_menu): Make it work with the up and down arrow keys 82 | on the keyboard. Code contributed by Matthias Bauer 83 | 84 | (version): Increment to 1.7. 85 | 86 | 2002-04-16 Arnold D. Robbins 87 | 88 | * README: Update the date. 89 | * 9menu.1: Update version to 1.6. Document new options. 90 | My email address updated. 91 | * 9menu.c (main): New options, -file and -path. Code contributed 92 | by Peter Seebach , in October, 2001. 93 | My email address updated. 94 | (version): Increment to 1.6. 95 | * Makefile.noimake: Renamed from Makefile. 96 | * Imakefile: Created. 97 | * Makefile: Generated via imake. 98 | 99 | 2001-01-16 Arnold D. Robbins 100 | 101 | * README: Update the date. My email address updated. 102 | * 9menu.1: Update version to 1.5. Document new options. 103 | * 9menu.c (main): New options, -fg and -bg. Code supplied by 104 | John M. O'Donnell , in April, 1997. 105 | (version): Increment to 1.5. 106 | 107 | 1997-04-27 Arnold D. Robbins 108 | 109 | * 9menu.c (set_wm_hints): Fix typos in error messages. 110 | 111 | 1995-06-20 Arnold D. Robbins 112 | 113 | * README: Update the date. 114 | * 9menu.1: Update version to 1.4. Document new options. Option 115 | ordering regularized and consistent everywhere. 116 | * 9menu.c (main): New options, -warp and -teleport. Christopher Platt 117 | motivated the -teleport option. Option 118 | ordering regularized and consistent everywhere. 119 | (redraw, teleportmenu, warpmouse, restoremouse): New functions. 120 | (version): Increment to 1.4. 121 | 122 | 1995-01-01 Arnold D. Robbins 123 | 124 | * README: Update the date. 125 | * 9menu.c (reap): Portability fix. 126 | (usage): Fix typo. 127 | (version): Increment to 1.3. 128 | 129 | 1994-12-25 Arnold D. Robbins 130 | 131 | * README: Update the date. 132 | * 9menu.c (reap): Portability fix. 133 | (usage): Update usage. 134 | (version): Increment to 1.2. 135 | 136 | 1994-12-14 Arnold D. Robbins 137 | 138 | * README: Update the date. 139 | * 9wm.DIFF: Removed. 140 | * 9menu.c (main): Add -shell option. Motivated by Rich Salz. 141 | (run_menu): Use XTextWidth in size calculations per fix for 142 | 9wm from Dave Edmondson . Add empty MappingNotify. 143 | (version): Increment to 1.1. 144 | * 9menu.1: Document -shell option. 145 | 146 | 1994-11-10 Arnold D. Robbins 147 | 148 | * 9menu.c: Add copyright line. 149 | * README: New file. 150 | 151 | 1994-11-09 Arnold D. Robbins 152 | 153 | * 9menu.c (main): Change call to signal(). 154 | (reap): New function to reap dead children. 155 | 156 | 1994-10-31 Arnold D. Robbins 157 | 158 | * 9menu.c (main): New options -geometry and -version. 159 | -iconic changed to -popdown. 160 | (nine_menu_bits): Update the icon. 161 | (set_wm_hints): New function. 162 | (usage): Updated. 163 | (version): Increment to 1.0. 164 | * 9menu.1: Document the new options, update examples. 165 | 166 | 1994-10-23 Arnold D. Robbins 167 | 168 | * 9menu.c (nine_menu_bits): Add an icon. 169 | (main): Add -iconic option. Update comments with credits. 170 | Use labels to compute menu size. Add comments where needed. 171 | Add -popup option. 172 | (progname): Use everywhere. 173 | (usage): Updated. 174 | (run_menu): Do iconifying of menu. 175 | * 9menu.1: Created. 176 | * Makefile: Created. 177 | 178 | 1994-10-22 Arnold D. Robbins 179 | 180 | * 9menu.c: Created. Not sure of exactly when, but first check-in 181 | to RCS was on this date. 182 | -------------------------------------------------------------------------------- /Imakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = -I$(TOP) 2 | DEPLIBS = $(DEPXLIBONLY) 3 | LOCAL_LIBRARIES = $(XLIBONLY) 4 | DEFINES = -DSHAPE #-DDEBUG -DDEBUG_EV 5 | SRCS = 9menu.c 6 | OBJS = 9menu.o 7 | 8 | ComplexProgramTarget(9menu) 9 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Makefile generated by imake - do not edit! 2 | # $TOG: imake.c /main/104 1998/03/24 12:45:15 kaleb $ 3 | 4 | # ---------------------------------------------------------------------- 5 | # Makefile generated from "Imake.tmpl" and 6 | # $TOG: Imake.tmpl /main/249 1997/10/13 15:28:56 kaleb $ 7 | # 8 | # 9 | # 10 | # 11 | # $XFree86: xc/config/cf/Imake.tmpl,v 3.81 2000/06/25 20:17:28 dawes Exp $ 12 | # ---------------------------------------------------------------------- 13 | 14 | all:: 15 | 16 | .SUFFIXES: .i 17 | 18 | # $TOG: Imake.cf /main/30 1998/04/28 13:55:25 barstow $ 19 | 20 | # $XFree86: xc/config/cf/Imake.cf,v 3.58 2000/06/30 17:15:05 dawes Exp $ 21 | 22 | # Keep cpp from replacing path elements containing i486/i586/i686 23 | 24 | # ----------------------------------------------------------------------- 25 | # site-specific configuration parameters that need to come before 26 | # the platform-specific parameters - edit site.def to change 27 | 28 | # site: $TOG: site.sample /main/r64_final/1 1998/02/05 16:28:49 kaleb $ 29 | 30 | # site: $XFree86: xc/config/cf/site.def,v 3.24 2000/06/25 20:17:29 dawes Exp $ 31 | 32 | # $XFree86: xc/config/cf/xf86site.def,v 3.162 2000/05/31 07:14:52 eich Exp $ 33 | 34 | # ---------------------------------------------------------------------- 35 | # platform-specific configuration parameters - edit linux.cf to change 36 | 37 | # platform: $TOG: linux.cf /main/47 1998/04/17 11:32:51 mgreess 38 | # platform: $XFree86: xc/config/cf/linux.cf,v 3.130 2000/07/07 20:06:56 tsi Exp $ 39 | 40 | # operating system: Linux 2.2.16-22 i686 [ELF] (2.2.16) 41 | # libc: (6.1.92) 42 | # binutils: (30) 43 | 44 | # $TOG: lnxLib.rules /main/14 1998/03/16 11:15:30 mgreess $ 45 | # $XFree86: xc/config/cf/lnxLib.rules,v 3.38 2000/06/15 20:49:56 dawes Exp $ 46 | 47 | # $XFree86: xc/config/cf/xfree86.cf,v 3.303 2000/08/01 20:52:18 dawes Exp $ 48 | 49 | # $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $ 50 | 51 | AFB_DEFS = -DUSE_AFB 52 | 53 | DRIVERSDKDIR = $(USRLIBDIR)/Server 54 | DRIVERSDKMODULEDIR = $(USRLIBDIR)/Server/modules 55 | DRIVERSDKINCLUDEDIR = $(USRLIBDIR)/Server/include 56 | 57 | XF86SRC = $(SERVERSRC)/hw/xfree86 58 | XF86COMSRC = $(XF86SRC)/common 59 | XF86PARSERSRC = $(XF86SRC)/parser 60 | XF86OSSRC = $(XF86SRC)/os-support 61 | XF86DRIVERSRC = $(XF86SRC)/drivers 62 | DRIVERSRC = $(XF86DRIVERSRC) 63 | 64 | XFREE86DOCDIR = $(DOCDIR) 65 | XFREE86PSDOCDIR = $(DOCPSDIR) 66 | XFREE86HTMLDOCDIR = $(DOCHTMLDIR) 67 | XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japanese 68 | 69 | # $XConsortium: xf86.rules /main/9 1996/10/31 14:54:26 kaleb $ 70 | # $XFree86: xc/config/cf/xf86.rules,v 3.31 2000/03/31 22:55:15 dawes Exp $ 71 | 72 | # ---------------------------------------------------------------------- 73 | # site-specific configuration parameters that go after 74 | # the platform-specific parameters - edit site.def to change 75 | 76 | # site: $TOG: site.sample /main/r64_final/1 1998/02/05 16:28:49 kaleb $ 77 | 78 | # site: $XFree86: xc/config/cf/site.def,v 3.24 2000/06/25 20:17:29 dawes Exp $ 79 | 80 | # --------------------------------------------------------------------- 81 | # Imake rules for building libraries, programs, scripts, and data files 82 | # rules: $TOG: Imake.rules /main/227 1998/02/02 12:07:57 kaleb $ 83 | # 84 | # 85 | # 86 | # 87 | # rules: $XFree86: xc/config/cf/Imake.rules,v 3.76 2000/06/15 20:49:55 dawes Exp $ 88 | 89 | _NULLCMD_ = @ echo -n 90 | 91 | GLIDE2INCDIR = 92 | 93 | GLIDE3INCDIR = 94 | 95 | TKLIBNAME = 96 | 97 | TKLIBDIR = 98 | 99 | TCLLIBNAME = 100 | 101 | TCLIBDIR = 102 | 103 | PATHSEP = / 104 | SHELL = /bin/sh 105 | 106 | TOP = . 107 | CURRENT_DIR = . 108 | 109 | IMAKE = imake 110 | DEPEND = gccmakedep 111 | MKDIRHIER = mkdir -p 112 | REVPATH = revpath 113 | EXPORTLISTGEN = 114 | RMAN = rman 115 | RMANOPTIONS = -f HTML 116 | CONFIGSRC = $(TOP)/config 117 | IMAKESRC = $(CONFIGSRC)/imake 118 | DEPENDSRC = $(CONFIGSRC)/util 119 | 120 | INCROOT = /usr/X11R6/include 121 | USRLIBDIR = /usr/X11R6/lib 122 | VARLIBDIR = /var/lib 123 | SYSTEMUSRLIBDIR = /usr/lib 124 | SYSTEMUSRINCDIR = /usr/include 125 | SHLIBDIR = /usr/X11R6/lib 126 | LINTLIBDIR = $(USRLIBDIR)/lint 127 | MANPATH = /usr/X11R6/man 128 | MANSOURCEPATH = $(MANPATH)/man 129 | MANDIR = $(MANSOURCEPATH)1 130 | LIBMANDIR = $(MANSOURCEPATH)3 131 | FILEMANDIR = $(MANSOURCEPATH)5 132 | MISCMANDIR = $(MANSOURCEPATH)$(MISCMANSUFFIX) 133 | DRIVERMANDIR = $(MANSOURCEPATH)$(DRIVERMANSUFFIX) 134 | LOGDIRECTORY = /var/log 135 | 136 | VARRUNDIR = /var/run 137 | 138 | VARDBDIR = /var/lib 139 | 140 | AR = ar clq 141 | BOOTSTRAPCFLAGS = 142 | CC = gcc 143 | AS = as 144 | 145 | .SUFFIXES: .cc 146 | 147 | CXX = c++ 148 | CXXFILT = c++filt 149 | CXXLIB = 150 | CXXDEBUGFLAGS = -O2 -fno-strength-reduce -Wall 151 | CXXDEPENDINCLUDES = 152 | CXXEXTRA_DEFINES = 153 | CXXEXTRA_INCLUDES = 154 | CXXSTD_DEFINES = -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(CXXPROJECT_DEFINES) 155 | CXXOPTIONS = 156 | CXXINCLUDES = $(INCLUDES) $(TOP_INCLUDES) $(CXXEXTRA_INCLUDES) 157 | CXXDEFINES = $(CXXINCLUDES) $(CXXSTD_DEFINES) $(THREADS_CXXDEFINES) $(CXXEXTRA_DEFINES) $(DEFINES) 158 | CXXFLAGS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) 159 | 160 | COMPRESS = compress 161 | GZIPCMD = gzip 162 | CPP = /lib/cpp $(STD_CPP_DEFINES) 163 | RAWCPP = /lib/cpp -undef $(STD_CPP_OPTIONS) 164 | PREPROCESSCMD = cpp $(STD_CPP_DEFINES) 165 | INSTALL = install 166 | INSTALLFLAGS = -c 167 | LD = ld 168 | LEX = flex -l 169 | M4 = m4 170 | M4FLAGS = 171 | LEXLIB = -lfl 172 | YACC = bison -y 173 | CCYACC = bison -y 174 | LINT = lint 175 | LINTLIBFLAG = -C 176 | LINTOPTS = -axz 177 | LN = ln -s 178 | MAKE = make 179 | MV = mv -f 180 | CP = cp 181 | 182 | RANLIB = ranlib 183 | RANLIBINSTFLAGS = 184 | 185 | RM = rm -f 186 | MANSUFFIX = 1x 187 | LIBMANSUFFIX = 3x 188 | FILEMANSUFFIX = 5x 189 | MISCMANSUFFIX = 7 190 | DRIVERMANSUFFIX = 4 191 | MANDEFS = -D__filemansuffix__=$(FILEMANSUFFIX) -D__miscmansuffix__=$(MISCMANSUFFIX) -D__drivermansuffix__=$(DRIVERMANSUFFIX) -D__projectroot__=$(PROJECTROOT) 192 | 193 | TROFF = groff -Tps 194 | NROFF = nroff 195 | MSMACROS = -ms 196 | MANMACROS = -man 197 | TBL = tbl 198 | EQN = eqn 199 | NEQN = neqn 200 | COL = col 201 | COLFLAGS = -b 202 | MODCC = gcc 203 | MODCPP = /lib/cpp 204 | MODCFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREAD_CFLAGS) $(ALLDEFINES) 205 | MODAS = as 206 | MODASFLAGS = 207 | MODLD = ld 208 | MODLDFLAGS = 209 | MODLDCOMBINEFLAGS = -r 210 | MODAR = ar clq 211 | MODRANLIB = 212 | 213 | STD_INCLUDES = 214 | STD_CPP_OPTIONS = -traditional 215 | STD_CPP_DEFINES = -traditional -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(PROJECT_DEFINES) 216 | STD_DEFINES = -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(PROJECT_DEFINES) 217 | EXTRA_LOAD_FLAGS = 218 | EXTRA_LDOPTIONS = 219 | EXTRA_LIBRARIES = 220 | TAGS = ctags 221 | 222 | PARALLELMFLAGS = 223 | 224 | SHAREDCODEDEF = 225 | SHLIBDEF = 226 | 227 | SHLIBLDFLAGS = -shared 228 | 229 | PICFLAGS = -fPIC 230 | 231 | CXXPICFLAGS = -fPIC 232 | 233 | PROTO_DEFINES = -DFUNCPROTO=15 -DNARROWPROTO 234 | 235 | INSTPGMFLAGS = 236 | 237 | INSTBINFLAGS = -m 0755 238 | INSTUIDFLAGS = -m 4711 239 | INSTLIBFLAGS = -m 0644 240 | INSTINCFLAGS = -m 0444 241 | INSTMANFLAGS = -m 0444 242 | INSTDATFLAGS = -m 0444 243 | INSTKMEMFLAGS = -m 4711 244 | 245 | PROJECTROOT = /usr/X11R6 246 | 247 | CDEBUGFLAGS = -O2 -fno-strength-reduce 248 | CCOPTIONS = 249 | 250 | ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES) 251 | ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(MODULE_DEFINES) $(DEFINES) 252 | CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(MODULE_CFLAGS) $(ALLDEFINES) 253 | LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES) 254 | LDPRELIB = -L$(USRLIBDIR) 255 | LDPOSTLIB = 256 | LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS) 257 | CXXLDOPTIONS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_CXXLDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS) 258 | 259 | LDLIBS = $(LDPOSTLIBS) $(THREADS_LIBS) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) 260 | 261 | CCLINK = $(CC) 262 | 263 | CXXLINK = $(CXX) 264 | 265 | LDSTRIPFLAGS = -x 266 | LDCOMBINEFLAGS = -r 267 | DEPENDFLAGS = 268 | 269 | # Not sure this belongs here 270 | TKLIBDIR = 271 | TKINCDIR = 272 | TKLIBNAME = 273 | TKLIBRARY = -L$(TKLIBDIR) -l$(TKLIBNAME) 274 | TCLLIBDIR = 275 | TCLINCDIR = 276 | TCLLIBNAME = 277 | TCLLIBRARY = -L$(TCLLIBDIR) -l$(TCLLIBNAME) 278 | 279 | MACROFILE = linux.cf 280 | RM_CMD = $(RM) 281 | 282 | IMAKE_DEFINES = 283 | 284 | IRULESRC = $(CONFIGDIR) 285 | IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) 286 | 287 | ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/X11.tmpl $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) $(IRULESRC)/xfree86.cf $(IRULESRC)/xf86.rules $(IRULESRC)/xf86site.def $(IRULESRC)/host.def $(EXTRA_ICONFIGFILES) 288 | 289 | # $TOG: X11.rules /main/4 1997/04/30 15:23:24 kaleb $ 290 | 291 | # $XFree86: xc/config/cf/X11.rules,v 1.4 1997/09/09 11:56:20 hohndel Exp $ 292 | 293 | # ---------------------------------------------------------------------- 294 | # X Window System Build Parameters and Rules 295 | # $TOG: X11.tmpl /main/308 1998/06/16 15:14:24 msr $ 296 | # 297 | # 298 | # 299 | # 300 | # $XFree86: xc/config/cf/X11.tmpl,v 1.72 2000/08/01 20:28:37 dawes Exp $ 301 | 302 | STICKY_DEFINES = -DHAS_STICKY_DIR_BIT 303 | 304 | FCHOWN_DEFINES = -DHAS_FCHOWN 305 | 306 | # ----------------------------------------------------------------------- 307 | # X Window System make variables; these need to be coordinated with rules 308 | 309 | XTOP = $(TOP) 310 | BINDIR = /usr/X11R6/bin 311 | BUILDINCROOT = $(TOP)/exports 312 | BUILDINCDIR = $(BUILDINCROOT)/include 313 | BUILDINCTOP = ../.. 314 | BUILDLIBDIR = $(TOP)/exports/lib 315 | BUILDLIBTOP = ../.. 316 | BUILDBINDIR = $(TOP)/exports/bin 317 | BUILDBINTOP = ../.. 318 | BUILDMODULEDIR = $(BUILDLIBDIR)/modules 319 | BUILDMODULETOP = $(BUILDLIBTOP)/.. 320 | XBUILDINCROOT = $(XTOP)/exports 321 | XBUILDINCDIR = $(XBUILDINCROOT)/include/X11 322 | XBUILDINCTOP = ../../.. 323 | XBUILDBINDIR = $(XBUILDINCROOT)/bin 324 | INCDIR = $(INCROOT) 325 | ADMDIR = /usr/adm 326 | LIBDIR = $(USRLIBDIR)/X11 327 | LIBEXECDIR = /usr/X11R6/libexec 328 | MODULEDIR = $(USRLIBDIR)/modules 329 | TOP_X_INCLUDES = 330 | 331 | VARDIR = /var/X11 332 | 333 | ETCX11DIR = /etc/X11 334 | 335 | CONFDIR = $(ETCX11DIR) 336 | 337 | DOCDIR = $(LIBDIR)/doc 338 | DOCHTMLDIR = $(DOCDIR)/html 339 | DOCPSDIR = $(DOCDIR)/PostScript 340 | FONTDIR = $(LIBDIR)/fonts 341 | ENCODINGSDIR = $(FONTDIR)/encodings 342 | XINITDIR = $(LIBDIR)/xinit 343 | XDMDIR = $(LIBDIR)/xdm 344 | XDMVARDIR = $(VARLIBDIR)/xdm 345 | TWMDIR = $(LIBDIR)/twm 346 | XSMDIR = $(LIBDIR)/xsm 347 | NLSDIR = $(LIBDIR)/nls 348 | XLOCALEDIR = $(LIBDIR)/locale 349 | PEXAPIDIR = $(LIBDIR)/PEX 350 | LBXPROXYDIR = $(LIBDIR)/lbxproxy 351 | PROXYMANAGERDIR = $(LIBDIR)/proxymngr 352 | XPRINTDIR = $(LIBDIR)/xserver 353 | XAPPLOADDIR = $(LIBDIR)/app-defaults 354 | FONTCFLAGS = -t 355 | 356 | INSTAPPFLAGS = $(INSTDATFLAGS) 357 | 358 | RGB = $(BINDIR)/rgb 359 | FONTC = $(BINDIR)/bdftopcf 360 | MKFONTDIR = $(BINDIR)/mkfontdir 361 | MKHTMLINDEX = $(BINDIR)/mkhtmlindex 362 | 363 | HTMLINDEXCMD = HtmlIndexCmd 364 | 365 | DOCUTILSRC = $(XTOP)/doc/util 366 | CLIENTSRC = $(TOP)/clients 367 | DEMOSRC = $(TOP)/demos 368 | XDOCMACROS = $(DOCUTILSRC)/macros.t 369 | XIDXMACROS = $(DOCUTILSRC)/indexmacros.t 370 | PROGRAMSRC = $(TOP)/programs 371 | LIBSRC = $(XTOP)/lib 372 | FONTSRC = $(XTOP)/fonts 373 | ENCODINGSSRC = $(FONTSRC)/encodings 374 | INCLUDESRC = $(BUILDINCROOT)/include 375 | XINCLUDESRC = $(INCLUDESRC)/X11 376 | SERVERSRC = $(XTOP)/programs/Xserver 377 | CONTRIBSRC = $(XTOP)/../contrib 378 | UNSUPPORTEDSRC = $(XTOP)/unsupported 379 | DOCSRC = $(XTOP)/doc 380 | RGBSRC = $(XTOP)/programs/rgb 381 | BDFTOPCFSRC = $(PROGRAMSRC)/bdftopcf 382 | MKFONTDIRSRC = $(PROGRAMSRC)/mkfontdir 383 | FONTSERVERSRC = $(PROGRAMSRC)/xfs 384 | FONTINCSRC = $(XTOP)/include/fonts 385 | EXTINCSRC = $(XTOP)/include/extensions 386 | FTSOURCEDIR = $(TOP)/extras/FreeType 387 | XTTSOURCEDIR = $(TOP)/extras/X-TrueType 388 | MESASRCDIR = $(TOP)/extras/Mesa 389 | PSWRAPSRC = $(XTOP)/config/pswrap 390 | TRANSCOMMSRC = $(LIBSRC)/xtrans 391 | TRANS_INCLUDES = -I$(TRANSCOMMSRC) 392 | CONNECTION_FLAGS = -DUNIXCONN -DTCPCONN $(STICKY_DEFINES) $(FCHOWN_DEFINES) 393 | 394 | XENVLIBDIR = $(USRLIBDIR) 395 | CLIENTENVSETUP = LD_LIBRARY_PATH=$(XENVLIBDIR) 396 | 397 | # $TOG: lnxLib.tmpl /main/7 1998/03/20 14:26:41 mgreess $ 398 | # $XFree86: xc/config/cf/lnxLib.tmpl,v 3.12 1999/06/27 14:07:17 dawes Exp $ 399 | 400 | XLIBSRC = $(LIBSRC)/X11 401 | 402 | SOXLIBREV = 6.1 403 | DEPXONLYLIB = 404 | XONLYLIB = -lX11 405 | 406 | LINTXONLY = $(LINTLIBDIR)/llib-lX11.ln 407 | 408 | XLIBONLY = $(XONLYLIB) 409 | 410 | XEXTLIBSRC = $(LIBSRC)/Xext 411 | 412 | SOXEXTREV = 6.4 413 | DEPEXTENSIONLIB = 414 | EXTENSIONLIB = -lXext 415 | 416 | LINTEXTENSION = $(LINTLIBDIR)/llib-lXext.ln 417 | 418 | LINTEXTENSIONLIB = $(LINTEXTENSION) 419 | DEPXLIB = $(DEPEXTENSIONLIB) $(DEPXONLYLIB) 420 | XLIB = $(EXTENSIONLIB) $(XONLYLIB) 421 | LINTXLIB = $(LINTXONLYLIB) 422 | 423 | XSSLIBSRC = $(LIBSRC)/Xss 424 | 425 | DEPXSSLIB = $(USRLIBDIR)/libXss.a 426 | XSSLIB = -lXss 427 | 428 | LINTXSS = $(LINTLIBDIR)/llib-lXss.ln 429 | 430 | XXF86MISCLIBSRC = $(LIBSRC)/Xxf86misc 431 | 432 | DEPXXF86MISCLIB = $(USRLIBDIR)/libXxf86misc.a 433 | XXF86MISCLIB = -lXxf86misc 434 | 435 | LINTXXF86MISC = $(LINTLIBDIR)/llib-lXxf86misc.ln 436 | 437 | XXF86VMLIBSRC = $(LIBSRC)/Xxf86vm 438 | 439 | DEPXXF86VMLIB = $(USRLIBDIR)/libXxf86vm.a 440 | XXF86VMLIB = -lXxf86vm 441 | 442 | LINTXXF86VM = $(LINTLIBDIR)/llib-lXxf86vm.ln 443 | 444 | XXF86DGALIBSRC = $(LIBSRC)/Xxf86dga 445 | 446 | DEPXXF86DGALIB = $(USRLIBDIR)/libXxf86dga.a 447 | XXF86DGALIB = -lXxf86dga 448 | 449 | LINTXXF86DGA = $(LINTLIBDIR)/llib-lXxf86dga.ln 450 | 451 | XXF86RUSHLIBSRC = $(LIBSRC)/Xxf86rush 452 | 453 | DEPXXF86RUSHLIB = $(USRLIBDIR)/libXxf86rush.a 454 | XXF86RUSHLIB = -lXxf86rush 455 | 456 | LINTXXF86RUSH = $(LINTLIBDIR)/llib-lXxf86rush.ln 457 | 458 | XVLIBSRC = $(LIBSRC)/Xv 459 | 460 | DEPXVLIB = $(USRLIBDIR)/libXv.a 461 | XVLIB = -lXv 462 | 463 | LINTXV = $(LINTLIBDIR)/llib-lXv.ln 464 | 465 | XINERAMALIBSRC = $(LIBSRC)/Xinerama 466 | 467 | DEPXINERAMALIB = $(USRLIBDIR)/libXinerama.a 468 | XINERAMALIB = -lXinerama 469 | 470 | LINTXINERAMA = $(LINTLIBDIR)/llib-lXinerama.ln 471 | 472 | XINERAMALIBSRC = $(LIBSRC)/Xinerama 473 | 474 | DEPXINERAMALIB = $(USRLIBDIR)/libXinerama.a 475 | XINERAMALIB = -lXinerama 476 | 477 | LINTXINERAMA = $(LINTLIBDIR)/llib-lXinerama.ln 478 | 479 | DPSLIBSRC = $(LIBSRC)/dps 480 | 481 | SODPSREV = 1.0 482 | DEPDPSLIB = 483 | DPSLIB = -ldps 484 | 485 | LINTDPS = $(LINTLIBDIR)/llib-ldps.ln 486 | 487 | DPSTKLIBSRC = $(LIBSRC)/dpstk 488 | 489 | SODPSTKREV = 1.0 490 | DEPDPSTKLIB = 491 | DPSTKLIB = -ldpstk 492 | 493 | LINTDPSTK = $(LINTLIBDIR)/llib-ldpstk.ln 494 | 495 | PSRESLIBSRC = $(LIBSRC)/psres 496 | 497 | SOPSRESREV = 1.0 498 | DEPPSRESLIB = 499 | PSRESLIB = -lpsres 500 | 501 | LINTPSRES = $(LINTLIBDIR)/llib-lpsres.ln 502 | 503 | GLXLIBSRC = $(LIBSRC)/GL 504 | 505 | SOGLREV = 1.2 506 | DEPGLXLIB = 507 | GLXLIB = -lGL 508 | 509 | LINTGLX = $(LINTLIBDIR)/llib-lGL.ln 510 | 511 | XFONTCACHELIBSRC = $(LIBSRC)/Xfontcache 512 | 513 | DEPXFONTCACHELIB = $(USRLIBDIR)/libXfontcache.a 514 | XFONTCACHELIB = -lXfontcache 515 | 516 | LINTXFONTCACHE = $(LINTLIBDIR)/llib-lXfontcache.ln 517 | 518 | XAUTHSRC = $(LIBSRC)/Xau 519 | 520 | DEPXAUTHLIB = $(USRLIBDIR)/libXau.a 521 | XAUTHLIB = -lXau 522 | 523 | LINTXAUTH = $(LINTLIBDIR)/llib-lXau.ln 524 | 525 | XDMCPLIBSRC = $(LIBSRC)/Xdmcp 526 | 527 | DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a 528 | XDMCPLIB = -lXdmcp 529 | 530 | LINTXDMCP = $(LINTLIBDIR)/llib-lXdmcp.ln 531 | 532 | XMUSRC = $(LIBSRC)/Xmu 533 | 534 | SOXMUREV = 6.1 535 | DEPXMULIB = 536 | XMULIB = -lXmu 537 | 538 | LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln 539 | 540 | OLDXLIBSRC = $(LIBSRC)/oldX 541 | 542 | DEPOLDXLIB = $(USRLIBDIR)/liboldX.a 543 | OLDXLIB = -loldX 544 | 545 | LINTOLDX = $(LINTLIBDIR)/llib-loldX.ln 546 | 547 | XPLIBSRC = $(LIBSRC)/Xp 548 | 549 | SOXPREV = 6.2 550 | DEPXPLIB = 551 | XPLIB = -lXp 552 | 553 | LINTXP = $(LINTLIBDIR)/llib-lXp.ln 554 | 555 | TOOLKITSRC = $(LIBSRC)/Xt 556 | 557 | SOXTREV = 6.0 558 | DEPXTOOLONLYLIB = 559 | XTOOLONLYLIB = -lXt 560 | 561 | LINTXTOOLONLY = $(LINTLIBDIR)/llib-lXt.ln 562 | 563 | DEPXTOOLLIB = $(DEPXTOOLONLYLIB) $(DEPSMLIB) $(DEPICELIB) 564 | XTOOLLIB = $(XTOOLONLYLIB) $(SMLIB) $(ICELIB) 565 | LINTXTOOLLIB = $(LINTXTOOLONLYLIB) 566 | 567 | XALIBSRC = $(LIBSRC)/Xa 568 | 569 | SOXAREV = 1.0 570 | DEPXALIB = 571 | XALIB = -lXa 572 | 573 | LINTXA = $(LINTLIBDIR)/llib-lXa.ln 574 | 575 | AWIDGETSRC = $(LIBSRC)/Xaw 576 | 577 | SOXAWREV = 7.0 578 | DEPXAWLIB = 579 | XAWLIB = -lXaw 580 | 581 | LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln 582 | 583 | AWIDGET6SRC = $(LIBSRC)/Xaw6 584 | 585 | SOXAW6REV = 6.1 586 | DEPXAW6LIB = 587 | XAW6LIB = -lXaw 588 | 589 | LINTXAW6 = $(LINTLIBDIR)/llib-lXaw.ln 590 | 591 | XILIBSRC = $(LIBSRC)/Xi 592 | 593 | SOXINPUTREV = 6.0 594 | DEPXILIB = 595 | XILIB = -lXi 596 | 597 | LINTXI = $(LINTLIBDIR)/llib-lXi.ln 598 | 599 | XTESTLIBSRC = $(LIBSRC)/Xtst 600 | 601 | SOXTESTREV = 6.1 602 | DEPXTESTLIB = 603 | XTESTLIB = -lXtst 604 | 605 | LINTXTEST = $(LINTLIBDIR)/llib-lXtst.ln 606 | 607 | PEXLIBSRC = $(LIBSRC)/PEX5 608 | 609 | SOPEXREV = 6.0 610 | DEPPEXLIB = 611 | PEXLIB = -lPEX5 612 | 613 | LINTPEX = $(LINTLIBDIR)/llib-lPEX5.ln 614 | 615 | XIELIBSRC = $(LIBSRC)/XIE 616 | 617 | SOXIEREV = 6.0 618 | DEPXIELIB = 619 | XIELIB = -lXIE 620 | 621 | LINTXIE = $(LINTLIBDIR)/llib-lXIE.ln 622 | 623 | PHIGSLIBSRC = $(LIBSRC)/PHIGS 624 | 625 | DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a 626 | PHIGSLIB = -lphigs 627 | 628 | LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln 629 | 630 | DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a 631 | XBSDLIB = -lXbsd 632 | 633 | LINTXBSD = $(LINTLIBDIR)/llib-lXbsd.ln 634 | 635 | ICESRC = $(LIBSRC)/ICE 636 | 637 | SOICEREV = 6.3 638 | DEPICELIB = 639 | ICELIB = -lICE 640 | 641 | LINTICE = $(LINTLIBDIR)/llib-lICE.ln 642 | 643 | SMSRC = $(LIBSRC)/SM 644 | 645 | SOSMREV = 6.0 646 | DEPSMLIB = 647 | SMLIB = -lSM 648 | 649 | LINTSM = $(LINTLIBDIR)/llib-lSM.ln 650 | 651 | XKEYSRC = $(LIBSRC)/Xkey 652 | 653 | SOXKEYREV = 6.0 654 | DEPXKEYLIB = 655 | XKEYLIB = -lXkey 656 | 657 | LINTXKEY = $(LINTLIBDIR)/llib-lXkey.ln 658 | 659 | FSLIBSRC = $(LIBSRC)/FS 660 | 661 | DEPFSLIB = $(USRLIBDIR)/libFS.a 662 | FSLIB = -lFS 663 | 664 | LINTFS = $(LINTLIBDIR)/llib-lFS.ln 665 | 666 | FONTLIBSRC = $(LIBSRC)/font 667 | 668 | SOFONTREV = 1.3 669 | DEPFONTLIB = 670 | FONTLIB = -L$(FREETYPELIBDIR) -L$(FONTLIBSRC) -lXfont 671 | 672 | LINTXFONT = $(LINTLIBDIR)/llib-lXfont.ln 673 | # 674 | SOFONTREV = 1.3 675 | DEPXFONTLIB = 676 | XFONTLIB = -lXfont 677 | 678 | LINTXFONT = $(LINTLIBDIR)/llib-lXfont.ln 679 | 680 | FONTSTUBLIBSRC = $(FONTLIBSRC)/stubs 681 | 682 | DEPFONTSTUBLIB = $(USRLIBDIR)/libfntstubs.a 683 | FONTSTUBLIB = -lfntstubs 684 | 685 | LINTFONTSTUB = $(LINTLIBDIR)/llib-lfntstubs.ln 686 | DEPFONTLIB = $(DEPXFONTLIB) $(DEPFONTSTUBLIB) 687 | FONTLIB = $(XFONTLIB) $(FONTSTUBLIB) 688 | 689 | XPMLIBSRC = $(LIBSRC)/Xpm 690 | 691 | SOXPMREV = 4.11 692 | DEPXPMLIB = 693 | XPMLIB = -lXpm 694 | 695 | LINTXPM = $(LINTLIBDIR)/llib-lXpm.ln 696 | 697 | XKBFILELIBSRC = $(LIBSRC)/xkbfile 698 | 699 | DEPXKBFILELIB = $(USRLIBDIR)/libxkbfile.a 700 | XKBFILELIB = -lxkbfile 701 | 702 | LINTXKBFILE = $(LINTLIBDIR)/llib-lxkbfile.ln 703 | 704 | XKBCOMPCMD = $(BINDIR)/xkbcomp 705 | 706 | XKBUILIBSRC = $(LIBSRC)/xkbui 707 | 708 | DEPXKBUILIB = $(USRLIBDIR)/libxkbui.a 709 | XKBUILIB = -lxkbui 710 | 711 | LINTXKBUI = $(LINTLIBDIR)/llib-lxkbui.ln 712 | 713 | DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) 714 | 715 | DEPLIBS1 = $(DEPLIBS) 716 | DEPLIBS2 = $(DEPLIBS) 717 | DEPLIBS3 = $(DEPLIBS) 718 | DEPLIBS4 = $(DEPLIBS) 719 | DEPLIBS5 = $(DEPLIBS) 720 | DEPLIBS6 = $(DEPLIBS) 721 | DEPLIBS7 = $(DEPLIBS) 722 | DEPLIBS8 = $(DEPLIBS) 723 | DEPLIBS9 = $(DEPLIBS) 724 | DEPLIBS10 = $(DEPLIBS) 725 | 726 | XMULIBONLY = -lXmu 727 | XMULIB = $(XMULIBONLY) $(XTOOLLIB) $(XLIB) 728 | 729 | CONFIGDIR = $(LIBDIR)/config 730 | 731 | USRLIBDIRPATH = $(USRLIBDIR) 732 | LDPRELIBS = -L$(USRLIBDIR) 733 | LDPOSTLIBS = 734 | TOP_INCLUDES = -I$(INCROOT) $(TOP_X_INCLUDES) 735 | PROJECT_DEFINES = 736 | 737 | CXXPROJECT_DEFINES = 738 | 739 | # ---------------------------------------------------------------------- 740 | # start of Imakefile 741 | 742 | INCLUDES = -I$(TOP) 743 | DEPLIBS = $(DEPXLIB) 744 | LOCAL_LIBRARIES = $(XLIB) 745 | DEFINES = -DSHAPE #-DDEBUG -DDEBUG_EV 746 | SRCS = 9menu.c 747 | OBJS = 9menu.o 748 | 749 | PROGRAM = 9menu 750 | 751 | all:: 9menu 752 | 753 | 9menu: $(OBJS) $(DEPLIBS) 754 | $(RM) $@ 755 | $(CCLINK) -o $@ $(LDOPTIONS) $(OBJS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) 756 | 757 | install:: 9menu 758 | @if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \ 759 | else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi 760 | $(INSTALL) $(INSTALLFLAGS) $(INSTPGMFLAGS) 9menu $(DESTDIR)$(BINDIR)/9menu 761 | 762 | install.man:: 9menu.man 763 | @if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \ 764 | else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi 765 | $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) 9menu.man $(DESTDIR)$(MANDIR)/9menu.$(MANSUFFIX) 766 | 767 | depend:: 768 | $(DEPEND) $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS) 769 | 770 | lint: 771 | $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) 772 | lint1: 773 | $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) 774 | 775 | clean:: 776 | $(RM) 9menu 777 | 778 | # ---------------------------------------------------------------------- 779 | # common rules for all Makefiles - do not edit 780 | 781 | .c.i: 782 | $(RM) $@ 783 | $(CC) -E $(CFLAGS) $(_NOOP_) $*.c > $@ 784 | 785 | .SUFFIXES: .s 786 | 787 | .c.s: 788 | $(RM) $@ 789 | $(CC) -S $(CFLAGS) $(_NOOP_) $*.c 790 | 791 | emptyrule:: 792 | 793 | clean:: 794 | $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"* 795 | 796 | Makefile:: 797 | -@if [ -f Makefile ]; then set -x; \ 798 | $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ 799 | else exit 0; fi 800 | $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) 801 | 802 | tags:: 803 | $(TAGS) -w *.[ch] 804 | $(TAGS) -xw *.[ch] > TAGS 805 | 806 | man_keywords:: 807 | 808 | html_index:: 809 | 810 | # ---------------------------------------------------------------------- 811 | # empty rules for directories that do not have SUBDIRS - do not edit 812 | 813 | install:: 814 | @echo "install in $(CURRENT_DIR) done" 815 | 816 | install.man:: 817 | @echo "install.man in $(CURRENT_DIR) done" 818 | 819 | install.sdk:: 820 | @echo "install.sdk in $(CURRENT_DIR) done" 821 | 822 | Makefiles:: 823 | 824 | includes:: 825 | 826 | depend:: 827 | 828 | # ---------------------------------------------------------------------- 829 | # dependencies generated by makedepend 830 | 831 | -------------------------------------------------------------------------------- /Makefile.noimake: -------------------------------------------------------------------------------- 1 | # Makefile for 9menu. 2 | # 3 | # Edit to taste 4 | # 5 | # Arnold Robbins 6 | # arnold@skeeve.atl.ga.us 7 | 8 | CC = gcc 9 | CFLAGS = -g -O 10 | LIBS = -lX11 11 | 12 | 9menu: 9menu.c 13 | $(CC) $(CFLAGS) 9menu.c $(LIBS) -o 9menu 14 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Wed Feb 24 17:11:01 IST 2021 2 | 3 | This is 9menu, a simple program that allows you to create X menus from the 4 | shell, where each menu item will run a command. 9menu is intended for use 5 | with 9wm, but can be used with any other window manager. 6 | 7 | The idea of a command line menu generator is from xmenu, but xmenu was 8 | exclusively a pop-up menu, not what I wanted. 9 | 10 | The files are: 11 | 12 | README --- this file 13 | 9menu.1 --- man page for 9menu 14 | 9menu.c --- source code 15 | Imakefile --- a contributed Imakefile, 16 | from Bengt Kleberg 17 | Makefile.noimake --- a simple makefile. 18 | meson.build --- for people who prefer meson. 19 | 20 | Licence 21 | ======= 22 | 23 | 9menu is free software, and is Copyright (c) 1994 by David Hogan and 24 | Arnold Robbins. Permission is granted to all sentient beings to use 25 | this software, to make copies of it, and to distribute those copies, 26 | provided that: 27 | 28 | (1) the copyright and licence notices are left intact 29 | (2) the recipients are aware that it is free software 30 | (3) any unapproved changes in functionality are either 31 | (i) only distributed as patches 32 | or (ii) distributed as a new program which is not called 9menu 33 | and whose documentation gives credit where it is due 34 | (4) the authors are not held responsible for any defects 35 | or shortcomings in the software, or damages caused by it. 36 | 37 | There is no warranty for this software. Have a nice day. 38 | 39 | -- 40 | Arnold Robbins 41 | arnold@skeeve.com 42 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | # meson.build for 9menu 2 | # license: public domain 3 | # Contributed by Anderson Torres, February 2021 4 | project ('9menu', 'c') 5 | 6 | executable ('9menu', '9menu.c', 7 | install: true, 8 | dependencies: [ dependency('x11'), 9 | dependency('xext') ]) 10 | install_man ('9menu.1') 11 | --------------------------------------------------------------------------------