aboutsummaryrefslogtreecommitdiffstats
path: root/libfonts_get_default_font.c
diff options
context:
space:
mode:
Diffstat (limited to 'libfonts_get_default_font.c')
-rw-r--r--libfonts_get_default_font.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/libfonts_get_default_font.c b/libfonts_get_default_font.c
index 25b18e1..5661e5c 100644
--- a/libfonts_get_default_font.c
+++ b/libfonts_get_default_font.c
@@ -4,13 +4,13 @@
static char *
-find(const char *dir_part1, const char *dir_part2, const char *dir_part3)
+find(const char *dir_part1, const char *dir_part2, const char *dir_part3, struct libfonts_context *ctx)
{
return NULL; /* TODO */
}
static char *
-getn(const char *file_part1, size_t file_part1_len, const char *file_part2, const char *name)
+getn(const char *file_part1, size_t file_part1_len, const char *file_part2, const char *name, struct libfonts_context *ctx)
{
size_t file_part2_len = strlen(file_part2);
char *path;
@@ -39,9 +39,9 @@ getn(const char *file_part1, size_t file_part1_len, const char *file_part2, cons
}
static char *
-get(const char *file_part1, const char *file_part2, const char *name)
+get(const char *file_part1, const char *file_part2, const char *name, struct libfonts_context *ctx)
{
- return getn(file_part1, strlen(file_part1), file_part2, name);
+ return getn(file_part1, strlen(file_part1), file_part2, name, ctx);
}
char *
@@ -72,51 +72,51 @@ libfonts_get_default_font(enum libfonts_default_font font, struct libfonts_conte
confenv = libfonts_getenv__("XDG_CONFIG_HOME", ctx);
if (confenv && *confenv) {
- ret = get(confenv, "/libfonts/default-fonts.conf", var);
+ ret = get(confenv, "/libfonts/default-fonts.conf", var, ctx);
if (ret)
goto out;
}
homeenv = libfonts_getenv__("HOME", ctx);
if (homeenv && *homeenv) {
- ret = get(homeenv, "/.config/libfonts/default-fonts.conf", var);
+ ret = get(homeenv, "/.config/libfonts/default-fonts.conf", var, ctx);
if (ret)
goto out;
- ret = get(homeenv, "/.libfonts/default-fonts.conf", var);
+ ret = get(homeenv, "/.libfonts/default-fonts.conf", var, ctx);
if (ret)
goto out;
}
home = libfonts_gethome__(ctx);
if (home && *home) {
- ret = get(home, "/.config/libfonts/default-fonts.conf", var);
+ ret = get(home, "/.config/libfonts/default-fonts.conf", var, ctx);
if (ret)
goto out;
- ret = get(home, "/.libfonts/default-fonts.conf", var);
+ ret = get(home, "/.libfonts/default-fonts.conf", var, ctx);
if (ret)
goto out;
}
if (confenv && *confenv) {
- ret = find(env, "/libfonts/", var);
+ ret = find(env, "/libfonts/", var, ctx);
if (ret)
goto out;
}
if (homeenv && *homeenv) {
- ret = find(homeenv, "/.config/libfonts/", var);
+ ret = find(homeenv, "/.config/libfonts/", var, ctx);
if (ret)
goto out;
- ret = find(homeenv, "/.libfonts/", var);
+ ret = find(homeenv, "/.libfonts/", var, ctx);
if (ret)
goto out;
}
if (home && *home) {
- ret = find(home, "/.config/libfonts/", var);
+ ret = find(home, "/.config/libfonts/", var, ctx);
if (ret)
goto out;
- ret = find(home, "/.libfonts/", var);
+ ret = find(home, "/.libfonts/", var, ctx);
if (ret)
goto out;
}
@@ -127,7 +127,7 @@ libfonts_get_default_font(enum libfonts_default_font font, struct libfonts_conte
next = strchr(&env[1], ':');
len = next ? (size_t)(next - env) : strlen(env);
if (len) {
- ret = getn(env, len, "/libfonts/default-fonts.conf", var);
+ ret = getn(env, len, "/libfonts/default-fonts.conf", var, ctx);
if (ret)
goto out;
}
@@ -135,11 +135,11 @@ libfonts_get_default_font(enum libfonts_default_font font, struct libfonts_conte
} while (next);
}
- ret = get("/etc", "/libfonts/default-fonts.conf", var);
+ ret = get("/etc", "/libfonts/default-fonts.conf", var, ctx);
if (ret)
goto out;
- ret = find("/etc", "/libfonts/", var);
+ ret = find("/etc", "/libfonts/", var, ctx);
if (ret)
goto out;