home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 157.lha / Arc_Src / arcdos.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-04-27  |  1.3 KB  |  42 lines

  1. /*  ARC - Archive utility - ARCDOS
  2.  
  3. System V Version 1.0 based upon:
  4.     Version 1.43, created on 11/09/85 at 22:24:44
  5.  
  6. (C) COPYRIGHT 1985 by System Enhancement Associates; ALL RIGHTS RESERVED
  7.  
  8.     By:  Thom Henderson
  9.  
  10.     Description:
  11.          This file contains certain DOS level routines that assist
  12.          in doing fancy things with an archive, primarily reading and
  13.          setting the date and time last modified.
  14.  
  15.          These are, by nature, system dependant functions.  But they are
  16.          also, by nature, very expendable.
  17. */
  18. #include "arc.h"
  19. #include <sys/types.h>
  20. #include <sys/stat.h>
  21. #include <time.h>
  22.  
  23. INT getstamp(f,date,time)              /* get a file's date/time stamp */
  24. FILE *f;                               /* file to get stamp from */
  25. unsigned INT *date, *time;             /* storage for the stamp */
  26. {
  27.     struct stat buf;
  28.     struct tm *tmbuf;
  29.  
  30.     fstat(fileno(f),&buf);
  31.     tmbuf=localtime(&buf.st_mtime);
  32.     
  33.     *date = ((tmbuf->tm_year-80)<<9) + ((tmbuf->tm_mon+1)<<5) + tmbuf->tm_mday;
  34.     *time = (tmbuf->tm_hour<<11) + (tmbuf->tm_min<<5) + (tmbuf->tm_sec>>1);;
  35. }
  36.  
  37. INT setstamp(f,date,time)              /* set a file's date/time stamp */
  38. FILE *f;                               /* file to set stamp on */
  39. unsigned INT date, time;               /* desired date, time */
  40. {
  41. }
  42.