Fix up parse word so that it can correctly handle empty arguments and (encode-bootpat...
[openbios.git] / utils / ofclient / of1275_io.c
blob25d1132c3966ec563a3cd443a18fd46a90ade5af
1 #include "of1275.h"
3 static int of_write_initialized = 0;
4 static int stdout_ihandle = 0;
5 static int of_read_initialized = 0;
6 static int stdin_ihandle = 0;
8 int write(int fd, char *buf, int len)
10 int actual;
12 if (fd != 1 && fd != 2) {
13 // printk("write: bad id %x\n", fd);
14 exit(1);
17 if (!of_write_initialized) {
18 stdout_ihandle =
19 of_find_integer_property("/chosen", "stdout");
20 // printk("stdout_ihandle: %x\n",stdout_ihandle);
21 of_write_initialized = 1;
24 of1275_write(stdout_ihandle, buf, len, &actual);
25 return actual;
28 int read(int fd, char *buf, int len)
30 int actual;
32 if (fd != 0) {
33 // printk("write: bad id %x\n", fd);
34 exit(1);
37 if (!of_read_initialized) {
38 stdin_ihandle =
39 of_find_integer_property("/chosen", "stdin");
40 of_read_initialized = 1;
43 of1275_read(stdin_ihandle, buf, len, &actual);
44 return actual;
47 exit(int status)
49 of1275_exit(status);
50 while (1);