Chameleon

Chameleon Commit Details

Date:2010-08-23 08:09:59 (9 years 5 months ago)
Author:Daniel Miranda
Commit:425
Parents: 424
Message:Fixed omission of fixed strbreak.
Changes:
M/branches/danielkza/i386/libsa/string.c

File differences

branches/danielkza/i386/libsa/string.c
269269
270270
271271
272
273272
274
273
275274
276
275
277276
278277
279278
280279
280
281
281282
282283
283284
284285
285286
286
287
288
289
287290
288
289
290
291
291
292292
293
294
295
296
293
297294
298295
299296
300
301
302
303
304
305
306
307
297
298
308299
309300
310
311
301
312302
303
304
305
313306
314307
315308
return 0;
}
char* strbreak(const char *str, char **next, long *len)
{
{
char *start = (char*)str, *end;
char *tmpNext;
bool quoted = false;
if ( !start || !len )
return 0;
*len = 0;
while ( isspace(*start) )
start++;
if (*start == '"')
{
end = strchr(++start, '"');
start++;
end = strchr(start, '"');
if(end)
{
*len = end - start;
tmpNext = end+1;
}
quoted = true;
else
{
*len = strlen(start);
tmpNext = start + (*len) + 1;
}
end = strchr(start, '\0');
}
else
{
for(end = start; *end; end++)
{
if(isspace(*end))
break;
}
*len = end - start;
tmpNext = end;
for ( end = start; *end && !isspace(*end); end++ )
{}
}
if(tmpNext)
*next = tmpNext;
*len = end - start;
if(next)
*next = quoted ? end+1 : end;
return start;
}

Archive Download the corresponding diff file

Revision: 425