return set_base(arg);
}
-int session_connect(const char *arg)
+static int session_connect_base(const char *arg, const char **basep)
{
void *add;
char type_and_host[101];
- const char *basep = 0;
if (conn)
{
cs_close(conn);
session_mem = NULL;
session_initResponse = 0;
}
- cs_get_host_args(arg, &basep);
+ cs_get_host_args(arg, basep);
strncpy(type_and_host, arg, sizeof(type_and_host)-1);
type_and_host[sizeof(type_and_host)-1] = '\0';
}
printf("OK.\n");
cs_print_session_info(conn);
- if (basep && *basep)
- set_base(basep);
- else if (protocol == PROTO_Z3950)
- set_base("Default");
-
if (protocol == PROTO_Z3950)
{
send_initRequest(type_and_host);
return 0;
}
+static int session_connect(const char *arg)
+{
+ int r;
+ const char *basep = 0;
+
+ r = session_connect_base(arg, &basep);
+ if (basep && *basep)
+ set_base(basep);
+ else if (protocol == PROTO_Z3950)
+ set_base("Default");
+ return r;
+}
+
int cmd_open(const char *arg)
{
int r;
&& !yaz_matchstr(sru_method, "get")
&& (location = z_HTTP_header_lookup(hres->headers, "Location")))
{
- session_connect(location);
+ const char *base_tmp;
+ session_connect_base(location, &base_tmp);
no_redirects++;
if (conn)
{