1 | /**************************************************************************
|
---|
2 | *
|
---|
3 | * mg.special.c -- Special pass for mg_passes
|
---|
4 | * Copyright (C) 1994 Neil Sharman
|
---|
5 | *
|
---|
6 | * This program is free software; you can redistribute it and/or modify
|
---|
7 | * it under the terms of the GNU General Public License as published by
|
---|
8 | * the Free Software Foundation; either version 2 of the License, or
|
---|
9 | * (at your option) any later version.
|
---|
10 | *
|
---|
11 | * This program is distributed in the hope that it will be useful,
|
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | * GNU General Public License for more details.
|
---|
15 | *
|
---|
16 | * You should have received a copy of the GNU General Public License
|
---|
17 | * along with this program; if not, write to the Free Software
|
---|
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
19 | *
|
---|
20 | * $Id: mg.special.c 3745 2003-02-20 21:20:24Z mdewsnip $
|
---|
21 | *
|
---|
22 | **************************************************************************/
|
---|
23 |
|
---|
24 | #include "sysfuncs.h"
|
---|
25 |
|
---|
26 | #include "mg.h"
|
---|
27 | #include "build.h"
|
---|
28 |
|
---|
29 |
|
---|
30 | /*
|
---|
31 | $Log$
|
---|
32 | Revision 1.1 2003/02/20 21:18:24 mdewsnip
|
---|
33 | Addition of MG package for search and retrieval
|
---|
34 |
|
---|
35 | Revision 1.1 1999/08/10 21:18:03 sjboddie
|
---|
36 | renamed mg-1.3d directory mg
|
---|
37 |
|
---|
38 | Revision 1.1 1998/11/17 09:34:51 rjmcnab
|
---|
39 | *** empty log message ***
|
---|
40 |
|
---|
41 | * Revision 1.3 1994/10/20 03:56:53 tes
|
---|
42 | * I have rewritten the boolean query optimiser and abstracted out the
|
---|
43 | * components of the boolean query.
|
---|
44 | *
|
---|
45 | * Revision 1.2 1994/09/20 04:41:44 tes
|
---|
46 | * For version 1.1
|
---|
47 | *
|
---|
48 | */
|
---|
49 |
|
---|
50 | static char *RCSID = "$Id: mg.special.c 3745 2003-02-20 21:20:24Z mdewsnip $";
|
---|
51 |
|
---|
52 |
|
---|
53 | FILE *fp;
|
---|
54 |
|
---|
55 |
|
---|
56 | int
|
---|
57 | init_special (char *FileName)
|
---|
58 | {
|
---|
59 | char FName[200];
|
---|
60 | sprintf (FName, "%s%s", FileName, ".docnums");
|
---|
61 | if (!(fp = fopen (FName, "w")))
|
---|
62 | return (COMPERROR);
|
---|
63 | return (COMPALLOK);
|
---|
64 | }
|
---|
65 |
|
---|
66 |
|
---|
67 |
|
---|
68 |
|
---|
69 | int
|
---|
70 | process_special (u_char * s_in, int l_in)
|
---|
71 | {
|
---|
72 | static int un = 1;
|
---|
73 | char *s_done = (char *) (s_in + l_in);
|
---|
74 | for (; (char *) s_in != s_done; s_in++)
|
---|
75 | if (*s_in == '<')
|
---|
76 | {
|
---|
77 | if (strncmp ((char *) s_in, "<DOCNO>", 7) == 0)
|
---|
78 | {
|
---|
79 | char *s_end = (char *) (s_in + 1);
|
---|
80 | for (; s_end != s_done; s_end++)
|
---|
81 | if (*s_end == '<')
|
---|
82 | if (strncmp (s_end, "</DOCNO>", 8) == 0)
|
---|
83 | break;
|
---|
84 | if (s_end == s_done)
|
---|
85 | {
|
---|
86 | fprintf (fp, "NO DOC ID %d\n", un++);
|
---|
87 | return COMPALLOK;
|
---|
88 | }
|
---|
89 | s_in += 7;
|
---|
90 | while (s_end != (char *) s_in &&
|
---|
91 | (*(s_end - 1) == ' ' || *(s_end - 1) == '\n'))
|
---|
92 | s_end--;
|
---|
93 | while ((char *) s_in != s_end &&
|
---|
94 | (*s_in == ' ' || *s_in == '\n'))
|
---|
95 | s_in++;
|
---|
96 | for (; (char *) s_in != s_end; s_in++)
|
---|
97 | putc (*s_in, fp);
|
---|
98 | putc ('\n', fp);
|
---|
99 | return (COMPALLOK);
|
---|
100 | }
|
---|
101 | }
|
---|
102 | fprintf (fp, "NO DOC ID %d\n", un++);
|
---|
103 | return (COMPALLOK);
|
---|
104 | }
|
---|
105 |
|
---|
106 |
|
---|
107 |
|
---|
108 |
|
---|
109 |
|
---|
110 |
|
---|
111 |
|
---|
112 |
|
---|
113 | int
|
---|
114 | done_special (char *FileName)
|
---|
115 | {
|
---|
116 | fclose (fp);
|
---|
117 | return COMPALLOK;
|
---|
118 | }
|
---|