~ubuntu-branches/ubuntu/utopic/binutils-arm64-cross/utopic

« back to all changes in this revision

Viewing changes to binutils-2.23.52.20130611/libiberty/strchr.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-06-20 17:38:09 UTC
  • Revision ID: package-import@ubuntu.com-20130620173809-app8lzgvymy5fg6c
Tags: 0.7
Build-depend on binutils-source (>= 2.23.52.20130620-1~).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Portable version of strchr()
 
2
   This function is in the public domain.  */
 
3
 
 
4
/*
 
5
 
 
6
@deftypefn Supplemental char* strchr (const char *@var{s}, int @var{c})
 
7
 
 
8
Returns a pointer to the first occurrence of the character @var{c} in
 
9
the string @var{s}, or @code{NULL} if not found.  If @var{c} is itself the
 
10
null character, the results are undefined.
 
11
 
 
12
@end deftypefn
 
13
 
 
14
*/
 
15
 
 
16
#include <ansidecl.h>
 
17
 
 
18
char *
 
19
strchr (register const char *s, int c)
 
20
{
 
21
  do {
 
22
    if (*s == c)
 
23
      {
 
24
        return (char*)s;
 
25
      }
 
26
  } while (*s++);
 
27
  return (0);
 
28
}