source: trunk/gsdl/packages/mg/src/text/mg.special.c@ 1017

Last change on this file since 1017 was 439, checked in by sjboddie, 25 years ago

renamed mg-1.3d directory mg

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
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 439 1999-08-10 21:23:37Z sjboddie $
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 1999/08/10 21:18:03 sjboddie
33 renamed mg-1.3d directory mg
34
35 Revision 1.1 1998/11/17 09:34:51 rjmcnab
36 *** empty log message ***
37
38 * Revision 1.3 1994/10/20 03:56:53 tes
39 * I have rewritten the boolean query optimiser and abstracted out the
40 * components of the boolean query.
41 *
42 * Revision 1.2 1994/09/20 04:41:44 tes
43 * For version 1.1
44 *
45 */
46
47static char *RCSID = "$Id: mg.special.c 439 1999-08-10 21:23:37Z sjboddie $";
48
49
50FILE *fp;
51
52
53int
54init_special (char *FileName)
55{
56 char FName[200];
57 sprintf (FName, "%s%s", FileName, ".docnums");
58 if (!(fp = fopen (FName, "w")))
59 return (COMPERROR);
60 return (COMPALLOK);
61}
62
63
64
65
66int
67process_special (u_char * s_in, int l_in)
68{
69 static int un = 1;
70 char *s_done = (char *) (s_in + l_in);
71 for (; (char *) s_in != s_done; s_in++)
72 if (*s_in == '<')
73 {
74 if (strncmp ((char *) s_in, "<DOCNO>", 7) == 0)
75 {
76 char *s_end = (char *) (s_in + 1);
77 for (; s_end != s_done; s_end++)
78 if (*s_end == '<')
79 if (strncmp (s_end, "</DOCNO>", 8) == 0)
80 break;
81 if (s_end == s_done)
82 {
83 fprintf (fp, "NO DOC ID %d\n", un++);
84 return COMPALLOK;
85 }
86 s_in += 7;
87 while (s_end != (char *) s_in &&
88 (*(s_end - 1) == ' ' || *(s_end - 1) == '\n'))
89 s_end--;
90 while ((char *) s_in != s_end &&
91 (*s_in == ' ' || *s_in == '\n'))
92 s_in++;
93 for (; (char *) s_in != s_end; s_in++)
94 putc (*s_in, fp);
95 putc ('\n', fp);
96 return (COMPALLOK);
97 }
98 }
99 fprintf (fp, "NO DOC ID %d\n", un++);
100 return (COMPALLOK);
101}
102
103
104
105
106
107
108
109
110int
111done_special (char *FileName)
112{
113 fclose (fp);
114 return COMPALLOK;
115}
Note: See TracBrowser for help on using the repository browser.