
/*  File   : strnlen.c
    Author : Richard A. O'Keefe.
    Updated: 10 April 1984
    Defines: strnlen()

    strnlen(src, len)
    returns the number of characters up to the first NUL in src, or len,
    whichever is smaller.  This is the same as strnend(src,len)-src.
*/

int strnlen(s, n)
    register char *s;
    register int n;
    {
        register int L;

        for (L = 0; --n >= 0 && *s++; L++) ;
        return L;
    }

