Added handling of qualifiers. Not finished yet.
[egate.git] / ccl / cclsh.c
1 /* CCL shell.
2  * Europagate 1995
3  *
4  * $Log: cclsh.c,v $
5  * Revision 1.2  1995/02/13 15:15:07  adam
6  * Added handling of qualifiers. Not finished yet.
7  *
8  * Revision 1.1  1995/02/13  12:35:21  adam
9  * First version of CCL. Qualifiers aren't handled yet.
10  *
11  */
12
13 #include <stdio.h>
14 #include <stdlib.h>
15
16 #include "ccl.h"
17
18 static int debug = 0;
19 static char *prog;
20
21 int main (int argc, char **argv)
22 {
23     CCL_bibset bibset;
24     static int uses[10];
25
26     prog = *argv;
27     bibset = ccl_qual_mk ();    
28     while (--argc > 0)
29     {
30         ++argv;
31         if (**++argv == '-')
32         {
33             switch (argv[0][1])
34             {
35             case 'd':
36                 debug = 1;
37                 break;
38             default:
39                 fprintf (stderr, "%s: unknown option '%s'\n",
40                     prog, *argv);
41                 exit (1);
42             }
43         }
44         else
45         {
46             fprintf (stderr, "%s: no filenames, please\n", prog);
47             exit (1);
48         }
49     }
50     uses[0] = 5;
51     ccl_qual_add (bibset, "ti", 1, uses, -1, -1,
52                   0, -1, -1);
53     uses[0] = 1;
54     ccl_qual_add (bibset, "au", 1, uses, -1, -1,
55                   0, -1, -1);
56     while (1)
57     {
58         char buf[80];
59         int error;
60         int pos;
61         printf ("CCLSH>"); fflush (stdout);
62         if (!fgets (buf, 79, stdin))
63             break;
64         ccl_find_str (bibset, buf, &error, &pos);
65         if (error)
66         {
67             printf ("%*s^ - ", 6+pos, " ");
68             printf ("%s\n", ccl_err_msg (error));
69             
70         }
71     }
72     return 0;
73 }
74
75