- (dtucker) [configure.ac defines.h openbsd-compat/vis.{c,h}] Sync current
versions from OpenBSD. ok djm@
This commit is contained in:
parent
e04ec6fdfd
commit
9ac1a65acb
|
@ -1,3 +1,7 @@
|
||||||
|
20051009
|
||||||
|
- (dtucker) [configure.ac defines.h openbsd-compat/vis.{c,h}] Sync current
|
||||||
|
versions from OpenBSD. ok djm@
|
||||||
|
|
||||||
20051008
|
20051008
|
||||||
- (dtucker) [configure.ac] Bug #1098: define $MAIL for HP-UX; report from
|
- (dtucker) [configure.ac] Bug #1098: define $MAIL for HP-UX; report from
|
||||||
brian.smith at agilent com.
|
brian.smith at agilent com.
|
||||||
|
@ -3096,4 +3100,4 @@
|
||||||
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
||||||
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.3918 2005/10/08 06:21:19 djm Exp $
|
$Id: ChangeLog,v 1.3919 2005/10/09 01:40:03 dtucker Exp $
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: configure.ac,v 1.300 2005/10/08 06:21:20 djm Exp $
|
# $Id: configure.ac,v 1.301 2005/10/09 01:40:03 dtucker Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 1999-2004 Damien Miller
|
# Copyright (c) 1999-2004 Damien Miller
|
||||||
#
|
#
|
||||||
|
@ -418,6 +418,7 @@ mips-sony-bsd|mips-sony-newsos4)
|
||||||
;;
|
;;
|
||||||
*-*-openbsd*)
|
*-*-openbsd*)
|
||||||
AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
|
AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
|
||||||
|
AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
|
||||||
;;
|
;;
|
||||||
*-*-solaris*)
|
*-*-solaris*)
|
||||||
if test "x$withval" != "xno" ; then
|
if test "x$withval" != "xno" ; then
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#ifndef _DEFINES_H
|
#ifndef _DEFINES_H
|
||||||
#define _DEFINES_H
|
#define _DEFINES_H
|
||||||
|
|
||||||
/* $Id: defines.h,v 1.128 2005/09/09 05:04:59 tim Exp $ */
|
/* $Id: defines.h,v 1.129 2005/10/09 01:40:04 dtucker Exp $ */
|
||||||
|
|
||||||
|
|
||||||
/* Constants */
|
/* Constants */
|
||||||
|
@ -450,6 +450,10 @@ struct winsize {
|
||||||
# define __sentinel__
|
# define __sentinel__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(HAVE_ATTRIBUTE__BOUNDED__) && !defined(__bounded__)
|
||||||
|
# define __bounded__(x, y, z)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* *-*-nto-qnx doesn't define this macro in the system headers */
|
/* *-*-nto-qnx doesn't define this macro in the system headers */
|
||||||
#ifdef MISSING_HOWMANY
|
#ifdef MISSING_HOWMANY
|
||||||
# define howmany(x,y) (((x)+((y)-1))/(y))
|
# define howmany(x,y) (((x)+((y)-1))/(y))
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* OPENBSD ORIGINAL: lib/libc/gen/vis.c */
|
/* OPENBSD ORIGINAL: lib/libc/gen/vis.c */
|
||||||
|
|
||||||
|
/* $OpenBSD: vis.c,v 1.19 2005/09/01 17:15:49 millert Exp $ */
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1989, 1993
|
* Copyright (c) 1989, 1993
|
||||||
* The Regents of the University of California. All rights reserved.
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
@ -28,36 +29,32 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
#if !defined(HAVE_STRNVIS)
|
#if !defined(HAVE_STRNVIS)
|
||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
|
||||||
static char rcsid[] = "$OpenBSD: vis.c,v 1.12 2003/06/02 20:18:35 millert Exp $";
|
|
||||||
#endif /* LIBC_SCCS and not lint */
|
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "vis.h"
|
#include "vis.h"
|
||||||
|
|
||||||
#define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7')
|
#define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7')
|
||||||
#define isvisible(c) (((u_int)(c) <= UCHAR_MAX && isascii((u_char)(c)) && \
|
#define isvisible(c) \
|
||||||
isgraph((u_char)(c))) || \
|
(((u_int)(c) <= UCHAR_MAX && isascii((u_char)(c)) && \
|
||||||
((flag & VIS_SP) == 0 && (c) == ' ') || \
|
(((c) != '*' && (c) != '?' && (c) != '[' && (c) != '#') || \
|
||||||
((flag & VIS_TAB) == 0 && (c) == '\t') || \
|
(flag & VIS_GLOB) == 0) && isgraph((u_char)(c))) || \
|
||||||
((flag & VIS_NL) == 0 && (c) == '\n') || \
|
((flag & VIS_SP) == 0 && (c) == ' ') || \
|
||||||
((flag & VIS_SAFE) && ((c) == '\b' || \
|
((flag & VIS_TAB) == 0 && (c) == '\t') || \
|
||||||
(c) == '\007' || (c) == '\r' || \
|
((flag & VIS_NL) == 0 && (c) == '\n') || \
|
||||||
isgraph((u_char)(c)))))
|
((flag & VIS_SAFE) && ((c) == '\b' || \
|
||||||
|
(c) == '\007' || (c) == '\r' || \
|
||||||
|
isgraph((u_char)(c)))))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* vis - visually encode characters
|
* vis - visually encode characters
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
vis(dst, c, flag, nextc)
|
vis(char *dst, int c, int flag, int nextc)
|
||||||
register char *dst;
|
|
||||||
int c, nextc;
|
|
||||||
register int flag;
|
|
||||||
{
|
{
|
||||||
if (isvisible(c)) {
|
if (isvisible(c)) {
|
||||||
*dst++ = c;
|
*dst++ = c;
|
||||||
|
@ -111,7 +108,8 @@ vis(dst, c, flag, nextc)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (((c & 0177) == ' ') || (flag & VIS_OCTAL)) {
|
if (((c & 0177) == ' ') || (flag & VIS_OCTAL) ||
|
||||||
|
((flag & VIS_GLOB) && (c == '*' || c == '?' || c == '[' || c == '#'))) {
|
||||||
*dst++ = '\\';
|
*dst++ = '\\';
|
||||||
*dst++ = ((u_char)c >> 6 & 07) + '0';
|
*dst++ = ((u_char)c >> 6 & 07) + '0';
|
||||||
*dst++ = ((u_char)c >> 3 & 07) + '0';
|
*dst++ = ((u_char)c >> 3 & 07) + '0';
|
||||||
|
@ -124,7 +122,7 @@ vis(dst, c, flag, nextc)
|
||||||
c &= 0177;
|
c &= 0177;
|
||||||
*dst++ = 'M';
|
*dst++ = 'M';
|
||||||
}
|
}
|
||||||
if (iscntrl(c)) {
|
if (iscntrl((u_char)c)) {
|
||||||
*dst++ = '^';
|
*dst++ = '^';
|
||||||
if (c == 0177)
|
if (c == 0177)
|
||||||
*dst++ = '?';
|
*dst++ = '?';
|
||||||
|
@ -153,12 +151,9 @@ done:
|
||||||
* This is useful for encoding a block of data.
|
* This is useful for encoding a block of data.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
strvis(dst, src, flag)
|
strvis(char *dst, const char *src, int flag)
|
||||||
register char *dst;
|
|
||||||
register const char *src;
|
|
||||||
int flag;
|
|
||||||
{
|
{
|
||||||
register char c;
|
char c;
|
||||||
char *start;
|
char *start;
|
||||||
|
|
||||||
for (start = dst; (c = *src);)
|
for (start = dst; (c = *src);)
|
||||||
|
@ -168,16 +163,11 @@ strvis(dst, src, flag)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
strnvis(dst, src, siz, flag)
|
strnvis(char *dst, const char *src, size_t siz, int flag)
|
||||||
char *dst;
|
|
||||||
const char *src;
|
|
||||||
size_t siz;
|
|
||||||
int flag;
|
|
||||||
{
|
{
|
||||||
char c;
|
|
||||||
char *start, *end;
|
char *start, *end;
|
||||||
char tbuf[5];
|
char tbuf[5];
|
||||||
int i;
|
int c, i;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
for (start = dst, end = start + siz - 1; (c = *src) && dst < end; ) {
|
for (start = dst, end = start + siz - 1; (c = *src) && dst < end; ) {
|
||||||
|
@ -217,13 +207,9 @@ strnvis(dst, src, siz, flag)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
strvisx(dst, src, len, flag)
|
strvisx(char *dst, const char *src, size_t len, int flag)
|
||||||
register char *dst;
|
|
||||||
register const char *src;
|
|
||||||
register size_t len;
|
|
||||||
int flag;
|
|
||||||
{
|
{
|
||||||
register char c;
|
char c;
|
||||||
char *start;
|
char *start;
|
||||||
|
|
||||||
for (start = dst; len > 1; len--) {
|
for (start = dst; len > 1; len--) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* OPENBSD ORIGINAL: include/vis.h */
|
/* OPENBSD ORIGINAL: include/vis.h */
|
||||||
|
|
||||||
/* $OpenBSD: vis.h,v 1.6 2003/06/02 19:34:12 millert Exp $ */
|
/* $OpenBSD: vis.h,v 1.11 2005/08/09 19:38:31 millert Exp $ */
|
||||||
/* $NetBSD: vis.h,v 1.4 1994/10/26 00:56:41 cgd Exp $ */
|
/* $NetBSD: vis.h,v 1.4 1994/10/26 00:56:41 cgd Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
|
@ -63,6 +63,7 @@
|
||||||
* other
|
* other
|
||||||
*/
|
*/
|
||||||
#define VIS_NOSLASH 0x40 /* inhibit printing '\' */
|
#define VIS_NOSLASH 0x40 /* inhibit printing '\' */
|
||||||
|
#define VIS_GLOB 0x100 /* encode glob(3) magics and '#' */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* unvis return codes
|
* unvis return codes
|
||||||
|
@ -80,10 +81,14 @@
|
||||||
|
|
||||||
char *vis(char *, int, int, int);
|
char *vis(char *, int, int, int);
|
||||||
int strvis(char *, const char *, int);
|
int strvis(char *, const char *, int);
|
||||||
int strnvis(char *, const char *, size_t, int);
|
int strnvis(char *, const char *, size_t, int)
|
||||||
int strvisx(char *, const char *, size_t, int);
|
__attribute__ ((__bounded__(__string__,1,3)));
|
||||||
|
int strvisx(char *, const char *, size_t, int)
|
||||||
|
__attribute__ ((__bounded__(__string__,1,3)));
|
||||||
int strunvis(char *, const char *);
|
int strunvis(char *, const char *);
|
||||||
int unvis(char *, char, int *, int);
|
int unvis(char *, char, int *, int);
|
||||||
|
ssize_t strnunvis(char *, const char *, size_t)
|
||||||
|
__attribute__ ((__bounded__(__string__,1,3)));
|
||||||
|
|
||||||
#endif /* !_VIS_H_ */
|
#endif /* !_VIS_H_ */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue