Article View: news.software.nn
Article #7330NN ignoring TERM; pipes losing ^Ms
From: Will Mengarini
Date: Fri, 24 Mar 1995 05:42
Date: Fri, 24 Mar 1995 05:42
140 lines
5894 bytes
5894 bytes
I'm running NN release 6.5.0 Beta 3 #10 under SunOS 4.1.3_U1. I have a
macro that, under Ultrix 4.3 with NN 6.4, let me finger a poster by
hitting ^F. Under SunOS & NN 6.5.0, the same code always displays
the output of finger with lines separated by RAW linefeeds rather
than by returns & linefeeds; that is,
lines
like this
become
lines
like this
and a wraparound occurs at the right edge of the screen. That wrap is the
only time the cursor returns to the left edge of the screen.
The macro I used under Ultrix was just
map show ^F (
save-full "|nnfinger"
redraw
)
because the nnfinger script contained the line
exitCode = system( "finger " $i "|less" )
which worked fine under Ultrix. ($i had become the user ID.)
Under SunOS, that always produced the raw-linefeed symptom described above.
I hacked the script to write a file named _nnfinger.out, & hacked
the macro to
map show ^F (
save-full "|nnfinger"
:!less _nnfinger.out
:!!rm _nnfinger.out
redraw
)
which--this is REALLY weird--USUALLY BUT NOT ALWAYS solved the wraparound
problem. Usually the display would be normal; sometimes it would have the
raw-linefeed problem; & the only datapoint I have on why is that the status
would remain constant for an entire session logged on to my Unix shell
net provider. I suspect, therefore, that there's some magical setting
for some of the modems but not the others that's relevant.
Unfortunately, lately the problem has worsened so that I always get
raw linefeeds with the hack above that usually worked, so I need a
better understanding of what's going on. This hack
map show ^F (
save-full "|nnfinger"
:!TERM=tty less _nnfinger.out
:!!rm _nnfinger.out
redraw
)
was a major clue, since a tty value for TERM would tell less that reverse-
video wasn't available; but reverse video continued to be used. (I
normally have TERM set to vt102; here I was testing whether it was ignored.)
I conclude that NN is ignoring TERM, & that this is probably relevant,
because the raw-linefeed symptom never occurs in any other context but
in a spawned NN shell; during sessions in which it's happening, less works
fine in all other contexts, including lessing _nnfinger.out from a shell
prompt (when the rm of that file had been #ed out for debugging).
I have occasionally seen nnsh in the ps list, but I don't know what it
is, & whatever it is, I don't want it; I want NN to use ksh as its shell.
I don't have access to the NN source; I'm using the net provider's code.
There's a difference between a spawned shell & one accessed
thru ^Z when NN was run from ksh; the latter just suspends NN
& resumes the ksh that NN was run from. When I use that method
of running less, less works fine. However, in a session in which
the raw-linefeed symptom is happening, accessing less by using
the ! command from inside NN causes the symptom to occur on all files.
This is consistent with observing it when ":!" is used in a macro.
Also, a command like "!TERM=tty less whatever" still fails, still
using reverse video, showing TERM was ignored.
The shell variables SHELL & TERM are set correctly on entry to NN.
Inside NN, ":set shell " displays /bin/ksh.
Can anybody give me some clues what's going on here?
[1] What's the mechanism causing these failures?
[2] Is nnsh relevant, what is it, & how can I make it go away?
[3] Is there some other workaround available?
I doubt that the nnfinger script is relevant, but the rest of this
article contains it just in case.
--------------------------------------------------
#!/usr/local/bin/gawk -f
# nnfinger - Will Mengarini - Extract & finger From: header from Usenet post
BEGIN {
# When we extract the net address, we must allow for formats like
# "someguy@wherever.com (Some Guy)" & "Some Guy <someguy@wherever.com>".
# The latter requires stripping the angle brackets.
FS = "[ \t<>]+"
# NN helpfully outputs the # of lines piped into nnfinger, but doesn't
# follow that with a newline, so we need to provide one here.
print "\n\r\n"
}
/^From:/ {
for( i = 1; i <= NF; ++i ){
if( $i ~ /@.*\./ ){
#Worked under Ultrix 4.3:
#exitCode = system( "finger " $i "|less" )
#Required under Sun 4.1.3:
exitCode = system( "finger " $i ">_nnfinger.out" )
#The macro in .nn/init then 'less'es & 'rm's _nnfinger.out
exit
}#if
}#for
#Now we know the From: line didn't have
#a recognizable Internet address on it, so we need to print an
#error message. Since this script is being run by nnsh from inside
#nn, the best way to display that message & let the user read it
#is to pipe it thru less.
#This should work...
# print "\"From:\" line had no recognizable Internet address." |less
#...but only this actually works (with gawk)...
system( "echo \\\"From:\\\" line had no recognizable net address. |less" )
exitCode = 1
exit
}#from
END {
if( exitCode != "" ) exit exitCode
system( "echo \\\"From:\\\" line not found. |less" )
exit 1
}
Technical Details
Message-ID:
<D5xJuy.K3o@eskimo.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!nntp.gmd.de!news.rwth-aachen.de!news.rhrz.uni-bonn.de!RRZ.Uni-Koeln.DE!uni-duisburg.de!zib-berlin.de!news.mathworks.com!mvb.saic.com!eskimo!seldonShow Full Headers
Complete Article Headers
Message-ID: <D5xJuy.K3o@eskimo.com> Subject: NN ignoring TERM; pipes losing ^Ms Date: Fri, 24 Mar 1995 05:42:34 GMT From: seldon@eskimo.com (Will Mengarini) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!nntp.gmd.de!news.rwth-aachen.de!news.rhrz.uni-bonn.de!RRZ.Uni-Koeln.DE!uni-duisburg.de!zib-berlin.de!news.mathworks.com!mvb.saic.com!eskimo!seldon Newsgroups: news.software.nn X-Nntp-Posting-Host: eskimo.com Lines: 141 Sender: usenet@eskimo.com (News User Id) Organization: Eskimo North (206) For-Ever X-Newsreader: NN version 6.5.0 #9 (NOV)