blob: 5f86c460b1a19a1e2e8151b7a03c3ed8a0752a2f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/* 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;
if ((fd = open("/dev/lcd", O_WRONLY)) == -1)
return 0;
if (--argc == 0) {
while ((len = read(0, buf, sizeof(buf))) > 0)
write(fd, buf, len);
}
else {
argv++;
while (argc--) {
len = strlen(*argv);
if (argc) /* still other args */
argv[0][len++]=' '; /* add a delimitor */
else
argv[0][len++]='\n'; /* end with a newline */
write(fd, *argv, len);
argv++;
}
}
close(fd);
return 0;
}
|