X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=zoom%2Fzoomsh.c;h=80970661384f7a25f519e2c8b53875f966dc9f17;hp=2f3897faf66ccff0481639099185ac8f5de4817b;hb=d9d97a04b6f9597225b8440dad61790dfa39a751;hpb=69bcd68523a9a8da083faef16887100369152673 diff --git a/zoom/zoomsh.c b/zoom/zoomsh.c index 2f3897f..8097066 100644 --- a/zoom/zoomsh.c +++ b/zoom/zoomsh.c @@ -1,5 +1,5 @@ /* - * $Id: zoomsh.c,v 1.1 2001-10-23 21:00:20 adam Exp $ + * $Id: zoomsh.c,v 1.14 2003-02-17 14:35:42 adam Exp $ * * ZOOM-C Shell */ @@ -9,9 +9,6 @@ #include #include -#define HAVE_READLINE_READLINE_H 1 -#define HAVE_READLINE_HISTORY_H 1 - #if HAVE_READLINE_READLINE_H #include #endif @@ -32,7 +29,7 @@ static int next_token (const char **cpp, const char **t_start) while (*cp == ' ') cp++; *t_start = cp; - while (*cp && *cp != ' ') + while (*cp && *cp != ' ' && *cp != '\r' && *cp != '\n') { cp++; len++; @@ -67,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]; @@ -79,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]; @@ -99,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"); @@ -236,7 +296,8 @@ static void cmd_help (Z3950_connection *c, Z3950_resultset *r, printf ("show [ []\n"); printf ("quit\n"); printf ("close \n"); - printf ("set