X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=client%2Fclient.c;h=9b050de26b943101386da43f7d54756c2537b9aa;hb=f60c0db8c4379047cdd75e2be50549abc0a1c74a;hp=619f963cf8c188a4ed9c7d8a6ce011c8816fed36;hpb=d554f7894acd70ee293d7c11294244bca870a6de;p=yaz-moved-to-github.git diff --git a/client/client.c b/client/client.c index 619f963..9b050de 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: client.c,v 1.339 2007-05-23 11:54:46 adam Exp $ + * $Id: client.c,v 1.340 2007-05-30 08:12:16 adam Exp $ */ /** \file client.c * \brief yaz-client program @@ -2853,7 +2853,8 @@ int cmd_cancel_find(const char *arg) { return fres; } -int send_scanrequest(const char *query, int pp, int num, const char *term) +int send_scanrequest(const char *set, const char *query, + int pp, int num, const char *term) { Z_APDU *apdu = zget_APDU(out, Z_APDU_scanRequest); Z_ScanRequest *req = apdu->u.scanRequest; @@ -2918,6 +2919,11 @@ int send_scanrequest(const char *query, int pp, int num, const char *term) req->numberOfTermsRequested = # req->preferredPositionInResponse = &pp; req->stepSize = odr_intdup(out, scan_stepSize); + + if (set) + yaz_oi_set_string_oid(&req->otherInfo, out, + yaz_oid_userinfo_scan_set, 1, set); + send_apdu(apdu); return 2; } @@ -3098,7 +3104,7 @@ int cmd_scansize(const char *arg) return 0; } -int cmd_scan(const char *arg) +static int cmd_scan_common(const char *set, const char *arg) { if (protocol == PROTO_HTTP) { @@ -3142,18 +3148,37 @@ int cmd_scan(const char *arg) if (*arg) { strcpy (last_scan_query, arg); - if (send_scanrequest(arg, scan_position, scan_size, 0) < 0) + if (send_scanrequest(set, arg, + scan_position, scan_size, 0) < 0) return 0; } else { - if (send_scanrequest(last_scan_query, 1, scan_size, last_scan_line) < 0) + if (send_scanrequest(set, last_scan_query, + 1, scan_size, last_scan_line) < 0) return 0; } return 2; } } +int cmd_scan(const char *arg) +{ + return cmd_scan_common(0, arg); +} + +int cmd_setscan(const char *arg) +{ + char setstring[100]; + int nor; + if (sscanf(arg, "%99s%n", setstring, &nor) < 1) + { + printf("missing set for setscan\n"); + return 0; + } + return cmd_scan_common(setstring, arg + nor); +} + int cmd_schema(const char *arg) { xfree(record_schema); @@ -4328,6 +4353,7 @@ static struct { {"delete", cmd_delete, "",NULL,0,NULL}, {"base", cmd_base, "",NULL,0,NULL}, {"show", cmd_show, "['+'<#recs>['+']]",NULL,0,NULL}, + {"setscan", cmd_setscan, "",NULL,0,NULL}, {"scan", cmd_scan, "",NULL,0,NULL}, {"scanstep", cmd_scanstep, "",NULL,0,NULL}, {"scanpos", cmd_scanpos, "",NULL,0,NULL},