home *** CD-ROM | disk | FTP | other *** search
- /*
- Listing 3.1 TOUCH.PRG
- Author: Joe Booth
- Excerpted from "Clipper 5: A Developer's Guide"
- Copyright (c) 1991 M&T Books
- 501 Galveston Drive
- Redwood City, CA 94063-4728
- (415) 366-3600
-
- NOTE: must compile with the /N switch!
- */
-
- #include "directry.ch"
-
- function touch(file_list)
- local flist
- if file_list <> NIL
- flist := Directory( file_list )
- Aeval( flist, { | afile | Chgtime(afile[F_NAME]) } )
- else
- ? "SYNTAX: touch <file-list>"
- endif
- return NIL
-
- function Chgtime(fname)
- local fh := fopen(fname, 2), one_byte := space(1)
- if fh > -1
- fread(fh, @one_byte, 1)
- fseek(fh, 0, 0)
- fwrite(fh, one_byte,1)
- fclose(fh)
- endif
- return NIL
-
- // end of file CHP0301.PRG
-