home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 387b.lha / dice_v2.02 / lib / string / strins.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-30  |  335 b   |  33 lines

  1.  
  2. /*
  3.  *  STRINS.C
  4.  */
  5.  
  6. void
  7. strins(d, s)
  8. char *d;
  9. const char *s;
  10. {
  11.     int len = strlen(s);    /*  # bytes to insert   */
  12.     int i;
  13.     char *ptr;
  14.  
  15.     /*
  16.      *    make room
  17.      */
  18.  
  19.     ptr = d + strlen(d);
  20.     while (ptr >= d) {
  21.     ptr[len] = ptr[0];
  22.     --ptr;
  23.     }
  24.  
  25.     /*
  26.      *    insert string
  27.      */
  28.  
  29.     while (*s)
  30.     *++ptr = *s++;
  31. }
  32.  
  33.