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