[comp.unix.wizards] How to force wraparound at col. 80

spolsky@eniac.seas.upenn.edu (Joel Spolsky) (08/19/88)

Hi folks!

Does anybody know how to convince Unix (Sun 3/260) how to
automatically send a carriage return after 80 columns of output?

We're using the Symbolics terminal emulator which SHOULD be emulating
a VT-100, unfortunately, the emulation is flawed because it allows
lines longer than 80 columns without wrapping.

The program we're using on the Sun (Sunlink 3270) assumes that the
terminal will wrap at column 80, which it doesn't, so nothing comes
out formatted correctly.

Thanks for any help...

Joel Spolsky
Bell Communications Research
spolsky@eniac.seas.upenn.edu
or ...!rutgers!bellcore!pyuxss!spolsky

karish@denali.stanford.edu (Chuck Karish) (08/19/88)

In article <4814@netnews.upenn.edu> spolsky@eniac.seas.upenn.edu (Joel Spolsky) writes:
>Does anybody know how to convince Unix (Sun 3/260) how to
>automatically send a carriage return after 80 columns of output?

>We're using the Symbolics terminal emulator which SHOULD be emulating
>a VT-100, unfortunately, the emulation is flawed because it allows
>lines longer than 80 columns without wrapping.


This behavior is configurable on many terminals.  The capability is
usually called 'autowrap' or 'automatic margin'.  For many UNIX
utilities, choosing a termcap entry that lacks the 'am' boolean
fixes things.  I think there's one called 'vt100-nam'.
Terminfo files also have the 'am' attribute.

>The program we're using on the Sun (Sunlink 3270) assumes that the
>terminal will wrap at column 80, which it doesn't, so nothing comes
>out formatted correctly.

If the program doesn't use termcap or terminfo, things are more
complicated.  You'll have to write a program that will intercept the
standard streams, process stdout and stderr, and interact with the
application as if the user were doing it directly.  The terminal
I/O can be faked either by using a couple of extra pty's or by using
ioctl() calls with the TIOCSTI parameter, to convince the application
that piped input is actually coming from the keyboard.

Chuck Karish	ARPA:	karish@denali.stanford.edu
		BITNET:	karish%denali@forsythe.stanford.edu
		UUCP:	{decvax,hplabs!hpda}!mindcrf!karish
		USPS:	1825 California St. #5   Mountain View, CA 94041

lew@gsg.UUCP (Paul Lew) (08/22/88)

In article <4814@netnews.upenn.edu> spolsky@eniac.seas.upenn.edu (Joel Spolsky) writes:
>Does anybody know how to convince Unix (Sun 3/260) how to
>automatically send a carriage return after 80 columns of output?

run public domain program 'screen' on the Sun after you login from your
Symbolic terminal emulator.  'Screen' will take care the wrapping problem for
you. Screen was posted to comp.sources.unix Aug 7, 1987 (v10i096-97).
-- 
Paul Lew			{oliveb,harvard,decvax}!gsg!lew	(UUCP)
General Systems Group, 5 Manor Parkway, Salem, NH 03079	(603) 893-1000

mouse@mcgill-vision.UUCP (der Mouse) (08/23/88)

In article <4814@netnews.upenn.edu>, spolsky@eniac.seas.upenn.edu (Joel Spolsky) writes:
> Does anybody know how to convince Unix (Sun 3/260) how to
> automatically send a carriage return after 80 columns of output?

> We're using the Symbolics terminal emulator which SHOULD be emulating
> a VT-100, unfortunately, the emulation is flawed because it allows
> lines longer than 80 columns without wrapping.

If it's really emulating a VT100, this can be changed.  A real VT100
likes to hammers on the right margin with long lines, but can be set to
wrap.  Unfortunately, it's a rather peculiar sort of wrap ("peculiar"
meaning "not many others do it this way").  The implicit CR/LF is
delayed by a character; it acts as though there were a phantom column
the cursor enters, and trying to print a character in this column
causes the cursor to wrap and then print the character.  (I'm not sure
what happens if the terminal gets a cursor motion sequence when the
cursor is in the phantom column.)  Our VT100 manuals seem to have
disappeared, so I can't give the escape sequence.

(Pet peeve: lots of "vt100 emulators" aren't.  It's depressing how many
of them don't do the right thing with ESC [ 4 ; r, for example.)

> The program we're using on the Sun (Sunlink 3270) assumes that the
> terminal will wrap at column 80, which it doesn't, so nothing comes
> out formatted correctly.

If the Sun program is written correctly, you should be able to create a
termcap description for a VT100-like terminal which doesn't wrap and
then set your terminal type to that before running this program.  If
the thing is so braindamaged it always assumes a VT100, I'd complain to
its vendor.

If none of the above turn out to be any help, you could do as someone
else suggested and find a terminal emulator which uses a pseudo-tty to
make things work properly.  There's probably such a thing in the
sources archives; I'm not sure.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

aland@infmx.UUCP (Dr. Scump) (08/25/88)

In article <1255@mcgill-vision.UUCP>, mouse@mcgill-vision.UUCP (der Mouse) writes:
> In article <4814@netnews.upenn.edu>, spolsky@eniac.seas.upenn.edu (Joel Spolsky) writes:
> > Does anybody know how to convince Unix (Sun 3/260) how to
> > automatically send a carriage return after 80 columns of output?
> 
> If it's really emulating a VT100, this can be changed.  A real VT100
> likes to hammers on the right margin with long lines, but can be set to
> wrap.  Unfortunately, it's a rather peculiar sort of wrap ("peculiar"
> meaning "not many others do it this way").  The implicit CR/LF is
> ...
> cursor is in the phantom column.)  Our VT100 manuals seem to have
> disappeared, so I can't give the escape sequence.
> (Pet peeve: lots of "vt100 emulators" aren't.  It's depressing how many
> of them don't do the right thing with ESC [ 4 ; r, for example.)

I ran into the same problem dialing-up through MIRROR (a Crosstalk
clone) with its vt100 emulator.  A *real* vt100 has a setup selection
for turning autowrap on/off.  Mirror did no such thing, but it *did*
process the corresponding escape sequence properly.
(BTW, the sequence is: ESC ? 7 h)

Therefore, in my .login, I assume wyse50 (work) but switch prompt
format, termcap, and force wrap mode on if I reply "vt100" to tset:
------
set noglob; eval `tset -Qs \?wy50n`; unset noglob
...
if ($TERM == wy30n || $TERM == wy50n) then
...
else 
   alias cd 'cd \!*; set prompt = $EN"#Infmx:"$cwd"# ! > "'
#     For vt100, reset the erase key and force wrap mode on...
#     Also, use INFORMIX termcap because Sun's vt100 Fkeys are wrong...
   if ($TERM == vt100) then
      setenv TERMCAP $IXD/etc/termcap
      set noglob; eval `tset -Qs vt100`; unset noglob
      stty decctlq -ctlecho erase 
      echo '^[[?7h'
#           ^^  substitute ESC for the "expanded" ^[
   endif
...
------

Hope this helps.
-- 
 Alan S. Denney  |  Informix Software, Inc.  |  {pyramid|uunet}!infmx!aland
 Disclaimer: These opinions are mine alone.  If I am caught or killed,
             the secretary will disavow any knowledge of my actions.
 Santos' 4th Law: "Anything worth fighting for is worth fighting *dirty* for"