diff options
author | June McEnroe <june@causal.agency> | 2020-02-11 17:37:18 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-02-11 17:37:18 -0500 |
commit | a50596c5c575d23fa92cace9eef3813dff36b175 (patch) | |
tree | 7595789e6602f26da1cde24422e5c5e941d4010e | |
parent | Fix whois idle unit calculation (diff) | |
download | test-a50596c5c575d23fa92cace9eef3813dff36b175.tar.gz test-a50596c5c575d23fa92cace9eef3813dff36b175.zip |
Move XDG_SUBDIR out of chat.h
Diffstat (limited to '')
-rw-r--r-- | chat.h | 2 | ||||
-rw-r--r-- | xdg.c | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/chat.h b/chat.h index 829dd1d..735327d 100644 --- a/chat.h +++ b/chat.h @@ -26,8 +26,6 @@ #define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0])) #define BIT(x) x##Bit, x = 1 << x##Bit, x##Bit_ = x##Bit -#define XDG_SUBDIR "catgirl" - typedef unsigned char byte; int procPipe[2]; diff --git a/xdg.c b/xdg.c index 6e33210..ed2a6e1 100644 --- a/xdg.c +++ b/xdg.c @@ -24,6 +24,8 @@ #include "chat.h" +#define SUBDIR "catgirl" + FILE *configOpen(const char *path, const char *mode) { if (path[0] == '/' || path[0] == '.') goto local; @@ -33,10 +35,10 @@ FILE *configOpen(const char *path, const char *mode) { char buf[PATH_MAX]; if (configHome) { - snprintf(buf, sizeof(buf), "%s/" XDG_SUBDIR "/%s", configHome, path); + snprintf(buf, sizeof(buf), "%s/" SUBDIR "/%s", configHome, path); } else { if (!home) goto local; - snprintf(buf, sizeof(buf), "%s/.config/" XDG_SUBDIR "/%s", home, path); + snprintf(buf, sizeof(buf), "%s/.config/" SUBDIR "/%s", home, path); } FILE *file = fopen(buf, mode); if (file) return file; @@ -49,7 +51,7 @@ FILE *configOpen(const char *path, const char *mode) { while (*configDirs) { size_t len = strcspn(configDirs, ":"); snprintf( - buf, sizeof(buf), "%.*s/" XDG_SUBDIR "/%s", + buf, sizeof(buf), "%.*s/" SUBDIR "/%s", (int)len, configDirs, path ); file = fopen(buf, mode); @@ -79,13 +81,13 @@ FILE *dataOpen(const char *path, const char *mode) { if (dataHome) { snprintf( homePath, sizeof(homePath), - "%s/" XDG_SUBDIR "/%s", dataHome, path + "%s/" SUBDIR "/%s", dataHome, path ); } else { if (!home) goto local; snprintf( homePath, sizeof(homePath), - "%s/.local/share/" XDG_SUBDIR "/%s", home, path + "%s/.local/share/" SUBDIR "/%s", home, path ); } FILE *file = fopen(homePath, mode); @@ -100,7 +102,7 @@ FILE *dataOpen(const char *path, const char *mode) { while (*dataDirs) { size_t len = strcspn(dataDirs, ":"); snprintf( - buf, sizeof(buf), "%.*s/" XDG_SUBDIR "/%s", + buf, sizeof(buf), "%.*s/" SUBDIR "/%s", (int)len, dataDirs, path ); file = fopen(buf, mode); |