[net.sources] Tty config file

thomas (10/25/82)

This script edits the /etc/tty.config file, then rebuilds all the tty
files (by calling bldttys).  Several lines need to be changed for your
system, particularly the lines following the 'set w = `whereami`'.
----------------------------------------------------------------
#! /bin/csh
# J.Lepreau 9/81
# set verbose; set echo

if (`whoami` != "root") then
	echo "Not allowed\!"
	exit 1
endif

set w = `whereami`
if ($w == "cs" || $w == "gr") then
	set sig = "HUP"		# Vaxen are different!
else
	set sig = 2
endif

set e = `printenv EDITOR`
if ("x$e" == "x") set e = "ex"
$e /etc/tty.config

if ($status == 0) then
	 /etc/bldttys
else
	echo 'Bad status from edit: exiting'
	exit 1
endif

if ($status == 0) then
	echo "All tty files built"
	echo "Poking init to re-merge /etc/ttys"
	kill -$sig 1
else
	echo 'Bad status from bldttys: exiting'
	exit 1
endif

----------------------------------------------------------------
This script takes the file /etc/tty.config and rebuilds all the
tty files.  
----------------------------------------------------------------
#! /bin/sh
# J.Lepreau, Univ of Utah 9/81 -- finally gave in to Randy!
awk -f /etc/bldttys.awk /etc/tty.config
echo 'New ttys were built' |/bin/mail lepreau
----------------------------------------------------------------
This awk program does the dirty work.
----------------------------------------------------------------
BEGIN	{ FS = "\t" }
	{ if (NF > 0 && substr($1,1,1) != "#") \
	    { \
		dev = $2; type = $3; swit = $4; des = $5; \
		printf "%s %s\n", type, dev > "/etc/ttytype"; \
		printf "%s%s\n", swit, dev > "/etc/ttys"; \
		printf "%s\t   %s\n", dev, des > "/etc/tty.places"; \
	    } \
	}
----------------------------------------------------------------
Finally, here is a sample tty.config file.
----------------------------------------------------------------
# /etc/tty.config -- IF THIS IS CHANGED, YOU MUST RUN /etc/bldttys !!
# Or better, use /etc/chgttys which does everything you want:
# edits this file, runs bldttys, and signals init to remerge.
# J.Lepreau, Univ of Utah 9/81

# Who reads the files output by bldttys:
# 1. /etc/tty.places	no programs, just people
# 2. /etc/ttytype	tset and login
# 3. /etc/ttys		getty

# Tab is the field separator.  Format, and where you get it from:
# arbitray-no. /dev/<foo> ttytype(termcap) ttys-entry(getty.types) location

1	console	dw	14	Vax 11/750 console, machine room
2	ttyh0	t10	2B	LocalNet A750/0
3	ttyh1	t10	12	Apollo Room Patch Panel
4	ttyd2	t10	13	Dial-up: 1200, 300.  581-3237
5	ttyh3	t10	17	Dec-20 link (csvax:, tty140:)
6	ttyh4	t10	17	SCL ttyh2: uucp,ltnet scl->cs
7	ttyh5	t10	0x	Graphics tty13 - uucp gr->cs
8	ttyh6	t10	0x	Currently Unused
9	ttyh7	t10	0x	Currently Unused
10	ttyh8	t10	17	VLSI Parameter extraction system, 3165 MEB
11	ttyd9	t10	0x	Dialout
12	ttyha	vt100	12	Megatek room - 3114 MEB
13	ttyhb	aaa	12	Mach Rm Panel (3161 MEB - Ann Arbor Ambassador)
14	ttyhc	t10	12	DSP Unix uucp dsp->cs
15	ttyhd	t10	2B	LocalNet A750/1
16	ttyhe	t10	2B	LocalNet A751/0
17	ttyhf	t10	2B	LocalNet A751/1
18	ttyl0	xxx	0x	KL 1200: Dec-20 UNXFTP control line (20 TTY34:)
19	ttyl1	dw3	0x	KL 2400: Printer 
20	ttyl2	xxx	0x	Currently Unused - KL 2400
21	ttyl3	xxx	0x	Currently Unused - KL 2400
#
# Now for the ptys
101	ttyp0	xxx	0x	pty slave
102	ttyp1	xxx	0x	pty slave
103	ttyp2	xxx	0x	pty slave
104	ttyp3	xxx	0x	pty slave
105	ttyp4	xxx	0x	pty slave
106	ttyp5	xxx	0x	pty slave
107	ttyp6	xxx	0x	pty slave
108	ttyp7	xxx	0x	pty slave
109	ttyp8	xxx	0x	pty slave
110	ttyp9	xxx	0x	pty slave
111	ttypa	xxx	0x	pty slave
112	ttypb	xxx	0x	pty slave
113	ttypc	xxx	0x	pty slave
114	ttypd	xxx	0x	pty slave
115	ttype	xxx	0x	pty slave
116	ttypf	xxx	0x	pty slave
117	ttyq0	xxx	0x	pty slave
118	ttyq1	xxx	0x	pty slave
119	ttyq2	xxx	0x	pty slave
120	ttyq3	xxx	0x	pty slave
121	ttyq4	xxx	0x	pty slave
122	ttyq5	xxx	0x	pty slave
123	ttyq6	xxx	0x	pty slave
124	ttyq7	xxx	0x	pty slave
125	ttyq8	xxx	0x	pty slave
126	ttyq9	xxx	0x	pty slave
127	ttyqa	xxx	0x	pty slave
128	ttyqb	xxx	0x	pty slave
129	ttyqc	xxx	0x	pty slave
130	ttyqd	xxx	0x	pty slave
131	ttyqe	xxx	0x	pty slave
132	ttyqf	xxx	0x	pty slave