1 /***************************************
2  $Header$
3 
4  Document parser test program
5  ******************/ /******************
6  Written by Andrew M. Bishop
7 
8  This file Copyright 1998,99,2000,01,03 Andrew M. Bishop
9  It may be distributed under the GNU Public License, version 2, or
10  any higher version.  See section COPYING of the GNU Public license
11  for conditions under which this file may be redistributed.
12  ***************************************/
13 
14 #include <stdio.h>
15 #include <unistd.h>
16 
17 #include "document.h"
18 #include "misc.h"
19 #include "io.h"
20 #include "config.h"
21 #include "errors.h"
22 
23 
main(int argc,char ** argv)24 int main(int argc,char **argv)
25 {
26  URL *Url;
27  URL **list,*refresh;
28  int j;
29 
30  if(argc==1)
31    {fprintf(stderr,"usage: test-doc URL < contents-of-url\n");return(1);}
32 
33  StderrLevel=ExtraDebug;
34 
35  InitErrorHandler("test-doc",0,1);
36 
37  InitConfigurationFile("./wwwoffle.conf");
38 
39  init_io(STDERR_FILENO);
40 
41  if(ReadConfigurationFile(STDERR_FILENO))
42     PrintMessage(Fatal,"Error in configuration file 'wwwoffle.conf'.");
43 
44  finish_io(STDERR_FILENO);
45 
46  Url=SplitURL(argv[1]);
47 
48  init_io(0);
49 
50  ParseDocument(0,Url,1);
51 
52  if((refresh=GetReference(RefMetaRefresh)))
53     printf("Refresh = %s\n",refresh->file);
54 
55  if((list=GetReferences(RefStyleSheet)))
56     for(j=0;list[j];j++)
57        printf("StyleSheet = %s\n",list[j]->file);
58 
59  if((list=GetReferences(RefImage)))
60     for(j=0;list[j];j++)
61        printf("Image = %s\n",list[j]->file);
62 
63  if((list=GetReferences(RefFrame)))
64     for(j=0;list[j];j++)
65        printf("Frame = %s\n",list[j]->file);
66 
67  if((list=GetReferences(RefScript)))
68     for(j=0;list[j];j++)
69        printf("Script = %s\n",list[j]->file);
70 
71  if((list=GetReferences(RefObject)))
72     for(j=0;list[j];j++)
73        printf("Object = %s\n",list[j]->file);
74 
75  if((list=GetReferences(RefInlineObject)))
76     for(j=0;list[j];j++)
77        printf("InlineObject = %s\n",list[j]->file);
78 
79  if((list=GetReferences(RefLink)))
80     for(j=0;list[j];j++)
81        printf("Link = %s\n",list[j]->file);
82 
83  FreeURL(Url);
84 
85  finish_io(0);
86 
87  return(0);
88 }
89