diff options
| author | Werner Koch <[email protected]> | 2025-11-18 14:54:47 +0000 |
|---|---|---|
| committer | Werner Koch <[email protected]> | 2025-11-18 14:54:47 +0000 |
| commit | be9b1404e66157ac00bf3ae488ad2af1becffe25 (patch) | |
| tree | 0bcadacebbe332986ad12154dc7ef5cd5452735e /common/stringhelp.h | |
| parent | gpg: Include ADSK keys in a key listing with fingerprints. (diff) | |
| download | gnupg-be9b1404e66157ac00bf3ae488ad2af1becffe25.tar.gz gnupg-be9b1404e66157ac00bf3ae488ad2af1becffe25.zip | |
common: New function replace_substr.
* common/stringhelp.c (replace_substr): New.
* common/t-stringhelp.c (test_replace_substr): New test.
Diffstat (limited to 'common/stringhelp.h')
| -rw-r--r-- | common/stringhelp.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/stringhelp.h b/common/stringhelp.h index d93373ec5..037ee8139 100644 --- a/common/stringhelp.h +++ b/common/stringhelp.h @@ -170,6 +170,13 @@ int compare_version_strings (const char *my_version, const char *req_version); /* Format a string so that it fits within about TARGET_COLS columns. */ char *format_text (const char *text, int target_cols, int max_cols); + +/* Return a new malloced string with the first occurance of SUBSTR in + * STRING replaced by REPLACE. Returns NULL on memory error. */ +char *replace_substr (const char *string, + const char *substr, const char *replace); + + /* Substitute variables in STRING. */ char *substitute_vars (const char *string, const char *(*getval)(void *cookie, const char *name), |
