diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-12-25 19:37:39 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-12-25 20:15:06 +0200 |
commit | 7a77cc6f80ae220c6adee5c862b53c43ed515270 (patch) | |
tree | 0949b82c347eba9386cf696a9540892e49c4b383 /examples | |
parent | 8571d58b012a8c920073d9b9d139547dd44bd42a (diff) | |
download | mailutils-7a77cc6f80ae220c6adee5c862b53c43ed515270.tar.gz mailutils-7a77cc6f80ae220c6adee5c862b53c43ed515270.tar.bz2 |
New string functions
* libmailutils/string/strcount.c (mu_str_count): Take an array of
(ASCII) characters to count occurrences of. Optionally store individual
counts in an array passed as the 3rd argument.
* include/mailutils/cstr.h (mu_str_count): Change proto.
(mu_c_str_escape, mu_c_str_escape_trans)
(mu_c_str_unescape_inplace, mu_c_str_unescape)
(mu_c_str_unescape_trans): New protos.
* libmailutils/string/cstrescape.c: New file.
* libmailutils/string/cstrunescape.c: New file.
* libmailutils/string/Makefile.am: Add new files.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/fremove.c | 2 | ||||
-rw-r--r-- | examples/frename.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/examples/fremove.c b/examples/fremove.c index e7c2d9118..991f5ba2b 100644 --- a/examples/fremove.c +++ b/examples/fremove.c @@ -32,7 +32,7 @@ main (int argc, char **argv) } if (!mu_file_name_is_safe (argv[0]) - || (argv[0][0] == '/' && mu_str_count (argv[0], '/') < 2)) + || (argv[0][0] == '/' && mu_str_count (argv[0], "/", NULL) < 2)) { mu_error ("unsafe file name"); return 1; diff --git a/examples/frename.c b/examples/frename.c index 1bf6556f4..9fcf67333 100644 --- a/examples/frename.c +++ b/examples/frename.c @@ -36,13 +36,13 @@ main (int argc, char **argv) } if (!mu_file_name_is_safe (argv[0]) - || (argv[0][0] == '/' && mu_str_count (argv[0], '/') < 2)) + || (argv[0][0] == '/' && mu_str_count (argv[0], "/", NULL) < 2)) { mu_error ("%s: unsafe file name", argv[0]); return 1; } if (!mu_file_name_is_safe (argv[1]) - || (argv[1][0] == '/' && mu_str_count (argv[1], '/') < 2)) + || (argv[1][0] == '/' && mu_str_count (argv[1], "/", NULL) < 2)) { mu_error ("%sunsafe file name", argv[0]); return 1; |