diskimage: Compiler delint
[AROS.git] / test / dos / r.c
blob3c20340bce173d343411959e4dfcb3a213a95c57
1 #include <proto/dos.h>
2 #include <proto/exec.h>
4 #include <aros/debug.h>
6 TEXT buffer[100];
8 /*
9 * A tool like "R" http://www.geit.de/eng_r.html requires that we can
10 * call a command such that it prints the template and then stops.
13 int main(void)
15 // in the real "R" we would check for an unused file name first
16 BPTR input = Open("t:00000001.request.infile", MODE_NEWFILE);
17 BPTR output = Open("t:00000001.request.outfile", MODE_NEWFILE);
19 // shut up DOS error message
20 struct Process *me = (struct Process*)FindTask(NULL);
21 APTR oldwin = me->pr_WindowPtr;
22 me->pr_WindowPtr = (APTR)-1;
24 // execute the command. The purpose of "*>NIL:" is to
25 // trigger an error
26 Execute("dir *>NIL: ?", input, output);
28 // restore window ptr
29 me->pr_WindowPtr = oldwin;
31 Seek(output, 0, OFFSET_BEGINNING);
33 // read the template
34 if (FGets(output, buffer, sizeof buffer))
36 bug("*****\n%s*****\n", buffer);
38 else
40 bug("%s\n", "-----");
43 Close(input);
44 Close(output);
46 return 0;