aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-11-26 17:05:22 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-11-26 17:05:22 +0000
commit1333e26be16b879441ae1ba68a4dbaddb9796c93 (patch)
treec1cf0201399514f3fb60a59fff133fdd40562693 /file.c
parentw3m 0.3.2.1 security fix (diff)
downloadw3m-1333e26be16b879441ae1ba68a4dbaddb9796c93.tar.gz
w3m-1333e26be16b879441ae1ba68a4dbaddb9796c93.zip
[w3m-dev 03488] meta refresh in frame
* file.c (getMetaRefreshParam): added (HTMLtagproc1): use getMetaRefreshParam() * frame.c (createFrameFile): check meta refresh * proto.h (getMetaRefreshProgram): added From: Hiroyuki Ito <hito@crl.go.jp>
Diffstat (limited to '')
-rw-r--r--file.c69
1 files changed, 42 insertions, 27 deletions
diff --git a/file.c b/file.c
index c8cb815..5ed8175 100644
--- a/file.c
+++ b/file.c
@@ -1,4 +1,4 @@
-/* $Id: file.c,v 1.129 2002/11/25 16:59:07 ukai Exp $ */
+/* $Id: file.c,v 1.130 2002/11/26 17:05:24 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
#include "myctype.h"
@@ -3940,6 +3940,46 @@ ul_type(struct parsed_tag *tag, int default_type)
}
int
+getMetaRefreshParam(char *q, Str *refresh_uri)
+{
+ int refresh_interval;
+ char *r;
+ Str s_tmp = NULL;
+
+ if(q == NULL || refresh_uri == NULL)
+ return 0;
+
+ refresh_interval = atoi(q);
+
+ while (*q) {
+ if (!strncasecmp(q, "url=", 4)) {
+ q += 4;
+ if (*q == '\"') /* " */
+ q++;
+ r = q;
+ while (*r && !IS_SPACE(*r) && *r != ';')
+ r++;
+ s_tmp = Strnew_charp_n(q, r - q);
+
+ if (s_tmp->ptr[s_tmp->length - 1] == '\"') { /* "
+ */
+ s_tmp->length--;
+ s_tmp->ptr[s_tmp->length] = '\0';
+ }
+ q = r;
+ }
+ while (*q && *q != ';')
+ q++;
+ if (*q == ';')
+ q++;
+ while (*q && *q == ' ')
+ q++;
+ }
+ *refresh_uri = s_tmp;
+ return refresh_interval;
+}
+
+int
HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
{
char *p, *q, *r;
@@ -4576,33 +4616,8 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
else
#endif
if (p && q && !strcasecmp(p, "refresh")) {
- int refresh_interval = atoi(q);
Str s_tmp = NULL;
-
- while (*q) {
- if (!strncasecmp(q, "url=", 4)) {
- q += 4;
- if (*q == '\"') /* " */
- q++;
- r = q;
- while (*r && !IS_SPACE(*r) && *r != ';')
- r++;
- s_tmp = Strnew_charp_n(q, r - q);
-
- if (s_tmp->ptr[s_tmp->length - 1] == '\"') { /* "
- */
- s_tmp->length--;
- s_tmp->ptr[s_tmp->length] = '\0';
- }
- q = r;
- }
- while (*q && *q != ';')
- q++;
- if (*q == ';')
- q++;
- while (*q && *q == ' ')
- q++;
- }
+ int refresh_interval = getMetaRefreshParam(q, &s_tmp);
if (s_tmp) {
q = html_quote(s_tmp->ptr);
tmp =