diff options
author | Willy Tarreau <w@1wt.eu> | 2006-07-16 14:53:39 +0200 |
---|---|---|
committer | Willy Tarreau <willy@wtap.(none)> | 2006-07-26 11:51:24 +0200 |
commit | cd97a35e24dcb6728b06f9974ed9ba49d07227b8 (patch) | |
tree | 7dd9977f67ec52b4853cdd6f6b104d533c801853 /lcd/lcdtee.c | |
parent | [RELEASE] flxutils-0.1.22 (diff) | |
download | flxutils-cd97a35e24dcb6728b06f9974ed9ba49d07227b8.tar.xz |
[RELEASE] flxutils-0.1.23v0.1.23
Diffstat (limited to 'lcd/lcdtee.c')
-rw-r--r-- | lcd/lcdtee.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lcd/lcdtee.c b/lcd/lcdtee.c new file mode 100644 index 0000000..2cab2ef --- /dev/null +++ b/lcd/lcdtee.c @@ -0,0 +1,21 @@ +/* simply write all args to /dev/lcd, and don't complain if it doesn't work */ +#include <sys/fcntl.h> + +main(int argc, char **argv) { + int fd; + char buf[1024]; + int len; + + fd = open("/dev/lcd", O_WRONLY); + + while ((len = read(0, buf, sizeof(buf))) > 0) { + write(1, buf, len); + if (fd > 0) + write(fd, buf, len); + } + + if (fd > 0) + close(fd); + return 0; +} + |