diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-05-16 15:56:43 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-05-16 15:56:43 +0200 |
commit | 43c435086fc16b4e86468dc8bafcd777ae0eace3 (patch) | |
tree | 3518382736a584eac947964b051c4c91ecd1545f | |
parent | 02f91017fdfa8c90a25991bf1cb4b6efcb0bc7c6 (diff) |
sfeed_frames: show mkdir error string, shorter function name normalizepath()
-rw-r--r-- | sfeed_frames.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sfeed_frames.c b/sfeed_frames.c index 0af29e0..0eff8d1 100644 --- 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); |