str.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /** @file str.h
  2. * @brief Public interface for faux string functions.
  3. */
  4. #ifndef _faux_str_h
  5. #define _faux_str_h
  6. #include <stddef.h>
  7. #include "faux/types.h"
  8. #define UTF8_MASK 0xC0
  9. #define UTF8_7BIT_MASK 0x80 /* One byte or multibyte */
  10. #define UTF8_11 0xC0 /* First UTF8 byte */
  11. #define UTF8_10 0x80 /* Next UTF8 bytes */
  12. C_DECL_BEGIN
  13. void faux_str_free(char **str);
  14. char *faux_str_dupn(const char *str, size_t n);
  15. char *faux_str_dup(const char *str);
  16. char *faux_str_catn(char **str, const char *text, size_t n);
  17. char *faux_str_cat(char **str, const char *text);
  18. char *faux_str_tolower(const char *str);
  19. //const char *faux_str_suffix(const char *string);
  20. //int faux_str_nocasecmp(const char *cs, const char *ct);
  21. //const char *faux_str_nocasestr(const char *cs, const char *ct);
  22. /*
  23. * These are the escape characters which are used by default when
  24. * expanding variables. These characters will be backslash escaped
  25. * to prevent them from being interpreted in a script.
  26. *
  27. * This is a security feature to prevent users from arbitarily setting
  28. * parameters to contain special sequences.
  29. */
  30. //extern const char *faux_str_esc_default;
  31. //extern const char *faux_str_esc_regex;
  32. //extern const char *faux_str_esc_quoted;
  33. //char *faux_str_decode(const char *string);
  34. //char *faux_str_ndecode(const char *string, unsigned int len);
  35. //char *faux_str_encode(const char *string, const char *escape_chars);
  36. //unsigned int faux_str_equal_part(const char *str1, const char *str2,
  37. // bool_t utf8);
  38. //const char *faux_str_nextword(const char *string,
  39. // size_t *len, size_t *offset, size_t *quoted);
  40. //unsigned int faux_str_wordcount(const char *line);
  41. C_DECL_END
  42. #endif /* _faux_str_h */