summaryrefslogtreecommitdiff
path: root/sfeed_frames.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2015-08-02 15:07:03 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-08-02 15:07:03 +0200
commitec254ccf06b80f3f276d8dc0120f4f7e6ba6141f (patch)
treef4117be3ca3898f5a78bb42161b7e6e5d1370665 /sfeed_frames.c
parent964846003dbd9de9771ff292c4191413796dcbe2 (diff)
sfeed_frames: normalizepath: dont start with replaced -, just ignore
Diffstat (limited to 'sfeed_frames.c')
-rw-r--r--sfeed_frames.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sfeed_frames.c b/sfeed_frames.c
index 4ac9f29..9744007 100644
--- a/sfeed_frames.c
+++ b/sfeed_frames.c
@@ -49,15 +49,15 @@ printcontent(const char *s, FILE *fp)
static size_t
normalizepath(const char *path, char *buf, size_t bufsiz)
{
- size_t i = 0, r = 0;
+ size_t i, r = 0;
- for (; *path && i < bufsiz; path++) {
+ for (i = 0; *path && i < bufsiz; path++) {
if (isalpha((int)*path) || isdigit((int)*path)) {
buf[i++] = tolower((int)*path);
r = 0;
} else {
- /* don't repeat '-' */
- if (!r)
+ /* don't repeat '-', don't start with '-' */
+ if (!r && i)
buf[i++] = '-';
r++;
}