aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-06 21:33:58 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-06 21:33:58 +0000
commitea5b7f9183cc42e84d201869b757220b9a1d815e (patch)
treed98a065455c4fd55f8ba9e907268cd3e5b0d7053 /main
parentc23f940cb7a287caa31f2928fa70a1323f5fbd5a (diff)
Merged revisions 210908 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r210908 | tilghman | 2009-08-06 16:29:26 -0500 (Thu, 06 Aug 2009) | 9 lines Allow Gosub to recognize quote delimiters without consuming them. (closes issue #15557) Reported by: rain Patches: 20090723__issue15557.diff.txt uploaded by tilghman (license 14) Tested by: rain Review: https://reviewboard.asterisk.org/r/316/ ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@210910 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/app.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/main/app.c b/main/app.c
index 5c0449a3d..80bdd4a03 100644
--- a/main/app.c
+++ b/main/app.c
@@ -1076,7 +1076,10 @@ int ast_app_group_list_unlock(void)
return AST_RWLIST_UNLOCK(&groups);
}
-unsigned int ast_app_separate_args(char *buf, char delim, char **array, int arraylen)
+#undef ast_app_separate_args
+unsigned int ast_app_separate_args(char *buf, char delim, char **array, int arraylen);
+
+unsigned int __ast_app_separate_args(char *buf, char delim, int remove_chars, char **array, int arraylen)
{
int argc;
char *scan, *wasdelim = NULL;
@@ -1099,12 +1102,18 @@ unsigned int ast_app_separate_args(char *buf, char delim, char **array, int arra
paren--;
} else if (*scan == '"' && delim != '"') {
quote = quote ? 0 : 1;
- /* Remove quote character from argument */
- memmove(scan, scan + 1, strlen(scan));
- scan--;
+ if (remove_chars) {
+ /* Remove quote character from argument */
+ memmove(scan, scan + 1, strlen(scan));
+ scan--;
+ }
} else if (*scan == '\\') {
- /* Literal character, don't parse */
- memmove(scan, scan + 1, strlen(scan));
+ if (remove_chars) {
+ /* Literal character, don't parse */
+ memmove(scan, scan + 1, strlen(scan));
+ } else {
+ scan++;
+ }
} else if ((*scan == delim) && !paren && !quote) {
wasdelim = scan;
*scan++ = '\0';
@@ -1122,6 +1131,12 @@ unsigned int ast_app_separate_args(char *buf, char delim, char **array, int arra
return argc;
}
+/* ABI compatible function */
+unsigned int ast_app_separate_args(char *buf, char delim, char **array, int arraylen)
+{
+ return __ast_app_separate_args(buf, delim, 1, array, arraylen);
+}
+
static enum AST_LOCK_RESULT ast_lock_path_lockfile(const char *path)
{
char *s;