X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/c6f2d14d9c38345075629af3487c2de491584ca1..7bb5dd523c67aabb2aa9cc623d69bc380862fc77:/sbr/utils.c?ds=sidebyside diff --git a/sbr/utils.c b/sbr/utils.c index c9769fb0..d9b903e7 100644 --- a/sbr/utils.c +++ b/sbr/utils.c @@ -360,6 +360,19 @@ nmh_strcasestr (const char *s1, const char *s2) { } +/* TrimSuffixC deletes c from the end of non-NULL string s if it's + * present, shortening s by 1. Only one instance of c is removed. */ +void TrimSuffixC(char *s, int c) +{ + if (!*s) + return; + + s += strlen(s) - 1; + if (*s == c) + *s = '\0'; +} + + int nmh_init(const char *argv0, int read_context) { if (! setlocale(LC_ALL, "")) {