201 |
Substitutions (RE back-references) |
Substitutions (RE back-references) |
202 |
************************************/ |
************************************/ |
203 |
|
|
204 |
char * |
static char * |
|
substitute(char *inbuf, char **subbuf) |
|
|
{ |
|
|
char **tmp = subbuf; |
|
|
char *tmpout = 0; |
|
|
char *tmpbuf = 0; |
|
|
char sign[5]; |
|
|
int i = 0; |
|
|
|
|
|
if (inbuf == 0 || subbuf == 0) |
|
|
return 0; |
|
|
|
|
|
tmpbuf = allocbuf(inbuf, 0); |
|
|
tmp++; |
|
|
while (*tmp) |
|
|
{ |
|
|
snprintf(sign, 4, "\\%d", i + 1); |
|
|
tmpout = insert(tmpbuf, sign, *tmp); |
|
|
if (tmpout) { |
|
|
tmpbuf = (char *)xrealloc((char *)tmpbuf, strlen(tmpout) + 1); |
|
|
strcpy(tmpbuf, tmpout); |
|
|
free(tmpout); |
|
|
} |
|
|
tmp++; |
|
|
i++; |
|
|
} |
|
|
return tmpbuf; |
|
|
} |
|
|
|
|
|
char * |
|
205 |
insert(char *inbuf, char *sign, char *fill_in) |
insert(char *inbuf, char *sign, char *fill_in) |
206 |
{ |
{ |
207 |
int len1 = 0; |
int len1 = 0; |
242 |
return outbuf; |
return outbuf; |
243 |
} |
} |
244 |
|
|
245 |
|
char * |
246 |
|
substitute(char *inbuf, char **subbuf) |
247 |
|
{ |
248 |
|
char **tmp = subbuf; |
249 |
|
char *tmpout = 0; |
250 |
|
char *tmpbuf = 0; |
251 |
|
char sign[5]; |
252 |
|
int i = 0; |
253 |
|
|
254 |
|
if (inbuf == 0 || subbuf == 0) |
255 |
|
return 0; |
256 |
|
|
257 |
|
tmpbuf = allocbuf(inbuf, 0); |
258 |
|
tmp++; |
259 |
|
while (*tmp) |
260 |
|
{ |
261 |
|
snprintf(sign, 4, "\\%d", i + 1); |
262 |
|
tmpout = insert(tmpbuf, sign, *tmp); |
263 |
|
if (tmpout) { |
264 |
|
tmpbuf = (char *)xrealloc((char *)tmpbuf, strlen(tmpout) + 1); |
265 |
|
strcpy(tmpbuf, tmpout); |
266 |
|
free(tmpout); |
267 |
|
} |
268 |
|
tmp++; |
269 |
|
i++; |
270 |
|
} |
271 |
|
return tmpbuf; |
272 |
|
} |
273 |
|
|
274 |
/*************************** |
/*************************** |
275 |
change to lower characters |
Change to lower characters |
276 |
****************************/ |
****************************/ |
277 |
|
|
278 |
void |
void |