vis.hin revision 72445
159243Sobrien/*	$NetBSD: vis.h,v 1.11 1999/11/25 16:55:50 wennmach Exp $	*/
2167465Smp/*	$Id: vis.hin,v 1.1 2000/12/06 21:35:47 joda Exp $	*/
359243Sobrien
459243Sobrien/*-
559243Sobrien * Copyright (c) 1990, 1993
659243Sobrien *	The Regents of the University of California.  All rights reserved.
759243Sobrien *
859243Sobrien * Redistribution and use in source and binary forms, with or without
959243Sobrien * modification, are permitted provided that the following conditions
1059243Sobrien * are met:
1159243Sobrien * 1. Redistributions of source code must retain the above copyright
1259243Sobrien *    notice, this list of conditions and the following disclaimer.
1359243Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1459243Sobrien *    notice, this list of conditions and the following disclaimer in the
1559243Sobrien *    documentation and/or other materials provided with the distribution.
1659243Sobrien * 3. All advertising materials mentioning features or use of this software
1759243Sobrien *    must display the following acknowledgement:
1859243Sobrien *	This product includes software developed by the University of
1959243Sobrien *	California, Berkeley and its contributors.
2059243Sobrien * 4. Neither the name of the University nor the names of its contributors
2159243Sobrien *    may be used to endorse or promote products derived from this software
2259243Sobrien *    without specific prior written permission.
2359243Sobrien *
2459243Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2559243Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2659243Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2759243Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2859243Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2959243Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3059243Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3159243Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3259243Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3359243Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3459243Sobrien * SUCH DAMAGE.
3559243Sobrien *
3659243Sobrien *	@(#)vis.h	8.1 (Berkeley) 6/2/93
3759243Sobrien */
3859243Sobrien
3959243Sobrien#ifndef _VIS_H_
4059243Sobrien#define	_VIS_H_
4159243Sobrien
4259243Sobrien/*
4359243Sobrien * to select alternate encoding format
4459243Sobrien */
4559243Sobrien#define	VIS_OCTAL	0x01	/* use octal \ddd format */
4659243Sobrien#define	VIS_CSTYLE	0x02	/* use \[nrft0..] where appropiate */
4759243Sobrien
4859243Sobrien/*
4959243Sobrien * to alter set of characters encoded (default is to encode all
5059243Sobrien * non-graphic except space, tab, and newline).
5159243Sobrien */
5259243Sobrien#define	VIS_SP		0x04	/* also encode space */
5359243Sobrien#define	VIS_TAB		0x08	/* also encode tab */
5459243Sobrien#define	VIS_NL		0x10	/* also encode newline */
5559243Sobrien#define	VIS_WHITE	(VIS_SP | VIS_TAB | VIS_NL)
5659243Sobrien#define	VIS_SAFE	0x20	/* only encode "unsafe" characters */
5759243Sobrien
5859243Sobrien/*
5959243Sobrien * other
6059243Sobrien */
6159243Sobrien#define	VIS_NOSLASH	0x40	/* inhibit printing '\' */
6259243Sobrien
6359243Sobrien/*
6459243Sobrien * unvis return codes
6559243Sobrien */
66#define	UNVIS_VALID	 1	/* character valid */
67#define	UNVIS_VALIDPUSH	 2	/* character valid, push back passed char */
68#define	UNVIS_NOCHAR	 3	/* valid sequence, no character produced */
69#define	UNVIS_SYNBAD	-1	/* unrecognized escape sequence */
70#define	UNVIS_ERROR	-2	/* decoder in unknown state (unrecoverable) */
71
72/*
73 * unvis flags
74 */
75#define	UNVIS_END	1	/* no more characters */
76
77char	*vis (char *, int, int, int);
78char	*svis (char *, int, int, int, const char *);
79int	strvis (char *, const char *, int);
80int	strsvis (char *, const char *, int, const char *);
81int	strvisx (char *, const char *, size_t, int);
82int	strsvisx (char *, const char *, size_t, int, const char *);
83int	strunvis (char *, const char *);
84int	unvis (char *, int, int *, int);
85
86#endif /* !_VIS_H_ */
87