[asterisk-commits] tilghman: trunk r49786 - in /trunk/funcs:
func_cut.c func_shell.c func_strings.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun Jan 7 07:44:49 MST 2007
Author: tilghman
Date: Sun Jan 7 08:44:49 2007
New Revision: 49786
URL: http://svn.digium.com/view/asterisk?view=rev&rev=49786
Log:
Modifications to allow the output of SHELL() to be split per line (Issue 8676)
Modified:
trunk/funcs/func_cut.c
trunk/funcs/func_shell.c
trunk/funcs/func_strings.c
Modified: trunk/funcs/func_cut.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_cut.c?view=diff&rev=49786&r1=49785&r2=49786
==============================================================================
--- trunk/funcs/func_cut.c (original)
+++ trunk/funcs/func_cut.c Sun Jan 7 08:44:49 2007
@@ -131,7 +131,7 @@
AST_STANDARD_APP_ARGS(args, parse);
/* Check and parse arguments */
- if(args.argc < 3){
+ if (args.argc < 3) {
return ERROR_NOARG;
} else {
char d, ds[2];
@@ -145,7 +145,19 @@
return ERROR_NOMEM;
}
- d = args.delimiter[0] ? args.delimiter[0] : '-';
+ if (args.delimiter[0] == '\\') {
+ if (args.delimiter[1] == 'n')
+ d = '\n';
+ else if (args.delimiter[1] == 't')
+ d = '\t';
+ else if (args.delimiter[1])
+ d = args.delimiter[1];
+ else
+ d = '-';
+ } else if (args.delimiter[0])
+ d = args.delimiter[0];
+ else
+ d = '-';
/* String form of the delimiter, for use with strsep(3) */
snprintf(ds, sizeof(ds), "%c", d);
Modified: trunk/funcs/func_shell.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_shell.c?view=diff&rev=49786&r1=49785&r2=49786
==============================================================================
--- trunk/funcs/func_shell.c (original)
+++ trunk/funcs/func_shell.c Sun Jan 7 08:44:49 2007
@@ -39,7 +39,7 @@
#include "asterisk/utils.h"
#include "asterisk/app.h"
-static int shell_helper(struct ast_channel *chan, char *cmd, char *data,
+static int shell_helper(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len)
{
if (ast_strlen_zero(data)) {
Modified: trunk/funcs/func_strings.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_strings.c?view=diff&rev=49786&r1=49785&r2=49786
==============================================================================
--- trunk/funcs/func_strings.c (original)
+++ trunk/funcs/func_strings.c Sun Jan 7 08:44:49 2007
@@ -56,6 +56,16 @@
AST_STANDARD_APP_ARGS(args, parse);
if (args.delim) {
pbx_retrieve_variable(chan, args.varname, &varval, buf, len, NULL);
+ if (args.delim[0] == '\\') {
+ if (args.delim[1] == 'n')
+ ast_copy_string(args.delim, "\n", 2);
+ else if (args.delim[1] == 't')
+ ast_copy_string(args.delim, "\t", 2);
+ else if (args.delim[1])
+ ast_copy_string(args.delim, &args.delim[1], 2);
+ else
+ ast_copy_string(args.delim, "-", 2);
+ }
while (strsep(&varval, args.delim))
fieldcount++;
} else {
More information about the asterisk-commits
mailing list