home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / dos / compat / d_setdat.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-24  |  700 b   |  38 lines

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. /*
  3.  * D_SETDAT.C.
  4.  *
  5.  * Written by Peter Sulyok 1995 <sulyok@math.klte.hu>.
  6.  *
  7.  * This file is distributed WITHOUT ANY WARRANTY; without even the implied
  8.  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9.  *
  10.  */
  11.  
  12. #include <dpmi.h>
  13. #include <errno.h>
  14. #include <dos.h>
  15.  
  16. unsigned int _dos_setdate(struct _dosdate_t *date)
  17. {
  18.   __dpmi_regs r;
  19.  
  20.   if (date == 0)
  21.   {
  22.     errno = EINVAL;
  23.     return -1;
  24.   }
  25.  
  26.   r.h.ah = 0x2B;
  27.   r.x.cx = date->year;
  28.   r.h.dh = date->month;
  29.   r.h.dl = date->day;
  30.   __dpmi_int(0x21, &r);
  31.   if ( r.h.al )
  32.   {
  33.     errno = EINVAL;
  34.     return 1;
  35.   }
  36.   return 0;
  37. }
  38.