X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=client%2Fclient.c;h=09c9a85ce36479404f27caa27e2e4aa137eeaca4;hp=87a87e6f164d95a01e7f366c976b6a5cd031e1d8;hb=4e641034b013c43b20922f66258f5daf8ac3ce59;hpb=1abd0885ceca8da4cf9c73d606b9681458f38d3a diff --git a/client/client.c b/client/client.c index 87a87e6..09c9a85 100644 --- a/client/client.c +++ b/client/client.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2009 Index Data + * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ /** \file client.c @@ -141,7 +141,7 @@ static int scan_stepSize = 0; static int scan_position = 1; static int scan_size = 20; static char cur_host[200]; -static int last_hit_count = 0; +static Odr_int last_hit_count = 0; typedef enum { QueryType_Prefix, @@ -1200,6 +1200,25 @@ static int send_srw(Z_SRW_PDU *sr) gdu = z_get_HTTP_Request_host_path(out, host_port, path); + if (auth) + { + if (auth->which == Z_IdAuthentication_open) + { + char **darray; + int num; + nmem_strsplit(out->mem, "/", auth->u.open, &darray, &num); + if (num >= 1) + sr->username = darray[0]; + if (num >= 2) + sr->password = darray[1]; + } + else if (auth->which == Z_IdAuthentication_idPass) + { + sr->username = auth->u.idPass->userId; + sr->password = auth->u.idPass->password; + } + } + if (!yaz_matchstr(sru_method, "get")) { yaz_sru_get_encode(gdu->u.HTTP_Request, sr, out, charset); @@ -1945,7 +1964,7 @@ static Z_External *create_external_itemRequest(void) return r; } -static Z_External *create_external_ILL_APDU(int which) +static Z_External *create_external_ILL_APDU(void) { struct ill_get_ctl ctl; ILL_APDU *ill_apdu; @@ -2047,7 +2066,7 @@ static Z_External *create_ItemOrderExternal(const char *type, int itemno, { printf("using ILL-request\n"); r->u.itemOrder->u.esRequest->notToKeep->itemRequest = - create_external_ILL_APDU(ILL_APDU_ILL_Request); + create_external_ILL_APDU(); } else if (!strcmp(type, "xml") || !strcmp(type, "3")) { @@ -2775,7 +2794,7 @@ static void parse_show_args(const char *arg_c, char *setstring, if ((p = strchr(arg, '+'))) { - *number = atoi(p + 1); + *number = odr_atoi(p + 1); *p = '\0'; } if (*arg) @@ -2786,7 +2805,7 @@ static void parse_show_args(const char *arg_c, char *setstring, *start = 1; } else - *start = atoi(arg); + *start = odr_atoi(arg); } if (p && (p=strchr(p+1, '+'))) strcpy(setstring, p+1); @@ -4965,7 +4984,10 @@ static void client(void) { line_in=readline(C_PROMPT); if (!line_in) + { + putchar('\n'); break; + } #if HAVE_READLINE_HISTORY_H if (*line_in) add_history(line_in);