home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / communic / pcmail / main / sysdep.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-05  |  2.0 KB  |  122 lines

  1. /*++
  2. /* NAME
  3. /*    sysdep 5
  4. /* SUMMARY
  5. /*    other system-dependent routines for MS-DOS or ST
  6. /* PROJECT
  7. /*    pc-mail
  8. /* PACKAGE
  9. /*    cico
  10. /* SYNOPSIS
  11. /*    #include "sysdep.h"
  12. /* DESCRIPTION
  13. /*    void.
  14. /* AUTHOR(S)
  15. /*    Some parts taken from uuslave sources written by John Gilmore
  16. /*    (gnu@hoptoad.com).
  17. /*
  18. /*    W.Z. Venema
  19. /*    Eindhoven University of Technology
  20. /*    Department of Mathematics and Computer Science
  21. /*    Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
  22. /* CREATION DATE
  23. /*    Sun Apr 12 17:48:08 GMT+1:00 1987
  24. /* LAST MODIFICATION
  25. /*    90/01/22 13:02:46
  26. /* VERSION/RELEASE
  27. /*    2.1
  28. /*--*/
  29.  
  30. #include "sysdep.h"
  31.  
  32. sigint()
  33. {
  34.     /* Restore terminal settings on dialout line */
  35. #ifdef MSDOS
  36.     uninit_comm();
  37.     reset_tty();
  38. #endif
  39. #ifdef ST
  40.     /* No need to do anything here? */
  41. #endif
  42.  
  43.     exit(0);
  44. }
  45.  
  46.  /*
  47.   * MSDOS and ST need some of these routines.  Probably should use the new
  48.   * names, but for now...
  49.   */
  50.  
  51. bzero(s, cnt)
  52. register char *s;
  53. register int cnt;
  54. {
  55.     register int i;
  56.  
  57.     for (i = 0; i < cnt; i++) {
  58.     *s++ = '\0';
  59.     }
  60. }
  61.  
  62. bcopy(from, to, cnt)
  63. register char *from;
  64. register char *to;
  65. register int cnt;
  66. {
  67.     register int i;
  68.  
  69.     for (i = 0; i < cnt; i++) {
  70.     *to++ = *from++;
  71.     }
  72. }
  73.  
  74. #ifdef MSDOS
  75.  /*
  76.   * MSDOS routines for handling the comm port.
  77.   * 
  78.   * get_time() fills timetype structure n with current time using DOS interrupt
  79.   * 21
  80.   * 
  81.   */
  82.  
  83. get_time(n)
  84. TIME_PTR n;
  85. {
  86.     union REGS inregs;
  87.     union REGS outregs;
  88.  
  89.     inregs.h.ah = 0x2c;                /* Please make a #define for
  90.                          * this, Tim */
  91.  
  92.     int86(0x21, &inregs, &outregs);        /* Please #define the 0x21
  93.                          * too */
  94.  
  95.     n->hour = outregs.h.ch;
  96.     n->minute = outregs.h.cl;
  97.     n->sec = outregs.h.dh;
  98.     n->hsec = outregs.h.dl;
  99.  
  100.     return (0);
  101. }
  102.  
  103. sleep(x)
  104. int     x;
  105. {
  106.     int     i;
  107.     unsigned s;
  108.     TIME    n;                /* current time record */
  109.  
  110.     i = 0;
  111.     get_time(&n);
  112.     s = n.sec;
  113.  
  114.     while (i < x) {
  115.     while (s == n.sec)
  116.         get_time(&n);
  117.     s = n.sec;
  118.     ++i;
  119.     }
  120. }
  121. #endif
  122.