blob: c2299ea692fc202f7dbf605b77a165cf3e0b78fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
char *
sv_append_till(sv,from,fromend,delim,keeplist)
register SV *sv;
register char *from;
register char *fromend;
register I32 delim;
char *keeplist;
{
register char *to;
register STRLEN len;
if (SvREADONLY(sv))
fatal(no_modify);
if (!from)
return Nullch;
len = fromend - from;
if (!SvUPGRADE(sv, SVt_PV))
return 0;
SvGROW(sv, SvCUR(sv) + len + 1);
SvPOK_only(sv); /* validate pointer */
to = SvPV(sv)+SvCUR(sv);
for (; from < fromend; from++,to++) {
if (*from == '\\' && from+1 < fromend && delim != '\\') {
if (!keeplist)
*to++ = *from++;
else if (from[1] && index(keeplist,from[1]))
*to++ = *from++;
else
from++;
}
else if (*from == delim)
break;
*to = *from;
}
*to = '\0';
SvCUR_set(sv, to - SvPV(sv));
return from;
}
|