2015-07-30 17:18 GMT+03:00 Vadim Ushakov <[email protected]>: > 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);
Tweaked version was just committed as -r1.50 of lex.c, thanks! -- WBR, Vadim Zhukov
