diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-07 14:44:49 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-07 14:44:49 +0000 |
commit | d78e74ce7e376b55771b8933afd24f7cedfd2bd3 (patch) | |
tree | 50d16b12c128c8967f19903561eb4cce3feee13c /funcs/func_cut.c | |
parent | 11ebcfbc4a1cdb8f463df0c3e73311f0119aedf2 (diff) |
Modifications to allow the output of SHELL() to be split per line (Issue 8676)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@49786 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs/func_cut.c')
-rw-r--r-- | funcs/func_cut.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/funcs/func_cut.c b/funcs/func_cut.c index 2f488a31d..9cab185b2 100644 --- a/funcs/func_cut.c +++ b/funcs/func_cut.c @@ -131,7 +131,7 @@ static int cut_internal(struct ast_channel *chan, char *data, char *buffer, size 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 @@ static int cut_internal(struct ast_channel *chan, char *data, char *buffer, size 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); |