From ec254ccf06b80f3f276d8dc0120f4f7e6ba6141f Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sun, 2 Aug 2015 15:07:03 +0200 Subject: sfeed_frames: normalizepath: dont start with replaced -, just ignore --- sfeed_frames.c | 8 ++++---- 1 file 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++; } -- cgit v1.2.3