You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.7 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /* source: utils.h */
  2. /* Copyright Gerhard Rieger and contributors (see file CHANGES) */
  3. /* Published under the GNU General Public License V.2, see file COPYING */
  4. #ifndef __utils_h_included
  5. #define __utils_h_included 1
  6. /* a generic name table entry */
  7. struct wordent {
  8. const char *name;
  9. void *desc;
  10. } ;
  11. #if !HAVE_PROTOTYPE_LIB_memrchr
  12. extern void *memrchr(const void *s, int c, size_t n);
  13. #endif
  14. extern void *memdup(const void *src, size_t n);
  15. #if !HAVE_SETENV
  16. extern int setenv(const char *name, const char *value, int overwrite);
  17. #endif /* !HAVE_SETENV */
  18. extern const struct wordent *keyw(const struct wordent *keywds, const char *name, unsigned int nkeys);
  19. #define XIOSAN_ZERO_MASK 0x000f
  20. #define XIOSAN_ZERO_DEFAULT 0x0000
  21. #define XIOSAN_ZERO_DOT 0x0001
  22. #define XIOSAN_ZERO_BACKSLASH_OCT_3 0x0002
  23. #define XIOSAN_ZERO_BACKSLASH_OCT_4 0x0003
  24. #define XIOSAN_ZERO_BACKSLASHX_HEX_UP 0x0004
  25. #define XIOSAN_ZERO_BACKSLASHX_HEX_LOW 0x0005
  26. #define XIOSAN_ZERO_PERCENT_HEX_UP 0x0006
  27. #define XIOSAN_ZERO_PERCENT_HEX_LOW 0x0007
  28. #define XIOSAN_CONTROL_MASK 0x00f0
  29. #define XIOSAN_CONTROL_DEFAULT 0x0000
  30. #define XIOSAN_CONTROL_DOT 0x0010
  31. #define XIOSAN_CONTROL_BACKSLASH_OCT_3 0x0020
  32. #define XIOSAN_CONTROL_BACKSLASH_OCT_4 0x0030
  33. #define XIOSAN_CONTROL_BACKSLASHX_HEX_UP 0x0040
  34. #define XIOSAN_CONTROL_BACKSLASHX_HEX_LOW 0x0050
  35. #define XIOSAN_CONTROL_PERCENT_HEX_UP 0x0060
  36. #define XIOSAN_CONTROL_PERCENT_HEX_LOW 0x0070
  37. #define XIOSAN_UNPRINT_MASK 0x0f00
  38. #define XIOSAN_UNPRINT_DEFAULT 0x0000
  39. #define XIOSAN_UNPRINT_DOT 0x0100
  40. #define XIOSAN_UNPRINT_BACKSLASH_OCT_3 0x0200
  41. #define XIOSAN_UNPRINT_BACKSLASH_OCT_4 0x0300
  42. #define XIOSAN_UNPRINT_BACKSLASHX_HEX_UP 0x0400
  43. #define XIOSAN_UNPRINT_BACKSLASHX_HEX_LOW 0x0500
  44. #define XIOSAN_UNPRINT_PERCENT_HEX_UP 0x0600
  45. #define XIOSAN_UNPRINT_PERCENT_HEX_LOW 0x0700
  46. #define XIOSAN_DEFAULT_MASK 0xf000
  47. #define XIOSAN_DEFAULT_BACKSLASH_DOT 0x1000
  48. #define XIOSAN_DEFAULT_BACKSLASH_OCT_3 0x2000
  49. #define XIOSAN_DEFAULT_BACKSLASH_OCT_4 0x3000
  50. #define XIOSAN_DEFAULT_BACKSLASHX_HEX_UP 0x4000
  51. #define XIOSAN_DEFAULT_BACKSLASHX_HEX_LOW 0x5000
  52. #define XIOSAN_DEFAULT_PERCENT_HEX_UP 0x6000
  53. #define XIOSAN_DEFAULT_PERCENT_HEX_LOW 0x7000
  54. extern
  55. char *sanitize_string(const char *data, /* input data */
  56. size_t bytes, /* length of input data, >=0 */
  57. char *coded, /* output buffer, must be long enough */
  58. int style);
  59. extern
  60. char *xiosubstr(char *scratch, const char *str, size_t from, size_t len);
  61. extern
  62. int xio_snprintf(char *str, size_t size, const char *format, ...);
  63. #endif /* !defined(__utils_h_included) */