aboutsummaryrefslogtreecommitdiffstats
path: root/funcs/func_strings.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-23 19:51:41 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-23 19:51:41 +0000
commitfd0b69a4e7f57297f9c011c75820432d693e21a5 (patch)
treec9c73917bfd120da30c16650000c7296781fae50 /funcs/func_strings.c
parentb5741f9dd4e38302ab7d62f3999c59f5b9011ac5 (diff)
Merge the dialplan_aesthetics branch. Most of this patch simply converts applications
using old methods of parsing arguments to using the standard macros. However, the big change is that the really old way of specifying application and arguments separated by a comma will no longer work (e.g. NoOp,foo|bar). Instead, the way that has been recommended since long before 1.0 will become the only method available (e.g. NoOp(foo,bar). git-svn-id: http://svn.digium.com/svn/asterisk/trunk@76703 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs/func_strings.c')
-rw-r--r--funcs/func_strings.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/funcs/func_strings.c b/funcs/func_strings.c
index c44c49921..5eab9930f 100644
--- a/funcs/func_strings.c
+++ b/funcs/func_strings.c
@@ -88,7 +88,7 @@ static int function_fieldqty(struct ast_channel *chan, const char *cmd,
static struct ast_custom_function fieldqty_function = {
.name = "FIELDQTY",
.synopsis = "Count the fields, with an arbitrary delimiter",
- .syntax = "FIELDQTY(<varname>|<delim>)",
+ .syntax = "FIELDQTY(<varname>,<delim>)",
.read = function_fieldqty,
};
@@ -104,7 +104,7 @@ static int filter(struct ast_channel *chan, const char *cmd, char *parse, char *
AST_STANDARD_APP_ARGS(args, parse);
if (!args.string) {
- ast_log(LOG_ERROR, "Usage: FILTER(<allowed-chars>|<string>)\n");
+ ast_log(LOG_ERROR, "Usage: FILTER(<allowed-chars>,<string>)\n");
return -1;
}
@@ -120,7 +120,7 @@ static int filter(struct ast_channel *chan, const char *cmd, char *parse, char *
static struct ast_custom_function filter_function = {
.name = "FILTER",
.synopsis = "Filter the string to include only the allowed characters",
- .syntax = "FILTER(<allowed-chars>|<string>)",
+ .syntax = "FILTER(<allowed-chars>,<string>)",
.read = filter,
};
@@ -237,15 +237,9 @@ static int array(struct ast_channel *chan, const char *cmd, char *var,
* delimiter, but we'll fall back to vertical bars if commas aren't found.
*/
ast_debug(1, "array (%s=%s)\n", var, value2);
- if (strchr(var, ','))
- AST_NONSTANDARD_APP_ARGS(arg1, var, ',');
- else
- AST_STANDARD_APP_ARGS(arg1, var);
+ AST_STANDARD_APP_ARGS(arg1, var);
- if (strchr(value2, ','))
- AST_NONSTANDARD_APP_ARGS(arg2, value2, ',');
- else
- AST_STANDARD_APP_ARGS(arg2, value2);
+ AST_STANDARD_APP_ARGS(arg2, value2);
for (i = 0; i < arg1.argc; i++) {
ast_debug(1, "array set value (%s=%s)\n", arg1.var[i],
@@ -302,7 +296,7 @@ static int hash_write(struct ast_channel *chan, const char *cmd, char *var, cons
AST_APP_ARG(hashkey);
);
- if (!strchr(var, '|')) {
+ if (!strchr(var, ',')) {
/* Single argument version */
return array(chan, "HASH", var, value);
}
@@ -363,7 +357,7 @@ static int hash_read(struct ast_channel *chan, const char *cmd, char *data, char
static struct ast_custom_function hash_function = {
.name = "HASH",
.synopsis = "Implementation of a dialplan associative array",
- .syntax = "HASH(hashname[|hashkey])",
+ .syntax = "HASH(hashname[,hashkey])",
.write = hash_write,
.read = hash_read,
.desc =
@@ -387,15 +381,13 @@ static struct ast_custom_function hashkeys_function = {
static struct ast_custom_function array_function = {
.name = "ARRAY",
.synopsis = "Allows setting multiple variables at once",
- .syntax = "ARRAY(var1[|var2[...][|varN]])",
+ .syntax = "ARRAY(var1[,var2[...][,varN]])",
.write = array,
.desc =
"The comma-separated list passed as a value to which the function is set will\n"
"be interpreted as a set of values to which the comma-separated list of\n"
"variable names in the argument should be set.\n"
- "Hence, Set(ARRAY(var1|var2)=1\\,2) will set var1 to 1 and var2 to 2\n"
- "Note: remember to either backslash your commas in extensions.conf or quote the\n"
- "entire argument, since Set can take multiple arguments itself.\n",
+ "Hence, Set(ARRAY(var1,var2)=1,2) will set var1 to 1 and var2 to 2.\n",
};
static int acf_sprintf(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
@@ -533,7 +525,7 @@ sprintf_fail:
static struct ast_custom_function sprintf_function = {
.name = "SPRINTF",
.synopsis = "Format a variable according to a format string",
- .syntax = "SPRINTF(<format>|<arg1>[|...<argN>])",
+ .syntax = "SPRINTF(<format>,<arg1>[,...<argN>])",
.read = acf_sprintf,
.desc =
"Parses the format string specified and returns a string matching that format.\n"
@@ -623,7 +615,7 @@ static int acf_strftime(struct ast_channel *chan, const char *cmd, char *parse,
static struct ast_custom_function strftime_function = {
.name = "STRFTIME",
.synopsis = "Returns the current date/time in a specified format.",
- .syntax = "STRFTIME([<epoch>][|[timezone][|format]])",
+ .syntax = "STRFTIME([<epoch>][,[timezone][,format]])",
.desc =
"STRFTIME sports all of the same formats as the underlying C function\n"
"strftime(3) - see the man page for details. It also supports the\n"
@@ -660,7 +652,7 @@ static int acf_strptime(struct ast_channel *chan, const char *cmd, char *data,
if (ast_strlen_zero(args.format)) {
ast_log(LOG_ERROR,
- "No format supplied to STRPTIME(<timestring>|<timezone>|<format>)");
+ "No format supplied to STRPTIME(<timestring>,<timezone>,<format>)");
return -1;
}
@@ -677,14 +669,14 @@ static struct ast_custom_function strptime_function = {
.name = "STRPTIME",
.synopsis =
"Returns the epoch of the arbitrary date/time string structured as described in the format.",
- .syntax = "STRPTIME(<datetime>|<timezone>|<format>)",
+ .syntax = "STRPTIME(<datetime>,<timezone>,<format>)",
.desc =
"This is useful for converting a date into an EPOCH time, possibly to pass to\n"
"an application like SayUnixTime or to calculate the difference between two\n"
"date strings.\n"
"\n"
"Example:\n"
- " ${STRPTIME(2006-03-01 07:30:35|America/Chicago|%Y-%m-%d %H:%M:%S)} returns 1141219835\n",
+ " ${STRPTIME(2006-03-01 07:30:35,America/Chicago,%Y-%m-%d %H:%M:%S)} returns 1141219835\n",
.read = acf_strptime,
};