summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index e6a2aee5..7ef7c62a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -331,6 +331,15 @@ util_expand_home(char *buffer, const char *filename, size_t length) {
strncpy(buffer, filename, length);
return buffer;
}
+char *
+util_normalize_filename(char *buffer, const char *filename, size_t length) {
+ char *tmp = buffer;
+ for (int i=0; *filename != 0 && i<length-1; i++, filename++, buffer++) {
+ *buffer = *filename == '/' ? '_' : *filename;
+ }
+ *buffer = 0;
+ return tmp;
+}
/* util_set_file_content(const char *filename, const char *content) {{{*/
gboolean
util_set_file_content(const char *filename, const char *content) {