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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc2/] [newlib/] [libc/] [string/] [strpbrk.c] - Diff between revs 207 and 520

Only display areas with differences | Details | Blame | View Log

Rev 207 Rev 520
/*
/*
FUNCTION
FUNCTION
        <<strpbrk>>---find characters in string
        <<strpbrk>>---find characters in string
 
 
INDEX
INDEX
        strpbrk
        strpbrk
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <string.h>
        #include <string.h>
        char *strpbrk(const char *<[s1]>, const char *<[s2]>);
        char *strpbrk(const char *<[s1]>, const char *<[s2]>);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
        #include <string.h>
        #include <string.h>
        char *strpbrk(<[s1]>, <[s2]>)
        char *strpbrk(<[s1]>, <[s2]>)
        char *<[s1]>;
        char *<[s1]>;
        char *<[s2]>;
        char *<[s2]>;
 
 
DESCRIPTION
DESCRIPTION
        This function locates the first occurence in the string
        This function locates the first occurence in the string
        pointed to by <[s1]> of any character in string pointed to by
        pointed to by <[s1]> of any character in string pointed to by
        <[s2]> (excluding the terminating null character).
        <[s2]> (excluding the terminating null character).
 
 
RETURNS
RETURNS
        <<strpbrk>> returns a pointer to the character found in <[s1]>, or a
        <<strpbrk>> returns a pointer to the character found in <[s1]>, or a
        null pointer if no character from <[s2]> occurs in <[s1]>.
        null pointer if no character from <[s2]> occurs in <[s1]>.
 
 
PORTABILITY
PORTABILITY
<<strpbrk>> requires no supporting OS subroutines.
<<strpbrk>> requires no supporting OS subroutines.
*/
*/
 
 
#include <string.h>
#include <string.h>
 
 
char *
char *
_DEFUN (strpbrk, (s1, s2),
_DEFUN (strpbrk, (s1, s2),
        _CONST char *s1 _AND
        _CONST char *s1 _AND
        _CONST char *s2)
        _CONST char *s2)
{
{
  _CONST char *c = s2;
  _CONST char *c = s2;
  if (!*s1)
  if (!*s1)
    return (char *) NULL;
    return (char *) NULL;
 
 
  while (*s1)
  while (*s1)
    {
    {
      for (c = s2; *c; c++)
      for (c = s2; *c; c++)
        {
        {
          if (*s1 == *c)
          if (*s1 == *c)
            break;
            break;
        }
        }
      if (*c)
      if (*c)
        break;
        break;
      s1++;
      s1++;
    }
    }
 
 
  if (*c == '\0')
  if (*c == '\0')
    s1 = NULL;
    s1 = NULL;
 
 
  return (char *) s1;
  return (char *) s1;
}
}
 
 

powered by: WebSVN 2.1.0

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