Hi,

According to the manpage, the escape sequence \nnn is expanded to the
octal character nnn in the PS1 prompt.

In fact, it is expanded to a garbage.

It seems that dopprompt() (in src/bin/ksh/lex.c) has the wrong
calculation:

n = cp[0] * 8 * 8 + cp[1] * 8 + cp[2];
snprintf(strbuf, sizeof strbuf, "%c", n);

This should probably be:

n = ('0' - cp[0]) * 8 * 8 + ('0' - cp[1]) * 8 + ('0' - cp[2]);
snprintf(strbuf, sizeof strbuf, "%c", n);

Reply via email to