Sys V wizard questions

Mike Finegan finegan at ucqais.uc.edu
Wed Aug 17 12:59:01 AEST 1988


I don't know if this got posted - but thought others would like to see it.
					Thanks Leslie (and Shankar ...),
							Mike

From: les at chinet.UUCP (Leslie Mikesell)
In article <1488 at ucqais.uc.edu> you write:
>
>	In trying to get TeX running on a 3B2/400, I noticed that
>after 14 or so characters, the file names get truncated! Can I set a
>parameter to change this (I don't have complete Sys V source), or am
>I stuck ? I have been told that this is part of Sys V Unix (hp840 did
>the same ...).

Can't help much with TeX, but there is a C version (I think translated
using CWEB) that won't compile on the 3B2 because of a huge switch
statement that causes a switch table overflow.

>	If you have a device connected to a serial port (could be a printer),
>and you are not using the print spooler to access the port, and you don't
>have a login for the port - how do you change the port characteristics (baud
>rate) ?

The first open on a port gets the default settings, usually 300 baud.
If you need to use shell commands only (as opposed to writing a C program
to do ioctl()'s), you need to use stty with input redirected from the
port, then keep the port open until the rest of you program completes.
One way to do this would be:

( stty 9600 onlcr opost tab3 0>&1
  cat $*
) >/dev/ttynn

This will redirect output to the tty port, then redirect stdin to the
same file as stdout (the tty) for the stty command (only).  This
method lets you pipe into the script or give filenames since the
command line is passed directly to cat (change as desired).

>I was told one way would be to have getty run a program that checks
>a spool for commands, or text, and that the program could use stty to change
>the port characteristics. If there is no process controlling the port, it
>reverts to 300 baud (I believe). I don't really want a program spooling, as
>this limits the type of access. Could I use a named pipe (mknode) ?, or is
>there another way ? Examples would be helpful ... The way stty works on
>Sys V versus BSD is a little confusing (stty > versus stty <) - anyone care
>to elaborate ?

A really simple-minded way to keep the port settings is to run a program
that does nothing with output redirected to the port.  The DTR line is
dropped on the last close of a port - the next open restores the default
settings.  Intermediate opens and closes do not affect the settings.

The sequence:

sleep 30000 > /dev/ttynn
stty 9600 </dev/ttynn

would keep the port set to 9600 baud for 30000 seconds or until another
stty is done.  I prefer the self-contained scripts, though.

Les Mikesell



More information about the Comp.unix.wizards mailing list