1*383f218aSitojun /* $NetBSD: wcscspn.c,v 1.1 2000/12/23 23:14:36 itojun Exp $ */ 2*383f218aSitojun 3*383f218aSitojun /*- 4*383f218aSitojun * Copyright (c)1999 Citrus Project, 5*383f218aSitojun * All rights reserved. 6*383f218aSitojun * 7*383f218aSitojun * Redistribution and use in source and binary forms, with or without 8*383f218aSitojun * modification, are permitted provided that the following conditions 9*383f218aSitojun * are met: 10*383f218aSitojun * 1. Redistributions of source code must retain the above copyright 11*383f218aSitojun * notice, this list of conditions and the following disclaimer. 12*383f218aSitojun * 2. Redistributions in binary form must reproduce the above copyright 13*383f218aSitojun * notice, this list of conditions and the following disclaimer in the 14*383f218aSitojun * documentation and/or other materials provided with the distribution. 15*383f218aSitojun * 16*383f218aSitojun * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17*383f218aSitojun * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18*383f218aSitojun * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19*383f218aSitojun * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20*383f218aSitojun * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21*383f218aSitojun * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22*383f218aSitojun * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23*383f218aSitojun * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24*383f218aSitojun * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25*383f218aSitojun * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26*383f218aSitojun * SUCH DAMAGE. 27*383f218aSitojun * 28*383f218aSitojun * citrus Id: wcscspn.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp 29*383f218aSitojun */ 30*383f218aSitojun 31*383f218aSitojun #include <sys/cdefs.h> 32*383f218aSitojun #if defined(LIBC_SCCS) && !defined(lint) 33*383f218aSitojun __RCSID("$NetBSD: wcscspn.c,v 1.1 2000/12/23 23:14:36 itojun Exp $"); 34*383f218aSitojun #endif /* LIBC_SCCS and not lint */ 35*383f218aSitojun 36*383f218aSitojun #include <wchar.h> 37*383f218aSitojun 38*383f218aSitojun size_t 39*383f218aSitojun wcscspn(s, set) 40*383f218aSitojun const wchar_t *s; 41*383f218aSitojun const wchar_t *set; 42*383f218aSitojun { 43*383f218aSitojun const wchar_t *p; 44*383f218aSitojun const wchar_t *q; 45*383f218aSitojun 46*383f218aSitojun p = s; 47*383f218aSitojun while (*p) { 48*383f218aSitojun q = set; 49*383f218aSitojun while (*q) { 50*383f218aSitojun if (*p == *q) 51*383f218aSitojun goto done; 52*383f218aSitojun q++; 53*383f218aSitojun } 54*383f218aSitojun p++; 55*383f218aSitojun } 56*383f218aSitojun 57*383f218aSitojun done: 58*383f218aSitojun return (p - s); 59*383f218aSitojun } 60