1 /* $Id: fm.h,v 1.149 2010/08/20 09:47:09 htrb Exp $ */ 2 /* 3 * w3m: WWW wo Miru utility 4 * 5 * by A.ITO Feb. 1995 6 * 7 * You can use,copy,modify and distribute this program without any permission. 8 */ 9 10 #ifndef FM_H 11 #define FM_H 12 13 14 #ifndef _GNU_SOURCE 15 #define _GNU_SOURCE /* strcasestr() */ 16 #endif 17 18 #include <stdio.h> 19 #include <stdlib.h> 20 #include <string.h> 21 #include <unistd.h> 22 #include <limits.h> 23 #include <sys/types.h> 24 #include <sys/stat.h> 25 #include <unistd.h> 26 #include "config.h" 27 #include "history.h" 28 29 #ifdef USE_MENU 30 #define MENU_SELECT 31 #define MENU_MAP 32 #endif /* USE_MENU */ 33 34 #ifndef USE_COLOR 35 #undef USE_ANSI_COLOR 36 #undef USE_BG_COLOR 37 #endif 38 39 #include "ctrlcode.h" 40 #include "html.h" 41 #include <gc.h> 42 #include "Str.h" 43 #ifdef USE_M17N 44 #include "wc.h" 45 #include "wtf.h" 46 #else 47 typedef int wc_ces; /* XXX: not used */ 48 #endif 49 50 #ifdef HAVE_LOCALE_H 51 #include <locale.h> 52 #endif 53 #if !HAVE_SETLOCALE 54 #define setlocale(category, locale) /* empty */ 55 #endif 56 57 #ifdef ENABLE_NLS 58 #include <libintl.h> 59 #define _(String) gettext (String) 60 #define N_(String) (String) 61 #else 62 # undef bindtextdomain 63 # define bindtextdomain(Domain, Directory) /* empty */ 64 # undef textdomain 65 # define textdomain(Domain) /* empty */ 66 # define _(Text) Text 67 # define N_(Text) Text 68 # define gettext(Text) Text 69 #endif 70 71 #include "form.h" 72 #include "frame.h" 73 #include "parsetag.h" 74 #include "parsetagx.h" 75 #include "func.h" 76 #include "menu.h" 77 #include "textlist.h" 78 #include "funcname1.h" 79 #include "terms.h" 80 #include "istream.h" 81 82 #ifndef HAVE_BCOPY 83 void bcopy(const void *, void *, int); 84 void bzero(void *, int); 85 #endif /* HAVE_BCOPY */ 86 #ifdef __EMX__ 87 #include <strings.h> /* for bzero() and bcopy() */ 88 #endif 89 90 #ifdef MAINPROGRAM 91 #define global 92 #define init(x) =(x) 93 #else /* not MAINPROGRAM */ 94 #define global extern 95 #define init(x) 96 #endif /* not MAINPROGRAM */ 97 98 #define DEFUN(funcname, macroname, docstring) void funcname(void) 99 100 /* 101 * Constants. 102 */ 103 #define LINELEN 256 /* Initial line length */ 104 #define PAGER_MAX_LINE 10000 /* Maximum line kept as pager */ 105 106 #define MAXIMUM_COLS 1024 107 #define DEFAULT_COLS 80 108 109 #ifdef USE_IMAGE 110 #define MAX_IMAGE 1000 111 #define MAX_IMAGE_SIZE 2048 112 113 #define DEFAULT_PIXEL_PER_CHAR 7.0 /* arbitrary */ 114 #define DEFAULT_PIXEL_PER_LINE 14.0 /* arbitrary */ 115 #else 116 #define DEFAULT_PIXEL_PER_CHAR 8.0 /* arbitrary */ 117 #endif 118 #define MINIMUM_PIXEL_PER_CHAR 4.0 119 #define MAXIMUM_PIXEL_PER_CHAR 32.0 120 121 #ifdef FALSE 122 #undef FALSE 123 #endif 124 125 #ifdef TRUE 126 #undef TRUE 127 #endif 128 129 #define FALSE 0 130 #define TRUE 1 131 132 #define SHELLBUFFERNAME "*Shellout*" 133 #define PIPEBUFFERNAME "*stream*" 134 #define CPIPEBUFFERNAME "*stream(closed)*" 135 #ifdef USE_DICT 136 #define DICTBUFFERNAME "*dictionary*" 137 #endif /* USE_DICT */ 138 139 #ifndef HOST_NAME_MAX 140 #define HOST_NAME_MAX 255 141 #endif 142 143 /* 144 * Line Property 145 */ 146 147 #define P_CHARTYPE 0x3f00 148 #ifdef USE_M17N 149 #define PC_ASCII (WTF_TYPE_ASCII << 8) 150 #define PC_CTRL (WTF_TYPE_CTRL << 8) 151 #define PC_WCHAR1 (WTF_TYPE_WCHAR1 << 8) 152 #define PC_WCHAR2 (WTF_TYPE_WCHAR2 << 8) 153 #define PC_KANJI (WTF_TYPE_WIDE << 8) 154 #define PC_KANJI1 (PC_WCHAR1 | PC_KANJI) 155 #define PC_KANJI2 (PC_WCHAR2 | PC_KANJI) 156 #define PC_UNKNOWN (WTF_TYPE_UNKNOWN << 8) 157 #define PC_UNDEF (WTF_TYPE_UNDEF << 8) 158 #else 159 #define PC_ASCII 0x0000 160 #define PC_CTRL 0x0100 161 #endif 162 #define PC_SYMBOL 0x8000 163 164 /* Effect ( standout/underline ) */ 165 #define P_EFFECT 0x40ff 166 #define PE_NORMAL 0x00 167 #define PE_MARK 0x01 168 #define PE_UNDER 0x02 169 #define PE_STAND 0x04 170 #define PE_BOLD 0x08 171 #define PE_ANCHOR 0x10 172 #define PE_EMPH 0x08 173 #define PE_IMAGE 0x20 174 #define PE_FORM 0x40 175 #define PE_ACTIVE 0x80 176 #define PE_VISITED 0x4000 177 178 /* Extra effect */ 179 #define PE_EX_ITALIC 0x01 180 #define PE_EX_INSERT 0x02 181 #define PE_EX_STRIKE 0x04 182 183 #define PE_EX_ITALIC_E PE_UNDER 184 #define PE_EX_INSERT_E PE_UNDER 185 #define PE_EX_STRIKE_E PE_STAND 186 187 #define CharType(c) ((c)&P_CHARTYPE) 188 #define CharEffect(c) ((c)&(P_EFFECT|PC_SYMBOL)) 189 #define SetCharType(v,c) ((v)=(((v)&~P_CHARTYPE)|(c))) 190 191 192 #define COLPOS(l,c) calcPosition(l->lineBuf,l->propBuf,l->len,c,0,CP_AUTO) 193 194 /* Flags for displayBuffer() */ 195 #define B_NORMAL 0 196 #define B_FORCE_REDRAW 1 197 #define B_REDRAW 2 198 #define B_SCROLL 3 199 #define B_REDRAW_IMAGE 4 200 201 /* Buffer Property */ 202 #define BP_NORMAL 0x0 203 #define BP_PIPE 0x1 204 #define BP_FRAME 0x2 205 #define BP_INTERNAL 0x8 206 #define BP_NO_URL 0x10 207 #define BP_REDIRECTED 0x20 208 #define BP_CLOSE 0x40 209 210 /* Link Buffer */ 211 #define LB_NOLINK -1 212 #define LB_FRAME 0 /* rFrame() */ 213 #define LB_N_FRAME 1 214 #define LB_INFO 2 /* pginfo() */ 215 #define LB_N_INFO 3 216 #define LB_SOURCE 4 /* vwSrc() */ 217 #define LB_N_SOURCE LB_SOURCE 218 #define MAX_LB 5 219 220 /* Search Result */ 221 #define SR_FOUND 0x1 222 #define SR_NOTFOUND 0x2 223 #define SR_WRAPPED 0x4 224 225 #ifdef MAINPROGRAM 226 int REV_LB[MAX_LB] = { 227 LB_N_FRAME, LB_FRAME, LB_N_INFO, LB_INFO, LB_N_SOURCE, 228 }; 229 #else /* not MAINPROGRAM */ 230 extern int REV_LB[]; 231 #endif /* not MAINPROGRAM */ 232 233 /* mark URL, Message-ID */ 234 #define CHK_URL 1 235 #define CHK_NMID 2 236 237 /* Flags for calcPosition() */ 238 #define CP_AUTO 0 239 #define CP_FORCE 1 240 241 /* Completion status. */ 242 #define CPL_OK 0 243 #define CPL_AMBIG 1 244 #define CPL_FAIL 2 245 #define CPL_MENU 3 246 247 #define CPL_NEVER 0x0 248 #define CPL_OFF 0x1 249 #define CPL_ON 0x2 250 #define CPL_ALWAYS 0x4 251 #define CPL_URL 0x8 252 253 /* Flags for inputLine() */ 254 #define IN_STRING 0x10 255 #define IN_FILENAME 0x20 256 #define IN_PASSWORD 0x40 257 #define IN_COMMAND 0x80 258 #define IN_URL 0x100 259 #define IN_CHAR 0x200 260 261 #define IMG_FLAG_SKIP 1 262 #define IMG_FLAG_AUTO 2 263 264 #define IMG_FLAG_START 0 265 #define IMG_FLAG_STOP 1 266 #define IMG_FLAG_NEXT 2 267 268 #define IMG_FLAG_UNLOADED 0 269 #define IMG_FLAG_LOADED 1 270 #define IMG_FLAG_ERROR 2 271 #define IMG_FLAG_DONT_REMOVE 4 272 273 #define IS_EMPTY_PARSED_URL(pu) ((pu)->scheme == SCM_UNKNOWN && !(pu)->file) 274 #define SCONF_RESERVED 0 275 #define SCONF_SUBSTITUTE_URL 1 276 #define SCONF_URL_CHARSET 2 277 #define SCONF_NO_REFERER_FROM 3 278 #define SCONF_NO_REFERER_TO 4 279 #define SCONF_USER_AGENT 5 280 #define SCONF_N_FIELD 6 281 #define query_SCONF_SUBSTITUTE_URL(pu) ((const char *)querySiteconf(pu, SCONF_SUBSTITUTE_URL)) 282 #define query_SCONF_USER_AGENT(pu) ((const char *)querySiteconf(pu, SCONF_USER_AGENT)) 283 #define query_SCONF_URL_CHARSET(pu) ((const wc_ces *)querySiteconf(pu, SCONF_URL_CHARSET)) 284 #define query_SCONF_NO_REFERER_FROM(pu) ((const int *)querySiteconf(pu, SCONF_NO_REFERER_FROM)) 285 #define query_SCONF_NO_REFERER_TO(pu) ((const int *)querySiteconf(pu, SCONF_NO_REFERER_TO)) 286 287 /* 288 * Macros. 289 */ 290 291 #define inputLineHist(p,d,f,h) inputLineHistSearch(p,d,f,h,NULL) 292 #define inputLine(p,d,f) inputLineHist(p,d,f,NULL) 293 #define inputStr(p,d) inputLine(p,d,IN_STRING) 294 #define inputStrHist(p,d,h) inputLineHist(p,d,IN_STRING,h) 295 #define inputFilename(p,d) inputLine(p,d,IN_FILENAME) 296 #define inputFilenameHist(p,d,h) inputLineHist(p,d,IN_FILENAME,h) 297 #define inputChar(p) inputLine(p,"",IN_CHAR) 298 299 #ifdef __EMX__ 300 #define HAVE_STRCASECMP 301 #define strcasecmp stricmp 302 #define strncasecmp strnicmp 303 #endif /* __EMX__ */ 304 305 306 #define SKIP_BLANKS(p) {while(*(p)&&IS_SPACE(*(p)))(p)++;} 307 #define SKIP_NON_BLANKS(p) {while(*(p)&&!IS_SPACE(*(p)))(p)++;} 308 #define IS_ENDL(c) ((c)=='\0'||(c)=='\r'||(c)=='\n') 309 #define IS_ENDT(c) (IS_ENDL(c)||(c)==';') 310 311 #define bpcmp(a,b) \ 312 (((a).line - (b).line) ? ((a).line - (b).line) : ((a).pos - (b).pos)) 313 314 #define RELATIVE_WIDTH(w) (((w)>=0)?(int)((w)/pixel_per_char):(w)) 315 #define REAL_WIDTH(w,limit) (((w)>=0)?(int)((w)/pixel_per_char):-(w)*(limit)/100) 316 317 #define EOL(l) (&(l)->ptr[(l)->length]) 318 #define IS_EOL(p,l) ((p)==&(l)->ptr[(l)->length]) 319 320 #define INLINE_IMG_NONE 0 321 #define INLINE_IMG_OSC5379 1 322 #define INLINE_IMG_SIXEL 2 323 #define INLINE_IMG_ITERM2 3 324 #define INLINE_IMG_KITTY 4 325 326 /* 327 * Types. 328 */ 329 330 typedef unsigned short Lineprop; 331 #ifdef USE_ANSI_COLOR 332 typedef unsigned char Linecolor; 333 #endif 334 335 typedef struct _MapArea { 336 char *url; 337 char *target; 338 char *alt; 339 #ifdef USE_IMAGE 340 char shape; 341 short *coords; 342 int ncoords; 343 short center_x; 344 short center_y; 345 #endif 346 } MapArea; 347 348 typedef struct _MapList { 349 Str name; 350 GeneralList *area; 351 struct _MapList *next; 352 } MapList; 353 354 typedef struct _Line { 355 char *lineBuf; 356 Lineprop *propBuf; 357 #ifdef USE_ANSI_COLOR 358 Linecolor *colorBuf; 359 #endif 360 struct _Line *next; 361 struct _Line *prev; 362 int len; 363 int width; 364 long linenumber; /* on buffer */ 365 long real_linenumber; /* on file */ 366 unsigned short usrflags; 367 int size; 368 int bpos; 369 int bwidth; 370 } Line; 371 372 typedef struct { 373 int line; 374 int pos; 375 int invalid; 376 } BufferPoint; 377 378 #ifdef USE_IMAGE 379 typedef struct _imageCache { 380 char *url; 381 ParsedURL *current; 382 char *file; 383 char *touch; 384 pid_t pid; 385 char loaded; 386 int index; 387 short width; 388 short height; 389 short a_width; 390 short a_height; 391 } ImageCache; 392 393 typedef struct _image { 394 char *url; 395 char *ext; 396 short width; 397 short height; 398 short xoffset; 399 short yoffset; 400 short y; 401 short rows; 402 char *map; 403 char ismap; 404 int touch; 405 ImageCache *cache; 406 } Image; 407 #endif 408 409 typedef struct _anchor { 410 char *url; 411 char *target; 412 char *referer; 413 char *title; 414 unsigned char accesskey; 415 BufferPoint start; 416 BufferPoint end; 417 int hseq; 418 char slave; 419 short y; 420 short rows; 421 #ifdef USE_IMAGE 422 Image *image; 423 #endif 424 } Anchor; 425 426 #define NO_REFERER ((char*)-1) 427 428 typedef struct _anchorList { 429 Anchor *anchors; 430 int nanchor; 431 int anchormax; 432 int acache; 433 } AnchorList; 434 435 typedef struct { 436 BufferPoint *marks; 437 int nmark; 438 int markmax; 439 int prevhseq; 440 } HmarkerList; 441 442 #define LINK_TYPE_NONE 0 443 #define LINK_TYPE_REL 1 444 #define LINK_TYPE_REV 2 445 typedef struct _LinkList { 446 char *url; 447 char *title; /* Next, Contents, ... */ 448 char *ctype; /* Content-Type */ 449 char type; /* Rel, Rev */ 450 struct _LinkList *next; 451 } LinkList; 452 453 typedef struct _Buffer { 454 char *filename; 455 char *buffername; 456 Line *firstLine; 457 Line *topLine; 458 Line *currentLine; 459 Line *lastLine; 460 struct _Buffer *nextBuffer; 461 struct _Buffer *linkBuffer[MAX_LB]; 462 short width; 463 short height; 464 char *type; 465 char *real_type; 466 int allLine; 467 short bufferprop; 468 int currentColumn; 469 short cursorX; 470 short cursorY; 471 int pos; 472 int visualpos; 473 short rootX; 474 short rootY; 475 short COLS; 476 short LINES; 477 InputStream pagerSource; 478 AnchorList *href; 479 AnchorList *name; 480 AnchorList *img; 481 AnchorList *formitem; 482 LinkList *linklist; 483 FormList *formlist; 484 MapList *maplist; 485 HmarkerList *hmarklist; 486 HmarkerList *imarklist; 487 ParsedURL currentURL; 488 ParsedURL *baseURL; 489 char *baseTarget; 490 int real_scheme; 491 char *sourcefile; 492 struct frameset *frameset; 493 struct frameset_queue *frameQ; 494 int *clone; 495 size_t trbyte; 496 char check_url; 497 #ifdef USE_M17N 498 wc_ces document_charset; 499 wc_uint8 auto_detect; 500 #endif 501 TextList *document_header; 502 FormItemList *form_submit; 503 char *savecache; 504 char *edit; 505 struct mailcap *mailcap; 506 char *mailcap_source; 507 char *header_source; 508 char search_header; 509 #ifdef USE_SSL 510 char *ssl_certificate; 511 #endif 512 char image_flag; 513 char image_loaded; 514 char need_reshape; 515 Anchor *submit; 516 struct _BufferPos *undo; 517 #ifdef USE_ALARM 518 struct _AlarmEvent *event; 519 #endif 520 } Buffer; 521 522 typedef struct _BufferPos { 523 long top_linenumber; 524 long cur_linenumber; 525 int currentColumn; 526 int pos; 527 int bpos; 528 struct _BufferPos *next; 529 struct _BufferPos *prev; 530 } BufferPos; 531 532 typedef struct _TabBuffer { 533 struct _TabBuffer *nextTab; 534 struct _TabBuffer *prevTab; 535 Buffer *currentBuffer; 536 Buffer *firstBuffer; 537 short x1; 538 short x2; 539 short y; 540 } TabBuffer; 541 542 typedef struct _DownloadList { 543 pid_t pid; 544 char *url; 545 char *save; 546 char *lock; 547 clen_t size; 548 time_t time; 549 int running; 550 int err; 551 struct _DownloadList *next; 552 struct _DownloadList *prev; 553 } DownloadList; 554 #define DOWNLOAD_LIST_TITLE "Download List Panel" 555 556 #define COPY_BUFROOT(dstbuf, srcbuf) {\ 557 (dstbuf)->rootX = (srcbuf)->rootX; \ 558 (dstbuf)->rootY = (srcbuf)->rootY; \ 559 (dstbuf)->COLS = (srcbuf)->COLS; \ 560 (dstbuf)->LINES = (srcbuf)->LINES; \ 561 } 562 563 #define COPY_BUFPOSITION(dstbuf, srcbuf) {\ 564 (dstbuf)->topLine = (srcbuf)->topLine; \ 565 (dstbuf)->currentLine = (srcbuf)->currentLine; \ 566 (dstbuf)->pos = (srcbuf)->pos; \ 567 (dstbuf)->cursorX = (srcbuf)->cursorX; \ 568 (dstbuf)->cursorY = (srcbuf)->cursorY; \ 569 (dstbuf)->visualpos = (srcbuf)->visualpos; \ 570 (dstbuf)->currentColumn = (srcbuf)->currentColumn; \ 571 } 572 #define SAVE_BUFPOSITION(sbufp) COPY_BUFPOSITION(sbufp, Currentbuf) 573 #define RESTORE_BUFPOSITION(sbufp) COPY_BUFPOSITION(Currentbuf, sbufp) 574 #define TOP_LINENUMBER(buf) ((buf)->topLine ? (buf)->topLine->linenumber : 1) 575 #define CUR_LINENUMBER(buf) ((buf)->currentLine ? (buf)->currentLine->linenumber : 1) 576 577 #define NO_BUFFER ((Buffer*)1) 578 579 #define RB_STACK_SIZE 10 580 581 #define TAG_STACK_SIZE 10 582 583 #define FONT_STACK_SIZE 5 584 585 #define FONTSTAT_SIZE 7 586 #define FONTSTAT_MAX 127 587 588 #define _INIT_BUFFER_WIDTH (COLS - (showLineNum ? 6 : 1)) 589 #define INIT_BUFFER_WIDTH ((_INIT_BUFFER_WIDTH > 0) ? _INIT_BUFFER_WIDTH : 0) 590 #define FOLD_BUFFER_WIDTH (FoldLine ? (INIT_BUFFER_WIDTH + 1) : -1) 591 592 struct input_alt_attr { 593 int hseq; 594 int fid; 595 int in; 596 Str type, name, value; 597 }; 598 599 typedef struct { 600 int pos; 601 int len; 602 int tlen; 603 long flag; 604 Anchor anchor; 605 Str img_alt; 606 struct input_alt_attr input_alt; 607 char fontstat[FONTSTAT_SIZE]; 608 short nobr_level; 609 Lineprop prev_ctype; 610 char init_flag; 611 short top_margin; 612 short bottom_margin; 613 } Breakpoint; 614 615 struct readbuffer { 616 Str line; 617 Lineprop cprop; 618 short pos; 619 Str prevchar; 620 long flag; 621 long flag_stack[RB_STACK_SIZE]; 622 int flag_sp; 623 int status; 624 unsigned char end_tag; 625 unsigned char q_level; 626 short table_level; 627 short nobr_level; 628 Anchor anchor; 629 Str img_alt; 630 struct input_alt_attr input_alt; 631 char fontstat[FONTSTAT_SIZE]; 632 char fontstat_stack[FONT_STACK_SIZE][FONTSTAT_SIZE]; 633 int fontstat_sp; 634 Lineprop prev_ctype; 635 Breakpoint bp; 636 struct cmdtable *tag_stack[TAG_STACK_SIZE]; 637 int tag_sp; 638 short top_margin; 639 short bottom_margin; 640 }; 641 642 #define in_bold fontstat[0] 643 #define in_under fontstat[1] 644 #define in_italic fontstat[2] 645 #define in_strike fontstat[3] 646 #define in_ins fontstat[4] 647 #define in_stand fontstat[5] 648 649 #define RB_PRE 0x01 650 #define RB_SCRIPT 0x02 651 #define RB_STYLE 0x04 652 #define RB_PLAIN 0x08 653 #define RB_LEFT 0x10 654 #define RB_CENTER 0x20 655 #define RB_RIGHT 0x40 656 #define RB_ALIGN (RB_LEFT| RB_CENTER | RB_RIGHT) 657 #define RB_NOBR 0x80 658 #define RB_P 0x100 659 #define RB_PRE_INT 0x200 660 #define RB_IN_DT 0x400 661 #define RB_INTXTA 0x800 662 #define RB_INSELECT 0x1000 663 #define RB_IGNORE_P 0x2000 664 #define RB_TITLE 0x4000 665 #define RB_NFLUSHED 0x8000 666 #define RB_NOFRAMES 0x10000 667 #define RB_INTABLE 0x20000 668 #define RB_PREMODE (RB_PRE | RB_PRE_INT | RB_SCRIPT | RB_STYLE | RB_PLAIN | RB_INTXTA) 669 #define RB_SPECIAL (RB_PRE | RB_PRE_INT | RB_SCRIPT | RB_STYLE | RB_PLAIN | RB_NOBR) 670 #define RB_PLAIN_PRE 0x40000 671 672 #ifdef FORMAT_NICE 673 #define RB_FILL 0x80000 674 #endif /* FORMAT_NICE */ 675 #define RB_DEL 0x100000 676 #define RB_S 0x200000 677 #define RB_HTML5 0x400000 678 679 #define RB_GET_ALIGN(obuf) ((obuf)->flag&RB_ALIGN) 680 #define RB_SET_ALIGN(obuf,align) do{(obuf)->flag &= ~RB_ALIGN; (obuf)->flag |= (align); }while(0) 681 #define RB_SAVE_FLAG(obuf) {\ 682 if ((obuf)->flag_sp < RB_STACK_SIZE) \ 683 (obuf)->flag_stack[(obuf)->flag_sp++] = RB_GET_ALIGN(obuf); \ 684 } 685 #define RB_RESTORE_FLAG(obuf) {\ 686 if ((obuf)->flag_sp > 0) \ 687 RB_SET_ALIGN(obuf,(obuf)->flag_stack[--(obuf)->flag_sp]); \ 688 } 689 690 /* state of token scanning finite state machine */ 691 #define R_ST_NORMAL 0 /* normal */ 692 #define R_ST_TAG0 1 /* within tag, just after < */ 693 #define R_ST_TAG 2 /* within tag */ 694 #define R_ST_QUOTE 3 /* within single quote */ 695 #define R_ST_DQUOTE 4 /* within double quote */ 696 #define R_ST_EQL 5 /* = */ 697 #define R_ST_AMP 6 /* within ampersand quote */ 698 #define R_ST_EOL 7 /* end of file */ 699 #define R_ST_CMNT1 8 /* <! */ 700 #define R_ST_CMNT2 9 /* <!- */ 701 #define R_ST_CMNT 10 /* within comment */ 702 #define R_ST_NCMNT1 11 /* comment - */ 703 #define R_ST_NCMNT2 12 /* comment -- */ 704 #define R_ST_NCMNT3 13 /* comment -- space */ 705 #define R_ST_IRRTAG 14 /* within irregular tag */ 706 #define R_ST_VALUE 15 /* within tag attribule value */ 707 708 #define ST_IS_REAL_TAG(s) ((s)==R_ST_TAG||(s)==R_ST_TAG0||(s)==R_ST_EQL||(s)==R_ST_VALUE) 709 710 /* is this '<' really means the beginning of a tag? */ 711 #define REALLY_THE_BEGINNING_OF_A_TAG(p) \ 712 (IS_ALPHA(p[1]) || p[1] == '/' || p[1] == '!' || p[1] == '?' || p[1] == '\0' || p[1] == '_') 713 714 /* flags for loadGeneralFile */ 715 #define RG_NOCACHE 1 716 #define RG_FRAME 2 717 #define RG_FRAME_SRC 4 718 719 struct html_feed_environ { 720 struct readbuffer *obuf; 721 TextLineList *buf; 722 FILE *f; 723 Str tagbuf; 724 int limit; 725 int maxlimit; 726 struct environment *envs; 727 int nenv; 728 int envc; 729 int envc_real; 730 char *title; 731 int blank_lines; 732 }; 733 734 #ifdef USE_COOKIE 735 struct portlist { 736 unsigned short port; 737 struct portlist *next; 738 }; 739 740 struct cookie { 741 ParsedURL url; 742 Str name; 743 Str value; 744 time_t expires; 745 Str path; 746 Str domain; 747 Str comment; 748 Str commentURL; 749 struct portlist *portl; 750 char version; 751 char flag; 752 struct cookie *next; 753 }; 754 #define COO_USE 1 755 #define COO_SECURE 2 756 #define COO_DOMAIN 4 757 #define COO_PATH 8 758 #define COO_DISCARD 16 759 #define COO_OVERRIDE 32 /* user chose to override security checks */ 760 761 #define COO_OVERRIDE_OK 32 /* flag to specify that an error is overridable */ 762 /* version 0 refers to the original cookie_spec.html */ 763 /* version 1 refers to RFC 2109 */ 764 /* version 1' refers to the Internet draft to obsolete RFC 2109 */ 765 #define COO_EINTERNAL (1) /* unknown error; probably forgot to convert "return 1" in cookie.c */ 766 #define COO_ETAIL (2 | COO_OVERRIDE_OK) /* tail match failed (version 0) */ 767 #define COO_ESPECIAL (3) /* special domain check failed (version 0) */ 768 #define COO_EPATH (4) /* Path attribute mismatch (version 1 case 1) */ 769 #define COO_ENODOT (5 | COO_OVERRIDE_OK) /* no embedded dots in Domain (version 1 case 2.1) */ 770 #define COO_ENOTV1DOM (6 | COO_OVERRIDE_OK) /* Domain does not start with a dot (version 1 case 2.2) */ 771 #define COO_EDOM (7 | COO_OVERRIDE_OK) /* domain-match failed (version 1 case 3) */ 772 #define COO_EBADHOST (8 | COO_OVERRIDE_OK) /* dot in matched host name in FQDN (version 1 case 4) */ 773 #define COO_EPORT (9) /* Port match failed (version 1' case 5) */ 774 #define COO_EMAX COO_EPORT 775 #endif /* USE_COOKIE */ 776 777 /* modes for align() */ 778 779 #define ALIGN_CENTER 0 780 #define ALIGN_LEFT 1 781 #define ALIGN_RIGHT 2 782 #define ALIGN_MIDDLE 4 783 #define ALIGN_TOP 5 784 #define ALIGN_BOTTOM 6 785 786 #define VALIGN_MIDDLE 0 787 #define VALIGN_TOP 1 788 #define VALIGN_BOTTOM 2 789 790 typedef struct http_request { 791 char command; 792 char flag; 793 char *referer; 794 FormList *request; 795 } HRequest; 796 797 #define HR_COMMAND_GET 0 798 #define HR_COMMAND_POST 1 799 #define HR_COMMAND_CONNECT 2 800 #define HR_COMMAND_HEAD 3 801 802 #define HR_FLAG_LOCAL 1 803 #define HR_FLAG_PROXY 2 804 805 #define HTST_UNKNOWN 255 806 #define HTST_MISSING 254 807 #define HTST_NORMAL 0 808 #define HTST_CONNECT 1 809 810 #define TMPF_DFL 0 811 #define TMPF_SRC 1 812 #define TMPF_FRAME 2 813 #define TMPF_CACHE 3 814 #define TMPF_COOKIE 4 815 #define MAX_TMPF_TYPE 5 816 817 #define set_no_proxy(domains) (NO_proxy_domains=make_domain_list(domains)) 818 819 /* 820 * Globals. 821 */ 822 823 extern int LINES, COLS; 824 #if defined(__CYGWIN__) 825 extern int LASTLINE; 826 #else /* not defined(__CYGWIN__) */ 827 #define LASTLINE (LINES-1) 828 #endif /* not defined(__CYGWIN__) */ 829 830 global int Tabstop init(8); 831 global int IndentIncr init(4); 832 global int ShowEffect init(TRUE); 833 global int PagerMax init(PAGER_MAX_LINE); 834 835 global char SearchHeader init(FALSE); 836 global char *DefaultType init(NULL); 837 global char RenderFrame init(FALSE); 838 global char TargetSelf init(FALSE); 839 global char PermitSaveToPipe init(FALSE); 840 global char DecodeCTE init(FALSE); 841 global char AutoUncompress init(FALSE); 842 global char PreserveTimestamp init(TRUE); 843 global char ArgvIsURL init(TRUE); 844 global char MetaRefresh init(FALSE); 845 global char LocalhostOnly init(FALSE); 846 global char* HostName init(NULL); 847 848 global char fmInitialized init(FALSE); 849 global char QuietMessage init(FALSE); 850 global char TrapSignal init(TRUE); 851 #define TRAP_ON if (TrapSignal) { \ 852 prevtrap = mySignal(SIGINT, KeyAbort); \ 853 if (fmInitialized) \ 854 term_cbreak(); \ 855 } 856 #define TRAP_OFF if (TrapSignal) { \ 857 if (fmInitialized) \ 858 term_raw(); \ 859 if (prevtrap) \ 860 mySignal(SIGINT, prevtrap); \ 861 } 862 863 extern unsigned char GlobalKeymap[]; 864 extern unsigned char EscKeymap[]; 865 extern unsigned char EscBKeymap[]; 866 extern unsigned char EscDKeymap[]; 867 #ifdef __EMX__ 868 extern unsigned char PcKeymap[]; 869 #endif 870 extern FuncList w3mFuncList[]; 871 872 global char *HTTP_proxy init(NULL); 873 #ifdef USE_SSL 874 global char *HTTPS_proxy init(NULL); 875 #endif /* USE_SSL */ 876 #ifdef USE_GOPHER 877 global char *GOPHER_proxy init(NULL); 878 #endif /* USE_GOPHER */ 879 global char *FTP_proxy init(NULL); 880 global ParsedURL HTTP_proxy_parsed; 881 #ifdef USE_SSL 882 global ParsedURL HTTPS_proxy_parsed; 883 #endif /* USE_SSL */ 884 #ifdef USE_GOPHER 885 global ParsedURL GOPHER_proxy_parsed; 886 #endif /* USE_GOPHER */ 887 global ParsedURL FTP_proxy_parsed; 888 global char *NO_proxy init(NULL); 889 global int NOproxy_netaddr init(TRUE); 890 #ifdef INET6 891 #define DNS_ORDER_UNSPEC 0 892 #define DNS_ORDER_INET_INET6 1 893 #define DNS_ORDER_INET6_INET 2 894 #define DNS_ORDER_INET_ONLY 4 895 #define DNS_ORDER_INET6_ONLY 6 896 global int DNS_order init(DNS_ORDER_UNSPEC); 897 extern int ai_family_order_table[7][3]; /* XXX */ 898 #endif /* INET6 */ 899 global TextList *NO_proxy_domains; 900 global char NoCache init(FALSE); 901 global char use_proxy init(TRUE); 902 #define Do_not_use_proxy (!use_proxy) 903 global int Do_not_use_ti_te init(FALSE); 904 #ifdef USE_NNTP 905 global char *NNTP_server init(NULL); 906 global char *NNTP_mode init(NULL); 907 global int MaxNewsMessage init(50); 908 #endif 909 910 global char *document_root init(NULL); 911 global char *personal_document_root init(NULL); 912 global char *cgi_bin init(NULL); 913 global char *index_file init(NULL); 914 915 global char *CurrentDir; 916 global int CurrentPid; 917 #if defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) 918 global char *MyProgramName init("w3m"); 919 #endif /* defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) */ 920 /* 921 * global Buffer *Currentbuf; 922 * global Buffer *Firstbuf; 923 */ 924 global TabBuffer *CurrentTab; 925 global TabBuffer *FirstTab; 926 global TabBuffer *LastTab; 927 global int open_tab_blank init(FALSE); 928 global int open_tab_dl_list init(FALSE); 929 global int close_tab_back init(FALSE); 930 global int nTab; 931 global int TabCols init(10); 932 #define NO_TABBUFFER ((TabBuffer *)1) 933 #define Currentbuf (CurrentTab->currentBuffer) 934 #define Firstbuf (CurrentTab->firstBuffer) 935 global DownloadList *FirstDL init(NULL); 936 global DownloadList *LastDL init(NULL); 937 global int CurrentKey; 938 global char *CurrentKeyData; 939 global char *CurrentCmdData; 940 global char *w3m_reqlog; 941 extern char *w3m_version; 942 extern int enable_inline_image; 943 944 #define DUMP_BUFFER 0x01 945 #define DUMP_HEAD 0x02 946 #define DUMP_SOURCE 0x04 947 #define DUMP_EXTRA 0x08 948 #define DUMP_HALFDUMP 0x10 949 #define DUMP_FRAME 0x20 950 global int w3m_debug; 951 global int w3m_dump init(0); 952 #define w3m_halfdump (w3m_dump & DUMP_HALFDUMP) 953 global int w3m_halfload init(FALSE); 954 global Str header_string init(NULL); 955 global int override_content_type init(FALSE); 956 global int override_user_agent init(FALSE); 957 958 #ifdef USE_COLOR 959 global int useColor init(TRUE); 960 global int basic_color init(8); /* don't change */ 961 global int anchor_color init(4); /* blue */ 962 global int image_color init(2); /* green */ 963 global int form_color init(1); /* red */ 964 #ifdef USE_BG_COLOR 965 global int bg_color init(8); /* don't change */ 966 global int mark_color init(6); /* cyan */ 967 #endif /* USE_BG_COLOR */ 968 global int useActiveColor init(FALSE); 969 global int active_color init(6); /* cyan */ 970 global int useVisitedColor init(FALSE); 971 global int visited_color init(5); /* magenta */ 972 #endif /* USE_COLOR */ 973 global int confirm_on_quit init(TRUE); 974 #ifdef USE_MARK 975 global int use_mark init(FALSE); 976 #endif 977 global int emacs_like_lineedit init(FALSE); 978 global int space_autocomplete init(FALSE); 979 global int vi_prec_num init(FALSE); 980 global int label_topline init(FALSE); 981 global int nextpage_topline init(FALSE); 982 global char *displayTitleTerm init(NULL); 983 global int displayLink init(FALSE); 984 global int displayLinkNumber init(FALSE); 985 global int displayLineInfo init(FALSE); 986 global int DecodeURL init(FALSE); 987 global int retryAsHttp init(TRUE); 988 global int showLineNum init(FALSE); 989 global int show_srch_str init(TRUE); 990 #ifdef USE_IMAGE 991 global char *Imgdisplay init(IMGDISPLAY); 992 global int activeImage init(FALSE); 993 global int displayImage init(TRUE); 994 global int autoImage init(TRUE); 995 global int useExtImageViewer init(TRUE); 996 global int maxLoadImage init(4); 997 global int image_map_list init(TRUE); 998 #else 999 global int displayImage init(FALSE); /* XXX: emacs-w3m use display_image=off */ 1000 #endif 1001 global int pseudoInlines init(TRUE); 1002 global char *Editor init(DEF_EDITOR); 1003 #ifdef USE_W3MMAILER 1004 global char *Mailer init(NULL); 1005 #else 1006 global char *Mailer init(DEF_MAILER); 1007 #endif 1008 #ifdef USE_W3MMAILER 1009 #define MAILTO_OPTIONS_USE_W3MMAILER 0 1010 #endif 1011 #define MAILTO_OPTIONS_IGNORE 1 1012 #define MAILTO_OPTIONS_USE_MAILTO_URL 2 1013 global int MailtoOptions init(MAILTO_OPTIONS_IGNORE); 1014 global char *ExtBrowser init(DEF_EXT_BROWSER); 1015 global char *ExtBrowser2 init(NULL); 1016 global char *ExtBrowser3 init(NULL); 1017 global char *ExtBrowser4 init(NULL); 1018 global char *ExtBrowser5 init(NULL); 1019 global char *ExtBrowser6 init(NULL); 1020 global char *ExtBrowser7 init(NULL); 1021 global char *ExtBrowser8 init(NULL); 1022 global char *ExtBrowser9 init(NULL); 1023 global int BackgroundExtViewer init(TRUE); 1024 global int disable_secret_security_check init(FALSE); 1025 global char *passwd_file init(PASSWD_FILE); 1026 global char *pre_form_file init(PRE_FORM_FILE); 1027 global char *siteconf_file init(SITECONF_FILE); 1028 global char *ftppasswd init(NULL); 1029 global int ftppass_hostnamegen init(TRUE); 1030 global int do_download init(FALSE); 1031 #ifdef USE_IMAGE 1032 global char *image_source init(NULL); 1033 #endif 1034 global char *UserAgent init(NULL); 1035 global int NoSendReferer init(FALSE); 1036 global int CrossOriginReferer init(TRUE); 1037 global char *AcceptLang init(NULL); 1038 global char *AcceptEncoding init(NULL); 1039 global char *AcceptMedia init(NULL); 1040 global int WrapDefault init(FALSE); 1041 global int IgnoreCase init(TRUE); 1042 global int WrapSearch init(FALSE); 1043 global int squeezeBlankLine init(FALSE); 1044 global char *BookmarkFile init(NULL); 1045 global int UseExternalDirBuffer init(TRUE); 1046 global char *DirBufferCommand init("file:///$LIB/dirlist" CGI_EXTENSION); 1047 #ifdef USE_DICT 1048 global int UseDictCommand init(TRUE); 1049 global char *DictCommand init("file:///$LIB/w3mdict" CGI_EXTENSION); 1050 #endif /* USE_DICT */ 1051 global int ignore_null_img_alt init(TRUE); 1052 #define DISPLAY_INS_DEL_SIMPLE 0 1053 #define DISPLAY_INS_DEL_NORMAL 1 1054 #define DISPLAY_INS_DEL_FONTIFY 2 1055 global int displayInsDel init(DISPLAY_INS_DEL_NORMAL); 1056 global int FoldTextarea init(FALSE); 1057 global int FoldLine init(FALSE); 1058 #define DEFAULT_URL_EMPTY 0 1059 #define DEFAULT_URL_CURRENT 1 1060 #define DEFAULT_URL_LINK 2 1061 global int DefaultURLString init(DEFAULT_URL_CURRENT); 1062 global int MarkAllPages init(FALSE); 1063 1064 #ifdef USE_MIGEMO 1065 global int use_migemo init(FALSE); 1066 global int migemo_active init(0); 1067 global char *migemo_command init(DEF_MIGEMO_COMMAND); 1068 #endif /* USE_MIGEMO */ 1069 1070 global struct auth_cookie *Auth_cookie init(NULL); 1071 #ifdef USE_COOKIE 1072 global struct cookie *First_cookie init(NULL); 1073 #endif /* USE_COOKIE */ 1074 1075 global char *mailcap_files init(USER_MAILCAP ", " SYS_MAILCAP); 1076 global char *mimetypes_files init(USER_MIMETYPES ", " SYS_MIMETYPES); 1077 #ifdef USE_EXTERNAL_URI_LOADER 1078 global char *urimethodmap_files init(USER_URIMETHODMAP ", " SYS_URIMETHODMAP); 1079 #endif 1080 1081 global TextList *fileToDelete; 1082 1083 extern Hist *LoadHist; 1084 extern Hist *SaveHist; 1085 extern Hist *URLHist; 1086 extern Hist *ShellHist; 1087 extern Hist *TextHist; 1088 #ifdef USE_HISTORY 1089 global int UseHistory init(TRUE); 1090 global int URLHistSize init(100); 1091 global int SaveURLHist init(TRUE); 1092 #endif /* USE_HISTORY */ 1093 global int multicolList init(FALSE); 1094 1095 #ifdef USE_M17N 1096 global wc_ces InnerCharset init(WC_CES_WTF); /* Don't change */ 1097 global wc_ces DisplayCharset init(DISPLAY_CHARSET); 1098 global wc_ces DocumentCharset init(DOCUMENT_CHARSET); 1099 global wc_ces SystemCharset init(SYSTEM_CHARSET); 1100 global wc_ces BookmarkCharset init(SYSTEM_CHARSET); 1101 global char ExtHalfdump init(FALSE); 1102 global char FollowLocale init(TRUE); 1103 global char UseContentCharset init(TRUE); 1104 global char SearchConv init(TRUE); 1105 global char SimplePreserveSpace init(FALSE); 1106 #define Str_conv_from_system(x) wc_Str_conv((x), SystemCharset, InnerCharset) 1107 #define Str_conv_to_system(x) wc_Str_conv_strict((x), InnerCharset, SystemCharset) 1108 #define Str_conv_to_halfdump(x) (ExtHalfdump ? wc_Str_conv((x), InnerCharset, DisplayCharset) : (x)) 1109 #define conv_from_system(x) wc_conv((x), SystemCharset, InnerCharset)->ptr 1110 #define conv_to_system(x) wc_conv_strict((x), InnerCharset, SystemCharset)->ptr 1111 #define url_quote_conv(x,c) url_quote(wc_conv_strict((x), InnerCharset, (c))->ptr) 1112 #else 1113 #define Str_conv_from_system(x) (x) 1114 #define Str_conv_to_system(x) (x) 1115 #define Str_conv_to_halfdump(x) (x) 1116 #define conv_from_system(x) (x) 1117 #define conv_to_system(x) (x) 1118 #define url_quote_conv(x,c) url_quote(x) 1119 #define wc_Str_conv(x,charset0,charset1) (x) 1120 #define wc_Str_conv_strict(x,charset0,charset1) (x) 1121 #endif 1122 global char UseAltEntity init(FALSE); 1123 #define GRAPHIC_CHAR_ASCII 2 1124 #define GRAPHIC_CHAR_DEC 1 1125 #define GRAPHIC_CHAR_CHARSET 0 1126 global char UseGraphicChar init(GRAPHIC_CHAR_CHARSET); 1127 global char DisplayBorders init(FALSE); 1128 global char DisableCenter init(FALSE); 1129 extern char *graph_symbol[]; 1130 extern char *graph2_symbol[]; 1131 extern int symbol_width; 1132 extern int symbol_width0; 1133 #define N_GRAPH_SYMBOL 32 1134 #define N_SYMBOL (N_GRAPH_SYMBOL + 14) 1135 #define SYMBOL_BASE 0x20 1136 global int no_rc_dir init(FALSE); 1137 global char *rc_dir init(NULL); 1138 global char *tmp_dir; 1139 global char *config_file init(NULL); 1140 1141 #ifdef USE_MOUSE 1142 global int use_mouse init(TRUE); 1143 extern int mouseActive; 1144 global int reverse_mouse init(FALSE); 1145 global int relative_wheel_scroll init(FALSE); 1146 global int fixed_wheel_scroll_count init(5); 1147 global int relative_wheel_scroll_ratio init(30); 1148 typedef struct _MouseActionMap { 1149 void (*func) (); 1150 char *data; 1151 } MouseActionMap; 1152 typedef struct _MouseAction { 1153 char *menu_str; 1154 char *lastline_str; 1155 int menu_width; 1156 int lastline_width; 1157 int in_action; 1158 int cursorX; 1159 int cursorY; 1160 MouseActionMap default_map[3]; 1161 MouseActionMap anchor_map[3]; 1162 MouseActionMap active_map[3]; 1163 MouseActionMap tab_map[3]; 1164 MouseActionMap *menu_map[3]; 1165 MouseActionMap *lastline_map[3]; 1166 } MouseAction; 1167 global MouseAction mouse_action; 1168 #define LIMIT_MOUSE_MENU 100 1169 #endif /* USE_MOUSE */ 1170 1171 #ifdef USE_COOKIE 1172 global int default_use_cookie init(TRUE); 1173 global int use_cookie init(TRUE); 1174 global int show_cookie init(FALSE); 1175 global int accept_cookie init(TRUE); 1176 #define ACCEPT_BAD_COOKIE_DISCARD 0 1177 #define ACCEPT_BAD_COOKIE_ACCEPT 1 1178 #define ACCEPT_BAD_COOKIE_ASK 2 1179 global int accept_bad_cookie init(ACCEPT_BAD_COOKIE_DISCARD); 1180 global char *cookie_reject_domains init(NULL); 1181 global char *cookie_accept_domains init(NULL); 1182 global char *cookie_avoid_wrong_number_of_dots init(NULL); 1183 global TextList *Cookie_reject_domains; 1184 global TextList *Cookie_accept_domains; 1185 global TextList *Cookie_avoid_wrong_number_of_dots_domains; 1186 #endif /* USE_COOKIE */ 1187 1188 #ifdef USE_IMAGE 1189 global int view_unseenobject init(FALSE); 1190 #else 1191 global int view_unseenobject init(TRUE); 1192 #endif 1193 1194 #if defined(USE_SSL) && defined(USE_SSL_VERIFY) 1195 global int ssl_verify_server init(TRUE); 1196 global char *ssl_cert_file init(NULL); 1197 global char *ssl_key_file init(NULL); 1198 global char *ssl_ca_path init(NULL); 1199 global char *ssl_ca_file init(DEF_CAFILE); 1200 global int ssl_ca_default init(TRUE); 1201 global int ssl_path_modified init(FALSE); 1202 #endif /* defined(USE_SSL) && 1203 * defined(USE_SSL_VERIFY) */ 1204 #ifdef USE_SSL 1205 global char *ssl_forbid_method init("2, 3, t, 5"); 1206 #ifdef SSL_CTX_set_min_proto_version 1207 global char *ssl_min_version init(NULL); 1208 #endif 1209 #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) 1210 global char *ssl_cipher init("DEFAULT:!LOW:!RC4:!EXP"); 1211 #else 1212 global char *ssl_cipher init(NULL); 1213 #endif 1214 #endif /* USE_SSL */ 1215 1216 global int is_redisplay init(FALSE); 1217 global int clear_buffer init(TRUE); 1218 global double pixel_per_char init(DEFAULT_PIXEL_PER_CHAR); 1219 global int pixel_per_char_i init(DEFAULT_PIXEL_PER_CHAR); 1220 global int set_pixel_per_char init(FALSE); 1221 #ifdef USE_IMAGE 1222 global double pixel_per_line init(DEFAULT_PIXEL_PER_LINE); 1223 global int pixel_per_line_i init(DEFAULT_PIXEL_PER_LINE); 1224 global int set_pixel_per_line init(FALSE); 1225 global double image_scale init(100); 1226 #endif 1227 global int use_lessopen init(FALSE); 1228 1229 global char *keymap_file init(KEYMAP_FILE); 1230 1231 #ifdef USE_M17N 1232 #define get_mctype(c) ((Lineprop)wtf_type((wc_uchar *)(c)) << 8) 1233 #define get_mclen(c) wtf_len1((wc_uchar *)(c)) 1234 #define get_mcwidth(c) wtf_width((wc_uchar *)(c)) 1235 #define get_strwidth(c) wtf_strwidth((wc_uchar *)(c)) 1236 #define get_Str_strwidth(c) wtf_strwidth((wc_uchar *)((c)->ptr)) 1237 #else 1238 #define get_mctype(c) (IS_CNTRL(*(c)) ? PC_CTRL : PC_ASCII) 1239 #define get_mclen(c) 1 1240 #define get_mcwidth(c) 1 1241 #define get_strwidth(c) strlen(c) 1242 #define get_Str_strwidth(c) ((c)->length) 1243 #endif 1244 1245 global int FollowRedirection init(10); 1246 1247 global int w3m_backend init(FALSE); 1248 global TextLineList *backend_halfdump_buf; 1249 global TextList *backend_batch_commands init(NULL); 1250 int backend(void); 1251 extern void deleteFiles(void); 1252 void w3m_exit(int i); 1253 1254 #ifdef USE_ALARM 1255 #define AL_UNSET 0 1256 #define AL_EXPLICIT 1 1257 #define AL_IMPLICIT 2 1258 #define AL_IMPLICIT_ONCE 3 1259 1260 typedef struct _AlarmEvent { 1261 int sec; 1262 short status; 1263 int cmd; 1264 void *data; 1265 } AlarmEvent; 1266 #endif 1267 1268 /* 1269 * Externals 1270 */ 1271 1272 #include "table.h" 1273 #include "proto.h" 1274 1275 #endif /* not FM_H */ 1276