root/lib/libc/strlen.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. strlen

   1 /* 
   2 FUNCTION
   3         <<strlen>>---character string length
   4         
   5 INDEX
   6         strlen
   7 
   8 ANSI_SYNOPSIS
   9         #include <string.h>
  10         size_t strlen(const char *<[str]>);
  11 
  12 TRAD_SYNOPSIS
  13         #include <string.h>
  14         size_t strlen(<[str]>)
  15         char *<[src]>;
  16 
  17 DESCRIPTION
  18         The <<strlen>> function works out the length of the string
  19         starting at <<*<[str]>>> by counting chararacters until it
  20         reaches a <<NULL>> character.
  21 
  22 RETURNS
  23         <<strlen>> returns the character count.
  24 
  25 PORTABILITY
  26 <<strlen>> is ANSI C.
  27 
  28 <<strlen>> requires no supporting OS subroutines.
  29 
  30 QUICKREF
  31         strlen ansi pure
  32 */
  33 
  34 long strlen(const char *str)
  35 {
  36   const char *start = str;
  37 
  38   while (*str)
  39     str++;
  40 
  41   return str - start;
  42 }

/* [<][>][^][v][top][bottom][index][help] */