Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For my Rust book I've just been diving into the old BSD 4.4 source code for cat which converts control characters into printable ASCII with the -v flag and it handles DEL as a special case: putchar(ch == '\177' ? '?' : ch | 0100). But if you XOR the character with 0100 (64) it always clears the 7th bit, which results in '?' for DEL. Interestingly, peeking at the GNU coreutils code it also handles DEL as a special case and just prints "^?".


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: