home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume13 / menu_mh / patch01 next >
Text File  |  1990-07-02  |  19KB  |  789 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v13i083: Patch to menu_mh in volume 11
  3. From: mike@milhow2.UUCP (Mike Howard)
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 13, Issue 83
  7. Submitted-by: mike@milhow2.UUCP (Mike Howard)
  8. Archive-name: menu_mh/patch01
  9.  
  10. Please post and file in volume-11/menu_mh
  11.  
  12. Thanks
  13. Mike Howard
  14. how%milhow1@uu.net
  15.  
  16. ---------------------------------------cut there-----------------------------
  17. Importance: High
  18.  
  19. These patches implement the following:
  20.  
  21.  - dumb_menu goes into an infinite loop if ^D is entered.
  22.  
  23.  - a MENU_PATH variable and search for menu is implemented.  -m is
  24. supported but surpressed.  Menu name may either be the default or
  25. taken from the command line.
  26.  
  27.  - all calls to malloc() and realloc() are tested for success. [this
  28. was more to avoid redicule than need - if anyone builds a menu which
  29. exceeds memory on any machine, it is probably too big to fit on the
  30. screen :-) ]
  31.  
  32. Mike Howard
  33. how@milhow1.uunet.uu.net
  34.  
  35. ------------------------cut here----------------------------------
  36.  
  37. Index: patchlevel.h
  38. *** ./version1/patchlevel.h    Sat Mar 17 11:50:46 1990
  39. --- ./patchlevel.h    Sat Mar 17 11:40:01 1990
  40. ***************
  41. *** 0 ****
  42. --- 1 ----
  43. + #define PATCHLEVEL 1
  44.  
  45. Index: MANIFEST
  46. *** ./version1/MANIFEST    Sat Mar 17 09:49:50 1990
  47. --- ./MANIFEST    Sat Mar 17 11:55:40 1990
  48. ***************
  49. *** 9,11 ****
  50. --- 9,12 ----
  51.    dumb_menu.y                1    
  52.    menu.def                   1    
  53.    sub.menu                   1    
  54. +  patchlevel.h               1    
  55.  
  56. Index: dumb_menu.y
  57. *** ./version1/dumb_menu.y    Sat Mar 17 09:49:54 1990
  58. --- ./dumb_menu.y    Sat Mar 17 10:41:49 1990
  59. ***************
  60. *** 1,5 ****
  61.   %{
  62. ! /* @(#)dumb_menu.y    1.3 90/03/08 */
  63.   
  64.   static char *cpy_str =
  65.     "Copyright (c), Mike Howard, 1990, all rights reserved";
  66. --- 1,5 ----
  67.   %{
  68. ! /* @(#)dumb_menu.y    1.4 90/03/17 */
  69.   
  70.   static char *cpy_str =
  71.     "Copyright (c), Mike Howard, 1990, all rights reserved";
  72. ***************
  73. *** 47,54 ****
  74.   
  75.   char *menu_title;
  76.   
  77. ! char *malloc();
  78. ! char *realloc();
  79.   
  80.   int lex_errors;
  81.   int yacc_errors;
  82. --- 47,54 ----
  83.   
  84.   char *menu_title;
  85.   
  86. ! char *Malloc();
  87. ! char *Realloc();
  88.   
  89.   int lex_errors;
  90.   int yacc_errors;
  91. ***************
  92. *** 62,67 ****
  93. --- 62,72 ----
  94.   /* Menus begin with a title definition
  95.      title { text for the title }
  96.   
  97. +    This is followed by zero or more of the following parameters, which
  98. +    do the `obvious' things:
  99. +    bold clear always-show
  100.      This is followed by one or more menu-item definitions of the form:
  101.   
  102.      item { prompt } { shell command }
  103. ***************
  104. *** 69,77 ****
  105.      parm "name" { prompt }
  106.      ;
  107.   
  108. !    the crud in between braces may contain any character, including
  109.      escapped braces and back-slash (\).
  110. !    The crud in between the double quotes may ONLY contain letters, digits,
  111.      and underscores;
  112.   
  113.      Sub-menus are formed by running dumb_menu as the shell process, pointed
  114. --- 74,82 ----
  115.      parm "name" { prompt }
  116.      ;
  117.   
  118. !    the text in between braces may contain any character, including
  119.      escapped braces and back-slash (\).
  120. !    The text in between the double quotes may ONLY contain letters, digits,
  121.      and underscores;
  122.   
  123.      Sub-menus are formed by running dumb_menu as the shell process, pointed
  124. ***************
  125. *** 174,186 ****
  126.   extern char *optarg;
  127.   extern int optind, opterr;
  128.   int tty_in;
  129. - FILE *tty_file;
  130.   int argcc;
  131.   char **argvv;
  132.   char *progname;
  133.   char *in_fname = "stdin";
  134. ! char *menu_fname = "./menu.def";
  135.   char *shell_path = "/bin/sh";
  136.   char *cat_path = "/bin/cat";
  137.   char *cmd_path;
  138.   char *cmd_name;
  139. --- 179,194 ----
  140.   extern char *optarg;
  141.   extern int optind, opterr;
  142.   int tty_in;
  143.   int argcc;
  144.   char **argvv;
  145.   char *progname;
  146.   char *in_fname = "stdin";
  147. ! char *menu_fname;
  148. ! #define MENU_FNAME "menu.def"
  149.   char *shell_path = "/bin/sh";
  150. + char *menu_path;
  151. + #define DEFAULT_MENU_PATH_WITH_HOME  "%s:/usr/local/lib/dumb_menu"
  152. + #define DEFAULT_MENU_PATH_WO_HOME    "/usr/local/lib/dumb_menu"
  153.   char *cat_path = "/bin/cat";
  154.   char *cmd_path;
  155.   char *cmd_name;
  156. ***************
  157. *** 195,201 ****
  158.   
  159.   char *hlp[] = {
  160.   "Option     Function",
  161. ! "-m file    set menu-definition file name to 'file' (menu.def)",
  162.   "-s path    path to shell to execute scripts",
  163.   "-c path    path to 'cat' for simple debug mode",
  164.   "-v         make command execution verbose (via set -xv)",
  165. --- 203,209 ----
  166.   
  167.   char *hlp[] = {
  168.   "Option     Function",
  169. ! "-M path    menu path",
  170.   "-s path    path to shell to execute scripts",
  171.   "-c path    path to 'cat' for simple debug mode",
  172.   "-v         make command execution verbose (via set -xv)",
  173. ***************
  174. *** 232,239 ****
  175. --- 240,258 ----
  176.       printf("%s: '%s'\n", selected_parms->prompt,
  177.              selected_parms->identifier);
  178.       }
  179. +     init_terminal();
  180. +     display_menu();
  181. +     exit(0);
  182.     }
  183.   
  184. +   close(0);
  185. +   close(1);
  186. +   dup(tty_in);
  187. +   dup(tty_in);
  188. +   close(tty_in);
  189.     init_terminal();
  190.   
  191.     do_menu();
  192. ***************
  193. *** 248,254 ****
  194.     extern char *optarg;
  195.     extern int optind, opterr;
  196.   
  197. !   while ((c = getopt(argc, argv, "hcsm:vD")) != EOF) {
  198.       switch (c) {
  199.       case 'h':
  200.         for (i=0;hlp[i];i++)
  201. --- 267,273 ----
  202.     extern char *optarg;
  203.     extern int optind, opterr;
  204.   
  205. !   while ((c = getopt(argc, argv, "hcsm:M:vD")) != EOF) {
  206.       switch (c) {
  207.       case 'h':
  208.         for (i=0;hlp[i];i++)
  209. ***************
  210. *** 261,268 ****
  211. --- 280,294 ----
  212.         cat_path = optarg;
  213.         break;
  214.       case 'm':
  215. +       /* this option is for backward compatability.  I did not handle
  216. +      menu file name specification correctly in the original version
  217. +      and am too lazy to change everything I have done. It will come
  218. +      out some day. */
  219.         menu_fname = optarg;
  220.         break;
  221. +     case 'M':
  222. +       menu_path = optarg;
  223. +       break;
  224.       case 'v':
  225.         verbose++;
  226.         break;
  227. ***************
  228. *** 277,296 ****
  229.     argcc = argc;
  230.     argvv = argv;
  231.     progname = argv[0];
  232. !   if (strcmp(menu_fname, "-")) {
  233. !     close(0);
  234.   
  235. !     if (open(menu_fname, O_RDONLY) < 0) {
  236. !       char buf[80];
  237. !       sprintf(buf, "cannot open menu definition: %s", menu_fname);
  238. !       fatal(buf);
  239. !     }
  240. !   }
  241. !   if ((tty_in = open("/dev/tty", O_RDONLY)) < 0)
  242.       fatal("cannot open tty - must be run interactively");
  243. -   tty_file = fdopen(tty_in, "r");
  244.   
  245.     cmd_path = debug_mode ? cat_path : shell_path;
  246.     if (cmd_name = strrchr(cmd_path, '/'))
  247. --- 303,314 ----
  248.     argcc = argc;
  249.     argvv = argv;
  250.     progname = argv[0];
  251. !   if (!menu_fname)
  252. !     menu_fname = optind == argc ? MENU_FNAME : argv[optind];
  253. !   open_menu_file();
  254.   
  255. !   if ((tty_in = open("/dev/tty", O_RDWR)) < 0)
  256.       fatal("cannot open tty - must be run interactively");
  257.   
  258.     cmd_path = debug_mode ? cat_path : shell_path;
  259.     if (cmd_name = strrchr(cmd_path, '/'))
  260. ***************
  261. *** 303,313 ****
  262.   char *identifier;
  263.   char *prompt;
  264.   {
  265. !   struct parm *parm_ptr = (struct parm *)malloc(sizeof(struct parm));
  266.   
  267. -   if (!parm_ptr)
  268. -     fatal("malloc() error");
  269.     parm_ptr->next = (struct parm *)0;
  270.     parm_ptr->prompt = prompt;
  271.     parm_ptr->identifier = identifier;
  272. --- 321,328 ----
  273.   char *identifier;
  274.   char *prompt;
  275.   {
  276. !   struct parm *parm_ptr = (struct parm *)Malloc(sizeof(struct parm));
  277.   
  278.     parm_ptr->next = (struct parm *)0;
  279.     parm_ptr->prompt = prompt;
  280.     parm_ptr->identifier = identifier;
  281. ***************
  282. *** 321,331 ****
  283.   char *command;
  284.   struct parm *parms;
  285.   {
  286. !   struct item *item_ptr = (struct item *)malloc(sizeof(struct item));
  287.   
  288. -   if (!item_ptr)
  289. -     fatal("malloc() error");
  290.     item_ptr->next = (struct item *)0;
  291.     item_ptr->prompt = prompt;
  292.     item_ptr->command = command;
  293. --- 336,343 ----
  294.   char *command;
  295.   struct parm *parms;
  296.   {
  297. !   struct item *item_ptr = (struct item *)Malloc(sizeof(struct item));
  298.   
  299.     item_ptr->next = (struct item *)0;
  300.     item_ptr->prompt = prompt;
  301.     item_ptr->command = command;
  302. ***************
  303. *** 412,418 ****
  304.         int rsp;
  305.   
  306.         display_menu();
  307. !       fgets(buf, 80, tty_file);
  308.         if (cp = strchr(buf, '\n'))
  309.       *cp = '\0';
  310.   
  311. --- 424,434 ----
  312.         int rsp;
  313.   
  314.         display_menu();
  315. !       if (!fgets(buf, 80, stdin) && feof(stdin)) {
  316. !     putc('\n', stdout);
  317. !     exit(0);
  318. !       }
  319.         if (cp = strchr(buf, '\n'))
  320.       *cp = '\0';
  321.   
  322. ***************
  323. *** 449,459 ****
  324.   
  325.         printf("%s: ", selected_parms->prompt);
  326.         fflush(stdout);
  327. !       fgets(buf, 255, tty_file);
  328.         if (cp = strchr(buf, '\n'))
  329.       *cp = '\0';
  330.   
  331. !       strcpy(selected_parms->value = malloc(strlen(buf) + 1), buf);
  332.         selected_parms = selected_parms->next;
  333.       }
  334.   
  335. --- 465,475 ----
  336.   
  337.         printf("%s: ", selected_parms->prompt);
  338.         fflush(stdout);
  339. !       fgets(buf, 255, stdin);
  340.         if (cp = strchr(buf, '\n'))
  341.       *cp = '\0';
  342.   
  343. !       strcpy(selected_parms->value = Malloc(strlen(buf) + 1), buf);
  344.         selected_parms = selected_parms->next;
  345.       }
  346.   
  347. ***************
  348. *** 476,485 ****
  349.       if ( !(pid = fork()) ) {
  350.         /* reset signals so that DEL,... work correctly */
  351.         reset_signals();
  352. !       close(0);
  353. !       dup(tty_in);
  354. !       close(tty_in);
  355. !       fclose(tty_file);
  356.         execl(cmd_path, cmd_name, tmp_fname, (char *)0);
  357.         fatal("exec of command failed");
  358.       }
  359. --- 492,499 ----
  360.       if ( !(pid = fork()) ) {
  361.         /* reset signals so that DEL,... work correctly */
  362.         reset_signals();
  363. !       close(2);
  364. !       dup(0);
  365.         execl(cmd_path, cmd_name, tmp_fname, (char *)0);
  366.         fatal("exec of command failed");
  367.       }
  368. ***************
  369. *** 492,498 ****
  370.   
  371.         printf("[Press Return to Continue]");
  372.         fflush(stdout);
  373. !       fgets(buf, 80, tty_file);
  374.       }
  375.     }
  376.     reset_signals();
  377. --- 506,512 ----
  378.   
  379.         printf("[Press Return to Continue]");
  380.         fflush(stdout);
  381. !       fgets(buf, 80, stdin);
  382.       }
  383.     }
  384.     reset_signals();
  385. ***************
  386. *** 580,586 ****
  387.     while ((wait_ret = wait(&status)) != pid) {
  388.       /* test to see if child is still there - if not, then return */
  389.       if (kill(pid, 0) < 0)
  390. !       return;
  391.     }
  392.   }
  393.   
  394. --- 594,600 ----
  395.     while ((wait_ret = wait(&status)) != pid) {
  396.       /* test to see if child is still there - if not, then return */
  397.       if (kill(pid, 0) < 0)
  398. !       break;
  399.     }
  400.   }
  401.   
  402. ***************
  403. *** 610,613 ****
  404. --- 624,730 ----
  405.     signal(SIGQUIT, SIG_DFL);
  406.     signal(SIGTERM, SIG_DFL);
  407.     signal(SIGCLD, SIG_DFL);
  408. + }
  409. + open_menu_file()
  410. + {
  411. +   int menu_fd;
  412. +   char *getenv();
  413. +   /* check to see if we are reading from stdin */
  414. +   if (!strcmp(menu_fname, "-"))
  415. +     return;
  416. +   /* absolute paths and ./<file-name> paths over-ride path search */
  417. +   if (menu_fname[0] == '/' || !strncmp(menu_fname, "./", 2)) {
  418. +     if ((menu_fd = open(menu_fname, O_RDONLY)) < 0)
  419. +       fatal("cannot open menu file");
  420. +     close(0);
  421. +     dup(menu_fd);
  422. +     close(menu_fd);
  423. +     return;
  424. +   }
  425. +   /* search for named menu along the menu path */
  426. +   if (menu_path || (menu_path = getenv("MENU_PATH")))
  427. +     return search_menu_path(menu_path, menu_fname);
  428. +   /* build a default menu path */
  429. +   {
  430. +     char *home;
  431. +     char buf[256];
  432. +     home = getenv("HOME");
  433. +     sprintf(buf, home ? DEFAULT_MENU_PATH_WITH_HOME :
  434. +         DEFAULT_MENU_PATH_WO_HOME, home);
  435. +     return search_menu_path(buf, menu_fname);
  436. +   }
  437. + }
  438. + search_menu_path(path, fname)
  439. + char *path;
  440. + char *fname;
  441. + {
  442. +   char *cp = path;
  443. +   int size = 256;
  444. +   int len;
  445. +   char *buf = Malloc(256);
  446. +   int menu_fd;
  447. +   while (cp) {
  448. +     if (cp = strchr(path, ':'))
  449. +       *cp++ = '\0';
  450. +     if (size < (len = strlen(path) + strlen(fname) + 2)) {
  451. +       buf = Realloc(buf, len);
  452. +       size = len;
  453. +     }
  454. +       
  455. +     strcpy(buf, path);
  456. +     len = strlen(buf);
  457. +     if (buf[len-1] != '/')
  458. +       buf[len++] = '/';
  459. +     strcpy(buf + len, fname);
  460. +     if ((menu_fd = open(buf, O_RDONLY)) >= 0) {
  461. +       free(buf);
  462. +       close(0);
  463. +       dup(menu_fd);
  464. +       close(menu_fd);
  465. +       return;
  466. +     }
  467. +     path = cp;
  468. +   }
  469. +   fatal("cannot open menu definition");
  470. + }
  471. + char *Malloc(size)
  472. + unsigned size;
  473. + {
  474. +   char *malloc();
  475. +   char *cp = malloc(size);
  476. +   if (!cp)
  477. +     fatal("out of memory in Malloc");
  478. +   return cp;
  479. + }
  480. + char *Realloc(ptr, size)
  481. + char *ptr;
  482. + unsigned size;
  483. + {
  484. +   char *realloc();
  485. +   char *cp = realloc(ptr, size);
  486. +   if (!cp)
  487. +     fatal("out of memory in Realloc");
  488. +   return cp;
  489. + }
  490. + yyerror(s)
  491. + char *s;
  492. + {
  493. +   printf("%s\n", s);
  494.   }
  495.  
  496. Index: dumb_menu.l
  497. *** ./version1/dumb_menu.l    Sat Mar 17 09:49:53 1990
  498. --- ./dumb_menu.l    Sat Mar 17 10:41:49 1990
  499. ***************
  500. *** 1,4 ****
  501. !     /* @(#)dumb_menu.l    1.2 90/03/08 */
  502.       /* copyrite (c) Miller/Howard Investments, 1990 */
  503.   
  504.   %{
  505. --- 1,4 ----
  506. !     /* @(#)dumb_menu.l    1.3 90/03/17 */
  507.       /* copyrite (c) Miller/Howard Investments, 1990 */
  508.   
  509.   %{
  510. ***************
  511. *** 8,13 ****
  512. --- 8,15 ----
  513.   #include <ctype.h>
  514.   
  515.     char *saved_text;
  516. +   char *Malloc();
  517. +   char *Realloc();
  518.   %}
  519.   
  520.       /* global definitions */
  521. ***************
  522. *** 76,82 ****
  523.     static int saved_size;
  524.   
  525.     if (!saved_text) {
  526. !     memset(saved_text = malloc(INIT_SIZE), '\0', INIT_SIZE);
  527.       room_left = INIT_SIZE;
  528.       saved_size = INIT_SIZE;
  529.       saved_length = 0;
  530. --- 78,84 ----
  531.     static int saved_size;
  532.   
  533.     if (!saved_text) {
  534. !     memset(saved_text = Malloc(INIT_SIZE), '\0', INIT_SIZE);
  535.       room_left = INIT_SIZE;
  536.       saved_size = INIT_SIZE;
  537.       saved_length = 0;
  538. ***************
  539. *** 84,90 ****
  540.   
  541.     len++;            /* inc len to account for terminating null */
  542.     while (len >= room_left) {
  543. !     saved_text = realloc(saved_text, saved_size += INC_SIZE);
  544.       room_left += INC_SIZE;
  545.     }
  546.   
  547. --- 86,92 ----
  548.   
  549.     len++;            /* inc len to account for terminating null */
  550.     while (len >= room_left) {
  551. !     saved_text = Realloc(saved_text, saved_size += INC_SIZE);
  552.       room_left += INC_SIZE;
  553.     }
  554.   
  555. ***************
  556. *** 114,120 ****
  557.   
  558.     /* is it all white? */
  559.     if (!*cp && cp > saved_text) {
  560. !     saved_text = realloc(saved_text, 1);
  561.       *saved_text = '\0';
  562.       return;
  563.     }
  564. --- 116,122 ----
  565.   
  566.     /* is it all white? */
  567.     if (!*cp && cp > saved_text) {
  568. !     saved_text = Realloc(saved_text, 1);
  569.       *saved_text = '\0';
  570.       return;
  571.     }
  572. ***************
  573. *** 124,130 ****
  574.       char *tmp;
  575.       int len;
  576.   
  577. !     tmp = malloc(len = strlen(cp) + 1);
  578.       memcpy(tmp, cp, len);
  579.       free(saved_text);
  580.       saved_text = tmp;
  581. --- 126,132 ----
  582.       char *tmp;
  583.       int len;
  584.   
  585. !     tmp = Malloc(len = strlen(cp) + 1);
  586.       memcpy(tmp, cp, len);
  587.       free(saved_text);
  588.       saved_text = tmp;
  589. ***************
  590. *** 132,140 ****
  591.       return;
  592.     }
  593.   
  594. !   saved_text = realloc(saved_text, strlen(saved_text) + 1);
  595.   }
  596. - #ifdef yywrap
  597. - #undef yywrap
  598. - #endif
  599. --- 134,138 ----
  600.       return;
  601.     }
  602.   
  603. !   saved_text = Realloc(saved_text, strlen(saved_text) + 1);
  604.   }
  605.  
  606. Index: dumb_menu.1
  607. *** ./version1/dumb_menu.1    Sat Mar 17 09:49:52 1990
  608. --- ./dumb_menu.1    Sat Mar 17 10:41:49 1990
  609. ***************
  610. *** 1,17 ****
  611.   .    \"    -*- nroff -*-
  612. ! .    \"    @(#)dumb_menu.1    1.2 90/03/08
  613.   .DA March 8, 1990
  614.   .TH DUMB_MENU 1 "local"
  615.   .SH NAME
  616.   dumb_menu \- executes a simple minded menu
  617.   .SH SYNOPSIS
  618.   .B dumb_menu
  619. ! [ -h | options ]
  620.   .SH DESCRIPTION
  621.   .PP
  622. ! .B -m path
  623. ! sets the path to the menu definition file.  Default is
  624. ! .I ./menu.def.
  625.   .PP
  626.   .B -s path
  627.   sets path for the shell which will execute the selected menu command.
  628. --- 1,32 ----
  629.   .    \"    -*- nroff -*-
  630. ! .    \"    @(#)dumb_menu.1    1.3 90/03/17
  631.   .DA March 8, 1990
  632.   .TH DUMB_MENU 1 "local"
  633.   .SH NAME
  634.   dumb_menu \- executes a simple minded menu
  635.   .SH SYNOPSIS
  636.   .B dumb_menu
  637. ! [ -h | options ] [menu defintion file]
  638.   .SH DESCRIPTION
  639.   .PP
  640. ! .B dumb_menu
  641. ! executes the menu defined in the optionally specified menu definition
  642. ! file.
  643. ! The default value is
  644. ! .I menu.def.
  645. ! If the menu definition file name begins with a slash (/) or dot-slash (./),
  646. ! then that absolute file is used.
  647. ! If not, then the menu path is searched for a matching file name.
  648. ! The menu path is a colon separated string of absolute directory names
  649. ! modelled after the PATH environment variable.
  650. ! The default menu path is: $HOME:/usr/local/lib/dumb_menu
  651. ! .PP
  652. ! .B -M path
  653. ! sets the search path for the menu definition file.
  654. ! If specified, this path is used.
  655. ! If not specified, the environment is checked to see if there is
  656. ! a variable named
  657. ! .B MENU_PATH.
  658.   .PP
  659.   .B -s path
  660.   sets path for the shell which will execute the selected menu command.
  661.  
  662. Index: Makefile
  663. *** Makefile    Mon Jun 25 08:59:15 1990
  664. --- Makefile.orig    Sat Mar 24 06:20:29 1990
  665. ***************
  666. *** 1,27 ****
  667.   #    CFLAGS    =    -g -DFLEX_DEBUG
  668.   #    CFLAGS    =    -g
  669.   #    CFLAGS    =    -g -DYYDEBUG
  670. ! #    CFLAGS    =    -O -DTERMIO -DTERMCAP
  671. ! CFLAGS    =    -g -DTERMIO -DTERMCAP
  672. ! LDFLAGS    =    -ltermcap
  673.   
  674.   # C source files
  675.   # Yacc source files
  676.   YSRC    =    dumb_menu.y
  677. ! YCCC    =    dumb_menu.c
  678. ! YOBJ    =    dumb_menu.o
  679.   
  680.   LSRC    =    dumb_menu.l
  681.   LEX    =    flex
  682.   LFLAGS    =
  683. - RLSDIR    =    ./version1
  684.   
  685.   dumb_menu :  $(YCCC) lex.yy.c
  686.       $(CC) $(CFLAGS) $(YCCC) $(LDFLAGS) -o dumb_menu
  687.   
  688. - #    SCO Xenix small model flags for 286 machines
  689.   dumb_menu.0s :  dumb_menu.c lex.yy.c
  690. !     $(CC) $(CFLAGS) -M0s -i dumb_menu.c $(LDFLAGS) -o dumb_menu.0s
  691.   
  692.   lex.yy.c : dumb_menu.l
  693.       $(LEX) $(LFLAGS) dumb_menu.l
  694. --- 1,24 ----
  695.   #    CFLAGS    =    -g -DFLEX_DEBUG
  696.   #    CFLAGS    =    -g
  697.   #    CFLAGS    =    -g -DYYDEBUG
  698. ! CFLAGS    =    -O -DTERMIO -DTERMCAP
  699. ! LDFLAGS    =    -ly -ltermcap
  700.   
  701.   # C source files
  702.   # Yacc source files
  703.   YSRC    =    dumb_menu.y
  704. ! YCCC    =    $(YSRC:.y=.c)
  705. ! YOBJ    =    $(YSRC:.y=.o)
  706.   
  707.   LSRC    =    dumb_menu.l
  708.   LEX    =    flex
  709.   LFLAGS    =
  710.   
  711.   dumb_menu :  $(YCCC) lex.yy.c
  712.       $(CC) $(CFLAGS) $(YCCC) $(LDFLAGS) -o dumb_menu
  713.   
  714.   dumb_menu.0s :  dumb_menu.c lex.yy.c
  715. !     $(CC) $(CFLAGS) -M0s dumb_menu.c $(LDFLAGS) -o dumb_menu.0s
  716.   
  717.   lex.yy.c : dumb_menu.l
  718.       $(LEX) $(LFLAGS) dumb_menu.l
  719. ***************
  720. *** 37,62 ****
  721.       tar cvf /dev/fd096ds9 $(YSRC) $(LSRC) *.1 Makefile s.* *.doc menu.def \
  722.           *.menu dumb_menu dumb_menu.0s
  723.   
  724. - tar.kit :
  725. -     rm -f tar.file.z
  726. -     tar cvf tar.file $(YSRC) $(LSRC) dumb_menu.1 Makefile \
  727. -         menu.def sub.menu directory README \
  728. -         dumb_menu dumb_menu.0s
  729. -     pack tar.file
  730.   clean :
  731.       rm -f $(OBJS) $(YCCC) lex.yy.c
  732.   
  733. ! kit : $(YSRC) $(LSRC) dumb_menu.1 Makefile menu.def sub.menu directory \
  734. !         README patchlevel.h
  735.       makekit -m $(YSRC) $(LSRC) dumb_menu.1 Makefile menu.def sub.menu \
  736.           directory README
  737.       touch kit
  738. - make-patches :
  739. -     rm -f patches
  740. -     for x in  patchlevel.h MANIFEST $(YSRC) $(LSRC) dumb_menu.1 Makefile \
  741. -         menu.def sub.menu directory README ; do \
  742. -         echo "\nIndex: $$x" >>patches ;\
  743. -          cdiff $(RLSDIR)/$$x ./$$x >>patches ;\
  744. -     done
  745. --- 34,43 ----
  746.       tar cvf /dev/fd096ds9 $(YSRC) $(LSRC) *.1 Makefile s.* *.doc menu.def \
  747.           *.menu dumb_menu dumb_menu.0s
  748.   
  749.   clean :
  750.       rm -f $(OBJS) $(YCCC) lex.yy.c
  751.   
  752. ! kit : $(YSRC) $(LSRC) dumb_menu.1 Makefile menu.def sub.menu directory
  753.       makekit -m $(YSRC) $(LSRC) dumb_menu.1 Makefile menu.def sub.menu \
  754.           directory README
  755.       touch kit
  756. ---------------------------------------cut there-----------------------------
  757.  
  758.  
  759.