summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2015-01-05 19:42:53 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-01-05 19:42:53 +0100
commit1f75e9bc3f49ada6ebdbe9812a8dc92cb75b8afa (patch)
tree7cea90a40dbe209ebce8c3049d25743e12a279bb
parenta7fb510dd6f4801e8bf72fef350adcc3a07164b0 (diff)
sfeed_frames: rename makepathname -> normalizepathname and add a comment
-rw-r--r--sfeed_frames.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sfeed_frames.c b/sfeed_frames.c
index f4a7331..97ada7d 100644
--- a/sfeed_frames.c
+++ b/sfeed_frames.c
@@ -107,8 +107,10 @@ printcontent(const char *s, FILE *fp)
}
}
+/* normalize path names, transform to lower-case and replace non-alpha and
+ * non-digit with '-' */
static size_t
-makepathname(const char *path, char *buf, size_t bufsiz)
+normalizepathname(const char *path, char *buf, size_t bufsiz)
{
size_t i = 0, r = 0;
@@ -187,7 +189,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 = makepathname(feedname, name, sizeof(name))))
+ if(!(namelen = normalizepathname(feedname, name, sizeof(name))))
continue;
esnprintf(dirpath, sizeof(dirpath), "%s/%s", basepath, name);
@@ -223,7 +225,7 @@ main(int argc, char *argv[])
totalfeeds++;
}
/* write content */
- if(!(namelen = makepathname(fields[FieldTitle], name, sizeof(name))))
+ if(!(namelen = normalizepathname(fields[FieldTitle], name, sizeof(name))))
continue;
esnprintf(filepath, sizeof(filepath), "%s/%s.html", dirpath, name);
esnprintf(relfilepath, sizeof(relfilepath), "%s/%s.html", reldirpath, name);