Provide functions for expanding string using mu_assoc_t table.
The functions are used wherever variables can be expected, most notably in configuration statements, such as ldap, namespace (imap4d), etc. Apart from expanding variables it also provides command expansion $(command args...) The commands currently available are: domainpart ARG splits its argument on the first occurrence of @ and returns the part after it. localpart ARG splits its argument on the first occurrence of @ and returns the part before it. shell CMD ARG... runs shell command CMD and returns its output * include/mailutils/cstr.h (mu_str_expand, mu_str_vexpand): New protos. * libmailutils/string/expvar.c: New file. * libmailutils/string/Makefile.am: Add expvar.c * libmailutils/tests/exp.c: New file. * libmailutils/tests/Makefile.am: Add exp.c * imap4d/imap4d.c (namespace_cfg_init): Fix docstring. * imap4d/namespace.c (namespace_translate_name): Use mu_str_expand. * libmailutils/mailbox/mbx_default.c (mu_construct_user_mailbox_url): Use mu_str_vexpand. * libmu_auth/ldap.c (_mu_ldap_search): Likewise. * libmu_auth/radius.c (_expand_query): Likewise. * libmu_auth/sql.c (mu_sql_expand_query): Likewise. * mu/shell.c (mutool_prompt_env): Remove. (shell_prompt): Rewrite (input_line_interactive): Use mu_str_expand. (mutool_shell_prompt_assoc): New function. * mu/mu.h (mutool_shell_prompt_assoc): New proto. * mu/imap.c (imap_prompt_env): Use mutool_shell_prompt_assoc. * mu/pop.c (pop_prompt_env): Likewise. * mu/smtp.c (smtp_prompt_env): Likewise.
Showing
16 changed files
with
546 additions
and
231 deletions
libmailutils/string/expvar.c
0 → 100644
libmailutils/tests/exp.c
0 → 100644
-
Please register or sign in to post a comment