Cleanup formatting

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3211 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.0
James Golovich 21 years ago
parent 001623fa0a
commit bc80b3130d

@ -100,24 +100,22 @@ static char reload_extensions_help[] =
/* /*
* Static code * Static code
*/ */
static char* process_quotes_and_slashes( char* start, char find, char replace_with ) static char *process_quotes_and_slashes(char* start, char find, char replace_with)
{ {
char* dataPut = start; char *dataPut = start;
int inEscape = 0; int inEscape = 0;
int inQuotes = 0; int inQuotes = 0;
for( ; *start; start++ ) {
if( inEscape ) { for (; *start; start++) {
if (inEscape) {
*dataPut++ = *start; /* Always goes verbatim */ *dataPut++ = *start; /* Always goes verbatim */
inEscape = 0; inEscape = 0;
} } else {
else { if (*start == '\\') {
if( *start == '\\' ) {
inEscape = 1; /* Do not copy \ into the data */ inEscape = 1; /* Do not copy \ into the data */
} } else if (*start == '\"') {
else if( *start == '\"' ) {
inQuotes = 1-inQuotes; /* Do not copy " into the data */ inQuotes = 1-inQuotes; /* Do not copy " into the data */
} } else {
else {
/* Replace , with |, unless in quotes */ /* Replace , with |, unless in quotes */
*dataPut++ = inQuotes ? *start : ((*start==find) ? replace_with : *start); *dataPut++ = inQuotes ? *start : ((*start==find) ? replace_with : *start);
} }
@ -1170,11 +1168,11 @@ static int handle_context_add_extension(int fd, int argc, char *argv[])
} }
} }
} }
app = strsep(&whole_exten,","); app = strsep(&whole_exten, ",");
if (app && (start = strchr(app, '(')) && (end = strrchr(app, ')'))) { if (app && (start = strchr(app, '(')) && (end = strrchr(app, ')'))) {
*start = *end = '\0'; *start = *end = '\0';
app_data = start + 1; app_data = start + 1;
process_quotes_and_slashes(app_data,',','|'); process_quotes_and_slashes(app_data, ',', '|');
} else } else
app_data = whole_exten; app_data = whole_exten;

Loading…
Cancel
Save