OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [string/] [strpbrk.c] - Blame information for rev 455

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/*
2
FUNCTION
3
        <<strpbrk>>---find characters in string
4
 
5
INDEX
6
        strpbrk
7
 
8
ANSI_SYNOPSIS
9
        #include <string.h>
10
        char *strpbrk(const char *<[s1]>, const char *<[s2]>);
11
 
12
TRAD_SYNOPSIS
13
        #include <string.h>
14
        char *strpbrk(<[s1]>, <[s2]>)
15
        char *<[s1]>;
16
        char *<[s2]>;
17
 
18
DESCRIPTION
19
        This function locates the first occurence in the string
20
        pointed to by <[s1]> of any character in string pointed to by
21
        <[s2]> (excluding the terminating null character).
22
 
23
RETURNS
24
        <<strpbrk>> returns a pointer to the character found in <[s1]>, or a
25
        null pointer if no character from <[s2]> occurs in <[s1]>.
26
 
27
PORTABILITY
28
<<strpbrk>> requires no supporting OS subroutines.
29
*/
30
 
31
#include <string.h>
32
 
33
char *
34
_DEFUN (strpbrk, (s1, s2),
35
        _CONST char *s1 _AND
36
        _CONST char *s2)
37
{
38
  _CONST char *c = s2;
39
  if (!*s1)
40
    return (char *) NULL;
41
 
42
  while (*s1)
43
    {
44
      for (c = s2; *c; c++)
45
        {
46
          if (*s1 == *c)
47
            break;
48
        }
49
      if (*c)
50
        break;
51
      s1++;
52
    }
53
 
54
  if (*c == '\0')
55
    s1 = NULL;
56
 
57
  return (char *) s1;
58
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.