mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
common: Add a flag for left anchored substring match to recsel.
* common/recsel.c (struct recsel_expr_s): Add field lefta. (recsel_parse_expr): Parse it. (recsel_select): Implement selection. -- This flags makes it for example easy to select keys last updated from an ldap server: gpg --list-filter 'select=origin=ks && -^ url =~ ldap' \ -k --with-key-origin
This commit is contained in:
parent
e5555a40e6
commit
c12b7d047e
3 changed files with 38 additions and 6 deletions
|
@ -225,9 +225,27 @@ run_test_2 (void)
|
|||
if (!recsel_select (se, test_2_getval, NULL))
|
||||
fail (0, 0);
|
||||
FREEEXPR();
|
||||
ADDEXPR ("uid =~ @");
|
||||
ADDEXPR ("uid !~ @");
|
||||
if (recsel_select (se, test_2_getval, NULL))
|
||||
fail (0, 0);
|
||||
|
||||
FREEEXPR();
|
||||
ADDEXPR ("uid =~ foo@");
|
||||
if (!recsel_select (se, test_2_getval, NULL))
|
||||
fail (0, 0);
|
||||
FREEEXPR();
|
||||
ADDEXPR ("uid =~ oo@");
|
||||
if (!recsel_select (se, test_2_getval, NULL))
|
||||
fail (0, 0);
|
||||
FREEEXPR();
|
||||
/* Again but with left anchored substring. */
|
||||
ADDEXPR ("-^ uid =~ foo@");
|
||||
if (!recsel_select (se, test_2_getval, NULL))
|
||||
fail (0, 0);
|
||||
FREEEXPR();
|
||||
ADDEXPR ("-^ uid =~ oo@");
|
||||
if (recsel_select (se, test_2_getval, NULL))
|
||||
fail (0, 0);
|
||||
|
||||
FREEEXPR();
|
||||
ADDEXPR ("keyid == 0x12345678");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue