aboutsummaryrefslogtreecommitdiffstats
path: root/common/t-stringhelp.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Remove remaining support for WindowsCEWerner Koch2022-06-031-5/+0
| | | | --
* w32: Fix for make check.NIIBE Yutaka2022-04-061-1/+9
| | | | | | | | | | | | | | * common/Makefile.am (module_tests): Exclude t-exechelp and t-exectool. * common/t-stringhelp.c (mygetcwd): Convert '\' to '/'. * tests/cms/Makefile.am: Add $(EXEEXT). * tests/gpgme/Makefile.am: Likewise. * tests/migrations/Makefile.am: Likewise. * tests/openpgp/Makefile.am: Likewise. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* common: New function substitute_envvars.Werner Koch2021-09-171-0/+99
| | | | | | | | | | * common/stringhelp.c (substitute_envvars): New. Based on code in gpg-connect-agent. * common/t-stringhelp.c: Include sysutils.h. (test_substitute_envvars): New. -- GnuPG-bug-id: 5599
* wkd: Fix client issue with leading or trailing spaces in user-ids.Werner Koch2021-08-201-4/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/recsel.c (recsel_parse_expr): Add flag -t. * common/stringhelp.c: Remove assert.h. (strtokenize): Factor code out to do_strtokenize. (strtokenize_nt): New. (do_strtokenize): Add arg trim to support the strtokenize_nt. * common/t-stringhelp.c (test_strtokenize_nt): New test cases. * tools/wks-util.c (wks_list_key): Use strtokenize_nt and the recsel flag -t. -- This fixes a bug with user ids with leading spaces because: wks-client lists all mail addresses from the key and matches them to the requested mail address. If there are several user-ids all with the same mail address wks-client picks one of them and then extracts exactly that user id. However, here it does not match by the mail address but by the full user-id so that we can be sure that there will be only one user-id in the final key. The filter built expression unfortunately strips leading blanks but requires a verbatim match. Thus it won't find the user id again and errors out. The new -t flag and a non-trimming strtokenize solves the problem. Signed-off-by: Werner Koch <[email protected]>
* common,agent,dirmngr,g10,tools: Fix split_fields API.NIIBE Yutaka2020-09-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | * common/stringhelp.h (split_fields): Use const * for the strings in the ARRAY. (split_fields_colon): Likewise. * common/stringhelp.c (split_fields, split_fields_colon): Fix the implementation. * agent/call-scd.c, agent/command.c: Follow the change. * common/t-stringhelp.c, dirmngr/loadswdb.c: Likewise. * g10/call-agent.c, tools/card-call-scd.c: Likewise. * tools/card-yubikey.c, tools/gpg-card.c: Likewise. * tools/gpg-card.h, tools/gpg-wks-client.c: Likewise. * tools/gpgconf-comp.c, tools/gpgconf.c: Likewise. * tools/wks-util.c: Likewise. -- The strings in the ARRAY don't need to be released by caller, as those are references. It's easier to follow the code when it's explicitly const *. Signed-off-by: NIIBE Yutaka <[email protected]>
* common: New function split_fields_colon.Werner Koch2017-07-171-0/+76
| | | | | | | | * common/stringhelp.c (split_fields_colon): New. * common/t-stringhelp.c (test_split_fields_colon): New test. (main): Call that test. Signed-off-by: Werner Koch <[email protected]>
* common: Let format_text return an error.Werner Koch2017-05-151-0/+5
| | | | | | | | | | | | | | | * common/stringhelp.c (format_text): Return NULL on error. * common/t-stringhelp.c (test_format_text): Adjust for change. * g10/gpgcompose.c (show_help): Abort on out of core. * g10/tofu.c (ask_about_binding): Abort on format_text error. (show_statistics): Ditto. (show_warning): Ditto. -- For better re-usability function in common/ shot better not use xmalloc functions. Signed-off-by: Werner Koch <[email protected]>
* common: Simplify format_text.NIIBE Yutaka2017-04-121-1/+1
| | | | | | | | | | | * common/stringhelp.c (format_text): Don't allow IN_PLACE formatting. * common/stringhelp.h: Change the API with no IN_PLACE. * common/t-stringhelp.c (test_format_text): Follow the change. * g10/gpgcompose.c (show_help): Likewise. * g10/tofu.c (format_conflict_msg_part1, ask_about_binding) (show_statistics, show_warning): Likewise. Signed-off-by: NIIBE Yutaka <[email protected]>
* Clarify text of LGPLv2+/GPLv2+ licensed files.Werner Koch2017-02-241-2/+2
| | | | --
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-051-1/+1
| | | | --
* common: Improve compare_string_versions.Werner Koch2016-11-021-23/+42
| | | | | | | | | | | | | | | * common/stringhelp.c: Include limits.h. (compare_version_strings): Change semantics to behave like strcmp. Include the patch lebel in the comparison. Allow checking a single version string. * common/t-stringhelp.c (test_compare_version_strings): Adjust test vectors and a few new vectors. * g10/call-agent.c (warn_version_mismatch): Adjust to new sematics. * g10/call-dirmngr.c (warn_version_mismatch): Ditto. * sm/call-agent.c (warn_version_mismatch): Ditto. * sm/call-dirmngr.c (warn_version_mismatch): Ditto. Signed-off-by: Werner Koch <[email protected]>
* common: Fix memory leaks.Justus Winter2016-06-281-0/+7
| | | | | | | | | | | | | * common/ccparray.c (ccparray_put): Free old array. * common/stringhelp.c (do_make_filename): Free 'home'. * common/t-convert.c: Fix trivial memory leaks. * common/t-iobuf.c: Likewise. * common/t-mbox-util.c: Likewise. * common/t-name-value.c: Likewise. * common/t-stringhelp.c: Likewise. * common/t-strlist.c: Likewise. Signed-off-by: Justus Winter <[email protected]>
* common: Fix bad printf format in t-stringhelp.cWerner Koch2016-06-121-1/+1
| | | | --
* common: New function split_fields.Werner Koch2016-06-111-0/+78
| | | | | | | | | * common/stringhelp.c (split_fields): New. * common/t-stringhelp.c: Include assert.h. (test_split_fields): New. (main): Call test. Signed-off-by: Werner Koch <[email protected]>
* common: New function compare_version_strings.Werner Koch2016-01-081-1/+62
| | | | | | | | | | | | | | | * common/stringhelp.c (parse_version_number): New. (parse_version_string): New. (compare_version_strings): New. * common/t-stringhelp.c (test_compare_version_strings): New. (main): Call test. Return ERRCOUNT instead of 0. -- The code for that function is based on code from libgcrypt. Similar code is in all GnuPG related libraries this function is a candidates for inclusion in libgpg-error. Signed-off-by: Werner Koch <[email protected]>
* common: Do not deref vars in tests after a fail().Werner Koch2016-01-061-16/+16
| | | | | | | | | | | | | | | | * common/t-convert.c (test_bin2hex): Turn if conditions into if-else chains to avoid accessing unchecked data. (test_bin2hexcolon): Ditto. * common/t-mapstrings.c (test_map_static_macro_string): Ditto. * common/t-stringhelp.c (test_percent_escape): Ditto. (test_make_filename_try): Ditto. (test_make_absfilename_try): Ditto. * common/t-timestuff.c (test_timegm): Ditto. -- Note that these dereference only occur after failed regression tests. Signed-off-by: Werner Koch <[email protected]>
* Remove replacements for libgpg-error < 1.21.Werner Koch2015-12-121-2/+1
| | | | | | | | | | | | | | | | * common/util.h: Remove replacement macros for libgpg-error<1.21. * common/types.h: Ditto. * common/mischelp.h: Ditto. * common/t-mapstrings.c: Include t-support.h before stringhelp.h * common/t-stringhelp.c: Ditto. * common/t-support.h: Always include gpg-error.h. * kbx/keybox-search.c: Do not include stringhelp.h so that keybox-defs comes first. -- This patch enhances commit d6e0149 from Dec 10. Signed-off-by: Werner Koch <[email protected]>
* gpg: Reflow long texts.Neal H. Walfield2015-11-231-0/+137
| | | | | | | | | | | * 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 <[email protected]>
* common: Add function strtokenize.Werner Koch2015-06-221-0/+141
| | | | | | | | * common/stringhelp.c: Include assert.h. (strtokenize): New. * common/t-stringhelp.c (test_strtokenize): New. Signed-off-by: Werner Koch <[email protected]>
* common: Remove JNLIB from boiler plate (jnlib merge).Werner Koch2015-04-241-3/+3
| | | | | | | * common/README.jnlib: Remove. -- This is the final part of merging jnlib into gnupg/common.
* common: Do without nested fucntions to support non-gcc.Werner Koch2015-04-131-52/+54
| | | | | | * common/t-stringhelp.c (test_strsplit): Remove nested function. Signed-off-by: Werner Koch <[email protected]>
* common: Add new helper function, strsplit.Neal H. Walfield2015-03-231-0/+58
| | | | | | | | | | * common/stringhelp.h (strsplit): New declaration. * common/stringhelp.c (strsplit): New function. * common/t-stringhelp.c (test_strsplit): New function. (main): Call it here. -- Signed-off-by: Neal H. Walfield <[email protected]>
* common: Add functions make_absfilename and make_absfilename_try.Werner Koch2014-04-221-0/+73
| | | | | | * common/stringhelp.c (do_make_filename): Add modes 2 and 3. (make_absfilename): New. (make_absfilename_try): New.
* Change JNLIB license to LGPLv3+ or GPLv2+.Werner Koch2011-09-301-7/+18
| | | | This is to allow the use of this code with code under GPLv2(only).
* Nuked almost all trailing white space.post-nuke-of-trailing-wsWerner Koch2011-02-041-11/+10
| | | | | | | | We better do this once and for all instead of cluttering all future commits with diffs of trailing white spaces. In the majority of cases blank or single lines are affected and thus this change won't disturb a git blame too much. For future commits the pre-commit scripts checks that this won't happen again.
* Merged jnlib into common.Werner Koch2010-03-101-0/+414