From 7c7682423a6b7150551cbda256bee7fd27155b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Mon, 13 Jul 1998 16:36:39 +0200 Subject: [PATCH] Added kluge for improved SSI tag handling. Rev: src/modules/spider/spider.c:1.70 --- src/modules/spider/spider.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/modules/spider/spider.c b/src/modules/spider/spider.c index d23d626aaa..2a00e01e03 100644 --- a/src/modules/spider/spider.c +++ b/src/modules/spider/spider.c @@ -43,7 +43,7 @@ #include "threads.h" #include "operators.h" -RCSID("$Id: spider.c,v 1.69 1998/06/25 22:37:33 grubba Exp $"); +RCSID("$Id: spider.c,v 1.70 1998/07/13 14:36:39 grubba Exp $"); #ifdef HAVE_PWD_H #include <pwd.h> @@ -442,7 +442,7 @@ void f_set_start_quote(INT32 args) #define STARTQUOTE(C) do{PUSH();j=i+1;inquote = 1;endquote=(C);}while(0) #define ENDQUOTE() do{PUSH();j++;inquote=0;endquote=0;}while(0) -int extract_word(char *s, int i, int len) +int extract_word(char *s, int i, int len, int is_SSI_tag) { int inquote = 0; char endquote = 0; @@ -460,9 +460,17 @@ int extract_word(char *s, int i, int len) { case ' ': case '\t': case '\n': case '\r': case '>': case '=': - if(!inquote) - goto done; - break; + if(!inquote) { + if (is_SSI_tag && (s[i] == '>') && (i-j == 2) && + (s[j] == '-') && (s[j+1] == '-')) { + /* SSI tag that ends with "-->", + * don't add the "--" to the attribute. + */ + j = i; /* Skip */ + } + goto done; + } + break; case '"': case '\'': @@ -511,6 +519,12 @@ int push_parsed_tag(char *s,int len) { int i=0; struct svalue *oldsp; + int is_SSI_tag; + + /* NOTE: At entry sp[-1] is the tagname */ + is_SSI_tag == (sp[-1].type == T_STRING) && + (!strncmp(sp[-1].u.string->str, "!--", 3)); + /* Find X=Y pairs. */ oldsp = sp; @@ -518,7 +532,7 @@ int push_parsed_tag(char *s,int len) { int oldi; oldi = i; - i = extract_word(s, i, len); + i = extract_word(s, i, len, is_SSI_tag); f_lower_case(1); /* Since SGML wants us to... */ if (i+1 >= len || (s[i] != '=')) { @@ -531,7 +545,7 @@ int push_parsed_tag(char *s,int len) pop_stack(); } } else { - i = extract_word(s, i+1, len); + i = extract_word(s, i+1, len, is_SSI_tag); } if(oldi == i) break; } -- GitLab