/* Copyright (C) 2004 * Andy Goth * * This code is available under the GNU General Public License; see COPYING. */ #include #include #include int main(int argc, char** argv) { int reverse; int i, ret; unsigned char c, buf[4096]; while (1) { ret = read(0, buf, 4096); if (ret == -1) { perror("read"); return EXIT_FAILURE; } else if (ret == 0) { return EXIT_SUCCESS; } else { /* Fall through. */ } for (i = 0; i < ret; ++i) { switch (c = buf[i]) { case '\n': break; case '\r': break; case ' ' : write(1, " ", 6); break; case '<' : write(1, "<" , 4); break; case '>' : write(1, ">" , 4); break; case '&' : write(1, "&" , 5); break; default : write(1, &c , 1); break; } } } return EXIT_SUCCESS; } /* vim: set ts=4 sts=4 sw=4 tw=80 et: */