home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / cbase.zip / CBASE10B.ZIP / ROLODECK.ZIP / KRTMP.C < prev    next >
Text File  |  1989-10-31  |  1KB  |  58 lines

  1. /* #ident    "krtmp.c    1.2 - 89/10/31" */
  2.  
  3. /*man---------------------------------------------------------------------------
  4. NAME
  5.     krtmp - K&R C temporary ANSI functions
  6.  
  7. DESCRIPTION
  8.     This file contains ANSI functions required by cbase which may not
  9.     be available with K&R compilers.
  10.  
  11. ------------------------------------------------------------------------------*/
  12. #if __STDC__ != 1
  13. #include <stdio.h>
  14. #include <sys/types.h>
  15. void *calloc();
  16. void free();
  17.  
  18. void *memmove(t, s, n)
  19. void *t;
  20. void *s;
  21. size_t n;
  22. {
  23.     void *buf = NULL;
  24.     if ((buf = calloc((size_t)1, n)) == NULL) return NULL;
  25.     memcpy(buf, s, n);
  26.     memcpy(t, buf, n);
  27.     free(buf);
  28.     return t;
  29. }
  30.  
  31. int link();
  32. int unlink();
  33.  
  34. int remove(filename)
  35. char *filename;
  36. {
  37.     if (unlink(filename) == -1) {
  38.         return -1;
  39.     }
  40.  
  41.     return 0;
  42. }
  43.  
  44. int rename(file1, file2)
  45. char *file1;
  46. char *file2;
  47. {
  48.     if (link(file1, file2) == -1) {
  49.         return -1;
  50.     }
  51.     if (unlink(file1) == -1) {
  52.         return -1;
  53.     }
  54.  
  55.     return 0;
  56. }
  57. #endif
  58.