diff options
-rw-r--r-- | Makefile.in | 4 | ||||
-rw-r--r-- | acinclude.m4 | 2 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | file.c | 149 | ||||
-rw-r--r-- | fm.h | 9 | ||||
-rw-r--r-- | form.c | 2 | ||||
-rw-r--r-- | html.c | 37 | ||||
-rw-r--r-- | html.h | 31 | ||||
-rw-r--r-- | istream.c | 10 | ||||
-rw-r--r-- | istream.h | 4 | ||||
-rw-r--r-- | keybind.c | 2 | ||||
-rw-r--r-- | main.c | 72 | ||||
-rw-r--r-- | proto.h | 3 | ||||
-rw-r--r-- | table.c | 8 | ||||
-rw-r--r-- | tagtable.tab | 1 | ||||
-rw-r--r-- | terms.c | 4 | ||||
-rw-r--r-- | w3mbookmark.c | 2 | ||||
-rw-r--r-- | w3mimg/Makefile.in | 2 |
18 files changed, 295 insertions, 49 deletions
diff --git a/Makefile.in b/Makefile.in index 7d692f9..339c95e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -150,7 +150,7 @@ parsetagx.o: html.c funcname.tab: $(DEFUNS) (echo '#define DEFUN(x,y,z) x y';\ - sed -ne '/^DEFUN/{p;n;/^[ ]/p;}' $(DEFUNS)) | $(CPP) - | \ + sed -ne '/^DEFUN/{p;n;/^[ ]/p;}' $(DEFUNS)) | $(CPP) $(CPPFLAGS) - | \ awk '$$1 ~ /^[_A-Za-z]/ { \ for (i=2;i<=NF;i++) { print $$i, $$1} \ }' > $@.tmp @@ -199,7 +199,7 @@ dummy.o: entity.c $(CC) $(CFLAGS) -DDUMMY -c -o $@ $? $(IMGDISPLAY): w3mimgdisplay.o $(ALIB) w3mimg/w3mimg.a - $(IMGLINK) $(CFLAGS) -o $(IMGDISPLAY) w3mimgdisplay.o w3mimg/w3mimg.a $(LDFLAGS) $(LIBS) $(IMGLDFLAGS) + $(IMGLINK) $(CFLAGS) -o $(IMGDISPLAY) w3mimgdisplay.o w3mimg/w3mimg.a $(LDFLAGS) $(LIBS) -lX11 $(IMGLDFLAGS) w3mimgdisplay.o: w3mimgdisplay.c w3mimg/w3mimg.h $(CC) $(CFLAGS) $(IMGCFLAGS) -o $@ -c $(srcdir)/w3mimgdisplay.c diff --git a/acinclude.m4 b/acinclude.m4 index e4ccc3d..52c8874 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -866,7 +866,7 @@ AC_MSG_CHECKING(for sys_errlist) AC_TRY_COMPILE( changequote(<<,>>)dnl <<extern char *sys_errlist[];>>, -<<printf(sys_errlist[0]);>>, +<<printf("%s", sys_errlist[0]);>>, changequote([,])dnl [have_sys_errlist="yes"; AC_DEFINE(HAVE_SYS_ERRLIST)], [have_sys_errlist="no"]) @@ -8986,7 +8986,7 @@ extern char *sys_errlist[]; int main () { -printf(sys_errlist[0]); +printf("%s", sys_errlist[0]); ; return 0; } @@ -2449,6 +2449,7 @@ set_breakpoint(struct readbuffer *obuf, int tag_length) bcopy((void *)&obuf->anchor, (void *)&obuf->bp.anchor, sizeof(obuf->anchor)); obuf->bp.img_alt = obuf->img_alt; + obuf->bp.input_alt = obuf->input_alt; obuf->bp.in_bold = obuf->in_bold; obuf->bp.in_italic = obuf->in_italic; obuf->bp.in_under = obuf->in_under; @@ -2466,6 +2467,7 @@ back_to_breakpoint(struct readbuffer *obuf) bcopy((void *)&obuf->bp.anchor, (void *)&obuf->anchor, sizeof(obuf->anchor)); obuf->img_alt = obuf->bp.img_alt; + obuf->input_alt = obuf->bp.input_alt; obuf->in_bold = obuf->bp.in_bold; obuf->in_italic = obuf->bp.in_italic; obuf->in_under = obuf->bp.in_under; @@ -2709,7 +2711,7 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent, Str line = obuf->line, pass = NULL; char *hidden_anchor = NULL, *hidden_img = NULL, *hidden_bold = NULL, *hidden_under = NULL, *hidden_italic = NULL, *hidden_strike = NULL, - *hidden_ins = NULL, *hidden = NULL; + *hidden_ins = NULL, *hidden_input, *hidden = NULL; #ifdef DEBUG if (w3m_debug) { @@ -2741,6 +2743,12 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent, hidden = hidden_img; } } + if (obuf->input_alt.in) { + if ((hidden_input = has_hidden_link(obuf, HTML_INPUT_ALT)) != NULL) { + if (!hidden || hidden_input < hidden) + hidden = hidden_input; + } + } if (obuf->in_bold) { if ((hidden_bold = has_hidden_link(obuf, HTML_B)) != NULL) { if (!hidden || hidden_bold < hidden) @@ -2792,6 +2800,8 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent, Strcat_charp(line, "</a>"); if (obuf->img_alt && !hidden_img) Strcat_charp(line, "</img_alt>"); + if (obuf->input_alt.in && !hidden_input) + Strcat_charp(line, "</input_alt>"); if (obuf->in_bold && !hidden_bold) Strcat_charp(line, "</b>"); if (obuf->in_italic && !hidden_italic) @@ -3002,6 +3012,18 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent, Strcat_charp(tmp, "\">"); push_tag(obuf, tmp->ptr, HTML_IMG_ALT); } + if (!hidden_input && obuf->input_alt.in) { + Str tmp; + if (obuf->input_alt.hseq > 0) + obuf->input_alt.hseq = - obuf->input_alt.hseq; + tmp = Sprintf("<INPUT_ALT hseq=\"%d\" fid=\"%d\" name=\"%s\" type=\"%s\" value=\"%s\">", + obuf->input_alt.hseq, + obuf->input_alt.fid, + obuf->input_alt.name->ptr, + obuf->input_alt.type->ptr, + obuf->input_alt.value->ptr); + push_tag(obuf, tmp->ptr, HTML_INPUT_ALT); + } if (!hidden_bold && obuf->in_bold) push_tag(obuf, "<B>", HTML_B); if (!hidden_italic && obuf->in_italic) @@ -3707,6 +3729,63 @@ process_input(struct parsed_tag *tag) } Str +process_button(struct parsed_tag *tag) +{ + Str tmp = NULL; + char *p, *q, *r, *qq = NULL; + int qlen, v; + + if (cur_form_id < 0) { + char *s = "<form_int method=internal action=none>"; + tmp = process_form(parse_tag(&s, TRUE)); + } + if (tmp == NULL) + tmp = Strnew(); + + p = "submit"; + parsedtag_get_value(tag, ATTR_TYPE, &p); + q = NULL; + parsedtag_get_value(tag, ATTR_VALUE, &q); + r = ""; + parsedtag_get_value(tag, ATTR_NAME, &r); + + v = formtype(p); + if (v == FORM_UNKNOWN) + return NULL; + + if (!q) { + switch (v) { + case FORM_INPUT_SUBMIT: + case FORM_INPUT_BUTTON: + q = "SUBMIT"; + break; + case FORM_INPUT_RESET: + q = "RESET"; + break; + } + } + if (q) { + qq = html_quote(q); + qlen = strlen(q); + } + + // Strcat_charp(tmp, "<pre_int>"); + Strcat(tmp, Sprintf("<input_alt hseq=\"%d\" fid=\"%d\" type=%s " + "name=\"%s\" value=\"%s\">", + cur_hseq++, cur_form_id, p, html_quote(r), qq)); + return tmp; +} + +Str +process_n_button(void) +{ + Str tmp = Strnew(); + Strcat_charp(tmp, "</input_alt>"); + // Strcat_charp(tmp, "</pre_int>"); + return tmp; +} + +Str process_select(struct parsed_tag *tag) { Str tmp = NULL; @@ -4837,7 +4916,35 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) if (i > obuf->bottom_margin) obuf->bottom_margin = i; } + if (parsedtag_get_value(tag, ATTR_HSEQ, &hseq)) { + obuf->input_alt.hseq = hseq; + } + if (parsedtag_get_value(tag, ATTR_FID, &i)) { + obuf->input_alt.fid = i; + } + if (parsedtag_get_value(tag, ATTR_TYPE, &p)) { + obuf->input_alt.type = Strnew_charp(p); + } + if (parsedtag_get_value(tag, ATTR_VALUE, &p)) { + obuf->input_alt.value = Strnew_charp(p); + } + if (parsedtag_get_value(tag, ATTR_NAME, &p)) { + obuf->input_alt.name = Strnew_charp(p); + } + obuf->input_alt.in = 1; return 0; + case HTML_N_INPUT_ALT: + if (obuf->input_alt.in) { + if (!close_effect0(obuf, HTML_INPUT_ALT)) + push_tag(obuf, "</input_alt>", HTML_N_INPUT_ALT); + obuf->input_alt.hseq = 0; + obuf->input_alt.fid = -1; + obuf->input_alt.in = 0; + obuf->input_alt.type = NULL; + obuf->input_alt.name = NULL; + obuf->input_alt.value = NULL; + } + return 1; case HTML_TABLE: close_anchor(h_env, obuf); obuf->table_level++; @@ -4946,6 +5053,16 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) case HTML_INPUT: close_anchor(h_env, obuf); tmp = process_input(tag); + if (tmp) + HTMLlineproc1(tmp->ptr, h_env); + return 1; + case HTML_BUTTON: + tmp = process_button(tag); + if (tmp) + HTMLlineproc1(tmp->ptr, h_env); + return 1; + case HTML_N_BUTTON: + tmp = process_n_button(); if (tmp) HTMLlineproc1(tmp->ptr, h_env); return 1; @@ -5672,6 +5789,21 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) putHmarker(buf->hmarklist, currentLn(buf), hpos, hseq - 1); } + else if (hseq < 0) { + int h = -hseq - 1; + int hpos = pos; + if (*str == '[') + hpos++; + if (buf->hmarklist && + h < buf->hmarklist->nmark && + buf->hmarklist->marks[h].invalid) { + buf->hmarklist->marks[h].pos = hpos; + buf->hmarklist->marks[h].line = currentLn(buf); + buf->hmarklist->marks[h].invalid = 0; + hseq = -hseq; + } + } + if (!form->target) form->target = buf->baseTarget; if (a_textarea && @@ -6743,6 +6875,12 @@ init_henv(struct html_feed_environ *h_env, struct readbuffer *obuf, obuf->nobr_level = 0; bzero((void *)&obuf->anchor, sizeof(obuf->anchor)); obuf->img_alt = 0; + obuf->input_alt.hseq = 0; + obuf->input_alt.fid = -1; + obuf->input_alt.in = 0; + obuf->input_alt.type = NULL; + obuf->input_alt.name = NULL; + obuf->input_alt.value = NULL; obuf->in_bold = 0; obuf->in_italic = 0; obuf->in_under = 0; @@ -6778,6 +6916,15 @@ completeHTMLstream(struct html_feed_environ *h_env, struct readbuffer *obuf) push_tag(obuf, "</img_alt>", HTML_N_IMG_ALT); obuf->img_alt = NULL; } + if (obuf->input_alt.in) { + push_tag(obuf, "</input_alt>", HTML_N_INPUT_ALT); + obuf->input_alt.hseq = 0; + obuf->input_alt.fid = -1; + obuf->input_alt.in = 0; + obuf->input_alt.type = NULL; + obuf->input_alt.name = NULL; + obuf->input_alt.value = NULL; + } if (obuf->in_bold) { push_tag(obuf, "</b>", HTML_N_B); obuf->in_bold = 0; @@ -574,6 +574,13 @@ typedef struct _DownloadList { #define INIT_BUFFER_WIDTH ((_INIT_BUFFER_WIDTH > 0) ? _INIT_BUFFER_WIDTH : 0) #define FOLD_BUFFER_WIDTH (FoldLine ? (INIT_BUFFER_WIDTH + 1) : -1) +struct input_alt_attr { + int hseq; + int fid; + int in; + Str type, name, value; +}; + typedef struct { int pos; int len; @@ -581,6 +588,7 @@ typedef struct { long flag; Anchor anchor; Str img_alt; + struct input_alt_attr input_alt; char fontstat[FONTSTAT_SIZE]; short nobr_level; Lineprop prev_ctype; @@ -603,6 +611,7 @@ struct readbuffer { short nobr_level; Anchor anchor; Str img_alt; + struct input_alt_attr input_alt; char fontstat[FONTSTAT_SIZE]; char fontstat_stack[FONT_STACK_SIZE][FONTSTAT_SIZE]; int fontstat_sp; @@ -196,7 +196,7 @@ formtype(char *typestr) if (!strcasecmp(typestr, _formtypetbl[i])) return i; } - return FORM_UNKNOWN; + return FORM_INPUT_TEXT; } void @@ -56,6 +56,9 @@ unsigned char ALST_INPUT[] = ATTR_CORE }; #define MAXA_INPUT MAXA_CORE + 12 +unsigned char ALST_BUTTON[] = + { ATTR_TYPE, ATTR_VALUE, ATTR_NAME, ATTR_CORE }; +#define MAXA_BUTTON MAXA_CORE + 3 unsigned char ALST_TEXTAREA[] = { ATTR_COLS, ATTR_ROWS, ATTR_NAME, ATTR_READONLY, ATTR_CORE }; #define MAXA_TEXTAREA MAXA_CORE + 4 @@ -247,24 +250,24 @@ TagInfo TagMAP[MAX_HTMLTAG] = { {"/bdo", NULL, 0, TFLG_END}, /* 121 HTML_N_BDO */ {"big", ALST_NOP, MAXA_NOP, 0}, /* 122 HTML_BIG */ {"/big", NULL, 0, TFLG_END}, /* 123 HTML_N_BIG */ - {"button", ALST_NOP, MAXA_NOP, 0}, /* 124 HTML_BUTTON */ - {"fieldset", ALST_NOP, MAXA_NOP, 0}, /* 125 HTML_FIELDSET */ - {"/fieldset", NULL, 0, TFLG_END}, /* 126 HTML_N_FIELDSET */ - {"iframe", ALST_NOP, MAXA_NOP, 0}, /* 127 HTML_IFRAME */ - {"label", ALST_NOP, MAXA_NOP, 0}, /* 128 HTML_LABEL */ - {"/label", NULL, 0, TFLG_END}, /* 129 HTML_N_LABEL */ - {"legend", ALST_NOP, MAXA_NOP, 0}, /* 130 HTML_LEGEND */ - {"/legend", NULL, 0, TFLG_END}, /* 131 HTML_N_LEGEND */ - {"noscript", ALST_NOP, MAXA_NOP, 0}, /* 132 HTML_NOSCRIPT */ - {"/noscript", NULL, 0, TFLG_END}, /* 133 HTML_N_NOSCRIPT */ - {"object", ALST_NOP, MAXA_NOP, 0}, /* 134 HTML_OBJECT */ - {"optgroup", ALST_NOP, MAXA_NOP, 0}, /* 135 HTML_OPTGROUP */ - {"/optgroup", NULL, 0, TFLG_END}, /* 136 HTML_N_OPTGROUP */ - {"param", ALST_NOP, MAXA_NOP, 0}, /* 137 HTML_PARAM */ - {"small", ALST_NOP, MAXA_NOP, 0}, /* 138 HTML_SMALL */ - {"/small", NULL, 0, TFLG_END}, /* 139 HTML_N_SMALL */ + {"button", ALST_BUTTON, MAXA_BUTTON, 0}, /* 124 HTML_BUTTON */ + {"/button", NULL, 0, TFLG_END}, /* 125 HTML_N_BUTTON */ + {"fieldset", ALST_NOP, MAXA_NOP, 0}, /* 126 HTML_FIELDSET */ + {"/fieldset", NULL, 0, TFLG_END}, /* 127 HTML_N_FIELDSET */ + {"iframe", ALST_NOP, MAXA_NOP, 0}, /* 128 HTML_IFRAME */ + {"label", ALST_NOP, MAXA_NOP, 0}, /* 129 HTML_LABEL */ + {"/label", NULL, 0, TFLG_END}, /* 130 HTML_N_LABEL */ + {"legend", ALST_NOP, MAXA_NOP, 0}, /* 131 HTML_LEGEND */ + {"/legend", NULL, 0, TFLG_END}, /* 132 HTML_N_LEGEND */ + {"noscript", ALST_NOP, MAXA_NOP, 0}, /* 133 HTML_NOSCRIPT */ + {"/noscript", NULL, 0, TFLG_END}, /* 134 HTML_N_NOSCRIPT */ + {"object", ALST_NOP, MAXA_NOP, 0}, /* 135 HTML_OBJECT */ + {"optgroup", ALST_NOP, MAXA_NOP, 0}, /* 136 HTML_OPTGROUP */ + {"/optgroup", NULL, 0, TFLG_END}, /* 137 HTML_N_OPTGROUP */ + {"param", ALST_NOP, MAXA_NOP, 0}, /* 138 HTML_PARAM */ + {"small", ALST_NOP, MAXA_NOP, 0}, /* 139 HTML_SMALL */ + {"/small", NULL, 0, TFLG_END}, /* 140 HTML_N_SMALL */ - {NULL, NULL, 0, 0}, /* 140 Undefined */ {NULL, NULL, 0, 0}, /* 141 Undefined */ {NULL, NULL, 0, 0}, /* 142 Undefined */ {NULL, NULL, 0, 0}, /* 143 Undefined */ @@ -214,21 +214,22 @@ typedef struct { #define HTML_BIG 122 #define HTML_N_BIG 123 #define HTML_BUTTON 124 -#define HTML_FIELDSET 125 -#define HTML_N_FIELDSET 126 -#define HTML_IFRAME 127 -#define HTML_LABEL 128 -#define HTML_N_LABEL 129 -#define HTML_LEGEND 130 -#define HTML_N_LEGEND 131 -#define HTML_NOSCRIPT 132 -#define HTML_N_NOSCRIPT 133 -#define HTML_OBJECT 134 -#define HTML_OPTGROUP 135 -#define HTML_N_OPTGROUP 136 -#define HTML_PARAM 137 -#define HTML_SMALL 138 -#define HTML_N_SMALL 139 +#define HTML_N_BUTTON 125 +#define HTML_FIELDSET 126 +#define HTML_N_FIELDSET 127 +#define HTML_IFRAME 128 +#define HTML_LABEL 129 +#define HTML_N_LABEL 130 +#define HTML_LEGEND 131 +#define HTML_N_LEGEND 132 +#define HTML_NOSCRIPT 133 +#define HTML_N_NOSCRIPT 134 +#define HTML_OBJECT 135 +#define HTML_OPTGROUP 136 +#define HTML_N_OPTGROUP 137 +#define HTML_PARAM 138 +#define HTML_SMALL 139 +#define HTML_N_SMALL 140 /* pseudo tag */ #define HTML_SELECT_INT 160 @@ -22,8 +22,8 @@ static void basic_close(int *handle); static int basic_read(int *handle, char *buf, int len); -static void file_close(struct file_handle *handle); -static int file_read(struct file_handle *handle, char *buf, int len); +static void file_close(struct io_file_handle *handle); +static int file_read(struct io_file_handle *handle, char *buf, int len); static int str_read(Str handle, char *buf, int len); @@ -114,7 +114,7 @@ newFileStream(FILE * f, void (*closep) ()) stream = New(union input_stream); init_base_stream(&stream->base, STREAM_BUF_SIZE); stream->file.type = IST_FILE; - stream->file.handle = New(struct file_handle); + stream->file.handle = New(struct io_file_handle); stream->file.handle->f = f; if (closep) stream->file.handle->close = closep; @@ -658,13 +658,13 @@ basic_read(int *handle, char *buf, int len) } static void -file_close(struct file_handle *handle) +file_close(struct io_file_handle *handle) { handle->close(handle->f); } static int -file_read(struct file_handle *handle, char *buf, int len) +file_read(struct io_file_handle *handle, char *buf, int len) { return fread(buf, 1, len, handle->f); } @@ -20,7 +20,7 @@ struct stream_buffer { typedef struct stream_buffer *StreamBuffer; -struct file_handle { +struct io_file_handle { FILE *f; void (*close) (); }; @@ -53,7 +53,7 @@ struct base_stream { struct file_stream { struct stream_buffer stream; - struct file_handle *handle; + struct io_file_handle *handle; char type; char iseos; int (*read) (); @@ -91,7 +91,7 @@ unsigned char EscBKeymap[128] = { /* 0 1 2 3 4 5 6 7 */ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, /* 8 9 : ; < = > ? */ - nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, + nulcmd, nulcmd, nulcmd, nulcmd, sgrmouse, nulcmd, nulcmd, nulcmd, /* @ A B C D E F G */ nulcmd, movU, movD, movR, movL, nulcmd, goLineL, pgFore, /* H I J K L M N O */ @@ -200,10 +200,12 @@ fusage(FILE * f, int err) #ifdef USE_M17N fprintf(f, " -I charset document charset\n"); fprintf(f, " -O charset display/output charset\n"); +#if 0 /* use -O{s|j|e} instead */ fprintf(f, " -e EUC-JP\n"); fprintf(f, " -s Shift_JIS\n"); fprintf(f, " -j JIS\n"); #endif +#endif fprintf(f, " -B load bookmark\n"); fprintf(f, " -bookmark file specify bookmark file\n"); fprintf(f, " -T type specify content-type\n"); @@ -248,7 +250,11 @@ fusage(FILE * f, int err) #endif /* USE_COOKIE */ fprintf(f, " -graph use DEC special graphics for border of table and menu\n"); fprintf(f, " -no-graph use ACII character for border of table and menu\n"); +#if 1 /* pager requires -s */ + fprintf(f, " -s squeeze multiple blank lines\n"); +#else fprintf(f, " -S squeeze multiple blank lines\n"); +#endif fprintf(f, " -W toggle wrap search mode\n"); fprintf(f, " -X don't use termcap init/deinit\n"); fprintf(f, @@ -311,7 +317,11 @@ wrap_GC_warn_proc(char *msg, GC_word arg) lock = 0; } } +#if GC_VERSION_MAJOR >= 7 && GC_VERSION_MINOR >= 2 + else if (orig_GC_warn_proc = GC_get_warn_proc()) +#else else if (orig_GC_warn_proc) +#endif orig_GC_warn_proc(msg, arg); else fprintf(stderr, msg, (unsigned long)arg); @@ -530,12 +540,14 @@ main(int argc, char **argv, char **envp) PagerMax = atoi(argv[i]); } #ifdef USE_M17N +#if 0 /* use -O{s|j|e} instead */ else if (!strcmp("-s", argv[i])) DisplayCharset = WC_CES_SHIFT_JIS; else if (!strcmp("-j", argv[i])) DisplayCharset = WC_CES_ISO_2022_JP; else if (!strcmp("-e", argv[i])) DisplayCharset = WC_CES_EUC_JP; +#endif else if (!strncmp("-I", argv[i], 2)) { if (argv[i][2] != '\0') p = argv[i] + 2; @@ -703,7 +715,11 @@ main(int argc, char **argv, char **envp) accept_cookie = TRUE; } #endif /* USE_COOKIE */ +#if 1 /* pager requires -s */ + else if (!strcmp("-s", argv[i])) +#else else if (!strcmp("-S", argv[i])) +#endif squeezeBlankLine = TRUE; else if (!strcmp("-X", argv[i])) Do_not_use_ti_te = TRUE; @@ -833,7 +849,11 @@ main(int argc, char **argv, char **envp) mySignal(SIGPIPE, SigPipe); #endif +#if GC_VERSION_MAJOR >= 7 && GC_VERSION_MINOR >= 2 + GC_set_warn_proc(wrap_GC_warn_proc); +#else orig_GC_warn_proc = GC_set_warn_proc(wrap_GC_warn_proc); +#endif err_msg = Strnew(); if (load_argc == 0) { /* no URL specified */ @@ -5394,6 +5414,58 @@ DEFUN(mouse, MOUSE, "mouse operation") process_mouse(btn, x, y); } +DEFUN(sgrmouse, SGRMOUSE, "SGR 1006 mouse operation") +{ + int btn = 0, x = 0, y = 0; + unsigned char c; + + do { + c = getch(); + if (IS_DIGIT(c)) + btn = btn * 10 + c - '0'; + else if (c == ';') + break; + else + return; + } while (1); + +#if defined(__CYGWIN__) && CYGWIN_VERSION_DLL_MAJOR < 1005 + if (cygwin_mouse_btn_swapped) { + if (btn == MOUSE_BTN2_DOWN) + btn = MOUSE_BTN3_DOWN; + else if (btn == MOUSE_BTN3_DOWN) + btn = MOUSE_BTN2_DOWN; + }; +#endif + + do { + c = getch(); + if (IS_DIGIT(c)) + x = x * 10 + c - '0'; + else if (c == ';') + break; + else + return; + } while (1); + + do { + c = getch(); + if (IS_DIGIT(c)) + y = y * 10 + c - '0'; + else if (c == 'M') + break; + else if (c == 'm') { + btn |= 3; + break; + } else + return; + } while (1); + + if (x < 0 || x >= COLS || y < 0 || y > LASTLINE) + return; + process_mouse(btn, x, y); +} + #ifdef USE_GPM int gpm_process_mouse(Gpm_Event * event, void *data) @@ -224,6 +224,8 @@ extern int getImageSize(ImageCache * cache); extern Str process_img(struct parsed_tag *tag, int width); extern Str process_anchor(struct parsed_tag *tag, char *tagbuf); extern Str process_input(struct parsed_tag *tag); +extern Str process_button(struct parsed_tag *tag); +extern Str process_n_button(void); extern Str process_select(struct parsed_tag *tag); extern Str process_n_select(void); extern void feed_select(char *str); @@ -700,6 +702,7 @@ extern void reMark(void); #ifdef USE_MOUSE extern void mouse(void); +extern void sgrmouse(void); extern void mouse_init(void); extern void mouse_end(void); extern void mouse_active(void); @@ -2878,6 +2878,14 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, tmp = process_input(tag); feed_table1(tbl, tmp, mode, width); break; + case HTML_BUTTON: + tmp = process_button(tag); + feed_table1(tbl, tmp, mode, width); + break; + case HTML_N_BUTTON: + tmp = process_n_button(); + feed_table1(tbl, tmp, mode, width); + break; case HTML_SELECT: tmp = process_select(tag); if (tmp) diff --git a/tagtable.tab b/tagtable.tab index f9b7b76..f5a2c30 100644 --- a/tagtable.tab +++ b/tagtable.tab @@ -176,6 +176,7 @@ bdo HTML_BDO big HTML_BIG /big HTML_N_BIG button HTML_BUTTON +/button HTML_N_BUTTON fieldset HTML_FIELDSET /fieldset HTML_N_FIELDSET iframe HTML_IFRAME @@ -2027,8 +2027,8 @@ sleep_till_anykey(int sec, int purge) #ifdef USE_MOUSE -#define XTERM_ON {fputs("\033[?1001s\033[?1000h",ttyf); flush_tty();} -#define XTERM_OFF {fputs("\033[?1000l\033[?1001r",ttyf); flush_tty();} +#define XTERM_ON {fputs("\033[?1001s\033[?1000h\033[?1006h",ttyf); flush_tty();} +#define XTERM_OFF {fputs("\033[?1006l\033[?1000l\033[?1001r",ttyf); flush_tty();} #define CYGWIN_ON {fputs("\033[?1000h",ttyf); flush_tty();} #define CYGWIN_OFF {fputs("\033[?1000l",ttyf); flush_tty();} diff --git a/w3mbookmark.c b/w3mbookmark.c index 4355536..fcbad11 100644 --- a/w3mbookmark.c +++ b/w3mbookmark.c @@ -99,7 +99,7 @@ create_new_bookmark(char *bmark, char *section, char *title, char *url, fprintf(f, "<body>\n<h1>Bookmarks</h1>\n"); fprintf(f, "<h2>%s</h2>\n<ul>\n", section); fprintf(f, "<li><a href=\"%s\">%s</a>\n", url, title); - fprintf(f, end_section); + fprintf(f, "%s", end_section); fprintf(f, "</ul>\n</body>\n</html>\n"); fclose(f); } diff --git a/w3mimg/Makefile.in b/w3mimg/Makefile.in index dfc550c..0a964a1 100644 --- a/w3mimg/Makefile.in +++ b/w3mimg/Makefile.in @@ -22,6 +22,8 @@ w3mimg.a: $(IMGOBJS) $(AR) rv $@ $(IMGOBJS) $(RANLIB) $@ +$(IMGOBJS): @IMGTARGETS@ + w3mimg.o: w3mimg.c $(CC) $(CFLAGS) -c $< |