Resurrected incomplete Intel graphics driver in case anyone wants to
[cake.git] / test / dos / getenv.c
blob1d28be30535f51ff8736c34c57c105bb06c3c042
1 #include <proto/dos.h>
2 #include <stdio.h>
3 #include <stdlib.h>
5 int main(int argc, char *argv[])
7 char c;
8 if (argc < 2)
10 fprintf(stderr, "usage: %s <varname>\n", argv[0]);
11 return 20;
14 if (GetVar(argv[1], &c, 1, GVF_BINARY_VAR) == 0)
16 LONG len = IoErr();
17 char *buf = malloc(len + 1);
18 if (!buf)
20 PrintFault(ERROR_NO_FREE_STORE, argv[0]);
21 return 20;
24 printf("IoErr() says the len of the value of the var '%s' is: %ld\n", argv[1], len);
27 len = GetVar(argv[1], buf, len+1, GVF_BINARY_VAR);
29 printf("GetVar() says the len of the value of the var '%s' is: %ld - its value is '%s'\n",
30 argv[1], len, buf);
32 free(buf);
34 return 0;
37 PrintFault(IoErr(), argv[1]);
39 return 20;