diff options
-rw-r--r-- | jim.c | 5 | ||||
-rw-r--r-- | jim_tcl.txt | 1 |
2 files changed, 3 insertions, 3 deletions
@@ -2227,15 +2227,14 @@ static const char *trim_left(const char *str, const char *trimchars) return str + strspn(str, trimchars); } +/* Note that trim_right() always trims null characters */ static void trim_right(char *str, const char *trimchars) { char *p = str + strlen(str) - 1; char *end = str - 1; - int c; while (p != end) { - c = *p; - if (strchr(trimchars, c) == 0) { + if (*p && strchr(trimchars, *p) == NULL) { break; } p--; diff --git a/jim_tcl.txt b/jim_tcl.txt index 126e260..eb2cec6 100644 --- a/jim_tcl.txt +++ b/jim_tcl.txt @@ -3561,6 +3561,7 @@ The legal options (which may be abbreviated) are: removed. If *chars* is not specified then white space is removed (spaces, tabs, newlines, and carriage returns). + Null characters are always removed. subst ~~~~~ |