home *** CD-ROM | disk | FTP | other *** search
-
- # %Z% %M% %I% %D% %Q%
- #
- # Copyright (C) The Santa Cruz Operation, 1988.
- # This Module contains Proprietary Information of
- # The Santa Cruz Operation, Microsoft Corporation
- # and AT&T, and should be treated as Confidential.
- #
- # MOUSCONFIG - XENIX System V busmouse configuration.
- #
-
- PATH=/etc:/bin:/usr/bin
- DIR=/usr/sys/io
- STOREL="/usr/lib/storel -DM_I386 -Mx -r -omoustmp.o"
- MOUSFILE=mousconf.asm
- MOUSOFILE=mousconf.o
- TMPFILE=/tmp/mousconfig$$
-
- # Define return values
- : ${OK=0} ${FAIL=1} ${STOP=10} ${HALT=11}
-
- cleanup="rm -rf $TMPFILE"
-
- trap 'eval $cleanup; exit $FAIL' 1 2 3 15
-
- # Prompt for yes or no answer - returns non-zero for no
- getyn() {
- while echo "\n$* (y/n) \c">&2
- do read yn rest
- case $yn in
- [yY]) return 0 ;;
- [nN]) return 1 ;;
- *) echo "Please answer y or n" >&2 ;;
- esac
- done
- }
-
- Getdfl() {
- read prm1 prm2 prm3 prm4 < $TMPFILE
- modified=
- }
- Reset() {
- prm1=0 prm2=0H
- modified=1
- }
- Getcur() {
- echo `sed -n -e '
- /@PARM/ {
- s/.*[ ]*equ[ ]*//
- s/[ ].*//
- p
- }
- ' $MOUSFILE` > $TMPFILE
- }
- Setcur() {
- ed - $MOUSFILE <<-EOF
- /@PARM1/s/equ[ ]*[^ ]*/equ $prm1/
- /@PARM2/s/equ[ ]*[^ ]*/equ $prm2/
- w
- q
- EOF
- $STOREL $MOUSFILE > /dev/null 2>&1 || {
- getyn "System configure failed. Try again?" || {
- # answered no
- echo "\nThe system should be configured in order to use a busmouse. Exiting."
- eval $cleanup
- exit $FAIL
- }
- # answered yes
- return 1
- }
- mv moustmp.o $MOUSOFILE
- }
- Showcur() {
- echo "
- Busmouse Parameters Values Comments
- ------------------- ------ --------
- 1. Interrupt Vector $prm1 logical vector number
- 2. Base Address $prm2 i/o addresses start here
-
- Zero Values Imply Auto-Configuration"
- }
-
- # beginning
- case $# in
- 0)
- ;;
- *)
- echo "USAGE: mousconfig"
- eval $cleanup
- exit $FAIL
- ;;
- esac
-
- status=0
- cd $DIR
- Getcur
- Getdfl
-
- while echo "\nBusmouse Configuration
-
- 1. Display current busmouse parameters
- 2. Modify current busmouse parameters
- 3. Select previous busmouse parameters
- 4. Select default busmouse parameters
-
- Enter an option or 'q' to quit: \c"
- do
- read ans
- case "$ans" in
- 1) Showcur
- ;;
- 2)
- Showcur
- while echo "\nEnter a parameter to modify or 'q' to return to the main menu: \c"
- do
- read y
- case "$y" in
- [1-4]) while echo "\nHexadecimal values may be entered with a trailing 'H'.
- For example, 0x0300 would be entered as 0300H.
- Enter the new value or <RETURN> to use the existing value: \c"
- do
- read z
- case "$z" in
- [0-9]*)
- eval prm$y=$z
- modified=1
- break
- ;;
- "") break
- ;;
- *) echo "Please enter a numeric value. \n"
- ;;
- esac
- done
- ;;
- [qQ]) break
- ;;
- *) echo "Please enter a choice, 1-4 or 'q'. \n"
- ;;
- esac
- done
- ;;
- 3) [ $modified ] && {
- Getdfl
- Showcur
- }
- ;;
- 4) Reset
- Showcur
- ;;
- [qQ]) [ $modified ] && Setcur
- break
- ;;
- *) echo "\nPlease enter '1', '2', '3', '4' or 'q'.\n"
- ;;
- esac
- done
- eval $cleanup
-