home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1144 < prev    next >
Encoding:
Internet Message Format  |  1990-12-28  |  39.3 KB

  1. From: pjc@pcbox.UUCP (Paul J. Condie)
  2. Newsgroups: alt.sources
  3. Subject: menu(1)  part 2 of 11
  4. Message-ID: <424@pcbox.UUCP>
  5. Date: 6 Apr 90 17:30:40 GMT
  6.  
  7.  
  8. #!/bin/sh
  9. # this is part 2 of a multipart archive
  10. # do not concatenate these parts, unpack them in order with /bin/sh
  11. # file menu.1 continued
  12. #
  13. CurArch=2
  14. if test ! -r s2_seq_.tmp
  15. then echo "Please unpack part 1 first!"
  16.      exit 1; fi
  17. ( read Scheck
  18.   if test "$Scheck" != $CurArch
  19.   then echo "Please unpack part $Scheck next!"
  20.        exit 1;
  21.   else exit 0; fi
  22. ) < s2_seq_.tmp || exit 1
  23. echo "x - Continuing file menu.1"
  24. sed 's/^X//' << 'SHAR_EOF' >> menu.1
  25. X Option description text.
  26. X.fi
  27. X.IP "" 6
  28. XDefines this option as a sub-menu.  When user selects this option
  29. Xthe menu defined in "menufile" will be parsed and displayed.
  30. X
  31. XThe [ GETINPUT ] option allows you to display a screen and prompt a user for
  32. Xinput.  The screen is displayed before parseing of the new menu is begun.
  33. XThis could be used to prompt a user for a password with a .UNIX in the calling
  34. Xmenu using checkpass(1) to check permission to run the menu.
  35. XCompliments of Victoria.
  36. X
  37. XA environment variable may be specified in the Option description text.
  38. X.br
  39. X
  40. XThe optional variables are environment variables that will be set equal to
  41. Xthe value specified when the user selects this option.  This can be used
  42. Xto pass data to a sub menu.  Maximum length of the .MENU line is 700 bytes.
  43. X
  44. XNot supported in a \fI.POPMENU\fP menu.
  45. X. \ --------------------------------------------------------------------------
  46. X
  47. X.PP
  48. X.nf
  49. X \fB.POPMENU\fP [ NoDim ] menufile [ row column ] [ [!]variable=value  ... ]  [ \\ ]
  50. X Option description text.
  51. X.fi
  52. X.IP "" 6
  53. XDefines this option as a pop-up menu.  When user selects this option
  54. Xthe script file "menufile" will be parsed and displayed.  
  55. XThe optional row and column (upper left corner) is where you want the pop-up 
  56. Xmenu to pop-up.  If row and column is omitted then the menu will be placed
  57. Xas close to the option, that is selecting it, as possible.
  58. XSee \fI.SETENV\fP for \fIvariable=value\fP.
  59. X
  60. XThe [ NoDim ] flag tells menu not to dim the box on a inactive menu.  The
  61. Xdefault is to dim inactive menus.  That way the user can easily see what
  62. Xmenu they are working with.
  63. X
  64. XA environment variable may be specified in the Option description text.
  65. X
  66. XThe options in a pop-up menu can be selected by hi-lighting the option
  67. Xand pressing return, or ESC to cancel.  The pop-up menu goes away after
  68. Xan option has been selected and you are put back in your calling menu 
  69. X(the calling menu is reparsed).
  70. XThis keyword was provided for those options where the user would go over to
  71. Xa menu select an item then return back.  A printer select menu would be ideal
  72. Xfor this keyword.
  73. X. \ --------------------------------------------------------------------------
  74. X
  75. X.PP
  76. X.nf
  77. X \fB.SETENV\fP  [ BELL ] [!]variable=value [ [!]variable=value ... ] [ message ]   [ \\ ]
  78. X Option description text.
  79. X.fi
  80. X.IP "" 6
  81. XWhen the user selects this option it will set
  82. Xa variable to a value in the the current environment (i.e. the menu
  83. Xenvironment).  This is useful if you want something like a printer menu
  84. Xlisting available printers and changing the $LPDEST so all print jobs
  85. Xwill go to the new printer.
  86. XThe \fImessage\fP argument is what is printed to the screen so the user
  87. Xcan get feed back that his selection did something.
  88. XThe \fIBELL\fP argument provides an audible beep if the variables were
  89. Xset successfully.
  90. X
  91. Xnote:
  92. X.br
  93. X      If the message has a "=" sign in it menu will think it is a
  94. X      "variable=value" and will try to set a environment variable.
  95. X. \ --------------------------------------------------------------------------
  96. X
  97. X.PP
  98. X.nf
  99. X \fB.SPACE\fP
  100. X.fi
  101. X.IP "" 6
  102. XPut a space in between options.
  103. X
  104. XNot supported in a \fI.POPMENU\fP menu.
  105. X. \ --------------------------------------------------------------------------
  106. X
  107. X.PP
  108. X.nf
  109. X \fB.SYSTEM\fP [ [ variable=value ... ] GETINPUT screen_name ] command   [ \\ ]
  110. X Option description text.
  111. X.fi
  112. X.IP "" 6
  113. XDefines this option as a system call.  When user selects this option
  114. Xa system call will be executed, with command as the argument. Since the command
  115. Xis a argument to system(3S) anything you can type at the $ prompt you can
  116. Xput in the command.
  117. XMaximum length of \fIcommand\fP is 1k.
  118. XA environment variable may be specified in the Option description text.
  119. X
  120. XThe [ GETINPUT ] option allows you to display a screen and prompt a user for
  121. Xinput that could be used as command line arguments to the command.  
  122. XThe screen_name is a defined screen name.
  123. XSee .GETINPUT and .DEFINE_SCREEN for more information.
  124. X.br
  125. XThe optional \fIvariable=value\fP arguments associated with the GETINPUT
  126. Xare set at runtime, when the user selects this option.  This could be
  127. Xused to have a dynamic window_title in your getinput screen.
  128. X
  129. XExample: Say you need to prompt the user for a $DATA field then pass that 
  130. Xfield into
  131. Xyour program, lock the program so that program cannot be run until this one 
  132. Xfinishes
  133. Xand you want to kick the program off in the back ground.  You
  134. Xcould try something like this (see lock(1),unlock(1)):
  135. X.nf
  136. X   .SYSTEM     GETINPUT  screen1 \\
  137. X        lock program_name; \\
  138. X        if [ $? -eq 0 ] \\
  139. X           then    (nohup program_name $DATA; nohup unlock program_name)& \\
  140. X           else    echo "Program Already Running."; \\
  141. X            echo "Press [ Return ] to continue ...\\c"; \\
  142. X            read reply \\
  143. X        fi
  144. X   Option Description Text.
  145. X
  146. X
  147. X
  148. XNote: No error checking is done for \fIcommand\fP.  If error checking is
  149. Ximportant for your application you will need to build it into 
  150. Xyour \fIcommand\fP.
  151. X.fi
  152. X. \ --------------------------------------------------------------------------
  153. X
  154. X.PP
  155. X.nf
  156. X \fB.TEXT\fP [-]row [-]column
  157. X Text goes on this line.
  158. X.fi
  159. X.IP "" 6
  160. XAllows you to put any text at a specified row and column on the \fIstdscr\fP 
  161. Xscreen (base 0).
  162. XA negative row and/or column indicates number of rows from the bottom of the
  163. Xscreen or number of columns from the right of the screen (relative addressing).
  164. XFor example, \fI.TEXT -4 -20\fP will display text on the 4th row from the
  165. Xbottom and the 20th column from the right.  This could be useful if your users
  166. Xare using different sized terminals/windows.  If the row and/or column are 
  167. Xgreater than the window size the text will get displayed on the last row or
  168. Xlast column of the screen.
  169. X
  170. XThis keyword could be used to
  171. Xplace a prompt text next to the cursor.  The \fI.TEXT\fP is only active for
  172. Xthe current menu.  If you want the same text to appear in every menu you
  173. Xwill need to put a \fI.TEXT\fP in every menu.
  174. XTerminal attributes may be placed in the text line (see Terminal Attributes).
  175. X
  176. XA environment variable may be specified within the text.
  177. X
  178. XThe last line of the screen is used to report error messages, like 
  179. X\fIInvalid Option\fP.  Your text will probably get erased if put on the last
  180. Xline.
  181. X. \ --------------------------------------------------------------------------
  182. X
  183. X.PP
  184. X.nf
  185. X \fB.TITLE\fP
  186. X Title Line text.
  187. X.fi
  188. X.IP "" 6
  189. XDisplay a title line top of menu.
  190. XTitle lines will start at row zero.
  191. XMultiple .TITLE lines may be defined up to MAXTITLE (6) defined in
  192. Xmenu.h file.
  193. X
  194. XThe title line consists of three sections defined as follows:
  195. X.br
  196. Xleft text...center text...right text
  197. X.br
  198. XText you place in the three sections will be either left justified,
  199. Xcentered, or right justified on the screen.  The "\fB...\fP" are used to
  200. Xseparate the sections.
  201. X
  202. X.RS 6
  203. X.PP
  204. XA substitutable variable may be specified within the title line text.
  205. XThe character $ is used to introduce substitutable 
  206. Xparameters, in the form of ${\fIparameter\fP}.
  207. XThe value, if any, of the \fIparameter\fP is substituted.  The braces are 
  208. Xrequired only when \fIparameter\fP is followed by a letter, digit, or 
  209. Xunderscore that is not to be interpreted as part of its name.  See sh(1) 
  210. Xfor more info.
  211. X.TP 6
  212. X$DATE
  213. Xmay be placed anywhere in title text and the system date (mm/dd/yy) will
  214. Xbe displayed.
  215. X.TP 6
  216. X$TIME
  217. Xmay be placed anywhere in title text and the system time (hh:mm zz) will 
  218. Xbe displayed.
  219. X
  220. X.TP 6
  221. X$MAIL
  222. XThe \fI$MAIL\fP is a special environment variable.  This turns on the mail
  223. Xnotification facility.  $MAIL may be placed anywhere in the title text and when
  224. Xthe user has mail to be read the word "\fBMAIL\fP" will be displayed in
  225. Xreverse video at that location in the title line, with an audible beep.
  226. XThe MAIL environment variable needs to be set to the users mail file, ex.
  227. X"MAIL=/usr/mail/pjc".  The environment variable \fIMAILCHECK\fP is used to
  228. Xdetermine how often to check for mail.  See mail(1).
  229. X.br
  230. XIf you have a hierarchy of menus for your application \fI$MAIL\fP only needs
  231. Xto be in the first menu.
  232. X
  233. XWarning: If menu is run with the set uid bit set, menu will be unable to
  234. Xdetermine if your mail is being forwarded, because it won't have read
  235. Xpermission on your mail file, and \fIMAIL\fP will be displayed all the time.
  236. X.TP
  237. XTerminal Attributes
  238. XAttributes may be specified anywhere in the title text as follows:
  239. X.nf
  240. X\\S = Standout
  241. X\\B = Bold
  242. X\\U = Underline
  243. X\\D = Dim
  244. X\\R = Reverse Video
  245. X\\L = Blink
  246. X\\N = Normal
  247. X
  248. Xexample: \\RThis text is reverse video.\\N Now normal.
  249. X
  250. Xnote: Terminal attributes are terminal dependent.
  251. XBerkeleys' version of curses only supports Standout.  Attributes may
  252. Xalso be combined.
  253. X.fi
  254. X
  255. XFor \fI.POPMENU\fP there is no left,center,right sections.  The title is
  256. Xcentered.  You can have only one \fI.TITLE\fP in a pop-up menu.  No attributes
  257. Xand/or environment variables are supported in the title for pop-up menus.
  258. X.RE
  259. X. \ --------------------------------------------------------------------------
  260. X
  261. X.PP
  262. X \fB.UNIX\fP  [ REDRAW ]  [ GETINPUT screen_name ]  command  [ \\ ]
  263. X.IP "" 6
  264. XA system(3) call with command as the argument is executed immediately 
  265. Xwhen found while parsing the 
  266. Xmenufile.  Can be used to set function keys on terminal.  Warning: if
  267. Xyou use this to set function keys and the function keys are changed in
  268. Xanother program, they do not get reset back to what they were in the menu.
  269. XMaximum length of command is 700 characters.
  270. X
  271. XThe [ GETINPUT ] option allows you to display a screen and prompt a user for
  272. Xinput, before the command is run.
  273. XThe window_pos argument to DEFINE_SCREEN must be specified in order to use
  274. Xthe screen here, because, menu is unable to automatically figure out where to 
  275. Xput the screen because this is happing during the parsing stage.
  276. X
  277. XThe [ REDRAW ] flag instructs menu to redraw the screen after your command
  278. Xhas been executed.  This is recommended if your command writes anything to
  279. Xthe screen.
  280. X
  281. XDiagnostics
  282. X.RS 10
  283. XThe following actions are taken by menu depending on what exit code your
  284. Xcommand uses.
  285. X.TP 15
  286. X0
  287. XAOK. Continue to parse the next keyword.
  288. X.TP 15
  289. X1
  290. XQuit/Exit the menu program.
  291. X.TP 15
  292. X4
  293. XReturn to previous menu and display the error message 
  294. X"Not Authorized to run menu.".
  295. X.TP 15
  296. Xanything else
  297. XQuit parsing this menu and return to previous menu.  No message.
  298. X.RE
  299. X
  300. X.RS 6
  301. XExample:  Authorize menu access.
  302. X.nf
  303. X         .UNIX grep $LOGNAME access_table >/dev/null 2>/dev/null \\
  304. X        [ $? -ne 0 ] exit 4 \\
  305. X        exit 0
  306. X.fi
  307. X
  308. XExample:  Build a menu script file at run time.
  309. X.nf
  310. X       ###  Printer Selection Menu
  311. X       ###  Build a .POPMENU of available printers connected to a system.
  312. X
  313. X          .UNIX echo ".TITLE" > printers.m; \\
  314. X             echo "Printer Menu" >> printers.m; \\
  315. X             echo ".TEXT 23 0" >> printers.m; \\
  316. X             echo "Select A Printer." >> printers.m; \\
  317. X             lpstat -p | awk '{ print $2 }' | \\
  318. X             for i in `cat` \\
  319. X             do \\
  320. X             echo ".SETENV LPDEST=$i  Printer ($i) selected." >>printers.m; \\
  321. X             echo "$i" >> printers.m; \\
  322. X             done; \\
  323. X             exit 0
  324. X
  325. X          .POPMENU printers.m  10 50
  326. X          Select Default Printer.
  327. X.fi
  328. X.RE
  329. X. \ --------------------------------------------------------------------------
  330. X
  331. X.PP
  332. X \fB.WINDOW\fP  first_row  last_row  first_col  last_col  [ heading ]
  333. X.IP "" 6
  334. XDefines a window area (rectangle) to display the options that follow this 
  335. Xkeyword (up to the next \fI.WINDOW\fP or end of file).
  336. XThe options are centered between first_row / last_row
  337. Xand between first_col / last_col.
  338. XThe \fIrows\fR and \fIcolumns\fR are absolute (base 0) and inclusive.  
  339. XIt is up to you
  340. Xto make sure they don't overlap (unless that's what you want), and
  341. Xthat it is large enough to hold the options that follow.
  342. XThe optional \fIheading\fR is text you wish centered over the window area
  343. X(rectangle).
  344. XIt is
  345. Xdisplayed on \fIfirst_row\fR minus one.
  346. XThe heading may contain terminal attributes as described under \fI.TITLE\fR.
  347. XYour \fI.WINDOW\fP keywords should be placed after all \fI.TITLE\fP(s).
  348. X.br
  349. XFor example suppose you want two columns of options on the screen, one
  350. Xof which will have a heading:
  351. X.nf
  352. X .WINDOW 0 23 0 39
  353. X1. this option in left column
  354. X2. this option in left column
  355. X .WINDOW 10 23 40 79 \\R REPORTS \\N
  356. X3. this option in right column
  357. X
  358. X.fi
  359. XIf no .WINDOW is used a default of .WINDOW 0 screen_rows 0 screen_cols 
  360. Xis used for all options.
  361. X
  362. XNot supported in a \fI.POPMENU\fP menu.
  363. X. \ --------------------------------------------------------------------------
  364. X
  365. X.SH HELP SCREENS
  366. XThe default help file for menu(1) is \fImenu.hlp\fP.  Additional help files
  367. Xmay be used in a GETINPUT screen.  The following describes the the syntax of
  368. Xa help file.
  369. X
  370. X\fBtagname\fP
  371. X.br
  372. X[ .TITLE   A Title May Be Placed Here. ]
  373. X.br
  374. XA tagname identifies a help screen and must be on a line by itself.
  375. X.br
  376. XThe text (with optional terminal attributes) to be displayed for this tagname 
  377. Xis placed between the two tags.  Don't use tabs to space the text 
  378. X(it don't work), you have to put in hard spaces.
  379. XMore than one tagname may be placed in a help file.
  380. XAny text outside of a tagname is ignored.
  381. X.br
  382. X\fBtagname\fP
  383. X
  384. X
  385. XThe \fITABLE_OF_CONTENTS\fP tagname is a special tag describing what
  386. Xis to be contained in the table of contents for help.  The following is the
  387. Xsyntax for this tagname.
  388. X.nf
  389. X\fBTABLE_OF_CONTENTS\fP
  390. Xhelpfile   tagname   description
  391. Xhelpfile   tagname   description
  392. X    etc...
  393. X\fBTABLE_OF_CONTENTS\fP
  394. X.fi
  395. X
  396. X
  397. XBelow is shown the default help file for menu(1)  (menu.hlp).
  398. XIt has four tagnames in it (TABLE_OF_CONTENTS, menu, popmenu, GETINPUT 
  399. Xand help).  This file may be customized to fit your needs.
  400. X
  401. X.nf
  402. X\fBTABLE_OF_CONTENTS\fP
  403. Xmenu.hlp    menu        Menus      - Help using menus.
  404. Xmenu.hlp    popmenu        Pop-menus  - Help using popmenus.
  405. Xmenu.hlp    GETINPUT    Input      - Editing commands.
  406. Xmenu.hlp    help        Help       - Using help.
  407. X\fBTABLE_OF_CONTENTS\fP
  408. X
  409. X
  410. X\fBmenu\fP
  411. X .TITLE Menu Help
  412. X
  413. X  \\RMENU COMMANDS:\\N
  414. X          M       \\D-  Go directly to main menu.\\N
  415. X          P       \\D-  Return to previous menu.\\N
  416. X          G or ^g \\D-  Go directly to a specific menu.\\N
  417. X          H or ?  \\D-  This help screen.\\N
  418. X          ^r      \\D-  Redraw the screen.\\N
  419. X          E       \\D-  Exit.\N
  420. X          !       \\D-  Enter a unix command.\\N
  421. X
  422. X  \\RSELECTING OPTIONS:\\N
  423. X          -  Use "up arrow key", "^k", "down arrow key", "^j" or
  424. X             "tab key" to place bar on option and press "return".    
  425. X
  426. X                  or
  427. X
  428. X          -  Enter option number and press "return".
  429. X
  430. X\fBmenu\fP
  431. X
  432. X\fBpopmenu\fP
  433. X .TITLE Pop-Up Menu Help
  434. XSELECTING OPTIONS:
  435. X    To select an option press the "up arrow key",
  436. X    "k", "down arrow key", "j" to place bar on
  437. X    option and press "return".
  438. X
  439. X    KEY_CANCEL (esc)   - Cancel selection.
  440. X\fBpopmenu\fP
  441. X
  442. X\fBGETINPUT\fP
  443. X .TITLE GETINPUT Help
  444. XMover Keys:
  445. X        KEY_RETURN  (^m)    Traverse forwards through the fields.
  446. X    .
  447. X    . (etc.  see GETINPUT)
  448. X    .
  449. X        KEY_PRINT  (^p)     Print screen to lp.
  450. X\fBGETINPUT\fP
  451. X
  452. X\fBhelp\fP
  453. X .TITLE Using Help
  454. XHelp displays consist of a description displayed in a window.
  455. XIf the description doesn't fit in the window, the Up Arrow and
  456. XDown Arrow keys can be used to view a few more lines of the 
  457. Xdisplay.  Exiting the help system will return the display to 
  458. Xthe state it was in when you asked for help.
  459. X
  460. X   The following keys are active in help:
  461. X        KEY_CANCEL  (esc)    Exit help.
  462. X        KEY_DOWN  (^j)    View a few more lines.
  463. X        KEY_UP  (^k)    View the previous lines.
  464. X        KEY_BEG  (^b)    Display first page.
  465. X        KEY_END  (^e)    Display last page.
  466. X        KEY_TOC  (^t)    Display help table of contents.
  467. X\fBhelp\fP
  468. X.fi
  469. X
  470. X.SH MENU INITIALIZATION FILE - (.menuinit)
  471. XA menu initialization file can be provided that
  472. Xcontains initialization commands
  473. Xto menu.  This file is read when menu is first started.  The \fI.menuinit\fP
  474. Xfile is first looked for in the current directory then in getenv("HOME")
  475. Xthen in getenv("MENUDIR").  This file is not needed if the default settings 
  476. Xsuffice.  
  477. X
  478. XBelow is listed a .menuinit 
  479. Xfile with all the various initialization commands and their associated default 
  480. Xvalue.  The decimal value is what is returned from a curses getch() call.  
  481. X\fITry menu  -keys\fP.  Setting a key value to minus one disables the key, 
  482. Xalthough the associated curses key, if any, is still active.
  483. X
  484. XNote: Menu(1) does character matching (case insensitive) on the option
  485. Xdescription,
  486. Xin addition to entering the number
  487. Xof the option, to select a option.  The character matching is done after it
  488. Xhas checked for any of the following keys.  So, for example, if you use the
  489. Xdefault setting for KEY_EXITMENU (e) and you have a option titled "Enter ...".
  490. XThe user will not be able to press a "e" for character matching on "Enter ...".
  491. XThe exit menu process will be enabled.  This should be considered in
  492. Xselecting your key values if full character matching is important.
  493. X
  494. X
  495. X.nf
  496. X     KEY_EXITMENU = 101    # (e)   Exit Menu Program.
  497. X     KEY_MAINMENU = 109    # (m)   Go to main menu.
  498. X     KEY_PREVMENU = 112    # (p)   Go to previous menu.
  499. X     HOTKEYS            #       This causes the above menu keys to work without a carraige return.
  500. X
  501. X     KEY_GNAME = 103    # (g)   Go to a specific menu prompt.
  502. X     KEY_POPGNAME = 7    # (^g)  Display "\fIGoto Menu\fP", GNAME pop menu.
  503. X     KEY_RETURN = 13    # (^m)  Select hi-lighted menu option or traverse forwards through GETINPUT fields.
  504. X     KEY_DOWN = 10    # (^j)  Traverse forwards through menu options or GETINPUT fields.
  505. X                       Scroll help screen.
  506. X     KEY_UP = 11        # (^k)  Traverse backwards through menu options or GETINPUT fields.
  507. X                       Scroll help screen.
  508. X     KEY_TAB = 9    # (^i)  Fast forward through menu options or GETINPUT fields.
  509. X     KEY_BTAB = -1    #        Fast reverse through menu options or GETINPUT fields.
  510. X     KEY_BEG = 2    # (^b)  Place cursor at beginning of a GETINPUT field.
  511. X                       Display first page of help screen.
  512. X     KEY_END = 5    # (^e)  Place cursor at end of input in a GETINPUT field.
  513. X                       Display last page of help screen.
  514. X     KEY_RIGHT = 12    # (^l)  Forward space within the GETINPUT field.
  515. X     KEY_LEFT = 8    # (^h)  Backspace within the GETINPUT field (non-destructive).
  516. X     KEY_BACKSPACE = 8    # (^h)  Same as KEY_LEFT.
  517. X     KEY_EOL = 4    # (^d)  Delete from cursor to end of GETINPUT field.
  518. X     KEY_DL = 3        # (^c)  Clear GETINPUT field and home cursor.
  519. X     KEY_DC = 24    # (^x)  Delete a character in a GETINPUT field.
  520. X     KEY_IC = 20        # (^t)  Toggle between type-over and insert mode in GETINPUT.
  521. X     KEY_HELP = 63    # (?)  Display help screen.
  522. X     KEY_TOC = 20    # (^t)  When in help display table of contents for help.
  523. X     KEY_REFRESH = 18    # (^r)  Redraw the screen.
  524. X     KEY_ACCEPT = 1    # (^a)  Accept all input from a GETINPUT screen.
  525. X     KEY_CANCEL = 27    # (esc)  Cancel all input from a GETINPUT screen or cancel a pop-up menu selection.
  526. X                       Exit a help screen.
  527. X     KEY_SAVE = 6    # (^f)  Save a GETINPUT screen to a file.
  528. X     KEY_PRINT = 16    # (^p)  Print a GETINPUT screen to lp.
  529. X.fi
  530. X
  531. X.SH EXAMPLE menufile
  532. X.nf
  533. X\fB###\fR     This is a example of a menu script file.
  534. X
  535. X\fB .AUTHORIZE\fR  pjc nortons boink mozart
  536. X
  537. X\fB###\fR    Initialize function keys for TERM=5425
  538. X\fB .UNIX\fR  echo "\\033[1;2;0;0q  HELP          h\\r\\c"
  539. X
  540. X\fB###\fR    Define goto menu names.
  541. X\fB .GNAME\fR  main  main.m
  542. X\fB .GNAME\fR  reports  reports.m
  543. X
  544. X\fB###\fR     Title Lines Section.
  545. X\fB .TITLE\fR
  546. X  Version 3.00...\\RPACIFIC * BELL\\N...$DATE
  547. X\fB .TITLE\fR
  548. X $MAIL...Sample Menu...\\S$TIME\\N
  549. X\fB .TITLE\fR
  550. X ...MAIN MENU...
  551. X\fB .LINE\fR
  552. X
  553. X\fB###\fR     Left column of screen - Options
  554. X\fB .WINDOW\fR 0 23 0 39
  555. X\fB .SYSTEM\fR who
  556. XList who is on the system.
  557. X\fB .SYSTEM\fR ps -ef; \\
  558. X    echo "Press [ Return ] to continue.\\c"; read reply
  559. XPrint process status table.
  560. X
  561. X\fB###\fR     Right column of screen - Options
  562. X\fB .WINDOW\fR 0 23 40 79 \\R SUB MENU \\N
  563. X\fB .MENU\fR reports.m
  564. XGo to report menu.
  565. X
  566. X\fB .TEXT\fP 22 50
  567. XSelection [ ? for help ]
  568. X.fi
  569. X
  570. X.SH GENERALLY ACCEPTED GUIDELINES
  571. X.PD 0.1
  572. X.IP -> 3
  573. XPut a meaningful title on the top of every menu.
  574. X.IP -> 3
  575. XProvide symmetric balance by centering the title and the menu options
  576. Xaround the center axis of the screen.
  577. X.IP -> 3
  578. XChoose an organizing principle for the menu options.
  579. XOrganize menu hierarchies according to the tasks users will perform, rather
  580. Xthan the structure of the software modules.
  581. X.br
  582. XHints in organizing options:
  583. X.RS 6
  584. X.IP * 3
  585. XChronological ordering
  586. X.IP * 3
  587. XAscending or descending numerical ordering
  588. X.IP * 3
  589. XItems grouped by physical properties, (Increasing volume, weight or temperature)
  590. X.IP * 3
  591. XAlphabetic sequence of terms
  592. X.IP * 3
  593. XGrouping of related options with spatial demarcation between groups
  594. X.IP * 3
  595. XMost frequently used options first
  596. X.IP * 3
  597. XMost important options first
  598. X.RE
  599. X.IP -> 3
  600. XTo facilitate scanning, put blank lines between logical groupings of menu
  601. Xoptions and after about every fifth option in a long list.
  602. X.IP -> 3
  603. XLimit the number of menu choices of one screen.
  604. XThe breadth (number of options per menu) should be no more than eight and the
  605. Xdepth (number of levels of menus) should be no more than four.
  606. X.IP -> 3
  607. XUse words for your menu options that clearly and specifically describe 
  608. Xwhat the user is selecting; use simple, active verbs to describe menu options.
  609. XUse common, short English words that clearly describe the action that the 
  610. Xcommand will carry out; choose words that are distinctive from one another.
  611. X.IP -> 3
  612. XDisplay the menu options in mixed, upper and lower case letters.
  613. X.IP -> 3
  614. XBe sure that any function keys that you use will operate correctly on all of
  615. Xthe different types of keyboards the users have.
  616. X.IP -> 3
  617. XBe consistent in the use of menu formats, procedures, and wording; the 
  618. Xmapping of keys to functions; the naming of menu options.
  619. X.IP -> 3
  620. XOptions should suggest or entail closure.  If a menu option calls another
  621. Xmenu (.MENU) the title of the option should be the title of the called menu
  622. Xto provide continuity.  Likewise, if a menu option calls a program (reports,
  623. Xscreens) the title of the option should be the title of the report/screen.
  624. X.IP -> 3
  625. XDisplay only information that the user needs to know.
  626. X.IP -> 3
  627. XEvery menu should indicate how to exit from the screen.
  628. X.IP -> 3
  629. XAvoid hyphenation of words between lines.
  630. X.IP -> 3
  631. XUse abbreviation and acronyms only when they are significantly shorter than
  632. Xthe full text and when they will be understood by the user.
  633. X.IP -> 3
  634. XOptions in a multiple column list should be organized in vertical columns
  635. Xwhich are read from left to right on the screen.
  636. X.IP -> 3
  637. XPut a least two spaces between the longest item in a column and the beginning
  638. Xof the next column.
  639. X.IP -> 3
  640. XUse highlighting to emphasize important information only.  Do not overuse
  641. Xit.
  642. X.IP -> 3
  643. XA \fI.POPMENU\fP, if possible, should appear as close to and to the right 
  644. Xof the option that selected it.  Probably a \fI.GETINPUT\fP screen should also.
  645. X.PD
  646. X
  647. X.SS References
  648. XHuman Factors Engineering, User Interface Guidelines, Pacific Bell, Sept (1987)
  649. X.PP
  650. XShore, John, The Sachertorte Algorithm and Other Antidotes to Computer
  651. XAnxiety, Viking Penguid Inc. (1985)
  652. X.IP * 3
  653. XShore's book for the general public which translates into why designing 
  654. Xgood user interfaces are necessary.
  655. X.PP
  656. XBeer, S. and Schoefer, W., Screen Development Guidelines - Draft,
  657. XVersion 1.0, Pacific Bell, April (1987)
  658. X.PP
  659. XRubinstein R., and Hersch H.M., with Ledgard, H.F., The Human Factor:
  660. XDesigning Computer Systems for People.  Digital Press, Digital Equipment
  661. XCorporation, (1984).
  662. X.IP * 3
  663. XRubinstein's work is very interesting and original.  The text is readable
  664. Xand the ideas presented are clear and attractive.  This is not a text book.
  665. X.PP
  666. XFuture Technology Architecture District, Proposed Pacific*Bell Screen 
  667. XStandards For NonProgrammable Terminals,  Pacific Bell, May (1988)
  668. X.PP
  669. XDumas Joseph S., Designing User Interface for Software, Prentice Hall, 1988
  670. X
  671. X.SH CREDITS
  672. XPaul J. Condie        8/18/86    original author
  673. X.br
  674. X{att,bellcore,sun,ames,pyramid}!pacbell!pcbox!pjc
  675. X.br
  676. X
  677. XIrving Griesman            GetInput(3X)
  678. X.br
  679. XSam S. Lok            .POPMENU enhancements
  680. X
  681. X.SH NOTE
  682. XIf memory size is important modify LoadKeys.c and remove all references
  683. Xto keywords your application does not use then relink.  This will reduce
  684. Xthe size of menu.
  685. X
  686. X.SH FILES
  687. Xmenu.hlp    -  menu help file
  688. X.br
  689. X/usr/local/lib/menus    - some menus you might want to use or look at.
  690. X.br
  691. X/usr/local/lib/menus/sample.m    -  a sample menu file
  692. X.br
  693. X/usr/local/lib/menus/printers.m    -  printers pop-up menu
  694. X.br
  695. X/usr/local/lib/menus/reportsrn.m    -  report option input screen
  696. X
  697. XThe library of menus may vary from machine to machine.
  698. X
  699. X.SH SEE ALSO
  700. XMenuAccess(1), curses(3X), system(3), mail(1), getenv(3), 
  701. Xlock(1), unlock(1), GetInput(3X), checkpass(1), runrealid(1).
  702. X
  703. X.SH WARNING
  704. XBecause menu uses the environment to pass and save data you are limited on the
  705. Xvolume of data you can have based upon the size of your environment.  
  706. XThis will vary from machine to machine.  If you see the 
  707. Xmessage "Unable to allocate environment memory..." then you have reached
  708. Xyour limit.  Actually you've surpassed the limit or you wouldn't have
  709. Xgotten the message.  But lets not squabble.
  710. X
  711. XMenu has very little intellegence built in to check if you exceed the bounds
  712. Xof any fields.  If menu core dumps, especially will a bus error, you are
  713. Xprobably trying to load too large a value into a field.
  714. X
  715. X.SH BUGS
  716. XCurses bug - When a attribute is the last character on the line (spaces don't 
  717. Xcount) the attributes do not get turned off until it hits the next character 
  718. Xon the next line.
  719. X
  720. X.PP
  721. XWhen you use the mail notification $MAIL the alarms get buffered up when
  722. Xthe cursor is just sitting there, so, as soon as the user types something
  723. Xat the keyboard all the alarms that were buffered take off, which means, you
  724. Xget a beep...beep...beep...beep.  This doesn't happen on AT&T 3b machines
  725. Xbut I've noticed it on SUNS and ARETE machines.
  726. XYou should take the -DALARM off the CFLAGS in the makefile which tells
  727. Xmenu not to use the alarm(2) to check for mail, but check when a key
  728. Xhas been pressed.
  729. X
  730. X.PP
  731. XMenu has not really been tested on terminals/windows that is not 24x80,
  732. Xok,ok... it hasn't been tested at all.  For the most part it should work
  733. Xfine, EXCEPT (you knew that was coming), when you want to create columns
  734. Xof options using the .WINDOW keyword.  The parameters to .WINDOW are
  735. Xabsolute therefore when you line up your columns for a 24x80 terminal and
  736. Xyour menu is run on say a 34x132 terminal your columns will not be
  737. Xcentered right.  Probably a new keyword should be introduced ".COLUMN"
  738. Xwhich would have some intelligence built in to try to center columns within
  739. Xthe window space.  It might have some problems going from a larger window
  740. Xto a smaller window if the columns won't fit.
  741. X.br
  742. XAnyone volunteer to write this one?
  743. X
  744. X.PP
  745. XTerminal attributes sometimes don't work right.  Especially when putting
  746. Xmultiple attributes on one line.  In all cases I've seen it is a restriction
  747. Xof the terminal (hardware).
  748. X
  749. X.bp
  750. X.SH PROGRAMMING NOTES
  751. XThis section is for those of you who want to or need to add new keywords.
  752. X.PP
  753. XThe keywords that have been provided should accommodate most
  754. Xapplication menus, however, if customization is needed the following
  755. Xmay come in handy.  If you introduce any neat new keywords (say like 
  756. X".IF THEN ELSE") I would
  757. Xappreciate you sending them to me so I can incorporate them.  Send your
  758. XParse, Show, and Run functions along with a copy of \fILoadKeys.c\fP.
  759. X.PP
  760. XMenu is primarily driven from the LoadKeys.c module.  This 
  761. Xmodule describes to menu what keywords it needs to scan for and what
  762. Xaction to take when found.
  763. XThere are four sections in LoadKeys (see LoadKeys example) each of which 
  764. Xneed to be
  765. Xdefined if you are introducing a new keyword.  LoadKkeys provides three areas
  766. Xof control (sections 2,3,4), and it is important that you know what you
  767. Xwant to accomplish at each control point:
  768. X.TP 4
  769. XParse
  770. XWhat do you want menu to do with your keyword once it has found it during
  771. Xthe parsing routine?  Any data you need to store for a later step, etc..
  772. X.TP 4
  773. XShow
  774. XHow do you want your keyword displayed to the screen?  Define as NULL if
  775. Xnot appropriate.
  776. X.TP 4
  777. XRun
  778. XIf the user selects an option that is your keyword, what do you want done?
  779. X
  780. X.PP
  781. XIf you want to put debugging code in your functions then the following
  782. Xformat should be used.
  783. X.nf
  784. Xextern int  debug;
  785. Xif (debug)
  786. X{
  787. X    fprintf (stderr, "\\n[Function] <KeyWord> ...", ...);
  788. X}
  789. X.fi
  790. Xwhere [Function] is the function name and <KeyWord> is the keyword being
  791. Xprocessed.
  792. X
  793. X.SS ADDING A NEW KEYWORD
  794. X.TP 8
  795. XStep 1:
  796. XDecide on the name of the new keyword.  For consistency sake, I suggest, it
  797. Xshould begin with a "." and be all in caps.  Maximum length of keyword is
  798. XMAXKEYLENGTH (15).  Then formulate a syntax for the keyword (what the user
  799. Xneeds to type in the menufile).
  800. X.br
  801. XAlso, get clear in your mind what you want done at each of the three control
  802. Xpoints.
  803. X
  804. X.TP 8
  805. XStep 2:
  806. Xvi LoadKeys.c
  807. X.br
  808. XStrcpy your keyword into the next available slot in KeyWord[], under SECTION 1.
  809. XMake sure MAXKEYS in menu.h is >= the slot you strcpy'ied your keyword into.
  810. XSee KeyWord[] below.
  811. X
  812. X.TP 8
  813. XStep 3:
  814. XIn SECTION 2 of LoadKeys.c assign the Parse function that is going 
  815. Xto parse your keyword.
  816. XIt should be assigned to the same slot as in SECTION 1.  First see if one
  817. Xof the Parse functions already written will do the job.  If so use that one,
  818. Xif not you will have to write one.  For consistency call it Parse????.c or
  819. XPar????.c, and declare it at the beginning of LoadKeys.c.
  820. XAll keywords must have a parse function.
  821. XThis function is called immediately when your keyword is found while parsing
  822. Xthe menufile.
  823. XSee ParseKey[]() below.
  824. X.br
  825. XReturn Values:
  826. X.RS 8
  827. X.TP 9
  828. X0
  829. XContinue to parse next keyword.
  830. X.TP 9
  831. X-1
  832. XQuit/Exit menu program.
  833. X.TP 9
  834. X-2
  835. XReturn to main menu.
  836. X.TP 9
  837. X-4
  838. XNOWAYJOSE - Not authorized to run this menu.
  839. X.TP
  840. Xanything else
  841. XAbort this menu and return to previous menu.
  842. X.RE
  843. X
  844. X.TP 8
  845. XStep 4:
  846. XIn SECTION 3 of LoadKeys.c assign the Show function (if your keyword is a
  847. Xuser selectable option) that will display the
  848. Xoption to the screen.
  849. XIt should be assigned to the same slot as in SECTION 1.  First see if one
  850. Xof the Show functions already written will do the job.  If so use that one,
  851. Xif not you will have to write one.  For consistency call it Show????.c, and
  852. Xdeclare it at the beginning of LoadKeys.c.
  853. XThis function is called when displaying options to the screen.
  854. XIf you don't need a Show function for your keyword assign slot to NULL.
  855. XSee ShowKey[]() below.
  856. X
  857. X.TP 8
  858. XStep 5:
  859. XIn SECTION 4 of LoadKeys.c assign the Run function (if your keyword is a
  860. Xuser selectable option) that will be called when the user selects this option.
  861. XIt should be assigned to the same slot as in SECTION 1.  First see if one
  862. Xof the Run functions already written will do the job.  If so use that one,
  863. Xif not you will have to write one.  For consistency call it Run????.c, and
  864. Xdeclare it at the beginning of LoadKeys.c.
  865. XIf you don't need a Run function for your keyword assign slot to NULL.
  866. X.br
  867. XReturn Values:
  868. X.RS 8
  869. X.TP 9
  870. X0
  871. XAOK, continue with normal menu processing.
  872. X.TP 9
  873. XMAINMENU
  874. XGoto main menu.  This is as if the user had typed an "M".
  875. X.TP
  876. XPREVIOUSMENU
  877. XGoto previous menu.  This is as if the user had typed a "P".
  878. X.TP
  879. XQUIT
  880. XQuit program.  This is as if the user had typed an "E".
  881. X.TP
  882. XSUBMENU
  883. XIf you are introducing
  884. Xa new submenu keyword (like \fI.MENU\fP) the Run??? function must return 
  885. X(SUBMENU), a #define.
  886. XRefer to \fIRunMenu.c\fP for an example.
  887. X.TP
  888. XGNAMEOFFSET + gindex
  889. XGoto a specific (.GNAME) menu.
  890. XWhere gindex = the index into the gnames array (base 0).
  891. XThis is as if the user had typed a goto menu.
  892. X.RE
  893. X
  894. X.TP 6
  895. XStep 6:
  896. XCompile your new functions, LoadKeys.c  and link into menu.  
  897. XYour KeyWord should work.
  898. XThere should be no need to change any of the existing driver routines 
  899. X(other than LoadKeys.c)?
  900. X
  901. X
  902. X.SS char  KeyWord[]
  903. XThis array identifies all the keywords to be scanned for in your
  904. Xmenufile.  Maximum number of keys is "MAXKEYS" defined in menu.h
  905. Xfile.  Increasing MAXKEYS will allow more keys.
  906. X
  907. X.SS "int (*ParseKey[]) (keyword, menufile, menu, KeyWord, ParseKey, gnames, gfiles, gindex, opnumber)"
  908. X.nf
  909. Xchar        keyword[];
  910. XFILE        *menufile;
  911. Xstruct MenuInfo    *menu;
  912. Xchar        KeyWord[][MAXKEYLENGTH];
  913. Xint        (*ParseKey[])();
  914. Xchar        gnames[][15], gfiles[][15];
  915. Xint        *gindex;
  916. Xint        *opnumber;
  917. X.fi
  918. XArray of pointers to functions that will be called to parse the
  919. Xkeyword when found.  Any processing you want done while program
  920. Xis parsing your keyword should be placed in this function.
  921. XIf you have defined a new keyword you must
  922. Xdescribe how that keyword is to be parsed.  Unless you are doing
  923. Xsomething special ParseOption() should do the job.
  924. XYour new function will need to malloc struct OptionInfo if you
  925. Xwant to store some information for the option.  The following describes
  926. Xthe data passed to all parsing functions.
  927. X.RS 6
  928. X.TP 6
  929. Xkeyword
  930. XThe keyword that was found in menufile.
  931. X.TP 6
  932. X*menufile
  933. XA pointer to your menufile.  When function returns you must leave
  934. Xthe pointer set to read in the next keyword.
  935. X.TP 6
  936. X*menu
  937. XA struct holding information about the menufile.  You need to maintain
  938. Xthe information for later processing. The Show and Run functions use the
  939. Xinformation you store here.  See struct MenuInfo and struct OptionInfo.
  940. X.TP 6
  941. Xgnames
  942. XThe goto menu names (.GNAME) presently defined (base 0).
  943. X.TP 6
  944. Xgfiles
  945. XThe menufiles associated with the goto names (base 0) (.GNAME).
  946. X.TP 6
  947. Xgindex
  948. XThe number of goto names (.GNAME) presently defined.
  949. X.TP 6
  950. Xopnumber
  951. XThe last option number.  This is the number that will appear to the left
  952. Xof the option, and the number the user will type in to select the option.
  953. XYou should increment this for the next option if your keyword will
  954. Xcontain a option number.
  955. XThe option number should be set to zero for options you don't want a
  956. Xnumber to appear to the left of the option.
  957. X.nf
  958. X.RE
  959. X
  960. X/*
  961. X**     Menu structure layout
  962. X*/
  963. Xstruct MenuInfo
  964. X{
  965. X    char            name    [15];        /* file name */
  966. X    int            wfrow;            /* window first row */
  967. X    int            wlrow;            /* window last row */
  968. X    int            wfcol;            /* window first col */
  969. X    int            wlcol;            /* window last col */
  970. X    int            row_cursor;        /* row for cursor */
  971. X    int            col_cursor;        /* col for cursor */
  972. X    unsigned        boxtype;        /* 0 = no box */
  973. X    unsigned        linetype;        /* same as box */
  974. X    int            titlecount;
  975. X    int            optioncount;        /* base 0 */
  976. X    struct OptionInfo    *option    [MAXOPTION];
  977. X    struct ScreenInfo    *srn    [MAXSCREENS+1];    /* .DEFINE_SCREEN */
  978. X                            /* NULL = EOL */
  979. X};
  980. X
  981. X
  982. Xstruct OptionInfo
  983. X{
  984. X    char    keyword        [MAXKEYLENGTH+1];
  985. X    int    opnumber;                /* option number */
  986. X    char    description    [200];
  987. X    char    command        [MAXLEN];
  988. X    int    row;                    /* row to display */
  989. X    int    col;                    /* col to display */
  990. X};
  991. X
  992. Xstruct ScreenInfo
  993. X{
  994. X    char            name    [30];        /* screen name */
  995. X    char            title    [100];        /* window title */
  996. X    int            toprow;            /* upper left corner */
  997. X    int            leftcol;
  998. X    int            rows;            /* # rows in win */
  999. X    int            cols;            /* # cols in win */
  1000. X    unsigned        boxtype;        /* 0 = no box */
  1001. X    int            exitlastfield;        /* after last field */
  1002. X    char            helpfile[16];
  1003. X    char            *fielddefaults;        /* init field command */
  1004. X    struct FieldInfo    *field    [MAXFIELDS+1];
  1005. X};
  1006. X
  1007. X
  1008. Xstruct FieldInfo
  1009. X{
  1010. X    char    name    [30];                /* field name */
  1011. X    char    label    [50];                /* field label */
  1012. X    int    row;                    /* start position */
  1013. X    int    col;
  1014. X    int    length;
  1015. X    int    min_input;
  1016. X    char    mask    [100];
  1017. X    char    range    [1025];
  1018. X    char    type;
  1019. X    char    adjust;
  1020. X    int    mustenter;
  1021. X    char    prompt    [100];
  1022. X    char    terminator[3];                /* field terminators */
  1023. X    int    noinput;
  1024. X};
  1025. X.fi
  1026. X.RE
  1027. X
  1028. X.SS "int (*ShowKey[]) (menu, index)"
  1029. X.nf
  1030. Xstruct MenuInfo   *menu;
  1031. Xint               index;
  1032. X
  1033. X.fi
  1034. XThe following describes the data passed to all Show functions.
  1035. XArray of pointers to functions that will be called to display
  1036. Xthat option to the screen.  Unless you are doing something special
  1037. XShowOption() should do the job.
  1038. X.RS 6
  1039. X.TP 6
  1040. X*menu
  1041. XSee above for description of menu structure.
  1042. X.br
  1043. Xmenu.option[index]->description gets displayed to the screen.
  1044. X.TP 6
  1045. Xindex
  1046. XOption number in menu structure that is to be displayed.
  1047. X
  1048. X.SS "int (*RunKey[]) (menu, opnumber, KeyWord, ParseKey, ShowKey, RunKey, gnames, gfiles, gindex)"
  1049. X.nf
  1050. Xstruct MenuInfo    *menu;
  1051. Xint        opnumber;
  1052. Xint        (*ParseKey[MAXKEYS])();
  1053. Xint        (*ShowKey[MAXKEYS])();
  1054. Xint        (*RunKey[MAXKEYS])();
  1055. Xchar        KeyWord[MAXKEYS][MAXKEYLENGTH];
  1056. Xchar        gnames[MAXGNAME][15];
  1057. Xchar        gfiles[MAXGNAME][15];
  1058. Xint        gindex;
  1059. X.fi
  1060. XThe following describes the data passed to all Run functions.
  1061. XArray of pointers to functions that will be called when the
  1062. Xuser selects the option on the screen.
  1063. X.RS 6
  1064. X.TP 6
  1065. X*option
  1066. XSee above for description of struct OptionInfo.
  1067. X.br
  1068. Xoption->command is what is to be executed for this option.
  1069. X.RE
  1070. X
  1071. X.SS LoadKeys Example:
  1072. X.nf
  1073. XLoadKeys (KeyWord, ParseKey, ShowKey, RunKey)
  1074. X
  1075. X    char    KeyWord[][10];
  1076. X    int    (*ParseKey[])(), (*ShowKey[])(), (*RunKey[])();
  1077. X{
  1078. X    int    ParseTitle(), ParseOption();
  1079. X    int    ShowOption();
  1080. X    int    RunSystem();
  1081. X
  1082. X    /*
  1083. X    **   Section 1:
  1084. X    **       Identify the new keyword here.
  1085. X    */
  1086. X    strcpy (KeyWord[1], ".TITLE");
  1087. X    strcpy (KeyWord[2], ".MENU");
  1088. X    strcpy (KeyWord[3], ".SYSTEM");
  1089. X
  1090. X    /*
  1091. X    **  Section 2:
  1092. X    **    Identify the parse function for the new keyword.
  1093. X    **      Every keyword needs a parse function.
  1094. X    */
  1095. X    ParseKey[1] = ParseTitle;
  1096. X    ParseKey[2] = ParseOption;
  1097. X    ParseKey[3] = ParseOption;
  1098. X
  1099. X    /*
  1100. X    **  Section 3:
  1101. X    **    Identify the show function for keywords that are options.
  1102. X    **      If ShowKey is set to NULL the option will not be displayed.
  1103. X    */
  1104. X    ShowKey[1] = NULL;    /* Title gets displayed in the parse function */
  1105. X    ShowKey[2] = ShowOption;
  1106. X    ShowKey[3] = ShowOption;
  1107. X
  1108. X    /*
  1109. X    **  Section 4:
  1110. X    **    Identify the run function for keywords that are options.
  1111. X    **      If RunKey is set to NULL the cursor will not stop at 
  1112. X    **      the option.  The user will not be able to select it.
  1113. X    */
  1114. X    RunKey[1] = NULL;    /* You can't select a title */
  1115. X    RunKey[2] = RunMenu;
  1116. X    RunKey[3] = RunSystem;
  1117. X}
  1118. X.fi
  1119. X
  1120. X
  1121. X
  1122. X
  1123. X.PP
  1124. XTHE END     (whew)
  1125. SHAR_EOF
  1126. echo "File menu.1 is complete"
  1127. chmod 0644 menu.1 || echo "restore of menu.1 fails"
  1128. echo "x - extracting Main.c (Text)"
  1129. sed 's/^X//' << 'SHAR_EOF' > Main.c &&
  1130. Xstatic char Sccsid[] = "@(#)Main.c    1.9   DeltaDate 1/22/90   ExtrDate 1/22/90";
  1131. X/*    PROGRAM       Menu  (generic)
  1132. X**    AUTHOR       Paul J. Condie
  1133. X**    DATE       8/18/86
  1134. X*/
  1135. X
  1136. X#include    <curses.h>
  1137. X#include    <signal.h>
  1138. X#include    "menu.h"
  1139. X
  1140. Xint    MAILCALL = FALSE;
  1141. Xint    mailrow;
  1142. Xint    mailcol;
  1143. Xint    debug = FALSE;                    /* debug flag */
  1144. X
  1145. X
  1146. Xmain (argc, argv)
  1147. X
  1148. X    int        argc;
  1149. X    char        *argv[];
  1150. X{
  1151. X    FILE        *fopen(), *menufile;
  1152. X    char        *getenv();
  1153. X    char        *findfile();
  1154. X    int        shutdown();        /* clean up before exit */
  1155. X    struct MenuInfo    menu;
  1156. X    int        (*ParseKey[MAXKEYS])(), 
  1157. X            (*ShowKey[MAXKEYS])(),
  1158. X            (*RunKey[MAXKEYS])();
  1159. X    char        KeyWord[MAXKEYS][MAXKEYLENGTH];
  1160. X/*
  1161. X**    menuname keeps track of nested submenus.
  1162. X**    mptr is the index into menuname 0 = main menu
  1163. SHAR_EOF
  1164. echo "End of part 2"
  1165. echo "File Main.c is continued in part 3"
  1166. echo "3" > s2_seq_.tmp
  1167. exit 0
  1168.