|
|
1.1 ! root 1: /* ! 2: * Coherent Standard I/O Library ! 3: * Copy one fixed length string to another. ! 4: */ ! 5: ! 6: #include <stdio.h> ! 7: ! 8: char * ! 9: strncpy(as1, s2, n) ! 10: char *as1; ! 11: register char *s2; ! 12: register unsigned n; ! 13: { ! 14: register char *s1; ! 15: ! 16: s1 = as1; ! 17: while (n > 0) { ! 18: n--; ! 19: if ((*s1++ = *s2++) == '\0') ! 20: break; ! 21: } ! 22: while (n--) ! 23: *s1++ = 0; ! 24: return (as1); ! 25: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.