vis.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* $NetBSD: vis.h,v 1.12 2002/03/23 17:39:05 christos Exp $ */
  2. /*-
  3. * Copyright (c) 1990, 1993
  4. * The Regents of the University of California. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * 3. All advertising materials mentioning features or use of this software
  15. * must display the following acknowledgement:
  16. * This product includes software developed by the University of
  17. * California, Berkeley and its contributors.
  18. * 4. Neither the name of the University nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  23. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  28. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  29. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  31. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32. * SUCH DAMAGE.
  33. *
  34. * @(#)vis.h 8.1 (Berkeley) 6/2/93
  35. */
  36. #ifndef _VIS_H_
  37. #define _VIS_H_
  38. /*
  39. * to select alternate encoding format
  40. */
  41. #define VIS_OCTAL 0x01 /* use octal \ddd format */
  42. #define VIS_CSTYLE 0x02 /* use \[nrft0..] where appropiate */
  43. /*
  44. * to alter set of characters encoded (default is to encode all
  45. * non-graphic except space, tab, and newline).
  46. */
  47. #define VIS_SP 0x04 /* also encode space */
  48. #define VIS_TAB 0x08 /* also encode tab */
  49. #define VIS_NL 0x10 /* also encode newline */
  50. #define VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL)
  51. #define VIS_SAFE 0x20 /* only encode "unsafe" characters */
  52. /*
  53. * other
  54. */
  55. #define VIS_NOSLASH 0x40 /* inhibit printing '\' */
  56. #define VIS_HTTPSTYLE 0x80 /* http-style escape % HEX HEX */
  57. /*
  58. * unvis return codes
  59. */
  60. #define UNVIS_VALID 1 /* character valid */
  61. #define UNVIS_VALIDPUSH 2 /* character valid, push back passed char */
  62. #define UNVIS_NOCHAR 3 /* valid sequence, no character produced */
  63. #define UNVIS_SYNBAD -1 /* unrecognized escape sequence */
  64. #define UNVIS_ERROR -2 /* decoder in unknown state (unrecoverable) */
  65. /*
  66. * unvis flags
  67. */
  68. #define UNVIS_END 1 /* no more characters */
  69. #include <sys/cdefs.h>
  70. __BEGIN_DECLS
  71. char *vis __P((char *, int, int, int));
  72. char *svis __P((char *, int, int, int, const char *));
  73. int strvis __P((char *, const char *, int));
  74. int strsvis __P((char *, const char *, int, const char *));
  75. int strvisx __P((char *, const char *, size_t, int));
  76. int strsvisx __P((char *, const char *, size_t, int, const char *));
  77. int strunvis __P((char *, const char *));
  78. int strunvisx __P((char *, const char *, int));
  79. #ifdef __LIBC12_SOURCE__
  80. int unvis __P((char *, int, int *, int));
  81. int __unvis13 __P((char *, int, int *, int));
  82. #else
  83. int unvis __P((char *, int, int *, int)) __RENAME(__unvis13);
  84. #endif
  85. __END_DECLS
  86. #endif /* !_VIS_H_ */