by swatcoder · 4y ago · 0 comments
That’s poetry. Nice find.
Reminds me a lot of writing my own compiler/assembler in university, where it’s expected that all this happens automatically nowadays.
main()
{
int ch;
while ((ch = read()) != 4) {
if (ch > 0100 && ch < 0133)
ch = ch + 040;
if (ch == 015) continue;
if (ch == 014) continue;
if (ch == 011) {
ch = 040040;
write(040040);
write(040040);
}
write(ch);
}
}
A more modern C version would look like: #include <stdio.h>
int
main(void)
{
int ch;
while ((ch = getchar()) != -1) {
if (ch > 0100 && ch < 0133)
ch = ch + 040;
if (ch == 015) continue;
if (ch == 014) continue;
// No need to handle tabstop specially
putchar(ch);
}
}