commit 1f75e9bc3f49ada6ebdbe9812a8dc92cb75b8afa
parent a7fb510dd6f4801e8bf72fef350adcc3a07164b0
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 5 Jan 2015 19:42:53 +0100
sfeed_frames: rename makepathname -> normalizepathname and add a comment
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git 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);