diff options
author | Peter Wu <lekensteyn@gmail.com> | 2012-09-26 15:04:18 +0200 |
---|---|---|
committer | Peter Wu <lekensteyn@gmail.com> | 2012-09-26 15:04:18 +0200 |
commit | 2497c1392b81e093f4de2541a98746aebd449a7f (patch) | |
tree | db87e59d4c70c677ddb1899d9161b004f6e454ac /rev.c | |
download | c-files-2497c1392b81e093f4de2541a98746aebd449a7f.tar.gz |
Initial commit
Diffstat (limited to 'rev.c')
-rw-r--r-- | rev.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -0,0 +1,10 @@ +#include <unistd.h> + +int main() { + char buf[1024]; + char *eob = buf + sizeof(buf) - 1; + char *p = eob; + while (read(STDIN_FILENO, p, 1) == 1 && --p >= buf); + write(STDOUT_FILENO, p + 1, eob - p); + return 0; +} |