X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzebrash.c;h=978ec6f08e5f7b8471912a7e6ce6cf11bbb4fd00;hb=4f8a19742e1f4ddb422fa515ff9c3f1d37e5641f;hp=63a878266309e51e5118b9bf7330b6933d50a950;hpb=5437b50633032595afe6f87dc0f989bc92a5aea8;p=idzebra-moved-to-github.git diff --git a/index/zebrash.c b/index/zebrash.c index 63a8782..978ec6f 100644 --- a/index/zebrash.c +++ b/index/zebrash.c @@ -1,6 +1,6 @@ -/* $Id: zebrash.c,v 1.30 2004-11-19 10:27:04 heikki Exp $ - Copyright (C) 2002,2003,2004 - Index Data Aps +/* $Id: zebrash.c,v 1.38 2006-05-19 13:49:34 adam Exp $ + Copyright (C) 1995-2005 + Index Data ApS This file is part of the Zebra server. @@ -28,7 +28,9 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include #include -#include /* for isatty */ +#if HAVE_UNISTD_H +#include +#endif #if HAVE_READLINE_READLINE_H #include @@ -38,7 +40,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #endif #include -#include +#include #include #include #include @@ -191,7 +193,7 @@ static int cmd_zebra_open( char *args[], WRBUF outbuff) if (!zs) wrbuf_puts(outbuff,"zebra seems not to have been started, " "trying anyway\n"); - zh=zebra_open(zs); + zh = zebra_open(zs, 0); return 0; /* ok */ } @@ -363,7 +365,7 @@ static int cmd_record_insert( char *args[], WRBUF outbuff) 0); if (0==rc) { - wrbuf_printf(outbuff,"ok sysno=%d\n",sysno); + wrbuf_printf(outbuff,"ok sysno=" ZINT_FORMAT "\n",sysno); } return rc; } @@ -390,15 +392,15 @@ static int cmd_exchange_record( char *args[], WRBUF outbuff) * Searching and retrieving */ -static int cmd_search_pqf( char *args[], WRBUF outbuff) +static int cmd_search_pqf(char *args[], WRBUF outbuff) { - int hits=0; - char *set=args[1]; - char *qry=restargs(args,2); + zint hits = 0; + char *set = args[1]; + char *qry = restargs(args,2); int rc; - rc=zebra_search_PQF(zh, qry, set, &hits); + rc = zebra_search_PQF(zh, qry, set, &hits); if (0==rc) - wrbuf_printf(outbuff,"%d hits found\n",hits); + wrbuf_printf(outbuff, ZINT_FORMAT " hits found\n", hits); return rc; } @@ -406,21 +408,21 @@ static int cmd_find( char *args[], WRBUF outbuff) { char *setname=DEFAULTRESULTSET; int rc; - int hits=0; - WRBUF qry=wrbuf_alloc(); + zint hits = 0; + WRBUF qry = wrbuf_alloc(); if (0==strstr(args[0],"@attr")) wrbuf_puts(qry, "@attr 1=/ "); wrbuf_puts(qry,restargs(args,1)); if (!zh) onecommand("quickstart", outbuff, ""); wrbuf_printf(outbuff, "find %s\n",wrbuf_buf(qry)); - rc=zebra_search_PQF(zh, wrbuf_buf(qry), setname, &hits); + rc = zebra_search_PQF(zh, wrbuf_buf(qry), setname, &hits); if (0==rc) { - wrbuf_printf(outbuff,"%d hits found\n",hits); - nextrecno=1; + wrbuf_printf(outbuff, ZINT_FORMAT " hits found\n", hits); + nextrecno = 1; } - wrbuf_free(qry,1); + wrbuf_free(qry, 1); return rc; } @@ -741,7 +743,7 @@ static int cmd_help( char *args[], WRBUF outbuff) /* If Zebra reports an error after an operation, * append it to the outbuff and log it */ -static void Zerrors ( WRBUF outbuff) +static void Zerrors (WRBUF outbuff) { int ec; if (!zh) @@ -755,7 +757,6 @@ static void Zerrors ( WRBUF outbuff) wrbuf_printf(outbuff, " Zebra error %d: %s, (%s)\n", ec, zebra_errString (zh), zebra_errAdd (zh) ); - zebra_clearError(zh); } } @@ -860,3 +861,11 @@ int main (int argc, char ** argv) shell(); return 0; } /* main */ +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +