X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=zoom%2Fzoomtst9.c;h=ed5b5b7cc6692c96f5067f0cc8d584a3c1211bcb;hp=d3f6e2f70d07c5e95ea6eb7fd2f9c611d7ddedac;hb=379504a233e3e2cc85bca1e7b6d864f1395aec7c;hpb=d57ade59211707b9bcfacc61039e446c9fa3f36f diff --git a/zoom/zoomtst9.c b/zoom/zoomtst9.c index d3f6e2f..ed5b5b7 100644 --- a/zoom/zoomtst9.c +++ b/zoom/zoomtst9.c @@ -1,17 +1,17 @@ -/* $Id: zoomtst9.c,v 1.2 2006-04-21 10:28:08 adam Exp $ */ - -/** \file zoomtst9.c - \brief Extended Service Update -*/ +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2009 Index Data + * See the file LICENSE for details. + */ #include #include +#include #include #include #include -static void usage() +static void usage(void) { fprintf(stderr, "usage:\n" "zoomtst9 target [insert|delete|replace|update] id1 rec1 " @@ -73,8 +73,21 @@ int main(int argc, char **argv) ZOOM_package_option_set(pkg, "recordIdOpaque", argv[i][0] ? argv[i] : 0); i++; - ZOOM_package_option_set(pkg, "record", - argv[i][0] ? argv[i] : 0); + if (!strcmp(argv[i], "-")) + { + /* For -, read record buffer from stdin */ + WRBUF w = wrbuf_alloc(); + int ch; + while ((ch = getchar()) != EOF) + wrbuf_putc(w, ch); + wrbuf_putc(w, '\0'); + ZOOM_package_option_set(pkg, "record", wrbuf_buf(w)); + } + else + { + ZOOM_package_option_set(pkg, "record", + argv[i][0] ? argv[i] : 0); + } i++; ZOOM_package_send(pkg, "update"); /* Update EXT service */ @@ -93,6 +106,7 @@ int main(int argc, char **argv) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab