$B:dK\$G$9!#(B
>> $B:dK\$G$9!#(B
>> >> $B2,ED$G$9!#(B
>> >> <A HREF="1">1></A><A HREF="2">2></A>
>> >> $B$H$$$&(B html $B$rI=<($5$;$k$H!"(B1> 2> $B$N$h$&$K4V$K6uGr$,F~$C$F$7$^$$$^$9!#(B
>> >> $B%"%s%+!<$NCf$G$J$$$H$-$O(B 1>2> $B$H$J$j$^$7$?!#(B
>> $B860x$OJ,$+$j$^$7$?!#(B
>> $B5U8~$-$K(B tag $B$r(B parse $B$9$k(B has_hidden_link() $B$,(B irregular $B$J(B '>' $B$K(B
>> $BBP1~$7$F$$$J$$$?$a$G$9!#(B
irregular $B$J(B '>' $B$,B8:_$9$k$H!"5U8~$-(B parse $B$O(B($B$[$H$s$I(B)$BIT2DG=$J$N$G(B
$BB?>/!"L5BL$J=hM}$,A}$($^$9$,!"(Bnext_status() $B$r;H$C$F=gJ}8~$K(B parse $B$9$k(B
$BMM$K=q$-49$($F$_$^$7$?!#(B
>> $B$`$7$m!"(Bpush_char() $B$9$k;~$K(B '>' $B$r(B quote $B$9$Y$-$J$N$+$b$7$l$^$;$s!#(B
$B$3$NJ}K!$O:#2s$O%Q%9!#(B
-----------------------------------
$B:dK\(B $B9@B'(B <hsaka@mth.biglobe.ne.jp>
http://www2u.biglobe.ne.jp/~hsaka/
--- file.c.orig Thu Jun 1 10:38:20 2000
+++ file.c Thu Jun 1 12:34:15 2000
@@ -1112,49 +1112,40 @@
#define TAG_IS(s,tag,len)\
(strncasecmp(s,tag,len)==0&&(s[len] == '>' || IS_SPACE((int)s[len])))
+
char *
has_hidden_link(Str line, char *tag, int taglen)
{
- char *p;
+ char *p, *s = NULL, *t = NULL;
int status = R_ST_NORMAL;
- for (p = line->ptr + line->length - 1; p >= line->ptr; p--) {
- switch (*p) {
- case '>':
- if (status == R_ST_NORMAL)
- status = R_ST_TAG0;
- break;
- case '<':
- if (status == R_ST_TAG) {
- if (TAG_IS(p, tag, taglen))
- return p;
- status = R_ST_NORMAL;
- }
+ if (Strlastchar(line) != '>')
+ return NULL;
+
+ for (p = line->ptr; p < line->length; p++) {
+ next_status(*p, &status);
+ switch(status) {
+ case R_ST_TAG0:
+ s = p;
break;
- case '"':
- if (status == R_ST_TAG || status == R_ST_TAG0)
- status = R_ST_DQUOTE;
- else if (status == R_ST_DQUOTE)
- status = R_ST_TAG;
- else if (status == R_ST_NORMAL)
- return NULL;
+ case R_ST_NORMAL:
+ if (*p == '>' && s != NULL && TAG_IS(s, tag, taglen))
+ t = s;
+ s = NULL;
break;
- case '\'':
- if (status == R_ST_TAG || status == R_ST_TAG0)
- status = R_ST_QUOTE;
- else if (status == R_ST_QUOTE)
- status = R_ST_TAG;
- else if (status == R_ST_NORMAL)
- return NULL;
+ case R_ST_AMP:
+ case R_ST_CMNT1:
+ case R_ST_CMNT2:
+ case R_ST_CMNT:
+ case R_ST_NCMNT1:
+ case R_ST_NCMNT2:
+ case R_ST_NCMNT3:
+ case R_ST_IRRTAG:
+ s = NULL;
break;
- default:
- if (status == R_ST_NORMAL)
- return NULL;
- else if (status == R_ST_TAG0)
- status = R_ST_TAG;
}
}
- return NULL;
+ return t;
}
static int
This archive was generated by hypermail 2b29 : Wed Jul 19 2000 - 10:30:56 CDT