1: /*	@(#)strncpy.c	2.1	SCCS id keyword	*/
   2: /*
   3:  * Copy s2 to s1, truncating or null-padding to always copy n bytes
   4:  * return s1
   5:  */
   6: 
   7: char *
   8: strncpy(s1, s2, n)
   9: register char *s1, *s2;
  10: {
  11:     register i;
  12:     register char *os1;
  13: 
  14:     os1 = s1;
  15:     for (i = 0; i < n; i++)
  16:         if ((*s1++ = *s2++) == '\0') {
  17:             while (++i < n)
  18:                 *s1++ = '\0';
  19:             return(os1);
  20:         }
  21:     return(os1);
  22: }

Defined functions

strncpy defined in line 7; used 75 times
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 671
Valid CSS Valid XHTML 1.0 Strict