[alt.sources.d] Trailblazer configuration awk script

tchrist@convex.COM (Tom Christiansen) (11/21/89)

In article <4268@helios.ee.lbl.gov> leres@helios.ee.lbl.gov 
(Craig Leres) writes:

>If you add any features, I'd appreciate getting a copy (but if you
>convert it to perl, please do not send it to me because I DON'T LIKE
>SPAM!)

Excuse me?  What does Spam(tm) have to do with perl?
Whence your revulsion?

And there's no work to to be done to convert a mere
awk script to perl: that's what the automatic awk-to-perl
translator, a2p, is for.

--tom

    Tom Christiansen                       {uunet,uiucdcs,sun}!convex!tchrist 
    Convex Computer Corporation                            tchrist@convex.COM
		 "EMACS belongs in <sys/errno.h>: Editor too big!"

jgd@rsiatl.UUCP (John G. De Armond) (11/23/89)

In article <4268@helios.ee.lbl.gov> leres@helios.ee.lbl.gov (Craig Leres) writes:
>Here's an awk script I wrote to munge the configuration output of my
>Trailblazer T2500's so that I could more easily restore a config (when
>doing rom upgrades, for example). My awk is vanilla SunOS 3.5.
>


Well, here's a KISS version of the same program using your friend and mine,
SED :-).

to use, simply fix the stty statement for the proper baud rate,
change the port name and uncomment, add or delete appropriate lines.

John

-----------------------

#set -xv

# Setup for Telebit with a getty

trap 'trap "" 1 2 3 9 15;
	rm -f /usr/spool/locks/LCK..tty01
exit 2' 1 2 3 15


if [ -f /usr/spool/locks/LCK..acu1 ]
then 
	echo "Port locked"
	exit	# can't do anything with the port locked
else
	touch /usr/spool/locks/LCK..acu1


	( stty 9600 ;

	cat <<EOF_HERE  |

~&F				# restore enhanced command mode defaults
~S63=1				# enhanced command mode
s0=1				# answer on 1 ring
s7=65				# wait time in seconds for carrier
q4				# do not send unsolicited result codes to DTE
e0				# do not echo commands back to DTE
s41=10				# modem inactivity timeout (6 min intervals)
s45=0				# remote access disabled
s50=0				# automatic speed determination
#s50=255			# speed is PEP tones
#s52=1				# no answer if dtr down.
s52=2				# no answer if dtr down. reset modem on dtr dow
s54=3				# pass break on to computer
#s55=3				# ignore +++ escape sequence
s55=0				# handle like hayes the +++ escape sequence
s66=1				# lock interface speed to s51
s58=2				# flow control is rts/cts to DTE
s68=2				# flow control is rts/cts to modem
s67=0				# CTS is used for flow control
#67=1				# assert cts 200 ms after rts
s64=1				# ignore data sent by local DTE when answering
s92=0				# answer the phone using s50 (pep first)
s94=1				# modems do speed negotiation
s110=255			# data compression enable iff remote s110=1
s111=30				# uucp protocol spoofing
#s111=255			# negotiate protocol spoofing
#s130=5				# assert dsr when valid data carrier detected
s130=0				# dsr is always on
#s130=3				# assert dsr when modem is ready is accept
#				# commands
s131=1				# assert dcd when valid data carrier detected
S51=4				# interface at 9600

&w0				# save setup to A

EOF_HERE

	sed -e '/^#/d' -e 's/#.*//' -e 's/[	 ]*$//g' -e '/^$/d' -e 's/^/AT/' -e 's/$/
	while read aline
	do
		echo $aline ;
		sleep 1 ;
	done
	) </dev/acu1 >/dev/acu1

	rm -f /usr/spool/locks/LCK..acu1
fi
exit

# ------ end of file ----

-- 
John De Armond, WD4OQC                     | Manual? ... What manual ?!? 
Radiation Systems, Inc.     Atlanta, GA    | This is Unix, My son, You 
emory!rsiatl!jgd          **I am the NRA** | just GOTTA Know!!! 

leres@ace.ee.lbl.gov (Craig Leres) (11/23/89)

John G. De Armond writes:
> Well, here's a KISS version of the same program using your friend and mine,
> SED :-).

I'm almost certain that you didn't even look at my posting; my awk
program allows one to munge a Trailblazer's A and B profiles into a
short list of commands that can be used to configure a Trailblazer in
an identical fashon. Your sed script is just a hardwired list of
commands... About the only thing the two have in common is that they
are used with Telebit products.

		Craig