From c835676f7dfe39830d5b0500ad2cb809832428d1 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 29 Oct 2024 10:37:15 +0100 Subject: core: Add new helper _gpgme_strtokenize. * src/conversion.c (spacep): New. (_gpgme_strtokenize): New. -- Function taken from GnuPG and license changed to LGPL 2.1. The version in GnuPG was entirely written by the author. --- src/util.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/util.h') diff --git a/src/util.h b/src/util.h index 03b800a0..ea92440a 100644 --- a/src/util.h +++ b/src/util.h @@ -140,6 +140,11 @@ gpgme_error_t _gpgme_encode_percent_string (const char *src, char **destp, * modifies STRING. The number of parsed fields is returned. */ int _gpgme_split_fields (char *string, char **array, int arraysize); +/* Tokenize STRING using the set of delimiters in DELIM into a NULL + * delimited array. Leading spaces and tabs are removed from all + * tokens if TRIM is set. The caller must free the result. */ +char **_gpgme_strtokenize (const char *string, const char *delim, int trim); + /* Convert the field STRING into an unsigned long value. Check for * trailing garbage. */ gpgme_error_t _gpgme_strtoul_field (const char *string, unsigned long *result); -- cgit v1.2.3