Annotation of researchv9/libc/gen/strncpy.c, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.