menu(1) part 1 of 14

Paul J. Condie pjc at pcbox.UUCP
Thu Dec 27 07:02:53 AEST 1990


#!/bin/sh
# shar:	Shell Archiver  (v1.22)
#
# This is part 1 of a multipart archive                                    
# do not concatenate these parts, unpack them in order with /bin/sh        
#
#      A Brief Description:
#           Menu(1) is an easy-to-use menu utility that allows users to
#           operate an application system in a user-friendly, menu-
#           driven environment.  Any application software, regardless of
#           source language or operating system process can be executed
#           from menus designed with Menu(1).
#
#           For systems requiring multi-level menus for a diverse number
#           of users, Menu(1) allows a single menu to call any number of
#           submenus, which may in turn call more menus or execute any
#           number of processes.  Menus can be nested to any level
#           without increasing startup time or memory requirements.
#
#           Menus can also be designed to function as user-friendly data
#           entry screens for capturing data, which can then be used as
#           input for a process.  Text items such as "displays",
#           "choices" and "responses" can be added within any of these
#           defined boundaries, and will automatically adjust if any
#           boundaries are changed.  Special screen attributes, such as
#           highlighting and reverse video, can be defined to add
#           special emphasis.
#
#           The menu script file contains all of the menu instructions,
#           and can be edited using a standard system editor, such as
#           vi.  Menus and utilities can be added or deleted by editing
#           the appropriate script file, even while the menu is in use.
#########
#
#
#	Run the following text with /bin/sh to create:
#	  README
#	  VERSIONHISTORY
#	  SHAREWARE
#	  makefile
#	  menu.1
#	  Main.c
#	  LoadKeys.c
#	  parsedrive.c
#	  showdriver.c
#	  rundriver.c
#	  ParseOpton.c
#	  ParseBaner.c
#	  ParseTitle.c
#	  ParseBox.c
#	  ParseWindo.c
#	  ParseLine.c
#	  ParseComnt.c
#	  ParseUnix.c
#	  ParseGname.c
#	  ParseAuthr.c
#	  ParseText.c
#	  ParseCur.c
#	  ParseSpace.c
#	  ParInclude.c
#	  ParAssign.c
#	  ParAftMenu.c
#	  ShowOption.c
#	  RunSystem.c
#	  RunExit.c
#	  RunSetenv.c
#	  RunMenu.c
#	  RunPopMenu.c
#	  RunGetI.c
#	  RunAftMenu.c
#	  GetOption.c
#	  EndWindow.c
#	  displaytxt.c
#	  SetTerm.c
#	  systime.c
#	  sysdate.c
#	  checkmail.c
#	  anymail.c
#	  setenv.c
#	  strmatch.c
#	  setvar.c
#	  drawline.c
#	  initmenu.c
#	  keyboard.c
#	  runscreen.c
#	  getval.c
#	  clean_menu.c
#	  slength.c
#	  runpopen.c
#	  mygetch.c
#	  menu.h
#	  terminal.h
#	  LexDeSrn.l
#	  menu.hlp
#	  runrealid.c
#	  ParseDeSrn.y
#	  utilities.d/libgeti.d/AdjField.c
#	  utilities.d/libgeti.d/BuildMenu.c
#	  utilities.d/libgeti.d/DateFun.c
#	  utilities.d/libgeti.d/DisPrmpt.c
#	  utilities.d/libgeti.d/FindSet.c
#	  utilities.d/libgeti.d/GetInput.c
#	  utilities.d/libgeti.d/GetSetLen.c
#	  utilities.d/libgeti.d/InitGetI.c
#	  utilities.d/libgeti.d/IsDate.c
#	  utilities.d/libgeti.d/IsFldOk.c
#	  utilities.d/libgeti.d/IsMask.c
#	  utilities.d/libgeti.d/IsRange.c
#	  utilities.d/libgeti.d/IsState.c
#	  utilities.d/libgeti.d/IsTime.c
#	  utilities.d/libgeti.d/ReDispFld.c
#	  utilities.d/libgeti.d/RingMenu.c
#	  utilities.d/libgeti.d/ScrnOut.c
#	  utilities.d/libgeti.d/ShowChar.c
#	  utilities.d/libgeti.d/ShowHelp.c
#	  utilities.d/libgeti.d/ShowSet.c
#	  utilities.d/libgeti.d/_Main.c
#	  utilities.d/libgeti.d/checkmask.c
#	  utilities.d/libgeti.d/doinsert.c
#	  utilities.d/libgeti.d/drawbox.c
#	  utilities.d/libgeti.d/findfile.c
#	  utilities.d/libgeti.d/getmmddyy.c
#	  utilities.d/libgeti.d/popmenu.c
#	  utilities.d/libgeti.d/stricmp.c
#	  utilities.d/libgeti.d/substr.c
#	  utilities.d/libgeti.d/upper.c
#	  utilities.d/libgeti.d/GetInput.h
#	  utilities.d/libgeti.d/keys.h
#	  utilities.d/libgeti.d/makefile
#	  utilities.d/libgeti.d/GetInput.3X
#	  utilities.d/libgeti.d/RingMenu.3
#	  utilities.d/libgeti.d/ShowHelp.3
#	  utilities.d/libgeti.d/drawbox.3
#	  utilities.d/libgeti.d/popmenu.3
#	  utilities.d/libgeti.d/GetInput.hlp
#	  utilities.d/checkpass.d/checkpass.1
#	  utilities.d/checkpass.d/checkpass.c
#	  utilities.d/lock.d/junk
#	  utilities.d/lock.d/lock.1
#	  utilities.d/lock.d/lock.c
#	  utilities.d/lock.d/unlock.1
#	  utilities.d/lock.d/unlock.c
#	  utilities.d/lock.d/uulock.c
#	  utilities.d/m.d/adduser
#	  utilities.d/m.d/adduser.old
#	  utilities.d/m.d/deluser
#	  utilities.d/m.d/junk
#	  utilities.d/m.d/junk.m
#	  utilities.d/m.d/passwdsrn.m
#	  utilities.d/m.d/printer2.sh
#	  utilities.d/m.d/printers.m
#	  utilities.d/m.d/printers.sh
#	  utilities.d/m.d/reportsrn.m
#	  utilities.d/m.d/sadmin.m
#	  utilities.d/m.d/sample.m
#	  utilities.d/m.d/setdbaperm
#	  utilities.d/m.d/suid_exec.c
#	  utilities.d/msgbox.d/displaytxt.c
#	  utilities.d/msgbox.d/makefile
#	  utilities.d/msgbox.d/msgbox.1
#	  utilities.d/msgbox.d/msgbox.c
#	  utilities.d/MenuMsg.d/MenuMsg.1
#	  utilities.d/MenuMsg.d/MenuMsg.c
#	  utilities.d/MenuMsg.d/MenuPrompt.1
#	  utilities.d/MenuMsg.d/MenuPrompt.c
#	  utilities.d/MenuMsg.d/makefile
#
mkdir utilities.d
mkdir utilities.d/checkpass.d
mkdir utilities.d/libgeti.d
mkdir utilities.d/lock.d
mkdir utilities.d/m.d
mkdir utilities.d/msgbox.d
mkdir utilities.d/MenuMsg.d
if test -r s2_seq_.tmp
then echo "Must unpack archives in sequence!"
     next=`cat s2_seq_.tmp`; echo "Please unpack part $next next"
     exit 1; fi
echo "x - extracting README (Text)"
sed 's/^X//' << 'SHAR_EOF' > README &&
Xmenu directory structure:
X
X                             |-MenuAccess.d	MenuAccess(1) program
X  menu(1)                    |-checkpass.d	checkpass(1) program
Xsource code --|-utilities.d--|-libgeti.d	GetInput(3X) library
X                             |-lock.d		lock(1) & unlock(1)
X                             |-m.d		Sample menu script files.
X                             |-msgbox.d		msgbox(1) program
X
XTo install menu(1):
X
X	1.   cd to where you want to keep the source code
X	2.   unpack the package
X	     cpio -iBcdumv < menu.cpio  or  unshar menu.shar.xx
X	3.   vi makefile and set where you want to install menu
X	4.   make
X	5.   make install
X
XTo test menu(1):
X	-   set menu directory to some sample menus
X	    MENUDIR=utilities.d/m.d; export MENUDIR
X	-   tell menu where you installed the help file
X	    HELPDIR=/usr/local/bin; export HELPDIR
X	-   run a sample menu
X	    menu sample.m
X
XNotes:
X	- The MenuAccess(1) program is not implemented yet.
X	- Refer to VERSIONHISTORY file for changes since previous versions.
SHAR_EOF
chmod 0644 README || echo "restore of README fails"
echo "x - extracting VERSIONHISTORY (Text)"
sed 's/^X//' << 'SHAR_EOF' > VERSIONHISTORY &&
X*** VERSION HISTORY ***
XVersion Number: A new keyword or major enhancements gets version bumped by a .10
X		Bug fixes small enhancements bumped .01
X
XVERSION 3.63 - Submitted to NetNews
X.  modified makefiles so CC would get carried to other makefiles	12/90
X.  fixed major bug if command line was greater than BUFSIZ but less than
X	MAXLEN - menu would core dump	10/90
X
XVERSION 3.62
X.  port to the sun	9/90
X.  clean_menu(3) - fixed bug in freeing memory	9/90
X.  popmenu(3) - KeyIC toggles between full and single char matching  sslok 9/90
X
XVVERSION 3.61
X.  GetInput() - popmenu tries to fit all options on the screen	9/90
X.  .POPMENU - fixed bug if # of items go off the screen	9/90
X.  do keypad (stdscr, TRUE) after each system() call	9/90
X.  GetInput() fixed REVERSE video on fields with no input	8/90
X.  popmenu() - added character matching		sslok 8/90
X	probably not downward compatible
X.  popmenu() - would core dump if only one item also increased max items
X	in a pop menu to 200	sslok	7/90
X.  GETINPUT added variable=value	8/90
X.  GETINPUT now adjusts (LFADJ_BFIL) the values set in popen calls	8/90
X.  popmenu() fixed bug where title would disappear when scrolling
X	off the last item	8/90
X.  popmenu() took off hi-lighted help on dimmed windows	8/90
X.  AFTER_MENU may now be used in a POPMENU	8/90
X.  after_field now get executed before a exit_last_field	8/90
X.  increased MAXFIELDS to 40	8/90
X
XVERSION 3.60
X.  added MenuMsg(1) utility	7/90
X.  added MenuPrompt(1) utility	7/90
X.  allow comment (#) on variable=value line	7/90
X.  popmenu(), drawbox() - added elevator	sslok 7/90
X.  ParAssign() - malloc assignment	7/90
X.  added exitoncancel in DEFINE_SCREEN	7/90
X.  field_range - added "`command`" 	7/90
X.  after_field/before_field - allow "$field_name=value ..."	7/90
X.  after_field - changed runscreen() to setenv after GetInput() instead of
X	after KEY_ACCEPT	7/90
X.  added -notrap to command line	7/90
X.  DEFINE_SCREEN title default is now the option description text	7/90
X.  DEFINE_SCREEN window_rows & window_cols may automatically be calculated 7/90
X.  GetInput() a MENU type field will now exit the field upon selecting a option
X	in the popmenu	6/90
X.  GetInput() now reads .menuinit file to set key values in InitGetI()	6/90
X.  GetInput() now does range checking on sun-sat,no_holidays,gt_today,
X	ge_today,lt_today,le_today for date fields	7/90
X.  GetInput() fixed bug where if value was entered then cleared the
X	function reported invalid range	7/90
X.  did away with the NULL on GETINPUT fields	7/90
X
XVERSION 3.50
X.  menu now ignores SIGINT, SIGQUIT	4/90
X.  added text option to DEFINE_SCREEN	4/90
X.  added field_before_input option to DEFINE_SCREEN	4/90
X.  added field_after_input option to DEFINE_SCREEN	4/90
X.  added .AFTER_MENU	4/90
X.  added after_menu to DEFINE_SCREEN	4/90
X.  added utility msgbox.1	rsprice 4/90
X
XVERSION 3.42
X.  .INCLUDE - the menufile argument can now be an environment variable or
X	absolute pathname	4/90
X.  fixed warning message in rundriver.c during compile	4/90
X
XVERSION 3.41 - released to alt.sources	4/90
X.  ParAssign.c - increased var=value to allow value to be BUFSIZE*2   sslok 4/90
X.  RunSystem.c - changed message "One moment loading program to say the
X		actual option you picked	sslok 4/90
X.  getval.c - fixed problem on 3b2/700 -- int/char casting	sslok 4/90
X.  popmenu.c - 3b2/700 -- int/char casting problem with toupper	sslok 4/90
X
XVERSION 3.40
X.  DEFINE_SCREEN - window_title, window_pos accepts a $var	2/90
X.  moved the GETINPUT screen on AUTO to end of description	2/90
X.  GETINPUT helpfile accepts double quotes and the fieldname becomes
X   the tagname in the helpfile	2/90
X.  ShowHelp - added table of contents	2/90
X.  fldadjust does not work in getinput screen	2/90
X.  help in getinput screen does not work if there is no toc	2/90
X
XVERSION 3.32 - released to comp.sources.unix and unix/c library
X.  changed (case ?) casting declarations for Xneix	11/89
X.  ssl added number matching on popmenu so "1.  xxx" may be placed in a
X   popmenu text
X.  .AUTHORIZE now checks the real uid instead of LOGNAME	11/89
X.  add character matching	11/89
X.  ssl added System() reset shell mode to the real uid	11/89
X.  combining attributes now work \R\D	11/89
X.  attributes work better on option description line	11/89
X.  increased field_range maximum to 1k	11/89
X
XVERSION 3.31
X.  added KEY_EXITMENU,KEY_MAINMENU,KEY_PREVMENU,KEY_POPGNAME, KEY_GNAME
X   to .menuinit	8/89
X.  fixed anymail() when set uid is set on menu	9/89
X.  fixed non numeric entry in selecting option	9/89
X
XVERSION 3.30 - Released to Unix/C library
X.  added field_protect	6/89
X.  added GETINPUT to .UNIX	6/89
X.  added GETINPUT to .MENU	6/89
X.  added REDRAW to .UNIX	6/89
X.  .UNIX command exit 4 = NOWAYJOSE, etc.	6/89
X.  added curses attributes to -keys	6/89
X
XVERSION 3.26
X.  mainly port to the sun
X.  GetInput allow for row and col for fldErrRow/fldMsgRow	6/89
X.  fixed ShowHelp to be more more like	6/89
X.  popmenu/GETINPUT automatically figure out where to put the window	6/89
X.  tilde expansion
X.  fixed clean_menu for RunPopMenu	6/89
X.  .TEXT a -0 should work	6/89
X.  changed selectable option to REVERSE as in popmenu	6/89
X.  put clearok in ParseUnix in case .UNIX messes up the screen	6/89
X
XVERSION 3.25 - pbcast
X.  install getval()  ${parameter}	5/89
X.  *=*  add PATH=$PATH:/usr/me
X
XVERSION 3.24
X.  added \ to .AUTHORIZE
X.  .INCLUDE - now menu will display the filename if it can't find it	4/89
X.  fixed .WINDOW bug	5/89
X.  refresh before a .EXIT
X.  added HOTKEYS to .menuinit
X.  fixed ShowHelp() bug when help file > 2 pages	5/89
X.  var=value can now be put in a .INCLUDE file	5/89
X.  findfile()  replaced access(3) with stat(3) for suid on menu	5/89
X.  for G and ! do away with the carraige after the G or !	4/89
X.  ability to turn off shell escape
X
XVERSION 3.23 - Released to Unix/C Library
X.  installed sam's new version on popmenu(3)	3/89
X
XVERSION 3.22
X.  GETINPUT error message did not clear err row.	1/89
X.  exit_last_field on last field in GETINPUT	1/89
X.  fixed SKIPJUNK	1/89
X.  POPMENU multiple popmenus in the same menu did not work	1/89
X.  ShowHelp - put More on bar line	1/89
X.  bumped YYLMAX to MAXLEN	2/89
X.  allowed _ in field_name	2/89
X
XVERSION 3.21 -  Released
X.  fixed popen for field_defaults	12/88
X.  added field_noinput	12/88
X.  a new ShowHelp(3)	12/88
X
XVERSION 3.20 - Released
X.  added continuation \ to .UNIX	12/88
X.  *=* keyword - variable=value	12/88
X.  increase length of command	12/88
X.  cleared prompt line when exiting GETINPUT	12/88
X.  add field_init to DEFINE_SCREEN	12/88
X.  fix getenv on returning NULL
X
XVERSION 3.10 - Released
X.  .DEFINE_SCREEN	11/88
X.  .GETINPUT - user input into fields/environment var	11/88
X.  menu -keys	11/88
X.  .INCLUDE	11/88
X.  renamed Menu.hlp to menu.hlp	11/88
X.  menufile nameing format = menufile.m	11/88
X.  GetInput()  added MENU	11/88
X.  GetInput()  clear field and home cursor	11/88
X.  GetInput()  delete a character	11/88
X.  GetInput()  type-over/insert	11/88
X.  GetInput()  KEY_BEG, KEY_END 11/88
X.  comments in a .DEFINE_SCREEN	11/88
X.  .GETINPUT  format the default value to the mask	11/88
X.  GetInput()  have down and up arrow accept field input
X
XVERSION 2.81 - Released
X.  check for mail being forwarded	10/88
X.  fixed .POPMENU with no var=value	10/88
X.  Dim does not work	10/88
X.  The space terminater for enviroment var should not be counted in text 10/88
X.  .menuinit - popup menu key GNAME	10/88
X.  take out LoadKeys in RunPopMenu	10/88
X.  reparsed menu on return from RunPopMenu & RunSetenv	10/88
X.  check if terminal has DrawLine capability	11/88
X.  popmenu - last item selected is displayed	11/88
X
XVERSION 2.8 - Released
X.  on goto popup menu put heading of GOTO MENU	10/88
X.  .POPMENU	10/88
X.  .menuinit with ^h etc. configurable	10/88
X.  .unix changed to .UNIX	10/88
X
XVERSION 2.72 - Released
X.  lock option so only one can run at a time - lock(1) utilities.d 10/88
X.  speeded up the box redraw - clrtobot(). 10/88
X.  added multiple variable setting on .SETENV 10/88
X.  fixed .MENU and .SETENV to allow quoted values for variables 10/88
X.  took out restriction of clear(1) - now tput clear 		10/88
X.  BELL on .SETENV ??	10/88
X
XVERSION 2.71 - Released
X.  fix mAiL display
X.  ^r redraw screen
X.  fixed the if [ $? -eq 0 ] \  etc... on the command line
X      be able to authorize down to the option level
X
XVERSION 2.7 - Released
X.  EXIT command
X.  ? for help
X
XVERSION 2.6 - Released  pbody pbhyf
X.  relative addresses for .TEXT .CURSOR - = calc from LINES,COLS	5/88
X.  got screen size from LINES,COLS
X
XVERSION 2.5 - Released  lacm pbuddy
X.  a debuging feature
X
XVERSION 2.4 - Released  3b2a
X.  modify rundriver that anytime a run function returns		5/88
X   SUBMENU	- display a new menu
X   MAINMENU	- goto main menu
X   PREVMENU	- previous menu
X		- goto a menu name
X   QUIT		- exit menu
X.  updated menu.1 for adding new keywords	5/88
X
XVERSION 2.3 - Released  pbody
X.  fixed ^g  5/88
X.  changed .SETENV var=value
X
XVERSION 2.2 - Released  pbody
X.  some way to pass data to another submenu 5/88
X.  reworked .MENU to RunMenu  5/88
X
XVERSION 2.1 - Released  pbody
X.  enviroment vars in .TEXT  5/88
X
XVERSION 2.0 - Released  pbody
X.  build mail notifier into menu	4/88
X.  increase length of command line	4/88
X.  .TEXT row col text  - display text at specified location	4/88
X.  .CURSOR row col  - allow user to specify where to put cursor	4/88
X.  display "enter h for help screen"	4/88  use .TEXT
X.  .SPACE keyword	4/88
X.  menu -v  print version 4/88
SHAR_EOF
chmod 0644 VERSIONHISTORY || echo "restore of VERSIONHISTORY fails"
echo "x - extracting SHAREWARE (Text)"
sed 's/^X//' << 'SHAR_EOF' > SHAREWARE &&
XMenu is released as ShareWare, which means it can be freely copied and
Xshared.  Due to the increased demand on my time, if you use menu(1) and
Xlike it, I'm asking for a voluntary contribution of $35 to help differ
Xthe costs of on-going support and future enhancements.
X
X	Paul J. Condie
X	2133 Fieldcrest Ave
X	Fairfield, Ca.  94546
X
X
SHAR_EOF
chmod 0644 SHAREWARE || echo "restore of SHAREWARE fails"
echo "x - extracting makefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > makefile &&
X# %W%   DeltaDate %G%   ExtrDate %H%
XTITLE = "MENU"
X
X# SYS5	- System V
X# BSD	- Berkely
XOSVER = SYS5
X
X# For the $MAIL (mail notification).
X# On some systems the alarm() does not come into effect while in the middle
X# of a getch().  The alarms get buffered up until the user hits a key and
X# then all the bells notifying of mail goes off.  You should take out the
X# -DALARM on the CFLAGS to get around this.
X# Works ok on:		-DALARM
X#	AT&T 3b1
X#	AT&T 3b2
X# Does not work on:
X#	SUN
X#	Arete
X#	AT&T 3b15
X#	AT&T 3b20
X#	CT megaframe
X#
X#  -DSINGLE
X#	Causes static references to terminal capabilities instead of dynamic 
X#	references.  This results in smaller code. See /usr/include/term.h
X#  -DLEXDEBUG
X#	Only if you need more debugging for .DEFINE_SCREEN
X#  -DYYDEBUG
X#	Only if you need more debugging for .DEFINE_SCREEN
X#  -DSUN
X#	Sun compilation with 5bin/cc (SYS5)
X
X
XINSTALLDIR = /usr/lbin
XHELPDIR = /usr/lbin
XMD = /usr/man/man1
XINCDIR = .
XLIBDIR =
X### Sun
X#CC	= /usr/5bin/cc
X### Sys V
XCC	= cc
X
X###  Various CFLAG settings
X
X###  Sys5
XCFLAGS = -I$(INCDIR) -O -D$(OSVER) -DSINGLE
X###  Xenix
X#CFLAGS = -I$(INCDIR) -O -D$(OSVER) -DSINGLE -DM_TERMINFO -LARGE -Ml -Mlt34 -F 10000 -SEG 500
X###  Sun (5bin)
X#CFLAGS = -I$(INCDIR) -O -D$(OSVER) -DSINGLE -DSUN
X
XYFLAGS = -d
X
X###  Libraries
X
X###  Sys5
XLIBS = libgeti.a -lcurses -ltermcap -lc -lm -ll -ly
X#LIBS = libgeti.a -lcurses -ll -ly
X###  Xenix
X#LIBS = libgeti.a -ltinfo -lx -ll -ly
X
XCFILES = Main.c LoadKeys.c parsedrive.c showdriver.c rundriver.c \
X	ParseOpton.c ParseBaner.c ParseTitle.c ParseBox.c ParseWindo.c \
X	ParseLine.c ParseComnt.c ParseUnix.c ParseGname.c ParseAuthr.c \
X	ParseText.c ParseCur.c ParseSpace.c ParInclude.c ParAssign.c \
X	ParAftMenu.c \
X	ShowOption.c \
X	RunSystem.c RunExit.c RunSetenv.c RunMenu.c RunPopMenu.c RunGetI.c \
X	RunAftMenu.c \
X	GetOption.c \
X	EndWindow.c displaytxt.c SetTerm.c \
X	systime.c sysdate.c checkmail.c anymail.c setenv.c \
X	strmatch.c setvar.c drawline.c initmenu.c keyboard.c \
X	runscreen.c getval.c clean_menu.c slength.c \
X	runpopen.c mygetch.c
X
XLFILES = LexDeSrn.l
XYFILES = ParseDeSrn.y
X
XHFILES = menu.h terminal.h
X
XMANPAGES = menu.1
X
XMENUFILES = utilities.d/m.d/*.m
XSHARFILES = README VERSIONHISTORY SHAREWARE makefile $(MANPAGES) $(CFILES) \
X	$(HFILES) $(LFILES) \
X	menu.hlp runrealid.c $(YFILES) \
X	utilities.d/libgeti.d/*.c utilities.d/libgeti.d/*.h \
X	utilities.d/libgeti.d/makefile utilities.d/libgeti.d/*.3* \
X	utilities.d/libgeti.d/*.hlp \
X	utilities.d/checkpass.d/* utilities.d/lock.d/* utilities.d/m.d/* \
X	utilities.d/msgbox.d/* utilities.d/MenuMsg.d/*
X
XOBJECTS = $(CFILES:.c=.o) $(YFILES:.y=.o) $(LFILES:.l=.o)
X
Xall:	menu runrealid checkpass lock msgbox MenuMsg MenuPrompt
X
Xmenu:	libgeti $(OBJECTS) 
X	$(CC) $(CFLAGS) $(OBJECTS) $(LIBDIR) $(LIBS) -o $@
X	size menu
X	@echo 
X
Xrunrealid: runrealid.c
X	$(CC) $(CFLAGS) runrealid.c -o $@
X
Xlibgeti:
X	cd utilities.d/libgeti.d; $(MAKE) CC=$(CC) install
X#	For SUN
X#	ranlib libgeti.a
X
Xcheckpass:
X	cd utilities.d/checkpass.d; $(MAKE) CC=$(CC) checkpass
X
Xlock:
X	cd utilities.d/lock.d; $(MAKE) CC=$(CC) lock
X	cd utilities.d/lock.d; $(MAKE) CC=$(CC) unlock
Xmsgbox:
X	cd utilities.d/msgbox.d; $(MAKE) CC=$(CC)
XMenuMsg:
X	cd utilities.d/MenuMsg.d; $(MAKE) CC=$(CC) MenuMsg
XMenuPrompt:
X	cd utilities.d/MenuMsg.d; $(MAKE) CC=$(CC) MenuPrompt
X
Xinstall:
X	strip menu
X	cp menu $(INSTALLDIR)
X	cp menu.hlp $(HELPDIR)
X#	cp sample.m $(INSTALLDIR)
X#	cp printers.m $(INSTALLDIR)
X#	cp reportsrn.m $(INSTALLDIR)
X	strip runrealid
X	cp runrealid $(INSTALLDIR)
X	cp utilities.d/checkpass.d/checkpass $(INSTALLDIR)
X	cp utilities.d/lock.d/lock $(INSTALLDIR)
X	cp utilities.d/lock.d/unlock $(INSTALLDIR)
X	cp utilities.d/msgbox.d/msgbox $(INSTALLDIR)
X	cp utilities.d/MenuMsg.d/MenuMsg $(INSTALLDIR)
X	cp utilities.d/MenuMsg.d/MenuPrompt $(INSTALLDIR)
X#	cp menu.1 $(MD)
X#	cp utilities.d/checkpass.d/checkpass.1 $(MD)
X#	cp utilities.d/lock.d/lock.1 $(MD)
X#	cp utilities.d/lock.d/unlock.1 $(MD)
X#	cp utilities.d/msgbox.d/msgbox.1 $(MD)
X#	cp utilities.d/MenuMsg.d/MenuMsg.1 $(MD)
X#	cp utilities.d/MenuMsg.d/MenuPrompt.1 $(MD)
X
Xlint:
X	lint -D LINT -I $(INCDIR) -I /usr/5include $(CFILES) -l curses -l c > menu.lint 
X
Xxref:
X	cxref -o menu.xref -c -t -I$(INCDIR) $(CFILES) > menu.xref
X
Xflow:
X	cflow -I$(INCDIR) $(CFILES) > menu.flow
X
Xprint:
X	ppgm -t$(TITLE) menu.1 makefile $(CFILES) $(HFILES) $(LFILES) $(YFILES)
X
Xshar:
X#	shar -b -c README makefile $(CFILES) $(HFILES) $(LFILES) $(YFILES) menu.hlp \
X#	$(MANPAGES) > menu.shar
X#	compress menu.shar
X#
X#	include HEADER file begining of file
X#	mkdir utilities.d directories
X	xshar -vcfx -l40 -omenu.shar. $(SHARFILES)
X
Xcpio:
X	cpio -oBcv > menu.cpio < Files
X	compress menu.cpio
X
Xclean:
X	rm -f *.o core menu menu.lint menu.shar* menu.xref menu.flow \
X	menu.shar.Z y.tab.h menu.cpio.Z runrealid
X	cd utilities.d/libgeti.d; $(MAKE) clean
X	rm -f utilities.d/lock.d/lock utilities.d/lock.d/unlock
X	rm -f utilities.d/lock.d/*.o
X	rm -f utilities.d/checkpass.d/checkpass utilities.d/checkpass.d/*.o
X	rm -f utilities.d/msgbox.d/msgbox utilities.d/msgbox.d/*.o
X	rm -f utilities.d/MenuMsg.d/MenuMsg utilities.d/MenuMsg.d/*.o
X	rm -f utilities.d/MenuMsg.d/MenuPrompt
X
Xlinks:
X	ln /usr/src/libgeti.d/findfile.c utilities.d/MenuAccess.d/findfile.c
X	ln /usr/src/libgeti.d/GetInput.c utilities.d/libgeti.d/GetInput.c
X
X#####
X#####
X
XMain.o:		Main.c menu.h
XParseOpton.o:	ParseOpton.c menu.h
XParseBaner.o:	ParseBaner.c menu.h
XParseBox.o:	ParseBox.c menu.h
XParseTitle.o:	ParseTitle.c menu.h
XParseLine.o:	ParseLine.c menu.h
XParseWindo.o:	ParseWindo.c menu.h
XParseComnt.o:	ParseComnt.c menu.h
XParseUnix.o:	ParseUnix.c menu.h
XParseGname.o:	ParseGname.c menu.h
XParseAuthr.o:	ParseAuthr.c menu.h
XParseText.o:	ParseText.c menu.h
XParseCur.o:	ParseCur.c menu.h
XParseSpace.o:	menu.h
XParInclude.o:	menu.h
XParAssign.o:	menu.h
XParAftMenu.o:	menu.h
XParseDeSrn.o: 	ParseDeSrn.y LexDeSrn.l menu.h
X		yacc $(YFLAGS) ParseDeSrn.y
X		$(CC) $(CFLAGS) -c y.tab.c
X		mv y.tab.o ParseDeSrn.o
X		rm -f y.tab.c
X
XShowOption.o:	ShowOption.c menu.h
X
XRunSystem.o:	RunSystem.c menu.h
XRunMenu.o:	RunMenu.c menu.h
XRunPopMenu.o:	RunPopMenu.c menu.h
XRunExit.o:	menu.h
XRunSetenv.o:	menu.h
XRunPopMenu.o:	menu.h
XRunGetI.o:	menu.h
X
Xparsedrive.o:	parsedrive.c menu.h
Xshowdriver.o:	showdriver.c menu.h 
Xrundriver.o:	rundriver.c menu.h terminal.h
XLoadKeys.o:	LoadKeys.c menu.h
XEndWindow.o:	EndWindow.c menu.h
XGetOption.o:	menu.h terminal.h
XSetTerm.o:	menu.h
Xsetvar.o:	menu.h
Xinitmenu.o:	menu.h
Xrunscreen.o:	menu.h terminal.h
XLexDeSrn.o: 	LexDeSrn.l ParseDeSrn.y menu.h
X		lex LexDeSrn.l
X		$(CC) -c $(CFLAGS) lex.yy.c
X		mv lex.yy.o LexDeSrn.o
X		rm -f lex.yy.c
X		rm -f y.tab.h
X
X#tokens.h: 	y.tab.h
X#		@if /bin/diff tokens.h y.tab.h > /dev/null 2> /dev/null;\
X#         	   then :; \
X#		   else cp y.tab.h tokens.h; \
X#		fi
X#calc.o: 	calc.y calc.l
X#		yacc $(YFLAGS) calc.y
X#		lex calc.l
X#		sed "s/#define YYABORT		return(1)/#define YYABORT return(-999)/" y.tab.c > junkme
X#		mv junkme y.tab.c
X#		rm -f junkme
X#		$(CC) $(CFLAGS) -c y.tab.c
X#		mv y.tab.o calc.o
X#		rm -f y.tab.c
X#		rm -f lex.yy.c
X#		rm -f y.tab.h
X
Xclean_menu.o:	menu.h
X
X
X#####
X#####	Inference Rules
X#####
X
X.SUFFIXES:
X.SUFFIXES: .o .ec .ec~ .c .c~ .h .h~
X
X.c~.c:
X	$(GET) $<
X.h~.h:
X	$(GET) $<
X.c.o:
X	$(CC) -c $(CFLAGS) $*.c
X.c~.o:
X	$(GET) -p $<> $*.c
X	$(CC) -c $(CFLAGS) $*.c
X	rm $*.c
X.ec.o:
X	esql $(CFLAGS) -c $<
X	rm -f $*.c
X.ec~.o:
X	$(GET) -p $<> $*.ec
X	esql $(CFLAGS) -c $<
X	rm $*.ec
X	rm $*.c
SHAR_EOF
chmod 0644 makefile || echo "restore of makefile fails"
echo "x - extracting menu.1 (Text)"
sed 's/^X//' << 'SHAR_EOF' > menu.1 &&
X. \ %W% DeltaDate %G% ExtrDate %H% 
X.po 6
X.TH MENU 1 "Version 3.63"
X.SH NAME
X.TP 12
Xmenu 
X\- a menu program
X.SH SYNOPSIS
X.B "menu  [ -v ] [ -p row,col ] [ -d ] [ -keys ] [ -notrap ]  menufile"
X
X.SH DESCRIPTION 
X\fBMenu(1)\fP is an easy-to-use menu utility that allows
Xusers to operate an application system in a user-friendly, menu-driven
Xenvironment.  Any application software, regardless of source language or
Xoperating system process can be executed from menus designed with
X\fIMenu(1)\fP.
X
XFor systems requiring multi-level menus for a diverse number of users,
X\fIMenu(1)\fP allows a single menu to call any number of submenus, which
Xmay in turn call more menus or execute any number of processes.
XMenus can be nested to any level without increasing
Xstartup time or memory requirements.
X
XMenus can also be designed to function as user-friendly data entry 
Xscreens for capturing data, which can then be used as input for a process.
XText items such as "displays", "choices" and "responses" can be added within 
Xany of these defined boundaries, and will automatically adjust if any 
Xboundaries are changed.  Special screen attributes, such as highlighting and
Xreverse video, can be defined to add special emphasis.
X
XThe menu script file contains all of the menu instructions, and can
Xbe edited using a standard system editor, such as vi.  Menus and utilities
Xcan be added or deleted by editing the appropriate script file, even while
Xthe menu is in use.  
X
XMenu provides flexibility in designing how you want your
Xmenus to look, yet, strives to maintain some consistency and functionality from
Xone menu to another.  Menu was designed with "hooks" built in, so that, if 
Xadditional features/functionality for an application is required 
Xthe programmers
Xnew "keyword" modules could be linked in to the driver routines in menu(1)
X(see Programming Notes).  Menu(1) could be used as a prototyping tool.
X.PP
XMenu is keyword driven.  
XThe menufile (script file) is parsed and when a defined keyword is found the
Xassociated function for that keyword is called.
XThe menufile is first searched for in your current directory and
Xthen in getenv("MENUDIR").  Menufile should be in basename format, use
XMENUDIR to get the full path name.  To be consistent with other file naming
Xconventions, I recommend that all menu script files be suffixed with a ".m"
Xfor menu.
XThe "menu.hlp" file contains the on-line help screen.
XThe help file is
Xfirst searched for in the current directory, then in getenv("HELPDIR"),
Xthen in getenv("MENUDIR").  Look in the directory where menu is installed
Xfor the help file (menu.hlp).  If you want to customize the help file, copy it
Xto another directory and set HELPDIR.
XMenu uses curses(3X) so you need to have your TERM variable set.
X.PP
XMenu provides a shell escape (!) depending upon whether the SHELL environment
Xvariable is set.  You should \fIunset SHELL\fP if you want to restrict the user
Xfrom the shell.  If the set uid bit is set on menu and a shell escape command
Xis selected by the user.  The uid and gid is set back to the real uid/gid
Xbefore executing the shell command.
X
X.SS Command Line Options
X.TP 6
X-v
XThe [-v] command line option will print the version of the menu program
Xyou are running.  The version number increasing by tenths usually indicate
Xnew capabilities/keywords, 
Xhundredths indicate bug fixes/enchancements to existing keywords/capabilities.
X.TP 6
X-p row,col
XTells menu what row and column (upper left corner) you
Xwant the pop-up menu, for goto menu names, to appear.
XSee .GNAME below.  Default is [6,8].  I would try to keep the pop-up 
Xmenu high and to the left, 
Xthere is no real intelligence built in if the number or length of GNAMES puts
Xit off the screen.
X.TP 6
X-d
XPrints debugging information to stderr.
X.TP 6
X-keys
XDetermine the various key values on your keyboard.  This displays what is
Xreturned from a curses getch() call with the keypad turned on.
XThis information can be used to custom tailor your .menuinit file.
X.TP 6
X-notrap
XDon't trap and ignore SIGINT,SIGQUIT signals.  This is good for testing so you
Xdon't lock up your terminal.  The default is to ignore those signals.
X
X.SS Syntax Used In This Man Page
XThe position of the arguments for the various keywords is important.  All
Xarguments including any
Xoptional arguments that are used must appear in the position shown in
Xthe synopsis for that keyword, unless stated otherwise.
X
X.TP 6
X[ ]
XThroughout this man page the "\fB[ ]\fP" indicate that what is enclosed is 
Xoptional.
X.TP 6
X[ \\\\\\ ]
XA keyword synopsis that has "\fB[ \\ ]\fP" as the last argument 
Xindicates that the continuation 
Xcharacter (\\) may be placed as the last character on the line to continue 
Xto the next line.
X.TP 6
X[!]
XIndicates a conditional environment variable setting.  If the variable is not
Xalready set (getenv(variable) == NULL) then the variable is set to the specified
Xvalue, otherwise it is not changed.  Same operation as doing a 
Xshell ${parameter:-word}.
X
X.SH KEYWORD SYNOPSIS
XThe following keywords are placed in a menu script file to tell \fImenu(1)\fP
Xwhat to do.  They are listed in alphabetical order, with special character
Xkeywords listed first.
X
X
X\fB[!]variable=value\fP
X.IP "" 6
XA environment variable assignment statement.  The environment variable defined
Xby \fIvariable\fP is set equal to the \fIvalue\fP specified.  The variable is 
Xset as soon as it is found while parsing the menufile, it becomes
Xpart of the menu environment so that all subsequent programs that are spawned
Xwill inherit these variables.
X
XThe character "$" in \fIvalue\fP is used to introduce substitutable 
Xparameters, in the form of ${\fIparameter\fP}.
XThe value, if any, of the \fIparameter\fP is substituted.  The braces are 
Xrequired only when \fIvalue\fP is followed by a letter, digit, or 
Xunderscore that is not to be interpreted as part of its name.
X
XThe character "~" in \fIvalue\fP is used to introduce tilde expansion.  
XMenu checks the value
Xto see if a "~" appears after the "=".  If it does menu checks the word that
Xfollows up to a "/".  A "~" by itself equals $HOME. A "~user" equals home(user).
X
XA pair of grave accents (`command`) introduce command substitution.  The
Xstandard output from the \fIcommand\fP is assigned to the variable.
X
XWarning: If you reset a environment variable in a GETINPUT that you have
Xdefined here.  The variable will get reset back to this value when the menufile
Xis re-parsed, unless you use the "!".
X. \ --------------------------------------------------------------------------
X.PP
X\fB###\fP  Comment text.
X.IP "" 6
XA comment line.  The entire line is ignored.  May be placed anywhere in
Xthe menufile.
X. \ --------------------------------------------------------------------------
X
X.PP
X\fB###NAME\fP  Alias menu name.
X.IP "" 6
XThis optional comment line is used by the MenuAccess(1) program to display
Xa different name on the screen for the menu instead of the unix file name,
Xmore user friendly.  This is recommended if you plan to use MenuAccess.
X. \ --------------------------------------------------------------------------
X
X.PP
X \fB.AFTER_MENU\fP  [ REDRAW ]  [ GETINPUT screen_name ]  command  [ \\ ]
X.IP "" 6
XA command that is run after the user exits/gets out of/returns from a menu
XSee \fI.UNIX\fP for more info.
X. \ --------------------------------------------------------------------------
X
X.PP
X \fB.AUTHORIZE\fP  logname  [ logname ... ]  [ \\ ]
X.IP "" 6
XAuthorize only certain login's to be able to access a menu.  For example
Xapplication administration functions to be done by application administrators
Xonly.  This can be done by putting those functions in one menu and
Xusing the .AUTHORIZE keyword.  \fILogname\fP is the login name of a user you
Xwant to allow to see this menu.  Only the
Xfirst .AUTHORIZE keyword will be used, so all lognames must be listed on 
Xthat line.
XIf no .AUTHORIZE is given in menufile then that menu is open to every one.
XIf a .AUTHORIZE is given in the main menu (first) then restriction would apply
Xto someone trying to get into the application.
X.br
XThis keyword is used by the \fIMenuAccess(1)\fP program.
X.br
X
X.br
XThis keyword authorizes a login at the menu level.  If you need to authorize
Xat the option level you could try something like this. (see .SYSTEM)
X.nf
X	.SYSTEM  if [ $LOGNAME = "stella" ] \\
X                   	        then  run_program \\
X                   	        else  echo "Sorry honey, Not Authorized." \\
X                	   fi
X	Option Description Text.
X.fi
X. \ --------------------------------------------------------------------------
X
X.PP
X.nf
X \fB.BANNER\fP [ linecount ]
X .section  text
X.fi
X.IP "" 6
XDraws a banner page.  Linecount should be the number of lines
Xfollowing .BANNER, each consisting of ".section text".  Section
Xmay be either .U to display text in upper section or .L to
Xdisplay text in lower section.  Only four lines in each section
Xallowed.
XThe idea behind this was to provide some kind of welcome (to your
Xapplication) screen.
XIf .BANNER is used it should be the first keyword in menufile.
XThis one is really worthless!  It's too slooooow.
X
XNot supported in a \fI.POPMENU\fP menu.
X. \ --------------------------------------------------------------------------
X
X.PP
X \fB.BOX\fP [ StandoutLine ] [ DumbLine ]
X.IP "" 6
XDraws a box around the menu window.
XThe \fIBOX\fP will use the top line of the screen so the first \fI.TITLE\fP
Xline should be null.  The box will also use the first and last column,
Xyour title lines should take that into account.  You get a different effect
Xdepending on whether you place the .BOX before (with a .LINE) or after 
Xthe .TITLE lines.
X
XThe arguments specify what type of line you want to use to draw the box with.
XThe second argument specifies the type of line to use to dim the menu.
X.br
XAny one of the following may be used:
X.nf
X	DumbLine	\fIDefault line used in dimming.\fP
X	StandoutLine	\fIDefault line.\fP
X	SingleLine	\fIAlternate character line.\fP
X	MosaicLine	\fIAlternate character line.\fP
X	DiamondLine	\fIAlternate character line.\fP
X	DotLine		\fIAlternate character line.\fP
X	PlusLine		\fIAlternate character line.\fP
X.fi
XThe alternate character lines are dependent on your terminal (try "menu -key").
XNot all terminals have the capability to draw these lines.
XIf one of the alternate character lines is specified
Xand it is found that the terminal does not support it, the line will be
Xdrawn in StandoutLine.  Check your terminal manual and the terminfo definition
Xfor alternate character set.
X
XNot supported in a \fI.POPMENU\fP menu.  
XAll pop-up menus automatically get boxed.
X. \ --------------------------------------------------------------------------
X
X.PP
X.nf
X \fB.CURSOR\fP [-]row [-]column
X.fi
X.IP "" 6
XWhere do you want the cursor to appear on the screen?  If no \fI.CURSOR\fP
Xis specified it defaults to row=lastrow-2, column=lastcol-4.  
XSee explanation under .TEXT for negative row/column.
XThe \fI.CURSOR\fP
Xis only active for the current menu.  If you want the same cursor location
Xin every menu you will need to put a \fI.CURSOR\fP in every menu.
X
XNot supported in a \fI.POPMENU\fP menu.
X. \ --------------------------------------------------------------------------
X
X.PP
X.nf
X \fB.DEFINE_SCREEN\fP  screen_name
X                    [ window_rows = number ]
X                    [ window_cols = number ]
X                    [ window_pos = number  number ]
X                    [ window_title = string ]
X                    [ window_border = string [ string ] ]
X                    [ helpfile = string ]
X                    [ field_defaults = "string" ]
X                    [ after_screen = "string" ]
X                    [ exit_last_field ]
X                    [ exit_on_cancel ]
X                    [ text = number number string ]
X
X                      ###  The following repeat for each field.
X
X                      field_name = $string
X                      field_row = number
X                      field_col = number
X                      field_length = number
X                    [ field_label = string ]
X                    [ field_mask = string ]
X                    [ field_edits = string ]
X                    [ field_range = string ]
X                    [ field_min = number ]
X                    [ field_adjust = string ]
X                    [ field_mustenter ]
X                    [ field_prompt = string ]
X                    [ field_terminator = string ]
X                    [ field_noinput ]
X                    [ before_field = "string" ]
X                    [ after_field = "string" ]
X ENDSCREEN
X.fi
X
X.RS 6
XThis keyword defines a input screen that can be used with the .GETINPUT keyword.
XIf you want the same screen definition in all menus you have
Xto place it in all menus (see .INCLUDE).
XThe ordering of the arguments is unimportant except for field_name, see below.
XThe screen arguments may be placed on the same line if separated by a comma.
XThe screen arguments are listed below with the default value
Xspecified for those arguments that are optional.
XSee GetInput(3X) man page for more information.
X
XYou may have a maximum of ten screens (MAXSCREENS) defined in any one menu and
Xa maximum of forty fields (MAXFIELDS) for any one screen.  This may be
Xincreased via the menu.h file.
X
XThe following arguments are listed in the order they are shown above.
X
XScreen Arguments:
X.RS 4
X.TP 15
Xscreen_name
XScreen Name.  Used with .GETINPUT to find screen definition.
XMaximum length of name is 30 characters.
X.TP 15
X[ window_rows ]
XNumber of rows in window.
X.br
XIf either window_rows or window_cols is zero, they will be set to the value 
Xof (screen_lines-window_pos(row)) and (screen_cols-window_pos(col)).
XIf the window_rows, window_cols and window_pos fields are all set to zero
Xa full-screen will be used.  See newwin(curses 3X) for more info.
XIf this argument is omitted then it will be automatically calculated.
X.TP 15
X[ window_cols ]
XNumber of columns in window.  See window_rows.
XIf this argument is omitted then it will be automatically calculated.
X.TP 15
X[ window_pos ]
XTop left corner to place the window at,  where the first number indicates the
Xrow and the second number indicates the column.  See window_rows.
XIf this argument is omitted then the window will be placed as close to, and to
Xthe right of, the option that selected it.  This argument is not optional if
Xthe screen is to be used with a .UNIX keyword.
XThere is no intelligence built in to check if you put the window outside 
Xthe screen dimensions.
X.br
XA environment variable may be specified for the arguments to window_pos.
X.TP 15
X[ window_title ]
XA title to be centered on line zero of the window.  A environment variable may 
Xbe specified in the title.  The title may not exceed 100 bytes.
XIf no window_title is specified a default of the option description text 
Xthat selected the \fIGETINPUT\fP screen is used.
X.TP 15
X[ window_border = Standout ]
XThe type of box you want around the window.  A standout box is the default.
XSee \fI.BOX\fP for description of line types.
X.TP 15
X[ helpfile = "menu.hlp" ]
XA help file associated with this window.  The helpfile should be in
Xdouble quotes if it has a "." in the name, and should be in basename format.
XThe helpfile is first looked for
Xin the current directory and then in \fI$HELPDIR\fP.  The fieldname (excluding
Xthe "$") becomes the tagname in the help file.  See \fIHELP SCREENS\fP in this 
Xdocument for more information.
XSet helpfile = "" if you don't want the Help message to appear in lower
Xright corner of window.
X.TP 15
X[ field_defaults = "" ]
XThis is used to initialize your fields to a default value at runtime.  
XWhat goes into the quoted
Xstring is a shell command that is passed into a popen(3) call.  What the shell
Xcommand should echo to stdout is the values you want to set your fields to.
XNo edit checks against the range values, if any, are performed on the default 
Xvalues.
XMaximum length of the shell command is 1k.
XField values composed of multiple strings should be quoted.  The quote should
Xalso be double escaped (\\\\"). If the number of
Xvalues echoed to stdout is less than the number of screen fields the remainder
Xof the screen fields are set to "".  To force a field value to "" echo \\"\\" to
Xstdout.
X.nf
SHAR_EOF
echo "End of part 1"
echo "File menu.1 is continued in part 2"
echo "2" > s2_seq_.tmp
exit 0



More information about the Alt.sources mailing list