/* touch.c : Defines the entry point for the console application.*/
/* Copyright 2000, International Business Machines Corporation and others.
All Rights Reserved.
-
+
This software has been released under the terms of the IBM Public
License. For details, see the LICENSE file in the top-level source
directory or online at http://www.openafs.org/dl/license10.html
*/
+#include <windows.h>
#include "io.h"
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <process.h>
+#ifndef intptr_t
+#define intptr_t INT_PTR
+#endif
+
void
-usuage()
+usage()
{
printf("touch filename/Wildcard \n");
exit(1);
}
+/*
+ * Construct the mask explicitly. Later versions of windows start filling
+ * in higher bits and that doesn't affect the operation
+ */
+
+#define ATTRIBUTE_MASK (_A_RDONLY | _A_HIDDEN | _A_SYSTEM | _A_SUBDIR)
+
+
int
main(int argc, char *argv[])
{
- int fh, fs;
+ int fh;
+ intptr_t fs;
long pos;
char buffer[1];
struct _finddata_t finfo;
if (argc < 2)
- usuage();
+ usage();
fs = _findfirst(argv[1], &finfo);
if (fs == -1)
return 0;
do {
- if ((finfo.attrib & ~_A_ARCH) != _A_NORMAL)
+ if ((finfo.attrib & ATTRIBUTE_MASK) != _A_NORMAL)
continue;
fh = _open(finfo.name, _S_IWRITE | _O_BINARY | _S_IREAD | _O_RDWR);
pos = _lseek(fh, 0L, SEEK_END);