home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / COMPRESS / ARC520S.ZIP / ARCDOS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-10-23  |  2.1 KB  |  60 lines

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