diff options
author | Werner Koch <[email protected]> | 1999-01-17 10:06:03 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 1999-01-17 10:06:03 +0000 |
commit | befacf7efa649de7ee4421a154cc06a40a181cf2 (patch) | |
tree | 8197e739f35fbe9d4afa9dc96cfa82aee75d74f5 /util/strgutil.c | |
parent | See ChangeLog: Sat Jan 16 21:25:17 CET 1999 Werner Koch (diff) | |
download | gnupg-befacf7efa649de7ee4421a154cc06a40a181cf2.tar.gz gnupg-befacf7efa649de7ee4421a154cc06a40a181cf2.zip |
See ChangeLog: Sun Jan 17 11:04:33 CET 1999 Werner Koch
Diffstat (limited to '')
-rw-r--r-- | util/strgutil.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/util/strgutil.c b/util/strgutil.c index d5379f903..b3213dc9c 100644 --- a/util/strgutil.c +++ b/util/strgutil.c @@ -191,6 +191,34 @@ trim_spaces( char *str ) } + +/**************** + * remove trailing white spaces and return the length of the buffer + */ +unsigned +trim_trailing_ws( byte *line, unsigned len ) +{ + byte *p, *mark; + unsigned n; + + for(mark=NULL, p=line, n=0; n < len; n++, p++ ) { + if( strchr(" \t\r\n", *p ) ) { + if( !mark ) + mark = p; + } + else + mark = NULL; + } + + if( mark ) { + *mark = 0; + return mark - line; + } + return len; +} + + + int string_count_chr( const char *string, int c ) { |