coreutils/lib/strpbrk.c

43 lines
1.3 KiB
C
Raw Normal View History

2003-09-14 06:01:20 +08:00
/* Copyright (C) 1991, 1994, 2000, 2002-2003 Free Software Foundation, Inc.
1995-10-09 11:46:41 +08:00
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
1995-10-09 11:42:11 +08:00
1995-10-09 11:46:41 +08:00
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
1995-10-09 11:42:11 +08:00
1995-10-09 11:46:41 +08:00
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
1995-10-09 11:42:11 +08:00
1995-10-09 11:46:41 +08:00
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
2005-05-14 15:58:06 +08:00
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
1995-10-09 11:42:11 +08:00
2003-08-18 17:44:49 +08:00
#ifdef HAVE_CONFIG_H
1995-10-09 11:46:41 +08:00
# include <config.h>
#endif
1995-10-09 11:42:11 +08:00
2002-12-01 18:42:12 +08:00
#include <stddef.h>
2003-09-14 06:01:20 +08:00
#include <string.h>
2002-12-01 18:42:12 +08:00
#undef strpbrk
2002-11-22 19:13:32 +08:00
/* Find the first occurrence in S of any character in ACCEPT. */
1995-10-09 11:42:11 +08:00
char *
strpbrk (const char *s, const char *accept)
1995-10-09 11:42:11 +08:00
{
while (*s != '\0')
{
const char *a = accept;
while (*a != '\0')
if (*a++ == *s)
return (char *) s;
++s;
}
2002-12-01 18:42:12 +08:00
return NULL;
1995-10-09 11:42:11 +08:00
}