#ifndef VAR_EXPAND_H
#define VAR_EXPAND_H
struct var_expand_table {
char key;
const char *value;
const char *long_key;
};
struct var_expand_func_table {
const char *key;
/* %{key:data}, or data is "" with %{key}.
Returns 1 on success, 0 if data is invalid, -1 on temporary error. */
};
/* Expand % variables in src and append the string in dest.
table must end with key = 0. Returns 1 on success, 0 if the format string
temporary error. Even in case of errors the dest string is still written as
fully as possible. */
const struct var_expand_table *table,
const char **error_r);
/* Like var_expand(), but support also callback functions for
variable expansion. */
const struct var_expand_table *table,
const struct var_expand_func_table *func_table,
/* Returns the actual key character for given string, ie. skip any modifiers
that are before it. The string should be the data after the '%' character.
For %{long_variable}, '{' is returned. */
/* Similar to var_get_key(), but works for long keys as well. For single char
keys size=1, while for e.g. %{key} size=3 and idx points to 'k'. */
unsigned int *size_r);
/* Returns TRUE if key variable is used in the string.
If key is '\0', it's ignored. If long_key is NULL, it's ignored. */
{
size_t n = 0;
n++;
return n;
}
struct var_expand_table *
const struct var_expand_table *b);
#define t_var_expand_merge_tables(a, b) \
#endif