menu(1) part 13 of 14

Paul J. Condie pjc at pcbox.UUCP
Thu Dec 27 07:16:44 AEST 1990


#!/bin/sh
# this is part 13 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file utilities.d/m.d/adduser continued
#
CurArch=13
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file utilities.d/m.d/adduser"
sed 's/^X//' << 'SHAR_EOF' >> utilities.d/m.d/adduser
X
X
X
X###	Add entry to password file
X### 	$PWDFILE must be writable.
XMenuMsg `tput lines` 0 "Adding entry to $PWDFILE"
Xif [ ! -w "$PWDFILE" ]
X   then echo "$PWDFILE is not writable."
X	exit 1
Xfi
X
X###  Next line is for standard SYSV
Xecho "$LOGNAME:$PASSWD:$UID:$GID:$NAME:$HOMEDIR:$LOGSHELL" >> $PWDFILE
Xrcde=$?
X
X###  Next Line is for the SUN
X#$ECHO "/^+/i\\" > /tmp/adduser.script
X#$ECHO "$LOGNAME:$PASSWD:$UID:$GID:$NAME:$HOMEDIR:$LOGSHELL" >> /tmp/adduser.script
X#sed -f /tmp/adduser.script $PWDFILE > /tmp/newpasswd
X#cp /tmp/newpasswd $PWDFILE
X#rm -f /tmp/adduser.script
X#rm -f /tmp/newpasswd
X
Xif [ $rcde -ne 0 ]
X   then echo "[$rcde]  Unable to add entry to $PWDFILE"
X	exit 1
Xfi
X###	Now that the entry has been added to the password file
X###	we can chown the home directory
Xchown $LOGNAME $HOMEDIR		
Xchgrp $GROUP $HOMEDIR
Xchmod 755 $HOMEDIR
X
X
X
X###
X### Create .profile
X###
X
Xif [ -n "$DPROFILE" ]
X   then	MenuMsg `tput lines` 0 "Setting up the .profile."
Xfi
XNEWPROFILE=yes
Xif [ -f $HOMEDIR/.profile ]
X   then	reply=`MenuPrompt \`tput lines\` 0 "A .profile already exists in $HOMEDIR.  Okay to use it. (y/n) ?  "`
X	if [ "$reply" = "y" ]
X   	   then NEWPROFILE=no
X		MenuMsg `tput lines` 0 "Using existing .profile."
X	   else rm -f "$HOMEDIR/.profile"
X	fi
Xfi
X
Xif [ "$NEWPROFILE" = "yes" -a -n "$DPROFILE" ]
X   then	MenuMsg `tput lines` 0 "Creating new .profile."
X	###  set default printer LPDEST
X	if [ -n "$PRINTER" ]
X	   then	sed "s/^LPDEST=local/LPDEST=$PRINTER/" $DPROFILE > $HOMEDIR/.profile
X	   else	cp $DPROFILE $HOMEDIR/.profile
X	fi
X	chown $LOGNAME $HOMEDIR/.profile
X	chgrp $GROUP $HOMEDIR/.profile
X	chmod 755 $HOMEDIR/.profile
X	chown $LOGNAME $HOMEDIR/.profile
X   	MenuMsg `tput lines` 0 ".profile added for $LOGNAME."
Xfi
X
X
X
X
X###
X### Create bin in HOMEDIR
X###
X
XMenuMsg `tput lines` 0 "Setting up the bin directory."
Xif [ -d $HOMEDIR/bin ]
X   then MenuMsg `tput lines` 0 "A bin directory already exists."
X   else MenuMsg `tput lines` 0 "Making direcotry $HOMEDIR/bin."
X	mkdir $HOMEDIR/bin
X	chown $LOGNAME $HOMEDIR/bin
X	chgrp $GROUP $HOMEDIR/bin
X	chmod 755 $HOMEDIR/bin
X	chown $LOGNAME $HOMEDIR/bin
X   	MenuMsg `tput lines` 0 "Bin directory added for $LOGNAME."
Xfi
X
X
X
X###
X###  Grant Database Permissions
X###
X
X#DBPATH=/prod/date.d; export DBPATH
X#/usr/informix/bin/isql - - <<END
X#database dateme;
X#grant select on techs to $LOGNAME;
X#grant insert on techs to $LOGNAME;
X#grant update on techs to $LOGNAME;
X#grant delete on techs to $LOGNAME;
X#grant connect to $LOGNAME;
X#END
X
Xecho "$LOGNAME added."
Xexit 1
SHAR_EOF
echo "File utilities.d/m.d/adduser is complete"
chmod 6755 utilities.d/m.d/adduser || echo "restore of utilities.d/m.d/adduser fails"
echo "x - extracting utilities.d/m.d/adduser.old (Text)"
sed 's/^X//' << 'SHAR_EOF' > utilities.d/m.d/adduser.old &&
X#! /bin/ksh
X# %W%   DeltaDate %G%   ExtrDate %H%
X
X###  adduser
X###	Add a new user login to the system.
X###	This script is designed to be run from the menu(1) program.
X###	Menu script file is sadmin.m
X###	This script needs to be run with a set uid to root program.  You
X###	pick the one you want to use.
X###
X###  Arguments:
X###	$1 = login ID
X###	$2 = encrypted password
X###	$3 = numerical user ID
X###	$4 = numerical group ID
X###	$5 = Text (Users Read Name)
X###	$6 = directory to create users home directory in
X###	$7 = program to use as Shell
X###	$8 = default .profile for user
X###	$9 = default printer
X###
X###  Note:
X###  	In order to get chgrp to work you need to chown to $LOGNAME first.
X###  	The setuid does not work for chgrp ????
X###
X
X###	Validate argument count
Xif [ $# -ne 9 ]
X   then	exit 1
Xfi
X
XLOGNAME=$1
XPASSWD=$2
XUID=$3
XGID=$4
XNAME=$5
XHOMEDIR=$6/$LOGNAME
XLOGSHELL=$7
XDPROFILE=$8
XPRINTER=$9
X
XPWDFILE=/etc/passwd
XGROUPFILE=/etc/group
XECHO=/bin/echo
X
X#stty sane erase '^h' echoe isig
X
Xtrap "$ECHO 'Adduser aborted.\nPress [ Return ] to continue...\c'; read reply; exit" 2 3 15
X
X$ECHO "\n"
X
Xif grep '^'$LOGNAME: $PWDFILE > /dev/null 2>&1
X   then $ECHO "Logname $LOGNAME is already in use."
X	$ECHO "Please try another."
X	$ECHO "Press [ Return ] to continue...\c"
X	read reply
X	exit 0
Xfi
X
XGROUP=`awk 'BEGIN{FS=":"} {if($3 == g) print $1}' g=$GID $GROUPFILE`
X
X
X
X$ECHO "Logname:         $LOGNAME"
X$ECHO "Default Passwd:  $PASSWD"
X$ECHO "Real name:       $NAME"
X$ECHO "User id:         $UID"
X$ECHO "Group:           $GROUP"
X$ECHO "Group number:    $GID"
X$ECHO "Home directory:  $HOMEDIR"
X$ECHO "Default Printer: $PRINTER"
X	
X#$ECHO "\nDatabase Permissions:"
X#$ECHO "\tService Rep: $rep"
X	
X$ECHO "\nOkay to add (y/n)? \c"
Xread reply
X
X$ECHO "\n"
Xif [ "$reply" = "y" ]
X   then trap "$ECHO 'Too late to abort adduser!'" 2 3 15
X	$ECHO "Adding entry to $PWDFILE"
X	###  Next line is for standard SYSV
X	$ECHO "$LOGNAME:$PASSWD:$UID:$GID:$NAME:$HOMEDIR:$LOGSHELL" >> $PWDFILE
X	if [ $? -ne 0 ]
X	   then	$ECHO "Unable to add entry to $PWDFILE"
X		$ECHO "Aborting add new user."
X		$ECHO "Press [ Return ] to continue...\c"
X		read reply
X		exit 0
X	fi
X	###  Next Line is for the SUN
X#	$ECHO "/^+/i\\" > /tmp/adduser.script
X#	$ECHO "$LOGNAME:$PASSWD:$UID:$GID:$NAME:$HOMEDIR:$LOGSHELL" >> /tmp/adduser.script
X#	sed -f /tmp/adduser.script $PWDFILE > /tmp/newpasswd
X#	cp /tmp/newpasswd $PWDFILE
X#	rm -f /tmp/adduser.script
X#	rm -f /tmp/newpasswd
X   else
X	$ECHO "$LOGNAME not added."
X	exit
Xfi
X
X
X###	Make home directory
XMAKEDIR=yes
Xif [ -s $HOMEDIR ]
X   then $ECHO "Warning: $HOMEDIR exists. Okay to use it (y/n)? \c"
X	read reply
X	if [ "$reply" = "y" ]
X	   then MAKEDIR=no
X	fi
Xfi
Xif [ "$MAKEDIR" = "yes" ]
X   then	mkdir $HOMEDIR
X	if [ $? -ne 0 ]
X	   then $ECHO "Could not create $HOMEDIR."
X		$ECHO "Aborting adduser."
X		$ECHO "Removing entry in $PWDFILE"
X		sed -e "/^$LOGNAME:/D" $PWDFILE > /tmp/passwd
X	  	if [ $? -ne 0 ]
X 	       	   then	$ECHO "Unable to delete entry from password file."
X	  		exit
X		   else chmod 744 $PWDFILE
X	  		cp /tmp/passwd $PWDFILE
X			rm -f /tmp/passwd
X		fi
X		$ECHO "Press [ Return ] to continue...\c"
X		read reply
X		exit
X	fi
Xfi
X# Correct mode of HOMEDIR
Xchown $LOGNAME $HOMEDIR
X/bin/chgrp $GROUP $HOMEDIR
X/bin/chmod 754 $HOMEDIR
Xchown $LOGNAME $HOMEDIR
X
X
X
X###
X###  If there is no .profile in HOMEDIR
X###     then  Copy default .profile to HOMEDIR
X###
X
Xif [ -f $HOMEDIR/.profile ]
X   then	$ECHO "A .profile already exists in $HOMEDIR."
X   else
X	if [ -f $DPROFILE ]
X	   then	$ECHO "Placing a .profile in $HOMEDIR"
X		###  Next line is used to set default printer LPDEST
X		if [ "$PRINTER" != "NULL" ]
X			# fix this
X		   then	sed "s/^LPDEST=local/LPDEST=$PRINTER/" $DPROFILE > $HOMEDIR/.profile
X		   else	cp $DPROFILE $HOMEDIR/.profile
X		fi
X		chown $LOGNAME $HOMEDIR/.profile
X		/bin/chgrp $GROUP $HOMEDIR/.profile
X		/bin/chmod 754 $HOMEDIR/.profile
X		chown $LOGNAME $HOMEDIR/.profile
X		$ECHO "Default .profile added for $LOGNAME."
X	   else	$ECHO "The default .profile ($DPROFILE) was not found."
X	fi
Xfi
X
X
X
X###
X### Create bin in HOMEDIR
X###
X
Xif [ -d $HOMEDIR/bin ]
X   then	$ECHO "A bin directory already exists."
X   else 
X	$ECHO "Making directory $HOMEDIR/bin"
X	mkdir $HOMEDIR/bin
X	chown $LOGNAME $HOMEDIR/bin
X	/bin/chgrp $GROUP $HOMEDIR/bin
X	/bin/chmod 755 $HOMEDIR/bin
X	chown $LOGNAME $HOMEDIR/bin
X	$ECHO "Bin directory added for $LOGNAME."
Xfi
X
X
X
X###
X###  Grant Database Permissions
X###
X
X#DBPATH=/prod/date.d; export DBPATH
X#/usr/informix/bin/isql - - <<END
X#database dateme;
X#grant select on techs to $LOGNAME;
X#grant insert on techs to $LOGNAME;
X#grant update on techs to $LOGNAME;
X#grant delete on techs to $LOGNAME;
X#grant connect to $LOGNAME;
X#END
X
X$ECHO "$LOGNAME added."
X$ECHO "Press [ Return ] to continue...\c"
Xread reply
SHAR_EOF
chmod 6755 utilities.d/m.d/adduser.old || echo "restore of utilities.d/m.d/adduser.old fails"
echo "x - extracting utilities.d/m.d/deluser (Text)"
sed 's/^X//' << 'SHAR_EOF' > utilities.d/m.d/deluser &&
X#! /usr/lbin/ksh
X# @(#)deluser.sh	1.1   DeltaDate 12/31/87   ExtrDate 12/31/87
X###
X###  You need to chown all files in the home directory you want to delete
X###  to $LOGNAME before you can remove the home directory.
X###
X
XLOGNAME=$1
XECHO=echo
XUIDBASE=2000
X
Xtrap "$ECHO 'Deluser aborted.'; exit 1" 2 3 15
X
Xtput clear
X#stty sane erase '^h' echoe isig
X
X
X
Xcase $LOGNAME in
X   dateme|pjc|root|nobody|daemon|sys|bin|uucp|nuucp|news|informix|telic|cadsys)
X	$ECHO "Sorry, You don't have permission to delete that one."
X	continue
X	;;
Xesac
X
X###
X### Check for validity - listed in password file.
X###
Xif grep '^'$LOGNAME: /etc/passwd > /dev/null 2>&1
X   then
X	### Extract data for this user and display.
X       	setthem=`sed -n "s/^$LOGNAME:\(.*\):\(.*\):\(.*\):\(.*\):\(.*\):\(.*\)/passwd=\1;uid=\2;gid=\3;realname='\4';homedir=\5;shell=\6/p" /etc/passwd`
X       	eval $setthem
X       	group=`awk 'BEGIN{FS=":"} {if($3 == g) print $1}' g=$gid /etc/group`
X
X	###
X	###  uid must be >= UIDBASE
X	###
X	if [ "$uid" -lt $UIDBASE ]
X   	   then	$ECHO "Sorry, You don't have permission to delete that one."
X   		continue
X	fi
X
X	$ECHO "\nLogname:           $LOGNAME"
X	$ECHO "Real name:         $realname"
X       	$ECHO "User id:           $uid"
X       	$ECHO "Group:             $group"
X       	$ECHO "Group number:      $gid"
X       	$ECHO "Home directory:    $homedir"
X	$ECHO "\n\n"
X       	break
X   else
X	$ECHO "$LOGNAME is not listed in the password file. Try again."
X	read reply
Xfi
X
X
X
Xwhile true
Xdo
X	$ECHO "Do you wish to delete this user from the system  (y/n):  \c"
X   	read reply
X
X   	case $reply in
X	   n|N)	break ;;
X     	   y|Y)
X		if [ "$homedir" != "/prod/date.d/cadsys.d" ]
X	   	   then
X			###  Not a Service Rep
X			###  Service Reps never had permission here
X			DBPATH=/prod/date.d
X			export DBPATH
X/usr/informix/bin/isql - - <<END
Xdatabase dateme;
Xrevoke all on techs from $LOGNAME;
Xrevoke all on turfs from $LOGNAME;
Xrevoke all on techtime from $LOGNAME;
Xrevoke all on factors from $LOGNAME;
Xrevoke all on turfs from $LOGNAME;
XEND
X		fi
X		DBPATH=/prod/date.d/cadsys.d
X		export DBPATH
X/usr/informix/bin/isql - - <<END
Xdatabase cadsys;
Xrevoke all on appt from $LOGNAME;
Xrevoke all on grid from $LOGNAME;
Xrevoke all on syserror from $LOGNAME;
Xrevoke all on appt_time from $LOGNAME;
Xrevoke all on sorder from $LOGNAME;
Xrevoke all on sysdeflt from $LOGNAME;
Xrevoke connect from $LOGNAME;
XEND
X			sed -e "/^$LOGNAME:/D" /etc/passwd > /tmp/passwd
X	  		if [ $? -ne 0 ]
X 	    	   	   then	$ECHO "Unable to delete from password file."
X		  		exit
X	  		fi
X	  		chmod 744 /etc/passwd
X	  		cp /tmp/passwd /etc/passwd
X
X			###
X			###  CUSTOMIZE
X			###  if this is a service rep we don't want to remove homedir
X			###
X			if [ "$homedir" != "/prod/date.d/cadsys.d" ]
X		   	   then
X	  			find $homedir -exec /etc/chown $LOGNAME {} \;
X	  			rm -r $homedir
X			fi
X	  		$ECHO "\nUser removed from system."
X	  		break;
X	  		;;
X     	   	   *)	$ECHO "Invalid reply."
X          		continue ;;
X   		esac
SHAR_EOF
chmod 0777 utilities.d/m.d/deluser || echo "restore of utilities.d/m.d/deluser fails"
echo "x - extracting utilities.d/m.d/junk (Text)"
sed 's/^X//' << 'SHAR_EOF' > utilities.d/m.d/junk &&
X			sed -e "/^$LOGNAME:/D" /etc/passwd > /tmp/passwd
SHAR_EOF
chmod 0644 utilities.d/m.d/junk || echo "restore of utilities.d/m.d/junk fails"
echo "x - extracting utilities.d/m.d/junk.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > utilities.d/m.d/junk.m &&
X###
X###   	.POPMENU
X###	Printer Selection Menu
X###
X
X.TITLE
XPrinter Menu
X
X.TEXT 23 0
XSelect A Printer.
X
X.SETENV BELL LPDEST=srv4e_700ps  Printer (srv4e_700ps) selected.
Xsrv4e_700ps
X
X.SETENV BELL LPDEST=srv4e_700dm  Printer (srv4e_700dm) selected.
Xsrv4e_700dm
X
X.SETENV BELL LPDEST=srv4e_811a  Printer (srv4e_811a) selected.
Xsrv4e_811a
X
X.SETENV BELL LPDEST=srv4e_760c  Printer (srv4e_760c) selected.
Xsrv4e_760c
SHAR_EOF
chmod 0644 utilities.d/m.d/junk.m || echo "restore of utilities.d/m.d/junk.m fails"
echo "x - extracting utilities.d/m.d/passwdsrn.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > utilities.d/m.d/passwdsrn.m &&
X.DEFINE_SCREEN passwdsrn
X	window_title = "Password Screen"
X	window_rows = 5
X	window_cols = 26
X	exit_last_field
X
X	field_name = $PASSWD
X	field_label = Password
X	field_row = 2
X	field_col = 12
X	field_length = 8
X	field_edits = PROTECT
X	field_prompt = "Enter password."
XENDSCREEN
SHAR_EOF
chmod 0644 utilities.d/m.d/passwdsrn.m || echo "restore of utilities.d/m.d/passwdsrn.m fails"
echo "x - extracting utilities.d/m.d/printer2.sh (Text)"
sed 's/^X//' << 'SHAR_EOF' > utilities.d/m.d/printer2.sh &&
XFrom uucp Tue Nov 28 16:07 PST 1989
X>From uucp Tue Nov 28 15:56 PST 1989 remote from pacbell
X>From srv.PacBell.COM!pjcondie  Tue Nov 28 14:35:31 1989 remote from mother
XReceived: from pbuddy.srv.PacBell.COM (pbuddy-gw) by srv.PacBell.COM (4.0/SMI-4.0)
X	id AA17298; Tue, 28 Nov 89 14:35:31 PST
XReceived: from lacm2.srv.PacBell.COM by pbuddy.srv.PacBell.COM (4.0/SMI-4.0)
X	id AA02251; Tue, 28 Nov 89 14:37:38 PST
XDate: Tue, 28 Nov 89 14:37:38 PST
XFrom: pjcondie at srv.PacBell.COM (Paul J. Condie)
XMessage-Id: <8911282237.AA02251 at pbuddy.srv.PacBell.COM>
XTo: pcbox!pjc
XSubject: Re:  printers.sh
XStatus: R
X
X
X----- Begin Included Message -----
X
X>From pbear2!ssl Tue Nov 28 14:31:29 1989
XSubject: printers.sh
XTo: pjc (Paul J. Condie(baer))
XX-Mailer: ELM [version 2.2 PL0]
X
X###
X###   	Build lpoptions.m from lpoptions.menu
X###	Printer Selection Menu
X###
X
XDUMMY="zzzzzzzz"			# end-of-list marker
X
Xsetprinters() {				# make a function
Xlpstat -a | grep accept | cut -d' ' -f1 | ( sort ; echo $DUMMY ) |
Xfor i in `cat`
Xdo
X	if [ $i = $DUMMY ]		# hit last one?
X	then
X		echo $PRINTERS
X	fi
X	PRINTERS=$PRINTERS","$i		# concat
Xdone ; }
X
XPRINTERS=$LPDEST`setprinters`		# now build it
Xsed -e s/\$PRINTERS/$PRINTERS/ $BVPS/misc/lpoptions.menu > lpoptions.m
X
X
X----- End Included Message -----
X
X
X
SHAR_EOF
chmod 0644 utilities.d/m.d/printer2.sh || echo "restore of utilities.d/m.d/printer2.sh fails"
echo "x - extracting utilities.d/m.d/printers.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > utilities.d/m.d/printers.m &&
X###
X###   	.POPMENU
X###	Printer Selection Menu
X###
X
X.TITLE
XPrinter Menu
X
X.TEXT 23 0
XSelect A Printer.
X
X.SETENV BELL LPDEST=srv4e_700ps  Printer (srv4e_700ps) selected.
Xsrv4e_700ps
X
X.SETENV BELL LPDEST=srv4e_700dm  Printer (srv4e_700dm) selected.
Xsrv4e_700dm
X
X.SETENV BELL LPDEST=srv4e_811a  Printer (srv4e_811a) selected.
Xsrv4e_811a
X
X.SETENV BELL LPDEST=srv4e_760c  Printer (srv4e_760c) selected.
Xsrv4e_760c
X
X.POPMENU printers.m
XPOP
SHAR_EOF
chmod 0644 utilities.d/m.d/printers.m || echo "restore of utilities.d/m.d/printers.m fails"
echo "x - extracting utilities.d/m.d/printers.sh (Text)"
sed 's/^X//' << 'SHAR_EOF' > utilities.d/m.d/printers.sh &&
X###
X###   	Build a .POPMENU
X###	Printer Selection Menu
X###
X
Xecho ".TITLE" > printers.m
Xecho "Printer Menu" >> printers.m
X
Xecho ".TEXT 23 0" >> printers.m
Xecho "Select A Printer." >> printers.m
X
Xlpstat -p | awk '{ print $2 }' |
Xfor i in `cat`
Xdo
X	echo ".SETENV BELL LPDEST=$i  Printer ($i) selected." >> printers.m
X	echo "$i" >> printers.m
Xdone
SHAR_EOF
chmod 0755 utilities.d/m.d/printers.sh || echo "restore of utilities.d/m.d/printers.sh fails"
echo "x - extracting utilities.d/m.d/reportsrn.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > utilities.d/m.d/reportsrn.m &&
X###	Screen to prompt user for report options.
X###	Fields:
X###		$FDATE    - From date.
X###		$TDATE    - To date.
X###		$PRIORITY - Priority
X###		$LPDEST   - Printer Destination
X###		$TARGET   - Print to terminal or printer.
X
X.DEFINE_SCREEN reportsrn
X	window_title = "REPORT OPTIONS"
X	window_rows = 10
X	window_cols = 28
X
X	###	$FDATE - From date.
X
X	field_name = $FDATE
X	field_label = From
X	field_row = 2
X	field_col = 13
X	field_length = 6
X	field_type = DATE
X	field_mask = "MM/DD/YY"
X	field_mustenter
X	field_prompt = "Enter starting date."
X
X	###	$TDATE - To date.
X
X	field_name = $TDATE
X	field_label = To
X	field_row = 3
X	field_col = 13
X	field_length = 6
X	field_type = DATE
X	field_mask = "MM/DD/YY"
X	field_mustenter
X	field_prompt = "Enter starting date."
X
X	field_name = $PRIORITY
X	field_label = Priority
X	field_row = 5
X	field_col = 13
X	field_length = 6
X	field_type = MENU
X	field_range = "LOW,MEDIUM,HIGH"
X	field_prompt = "Select priority level."
X
X	field_name = $LPDEST
X	field_label = Printer
X	field_row = 6
X	field_col = 13
X	field_length = 11
X	field_type = SET
X	field_range = "srv4e_700ps,srv4e_811a"
X	field_prompt = "Select printer."
X
X	field_name = $TARGET
X	field_label = "Print To"
X	field_row = 7
X	field_col = 13
X	field_length = 8
X	field_type = SET
X	field_range = "TERMINAL,PRINTER,BOTH"
X	field_prompt = "Print to terminal or printer."
XENDSCREEN
SHAR_EOF
chmod 0644 utilities.d/m.d/reportsrn.m || echo "restore of utilities.d/m.d/reportsrn.m fails"
echo "x - extracting utilities.d/m.d/sadmin.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > utilities.d/m.d/sadmin.m &&
X###	sadmin.m
X###	System administration menu(1) script file.
X###
X###  Contains:
X###	Add New User To System.
X###	Remove User From System.
X
XGROUP=users				# default group for new users
XHOMEDIRS=/tmp				# where to make home dir for new users
XPRINTER=""				# default printer destination
XDPROFILE=				# skeleton .profile for new users
XLOGSHELL=/bin/ksh			# default login shell for new users
XPASSWDAGE=",O/"				# password entry for new users
XUIDBASE=1000				# new users uid start from here
X
XPWDFILE=/etc/passwd			# password file
XGROUPFILE=/etc/group
X
X.TITLE
X$LOGNAME ...System Administration...$DATE
X.TITLE
X...Menu...$TIME
X.LINE
X
X.GETINPUT adduser
XAdd New User To System.
X
X.GETINPUT deluser
XRemove User From System.
X
X.GETINPUT dbapermissions
XSet Database Permissions.
X
X
X
X###	Screen Definitions
X
X.DEFINE_SCREEN adduser
X	exit_on_cancel
X	after_screen = "adduser \"$logname\" \"$PASSWDAGE\" \"$UID\" \"$GID\" \
X				\"$realname\" \"$HOMEDIR\" \"$LOGSHELL\" \
X				\"$DPROFILE\" \"$PRINTER\" \"$PWDFILE\" \
X				\"$GROUPFILE\"
X			exit $?"
X
X	field_name = $logname
X	field_label = "Login Name"
X	field_row = 2, field_col = 19
X	field_length = 8
X	field_type = ALPHANUM, field_mask = "A       "
X	field_min = 3
X	field_mustenter
X	### make sure logname is unique and tag on logname to homedirs
X	after_field = "grep $logname $PWDFILE >/dev/null 2>/dev/null
X			if [ $? -eq 0 ]
X			   then echo \"Login already exists.\"
X				exit 1
X			   else echo \"\$HOMEDIR=$HOMEDIRS/$logname\"
X				exit 0
X			fi"
X
X	field_name = $realname
X	field_label = "Real Name"
X	field_row = 3, field_col = 19
X	field_length = 25
X	field_type = ALPHANUM
X	field_mustenter
X
X	field_name = $UID
X	field_label = "User ID"
X	field_row = 4, field_col = 19
X	field_length = 5
X	field_noinput
X	field_terminator = "  "
X
X	field_name = $GROUP
X	field_label = "Group"
X	field_row = 5, field_col = 19
X	field_length = 10
X	field_noinput
X	field_terminator = "  "
X
X	field_name = $GID
X	field_label = "Group ID"
X	field_row = 6, field_col = 19
X	field_length = 5
X	field_noinput
X	field_terminator = "  "
X
X	field_name = $HOMEDIR
X	field_label = "Home Directory"
X	field_row = 7, field_col = 19
X	field_length = 25
X	field_noinput
X	field_terminator = "  "
X
X	field_name = $PRINTER
X	field_label = "Default Printer"
X	field_row = 8, field_col = 19
X	field_type = MENU
X	### build field_range based on available printers
X	field_range = "`lpstat -p | awk '{ print $2 }' |
X			for printer in `cat`
X			do
X				if [ \"$printer\" = \"unknown\" ]
X				   then continue
X				fi
X				if [ -z \"$RANGEVALUES\" ]
X	   	   		   then RANGEVALUES=$printer
X	   	   		   else RANGEVALUES=\"$RANGEVALUES,$printer\"
X				fi
X				echo $RANGEVALUES > /tmp/menu.tmpfile
X			done
X			cat /tmp/menu.tmpfile`"
X
X	### get next unused uid greater than UIDBASE from password file
X	### get gid from group file using GROUP
X	field_defaults = "UID=`awk 'BEGIN{ FS=\":\" } { x[$3] = 1 } END \
X		{ i = UIDBASE; while (x[i] == 1) { ++i }; print i }' \
X			UIDBASE=$UIDBASE $PWDFILE`
X		GID=`awk 'BEGIN{FS=\":\"} {if($1 == g) print $3}' g=$GROUP \
X			$GROUPFILE`
X		echo \\"\\" \\"\\" $UID $GROUP $GID $HOMEDIRS \\"$PRINTER\\""
XENDSCREEN
X
X
X
X.DEFINE_SCREEN deluser
X	exit_on_cancel
X	after_screen = "deluser \"$logname\" \"$PWDFILE\"
X			exit $?"
X
X	field_name = $logname
X	field_label = "Login Name"
X	field_row = 2, field_col = 19
X	field_length = 8
X	field_type = ALPHANUM, field_mask = "A       "
X	field_min = 3
X	field_mustenter
X	### make sure logname exists and set other fields
X	after_field = "grep $logname $PWDFILE >/dev/null 2>/dev/null
X		if [ $? -ne 0 ]
X	   	   then	echo \"Login not found.\"
X			exit 1
X		fi
X       		setthem=`sed -n \"s/^$logname:\(.*\):\(.*\):\(.*\):\(.*\):\(.*\):\(.*\)/passwd=\1;uid=\2;gid=\3;realname='\4';homedir=\5;shell=\6/p\" /etc/passwd`
X       	eval $setthem
X       	group=`awk 'BEGIN{FS=\":\"} {if($3 == g) print $1}' g=$gid /etc/group`
X	if [ \"$uid\" -lt $UIDBASE ]
X   	   then	echo \"Sorry, You don't have permission to delete that one.\"
X   		exit 1
X	fi
X	echo \"$logname\" \"$realname\" \"$uid\" \"$group\" \"$gid\" \"$homedir\"
X	exit 0"
X
X	field_name = $realname
X	field_label = "Real Name"
X	field_row = 3, field_col = 19
X	field_length = 25
X	field_type = ALPHANUM
X	field_noinput
X	field_terminator = "  "
X
X	field_name = $UID
X	field_label = "User ID"
X	field_row = 4, field_col = 19
X	field_length = 5
X	field_noinput
X	field_terminator = "  "
X
X	field_name = $GROUP
X	field_label = "Group"
X	field_row = 5, field_col = 19
X	field_length = 10
X	field_noinput
X	field_terminator = "  "
X
X	field_name = $GID
X	field_label = "Group ID"
X	field_row = 6, field_col = 19
X	field_length = 5
X	field_noinput
X	field_terminator = "  "
X
X	field_name = $HOMEDIR
X	field_label = "Home Directory"
X	field_row = 7, field_col = 19
X	field_length = 25
X	field_noinput
X	field_terminator = "  "
X
X	field_name = $DELETE
X	field_label = "Delete"
X	field_row = 9, field_col = 19
X	field_range = "YES,NO"
X	field_edits = SET
X
X
X	field_defaults = "echo \\"\\" \\"\\" \\"\\" \\"\\" \\"\\""
XENDSCREEN
X
X
X.DEFINE_SCREEN dbapermissions
X	after_screen = "setdbaperm hits he"
X
X	### Column Headings
X	text = 2 3 "\UUsers\N"
X	text = 2 16 "\USelect\N"
X	text = 2 23 "\UUpdate\N"
X	text = 2 30 "\UInsert\N"
X	text = 2 37 "\UDelete\N"
X	text = 2 44 "\UIndex\N"
X	text = 2 51 "\UAlter\N"
X
X	### Retrieve current database permissions
X	### Save for latter comparison on what logins got changed.
X	### Set variables with current permissions
X	field_defaults = "LINECNT=0
X			DATA=\"\"
X			isql hits - <<-END 2> /dev/null | tee -a /tmp/tmpfile2 |
X				info tables access for he;
XEND
X			for i in `cat`
X			do
X				LINECNT=`expr $LINECNT + 1`
X				[ $LINECNT -le 7 ] && continue
X				DATA=\"$DATA $i\"
X				echo $DATA > /tmp/menu.tmpfile
X			done
X			cat /tmp/menu.tmpfile"
X
X	field_name = $USER[0]
X	field_row = 3, field_col = 3
X	field_length = 10
X	field_edits = ALPHANUM
X	after_field = "[ \"${USER[0]}\" = \"public\" ] && exit 0
X		[ \"${USER[0]}\" = \"\" ] && exit 0
X		grep \"${USER[0]}\" $PWDFILE >/dev/null 2>/dev/null
X		if [ $? -ne 0 ]
X	   	   then	echo \"Login not found.\"
X			exit 1
X		   else exit 0
X		fi"
X
X	field_name = $SELECT[0]
X	field_row = 3, field_col = 17
X	field_edits = SET
X	field_range = ",All,No"
X
X	field_name = $UPDATE[0]
X	field_row = 3, field_col = 24
X	field_edits = SET
X	field_range = ",All,No"
X
X	field_name = $INSERT[0]
X	field_row = 3, field_col = 31
X	field_edits = SET
X	field_range = ",Yes,No"
X
X	field_name = $DELETE[0]
X	field_row = 3, field_col = 38
X	field_edits = SET
X	field_range = ",Yes,No"
X
X	field_name = $INDEX[0]
X	field_row = 3, field_col = 45
X	field_edits = SET
X	field_range = ",Yes,No"
X
X	field_name = $ALTER[0]
X	field_row = 3, field_col = 52
X	field_edits = SET
X	field_range = ",Yes,No"
X
X	field_name = $USER[1]
X	field_row = 4, field_col = 3
X	field_length = 10
X	field_edits = ALPHANUM
X	### accept public login
X	after_field = "[ \"${USER[1]}\" = \"public\" ] && exit 0
X		[ \"${USER[1]}\" = \"\" ] && exit 0
X		grep \"${USER[1]}\" $PWDFILE >/dev/null 2>/dev/null
X		if [ $? -ne 0 ]
X	   	   then	echo \"Login not found.\"
X			exit 1
X		   else [ \"${SELECT[1]}\" = \"\" ] && echo \"\$SELECT[1]=All \$UPDATE[1]=No \$INSERT[1]=No \$DELETE[1]=No \$INDEX[1]=No \$ALTER[1]=No\"
X			exit 0
X		fi"
X
X	field_name = $SELECT[1]
X	field_row = 4, field_col = 17
X	field_edits = SET
X	field_range = ",All,No"
X
X	field_name = $UPDATE[1]
X	field_row = 4, field_col = 24
X	field_edits = SET
X	field_range = ",All,No"
X
X	field_name = $INSERT[1]
X	field_row = 4, field_col = 31
X	field_edits = SET
X	field_range = ",Yes,No"
X
X	field_name = $DELETE[1]
X	field_row = 4, field_col = 38
X	field_edits = SET
X	field_range = ",Yes,No"
X
X	field_name = $INDEX[1]
X	field_row = 4, field_col = 45
X	field_edits = SET
X	field_range = ",Yes,No"
X
X	field_name = $ALTER[1]
X	field_row = 4, field_col = 52
X	field_edits = SET
X	field_range = ",Yes,No"
XENDSCREEN
SHAR_EOF
chmod 0644 utilities.d/m.d/sadmin.m || echo "restore of utilities.d/m.d/sadmin.m fails"
echo "x - extracting utilities.d/m.d/sample.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > utilities.d/m.d/sample.m &&
X### 	Sample.Menu
X###	A sample menu script file.
X
X.TITLE
X$LOGNAME ...SAMPLE...$DATE
X.TITLE
X$MAIL...MENU...$TIME
X.LINE
X
X.GNAME sample sample.m
X
X.INCLUDE reportsrn.m
X.INCLUDE passwdsrn.m
X
X.TEXT 22 61
X"?" for help :
X
X.SYSTEM echo "Press [ ^d ] to return to menu ..."; ksh
XUnix System.
X
X.SYSTEM who; \
X	echo "Press [ Return ] to continue ..."; \
X	read reply
XShow Who Is On The System.
X
X.SYSTEM more sample.m; echo "Press [ Return ] to continue ...\c"; read reply
XDisplay sample.m script file.
X
X.POPMENU printers.m
XSelect Printer Menu ($LPDEST).
X
X.GETINPUT reportsrn
XA Sample GETINPUT Screen.
X
X.GETINPUT passwdsrn
XA Sample Password Screen.
X
X.SPACE
X
X.EXIT
XExit Menu Program.
SHAR_EOF
chmod 0644 utilities.d/m.d/sample.m || echo "restore of utilities.d/m.d/sample.m fails"
echo "x - extracting utilities.d/m.d/setdbaperm (Text)"
sed 's/^X//' << 'SHAR_EOF' > utilities.d/m.d/setdbaperm &&
X#!/bin/ksh
X
X###	$1	- database
X###	$2	- table name
X
X[ $# -ne 2 ] && exit 1			# validate argument count
X
XDATABASE=$1
XTABLE=$2
XTMPFILE=/tmp/menutmp
X
X
X#  Get current settings
Xisql "$DATABASE" - <<-END 2> /dev/null > $TMPFILE
X	info tables access for $TABLE;
XEND
X
X
X#  Loop through each user
Xlet i=0
Xfor dummy in "${USER[@]}"
Xdo
X	GC=""						# Grant Commands
X	grep "^${USER[i]}" $TMPFILE | read line
X	if [ $? -ne 0 ]
X	   then	# "No match "${USER[i]}" - add new login's permissions."
X		GC="${GC}grant connect to ${USER[i]};\n"
X		[ "${SELECT[i]}" = "All" ] && 
X			GC="${GC}grant select on $TABLE to ${USER[i]};\n"
X		[ "${UPDATE[i]}" = "All" ] && 
X			GC="${GC}grant update on $TABLE to ${USER[i]};\n"
X		[ "${INSERT[i]}" = "Yes" ] && 
X			GC="${GC}grant insert on $TABLE to ${USER[i]};\n"
X		[ "${DELETE[i]}" = "Yes" ] && 
X			GC="${GC}grant delete on $TABLE to ${USER[i]};\n"
X		[ "${INDEX[i]}" = "Yes" ] && 
X			GC="${GC}grant index on $TABLE to ${USER[i]};\n"
X		[ "${ALTER[i]}" = "Yes" ] && 
X			GC="${GC}grant alter on $TABLE to ${USER[i]};\n"
X	   else	# "Match "${USER[i]}" - check if permissions have changed."
X		set $line
X		PUSER=$1; PSELECT=$2; PUPDATE=$3; PINSERT=$4; 
X		PDELETE=$5; PINDEX=$6; PALTER=$7
X		if [ "${SELECT[i]}" != "$PSELECT" ]
X		   then # "Select changed. $PSELECT-${SELECT[i]}"
X			[ "${SELECT[i]}" = "All" ] && 
X			    GC="${GC}grant select on $TABLE from ${USER[i]};\n"
X			[ "${SELECT[i]}" = "No" ] && 
X			    GC="${GC}revoke select on $TABLE from ${USER[i]};\n"
X		fi
X		if [ "${UPDATE[i]}" != "$PUPDATE" ]
X		   then # "Select changed. $PUPDATE-${UPDATE[i]}"
X			[ "${UPDATE[i]}" = "All" ] && 
X			    GC="${GC}grant update on $TABLE from ${USER[i]};\n"
X			[ "${UPDATE[i]}" = "No" ] && 
X			    GC="${GC}revoke update on $TABLE from ${USER[i]};\n"
X		fi
X		if [ "${INSERT[i]}" != "$PINSERT" ]
X		   then # "Select changed. $PINSERT-${INSERT[i]}"
X			[ "${INSERT[i]}" = "Yes" ] && 
X			    GC="${GC}grant insert on $TABLE from ${USER[i]};\n"
X			[ "${INSERT[i]}" = "No" ] && 
X			    GC="${GC}revoke insert on $TABLE from ${USER[i]};\n"
X		fi
X		if [ "${DELETE[i]}" != "$PDELETE" ]
X		   then # "Select changed. $PDELETE-${DELETE[i]}"
X			[ "${DELETE[i]}" = "Yes" ] && 
X			    GC="${GC}grant delete on $TABLE from ${USER[i]};\n"
X			[ "${DELETE[i]}" = "No" ] && 
X			    GC="${GC}revoke delete on $TABLE from ${USER[i]};\n"
X		fi
X		if [ "${INDEX[i]}" != "$PINDEX" ]
X		   then # "Select changed. $PINDEX-${INDEX[i]}"
X			[ "${INDEX[i]}" = "Yes" ] && 
X			    GC="${GC}grant index on $TABLE from ${USER[i]};\n"
X			[ "${INDEX[i]}" = "No" ] && 
X			    GC="${GC}revoke index on $TABLE from ${USER[i]};\n"
X		fi
X		if [ "${ALTER[i]}" != "$PALTER" ]
X		   then # "Select changed. $PALTER-${ALTER[i]}"
X			[ "${ALTER[i]}" = "Yes" ] && 
X			    GC="${GC}grant alter on $TABLE from ${USER[i]};\n"
X			[ "${ALTER[i]}" = "No" ] && 
X			    GC="${GC}revoke alter on $TABLE from ${USER[i]};\n"
X		fi
X	fi
X	echo "$GC\n" >> /tmp/grantstuff
X	let i=i+1				# increment index
Xdone
SHAR_EOF
chmod 0755 utilities.d/m.d/setdbaperm || echo "restore of utilities.d/m.d/setdbaperm fails"
echo "x - extracting utilities.d/m.d/suid_exec.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > utilities.d/m.d/suid_exec.c &&
X#include	<stdio.h>
X#include	<fcntl.h>
X#include	<sys/stat.h>
X
X#define	ROOT	0
X
Xmain (argc, argv)
X	int	argc;
X	char	*argv[];
X{
X	int		fd;
X	struct stat	sbuf;
X	char		command[200];
X	int		i;
X
X
X	if (argc < 2)
X		exit (1);
X
X	if ((fd = open (argv[1], O_RDONLY)) <= 0)
X		exit (1);				/* can't open */
X
X	/* Get file status information */
X   	if (fstat (fd, &sbuf) < 0)
X		exit (1);
X
X	/* Is this a regular file */
X	if ((sbuf.st_mode & S_IFREG) != S_IFREG)
X		exit (1);
X
X	/* does root own this file */
X	if (sbuf.st_uid != ROOT)
X		exit (1);
X
X	/* Is file executable by owner(root) */
X	if ((sbuf.st_mode & S_IEXEC) != S_IEXEC)
X		exit (1);
X
X	/* Is set uid bit on */
X	if ((sbuf.st_mode & S_ISUID) != S_ISUID)
X		exit (1);
X
X	setuid (ROOT);
X
X	strcpy (command, argv[1]);			/* program name */
X	for (i = 2; i < argc; i++)
X	{
X		strcat (command, " ");
X		strcat (command, "\"");
X		strcat (command, argv[i]);		/* program arguments */
X		strcat (command, "\"");
X	}
X
X	system (command);
X}
X/* Paul J. Condie  2-89 */
SHAR_EOF
chmod 0644 utilities.d/m.d/suid_exec.c || echo "restore of utilities.d/m.d/suid_exec.c fails"
echo "x - extracting utilities.d/msgbox.d/displaytxt.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > utilities.d/msgbox.d/displaytxt.c &&
Xstatic char Sccsid[] = "%W%   DeltaDate %G%   ExtrDate %H%";
X
X/*  FUNCTION:	displaytext()
X**		Displays a string to the screen with atributes.
X**  ARGS:	
X**		win	curses window to display to
X**		row	screen row
X**		col	screen col
X**		s	the string
X**  RETURNS:	none
X*/
X
X#include	<curses.h>
X
Xdisplaytext (win, row, col, s)
X	WINDOW	*win;
X	int	row, col;
X	char	s[];
X{
X	int	i;
X
X	wmove (win, row, col);
X
X/*
X**	Now display looking for terminal attributes.
X*/
X      for (i = 0; s[i] != '\0'; i++)
X      {
X         if (s[i] == '\\')
X	 {
X#ifdef BSD
X	    if (s[i+1] != 'N') s[i+1] = 'S';   /* Berk only supports standout */
X#endif
X            switch (s[++i])
X            {
X	       case 'n':	/* newline */
X			wmove (win, ++row, col);
X			break;
X
X	       case 'S':
X#ifdef BSD
X			wstandout (win);
X#else
X	   		wattrset (win, win->_attrs|A_STANDOUT);
X#endif
X			break;
X	       case 'B':
X#ifdef SYS5
X			wattrset (win, win->_attrs|A_BOLD);
X#endif
X			break;
X	       case 'U':
X#ifdef SYS5
X			wattrset (win, win->_attrs|A_UNDERLINE);
X#endif
X			break;
X	       case 'D':
X#ifdef SYS5
X			wattrset (win, win->_attrs|A_DIM);
X#endif
X			break;
X	       case 'R':
X#ifdef SYS5
X			wattrset (win, win->_attrs|A_REVERSE);
X#endif
X			break;
X	       case 'L':
X#ifdef SYS5
X			wattrset (win, win->_attrs|A_BLINK);
X#endif
X			break;
X	       case 'N': 
X#ifdef BSD
X			wstandend (win);
X#else
X			wattrset (win, A_NORMAL);
X#endif
X			break;
X	    }
X	 }
X         else
X            waddch (win, s[i]);
X      }
X}
SHAR_EOF
chmod 0644 utilities.d/msgbox.d/displaytxt.c || echo "restore of utilities.d/msgbox.d/displaytxt.c fails"
echo "x - extracting utilities.d/msgbox.d/makefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > utilities.d/msgbox.d/makefile &&
X###	Special function targets begin with a dot.
X###	Target name that begin with a dot are never used as the starting 
X###	target, unless specifically requested as an argument on the command
X###	line.
X
X#.SILENT:	# inhibit the display of command lines (@)
X#.IGNORE:	# ignore exit codes from command lines (-)
X
XPGM		= msgbox
XINSTALLDIR 	= 
XTARGET_ARCH	= sys5
X
XLIBS	= ../../libgeti.a -lcurses
X
X###	Flags
XINCDIR		= ../libgeti.d
XCPPFLAGS	=
XCFLAGS		= -O -I$(INCDIR)
XLDFLAGS		=
XLINTFLAGS	=
X
X###	Source Files
XPERFILES 	= 
XACEFILES	=
XCFILES		= msgbox.c
XC+FILES		=
XECFILES		=
XHFILES		=
X
XOBJECTS = $(CFILES:.c=.o)
XLINTFILES = $(SOURCES:.c=.ln)
X
X#all:	$(PGM) install
X
X###	Conditional Macro Definitions
X#debug := CFLAGS= -g
X#profile := CFLAGS= -pg -O
X
X###	Targets and Dependencies
X###	target [target ...]: [dependency ...]
X###		[command]			# target rule
X###		...
X###	* If there is no rule for a target entry, make looks for an implicit 
X###	  rule to use.
X###	* Line breaks within a rule are significant in that each command line
X###	  is performed by a separate process or shell.
X###	* Make invokes a shell to process a command line if that line contains
X###	  any shell metacharacters, (;,<,>,>>,|,...).
X###  The $@ = target name
X###	@command - inhibit the display of a given command line
X###	-command - continue processing regardless of command's exit code.
X###	- at command - works
X
X$(PGM):	$(OBJECTS)
X	$(CC) $(CFLAGS) $(OBJECTS) $(LIBS) -o $@
X	@echo 
X	size $@
X
Xclean:
Xcpio:
X
Xinstall:
X	mv *.frm $(INSTALLDIR)
X
Xlint:	$(LINTFILES)
X	$(LINT.c) $(LINTFILES)
X
Xprint:
Xshar:
X
X
X###	Implicit Rules
X###	Suffixes should be ordered from target to dependency
X###	Make scans the SUFFIXES from left to right until it finds a match.
X###	The .SUFFIXES: on a line by itself puts yours at the head of the list.
X###	ex: .o .c .c~
X###	Dynamic Macros:
X###		$@  Current target
X###		$?  List of dependencies newer than the target.
X###		$<  Name of the dependency file.
X###		$*  Basename of the current target(stripped of suffix).
X###		$%  For libraries, member being processed.
X###	Dynamic Macro Modifiers:
X###		F   Filename part  ex. $(@F)
X###		D   Directory part
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 0666 utilities.d/msgbox.d/makefile || echo "restore of utilities.d/msgbox.d/makefile fails"
echo "x - extracting utilities.d/msgbox.d/msgbox.1 (Text)"
sed 's/^X//' << 'SHAR_EOF' > utilities.d/msgbox.d/msgbox.1 &&
X. \ %W% DeltaDate %G% ExtrDate %H% 
X.po 6
X.TH MSGBOX 1 "" "Menu Utility"
X
X.SH \s9NAME\s0
Xmsgbox \- place a message in a STANDOUT bordered box; center box horizontally
X
X.SH SYNOPSIS
Xmsgbox msg [TopRow]
X
X.SH DESCRIPTION
X.I Msgbox 
Xplaces \fBmsg\fP, a message of 1 - 78 characters in a curses window bordered
Xby STANDOUT attributes.  The window, called "box" from here on, is 5 rows
Xhigh:  Row 1 - STANDOUT border; Row 2 - blank; Row 3 - \fBmsg\fP; Row 4 - blank;
XRow 5 - STANDOUT border.
X.P
XThe optional argument, \fBTopRow\fP, determines which screen row on which to
Xstart the box.  (0, 0 are assumed to be the home coordinates of the screen.)
XIf \fBTopRow\fP is omitted, non-numeric, or out of the range 0 - 19, the box
Xwill be started on row 0.
X
X.SH FILES
X/eng/lib/libgeti.a, the \fBGetInput(3X)\fP library containing drawbox()
X
X.SH AUTHOR
XR. Stephen Price
X
X.SH DIAGNOSTICS
X\fImsgbox\fP returns exit code zero if it was successful, 1 if the arg count is 
Xbad, and 2 if \fBmsg\fP length is less than 1 or greater than 78.
X
X.SH BUGS
XSTANDOUT attribute is not produced using the curses provided on Convergent
XTechnologies Mighty Frame.  The curses taken from a Convergent Technologies 
XMega Frame must be used on a Convergent Technologies Mighty Frame or S320.
SHAR_EOF
chmod 0644 utilities.d/msgbox.d/msgbox.1 || echo "restore of utilities.d/msgbox.d/msgbox.1 fails"
echo "x - extracting utilities.d/msgbox.d/msgbox.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > utilities.d/msgbox.d/msgbox.c &&
X
Xstatic char Sccsid[] = "%W%    DeltaDate %G%    ExtrDate %H%";
X
X/* msgbox.c -- Displaying a user message in a STANDOUT box (window).
X *
X *             Draw and center a curses window and place a message in the box.
X *             Center the box horizontally, making the box 2 characters
X *             wider than the message contained in argv[1].
X *             Place the top row of the box on the line indicated by argv[2]. 
X *
X *	       The box will be 5 rows in height: 
X *			border (STANDOUT)
X *			blank row
X *			message
X *			blank row
X *			border (STANDOUT)
X *
X *
X * files:      /eng/lib/libgeti.a, the GetInput library containing drawbox()
X *
X * input:      msg: argv[1] holds a message -- a string of 1 - 78 chars.
X *                 (quotation mark delimited, if there is embedded whitespace)
X *             BoxTop: argv[2] holds the screen line on which to 
X *	           start the message box.  
X *                 [This is optional.  If not given or if atoi(argv[2]) is
X *                  out of range (0-19), 0 is used.]
X *
X * output:     The MsgWind will appear with the msg on the terminal.
X *	       There will ALWAYS be a MsgWind, even if there are parameter
X *	       errors. See "exit value" below.
X *
X * exit value: Exit codes indicate execution status:
X *	       NO_ERR -- Gut, alles in ordnung!
X *             ARG_COUNT_ERR -- Failure: improper arg count (should be 2 or 3)
X *	       MSG_LEN_ERROR -- strlen(argv[2]) < 1 or > 78
X *		
X *	       The legal range of rows is 0 - 19 to fit box on screen;
X *	       If the legal range of rows is violated, 0 will be
X *	       used for BoxTop. NO_ERR exit code will be used.
X *
X *             If error, a USAGE message is displayed in the msgbox and the
X *	       appropriate non zero exit code is used.  Also a 5 second 
X *             sleep is used to preserve the USAGE msg on the terminal before
X *	       program termination.
X *
X *	       If no errors are found the user's message will appear as 
X *	       requesed and NO_ERR will be the exit value.
X *
X * note:       Will clear stdscr, since initscr() is used.
X *
X * author:     Steve Price (pacbell!pbhyf!rsp)
X *
X * bugs:       The curses on Convergent Technologies Mighty Frame does not
X *	       handle the STANDOUT attribute properly.  Use the curses from
X *             a Convergent Technologies Mega Frame, in that case.
X */
X
X
X
X
X#include <signal.h>
X#include <curses.h>
X#include "GetInput.h"
X
X
X#define MAX_ROW 19	/* last row at which a box can be started & still fit */
X#define BOX_ROWS 5	/* total height of message box */
X#define NO_ERR 0	/* it's cool, dude! */
SHAR_EOF
echo "End of part 13"
echo "File utilities.d/msgbox.d/msgbox.c is continued in part 14"
echo "14" > s2_seq_.tmp
exit 0



More information about the Alt.sources mailing list