summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-09-20 02:07:50 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-09-20 02:07:50 +0000
commit84a6bfba15e833a9b70de130f9427245fca89724 (patch)
tree851077a469e759473ada938ba5ff5507b6976aee /openbsd-compat
parent03598a1c230962db9befb8f8e5ccdab3d0449346 (diff)
- (bal) openbsd-compat/vis.[ch] is dead wood. Removed.
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/Makefile.in4
-rw-r--r--openbsd-compat/openbsd-compat.h3
-rw-r--r--openbsd-compat/vis.c139
-rw-r--r--openbsd-compat/vis.h34
4 files changed, 3 insertions, 177 deletions
diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in
index c6b3c959e..103ecc312 100644
--- a/openbsd-compat/Makefile.in
+++ b/openbsd-compat/Makefile.in
@@ -1,4 +1,4 @@
1# $Id: Makefile.in,v 1.18 2001/08/07 22:29:09 tim Exp $ 1# $Id: Makefile.in,v 1.19 2001/09/20 02:07:51 mouring Exp $
2 2
3sysconfdir=@sysconfdir@ 3sysconfdir=@sysconfdir@
4piddir=@piddir@ 4piddir=@piddir@
@@ -16,7 +16,7 @@ RANLIB=@RANLIB@
16INSTALL=@INSTALL@ 16INSTALL=@INSTALL@
17LDFLAGS=-L. @LDFLAGS@ 17LDFLAGS=-L. @LDFLAGS@
18 18
19OPENBSD=base64.o bindresvport.o daemon.o dirname.o getcwd.o getgrouplist.o getopt.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sigact.o strlcat.o strlcpy.o strmode.o strsep.o vis.o 19OPENBSD=base64.o bindresvport.o daemon.o dirname.o getcwd.o getgrouplist.o getopt.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sigact.o strlcat.o strlcpy.o strmode.o strsep.o
20 20
21COMPAT=bsd-arc4random.o bsd-cray.o bsd-cygwin_util.o bsd-misc.o bsd-nextstep.o bsd-snprintf.o bsd-waitpid.o fake-getaddrinfo.o fake-getnameinfo.o 21COMPAT=bsd-arc4random.o bsd-cray.o bsd-cygwin_util.o bsd-misc.o bsd-nextstep.o bsd-snprintf.o bsd-waitpid.o fake-getaddrinfo.o fake-getnameinfo.o
22 22
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h
index eba9ca051..efa204dc3 100644
--- a/openbsd-compat/openbsd-compat.h
+++ b/openbsd-compat/openbsd-compat.h
@@ -1,4 +1,4 @@
1/* $Id: openbsd-compat.h,v 1.13 2001/08/07 22:29:09 tim Exp $ */ 1/* $Id: openbsd-compat.h,v 1.14 2001/09/20 02:07:51 mouring Exp $ */
2 2
3#ifndef _OPENBSD_H 3#ifndef _OPENBSD_H
4#define _OPENBSD_H 4#define _OPENBSD_H
@@ -21,7 +21,6 @@
21#include "inet_ntoa.h" 21#include "inet_ntoa.h"
22#include "inet_ntop.h" 22#include "inet_ntop.h"
23#include "strsep.h" 23#include "strsep.h"
24#include "vis.h"
25#include "setproctitle.h" 24#include "setproctitle.h"
26#include "getgrouplist.h" 25#include "getgrouplist.h"
27#include "glob.h" 26#include "glob.h"
diff --git a/openbsd-compat/vis.c b/openbsd-compat/vis.c
deleted file mode 100644
index 7eb2d6cd9..000000000
--- a/openbsd-compat/vis.c
+++ /dev/null
@@ -1,139 +0,0 @@
1/*-
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#if defined(LIBC_SCCS) && !defined(lint)
35static char rcsid[] = "$OpenBSD: vis.c,v 1.6 2000/11/21 00:47:28 millert Exp $";
36#endif /* LIBC_SCCS and not lint */
37
38#include "includes.h"
39
40#ifndef HAVE_VIS
41
42#define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7')
43#define isvisible(c) (((u_int)(c) <= UCHAR_MAX && isascii((u_char)(c)) && \
44 isgraph((u_char)(c))) || \
45 ((flag & VIS_SP) == 0 && (c) == ' ') || \
46 ((flag & VIS_TAB) == 0 && (c) == '\t') || \
47 ((flag & VIS_NL) == 0 && (c) == '\n') || \
48 ((flag & VIS_SAFE) && \
49 ((c) == '\b' || (c) == '\007' || (c) == '\r')))
50
51/*
52 * vis - visually encode characters
53 */
54char *vis(char *dst, int c, int flag, int nextc)
55{
56 if (isvisible(c)) {
57 *dst++ = c;
58 if (c == '\\' && (flag & VIS_NOSLASH) == 0)
59 *dst++ = '\\';
60 *dst = '\0';
61 return (dst);
62 }
63
64 if (flag & VIS_CSTYLE) {
65 switch(c) {
66 case '\n':
67 *dst++ = '\\';
68 *dst++ = 'n';
69 goto done;
70 case '\r':
71 *dst++ = '\\';
72 *dst++ = 'r';
73 goto done;
74 case '\b':
75 *dst++ = '\\';
76 *dst++ = 'b';
77 goto done;
78#ifdef __STDC__
79 case '\a':
80#else
81 case '\007':
82#endif
83 *dst++ = '\\';
84 *dst++ = 'a';
85 goto done;
86 case '\v':
87 *dst++ = '\\';
88 *dst++ = 'v';
89 goto done;
90 case '\t':
91 *dst++ = '\\';
92 *dst++ = 't';
93 goto done;
94 case '\f':
95 *dst++ = '\\';
96 *dst++ = 'f';
97 goto done;
98 case ' ':
99 *dst++ = '\\';
100 *dst++ = 's';
101 goto done;
102 case '\0':
103 *dst++ = '\\';
104 *dst++ = '0';
105 if (isoctal(nextc)) {
106 *dst++ = '0';
107 *dst++ = '0';
108 }
109 goto done;
110 }
111 }
112 if (((c & 0177) == ' ') || (flag & VIS_OCTAL)) {
113 *dst++ = '\\';
114 *dst++ = ((u_char)c >> 6 & 07) + '0';
115 *dst++ = ((u_char)c >> 3 & 07) + '0';
116 *dst++ = ((u_char)c & 07) + '0';
117 goto done;
118 }
119 if ((flag & VIS_NOSLASH) == 0)
120 *dst++ = '\\';
121 if (c & 0200) {
122 c &= 0177;
123 *dst++ = 'M';
124 }
125 if (iscntrl(c)) {
126 *dst++ = '^';
127 if (c == 0177)
128 *dst++ = '?';
129 else
130 *dst++ = c + '@';
131 } else {
132 *dst++ = '-';
133 *dst++ = c;
134 }
135done:
136 *dst = '\0';
137 return (dst);
138}
139#endif /* HAVE_VIS */
diff --git a/openbsd-compat/vis.h b/openbsd-compat/vis.h
deleted file mode 100644
index 677fe959b..000000000
--- a/openbsd-compat/vis.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/* $Id: vis.h,v 1.2 2001/02/09 01:55:37 djm Exp $ */
2
3#ifndef _BSD_VIS_H
4#define _BSD_VIS_H
5
6#include "config.h"
7
8#ifndef HAVE_VIS
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 appropriate */
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
31char *vis (char *, int, int, int);
32#endif /* HAVE_VIS */
33
34#endif /* _BSD_VIS_H */