home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a012 / 1.ddi / CHAP03.EXE / CHP0301.PRG < prev   
Encoding:
Text File  |  1991-06-12  |  787 b   |  36 lines

  1. /*
  2.    Listing 3.1 TOUCH.PRG
  3.    Author: Joe Booth
  4.    Excerpted from "Clipper 5: A Developer's Guide"
  5.    Copyright (c) 1991 M&T Books
  6.                       501 Galveston Drive
  7.                       Redwood City, CA 94063-4728
  8.                       (415) 366-3600
  9.  
  10.   NOTE: must compile with the /N switch!
  11. */
  12.  
  13. #include "directry.ch"
  14.  
  15. function touch(file_list)
  16. local flist
  17. if file_list <> NIL
  18.    flist := Directory( file_list )
  19.    Aeval( flist, { | afile | Chgtime(afile[F_NAME]) } )
  20. else
  21.    ? "SYNTAX: touch <file-list>"
  22. endif
  23. return NIL
  24.  
  25. function Chgtime(fname)
  26. local fh := fopen(fname, 2), one_byte := space(1)
  27. if fh > -1
  28.    fread(fh, @one_byte, 1)
  29.    fseek(fh, 0, 0)
  30.    fwrite(fh, one_byte,1)
  31.    fclose(fh)
  32. endif
  33. return NIL
  34.  
  35. // end of file CHP0301.PRG
  36.