Line
Link Here
|
0 |
-- qdepends.c |
0 |
++ qdepends.c |
Lines 483-493
Link Here
|
483 |
int ret; |
483 |
int ret; |
484 |
regex_t preg; |
484 |
regex_t preg; |
485 |
regmatch_t match; |
485 |
regmatch_t match; |
486 |
depend_atom *aq; |
|
|
487 |
depend_atom *as; |
486 |
depend_atom *as; |
488 |
depend_atom *ac; |
487 |
depend_atom *ac; |
489 |
char firstmatch = 0; |
488 |
char firstmatch = 0; |
490 |
char *sslot; |
|
|
491 |
|
489 |
|
492 |
if (!q_vdb_pkg_eat(pkg_ctx, state->depend_file, &depend, &depend_len)) |
490 |
if (!q_vdb_pkg_eat(pkg_ctx, state->depend_file, &depend, &depend_len)) |
493 |
return 0; |
491 |
return 0; |
Lines 526-559
Link Here
|
526 |
return 1; |
524 |
return 1; |
527 |
} |
525 |
} |
528 |
|
526 |
|
529 |
aq = atom_explode(state->query); |
527 |
/* fallback for old behaviour of just performing an extended |
530 |
if (!aq) { |
528 |
* regular expression match */ |
531 |
/* "fall" back to old behaviour of just performing an extended |
529 |
if (wregcomp(&preg, state->query, REG_EXTENDED) != 0) { |
532 |
* regular expression match */ |
530 |
dep_burn_tree(dep_tree); |
533 |
if (wregcomp(&preg, state->query, REG_EXTENDED) != 0) { |
531 |
return 1; |
534 |
dep_burn_tree(dep_tree); |
|
|
535 |
return 1; |
536 |
} |
537 |
} |
532 |
} |
538 |
|
533 |
|
539 |
match.rm_eo = 0; |
534 |
match.rm_eo = 0; |
540 |
firstmatch = 1; |
535 |
firstmatch = 1; |
541 |
do { /* find all matches */ |
536 |
do { /* find all matches */ |
542 |
if (!aq) { |
537 |
ret = regexec(&preg, ptr + match.rm_eo, 1, &match, 0); |
543 |
ret = regexec(&preg, ptr + match.rm_eo, 1, &match, 0); |
|
|
544 |
} else { |
545 |
char *loc; |
546 |
ret = -1; |
547 |
snprintf(qbuf, sizeof(qbuf), "%s%s%s", |
548 |
aq->CATEGORY ? aq->CATEGORY : "", |
549 |
aq->CATEGORY ? "/" : "", |
550 |
aq->PN); |
551 |
if ((loc = strstr(ptr + match.rm_eo, qbuf)) != NULL) { |
552 |
ret = 0; |
553 |
match.rm_so = loc - ptr; |
554 |
match.rm_eo = match.rm_so + strlen(qbuf); |
555 |
} |
556 |
} |
557 |
if (ret != 0) |
538 |
if (ret != 0) |
558 |
break; |
539 |
break; |
559 |
|
540 |
|
Lines 571-588
Link Here
|
571 |
ptr + match.rm_so); |
552 |
ptr + match.rm_so); |
572 |
ac = atom_explode(qbuf); |
553 |
ac = atom_explode(qbuf); |
573 |
|
554 |
|
574 |
/* drop SLOT when not present in aq so we can match atoms |
|
|
575 |
* regardless */ |
576 |
sslot = ac->SLOT; |
577 |
if (aq->SLOT == NULL && ac->SLOT != NULL) |
578 |
ac->SLOT = NULL; |
579 |
ret = atom_compare(ac, aq); |
580 |
ac->SLOT = sslot; |
581 |
if (ret != EQUAL) { |
582 |
atom_implode(ac); |
583 |
break; |
584 |
} |
585 |
|
586 |
if (firstmatch == 1) { |
555 |
if (firstmatch == 1) { |
587 |
firstmatch = 0; |
556 |
firstmatch = 0; |
588 |
printf("%s%s/%s%s%s%c", BOLD, catname, BLUE, |
557 |
printf("%s%s/%s%s%s%c", BOLD, catname, BLUE, |
Lines 615-625
Link Here
|
615 |
if (verbose && firstmatch == 0) |
584 |
if (verbose && firstmatch == 0) |
616 |
printf("\n"); |
585 |
printf("\n"); |
617 |
|
586 |
|
618 |
if (!aq) { |
587 |
regfree(&preg); |
619 |
regfree(&preg); |
|
|
620 |
} else { |
621 |
atom_implode(aq); |
622 |
} |
623 |
atom_implode(as); |
588 |
atom_implode(as); |
624 |
dep_burn_tree(dep_tree); |
589 |
dep_burn_tree(dep_tree); |
625 |
|
590 |
|