Annotation of 43BSDTahoe/lib/libc/gen/strncpy.c, revision 1.1

1.1     ! root        1: #if defined(LIBC_SCCS) && !defined(lint)
        !             2: static char sccsid[] = "@(#)strncpy.c  5.2 (Berkeley) 3/9/86";
        !             3: #endif LIBC_SCCS and not lint
        !             4: 
        !             5: /*
        !             6:  * Copy s2 to s1, truncating or null-padding to always copy n bytes
        !             7:  * return s1
        !             8:  */
        !             9: 
        !            10: char *
        !            11: strncpy(s1, s2, n)
        !            12: register char *s1, *s2;
        !            13: {
        !            14:        register i;
        !            15:        register char *os1;
        !            16: 
        !            17:        os1 = s1;
        !            18:        for (i = 0; i < n; i++)
        !            19:                if ((*s1++ = *s2++) == '\0') {
        !            20:                        while (++i < n)
        !            21:                                *s1++ = '\0';
        !            22:                        return(os1);
        !            23:                }
        !            24:        return(os1);
        !            25: }

unix.superglobalmegacorp.com

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