diff options
author | ewt <devnull@localhost> | 1996-07-10 02:33:54 +0000 |
---|---|---|
committer | ewt <devnull@localhost> | 1996-07-10 02:33:54 +0000 |
commit | 3685015232cf8870ff32f30e1e446e52809651c0 (patch) | |
tree | e88ae20247f6c30a3c4e8ee58fcd0de09c141fc7 /lib | |
parent | 5f0b82b4f575d3e23b541b68899cfb4db9ddc76a (diff) | |
download | rpm-3685015232cf8870ff32f30e1e446e52809651c0.tar.gz rpm-3685015232cf8870ff32f30e1e446e52809651c0.tar.bz2 rpm-3685015232cf8870ff32f30e1e446e52809651c0.zip |
added stripTrailingSlashes()
CVS patchset: 759
CVS date: 1996/07/10 02:33:54
Diffstat (limited to 'lib')
-rw-r--r-- | lib/misc.c | 10 | ||||
-rw-r--r-- | lib/misc.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/misc.c b/lib/misc.c index c23f14717..38914cbfe 100644 --- a/lib/misc.c +++ b/lib/misc.c @@ -251,3 +251,13 @@ int vercmp(char * one, char * two) { if (!*one) return -1; else return 1; } + +void stripTrailingSlashes(char * str) { + char * chptr; + + chptr = str + strlen(str) - 1; + while (*chptr == '/' && chptr >= str) { + *chptr = '\0'; + chptr--; + } +} diff --git a/lib/misc.h b/lib/misc.h index 278ef2f3c..2dc806101 100644 --- a/lib/misc.h +++ b/lib/misc.h @@ -3,6 +3,7 @@ char ** splitString(char * str, int length, char sep); void freeSplitString(char ** list); +void stripTrailingSlashes(char * str); int exists(char * filespec); |