⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addmodems.sh

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 SH
📖 第 1 页 / 共 2 页
字号:
			echo " "			echo "A valid speed is one of the following: $SPEEDS"			echo " "			continue		}	done	## What direction is the modem used in: shared, outgoing, incoming	echo ""	while :	do		case "$MDMODEMCTRL" in		yes)				echo $MN \'Setup modem to make outgoing calls, accept incoming calls, or both.Specify "out" for outgoing, "in" for incoming, or "shared" for both.Enter "out", "in", or "shared" [shared]: '$BC			RESPONSES="out in shared"			;;		no)			echo $MN \'Setup modem to make outgoing calls or accept incoming calls.Specify "out" for outgoing, "in" for incoming.Enter "out" or "in". [out]: '$BC			RESPONSES="out in"			;;		*)	echo "Invalid modem control entry from database - error"			exit 1			;;		esac		read MDDIRECTION		case "$MDDIRECTION" in		"")	case "$MDMODEMCTRL" in			yes)					MDDIRECTION="shared"				;;			no) 				MDDIRECTION="out"			esac		;;		esac				echo "$RESPONSES" | grep -ws "$MDDIRECTION" &&		{			break	# valid response			:		}||{			echo "Inappropriate response, please try again."		}	done	## Use the first available ttyd? name for this modem	##  - except for direct connect lines (which are not modems)	case "$MDTYPE" in	direct)			MDNEWNAME=$MDLINE  # stays the same		;;	*)		set ""$TTYDNAMES		MDNEWNAME=$1	   # becomes ttyd?		shift		TTYDNAMES="$*"		;;	esac		## All done with this modem, write out entry to temp modem database	A=$MDNEWNAME B=$MDCTRLTYPE C=$MDCTRLNUM D=$MDLINENUM E=$MDMODEMCTRL	F=$MDTYPE G=$MDSPEED H=$MDDIRECTION I=$MDLINE	echo $A $B $C $D $E $F $G $H $I |	  awk  '{		printf "%-6s  %-8s  %-2s      %-2s   %-4s    %-8s %-6s  %-8s  %-8s\n",\		$1, $2, $3, $4, $5, $6, $7, $8, $9 		}' >> $MDDBTMP	## increment modem counter	echo ""	i=`expr $i + 1`done## Now verify that all information is correct, and if not we re-exec ## ourself.echo "The following table lists the information you entered for the modem(s).Look at it carefully and decide if the information is correct.  If itis not you will be given a chance to re-enter the information.MODEM INFORMATION:"RESPONSES=`   ## Build response tableecho "MODEM    MODEM   IN/OUT  TTY     CNTRL  CNTRL   LINETYPE     SPEED   SHARED  LINE    NAME   NUMBER  NUMBER------   -----   ------  -----   -----  ------  ------"awk  '{	printf "%-8s %-5s   %-6s  %-5s   %-5s    %-4s    %-4s\n",\	$6, $7, $8, $9, $2, $3, $4	}'  $MDDBTMPecho "`	## end response tableecho "$RESPONSES"while :do	echo $MN "Enter \"y\" if all the information is correct, \"n\" if you would like tostart over, \"q\" if you would like to abort adding modems, or \"?\" to re-display the table.Enter \"y\", \"n\", \"q\", or \"?\" [y]: "$BC	read buff	case "$buff" in	"" | y*)		break		;;	n*)		echo "Starting over..."		exec $MYNAME $*		## NOTREACHED		;;	"?")		echo "$RESPONSES"		;;	q*)			rm -f $MDDBTMP		exit 1		;;	esacdonecase "$MDTYPE" in direct) ;;*)## Parse /etc/remote.  If a dial entry is free we mark it as "UNUSED",## otherwise we mark it with the device type currently being used. We## are currently left with the restriction that all modems on a given## rotary (one per leaf) must be of the same type.  If this weren't## the case then all modems at a given speed could be added on for use by## tip, no questions asked. ## The remote file is parsed out as shell variable entries named:####       TIP${SPEED}=value, where value is either "UNUSED" or the acu type#### E.g.  If the entry "dial1200" already had a df112 modem on it then the##       shell variable TIP1200 would be set to "df112".eval `awk '	/^dial[0-9]*\|/ {		speed=substr($0,5,index($0,"|")-5)		if (speed != "300" && speed != "1200" \		    && speed != "2400" && speed != "9600" \		    && speed != "19200")			next  # sanity check		getline(s)  # next line has attributes we want (or better have)		# parse attributes		nattrs = split($0, attr, ":")		unused="false"		for (i=1; i<=nattrs; i++) {			if (attr[i] ~ /^dv=/) {				n = split(attr[i], dvs, "=")				if (n != 2) {					continue # bad entry - skip				} else if (dvs[2] == "") {					unused="true"				} 			} else if (attr[i] ~ /^at=/) {				nats = split(attr[i], ats, "=")				if (nats != 2) {					continue # bad entry - skip				} else if (ats[2] == "") {					unused="true"				} else {					type=ats[2]				}			}		}		if (unused == "true") type="UNUSED"		printf "TIP%s=\"%s\"\n", speed, type					}' $REMOTE `## Build generic ed substitution string for adding tip entryEDTIP=\'H/^dial$speed|/+1s/dv=[^:]*/&,\\/dev\\/$newname/ps/dv=,/dv=/ps/at=[^:]*/at=$type/ps/cu=[^:]*://pwq'	;;esac #if !direct#for i in 300 1200 2400 4800 9600; do eval type=\$TIP$i echo "DIAL$i=$type" done## Do the worktrap '' $STDSIGSecho "The following special device files in /dev have been changed as follows:"exec <$MDDBTMPwhile :do	read record	case "$?" in	0) : ;;	*) 	break		;;	esac	set - $record	newname=$1 modemctrl=$5 type=$6 speed=$7 dir=$8 oldname=$9	echo "$type" | grep -ws "direct" &&	{ 			:	}||{		mv $DEV/$oldname $DEV/$newname	}	chmod 666 $DEV/$newname		# ***ALERT*** this part will need fixing up in the future	# We don't have getty entries defined for any other modem speeds.	case "$speed" in	19200)	GETTYENTRY="std.19200\"" ;;	9600)	GETTYENTRY="std.9600\"" ;;	2400)	GETTYENTRY="H2400\"" ;;	1200)	GETTYENTRY="D1200\"" ;;	300)	GETTYENTRY="D300\" "  ;;	*)	echo "WARNING: Can't setup a $speed baud modem yet, skipped..."		continue		;;	esac		case "$dir" in	shared)	STATE="on " SHARED="shared" MODEM="modem  " ;;	out)	STATE="off" SHARED="      " MODEM="modem  " ;;	"in")	STATE="on " SHARED="      " MODEM="modem  " ;;	esac	case "$type" in 		"direct")			modemctrl="no" 			DIALUP="vt100" 			AorD="DIR"			;;		*)	DIALUP="dialup"			AorD="ACU"			;;	esac		case "$modemctrl" in	yes)	: ;;	no) 	MODEM="nomodem" ;;	esac	TTYENTRY="$newname \"/etc/getty $GETTYENTRY $DIALUP $STATE $MODEM $SHARED # oldname=$oldname, $type"	ed - $TTYS <<EOF  1>>$NULL 2>&1Hg/^$oldname/d/^#*console/a$TTYENTRY.wqEOF		case "$dir" in "shared"|"out")	    echo "g/$newname/d\nw\nq" | ed - $LDEVICES	    echo "$AorD	$newname $newname $speed $type" >> $LDEVICES	esaccase "$type" in	"direct") ;;	*)	echo "	/dev/$oldname has been renamed as /dev/$newname"		# If modem can be used by tip then add it to /etc/remote	case "$dir" in "shared"|"out")		eval tiptype=\$TIP$speed		case "$tiptype" in "UNUSED" | "$type") 			eval EDSTRING=\""$EDTIP"\"    # We can use it			#echo "$EDSTRING" | ed - $REMOTE 1>>$NULL 2>&1			echo $EDSTRING			echo "$EDSTRING" | ed - $REMOTE 			echo "	and has been made available for use by tip"			eval TIP$speed=$type  # set it in case it was UNUSED			;;		esac		;;	esac	;;esac		echo " $record" >> $MODEMDB  # record it in modem databasedone	# loopchown uucp $LDEVICES 2>/dev/nullchmod 400 $LDEVICES 2>/dev/nullkill -HUP 1rm -f $MDDBTMPecho "The list of installed modems on your system is available in thefile: /usr/var/uucp/modemdb.  You should now physically connectthe modems to your system if you haven't already."exit 0#									# 			Copyright (c) 1984 by				# 		Digital Equipment Corporation, Maynard, MA		# 			All rights reserved.				# 									#	This software is furnished under a license and may be used and	#	copied  only  in accordance with the terms of such license and	#	with the  inclusion  of  the  above  copyright  notice.   This	#	software  or  any  other copies thereof may not be provided or	#	otherwise made available to any other person.  No title to and	#	ownership of the software is hereby transferred.			# 									#	The information in this software is subject to change  without	#	notice  and should not be construed as a commitment by Digital	#	Equipment Corporation.						# 									#	Digital assumes no responsibility for the use  or  reliability	#	of its software on equipment which is not supplied by Digital.	##	EDIT HISTORY:##	1-Jun-1986	XXX	- first version#	16-Feb-1988	Lea Gottfredsen #				- /usr/lib/uucp -> /usr/var/uucp#	1-23-1989	Lea Gottfredsen#				- added support for direct connect lines#

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -