X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=zoom%2Fzoomsh.c;h=ad829489bffcab461aa02459a548879f6064ad22;hp=6f37182befbf0c4d5a2af83b65fb519004293d71;hb=16ee7ff60aee87829916837bcb2a200ce72870d9;hpb=3b96525a40981e162b959f3e842e0ff20e314320 diff --git a/zoom/zoomsh.c b/zoom/zoomsh.c index 6f37182..ad82948 100644 --- a/zoom/zoomsh.c +++ b/zoom/zoomsh.c @@ -1,11 +1,13 @@ /* - * Copyright (c) 2002-2004, Index Data. + * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: zoomsh.c,v 1.30 2004-11-18 15:18:14 heikki Exp $ + * $Id: zoomsh.c,v 1.41 2006-04-24 10:30:44 adam Exp $ */ -/* ZOOM-C Shell */ +/** \file zoomsh.c + \brief ZOOM C command line tool (shell) +*/ #include #include @@ -23,7 +25,7 @@ #include -#include +#include #include #include #include @@ -35,7 +37,7 @@ static int next_token (const char **cpp, const char **t_start) int len = 0; const char *cp = *cpp; while (*cp == ' ') - cp++; + cp++; if (*cp == '"') { cp++; @@ -69,11 +71,11 @@ static int next_token_copy (const char **cpp, char *buf_out, int buf_max) int len = next_token (cpp, &start); if (len < 0) { - *buf_out = 0; - return len; + *buf_out = 0; + return len; } if (len >= buf_max) - len = buf_max-1; + len = buf_max-1; memcpy (buf_out, start, len); buf_out[len] = '\0'; return len; @@ -83,37 +85,37 @@ static int is_command (const char *cmd_str, const char *this_str, int this_len) { int cmd_len = strlen(cmd_str); if (cmd_len != this_len) - return 0; + return 0; if (memcmp (cmd_str, this_str, cmd_len)) - return 0; + return 0; return 1; } static void cmd_set (ZOOM_connection *c, ZOOM_resultset *r, - ZOOM_options options, - const char **args) + ZOOM_options options, + const char **args) { char key[40], val[80]; if (next_token_copy (args, key, sizeof(key)) < 0) { - printf ("missing argument for set\n"); - return ; + printf ("missing argument for set\n"); + return ; } if (next_token_copy (args, val, sizeof(val)) < 0) - ZOOM_options_set(options, key, 0); + ZOOM_options_set(options, key, 0); else - ZOOM_options_set(options, key, val); + ZOOM_options_set(options, key, val); } static void cmd_get (ZOOM_connection *c, ZOOM_resultset *r, - ZOOM_options options, - const char **args) + ZOOM_options options, + const char **args) { char key[40]; if (next_token_copy (args, key, sizeof(key)) < 0) { - printf ("missing argument for get\n"); + printf ("missing argument for get\n"); } else { @@ -122,99 +124,123 @@ static void cmd_get (ZOOM_connection *c, ZOOM_resultset *r, } } +static void cmd_rget(ZOOM_connection *c, ZOOM_resultset *r, + ZOOM_options options, + const char **args) +{ + char key[40]; + if (next_token_copy (args, key, sizeof(key)) < 0) + { + printf ("missing argument for get\n"); + } + else + { + int i; + for (i = 0; i"); + } + } +} + static void cmd_close (ZOOM_connection *c, ZOOM_resultset *r, - ZOOM_options options, - const char **args) + ZOOM_options options, + const char **args) { char host[60]; int i; next_token_copy (args, host, sizeof(host)); for (i = 0; i= 0) - ZOOM_options_set (options, "start", start_str); + ZOOM_options_set (options, "start", start_str); if (next_token_copy (args, count_str, sizeof(count_str)) >= 0) - ZOOM_options_set (options, "count", count_str); + ZOOM_options_set (options, "count", count_str); for (i = 0; i\n"); printf ("search \n"); @@ -399,6 +432,7 @@ static void cmd_help (ZOOM_connection *c, ZOOM_resultset *r, printf ("scan \n"); printf ("quit\n"); printf ("close \n"); + printf ("ext \n"); printf ("set