common.h 242 B

123456789101112131415161718
  1. #include <ccan/json/json.c>
  2. #include <ccan/tap/tap.h>
  3. #include <errno.h>
  4. #include <string.h>
  5. static char *chomp(char *s)
  6. {
  7. char *e;
  8. if (s == NULL || *s == 0)
  9. return s;
  10. e = strchr(s, 0);
  11. if (e[-1] == '\n')
  12. *--e = 0;
  13. return s;
  14. }