X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=zoom%2Fzoomsh.c;h=80970661384f7a25f519e2c8b53875f966dc9f17;hp=9f9d0e4e149c6a7750a2be8bddcf59e47a55358a;hb=d9d97a04b6f9597225b8440dad61790dfa39a751;hpb=bc66c2a11aa31c16f46c49100e99dc9b7e940faf diff --git a/zoom/zoomsh.c b/zoom/zoomsh.c index 9f9d0e4..8097066 100644 --- a/zoom/zoomsh.c +++ b/zoom/zoomsh.c @@ -1,5 +1,5 @@ /* - * $Id: zoomsh.c,v 1.2 2001-10-24 12:24:43 adam Exp $ + * $Id: zoomsh.c,v 1.14 2003-02-17 14:35:42 adam Exp $ * * ZOOM-C Shell */ @@ -64,8 +64,8 @@ static int is_command (const char *cmd_str, const char *this_str, int this_len) return 1; } -static void cmd_set (Z3950_connection *c, Z3950_resultset *r, - Z3950_options options, +static void cmd_set (ZOOM_connection *c, ZOOM_resultset *r, + ZOOM_options options, const char **args) { char key[40], val[80]; @@ -76,16 +76,29 @@ static void cmd_set (Z3950_connection *c, Z3950_resultset *r, return ; } if (!next_token_copy (args, val, sizeof(val))) + ZOOM_options_set(options, key, 0); + else + ZOOM_options_set(options, key, val); +} + +static void cmd_get (ZOOM_connection *c, ZOOM_resultset *r, + ZOOM_options options, + const char **args) +{ + char key[40]; + if (!next_token_copy (args, key, sizeof(key))) { - const char *val = Z3950_options_get(options, key); - printf ("%s = %s\n", key, val ? val : ""); + printf ("missing argument for get\n"); } else - Z3950_options_set(options, key, val); + { + const char *val = ZOOM_options_get(options, key); + printf ("%s = %s\n", key, val ? val : ""); + } } -static void cmd_close (Z3950_connection *c, Z3950_resultset *r, - Z3950_options options, +static void cmd_close (ZOOM_connection *c, ZOOM_resultset *r, + ZOOM_options options, const char **args) { char host[60]; @@ -96,136 +109,186 @@ static void cmd_close (Z3950_connection *c, Z3950_resultset *r, const char *h; if (!c[i]) continue; - if ((h = Z3950_connection_host(c[i])) && !strcmp (h, host)) + if ((h = ZOOM_connection_option_get(c[i], "host")) + && !strcmp (h, host)) { - Z3950_connection_destroy (c[i]); + ZOOM_connection_destroy (c[i]); c[i] = 0; } else if (*host == '\0') { - Z3950_connection_destroy (c[i]); + ZOOM_connection_destroy (c[i]); c[i] = 0; } } } -static void display_records (Z3950_connection c, - Z3950_resultset r, +static void display_records (ZOOM_connection c, + ZOOM_resultset r, int start, int count) { int i; for (i = 0; i\n"); @@ -233,7 +296,8 @@ static void cmd_help (Z3950_connection *c, Z3950_resultset *r, printf ("show [ []\n"); printf ("quit\n"); printf ("close \n"); - printf ("set