{
regmatch_t matches[10];
int i,m;
-int doprep;
+int doprep,willprep;
static char modbuf1[sizeof(buf)],modbuf2[sizeof(modbuf1)];
char *src=what,*dstbase=modbuf1,*dst=dstbase;
const char *start FAKEUSE,*end FAKEUSE,*patt;
if (verbose) printf("modify: %s\n",what);
modify_load();
- for (m=0,item=modifies;;m++,item=item->next) {
+ for (m=0,item=modifies,willprep=1;;m++,item=item->next) {
enum { PATT_START,PATT_MID,PATT_END,PATT_TERM } pattpos;
- for (doprep=1;doprep>=0;doprep--) {
+ for (doprep=willprep;doprep>=0;doprep--) {
if (doprep) {
*dst++='-';
for (patt=src;;patt++) {
}
}
else {
+ if (!item)
+ return src;
i=regexec(&modistructs[m].regex,src,LENGTH(matches),matches,0);
- if (i==REG_NOMATCH) continue;
+ if (i==REG_NOMATCH) {
+ willprep=0;
+ break;
+ }
if (i) {
fprintf(ERRH1"regexec() failed for \"%s\""ERRNO1,ERRH2,item->text,ERRNO2);
exit(EXIT_FAILURE);
}
+ willprep=1;
if (verbose) printf("matched: %s -> %s\n",item->text,modistructs[m].dst);
pattpos=PATT_START; patt=NULL;
while (pattpos!=PATT_TERM) {
||(src==modbuf2 && dstbase==modbuf1));
swap=src; src=dstbase; dst=dstbase=swap;
}
- if (!item)
- return src;
} /* for (doprep) */
}
/* NOTREACHED */