X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=ccl%2Fcclsh.c;h=1b01bb8a14b763587267427a3589665e14de1dbd;hb=754b0cc078d975dc04dfb1e58e93780935a53a49;hp=acff48fc635adce8128a5f9f5bcbf90ad5a6e4f2;hpb=330271187bc05322c13e6e22483120ca8e5a20a1;p=yaz-moved-to-github.git diff --git a/ccl/cclsh.c b/ccl/cclsh.c index acff48f..1b01bb8 100644 --- a/ccl/cclsh.c +++ b/ccl/cclsh.c @@ -1,9 +1,77 @@ +/* + * Copyright (c) 1995, the EUROPAGATE consortium (see below). + * + * The EUROPAGATE consortium members are: + * + * University College Dublin + * Danmarks Teknologiske Videnscenter + * An Chomhairle Leabharlanna + * Consejo Superior de Investigaciones Cientificas + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation, in whole or in part, for any purpose, is hereby granted, + * provided that: + * + * 1. This copyright and permission notice appear in all copies of the + * software and its documentation. Notices of copyright or attribution + * which appear at the beginning of any file must remain unchanged. + * + * 2. The names of EUROPAGATE or the project partners may not be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * 3. Users of this software (implementors and gateway operators) agree to + * inform the EUROPAGATE consortium of their use of the software. This + * information will be used to evaluate the EUROPAGATE project and the + * software, and to plan further developments. The consortium may use + * the information in later publications. + * + * 4. Users of this software agree to make their best efforts, when + * documenting their use of the software, to acknowledge the EUROPAGATE + * consortium, and the role played by the software in their work. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * IN NO EVENT SHALL THE EUROPAGATE CONSORTIUM OR ITS MEMBERS BE LIABLE + * FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF + * ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA + * OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND + * ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE + * USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ /* CCL shell. * Europagate 1995 * * $Log: cclsh.c,v $ - * Revision 1.1 1995-04-10 10:28:21 quinn - * Added copy of CCL. + * Revision 1.7 2000-10-17 19:50:28 adam + * Implemented and-list and or-list for CCL module. + * + * Revision 1.6 2000/01/31 13:15:21 adam + * Removed uses of assert(3). Cleanup of ODR. CCL parser update so + * that some characters are not surrounded by spaces in resulting term. + * ILL-code updates. + * + * Revision 1.5 1999/12/16 23:36:19 adam + * Implemented ILL protocol. Minor updates ASN.1 compiler. + * + * Revision 1.4 1999/03/31 11:15:37 adam + * Fixed memory leaks in ccl_find_str and ccl_qual_rm. + * + * Revision 1.3 1997/04/30 08:52:07 quinn + * Null + * + * Revision 1.2 1996/10/11 15:00:25 adam + * CCL parser from Europagate Email gateway 1.0. + * + * Revision 1.11 1995/05/16 09:39:27 adam + * LICENSE. + * + * Revision 1.10 1995/05/11 14:03:57 adam + * Changes in the reading of qualifier(s). New function: ccl_qual_fitem. + * New variable ccl_case_sensitive, which controls whether reserved + * words and field names are case sensitive or not. * * Revision 1.9 1995/02/23 08:32:00 adam * Changed header. @@ -36,13 +104,18 @@ #include #include -#include -#include +#include static int debug = 0; static char *prog; +void usage(const char *prog) +{ + fprintf (stderr, "%s: [-d] [-b configfile]\n", prog); + exit (1); +} + int main (int argc, char **argv) { CCL_bibset bibset; @@ -84,9 +157,7 @@ int main (int argc, char **argv) fclose (bib_inf); break; default: - fprintf (stderr, "%s: unknown option '%s'\n", - prog, *argv); - exit (1); + usage(prog); } } else @@ -98,23 +169,30 @@ int main (int argc, char **argv) while (1) { char buf[80]; - int error, pos; + int i, error, pos; struct ccl_rpn_node *rpn; printf ("CCLSH>"); fflush (stdout); if (!fgets (buf, 79, stdin)) break; - rpn = ccl_find_str (bibset, buf, &error, &pos); - if (error) + for (i = 0; i<1; i++) { - printf ("%*s^ - ", 6+pos, " "); - printf ("%s\n", ccl_err_msg (error)); - } - else - { - assert (rpn); - ccl_pr_tree (rpn, stdout); - putchar ('\n'); + rpn = ccl_find_str (bibset, buf, &error, &pos); + if (error) + { + printf ("%*s^ - ", 6+pos, " "); + printf ("%s\n", ccl_err_msg (error)); + } + else + { + if (rpn && i == 0) + { + ccl_pr_tree (rpn, stdout); + putchar ('\n'); + } + } + if (rpn) + ccl_rpn_delete(rpn); } } putchar ('\n');