aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/test/libpq_testclient.c
diff options
context:
space:
mode:
authorDaniel Gustafsson <dgustafsson@postgresql.org>2022-05-04 14:15:25 +0200
committerDaniel Gustafsson <dgustafsson@postgresql.org>2022-05-04 14:15:25 +0200
commit0432490d290f679cad773ce4735e8769e2c4db75 (patch)
tree67fd6659b4650c7a3b707e99b745c8d0e45f83d0 /src/interfaces/libpq/test/libpq_testclient.c
parent2e77180d4572ddb892f9c2e253ee95dc0fa26b5f (diff)
downloadpostgresql-0432490d290f679cad773ce4735e8769e2c4db75.tar.gz
postgresql-0432490d290f679cad773ce4735e8769e2c4db75.zip
Rename libpq test programs with libpq_ prefix
The testclient and uri-regress programs in the libpq test suite had quite generic names which didn't convey much meaning. Since they are installed as part of the MSVC test runs, ensure that their purpose is a little bit clearer by renaming with a libpq_ prefix. While at it rename uri-regress to uri_regress to avoid mixing dash and under- score in the same filename. Reported-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/20220501080706.GA1542365@rfd.leadboat.com
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 00000000000..d945bacf1b2
--- /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;
+}