[TUHS] terminal types in 1BSD
Phil Budne via TUHS
tuhs at tuhs.org
Fri May 22 06:55:48 AEST 2026
> To bring things firmly back into TUHS territory: In the early 80's I
> took a Harvard Extension class, and remember the Harvard Science
> Center 11/70 UNIX systems; ISTR them as being v6 based, and terminal
> types were all two characters (presumably passed around as two bytes,
> without the benefit of environment variables). And that termcap had
> two-char aliases as well... Am I remembering this correctly?
Answering my own question, looking at:
https://www.tuhs.org/cgi-bin/utree.pl?file=1BSD/ex-1.1/ex_init.c
the initoptions function has:
ttyno = ttyn(f);
if (ttyno != 'x') {
if (hget(ttyno) == 0)
isetterm(hsgettype());
}
https://www.tuhs.org/cgi-bin/utree.pl?file=1BSD/s7/htmpg.c
has the hget function to read /etc/htmp:
struct htmp {
int uid;
char home[28];
int ttytype;
} hentry;
indexed by the ttyno char passed in, and also contains hgethome(),
hgetuid() and h(s)gettype functions (depending on whether you want an
int, or a string with the two terminal type bytes!)
ttyn is a standard library function, present as early as v3:
https://www.tuhs.org/cgi-bin/utree.pl?file=V3/man/man3/ttyn.3
still in assembler in v6:
https://www.tuhs.org/cgi-bin/utree.pl?file=V6/usr/source/s3/ttyn.s
Further down initoptions calls:
uid = getuid() & mask;
H = hgethome();
if (uid == 0)
strcpy(H, "/");
else if (uid != hgetuid())
return;
https://www.tuhs.org/cgi-bin/utree.pl?file=1BSD/etc/READ_ME
says:
November 17, 1977
This directory contains prototype data files for /etc.
Htmp is here simply to indicate that it must exist... it can be created via
cp /dev/null /etc/htmp
chown bin /etc/htmp
chmod 644 /etc/htmp
The file ttytype should be modified to conform to your configuration,
and new entries should be added to ttycap for the terminals which you
have. Note that the programs "sethome", "tset" and "ttytype" must be able to
write on htmp so they must either be setuid or /etc/htmp must be mode 666
(safe only if you have a completely friendly community of users.)
https://www.tuhs.org/cgi-bin/utree.pl?file=1BSD/etc/ttycap
is the primordial termcap file (each entry is a one-liner):
l1|11/10:0:0:?
ca|adm3a|3a:0177440:0000332:li#24:co#80:cl=^z:ho=\036:nd=^l:up=^k:am:bs:ca
cl|adm3|3:0177440:0000332:li#24:co#80:cl=^z:am:bs
bh|beehiveIIIm:0177440:0000330:li#20:co#80:cl=^e^r:ho=^e:nd=^l:up=^k:bs:ca:am:pt
cm|datamedia|dm:0177440:0000332:li#24:co#80:cl=^l:am:bs
td|decwriter|dw2:0177444:0000332:co#132:bs:os:
pd|dtc300s|diablo|dtc:0137446:0000330:if=/usr/lib/tset.dtc_tabs:co#132:hu=\EH:hd=\Eh:up=^z:bs:it:os:pt:pl
du|dialup:0:0:
cf|fox:0177440:0000332:li#24:co#80:cl=\EK\1\1\1\1:ho=\EH:nd=\EC:up=\EA:am:bs:ca
pg|gsi:0137446:0000330:is#1:co#132:hu=\EH:hd=\Eh:up=^z:bs:it:os:pt:pl
g0|gt40:0177444:0000332:li#30:co#72:bs:os
g2|gt42|42:0177444:0000332:li#40:co#72:bs:os
ch|hazeltine|2000:0177440:0000332:bs:ca
lh|hp21mx:0:0:?
cH|hp2645|2645:0177440:0000332:li#24:co#80:cl=\E&a00c00Y\EJ:ho?:nd=\EC:up=\EA:am:bs:ca:it:ce=\Ek:pt:al=\EL:dl=\EM:ce=\EK:cd=\EJ
gk|tek4014:0177444:0040332:co#120:li#56:bs:os:cl=\E^l:is=\E\:
ct|teleray:0177440:0000332:co#80:li#24:cl=^l:bs
ti|ti700|ti|ti733|7:0151440:0020332:co#80:bs:os
t3|teletype|tty|33|35:0157440:0020336:co#72
t7|tty37|37:0115044:0062732:bs:os:hu?:hd?:up?
t4|tty43|43:0177444:0000332:bs:os:am:co#132
un|unknown|u:0:0:
https://www.tuhs.org/cgi-bin/utree.pl?file=1BSD/READ_ME
says:
The trek game in "trek" uses the rewritten portable library in "portlib".
It (and the program tset) were written by Eric Allman whose address
is in the trek setup instructions in "trek".
Digging further has been delayed by not being able to extract all the
cont.a archives in the 1bsd tar file, so I don't yet understand
how/when the htentry uid field was set!
More information about the TUHS
mailing list