Merged revisions 117335 via svnmerge from

https://origsvn.digium.com/svn/asterisk/trunk

........
r117335 | murf | 2008-05-20 19:00:28 -0600 (Tue, 20 May 2008) | 10 lines

These changes were made via the comments atis_work made at 4:30am (Mountain Time zone- US)
in #asterisk-dev on 20 May 2008. He noted that a backslash was being inserted before commas
in app call arguments in the extensions.conf.aeldump file that you get from aelparse with the
-w arg. This was being generated from code left over from 1.4, where commas were substituted
with '|', and any remaining commas needed to be escaped.

Many thanks to atis for his comment; please let us know if these changes break anything!



........


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@117365 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Steve Murphy
2008-05-21 01:20:45 +00:00
parent de3112d3ee
commit 2fdbd728b8

View File

@@ -247,8 +247,6 @@ int ast_add_extension2(struct ast_context *con,
if( dump_extensions && dumpfile ) { if( dump_extensions && dumpfile ) {
struct namelist *n; struct namelist *n;
char *data2,*data3=0;
int commacount = 0;
if( FIRST_TIME ) { if( FIRST_TIME ) {
FIRST_TIME = 0; FIRST_TIME = 0;
@@ -282,44 +280,16 @@ int ast_add_extension2(struct ast_context *con,
if( data ) { if( data ) {
filter_newlines((char*)data); filter_newlines((char*)data);
filter_leading_space_from_exprs((char*)data); filter_leading_space_from_exprs((char*)data);
/* in previous versions, commas were converted to '|' to separate
/* compiling turns commas into vertical bars in the app data, and also removes the backslash from before escaped commas; args in app calls, but now, commas are used. There used to be
we have to restore the escaping backslash in front of any commas; the vertical bars are OK to leave as-is */ code here to insert backslashes (escapes) before any commas
for (data2 = data; *data2; data2++) { that may have been embedded in the app args. This code is no more. */
if (*data2 == ',')
commacount++; /* we need to know how much bigger the string will grow-- one backslash for each comma */
}
if (commacount)
{
char *d3,*d4;
data2 = (char*)malloc(strlen(data)+commacount+1);
data3 = data;
d3 = data;
d4 = data2;
while (*d3) {
if (*d3 == ',') {
*d4++ = '\\'; /* put a backslash in front of each comma */
*d4++ = *d3++;
} else
*d4++ = *d3++; /* or just copy the char */
}
*d4++ = 0; /* cap off the new string */
data = data2;
} else
data2 = 0;
if( strcmp(label,"(null)") != 0 ) if( strcmp(label,"(null)") != 0 )
fprintf(dumpfile,"exten => %s,%d(%s),%s(%s)\n", extension, priority, label, application, (char*)data); fprintf(dumpfile,"exten => %s,%d(%s),%s(%s)\n", extension, priority, label, application, (char*)data);
else else
fprintf(dumpfile,"exten => %s,%d,%s(%s)\n", extension, priority, application, (char*)data); fprintf(dumpfile,"exten => %s,%d,%s(%s)\n", extension, priority, application, (char*)data);
if (data2) {
free(data2);
data2 = 0;
data = data3; /* restore data to pre-messedup state */
}
} else { } else {
if( strcmp(label,"(null)") != 0 ) if( strcmp(label,"(null)") != 0 )