common.h (761B)
1 #ifndef COMMON_H 2 #define COMMON_H 3 4 #include <stdio.h> 5 6 #include "config.h" 7 8 #if DEBUG 9 #define DPRINTF(fmt, ...) \ 10 fprintf(stderr, "DEBUG: " fmt, ##__VA_ARGS__) 11 #else 12 #define DPRINTF(fmt, ...) \ 13 do { } while (0) 14 #endif 15 16 void reply(const char *, const char *); 17 void redirect(const char *); 18 19 int build_repository_path(char *path, size_t len, const char *storage_root, const char *repository); 20 int build_storage_path(char *path, size_t len, const char *storage_root, const char *repository, const char *filename); 21 22 const char *storage_root(void); 23 const char *repository(void); 24 const char *repository_lock_dir(void); 25 int valid_filename(const char *); 26 27 int repository_lock(const char *repository); 28 void repository_unlock(int); 29 30 int check_csrf_origin(void); 31 32 #endif