diff options
Diffstat (limited to 'util/strgutil.c')
-rw-r--r-- | util/strgutil.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/util/strgutil.c b/util/strgutil.c index 5cef77bf6..ab0d2234a 100644 --- a/util/strgutil.c +++ b/util/strgutil.c @@ -213,17 +213,14 @@ trim_spaces( char *str ) -/**************** - * remove trailing white spaces and return the length of the buffer - */ unsigned -trim_trailing_ws( byte *line, unsigned len ) +trim_trailing_chars( byte *line, unsigned len, const char *trimchars ) { byte *p, *mark; unsigned n; for(mark=NULL, p=line, n=0; n < len; n++, p++ ) { - if( strchr(" \t\r\n", *p ) ) { + if( strchr(trimchars, *p ) ) { if( !mark ) mark = p; } @@ -238,6 +235,15 @@ trim_trailing_ws( byte *line, unsigned len ) return len; } +/**************** + * remove trailing white spaces and return the length of the buffer + */ +unsigned +trim_trailing_ws( byte *line, unsigned len ) +{ + return trim_trailing_chars( line, len, " \t\r\n" ); +} + int |