Fix IO memory access .. SB128 driver makes noises in VMWare - CMI is untested (Curren...
[AROS.git] / workbench / c / Touch.c
blob6d7f75a0896dbd29635c9f0a254d55194d8c8edf
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Touch CLI command.
6 Lang: english
7 */
9 #include <dos/dos.h>
10 #include <proto/dos.h>
12 int __nocommandline;
14 int main(void)
16 IPTR args[1] = { 0 };
17 struct RDArgs *rda = ReadArgs("NAME/A", args, NULL);
19 if (rda)
21 struct DateStamp ds;
23 /* Attempt to update the file's date stamp */
24 if (SetFileDate((CONST_STRPTR)args[0], DateStamp(&ds))) {
25 return RETURN_OK;
26 } else {
27 /* Attempt to create the file, if needed */
28 BPTR fh = Open((STRPTR)args[0], MODE_NEWFILE);
29 if (fh) {
30 Close(fh);
31 return RETURN_OK;
35 PrintFault(IoErr(), NULL);
37 return RETURN_FAIL;