Plan 9 from Bell Labs’s /usr/web/sources/contrib/someone/root/rc/bin/ipconf/bsr

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc

fn initfn {
	dial/drain
	dial/at '' e1
}

fn dialfn {
	dial/drain
	dial/at 'd*99***1#'
}

# process options
for(i in $*){
	switch($i){
	case '-P'
		primary=-P
	}
}

# the following can be inherited
switch($dev){
case ''
	dev=/dev/eia1
}
switch($baud){
case ''
	baud=115200
}

{
	# set up uart
	if( test -e $dev^ctl ){
		echo -n b^$baud	# baud rate
		echo -n m1	# cts/rts flow control
		echo -n q64000	# big buffer
		echo -n n1	# nonblocking writes
		echo -n r1	# rts on
		echo -n d1	# dtr on
		echo -n c1	# handup wen we lose dcd
		echo -n w10	# 1ms wait time
	} > $dev^ctl

	# get the modem's attention
	while( ! initfn )
		sleep 1

	# dial
	while( ! dialfn )
		sleep 30
		
	echo connected to PPP >[1=2]

	# start ppp
	bind '#I1' /net.alt
	ip/ppp -P -fx /net.alt
} < $dev > $dev

# supply unknowns with inside addresses
if( ! grep -s 'auth=' /net.alt/ndb){
	echo '	auth=204.178.31.2'>>/net.alt/ndb
	echo '	authdom=cs.bell-labs.com'>>/net.alt/ndb
}
if( ! grep -s 'ntp=' /net.alt/ndb)
	echo '	ntp=204.178.31.2'>>/net.alt/ndb
if( ! grep -s 'dns=' /net.alt/ndb){
	echo '	dns=204.178.31.3'>>/net.alt/ndb
	echo '	dns=204.178.31.4'>>/net.alt/ndb
}

# start cs if it isn't already going
if(! test -e /srv/cs_net.alt )
	ndb/cs -rx /net.alt -f /lib/ndb/external
if not mount -a /srv/cs_net.alt /net.alt

# start dns if it isn't already going
if(! test -e /srv/dns_net.alt )
	ndb/dns -rx /net.alt -f /lib/ndb/external
if not mount -a /srv/dns_net.alt /net.alt

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.