xref: /csrg-svn/include/vis.h (revision 61072)
144297Smarc /*-
2*61072Sbostic  * Copyright (c) 1990, 1993
3*61072Sbostic  *	The Regents of the University of California.  All rights reserved.
439285Smarc  *
544297Smarc  * %sccs.include.redist.c%
639285Smarc  *
7*61072Sbostic  *	@(#)vis.h	8.1 (Berkeley) 06/02/93
839285Smarc  */
939285Smarc 
1047789Sbostic #ifndef _VIS_H_
1147789Sbostic #define	_VIS_H_
1247789Sbostic 
1339285Smarc /*
1441753Smarc  * to select alternate encoding format
1539285Smarc  */
1641753Smarc #define	VIS_OCTAL	0x01	/* use octal \ddd format */
1744297Smarc #define	VIS_CSTYLE	0x02	/* use \[nrft0..] where appropiate */
1844297Smarc 
1941753Smarc /*
2044297Smarc  * to alter set of characters encoded (default is to encode all
2144297Smarc  * non-graphic except space, tab, and newline).
2241753Smarc  */
2344297Smarc #define	VIS_SP		0x04	/* also encode space */
2444297Smarc #define	VIS_TAB		0x08	/* also encode tab */
2544297Smarc #define	VIS_NL		0x10	/* also encode newline */
2644297Smarc #define	VIS_WHITE	(VIS_SP | VIS_TAB | VIS_NL)
2744297Smarc #define	VIS_SAFE	0x20	/* only encode "unsafe" characters */
2844297Smarc 
2941753Smarc /*
3041753Smarc  * other
3141753Smarc  */
3244297Smarc #define	VIS_NOSLASH	0x40	/* inhibit printing '\' */
3339285Smarc 
3444297Smarc /*
3544297Smarc  * unvis return codes
3644297Smarc  */
3744297Smarc #define	UNVIS_VALID	 1	/* character valid */
3844297Smarc #define	UNVIS_VALIDPUSH	 2	/* character valid, push back passed char */
3944297Smarc #define	UNVIS_NOCHAR	 3	/* valid sequence, no character produced */
4044297Smarc #define	UNVIS_SYNBAD	-1	/* unrecognized escape sequence */
4144297Smarc #define	UNVIS_ERROR	-2	/* decoder in unknown state (unrecoverable) */
4241753Smarc 
4339285Smarc /*
4441753Smarc  * unvis flags
4539285Smarc  */
4644297Smarc #define	UNVIS_END	1	/* no more characters */
4739285Smarc 
4846283Sbostic #include <sys/cdefs.h>
4946283Sbostic 
5046283Sbostic __BEGIN_DECLS
5152362Sbostic char	*vis __P((char *, int, int, int));
5246283Sbostic int	strvis __P((char *, const char *, int));
5346283Sbostic int	strvisx __P((char *, const char *, size_t, int));
5446515Sdonn int	strunvis __P((char *, const char *));
5552362Sbostic int	unvis __P((char *, int, int *, int));
5646283Sbostic __END_DECLS
5747789Sbostic 
5847789Sbostic #endif /* !_VIS_H_ */
59