home *** CD-ROM | disk | FTP | other *** search
/ ftp.update.uu.se / ftp.update.uu.se.2014.03.zip / ftp.update.uu.se / pub / rainbow / msdos / decus / RB122 / arc510sr.arc / ARCDOS.MAC < prev    next >
Text File  |  1986-04-14  |  3KB  |  66 lines

  1. /*  ARC - Archive utility - ARCDOS
  2.  
  3. $define(tag,$$segment(@1,$$index(@1,=)+1))#
  4. $define(version,Version $tag(
  5. TED_VERSION DB =1.43), created on $tag(
  6. TED_DATE DB =11/09/85) at $tag(
  7. TED_TIME DB =22:24:44))#
  8. $undefine(tag)#
  9.     $version
  10.  
  11. (C) COPYRIGHT 1985 by System Enhancement Associates; ALL RIGHTS RESERVED
  12.  
  13.     By:  Thom Henderson
  14.  
  15.     Description:
  16.          This file contains certain DOS level routines that assist
  17.          in doing fancy things with an archive, primarily reading and
  18.          setting the date and time last modified.
  19.  
  20.          These are, by nature, system dependant functions.  But they are
  21.          also, by nature, very expendable.
  22.  
  23.     Language:
  24.          Computer Innovations Optimizing C86
  25. */
  26. #include <stdio.h>
  27. #include "arc.h"
  28. #include "fileio2.h"                   /* needed for filehand */
  29.  
  30. getstamp(f,date,time)                  /* get a file's date/time stamp */
  31. FILE *f;                               /* file to get stamp from */
  32. unsigned int *date, *time;             /* storage for the stamp */
  33. {
  34.     struct {int ax,bx,cx,dx,si,di,ds,es;} reg;
  35.  
  36.     reg.ax = 0x5700;                   /* get date/time */
  37.     reg.bx = filehand(f);              /* file handle */
  38.     if(sysint21(®,®)&1)          /* DOS call */
  39.          printf("Get timestamp fail (%d)\n",reg.ax);
  40.  
  41.     *date = reg.dx;                    /* save date/time */
  42.     *time = reg.cx;
  43. }
  44.  
  45. setstamp(f,date,time)                  /* set a file's date/time stamp */
  46. FILE *f;                               /* file to set stamp on */
  47. unsigned int date, time;               /* desired date, time */
  48. {
  49.     struct {int ax,bx,cx,dx,si,di,ds,es;} reg;
  50.  
  51.     fflush(f);                         /* force any pending output */
  52.  
  53.     reg.ax = 0x5701;                   /* set date/time */
  54.     reg.bx = filehand(f);              /* file handle */
  55.     reg.cx = time;                     /* desired time */
  56.     reg.dx = date;                     /* desired date */
  57.     if(sysint21(®,®)&1)          /* DOS call */
  58.          printf("Set timestamp fail (%d)\n",reg.ax);
  59. }
  60.  
  61. static int filehand(stream)            /* find handle on a file */
  62. struct bufstr *stream;                 /* file to grab onto */
  63. {
  64.     return stream->bufhand;            /* return DOS 2.0 file handle */
  65. }
  66.