Different keymaps (??) on my ttys

Paul Fox pgf at brightstareng.com
Mon Dec 3 14:01:42 UTC 2007


 > Alexander Griesser wrote:
 > > Well, I think I have more details now after my vacation ;)
 > > It seems as if `login` breaks stuff.
 > 
 > Sorry for followin up on my own posting that often, but I think I
 > found the cause for this now finally. Somewhere down in getty.c
 > it says:
 > 
 > ------------------------ 8< ---------------------
 > static char *get_logname(char *logname, unsigned size_logname,
 >         struct options *op, struct chardata *cp, struct termios *tp)
 > [...]
 >             case BS:
 >             case DEL:
 >             case '#':
 >                 cp->erase = ascval;     /* set erase character */
 >                 if (bp > logname) {
 >                     write(1, erase[cp->parity], 3);
 >                     bp--;
 >                 }
 >                 break;
 >             case CTL('U'):
 >             case '@':
 >                 cp->kill = ascval;      /* set kill character */
 >                 while (bp > logname) {
 >                     write(1, erase[cp->parity], 3);
 >                     bp--;
 >                 }
 >                 break;
 > [...]
 > ----------------------- 8< -----------------------
 > 
 > Which is _EXACTLY_ what I'm experiencing. Is there some reasoning
 > behind that?

yes.  it's _very_ historical reasoning, however.

back in the distant pass, when "glass" terminals were not common,
the backspace and line-kill characters on unix were '#' and '@'
by default.  this way if you mistyped a word, you could see your
corrections on the paper of your terminal:
    helo#lo
and if you waxyd to replace@
and if you wanted to replace a whole line, that was obvious too.

(this same kind of reasoning is why login will put your terminal into
upper-case-translation mode if you type all uppercase characters very
early -- it thinks you're on a terminal that _can't_ do lowercase input.)

it wasn't until the 80's that the erase/kill characters changed
to backspace (or DEL, in BSD's case) and ^U by default.

getting these characters set correctly early is an advantage for
the user, since otherwise they can't correct their mistakes,
and since traditional ascii/english usernames did not
contain the '#' or '@' characters, it was reasonable to set the
erase and kill characters during the login phase if they were typed,
since there would be no other reason to type them.

clearly this code has no place in login or getty in 2007.  (i'm less
convinced about BS vs. DEL -- that might still be useful.)

paul
=---------------------
 paul fox, pgf at brightstareng.com



More information about the busybox mailing list