#ifndef lint
-FILE_RCSID("@(#)$File: softmagic.c,v 1.89 2007/01/16 14:58:48 ljt Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.91 2007/01/18 05:29:33 ljt Exp $")
#endif /* lint */
private int match(struct magic_set *, struct magic *, uint32_t,
}
else {
regmatch_t pmatch[1];
+#ifndef REG_STARTEND
+#define REG_STARTEND 0
+ char c = ms->search.s[ms->search.s_len - 1];
+ ms->search.s[ms->search.s_len - 1] = '\0';
+#else
pmatch[0].rm_so = 0;
pmatch[0].rm_eo = ms->search.s_len;
+#endif
rc = regexec(&rx, (const char *)ms->search.s,
1, pmatch, REG_STARTEND);
+#if REG_STARTEND == 0
+ ms->search.s[ms->search.s_len - 1] = c;
+#endif
switch (rc) {
case 0:
ms->search.s += (int)pmatch[0].rm_so;