Group key config symbols together
[neverball] / share / common.h
index 657ea87..e292b09 100644 (file)
 
 #include <time.h>
 #include <stdio.h>
+#include "fs.h"
+
+#ifdef __GNUC__
+#define NULL_TERMINATED __attribute__ ((__sentinel__))
+#else
+#define NULL_TERMINATED
+#endif
 
 #define ARRAYSIZE(a) (sizeof (a) / sizeof ((a)[0]))
 
 #define MIN(x, y) ((x) < (y) ? (x) : (y))
 #define MAX(x, y) ((x) > (y) ? (x) : (y))
 
-int   read_line(char **, FILE *);
+int   read_line(char **, fs_file);
 char *strip_newline(char *);
-char *strdup(const char *);
+
+char *dupe_string(const char *);
+char *concat_string(const char *first, ...) NULL_TERMINATED;
+char *trunc_string(const char *src, char *dst, int len);
+
+#ifdef strdup
+#undef strdup
+#endif
+#define strdup dupe_string
 
 time_t make_time_from_utc(struct tm *);
 const char *date_to_str(time_t);
@@ -39,7 +54,14 @@ int  file_exists(const char *);
 int  file_rename(const char *, const char *);
 void file_copy(FILE *fin, FILE *fout);
 
+int path_is_sep(int);
+int path_is_abs(const char *);
+
 char       *base_name(const char *name, const char *suffix);
 const char *dir_name(const char *name);
 
+char *path_resolve(const char *ref, const char *rel);
+
+int rand_between(int low, int high);
+
 #endif