home *** CD-ROM | disk | FTP | other *** search
/ Frostbyte's 1980s DOS Shareware Collection / floppyshareware.zip / floppyshareware / DOOG / CBASE09.ZIP / BLKIO10.ZIP / BTMP.C < prev    next >
Text File  |  1989-08-30  |  1KB  |  69 lines

  1. /* #ident    "btmp.c    1.1 - 89/07/03" */
  2.  
  3. #include "blkio_.h"
  4.  
  5. /*------------------------------------------------------------------------------
  6. DESCRIPTION
  7.      This file contains new ANSI C library functions used by the blkio
  8.      package.  Any functions included with your library should be deleted
  9.      from this file.
  10.  
  11. SEE ALSO
  12.      blkio.h.
  13.  
  14. ------------------------------------------------------------------------------*/
  15. void *calloc(n, size)
  16. size_t n;
  17. size_t size;
  18. {
  19.     void *rt = NULL;
  20.  
  21.     rt = (void *)malloc(n * size);
  22.     if (rt != NULL) {
  23.         memset(rt, 0, n * size);
  24.     }
  25.  
  26.     return rt;
  27. }
  28.  
  29. void *memmove(t, s, n)
  30. void *t;
  31. void *s;
  32. size_t n;
  33. {
  34.     void *buf = NULL;
  35.  
  36.     buf = calloc(1, n);
  37.     if (buf == NULL) {
  38.         return NULL;
  39.     }
  40.  
  41.     memcpy(buf, s, n);
  42.     memcpy(t, buf, n);
  43.  
  44.     free(buf);
  45.  
  46.     return t;
  47. }
  48.  
  49. char *strstr(cs, ct)
  50. char *cs;
  51. char *ct;
  52. {
  53.     size_t ctlen = 0;
  54.  
  55.     if ((cs == NULL) || (ct == NULL)) {
  56.         return NULL;
  57.     }
  58.  
  59.     ctlen = strlen(ct);
  60.     while (*cs != '\0') {
  61.         if (strncmp(cs, ct, ctlen) == 0) {
  62.             return cs;
  63.         }
  64.         cs++;
  65.     }
  66.  
  67.     return NULL;
  68. }
  69.