+
+const char *cs_strerror(COMSTACK h)
+{
+ return cs_errmsg(h->cerrno);
+}
+
+COMSTACK cs_create_host(const char *type_and_host, int blocking, void **vp)
+{
+ const char *host = 0;
+ COMSTACK cs;
+ CS_TYPE t;
+
+ if (strncmp (type_and_host, "tcp:", 4) == 0)
+ {
+ t = tcpip_type;
+ host = type_and_host + 4;
+ }
+ else if (strncmp (type_and_host, "ssl:", 4) == 0)
+ {
+#if HAVE_OPENSSL_SSL_H
+ t = ssl_type;
+ host = type_and_host + 4;
+#else
+ return 0;
+#endif
+ }
+ else
+ {
+ t = tcpip_type;
+ host = type_and_host;
+
+ }
+ cs = cs_create (t, blocking, PROTO_Z3950);
+ if (!cs)
+ return 0;
+
+ if (!(*vp = cs_straddr(cs, host)))
+ {
+ cs_close (cs);
+ return 0;
+ }
+ return cs;
+}
+
+int cs_look (COMSTACK cs)
+{
+ return cs->event;
+}