172445Sassar/* $NetBSD: vis.h,v 1.11 1999/11/25 16:55:50 wennmach Exp $ */ 2178825Sdfr/* $Id: vis.hin 19341 2006-12-15 11:53:09Z lha $ */ 372445Sassar 472445Sassar/*- 572445Sassar * Copyright (c) 1990, 1993 672445Sassar * The Regents of the University of California. All rights reserved. 772445Sassar * 872445Sassar * Redistribution and use in source and binary forms, with or without 972445Sassar * modification, are permitted provided that the following conditions 1072445Sassar * are met: 1172445Sassar * 1. Redistributions of source code must retain the above copyright 1272445Sassar * notice, this list of conditions and the following disclaimer. 1372445Sassar * 2. Redistributions in binary form must reproduce the above copyright 1472445Sassar * notice, this list of conditions and the following disclaimer in the 1572445Sassar * documentation and/or other materials provided with the distribution. 16178825Sdfr * 3. Neither the name of the University nor the names of its contributors 1772445Sassar * may be used to endorse or promote products derived from this software 1872445Sassar * without specific prior written permission. 1972445Sassar * 2072445Sassar * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2172445Sassar * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2272445Sassar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2372445Sassar * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2472445Sassar * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2572445Sassar * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2672445Sassar * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2772445Sassar * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2872445Sassar * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2972445Sassar * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3072445Sassar * SUCH DAMAGE. 3172445Sassar * 3272445Sassar * @(#)vis.h 8.1 (Berkeley) 6/2/93 3372445Sassar */ 3472445Sassar 3572445Sassar#ifndef _VIS_H_ 3672445Sassar#define _VIS_H_ 3772445Sassar 38178825Sdfr#ifndef ROKEN_LIB_FUNCTION 39178825Sdfr#ifdef _WIN32 40178825Sdfr#define ROKEN_LIB_FUNCTION _stdcall 41178825Sdfr#else 42178825Sdfr#define ROKEN_LIB_FUNCTION 43178825Sdfr#endif 44178825Sdfr#endif 45178825Sdfr 4672445Sassar/* 4772445Sassar * to select alternate encoding format 4872445Sassar */ 4972445Sassar#define VIS_OCTAL 0x01 /* use octal \ddd format */ 5072445Sassar#define VIS_CSTYLE 0x02 /* use \[nrft0..] where appropiate */ 5172445Sassar 5272445Sassar/* 5372445Sassar * to alter set of characters encoded (default is to encode all 5472445Sassar * non-graphic except space, tab, and newline). 5572445Sassar */ 5672445Sassar#define VIS_SP 0x04 /* also encode space */ 5772445Sassar#define VIS_TAB 0x08 /* also encode tab */ 5872445Sassar#define VIS_NL 0x10 /* also encode newline */ 5972445Sassar#define VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL) 6072445Sassar#define VIS_SAFE 0x20 /* only encode "unsafe" characters */ 6172445Sassar 6272445Sassar/* 6372445Sassar * other 6472445Sassar */ 6572445Sassar#define VIS_NOSLASH 0x40 /* inhibit printing '\' */ 6672445Sassar 6772445Sassar/* 6872445Sassar * unvis return codes 6972445Sassar */ 7072445Sassar#define UNVIS_VALID 1 /* character valid */ 7172445Sassar#define UNVIS_VALIDPUSH 2 /* character valid, push back passed char */ 7272445Sassar#define UNVIS_NOCHAR 3 /* valid sequence, no character produced */ 7372445Sassar#define UNVIS_SYNBAD -1 /* unrecognized escape sequence */ 7472445Sassar#define UNVIS_ERROR -2 /* decoder in unknown state (unrecoverable) */ 7572445Sassar 7672445Sassar/* 7772445Sassar * unvis flags 7872445Sassar */ 7972445Sassar#define UNVIS_END 1 /* no more characters */ 8072445Sassar 81178825Sdfrchar ROKEN_LIB_FUNCTION 82178825Sdfr *rk_vis (char *, int, int, int); 83178825Sdfrchar ROKEN_LIB_FUNCTION 84178825Sdfr *rk_svis (char *, int, int, int, const char *); 85178825Sdfrint ROKEN_LIB_FUNCTION 86178825Sdfr rk_strvis (char *, const char *, int); 87178825Sdfrint ROKEN_LIB_FUNCTION 88178825Sdfr rk_strsvis (char *, const char *, int, const char *); 89178825Sdfrint ROKEN_LIB_FUNCTION 90178825Sdfr rk_strvisx (char *, const char *, size_t, int); 91178825Sdfrint ROKEN_LIB_FUNCTION 92178825Sdfr rk_strsvisx (char *, const char *, size_t, int, const char *); 93178825Sdfrint ROKEN_LIB_FUNCTION 94178825Sdfr rk_strunvis (char *, const char *); 95178825Sdfrint ROKEN_LIB_FUNCTION 96178825Sdfr rk_unvis (char *, int, int *, int); 9772445Sassar 98178825Sdfr#undef vis 99178825Sdfr#define vis(a,b,c,d) rk_vis(a,b,c,d) 100178825Sdfr#undef svis 101178825Sdfr#define svis(a,b,c,d,e) rk_svis(a,b,c,d,e) 102178825Sdfr#undef strvis 103178825Sdfr#define strvis(a,b,c) rk_strvis(a,b,c) 104178825Sdfr#undef strsvis 105178825Sdfr#define strsvis(a,b,c,d) rk_strsvis(a,b,c,d) 106178825Sdfr#undef strvisx 107178825Sdfr#define strvisx(a,b,c,d) rk_strvisx(a,b,c,d) 108178825Sdfr#undef strsvisx 109178825Sdfr#define strsvisx(a,b,c,d,e) rk_strsvisx(a,b,c,d,e) 110178825Sdfr#undef strunvis 111178825Sdfr#define strunvis(a,b) rk_strunvis(a,b) 112178825Sdfr#undef unvis 113178825Sdfr#define unvis(a,b,c,d) rk_unvis(a,b,c,d) 114178825Sdfr 11572445Sassar#endif /* !_VIS_H_ */ 116