cachemgr-setuerror-ifdef-cleanup-20020827
[openafs.git] / src / config / touch.c
1 /* touch.c : Defines the entry point for the console application.*/
2 /* Copyright 2000, International Business Machines Corporation and others.
3         All Rights Reserved.
4  
5         This software has been released under the terms of the IBM Public
6         License.  For details, see the LICENSE file in the top-level source
7         directory or online at http://www.openafs.org/dl/license10.html
8 */
9
10 #include "io.h"
11 #include <stdio.h>
12 #include <fcntl.h>
13 #include <sys/stat.h>
14 #include <process.h>
15
16 void usuage()
17 {
18         printf("touch filename/Wildcard \n");
19         exit(1);
20 }
21
22 int main(int argc, char* argv[])
23 {
24         int fh,fs;
25         long pos;
26         char buffer[1];
27         struct _finddata_t finfo;
28         if (argc<2)
29                 usuage();
30         fs=_findfirst(argv[1],&finfo);
31         if (fs==-1)
32                 return 0;
33         do {
34
35                 if ((finfo.attrib & ~_A_ARCH) != _A_NORMAL) continue;
36                 fh=_open(finfo.name,_S_IWRITE|_O_BINARY|_S_IREAD|_O_RDWR);
37                 pos=_lseek(fh,0l,SEEK_END);
38                 _write(fh,buffer,1);
39                 _chsize(fh,pos);
40                 _close(fh);
41         } while (_findnext(fs,&finfo)==0);
42         return 0;
43 }