commit 43c435086fc16b4e86468dc8bafcd777ae0eace3
parent 02f91017fdfa8c90a25991bf1cb4b6efcb0bc7c6
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 16 May 2015 15:56:43 +0200
sfeed_frames: show mkdir error string, shorter function name normalizepath()
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/sfeed_frames.c b/sfeed_frames.c
@@ -110,7 +110,7 @@ printcontent(const char *s, FILE *fp)
/* normalize path names, transform to lower-case and replace non-alpha and
* non-digit with '-' */
static size_t
-normalizepathname(const char *path, char *buf, size_t bufsiz)
+normalizepath(const char *path, char *buf, size_t bufsiz)
{
size_t i = 0, r = 0;
@@ -158,8 +158,10 @@ main(int argc, char *argv[])
comparetime = time(NULL) - 86400;
basepathlen = strlen(basepath);
- if(basepathlen > 0)
+ if(basepathlen > 0) {
mkdir(basepath, S_IRWXU);
+ xerr(1, "mkdir: %s", basepath);
+ }
/* write main index page */
esnprintf(dirpath, sizeof(dirpath), "%s/index.html", basepath);
if(!(fpindex = fopen(dirpath, "w+b")))
@@ -189,7 +191,7 @@ main(int argc, char *argv[])
/* first of feed section or new feed section (differ from previous). */
if(!totalfeeds || strcmp(fcur->name, feedname)) {
/* make directory for feedname */
- if(!(namelen = normalizepathname(feedname, name, sizeof(name))))
+ if(!(namelen = normalizepath(feedname, name, sizeof(name))))
continue;
esnprintf(dirpath, sizeof(dirpath), "%s/%s", basepath, name);
@@ -225,7 +227,7 @@ main(int argc, char *argv[])
totalfeeds++;
}
/* write content */
- if(!(namelen = normalizepathname(fields[FieldTitle], name, sizeof(name))))
+ if(!(namelen = normalizepath(fields[FieldTitle], name, sizeof(name))))
continue;
esnprintf(filepath, sizeof(filepath), "%s/%s.html", dirpath, name);
esnprintf(relfilepath, sizeof(relfilepath), "%s/%s.html", reldirpath, name);