tRearrange sanitize() function to keep '-' and '_' in filenames - scribo - Email-based phlog generator
(HTM) git clone git://git.z3bra.org/scribo.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 9be6b4ef01093e51e0dea7752b04fa2cf0933d4e
(DIR) parent ed9476f27e11d476fd01773cfd1d3a5fc7d23879
(HTM) Author: Willy Goiffon <dev@z3bra.org>
Date: Sat, 19 Sep 2020 23:56:23 +0200
Rearrange sanitize() function to keep '-' and '_' in filenames
Diffstat:
M scribo.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
---
(DIR) diff --git a/scribo.c b/scribo.c
t@@ -63,15 +63,13 @@ sanitize(const char *s)
for (p = s, w = tmp; *p; p++) {
switch (*p) {
case '.':
+ case '-':
+ case '_':
*(w++) = *p;
break;
- case '\t':
- case ' ':
- *(w++) = '-';
- break;
default:
- if (isalnum(*p))
- *(w++) = tolower(*p);
+ if (isblank(*p)) *(w++) = '-';
+ if (isalnum(*p)) *(w++) = tolower(*p);
}
}