home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gccdist / gcc-src / vms / gcclib / strings / strncat.c < prev    next >
Encoding:
Text File  |  1992-04-09  |  336 b   |  26 lines

  1. /*
  2.  *    Replacement "strcat" routine
  3.  */
  4.  
  5. /*
  6.  * Concatenate s2 on the end of s1.  S1's space must be large enough.
  7.  * Return s1.
  8.  */
  9.  
  10. char *
  11. strncat(s1, s2, n)
  12. register char *s1, *s2;
  13. register int n;
  14. {
  15.     register char *os1;
  16.  
  17.     os1 = s1;
  18.     while (*s1++)
  19.         ;
  20.     --s1;
  21.     while (*s1++ = *s2++)
  22.       if(n-- <= 0) {*--s1 = 0; break;};
  23.  
  24.     return(os1);
  25. }
  26.