home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V7 / usr / src / libc / gen / strncat.c < prev    next >
Encoding:
Text File  |  1979-01-10  |  337 b   |  25 lines

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