xref: /original-bsd/include/vis.h (revision c3e32dec)
1 /*-
2  * Copyright (c) 1990, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)vis.h	8.1 (Berkeley) 06/02/93
8  */
9 
10 #ifndef _VIS_H_
11 #define	_VIS_H_
12 
13 /*
14  * to select alternate encoding format
15  */
16 #define	VIS_OCTAL	0x01	/* use octal \ddd format */
17 #define	VIS_CSTYLE	0x02	/* use \[nrft0..] where appropiate */
18 
19 /*
20  * to alter set of characters encoded (default is to encode all
21  * non-graphic except space, tab, and newline).
22  */
23 #define	VIS_SP		0x04	/* also encode space */
24 #define	VIS_TAB		0x08	/* also encode tab */
25 #define	VIS_NL		0x10	/* also encode newline */
26 #define	VIS_WHITE	(VIS_SP | VIS_TAB | VIS_NL)
27 #define	VIS_SAFE	0x20	/* only encode "unsafe" characters */
28 
29 /*
30  * other
31  */
32 #define	VIS_NOSLASH	0x40	/* inhibit printing '\' */
33 
34 /*
35  * unvis return codes
36  */
37 #define	UNVIS_VALID	 1	/* character valid */
38 #define	UNVIS_VALIDPUSH	 2	/* character valid, push back passed char */
39 #define	UNVIS_NOCHAR	 3	/* valid sequence, no character produced */
40 #define	UNVIS_SYNBAD	-1	/* unrecognized escape sequence */
41 #define	UNVIS_ERROR	-2	/* decoder in unknown state (unrecoverable) */
42 
43 /*
44  * unvis flags
45  */
46 #define	UNVIS_END	1	/* no more characters */
47 
48 #include <sys/cdefs.h>
49 
50 __BEGIN_DECLS
51 char	*vis __P((char *, int, int, int));
52 int	strvis __P((char *, const char *, int));
53 int	strvisx __P((char *, const char *, size_t, int));
54 int	strunvis __P((char *, const char *));
55 int	unvis __P((char *, int, int *, int));
56 __END_DECLS
57 
58 #endif /* !_VIS_H_ */
59