home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 January
/
usenetsourcesnewsgroupsinfomagicjanuary1994.iso
/
sources
/
misc
/
volume39
/
pscmenu
/
part02
< prev
next >
Wrap
Text File
|
1993-08-29
|
34KB
|
1,317 lines
Newsgroups: comp.sources.misc
From: Ted Wisniewski <ted@oz.plymouth.edu>
Subject: v39i061: pscmenu - tty based menu system v2.3, Part02/02
Message-ID: <1993Aug29.165511.24767@sparky.sterling.com>
X-Md4-Signature: 4c312bfbb32ec8ff61e9a14164e04e36
Sender: kent@sparky.sterling.com (Kent Landfield)
Reply-To: ted@oz.plymouth.edu (The Wizard of Oz)
Organization: Plymouth State College - Plymouth, N.H.
Date: Sun, 29 Aug 1993 16:55:11 GMT
Approved: kent@sparky.sterling.com
Submitted-by: Ted Wisniewski <ted@oz.plymouth.edu>
Posting-number: Volume 39, Issue 61
Archive-name: pscmenu/part02
Environment: UNIX, curses
Supersedes: pscmenu: Volume 22, Issue 98-99
#! /bin/sh
# This is a shell archive. Remove anything before this line, then feed it
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".
# Contents: MENU/Makefile MENU/README MENU/config.h
# MENU/demos/HELP/cat.help MENU/demos/HELP/copy.help
# MENU/demos/HELP/mail.help MENU/demos/HELP/man.help
# MENU/demos/HELP/remove.help MENU/demos/HELP/sub_menu.help
# MENU/demos/HELP/vi.help MENU/demos/main.menu MENU/demos/printers
# MENU/dir.h MENU/menu.desc MENU/printers MENU/proto.h MENU/screen.c
# MENU/signals.c MENU/time.c MENU/utils.c MENU/utils.h
# Wrapped by kent@sparky on Sun Aug 29 11:50:48 1993
PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
echo If this archive is complete, you will see the following message:
echo ' "shar: End of archive 2 (of 2)."'
if test -f 'MENU/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/Makefile'\"
else
echo shar: Extracting \"'MENU/Makefile'\" \(1377 characters\)
sed "s/^X//" >'MENU/Makefile' <<'END_OF_FILE'
XCC = cc
X#CC = gcc
XCFLAGS = -O -g3
X
X# Some Systems may not require "-ltermcap" and may instead need "-ltermlib"
X#
XLIBS = -lcurses -ltermcap
X#LIBS = -lcurses -ltermlib
XMENUDIR= /usr/local/lib/menus
XDEFS =
XTARGET = menu
X
XHDRS = menu.h utils.h dir.h config.h
XSRCS = menu.c appl.c utils.c files.c signals.c dir.c screen.c terminal.c time.c
XOBJS = menu.o appl.o utils.o files.o signals.o dir.o screen.o terminal.o time.o
X
X$(TARGET): $(OBJS) $(SRCS) $(HDRS)
X $(CC) $(CFLAGS) $(OBJS) -o $(TARGET) $(LIBS)
X
Xmenu.o : menu.c menu.h config.h
X $(CC) $(CFLAGS) $(DEFS) -c menu.c
X
Xappl.o : appl.c menu.h config.h
X $(CC) $(CFLAGS) $(DEFS) -c appl.c
X
Xutils.o : utils.c utils.h config.h
X $(CC) $(CFLAGS) $(DEFS) -c utils.c
X
Xfiles.o : files.c menu.h config.h
X $(CC) $(CFLAGS) $(DEFS) -c files.c
X
Xsignals.o : signals.c config.h
X $(CC) $(CFLAGS) $(DEFS) -c signals.c
X
Xscreen.o : screen.c config.h
X $(CC) $(CFLAGS) $(DEFS) -c screen.c
X
Xterminal.o : terminal.c config.h
X $(CC) $(CFLAGS) $(DEFS) -c terminal.c
X
Xdir.o : dir.c dir.h config.h
X $(CC) $(CFLAGS) $(DEFS) -c dir.c
X
Xtime.o : time.c menu.h config.h
X $(CC) $(CFLAGS) $(DEFS) -c time.c
X
Xinstall:
X -chmod 711 /usr/local/bin/menu
X install -c -m 1711 -o root -g system -s menu /usr/local/bin/menu
X -mkdir $(MENUDIR)
X -chmod 755 $(MENUDIR)
X
Xclean:
X rm -f $(OBJS) ./menu core core.menu
X
Xlint:
X lint -DDFLAGS $(SRCS) > LINT.OUT
END_OF_FILE
if test 1377 -ne `wc -c <'MENU/Makefile'`; then
echo shar: \"'MENU/Makefile'\" unpacked with wrong size!
fi
# end of 'MENU/Makefile'
fi
if test -f 'MENU/README' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/README'\"
else
echo shar: Extracting \"'MENU/README'\" \(2731 characters\)
sed "s/^X//" >'MENU/README' <<'END_OF_FILE'
XPSCmenu 2.3
X
XChanges Since 2.2:
X
X - Some minor tweeks for smoother operation.
X - Added support for 386BSD/NetBSD.
X - Ability to have as many as 14 menu choices.
X - Removed some old code.
X - Streamlined include files.
X - Added config.h and proto.h
X
XSystems tested on:
X
X Ultrix4.2a, AIX(version ???), 386BSD/NetBSD
X
XNotes from Author:
X
X * PSCmenu is free, however, if you like it and intend
X on using it I would appreciate it if you send me a
X post-card; please include: your name, title
X and organization. Send it to:
X
X Ted Wisniewski
X Academic Computing
X Lamson Library
X Plymouth State College
X Plymouth NH, 03264
X
XInstall Notes:
X
XInstall Notes for PSCmenu2.3
X
X This Menu system should compile on just about any machine. I have
Xit working under Ultrix, AIX (IBM system V), SUN and *HP-UX*. These are the
Xonly variations of UNIX that I know it has worked on. If you have problems
Xjust ask. If you need to make changes to get menu to run on your system
Xplease send me the following information:
X
X* I have not actually seen it it run on HP-UX systems.
X
X 1. Computer Type.
X 2. Your variaton of UNIX. (Ultrix, AIX, SUN-OS, ...)
X 3. Code you had to modify.
X
XTo compile:
X
X If you have the 'shar' file:
X
X unshar the shell archive via: % sh menu.shar
X
X then edit the header files "config.h" and the Makefile to set
X appropriate paths and definitions for your system.
X
X Things to edit:
X
X config.h:
X
X Various System definitions. Make sure you select ones
X to fit your system.
X
X MENU_DIR - The directory containing menu files.
X
X PRINT_PATH - Set to path/name of file containg print
X commands.
X PRT_TO_SCR - Name of program that prints to screen.
X
X Makefile:
X
X Make sure 'MENU_DIR' in the config.h and 'MENUDIR' in the
X Makefile agree.
X
X printers:
X
X If you are using the builtin priting support, edit the file
X called printers to agree with your printing commands.
X
X then
X
X do: % make
X
XTo Test:
X
X do: % ./menu ./demos
X
X This should show you a working example of how this menu
X works, the demo is set up for what this site is using so
X the applications called may not be on your system.
X
X
XTo install:
X
X do: % make install
X
X * Edit 'printers' and copy to the 'MENU_DIR'. You may have
X up to 30 specified printers.
X
X File format for 'printers':
X
X ? Printer description
X * Printing Command to be used.
X
X * Edit 'demos/main.menu' and copy to the 'MENU_DIR'.
X * Make both files read-able to those using the menu.
X
XProblems or Questions:
X
X Send E-Mail to: ted@oz.plymouth.edu
X
XHP-UX Compatability, Thanks to:
X Barry Mc Innes - barry@giaea.oz.au
X
X
XUp to date Versions are available via Anonymous ftp from:
X
X oz.plymouth.edu -> /pub/psc/ -> All day.
X wiz.plymouth.edu -> /pub/psc/ -> 11pm to 3pm
END_OF_FILE
if test 2731 -ne `wc -c <'MENU/README'`; then
echo shar: \"'MENU/README'\" unpacked with wrong size!
fi
# end of 'MENU/README'
fi
if test -f 'MENU/config.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/config.h'\"
else
echo shar: Extracting \"'MENU/config.h'\" \(1388 characters\)
sed "s/^X//" >'MENU/config.h' <<'END_OF_FILE'
X# define __CONFIG_H
X
X/*
X Systems, Comment out or uncomment the appropriate define(s)
X for your system.
X*/
X
X/*# define AIX /* IBM unix (SYSV) */
X# define ULTRIX /* DEC Ultrix (BSD) */
X/*# define PC_BSD /* 386BSD/NetBSD (BSD) */
X/*# define HPUX /* Hewlet Packard (SYSV)*/
X/*# define SUN /* Sun Systems (BSD?) */
X
X/* System Types */
X
X/*# define SYSTEM_FIVE /* For system V machines */
X/*# define BSD43 /* For some BSD machines, try without 1st */
X
X/* Other */
X
X/*# define TERM_INFO /* For Systems with terminfo */
X
X/*
X Comment out PRINT_TIME if you compiler barfs when compiling
X time.c, I have not yet tested this code on many machines.
X*/
X
X# define PRINT_TIME /* To print time/date on screen */
X
X/*
X The directory where the system default menu files will be
X located.
X*/
X
X# define MENU_DIR "/usr/local/lib/menus/"
X
X# define ENABLE_PRINT /* Comment to disable printing menu */
X
X/*
X Full pathname to printer support file.
X*/
X
X# define PRINT_PATH "/usr/local/lib/menus/printers"
X
X/*
X Full pathname to the 'more' command.
X*/
X
X# ifndef HPUX
X# define PRT_TO_SCR "/usr/ucb/more"
X# else
X# define PRT_TO_SCR "/usr/bin/more"
X# endif HPUX
X
X
X/*
X Other Configurations.
X*/
X
X/* The 'getwd(buf) routine fails for NetBSD and perhaps others
X define 'USE_CWD' to use the 'getcwd(buf, size) instead.
X*/
X
X/*# define USE_CWD /* Use getcwd(buf,size) and not getwd(buf) */
X
END_OF_FILE
if test 1388 -ne `wc -c <'MENU/config.h'`; then
echo shar: \"'MENU/config.h'\" unpacked with wrong size!
fi
# end of 'MENU/config.h'
fi
if test -f 'MENU/demos/HELP/cat.help' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/demos/HELP/cat.help'\"
else
echo shar: Extracting \"'MENU/demos/HELP/cat.help'\" \(32 characters\)
sed "s/^X//" >'MENU/demos/HELP/cat.help' <<'END_OF_FILE'
XThis is an example of cat help.
END_OF_FILE
if test 32 -ne `wc -c <'MENU/demos/HELP/cat.help'`; then
echo shar: \"'MENU/demos/HELP/cat.help'\" unpacked with wrong size!
fi
# end of 'MENU/demos/HELP/cat.help'
fi
if test -f 'MENU/demos/HELP/copy.help' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/demos/HELP/copy.help'\"
else
echo shar: Extracting \"'MENU/demos/HELP/copy.help'\" \(33 characters\)
sed "s/^X//" >'MENU/demos/HELP/copy.help' <<'END_OF_FILE'
XThis is an example of copy help.
END_OF_FILE
if test 33 -ne `wc -c <'MENU/demos/HELP/copy.help'`; then
echo shar: \"'MENU/demos/HELP/copy.help'\" unpacked with wrong size!
fi
# end of 'MENU/demos/HELP/copy.help'
fi
if test -f 'MENU/demos/HELP/mail.help' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/demos/HELP/mail.help'\"
else
echo shar: Extracting \"'MENU/demos/HELP/mail.help'\" \(33 characters\)
sed "s/^X//" >'MENU/demos/HELP/mail.help' <<'END_OF_FILE'
XThis is an example of mail help.
END_OF_FILE
if test 33 -ne `wc -c <'MENU/demos/HELP/mail.help'`; then
echo shar: \"'MENU/demos/HELP/mail.help'\" unpacked with wrong size!
fi
# end of 'MENU/demos/HELP/mail.help'
fi
if test -f 'MENU/demos/HELP/man.help' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/demos/HELP/man.help'\"
else
echo shar: Extracting \"'MENU/demos/HELP/man.help'\" \(32 characters\)
sed "s/^X//" >'MENU/demos/HELP/man.help' <<'END_OF_FILE'
XThis is an example of man help.
END_OF_FILE
if test 32 -ne `wc -c <'MENU/demos/HELP/man.help'`; then
echo shar: \"'MENU/demos/HELP/man.help'\" unpacked with wrong size!
fi
# end of 'MENU/demos/HELP/man.help'
fi
if test -f 'MENU/demos/HELP/remove.help' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/demos/HELP/remove.help'\"
else
echo shar: Extracting \"'MENU/demos/HELP/remove.help'\" \(35 characters\)
sed "s/^X//" >'MENU/demos/HELP/remove.help' <<'END_OF_FILE'
XThis is an example of remove help.
END_OF_FILE
if test 35 -ne `wc -c <'MENU/demos/HELP/remove.help'`; then
echo shar: \"'MENU/demos/HELP/remove.help'\" unpacked with wrong size!
fi
# end of 'MENU/demos/HELP/remove.help'
fi
if test -f 'MENU/demos/HELP/sub_menu.help' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/demos/HELP/sub_menu.help'\"
else
echo shar: Extracting \"'MENU/demos/HELP/sub_menu.help'\" \(37 characters\)
sed "s/^X//" >'MENU/demos/HELP/sub_menu.help' <<'END_OF_FILE'
XThis is an example of sub-menu help.
END_OF_FILE
if test 37 -ne `wc -c <'MENU/demos/HELP/sub_menu.help'`; then
echo shar: \"'MENU/demos/HELP/sub_menu.help'\" unpacked with wrong size!
fi
# end of 'MENU/demos/HELP/sub_menu.help'
fi
if test -f 'MENU/demos/HELP/vi.help' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/demos/HELP/vi.help'\"
else
echo shar: Extracting \"'MENU/demos/HELP/vi.help'\" \(31 characters\)
sed "s/^X//" >'MENU/demos/HELP/vi.help' <<'END_OF_FILE'
XThis is an example of vi help.
END_OF_FILE
if test 31 -ne `wc -c <'MENU/demos/HELP/vi.help'`; then
echo shar: \"'MENU/demos/HELP/vi.help'\" unpacked with wrong size!
fi
# end of 'MENU/demos/HELP/vi.help'
fi
if test -f 'MENU/demos/main.menu' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/demos/main.menu'\"
else
echo shar: Extracting \"'MENU/demos/main.menu'\" \(838 characters\)
sed "s/^X//" >'MENU/demos/main.menu' <<'END_OF_FILE'
X! PSC Menu Executive (14-option)
X...........................................
X1 /usr/ucb/vi
X# ./HELP/vi.help
X? Use the vi editor.
X...........................................
X2 /bin/cp -i
X# ./HELP/copy.help
X? Make a copy of a file.
X...........................................
X3 /usr/ucb/mail
X# ./HELP/mail.help
X? Send Mail (Asks for a user name).
X...........................................
X4 /usr/ucb/man
X# ./HELP/man.help
X? Read the Manual (Asks for a topic).
X...........................................
X5 /bin/rm -i
X# ./HELP/remove.help
X? Remove file (Use visual Dir. C-shell).
X...........................................
X6 /bin/cat
X# ./HELP/cat.help
X? Cat a file (Use visual Dir. PIPE).
X...........................................
X& sub_menu.menu
X# ./HELP/sub_menu.help
X? Load A Sub-Menu.
X...........................................
END_OF_FILE
if test 838 -ne `wc -c <'MENU/demos/main.menu'`; then
echo shar: \"'MENU/demos/main.menu'\" unpacked with wrong size!
fi
# end of 'MENU/demos/main.menu'
fi
if test -f 'MENU/demos/printers' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/demos/printers'\"
else
echo shar: Extracting \"'MENU/demos/printers'\" \(449 characters\)
sed "s/^X//" >'MENU/demos/printers' <<'END_OF_FILE'
X......................................
X.. Example Printer Definition File ...
X......................................
X? Print on the Screen.
X* /usr/ucb/more
X......................................
X? Library (wide)
X* /usr/local/bin/lprlib
X......................................
X? Library (narrow)
X* /usr/local/bin/lprlibx
X......................................
X? Library (Letter Quality)
X* /usr/local/bin/lprlibz
X......................................
END_OF_FILE
if test 449 -ne `wc -c <'MENU/demos/printers'`; then
echo shar: \"'MENU/demos/printers'\" unpacked with wrong size!
fi
# end of 'MENU/demos/printers'
fi
if test -f 'MENU/dir.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/dir.h'\"
else
echo shar: Extracting \"'MENU/dir.h'\" \(1266 characters\)
sed "s/^X//" >'MENU/dir.h' <<'END_OF_FILE'
X# ifndef __DIR_H
X# define __DIR_H
X
X# include <ctype.h>
X
X# define PRT_MENU "Choose a printer: arrow keys to move, return to select, 'q' to quit"
X
X/*
X# define PRINT_PATH "/usr/local/lib/menus/printers"
X# ifndef HPUX
X# define PRT_TO_SCR "/usr/ucb/more"
X# else
X# define PRT_TO_SCR "/usr/bin/more"
X# endif HPUX
X*/
X
X# define OTHER_LINE "n)ext page p)revious page"
X
X# define UP 252
X# define DOWN 253
X# define LEFT 254
X# define RIGHT 255
X
X# define MAX_PRINTERS 30
X# define MAX_ENT 1024
X# define ENT_LEN 20
X
X# define isposodd(x) (x % 2)
X# define in_col_one(x) ((x / 2) + (x % 2))
X# define in_col_two(x) (x - in_col_one(x))
X
Xstruct print_options
X{
X char selection[80];
X int option;
X int x;
X int y;
X};
X
Xstatic struct print_options print_opts[6] = {
X {"CANCEL",0,5,22},
X {"PRINT",0,16,22},
X {"(Spacing %d)",0,26,22},
X {"(Skip Page Break %s)",0,41,22},
X {"(Copies %d)",0,65,22}
X};
X
Xtypedef struct
X{
X char comment[40];
X char command[128];
X}printer;
X
Xtypedef struct
X{
X int max_row;
X int max_col;
X}dir_info;
X
Xextern DIR *opendir();
X# if defined (SUN) || defined (BSD43)
Xstruct direct *readdir();
X# else
Xstruct dirent *readdir();
X# endif (SUN || BSD43)
X# ifdef BSD43
Xextern struct direct *readdir();
Xvoid closedir();
X# else
Xint closedir();
X# endif BSD43
X
X# endif __DIR_H
END_OF_FILE
if test 1266 -ne `wc -c <'MENU/dir.h'`; then
echo shar: \"'MENU/dir.h'\" unpacked with wrong size!
fi
# end of 'MENU/dir.h'
fi
if test -f 'MENU/menu.desc' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/menu.desc'\"
else
echo shar: Extracting \"'MENU/menu.desc'\" \(2261 characters\)
sed "s/^X//" >'MENU/menu.desc' <<'END_OF_FILE'
XMenu file key descriptions:
X
XThe key is the first character on each line
Xin a menu file.
X
X'$' Menu header. This is the text that will appear at the top
X of the menu. 7 option menu style.
X
X'!' Menu header. Same as above, but selects 14 option menu
X style.
X
X'?' Menu comment. Text that describes what will be used when
X the user presses the corresponding key.
X
X'+' Execute in a pipe. Execute a process in a pipe. The process
X called must not require user interaction. Good examples
X would be "ls" or "cat filename".
X
X'#' Name of help file. The name of the help file for the
X corresponding menu option.
X
X'*' Execute commend in a subshell. Output does not use the
X menu window. Upon completion of the command the user
X will be prompted to press the space key to continue.
X
X'%' Execute command in a subshell. Essentially identical
X to '*' with the exception that it returns without
X prompting the user to press the space key. Returns
X immediately upon completion of the command.
X
X'&' The name of a menu file is specified for loading.
X
X'@' The name of a menu file is specified for loading. In this
X case the loaded menu file is specified to be the main
X menu. This may be useful for sub-menu grouping. The only
X way a user can get back to the real "main" menu is by
X use of the 'm' menu command. The return key or the 'p' key
X will only take the user back as far as a menu specified
X with the '@' character.
X
X'1' Execute a C-Shell command, but ask for a file name to use
X as an argument for the command.
X
X'2' Execute a C-Shell command, but ask for two file names
X as arguments for the command. Good for use with the
X "mv" command.
X
X'3' Execute a C-Shell command, but ask for a persons login
X name. Useful when using the "talk" command.
X
X'4' Execute a C-Shell command, but ask for a topic. Useful
X when using the "man" command.
X
X'5' Execute a C-Shell command with a file name as an argument.
X Uses visual directory listing and a file is selected by
X using the arrow keys. Useful when you know the file
X must exist.
X
X'6' Execute a command in a pipe with a file name as an argument.
X Uses visual directory listing and a file is selected by
X using the arrow keys. Useful when you know the file
X must exist.
END_OF_FILE
if test 2261 -ne `wc -c <'MENU/menu.desc'`; then
echo shar: \"'MENU/menu.desc'\" unpacked with wrong size!
fi
# end of 'MENU/menu.desc'
fi
if test -f 'MENU/printers' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/printers'\"
else
echo shar: Extracting \"'MENU/printers'\" \(449 characters\)
sed "s/^X//" >'MENU/printers' <<'END_OF_FILE'
X......................................
X.. Example Printer Definition File ...
X......................................
X? Print on the Screen.
X* /usr/ucb/more
X......................................
X? Library (wide)
X* /usr/local/bin/lprlib
X......................................
X? Library (narrow)
X* /usr/local/bin/lprlibx
X......................................
X? Library (Letter Quality)
X* /usr/local/bin/lprlibz
X......................................
END_OF_FILE
if test 449 -ne `wc -c <'MENU/printers'`; then
echo shar: \"'MENU/printers'\" unpacked with wrong size!
fi
# end of 'MENU/printers'
fi
if test -f 'MENU/proto.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/proto.h'\"
else
echo shar: Extracting \"'MENU/proto.h'\" \(1683 characters\)
sed "s/^X//" >'MENU/proto.h' <<'END_OF_FILE'
X/* Others */
X
Xchar *getwd(char *);
X
X/* For curses */
X
Xint tgetent();
Xint waddch();
Xint addch();
Xint refresh();
Xint wrefresh();
Xint wstandout();
Xint wstandend();
Xint wmove();
Xint endwin();
Xint stty();
Xint gtty();
Xint wclear();
Xint wprintw();
Xint wclrtobot();
Xint wclrtoeol();
Xint getch();
Xint wgetch();
X
X# ifndef __TERMINAL_C
X
Xunsigned short my_getchar();
Xvoid setup_modes();
Xvoid unset_modes();
Xvoid start_up();
Xvoid end_up();
Xvoid move_csr();
Xvoid my_print();
Xvoid hi_lite();
Xvoid print_char();
Xvoid hi_lite_char();
Xvoid clear_window();
Xvoid clear_to_eol();
Xvoid clear_to_bot();
X
X# endif
X
X# ifndef __APPL_C
X
Xvoid check_dirname();
Xvoid do_padding();
Xvoid disp_menu();
Xvoid do_menu();
Xvoid chop_str();
Xvoid pad_str();
X
X# endif
X
X# ifndef __DIR_C
X
Xvoid replace_spaces();
Xvoid move_entry();
Xvoid show_printers();
Xvoid do_printers();
Xchar *select_item();
Xchar *choose_print();
Xchar *do_selection();
Xint is_directory();
Xint get_dir();
Xint print_dir();
Xint read_printers();
X
X# endif
X
X# ifndef __FILES_C
X
Xvoid read_menu();
Xint check_file();
X
X# endif
X
X# ifndef __UTILS_C
X
Xvoid quit();
Xvoid read_str();
Xvoid rm_lf();
Xvoid clear_array();
Xint get_term();
Xint get_input();
X
X# endif
X
X# ifndef __SCREEN_C
X
Xvoid center_line();
Xvoid box_screen();
Xvoid box_window();
X
X# endif
X
X# ifndef __SIGNALS_C
X
Xvoid catch();
Xvoid setup_sigs();
Xvoid log_out();
X
X# endif
X
X# ifndef __TIME_C
X
Xvoid print_time();
Xvoid set_alarm();
Xvoid unset_alarm();
Xchar *extract_mins();
X
X# endif
X
X# ifndef __MENU_C
X
Xvoid erase_line();
Xvoid continue_it();
Xvoid clr_area();
Xvoid print_output();
Xvoid exec_pipe();
Xvoid prt_curdir();
Xvoid exec_cshell();
Xvoid setup_screen();
Xvoid initialize();
Xvoid check_run();
Xint cont_it();
X
X# endif
END_OF_FILE
if test 1683 -ne `wc -c <'MENU/proto.h'`; then
echo shar: \"'MENU/proto.h'\" unpacked with wrong size!
fi
# end of 'MENU/proto.h'
fi
if test -f 'MENU/screen.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/screen.c'\"
else
echo shar: Extracting \"'MENU/screen.c'\" \(2580 characters\)
sed "s/^X//" >'MENU/screen.c' <<'END_OF_FILE'
X# define __SCREEN_C
X
X# include "config.h"
X# include "proto.h"
X# include <stdio.h>
X# include <curses.h>
X
X# define SCREEN_WIDTH 80
X# define FIRST_LINE 0
X# define FIRST_COL 0
X# define LAST_COL 79
X# define LAST_LINE 23
X# define SPACE ' '
X# define RETURN '\r'
X# define LINE_FEED '\n'
X# define BACK_SPACE '\b'
X# define BLANK_LINE " "
X# define NORMAL 0
X# define REVERSE 1
X
XWINDOW *view_port;
X
X/*
X * Routine : center_line();
X *
X * Purpose : Center a line in a window.
X *
X * Parameters : window_name - Curses window
X * string - The text to center.
X * line_number - The line in the window to print on.
X * width - The width of the window.
X * flag - To Hi-lite or not, that is the quest?
X *
X * Last Modify : 11-10-91
X *
X * Example call : center_line(WIN,"Hello",2,20,1);
X *
X */
X
Xvoid center_line(window_name,string,line_number,width,flag)
XWINDOW *window_name;
Xchar *string;
Xunsigned short line_number,width,flag; /* flag = 0 normal, flag = 1 hi-lite */
X{
X if(flag == NORMAL)
X my_print(window_name,string,((width/2)-(strlen(string)/2)),line_number);
X else
X hi_lite(window_name,string,((width/2)-(strlen(string)/2)),line_number);
X}
X
X/*
X * Routine : box_screen()
X *
X * Purpose : Place a hi-lited box around the screen.
X *
X * Parameters : top_line - String Containing Screen Heading.
X *
X * Last Modify : 11-10-91
X *
X * Example call : box_screen("Hello World");
X *
X */
X
Xvoid box_screen(top_line)
Xchar *top_line;
X{
X char line[SCREEN_WIDTH+5];
X int index;
X
X (void) sprintf(line,"%80s",BLANK_LINE);
X clear_window(stdscr);
X hi_lite(stdscr,line,FIRST_COL,FIRST_LINE);
X hi_lite(stdscr,line,FIRST_COL,LAST_LINE-1);
X for(index=FIRST_LINE;index<LAST_LINE;index++)
X hi_lite_char(stdscr,SPACE,FIRST_COL,index);
X for(index=FIRST_LINE;index<LAST_LINE;index++)
X hi_lite_char(stdscr,SPACE,LAST_COL,index);
X center_line(stdscr,top_line,FIRST_LINE,SCREEN_WIDTH,REVERSE);
X move_csr(stdscr,0,23);
X}
X
X/*
X * Routine : box_window()
X *
X * Purpose : Place a box around a window.
X *
X * Parameters : window_name - Curses window structure pointer.
X *
X * Last Modify : 11-10-91
X *
X * Example call : box_window(stdscr);
X *
X */
X
Xvoid box_window(window_name)
XWINDOW *window_name;
X{
X int index,max_x, max_y;
X char print_buff[80];
X
X (void) sprintf(print_buff," ");
X max_x = window_name->_maxx;
X max_y = window_name->_maxy;
X do_padding(print_buff,(max_x-2));
X hi_lite(window_name,print_buff,0,0);
X hi_lite(window_name,print_buff,0,(max_y-1));
X for(index=1;index<(max_y-1);index++){
X hi_lite_char(window_name,SPACE,0,index);
X hi_lite_char(window_name,SPACE,max_x-1,index);
X }
X
X}
END_OF_FILE
if test 2580 -ne `wc -c <'MENU/screen.c'`; then
echo shar: \"'MENU/screen.c'\" unpacked with wrong size!
fi
# end of 'MENU/screen.c'
fi
if test -f 'MENU/signals.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/signals.c'\"
else
echo shar: Extracting \"'MENU/signals.c'\" \(1664 characters\)
sed "s/^X//" >'MENU/signals.c' <<'END_OF_FILE'
X# define __SIGNALS_C
X
X# include "config.h"
X# include "proto.h"
X# include <signal.h>
X# include "menu.h"
X
X/* PSC MENU COPYRIGHT NOTICE
X
X Part of PSCMenu
X
X This software is to be considered to be public domain, it
Xmay be copied, modified and parts of it may be used in other programs
Xas long as this copyright notice remains intact.
X
X Copyright() PSC - Plymouth State College
X Written by: Ted Wisniewski 12-9-1990
X
X*/
X
X/*
X * void setup_sigs():
X *
X * Parameters: None.
X *
X * Description: Set up signal handling.
X *
X * Returns: None.
X *
X * Last Modify: 05-8-91 (TW)
X *
X */
X
X/*
X * catch():
X *
X * Parameters: signo - The signal ID #.
X *
X * Description: Routine to catch specific signals.
X *
X * Returns: None.
X *
X * Last Modify: 05-8-91 (TW)
X *
X */
X
Xvoid catch(signo)
Xint signo;
X{
X switch (signo){
X case SIGHUP:
X exit(1);
X break;
X case SIGSEGV:
X case SIGBUS:
X clear_window(stdscr);
X unset_modes();
X perror("BUS ERROR");
X exit(1);
X break;
X }
X}
X
Xvoid setup_sigs()
X{
X (void) signal(SIGHUP,catch);
X (void) signal(SIGSEGV,catch);
X (void) signal(SIGBUS,catch);
X (void) signal(SIGINT,SIG_IGN);
X (void) signal(SIGTSTP,SIG_IGN);
X (void) signal(SIGQUIT,SIG_IGN);
X}
X
X/*
X * log_out():
X *
X * Parameters: None.
X *
X * Description: Kill The process group of the parent to the menu,
X * hopefully this will be the users login shell.
X *
X * Returns: None.
X *
X * Last Modify: 09-04-91 (TW)
X *
X */
X
Xvoid log_out()
X{
X# ifndef HPUX
X killpg(getppid(),SIGHUP); /* Kill Parent Process */
X killpg(getpid(),SIGHUP); /* Suicide: Kill self. */
X# else
X kill(getppid(),SIGHUP); /* Kill Parent Process */
X kill(getpid(),SIGHUP); /* Suicide: Kill self. */
X# endif HPUX
X}
END_OF_FILE
if test 1664 -ne `wc -c <'MENU/signals.c'`; then
echo shar: \"'MENU/signals.c'\" unpacked with wrong size!
fi
# end of 'MENU/signals.c'
fi
if test -f 'MENU/time.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/time.c'\"
else
echo shar: Extracting \"'MENU/time.c'\" \(1264 characters\)
sed "s/^X//" >'MENU/time.c' <<'END_OF_FILE'
X# define __TIME_C
X
X# include "config.h"
X
X# ifdef PRINT_TIME
X# include "proto.h"
X# include "menu.h"
X# ifdef AIX
X# include <time.h>
X# else
X# include <sys/time.h>
X# endif
X# include <signal.h>
X
Xchar t_buf[3];
X
Xstatic char days[7][4] = {
X "Sun","Mon","Tue","Wed","Thu","Fri","Sat"
X};
X
Xstatic char months[12][4] = {
X "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"
X};
X
Xchar *extract_mins(minute)
Xint minute;
X{
X if(minute < 10)
X (void) sprintf(t_buf,"0%d",minute);
X else
X (void) sprintf(t_buf,"%d",minute);
X return(t_buf);
X}
X
Xvoid print_time()
X{
X long t_ptr;
X struct tm *local, *localtime();
X char buffer[80], buffer2[40];
X
X time(&t_ptr);
X local = localtime(&t_ptr);
X if(local->tm_hour > 12)
X (void) sprintf(buffer,"%d:%s pm",local->tm_hour-12,extract_mins(local->tm_min));
X else
X (void) sprintf(buffer,"%d:%s am",local->tm_hour,extract_mins(local->tm_min));
X (void) sprintf(buffer2,"%s, %s %d",days[local->tm_wday],months[local->tm_mon],local->tm_mday);
X hi_lite(stdscr,buffer,72,0);
X hi_lite(stdscr,buffer2,0,0);
X my_print(stdscr,"",0,23);
X alarm(TIME_OUT);
X}
X
Xvoid set_alarm()
X{
X (void) signal(SIGALRM,print_time);
X alarm_on = TRUE;
X alarm(TIME_OUT);
X}
X
Xvoid unset_alarm()
X{
X alarm_on = FALSE;
X alarm(OFF);
X}
X
X# endif PRINT_TIME
END_OF_FILE
if test 1264 -ne `wc -c <'MENU/time.c'`; then
echo shar: \"'MENU/time.c'\" unpacked with wrong size!
fi
# end of 'MENU/time.c'
fi
if test -f 'MENU/utils.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/utils.c'\"
else
echo shar: Extracting \"'MENU/utils.c'\" \(2781 characters\)
sed "s/^X//" >'MENU/utils.c' <<'END_OF_FILE'
X# define __UTILS_C
X
X# include "config.h"
X# include "proto.h"
X# include "utils.h"
X
X/*
X This file contains basic low level utilities.
X*/
X
Xint get_term()
X/*
X This routine gets the terminal specific escape sequences
X and saves them in the appropriate variable for use by
X tputs() and tgoto()
X*/
X{
X char bp[1024], termtype[MAXL];
X static char buf[100];
X char *buf_ptr = buf;
X# ifdef TERM_INFO
X int status;
X# endif
X
X
X if(getenv("TERM") != NULL)
X (void) strcpy(termtype, getenv("TERM"));
X else
X return(-1);
X initscr();
X
X# ifdef TERM_INFO
X setupterm(termtype,1,&status);
X if(status != 1)
X return(-1);
X
X KU = key_up;
X KD = key_down;
X KL = key_left;
X KR = key_right;
X
X# else TERM_INFO
X
X if(tgetent(bp,termtype) != 1)
X return(-1);
X if((KU = tgetstr("ku",&buf_ptr)) == (char *)NULL)
X return (1);
X if((KD = tgetstr("kd",&buf_ptr)) == (char *)NULL)
X return (1);
X if((KL = tgetstr("kl",&buf_ptr)) == (char *)NULL)
X return (1);
X if((KR = tgetstr("kr",&buf_ptr)) == (char *)NULL)
X return (1);
X# endif TERM_INFO
X return(0);
X}
X
Xvoid quit()
X{
X clear_window(stdscr); /* Clear screen routine */
X move_csr(stdscr,0,LAST_LINE);
X end_up();
X exit(0);
X}
X
Xvoid rm_lf(array)
Xchar *array;
X/*
X Remove Trailing line feed from a line.
X*/
X{
X if(array[strlen(array)-1] == '\n')
X array[strlen(array)-1] = NULL;
X}
X
Xvoid read_str(window_name,string,max_length)
XWINDOW *window_name;
Xchar *string;
Xint max_length;
X{
X char *str;
X int length = 0;
X
X str = string;
X while((*str =my_getchar(window_name)) != LF && *str != RETURN && length <= max_length){
X if(*str == DEL || *str == BS)
X if(*str != *string){
X waddch(window_name,DEL);
X waddch(window_name,SPACE);
X waddch(window_name,DEL);
X wrefresh(window_name);
X *str--;
X length--;
X }else
X continue;
X else{
X if(length == max_length)
X waddch(window_name,0x07);
X else{
X waddch(window_name,*str);
X *str++;
X length++;
X }
X wrefresh(window_name);
X }
X }
X *str = NULL;
X}
X
X
Xvoid clear_array(array)
Xchar *array;
X{
X for(;*array != NULL;*array++)
X *array = NULL;
X}
X
Xint get_input()
X{
X char c, buffer[80];
X int ct = 0, len;
X
X if((len = strlen(KU)-1) < 2)
X len = 1;
X while((c = my_getchar(stdscr)) && (ct < len)){
X if((c == 0x1b) || (ct > 0)){
X buffer[ct] = c;
X ct++;
X }else
X return(c);
X }
X buffer[ct] = c;
X buffer[ct+1] = NULL;
X if((strcmp(KU,buffer)) == 0 || strcmp("\033[A",buffer) == 0)
X return(UP);
X else
X if((strcmp(KD,buffer)) == 0 || strcmp("\033[B",buffer) == 0)
X return(DOWN);
X else
X if((strcmp(KR,buffer)) == 0 || strcmp("\033[C",buffer) == 0)
X return(RIGHT);
X else
X if((strcmp(KL,buffer)) == 0 || strcmp("\033[D",buffer) == 0)
X return(LEFT);
X else
X return(NULL);
X}
END_OF_FILE
if test 2781 -ne `wc -c <'MENU/utils.c'`; then
echo shar: \"'MENU/utils.c'\" unpacked with wrong size!
fi
# end of 'MENU/utils.c'
fi
if test -f 'MENU/utils.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MENU/utils.h'\"
else
echo shar: Extracting \"'MENU/utils.h'\" \(852 characters\)
sed "s/^X//" >'MENU/utils.h' <<'END_OF_FILE'
X# ifndef __UTILS_H
X# define __UTILS_H
X
X# include <stdio.h>
X# include <curses.h>
X# ifdef TERM_INFO
X# include <term.h>
X# endif TERM_INFO
X
X# include <sys/types.h>
X# include <unistd.h>
X
X/* PSC MENU COPYRIGHT NOTICE
X
X Part of PSCMenu
X
X This software is to be considered to be public domain, it
Xmay be copied, modified and parts of it may be used in other programs
Xas long as this copyright notice remains intact.
X
X Copyright() PSC - Plymouth State College
X Written by: Ted Wisniewski 12-9-1990
X
X*/
X
X# define MAXL 80
X# define THIS_TTY 0
X# define DEL '\b'
X# define BS 0x7f
X# define SPACE ' '
X# define LF '\n'
X# define RETURN '\r'
X# define LAST_LINE 23
X
X# define UP 252
X# define DOWN 253
X# define LEFT 254
X# define RIGHT 255
X
Xchar *getenv(), *tgetstr(), *tgoto();
X
Xint outc();
X
Xchar *KU, *KD, *KL, *KR;
X
X# endif __UTILS_H
END_OF_FILE
if test 852 -ne `wc -c <'MENU/utils.h'`; then
echo shar: \"'MENU/utils.h'\" unpacked with wrong size!
fi
# end of 'MENU/utils.h'
fi
echo shar: End of archive 2 \(of 2\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked both archives.
rm -f ark[1-9]isdone
else
echo You still must unpack the following archives:
echo " " ${MISSING}
fi
exit 0
exit 0 # Just in case...