aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-make/utils.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2019-07-24 18:04:28 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2019-07-24 18:04:28 +0200
commit8a4e6248052ff32e02dcec3dd6850d4582836fb5 (patch)
tree6cec5c6839bceac42c3a3006fccae619c842c850 /src/blogc-make/utils.c
parent3b27b61e5409f58531e4aa8ce899b2d9c96fb433 (diff)
downloadblogc-8a4e6248052ff32e02dcec3dd6850d4582836fb5.tar.gz
blogc-8a4e6248052ff32e02dcec3dd6850d4582836fb5.tar.bz2
blogc-8a4e6248052ff32e02dcec3dd6850d4582836fb5.zip
make: fixed filename generation for pagination_tags
Diffstat (limited to 'src/blogc-make/utils.c')
-rw-r--r--src/blogc-make/utils.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/blogc-make/utils.c b/src/blogc-make/utils.c
index 91b7b53..8f69e44 100644
--- a/src/blogc-make/utils.c
+++ b/src/blogc-make/utils.c
@@ -28,7 +28,7 @@ bm_generate_filename(const char *dir, const char *prefix, const char *fname,
bool have_ext = ext != NULL && ext[0] != '\0';
bool have_ext_noslash = have_ext && ext[0] != '/';
bool is_index = have_fname && have_ext && (
- (0 == strcmp(fname, "index")) && ext[0] == '/');
+ (0 == strcmp(fname, "index")) && ext[0] == '/') && !have_prefix;
bc_string_t *rv = bc_string_new();
@@ -70,6 +70,38 @@ bm_generate_filename(const char *dir, const char *prefix, const char *fname,
char*
+bm_generate_filename2(const char *dir, const char *prefix, const char *fname,
+ const char *prefix2, const char *fname2, const char *ext)
+{
+ bool have_prefix = prefix != NULL && prefix[0] != '\0';
+ bool have_fname = fname != NULL && fname[0] != '\0';
+ bool have_prefix2 = prefix2 != NULL && prefix2[0] != '\0';
+
+ bc_string_t *p = bc_string_new();
+
+ if (have_prefix)
+ bc_string_append(p, prefix);
+
+ if (have_prefix && (have_fname || have_prefix2))
+ bc_string_append_c(p, '/');
+
+ if (have_fname)
+ bc_string_append(p, fname);
+
+ if (have_fname && have_prefix2)
+ bc_string_append_c(p, '/');
+
+ if (have_prefix2)
+ bc_string_append(p, prefix2);
+
+ char *rv = bm_generate_filename(dir, p->str, fname2, ext);
+ bc_string_free(p, true);
+
+ return rv;
+}
+
+
+char*
bm_abspath(const char *path, bc_error_t **err)
{
if (err == NULL || *err != NULL)