On Mon, 06 Apr 2015 13:46:45 -0400 (EDT), Bob Proulx wrote: > > I would try dumping a man page to a file and then examining the file > to understand if the 'm's are in the man output or an artifact of > browsing on the terminal with less.
Here's what I did. On a terminal other than my 3151, I issued the following commands: script script.output TERM=ibm3161 man man q exit reset Now, by examining script.output, I was able to determine that each line ends with ^[[m. That's escape, left square bracket, m. This appears to be an escape sequence for turning off special modes, such as high intensity, reverse video, blink, etc. This is an ANSI standard escape sequence. The problem is, this terminal does not conform to the ANSI standard. The correct code for this terminal to do the above is ^[4@. That's escape, 4, at sign. This is clearly a bug, probably in grotty, which just assumes that all terminals conform to the ANSI standard. They don't. This terminal recognizes the ^[[ as an invalid combination and throws it away. The trailing m is then displayed literally. A related problem is that agetty does not clear the screen. The clear command, issued at a Linux shell prompt, works. The clear command consults the terminfo database to determine the proper control sequence for the current terminal type ($TERM environment variable) to clear the screen. But agetty, it seems, sends the most common control sequence used to clear the screen, which doesn't work on this terminal. Here's how I fixed it, or rather, how I worked around it. First of all I use the --noclear option of agetty: /sbin/agetty -8 --noclear ttyS0 38400 ibm3161 Instead, I clear the screen on logout, with this logic in ~/.bash_logout: if [ "$SHLVL" = 1 ] then if [ "$TERM" = "ibm3161" ] then clear fi fi I wrote a shell script, which I place in my ~/bin directory. The name of the script is mypager, which is marked executable, of course, with "chmod +x mypager". Here is what it looks like: #!/bin/sh sed -e 's/^[\[m$/^[4@/'|less -r That's not a circumflex followed by a left square bracket. That's the escape character. In input mode in vi, I entered it with the ^V^[ sequence, since otherwise, it would cause vi to exit input mode. I also have the following logic in ~/.bashrc: if [ "$TERM" = "ibm3161" ] then LANG=en_US LESS="-h0 -d" MANOPT="-P mypager -7" export LESS MANOPT fi Problem solved. But this is a workaround. There are two bugs. One is in agetty for not sending the right clear code. The other is in grotty (probably) for not sending the right "turn off special modes" code. Thanks to all those who helped. -- .''`. Stephen Powell <zlinux...@wowway.com> : :' : `. `'` `- -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/412078797.19466127.1428371465909.javamail.zim...@wowway.com