Stephen Powell wrote: > I am experiencing a very strange phenomenon. I have an old IBM 3151 > ASCII display terminal that has been lying around the house; > and today I decided to see if I could get it connected up to one
Fun! I never used one of those models and am unfamiliar with it in particular. > of my PCs, which runs Debian GNU/Linux (jessie). I was successful > in doing this. But when I login to Debian from the IBM 3151 terminal, > I have noticed some strange goings on. The system locale is > en_US.UTF-8. But of course this old terminal is mostly 7-bit ASCII, > though it does support vt100 graphic character escape sequences for > box drawing. I have modified ~/.bashrc so that if the terminal type > ($TERM) is ibm3151, I set LANG to en_US, and that has solved some > problems. But when I issue the MAN command, I see lower-case "m"s > at the end of each line. How does the terminal handle control-m carriage returns? Normally at the terminal will receive a CR-NL pair and will move the cursor left and then down. It seems likely those 'm's are CR characters. It would be good to verify that. $ printf "This is a CR char: ==\r==\n" If it is a normal terminal we would see this. Because the CR moves the cursor to the left and the next two "==" chars overwrite the "Th" of "This". Then the newline is translated to a CR-NL pair and moves the cursor left and down. ==is is a CR char: == But if it is the CR chars producing the 'm' for you then it would print this: This is a CR char: ==m== Then at least you would know it is the CR that isn't handled like in a standard terminal. > Ideas, anyone? I would see if there is a setting on the terminal to change. Having it work normally would be best. Additionally maybe you can avoid sending CR chars to the terminal. Does it interpret NLs as a CR-NL just by itself? If so then turn off onlcr. Try setting the stty settings to avoid sending a CR. man stty * [-]onlcr translate newline to carriage return-newline Normally that is set. $ stty -a ... opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel ... The onlcr translates NL into CR-NL pairs. It might be that your terminal wants it unset. $ stty -onlcr On a standard terminal that would cause the cursor to move down vertically at the end of the line but not return to the left. If that happens just set it back to on again. $ stty onlcr Bob
signature.asc
Description: Digital signature