#include <stdarg.h>
#include <stdbool.h>
-struct list {
- void *el;
- struct list *tail;
-};
+struct list { void *el; struct list *tail; };
struct list *list_cons(void *el, struct list *tail);
void list_free(struct list *head, void (*freefun)(void *));
void **list_to_array(struct list *list, int *num, bool reverse);
void die(const char *msg, ...);
void pdie(const char *msg);
+/* if buf == NULL, a fresh buffer is allocated */
+char *escape_char(char c, char *buf, bool str);
+/* unescaped character will be in position 0 and the rest from position 1 on */
+char *unescape_char(char *c);
+/* Remove the last and first character from the string */
+char *trimquotes(char *c);
void pindent(int indent, FILE *out);
+
void safe_fprintf(FILE *out, const char *msg, ...);
void *safe_malloc(size_t size);
void *safe_strdup(const char *c);