summaryrefslogtreecommitdiffstats
path: root/src/interfaces/libpq/test/libpq_testclient.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/libpq/test/libpq_testclient.c')
-rw-r--r--src/interfaces/libpq/test/libpq_testclient.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/interfaces/libpq/test/libpq_testclient.c b/src/interfaces/libpq/test/libpq_testclient.c
new file mode 100644
index 0000000..d945bac
--- /dev/null
+++ b/src/interfaces/libpq/test/libpq_testclient.c
@@ -0,0 +1,37 @@
+/*
+ * libpq_testclient.c
+ * A test program for the libpq public API
+ *
+ * Copyright (c) 2022, PostgreSQL Global Development Group
+ *
+ * IDENTIFICATION
+ * src/interfaces/libpq/test/libpq_testclient.c
+ */
+
+#include "postgres_fe.h"
+
+#include "libpq-fe.h"
+
+static void
+print_ssl_library()
+{
+ const char *lib = PQsslAttribute(NULL, "library");
+
+ if (!lib)
+ fprintf(stderr, "SSL is not enabled\n");
+ else
+ printf("%s\n", lib);
+}
+
+int
+main(int argc, char *argv[])
+{
+ if ((argc > 1) && !strcmp(argv[1], "--ssl"))
+ {
+ print_ssl_library();
+ return 0;
+ }
+
+ printf("currently only --ssl is supported\n");
+ return 1;
+}