|
1 |
| -/* $NetBSD: vis.h,v 1.25 2017/04/23 01:57:36 christos Exp $ */ |
| 1 | +/* $OpenBSD: vis.h,v 1.15 2015/07/20 01:52:27 millert Exp $ */ |
| 2 | +/* $NetBSD: vis.h,v 1.4 1994/10/26 00:56:41 cgd Exp $ */ |
2 | 3 |
|
3 | 4 | /*-
|
4 |
| - * Copyright (c) 1990, 1993 |
5 |
| - * The Regents of the University of California. All rights reserved. |
| 5 | + * Copyright (c) 1990 The Regents of the University of California. |
| 6 | + * All rights reserved. |
6 | 7 | *
|
7 | 8 | * Redistribution and use in source and binary forms, with or without
|
8 | 9 | * modification, are permitted provided that the following conditions
|
|
28 | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
29 | 30 | * SUCH DAMAGE.
|
30 | 31 | *
|
31 |
| - * @(#)vis.h 8.1 (Berkeley) 6/2/93 |
| 32 | + * @(#)vis.h 5.9 (Berkeley) 4/3/91 |
32 | 33 | */
|
33 | 34 |
|
34 | 35 | #ifndef _VIS_H_
|
35 | 36 | #define _VIS_H_
|
36 | 37 |
|
37 |
| -#include <bsd.h> |
38 |
| -#include <sys/types.h> |
39 |
| - |
40 | 38 | /*
|
41 | 39 | * to select alternate encoding format
|
42 | 40 | */
|
43 |
| -#define VIS_OCTAL 0x0001 /* use octal \ddd format */ |
44 |
| -#define VIS_CSTYLE 0x0002 /* use \[nrft0..] where appropiate */ |
| 41 | +#define VIS_OCTAL 0x01 /* use octal \ddd format */ |
| 42 | +#define VIS_CSTYLE 0x02 /* use \[nrft0..] where appropriate */ |
45 | 43 |
|
46 | 44 | /*
|
47 | 45 | * to alter set of characters encoded (default is to encode all
|
48 | 46 | * non-graphic except space, tab, and newline).
|
49 | 47 | */
|
50 |
| -#define VIS_SP 0x0004 /* also encode space */ |
51 |
| -#define VIS_TAB 0x0008 /* also encode tab */ |
52 |
| -#define VIS_NL 0x0010 /* also encode newline */ |
| 48 | +#define VIS_SP 0x04 /* also encode space */ |
| 49 | +#define VIS_TAB 0x08 /* also encode tab */ |
| 50 | +#define VIS_NL 0x10 /* also encode newline */ |
53 | 51 | #define VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL)
|
54 |
| -#define VIS_SAFE 0x0020 /* only encode "unsafe" characters */ |
55 |
| -#define VIS_DQ 0x8000 /* also encode double quotes */ |
| 52 | +#define VIS_SAFE 0x20 /* only encode "unsafe" characters */ |
| 53 | +#define VIS_DQ 0x200 /* backslash-escape double quotes */ |
| 54 | +#define VIS_ALL 0x400 /* encode all characters */ |
56 | 55 |
|
57 | 56 | /*
|
58 | 57 | * other
|
59 | 58 | */
|
60 |
| -#define VIS_NOSLASH 0x0040 /* inhibit printing '\' */ |
61 |
| -#define VIS_HTTP1808 0x0080 /* http-style escape % hex hex */ |
62 |
| -#define VIS_HTTPSTYLE 0x0080 /* http-style escape % hex hex */ |
63 |
| -#define VIS_MIMESTYLE 0x0100 /* mime-style escape = HEX HEX */ |
64 |
| -#define VIS_HTTP1866 0x0200 /* http-style &#num; or &string; */ |
65 |
| -#define VIS_NOESCAPE 0x0400 /* don't decode `\' */ |
66 |
| -#define _VIS_END 0x0800 /* for unvis */ |
67 |
| -#define VIS_GLOB 0x1000 /* encode glob(3) magic characters */ |
68 |
| -#define VIS_SHELL 0x2000 /* encode shell special characters [not glob] */ |
69 |
| -#define VIS_META (VIS_WHITE | VIS_GLOB | VIS_SHELL) |
70 |
| -#define VIS_NOLOCALE 0x4000 /* encode using the C locale */ |
| 59 | +#define VIS_NOSLASH 0x40 /* inhibit printing '\' */ |
| 60 | +#define VIS_GLOB 0x100 /* encode glob(3) magics and '#' */ |
71 | 61 |
|
72 | 62 | /*
|
73 | 63 | * unvis return codes
|
|
81 | 71 | /*
|
82 | 72 | * unvis flags
|
83 | 73 | */
|
84 |
| -#define UNVIS_END _VIS_END /* no more characters */ |
| 74 | +#define UNVIS_END 1 /* no more characters */ |
| 75 | + |
| 76 | +#include <bsd.h> |
85 | 77 |
|
86 | 78 | __BEGIN_DECLS
|
87 | 79 | char *vis(char *, int, int, int);
|
88 |
| -char *nvis(char *, size_t, int, int, int); |
89 |
| - |
90 |
| -char *svis(char *, int, int, int, const char *); |
91 |
| -char *snvis(char *, size_t, int, int, int, const char *); |
92 |
| - |
93 | 80 | int strvis(char *, const char *, int);
|
94 | 81 | int stravis(char **, const char *, int);
|
95 |
| -int strnvis(char *, size_t, const char *, int); |
96 |
| - |
97 |
| -int strsvis(char *, const char *, int, const char *); |
98 |
| -int strsnvis(char *, size_t, const char *, int, const char *); |
99 |
| - |
100 |
| -int strvisx(char *, const char *, size_t, int); |
101 |
| -int strnvisx(char *, size_t, const char *, size_t, int); |
102 |
| -int strenvisx(char *, size_t, const char *, size_t, int, int *); |
103 |
| - |
104 |
| -int strsvisx(char *, const char *, size_t, int, const char *); |
105 |
| -int strsnvisx(char *, size_t, const char *, size_t, int, const char *); |
106 |
| -int strsenvisx(char *, size_t, const char *, size_t , int, const char *, |
107 |
| - int *); |
108 |
| - |
| 82 | +int strnvis(char *, const char *, size_t, int) |
| 83 | + __attribute__ ((__bounded__(__string__,1,3))); |
| 84 | +int strvisx(char *, const char *, size_t, int) |
| 85 | + __attribute__ ((__bounded__(__string__,1,3))); |
109 | 86 | int strunvis(char *, const char *);
|
110 |
| -int strnunvis(char *, size_t, const char *); |
111 |
| - |
112 |
| -int strunvisx(char *, const char *, int); |
113 |
| -int strnunvisx(char *, size_t, const char *, int); |
| 87 | +int unvis(char *, char, int *, int); |
| 88 | +ssize_t strnunvis(char *, const char *, size_t) |
| 89 | + __attribute__ ((__bounded__(__string__,1,3))); |
114 | 90 |
|
115 |
| -#ifndef __LIBC12_SOURCE__ |
116 |
| -int unvis(char *, int, int *, int); |
117 |
| -#endif |
118 | 91 | __END_DECLS
|
119 | 92 |
|
120 | 93 | #endif /* !_VIS_H_ */
|
0 commit comments