[comp.unix.questions] Can a script check if my line is dialup?

phd_ivo@gsbacd.uchicago.edu (06/29/90)

I would like a script to execute a number of alias-es and execute
tset only if I dialup, but not when I login in from my beautiful
NeXT console (which uses a different terminal definition, and some
other special definitions).

A NeXT runs Mach, which emulates BSD 4.3. The shell is an enhanced
csh, but without full bourne programmability.

Any notes home are appreciated...

/ivo welch	ivo@next.agsm.ucla.edu

bob@wyse.wyse.com (Bob McGowen x4312 dept208) (06/29/90)

In article <1990Jun29.050949.8906@midway.uchicago.edu> phd_ivo@gsbacd.uchicago.edu writes:
>I would like a script to execute a number of alias-es and execute
>tset only if I dialup, but not when I login in from my beautiful
------------

Actually, you would want tset to run in all cases.  You just need to
set it so it recognizes the lines that you have.

tset uses the /etc/ttytype file as a database mapping terminal types to
tty lines.  tset also lets you modify just what it does with this
information by using the -m option on its command line.  You should
log in from the console and type tty to get the name the system uses
for login on the console (probably /dev/console but we need to be sure).
Then grep for that name in /etc/ttytype.  This will tell you the name
to use in the tset command line.  Assuming that this name were something
like Next, you would add the following to the existing tset in your
.login (.cshrc, whichever):

	-m Next:Next

You would repeat this for the dialup line or other hardwire lines that
you might use.  The result should look like:

	eval `tset -m Next:Next -m dialup:vt100 .......`

When you use the console, you will get the Next console termcap entry,
when you dial in by modem, you will a vt100 entry, and so on.  Check
the man page for tset for other things to do with tset.

I hope this clears up the problem.

Bob McGowan  (standard disclaimer, these are my own ...)
Product Support, Wyse Technology, San Jose, CA
..!uunet!wyse!bob
bob@wyse.com

guy@auspex.auspex.com (Guy Harris) (07/01/90)

>tset uses the /etc/ttytype file as a database mapping terminal types to
>tty lines.

"tset" on *some* systems *might* use "/etc/ttytype" as a database
mapping terminal types to tty lines; I've never seen any such system,
but perhaps Wyse's flavor of UNIX is one such system?

Some systems - e.g., 4.3BSD, and probably therefore nExt's OS, use
"/etc/ttys" (or "/etc/ttytab", if they had to keep "/etc/ttys" in the
old format for backwards compatibility), as that table, and in the cases
I've seen it's "login", not "tset", that uses it, and sets the TERM
environment varible; "tset" just looks at that environment variable. 

bob@wyse.wyse.com (Bob McGowen x4312 dept208) (07/03/90)

In article <3586@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes:
>>tset uses the /etc/ttytype file as a database mapping terminal types to
>>tty lines.
>
>"tset" on *some* systems *might* use "/etc/ttytype" as a database
>mapping terminal types to tty lines; I've never seen any such system,
>but perhaps Wyse's flavor of UNIX is one such system?

Try SCO XENIX, which gives credit to UCBerkely for the tset program.
The man page for XENIX references /etc/ttytype as the database file.
This is also true for Wyse UNIX, as you guessed.

>Some systems - e.g., 4.3BSD, and probably therefore nExt's OS, use
>"/etc/ttys" (or "/etc/ttytab", if they had to keep "/etc/ttys" in the

It is cetainly possible that the database file name changed somewhere in
the series.  The Sun system at Wyse uses the file /etc/ttytab.  But I
recall seeing /etc/ttytype on an older BSD UNIX, though I do not remember
the version.

>old format for backwards compatibility), as that table, and in the cases
>I've seen it's "login", not "tset", that uses it, and sets the TERM
>environment varible; "tset" just looks at that environment variable. 

According to the man page tset will use the environment variable for
TERM if it is set.  If TERM is not set for some reason (presumably some
system's login commands or shells do not do this automagically) then
tset would have to read the database file.  This again comes from the
man page, none of the systems I have access to fail to set TERM before
starting the shell.

Bob McGowan  (standard disclaimer, these are my own ...)
Product Support, Wyse Technology, San Jose, CA
..!uunet!wyse!bob
bob@wyse.com

A_DOUGHERTY@acc.haverford.edu (Andy Dougherty) (07/06/90)

>tset uses the /etc/ttytype file as a database mapping terminal types to
>tty lines
    The Unisoft UniPlus+ System Vr2 works this way.  If memory serves,
their SysVr1 also did.  (However, SysVr2 uses a terminfo database for
most programs, and I generally use tput(1) rather than tset(1).)
Andy Dougherty  (A_Dougherty@hvrford.bitnet)