diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2000-02-15 04:10:19 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2000-02-15 04:10:19 -0500 |
commit | 383b3f2ddbc1e2b64996958c1d9d944979fd190b (patch) | |
tree | 5c448e24f1b69593713b31529d1bdedf39a22a9d /src | |
parent | d61bc4e56055c372ab0b8d027f376c2f4a2ecfff (diff) | |
download | lynx-snapshots-383b3f2ddbc1e2b64996958c1d9d944979fd190b.tar.gz |
snapshot of project "lynx", label v2-8-3dev_19
Diffstat (limited to 'src')
-rw-r--r-- | src/GridText.c | 358 | ||||
-rw-r--r-- | src/GridText.h | 9 | ||||
-rw-r--r-- | src/HTFWriter.c | 1 | ||||
-rw-r--r-- | src/HTInit.c | 20 | ||||
-rw-r--r-- | src/HTML.c | 87 | ||||
-rw-r--r-- | src/LYCgi.c | 8 | ||||
-rw-r--r-- | src/LYCharUtils.c | 10 | ||||
-rw-r--r-- | src/LYCurses.c | 13 | ||||
-rw-r--r-- | src/LYCurses.h | 8 | ||||
-rw-r--r-- | src/LYDownload.c | 5 | ||||
-rw-r--r-- | src/LYEdit.c | 10 | ||||
-rw-r--r-- | src/LYExtern.c | 26 | ||||
-rw-r--r-- | src/LYExtern.h | 4 | ||||
-rw-r--r-- | src/LYForms.c | 92 | ||||
-rw-r--r-- | src/LYGetFile.c | 17 | ||||
-rw-r--r-- | src/LYGlobalDefs.h | 30 | ||||
-rw-r--r-- | src/LYHistory.c | 48 | ||||
-rw-r--r-- | src/LYJustify.h | 2 | ||||
-rw-r--r-- | src/LYKeymap.c | 10 | ||||
-rw-r--r-- | src/LYKeymap.h | 5 | ||||
-rw-r--r-- | src/LYLocal.h | 44 | ||||
-rw-r--r-- | src/LYMail.c | 290 | ||||
-rw-r--r-- | src/LYMain.c | 7 | ||||
-rw-r--r-- | src/LYMainLoop.c | 74 | ||||
-rw-r--r-- | src/LYOptions.c | 240 | ||||
-rw-r--r-- | src/LYPrettySrc.c | 2 | ||||
-rw-r--r-- | src/LYPrint.c | 18 | ||||
-rw-r--r-- | src/LYStrings.c | 59 | ||||
-rw-r--r-- | src/LYUtils.c | 41 | ||||
-rw-r--r-- | src/LYUtils.h | 4 | ||||
-rw-r--r-- | src/LYexit.c | 4 | ||||
-rw-r--r-- | src/TRSTable.c | 20 | ||||
-rw-r--r-- | src/UCdomap.c | 6 | ||||
-rw-r--r-- | src/makefile.dos | 6 | ||||
-rw-r--r-- | src/makefile.dsl | 6 | ||||
-rw-r--r-- | src/makefile.wsl | 6 |
36 files changed, 901 insertions, 689 deletions
diff --git a/src/GridText.c b/src/GridText.c index 367b6280..2082036c 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -100,8 +100,10 @@ struct _HTStream { /* only know it as object */ extern BOOL HTPassHighCtrlRaw; extern HTCJKlang HTCJK; -#ifdef CJK_EX +#ifdef KANJI_CODE_OVERRIDE PUBLIC HTkcode last_kcode = NOKANJI; /* 1997/11/14 (Fri) 09:09:26 */ +#endif +#ifdef CJK_EX #define CHAR_WIDTH 6 #else #define CHAR_WIDTH 1 @@ -386,6 +388,16 @@ struct _HText { STable_info * stbl; HTkcode kcode; /* Kanji code? */ + HTkcode specified_kcode; /* Specified Kanji code */ +#ifdef USE_TH_JP_AUTO_DETECT + enum _detected_kcode { DET_SJIS, DET_EUC, DET_NOTYET, DET_MIXED } + detected_kcode; /* Detected Kanji code */ + enum _SJIS_status { SJIS_state_neutral, SJIS_state_in_kanji, + SJIS_state_has_bad_code } SJIS_status; + enum _EUC_status { EUC_state_neutral, EUC_state_in_kanji, + EUC_state_in_kana, EUC_state_has_bad_code } + EUC_status; +#endif enum grid_state { S_text, S_esc, S_dollar, S_paren, S_nonascii_text, S_dollar_paren, S_jisx0201_text } @@ -824,6 +836,12 @@ PUBLIC HText * HText_new ARGS1( HTMainAnchor = anchor; self->display_on_the_fly = 0; self->kcode = NOKANJI; + self->specified_kcode = NOKANJI; +#ifdef USE_TH_JP_AUTO_DETECT + self->detected_kcode = DET_NOTYET; + self->SJIS_status = SJIS_state_neutral; + self->EUC_status = EUC_state_neutral; +#endif self->state = S_text; self->kanji_buf = '\0'; self->in_sjis = 0; @@ -837,9 +855,8 @@ PUBLIC HText * HText_new ARGS1( /* * Check the kcode setting if the anchor has a charset element. - FM */ - if (anchor->charset) - HText_setKcode(self, anchor->charset, - HTAnchor_getUCInfoStage(anchor, UCT_STAGE_HTEXT)); + HText_setKcode(self, anchor->charset, + HTAnchor_getUCInfoStage(anchor, UCT_STAGE_HTEXT)); /* * Memory leak fixed. @@ -1293,6 +1310,7 @@ PRIVATE int display_line ARGS4( */ buffer[0] = '-'; } + /* FALLTHRU */ default: #ifndef USE_COLOR_STYLE @@ -1342,11 +1360,18 @@ PRIVATE int display_line ARGS4( buffer[1] = '\0'; data += utf_extra; utf_extra = 0; - } else if (HTCJK != NOCJK && !isascii((unsigned char)buffer[0])) { + } else if (HTCJK != NOCJK && !isascii((unsigned char)buffer[0]) +#ifndef CONV_JISX0201KANA_JISX0208KANA + && kanji_code != SJIS +#endif + ) { /* * For CJK strings, by Masanobu Kimura. */ + if (i >= LYcols) goto after_while; + buffer[1] = *data; + buffer[2] = '\0'; data++; i++; addstr(buffer); @@ -1379,6 +1404,7 @@ PRIVATE int display_line ARGS4( } /* end of switch */ } /* end of while */ +after_while: #if !defined(NCURSES_VERSION) if (text->has_utf8) { LYtouchline(scrline); @@ -1515,7 +1541,7 @@ PRIVATE void display_title ARGS1( } move(0, 0); clrtoeol(); -#if defined(CJK_EX) && defined(SH_EX) +#if defined(SH_EX) && defined(KANJI_CODE_OVERRIDE) addstr(str_kcode(last_kcode)); #endif if (text->top_of_screen > 0 && HText_hasToolbar(text)) { @@ -3498,6 +3524,100 @@ PUBLIC void HText_appendCharacter ARGS2( text->halted = 3; return; } +#ifdef USE_TH_JP_AUTO_DETECT + if ((HTCJK == JAPANESE) && (text->detected_kcode != DET_MIXED) && + (text->specified_kcode != SJIS) && (text->specified_kcode != EUC)) { + unsigned char c; + int save_d_kcode; + + c = ch; + save_d_kcode = text->detected_kcode; + switch (text->SJIS_status) { + case SJIS_state_has_bad_code: + break; + case SJIS_state_neutral: + if (IS_SJIS_HI1(c) || IS_SJIS_HI2(c)) { + text->SJIS_status = SJIS_state_in_kanji; + } + else if ((c & 0x80) && !IS_SJIS_X0201KANA(c)) { + text->SJIS_status = SJIS_state_has_bad_code; + if (text->EUC_status == EUC_state_has_bad_code) + text->detected_kcode = DET_MIXED; + else + text->detected_kcode = DET_EUC; + } + break; + case SJIS_state_in_kanji: + if (IS_SJIS_LO(c)) { + text->SJIS_status = SJIS_state_neutral; + } + else { + text->SJIS_status = SJIS_state_has_bad_code; + if (text->EUC_status == EUC_state_has_bad_code) + text->detected_kcode = DET_MIXED; + else + text->detected_kcode = DET_EUC; + } + break; + } + switch (text->EUC_status) { + case EUC_state_has_bad_code: + break; + case EUC_state_neutral: + if (IS_EUC_HI(c)) { + text->EUC_status = EUC_state_in_kanji; + } + else if (c == 0x8e) { + text->EUC_status = EUC_state_in_kana; + } + else if (c & 0x80) { + text->EUC_status = EUC_state_has_bad_code; + if (text->SJIS_status == SJIS_state_has_bad_code) + text->detected_kcode = DET_MIXED; + else + text->detected_kcode = DET_SJIS; + } + break; + case EUC_state_in_kanji: + if (IS_EUC_LOX(c)) { + text->EUC_status = EUC_state_neutral; + } + else { + text->EUC_status = EUC_state_has_bad_code; + if (text->SJIS_status == SJIS_state_has_bad_code) + text->detected_kcode = DET_MIXED; + else + text->detected_kcode = DET_SJIS; + } + break; + case EUC_state_in_kana: + if ((0xA1<=c)&&(c<=0xDF)) { + text->EUC_status = EUC_state_neutral; + } + else { + text->EUC_status = EUC_state_has_bad_code; + if (text->SJIS_status == SJIS_state_has_bad_code) + text->detected_kcode = DET_MIXED; + else + text->detected_kcode = DET_SJIS; + } + break; + } + if (save_d_kcode != text->detected_kcode) { + switch (text->detected_kcode) { + case DET_SJIS: + CTRACE((tfp, "TH_JP_AUTO_DETECT: This document's kcode seems SJIS.\n")); + break; + case DET_EUC: + CTRACE((tfp, "TH_JP_AUTO_DETECT: This document's kcode seems EUC.\n")); + break; + case DET_MIXED: + CTRACE((tfp, "TH_JP_AUTO_DETECT: This document's kcode seems mixed!\n")); + break; + } + } + } +#endif /* USE_TH_JP_AUTO_DETECT */ /* * Make sure we don't hang on escape sequences. */ @@ -3547,7 +3667,7 @@ PUBLIC void HText_appendCharacter ARGS2( } break; - case S_esc: + case S_esc: /* * Expecting '$'or '(' following CJK ESC. */ @@ -3560,13 +3680,16 @@ PUBLIC void HText_appendCharacter ARGS2( } else { text->state = S_text; } + /* FALLTHRU */ - case S_dollar: + case S_dollar: /* * Expecting '@', 'B', 'A' or '(' after CJK "ESC$". */ if (ch == '@' || ch == 'B' || ch=='A') { text->state = S_nonascii_text; + if (ch == '@' || ch == 'B') + text->kcode = JIS; return; } else if (ch == '(') { text->state = S_dollar_paren; @@ -3576,7 +3699,7 @@ PUBLIC void HText_appendCharacter ARGS2( } break; - case S_dollar_paren: + case S_dollar_paren: /* * Expecting 'C' after CJK "ESC$(". */ @@ -3588,7 +3711,7 @@ PUBLIC void HText_appendCharacter ARGS2( } break; - case S_paren: + case S_paren: /* * Expecting 'B', 'J', 'T' or 'I' after CJK "ESC(". */ @@ -3605,20 +3728,30 @@ PUBLIC void HText_appendCharacter ARGS2( * Can split here. - FM */ text->permissible_split = text->last_line->size; + text->kcode = JIS; return; } else { text->state = S_text; } break; - case S_nonascii_text: + case S_nonascii_text: /* * Expecting CJK ESC after non-ASCII text. */ if (ch == CH_ESC) { /* S/390 -- gil -- 1553 */ text->state = S_esc; text->kanji_buf = '\0'; + if (HTCJK == JAPANESE) { + text->kcode = NOKANJI; + } return; + } else if ((0 <= ch) && (ch < 32)) { + text->state = S_text; + text->kanji_buf = '\0'; + if (HTCJK == JAPANESE) { + text->kcode = NOKANJI; + } } else { ch |= 0200; } @@ -3627,14 +3760,16 @@ PUBLIC void HText_appendCharacter ARGS2( /* * JIS X0201 Kana in JIS support. - by ASATAKU */ - case S_jisx0201_text: + case S_jisx0201_text: if (ch == CH_ESC) { /* S/390 -- gil -- 1570 */ text->state = S_esc; text->kanji_buf = '\0'; + text->kcode = NOKANJI; return; } else { text->kanji_buf = '\216'; ch |= 0200; +#if 0 /* This conversion is done after. --TH */ #ifdef SH_EX /**** Add Next Line by patakuti ****/ text->permissible_split = (int)text->last_line->size; @@ -3645,6 +3780,7 @@ PUBLIC void HText_appendCharacter ARGS2( ch = low; } #endif +#endif } break; } /* end switch */ @@ -3654,10 +3790,26 @@ PUBLIC void HText_appendCharacter ARGS2( /* * JIS X0201 Kana in SJIS support. - by ASATAKU */ - if ((text->kcode == SJIS) && + if ((text->kcode != JIS) + && ( +#ifdef KANJI_CODE_OVERRIDE + (last_kcode == SJIS) || + ((last_kcode == NOKANJI) && +#endif + ((text->kcode == SJIS) || +#ifdef USE_TH_JP_AUTO_DETECT + ((text->detected_kcode == DET_SJIS) && + (text->specified_kcode == NOKANJI)) || +#endif + ((text->kcode == NOKANJI) && + (text->specified_kcode == SJIS)) ) +#ifdef KANJI_CODE_OVERRIDE + ) +#endif + ) && ((unsigned char)ch >= 0xA1) && - ((unsigned char)ch <= 0xDF)) - { + ((unsigned char)ch <= 0xDF)) { +#ifdef CONV_JISX0201KANA_ISX0208KANA unsigned char c = (unsigned char)ch; unsigned char kb = (unsigned char)text->kanji_buf; JISx0201TO0208_SJIS(c, @@ -3665,6 +3817,7 @@ PUBLIC void HText_appendCharacter ARGS2( (unsigned char *)&c); ch = (char)c; text->kanji_buf = kb; +#endif /* 1998/01/19 (Mon) 09:06:15 */ text->permissible_split = (int)text->last_line->size; } else { @@ -3677,7 +3830,7 @@ PUBLIC void HText_appendCharacter ARGS2( } } } else { - goto check_IgnoreExcess; + goto check_WrapSource; } } else if (ch == CH_ESC) { /* S/390 -- gil -- 1587 */ return; @@ -3952,20 +4105,33 @@ PUBLIC void HText_appendCharacter ARGS2( } return; } /* if tab */ - else if ( (text->source || dont_wrap_pre) && text == HTMainText) { + +check_WrapSource: + if ( (text->source || dont_wrap_pre) && text == HTMainText) { /* * If we're displaying document source, wrap long lines to keep all of * the source visible. */ int target = (int)(line->offset + line->size) - ctrl_chars_on_this_line; int target_cu = target + utfxtra_on_this_line; - if (target >= (LYcols-1) - style->rightIndent || + if (target >= (LYcols-1) - style->rightIndent - + (((HTCJK != NOCJK) && text->kanji_buf) ? 1 : 0) || (text->T.output_utf8 && target_cu + UTF_XLEN(ch) >= (LYcols_cu-1)) ) { + int saved_kanji_buf; + int saved_state; + new_line(text); line = text->last_line; + + saved_kanji_buf = text->kanji_buf; + saved_state = text->state; + text->kanji_buf = '\0'; + text->state = S_text; HText_appendCharacter (text, LY_SOFT_NEWLINE); + text->kanji_buf = saved_kanji_buf; + text->state = saved_state; } } @@ -3985,7 +4151,6 @@ PUBLIC void HText_appendCharacter ARGS2( /* * Check if we should ignore characters at the wrap point. */ -check_IgnoreExcess: if (text->IgnoreExcess && (((indent + (int)line->offset + (int)line->size) + (int)style->rightIndent - ctrl_chars_on_this_line) >= (LYcols-1) || @@ -3998,6 +4163,7 @@ check_IgnoreExcess: */ if (((indent + (int)line->offset + (int)line->size) + (int)style->rightIndent - ctrl_chars_on_this_line + + (((HTCJK != NOCJK) && text->kanji_buf) ? 1 : 0) + ((line->size > 0) && (int)(line->data[line->size-1] == LY_SOFT_HYPHEN ? @@ -4078,12 +4244,40 @@ check_IgnoreExcess: line = text->last_line; /* May have changed */ -#ifdef CJK_EX /* 1997/11/14 (Fri) 09:10:03 */ if (HTCJK != NOCJK && text->kanji_buf) { hi = (unsigned char)text->kanji_buf; lo = (unsigned char)ch; if (HTCJK == JAPANESE) { + if (text->kcode != JIS) { + if (IS_SJIS_2BYTE(hi, lo)) { + if (IS_EUC(hi, lo)) { +#ifdef KANJI_CODE_OVERRIDE + if (last_kcode != NOKANJI) + text->kcode = last_kcode; + else +#endif + if (text->specified_kcode != NOKANJI) + text->kcode = text->specified_kcode; +#ifdef USE_TH_JP_AUTO_DETECT + else if (text->detected_kcode == DET_EUC) + text->kcode = EUC; + else if (text->detected_kcode == DET_SJIS) + text->kcode = SJIS; +#endif + else if (IS_EUC_X0201KANA(hi, lo) && (text->kcode != EUC)) + text->kcode = SJIS; + } + else + text->kcode = SJIS; + } + else if (IS_EUC(hi, lo)) + text->kcode = EUC; + else + text->kcode = NOKANJI; + } + +#if 0 /* This judgement routine is replaced by above one. -- TH */ if (text->kcode == NOKANJI) { if (IS_SJIS(hi, lo, text->in_sjis) && IS_EUC(hi, lo)) { @@ -4094,6 +4288,7 @@ check_IgnoreExcess: text->kcode = EUC; } } +#endif switch (kanji_code) { case EUC: @@ -4101,37 +4296,39 @@ check_IgnoreExcess: SJIS_TO_EUC1(hi, lo, tmp); line->data[line->size++] = tmp[0]; line->data[line->size++] = tmp[1]; - } else if (text->kcode == EUC) { + } else if (IS_EUC(hi, lo)) { +#ifdef CONV_JISX0201KANA_ISX0208KANA JISx0201TO0208_EUC(hi, lo, &hi, &lo); +#endif line->data[line->size++] = hi; line->data[line->size++] = lo; + } else { + CTRACE((tfp, "This character (%X:%X) doesn't seem Japanese\n", hi, lo)); + line->data[line->size++] = '='; + line->data[line->size++] = '='; } break; case SJIS: - if (last_kcode != SJIS && text->kcode == EUC) + if ((text->kcode == EUC) || (text->kcode == JIS)) { - EUC_TO_SJIS1(hi, lo, tmp); - line->data[line->size++] = tmp[0]; - line->data[line->size++] = tmp[1]; - } else { - /* text->kcode == (SJIS or NOKANJI) */ -#ifdef CJK_EX /* 1998/01/20 (Tue) 16:46:34 */ - if (last_kcode == EUC) { - if (lo == 0) { /* BAD EUC code */ - hi = '='; - lo = '='; - } else if (hi == 0x8e) { - text->kcode = NOKANJI; - JISx0201TO0208_EUC(hi, lo, &hi, &lo); - EUC_TO_SJIS1(hi, lo, tmp); - hi = tmp[0]; - lo = tmp[1]; - } - } +#ifndef CONV_JISX0201KANA_ISX0208KANA + if (IS_EUC_X0201KANA(hi, lo)) + line->data[line->size++] = lo; + else #endif + { + EUC_TO_SJIS1(hi, lo, tmp); + line->data[line->size++] = tmp[0]; + line->data[line->size++] = tmp[1]; + } + } else if (IS_SJIS_2BYTE(hi, lo)) { line->data[line->size++] = hi; line->data[line->size++] = lo; + } else { + line->data[line->size++] = '='; + line->data[line->size++] = '='; + CTRACE((tfp, "This character (%X:%X) doesn't seem Japanese\n", hi, lo)); } break; @@ -4144,7 +4341,7 @@ check_IgnoreExcess: } text->kanji_buf = 0; } -#else +#if 0 if (HTCJK != NOCJK && text->kanji_buf) { hi = (unsigned char)text->kanji_buf, lo = (unsigned char)ch; if (HTCJK == JAPANESE && text->kcode == NOKANJI) { @@ -4163,7 +4360,9 @@ check_IgnoreExcess: line->data[line->size++] = tmp[1]; } else if (HTCJK == JAPANESE && (kanji_code == EUC) && (text->kcode == EUC)) { +#ifdef CONV_JISX0201KANA_JISX0208KANA JISx0201TO0208_EUC(hi, lo, &hi, &lo); +#endif line->data[line->size++] = hi; line->data[line->size++] = lo; } else if (HTCJK == JAPANESE && @@ -4178,6 +4377,13 @@ check_IgnoreExcess: text->kanji_buf = 0; } #endif +#ifndef CONV_JISX0201KANA_JISX0208KANA + else if ((HTCJK == JAPANESE) && IS_SJIS_X0201KANA((unsigned char)(ch)) && + (kanji_code == EUC)) { + line->data[line->size++] = 0x8e; + line->data[line->size++] = ch; + } +#endif else if (HTCJK != NOCJK) { line->data[line->size++] = (char) ( (kanji_code != NOKANJI) ? @@ -4861,7 +5067,7 @@ PUBLIC int HText_beginAnchor ARGS3( a->link_type = INTERNAL_LINK_ANCHOR; } else #endif - if (HTAnchor_followMainLink((HTAnchor*)anc)) { + if (HTAnchor_followMainLink((HTAnchor*)anc)) { a->number = ++(text->last_anchor_number); } else { a->number = 0; @@ -6998,10 +7204,10 @@ PUBLIC BOOL HTFindPoundSelector ARGS1( CTRACE((tfp, "HText: Selecting anchor [%d] at character %d, line %d\n", a->number, a->start, www_search_result)); - if (!strcmp(selector, LYToolbarName)) + if (!strcmp(selector, LYToolbarName)) { --www_search_result; - - return(YES); + } + return(YES); } } @@ -7481,8 +7687,8 @@ PUBLIC void print_wwwfile_to_fd ARGS2( LYRawMode && LYlowest_eightbit[current_char_set] <= 173 && (LYCharSet_UC[current_char_set].enc == UCT_ENC_8859 || - LYCharSet_UC[current_char_set].like8859 & - UCT_R_8859SPECL)) { + (LYCharSet_UC[current_char_set].like8859 & + UCT_R_8859SPECL)) != 0) { fputc(0xad, fp); /* the iso8859 byte for SHY */ } else { fputc('-', fp); @@ -7585,8 +7791,8 @@ PUBLIC void print_crawl_to_fd ARGS3( LYRawMode && LYlowest_eightbit[current_char_set] <= 173 && (LYCharSet_UC[current_char_set].enc == UCT_ENC_8859 || - LYCharSet_UC[current_char_set].like8859 & - UCT_R_8859SPECL)) { + (LYCharSet_UC[current_char_set].like8859 & + UCT_R_8859SPECL)) != 0) { fputc(0xad, fp); /* the iso8859 byte for SHY */ } else { fputc('-', fp); @@ -10206,6 +10412,7 @@ PUBLIC int HText_SubmitForm ARGS4( "values are different")); break; } + /* FALLTHRU */ #ifdef EXP_FILE_UPLOAD case F_FILE_TYPE: @@ -11172,6 +11379,8 @@ PUBLIC void HText_setKcode ARGS3( CONST char *, charset, LYUCcharset *, p_in) { + BOOL explicit; + if (!text) return; @@ -11181,6 +11390,7 @@ PUBLIC void HText_setKcode ARGS3( if (!charset && !p_in) { return; } + explicit = charset ? TRUE : FALSE; /* ** If no explicit charset string, use the implied one. - kw */ @@ -11200,17 +11410,25 @@ PUBLIC void HText_setKcode ARGS3( ** so check the charset value and set the text->kcode element ** appropriately. - FM */ - if (!strcmp(charset, "shift_jis") || + /* If charset isn't specified explicitely nor assumed, + * p_in->MIMEname would be set as display charset. + * So text->kcode sholud be set as SJIS or EUC here only if charset + * is specified explicitely, otherwise text->kcode would cause + * mishandling Japanese strings. -- TH + */ + if (explicit && (!strcmp(charset, "shift_jis") || !strcmp(charset, "x-sjis") || /* 1997/11/28 (Fri) 18:11:33 */ - !strcmp(charset, "x-shift-jis")) + !strcmp(charset, "x-shift-jis"))) { text->kcode = SJIS; - } else if ((p_in && (p_in->enc == UCT_ENC_CJK)) || + } else if (explicit && ((p_in && (p_in->enc == UCT_ENC_CJK)) || !strcmp(charset, "x-euc") || /* 1997/11/28 (Fri) 18:11:24 */ !strcmp(charset, "euc-jp") || !strncmp(charset, "x-euc-", 6) || +#if 0 /* iso-2022-jp* shouldn't be treated as euc-jp */ !strcmp(charset, "iso-2022-jp") || !strcmp(charset, "iso-2022-jp-2") || +#endif !strcmp(charset, "euc-kr") || !strcmp(charset, "iso-2022-kr") || !strcmp(charset, "big5") || @@ -11218,14 +11436,14 @@ PUBLIC void HText_setKcode ARGS3( !strcmp(charset, "euc-cn") || !strcmp(charset, "gb2312") || !strncmp(charset, "cn-gb", 5) || - !strcmp(charset, "iso-2022-cn")) { + !strcmp(charset, "iso-2022-cn"))) { text->kcode = EUC; } else { /* ** If we get to here, it's not CJK, so disable that if ** it is enabled. But only if we are quite sure. - FM & kw */ -#ifdef CJK_EX +#ifdef KANJI_CODE_OVERRIDE last_kcode = text->kcode = NOKANJI; #else text->kcode = NOKANJI; @@ -11235,6 +11453,16 @@ PUBLIC void HText_setKcode ARGS3( HTCJK = NOCJK; } } + if (explicit) + text->specified_kcode = text->kcode; + else { + if (UCAssume_MIMEcharset) { + if (!strcmp(UCAssume_MIMEcharset, "euc-jp")) + text->kcode = text->specified_kcode = EUC; + else if (!strcmp(UCAssume_MIMEcharset, "shift_jis")) + text->kcode = text->specified_kcode = SJIS; + } + } return; } @@ -11450,7 +11678,7 @@ PRIVATE void cleanup_line_for_textarea ARGS2( * multibyte character set support, consider yourself to have been * warned.] */ - for (p = line, s = tbuf; *s != '\0'; p++, s++) + for (p = line, s = tbuf; *s != '\0'; p++, s++) { #ifndef EBCDIC *p = (((unsigned char)*s < (unsigned char)' ') || ((unsigned char)*s == (unsigned char)'\177') || @@ -11461,6 +11689,7 @@ PRIVATE void cleanup_line_for_textarea ARGS2( #else *p = ((unsigned char)*s < (unsigned char)' ') ? SPLAT : *s; #endif + } *p = '\0'; } @@ -11624,7 +11853,7 @@ PRIVATE int increment_tagged_htline ARGS6( * Dunno how to fix that behavior ATT, but at least the * tag numbers themselves are correct. -KED /\oo/\ ] */ - if (new_n -= n) { + if ((new_n -= n) != 0) { nxt_anchor = st_anchor; while ((nxt_anchor) && (nxt_anchor->line_num == a->line_num)) { @@ -12922,6 +13151,7 @@ PRIVATE void redraw_part_of_line ARGS4( buffer[0] = '-'; i++; } + /* FALLTHRU */ default: i++; @@ -13349,6 +13579,7 @@ PRIVATE void move_to_glyph ARGS10( */ buffer[0] = '-'; } + /* FALLTHRU */ default: /* @@ -13650,7 +13881,6 @@ PUBLIC void HTMark_asSource NOARGS } #endif -#ifdef CJK_EX PUBLIC HTkcode HText_getKcode ARGS1( HText *, text) { @@ -13663,7 +13893,19 @@ PUBLIC void HText_updateKcode ARGS2( { text->kcode = kcode; } -#endif + +PUBLIC HTkcode HText_getSpecifiedKcode ARGS1( + HText *, text) +{ + return text->specified_kcode; +} + +PUBLIC void HText_updateSpecifiedKcode ARGS2( + HText *, text, + HTkcode, kcode) +{ + text->specified_kcode = kcode; +} PUBLIC int HTMainText_Get_UCLYhndl NOARGS { diff --git a/src/GridText.h b/src/GridText.h index ba6ce2cb..da17b203 100644 --- a/src/GridText.h +++ b/src/GridText.h @@ -310,14 +310,15 @@ extern void HTMark_asSource NOPARAMS; extern int HTMainText_Get_UCLYhndl NOPARAMS; -#ifdef CJK_EX - #include <HTCJK.h> + +#ifdef KANJI_CODE_OVERRIDE extern HTkcode last_kcode; +#endif extern HTkcode HText_getKcode PARAMS((HText * text)); extern void HText_updateKcode PARAMS((HText * text, HTkcode kcode)); - -#endif +extern HTkcode HText_getSpecifiedKcode PARAMS((HText * text)); +extern void HText_updateSpecifiedKcode PARAMS((HText * text, HTkcode kcode)); #endif /* LYGRIDTEXT_H */ diff --git a/src/HTFWriter.c b/src/HTFWriter.c index db0c3739..833fe763 100644 --- a/src/HTFWriter.c +++ b/src/HTFWriter.c @@ -32,6 +32,7 @@ extern int exec_command(char * cmd, int wait_flag); /* xsystem.c */ #include <LYGlobalDefs.h> #include <LYClean.h> #include <GridText.h> +#include <LYExtern.h> #include <LYexit.h> #include <LYLeaks.h> #include <LYKeymap.h> diff --git a/src/HTInit.c b/src/HTInit.c index a9506b8d..743c8ace 100644 --- a/src/HTInit.c +++ b/src/HTInit.c @@ -384,7 +384,7 @@ PRIVATE int ProcessMailcapEntry ARGS2( } else if (eq && !strcmp(arg, "q")) { mc->quality = (float)atof(eq); if (mc->quality > 0.000 && mc->quality < 0.001) - mc->quality = 0.001; + mc->quality = (float) 0.001; } else if (eq && !strcmp(arg, "mxb")) { mc->maxbytes = atol(eq); if (mc->maxbytes < 0) @@ -433,9 +433,11 @@ PRIVATE void BuildCommand ARGS5( *to++ = '%'; break; case 'n': + /* FALLTHRU */ case 'F': CTRACE((tfp, "BuildCommand: Bad mailcap \"test\" clause: %s\n", controlstring)); + /* FALLTHRU */ case 's': if (TmpFileLen && TmpFileName) { if ((to - *pBuf) + TmpFileLen + 1 > Bufsize) { @@ -896,15 +898,15 @@ PUBLIC void HTFileInit NOARGS HTSetSuffix(".bkp", "application/x-VMS BAK File", "binary", 1.0); HTSetSuffix(".bck", "application/x-VMS BAK File", "binary", 1.0); - HTSetSuffix(".bkp_gz", "application/octet-stream", "gzip", "GNU BAK File", 1.0); - HTSetSuffix(".bkp-gz", "application/octet-stream", "gzip", "GNU BAK File", 1.0); - HTSetSuffix(".bck_gz", "application/octet-stream", "gzip", "GNU BAK File", 1.0); - HTSetSuffix(".bck-gz", "application/octet-stream", "gzip", "GNU BAK File", 1.0); + HTSetSuffix5(".bkp_gz", "application/octet-stream", "gzip", "GNU BAK File", 1.0); + HTSetSuffix5(".bkp-gz", "application/octet-stream", "gzip", "GNU BAK File", 1.0); + HTSetSuffix5(".bck_gz", "application/octet-stream", "gzip", "GNU BAK File", 1.0); + HTSetSuffix5(".bck-gz", "application/octet-stream", "gzip", "GNU BAK File", 1.0); - HTSetSuffix(".bkp-Z", "application/octet-stream", "compress", "Comp. BAK File", 1.0); - HTSetSuffix(".bkp_Z", "application/octet-stream", "compress", "Comp. BAK File", 1.0); - HTSetSuffix(".bck-Z", "application/octet-stream", "compress", "Comp. BAK File", 1.0); - HTSetSuffix(".bck_Z", "application/octet-stream", "compress", "Comp. BAK File", 1.0); + HTSetSuffix5(".bkp-Z", "application/octet-stream", "compress", "Comp. BAK File", 1.0); + HTSetSuffix5(".bkp_Z", "application/octet-stream", "compress", "Comp. BAK File", 1.0); + HTSetSuffix5(".bck-Z", "application/octet-stream", "compress", "Comp. BAK File", 1.0); + HTSetSuffix5(".bck_Z", "application/octet-stream", "compress", "Comp. BAK File", 1.0); #else HTSetSuffix5(".bak", NULL, "binary", "Backup", 0.5); HTSetSuffix5(".bkp", "application/octet-stream", "binary", "VMS BAK File", 1.0); diff --git a/src/HTML.c b/src/HTML.c index a1492ed9..95a59897 100644 --- a/src/HTML.c +++ b/src/HTML.c @@ -243,7 +243,7 @@ PUBLIC BOOL LYBadHTML ARGS1( */ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c) { -#ifdef CJK_EX +#if 0 /* def KANJI_CODE_OVERRIDE */ static unsigned char save_ch1 = 0; static unsigned char save_ch2 = 0; #endif @@ -427,7 +427,7 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c) } else { me->inP = TRUE; me->inLABEL = FALSE; -#ifdef CJK_EX +#if 0 /* Should this check be done in HText_appendCharacter? */ if (last_kcode == EUC) { if (save_ch1 && !save_ch2) { if ((unsigned char)c & 0x80) { @@ -445,9 +445,8 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c) } else { HText_appendCharacter(me->text, c); } -#else - HText_appendCharacter(me->text, c); #endif + HText_appendCharacter(me->text, c); me->in_word = YES; } } @@ -587,7 +586,7 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s) if (me->in_word) { if (HText_getLastChar(me->text) != ' ') HText_appendCharacter(me->text, ' '); - me->in_word = NO; + me->in_word = NO; } } @@ -2245,7 +2244,7 @@ PRIVATE int HTML_start_element ARGS6( HText_cancelStbl(me->text); UPDATE_STYLE; - CANT_JUSTIFY_THIS_LINE + CANT_JUSTIFY_THIS_LINE; if (present[HTML_TAB_ALIGN] && value[HTML_TAB_ALIGN] && (strcasecomp(value[HTML_TAB_ALIGN], "left") || !(present[HTML_TAB_TO] || present[HTML_TAB_INDENT]))) { @@ -2462,8 +2461,11 @@ PRIVATE int HTML_start_element ARGS6( ** PRE block is received. - FM */ me->inPRE = FALSE; + /* FALLTHRU */ case HTML_LISTING: /* Literal text */ + /* FALLTHRU */ case HTML_XMP: + /* FALLTHRU */ case HTML_PLAINTEXT: change_paragraph_style(me, styles[ElementNumber]); UPDATE_STYLE; @@ -4596,7 +4598,7 @@ PRIVATE int HTML_start_element ARGS6( if (me->inUnderline == FALSE) HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR); HTML_put_character(me, ' '); - CAN_JUSTIFY_START + CAN_JUSTIFY_START; if (me->inFIG) /* @@ -4645,7 +4647,7 @@ PRIVATE int HTML_start_element ARGS6( * Set to know we are in a new form. */ me->inFORM = TRUE; - EMIT_IFDEF_EXP_JUSTIFY_ELTS(form_in_htext=TRUE;) + EMIT_IFDEF_EXP_JUSTIFY_ELTS(form_in_htext = TRUE); if (present && present[HTML_FORM_ACCEPT_CHARSET]) { accept_cs = value[HTML_FORM_ACCEPT_CHARSET] ? @@ -4964,9 +4966,8 @@ PRIVATE int HTML_start_element ARGS6( BOOL HaveSRClink = FALSE; char* ImageSrc = NULL; BOOL IsSubmitOrReset = FALSE; -#ifdef CJK_EX HTkcode kcode = 0; -#endif + HTkcode specified_kcode = 0; /* init */ I.align=NULL; I.accept=NULL; I.checked=NO; I.class=NULL; I.disabled=NO; I.error=NULL; I.height= NULL; I.id=NULL; @@ -5397,12 +5398,12 @@ PRIVATE int HTML_start_element ARGS6( for (; chars > 0; chars--) HTML_put_character(me, '_'); } else { -#ifdef CJK_EX - if (HTCJK != NOCJK) { + if (HTCJK == JAPANESE) { kcode = HText_getKcode(me->text); HText_updateKcode(me->text, kanji_code); + specified_kcode = HText_getSpecifiedKcode(me->text); + HText_updateSpecifiedKcode(me->text, kanji_code); } -#endif if (me->sp[0].tag_number == HTML_PRE || !me->sp->style->freeFormat) { /* @@ -5442,10 +5443,10 @@ PRIVATE int HTML_start_element ARGS6( while (i < chars) HTML_put_character(me, HT_NON_BREAK_SPACE); } -#ifdef CJK_EX - if (HTCJK != NOCJK) + if (HTCJK == JAPANESE) { HText_updateKcode(me->text, kcode); -#endif + HText_updateSpecifiedKcode(me->text, specified_kcode); + } } HText_setIgnoreExcess(me->text, FALSE); FREE(ImageSrc); @@ -6143,7 +6144,7 @@ PRIVATE int HTML_end_element ARGS3( BOOL BreakFlag = FALSE; BOOL intern_flag = FALSE; BOOL skip_stack_requested = FALSE; - EMIT_IFDEF_EXP_JUSTIFY_ELTS(BOOL reached_awaited_stacked_elt=FALSE;) + EMIT_IFDEF_EXP_JUSTIFY_ELTS(BOOL reached_awaited_stacked_elt = FALSE); #ifdef USE_PRETTYSRC if (psrc_view && !sgml_in_psrc_was_initialized) { @@ -6655,8 +6656,11 @@ PRIVATE int HTML_end_element ARGS3( * Set to know that we are no longer in a PRE block. */ me->inPRE = FALSE; + /* FALLTHRU */ case HTML_LISTING: /* Literal text */ + /* FALLTHRU */ case HTML_XMP: + /* FALLTHRU */ case HTML_PLAINTEXT: if (me->comment_start) HText_appendText(me->text, me->comment_start); @@ -6681,9 +6685,13 @@ PRIVATE int HTML_end_element ARGS3( case HTML_OL: me->OL_Counter[me->List_Nesting_Level < 11 ? me->List_Nesting_Level : 11] = OL_VOID; + /* FALLTHRU */ case HTML_DL: + /* FALLTHRU */ case HTML_UL: + /* FALLTHRU */ case HTML_MENU: + /* FALLTHRU */ case HTML_DIR: me->List_Nesting_Level--; CTRACE((tfp, "HTML_end_element: Reducing List Nesting Level to %d\n", @@ -7202,7 +7210,7 @@ End_Object: if (LYBadHTML(me)) CTRACE((tfp, "Bad HTML: Unmatched FORM end tag\n")); } - EMIT_IFDEF_EXP_JUSTIFY_ELTS(form_in_htext=FALSE;) + EMIT_IFDEF_EXP_JUSTIFY_ELTS(form_in_htext = FALSE); /* * Check if we still have a SELECT element open. @@ -7551,8 +7559,21 @@ End_Object: for (; ptr && *ptr != '\0'; ptr++) { if (*ptr == ' ') HText_appendCharacter(me->text,HT_NON_BREAK_SPACE); - else + else { + HTkcode kcode = 0; + HTkcode specified_kcode = 0; + if (HTCJK == JAPANESE) { + kcode = HText_getKcode(me->text); + HText_updateKcode(me->text, kanji_code); + specified_kcode = HText_getSpecifiedKcode(me->text); + HText_updateSpecifiedKcode(me->text, kanji_code); + } HText_appendCharacter(me->text,*ptr); + if (HTCJK == JAPANESE) { + HText_updateKcode(me->text, kcode); + HText_updateSpecifiedKcode(me->text, specified_kcode); + } + } } /* * Add end option character. @@ -8611,6 +8632,8 @@ PRIVATE HTStream* CacheThru_new ARGS2( return stream; } +#else +#define CacheThru_new(anchor, target) target #endif /* HTConverter for HTML to plain text @@ -8626,13 +8649,9 @@ PUBLIC HTStream* HTMLToPlain ARGS3( HTParentAnchor *, anchor, HTStream *, sink) { -#ifdef SOURCE_CACHE return CacheThru_new(anchor, SGML_new(&HTML_dtd, anchor, HTML_new(anchor, pres->rep_out, sink))); -#else - return SGML_new(&HTML_dtd, anchor, HTML_new(anchor, pres->rep_out, sink)); -#endif } /* HTConverter for HTML source to plain text @@ -8691,13 +8710,9 @@ PUBLIC HTStream* HTMLParsedPresent ARGS3( } if (!intermediate) return NULL; -#ifdef SOURCE_CACHE return CacheThru_new(anchor, SGML_new(&HTML_dtd, anchor, HTMLGenerator(intermediate))); -#else - return SGML_new(&HTML_dtd, anchor, HTMLGenerator(intermediate)); -#endif } /* HTConverter for HTML to C code @@ -8728,12 +8743,8 @@ PUBLIC HTStream* HTMLToC ARGS3( html->comment_end = " */\n"; /* Must start in col 1 for cpp */ if (!sink) HTML_put_string(html,html->comment_start); -#ifdef SOURCE_CACHE return CacheThru_new(anchor, SGML_new(&HTML_dtd, anchor, html)); -#else - return SGML_new(&HTML_dtd, anchor, html); -#endif } /* Presenter for HTML @@ -8750,13 +8761,9 @@ PUBLIC HTStream* HTMLPresent ARGS3( HTParentAnchor *, anchor, HTStream *, sink GCC_UNUSED) { -#ifdef SOURCE_CACHE return CacheThru_new(anchor, SGML_new(&HTML_dtd, anchor, HTML_new(anchor, WWW_PRESENT, NULL))); -#else - return SGML_new(&HTML_dtd, anchor, HTML_new(anchor, WWW_PRESENT, NULL)); -#endif } #endif /* !GUI */ @@ -8810,19 +8817,19 @@ PRIVATE char * MakeNewTitle ARGS2(CONST char **, value, int, src_type) #ifdef SH_EX /* 1998/04/02 (Thu) 16:02:00 */ /* for proxy server 1998/12/19 (Sat) 11:53:30 */ - if (stricmp(newtitle + 1, "internal-gopher-menu") == 0) { + if (AS_casecomp(newtitle + 1, "internal-gopher-menu") == 0) { StrAllocCopy(newtitle, "+"); - } else if (stricmp(newtitle + 1, "internal-gopher-unknown") == 0) { + } else if (AS_casecomp(newtitle + 1, "internal-gopher-unknown") == 0) { StrAllocCopy(newtitle, " "); } else { /* normal title */ ptr = strrchr(newtitle, '.'); if (ptr) { - if (stricmp(ptr, ".gif") == 0) + if (AS_casecomp(ptr, ".gif") == 0) *ptr = '\0'; - else if (stricmp(ptr, ".jpg") == 0) + else if (AS_casecomp(ptr, ".jpg") == 0) *ptr = '\0'; - else if (stricmp(ptr, ".jpeg") == 0) + else if (AS_casecomp(ptr, ".jpeg") == 0) *ptr = '\0'; } StrAllocCat(newtitle, "]"); diff --git a/src/LYCgi.c b/src/LYCgi.c index eb1ceda3..3d075780 100644 --- a/src/LYCgi.c +++ b/src/LYCgi.c @@ -240,13 +240,11 @@ PRIVATE int LYLoadCGI ARGS4( } else #ifdef _WINDOWS /* 1998/01/14 (Wed) 09:16:04 */ - if (!(S_ISREG(stat_buf.st_mode) && - stat_buf.st_mode & (S_IXUSR))) +#define isExecutable(mode) (mode & (S_IXUSR)) #else - if (!(S_ISREG(stat_buf.st_mode) && - stat_buf.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH))) +#define isExecutable(mode) (mode & (S_IXUSR|S_IXGRP|S_IXOTH)) #endif - { + if (!(S_ISREG(stat_buf.st_mode) && isExecutable(stat_buf.st_mode))) { /* * Not a runnable file, See if we can load it using "file:" code. */ diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c index 19efad55..d4227365 100644 --- a/src/LYCharUtils.c +++ b/src/LYCharUtils.c @@ -180,6 +180,7 @@ PUBLIC void LYEntify ARGS2( *q++ = *p; continue; } + /* FALLTHRU */ case S_nonascii_text: if (*p == '\033') @@ -1658,8 +1659,10 @@ PUBLIC char ** LYUCFullyTranslateString ARGS9( enum _parsing_what { P_text, P_utf8, P_hex, P_decimal, P_named } what = P_text; -#ifdef CJK_EX /* 1997/12/12 (Fri) 18:08:48 */ +#ifdef KANJI_CODE_OVERRIDE static unsigned char sjis_1st = '\0'; +#endif +#ifdef CONV_JISX0201KANA_JISX0208KANA unsigned char sjis_str[3]; #endif @@ -1763,13 +1766,14 @@ PUBLIC char ** LYUCFullyTranslateString ARGS9( switch(state) { case S_text: code = (unsigned char)(*p); -#ifdef CJK_EX /* 1997/12/13 (Sat) 14:41:53 */ +#ifdef KANJI_CODE_OVERRIDE if (HTCJK == JAPANESE && last_kcode == SJIS) { if (sjis_1st == '\0' && (IS_SJIS_HI1(code)||IS_SJIS_HI2(code))){ sjis_1st = (unsigned char)code; } else if (sjis_1st && IS_SJIS_LO(code)) { sjis_1st = '\0'; } else { +#ifdef CONV_JISX0201KANA_JISX0208KANA if (0xA1 <= code && code <= 0xDF) { sjis_str[2] = '\0'; JISx0201TO0208_SJIS((unsigned char)code, @@ -1778,6 +1782,7 @@ PUBLIC char ** LYUCFullyTranslateString ARGS9( p++; continue; } +#endif } } #endif @@ -1821,6 +1826,7 @@ PUBLIC char ** LYUCFullyTranslateString ARGS9( } else { state = S_text; } + break; case S_dollar: if (*p == '@' || *p == 'B' || *p == 'A') { diff --git a/src/LYCurses.c b/src/LYCurses.c index cdc0eb36..0897642d 100644 --- a/src/LYCurses.c +++ b/src/LYCurses.c @@ -14,6 +14,10 @@ #include <LYexit.h> #include <LYLeaks.h> +#ifdef VMS +#include <LYMainLoop.h> +#endif + #if defined(VMS) && defined(__GNUC__) #include <gnu_hacks.h> #undef LINES @@ -1246,7 +1250,7 @@ PUBLIC BOOLEAN setup ARGS1( LYlines = LINES; LYcols = COLS; #endif /* HAVE_SIZECHANGE && !USE_SLANG && USE_NOTDEFINED */ -#if defined(PDCURSES) && defined(WIN_EX) && defined(CJK_EX) /* 1999/08/26 (Thu) 17:53:38 */ +#if defined(PDCURSES_EXP) && defined(WIN_EX) && defined(CJK_EX) /* 1999/08/26 (Thu) 17:53:38 */ { extern int current_codepage; /* PDCurses lib. */ @@ -1356,6 +1360,12 @@ PUBLIC void LYtouchline ARGS1( #if defined(HAVE_WREDRAWLN) wredrawln(stdscr, row, 1); #else +#if defined(VMS) && !defined(_BSD44_CURSES) + /* touchline() is not available on VMS before version 7.0, and then + * only on Alpha, since prior ports of curses were broken. + */ + touchwin(stdscr); +#else #if defined(FANCY_CURSES) touchline(stdscr, row, 1); #else @@ -1364,6 +1374,7 @@ PUBLIC void LYtouchline ARGS1( #endif #endif #endif +#endif } /* diff --git a/src/LYCurses.h b/src/LYCurses.h index 2d8b6236..9248e6a3 100644 --- a/src/LYCurses.h +++ b/src/LYCurses.h @@ -100,10 +100,6 @@ # define getbkgd(w) wgetbkgd(w) /* workaround pre-1.9.9g bug */ # endif -# ifdef NCURSES -extern void LYsubwindow PARAMS((WINDOW * param)); -# endif /* NCURSES */ - #if defined(NCURSES_VERSION) && defined(HAVE_DEFINE_KEY) #include <term.h> #define USE_KEYMAPS 1 @@ -121,6 +117,10 @@ extern void LYsubwindow PARAMS((WINDOW * param)); # endif /* VMS && __GNUC__ */ #endif /* HAVE_CONFIG_H */ +#if defined(NCURSES) || defined(PDCURSES) +extern void LYsubwindow PARAMS((WINDOW * param)); +#endif /* NCURSES */ + #ifdef VMS extern void VMSbox PARAMS((WINDOW *win, int height, int width)); #else diff --git a/src/LYDownload.c b/src/LYDownload.c index a107029a..021ee27b 100644 --- a/src/LYDownload.c +++ b/src/LYDownload.c @@ -90,15 +90,14 @@ PUBLIC void LYDownload ARGS1( #if defined(DIRED_SUPPORT) /* FIXME: use HTLocalName */ - if (!strncmp(file, "file://localhost", 16)) + if (!strncmp(file, "file://localhost", 16)) { #ifdef __DJGPP__ - { file += 17; file = HTDOS_name(file); - } #else file += 16; #endif /* __DJGPP__ */ + } else if (!strncmp(file, "file:", 5)) file += 5; HTUnEscape(file); diff --git a/src/LYEdit.c b/src/LYEdit.c index 11f2e07c..935cfe0c 100644 --- a/src/LYEdit.c +++ b/src/LYEdit.c @@ -18,9 +18,9 @@ PUBLIC BOOLEAN editor_can_position NOARGS #else return (strstr(editor, "emacs") || strstr(editor, "vi") || strstr(editor, "pico") || strstr(editor, "jove") || - strstr(editor, "jed") || strstr(editor, "joe") || - strstr(editor, "jstar") || strstr(editor, "jmacs") || - strstr(editor, "rjoe") || strstr(editor, "jpico")); + strstr(editor, "jed") || strstr(editor, "joe") || + strstr(editor, "jstar") || strstr(editor, "jmacs") || + strstr(editor, "rjoe") || strstr(editor, "jpico")); #endif } @@ -157,14 +157,14 @@ PUBLIC int edit_current_file ARGS3( } #ifdef DOSPATH else if (strncmp(editor, "VZ", 2)==0) { - /* for Vz editor */ + /* for Vz editor */ format = "%s %s -%s"; HTAddXpand(&command, format, params++, editor); HTAddParam(&command, format, params++, HTDOS_short_name(filename)); HTAddParam(&command, format, params++, position); HTEndParam(&command, format, params); } else if (strncmp(editor, "edit", 4)==0) { - /* for standard editor */ + /* for standard editor */ HTAddXpand(&command, format, params++, editor); HTAddParam(&command, format, params++, HTDOS_short_name(filename)); HTEndParam(&command, format, params); diff --git a/src/LYExtern.c b/src/LYExtern.c index d0e2b974..e3d84275 100644 --- a/src/LYExtern.c +++ b/src/LYExtern.c @@ -24,6 +24,7 @@ #include <LYExtern.h> #include <LYLeaks.h> #include <LYCurses.h> +#include <LYStrings.h> #ifdef WIN_EX @@ -171,6 +172,15 @@ void run_external_ ARGS1(char *, cmd) } #endif +PRIVATE void format ARGS3( + char **, result, + char *, fmt, + char *, parm) +{ + *result = NULL; + HTAddParam(result, fmt, 1, parm); + HTEndParam(result, fmt, 1); +} void run_external ARGS1(char *, c) { @@ -216,12 +226,12 @@ void run_external ARGS1(char *, c) * Dunno how this needs to be modified for VMS or DOS. - kw */ #if (defined(VMS) || defined(DOSPATH) || defined(__EMX__)) && !defined(WIN_EX) - HTSprintf0(&cmdbuf, externals2->command, c); + format(&cmdbuf, externals2->command, c); #else /* Unix or DOS/Win: */ #if defined(WIN_EX) if (*c != '\"' && strchr(c, ' ') != NULL) { char *cp = quote_pathname(c); - HTSprintf0(&cmdbuf, externals2->command, cp); + format(&cmdbuf, externals2->command, cp); FREE(cp); } else { LYstrncpy(pram_string, c, sizeof(pram_string)-1); @@ -229,7 +239,7 @@ void run_external ARGS1(char *, c) c = pram_string; if (strnicmp("mailto:", c, 7) == 0) { - HTSprintf0(&cmdbuf, externals2->command, c + 7); + format(&cmdbuf, externals2->command, c + 7); } else if (strnicmp("telnet://", c, 9) == 0) { char host[sizeof(pram_string)]; int last_pos; @@ -239,7 +249,7 @@ void run_external ARGS1(char *, c) if (last_pos > 1 && host[last_pos] == '/') host[last_pos] = '\0'; - HTSprintf0(&cmdbuf, externals2->command, host); + format(&cmdbuf, externals2->command, host); } else if (strnicmp("file://localhost/", c, 17) == 0) { char e_buff[PATH_MAX], *p; @@ -266,19 +276,19 @@ void run_external ARGS1(char *, c) * less ==> long filename */ if (isupper(externals2->command[0])) { - HTSprintf0(&cmdbuf, + format(&cmdbuf, externals2->command, HTDOS_short_name(e_buff)); } else { - HTSprintf0(&cmdbuf, externals2->command, e_buff); + format(&cmdbuf, externals2->command, e_buff); } } else { - HTSprintf0(&cmdbuf, externals2->command, c); + format(&cmdbuf, externals2->command, c); } } #else /* Unix */ { char *cp = HTQuoteParameter(c); - HTSprintf0(&cmdbuf, externals2->command, cp); + format(&cmdbuf, externals2->command, cp); FREE(cp); } #endif diff --git a/src/LYExtern.h b/src/LYExtern.h index 66b49b21..c172800a 100644 --- a/src/LYExtern.h +++ b/src/LYExtern.h @@ -8,4 +8,8 @@ void run_external PARAMS((char * c)); char *string_short PARAMS((char * str, int cut_pos)); +#ifdef WIN_EX +extern char * quote_pathname PARAMS((char * pathname)); +#endif + #endif /* EXTERNALS_H */ diff --git a/src/LYForms.c b/src/LYForms.c index b5d727fb..03a9e166 100644 --- a/src/LYForms.c +++ b/src/LYForms.c @@ -20,6 +20,12 @@ #include <LYHash.h> #endif +#if defined(VMS) && !defined(USE_SLANG) +#define CTRL_W_HACK DO_NOTHING +#else +#define CTRL_W_HACK 23 /* CTRL-W refresh without clearok */ +#endif /* VMS && !USE_SLANG */ + extern HTCJKlang HTCJK; PRIVATE int form_getstr PARAMS(( @@ -90,11 +96,7 @@ PUBLIC int change_form_link_ex ARGS8( form->size_l, form->disabled); #if defined(FANCY_CURSES) || defined(USE_SLANG) if (!enable_scrollback) -#if defined(VMS) && !defined(USE_SLANG) - c = DO_NOTHING; -#else - c = 23; /* CTRL-W refresh without clearok */ -#endif /* VMS && !USE_SLANG */ + c = CTRL_W_HACK; /* CTRL-W refresh without clearok */ else #endif /* FANCY_CURSES || USE_SLANG */ c = 12; /* CTRL-L for repaint */ @@ -125,12 +127,7 @@ PUBLIC int change_form_link_ex ARGS8( } #if defined(FANCY_CURSES) || defined(USE_SLANG) if (!enable_scrollback) -#if defined(VMS) && !defined(USE_SLANG) - if (form->num_value == OrigNumValue) - c = DO_NOTHING; - else -#endif /* VMS && !USE_SLANG*/ - c = 23; /* CTRL-W refresh without clearok */ + c = CTRL_W_HACK; /* CTRL-W refresh without clearok */ else #endif /* FANCY_CURSES || USE_SLANG */ c = 12; /* CTRL-L for repaint */ @@ -836,6 +833,7 @@ PRIVATE int get_popup_option_number ARGS2( default: *c = *p++; *rel = *p; + break; case 0: break; } @@ -1035,7 +1033,7 @@ PRIVATE int popup_options ARGS7( #ifdef PDCURSES keypad(form_window, TRUE); #endif /* PDCURSES */ -#if defined(NCURSES) +#if defined(NCURSES) || defined(PDCURSES) LYsubwindow(form_window); #endif #if defined(HAVE_GETBKGD) /* not defined in ncurses 1.8.7 */ @@ -1191,14 +1189,15 @@ redraw: switch(cmd) { case LYK_F_LINK_NUM: c = '\0'; - case LYK_1: - case LYK_2: - case LYK_3: - case LYK_4: - case LYK_5: - case LYK_6: - case LYK_7: - case LYK_8: + /* FALLTHRU */ + case LYK_1: /* FALLTHRU */ + case LYK_2: /* FALLTHRU */ + case LYK_3: /* FALLTHRU */ + case LYK_4: /* FALLTHRU */ + case LYK_5: /* FALLTHRU */ + case LYK_6: /* FALLTHRU */ + case LYK_7: /* FALLTHRU */ + case LYK_8: /* FALLTHRU */ case LYK_9: /* * Get a number from the user, possibly with @@ -1607,6 +1606,7 @@ redraw: } } strcpy(prev_target, prev_target_buffer); + /* FALLTHRU */ case LYK_WHEREIS: if (*prev_target == '\0' ) { _statusline(ENTER_WHEREIS_QUERY); @@ -1657,11 +1657,12 @@ check_recall: */ QueryNum++; } - if (QueryNum >= QueryTotal) + if (QueryNum >= QueryTotal) { /* * Roll around to the last query in the list. - FM */ QueryNum = 0; + } if ((cp = (char *)HTList_objectAt(search_queries, QueryNum)) != NULL) { strcpy(prev_target, cp); @@ -1687,35 +1688,36 @@ check_recall: } } else if (recall && ch == DNARROW) { if (FirstRecall) { - /* - * Use the current string or - * first query in the list. - FM - */ - FirstRecall = FALSE; - if (*prev_target_buffer) { - for (QueryNum = 0; - QueryNum < (QueryTotal - 1); QueryNum++) { - if ((cp = (char *)HTList_objectAt( - search_queries, - QueryNum)) != NULL && - !strcmp(prev_target_buffer, cp)) { - break; + /* + * Use the current string or + * first query in the list. - FM + */ + FirstRecall = FALSE; + if (*prev_target_buffer) { + for (QueryNum = 0; + QueryNum < (QueryTotal - 1); QueryNum++) { + if ((cp = (char *)HTList_objectAt( + search_queries, + QueryNum)) != NULL && + !strcmp(prev_target_buffer, cp)) { + break; + } } + } else { + QueryNum = (QueryTotal - 1); } } else { + /* + * Advance to the next query in the list. - FM + */ + QueryNum--; + } + if (QueryNum < 0) { + /* + * Roll around to the first query in the list. - FM + */ QueryNum = (QueryTotal - 1); } - } else { - /* - * Advance to the next query in the list. - FM - */ - QueryNum--; - } - if (QueryNum < 0) - /* - * Roll around to the first query in the list. - FM - */ - QueryNum = (QueryTotal - 1); if ((cp = (char *)HTList_objectAt(search_queries, QueryNum)) != NULL) { strcpy(prev_target, cp); diff --git a/src/LYGetFile.c b/src/LYGetFile.c index aaf3203f..4525dcbf 100644 --- a/src/LYGetFile.c +++ b/src/LYGetFile.c @@ -350,18 +350,12 @@ Try_Redirected_URL: */ LYDidRename = FALSE; return(NULLFILE); - } else { - return(NORMAL); } -#else - return(NORMAL); #endif /* VMS */ + return(NORMAL); } else if (url_type == LYNXDIRED_URL_TYPE) { #ifdef DIRED_SUPPORT - if (no_dired_support) { - HTUserMsg(DIRED_DISABLED); - return(NULLFILE); - } else { + if (!no_dired_support) { local_dired(doc); WWWDoc.address = doc->address; WWWDoc.post_data = doc->post_data; @@ -374,11 +368,9 @@ Try_Redirected_URL: return(NOT_FOUND); return(NORMAL); } -#else +#endif /* DIRED_SUPPORT */ HTUserMsg(DIRED_DISABLED); return(NULLFILE); -#endif /* DIRED_SUPPORT */ - } if (LYNoRefererHeader == FALSE && @@ -863,7 +855,7 @@ Try_Redirected_URL: url_type == LYNXCOMPILE_OPTS_URL_TYPE || url_type == LYNXHIST_URL_TYPE || url_type == LYNXCOOKIE_URL_TYPE || - url_type == LYNXMESSAGES_URL_TYPE || + url_type == LYNXMESSAGES_URL_TYPE || (LYValidate && url_type != HTTP_URL_TYPE && url_type != HTTPS_URL_TYPE) || @@ -1166,6 +1158,7 @@ PUBLIC int follow_link_number ARGS4( break; default: rel = *++p; + break; case 0: break; } diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h index 7efa8a4a..b39fe04a 100644 --- a/src/LYGlobalDefs.h +++ b/src/LYGlobalDefs.h @@ -38,6 +38,31 @@ #include <HTChunk.h> #endif +/* + * Ifdef's in case we have a working popen/pclose, useful for piping to the + * mail program. + */ +#if !defined(HAVE_POPEN) || defined(VMS) || defined(DOSPATH) || defined(__CYGWIN__) +#define CAN_PIPE_TO_MAILER 0 +#else +#define CAN_PIPE_TO_MAILER 1 +#endif + +/* + * Ifdef's for specific mailers: + */ +#ifdef VMS +#define USE_PMDF_MAILER 1 +#else +#define USE_PMDF_MAILER 0 +#endif + +#ifdef SH_EX +#define USE_BLAT_MAILER 1 +#else +#define USE_BLAT_MAILER 0 +#endif + #ifdef SOCKS extern BOOLEAN socks_flag; #endif /* SOCKS */ @@ -439,13 +464,16 @@ extern int lynx_timeout; #ifdef SH_EX extern BOOLEAN show_cfg; -extern BOOLEAN mail_is_blat; #ifdef WIN_EX extern int debug_delay; #endif extern BOOLEAN no_table_center; #endif +#if USE_BLAT_MAILER +extern BOOLEAN mail_is_blat; +#endif + #if defined(__CYGWIN__) extern void cygwin_conv_to_full_win32_path(char *posix, char *dos); extern void cygwin_conv_to_full_posix_path(char *dos, char *posix); diff --git a/src/LYHistory.c b/src/LYHistory.c index 6621e6d0..ba3c1a26 100644 --- a/src/LYHistory.c +++ b/src/LYHistory.c @@ -26,6 +26,7 @@ #include <LYexit.h> #include <LYLeaks.h> +#include <HTCJK.h> PUBLIC HTList * Visited_Links = NULL; /* List of safe popped docs. */ PUBLIC int Visited_Links_As = VISITED_LINKS_AS_TREE; @@ -37,6 +38,8 @@ PRIVATE VisitedLink *Latest_tree; PRIVATE VisitedLink *First_tree; PRIVATE VisitedLink *Last_by_first; +extern HTCJKlang HTCJK; + #ifdef LY_FIND_LEAKS /* * Utility for freeing the list of visited links. - FM @@ -75,6 +78,7 @@ PUBLIC void LYAddVisitedLink ARGS1( VisitedLink *new; HTList *cur; char *title = (doc->title ? doc->title : NO_TITLE); + char *tmp_buffer = NULL; if (!(doc->address && *doc->address)) { PrevVisitedLink = NULL; @@ -156,7 +160,26 @@ PUBLIC void LYAddVisitedLink ARGS1( if ((new = (VisitedLink *)calloc(1, sizeof(*new))) == NULL) outofmem(__FILE__, "LYAddVisitedLink"); StrAllocCopy(new->address, doc->address); - StrAllocCopy(new->title, title); + if (HTCJK == JAPANESE) { + if ((tmp_buffer = (char *) malloc (strlen(title)+1)) == 0) + outofmem(__FILE__, "LYAddVisitedLink"); + switch(kanji_code) { + case EUC: + TO_EUC((CONST unsigned char *) title, (unsigned char *) tmp_buffer); + break; + case SJIS: + TO_SJIS((CONST unsigned char *) title, (unsigned char *) tmp_buffer); + break; + default: + CTRACE((tfp, "\nLYADDVisitedLink: kanji_code is an unexpected value.")); + strcpy(tmp_buffer, title); + break; + } + StrAllocCopy(new->title, tmp_buffer); + FREE(tmp_buffer); + } else { + StrAllocCopy(new->title, title); + } /* First-visited chain */ HTList_appendObject(Visited_Links, new); /* At end */ @@ -259,6 +282,8 @@ PUBLIC void LYpush ARGS2( document *, doc, BOOLEAN, force_push) { + char *tmp_buffer = NULL; + /* * Don't push NULL file names. */ @@ -309,7 +334,26 @@ PUBLIC void LYpush ARGS2( history[nhist].link = doc->link; history[nhist].line = doc->line; history[nhist].title = NULL; - StrAllocCopy(history[nhist].title, doc->title); + if (HTCJK == JAPANESE) { + if ((tmp_buffer = (char *) malloc (strlen(doc->title)+1)) == 0) + outofmem(__FILE__, "LYpush"); + switch(kanji_code) { + case EUC: + TO_EUC((CONST unsigned char *) doc->title, (unsigned char *) tmp_buffer); + break; + case SJIS: + TO_SJIS((CONST unsigned char *) doc->title, (unsigned char *) tmp_buffer); + break; + default: + CTRACE((tfp, "\nLYpush: kanji_code is an unexpected value.")); + strcpy(tmp_buffer, doc->title); + break; + } + StrAllocCopy(history[nhist].title, tmp_buffer); + FREE(tmp_buffer); + } else { + StrAllocCopy(history[nhist].title, doc->title); + } history[nhist].address = NULL; StrAllocCopy(history[nhist].address, doc->address); history[nhist].post_data = NULL; diff --git a/src/LYJustify.h b/src/LYJustify.h index 7ecbd840..61de5df1 100644 --- a/src/LYJustify.h +++ b/src/LYJustify.h @@ -51,7 +51,7 @@ extern BOOL can_justify_stack_depth;/* can be 0 or 1 if all code is correct*/ * This is a macro (that uses 'me'). */ #define CAN_JUSTIFY_START mark_justify_start_position(me->text); -#define CANT_JUSTIFY_THIS_LINE can_justify_this_line=FALSE; +#define CANT_JUSTIFY_THIS_LINE can_justify_this_line = FALSE #define EMIT_IFDEF_EXP_JUSTIFY_ELTS(x) x /*defined in order not to wrap single line of code into #ifdef/#endif */ diff --git a/src/LYKeymap.c b/src/LYKeymap.c index b0d021cf..a21e4003 100644 --- a/src/LYKeymap.c +++ b/src/LYKeymap.c @@ -69,16 +69,20 @@ LYK_ABORT, LYK_END, LYK_NEXT_PAGE, 0, LYK_HISTORY, LYK_FASTFORW_LINK, LYK_ACTIVATE, LYK_COOKIE_JAR, /* bs */ /* ht */ /* nl */ /* ^K */ -#ifdef SH_EX /* 1998/10/02 (Fri) 08:48:44 */ +#ifdef KANJI_CODE_OVERRIDE LYK_CHG_KCODE, LYK_ACTIVATE, LYK_DOWN_TWO, 0, /* ^L */ /* cr */ /* ^N */ /* ^O */ -LYK_UP_TWO, LYK_CHG_CENTER, LYK_RELOAD, LYK_TO_CLIPBOARD, -/* ^P */ /* XON */ /* ^R */ /* ^S */ #else LYK_REFRESH, LYK_ACTIVATE, LYK_DOWN_TWO, 0, /* ^L */ /* cr */ /* ^N */ /* ^O */ +#endif +#ifdef SH_EX /* 1998/10/02 (Fri) 08:48:44 */ +LYK_UP_TWO, LYK_CHG_CENTER, LYK_RELOAD, LYK_TO_CLIPBOARD, +/* ^P */ /* XON */ /* ^R */ /* ^S */ + +#else LYK_UP_TWO, 0, LYK_RELOAD, 0, /* ^P */ /* XON */ /* ^R */ /* XOFF */ #endif diff --git a/src/LYKeymap.h b/src/LYKeymap.h index 54ee68de..bd0048b8 100644 --- a/src/LYKeymap.h +++ b/src/LYKeymap.h @@ -228,9 +228,10 @@ typedef enum { #ifdef SH_EX , LYK_CHG_CENTER , LYK_TO_CLIPBOARD - , LYK_CHG_KCODE #endif /* SH_EX */ - +#ifdef KANJI_CODE_OVERRIDE + , LYK_CHG_KCODE +#endif } LYKeymapCode; diff --git a/src/LYLocal.h b/src/LYLocal.h index 264c6d4f..4ba498d2 100644 --- a/src/LYLocal.h +++ b/src/LYLocal.h @@ -3,31 +3,7 @@ #ifdef DIRED_SUPPORT -#ifdef VMS -#include <types.h> -#include <stat.h> -#endif /* VMS */ - -#ifndef S_IRWXU -#define S_IRWXU 0000700 /* rwx, owner */ -#define S_IRUSR 0000400 /* read permission, owner */ -#define S_IWUSR 0000200 /* write permission, owner */ -#define S_IXUSR 0000100 /* execute/search permission, owner */ -#define S_IRWXG 0000070 /* rwx, group */ -#define S_IRGRP 0000040 /* read permission, group */ -#define S_IWGRP 0000020 /* write permission, grougroup */ -#define S_IXGRP 0000010 /* execute/search permission, group */ -#define S_IRWXO 0000007 /* rwx, other */ -#define S_IROTH 0000004 /* read permission, other */ -#define S_IWOTH 0000002 /* write permission, other */ -#define S_IXOTH 0000001 /* execute/search permission, other */ -#endif /* !S_IRWXU */ - -#ifndef S_ISUID /* Unusual modes */ -#define S_ISUID 0x800 /* set user id on execution */ -#define S_ISGID 0x400 /* set group id on execution */ -#define S_ISVTX 0x200 /* save swapped text even after use */ -#endif /* !S_ISUID */ +#include <HTUtils.h> /* Special return code for LYMainLoop.c */ #define PERMIT_FORM_RESULT (-99) @@ -42,24 +18,12 @@ extern BOOLEAN local_install PARAMS((char *destpath, char *srcpath, char **newpa /* MainLoop needs to know about this one for atexit cleanup */ extern void clear_tags NOPARAMS; -/* Define the PRIVATE routines in case they ever go PUBLIC - -extern BOOLEAN modify_name PARAMS((char *testpath)); -extern BOOLEAN modify_location PARAMS((char *testpath)); -extern BOOLEAN create_file PARAMS((char *testpath)); -extern BOOLEAN create_directory PARAMS((char *testpath)); -extern BOOLEAN modify_tagged PARAMS((char *testpath)); -extern BOOLEAN remove_tagged NOPARAMS; -extern BOOLEAN remove_single PARAMS ((char *testpath)); -extern BOOLEAN is_a_file PARAMS((char *testname)); -*/ -extern void tagflag PARAMS((int flag, int cur)); -extern void showtags PARAMS((HTList *tag)); -extern int local_dired PARAMS((document *doc)); extern int dired_options PARAMS ((document *doc, char ** newfile)); - +extern int local_dired PARAMS((document *doc)); extern void add_menu_item PARAMS((char *str)); extern void reset_dired_menu NOPARAMS; +extern void showtags PARAMS((HTList *tag)); +extern void tagflag PARAMS((int flag, int cur)); #endif /* DIRED_SUPPORT */ diff --git a/src/LYMail.c b/src/LYMail.c index 9db9e1c1..613b0556 100644 --- a/src/LYMail.c +++ b/src/LYMail.c @@ -31,9 +31,7 @@ PRIVATE void remove_tildes PARAMS((char *string)); #define system(p) xsystem(p) /* 1998/06/05 (Fri) 21:53:30 */ #endif -#ifdef SH_EX /* 1999/01/03 (Sun) 22:00:47 */ - -extern BOOLEAN mail_is_blat; +#if USE_BLAT_MAILER /* syntax: @@ -55,7 +53,7 @@ Blat <filename> -t <recipient> [optional switches (see below)] static char bl_cmd_file[512]; -PRIVATE void blat_clean() +PRIVATE void blat_clean(void) { if (bl_cmd_file[0]) { bl_cmd_file[0] = '\0'; @@ -68,8 +66,7 @@ PRIVATE char *blat_cmd( char *address, char *subject, char *ccaddr, - char *mail_addr -) + char *mail_addr) { FILE *fp; static char b_cmd[512]; @@ -137,8 +134,8 @@ PRIVATE void SafeHTUnEscape ARGS1( ** mailform() sends form content to the mailto address(es). - FM */ PUBLIC void mailform ARGS4( - CONST char *, mailto_address GCC_UNUSED, - CONST char *, mailto_subject GCC_UNUSED, + CONST char *, mailto_address, + CONST char *, mailto_subject, CONST char *, mailto_content, CONST char *, mailto_type) { @@ -147,29 +144,23 @@ PUBLIC void mailform ARGS4( char *ccaddr = NULL; char *keywords = NULL; char *cp = NULL; + char self[80]; char subject[80]; + char *searchpart = NULL; char cmd[512]; - int len, i; + char *cp0 = NULL, *cp1 = NULL; + int ch, len, i; #ifdef VMS char *address_ptr1, *address_ptr2; - BOOLEAN isPMDF = FALSE; + BOOLEAN isPMDF = !strncasecomp(system_mail, "PMDF SEND", 9); BOOLEAN first = TRUE; FILE *hfd; char hdrfile[LY_MAXPATH]; #endif #if defined(VMS) || defined(DOSPATH) || defined(SH_EX) - int ch; - char self[80]; - char *searchpart = NULL; - char *cp0 = NULL, *cp1 = NULL; char *command = NULL; char my_tmpfile[LY_MAXPATH]; - -#ifdef VMS - if (!strncasecomp(system_mail, "PMDF SEND", 9)) { - isPMDF = TRUE; - } -#endif /* VMS */ +#endif if (!mailto_address || !mailto_content) { HTAlert(BAD_FORM_MAILTO); @@ -421,7 +412,30 @@ PUBLIC void mailform ARGS4( } } -#if defined(VMS) || defined(DOSPATH) || defined(SH_EX) +#if CAN_PIPE_TO_MAILER + sprintf(cmd, "%s %s", system_mail, system_mail_flags); + if ((fd = popen(cmd, "w")) == NULL) { + HTAlert(FORM_MAILTO_FAILED); + FREE(address); + FREE(ccaddr); + FREE(keywords); + return; + } + + if (mailto_type && *mailto_type) { + fprintf(fd, "Mime-Version: 1.0\n"); + fprintf(fd, "Content-Type: %s\n", mailto_type); + } + fprintf(fd, "To: %s\n", address); + if (personal_mail_address && *personal_mail_address) + fprintf(fd, "From: %s\n", personal_mail_address); + if (ccaddr != NULL && *ccaddr != '\0') + fprintf(fd, "Cc: %s\n", ccaddr); + fprintf(fd, "Subject: %s\n\n", subject); + if (keywords != NULL && *keywords != '\0') + fprintf(fd, "Keywords: %s\n", keywords); + _statusline(SENDING_FORM_CONTENT); +#else /* e.g., VMS, DOSPATH */ if ((fd = LYOpenTemp(my_tmpfile, ".txt", "w")) == NULL) { HTAlert(FORM_MAILTO_FAILED); FREE(address); @@ -429,7 +443,6 @@ PUBLIC void mailform ARGS4( FREE(keywords); return; } -#endif #ifdef VMS if (isPMDF) { if ((hfd = LYOpenTemp(hdrfile, ".txt", "w")) == NULL) { @@ -458,11 +471,13 @@ PUBLIC void mailform ARGS4( fprintf(fd, "X-Content-Type: %s\n\n", mailto_type); } #else /* !VMS (DOS) */ -#ifdef SH_EX +#if USE_BLAT_MAILER if (mail_is_blat) { if (strlen(subject) > 70) subject[70] = '\0'; - } else { + } else +#endif + { if (mailto_type && *mailto_type) { fprintf(fd, "Mime-Version: 1.0\n"); fprintf(fd, "Content-Type: %s\n", mailto_type); @@ -473,43 +488,8 @@ PUBLIC void mailform ARGS4( remove_tildes(self); fprintf(fd,"Subject: %.70s\n\n", subject); } -#else - if (mailto_type && *mailto_type) { - fprintf(fd, "Mime-Version: 1.0\n"); - fprintf(fd, "Content-Type: %s\n", mailto_type); - } - fprintf(fd,"To: %s\n", address); - if (personal_mail_address && *personal_mail_address) - fprintf(fd,"From: %s\n", personal_mail_address); - remove_tildes(self); - fprintf(fd,"Subject: %.70s\n\n", subject); -#endif /* SH_EX */ -#endif - -#else /* !(defined(VMS) || defined(DOSPATH) || defined(SH_EX)) */ - sprintf(cmd, "%s %s", system_mail, system_mail_flags); - if ((fd = popen(cmd, "w")) == NULL) { - HTAlert(FORM_MAILTO_FAILED); - FREE(address); - FREE(ccaddr); - FREE(keywords); - return; - } - - if (mailto_type && *mailto_type) { - fprintf(fd, "Mime-Version: 1.0\n"); - fprintf(fd, "Content-Type: %s\n", mailto_type); - } - fprintf(fd, "To: %s\n", address); - if (personal_mail_address && *personal_mail_address) - fprintf(fd, "From: %s\n", personal_mail_address); - if (ccaddr != NULL && *ccaddr != '\0') - fprintf(fd, "Cc: %s\n", ccaddr); - fprintf(fd, "Subject: %s\n\n", subject); - if (keywords != NULL && *keywords != '\0') - fprintf(fd, "Keywords: %s\n", keywords); - _statusline(SENDING_FORM_CONTENT); #endif /* VMS */ +#endif /* CAN_PIPE_TO_MAILER */ /* * Break up the content into lines with a maximum length of 78. @@ -543,7 +523,7 @@ PUBLIC void mailform ARGS4( if (len) fprintf(fd, "%s\n", &mailto_content[i]); -#if defined(UNIX) && !defined(__CYGWIN__) +#if CAN_PIPE_TO_MAILER pclose(fd); sleep(MessageSecs); #endif /* UNIX */ @@ -666,7 +646,7 @@ PUBLIC void mailform ARGS4( LYRemoveTemp(my_tmpfile); LYRemoveTemp(hdrfile); #else /* DOSPATH */ -#ifdef SH_EX /* 1998/05/04 (Mon) 22:18:44 */ +#if USE_BLAT_MAILER if (mail_is_blat) { StrAllocCopy(command, blat_cmd( @@ -678,7 +658,9 @@ PUBLIC void mailform ARGS4( personal_mail_address ) ); - } else { + } else +#endif + { /* for sendmail.exe */ StrAllocCopy(command, system_mail); StrAllocCat(command, " -t \""); @@ -686,13 +668,7 @@ PUBLIC void mailform ARGS4( StrAllocCat(command, "\" -F "); StrAllocCat(command, my_tmpfile); } -#else /* !SH_EX */ - StrAllocCopy(command, system_mail); - StrAllocCat(command, " -t \""); - StrAllocCat(command, address); - StrAllocCat(command, "\" -F "); - StrAllocCat(command, my_tmpfile); -#endif + stop_curses(); printf("%s\n\n$ %s\n\n%s", SENDING_FORM_CONTENT, command, PLEASE_WAIT); LYSystem(command); /* Mail sending form content (DOS/Windows) */ @@ -700,10 +676,11 @@ PUBLIC void mailform ARGS4( sleep(MessageSecs); start_curses(); LYRemoveTemp(my_tmpfile); -#ifdef SH_EX + +#if USE_BLAT_MAILER if (mail_is_blat) blat_clean(); -#endif /* SH_EX */ +#endif #endif #endif /* VMS */ @@ -744,7 +721,6 @@ PUBLIC void mailmsg ARGS4( char hdrfile[LY_MAXPATH]; FILE *hfd; char *command = NULL; - BOOLEAN first = TRUE; CTRACE((tfp, "mailmsg(%d, \"%s\", \"%s\", \"%s\")\n", cur, owner_address?owner_address:"<nil>", @@ -861,7 +837,7 @@ PUBLIC void mailmsg ARGS4( return; } -#if defined(UNIX) && !defined(__CYGWIN__) +#if CAN_PIPE_TO_MAILER HTSprintf0(&cmd, "%s %s", system_mail, system_mail_flags); if ((fd = popen(cmd, "w")) == NULL) { FREE(address); @@ -876,8 +852,7 @@ PUBLIC void mailmsg ARGS4( } fprintf(fd, "X-URL: %s\n", filename); fprintf(fd, "X-Mailer: Lynx, Version %s\n\n", LYNX_VERSION); -#endif /* UNIX */ -#if defined(VMS) || defined(DOSPATH) || defined(WIN_EX) +#else if ((fd = LYOpenTemp(my_tmpfile, ".txt", "w")) == NULL) { CTRACE((tfp, "mailmsg: Could not fopen '%s'.\n", my_tmpfile)); FREE(address); @@ -897,11 +872,11 @@ PUBLIC void mailmsg ARGS4( fprintf(fd, "X-URL: %s\n", filename); fprintf(fd, "X-Mailer: Lynx, Version %s\n\n", LYNX_VERSION); } -#else +#else /* !VMS, e.g., DOSPATH */ sprintf(subject, "Lynx Error in %.56s", filename); ccaddr = personal_mail_address; #endif /* VMS */ -#endif /* VMS || DOSPATH */ +#endif /* CAN_PIPE_TO_MAILER */ fprintf(fd, gettext("The link %s :?: %s \n"), links[cur].lname, links[cur].target); @@ -986,7 +961,7 @@ PUBLIC void mailmsg ARGS4( LYRemoveTemp(hdrfile); } #else /* DOSPATH */ -#ifdef SH_EX +#if USE_BLAT_MAILER if (mail_is_blat) strcpy(cmd, blat_cmd( @@ -999,17 +974,16 @@ PUBLIC void mailmsg ARGS4( ) ); else +#endif sprintf(cmd, "%s -t \"%s\" -F %s", system_mail, address, my_tmpfile); -#else /* !SH_EX */ - sprintf(cmd, "%s -t \"%s\" -F %s", system_mail, address, my_tmpfile); -#endif /* SH_EX */ + LYSystem(cmd); /* Mail (DOS/Windows) */ #if 0 /* Not SH_EX */ FREE(command); #endif LYRemoveTemp(my_tmpfile); -#ifdef SH_EX +#if USE_BLAT_MAILER if (mail_is_blat) blat_clean(); #endif @@ -1399,11 +1373,11 @@ PUBLIC void reply_by_mail ARGS4( (filename && *filename) ? "" : address); fprintf((isPMDF ? hfd : fd), "X-Mailer: Lynx, Version %s\n",LYNX_VERSION); -#ifdef NO_ANONYMOUS_MAIL +#ifdef NO_ANONYMOUS_EMAIL if (!isPMDF) { fprintf(fd, "\n"); } -#endif /* NO_ANONYMOUS_MAIL */ +#endif /* NO_ANONYMOUS_EMAIL */ } #else /* Unix/DOS/Windows */ /* @@ -1636,15 +1610,8 @@ PUBLIC void reply_by_mail ARGS4( } addstr("\n"); remove_tildes(user_input); -#ifdef VMS - sprintf(subject, "%.70s", user_input); -#else -#ifdef SH_EX - if (mail_is_blat) - sprintf(subject, "%.70s", user_input); -#else /* @@@ */ sprintf(subject, "%.70s", user_input); -#endif +#ifndef VMS StrAllocCat(header, "Subject: "); StrAllocCat(header, user_input); StrAllocCat(header, "\n"); @@ -2013,86 +1980,83 @@ PUBLIC void reply_by_mail ARGS4( FREE(command); sleep(AlertSecs); start_curses(); - goto cleandown; #else /* Unix/DOS/Windows */ /* * Send the tmpfile into sendmail. */ _statusline(SENDING_YOUR_MSG); - sprintf(cmd, "%s %s", system_mail, system_mail_flags); -#if defined(DOSPATH) || defined(WIN_EX) - if ((fp = LYOpenTemp(tmpfile2, ".txt", "w")) == NULL) { - HTAlert(MAILTO_URL_TEMPOPEN_FAILED); - return; - } -#else +#if CAN_PIPE_TO_MAILER signal(SIGINT, SIG_IGN); + sprintf(cmd, "%s %s", system_mail, system_mail_flags); + CTRACE((tfp, "%s\n", cmd)); fp = popen(cmd, "w"); if (fp == NULL) { HTInfoMsg(COMMENT_REQUEST_CANCELLED); - goto cleanup; } -#endif /* DOSPATH */ - fd = fopen(my_tmpfile, TXT_R); - if (fd == NULL) { - HTInfoMsg(COMMENT_REQUEST_CANCELLED); - pclose(fp); - goto cleanup; +#else + if ((fp = LYOpenTemp(tmpfile2, ".txt", "w")) == NULL) { + HTAlert(MAILTO_URL_TEMPOPEN_FAILED); } -#ifdef SH_EX - if (!mail_is_blat) - fputs(header, fp); +#endif /* CAN_PIPE_TO_MAILER */ + if (fp != 0) { + fd = fopen(my_tmpfile, TXT_R); + if (fd == NULL) { + HTInfoMsg(COMMENT_REQUEST_CANCELLED); +#if CAN_PIPE_TO_MAILER + pclose(fp); #else - fputs(header, fp); + LYCloseTempFP(fp); +#endif /* CAN_PIPE_TO_MAILER */ + } else { +#if USE_BLAT_MAILER + if (!mail_is_blat) + fputs(header, fp); +#else + fputs(header, fp); #endif - while ((n = fread(buf, 1, sizeof(buf), fd)) != 0) { - fwrite(buf, 1, n, fp); - } -#if defined(DOSPATH) || defined(SH_EX) -#ifdef SH_EX /* 1998/05/04 (Mon) 22:40:35 */ - if (mail_is_blat) { - StrAllocCopy(command, - blat_cmd( - system_mail, - tmpfile2, - address, - subject, - ccaddr, - personal_mail_address - ) - ); - } else { - StrAllocCopy(command, system_mail); - StrAllocCat(command, " -t \""); - StrAllocCat(command, address); - StrAllocCat(command, "\" -F "); - StrAllocCat(command, tmpfile2); - } -#else /* DOSPATH */ - StrAllocCopy(command, system_mail); - StrAllocCat(command, " -t \""); - StrAllocCat(command, address); - StrAllocCat(command, "\" -F "); - StrAllocCat(command, tmpfile2); + while ((n = fread(buf, 1, sizeof(buf), fd)) != 0) { + fwrite(buf, 1, n, fp); + } +#if CAN_PIPE_TO_MAILER + pclose(fp); +#else + LYCloseTempFP(fp); /* Close the tmpfile. */ +#if USE_BLAT_MAILER + if (mail_is_blat) { + StrAllocCopy(command, + blat_cmd( + system_mail, + tmpfile2, + address, + subject, + ccaddr, + personal_mail_address + ) + ); + } else #endif /* SH_EX */ - LYCloseTempFP(fp); /* Close the tmpfile. */ - stop_curses(); - printf("%s\n\n$ %s\n\n%s", SENDING_COMMENT, command, PLEASE_WAIT); - LYSystem(command); /* SENDING COMMENT (DOS/Windows/Unix) */ - FREE(command); - sleep(MessageSecs); - start_curses(); - LYRemoveTemp(tmpfile2); /* Delete the tmpfile. */ -#ifdef SH_EX - if (mail_is_blat) - blat_clean(); + { + StrAllocCopy(command, system_mail); + StrAllocCat(command, " -t \""); + StrAllocCat(command, address); + StrAllocCat(command, "\" -F "); + StrAllocCat(command, tmpfile2); + } + stop_curses(); + printf("%s\n\n$ %s\n\n%s", SENDING_COMMENT, command, PLEASE_WAIT); + LYSystem(command); /* SENDING COMMENT (DOS/Windows/Unix) */ + FREE(command); + sleep(MessageSecs); + start_curses(); + LYRemoveTemp(tmpfile2); /* Delete the tmpfile. */ +#if USE_BLAT_MAILER + if (mail_is_blat) + blat_clean(); #endif -#else /* !DOSPATH */ - pclose(fp); -#endif /* DOSPATH */ - fclose(fd); /* Close the tmpfile. */ - - CTRACE((tfp, "%s\n", cmd)); +#endif /* CAN_PIPE_TO_MAILER */ + fclose(fd); /* Close the tmpfile. */ + } + } #endif /* VMS */ /* @@ -2100,14 +2064,8 @@ PUBLIC void reply_by_mail ARGS4( */ cleanup: signal(SIGINT, cleanup_sig); -#if !defined(VMS) && !defined(DOSPATH) || defined(SH_EX) - FREE(header); -#endif /* !VMS */ - -#if defined(VMS) -cleandown: -#endif /* VMS */ term_letter = FALSE; + #ifdef VMS FREE(command); while (LYRemoveTemp(my_tmpfile) == 0) @@ -2116,8 +2074,10 @@ cleandown: LYRemoveTemp(hdrfile); /* Delete the hdrfile. */ } #else + FREE(header); LYRemoveTemp(my_tmpfile); /* Delete the tmpfile. */ #endif /* VMS */ + FREE(address); FREE(ccaddr); FREE(keywords); diff --git a/src/LYMain.c b/src/LYMain.c index 1d0434d6..52c8600b 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -299,13 +299,16 @@ PUBLIC BOOLEAN system_is_NT = FALSE; #ifdef SH_EX PUBLIC BOOLEAN show_cfg = FALSE; -PUBLIC BOOLEAN mail_is_blat = TRUE; #ifdef WIN_EX PUBLIC int debug_delay = 0; /* 1998/10/06 (Tue) 08:41:20 */ #endif PUBLIC BOOLEAN no_table_center = FALSE; /* 1998/10/09 (Fri) 15:12:49 */ #endif /* SH_EX */ +#if USE_BLAT_MAILER +PUBLIC BOOLEAN mail_is_blat = TRUE; +#endif + PUBLIC char *editor = NULL; /* the name of the current editor */ PUBLIC char *jumpfile = NULL; /* the name of the default jumps file */ PUBLIC char *jumpprompt = NULL; /* the default jumps prompt */ @@ -3351,7 +3354,7 @@ keys (may be incompatible with some curses packages)" "=NUMBER\nmaximum news articles in listings before chunking" ), #endif -#ifdef SH_EX +#if USE_BLAT_MAILER PARSE_SET( "noblat", TOGGLE_ARG, &mail_is_blat, "select mail tool (`BLAT' ==> `sendmail')" diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index d8996f8e..5704abd1 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -39,11 +39,16 @@ #include <LYMainLoop.h> #include <LYPrettySrc.h> -#if defined(CJK_EX) /* 1999/05/25 (Tue) 11:10:45 */ +#ifdef KANJI_CODE_OVERRIDE #include <HTCJK.h> extern HTCJKlang HTCJK; +#endif + +#if defined(CJK_EX) /* 1999/05/25 (Tue) 11:10:45 */ extern char *string_short(char *str, int cut_pos); /* LYExtern.c */ +#endif +#ifdef KANJI_CODE_OVERRIDE PUBLIC char *str_kcode(HTkcode code) { char *p; @@ -90,17 +95,21 @@ PUBLIC char *str_kcode(HTkcode code) return buff; } +#endif +#ifdef CJK_EX #ifdef WIN_EX PRIVATE char *str_sjis(char *to, char *from) { if (!LYRawMode) { strcpy(to, from); +#ifdef KANJI_CODE_OVERRIDE } else if (last_kcode == EUC) { EUC_TO_SJIS(from, to); } else if (last_kcode == SJIS) { strcpy(to, from); +#endif } else { TO_SJIS(from, to); } @@ -1214,6 +1223,7 @@ gettext("Enctype multipart/form-data not yet supported! Cannot submit.")); *c = DO_NOTHING; break; } + /* FALLTHRU */ #endif default: if ((real_cmd == LYK_ACTIVATE || real_cmd == LYK_SUBMIT) && @@ -1824,6 +1834,8 @@ PRIVATE void handle_LYK_DIRED_MENU ARGS3( int, real_c GCC_UNUSED) { #ifdef VMS + char *cp, *temp; + /* * Check if the CSwing Directory/File Manager is available. * Will be disabled if LYCSwingPath is NULL, zero-length, @@ -1940,7 +1952,6 @@ PRIVATE void handle_LYK_DIRED_MENU ARGS3( LYSystem(temp); start_curses(); FREE(temp); - return; #else /* * Don't do if not allowed or already viewing the menu. @@ -1952,8 +1963,8 @@ PRIVATE void handle_LYK_DIRED_MENU ARGS3( dired_options(&curdoc,&newdoc.address); *refresh_screen = TRUE; /* redisplay */ } -} #endif /* VMS */ +} #endif /* defined(DIRED_SUPPORT) || defined(VMS) */ PRIVATE int handle_LYK_DOWNLOAD ARGS3( @@ -3173,7 +3184,7 @@ PRIVATE void handle_LYK_INDEX ARGS2( } } else { -#ifdef CJK_EX /* 1997/12/13 (Sat) 15:20:18 */ +#ifdef KANJI_CODE_OVERRIDE if (HTCJK == JAPANESE) { last_kcode = NOKANJI; /* AUTO */ } @@ -4718,7 +4729,7 @@ PRIVATE void handle_LYK_VIEW_BOOKMARK ARGS3( *refresh_screen = TRUE; return; } -#if defined(CJK_EX) /* 1997/12/13 (Sat) 15:20:18 */ +#ifdef KANJI_CODE_OVERRIDE if (HTCJK == JAPANESE) { last_kcode = NOKANJI; /* AUTO */ } @@ -5255,6 +5266,7 @@ try_again: try_internal = TRUE; } else #endif /* TRACK_INTERNAL_LINKS */ + { /* * Force a no_cache override unless * it's a bookmark file, or it has POST content @@ -5265,14 +5277,15 @@ try_again: * value from getfile(). - FM */ if ((newdoc.bookmark != NULL) || - (newdoc.post_data != NULL && - !newdoc.safe && - LYresubmit_posts && - !override_LYresubmit_posts && - NO_INTERNAL_OR_DIFFERENT(&curdoc, &newdoc))) { - LYoverride_no_cache = FALSE; - } else { - LYoverride_no_cache = TRUE; + (newdoc.post_data != NULL && + !newdoc.safe && + LYresubmit_posts && + !override_LYresubmit_posts && + NO_INTERNAL_OR_DIFFERENT(&curdoc, &newdoc))) { + LYoverride_no_cache = FALSE; + } else { + LYoverride_no_cache = TRUE; + } } } override_LYresubmit_posts = FALSE; @@ -5504,6 +5517,7 @@ try_again: exit_immediately_with_error_message(NOT_FOUND, first_file); return(-1); } + /* FALLTHRU */ case NULLFILE: /* @@ -5694,14 +5708,14 @@ try_again: } else { strcpy(cp, (char *)&temp[len]); } - for (i = 0; i <= MBM_V_MAXFILES; i++) { - if (MBM_A_subbookmark[i] && #ifdef VMS - !strcasecomp(cp, MBM_A_subbookmark[i]) +#define CompareBookmark(a,b) strcasecomp(a, b) #else - !strcmp(cp, MBM_A_subbookmark[i]) +#define CompareBookmark(a,b) strcmp(a, b) #endif /* VMS */ - ) { + for (i = 0; i <= MBM_V_MAXFILES; i++) { + if (MBM_A_subbookmark[i] && + !CompareBookmark(cp, MBM_A_subbookmark[i])) { StrAllocCopy(BookmarkPage, MBM_A_subbookmark[i]); break; @@ -6251,7 +6265,7 @@ try_again: /* Show the URL & kanji code . */ if (strlen(links[curdoc.link].lname) == 0) { - if (links[curdoc.link].type == WWW_FORM_LINK_TYPE) + if (links[curdoc.link].type == WWW_FORM_LINK_TYPE) { switch(links[curdoc.link].form->type) { case F_TEXT_SUBMIT_TYPE: @@ -6284,6 +6298,7 @@ try_again: break; } set_ws_title(p); + } } else { if (user_mode == ADVANCED_MODE) { p = curdoc.title; @@ -6697,14 +6712,15 @@ new_cmd: /* case LYK_F_LINK_NUM: c = '\0'; - case LYK_1: - case LYK_2: - case LYK_3: - case LYK_4: - case LYK_5: - case LYK_6: - case LYK_7: - case LYK_8: + /* FALLTHRU */ + case LYK_1: /* FALLTHRU */ + case LYK_2: /* FALLTHRU */ + case LYK_3: /* FALLTHRU */ + case LYK_4: /* FALLTHRU */ + case LYK_5: /* FALLTHRU */ + case LYK_6: /* FALLTHRU */ + case LYK_7: /* FALLTHRU */ + case LYK_8: /* FALLTHRU */ case LYK_9: handle_LYK_digit(c, &force_load, user_input_buffer, &old_c, real_c, &try_internal); @@ -6724,8 +6740,8 @@ new_cmd: /* no_table_center = TRUE; HTInfoMsg("TABLE center disable."); } - /* goto RELOAD */ #endif + /* FALLTHRU */ case LYK_RELOAD: /* control-R to reload and refresh */ handle_LYK_RELOAD(real_cmd); break; @@ -6796,7 +6812,7 @@ new_cmd: /* break; #endif -#if defined(CJK_EX) && defined(SH_EX) /* 1999/02/25 (Thu) 15:29:05 */ +#ifdef KANJI_CODE_OVERRIDE case LYK_CHG_KCODE: /* ^L */ if (LYRawMode && (HTCJK == JAPANESE)) { switch(last_kcode) { diff --git a/src/LYOptions.c b/src/LYOptions.c index 7ee2397b..c97dac50 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -24,6 +24,8 @@ #include <LYLeaks.h> +extern HTCJKlang HTCJK; + BOOLEAN term_options; PRIVATE void terminate_options PARAMS((int sig)); @@ -229,6 +231,21 @@ PRIVATE void addlbl ARGS1(CONST char *, text) stop_bold(); } +#if !defined(VMS) || defined(USE_SLANG) +#define HANDLE_LYOPTIONS \ + if (term_options) { \ + term_options = FALSE; \ + } else { \ + AddValueAccepted = TRUE; \ + } \ + goto draw_options +#else +#define HANDLE_LYOPTIONS \ + term_options = FALSE; \ + if (use_assume_charset != old_use_assume_charset) \ + goto draw_options +#endif /* !VMS || USE_SLANG */ + PUBLIC void LYoptions NOARGS { #if defined(ENABLE_OPTS_CHANGE_EXEC) && (defined(EXEC_LINKS) || defined(EXEC_SCRIPTS)) @@ -585,14 +602,16 @@ draw_options: sizeof(display_option), NORECALL); stop_bold(); move(L_DISPLAY, COL_OPTION_VALUES); - if ((term_options || ch == -1) || - (x_display != NULL && + #ifdef VMS - !strcasecomp(x_display, display_option))) +#define CompareEnvVars(a,b) strcasecomp(a, b) #else - !strcmp(x_display, display_option))) +#define CompareEnvVars(a,b) strcmp(a, b) #endif /* VMS */ - { + + if ((term_options || ch == -1) || + (x_display != NULL && + !CompareEnvVars(x_display, display_option))) { /* * Cancelled, or a non-NULL display string * wasn't changed. - FM @@ -691,16 +710,7 @@ draw_options: } response = ' '; if (LYSelectPopups) { -#if !defined(VMS) || defined(USE_SLANG) - if (term_options) { - term_options = FALSE; - } else { - AddValueAccepted = TRUE; - } - goto draw_options; -#else - term_options = FALSE; -#endif /* !VMS || USE_SLANG */ + HANDLE_LYOPTIONS; } break; @@ -796,16 +806,7 @@ draw_options: FREE(choices[3]); response = ' '; if (LYSelectPopups) { -#if !defined(VMS) || defined(USE_SLANG) - if (term_options) { - term_options = FALSE; - } else { - AddValueAccepted = TRUE; - } - goto draw_options; -#else - term_options = FALSE; -#endif /* !VMS || USE_SLANG */ + HANDLE_LYOPTIONS; } break; @@ -922,7 +923,8 @@ draw_options: StrAllocCopy(UCAssume_MIMEcharset, LYCharSet_UC[UCLYhndl_for_unspec].MIMEname); } - LYRawMode = (BOOL) (UCLYhndl_for_unspec == current_char_set); + if (HTCJK != JAPANESE) + LYRawMode = (BOOL) (UCLYhndl_for_unspec == current_char_set); HTMLSetUseDefaultRawMode(current_char_set, LYRawMode); HTMLSetCharacterHandling(current_char_set); CurrentAssumeCharSet = UCLYhndl_for_unspec; @@ -939,16 +941,7 @@ draw_options: FREE(assume_list); response = ' '; if (LYSelectPopups) { -#if !defined(VMS) || defined(USE_SLANG) - if (term_options) { - term_options = FALSE; - } else { - AddValueAccepted = TRUE; - } - goto draw_options; -#else - term_options = FALSE; -#endif /* !VMS || USE_SLANG */ + HANDLE_LYOPTIONS; } } else { _statusline(NEED_ADVANCED_USER_MODE); @@ -1009,16 +1002,7 @@ draw_options: } response = ' '; if (LYSelectPopups) { -#if !defined(VMS) || defined(USE_SLANG) - if (term_options) { - term_options = FALSE; - } else { - AddValueAccepted = TRUE; - } - goto draw_options; -#else - term_options = FALSE; -#endif /* !VMS || USE_SLANG */ + HANDLE_LYOPTIONS; } break; @@ -1310,16 +1294,7 @@ draw_options: #endif response = ' '; if (LYSelectPopups && !no_option_save) { -#if !defined(VMS) || defined(USE_SLANG) - if (term_options) { - term_options = FALSE; - } else { - AddValueAccepted = TRUE; - } - goto draw_options; -#else - term_options = FALSE; -#endif /* !VMS || USE_SLANG */ + HANDLE_LYOPTIONS; } break; #endif /* USE_SLANG or COLOR_CURSES */ @@ -1382,16 +1357,7 @@ draw_options: FREE(choices[2]); response = ' '; if (LYSelectPopups) { -#if !defined(VMS) || defined(USE_SLANG) - if (term_options) { - term_options = FALSE; - } else { - AddValueAccepted = TRUE; - } - goto draw_options; -#else - term_options = FALSE; -#endif /* !VMS || USE_SLANG */ + HANDLE_LYOPTIONS; } break; @@ -1414,16 +1380,7 @@ draw_options: } response = ' '; if (LYSelectPopups) { -#if !defined(VMS) || defined(USE_SLANG) - if (term_options) { - term_options = FALSE; - } else { - AddValueAccepted = TRUE; - } - goto draw_options; -#else - term_options = FALSE; -#endif /* !VMS || USE_SLANG */ + HANDLE_LYOPTIONS; } break; @@ -1447,16 +1404,7 @@ draw_options: } response = ' '; if (LYSelectPopups) { -#if !defined(VMS) || defined(USE_SLANG) - if (term_options) { - term_options = FALSE; - } else { - AddValueAccepted = TRUE; - } - goto draw_options; -#else - term_options = FALSE; -#endif /* !VMS || USE_SLANG */ + HANDLE_LYOPTIONS; } break; #endif /* EXP_KEYBOARD_LAYOUT */ @@ -1494,16 +1442,7 @@ draw_options: FREE(choices[2]); response = ' '; if (LYSelectPopups) { -#if !defined(VMS) || defined(USE_SLANG) - if (term_options) { - term_options = FALSE; - } else { - AddValueAccepted = TRUE; - } - goto draw_options; -#else - term_options = FALSE; -#endif /* !VMS || USE_SLANG */ + HANDLE_LYOPTIONS; } break; #endif /* DIRED_SUPPORT */ @@ -1549,18 +1488,7 @@ draw_options: } response = ' '; if (LYSelectPopups) { -#if !defined(VMS) || defined(USE_SLANG) - if (term_options) { - term_options = FALSE; - } else { - AddValueAccepted = TRUE; - } - goto draw_options; -#else - term_options = FALSE; - if (use_assume_charset != old_use_assume_charset) - goto draw_options; -#endif /* !VMS || USE_SLANG */ + HANDLE_LYOPTIONS; } break; @@ -1589,18 +1517,7 @@ draw_options: FREE(choices[1]); response = ' '; if (LYSelectPopups) { -#if !defined(VMS) || defined(USE_SLANG) - if (term_options) { - term_options = FALSE; - } else { - AddValueAccepted = TRUE; - } - goto draw_options; -#else - term_options = FALSE; - if (use_assume_charset != old_use_assume_charset) - goto draw_options; -#endif /* !VMS || USE_SLANG */ + HANDLE_LYOPTIONS; } break; @@ -1726,16 +1643,7 @@ draw_options: } response = ' '; if (LYSelectPopups) { -#if !defined(VMS) || defined(USE_SLANG) - if (exec_frozen || term_options) { - term_options = FALSE; - } else { - AddValueAccepted = TRUE; - } - goto draw_options; -#else - term_options = FALSE; -#endif /* !VMS || USE_SLANG */ + HANDLE_LYOPTIONS; } break; #endif /* ENABLE_OPTS_CHANGE_EXEC */ @@ -2451,7 +2359,7 @@ PUBLIC int popup_choice ARGS7( #ifdef PDCURSES keypad(form_window, TRUE); #endif /* PDCURSES */ -#ifdef NCURSES +#if defined(NCURSES) || defined(PDCURSES) LYsubwindow(form_window); #endif #if defined(HAVE_GETBKGD)/* not defined in ncurses 1.8.7 */ @@ -2637,14 +2545,15 @@ redraw: switch(cmd) { case LYK_F_LINK_NUM: c = '\0'; - case LYK_1: - case LYK_2: - case LYK_3: - case LYK_4: - case LYK_5: - case LYK_6: - case LYK_7: - case LYK_8: + /* FALLTHRU */ + case LYK_1: /* FALLTHRU */ + case LYK_2: /* FALLTHRU */ + case LYK_3: /* FALLTHRU */ + case LYK_4: /* FALLTHRU */ + case LYK_5: /* FALLTHRU */ + case LYK_6: /* FALLTHRU */ + case LYK_7: /* FALLTHRU */ + case LYK_8: /* FALLTHRU */ case LYK_9: /* * Get a number from the user, possibly with @@ -2993,6 +2902,7 @@ redraw: } } strcpy(prev_target, prev_target_buffer); + /* FALLTHRU */ case LYK_WHEREIS: if (*prev_target == '\0' ) { _statusline(ENTER_WHEREIS_QUERY); @@ -3073,35 +2983,35 @@ check_recall: } } else if (recall && ch == DNARROW) { if (FirstRecall) { - /* - * Use the current string or - * first query in the list. - FM - */ - FirstRecall = FALSE; - if (*prev_target_buffer) { - for (QueryNum = 0; - QueryNum < (QueryTotal - 1); QueryNum++) { - if ((cp = (char *)HTList_objectAt( - search_queries, - QueryNum)) != NULL && - !strcmp(prev_target_buffer, cp)) { - break; + /* + * Use the current string or + * first query in the list. - FM + */ + FirstRecall = FALSE; + if (*prev_target_buffer) { + for (QueryNum = 0; + QueryNum < (QueryTotal - 1); QueryNum++) { + if ((cp = (char *)HTList_objectAt( + search_queries, + QueryNum)) != NULL && + !strcmp(prev_target_buffer, cp)) { + break; + } } + } else { + QueryNum = (QueryTotal - 1); } } else { - QueryNum = (QueryTotal - 1); + /* + * Advance to the next query in the list. - FM + */ + QueryNum--; } - } else { - /* - * Advance to the next query in the list. - FM - */ - QueryNum--; - } - if (QueryNum < 0) - /* - * Roll around to the first query in the list. - FM - */ - QueryNum = (QueryTotal - 1); + if (QueryNum < 0) + /* + * Roll around to the first query in the list. - FM + */ + QueryNum = (QueryTotal - 1); if ((cp = (char *)HTList_objectAt(search_queries, QueryNum)) != NULL) { strcpy(prev_target, cp); @@ -4048,7 +3958,7 @@ PUBLIC int postoptions ARGS1( LYUseDefaultRawMode = TRUE; HTMLUseCharacterSet(current_char_set); } - if (assume_char_set_changed) { + if (assume_char_set_changed && HTCJK != JAPANESE) { LYRawMode = (BOOL) (UCLYhndl_for_unspec == current_char_set); } if (raw_mode_old != LYRawMode || assume_char_set_changed) { diff --git a/src/LYPrettySrc.c b/src/LYPrettySrc.c index 8c41c12d..a4920671 100644 --- a/src/LYPrettySrc.c +++ b/src/LYPrettySrc.c @@ -209,7 +209,9 @@ PUBLIC int html_src_parse_tagspec ARGS4( case HTSRC_CK_after_tagname: switch (*p) { case '\0': stop = TRUE; + /* FALLTHRU */ case ' ': + /* FALLTHRU */ case '\t': { char save = *tagend; diff --git a/src/LYPrint.c b/src/LYPrint.c index e83a29de..ca05d3a1 100644 --- a/src/LYPrint.c +++ b/src/LYPrint.c @@ -21,10 +21,6 @@ #define CancelPrint(msg) HTInfoMsg(msg); goto done #define CannotPrint(msg) HTAlert(msg); goto done -#ifdef WIN_EX -static BOOLEAN mail_is_blat = FALSE; -#endif - /* * printfile prints out the current file minus the links and targets * to a variety of places @@ -668,11 +664,11 @@ PRIVATE void send_file_to_mail ARGS3( LYRemoveTemp(my_temp); #else /* !VMS (Unix or DOS) */ -#if defined(DOSPATH) - outfile_fp = LYOpenTemp(my_temp, ".txt", "w"); -#else +#if CAN_PIPE_TO_MAILER HTSprintf0(&buffer, "%s %s", system_mail, system_mail_flags); outfile_fp = popen(buffer, "w"); +#else + outfile_fp = LYOpenTemp(my_temp, ".txt", "w"); #endif if (outfile_fp == NULL) { CannotPrint(MAIL_REQUEST_FAILED); @@ -771,14 +767,14 @@ PRIVATE void send_file_to_mail ARGS3( printlist(outfile_fp, FALSE); #if defined(WIN_EX) || defined(__DJGPP__) -#if defined(WIN_EX) /* 1998/08/17 (Mon) 16:29:49 */ +#if USE_BLAT_MAILER if (mail_is_blat) HTSprintf0(&buffer, "%s %s -t \"%s\"", - system_mail, my_temp, user_response); + system_mail, my_temp, user_response); else -#endif /* WIN_EX */ +#endif HTSprintf0(&buffer, "%s -t \"%s\" -F %s", - system_mail, user_response, my_temp); + system_mail, user_response, my_temp); LYCloseTempFP(outfile_fp); /* Close the tmpfile. */ stop_curses(); diff --git a/src/LYStrings.c b/src/LYStrings.c index 45197080..0e4244f5 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -1259,14 +1259,12 @@ PUBLIC int lynx_initialize_keymaps NOARGS setup_vtXXX_keymap(); define_key ("\033[M", MOUSE_KEYSYM); - if (SLang_Error - || (-1 == read_keymap_file ())) - SLang_exit_error ("Unable to initialize keymaps"); - return 0; + if (SLang_Error) + SLang_exit_error ("Unable to initialize keymaps"); #else setup_vtXXX_keymap(); - return read_keymap_file(); #endif + return read_keymap_file(); } #endif /* USE_KEYMAPS */ @@ -1505,7 +1503,7 @@ re_read: if (LYNoZapKey > 1 && errno != EINTR && (c == EOF #ifdef USE_SLANG - || c = 0xFFFF + || (c == 0xFFFF) #endif )) { int fd, kbd_fd; @@ -1724,6 +1722,7 @@ re_read: c = F1; break; } + /* FALLTHRU */ default: if (c == CH_ESC && a == b && !found_CSI(c,b)) { current_modifier = LKC_MOD2; @@ -1767,9 +1766,8 @@ re_read: #endif if (done_esc) { /* don't do keypad() switches below, we already got it - kw */ - } + } else { #if HAVE_KEYPAD - else { /* * Convert keypad() mode keys into Lynx defined keys. */ @@ -2159,10 +2157,8 @@ re_read: break; #endif /* NCURSES_MOUSE_VERSION */ } - } #endif /* HAVE_KEYPAD */ #ifdef DJGPP_KEYHANDLER - else { switch(c) { case K_Down: /* The four arrow keys ... */ case K_EDown: @@ -2220,10 +2216,8 @@ re_read: c = BACKTAB_KEY; break; } - } #endif /* DGJPP_KEYHANDLER */ #if defined(USE_SLANG) && (defined(__DJGPP__) || defined(__CYGWIN__)) && !defined(DJGPP_KEYHANDLER) && !defined(USE_KEYMAPS) - else { switch(c) { case SL_KEY_DOWN: /* The four arrow keys ... */ c = DNARROW; @@ -2263,8 +2257,8 @@ re_read: c = REMOVE_KEY; break; } - } #endif /* USE_SLANG && __DJGPP__ && !DJGPP_KEYHANDLER && !USE_KEYMAPS */ + } if (c&(LKC_ISLAC|LKC_ISLECLAC)) return(c); @@ -2590,8 +2584,9 @@ PUBLIC int LYEdit1 ARGS4( * character in the current display character set. * Otherwise, we treat this as LYE_ENTER. */ - if (HTCJK == NOCJK && LYlowest_eightbit[current_char_set] > 0x97) - return(ch); + if (HTCJK == NOCJK && LYlowest_eightbit[current_char_set] > 0x97) + return(ch); + /* FALLTHRU */ #endif case LYE_CHAR: #ifdef EXP_KEYBOARD_LAYOUT @@ -3035,12 +3030,11 @@ PUBLIC void LYRefreshEdit ARGS1( * extending the string. Looks awful, but that way we can keep up with * data entry at low baudrates. */ - if ((DspStart + DspWdth) <= length) + if ((DspStart + DspWdth) <= length) { + if (Pos >= (DspStart + DspWdth) - Margin) { #ifndef SUPPORT_MULTIBYTE_EDIT - if (Pos >= (DspStart + DspWdth) - Margin) DspStart=(Pos - DspWdth) + Margin; #else /* SUPPORT_MULTIBYTE_EDIT */ - if (Pos >= (DspStart + DspWdth) - Margin) { if (HTCJK != NOCJK) { int tmp = (Pos - DspWdth) + Margin; @@ -3049,10 +3043,12 @@ PUBLIC void LYRefreshEdit ARGS1( DspStart++; DspStart++; } - } else - DspStart=(Pos - DspWdth) + Margin; - } + } else { + DspStart = (Pos - DspWdth) + Margin; + } #endif /* SUPPORT_MULTIBYTE_EDIT */ + } + } if (Pos < DspStart + Margin) { #ifndef SUPPORT_MULTIBYTE_EDIT @@ -3234,23 +3230,21 @@ again: goto again; #endif #endif /* SUPPORT_MULTIBYTE_EDIT */ + + if (term_letter || term_options #ifdef VMS - if (term_letter || term_options || + || HadVMSInterrupt +#endif /* VMS */ #ifndef DISABLE_NEWS - term_message || + || term_message #endif - HadVMSInterrupt) { + ) { +#ifdef VMS HadVMSInterrupt = FALSE; +#endif /* VMS */ ch = 7; } -#else - if (term_letter || term_options -#ifndef DISABLE_NEWS - || term_message -#endif - ) - ch = 7; -#endif /* VMS */ + if (recall && (ch == UPARROW || ch == DNARROW)) { strcpy(inputline, MyEdit.buffer); LYAddToCloset(MyEdit.buffer); @@ -3318,6 +3312,7 @@ again: LYLineEdit(&MyEdit,ch, FALSE); break; } + /* FALLTHRU */ #endif case LYE_ENTER: /* diff --git a/src/LYUtils.c b/src/LYUtils.c index 77ad6f49..31572b19 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -108,10 +108,18 @@ extern int BSDselect PARAMS((int nfds, fd_set * readfds, fd_set * writefds, #endif /* __FreeBSD__ || __bsdi__ */ #endif /* !UTMP_FILE */ +/* + * experimental - make temporary filenames random to make the scheme less + * obvious. However, as noted by KW, there are instances (such as the + * 'O'ption page, for which Lynx will store a temporary filename even when + * it no longer applies, since it will reuse that filename at a later time. + */ +#ifdef EXP_RAND_TEMPNAME #if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(RAND_MAX) #define USE_RAND_TEMPNAME 1 #define MAX_TEMPNAME 10000 #endif +#endif #define COPY_COMMAND "%s %s %s" @@ -1984,7 +1992,7 @@ PUBLIC void statusline ARGS1( if (kanji_code == EUC) { TO_EUC((CONST unsigned char *)text_buff, temp); } else if (kanji_code == SJIS) { -#ifdef CJK_EX +#ifdef KANJI_CODE_OVERRIDE if (!LYRawMode || last_kcode == SJIS) strcpy(temp, text_buff); else @@ -2523,10 +2531,11 @@ PUBLIC BOOLEAN LYisLocalFile ARGS1( if (0==strcmp("file", acc_method) && (0==strcmp(host, "localhost") || #ifdef VMS - 0==strcasecomp(host, HTHostName()))) + 0==strcasecomp(host, HTHostName()) #else - 0==strcmp(host, HTHostName()))) + 0==strcmp(host, HTHostName()) #endif /* VMS */ + )) { FREE(host); FREE(acc_method); @@ -4983,11 +4992,13 @@ PUBLIC BOOLEAN LYExpandHostForURL ARGS3( FREE(MsgStr); return GotHost; } + else if (LYCursesON && #if defined(__DJGPP__) && !defined(WATT32) - else if (LYCursesON && HTCheckForInterrupt()) + HTCheckForInterrupt() #else /* normal systems */ - else if (LYCursesON && (lynx_nsl_status == HT_INTERRUPTED)) + (lynx_nsl_status == HT_INTERRUPTED) #endif + ) { /* * Give the user chance to interrupt lookup cycles. - KW & FM @@ -5768,15 +5779,18 @@ PUBLIC void LYAddPathToHome ARGS3( * Set up home string and length. - FM */ StrAllocCopy(home, Home_Dir()); + +#ifdef VMS +#define NO_HOMEPATH "Error:" +#else +#define NO_HOMEPATH "/error" +#endif /* VMS */ if (!(home && *home)) /* * Home_Dir() has a bug if this ever happens. - FM */ -#ifdef VMS - StrAllocCopy(home, "Error:"); -#else - StrAllocCopy(home, "/error"); -#endif /* VMS */ + StrAllocCopy(home, NO_HOMEPATH); + len = fbuffer_size - (strlen(home) + 1); if (len <= 0) { /* @@ -6231,7 +6245,7 @@ PRIVATE BOOL IsOurFile ARGS1(char *, name) * portable. */ if (data.st_uid != 0 - || data.st_mode & S_IWOTH) { + || (data.st_mode & S_IWOTH) != 0) { linked = TRUE; /* force an error-return */ break; } @@ -6719,11 +6733,11 @@ PUBLIC void LYCloseTempFP ARGS1( /* * Close a temp-file, removing it. */ -PUBLIC void LYRemoveTemp ARGS1( +PUBLIC int LYRemoveTemp ARGS1( char *, name) { LY_TEMP *p, *q; - int code; + int code = -1; if (name != 0 && *name != 0) { CTRACE((tfp, "LYRemoveTemp(%s)\n", name)); @@ -6746,6 +6760,7 @@ PUBLIC void LYRemoveTemp ARGS1( } } } + return code; } /* diff --git a/src/LYUtils.h b/src/LYUtils.h index 513e25d2..646411b8 100644 --- a/src/LYUtils.h +++ b/src/LYUtils.h @@ -50,6 +50,7 @@ #define LYIsHtmlSep(ch) ((ch) == '/') +extern BOOL strn_dash_equ PARAMS((CONST char* p1,CONST char* p2,int len)); extern BOOLEAN LYAddSchemeForURL PARAMS((char **AllocatedString, char *default_scheme)); extern BOOLEAN LYCachedTemp PARAMS((char *result, char **cached)); extern BOOLEAN LYCanDoHEAD PARAMS((CONST char *address)); @@ -83,6 +84,7 @@ extern int LYCheckForProxyURL PARAMS((char *filename)); extern int LYConsoleInputFD PARAMS((BOOLEAN need_selectable)); extern int LYCopyFile PARAMS((char *src, char *dst)); extern int LYOpenInternalPage PARAMS((FILE **fp0, char **newfile)); +extern int LYRemoveTemp PARAMS((char *name)); extern int LYSystem PARAMS((char *command)); extern int LYValidateOutput PARAMS((char * filename)); extern int is_url PARAMS((char *filename)); @@ -109,7 +111,6 @@ extern void LYFakeZap PARAMS((BOOL set)); extern void LYFixCursesOn PARAMS((CONST char* reason)); extern void LYLocalFileToURL PARAMS((char **target, CONST char *source)); extern void LYLocalhostAliases_free NOPARAMS; -extern void LYRemoveTemp PARAMS((char *name)); extern void LYRenamedTemp PARAMS((char * oldname, char * newname)); extern void LYTrimHtmlSep PARAMS((char *path)); extern void LYTrimPathSep PARAMS((char *path)); @@ -126,7 +127,6 @@ extern void remove_backslashes PARAMS((char *buf)); extern void size_change PARAMS((int sig)); extern void statusline PARAMS((CONST char *text)); extern void toggle_novice_line NOPARAMS; -extern BOOL strn_dash_equ PARAMS((CONST char* p1,CONST char* p2,int len)); /* Keeping track of User Interface Pages: */ typedef enum { diff --git a/src/LYexit.c b/src/LYexit.c index 71079a12..9d4fd0f2 100644 --- a/src/LYexit.c +++ b/src/LYexit.c @@ -34,10 +34,10 @@ PRIVATE int topOfStack = 0; */ #ifdef __STDC__ -PUBLIC int LYatexit(void (*function)(void)) +PUBLIC int LYatexit(void (*function) NOPARAMS) #else /* Not ANSI, ugh! */ PUBLIC int LYatexit(function) -void (*function)(); +void (*function) NOPARAMS; #endif /* __STDC__ */ { /* diff --git a/src/TRSTable.c b/src/TRSTable.c index 01aa9d8a..d9ab4644 100644 --- a/src/TRSTable.c +++ b/src/TRSTable.c @@ -26,7 +26,7 @@ /* must be different from HT_ALIGN_NONE and HT_LEFT, HT_CENTER etc.: */ #define RESERVEDCELL (-2) /* cell's alignment field is overloaded, this value means cell was reserved by ROWSPAN */ -#define EOCOLG (-2) /* sumcols' Line field isn't used for line info, this +#define EOCOLG (-2) /* sumcols' Line field isn't used for line info, this special value means end of COLGROUP */ typedef enum { CS_invalid = -1, @@ -422,9 +422,9 @@ PRIVATE int Stbl_addCellToRow ARGS9( cells = realloc(me->cells, (me->allocated + growby) * sizeof(STable_cellinfo)); - for (i = 0; cells && i < growby; i++) { + for (i = 0; cells && i < growby; i++) { cells[me->allocated + i].alignment = HT_ALIGN_NONE; - } + } } if (cells) { me->allocated += growby; @@ -443,7 +443,7 @@ PRIVATE int Stbl_addCellToRow ARGS9( if (alignment != HT_ALIGN_NONE) me->cells[me->ncells].alignment = alignment; else { - if (ncolinfo >= me->ncells + 1) + if (ncolinfo >= me->ncells + 1) me->cells[me->ncells].alignment = colinfo[me->ncells].alignment; else me->cells[me->ncells].alignment = me->alignment; @@ -538,8 +538,6 @@ PRIVATE int Stbl_finishCellInRow ARGS5( else return lastcell->len <= 0 ? 0 : 0; } - newstate = empty ? CS__0eb : CS__ebc; - break; case CS__0cb: if (!me->fixed_line) { if (empty) { /* ##462_return_0 */ @@ -579,8 +577,6 @@ PRIVATE int Stbl_finishCellInRow ARGS5( else return lastcell->len <= 0 ? 0 : -1; } - newstate = empty ? CS__eb : CS__ebc; - break; case CS__cb: if (s->pending_len && empty) { /* ##496: */ lastcell->len = s->pending_len; @@ -656,7 +652,6 @@ PRIVATE int Stbl_finishCellInRow ARGS5( else return lastcell->len <= 0 ? 0 : 0; } - newstate = empty ? CS__0f : CS__0cf; break; /* ebc?? */ case CS__0cb: if (s->pending_len) { if (empty) @@ -682,6 +677,7 @@ PRIVATE int Stbl_finishCellInRow ARGS5( newstate = empty ? CS__0cf : CS__cbc; break; case CS__0f: newstate = CS__0f; + /* FALLTHRU */ case CS__0cf: break; case CS_new: @@ -700,7 +696,6 @@ PRIVATE int Stbl_finishCellInRow ARGS5( else return lastcell->len <= 0 ? 0 : -1; } - newstate = empty ? CS__ef : CS__ef; break; case CS__cb: if (s->pending_len && empty) { lastcell->len = s->pending_len; @@ -762,8 +757,10 @@ PRIVATE int Stbl_finishCellInRow ARGS5( return 0; /* or 0 for xlen to s->pending_len?? */ case CS__0eb: /* cannot happen */ newstate = CS__eb; + break; case CS__0cb: /* cannot happen */ - newstate = CS__cb; break; + newstate = CS__cb; + break; case CS__0f: case CS__0cf: break; @@ -808,6 +805,7 @@ PRIVATE int Stbl_finishCellInRow ARGS5( case CS_invalid: /* ##691_no_lastcell_len_for_invalid: */ if (!(me->fixed_line && me->Line == lastcell->Line)) lastcell->len = 0; + /* FALLTHRU */ case CS__0: newstate = empty ? CS__0f : CS__0cf; break; /* ##630 */ case CS__0eb: diff --git a/src/UCdomap.c b/src/UCdomap.c index 2fd0d885..48991d6a 100644 --- a/src/UCdomap.c +++ b/src/UCdomap.c @@ -1578,13 +1578,13 @@ PUBLIC int UCGetLYhndl_byMIME ARGS1( } #endif #if !NO_CHARSET_euc_jp - if (!strncasecomp(value, "iso-2022-jp", 11) || - !strcasecomp(value, "x-euc-jp")) { + if (!strcasecomp(value, "x-euc-jp")) { return UCGetLYhndl_byMIME("euc-jp"); } #endif #if !NO_CHARSET_shift_jis - if (!strcasecomp(value, "x-shift-jis")) { + if ((!strcasecomp(value, "x-shift-jis")) || + (!strcasecomp(value, "x-sjis"))) { return UCGetLYhndl_byMIME("shift_jis"); } #endif diff --git a/src/makefile.dos b/src/makefile.dos index 95e6deef..6e8ee8f4 100644 --- a/src/makefile.dos +++ b/src/makefile.dos @@ -9,7 +9,7 @@ LYLeaks.o LYexit.o LYJump.o LYList.o LYCgi.o LYTraversal.o \ LYEditmap.o LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o LYExtern.o \ LYStyle.o LYHash.o LYPrettySrc.o TRSTable.o -CFLAGS= $(MCFLAGS) $(INTLFLAGS) -I. -I.. $(SLANGINC) +CFLAGS= -O1 $(MCFLAGS) $(INTLFLAGS) -I. -I.. $(SLANGINC) # comment this line to suppress DIRED support DIRED_DEFS = \ @@ -28,7 +28,7 @@ DIRED_DEFS = \ CC = gcc -MCFLAGS = -O2 \ +MCFLAGS = \ $(DIRED_DEFS) \ $(ENABLE_COLOR_STYLE) \ -DACCESS_AUTH \ @@ -48,7 +48,7 @@ MCFLAGS = -O2 \ -DNO_UTMP \ -DSOURCE_CACHE \ -DUSE_EXTERNALS \ - -DUSE_PSRC \ + -DUSE_PRETTYSRC \ -DUSE_ZLIB \ -DWATT32 \ -I./chrtrans \ diff --git a/src/makefile.dsl b/src/makefile.dsl index abb1815d..0c6bca42 100644 --- a/src/makefile.dsl +++ b/src/makefile.dsl @@ -9,7 +9,7 @@ LYLeaks.o LYexit.o LYJump.o LYList.o LYCgi.o LYTraversal.o \ LYEditmap.o LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o LYExtern.o \ LYStyle.o LYHash.o LYPrettySrc.o TRSTable.o -CFLAGS= $(MCFLAGS) $(INTLFLAGS) -I. -I.. $(SLANGINC) +CFLAGS= -O1 $(MCFLAGS) $(INTLFLAGS) -I. -I.. $(SLANGINC) # comment this line to suppress DIRED support DIRED_DEFS = \ @@ -22,7 +22,7 @@ DIRED_DEFS = \ CC = gcc -MCFLAGS = -O2 \ +MCFLAGS = \ $(DIRED_DEFS) \ -DACCESS_AUTH \ -DDISP_PARTIAL \ @@ -34,7 +34,7 @@ MCFLAGS = -O2 \ -DNO_UTMP \ -DSOURCE_CACHE \ -DUSE_EXTERNALS \ - -DUSE_PSRC \ + -DUSE_PRETTYSRC \ -DUSE_SLANG \ -DUSE_ZLIB \ -DWATT32 \ diff --git a/src/makefile.wsl b/src/makefile.wsl index 97f488d9..1d771a6e 100644 --- a/src/makefile.wsl +++ b/src/makefile.wsl @@ -9,11 +9,11 @@ LYLeaks.o LYexit.o LYJump.o LYList.o LYCgi.o LYTraversal.o \ LYEditmap.o LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o LYExtern.o \ LYStyle.o LYHash.o LYPrettySrc.o TRSTable.o -CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC) +CFLAGS= -O1 $(MCFLAGS) -I. -I.. $(SLANGINC) CC = gcc -MCFLAGS = -O2 -DDISP_PARTIAL -DUSE_ZLIB -DUSE_EXTERNALS \ --DSOURCE_CACHE -DUSE_PSRC \ +MCFLAGS = -DDISP_PARTIAL -DUSE_ZLIB -DUSE_EXTERNALS \ +-DSOURCE_CACHE -DUSE_PRETTYSRC \ -DUSE_SLANG -DACCESS_AUTH -DNO_CUSERID \ -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -I../WWW/library/implement -I../djgpp/tcplib/include \ -I./chrtrans -I../djgpp/tcplib/include/tcp |