| 1171 | } |
| 1172 | |
| 1173 | int grep_next_match(struct grep_opt *opt, |
| 1174 | const char *bol, const char *eol, |
| 1175 | enum grep_context ctx, regmatch_t *pmatch, |
| 1176 | enum grep_header_field field, int eflags) |
| 1177 | { |
| 1178 | struct grep_pat *p; |
| 1179 | int hit = 0; |
| 1180 | |
| 1181 | pmatch->rm_so = pmatch->rm_eo = -1; |
| 1182 | if (bol < eol) { |
| 1183 | for (p = ((ctx == GREP_CONTEXT_HEAD) |
| 1184 | ? opt->header_list : opt->pattern_list); |
| 1185 | p; p = p->next) { |
| 1186 | switch (p->token) { |
| 1187 | case GREP_PATTERN_HEAD: |
| 1188 | if ((field != GREP_HEADER_FIELD_MAX) && |
| 1189 | (p->field != field)) |
| 1190 | continue; |
| 1191 | /* fall thru */ |
| 1192 | case GREP_PATTERN: /* atom */ |
| 1193 | case GREP_PATTERN_BODY: |
| 1194 | hit |= match_next_pattern(p, bol, eol, ctx, |
| 1195 | pmatch, eflags); |
| 1196 | break; |
| 1197 | default: |
| 1198 | break; |
| 1199 | } |
| 1200 | } |
| 1201 | } |
| 1202 | return hit; |
| 1203 | } |
| 1204 | |
| 1205 | static void show_line_header(struct grep_opt *opt, const char *name, |
| 1206 | unsigned lno, ssize_t cno, char sign) |
no test coverage detected