Added missing cap.
[AROS.git] / workbench / c / Touch.c
blobb5cab96e50ff90d674570759431de8ef82803fc1
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] = {NULL};
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;