diff options
author | Neal H. Walfield <neal@g10code.com> | 2015-11-23 22:20:28 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@g10code.com> | 2015-11-23 22:23:38 +0100 |
commit | 19362a8dd7ee986c082a5afc5a446f939991ec0f (patch) | |
tree | a5f4b3d346583ada7518bda71fcc50153815506a /common/stringhelp.h | |
parent | common: Extend utf8_charcount to include the string's length. (diff) | |
download | gnupg2-19362a8dd7ee986c082a5afc5a446f939991ec0f.tar.xz gnupg2-19362a8dd7ee986c082a5afc5a446f939991ec0f.zip |
gpg: Reflow long texts.
* common/stringhelp.c (format_text): New function.
* common/t-stringhelp.c (stresc): New function.
(test_format_text): New function. Test format_text.
* g10/tofu.c (get_trust): Use format_text to reflow long texts.
(show_statistics): Likewise.
--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Diffstat (limited to 'common/stringhelp.h')
-rw-r--r-- | common/stringhelp.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/stringhelp.h b/common/stringhelp.h index b34d28b89..9ff062bd9 100644 --- a/common/stringhelp.h +++ b/common/stringhelp.h @@ -148,6 +148,11 @@ char **strsplit (char *string, char delim, char replacement, int *count); /* Tokenize STRING using the set of delimiters in DELIM. */ char **strtokenize (const char *string, const char *delim); +/* Format a string so that it fits within about TARGET_COLS columns. + If IN_PLACE is 0, then TEXT is copied to a new buffer, which is + returned. Otherwise, TEXT is modified in place and returned. + Normally, target_cols will be 72 and max_cols is 80. */ +char *format_text (char *text, int in_place, int target_cols, int max_cols); /*-- mapstrings.c --*/ const char *map_static_macro_string (const char *string); |