mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-17 07:18:15 +00:00
Recorded merge of revisions 197209 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r197209 | tilghman | 2009-05-27 14:20:56 -0500 (Wed, 27 May 2009) | 12 lines Recorded merge of revisions 197194 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r197194 | tilghman | 2009-05-27 14:09:42 -0500 (Wed, 27 May 2009) | 5 lines Use a different determinator on whether to print the delimiter, since leading fields may be blank. (closes issue #15208) Reported by: ramonpeek Patch by me, though inspired in part by a patch from ramonpeek ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@197244 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -147,7 +147,7 @@ static int cut_internal(struct ast_channel *chan, char *data, char *buffer, size
|
|||||||
pbx_substitute_variables_helper(chan, tmp, tmp2, MAXRESULT - 1);
|
pbx_substitute_variables_helper(chan, tmp, tmp2, MAXRESULT - 1);
|
||||||
|
|
||||||
if (tmp2) {
|
if (tmp2) {
|
||||||
int curfieldnum = 1;
|
int curfieldnum = 1, firstfield = 1;
|
||||||
while (tmp2 != NULL && args.field != NULL) {
|
while (tmp2 != NULL && args.field != NULL) {
|
||||||
char *nextgroup = strsep(&(args.field), "&");
|
char *nextgroup = strsep(&(args.field), "&");
|
||||||
int num1 = 0, num2 = MAXRESULT;
|
int num1 = 0, num2 = MAXRESULT;
|
||||||
@@ -189,10 +189,12 @@ static int cut_internal(struct ast_channel *chan, char *data, char *buffer, size
|
|||||||
char *tmp3 = strsep(&tmp2, ds);
|
char *tmp3 = strsep(&tmp2, ds);
|
||||||
int curlen = strlen(buffer);
|
int curlen = strlen(buffer);
|
||||||
|
|
||||||
if (curlen)
|
if (firstfield) {
|
||||||
snprintf(buffer + curlen, buflen - curlen, "%c%s", d, tmp3);
|
|
||||||
else
|
|
||||||
snprintf(buffer, buflen, "%s", tmp3);
|
snprintf(buffer, buflen, "%s", tmp3);
|
||||||
|
firstfield = 0;
|
||||||
|
} else {
|
||||||
|
snprintf(buffer + curlen, buflen - curlen, "%c%s", d, tmp3);
|
||||||
|
}
|
||||||
|
|
||||||
curfieldnum++;
|
curfieldnum++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user