[wiki] [sites] build-page: fix call to snprintf || Quentin Rameau

From: <git_AT_suckless.org>
Date: Sun, 06 Jan 2019 14:32:06 +0100

commit 49f25e0108c5b0c565c17f96525ddbfc08bb7fbb
Author: Quentin Rameau <quinq_AT_fifth.space>
Date: Sun Jan 6 14:18:57 2019 +0100

    build-page: fix call to snprintf
    
    Yes, when calling positioned argument, all leading arguments must
    be specified in the format.

diff --git a/build-page.c b/build-page.c
index b466de38..6f0782ae 100644
--- a/build-page.c
+++ b/build-page.c
_AT_@ -223,8 +223,8 @@ menu_panel(char *domain, char *page, char *this, int depth)
                 d = d_list[l];
                 if (*d == '.')
                         continue;
- snprintf(newdir, sizeof(newdir), this ? "%s/%s" : "%2$s",
- this, d);
+ snprintf(newdir, sizeof(newdir), this ? "%2$s/%1$s" : "%s",
+ d, this);
                 if (!stat_isdir(newdir))
                         continue;
 
_AT_@ -271,8 +271,8 @@ print_content(char *domain, char *page)
         char index[PATH_MAX];
         char *argv[] = { CONVERTER, index, NULL };
 
- snprintf(index, sizeof(index), page ? "%s/%s" : "%2$s",
- page, "index.md");
+ snprintf(index, sizeof(index), page ? "%2$s/%1$s" : "%s",
+ "index.md", page);
 
         puts("<div id=\"main\">
");
 
Received on Sun Jan 06 2019 - 14:32:06 CET

This archive was generated by hypermail 2.3.0 : Sun Jan 06 2019 - 14:36:26 CET