xref: /netbsd-src/share/man/man9/scanc.9 (revision c0a3e99683742464deb7d896fc4c3f53d4475cf5)
1*c0a3e996Syamt.\"	$NetBSD: scanc.9,v 1.4 2013/04/24 00:56:14 yamt Exp $
2e9ab523bSyamt.\"
3f0a39962Syamt.\" Copyright (c)2011,2013 YAMAMOTO Takashi,
4e9ab523bSyamt.\" All rights reserved.
5e9ab523bSyamt.\"
6e9ab523bSyamt.\" Redistribution and use in source and binary forms, with or without
7e9ab523bSyamt.\" modification, are permitted provided that the following conditions
8e9ab523bSyamt.\" are met:
9e9ab523bSyamt.\" 1. Redistributions of source code must retain the above copyright
10e9ab523bSyamt.\"    notice, this list of conditions and the following disclaimer.
11e9ab523bSyamt.\" 2. Redistributions in binary form must reproduce the above copyright
12e9ab523bSyamt.\"    notice, this list of conditions and the following disclaimer in the
13e9ab523bSyamt.\"    documentation and/or other materials provided with the distribution.
14e9ab523bSyamt.\"
15e9ab523bSyamt.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16e9ab523bSyamt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17e9ab523bSyamt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18e9ab523bSyamt.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19e9ab523bSyamt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20e9ab523bSyamt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21e9ab523bSyamt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22e9ab523bSyamt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23e9ab523bSyamt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24e9ab523bSyamt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25e9ab523bSyamt.\" SUCH DAMAGE.
26e9ab523bSyamt.\"
27e9ab523bSyamt.\" ------------------------------------------------------------
28f0a39962Syamt.Dd April 24, 2013
29e9ab523bSyamt.Dt SCANC 9
30e9ab523bSyamt.Os
31e9ab523bSyamt.\" ------------------------------------------------------------
32e9ab523bSyamt.Sh NAME
33e9ab523bSyamt.Nm scanc
34f5088175Swiz.Nd use byte string as lookup table index
35e9ab523bSyamt.\" ------------------------------------------------------------
36e9ab523bSyamt.Sh SYNOPSIS
37e9ab523bSyamt.In lib/libkern/libkern.h
38e9ab523bSyamt.\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
39e9ab523bSyamt.Ft int
40e9ab523bSyamt.Fn scanc \
41*c0a3e996Syamt"u_int size" "const u_char *cp" "const u_char table[]" "int mask"
42e9ab523bSyamt.\" ------------------------------------------------------------
43e9ab523bSyamt.Sh DESCRIPTION
44e9ab523bSyamtThe
45e9ab523bSyamt.Fn scanc
46e9ab523bSyamtfunction scans the byte string
47e9ab523bSyamt.Fa cp ,
48e9ab523bSyamtwhose length is
49e9ab523bSyamt.Fa size .
50e9ab523bSyamtA character in the string is used as an index in the 256-byte
51e9ab523bSyamt.Fa table .
52e9ab523bSyamtIf a bitwise-AND of the byte from the table and
53e9ab523bSyamt.Fa mask
54f5088175Swizisn't zero or the string is exhausted, the scan stops.
55e9ab523bSyamt.\" ------------------------------------------------------------
56e9ab523bSyamt.Sh RETURN VALUES
57e9ab523bSyamtThe
58e9ab523bSyamt.Fn scanc
59f0a39962Syamtfunction returns the length of the rest of the string,
60f0a39962Syamtincluding the character which made the scan stop.
61f0a39962SyamtIf the
62f0a39962Syamt.Fn scanc
63f0a39962Syamtfunction exhausted the string, it returns 0.
64e9ab523bSyamt.\" ------------------------------------------------------------
65e9ab523bSyamt.Sh HISTORY
66e9ab523bSyamtThe
67e9ab523bSyamt.Fn scanc
68e9ab523bSyamtfunction emulates a VAX instruction with the same name.
69