Another copy of my dotfiles. Because I don't completely trust GitHub.
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.

42 lines
952 B

  1. /* See LICENSE file for copyright and license details. */
  2. #ifndef UTIL_H
  3. #define UTIL_H
  4. #include <regex.h>
  5. #include <stddef.h>
  6. #include <time.h>
  7. #include "config.h"
  8. /* general purpose buffer */
  9. struct buffer {
  10. char data[BUFFER_SIZE];
  11. size_t len;
  12. };
  13. #undef MIN
  14. #define MIN(x,y) ((x) < (y) ? (x) : (y))
  15. #undef MAX
  16. #define MAX(x,y) ((x) > (y) ? (x) : (y))
  17. #undef LEN
  18. #define LEN(x) (sizeof (x) / sizeof *(x))
  19. extern char *argv0;
  20. void warn(const char *, ...);
  21. void die(const char *, ...);
  22. void epledge(const char *, const char *);
  23. void eunveil(const char *, const char *);
  24. int timestamp(char *, size_t, time_t);
  25. int esnprintf(char *, size_t, const char *, ...);
  26. int prepend(char *, size_t, const char *);
  27. int spacetok(const char *, char **, size_t);
  28. void *reallocarray(void *, size_t, size_t);
  29. long long strtonum(const char *, long long, long long, const char **);
  30. int buffer_appendf(struct buffer *, const char *, ...);
  31. #endif /* UTIL_H */