summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-09-08 18:45:12 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-09-08 18:45:12 +0000
commite8cf7cb598d2dcb8cba29ccbe89eaa8509b16e63 (patch)
treedd7fac7bc589320a5f6c3592e19a86f2444f72dc /src/util.c
parentdc3a89ca0755edce2031d8e283d17bce18190da1 (diff)
issue 71 - remove trailing slashes from directory names in combo box and state selector to avoid duplicates.
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index 4bcfc1b..b961d3c 100644
--- a/src/util.c
+++ b/src/util.c
@@ -342,3 +342,18 @@ evutil_vsnprintf(char *buf, size_t buflen, const char *format, va_list ap)
return r;
#endif
}
+
+void rm_trailing_slashes(gchar *str)
+{
+ int i, len;
+ if ((len = strlen(str)) < 1)
+ return;
+
+ for (i = strlen(str)-1; str[i]; i--)
+ {
+ if (str[i] == '/')
+ str[i] = '\0';
+ else
+ return;
+ }
+}