xref: /netbsd-src/sys/lib/libkern/skpc.c (revision 454af1c0e885cbba6b59706391f770d646303f8c)
1*454af1c0Sdsl /*	$NetBSD: skpc.c,v 1.7 2009/03/14 15:36:22 dsl Exp $	*/
2aa9eacddScgd 
32d4295ebScgd /*
42d4295ebScgd  * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
52d4295ebScgd  * All rights reserved.
62d4295ebScgd  *
72d4295ebScgd  * Redistribution and use in source and binary forms, with or without
82d4295ebScgd  * modification, are permitted provided that the following conditions
92d4295ebScgd  * are met:
102d4295ebScgd  * 1. Redistributions of source code must retain the above copyright
112d4295ebScgd  *    notice, this list of conditions and the following disclaimer.
122d4295ebScgd  * 2. Redistributions in binary form must reproduce the above copyright
132d4295ebScgd  *    notice, this list of conditions and the following disclaimer in the
142d4295ebScgd  *    documentation and/or other materials provided with the distribution.
15aad01611Sagc  * 3. Neither the name of the University nor the names of its contributors
162d4295ebScgd  *    may be used to endorse or promote products derived from this software
172d4295ebScgd  *    without specific prior written permission.
182d4295ebScgd  *
192d4295ebScgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
202d4295ebScgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
212d4295ebScgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
222d4295ebScgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
232d4295ebScgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
242d4295ebScgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
252d4295ebScgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
262d4295ebScgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
272d4295ebScgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
282d4295ebScgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
292d4295ebScgd  * SUCH DAMAGE.
302d4295ebScgd  *
31aa9eacddScgd  *	@(#)ufs_subr.c	7.13 (Berkeley) 6/28/90
322d4295ebScgd  */
332d4295ebScgd 
342d4295ebScgd #include <sys/types.h>
35fb901eb9Schristos #include <lib/libkern/libkern.h>
362d4295ebScgd 
372d4295ebScgd int
skpc(int mask,size_t size,u_char * cp)38*454af1c0Sdsl skpc(int mask, size_t size, u_char *cp)
392d4295ebScgd {
401279e67bSaugustss 	u_char *end = &cp[size];
412d4295ebScgd 
42fb901eb9Schristos 	while (cp < end && *cp == (u_char) mask)
432d4295ebScgd 		cp++;
442d4295ebScgd 	return (end - cp);
452d4295ebScgd }
46