A mail formatter.
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.
 
 
 

70 lines
1.5 KiB

  1. /*
  2. * sbuffer - Incenp.org Notch Library: string buffer module
  3. * Copyright (C) 2011,2018 Damien Goutte-Gattat
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef ICP20110203_SBUFFER_H
  19. #define ICP20110203_SBUFFER_H
  20. #include <stdlib.h>
  21. #include <stdarg.h>
  22. typedef struct
  23. {
  24. char *buffer;
  25. size_t len;
  26. size_t size;
  27. size_t block;
  28. int error;
  29. } string_buffer_t;
  30. #ifdef __cpluscplus
  31. extern "C" {
  32. #endif
  33. int
  34. sb_init(string_buffer_t *, size_t);
  35. const char *
  36. sb_get(string_buffer_t *);
  37. char *
  38. sb_get_copy(string_buffer_t *);
  39. int
  40. sb_empty(string_buffer_t *);
  41. int
  42. sb_addc(string_buffer_t *, char);
  43. int
  44. sb_add(string_buffer_t *, const char *);
  45. int
  46. sb_addn(string_buffer_t *, const char *, size_t);
  47. int
  48. sb_vaddf(string_buffer_t *, const char *, va_list);
  49. int
  50. sb_addf(string_buffer_t *, const char *, ...);
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif /* !ICP20110203_SBUFFER_H */