Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:19

0001 /*  $NetBSD: vis.h,v 1.16 2005/09/13 01:44:32 christos Exp $    */
0002 
0003 /*-
0004  * Copyright (c) 1990, 1993
0005  *  The Regents of the University of California.  All rights reserved.
0006  *
0007  * Redistribution and use in source and binary forms, with or without
0008  * modification, are permitted provided that the following conditions
0009  * are met:
0010  * 1. Redistributions of source code must retain the above copyright
0011  *    notice, this list of conditions and the following disclaimer.
0012  * 2. Redistributions in binary form must reproduce the above copyright
0013  *    notice, this list of conditions and the following disclaimer in the
0014  *    documentation and/or other materials provided with the distribution.
0015  * 3. Neither the name of the University nor the names of its contributors
0016  *    may be used to endorse or promote products derived from this software
0017  *    without specific prior written permission.
0018  *
0019  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
0020  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0021  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0022  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
0023  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0024  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0025  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0026  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0027  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0028  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0029  * SUCH DAMAGE.
0030  *
0031  *  @(#)vis.h   8.1 (Berkeley) 6/2/93
0032  */
0033 
0034 #ifndef _VIS_H_
0035 #define _VIS_H_
0036 
0037 #include <sys/types.h>
0038 
0039 /*
0040  * to select alternate encoding format
0041  */
0042 #define VIS_OCTAL   0x01    /* use octal \ddd format */
0043 #define VIS_CSTYLE  0x02    /* use \[nrft0..] where appropiate */
0044 
0045 /*
0046  * to alter set of characters encoded (default is to encode all
0047  * non-graphic except space, tab, and newline).
0048  */
0049 #define VIS_SP      0x04    /* also encode space */
0050 #define VIS_TAB     0x08    /* also encode tab */
0051 #define VIS_NL      0x10    /* also encode newline */
0052 #define VIS_WHITE   (VIS_SP | VIS_TAB | VIS_NL)
0053 #define VIS_SAFE    0x20    /* only encode "unsafe" characters */
0054 
0055 /*
0056  * other
0057  */
0058 #define VIS_NOSLASH 0x40    /* inhibit printing '\' */
0059 #define VIS_HTTPSTYLE   0x80    /* http-style escape % HEX HEX */
0060 
0061 /*
0062  * unvis return codes
0063  */
0064 #define UNVIS_VALID  1  /* character valid */
0065 #define UNVIS_VALIDPUSH  2  /* character valid, push back passed char */
0066 #define UNVIS_NOCHAR     3  /* valid sequence, no character produced */
0067 #define UNVIS_SYNBAD    -1  /* unrecognized escape sequence */
0068 #define UNVIS_ERROR -2  /* decoder in unknown state (unrecoverable) */
0069 
0070 /*
0071  * unvis flags
0072  */
0073 #define UNVIS_END   1   /* no more characters */
0074 
0075 #include <sys/cdefs.h>
0076 
0077 __BEGIN_DECLS
0078 char    *vis(char *, int, int, int);
0079 char    *svis(char *, int, int, int, const char *);
0080 int strvis(char *, const char *, int);
0081 int strsvis(char *, const char *, int, const char *);
0082 int strvisx(char *, const char *, size_t, int);
0083 int strsvisx(char *, const char *, size_t, int, const char *);
0084 int strunvis(char *, const char *);
0085 int strunvisx(char *, const char *, int);
0086 #ifndef __LIBC12_SOURCE__
0087 //int   unvis(char *, int, int *, int) __RENAME(__unvis13);
0088 #endif
0089 __END_DECLS
0090 
0091 #endif /* !_VIS_H_ */