aboutsummaryrefslogtreecommitdiffstats
path: root/common/stringhelp.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2020-08-20 13:50:50 +0000
committerWerner Koch <[email protected]>2020-08-20 13:50:50 +0000
commite276f63e4a80e8d1cb1ba5621cedaeb0ccda956d (patch)
tree3768a164f347db3805702f5f02e105653bc43797 /common/stringhelp.c
parentbuild: New configure option --disable-tests (diff)
downloadgnupg-e276f63e4a80e8d1cb1ba5621cedaeb0ccda956d.tar.gz
gnupg-e276f63e4a80e8d1cb1ba5621cedaeb0ccda956d.zip
gpgtar: Make --files-from and --null work as described.
* tools/gpgtar-create.c (gpgtar_create): Add args files_from and null_names. Improve reading from a file. * tools/gpgtar.c: Make global vars static. (main): Remove tests for --files-from and --null option combinations. Pass option variables to gpgtar_create. -- GnuPG-bug-id: 5027 Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'common/stringhelp.c')
-rw-r--r--common/stringhelp.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/common/stringhelp.c b/common/stringhelp.c
index dd1711684..3424048f9 100644
--- a/common/stringhelp.c
+++ b/common/stringhelp.c
@@ -213,6 +213,36 @@ trim_spaces( char *str )
return str ;
}
+
+/* Same as trim_spaces but only condider, space, tab, cr and lf as space. */
+char *
+ascii_trim_spaces (char *str)
+{
+ char *string, *p, *mark;
+
+ string = str;
+
+ /* Find first non-ascii space character. */
+ for (p=string; *p && ascii_isspace (*p); p++)
+ ;
+ /* Move characters. */
+ for (mark=NULL; (*string = *p); string++, p++ )
+ {
+ if (ascii_isspace (*p))
+ {
+ if (!mark)
+ mark = string;
+ }
+ else
+ mark = NULL ;
+ }
+ if (mark)
+ *mark = '\0' ; /* Remove trailing spaces. */
+
+ return str ;
+}
+
+
/****************
* remove trailing white spaces
*/