Listtree.mcc: forward DragQuery to NListobject with the msg->obj set to the NListobje...
[AROS.git] / test / dos / r.c
blob13faf3238af5077d66f9a65e8b911e65766312cb
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/dos.h>
7 #include <proto/exec.h>
9 #include <aros/debug.h>
11 TEXT buffer[100];
14 * A tool like "R" http://www.geit.de/eng_r.html requires that we can
15 * call a command such that it prints the template and then stops.
18 int main(void)
20 // in the real "R" we would check for an unused file name first
21 BPTR input = Open("t:00000001.request.infile", MODE_NEWFILE);
22 BPTR output = Open("t:00000001.request.outfile", MODE_NEWFILE);
24 // shut up DOS error message
25 struct Process *me = (struct Process*)FindTask(NULL);
26 APTR oldwin = me->pr_WindowPtr;
27 me->pr_WindowPtr = (APTR)-1;
29 // execute the command. The purpose of "*>NIL:" is to
30 // trigger an error
31 Execute("dir *>NIL: ?", input, output);
33 // restore window ptr
34 me->pr_WindowPtr = oldwin;
36 Seek(output, 0, OFFSET_BEGINNING);
38 // read the template
39 if (FGets(output, buffer, sizeof buffer))
41 bug("*****\n%s*****\n", buffer);
43 else
45 bug("%s\n", "-----");
48 Close(input);
49 Close(output);
51 return 0;