home *** CD-ROM | disk | FTP | other *** search
- From: pjc@pcbox.UUCP (Paul J. Condie)
- Newsgroups: alt.sources
- Subject: menu(1) part 1 of 11
- Message-ID: <423@pcbox.UUCP>
- Date: 6 Apr 90 17:29:28 GMT
-
-
- #!/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
- #
- # In appreciation of the many things I've pulled off the net,
- # I give you this.
- #
- # 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
- # 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
- # ShowOption.c
- # RunSystem.c
- # RunExit.c
- # RunSetenv.c
- # RunMenu.c
- # RunPopMenu.c
- # RunGetI.c
- # GetOption.c
- # EndWindow.c
- # displaytxt.c
- # SetTerm.c
- # systime.c
- # sysdate.c
- # TrapSignal.c
- # checkmail.c
- # anymail.c
- # setenv.c
- # strmatch.c
- # setvar.c
- # findfile.c
- # drawline.c
- # initmenu.c
- # keyboard.c
- # runscreen.c
- # getval.c
- # clean_menu.c
- # System.c
- # slength.c
- # upper.c
- # substr.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/popmenu.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/m.d/adduser
- # utilities.d/m.d/deluser
- # 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/suid_exec.c
- #
- 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
- mkdir utilities.d
- mkdir utilities.d/libgeti.d
- mkdir utilities.d/m.d
- mkdir utilities.d/lock.d
- mkdir utilities.d/checkpass.d
- echo "x - extracting README (Text)"
- sed 's/^X//' << 'SHAR_EOF' > README &&
- XThis menu program is being released as public domain software, and as
- Xsuch, you have the right to use/abuse it as you see fit so long as no
- Xprofit is made from it.
- X Paul J. Condie
- X (Author)
- X
- 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
- 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
- X - tell menu where you installed the help file
- X HELPDIR=/usr/local/bin
- X - run a sample menu
- X menu sample.m
- X
- XNotes:
- X - The MenuAccess(1) program is not implemented yet.
- SHAR_EOF
- chmod 0644 README || echo "restore of README 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
- 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
- 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 ShowOption.c \
- X RunSystem.c RunExit.c RunSetenv.c RunMenu.c RunPopMenu.c RunGetI.c \
- X GetOption.c \
- X EndWindow.c displaytxt.c SetTerm.c \
- X systime.c sysdate.c TrapSignal.c checkmail.c anymail.c setenv.c \
- X strmatch.c setvar.c findfile.c drawline.c initmenu.c keyboard.c \
- X runscreen.c getval.c clean_menu.c System.c slength.c upper.c substr.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 makefile $(MANPAGES) $(CFILES) $(HFILES) $(LFILES) \
- X menu.hlp runrealid.c $(YFILES) utilities.d/libgeti.d/*.c \
- X utilities.d/libgeti.d/*.h utilities.d/libgeti.d/makefile \
- X utilities.d/libgeti.d/*.3* utilities.d/libgeti.d/*.hlp \
- X utilities.d/checkpass.d/* utilities.d/lock.d/* utilities.d/m.d/*
- X
- XOBJECTS = $(CFILES:.c=.o) $(YFILES:.y=.o) $(LFILES:.l=.o)
- X
- Xall: menu runrealid checkpass lock
- 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) install
- X
- Xcheckpass:
- X cd utilities.d/checkpass.d; $(MAKE) checkpass
- X
- Xlock:
- X cd utilities.d/lock.d; $(MAKE) lock
- X cd utilities.d/lock.d; $(MAKE) unlock
- 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# cp menu.1 $(MD)
- X strip runrealid
- X cp runrealid $(INSTALLDIR)
- X cp utilities.d/checkpass.d/checkpass $(INSTALLDIR)
- X# cp utilities.d/checkpass.d/checkpass.1 $(MD)
- X cp utilities.d/lock.d/lock $(INSTALLDIR)
- X cp utilities.d/lock.d/unlock $(INSTALLDIR)
- X# cp utilities.d/lock.d/lock.1 $(MD)
- X# cp utilities.d/lock.d/unlock.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 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
- Xlinks:
- X ln 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
- 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.41"
- X.SH NAME
- X.TP 12
- Xmenu
- X\- a menu program
- X.SH SYNOPSIS
- X.B "menu [ -v ] [ -p row,col ] [ -d ] [ -keys ] 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).
- X.br
- XThis 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. There should be a sample menufile
- X(\fIsample.m\fP) in the same directory where menu is installed
- Xtry "\fImenu sample.m\fP".
- 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
- 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 enviroment 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.
- 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.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 dependant 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 [ exit_last_field ]
- 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 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 twenty fields (MAXFIELDS) for any one screen. This may be
- Xincreased via the menu.h file.
- X
- XScreen Arguments:
- X.RS 4
- X.TP 15
- Xscreen_name
- XScreen Name. Used in .GETINPUT to find screen definition.
- X.TP 15
- Xwindow_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.
- X.TP 15
- Xwindow_cols
- XNumber of columns in window. See window_rows.
- 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 intellegence 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.
- 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 assiciated with this window. The helpfile should be in
- Xdouble quotes if it has a "." in the name, and shoud 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.
- 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.
- XMaximum length of the shell command is 1k.
- XField values composed of multiple strings should be quoted. The quote should
- Xalso be 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 NULL to
- Xstdout.
- X.nf
- XFor example:
- XAssuming $SNAME is a multiple worded value to be assigned to a field.
- X
- X field_defaults = "cat \fIfilename\fP |
- X while [ $? -eq 0 ]
- X do
- X read LINE
- X [ $? -ne 0 ] && break
- X set $LINE
- X SCODE=$1
- X shift
- X SNAME=$*
- X echo $SCODE \\\\"$SNAME\\\\"
- X done"
- X.fi
- X.TP 15
- X[ exit_last_field ]
- XIf exit_last_field is specified, after the user presses return on the last field
- Xthe input will be accepted and the user will exit the screen (this is as if the
- Xuser had pressed the KEY_ACCEPT). Don't ask me Lee wanted it.
- X.TP 15
- Xfield_name
- XThe environment variable name that the data will be assigned to. The field_name
- Xmust begin with a "$", just to remind you that it is a environment variable
- Xthat I
- Xam using. Although, the "$" is not actually used in the environment variable
- Xname. This screen argument (field_name) tells menu that you are starting
- Xa new field
- Xdefinition. ..soooo... It has to be the first argument for a field.
- XAll other field
- Xarguments for that field_name follows after, but before the next field_name.
- X.TP 15
- Xfield_row
- XThe row this field will appear on (base zero).
- XThe window is drawn with a box on the outer edge, row zero and the last
- Xrow (window_rows) is used for the box.
- X.TP 15
- Xfield_col
- XThe starting column for this field (base zero).
- XIf you have a field_label you need to allow enough room to place the label
- Xto the left of the field, also, the field terminators.
- XThe window is drawn with
- Xa box on the outer edge, so, column zero and the last column (window_cols)
- Xis used for the box.
- X.TP 15
- Xfield_length
- XMaximum length of this field. For field types SET and MENU this argument
- Xbecomes optional, the field length is automatically set to the longest set value
- Xin the field_range.
- X.TP 15
- X[ field_label = "" ]
- XA Label to be placed to the left of the field.
- X. \ **********************************
- X.TP 15
- X[ field_mask = "" ]
- XValid masks for a field depend upon the type of field
- Xyou specified, see (field_edits). Basically the mask says what character
- Xpositions in the field you allow input, what type of character allowed at that
- Xposition, and what kind of a format do you want for the field.
- X
- XThe \fIfield_length\fP should not include character positions where no input
- Xis allowed in the mask (format characters), because format characters
- Xare not returned into \fIfield_name\fP. For example, \fIfield_edits = DATE,
- Xfield_mask = "MM/DD/YY"\fP. The "/" is a format character. The cursor
- Xwill skip over those positions in the field. Only the characters typed in
- Xthe MM DD YY positions will be in the environment variable \fIfield_name\fP.
- XThe field_length would be six.
- X
- XBecause the mask is so closely tied to the \fIfield_edits\fP, a complete
- Xdescription of what mask characters are valid with what field types is
- Xdescribed under
- X\fIfield_edits\fP. Any character in the mask that is not listed as a valid
- Xmask character for that field type becomes a format character.
- X. \ ---------------------------------
- X.TP 15
- X[ field_edits = UPPER_AN ]
- XThis argument defines edit checks to be performed on the
- Xinput characters as they are being typed in. If no mask is provided then
- Xthe field type itself determines the edit checks to be performed on all
- Xcharacters in the field.
- X.RS 15
- X.TP 11
- XALPHANUM
- XAny alpha/numeric character is allowed.
- X.br
- XValid mask characters:
- X.nf
- X space alpha/numeric
- X A alpha
- X 9 numeric
- X U alpha only - convert to upper case
- X V alpha/numeric - convert alpha to upper case
- X H ???
- X.fi
- X.TP
- XALPHA
- XAlpha only.
- X.br
- XValid mask characters:
- X.nf
- X A alpha
- X.fi
- X.TP
- XNUMERIC
- XNumeric only.
- X.br
- XValid mask characters:
- X.nf
- X 9 numeric
- X.fi
- X.TP
- XUPPER
- XConvert to upper case. Only alpha permitted.
- X.br
- XValid mask characters:
- X.nf
- X U upper alpha
- X.fi
- X.TP
- XUPPER_AN
- XAlpha and numeric permitted. Convert alpha characters to upper-case.
- X.br
- XValid mask characters:
- X.nf
- X V upper alpha/numeric
- X.fi
- X.TP
- XHEX
- XOnly hex characters permitted.
- X.br
- XValid mask characters:
- X.nf
- X H ???
- X space ???
- X.fi
- X.TP
- XSTATE
- XValid two character Post Office abbreviations for the fifty states.
- XA edit check is done for a valid state.
- X.br
- XValid mask characters:
- X.nf
- X SS two character state
- X S ???
- X space ???
- X.fi
- X.TP
- XZIP
- XPost Office zip code.
- X.br
- XValid mask characters:
- X.nf
- X 99999-9999 ???
- X.fi
- X.TP
- XDATE
- XA valid date.
- X.br
- XValid mask characters:
- X.nf
- X MM month (01-12)
- X DD day (01-31)
- X YY year (00-99)
- X YYYY full year with century
- X.fi
- XThe mask must contain at least MM and DD. If no mask is specified for the
- Xfield a default mask of "MMDDYY" is used.
- X.br
- XSome examples:
- X.nf
- X MMDDYY
- X MM/DD/YY
- X YY-MM-DD
- X MM DD YYYY
- X.fi
- X.TP
- XTIME
- XA time field.
- X.br
- XValid mask characters:
- X.nf
- X HH hours (01-12)
- X MM minutes (00-59)
- X SS seconds (00-59)
- X TT tenths (00-99)
- X II military hours (00-24)
- X.fi
- XSome examples:
- X.nf
- X HH:MM
- X HH:MM:SS
- X HH:MM:SS:TT
- X II:MM
- X II:MM:SS
- X II:MM:SS:TT
- X.fi
- X.TP
- XSET
- XThis field type specifies a set of values that are acceptable in the input
- Xfield.
- XThe acceptable values within the set are specified in the \fIfield_range\fP
- Xargument.
- XThe user selects one of the set values specified in the field range by
- Xpressing the space bar, which will toggle through the set values,
- Xor by pressing the first character in the desired value.
- X
- XThe format of the field_range can only be comma separated values
- X(ex. "CA,ID,TX").
- XRange values, such as "1-5", don't work. You would have to say "1,2,3,4,5".
- X.br
- XThe field length is automatically set to the longest set value in the
- Xfield_range.
- X.TP
- XMENU
- XThis field type is similar to the SET type. The difference is when the user
- Xattempts to type something in the field a pop-up menu of available choices
- Xare displayed, as specified in field_range.
- XThe user makes a selection by hi-lighting the choice and pressing return.
- X.br
- XSee SET type for specifying the field range.
- XThe limit is ten items in the field range.
- X.TP
- XPROTECT
- XThis X's out the field so that what is entered on the keyboard can not be seen
- Xon the screen. Useful for password entry.
- X.RE
- X. \ ---------------------------------
- X.TP 15
- X[ field_range = "" ]
- XA set of valid ranges permitted for this field.
- XRanges may be specified as comma separated values ("ONE,TWO,THREE")
- Xor as a range ("1-5"), or a combination of both ("1-5,M,E").
- XRange values must be compatible with the field_edits that you have selected.
- XMaximum length of this field is 1k.
- X.br
- XSome examples:
- X.nf
- X "1-10"
- X "5,10,15,16"
- X "1-10,20,M,E,32-40"
- X "CA,TX,ID"
- X.fi
- X. \ ---------------------------------
- X.TP 15
- X[ field_min = 0 ]
- XIf field_mustenter is selected then this is the minimum
- Xrequired input. Otherwise, it is the minimum required input only if they try
- Xto input something.
- X.TP 15
- X[ field_adjust = NOFILL ]
- XIndicates whether to adjust the text right or left within the field
- Xand whether or not to zero or blank fill the field.
- X.RS 15
- X.TP 15
- XNOFILL
- Xno action.
- X.TP
- XRTADJ_ZFILL
- Xright adjust, zero fill
- X.TP
- XRTADJ_BFILL
- Xright adjust, blank fill
- X.TP
- XLFADJ_ZFILL
- Xleft adjust, zero fill
- X.TP
- XLFADJ_BFILL
- Xleft adjust, blank fill
- X.RE
- X. \ ---------------------------------
- X.TP 15
- X[ field_mustenter ]
- XMarks this as a must enter field. Default is that the field is not
- Xa must enter field.
- X. \ ---------------------------------
- X.TP 15
- X[ field_prompt = "" ]
- XPrompt message to be displayed.
- X. \ ---------------------------------
- X.TP 15
- X[ field_terminator = "[]" ]
- XCharacters to terminate the field with. The left one goes on the left,
- Xthe right one goes on the right. Funny how that works.
- X. \ ---------------------------------
- X.TP 15
- X[ field_noinput ]
- XIf field_noinput is selected then the cursor will skip over this field. A
- Xdisplay only field.
- X.RE
- X.RE
- X. \ --------------------------------------------------------------------------
- X
- X.PP
- X.nf
- X \fB.EXIT\fP [ command ] [ \\ ]
- XExit description text.
- X.fi
- X.IP "" 6
- XExit menu program. This can be used if you want to exit as a user
- Xselectable option. There should be only one .EXIT per menu.
- X.br
- XIf command is present a system(3S) will be called, with command as the
- Xargument, before exiting. The command will be executed even if the user uses
- Xthe "E" command (see help) to exit, as long as there is a .EXIT
- Xin current menu. If you
- Xwant to make sure a particular command gets executed when the user exits you
- Xshould have a ".EXIT command" in every menu.
- X. \ --------------------------------------------------------------------------
- X
- X.PP
- X.nf
- X \fB.GETINPUT\fP screen_name
- XOption description text.
- X.fi
- X.IP "" 6
- XDisplays a predefined screen and prompts for input
- Xas outlined in the screen definition.
- XAfter the user has pressed the \fIKEY_ACCEPT\fP
- Xthe environment variables, specified by the \fIfield_name\fP argument
- Xis set equal to the data the user entered in that field.
- XIf no data was entered for a field the environment variable is set equal to
- X"NULL". The logic behind the "NULL" is to maintain the positional parameters
- Xwhen the environment variables are passed to a program.
- XIf \fIKEY_CANCEL\fP is pressed the environment variables are not set.
- X.br
- XThe screen_name is what was used in the .DEFINE_SCREEN keyword.
- X.br
- X
- XThe cursor moves from field to field based upon the order of the fields in
- Xthe \fI.DEFINE_SCREEN\fP keyword.
- XBelow is listed the various keys used in a GETINPUT, the action they perform
- Xand their default value. In addition to the default values, if the terminal
- Xhas a associated curses key defined (see curses.h) that key may also be used.
- XFor example, ^j is the default value to traverse forwards through the fields
- Xbut if the down arrow is defined for KEY_DOWN, in curses, then the down arrow
- Xmay also be used. Not all keys may have an associated curses key.
- XThe "^" indicates press and hold the control key.
- X.br
- XSee \fIMenu Initialization File\fP to customize the values of the keys.
- X
- XMover Keys:
- X.nf
- X KEY_RETURN (^m) Traverse forwards through the fields.
- X KEY_DOWN (^j) Traverse forwards through the fields.
- X KEY_UP (^k) Traverse backwards through the fields.
- X KEY_TAB (^i) Fast forward through the fields.
- X KEY_BTAB Fast reverse through the fields.
- XField Editing Keys:
- X KEY_BEG (^b) Place cursor at beginning of field.
- X KEY_END (^e) Place cursor at end of input in field.
- X KEY_RIGHT (^l) Forward space within the field.
- X KEY_LEFT (^h) Backspace within the field (non-destructive).
- X KEY_BACKSPACE (^h) Same as KEY_LEFT.
- X KEY_EOL (^d) Delete from cursor to end of field.
- X KEY_DL (^c) Clear field and home cursor.
- X KEY_DC (^x) Delete a character.
- X KEY_IC (^t) Toggle between type-over and insert mode.
- XOther Keys:
- X KEY_HELP (?) Display help screen.
- X KEY_REFRESH (^r) Redraw the screen.
- X KEY_ACCEPT (^a) Accept all input and exit screen.
- X KEY_CANCEL (esc) Cancel all input and exit screen.
- X KEY_SAVE (^f) Save screen to a file.
- X KEY_PRINT (^p) Print screen to lp.
- X.fi
- X. \ --------------------------------------------------------------------------
- X
- X.PP
- X \fB.GNAME\fP menuname menufile
- X.IP "" 6
- XDefine a goto name for a menu so that the user may go directly to that
- Xmenu by typing in the menu name (G "return" menuname "return").
- XMenuname is the name you want
- Xthe user to input. Menuname has to be one word and is limited to fifteen
- Xcharacters.
- XMenufile is the unix filename for that menu. The .GNAME
- Xis not accessible to the user until the menufile that you have placed the .GNAME
- Xin has been displayed. If all .GNAME's have been placed in the main menu
- Xthen they will all be accessible to the user as soon as the main menu has
- Xbeen displayed.
- X.br
- XInstead of having the user type (G "return" menuname "return") try
- X(control g).
- X
- XNot supported in a \fI.POPMENU\fP menu.
- X. \ --------------------------------------------------------------------------
- X
- X.PP
- X \fB.INCLUDE\fP menufile
- X.IP "" 6
- XInclude a menu script file. This is so you don't have to type the same
- Xscreen definition in all the menu files that you want to use it in.
- XAlthough, it could be used for any menufile.
- XIt is significant where you place the .INCLUDE in your menufile, depending on
- Xwhat is in the .INCLUDE menufile. Think of it as if you were typing it in
- Xat this point in the menu file.
- X. \ --------------------------------------------------------------------------
- X
- X.PP
- X \fB.LINE\fP [ StandoutLine ] [ DumbLine ]
- X.IP "" 6
- XDraws a standout line underneath your last title line to
- Xsplit the options portion of the screen from the title portion.
- XPlace after last \fI.TITLE\fP.
- X.br
- XSee .BOX for description of line types.
- X
- XNot supported in a \fI.POPMENU\fP menu.
- X. \ --------------------------------------------------------------------------
- X
- X.PP
- X.nf
- X \fB.MENU\fP menufile [ GETINPUT screen_name ] [ [!]variable=value ... ] [ \\ ]
- SHAR_EOF
- echo "End of part 1"
- echo "File menu.1 is continued in part 2"
- echo "2" > s2_seq_.tmp
- exit 0
-