fixed grep
This commit is contained in:
parent
c601693811
commit
f26953c707
@ -89,12 +89,16 @@ static int addpattern(const char *str, const size_t size) {
|
|||||||
else if (w_flag)
|
else if (w_flag)
|
||||||
snprintf(reg_str, rs_size + 4, "%s\\<%s%.*s%s\\>%s", (bol) ? "^" : "", (E_flag) ? "(" : "\\(", (int)size - bol - eol, ptrns[ptrns_size]->str + bol, (E_flag) ? ")" : "\\)", (eol) ? "$" : "");
|
snprintf(reg_str, rs_size + 4, "%s\\<%s%.*s%s\\>%s", (bol) ? "^" : "", (E_flag) ? "(" : "\\(", (int)size - bol - eol, ptrns[ptrns_size]->str + bol, (E_flag) ? ")" : "\\)", (eol) ? "$" : "");
|
||||||
|
|
||||||
|
char flag = 0;
|
||||||
if (regcomp(&ptrns[ptrns_size]->reg, reg_str, reg_flag) < 0)
|
if (regcomp(&ptrns[ptrns_size]->reg, reg_str, reg_flag) < 0)
|
||||||
goto ADDP_ERROR;
|
flag = 1;
|
||||||
|
|
||||||
ptrns[ptrns_size]->reg_set = 1;
|
ptrns[ptrns_size]->reg_set = 1;
|
||||||
if (x_flag || w_flag)
|
if (x_flag || w_flag)
|
||||||
free(reg_str);
|
free(reg_str);
|
||||||
|
|
||||||
|
if (flag)
|
||||||
|
goto ADDP_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptrns_size++;
|
ptrns_size++;
|
||||||
|
Loading…
Reference in New Issue
Block a user