summaryrefslogtreecommitdiffstats
path: root/dirmngr/t-ldap-parse-uri.c
diff options
context:
space:
mode:
Diffstat (limited to 'dirmngr/t-ldap-parse-uri.c')
-rw-r--r--dirmngr/t-ldap-parse-uri.c54
1 files changed, 50 insertions, 4 deletions
diff --git a/dirmngr/t-ldap-parse-uri.c b/dirmngr/t-ldap-parse-uri.c
index 932ca7dcb..984e1412f 100644
--- a/dirmngr/t-ldap-parse-uri.c
+++ b/dirmngr/t-ldap-parse-uri.c
@@ -20,9 +20,13 @@
#include <config.h>
#include "ldap-parse-uri.h"
-
#include "t-support.h"
+#define PGM "t-ldap-parse-uri"
+
+static int verbose;
+
+
struct test_ldap_uri_p
{
const char *uri;
@@ -32,7 +36,11 @@ struct test_ldap_uri_p
void
check_ldap_uri_p (int test_count, struct test_ldap_uri_p *test)
{
- int result = ldap_uri_p (test->uri);
+ int result;
+
+ if (verbose)
+ fprintf (stderr, PGM ": checking '%s'\n", test->uri);
+ result = ldap_uri_p (test->uri);
if (result != test->result)
{
printf ("'%s' is %san LDAP schema, but ldap_uri_p says opposite.\n",
@@ -106,6 +114,8 @@ check_ldap_parse_uri (int test_count, struct test_ldap_parse_uri *test)
gpg_error_t err;
parsed_uri_t puri;
+ if (verbose)
+ fprintf (stderr, PGM ": parsing '%s'\n", test->uri);
err = ldap_parse_uri (&puri, test->uri);
if (err)
{
@@ -242,12 +252,48 @@ test_ldap_escape_filter (void)
test_count ++)
check_ldap_escape_filter (test_count, &tests[test_count - 1]);
}
+
+
int
main (int argc, char **argv)
{
- (void)argc;
- (void)argv;
+ int last_argc = -1;
+
+ if (argc)
+ { argc--; argv++; }
+ while (argc && last_argc != argc )
+ {
+ last_argc = argc;
+ if (!strcmp (*argv, "--"))
+ {
+ argc--; argv++;
+ break;
+ }
+ else if (!strcmp (*argv, "--help"))
+ {
+ fputs ("usage: " PGM "\n"
+ "Options:\n"
+ " --verbose print timings etc.\n",
+ stdout);
+ exit (0);
+ }
+ else if (!strcmp (*argv, "--verbose"))
+ {
+ verbose++;
+ argc--; argv++;
+ }
+ else if (!strncmp (*argv, "--", 2))
+ {
+ fprintf (stderr, PGM ": unknown option '%s'\n", *argv);
+ exit (1);
+ }
+ }
+ if (argc)
+ {
+ fprintf (stderr, PGM ": no argumenst are expected\n");
+ exit (1);
+ }
test_ldap_uri_p ();
test_ldap_parse_uri ();