aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1999-07-14 16:44:55 -0400
committerThomas E. Dickey <dickey@invisible-island.net>1999-07-14 16:44:55 -0400
commita2a1ab1ed484fec332c6dcccb8d033f1c33bb0b5 (patch)
treedd9b34832247f03ce3fb9142353197cc651f176b /src
parent83824f14360f92f8a3a47ac5f136bb077b141065 (diff)
downloadlynx-snapshots-a2a1ab1ed484fec332c6dcccb8d033f1c33bb0b5.tar.gz
snapshot of project "lynx", label v2-8-3dev_4
Diffstat (limited to 'src')
-rw-r--r--src/GridText.c748
-rw-r--r--src/GridText.h17
-rw-r--r--src/HTAlert.c119
-rw-r--r--src/HTFWriter.c122
-rw-r--r--src/HTInit.c22
-rw-r--r--src/HTML.c179
-rw-r--r--src/LYBookmark.c81
-rw-r--r--src/LYCgi.c11
-rw-r--r--src/LYCharSets.c2
-rw-r--r--src/LYCharSets.h3
-rw-r--r--src/LYCharUtils.c116
-rw-r--r--src/LYCookie.c4
-rw-r--r--src/LYCurses.c94
-rw-r--r--src/LYCurses.h19
-rw-r--r--src/LYDownload.c20
-rw-r--r--src/LYEdit.c69
-rw-r--r--src/LYEditmap.c18
-rw-r--r--src/LYExtern.c334
-rw-r--r--src/LYExtern.h1
-rw-r--r--src/LYForms.c142
-rw-r--r--src/LYGlobalDefs.h45
-rw-r--r--src/LYJump.c4
-rw-r--r--src/LYJustify.h75
-rw-r--r--src/LYKeymap.c31
-rw-r--r--src/LYKeymap.h14
-rw-r--r--src/LYList.c4
-rw-r--r--src/LYLocal.c8
-rw-r--r--src/LYMail.c330
-rw-r--r--src/LYMain.c251
-rw-r--r--src/LYMainLoop.c330
-rw-r--r--src/LYNews.c55
-rw-r--r--src/LYOptions.c46
-rw-r--r--src/LYPrint.c83
-rw-r--r--src/LYReadCFG.c55
-rw-r--r--src/LYStrings.c697
-rw-r--r--src/LYStrings.h8
-rw-r--r--src/LYStyle.c5
-rw-r--r--src/LYTraversal.c4
-rw-r--r--src/LYUtils.c654
-rw-r--r--src/LYUtils.h19
-rw-r--r--src/LYexit.c6
-rw-r--r--src/LYrcFile.c4
-rw-r--r--src/UCdomap.c4
-rw-r--r--src/Xsystem.c598
-rw-r--r--src/chrtrans/README.format2
-rw-r--r--src/chrtrans/UCkd.h3
-rw-r--r--src/chrtrans/jcuken_kb.h2
-rw-r--r--src/chrtrans/make-msc.bat49
-rw-r--r--src/chrtrans/makefile.dos4
-rw-r--r--src/chrtrans/makefile.in2
-rw-r--r--src/chrtrans/makefile.msc23
-rw-r--r--src/chrtrans/makefile.w32 (renamed from src/chrtrans/MAKEFILE.W32)0
-rw-r--r--src/chrtrans/makeuctb.c1
-rw-r--r--src/chrtrans/makew32.bat (renamed from src/chrtrans/MAKEW32.BAT)88
-rw-r--r--src/chrtrans/rot13_kb.h2
-rw-r--r--src/chrtrans/yawerty_kb.h2
-rw-r--r--src/makefile.dos124
-rw-r--r--src/makefile.dsl139
-rw-r--r--src/makefile.wsl128
59 files changed, 5271 insertions, 749 deletions
diff --git a/src/GridText.c b/src/GridText.c
index 174b29cd..f50cac68 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -1,4 +1,4 @@
-/* Character grid hypertext object
+/*
** ===============================
*/
@@ -45,6 +45,10 @@
#include <LYexit.h>
#include <LYLeaks.h>
+#ifdef SH_EX /* for DEBUG (1997/10/10 (Fri) 07:58:47) */
+#define NOTUSED_BAD_FOR_SCREEN
+#endif
+
#undef DEBUG_APPCH
#ifdef SOURCE_CACHE
@@ -59,12 +63,15 @@ unsigned int cached_styles[CACHEH][CACHEW];
#endif
+#include <LYJustify.h>
+
+
#ifdef USE_COLOR_STYLE_UNUSED
void LynxClearScreenCache NOARGS
{
int i,j;
- CTRACE(tfp, "flushing cached screen styles\n");
+ CTRACE(tfp, "GridText: flushing cached screen styles\n");
for (i=0;i<CACHEH;i++)
for (j=0;j<CACHEW;j++)
cached_styles[i][j]=s_a;
@@ -92,9 +99,16 @@ struct _HTStream { /* only know it as object */
((unsigned char)(ch)&0xc0) == 0x80)
extern BOOL HTPassHighCtrlRaw;
-extern HTkcode kanji_code;
extern HTCJKlang HTCJK;
+#ifdef CJK_EX
+PUBLIC HTkcode last_kcode = NOKANJI; /* 1997/11/14 (Fri) 09:09:26 */
+extern char *str_kcode(HTkcode code);
+#define CHAR_WIDTH 6
+#else
+#define CHAR_WIDTH 1
+#endif
+
/* Exports
*/
PUBLIC HText * HTMainText = NULL; /* Equivalent of main window */
@@ -250,6 +264,63 @@ struct _HText {
PRIVATE void HText_AddHiddenLink PARAMS((HText *text, TextAnchor *textanchor));
+
+#ifdef EXP_JUSTIFY_ELTS
+PUBLIC BOOL can_justify_here;
+PUBLIC BOOL can_justify_here_saved;
+
+PUBLIC BOOL can_justify_this_line;/* =FALSE if line contains form objects */
+PUBLIC int wait_for_this_stacked_elt;/* -1 if can justify contents of the
+ element on the op of stack. If positive - specifies minimal stack depth
+ plus 1 at which we can justify element (can be MAX_LINE+2 if
+ ok_justify ==FALSE or in psrcview. */
+PUBLIC BOOL form_in_htext;/*to indicate that we are in form (since HTML_FORM is
+ not stacked in the HTML.c */
+#ifdef DEBUG_JUSTIFY
+PUBLIC BOOL can_justify_stack_depth;/* can be 0 or 1 if all code is correct*/
+#endif
+
+
+typedef struct ht_run_info_ {
+ int byte_len; /*length in bytes*/
+ int cell_len; /*length in cells*/
+} ht_run_info;
+
+static int justify_start_position;/* this is an index of char from which
+ justification can start (eg after "* " preceeding <li> text) */
+
+static int ht_num_runs;/*the number of runs filled*/
+static ht_run_info ht_runs[MAX_LINE];
+static BOOL this_line_was_splitted;
+static TextAnchor* last_anchor_of_previous_line;
+static int justified_text_map[MAX_LINE]; /* this is a map - for each index i
+ it tells to which position j=justified_text_map[i] in justified text
+ i-th character is mapped - it's used for anchor positions fixup and for
+ color style's positions adjustment. */
+
+PUBLIC void ht_justify_cleanup NOARGS
+{
+ last_anchor_of_previous_line = NULL;
+ this_line_was_splitted = FALSE;
+}
+
+PUBLIC void mark_justify_start_position ARGS1(void*,text)
+{
+ if (text && ((HText*)text)->last_line)
+ justify_start_position = ((HText*)text )->last_line->size;
+}
+
+
+#define REALLY_CAN_JUSTIFY(text) ( (wait_for_this_stacked_elt<0) && \
+ ( text->style->alignment == HT_LEFT || \
+ text->style->alignment == HT_JUSTIFY) && \
+ HTCJK == NOCJK && \
+ can_justify_here && can_justify_this_line && !form_in_htext )
+
+#endif /* EXP_JUSTIFY_ELTS */
+
+
+
/*
* Boring static variable used for moving cursor across
*/
@@ -288,6 +359,7 @@ PRIVATE int HText_TrueLineSize PARAMS((
#define CHECK_FREE_MEM
#endif
+
#ifdef CHECK_FREE_MEM
/*
@@ -546,7 +618,7 @@ PUBLIC HText * HText_new ARGS1(
self->LastChar = '\0';
self->IgnoreExcess = FALSE;
-#ifndef PSRC_TEST
+#ifndef USE_PSRC
if (HTOutputFormat == WWW_SOURCE)
self->source = YES;
else
@@ -855,7 +927,14 @@ PRIVATE int display_line ARGS2(
addch('_');
i++;
} else {
+#if (defined(DOSPATH) || defined(WIN_EX)) && !defined(USE_SLANG)
+ if (LYShowColor == SHOW_COLOR_NEVER)
+ start_bold();
+ else
+ start_underline();
+#else
start_underline();
+#endif /* DOSPATH ... */
}
break;
@@ -864,7 +943,14 @@ PRIVATE int display_line ARGS2(
addch('_');
i++;
} else {
+#if (defined(DOSPATH) || defined(WIN_EX)) && !defined(USE_SLANG)
+ if (LYShowColor == SHOW_COLOR_NEVER)
+ stop_bold();
+ else
+ stop_underline();
+#else
stop_underline();
+#endif /* DOSPATH ... */
}
break;
@@ -1020,7 +1106,7 @@ PRIVATE void display_title ARGS1(
*/
StrAllocCopy(title,
(HTAnchor_title(text->node_anchor) ?
- HTAnchor_title(text->node_anchor) : ""));
+ HTAnchor_title(text->node_anchor) : " ")); /* "" -> " " */
/*
* There shouldn't be any \n in the title field,
@@ -1073,7 +1159,7 @@ PRIVATE void display_title ARGS1(
*/
if (HTCJK != NOCJK) {
if (*title &&
- (tmp = (unsigned char *)calloc(1, (strlen(title) + 1)))) {
+ (tmp = (unsigned char *)calloc(1, (strlen(title) + 256)))) {
if (kanji_code == EUC) {
TO_EUC((unsigned char *)title, tmp);
} else if (kanji_code == SJIS) {
@@ -1092,11 +1178,14 @@ PRIVATE void display_title ARGS1(
}
move(0, 0);
clrtoeol();
+#ifdef CJK_EX
+ addstr(str_kcode(last_kcode));
+#endif
if (text->top_of_screen > 0 && HText_hasToolbar(text)) {
addch('#');
}
i = (LYcols - 1) - strlen(percent) - strlen(title);
- if (i > 0) {
+ if (i >= CHAR_WIDTH) {
move(0, i);
} else {
/*
@@ -1104,9 +1193,9 @@ PRIVATE void display_title ARGS1(
* account the possibility that multibyte
* characters might be present. - FM
*/
- if (LYcols - 2 >= (int)strlen(percent))
- title[((LYcols - 2) - strlen(percent))] = '\0';
- move(0, 1);
+ if ((i = ((LYcols - 2) - strlen(percent)) - CHAR_WIDTH) >= 0)
+ title[i] = '\0';
+ move(0, CHAR_WIDTH);
}
addstr(title);
if (percent[0] != '\0')
@@ -1554,7 +1643,7 @@ PRIVATE void display_page ARGS3(
if (link_dest_intl && link_dest_intl != link_dest) {
CTRACE(tfp,
- "display_page: unexpected typed link to %s!\n",
+ "GridText: display_page: unexpected typed link to %s!\n",
link_dest_intl->parent->address);
link_dest_intl = NULL;
}
@@ -1854,7 +1943,17 @@ PRIVATE void split_line ARGS2(
* of our new line. - FM
*/
p = prevdata + split;
- while ((*p == ' ' &&
+ while ((
+#ifdef EXP_JUSTIFY_ELTS
+ /* if justification is allowed for prev line, then raw
+ * HT_NON_BREAK_SPACE are still present in data[] (they'll be
+ * substituted at the end of this function with ' ') - VH
+ */
+ (*p == ' ' || *p == HT_NON_BREAK_SPACE ) &&
+#else
+ (*p == ' ') &&
+#endif
+
(HeadTrim || text->first_anchor ||
underline_on || bold_on ||
text->style->alignment != HT_LEFT ||
@@ -1970,7 +2069,16 @@ PRIVATE void split_line ARGS2(
* Economize on space.
*/
while ((previous->size > 0) &&
+#ifdef EXP_JUSTIFY_ELTS
+ /* if justification is allowed for prev line, then raw
+ * HT_NON_BREAK_SPACE are still present in data[] (they'll be
+ * substituted at the end of this function with ' ') - VH
+ */
+ ((previous->data[previous->size-1] == ' ') ||
+ (previous->data[previous->size-1] == HT_NON_BREAK_SPACE)) &&
+#else
(previous->data[previous->size-1] == ' ') &&
+#endif
(ctrl_chars_on_this_line || HeadTrim || text->first_anchor ||
underline_on || bold_on ||
text->style->alignment != HT_LEFT ||
@@ -2089,7 +2197,7 @@ PRIVATE void split_line ARGS2(
(previous->styles[spare - 1].direction == ABS_ON &&
previous->styles[spare - 2].direction == ABS_OFF)
)) {
- /*
+ /*
* Skip pairs of adjacent ON/OFF or OFF/ON changes.
*/
spare -= 2;
@@ -2167,8 +2275,13 @@ PRIVATE void split_line ARGS2(
* Align left, right or center.
*/
spare = 0;
- if (style->alignment == HT_CENTER ||
- style->alignment == HT_RIGHT) {
+ ctrl_chars_on_previous_line = 0; /* - VH */
+ if (
+#ifdef EXP_JUSTIFY_ELTS
+ this_line_was_splitted ||
+#endif
+ (style->alignment == HT_CENTER ||
+ style->alignment == HT_RIGHT) ) {
/* Calculate spare character positions if needed */
for (cp = previous->data; *cp; cp++) {
if (*cp == LY_UNDERLINE_START_CHAR ||
@@ -2359,6 +2472,287 @@ PRIVATE void split_line ARGS2(
}
}
}
+
+#ifdef EXP_JUSTIFY_ELTS
+ /* now perform justification - by VH */
+
+ if (this_line_was_splitted && spare ) {
+ /* this is the only case when we need justification*/
+ char* jp = previous->data + justify_start_position;
+ ht_run_info* r = ht_runs;
+ char c;
+ int total_byte_len = 0, total_cell_len = 0;
+ int d_, r_, i, j, cur_byte_num, *m;
+ HTLine * jline;
+ char *jdata;
+ char *prevdata = previous->data;
+
+ ht_num_runs = 0;
+ r->byte_len = r->cell_len = 0;
+
+ for(; (c = *jp) != 0; ++jp) {
+ if (c == ' ') {
+ total_byte_len += r->byte_len;
+ total_cell_len += r->cell_len;
+ ++r;
+ ++ht_num_runs;
+ r->byte_len = r->cell_len = 0;
+ continue;
+ }
+ ++r->byte_len;
+ if ( IsSpecialAttrChar(c) )
+ continue;
+
+ ++r->cell_len;
+ if (c == HT_NON_BREAK_SPACE) {
+ *jp = ' '; /* substitute it */
+ continue;
+ }
+ if (text->T.output_utf8 && !isascii(c)) {
+ int utf_extra = 0;
+ if ((c & 0xe0) == 0xc0) {
+ utf_extra = 1;
+ } else if ((c & 0xf0) == 0xe0) {
+ utf_extra = 2;
+ } else if ((c & 0xf8) == 0xf0) {
+ utf_extra = 3;
+ } else if ((c & 0xfc) == 0xf8) {
+ utf_extra = 4;
+ } else if ((c & 0xfe) == 0xfc) {
+ utf_extra = 5;
+ } else
+ utf_extra = 0;
+ if ( (int) strlen(jp+1) < utf_extra)
+ utf_extra = 0;
+ r->byte_len += utf_extra;
+ jp += utf_extra;
+ }
+ }
+ total_byte_len += r->byte_len;
+ total_cell_len += r->cell_len;
+ ++ht_num_runs;
+
+ if (ht_num_runs != 1) {
+
+ jline = (HTLine *)LY_CALLOC(1, LINE_SIZE(previous->size+spare));
+ if (jline == NULL)
+ outofmem(__FILE__, "split_line_1");
+
+ jdata = jline->data;
+
+ /*
+ * we have to spread num_spaces among (ht_num_runs-1) runs - we
+ * fill justified_text_map in order to apply changes caused by
+ * justification to anchor data and color styles, and justify
+ * original string on the fly
+ */
+ d_ = spare/(ht_num_runs-1);
+ r_ = spare % (ht_num_runs-1);
+
+ m = justified_text_map;
+ for(jp=previous->data,i=0;i<justify_start_position;++i) {
+ *m++ = i;
+ *jdata++ = ( *prevdata == HT_NON_BREAK_SPACE ? ' ' : *prevdata);
+ ++prevdata;
+ }
+
+ cur_byte_num = i;
+
+ for (r = ht_runs; r < ht_runs + ht_num_runs; ++r ) {
+
+ /* copy the reference to run content */
+ for(i=0; i < r->byte_len; ++i) {
+ *m++ = cur_byte_num++;
+ *jdata++ = *prevdata++;
+ }
+ if ( r - ht_runs == ht_num_runs - 1 ) { /* nop on last run */
+ *jdata++ = '\0';
+ break;
+ }
+
+ /* the space that was in original string */
+ *m++ = cur_byte_num++;
+ *jdata++ = ' ';
+ prevdata++;/* skip that space */
+
+ cur_byte_num += j=( d_ + ( r_-- > 0 ) );
+ for (i=0; i<j; ++i)
+ *jdata++ = ' ';
+ }
+ *m++ = justify_start_position + total_cell_len +
+ spare + ht_num_runs - 1; /*map the end*/
+
+ text->chars += spare;
+
+ jline->offset = previous->offset;
+ jline->size = previous->size + spare;
+ jline->split_after = previous->split_after;
+ jline->bullet = previous->bullet;
+ jline->expansion_line = previous->expansion_line;
+
+ jline->prev = previous->prev;
+ jline->next = previous->next;
+ previous->next->prev = jline;
+ previous->prev->next = jline;
+
+#if defined(USE_COLOR_STYLE)
+ jline->numstyles = previous->numstyles;
+
+ /* now copy and fix colorstyles */
+ for(i = 0; i < jline->numstyles; ++i) {
+ jline->styles[i].style = previous->styles[i].style;
+ jline->styles[i].direction = previous->styles[i].direction;
+ jline->styles[i].previous = previous->styles[i].previous;
+ jline->styles[i].horizpos = justified_text_map[previous->styles[i].horizpos];
+ }
+#endif
+ /* we have to fix anchors*/
+ {
+ /*a2 is the last anchor on the line preceeding 'previous'*/
+ TextAnchor* a2 = last_anchor_of_previous_line;
+
+ if (!a2)
+ a2 = text->first_anchor;
+ else if (a2 == text->last_anchor)
+ a2 = NULL;
+ else
+ a2 = a2->next; /*1st anchor on line we justify */
+
+ if (a2) {
+ for (; a2 /*&& a2->line_num == text->Lines-1*/;
+ last_anchor_of_previous_line = a2, a2 = a2->next) {
+ int oldpos = a2->line_pos,
+ newpos = justified_text_map[a2->line_pos],
+ shift = newpos - oldpos;
+
+ if (a2->line_num == text->Lines)
+ break;/*new line not yet completed*/
+
+ if (a2->line_num == text->Lines-1) {
+ a2->line_pos = newpos;
+ a2->start += shift;
+
+ if (!a2->extent && a2->number &&
+ (a2->link_type & HYPERTEXT_ANCHOR) &&
+ !a2->show_anchor &&
+ a2->number == text->last_anchor_number)
+ /* seems endAnchor wasn't called for it */ {
+ a2 = a2->next; /*don't allow .start to be incremented
+ by 'spare' once more */
+ break;
+ }
+
+ if ( a2->extent + oldpos > (int) previous->size)
+ /*anchor content wrapped to new line */
+ a2->extent += (jline->size - newpos) -
+ (previous->size - oldpos);
+ else
+ a2->extent = justified_text_map[oldpos+a2->extent]
+ - newpos;
+
+ } else {
+ /* This is the anchor that was started on previous
+ * line. Its .line_pos and .start were updated.
+ * So we have to update only extent. If anchor
+ * text is longer than two lines, we don't bother
+ * setting it to correct value.
+ */
+ if (a2->line_num != text->Lines-2)
+ continue; /* don't bother */
+ if (!a2->extent && a2->number &&
+ (a2->link_type & HYPERTEXT_ANCHOR) &&
+ !a2->show_anchor &&
+ a2->number == text->last_anchor_number)
+ /* seems endAnchor wasn't called for it */
+ continue;
+ /* anchor is started at text->Lines-2, and there
+ * are two cases - either it was wrapped to newline
+ * or it ended in previous text->Lines-1.
+ */
+ {
+ int p2sz = previous->prev->size,
+ p1sz = previous->size,
+ onp2sz = p2sz - a2->line_pos,
+ onp1sz = a2->extent - 1 - onp2sz;
+
+ if (onp1sz >= p1sz)
+ /* this anchor will be skipped at the next
+ * split_line here, since its line_num will
+ * be text->Lines-3
+ */
+ a2->extent += spare;
+ else {
+ a2->extent += justified_text_map[onp1sz-1]
+ - onp1sz + 1;
+ }
+ }
+
+ }
+
+ }
+
+ /* iterate on anchors in the last line */
+ for (; a2; a2 = a2->next)
+ a2->start += spare;
+ }
+ }
+
+ FREE(previous);
+
+ } else { /* (ht_num_runs==1) */
+ /* keep maintaining 'last_anchor_of_previous_line' */
+ TextAnchor* a2 = last_anchor_of_previous_line;
+ if (!a2)
+ a2 = text->first_anchor;
+ else if (a2 == text->last_anchor)
+ a2 = NULL;
+ else
+ a2 = a2->next; /* 1st anchor on line we justify */
+
+ if (a2)
+ for (; a2 && a2->line_num <= text->Lines-1;
+ last_anchor_of_previous_line = a2, a2 = a2->next);
+ }
+ } else {
+ if (REALLY_CAN_JUSTIFY(text) ) {
+ char* p;
+
+ /* it was permitted to justify line, but this function was called
+ * to end paragraph - we must subsitute HT_NON_BREAK_SPACEs with
+ * spaces in previous line
+ */
+ if (line->size) {
+ CTRACE(tfp,"justification: shouldn't happen - new line is not empty!\n");
+ }
+
+ for (p=previous->data;*p;++p)
+ if (*p == HT_NON_BREAK_SPACE)
+ *p = ' ';
+ }
+
+ /* HT_NON_BREAK_SPACEs were subsituted with spaces in
+ HText_appendCharacter */
+ {
+ /* keep maintaining 'last_anchor_of_previous_line' */
+ TextAnchor* a2 = last_anchor_of_previous_line;
+ if (!a2)
+ a2 = text->first_anchor;
+ else if (a2 == text->last_anchor)
+ a2 = NULL;
+ else
+ a2 = a2->next; /*1st anchor on line we justify */
+
+ if (a2)
+ for (; a2 && a2->line_num <= text->Lines-1;
+ last_anchor_of_previous_line = a2, a2 = a2->next);
+ }
+ }
+
+ /* cleanup */
+ can_justify_this_line = TRUE;
+ justify_start_position = 0;
+ this_line_was_splitted = FALSE;
+#endif
} /* split_line */
@@ -2439,6 +2833,10 @@ PUBLIC void HText_appendCharacter ARGS2(
int indent;
#ifdef DEBUG_APPCH
+#ifdef CJK_EX
+ static unsigned char save_ch = 0;
+#endif
+
if (TRACE) {
char * special = NULL; /* make trace a little more readable */
switch(ch) {
@@ -2475,8 +2873,28 @@ PUBLIC void HText_appendCharacter ARGS2(
CTRACE(tfp, "add(%s %d special char) %d/%d\n", special, ch,
HTisDocumentSource(), HTOutputFormat != WWW_SOURCE);
} else {
- CTRACE(tfp, "add(%c) %d/%d\n", ch,
- HTisDocumentSource(), HTOutputFormat != WWW_SOURCE);
+#ifdef CJK_EX /* 1998/08/30 (Sun) 13:26:23 */
+ if (save_ch == 0) {
+ if (IS_SJIS_HI1(ch) || IS_SJIS_HI2(ch)) {
+ save_ch = ch;
+ } else {
+ CTRACE(tfp, "add(%c) %d/%d\n", ch,
+ HTisDocumentSource(), HTOutputFormat != WWW_SOURCE);
+ }
+ } else {
+ CTRACE(tfp, "add(%c%c) %d/%d\n", save_ch, ch,
+ HTisDocumentSource(), HTOutputFormat != WWW_SOURCE);
+ save_ch = 0;
+ }
+#else
+ if (ch < 0x80) {
+ CTRACE(tfp, "add(%c) %d/%d\n", ch,
+ HTisDocumentSource(), HTOutputFormat != WWW_SOURCE);
+ } else {
+ CTRACE(tfp, "add(%02x) %d/%d\n", ch,
+ HTisDocumentSource(), HTOutputFormat != WWW_SOURCE);
+ }
+#endif /* CJK_EX */
}
} /* trace only */
#endif /* DEBUG_APPCH */
@@ -2642,9 +3060,19 @@ PUBLIC void HText_appendCharacter ARGS2(
} else {
text->kanji_buf = '\216';
ch |= 0200;
+#ifdef SH_EX
+ /**** Add Next Line by patakuti ****/
+ text->permissible_split = (int)text->last_line->size;
+ {
+ unsigned char hi, low;
+ JISx0201TO0208_EUC(0x8e, ch, &hi, &low);
+ text->kanji_buf = hi;
+ ch = low;
}
- break;
+#endif
}
+ break;
+ } /* end switch */
if (!text->kanji_buf) {
if ((ch & 0200) != 0) {
@@ -2653,7 +3081,8 @@ PUBLIC void HText_appendCharacter ARGS2(
*/
if ((text->kcode == SJIS) &&
((unsigned char)ch >= 0xA1) &&
- ((unsigned char)ch <= 0xDF)) {
+ ((unsigned char)ch <= 0xDF))
+ {
unsigned char c = (unsigned char)ch;
unsigned char kb = (unsigned char)text->kanji_buf;
JISx0201TO0208_SJIS(c,
@@ -2661,6 +3090,8 @@ PUBLIC void HText_appendCharacter ARGS2(
(unsigned char *)&c);
ch = (char)c;
text->kanji_buf = kb;
+ /* 1998/01/19 (Mon) 09:06:15 */
+ text->permissible_split = (int)text->last_line->size;
} else {
text->kanji_buf = ch;
/*
@@ -2677,9 +3108,20 @@ PUBLIC void HText_appendCharacter ARGS2(
return;
}
+#ifdef CJK_EX /* MOJI-BAKE Fix! 1997/10/12 -- 10/31 (Fri) 00:22:57 - JH7AYN */
+ if (ch == LY_BOLD_START_CHAR || ch == LY_BOLD_END_CHAR) {
+ text->permissible_split = (int)line->size; /* Can split here */
+ if (HTCJK == JAPANESE)
+ text->kcode = NOKANJI;
+ }
+#endif
+
if (IsSpecialAttrChar(ch) && ch != LY_SOFT_NEWLINE) {
-#ifndef USE_COLOR_STYLE
+#if !defined(USE_COLOR_STYLE) || !defined(NO_DUMP_WITH_BACKSPACES)
if (line->size >= (MAX_LINE-1)) return;
+#if defined(USE_COLOR_STYLE) && !defined(NO_DUMP_WITH_BACKSPACES)
+ if (with_backspaces && HTCJK==NOCJK && !text->T.output_utf8) {
+#endif
if (ch == LY_UNDERLINE_START_CHAR) {
line->data[line->size++] = LY_UNDERLINE_START_CHAR;
line->data[line->size] = '\0';
@@ -2730,6 +3172,12 @@ PUBLIC void HText_appendCharacter ARGS2(
return;
}
}
+#if defined(USE_COLOR_STYLE) && !defined(NO_DUMP_WITH_BACKSPACES)
+ } /* if (with_backspaces && HTCJK==HTNOCJK && !text->T.output_utf8) */
+ else
+ return;
+#endif
+
#else
return;
#endif
@@ -2767,6 +3215,15 @@ PUBLIC void HText_appendCharacter ARGS2(
if (ch == HT_EN_SPACE)
ch = ' ';
+#ifdef SH_EX /* 1997/11/01 (Sat) 12:08:54 */
+ if (ch == 0x0b) { /* ^K ??? */
+ ch = '\r';
+ }
+ if (ch == 0x1a) { /* ^Z ??? */
+ ch = '\r';
+ }
+#endif
+
/*
* I'm going to cheat here in a BIG way. Since I know that all
* \r's will be trapped by HTML_put_character I'm going to use
@@ -2898,6 +3355,10 @@ check_IgnoreExcess:
1 : 0))) >= (LYcols - 1)) {
if (style->wordWrap && HTOutputFormat != WWW_SOURCE) {
+#ifdef EXP_JUSTIFY_ELTS
+ if (REALLY_CAN_JUSTIFY(text))
+ this_line_was_splitted=TRUE;
+#endif
split_line(text, text->permissible_split);
if (ch == ' ') return; /* Ignore space causing split */
@@ -2916,7 +3377,14 @@ check_IgnoreExcess:
* For normal stuff like pre let's go ahead and
* wrap so the user can see all of the text.
*/
- new_line(text);
+
+ if ( (dump_output_immediately|| (crawl && traversal) )
+ && dont_wrap_pre) {
+ if ((int)line->size >= (int)(MAX_LINE-1))
+ new_line(text);
+ } else
+ new_line(text);
+
}
} else if ((int)line->size >= (int)(MAX_LINE-1)) {
/*
@@ -2928,18 +3396,93 @@ check_IgnoreExcess:
/*
* Insert normal characters.
*/
- if (ch == HT_NON_BREAK_SPACE) {
+ if (ch == HT_NON_BREAK_SPACE
+#ifdef EXP_JUSTIFY_ELTS
+ && !REALLY_CAN_JUSTIFY(text)
+#endif
+ )
ch = ' ';
- }
+ /* we leave raw HT_NON_BREAK_SPACE otherwise (we'll substitute it later) */
if (ch & 0x80)
text->have_8bit_chars = YES;
+ /*
+ * Kanji charactor handling.
+ */
{
HTFont font = style->font;
unsigned char hi, lo, tmp[2];
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 == NOKANJI)
+ {
+ if (IS_SJIS(hi, lo, text->in_sjis) && IS_EUC(hi, lo)) {
+ text->kcode = NOKANJI;
+ } else if (IS_SJIS(hi, lo, text->in_sjis)) {
+ text->kcode = SJIS;
+ } else if (IS_EUC(hi, lo)) {
+ text->kcode = EUC;
+ }
+ }
+
+ switch (kanji_code) {
+ case EUC:
+ if (text->kcode == SJIS) {
+ SJIS_TO_EUC1(hi, lo, tmp);
+ line->data[line->size++] = tmp[0];
+ line->data[line->size++] = tmp[1];
+ } else if (text->kcode == EUC) {
+ JISx0201TO0208_EUC(hi, lo, &hi, &lo);
+ line->data[line->size++] = hi;
+ line->data[line->size++] = lo;
+ }
+ break;
+
+ case SJIS:
+ if (last_kcode != SJIS && text->kcode == EUC)
+ {
+ 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];
+ }
+ }
+#endif
+ line->data[line->size++] = hi;
+ line->data[line->size++] = lo;
+ }
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ line->data[line->size++] = hi;
+ line->data[line->size++] = lo;
+ }
+ text->kanji_buf = 0;
+ }
+#else
if (HTCJK != NOCJK && text->kanji_buf) {
hi = (unsigned char)text->kanji_buf, lo = (unsigned char)ch;
if (HTCJK == JAPANESE && text->kcode == NOKANJI) {
@@ -2971,7 +3514,9 @@ check_IgnoreExcess:
line->data[line->size++] = lo;
}
text->kanji_buf = 0;
- } else if (HTCJK != NOCJK) {
+ }
+#endif
+ else if (HTCJK != NOCJK) {
line->data[line->size++] = (kanji_code != NOKANJI) ?
ch :
(font & HT_CAPITALS) ?
@@ -3113,7 +3658,7 @@ PUBLIC int HText_beginAnchor ARGS3(
*/
if ((a->number > 0) &&
(keypad_mode == LINKS_ARE_NUMBERED ||
- keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED)) {
+ keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED)) {
char saved_lastchar = text->LastChar;
int saved_linenum = text->Lines;
sprintf(marker,"[%d]", a->number);
@@ -3163,7 +3708,7 @@ PUBLIC void HText_endAnchor ARGS2(
}
}
- CTRACE(tfp, "HText_endAnchor: number:%d link_type:%d\n",
+ CTRACE(tfp, "GridText:HText_endAnchor: number:%d link_type:%d\n",
a->number, a->link_type);
if (a->link_type == INPUT_ANCHOR) {
/*
@@ -3181,7 +3726,7 @@ PUBLIC void HText_endAnchor ARGS2(
int i, j, k, l;
BOOL remove_numbers_on_empty =
((keypad_mode == LINKS_ARE_NUMBERED ||
- keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED) &&
+ keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED) &&
(text->hiddenlinkflag != HIDDENLINKS_MERGE ||
(LYNoISMAPifUSEMAP &&
!(text->node_anchor && text->node_anchor->bookmark) &&
@@ -3672,8 +4217,7 @@ PUBLIC void HText_endAppend ARGS1(
while (text->last_line->data[0] == '\0' && text->Lines > 2) {
HTLine *next_to_the_last_line = text->last_line->prev;
-
- CTRACE(tfp, "GridText: Removing bottom blank line: %s\n",
+ CTRACE(tfp, "GridText: Removing bottom blank line: `%s'\n",
text->last_line->data);
/*
* line_ptr points to the first line.
@@ -3683,7 +4227,7 @@ PUBLIC void HText_endAppend ARGS1(
FREE(text->last_line);
text->last_line = next_to_the_last_line;
text->Lines--;
- CTRACE(tfp, "GridText: New bottom line: %s\n",
+ CTRACE(tfp, "GridText: New bottom line: `%s'\n",
text->last_line->data);
}
@@ -3733,7 +4277,7 @@ PUBLIC void HText_trimHightext ARGS2(
return;
CTRACE(tfp, "Gridtext: Entering HText_trimHightext %s\n",
- final ? "(final)" : "(partial)");
+ final ? "(final)" : "(partial)");
/*
* Get the first line.
@@ -3825,8 +4369,7 @@ re_parse:
}
anchor_ptr->start += cur_shift;
- CTRACE(tfp, "anchor text: '%s'\n",
- line_ptr->data);
+ CTRACE(tfp, "anchor text: '%s'\n", line_ptr->data);
/*
* If the link begins with an end of line and we have more
* lines, then start the highlighting on the next line. - FM
@@ -5582,6 +6125,11 @@ PUBLIC void print_wwwfile_to_fd ARGS2(
register int i;
int first = TRUE;
HTLine * line;
+#ifndef NO_DUMP_WITH_BACKSPACES
+ HText* text = HTMainText;
+ BOOL in_b=FALSE,in_u=FALSE,
+ bs=text && with_backspaces && HTCJK==NOCJK && !text->T.output_utf8;
+#endif
if (!HTMainText)
return;
@@ -5612,6 +6160,17 @@ PUBLIC void print_wwwfile_to_fd ARGS2(
*/
for (i = 0; line->data[i] != '\0'; i++) {
if (!IsSpecialAttrChar(line->data[i])) {
+#ifndef NO_DUMP_WITH_BACKSPACES
+ if (in_b) {
+ fputc(line->data[i], fp);
+ fputc('\b',fp);
+ fputc(line->data[i], fp);
+ } else if (in_u) {
+ fputc('_',fp);
+ fputc('\b',fp);
+ fputc(line->data[i], fp);
+ } else
+#endif
fputc(line->data[i], fp);
} else if (line->data[i] == LY_SOFT_HYPHEN &&
line->data[i + 1] == '\0') { /* last char on line */
@@ -5636,6 +6195,27 @@ PUBLIC void print_wwwfile_to_fd ARGS2(
break;
}
}
+#ifndef NO_DUMP_WITH_BACKSPACES
+ else if (bs) {
+ switch (line->data[i]) {
+ case LY_UNDERLINE_START_CHAR:
+ if (!in_b)
+ in_u = TRUE; /*favor bold over underline*/
+ break;
+ case LY_UNDERLINE_END_CHAR:
+ in_u = FALSE;
+ break;
+ case LY_BOLD_START_CHAR:
+ if (in_u)
+ in_u = FALSE; /* turn it off*/
+ in_b = TRUE;
+ break;
+ case LY_BOLD_END_CHAR:
+ in_b = FALSE;
+ break;
+ }
+ }
+#endif
}
if (line == HTMainText->last_line)
@@ -5663,6 +6243,12 @@ PUBLIC void print_crawl_to_fd ARGS3(
register int i;
int first = TRUE;
HTLine * line;
+#ifndef NO_DUMP_WITH_BACKSPACES
+ HText* text = HTMainText;
+ BOOL in_b=FALSE,in_u=FALSE,
+ bs=text && with_backspaces && HTCJK==NOCJK && !text->T.output_utf8;
+#endif
+
if (!HTMainText)
return;
@@ -5704,6 +6290,28 @@ PUBLIC void print_crawl_to_fd ARGS3(
fputc('-', fp);
}
}
+#ifndef NO_DUMP_WITH_BACKSPACES
+ else if (bs) {
+ switch (line->data[i]) {
+ case LY_UNDERLINE_START_CHAR:
+ if (!in_b)
+ in_u = TRUE; /*favor bold over underline*/
+ break;
+ case LY_UNDERLINE_END_CHAR:
+ in_u = FALSE;
+ break;
+ case LY_BOLD_START_CHAR:
+ if (in_u)
+ in_u = FALSE; /* turn it off*/
+ in_b = TRUE;
+ break;
+ case LY_BOLD_END_CHAR:
+ in_b = FALSE;
+ break;
+ }
+ }
+#endif
+
}
if (line == HTMainText->last_line) {
@@ -5717,7 +6325,7 @@ PUBLIC void print_crawl_to_fd ARGS3(
*/
if ((nolist == FALSE) &&
(keypad_mode == LINKS_ARE_NUMBERED ||
- keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED)) {
+ keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED)) {
printlist(fp,FALSE);
}
@@ -6969,7 +7577,7 @@ PRIVATE char * HText_skipOptionNumPrefix ARGS1(
/*
* Check if we are in the correct keypad mode.
*/
- if (keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED) {
+ if (keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED) {
/*
* Skip the option number embedded in the option name so the
* extra chars won't mess up cgi scripts processing the value.
@@ -7057,7 +7665,7 @@ PUBLIC char * HText_setLastOptionValue ARGS7(
cp++;
if (HTCurSelectGroupType == F_RADIO_TYPE &&
LYSelectPopups &&
- keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED) {
+ keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED) {
/*
* Collapse any space between the popup option
* prefix and actual value. - FM
@@ -7162,6 +7770,10 @@ PUBLIC char * HText_setLastOptionValue ARGS7(
if (HTCJK != NOCJK) {
if (cp &&
(tmp = (unsigned char *)calloc(1, strlen(cp)+1))) {
+#ifdef SH_EX
+ if (tmp == NULL)
+ outofmem(__FILE__, "HText_setLastOptionValue");
+#endif
if (kanji_code == EUC) {
TO_EUC((unsigned char *)cp, tmp);
val_cs = current_char_set;
@@ -7296,7 +7908,7 @@ PUBLIC int HText_beginInput ARGS3(
unsigned char *tmp = NULL;
int i, j;
- CTRACE(tfp,"Entering HText_beginInput\n");
+ CTRACE(tfp, "GridText: Entering HText_beginInput\n");
if (a == NULL || f == NULL)
outofmem(__FILE__, "HText_beginInput");
@@ -7380,6 +7992,10 @@ PUBLIC int HText_beginInput ARGS3(
StrAllocCopy(IValue, I->value);
if (IValue && HTCJK != NOCJK) {
if ((tmp = (unsigned char *)calloc(1, (strlen(IValue) + 1)))) {
+#ifdef SH_EX
+ if (tmp == NULL)
+ outofmem(__FILE__, "HText_beginInput");
+#endif
if (kanji_code == EUC) {
TO_EUC((unsigned char *)IValue, tmp);
I->value_cs = current_char_set;
@@ -7643,13 +8259,13 @@ PUBLIC int HText_beginInput ARGS3(
break;
default:
- if (keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED)
+ if (keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED)
a->number = ++(text->last_anchor_number);
else
a->number = 0;
break;
}
- if (keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED && a->number > 0) {
+ if (keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED && a->number > 0) {
char marker[16];
if (f->type != F_OPTION_LIST_TYPE)
@@ -7698,7 +8314,7 @@ PUBLIC int HText_beginInput ARGS3(
* If we are numbering form links, take that into
* account as well. - FM
*/
- if (keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED)
+ if (keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED)
MaximumSize -= ((a->number/10) + 3);
if (f->size > MaximumSize)
f->size = MaximumSize;
@@ -8254,9 +8870,9 @@ PUBLIC int HText_SubmitForm ARGS4(
CTRACE(tfp, "I'd submit %s (from %s), but you've not finished it\n", form_ptr->value, form_ptr->name);
name_used = (form_ptr->name ? form_ptr->name : "");
val_used = (form_ptr->value ? form_ptr->value : "");
- break;
+ break;
#endif
-
+
/* fall through */
case F_RADIO_TYPE:
case F_CHECKBOX_TYPE:
@@ -8491,7 +9107,7 @@ PUBLIC int HText_SubmitForm ARGS4(
cdisp_name_startpos = strlen(escaped1);
StrAllocCat(escaped1, name_used);
StrAllocCat(escaped1, "; filename=\"");
- StrAllocCat(escaped1, val_used);
+ StrAllocCat(escaped1, val_used);
StrAllocCat(escaped1, "\"");
if (MultipartContentType) {
StrAllocCat(escaped1, MultipartContentType);
@@ -8768,7 +9384,7 @@ PUBLIC int HText_SubmitForm ARGS4(
} else {
/*
* This is a continuation of a previous textarea
- * add %0a (\n) and the escaped string.
+ * add %0d%0a (\r\n) and the escaped string.
*/
if (escaped2[0] != '\0') {
if (previous_blanks) {
@@ -8780,7 +9396,7 @@ PUBLIC int HText_SubmitForm ARGS4(
} else if (Boundary) {
HTSprintf(&query, "%s\r\n", escaped2);
} else {
- HTSprintf(&query, "%%0a%s", escaped2);
+ HTSprintf(&query, "%%0d%%0a%s", escaped2);
}
} else {
if (PlainText) {
@@ -8788,7 +9404,7 @@ PUBLIC int HText_SubmitForm ARGS4(
} else if (Boundary) {
StrAllocCat(previous_blanks, "\r\n");
} else {
- StrAllocCat(previous_blanks, "%0a");
+ StrAllocCat(previous_blanks, "%0d%0a");
}
}
}
@@ -8872,7 +9488,7 @@ PUBLIC int HText_SubmitForm ARGS4(
StrAllocCopy(query, "");
}
FREE(previous_blanks);
-
+
CTRACE(tfp, "QUERY (%d) >> \n%s\n", strlen(query), query);
if (submit_item->submit_method == URL_MAIL_METHOD) {
@@ -9227,9 +9843,12 @@ PUBLIC void HText_setKcode ARGS3(
** appropriately. - FM
*/
if (!strcmp(charset, "shift_jis") ||
- !strcmp(charset, "x-shift-jis")) {
+ !strcmp(charset, "x-sjis") || /* 1997/11/28 (Fri) 18:11:33 */
+ !strcmp(charset, "x-shift-jis"))
+ {
text->kcode = SJIS;
} else if ((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) ||
!strcmp(charset, "iso-2022-jp") ||
@@ -9248,7 +9867,11 @@ PUBLIC void HText_setKcode ARGS3(
** 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
+ last_kcode = text->kcode = NOKANJI;
+#else
text->kcode = NOKANJI;
+#endif
if (HTCJK != NOCJK) {
if (!p_in || p_in->enc != UCT_ENC_CJK)
HTCJK = NOCJK;
@@ -9830,7 +10453,7 @@ PRIVATE void insert_new_textarea_anchor ARGS2(
l->numstyles = htline->numstyles;
#endif
strcpy (l->data, htline->data);
- if (keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED) {
+ if (keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED) {
a->number++;
increment_tagged_htline (l, a, &lx, &curr_tag, 1, CHOP);
}
@@ -9883,10 +10506,10 @@ PRIVATE void update_subsequent_anchors ARGS4(
HTLine *htline = start_htline;
int form_chars_added = (start_anchor->input_field->size + 1) * n;
- int line_adj = 0;
- int tag_adj = 0;
- int lx = 0;
- int hang = 0; /* for HANG detection of a nasty intermittent */
+ int line_adj = 0;
+ int tag_adj = 0;
+ int lx = 0;
+ int hang = 0; /* for HANG detection of a nasty intermittent */
int hang_detect = 100000; /* ditto */
@@ -9902,7 +10525,7 @@ PRIVATE void update_subsequent_anchors ARGS4(
*/
anchor = start_anchor->next; /* begin updating with the NEXT anchor */
while (anchor) {
- if ((keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED) &&
+ if ((keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED) &&
(anchor->number != 0))
anchor->number += n;
anchor->line_num += n;
@@ -9940,7 +10563,7 @@ PRIVATE void update_subsequent_anchors ARGS4(
* relocating an anchor to the following line, when [tag] digits
* expansion pushes things too far in that direction.]
*/
- if (keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED) {
+ if (keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED) {
anchor = start_anchor->next;
while (htline != HTMainText->last_line->next) {
@@ -10897,6 +11520,21 @@ PUBLIC void HTMark_asSource NOARGS
}
#endif
+#ifdef CJK_EX
+PUBLIC HTkcode HText_getKcode ARGS1(
+ HText *, text)
+{
+ return text->kcode;
+}
+
+PUBLIC void HText_updateKcode ARGS2(
+ HText *, text,
+ HTkcode, kcode)
+{
+ text->kcode = kcode;
+}
+#endif
+
PUBLIC int HTMainText_Get_UCLYhndl NOARGS
{
return (HTMainText ? HTMainText->node_anchor->UCStages->s[0].C.UChndl : 0);
diff --git a/src/GridText.h b/src/GridText.h
index a26f709a..b8705e7a 100644
--- a/src/GridText.h
+++ b/src/GridText.h
@@ -47,6 +47,13 @@
#define NOCHOP 0
#define CHOP 1
+#define TABSTOP 8
+#define SPACES " " /* must be at least TABSTOP spaces long */
+#define SPLAT '.'
+
+#define NOCHOP 0
+#define CHOP 1
+
/* just for information:
US-ASCII control characters <32 which are not defined in Unicode standard
=00 U+0000 NULL
@@ -286,4 +293,14 @@ extern void HTMark_asSource NOPARAMS;
extern int HTMainText_Get_UCLYhndl NOPARAMS;
+#ifdef CJK_EX
+
+#include <HTCJK.h>
+extern HTkcode last_kcode;
+
+extern HTkcode HText_getKcode PARAMS((HText * text));
+extern void HText_updateKcode PARAMS((HText * text, HTkcode kcode));
+
+#endif
+
#endif /* LYGRIDTEXT_H */
diff --git a/src/HTAlert.c b/src/HTAlert.c
index 29abf7c1..0730e8a5 100644
--- a/src/HTAlert.c
+++ b/src/HTAlert.c
@@ -22,6 +22,10 @@
#include <LYLeaks.h>
+#if _WIN_CC
+#include <HTParse.h>
+#endif
+
/* Issue a message about a problem. HTAlert()
** --------------------------------
*/
@@ -106,6 +110,53 @@ PUBLIC void HTUserMsg2 ARGS2(
}
}
+#ifdef WIN_EX /* 1997/10/28 (Tue) 17:19:43 */
+
+#define MAX_LEN 512
+
+void ws_title(CONST char *str)
+{
+ char buff[MAX_LEN];
+ char *p;
+ int len;
+
+#define TITLE_CUT 32
+
+ p = (char *)str;
+ len = strlen(p);
+ if (len > (MAX_LEN - 1)) {
+ strncpy(buff, p, (MAX_LEN - 1));
+ len = MAX_LEN - 1;
+ buff[MAX_LEN - 1] = '\0';
+ } else {
+ strcpy(buff, p);
+ }
+
+ if (len > LYcols) {
+ buff[TITLE_CUT] = '.';
+ buff[TITLE_CUT+1] = '.';
+ strcpy(buff + TITLE_CUT + 2, (buff + len) - LYcols + TITLE_CUT + 1);
+ }
+ if (strchr(buff, '%')) {
+ HTUnEscape(buff);
+ }
+
+ p = buff;
+ while (*p++) {
+ if (*p == '\r') {
+ *p = '\0';
+ break;
+ } else if (*p == '\n') {
+ *p = '\0';
+ break;
+ }
+ }
+
+ /* Quick hack. buff is SJIS only ??? */
+ SetConsoleTitle(buff);
+}
+#endif
+
/* Issue a progress message. HTProgress()
** -------------------------
*/
@@ -115,6 +166,12 @@ PUBLIC void HTProgress ARGS1(
statusline(Msg);
LYstore_message(Msg);
CTRACE(tfp, "%s\n", Msg);
+#if defined(SH_EX) && defined(WIN_EX) /* 1997/10/11 (Sat) 12:51:02 */
+ {
+ if (debug_delay != 0)
+ Sleep(debug_delay); /* XXX msec */
+ }
+#endif
}
/* Issue a read-progress message. HTReadProgress()
@@ -124,6 +181,67 @@ PUBLIC void HTReadProgress ARGS2(
long, bytes,
long, total)
{
+#ifdef WIN_EX /* 1998/07/08 (Wed) 16:09:47 */
+
+#include <sys/timeb.h>
+#define kb_units 1024L
+ static double now, first, last;
+ static long bytes_last;
+
+ double transfer_rate;
+ char line[80];
+ struct timeb tb;
+ char *units = "bytes";
+
+ ftime(&tb);
+ now = tb.time + (double)tb.millitm / 1000;
+
+ if (bytes == 0) {
+ first = last = now;
+ bytes_last = bytes;
+ } else if ((bytes > 0) && (now > first)) {
+ transfer_rate = (double)bytes / (now - first); /* bytes/sec */
+
+ if (now != last) {
+ last = now;
+ bytes_last = bytes;
+ }
+ if (total >= kb_units || bytes >= kb_units) {
+ if (total > 0)
+ total /= 1024;
+ bytes /= 1024;
+ units = "KB";
+ }
+
+ if (total > 0)
+ sprintf (line, "Read %3d%%, %ld of %ld %s.",
+ (int) (bytes * 100 / total), bytes, total, units);
+ else
+ sprintf (line, "Read %ld %s of data.", bytes, units);
+
+ if (transfer_rate > 0.0) {
+ int n;
+ n = strlen(line);
+ if (LYshow_kb_rate) {
+ sprintf (line + n, " %6.2lf KB/sec.", transfer_rate / 1024.0);
+ } else {
+ int t_rate;
+
+ t_rate = (int)transfer_rate;
+ if (t_rate < 1000)
+ sprintf (line + n, " %6d bytes/sec.", t_rate);
+ else
+ sprintf (line + n, " %6d,%03d bytes/sec.",
+ t_rate / 1000, t_rate % 1000);
+ }
+ }
+ if (total < 0) {
+ if (total < -1)
+ strcat(line, " (Press 'z' to abort)");
+ }
+ _HTProgress(line);
+ }
+#else
static long kb_units = 1024;
static time_t first, last;
static long bytes_last;
@@ -186,6 +304,7 @@ PUBLIC void HTReadProgress ARGS2(
CTRACE(tfp, "%s\n", line);
}
}
+#endif
}
PRIVATE BOOL conf_cancelled = NO; /* used by HTConfirm only - kw */
diff --git a/src/HTFWriter.c b/src/HTFWriter.c
index 7211c3ef..fd1f4bd5 100644
--- a/src/HTFWriter.c
+++ b/src/HTFWriter.c
@@ -13,6 +13,11 @@
#include <HTFWriter.h>
#include <HTSaveToFile.h>
+#if _WIN_CC
+#include <HTParse.h>
+extern int exec_command(char * cmd, int wait_flag); /* xsystem.c */
+#endif
+
#include <HTFormat.h>
#include <UCDefs.h>
#include <HTAlert.h>
@@ -80,7 +85,8 @@ struct _HTStream {
*/
PRIVATE void HTFWriter_put_character ARGS2(HTStream *, me, char, c)
{
- putc(c, me->fp);
+ if (me->fp)
+ putc(c, me->fp);
}
/* String handling
@@ -90,7 +96,8 @@ PRIVATE void HTFWriter_put_character ARGS2(HTStream *, me, char, c)
*/
PRIVATE void HTFWriter_put_string ARGS2(HTStream *, me, CONST char*, s)
{
- fputs(s, me->fp);
+ if (me->fp)
+ fputs(s, me->fp);
}
/* Buffer write. Buffers can (and should!) be big.
@@ -98,7 +105,8 @@ PRIVATE void HTFWriter_put_string ARGS2(HTStream *, me, CONST char*, s)
*/
PRIVATE void HTFWriter_write ARGS3(HTStream *, me, CONST char*, s, int, l)
{
- fwrite(s, 1, l, me->fp);
+ if (me->fp)
+ fwrite(s, 1, l, me->fp);
}
@@ -119,8 +127,14 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me)
char *addr = NULL;
int status;
BOOL use_gzread = NO;
+#ifdef WIN_EX
+ HANDLE cur_handle;
+
+ cur_handle = GetForegroundWindow();
+#endif
- fflush(me->fp);
+ if (me->fp)
+ fflush(me->fp);
if (me->end_command) { /* Temp file */
LYCloseTempFP(me->fp);
#ifdef VMS
@@ -294,16 +308,29 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me)
* Tell user what's happening. - FM
*/
HTProgress(me->end_command);
+#ifndef WIN_EX
stop_curses();
+#endif
}
+#ifdef _WIN_CC
+ exec_command(me->end_command, FALSE);
+#else
LYSystem(me->end_command);
-
+#endif
if (me->remove_command) {
/* NEVER REMOVE THE FILE unless during an abort!!!*/
FREE(me->remove_command);
}
- if (!dump_output_immediately)
+ if (!dump_output_immediately) {
+#ifdef WIN_EX
+ if (focus_window) {
+ HTInfoMsg("Set focus1");
+ status = SetForegroundWindow(cur_handle);
+ }
+#else
start_curses();
+#endif
+ }
} else
status = HTLoadFile(addr,
me->anchor,
@@ -337,16 +364,30 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me)
* Tell user what's happening. - FM
*/
_HTProgress(me->end_command);
+#ifndef WIN_EX
stop_curses();
+#endif
}
+#ifdef _WIN_CC
+ exec_command(me->end_command, FALSE);
+#else
LYSystem(me->end_command);
+#endif
if (me->remove_command) {
/* NEVER REMOVE THE FILE unless during an abort!!!*/
FREE(me->remove_command);
}
- if (!dump_output_immediately)
+ if (!dump_output_immediately) {
+#ifdef WIN_EX
+ if (focus_window) {
+ HTInfoMsg("Set focus2");
+ status = SetForegroundWindow(cur_handle);
+ }
+#else
start_curses();
+#endif
+ }
} else {
/*
* It's a file we saved to disk for handling
@@ -356,6 +397,16 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me)
/* NEVER REMOVE THE FILE unless during an abort!!!*/
FREE(me->remove_command);
}
+ if (!dump_output_immediately) {
+#ifdef WIN_EX
+ if (focus_window) {
+ HTInfoMsg("Set focus3");
+ status = SetForegroundWindow(cur_handle);
+ }
+#else
+ start_curses();
+#endif
+ }
}
FREE(me->end_command);
}
@@ -466,7 +517,6 @@ PUBLIC HTStream* HTSaveAndExecute ARGS3(
LYCancelledFetch = TRUE;
return(NULL);
}
-
#if defined(EXEC_LINKS) || defined(EXEC_SCRIPTS)
if (pres->quality == 999.0) { /* exec link */
if (dump_output_immediately) {
@@ -510,6 +560,56 @@ PUBLIC HTStream* HTSaveAndExecute ARGS3(
if (LYCachedTemp(fnam, &(anchor->FileCache))) {
me->fp = LYNewBinFile (fnam);
} else {
+#if defined(WIN_EX) && !defined(__CYGWIN__) /* 1998/01/04 (Sun) */
+ if (!strncmp(anchor->address,"file://localhost",16)) {
+
+ /* 1998/01/23 (Fri) 17:38:26 */
+ extern char windows_drive[];
+ unsigned char *cp, *view_fname;
+
+#define IS_SJIS_HI1(hi) ((0x81<=hi)&&(hi<=0x9F)) /* 1st lev. */
+#define IS_SJIS_HI2(hi) ((0xE0<=hi)&&(hi<=0xEF)) /* 2nd lev. */
+
+ me->fp = NULL;
+
+ view_fname = fnam + 3;
+ strcpy(view_fname, anchor->address + 17);
+ HTUnEscape(view_fname);
+
+ if (strchr(view_fname, ':')==NULL) {
+ fnam[0] = windows_drive[0];
+ fnam[1] = windows_drive[1];
+ fnam[2] = '/';
+ view_fname = fnam;
+ }
+
+ /* 1998/04/21 (Tue) 11:04:16 */
+ cp = view_fname;
+ while (*cp) {
+ if (IS_SJIS_HI1(*cp) || IS_SJIS_HI2(*cp)) {
+ cp += 2;
+ continue;
+ } else if (*cp == '/') {
+ *cp = '\\';
+ }
+ cp++;
+ }
+ if (strchr(view_fname, ' '))
+ view_fname = quote_pathname(view_fname);
+
+ StrAllocCopy(me->viewer_command, pres->command);
+
+ me->end_command = (char *)calloc (
+ (strlen (pres->command) + 10 + strlen(view_fname))
+ * sizeof (char),1);
+ if (me->end_command == NULL)
+ outofmem(__FILE__, "HTSaveAndExecute");
+ sprintf(me->end_command, pres->command, view_fname);
+ me->remove_command = NULL;
+
+ return me;
+ }
+#endif
/*
* Check for a suffix.
* Save the file under a suitably suffixed name.
@@ -521,8 +621,10 @@ PUBLIC HTStream* HTSaveAndExecute ARGS3(
} else if (!strcasecomp(pres->rep->name,
"application/octet-stream")) {
suffix = ".bin";
- } else if ((suffix = HTFileSuffix(pres->rep, anchor->content_encoding)) == 0
- || *suffix != '.') {
+ } else if (
+ (suffix = HTFileSuffix(pres->rep, anchor->content_encoding)) == 0
+ || *suffix != '.')
+ {
suffix = HTML_SUFFIX;
}
me->fp = LYOpenTemp(fnam, suffix, "wb");
diff --git a/src/HTInit.c b/src/HTInit.c
index b5f39fb7..6a82af9a 100644
--- a/src/HTInit.c
+++ b/src/HTInit.c
@@ -49,10 +49,10 @@ PUBLIC void HTFormatInit NOARGS
HTSetPresentation("image/x-xbm", XLoadImageCommand, 1.0, 3.0, 0.0, 0);
HTSetPresentation("image/x-xbitmap", XLoadImageCommand, 1.0, 3.0, 0.0, 0);
HTSetPresentation("image/x-png", XLoadImageCommand, 2.0, 3.0, 0.0, 0);
- HTSetPresentation("image/png", XLoadImageCommand, 1.0, 3.0, 0.0, 0);
+ HTSetPresentation("image/png", XLoadImageCommand, 1.0, 3.0, 0.0, 0);
HTSetPresentation("image/x-rgb", XLoadImageCommand, 1.0, 3.0, 0.0, 0);
HTSetPresentation("image/x-tiff", XLoadImageCommand, 2.0, 3.0, 0.0, 0);
- HTSetPresentation("image/tiff", XLoadImageCommand, 1.0, 3.0, 0.0, 0);
+ HTSetPresentation("image/tiff", XLoadImageCommand, 1.0, 3.0, 0.0, 0);
HTSetPresentation("image/jpeg", XLoadImageCommand, 1.0, 3.0, 0.0, 0);
HTSetPresentation("video/mpeg", "mpeg_play %s &", 1.0, 3.0, 0.0, 0);
@@ -62,9 +62,9 @@ PUBLIC void HTFormatInit NOARGS
#ifdef EXEC_SCRIPTS
/* set quality to 999.0 for protected exec applications */
#ifndef VMS
- HTSetPresentation("application/x-csh", "csh %s", 999.0, 3.0, 0.0, 0);
- HTSetPresentation("application/x-sh", "sh %s", 999.0, 3.0, 0.0, 0);
- HTSetPresentation("application/x-ksh", "ksh %s", 999.0, 3.0, 0.0, 0);
+ HTSetPresentation("application/x-csh", "csh %s", 999.0, 3.0, 0.0, 0);
+ HTSetPresentation("application/x-sh", "sh %s", 999.0, 3.0, 0.0, 0);
+ HTSetPresentation("application/x-ksh", "ksh %s", 999.0, 3.0, 0.0, 0);
#else
HTSetPresentation("application/x-VMS_script", "@%s", 999.0, 3.0, 0.0, 0);
#endif /* not VMS */
@@ -153,7 +153,7 @@ PUBLIC void HTFormatInit NOARGS
/*
* Load the local maps.
*/
- if ((fp = fopen(personal_type_map,"r")) != NULL) {
+ if ((fp = fopen(personal_type_map, TXT_R)) != NULL) {
fclose(fp);
/* These should override everything else. */
HTLoadTypesConfigFile(personal_type_map);
@@ -376,7 +376,7 @@ PRIVATE int ProcessMailcapEntry ARGS2(
/* no support for now. What does this do anyways? */
/* ExceptionalNewline(mc->contenttype, atoi(eq)); */
} else if (eq && !strcmp(arg, "q")) {
- mc->quality = atof(eq);
+ mc->quality = (float)atof(eq);
if (mc->quality > 0.000 && mc->quality < 0.001)
mc->quality = 0.001;
} else if (eq && !strcmp(arg, "mxb")) {
@@ -624,7 +624,7 @@ PRIVATE int ProcessMailcapFile ARGS1(
CTRACE(tfp, "ProcessMailcapFile: Loading file '%s'.\n",
file);
- if ((fp = fopen(file, "r")) == NULL) {
+ if ((fp = fopen(file, TXT_R)) == NULL) {
CTRACE(tfp, "ProcessMailcapFile: Could not open '%s'.\n",
file);
return(-1 == 0);
@@ -755,6 +755,8 @@ PUBLIC void HTFileInit NOARGS
HTSetSuffix(".bz2", "application/x-bzip2", "binary", 1.0);
+ HTSetSuffix(".bz2", "application/x-bzip2", "binary", 1.0);
+
HTSetSuffix(".uu", "application/x-UUencoded", "8bit", 1.0);
HTSetSuffix(".hqx", "application/x-Binhex", "8bit", 1.0);
@@ -909,7 +911,7 @@ PUBLIC void HTFileInit NOARGS
/* These should override the default extensions as necessary. */
HTLoadExtensionsConfigFile(global_extension_map);
- if ((fp = fopen(personal_extension_map,"r")) != NULL) {
+ if ((fp = fopen(personal_extension_map, TXT_R)) != NULL) {
fclose(fp);
/* These should override everything else. */
HTLoadExtensionsConfigFile(personal_extension_map);
@@ -997,7 +999,7 @@ PRIVATE int HTLoadExtensionsConfigFile ARGS1(
CTRACE(tfp, "HTLoadExtensionsConfigFile: Loading file '%s'.\n", fn);
- if ((f = fopen(fn,"r")) == NULL) {
+ if ((f = fopen(fn, TXT_R)) == NULL) {
CTRACE(tfp, "HTLoadExtensionsConfigFile: Could not open '%s'.\n", fn);
return count;
}
diff --git a/src/HTML.c b/src/HTML.c
index 4849b24b..6fda07e9 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -78,6 +78,8 @@
#include <HTAccess.h>
#endif
+#include <LYJustify.h>
+
#include <LYexit.h>
#include <LYLeaks.h>
@@ -226,6 +228,10 @@ PRIVATE void change_paragraph_style ARGS2(HTStructured *, me, HTStyle *,style)
*/
PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
{
+#ifdef CJK_EX
+ static unsigned char save_ch1 = 0;
+ static unsigned char save_ch2 = 0;
+#endif
/*
* Ignore all non-MAP content when just
* scanning a document for MAPs. - FM
@@ -406,7 +412,27 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
} else {
me->inP = TRUE;
me->inLABEL = FALSE;
+#ifdef CJK_EX
+ if (last_kcode == EUC) {
+ if (save_ch1 && !save_ch2) {
+ if ((unsigned char)c & 0x80) {
+ save_ch2 = c;
+ }
+ HText_appendCharacter(me->text, save_ch1);
+ HText_appendCharacter(me->text, save_ch2);
+ save_ch1 = save_ch2 = '\0';
+ } else if ((unsigned char)c & 0x80) {
+ save_ch1 = c;
+ save_ch2 = '\0';
+ } else {
+ HText_appendCharacter(me->text, c);
+ }
+ } else {
+ HText_appendCharacter(me->text, c);
+ }
+#else
HText_appendCharacter(me->text, c);
+#endif
me->in_word = YES;
}
}
@@ -446,7 +472,7 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
StrAllocCopy(translated_string,s);
TRANSLATE_AND_UNESCAPE_ENTITIES(&translated_string, TRUE, FALSE);
s = (CONST char *) translated_string;
- };
+ }
#endif
switch (me->sp[0].tag_number) {
@@ -707,8 +733,14 @@ PRIVATE void HTMLSRC_apply_markup ARGS4(
}
# define START TRUE
# define STOP FALSE
+
+#ifdef __STDC__
# define PSRCSTART(x) HTMLSRC_apply_markup(me,HTL_##x,START,tag_charset)
# define PSRCSTOP(x) HTMLSRC_apply_markup(me,HTL_##x,STOP,tag_charset)
+#else
+# define PSRCSTART(x) HTMLSRC_apply_markup(me,HTL_/**/x,START,tag_charset)
+# define PSRCSTOP(x) HTMLSRC_apply_markup(me,HTL_/**/x,STOP,tag_charset)
+#endif
# define PUTC(x) HTML_put_character(me,x)
# define PUTS(x) HTML_put_string(me,x)
@@ -1207,7 +1239,7 @@ PRIVATE void HTML_start_element ARGS6(
*/
/* lss and css has different syntax - lynx shouldn't try to
parse them now (it tries to parse them as lss, so it exits with
- error message the 1st non-empty line) - HVV
+ error message on the 1st non-empty line) - VH
*/
#ifndef USE_COLOR_STYLE
if (!strcasecomp(value[HTML_LINK_REL], "StyleSheet") ||
@@ -1591,6 +1623,7 @@ PRIVATE void HTML_start_element ARGS6(
NULL, /* Tag */
href, /* Addresss */
INTERN_LT); /* Type */
+ CAN_JUSTIFY_PUSH(FALSE);
LYEnsureSingleSpace(me);
if (me->inUnderline == FALSE)
HText_appendCharacter(me->text, LY_UNDERLINE_START_CHAR);
@@ -1609,6 +1642,7 @@ PRIVATE void HTML_start_element ARGS6(
HText_appendCharacter(me->text, LY_BOLD_END_CHAR);
HText_endAnchor(me->text, 0);
LYEnsureSingleSpace(me);
+ CAN_JUSTIFY_POP;
} else {
CHECK_ID(HTML_FRAME_ID);
}
@@ -1662,6 +1696,7 @@ PRIVATE void HTML_start_element ARGS6(
href, /* Addresss */
INTERN_LT); /* Type */
LYEnsureDoubleSpace(me);
+ CAN_JUSTIFY_PUSH_F
LYResetParagraphAlignment(me);
if (me->inUnderline == FALSE)
HText_appendCharacter(me->text, LY_UNDERLINE_START_CHAR);
@@ -1669,6 +1704,7 @@ PRIVATE void HTML_start_element ARGS6(
if (me->inUnderline == FALSE)
HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
HTML_put_character(me, ' ');
+
me->in_word = NO;
CHECK_ID(HTML_IFRAME_ID);
HText_beginAnchor(me->text, me->inUnderline, me->CurrentA);
@@ -1680,6 +1716,7 @@ PRIVATE void HTML_start_element ARGS6(
HText_appendCharacter(me->text, LY_BOLD_END_CHAR);
HText_endAnchor(me->text, 0);
LYEnsureSingleSpace(me);
+ CAN_JUSTIFY_POP;
} else {
CHECK_ID(HTML_IFRAME_ID);
}
@@ -2014,6 +2051,7 @@ PRIVATE void HTML_start_element ARGS6(
}
UPDATE_STYLE;
+ 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]))) {
@@ -2069,6 +2107,7 @@ PRIVATE void HTML_start_element ARGS6(
* or right, just add a collapsible space, otherwise, add the
* appropriate number of spaces. - FM
*/
+
if (target < column ||
target > HText_getMaximumColumn(me->text)) {
HTML_put_character(me, ' ');
@@ -2273,8 +2312,10 @@ PRIVATE void HTML_start_element ARGS6(
if (me->inUnderline == FALSE)
HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
HTML_put_character(me, ' ');
+ CAN_JUSTIFY_START;
FREE(note);
}
+ CAN_JUSTIFY_START;
me->inLABEL = TRUE;
me->in_word = NO;
me->inP = FALSE;
@@ -2305,6 +2346,7 @@ PRIVATE void HTML_start_element ARGS6(
}
UPDATE_STYLE; /* update to the new style */
CHECK_ID(HTML_DL_ID);
+
break;
case HTML_DLC:
@@ -2693,6 +2735,7 @@ PRIVATE void HTML_start_element ARGS6(
HText_setLastChar(me->text, ' ');
}
}
+ CAN_JUSTIFY_START;
me->in_word = NO;
me->inP = FALSE;
break;
@@ -2731,6 +2774,7 @@ PRIVATE void HTML_start_element ARGS6(
if (me->inUnderline == FALSE)
HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
HTML_put_character(me, ' ');
+ CAN_JUSTIFY_START
me->inLABEL = TRUE;
me->in_word = NO;
me->inP = FALSE;
@@ -2923,17 +2967,20 @@ PRIVATE void HTML_start_element ARGS6(
me->inUnderline, me->CurrentA);
if (me->inBoldA == TRUE && me->inBoldH == FALSE)
HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
-#ifdef NOTUSED_FOTEMODS
+#if defined(NOTUSED_FOTEMODS) || !defined(NO_EMPTY_HREFLESS_A)
/*
* Close an HREF-less NAMED-ed now if we aren't making their
* content bold, and let the check in HTML_end_element() deal
* with any dangling end tag this creates. - FM
*/
- if (href == NULL && me->inBoldA == FALSE) {
- SET_SKIP_STACK(HTML_A);
- HTML_end_element(me, HTML_A, &include);
- }
-#endif /* NOTUSED_FOTEMODS */
+# ifndef NO_EMPTY_HREFLESS_A
+ if (force_empty_hrefless_a)
+# endif
+ if (href == NULL && me->inBoldA == FALSE) {
+ SET_SKIP_STACK(HTML_A);
+ HTML_end_element(me, HTML_A, include);
+ }
+#endif /* NOTUSED_FOTEMODS || !defined(NO_EMPTY_HREFLESS_A)*/
FREE(href);
break;
@@ -4192,6 +4239,7 @@ PRIVATE void HTML_start_element ARGS6(
if (me->inUnderline == FALSE)
HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
HTML_put_character(me, ' ');
+ CAN_JUSTIFY_START;
if (me->inFIG)
/*
@@ -4223,6 +4271,7 @@ PRIVATE void HTML_start_element ARGS6(
if (me->inUnderline == FALSE)
HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
HTML_put_character(me, ' ');
+ CAN_JUSTIFY_START
if (me->inFIG)
/*
@@ -4271,6 +4320,7 @@ PRIVATE void 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;)
if (present && present[HTML_FORM_ACCEPT_CHARSET]) {
accept_cs = value[HTML_FORM_ACCEPT_CHARSET] ?
@@ -4593,7 +4643,9 @@ PRIVATE void HTML_start_element ARGS6(
BOOL HaveSRClink = FALSE;
char* ImageSrc = NULL;
BOOL IsSubmitOrReset = FALSE;
-
+#ifdef CJK_EX
+ HTkcode kcode = 0;
+#endif
/* 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;
@@ -5032,6 +5084,12 @@ PRIVATE void HTML_start_element ARGS6(
for (; chars > 0; chars--)
HTML_put_character(me, '_');
} else {
+#ifdef CJK_EX
+ if (HTCJK != NOCJK) {
+ kcode = HText_getKcode(me->text);
+ HText_updateKcode(me->text, kanji_code);
+ }
+#endif
if (me->sp[0].tag_number == HTML_PRE ||
!me->sp->style->freeFormat) {
/*
@@ -5071,6 +5129,10 @@ PRIVATE void HTML_start_element ARGS6(
while (i < chars)
HTML_put_character(me, HT_NON_BREAK_SPACE);
}
+#ifdef CJK_EX
+ if (HTCJK != NOCJK)
+ HText_updateKcode(me->text, kcode);
+#endif
}
HText_setIgnoreExcess(me->text, FALSE);
FREE(ImageSrc);
@@ -5383,7 +5445,7 @@ PRIVATE void HTML_start_element ARGS6(
*/
if (HTCurSelectGroupType == F_RADIO_TYPE &&
LYSelectPopups &&
- keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED) {
+ keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED) {
char marker[8];
int opnum = HText_getOptionNum(me->text);
@@ -5430,10 +5492,27 @@ PRIVATE void HTML_start_element ARGS6(
if (present && present[HTML_TABLE_ALIGN] &&
value[HTML_TABLE_ALIGN] && *value[HTML_TABLE_ALIGN]) {
if (!strcasecomp(value[HTML_TABLE_ALIGN], "center")) {
+#ifdef SH_EX /* 1998/10/09 (Fri) 15:20:09 */
+ if (no_table_center) {
+ me->DivisionAlignments[me->Division_Level] = HT_LEFT;
+ change_paragraph_style(me, styles[HTML_DLEFT]);
+ UPDATE_STYLE;
+ me->current_default_alignment =
+ styles[HTML_DLEFT]->alignment;
+ } else {
+ me->DivisionAlignments[me->Division_Level] = HT_CENTER;
+ change_paragraph_style(me, styles[HTML_DCENTER]);
+ UPDATE_STYLE;
+ me->current_default_alignment =
+ styles[HTML_DCENTER]->alignment;
+ }
+#else
me->DivisionAlignments[me->Division_Level] = HT_CENTER;
change_paragraph_style(me, styles[HTML_DCENTER]);
UPDATE_STYLE;
me->current_default_alignment = styles[HTML_DCENTER]->alignment;
+
+#endif
} else if (!strcasecomp(value[HTML_TABLE_ALIGN], "right")) {
me->DivisionAlignments[me->Division_Level] = HT_RIGHT;
change_paragraph_style(me, styles[HTML_DRIGHT]);
@@ -5491,9 +5570,18 @@ PRIVATE void HTML_start_element ARGS6(
me->sp->style->alignment = me->current_default_alignment;
}
if (present && present[HTML_TR_ALIGN] && value[HTML_TR_ALIGN]) {
+#ifdef SH_EX
+ if (!strcasecomp(value[HTML_TR_ALIGN], "center") &&
+ !(me->List_Nesting_Level >= 0 && !me->inP))
+ if (no_table_center)
+ me->sp->style->alignment = HT_LEFT;
+ else
+ me->sp->style->alignment = HT_CENTER;
+#else
if (!strcasecomp(value[HTML_TR_ALIGN], "center") &&
!(me->List_Nesting_Level >= 0 && !me->inP))
me->sp->style->alignment = HT_CENTER;
+#endif
else if (!strcasecomp(value[HTML_TR_ALIGN], "right") &&
!(me->List_Nesting_Level >= 0 && !me->inP))
me->sp->style->alignment = HT_RIGHT;
@@ -5593,7 +5681,8 @@ PRIVATE void HTML_start_element ARGS6(
if (HTML_dtd.tags[ElementNumber].contents != SGML_EMPTY) {
if (me->skip_stack > 0) {
- CTRACE(tfp, "HTML:begin_element: internal call (level %d), leaving on stack - %s\n",
+ CTRACE(tfp,
+ "HTML:begin_element: internal call (level %d), leaving on stack - `%s'\n",
me->skip_stack, me->sp->style->name);
me->skip_stack--;
return;
@@ -5619,6 +5708,11 @@ PRIVATE void HTML_start_element ARGS6(
(me->sp)--;
me->sp[0].style = me->new_style; /* Stack new style */
me->sp[0].tag_number = ElementNumber;
+#ifdef EXP_JUSTIFY_ELTS
+ if (wait_for_this_stacked_elt<0 &&
+ HTML_dtd.tags[ElementNumber].can_justify==FALSE)
+ wait_for_this_stacked_elt=me->stack - me->sp;
+#endif
}
#if defined(USE_COLOR_STYLE)
@@ -5672,6 +5766,7 @@ PRIVATE void HTML_end_element ARGS3(
int i = 0;
char *temp = NULL, *cp = NULL;
BOOL BreakFlag = FALSE;
+ EMIT_IFDEF_EXP_JUSTIFY_ELTS(BOOL reached_awaited_stacked_elt=FALSE;)
#ifdef USE_PSRC
if (psrc_view && !sgml_in_psrc_was_initialized) {
@@ -5793,6 +5888,10 @@ PRIVATE void HTML_end_element ARGS3(
*/
return;
} else if (me->sp < (me->stack + MAX_NESTING - 1)) {
+#ifdef EXP_JUSTIFY_ELTS
+ if (wait_for_this_stacked_elt==me->stack-me->sp)
+ reached_awaited_stacked_elt=TRUE;
+#endif
(me->sp)++;
CTRACE(tfp, "HTML:end_element[%d]: Popped style off stack - %s\n",
(int) STACKLEVEL(me),
@@ -5802,8 +5901,13 @@ PRIVATE void HTML_end_element ARGS3(
"Stack underflow error! Tried to pop off more styles than exist in stack\n");
}
}
- if (BreakFlag == TRUE)
+ if (BreakFlag == TRUE) {
+#ifdef EXP_JUSTIFY_ELTS
+ if (reached_awaited_stacked_elt)
+ wait_for_this_stacked_elt=-1;
+#endif
return;
+ }
/*
* Check for unclosed TEXTAREA. - FM
@@ -6587,6 +6691,7 @@ End_Object:
me->inBadHTML = TRUE;
}
}
+ EMIT_IFDEF_EXP_JUSTIFY_ELTS(form_in_htext=FALSE;)
/*
* Check if we still have a SELECT element open.
@@ -7026,6 +7131,11 @@ End_Object:
break;
} /* switch */
+
+#ifdef EXP_JUSTIFY_ELTS
+ if (reached_awaited_stacked_elt)
+ wait_for_this_stacked_elt=-1;
+#endif
#ifdef USE_COLOR_STYLE
#if !OPT_SCN
TrimColorClass(HTML_dtd.tags[element_number].name,
@@ -7122,15 +7232,17 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me)
CTRACE(tfp,"HTML_free: Ending underline\n");
}
if (me->inA) {
- HTML_end_element(me, HTML_A, &include);
+ HTML_end_element(me, HTML_A, (char **)&include);
me->inA = FALSE;
+ if (TRACE)
+ fprintf(stderr,"HTML_free: Ending HTML_A\n");
}
if (me->inFONT) {
- HTML_end_element(me, HTML_FONT, &include);
+ HTML_end_element(me, HTML_FONT, (char **)&include);
me->inFONT = FALSE;
}
if (me->inFORM) {
- HTML_end_element(me, HTML_FORM, &include);
+ HTML_end_element(me, HTML_FORM, (char **)&include);
me->inFORM = FALSE;
}
if (me->option.size > 0) {
@@ -7720,6 +7832,19 @@ PUBLIC HTStructured* HTML_new ARGS3(
me->outUCLYhndl, me->outUCI);
#endif
+#ifdef EXP_JUSTIFY_ELTS
+ wait_for_this_stacked_elt = !ok_justify
+# ifdef USE_PSRC
+ || psrc_view
+# endif
+ ? MAX_NESTING+2 /*some unreachable value*/ : -1;
+ can_justify_here = TRUE;
+ can_justify_this_line = TRUE;
+ form_in_htext = FALSE;
+
+ ht_justify_cleanup();
+#endif
+
me->target = stream;
if (stream)
me->targetClass = *stream->isa; /* Copy pointers */
@@ -8064,7 +8189,29 @@ PRIVATE char * MakeNewTitle ARGS2(CONST char **, value, int, src_type)
} else {
StrAllocCat(newtitle, ptr + 1);
}
+#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) {
+ StrAllocCopy(newtitle, "+");
+ } else if (stricmp(newtitle + 1, "internal-gopher-unknown") == 0) {
+ StrAllocCopy(newtitle, " ");
+ } else {
+ /* normal title */
+ ptr = strrchr(newtitle, '.');
+ if (ptr) {
+ if (stricmp(ptr, ".gif") == 0)
+ *ptr = '\0';
+ else if (stricmp(ptr, ".jpg") == 0)
+ *ptr = '\0';
+ else if (stricmp(ptr, ".jpeg") == 0)
+ *ptr = '\0';
+ }
+ StrAllocCat(newtitle, "]");
+ }
+#else
StrAllocCat(newtitle, "]");
+#endif
return newtitle;
}
@@ -8091,7 +8238,7 @@ PRIVATE char * MakeNewMapValue ARGS2(CONST char **, value, CONST char*, mapstr)
StrAllocCopy(newtitle, "[");
StrAllocCat(newtitle,mapstr); /* ISMAP or USEMAP */
- if ( verbose_img ) {
+ if ( verbose_img && value[HTML_IMG_SRC] && *value[HTML_IMG_SRC] ) {
StrAllocCat(newtitle,":");
ptr = strrchr(value[HTML_IMG_SRC], '/');
if (!ptr) {
diff --git a/src/LYBookmark.c b/src/LYBookmark.c
index 5c4de52e..50ad92bd 100644
--- a/src/LYBookmark.c
+++ b/src/LYBookmark.c
@@ -11,6 +11,7 @@
#include <LYCharSets.h> /* need for LYHaveCJKCharacterSet */
#include <LYCurses.h>
#include <GridText.h>
+#include <HTCJK.h>
#ifdef VMS
#include <nam.h>
@@ -24,6 +25,8 @@ PUBLIC char *MBM_A_subdescript[MBM_V_MAXFILES+1];
PRIVATE BOOLEAN is_mosaic_hotlist = FALSE;
PRIVATE char * convert_mosaic_bookmark_file PARAMS((char *filename_buffer));
+extern HTCJKlang HTCJK;
+
PRIVATE void
show_bookmark_not_defined NOARGS
{
@@ -93,7 +96,7 @@ PUBLIC char * get_bookmark_filename ARGS1(
BookmarkPage);
CTRACE(tfp, "\nget_bookmark_filename: SEEKING %s\n AS %s\n\n",
BookmarkPage, filename_buffer);
- if ((fp = fopen(filename_buffer,"r")) != NULL) {
+ if ((fp = fopen(filename_buffer, TXT_R)) != NULL) {
goto success;
}
@@ -147,7 +150,7 @@ PRIVATE char * convert_mosaic_bookmark_file ARGS1(
return ("");
}
- if ((fp = fopen(filename_buffer, "r")) == NULL)
+ if ((fp = fopen(filename_buffer, TXT_R)) == NULL)
return (""); /* should always open */
fprintf(nfp,"<head>\n<title>%s</title>\n</head>\n",MOSAIC_BOOKMARK_TITLE);
@@ -162,6 +165,11 @@ PRIVATE char * convert_mosaic_bookmark_file ARGS1(
endline = &buf[strlen(buf)-1];
if(*endline == '\n')
*endline = '\0';
+#ifdef DOSPATH /* 1998/01/10 (Sat) 15:41:35 */
+ endline = strchr(buf, '\r');
+ if (endline == NULL)
+ *endline = '\0';
+#endif
if((line % 2) == 0) { /* even lines */
if(*buf != '\0') {
strtok(buf," "); /* kill everything after the space */
@@ -200,6 +208,7 @@ PUBLIC void save_bookmark_link ARGS2(
char *bookmark_URL = NULL;
char filename_buffer[LY_MAXPATH];
char string_buffer[BUFSIZ];
+ char tmp_buffer[BUFSIZ];
char *Address = NULL;
char *Title = NULL;
int i, c;
@@ -269,7 +278,21 @@ PUBLIC void save_bookmark_link ARGS2(
* Allow user to change the title. - FM
*/
do {
- LYstrncpy(string_buffer, title, sizeof(string_buffer)-1);
+ if (HTCJK == JAPANESE) {
+ switch(kanji_code) {
+ case EUC:
+ TO_EUC(title, tmp_buffer);
+ break;
+ case SJIS:
+ TO_SJIS(title, tmp_buffer);
+ break;
+ default:
+ break;
+ }
+ LYstrncpy(string_buffer, tmp_buffer, sizeof(string_buffer)-1);
+ } else {
+ LYstrncpy(string_buffer, title, sizeof(string_buffer)-1);
+ }
convert_to_spaces(string_buffer, FALSE);
LYMBM_statusline(TITLE_PROMPT);
LYgetstr(string_buffer, VISIBLE, sizeof(string_buffer), NORECALL);
@@ -290,7 +313,22 @@ PUBLIC void save_bookmark_link ARGS2(
* from display character set which may need changing.
* Do NOT convert any 8-bit chars if we have CJK display. - LP
*/
- StrAllocCopy(Title, string_buffer);
+ if (HTCJK == JAPANESE) {
+ switch(kanji_code) { /* 1997/11/22 (Sat) 09:28:00 */
+ case EUC:
+ TO_EUC(string_buffer, tmp_buffer);
+ break;
+ case SJIS:
+ TO_SJIS(string_buffer, tmp_buffer);
+ break;
+ default:
+ TO_JIS(string_buffer, tmp_buffer);
+ break;
+ }
+ StrAllocCopy(Title, tmp_buffer);
+ } else {
+ StrAllocCopy(Title, string_buffer);
+ }
LYEntify(&Title, TRUE);
if (UCSaveBookmarksInUnicode &&
have8bit(Title) && (!LYHaveCJKCharacterSet)) {
@@ -334,8 +372,21 @@ PUBLIC void save_bookmark_link ARGS2(
*/
if (first_time) {
fprintf(fp,"<head>\n");
+#if defined(SH_EX) && !defined(_WINDOWS) /* 1997/12/11 (Thu) 19:13:40 */
+ if (HTCJK != JAPANESE)
+ LYAddMETAcharsetToFD(fp, -1);
+ else
+ fprintf(fp, "<META %s %s>\n",
+ "http-equiv=\"content-type\"",
+ "conetnt=\"text/html;charset=iso-2022-jp\"");
+#else
LYAddMETAcharsetToFD(fp, -1);
+#endif /* !_WINDOWS */
fprintf(fp,"<title>%s</title>\n</head>\n", BOOKMARK_TITLE);
+#ifdef _WINDOWS
+ fprintf(fp,
+ gettext(" You can delete links by the 'R' key<br>\n<ol>\n"));
+#else
fprintf(fp, "%s<br>\n%s\n\n<!--\n%s\n-->\n\n<p>\n<ol>",
gettext("\
You can delete links using the remove bookmark command. It is usually\n\
@@ -349,6 +400,7 @@ Note: if you edit this file manually\n\
you should not change the format within the lines\n\
or add other HTML markup.\n\
Make sure any bookmark link is saved as a single line."));
+#endif /* _WINDOWS */
}
/*
@@ -423,8 +475,10 @@ PUBLIC void remove_bookmark_link ARGS2(
#else
char filename_buffer[LY_MAXPATH];
char newfile[LY_MAXPATH];
+#ifdef UNIX
struct stat stat_buf;
mode_t mode;
+#endif /* UNIX */
#endif /* VMS */
char homepath[LY_MAXPATH];
@@ -437,7 +491,7 @@ PUBLIC void remove_bookmark_link ARGS2(
cur_bookmark_page);
CTRACE(tfp, "\nremove_bookmark_link: SEEKING %s\n AS %s\n\n",
cur_bookmark_page, filename_buffer);
- if ((fp = fopen(filename_buffer, "r")) == NULL) {
+ if ((fp = fopen(filename_buffer, TXT_R)) == NULL) {
HTAlert(BOOKMARK_OPEN_FAILED_FOR_DEL);
return;
}
@@ -535,12 +589,20 @@ PUBLIC void remove_bookmark_link ARGS2(
* Check if this is the case and do something appropriate.
* Used to be ODD_RENAME
*/
-#ifdef _WINDOWS
+#if defined(_WINDOWS) || defined(WIN_EX)
+#if defined(WIN_EX)
+ if (GetLastError() == ERROR_NOT_SAME_DEVICE)
+#else /* !_WIN_CC */
if (errno == ENOTSAM)
-#else
- if (errno == EXDEV)
-#endif /* WINDOWS */
+#endif /* _WIN_CC */
{
+ if (rename(newfile, filename_buffer) != 0) {
+ if (LYCopyFile(newfile, filename_buffer) == 0)
+ remove(newfile);
+ }
+ }
+#else
+ if (errno == EXDEV) {
static CONST char MV_FMT[] = "%s %s %s";
char *buffer = 0;
HTAddParam(&buffer, MV_FMT, 1, MV_PATH);
@@ -551,6 +613,7 @@ PUBLIC void remove_bookmark_link ARGS2(
FREE(buffer);
return;
}
+#endif /* _WINDOWS */
#endif /* !VMS */
#ifdef VMS
diff --git a/src/LYCgi.c b/src/LYCgi.c
index 9e0bfce0..375206a6 100644
--- a/src/LYCgi.c
+++ b/src/LYCgi.c
@@ -238,8 +238,15 @@ PRIVATE int LYLoadCGI ARGS4(
PERROR("stat() failed");
status = -4;
- } else if (!(S_ISREG(stat_buf.st_mode) &&
- stat_buf.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH))) {
+ } else
+#ifdef _WINDOWS /* 1998/01/14 (Wed) 09:16:04 */
+ if (!(S_ISREG(stat_buf.st_mode) &&
+ stat_buf.st_mode & (S_IXUSR)))
+#else
+ if (!(S_ISREG(stat_buf.st_mode) &&
+ stat_buf.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)))
+#endif
+ {
/*
* Not a runnable file, See if we can load it using "file:" code.
*/
diff --git a/src/LYCharSets.c b/src/LYCharSets.c
index 8890f9df..5924a4f8 100644
--- a/src/LYCharSets.c
+++ b/src/LYCharSets.c
@@ -484,7 +484,7 @@ PUBLIC void HTMLSetCharacterHandling ARGS1(int,i)
}
#endif /* USE_SLANG */
- ena_csi((LYlowest_eightbit[current_char_set] > 155));
+ ena_csi((BOOLEAN)(LYlowest_eightbit[current_char_set] > 155));
/* some diagnostics */
if (TRACE) {
diff --git a/src/LYCharSets.h b/src/LYCharSets.h
index 1f21db0f..ea132684 100644
--- a/src/LYCharSets.h
+++ b/src/LYCharSets.h
@@ -14,6 +14,9 @@
extern BOOLEAN LYHaveCJKCharacterSet;
extern BOOLEAN DisplayCharsetMatchLocale;
+#include <HTCJK.h>
+extern HTkcode kanji_code;
+
/*
* currently active character set (internal handler)
*/
diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c
index 5e15c2a2..aef1862e 100644
--- a/src/LYCharUtils.c
+++ b/src/LYCharUtils.c
@@ -43,7 +43,6 @@ extern BOOL HTPassEightBitRaw;
extern BOOL HTPassEightBitNum;
extern BOOL HTPassHighCtrlRaw;
extern BOOL HTPassHighCtrlNum;
-extern HTkcode kanji_code;
extern HTCJKlang HTCJK;
/*
@@ -65,6 +64,12 @@ PUBLIC void LYEntify ARGS2(
char *p = *str;
char *q = NULL, *cp = NULL;
int amps = 0, lts = 0, gts = 0;
+#ifdef CJK_EX
+ enum _state
+ { S_text, S_esc, S_dollar, S_paren,
+ S_nonascii_text, S_dollar_paren } state = S_text;
+ int in_sjis = 0;
+#endif
if (p == NULL || *p == '\0')
return;
@@ -113,6 +118,88 @@ PUBLIC void LYEntify ARGS2(
if ((cp = q) == NULL)
outofmem(__FILE__, "LYEntify");
for (p = *str; *p; p++) {
+#ifdef CJK_EX
+ if (HTCJK != NOCJK) {
+ switch(state) {
+ case S_text:
+ if (*p == '\033') {
+ state = S_esc;
+ *q++ = *p;
+ continue;
+ }
+ break;
+
+ case S_esc:
+ if (*p == '$') {
+ state = S_dollar;
+ *q++ = *p;
+ continue;
+ } else if (*p == '(') {
+ state = S_paren;
+ *q++ = *p;
+ continue;
+ } else {
+ state = S_text;
+ *q++ = *p;
+ continue;
+ }
+
+ case S_dollar:
+ if (*p == '@' || *p == 'B' || *p == 'A') {
+ state = S_nonascii_text;
+ *q++ = *p;
+ continue;
+ } else if (*p == '(') {
+ state = S_dollar_paren;
+ *q++ = *p;
+ continue;
+ } else {
+ state = S_text;
+ *q++ = *p;
+ continue;
+ }
+
+ case S_dollar_paren:
+ if (*p == 'C') {
+ state = S_nonascii_text;
+ *q++ = *p;
+ continue;
+ } else {
+ state = S_text;
+ *q++ = *p;
+ continue;
+ }
+
+ case S_paren:
+ if (*p == 'B' || *p == 'J' || *p =='T') {
+ state = S_text;
+ *q++ = *p;
+ continue;
+ } else if (*p == 'I') {
+ state = S_nonascii_text;
+ *q++ = *p;
+ continue;
+ }
+
+ case S_nonascii_text:
+ if (*p == '\033')
+ state = S_esc;
+ *q++ = *p;
+ continue;
+
+ default:
+ break;
+ }
+ if (*(p+1) != '\0' &&
+ (IS_EUC((unsigned char)*p, (unsigned char)*(p+1)) ||
+ IS_SJIS((unsigned char)*p, (unsigned char)*(p+1), in_sjis) ||
+ IS_BIG5((unsigned char)*p, (unsigned char)*(p+1)))) {
+ *q++ = *p++;
+ *q++ = *p;
+ continue;
+ }
+ }
+#endif
if (*p == '&') {
*q++ = '&';
*q++ = 'a';
@@ -133,6 +220,7 @@ PUBLIC void LYEntify ARGS2(
*q++ = *p;
}
}
+ *q = '\0';
FREE(*str);
*str = cp;
}
@@ -1632,6 +1720,10 @@ PRIVATE char ** LYUCFullyTranslateString_1 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 */
+ static unsigned char sjis_1st = '\0';
+ unsigned char sjis_str[3];
+#endif
/*
** Make sure we have a non-empty string. - FM
@@ -1732,6 +1824,24 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9(
switch(state) {
case S_text:
code = (unsigned char)(*p);
+#ifdef CJK_EX /* 1997/12/13 (Sat) 14:41:53 */
+ 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 {
+ if (0xA1 <= code && code <= 0xDF) {
+ sjis_str[2] = '\0';
+ JISx0201TO0208_SJIS((unsigned char)code,
+ sjis_str, sjis_str + 1);
+ REPLACE_STRING(sjis_str);
+ p++;
+ continue;
+ }
+ }
+ }
+#endif
if (*p == '\033') {
if ((HTCJK != NOCJK && !hidden) || stype != st_HTML) {
state = S_esc;
@@ -1850,7 +1960,7 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9(
state = S_got_outchar;
break;
} else {
- *p = 160;
+ *(unsigned char *)p = (unsigned char)160;
code = 160;
if (LYCharSet_UC[cs_to].enc == UCT_ENC_8859 ||
(LYCharSet_UC[cs_to].like8859 & UCT_R_8859SPECL)) {
@@ -1859,7 +1969,7 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9(
}
}
} else if ((*p) == LY_SOFT_HYPHEN) {
- *p = 173;
+ *(unsigned char *)p = (unsigned char)173;
code = 173;
if (LYCharSet_UC[cs_to].enc == UCT_ENC_8859 ||
(LYCharSet_UC[cs_to].like8859 & UCT_R_8859SPECL)) {
diff --git a/src/LYCookie.c b/src/LYCookie.c
index e93b27f2..a3640e32 100644
--- a/src/LYCookie.c
+++ b/src/LYCookie.c
@@ -2028,7 +2028,11 @@ PUBLIC void LYLoadCookies ARGS1 (
};
time_t expires;
+#ifdef DOSPATH /* 1998/12/19 (Sat) 08:10:57 */
+ cookie_handle = fopen(cookie_file, "rt+");
+#else
cookie_handle = fopen(cookie_file, "r+");
+#endif
if (!cookie_handle)
return;
diff --git a/src/LYCurses.c b/src/LYCurses.c
index 666d96b6..679c2f99 100644
--- a/src/LYCurses.c
+++ b/src/LYCurses.c
@@ -198,7 +198,7 @@ PUBLIC void VMSbox ARGS3(
wmove(win, 0, 0);
waddstr(win, "\033)0\016l");
for (i = 1; i < width; i++)
- waddch(win, 'q');
+ waddch(win, 'q');
waddch(win, 'k');
for (i = 1; i < height-1; i++) {
wmove(win, i, 0);
@@ -209,7 +209,7 @@ PUBLIC void VMSbox ARGS3(
wmove(win, i, 0);
waddch(win, 'm');
for (i = 1; i < width; i++)
- waddch(win, 'q');
+ waddch(win, 'q');
waddstr(win, "j\017");
}
#else
@@ -328,8 +328,8 @@ PUBLIC void curses_w_style ARGS3(
#if !OMIT_SCN_KEEPING
bucket* ds= (style == NOSTYLE ? &nostyle_bucket : &hashStyles[style]);
#else
- bucket* ds= (style == NOSTYLE ? &nostyle_bucket :
- (style== SPECIAL_STYLE ? &special_bucket :&hashStyles[style]) );
+ bucket* ds= (style == NOSTYLE ? &nostyle_bucket :
+ (style== SPECIAL_STYLE ? &special_bucket :&hashStyles[style]) );
#endif
@@ -375,12 +375,12 @@ PUBLIC void curses_w_style ARGS3(
last_styles[last_colorattr_ptr++] = getattrs(stdscr);
/* don't cache style changes for active links */
#if OMIT_SCN_KEEPING
- /* since we don't compute the hcode
- to stack off in HTML.c, we don't know whether this style is
- configured. So, we shouldn't simply return on stacking on on
- unconfigured styles, we should push curr attrs on stack. -HV
- */
- if (!ds->name) return;
+ /* since we don't compute the hcode to stack off in HTML.c, we
+ * don't know whether this style is configured. So, we
+ * shouldn't simply return on stacking on on unconfigured
+ * styles, we should push curr attrs on stack. -HV
+ */
+ if (!ds->name) return;
#endif
if (style != s_alink)
{
@@ -397,7 +397,7 @@ PUBLIC void curses_w_style ARGS3(
CTRACE(tfp, "CACHED: <%s> @(%d,%d)\n", ds->name, YP, XP);
if (win==stdscr) cached_styles[YP][XP]=style;
}
- LYAttrset(win, ds->color, ds->mono);
+ LYAttrset(win, ds->color, ds->mono);
return;
}
}
@@ -490,7 +490,7 @@ PRIVATE void LYsetWAttr ARGS1(WINDOW *, win)
int offs = 1;
static int NoColorVideo = -1;
-#ifdef UNIX
+#if defined(UNIX) && !defined(PDCURSES)
if (NoColorVideo < 0) {
NoColorVideo = tigetnum("ncv");
}
@@ -545,9 +545,9 @@ PRIVATE void lynx_map_color ARGS1(int, n)
for (m = 0; m <= 16; m += 8) {
int pair = n + m + 1;
if (pair < COLOR_PAIRS)
- init_pair(pair,
- lynx_color_pairs[pair].fg,
- lynx_color_pairs[pair].bg);
+ init_pair((short)pair,
+ (short)lynx_color_pairs[pair].fg,
+ (short)lynx_color_pairs[pair].bg);
}
if (n == 0 && LYShowColor >= SHOW_COLOR_ON)
bkgd(COLOR_BKGD | ' ');
@@ -602,9 +602,9 @@ PRIVATE void lynx_init_colors NOARGS
for (m = 0; m <= 16; m += 8) {
int pair = n + m + 1;
if (pair < COLOR_PAIRS)
- init_pair(pair,
- lynx_color_pairs[pair].fg,
- lynx_color_pairs[pair].bg);
+ init_pair((short)pair,
+ (short)lynx_color_pairs[pair].fg,
+ (short)lynx_color_pairs[pair].bg);
}
if (n == 0 && LYShowColor >= SHOW_COLOR_ON)
bkgd(COLOR_BKGD | ' ');
@@ -653,9 +653,9 @@ PUBLIC void start_curses NOARGS
if (LYUseMouse)
lynx_enable_mouse (1);
- } else
+ } else {
sock_init();
-
+ }
LYCursesON = TRUE;
CTRACE(tfp, "start_curses: done.\n");
clear();
@@ -677,7 +677,9 @@ PUBLIC void start_curses NOARGS
}
if (slinit == 0) {
+#if !defined(USE_KEYMAPS)
SLtt_get_terminfo();
+#endif
#if defined(__DJGPP__) && !defined(DJGPP_KEYHANDLER)
SLkp_init ();
#endif /* __DJGPP__ && !DJGPP_KEYHANDLER */
@@ -737,7 +739,11 @@ PUBLIC void start_curses NOARGS
#endif /* VMS || UNIX */
}
#ifdef __DJGPP__
+#ifdef WATT32
+ _eth_init();
+#else
else sock_init();
+#endif /* WATT32 */
#endif /* __DJGPP__ */
slinit = 1;
@@ -825,7 +831,7 @@ PUBLIC void start_curses NOARGS
if (has_colors()) {
lynx_has_color = TRUE;
start_color();
-#if HAVE_USE_DEFAULT_COLORS
+#if HAVE_USE_DEFAULT_COLORS && !defined(PDCURSES)
if (use_default_colors() == OK) {
default_fg = DEFAULT_COLOR;
default_bg = DEFAULT_COLOR;
@@ -875,19 +881,19 @@ PUBLIC void start_curses NOARGS
fflush(stderr);
#endif /* USE_SLANG */
-#ifdef _WINDOWS
+#if defined(WIN_EX)
clear();
#endif
LYCursesON = TRUE;
CTRACE(tfp, "start_curses: done.\n");
-}
+} /* end of start_curses() */
PUBLIC void lynx_enable_mouse ARGS1(int,state)
{
-#ifdef __BORLANDC__
+#if defined(WIN_EX)
/* modify lynx_enable_mouse() for pdcurses configuration so that mouse support
is disabled unless -use_mouse is specified. This is ifdef'd with
__BORLANDC__ for the time being (WB).
@@ -911,7 +917,7 @@ PUBLIC void lynx_enable_mouse ARGS1(int,state)
#else
#ifdef NCURSES_MOUSE_VERSION
-#if defined(__BORLANDC__) && defined(__PDCURSES__)
+#if defined(WIN_EX) && defined(PDCURSES)
if (state)
{
SetConsoleMode(hConIn, ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT);
@@ -945,23 +951,27 @@ PUBLIC void lynx_enable_mouse ARGS1(int,state)
NULL);
} else
mousemask(0, NULL);
-#endif /* __BORLANDC__ and __PDCURSES__ */
+#endif /* _WIN_CC and PDCURSES */
#endif /* NCURSES_MOUSE_VERSION */
#if defined(DJGPP) && !defined(USE_SLANG)
if (state)
mouse_set(BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED);
#endif
-#endif /* NOT USE_SLANG_MOUSE */
+#endif /* NOT USE_SLANG_MOUSE */
}
PUBLIC void stop_curses NOARGS
{
echo();
-#ifdef DJGPP
+#ifdef __DJGPP__
+#ifdef WATT32
+ _eth_release();
+#else
sock_exit();
-#endif
-#if defined (DOSPATH) && !defined(USE_SLANG)
+#endif /* WATT32 */
+#endif /* __DJGPP__ */
+#if defined(DOSPATH) && !(defined(USE_SLANG) || _WIN_CC)
clrscr();
#else
@@ -971,8 +981,18 @@ PUBLIC void stop_curses NOARGS
*/
if(LYCursesON == TRUE) {
lynx_enable_mouse (0);
+#ifndef WIN_EX /* @@@ */
endwin(); /* stop curses */
+#endif
+ }
+#ifdef SH_EX
+ {
+ int i;
+ for (i=0; i <= 3; i++) {
+ fprintf(stdout, "\r\n");
+ }
}
+#endif
fflush(stdout);
#endif /* DJGPP */
@@ -1177,6 +1197,14 @@ PUBLIC BOOLEAN setup ARGS1(
LYlines = LINES;
LYcols = COLS;
#endif /* HAVE_SIZECHANGE && !USE_SLANG && USE_NOTDEFINED */
+#if defined(WIN_EX) && defined(NOTDEFINED)
+ {
+ extern int current_codepage; /* PDCurses lib. */
+
+ if (current_codepage == 932)
+ LYcols = COLS - 1;
+ }
+#endif
if (LYlines <= 0)
LYlines = 24;
if (LYcols <= 0)
@@ -1765,10 +1793,16 @@ PUBLIC void lynx_force_repaint NOARGS
PUBLIC void lynx_start_title_color NOARGS
{
+#ifdef SH_EX
+ start_reverse();
+#endif
}
PUBLIC void lynx_stop_title_color NOARGS
{
+#ifdef SH_EX
+ stop_reverse();
+#endif
}
PUBLIC void lynx_start_link_color ARGS2(
diff --git a/src/LYCurses.h b/src/LYCurses.h
index 51c116e1..3b252afa 100644
--- a/src/LYCurses.h
+++ b/src/LYCurses.h
@@ -71,6 +71,10 @@
#undef PENDIN
#endif
+#if defined(_MSC_VER)
+#undef MOUSE_MOVED /* conflict between PDCURSES and _WIN32 */
+#endif /* _MSC_VER */
+
#ifdef HAVE_CONFIG_H
# ifdef HAVE_NCURSES_H
# include <ncurses.h>
@@ -81,7 +85,11 @@
# ifdef HAVE_JCURSES_H
# include <jcurses.h> /* sony_news */
# else
-# include <curses.h> /* default */
+# ifdef PDCURSES
+# include <pdcurses.h> /* for PDCurses */
+# else
+# include <curses.h> /* default */
+# endif
# endif
# endif
# endif
@@ -315,8 +323,13 @@ extern int lynx_chg_color PARAMS((int, int, int));
#ifdef UNDERLINE_LINKS
#define start_bold() LYaddAttr(A_UNDERLINE)
#define stop_bold() LYsubAttr(A_UNDERLINE)
+#ifdef __CYGWIN__ /* 1999/02/25 (Thu) 01:09:45 */
+#define start_underline() /* LYaddAttr(A_BOLD) */
+#define stop_underline() /* LYsubAttr(A_BOLD) */
+#else
#define start_underline() LYaddAttr(A_BOLD)
#define stop_underline() LYsubAttr(A_BOLD)
+#endif /* __CYGWIN__ */
#else /* not UNDERLINE_LINKS: */
#define start_bold() LYaddAttr(A_BOLD)
#define stop_bold() LYsubAttr(A_BOLD)
@@ -327,6 +340,7 @@ extern int lynx_chg_color PARAMS((int, int, int));
#endif /* USE_COLOR_STYLE */
#define stop_underline() LYsubAttr(A_UNDERLINE)
#endif /* UNDERLINE_LINKS */
+
#if defined(SNAKE) && defined(HP_TERMINAL)
#define start_reverse() LYaddWAttr(stdscr, A_DIM)
#define wstart_reverse(a) LYaddWAttr(a, A_DIM)
@@ -338,6 +352,7 @@ extern int lynx_chg_color PARAMS((int, int, int));
#define stop_reverse() LYsubAttr(A_REVERSE)
#define wstop_reverse(a) LYsubWAttr(a, A_REVERSE)
#endif /* SNAKE && HP_TERMINAL */
+
#endif /* VMS */
#else /* Not FANCY_CURSES: */
@@ -403,7 +418,7 @@ extern void lynx_stop_all_colors NOPARAMS;
* Note: EMX has no corresponding variable like _fmode on DOS, but it does
* have setmode.
*/
-#if defined(_WINDOWS) || defined(DJGPP) || defined(__EMX__)
+#if defined(_WINDOWS) || defined(DJGPP) || defined(__EMX__) || defined(WIN_EX)
#define SetOutputMode(mode) setmode(fileno(stdout), mode)
#else
#define SetOutputMode(mode) /* nothing */
diff --git a/src/LYDownload.c b/src/LYDownload.c
index 5b079b32..78b1a4cb 100644
--- a/src/LYDownload.c
+++ b/src/LYDownload.c
@@ -88,7 +88,7 @@ PUBLIC void LYDownload ARGS1(
goto failed;
}
-#ifdef DIRED_SUPPORT
+#if defined(DIRED_SUPPORT)
/* FIXME: use HTLocalName */
if (!strncmp(file, "file://localhost", 16))
#ifdef __DJGPP__
@@ -102,6 +102,14 @@ PUBLIC void LYDownload ARGS1(
else if (!strncmp(file, "file:", 5))
file += 5;
HTUnEscape(file);
+#else
+#if defined(_WINDOWS) /* 1997/10/15 (Wed) 16:27:38 */
+ if (!strncmp(file, "file://localhost/", 17))
+ file += 17;
+ else if (!strncmp(file, "file:/", 6))
+ file += 6;
+ HTUnEscape(file);
+#endif /* _WINDOWS */
#endif /* DIRED_SUPPORT */
if ((method = (char *)strstr(Line, "Method=")) == NULL)
@@ -403,7 +411,11 @@ check_recall:
if (!strncasecomp(buffer, "nl:", 3) ||
!strncasecomp(buffer, "/nl/", 4))
#else
+#if defined(DOSPATH) /* 1997/10/15 (Wed) 16:41:30 */
+ if (!strcmp(buffer, "nul"))
+#else
if (!strcmp(buffer, "/dev/null"))
+#endif /* DOSPATH */
#endif /* VMS */
{
goto cancelled;
@@ -490,10 +502,10 @@ PUBLIC int LYdownload_options ARGS2(
change_sug_filename(sug_filename);
if (LYReuseTempfiles) {
- fp0 = LYOpenTempRewrite(tempfile, HTML_SUFFIX, "w");
+ fp0 = LYOpenTempRewrite(tempfile, HTML_SUFFIX, "wb");
} else {
LYRemoveTemp(tempfile);
- fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w");
+ fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "wb");
}
if (fp0 == NULL) {
HTAlert(CANNOT_OPEN_TEMP);
@@ -526,7 +538,7 @@ PUBLIC int LYdownload_options ARGS2(
: gettext("Download options:"));
if (!no_disk_save && !child_lynx) {
-#ifdef DIRED_SUPPORT
+#if defined(DIRED_SUPPORT)
/*
* Disable save to disk option for local files.
*/
diff --git a/src/LYEdit.c b/src/LYEdit.c
index 8e2ab7a9..65d7c495 100644
--- a/src/LYEdit.c
+++ b/src/LYEdit.c
@@ -45,6 +45,9 @@ PUBLIC int edit_current_file ARGS3(
char *colon, *number_sign;
char position[80];
FILE *fp;
+#ifdef __CYGWIN__
+ unsigned char temp_buff[LY_MAXPATH];
+#endif
/*
* If its a remote file then we can't edit it.
@@ -67,25 +70,41 @@ PUBLIC int edit_current_file ARGS3(
*
* On VMS, only try the path.
*/
-#if !defined (VMS) && !defined (DOSPATH) && !defined (__EMX__)
+#if defined (VMS) || defined (DOSPATH) || defined (__EMX__)
+ filename = HTParse(newfile, "", PARSE_PATH+PARSE_PUNCTUATION);
+ HTUnEscape(filename);
+ StrAllocCopy(filename, HTSYS_name(filename));
+ if ((fp = fopen(filename, "r")) == NULL)
+ {
+#ifdef SH_EX
+ HTUserMsg2(COULD_NOT_EDIT_FILE, filename);
+#else
+ HTAlert(COULD_NOT_ACCESS_FILE);
+#endif
+ CTRACE(tfp, "filename: '%s'\n", filename);
+ goto done;
+ }
+#else /* !(VMS || !DOSPATH || !__EMX__) == UNIX */
+#ifdef SH_EX /* Speed Up! */
+ if (strncmp(newfile, "file://localhost/", 16) == 0)
+ colon = newfile + 16;
+ else
+ colon = strchr(newfile, ':');
+#else
colon = strchr(newfile, ':');
+#endif
StrAllocCopy(filename, (colon + 1));
HTUnEscape(filename);
if ((fp = fopen(filename, "r")) == NULL) {
FREE(filename);
-#endif /* !VMS */
filename = HTParse(newfile, "", PARSE_PATH+PARSE_PUNCTUATION);
HTUnEscape(filename);
- StrAllocCopy(filename, HTSYS_name(filename));
- if ((fp = fopen(filename, "r")) == NULL)
- {
+ if ((fp = fopen(HTSYS_name(filename), "r")) == NULL) {
HTAlert(COULD_NOT_ACCESS_FILE);
- CTRACE(tfp, "filename: '%s'\n", filename);
goto done;
}
-#if !defined (VMS) && !defined (DOSPATH) && !defined (__EMX__)
}
-#endif /* !VMS */
+#endif /* !(VMS || !DOSPATH || !__EMX__) */
fclose(fp);
#if defined(VMS) || defined(CANT_EDIT_UNWRITABLE_FILES)
@@ -132,8 +151,40 @@ PUBLIC int edit_current_file ARGS3(
HTAddParam(&command, format, params++, filename);
HTEndParam(&command, format, params);
#endif
- } else {
+ }
+#ifdef DOSPATH
+ else if (strncmp(editor, "VZ", 2)==0) {
+ /* 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 */
+ HTAddXpand(&command, format, params++, editor);
+ HTAddParam(&command, format, params++, HTDOS_short_name(filename));
+ HTEndParam(&command, format, params);
+ }
+#endif
+ else {
+#ifdef _WINDOWS
+ if (strchr(editor, ' '))
+ HTAddXpand(&command, format, params++, HTDOS_short_name(editor));
+ else
+ HTAddXpand(&command, format, params++, editor);
+#else
+#if defined(__CYGWIN__) && defined(DOSPATH)
+ if (strchr(editor, ' ')) {
+ cygwin_conv_to_full_posix_path(HTDOS_short_name(editor), temp_buff);
+ HTAddXpand(&command, format, params++, temp_buff);
+ } else {
+ HTAddXpand(&command, format, params++, editor);
+ }
+#else
HTAddXpand(&command, format, params++, editor);
+#endif /* __CYGWIN__ */
+#endif
HTAddParam(&command, format, params++, filename);
HTEndParam(&command, format, params);
}
diff --git a/src/LYEditmap.c b/src/LYEditmap.c
index 8a947ac4..504f9bf7 100644
--- a/src/LYEditmap.c
+++ b/src/LYEditmap.c
@@ -47,7 +47,11 @@ LYE_NOP, LYE_ENTER, LYE_FORWW, LYE_ABORT,
LYE_BACKW, LYE_NOP, LYE_DELN, LYE_NOP,
/* ^P XON ^R XOFF */
+#ifdef WIN_EX
+LYE_UPPER, LYE_ERASE, LYE_LKCMD, LYE_PASTE,
+#else
LYE_UPPER, LYE_ERASE, LYE_LKCMD, LYE_NOP,
+#endif
/* ^T ^U ^V ^W */
LYE_ERASE, LYE_NOP, LYE_NOP, LYE_NOP,
@@ -88,8 +92,12 @@ LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR,
LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR,
LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR,
LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR,
+#ifdef CJK_EX /* 1997/11/03 (Mon) 20:30:54 */
+LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR,
+#else
LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_AIX,
/* 97 AIX */
+#endif
LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR,
LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR,
@@ -276,7 +284,7 @@ LYE_NOP, LYE_BOL, LYE_BACK, LYE_ABORT,
LYE_DELN, LYE_EOL, LYE_FORW, LYE_ABORT,
/* ^D ^E ^F ^G */
-LYE_DELP, LYE_ENTER, LYE_ENTER, LYE_DELEL,
+LYE_DELP, LYE_ENTER, LYE_ENTER, LYE_DELNW, /* LYE_DELEL,*/
/* bs tab nl ^K */
LYE_NOP, LYE_ENTER, LYE_FORWW, LYE_ABORT,
@@ -285,7 +293,11 @@ LYE_NOP, LYE_ENTER, LYE_FORWW, LYE_ABORT,
LYE_BACKW, LYE_NOP, LYE_DELPW, LYE_NOP,
/* ^P XON ^R XOFF */
+#ifdef WIN_EX
+LYE_DELNW, LYE_ERASE, LYE_LKCMD, LYE_PASTE,
+#else
LYE_DELNW, LYE_ERASE, LYE_LKCMD, LYE_NOP,
+#endif
/* ^T ^U ^V ^W */
LYE_DELBL, LYE_NOP, LYE_NOP, LYE_NOP,
@@ -326,8 +338,12 @@ LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR,
LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR,
LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR,
LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR,
+#ifdef CJK_EX /* 1997/11/03 (Mon) 20:30:54 */
+LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR,
+#else
LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_AIX,
/* 97 AIX */
+#endif
LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR,
LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR,
diff --git a/src/LYExtern.c b/src/LYExtern.c
index 5fb37840..0f8a1c4f 100644
--- a/src/LYExtern.c
+++ b/src/LYExtern.c
@@ -25,7 +25,120 @@
#include <LYLeaks.h>
#include <LYCurses.h>
-void run_external ARGS1(char *, cmd)
+
+#ifdef WIN_EX
+/* 1997/10/15 (Wed) 17:39:50 */
+
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
+#define STRING_MAX 512
+
+/* ASCII char -> HEX digit */
+#define ASC2HEXD(x) (((x) >= '0' && (x) <= '9') ? \
+ ((x) - '0') : (toupper(x) - 'A' + 10))
+
+
+/* Decodes the forms %xy in a URL to the character the hexadecimal
+ code of which is xy. xy are hexadecimal digits from
+ [0123456789ABCDEF] (case-insensitive). If x or y are not hex-digits
+ or '%' is near '\0', the whole sequence is inserted literally. */
+
+
+static char *decode_string(char *s)
+{
+ char *save_s;
+ char *p = s;
+
+ save_s = s;
+ for (; *s; s++, p++) {
+ if (*s != '%')
+ *p = *s;
+ else {
+ /* Do nothing if at the end of the string. Or if the chars
+ are not hex-digits. */
+ if (!*(s + 1) || !*(s + 2)
+ || !(isxdigit(*(s + 1)) && isxdigit(*(s + 2)))) {
+ *p = *s;
+ continue;
+ }
+ *p = (ASC2HEXD(*(s + 1)) << 4) + ASC2HEXD(*(s + 2));
+ s += 2;
+ }
+ }
+ *p = '\0';
+ return save_s;
+}
+#endif /* WIN_EX */
+
+#ifndef STRING_MAX
+#define STRING_MAX 512
+#endif
+
+/* 1997/11/10 (Mon) 14:26:10 */
+PUBLIC char *string_short ARGS2(
+ char *, str,
+ int, cut_pos)
+{
+ char buff[STRING_MAX];
+ static char s_str[STRING_MAX];
+ char *p;
+ int len;
+
+ p = str;
+ len = strlen(p);
+
+ if (len > STRING_MAX) {
+ strncpy(buff, p, STRING_MAX - 1);
+ buff[STRING_MAX - 1] = '\0';
+ len = STRING_MAX - 1;
+ } else {
+ strcpy(buff, p);
+ }
+ if (len > (LYcols - 10)) {
+ buff[cut_pos] = '.';
+ buff[cut_pos + 1] = '.';
+ strcpy(buff + cut_pos + 2, (buff + len) - (LYcols - 10) + cut_pos + 1);
+ }
+ strcpy(s_str, buff);
+ return (s_str);
+}
+
+#ifdef WIN_EX
+/*
+ * Quote the path to make it safe for shell command processing.
+ *
+ * We use a simple technique which involves quoting the entire
+ * string using single quotes, escaping the real single quotes
+ * with double quotes. This may be gross but it seems to work.
+ */
+PUBLIC char * quote_pathname ARGS1(
+ char *, pathname)
+{
+ size_t n = 0;
+ char * result;
+
+ if (strchr(pathname, ' ') != NULL) {
+ n = strlen(pathname);
+ result = (char *)malloc(n + 3);
+ if (result == NULL)
+ outofmem(__FILE__, "quote_pathname");
+ result[0] = '"';
+ strcpy(result + 1, pathname);
+ result[n+1] = '"';
+ result[n+2] = '\0';
+ } else {
+ result = strdup(pathname);
+ if (result == NULL)
+ outofmem(__FILE__, "quote_pathname");
+ }
+ return result;
+}
+#endif /* WIN_EX */
+
+#if 0 /* old version */
+void run_external_ ARGS1(char *, cmd)
{
char *the_command = 0;
lynx_html_item_type *ext = 0;
@@ -56,4 +169,221 @@ void run_external ARGS1(char *, cmd)
return;
}
-#endif /* USE_EXTERNALS */
+#endif
+
+
+void run_external ARGS1(char *, c)
+{
+#ifdef WIN_EX
+ HANDLE handle;
+ int stat;
+ char pram_string[PATH_MAX];
+ int redraw_flag;
+ extern int xsystem(char *cmd);
+#endif
+ char command[1024];
+ lynx_html_item_type *externals2 = 0;
+
+ if (externals == NULL)
+ return;
+
+#ifdef WIN_EX /* 1998/01/26 (Mon) 09:16:13 */
+ if (c == NULL) {
+ HTInfoMsg("Not exist external command");
+ return;
+ }
+#endif
+
+ for (externals2 = externals; externals2 != NULL;
+ externals2 = externals2->next) {
+
+#ifdef WIN_EX
+ handle = GetForegroundWindow();
+ CTRACE(tfp, "EXTERNAL: '%s' <==> '%s'\n", externals2->name, c);
+#endif
+ if (externals2->command != 0
+ && !strncasecomp(externals2->name, c, strlen(externals2->name)))
+ {
+ char *cp;
+
+ if (no_externals && !externals2->always_enabled) {
+ HTUserMsg(EXTERNALS_DISABLED);
+ return;
+ }
+ /* Too dangerous to leave any URL that may come along unquoted.
+ * They often contain '&', ';', and '?' chars, and who knows
+ * what else may occur.
+ * Prevent spoofing of the shell.
+ * Dunno how this needs to be modified for VMS or DOS. - kw
+ */
+#if (defined(VMS) || defined(DOSPATH) || defined(__EMX__)) && !defined(WIN_EX)
+ sprintf(command, externals2->command, c);
+#else /* Unix or DOS/Win: */
+#if defined(WIN_EX)
+ if (*c != '\"' && strchr(c, ' ') != NULL) {
+ cp = quote_pathname(c);
+ sprintf(command, externals2->command, cp);
+ FREE(cp);
+ } else {
+ strcpy(pram_string, c);
+ decode_string(pram_string);
+ c = pram_string;
+
+ /* mailto: */
+ if (strnicmp("mailto:", c, 7) == 0) {
+ sprintf(command, externals2->command, c + 7);
+ }
+ /* telnet:// */
+ else if (strnicmp("telnet://", c, 9) == 0) {
+ char host[STRING_MAX];
+ int last_pos;
+
+ strcpy(host, c + 9);
+ last_pos = strlen(host) - 1;
+ if (last_pos > 1 && host[last_pos] == '/')
+ host[last_pos] = '\0';
+
+ sprintf(command, externals2->command, host);
+ }
+ /* file:// */
+ else if (strnicmp("file://localhost/", c, 17) == 0) {
+ extern char windows_drive[];
+ char e_buff[PATH_MAX], *p;
+
+ p = c + 17;
+ if (strchr(p, ':') == NULL) {
+ sprintf(e_buff, "%s/%s", windows_drive, p);
+ } else {
+ strcpy(e_buff, p);
+ }
+ p = strrchr(e_buff, '.');
+ if (p) {
+ p = strchr(p, '#');
+ if (p) {
+ *p = '\0';
+ }
+ }
+ if (*e_buff != '\"' && strchr(e_buff, ' ') != NULL) {
+ p = quote_pathname(e_buff);
+ strcpy(e_buff, p);
+ FREE(p);
+ }
+
+ /* Less ==> short filename,
+ * less ==> long filename
+ */
+ if (isupper(externals2->command[0])) {
+ sprintf(command,
+ externals2->command, HTDOS_short_name(e_buff));
+ } else {
+ sprintf(command, externals2->command, e_buff);
+ }
+ } else {
+ sprintf(command, externals2->command, c);
+ }
+ }
+#else /* Unix */
+ cp = HTQuoteParameter(c);
+ sprintf(command, externals2->command, cp);
+ FREE(cp);
+#endif
+#endif /* VMS */
+
+ if (*command != '\0') {
+#ifdef WIN_EX /* 1997/10/17 (Fri) 14:07:50 */
+ int len;
+ char buff[PATH_MAX];
+
+ CTRACE(tfp, "Lynx EXTERNAL: '%s'\n", command);
+#ifdef WIN_GUI /* 1997/11/06 (Thu) 14:17:15 */
+ stat = MessageBox(handle, command,
+ "Lynx (EXTERNAL COMMAND EXEC)",
+ MB_ICONQUESTION | MB_SETFOREGROUND | MB_OKCANCEL);
+ if (stat == IDCANCEL) {
+ return;
+ }
+#else
+ stat = HTConfirm(string_short(command, 40));
+ if (stat == NO) {
+ return;
+ }
+#endif
+
+ len = strlen(command);
+ if (len > 255) {
+ sprintf(buff, "Lynx: command line too long (%d > 255)", len);
+#ifdef WIN_GUI /* 1997/11/06 (Thu) 14:17:02 */
+ MessageBox(handle, buff,
+ "Lynx (EXTERNAL COMMAND EXEC)",
+ MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_OK);
+ SetConsoleTitle("Lynx for Win32");
+#else
+ stat = HTConfirm(string_short(buff, 40));
+#endif
+ return;
+ } else {
+ SetConsoleTitle(command);
+ }
+#endif
+
+#ifdef WIN_EX
+ if (strnicmp(command, "start ", 6) == 0)
+ redraw_flag = FALSE;
+ else
+ redraw_flag = TRUE;
+
+ if (redraw_flag) {
+ stop_curses();
+ fflush(stdout);
+ }
+#else
+ HTUserMsg(command);
+ stop_curses();
+#endif
+
+ /* command running. */
+#ifdef WIN_EX /* 1997/10/17 (Fri) 14:07:50 */
+#ifdef __CYGWIN__
+ stat = system(command);
+#else
+ stat = xsystem(command);
+#endif
+ if (stat != 0) {
+ sprintf(buff,
+ "EXEC code = %04x (%2d, %2d)\r\n"
+ "'%s'",
+ stat, (stat / 256), (stat & 0xff),
+ command);
+#ifdef SH_EX /* WIN_GUI for ERROR only */
+ MessageBox(handle, buff,
+ "Lynx (EXTERNAL COMMAND EXEC)",
+ MB_ICONSTOP | MB_SETFOREGROUND | MB_OK);
+#else
+ stat = HTConfirm(string_short(buff, 40));
+#endif /* 1 */
+ }
+#else /* Not WIN_EX */
+ LYSystem(command);
+#endif /* WIN_EX */
+
+#if defined(WIN_EX)
+ SetConsoleTitle("Lynx for Win32");
+#endif
+
+#ifdef WIN_EX
+ if (redraw_flag) {
+ fflush(stdout);
+ start_curses();
+ }
+#else
+ fflush(stdout);
+ start_curses();
+#endif
+ }
+ return;
+ } /* end if */
+ } /* end-for */
+
+ return;
+}
+#endif /* USE_EXTERNALS */
diff --git a/src/LYExtern.h b/src/LYExtern.h
index 094f4ddc..66b49b21 100644
--- a/src/LYExtern.h
+++ b/src/LYExtern.h
@@ -6,5 +6,6 @@
#endif /* LYSTRUCTS_H */
void run_external PARAMS((char * c));
+char *string_short PARAMS((char * str, int cut_pos));
#endif /* EXTERNALS_H */
diff --git a/src/LYForms.c b/src/LYForms.c
index 2f12576f..574a857a 100644
--- a/src/LYForms.c
+++ b/src/LYForms.c
@@ -130,8 +130,8 @@ PUBLIC int change_form_link ARGS7(
c = 23; /* CTRL-W refresh without clearok */
else
#endif /* FANCY_CURSES || USE_SLANG */
- c = 12; /* CTRL-L for repaint */
- break;
+ c = 12; /* CTRL-L for repaint */
+ break;
case F_RADIO_TYPE:
if (form->disabled == YES)
@@ -327,6 +327,9 @@ PRIVATE int form_getstr ARGS2(
BOOL HaveMaxlength = FALSE;
int action, repeat;
int last_xlkc = -1;
+#ifdef SUPPORT_MULTIBYTE_EDIT
+ BOOL refresh = TRUE;
+#endif
EditFieldData MyEdit;
BOOLEAN Edited = FALSE; /* Value might be updated? */
@@ -420,6 +423,16 @@ again:
get_mouse_link(); /* Reset mouse_link. */
ch = LYgetch_for(FOR_INPUT);
+#ifdef SUPPORT_MULTIBYTE_EDIT
+#ifdef WIN_EX
+ if (!refresh && (EditBinding(ch) != LYE_CHAR))
+ goto again;
+#else
+ if (!refresh &&
+ (EditBinding(ch) != LYE_CHAR) && (EditBinding(ch) != LYE_AIX))
+ goto again;
+#endif
+#endif /* SUPPORT_MULTIBYTE_EDIT */
#ifdef VMS
if (HadVMSInterrupt) {
HadVMSInterrupt = FALSE;
@@ -427,9 +440,23 @@ again:
}
#endif /* VMS */
# ifdef NCURSES_MOUSE_VERSION
- if (ch != -1 && (ch&LKC_ISLAC)) /* already lynxactioncode? */
+ if (ch != -1 && (ch & LKC_ISLAC)) /* already lynxactioncode? */
break; /* @@@ maybe move these 2 lines outside ifdef -kw */
if (ch == MOUSE_KEY) { /* Need to process ourselves */
+#if defined(WIN_EX)
+ int curx, cury;
+
+ request_mouse_pos();
+ LYGetYX(cury, curx);
+ if (MOUSE_Y_POS == cury) {
+ repeat = MOUSE_X_POS - curx;
+ if (repeat < 0) {
+ ch = LTARROW;
+ repeat = - repeat;
+ } else
+ ch = RTARROW;
+ }
+#else
MEVENT event;
int curx, cury;
@@ -442,7 +469,9 @@ again:
repeat = - repeat;
} else
ch = RTARROW;
- } else {
+ }
+#endif /* WIN_EX */
+ else {
/* Mouse event passed to us as MOUSE_KEY, and apparently
* not on this field's line? Something is not as it
* should be...
@@ -466,6 +495,7 @@ again:
}
if (peek_mouse_link() != -1)
break;
+
action = EditBinding(ch);
if ((action & LYE_DF) && !(action & LYE_FORM_LAC)) {
last_xlkc = ch;
@@ -473,6 +503,7 @@ again:
} else {
last_xlkc = -1;
}
+
if (action == LYE_SETM1) {
/*
* Set flag for modifier 1.
@@ -510,9 +541,61 @@ again:
#endif /* VMS */
break;
}
+
+#if defined(WIN_EX) /* 1998/10/01 (Thu) 19:19:22 */
+
+#define FORM_PASTE_MAX 8192
+
+ if (action == LYE_PASTE) {
+ unsigned char buff[FORM_PASTE_MAX];
+ int i, len;
+
+ len = get_clip(buff, FORM_PASTE_MAX);
+
+ if (len > 0) {
+ i = 0;
+ while ((ch = buff[i]) != '\0') {
+
+ if (ch == '\r') {
+ i++;
+ continue;
+ }
+ if (ch == '\n') {
+ i++;
+ len = strlen(buff + i);
+ if (len > 0) {
+ put_clip(buff + i);
+ }
+ break;
+ }
+
+ LYLineEdit(&MyEdit, ch, TRUE);
+
+ if (MyEdit.strlen >= max_length) {
+ HaveMaxlength = TRUE;
+ } else if (HaveMaxlength &&
+ MyEdit.strlen < max_length) {
+ HaveMaxlength = FALSE;
+ _statusline(ENTER_TEXT_ARROWS_OR_TAB);
+ }
+ i++;
+ }
+ if (strcmp(value, MyEdit.buffer) != 0) {
+ Edited = TRUE;
+ }
+ LYRefreshEdit(&MyEdit);
+
+ } else {
+ HTInfoMsg("Clipboard empty or Not text data.");
+ return(DO_NOTHING);
+ }
+ break;
+ }
+#else
if (action == LYE_AIX &&
(HTCJK == NOCJK && LYlowest_eightbit[current_char_set] > 0x97))
break;
+#endif
if (action == LYE_TAB) {
ch = (int)('\t');
break;
@@ -522,6 +605,13 @@ again:
}
if (LKC_TO_LAC(keymap,ch) == LYK_REFRESH)
break;
+#ifdef SH_EX
+/* ASATAKU emacskey hack 1997/08/26 (Tue) 09:19:23 */
+ if (emacs_keys &&
+ (EditBinding(ch) == LYE_FORWW || EditBinding(ch) == LYE_BACKW))
+ goto breakfor;
+/* ASATAKU emacskey hack */
+#endif
switch (ch) {
#ifdef NOTDEFINED /* The first four are mapped to LYE_FORM_PASS now */
case DNARROW:
@@ -539,7 +629,7 @@ again:
* Left arrrow in column 0 deserves special treatment here,
* else you can get trapped in a form without submit button!
*/
- case LTARROW:
+ case LTARROW: /* 1999/04/14 (Wed) 15:01:33 */
if (MyEdit.pos == 0 && repeat == -1) {
int c = YES; /* Go back immediately if no changes */
if (strcmp(MyEdit.buffer, value)) {
@@ -564,8 +654,23 @@ again:
*/
if (repeat < 0)
repeat = 1;
- while (repeat--)
+ while (repeat--) {
+#ifndef SUPPORT_MULTIBYTE_EDIT
LYLineEdit(&MyEdit, ch, TRUE);
+#else /* SUPPORT_MULTIBYTE_EDIT */
+ if (LYLineEdit(&MyEdit, ch, TRUE) == 0) {
+ if (HTCJK != NOCJK && (0x80 <= ch)
+ && (ch <= 0xfe) && refresh)
+ refresh = FALSE;
+ else
+ refresh = TRUE;
+ } else {
+ if (!refresh) {
+ LYEdit1(&MyEdit, 0, LYE_DELP, TRUE);
+ }
+ }
+#endif /* SUPPORT_MULTIBYTE_EDIT */
+ }
if (MyEdit.strlen >= max_length) {
HaveMaxlength = TRUE;
} else if (HaveMaxlength &&
@@ -576,11 +681,14 @@ again:
if (strcmp(value, MyEdit.buffer)) {
Edited = TRUE;
}
+#ifdef SUPPORT_MULTIBYTE_EDIT
+ if (refresh)
+#endif
LYRefreshEdit(&MyEdit);
LYSetLastTFPos(MyEdit.pos);
}
}
-#ifdef NOTDEFINED
+#if defined(NOTDEFINED) || defined(SH_EX)
breakfor:
#endif /* NOTDEFINED */
if (Edited) {
@@ -705,7 +813,7 @@ PRIVATE int get_popup_option_number ARGS2(
PRIVATE void paddstr ARGS3(
WINDOW *, the_window,
int, width,
- char *, the_string)
+ char *, the_string)
{
width -= strlen(the_string);
waddstr(the_window, the_string);
@@ -869,10 +977,10 @@ PRIVATE int popup_options ARGS7(
#ifdef PDCURSES
keypad(form_window, TRUE);
#endif /* PDCURSES */
-#ifdef NCURSES
+#if defined(NCURSES)
LYsubwindow(form_window);
#endif
-#if defined(HAVE_GETBKGD) /* not defined in ncurses 1.8.7 */
+#if defined(HAVE_GETBKGD) && !defined(PDCURSES)/* not defined in ncurses 1.8.7 */
wbkgd(form_window, getbkgd(stdscr));
wbkgdset(form_window, getbkgd(stdscr));
#endif
@@ -895,9 +1003,9 @@ PRIVATE int popup_options ARGS7(
: 1;
/*
* OH! I LOVE GOTOs! hack hack hack
- * 07-11-94 GAB
+ * 07-11-94 GAB
* MORE hack hack hack
- * 09-05-94 FM
+ * 09-05-94 FM
*/
redraw:
opt_ptr = list;
@@ -975,9 +1083,17 @@ redraw:
SLsmg_refresh();
#else
wmove(form_window, ((i + 1) - window_offset), 2);
+#if defined(WIN_EX) /* FIX */
+ wattron(form_window, A_REVERSE);
+#else
wstart_reverse(form_window);
+#endif
paddstr(form_window, width, opt_ptr->name);
+#if defined(WIN_EX) /* FIX */
+ wattroff(form_window, A_REVERSE);
+#else
wstop_reverse(form_window);
+#endif
/*
* If LYShowCursor is ON, move the cursor to the left
* of the current option, so that blind users, who are
@@ -1679,7 +1795,7 @@ restore_popup_statusline:
}
#ifndef USE_SLANG
delwin(form_window);
-#ifdef NCURSES
+#if defined(NCURSES)
LYsubwindow(0);
#endif
#endif /* !USE_SLANG */
diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h
index 9148285e..2bbe13f1 100644
--- a/src/LYGlobalDefs.h
+++ b/src/LYGlobalDefs.h
@@ -88,7 +88,7 @@ extern char *LYCgiDocumentRoot; /* DOCUMENT_ROOT in the lynxcgi env */
/* Values to which keypad_mode can be set */
#define NUMBERS_AS_ARROWS 0
#define LINKS_ARE_NUMBERED 1
-#define LINKS_AND_FORM_FIELDS_ARE_NUMBERED 2
+#define LINKS_AND_FIELDS_ARE_NUMBERED 2
#define HIDDENLINKS_MERGE 0
#define HIDDENLINKS_SEPARATE 1
@@ -384,6 +384,19 @@ extern BOOLEAN LYPrependCharsetToSource;
extern BOOLEAN LYQuitDefaultYes;
extern BOOLEAN LYNonRestartingSIGWINCH;
extern BOOLEAN LYReuseTempfiles;
+extern BOOLEAN dont_wrap_pre;
+
+#ifdef EXP_JUSTIFY_ELTS
+extern BOOL ok_justify;
+#endif
+
+#ifndef NO_DUMP_WITH_BACKSPACES
+extern BOOLEAN with_backspaces;
+#endif
+
+#ifndef NO_EMPTY_HREFLESS_A
+extern BOOL force_empty_hrefless_a;
+#endif
#ifndef VMS
extern BOOLEAN LYNoCore;
@@ -392,4 +405,34 @@ extern BOOLEAN restore_sigpipe_for_children;
extern int HTNoDataOK; /* HT_NO_DATA-is-ok hack */
+#ifdef WIN_EX
+/* LYMain.c */
+extern int lynx_timeout;
+extern BOOLEAN system_is_NT;
+extern BOOLEAN focus_window;
+#endif /* _WINDOWS */
+
+#ifdef SH_EX
+extern BOOLEAN show_cfg;
+extern BOOLEAN mail_is_blat;
+extern BOOLEAN no_table_center;
+extern int debug_delay;
+#endif
+
+#if !defined(__CYGWIN__) && defined(__CYGWIN32__)
+#define __CYGWIN__
+
+#define cygwin_conv_to_full_win32_path(p, q) \
+ cygwin32_conv_to_full_win32_path(p, q)
+
+#define cygwin_conv_to_full_posix_path(p, q) \
+ cygwin32_conv_to_full_posix_path(p, q)
+#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);
+extern int setmode(int handle, int amode);
+#endif
+
#endif /* LYGLOBALDEFS_H */
diff --git a/src/LYJump.c b/src/LYJump.c
index 5b185d0c..7bb03e8b 100644
--- a/src/LYJump.c
+++ b/src/LYJump.c
@@ -9,6 +9,10 @@
#include <LYLeaks.h>
+#ifdef _WINDOWS
+#include <stdlib.h> /* bsearch() */
+#endif
+
#ifdef VMS
#include <fab.h>
#endif /* VMS */
diff --git a/src/LYJustify.h b/src/LYJustify.h
new file mode 100644
index 00000000..fb800bc2
--- /dev/null
+++ b/src/LYJustify.h
@@ -0,0 +1,75 @@
+/* Justification for lynx - implemented by Vlad Harchev <hvv@hippo.ru>
+ 11 July 1999
+*/
+
+#ifndef LYJUSTIFY_H
+#define LYJUSTIFY_H
+
+#include <HTUtils.h>
+
+#ifdef EXP_JUSTIFY_ELTS
+
+extern BOOL ok_justify;
+extern BOOL can_justify_here;
+extern BOOL can_justify_here_saved;
+
+extern BOOL can_justify_this_line;
+extern int wait_for_this_stacked_elt;
+extern BOOL form_in_htext;
+
+/*disabled by default*/
+/*#define DEBUG_JUSTIFY*/
+#ifdef DEBUG_JUSTIFY
+extern BOOL can_justify_stack_depth;/* can be 0 or 1 if all code is correct*/
+# define CAN_JUSTIFY_STACK_INC ++can_justify_stack_depth;\
+ assert(can_justify_stack_depth < 2 && can_justify_stack_depth >=0 );
+# define CAN_JUSTIFY_STACK_DEC --can_justify_stack_depth;\
+ assert(can_justify_stack_depth < 2 && can_justify_stack_depth >=0 );
+#else
+# define CAN_JUSTIFY_STACK_INC /* nothing */
+# define CAN_JUSTIFY_STACK_DEC /* nothing */
+#endif
+
+#define CAN_JUSTIFY_PUSH(x) can_justify_here_saved=can_justify_here;\
+ can_justify_here=(x); CAN_JUSTIFY_STACK_INC
+#define CAN_JUSTIFY_POP can_justify_here=can_justify_here_saved;\
+ CAN_JUSTIFY_STACK_INC
+#define CAN_JUSTIFY_SET(x) can_justify_here=(x);
+
+/*
+ * This is used to indicate that starting from the current offset in current
+ * line justification can take place (in order the gap between some prefix and
+ * the word not to be enlarged.
+ * For example, when forming OL,
+ * 1.21 foo
+ * ^justification can start here so that gap between 1.21 and "foo"
+ * will not be enlarged.
+ * 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 EMIT_IFDEF_EXP_JUSTIFY_ELTS(x) x
+ /*defined in order not to wrap single line of code into #ifdef/#endif */
+
+extern void ht_justify_cleanup NOPARAMS;
+extern void mark_justify_start_position PARAMS((void* text));
+
+#else /* ! EXP_JUSTIFY_ELTS */
+
+/*
+ * define empty macros so that they can be used without wrapping them in
+ * #ifdef EXP_JUSTIFY_ELTS/#endif
+ */
+
+#define CAN_JUSTIFY_PUSH(x)
+#define CAN_JUSTIFY_POP
+#define CAN_JUSTIFY_SET(x)
+#define CAN_JUSTIFY_START
+#define CANT_JUSTIFY_THIS_LINE
+#define EMIT_IFDEF_EXP_JUSTIFY_ELTS(x)
+
+#endif /* EXP_JUSTIFY_ELTS */
+
+#define CAN_JUSTIFY_PUSH_F CAN_JUSTIFY_PUSH(FALSE)
+
+#endif /* LYJUSTIFY_H */
diff --git a/src/LYKeymap.c b/src/LYKeymap.c
index be169559..32a2e0eb 100644
--- a/src/LYKeymap.c
+++ b/src/LYKeymap.c
@@ -18,7 +18,7 @@
#ifdef EXP_KEYBOARD_LAYOUT
PUBLIC int current_layout = 0; /* Index into LYKbLayouts[] */
-PUBLIC unsigned short * LYKbLayouts[]={
+PUBLIC LYKeymap_t * LYKbLayouts[]={
kb_layout_rot13,
kb_layout_jcuken,
kb_layout_yawerty
@@ -70,11 +70,19 @@ 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 */
+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 */
LYK_UP_TWO, 0, LYK_RELOAD, 0,
/* ^P */ /* XON */ /* ^R */ /* XOFF */
+#endif
LYK_TRACE_TOGGLE, 0, LYK_SWITCH_DTD, LYK_REFRESH,
/* ^T */ /* ^U */ /* ^V */ /* ^W */
@@ -753,6 +761,11 @@ PRIVATE struct rmap revmap[] = {
{ "UPLOAD", "upload from your computer to the current directory" },
{ "INSTALL", "install file or tagged files into a system area" },
#endif /* DIRED_SUPPORT */
+#ifdef SH_EX /* 1999/01/01 (Fri) 01:18:12 */
+{ "CHANGE_CENTER", "toggle center alignment in HTML TABLE" },
+{ "TO_CLIPBOARD", "link's URL to Clip Board" },
+{ "CHANGE_KCODE", "Change Kanji code" },
+#endif
#endif /* VMS */
{ NULL, "" }
};
@@ -899,11 +912,11 @@ PUBLIC int lkcstring_to_lkc ARGS1(
}
#endif
#endif
- }
- if (c < -1)
- return (-1);
- else
- return c;
+ }
+ if (c < -1)
+ return (-1);
+ else
+ return c;
}
PRIVATE int LYLoadKeymap ARGS4 (
@@ -1022,7 +1035,7 @@ PUBLIC void set_vms_keys NOARGS
keymap['$'+1] = LYK_SHELL;
}
-static char saved_vi_keys[4];
+static LYKeymap_t saved_vi_keys[4];
static BOOLEAN did_vi_keys;
PUBLIC void set_vi_keys NOARGS
@@ -1052,7 +1065,7 @@ PUBLIC void reset_vi_keys NOARGS
did_vi_keys = FALSE;
}
-static char saved_emacs_keys[4];
+static LYKeymap_t saved_emacs_keys[4];
static BOOLEAN did_emacs_keys;
PUBLIC void set_emacs_keys NOARGS
@@ -1082,7 +1095,7 @@ PUBLIC void reset_emacs_keys NOARGS
did_emacs_keys = FALSE;
}
-static char saved_number_keys[9];
+static LYKeymap_t saved_number_keys[9];
static BOOLEAN did_number_keys;
PUBLIC void set_numbers_as_arrows NOARGS
diff --git a/src/LYKeymap.h b/src/LYKeymap.h
index 036e4c60..518864fe 100644
--- a/src/LYKeymap.h
+++ b/src/LYKeymap.h
@@ -32,7 +32,7 @@ extern LYKeymap_t keymap[KEYMAP_SIZE]; /* main keymap matrix */
#ifdef EXP_KEYBOARD_LAYOUT
extern int current_layout;
-extern unsigned short * LYKbLayouts[];
+extern LYKeymap_t * LYKbLayouts[];
extern char * LYKbLayoutNames[];
extern int LYSetKbLayout PARAMS((char *layout_id));
#endif
@@ -58,9 +58,9 @@ extern LYKeymap_t key_override[];
/* Convert lynxkeycode to lynxactioncode. Modifiers are dropped. */
-#define LKC_TO_LAC(ktab,c) (((c)==-1) ? ktab[0] : \
- ((c)&LKC_ISLAC) ? ((c)&LAC_MASK) : \
- ktab[((c)&LKC_MASK)+1])
+#define LKC_TO_LAC(ktab,c) (((c) == -1) ? ktab[0] : \
+ ((c) & LKC_ISLAC) ? ((c) & LAC_MASK) : \
+ ktab[((c) & LKC_MASK) + 1])
/* Mask lynxactioncode as a lynxkeycode. */
@@ -197,6 +197,12 @@ typedef enum {
#define LYK_TAG_LINK LYK_UNKNOWN
#endif /* DIRED_SUPPORT */
+#ifdef SH_EX
+ , LYK_CHG_CENTER
+ , LYK_TO_CLIPBOARD
+ , LYK_CHG_KCODE
+#endif /* SH_EX */
+
} LYKeymapCodes;
diff --git a/src/LYList.c b/src/LYList.c
index f1e111ff..368e5a8c 100644
--- a/src/LYList.c
+++ b/src/LYList.c
@@ -125,7 +125,7 @@ PUBLIC int showlist ARGS2(
* right in connection with always treating this file as
* HIDDENLINKS_MERGE in GridText.c - kw
*/
- if (keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED) {
+ if (keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED) {
HText_FormDescNumber(cnt, (char **)&desc);
fprintf(fp0,
"<li><a id=%d href=\"#%d\">form field</a> = <em>%s</em>\n",
@@ -288,7 +288,7 @@ PUBLIC void printlist ARGS2(
* the list page match the numbering in the original document,
* but won't create a forward link to the form. - FM && LE
*/
- if (keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED) {
+ if (keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED) {
HText_FormDescNumber(cnt, (char **)&desc);
fprintf(fp, "%4d. form field = %s\n", cnt, desc);
}
diff --git a/src/LYLocal.c b/src/LYLocal.c
index 7409535a..58eacbfb 100644
--- a/src/LYLocal.c
+++ b/src/LYLocal.c
@@ -348,6 +348,11 @@ PRIVATE BOOLEAN ok_localname ARGS2(char*, dst, CONST char*, src)
PRIVATE int move_file ARGS2(char *, source, char *, target)
{
int code;
+#ifdef WIN_EX /* 1999/01/02 (Sat) 23:24:20 */
+ if ((code = rename(source, target)) != 0)
+ if ((code = LYCopyFile(source, target)) >= 0)
+ code = remove(source);
+#else
char *msg = 0;
char *args[5];
@@ -358,6 +363,7 @@ PRIVATE int move_file ARGS2(char *, source, char *, target)
args[3] = (char *) 0;
code = (LYExecv(MV_PATH, args, msg) <= 0) ? -1 : 1;
FREE(msg);
+#endif
return code;
}
@@ -2318,7 +2324,7 @@ PRIVATE int LYExecv ARGS3(
char **, argv,
char *, msg)
{
-#if defined(VMS) || defined(_WINDOWS)
+#if defined(VMS) || defined(SH_EX) || defined(_WINDOWS)
CTRACE(tfp, "LYExecv: Called inappropriately!\n");
return(0);
#else
diff --git a/src/LYMail.c b/src/LYMail.c
index 37764eab..1112eb2e 100644
--- a/src/LYMail.c
+++ b/src/LYMail.c
@@ -27,6 +27,90 @@ BOOLEAN term_letter; /* Global variable for async i/o. */
PRIVATE void terminate_letter PARAMS((int sig));
PRIVATE void remove_tildes PARAMS((char *string));
+#ifdef _WINDOWS
+#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;
+
+/*
+syntax:
+Blat <filename> -t <recipient> [optional switches (see below)]
+
+<filename> : file with the message body
+-t <recipient>: recipient list (comma separated)
+-s <subj> : subject line
+-f <sender> : overrides the default sender address (must be known to server)
+-i <addr> : a 'From:' address, not necessarily known to the SMTP server.
+-c <recipient>: carbon copy recipient list (comma separated)
+-b <recipient>: blind carbon copy recipient list (comma separated)
+-h : displays this help.
+-mime : MIME Quoted-Printable Content-Transfer-Encoding.
+-q : supresses *all* output.
+-server <addr>: overrides the default SMTP server to be used.
+
+*/
+
+static char bl_cmd_file[512];
+
+PRIVATE void blat_clean()
+{
+ if (bl_cmd_file[0]) {
+ bl_cmd_file[0] = '\0';
+ }
+}
+
+PRIVATE char *blat_cmd(
+ char *mail_cmd,
+ char *filename,
+ char *address,
+ char *subject,
+ char *ccaddr,
+ char *mail_addr
+)
+{
+ FILE *fp;
+ static char b_cmd[512];
+#ifdef __CYGWIN__
+ char dosname[LY_MAXPATH];
+#endif
+
+ if ((fp = LYOpenTemp(bl_cmd_file, ".blt", "w")) == NULL) {
+ HTAlert(FORM_MAILTO_FAILED);
+ return NULL;
+ }
+
+#ifdef __CYGWIN__
+ cygwin_conv_to_full_win32_path(filename, dosname);
+ fprintf(fp, "%s\n", dosname);
+#else
+ fprintf(fp, "%s\n", filename);
+#endif
+ fprintf(fp, "-t\n%s\n", address);
+ if (subject)
+ fprintf(fp, "-s\n%s\n", subject);
+ if (mail_addr && strlen(mail_addr) > 0) {
+ fprintf(fp, "-f\n%s\n", mail_addr);
+ }
+ if (ccaddr && strlen(ccaddr) > 0) {
+ fprintf(fp, "-c\n%s\n", ccaddr);
+ }
+ fclose(fp);
+
+#ifdef __CYGWIN__
+ cygwin_conv_to_full_win32_path(bl_cmd_file, dosname);
+ sprintf(b_cmd, "%s \"@%s\"", mail_cmd, dosname);
+#else
+ sprintf(b_cmd, "%s @%s", mail_cmd, bl_cmd_file);
+#endif
+
+ return b_cmd;
+}
+
+#endif /* SH_EX */
+
/* HTUnEscape with control-code nuking */
PRIVATE void SafeHTUnEscape ARGS1(
char *, string)
@@ -53,8 +137,8 @@ PRIVATE void SafeHTUnEscape ARGS1(
** mailform() sends form content to the mailto address(es). - FM
*/
PUBLIC void mailform ARGS4(
- CONST char *, mailto_address,
- CONST char *, mailto_subject,
+ CONST char *, mailto_address GCC_UNUSED,
+ CONST char *, mailto_subject GCC_UNUSED,
CONST char *, mailto_content,
CONST char *, mailto_type)
{
@@ -62,23 +146,26 @@ PUBLIC void mailform ARGS4(
char *address = NULL;
char *ccaddr = NULL;
char *keywords = NULL;
- char *searchpart = NULL;
- char *cp = NULL, *cp0 = NULL, *cp1 = NULL;
+ char *cp = NULL;
char subject[80];
- char self[80];
char cmd[512];
- int len, i, ch;
-#if defined(VMS) || defined(DOSPATH)
- char my_tmpfile[LY_MAXPATH];
- char *command = NULL;
+ int len, i;
#ifdef VMS
char *address_ptr1, *address_ptr2;
- BOOLEAN first = TRUE;
-#endif
BOOLEAN isPMDF = FALSE;
- char hdrfile[LY_MAXPATH];
+ 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;
}
@@ -334,7 +421,7 @@ PUBLIC void mailform ARGS4(
}
}
-#if defined(VMS) || defined(DOSPATH)
+#if defined(VMS) || defined(DOSPATH) || defined(SH_EX)
if ((fd = LYOpenTemp(my_tmpfile, ".txt", "w")) == NULL) {
HTAlert(FORM_MAILTO_FAILED);
FREE(address);
@@ -342,6 +429,8 @@ PUBLIC void mailform ARGS4(
FREE(keywords);
return;
}
+#endif
+#ifdef VMS
if (isPMDF) {
if ((hfd = LYOpenTemp(hdrfile, ".txt", "w")) == NULL) {
HTAlert(FORM_MAILTO_FAILED);
@@ -352,7 +441,6 @@ PUBLIC void mailform ARGS4(
return;
}
}
-#ifdef VMS
if (isPMDF) {
if (mailto_type && *mailto_type) {
fprintf(hfd, "Mime-Version: 1.0\n");
@@ -369,6 +457,22 @@ PUBLIC void mailform ARGS4(
*/
fprintf(fd, "X-Content-Type: %s\n\n", mailto_type);
}
+#else /* !VMS (DOS) */
+#ifdef SH_EX
+ if (mail_is_blat) {
+ if (strlen(subject) > 70)
+ subject[70] = '\0';
+ } 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);
+ }
#else
if (mailto_type && *mailto_type) {
fprintf(fd, "Mime-Version: 1.0\n");
@@ -379,9 +483,10 @@ PUBLIC void mailform ARGS4(
fprintf(fd,"From: %s\n", personal_mail_address);
remove_tildes(self);
fprintf(fd,"Subject: %.70s\n\n", subject);
+#endif /* SH_EX */
#endif
-#else
+#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);
@@ -438,11 +543,11 @@ PUBLIC void mailform ARGS4(
if (len)
fprintf(fd, "%s\n", &mailto_content[i]);
-#ifdef UNIX
+#if defined(UNIX) && !defined(__CYGWIN__)
pclose(fd);
sleep(MessageSecs);
#endif /* UNIX */
-#if defined(VMS) || defined(DOSPATH)
+#if defined(VMS) || defined(DOSPATH) || defined(SH_EX)
LYCloseTempFP(fd);
#ifdef VMS
/*
@@ -554,25 +659,51 @@ PUBLIC void mailform ARGS4(
stop_curses();
printf("%s\n\n$ %s\n\n%s", SENDING_FORM_CONTENT, command, PLEASE_WAIT);
- LYSystem(command);
+ LYSystem(command); /* Mail (VMS) */
FREE(command);
sleep(AlertSecs);
start_curses();
LYRemoveTemp(my_tmpfile);
LYRemoveTemp(hdrfile);
#else /* DOSPATH */
+#ifdef SH_EX /* 1998/05/04 (Mon) 22:18:44 */
+ if (mail_is_blat) {
+ StrAllocCopy(command,
+ blat_cmd(
+ system_mail,
+ my_tmpfile,
+ address,
+ subject,
+ ccaddr,
+ personal_mail_address
+ )
+ );
+ } else {
+ /* for sendmail.exe */
+ StrAllocCopy(command, system_mail);
+ StrAllocCat(command, " -t \"");
+ StrAllocCat(command, address);
+ 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);
+ LYSystem(command); /* Mail sending form content (DOS/Windows) */
FREE(command);
sleep(MessageSecs);
start_curses();
LYRemoveTemp(my_tmpfile);
+#ifdef SH_EX
+ if (mail_is_blat)
+ blat_clean();
+#endif /* SH_EX */
#endif
#endif /* VMS */
@@ -599,16 +730,21 @@ PUBLIC void mailmsg ARGS4(
#ifdef ALERTMAIL
BOOLEAN skip_parsing = FALSE;
#endif
-#if defined(VMS) || defined(DOSPATH)
+#if defined(DOSPATH) || defined(WIN_EX)
+ char *ccaddr;
+ char subject[128];
+#endif
+#if defined(VMS) || defined(DOSPATH) || defined(WIN_EX)
char my_tmpfile[LY_MAXPATH];
- char *command = NULL;
+#endif
#ifdef VMS
char *address_ptr1, *address_ptr2;
BOOLEAN first = TRUE;
-#endif
BOOLEAN isPMDF = FALSE;
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>",
@@ -618,7 +754,7 @@ PUBLIC void mailmsg ARGS4(
if (!strncasecomp(system_mail, "PMDF SEND", 9)) {
isPMDF = TRUE;
}
-#endif /* VMS || DOSPATH */
+#endif /* VMS */
#ifdef ALERTMAIL
if (owner_address == NULL) {
@@ -721,17 +857,15 @@ PUBLIC void mailmsg ARGS4(
address[(strlen(address) - 1)] = '\0';
if (*address == '\0') {
FREE(address);
- CTRACE(tfp, "mailmsg: No address in '%s'.\n",
- owner_address);
+ CTRACE(tfp, "mailmsg: No address in '%s'.\n", owner_address);
return;
}
-#ifdef UNIX
+#if defined(UNIX) && !defined(__CYGWIN__)
HTSprintf0(&cmd, "%s %s", system_mail, system_mail_flags);
if ((fd = popen(cmd, "w")) == NULL) {
FREE(address);
- CTRACE(tfp, "mailmsg: '%s' failed.\n",
- cmd);
+ CTRACE(tfp, "mailmsg: '%s' failed.\n", cmd);
return;
}
@@ -743,17 +877,16 @@ 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)
+#if defined(VMS) || defined(DOSPATH) || defined(WIN_EX)
if ((fd = LYOpenTemp(my_tmpfile, ".txt", "w")) == NULL) {
- CTRACE(tfp, "mailmsg: Could not fopen '%s'.\n",
- my_tmpfile);
+ CTRACE(tfp, "mailmsg: Could not fopen '%s'.\n", my_tmpfile);
FREE(address);
return;
}
+#ifdef VMS
if (isPMDF) {
if ((hfd = LYOpenTemp(hdrfile, ".txt", "w")) == NULL) {
- CTRACE(tfp, "mailmsg: Could not fopen '%s'.\n",
- hdrfile);
+ CTRACE(tfp, "mailmsg: Could not fopen '%s'.\n", hdrfile);
FREE(address);
return;
}
@@ -764,7 +897,11 @@ PUBLIC void mailmsg ARGS4(
fprintf(fd, "X-URL: %s\n", filename);
fprintf(fd, "X-Mailer: Lynx, Version %s\n\n", LYNX_VERSION);
}
+#else
+ sprintf(subject, "Lynx Error in %.56s", filename);
+ ccaddr = personal_mail_address;
#endif /* VMS */
+#endif /* VMS || DOSPATH */
fprintf(fd, gettext("The link %s :?: %s \n"),
links[cur].lname, links[cur].target);
@@ -776,16 +913,16 @@ PUBLIC void mailmsg ARGS4(
fprintf(fd, "%s\n", gettext("This message was automatically generated by"));
fprintf(fd, gettext("Lynx ver. %s"), LYNX_VERSION);
if ((LynxSigFile != NULL) &&
- (fp = fopen(LynxSigFile, "r")) != NULL) {
+ (fp = fopen(LynxSigFile, TXT_R)) != NULL) {
fputs("-- \n", fd);
while (LYSafeGets(&cmd, fp) != NULL)
fputs(cmd, fd);
fclose(fp);
}
-#ifdef UNIX
+#if defined(UNIX) && !defined(__CYGWIN__)
pclose(fd);
#endif /* UNIX */
-#if defined(VMS) || defined(DOSPATH)
+#if defined(VMS) || defined(DOSPATH) || defined(WIN_EX)
LYCloseTempFP(fd);
#ifdef VMS
if (isPMDF) {
@@ -838,10 +975,10 @@ PUBLIC void mailmsg ARGS4(
HTSprintf0(&cmd, mail_adrs, address_ptr1);
StrAllocCat(command, cmd);
first = FALSE;
- address_ptr1 = address_ptr2;
+ address_ptr1 = address_ptr2;
} while (address_ptr1 != NULL);
- LYSystem(command);
+ LYSystem(command); /* VMS */
FREE(command);
FREE(cmd);
LYRemoveTemp(my_tmpfile);
@@ -849,14 +986,33 @@ PUBLIC void mailmsg ARGS4(
LYRemoveTemp(hdrfile);
}
#else /* DOSPATH */
- StrAllocCopy(command, system_mail);
- StrAllocCat(command, " -t \"");
- StrAllocCat(command, address);
- StrAllocCat(command, "\" -F ");
- StrAllocCat(command, my_tmpfile);
- LYSystem(command);
+#ifdef SH_EX
+ if (mail_is_blat)
+ strcpy(cmd,
+ blat_cmd(
+ system_mail,
+ my_tmpfile,
+ address,
+ subject,
+ ccaddr,
+ personal_mail_address
+ )
+ );
+ else
+ 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 (mail_is_blat)
+ blat_clean();
+#endif
#endif
#endif /* VMS */
@@ -901,10 +1057,10 @@ PUBLIC void reply_by_mail ARGS4(
int i, len;
int c = 0; /* user input */
char my_tmpfile[LY_MAXPATH], cmd[512];
-#ifdef DOSPATH
+#if defined(DOSPATH) || defined(WIN_EX)
char tmpfile2[LY_MAXPATH];
#endif
-#if defined(DOSPATH) || defined(VMS)
+#if defined(DOSPATH) || defined(WIN_EX) || defined(VMS)
char *command = NULL;
#endif
#ifndef NO_ANONYMOUS_EMAIL
@@ -922,7 +1078,7 @@ PUBLIC void reply_by_mail ARGS4(
isPMDF = TRUE;
}
#else
- char buf[512];
+ char buf[4096]; /* 512 */
char *header = NULL;
int n;
#endif /* VMS */
@@ -1249,7 +1405,7 @@ PUBLIC void reply_by_mail ARGS4(
}
#endif /* NO_ANONYMOUS_MAIL */
}
-#else /* Unix: */
+#else /* Unix/DOS/Windows */
/*
* Put the To: line in the header.
*/
@@ -1483,6 +1639,12 @@ PUBLIC void reply_by_mail ARGS4(
#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
StrAllocCat(header, "Subject: ");
StrAllocCat(header, user_input);
StrAllocCat(header, "\n");
@@ -1529,7 +1691,7 @@ PUBLIC void reply_by_mail ARGS4(
}
}
-#ifdef DOSPATH
+#if defined(DOSPATH) || defined(SH_EX)
if (*address) {
StrAllocCat(header, "To: ");
StrAllocCat(header, address);
@@ -1610,7 +1772,7 @@ PUBLIC void reply_by_mail ARGS4(
sprintf(user_input, "%s%s %s", editor, editor_arg, my_tmpfile);
_statusline(SPAWNING_EDITOR_FOR_MAIL);
stop_curses();
- if (LYSystem(user_input)) {
+ if (LYSystem(user_input)) { /* Spawn Editor */
start_curses();
HTAlert(ERROR_SPAWNING_EDITOR);
} else {
@@ -1708,7 +1870,7 @@ PUBLIC void reply_by_mail ARGS4(
goto cleanup;
}
if ((body == NULL && LynxSigFile != NULL) &&
- (fp = fopen(LynxSigFile, "r")) != NULL) {
+ (fp = fopen(LynxSigFile, TXT_R)) != NULL) {
LYStatusLine = (LYlines - 1);
if (term_letter) {
_user_message(APPEND_SIG_FILE, LynxSigFile);
@@ -1721,7 +1883,7 @@ PUBLIC void reply_by_mail ARGS4(
}
LYStatusLine = -1;
if (c == YES) {
- if ((fd = fopen(my_tmpfile, "a")) != NULL) {
+ if ((fd = fopen(my_tmpfile, TXT_A)) != NULL) {
char *buffer = NULL;
fputs("-- \n", fd);
while (LYSafeGets(&buffer, fp) != NULL) {
@@ -1847,18 +2009,18 @@ PUBLIC void reply_by_mail ARGS4(
stop_curses();
printf("%s\n\n$ %s\n\n%s", SENDING_COMMENT, command, PLEASE_WAIT);
- LYSystem(command);
+ LYSystem(command); /* SENDING COMMENT (VMS) */
FREE(command);
sleep(AlertSecs);
start_curses();
goto cleandown;
-#else /* not VMS: */
+#else /* Unix/DOS/Windows */
/*
* Send the tmpfile into sendmail.
*/
_statusline(SENDING_YOUR_MSG);
sprintf(cmd, "%s %s", system_mail, system_mail_flags);
-#ifdef DOSPATH
+#if defined(DOSPATH) || defined(WIN_EX)
if ((fp = LYOpenTemp(tmpfile2, ".txt", "w")) == NULL) {
HTAlert(MAILTO_URL_TEMPOPEN_FAILED);
return;
@@ -1871,33 +2033,64 @@ PUBLIC void reply_by_mail ARGS4(
goto cleanup;
}
#endif /* DOSPATH */
- fd = fopen(my_tmpfile, "r");
+ fd = fopen(my_tmpfile, TXT_R);
if (fd == NULL) {
HTInfoMsg(COMMENT_REQUEST_CANCELLED);
pclose(fp);
goto cleanup;
}
+#ifdef SH_EX
+ if (!mail_is_blat)
+ fputs(header, fp);
+#else
fputs(header, fp);
- while ((n = fread(buf, 1, sizeof(buf), fd)) != 0)
+#endif
+ while ((n = fread(buf, 1, sizeof(buf), fd)) != 0) {
fwrite(buf, 1, n, fp);
-#ifdef DOSPATH
+ }
+#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);
+#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);
+ LYSystem(command); /* SENDING COMMENT (DOS/Windows/Unix) */
FREE(command);
sleep(MessageSecs);
start_curses();
LYRemoveTemp(tmpfile2); /* Delete the tmpfile. */
-#else
- pclose(fp);
+#ifdef SH_EX
+ if (mail_is_blat)
+ blat_clean();
#endif
- LYCloseTempFP(fd); /* Close the tmpfile. */
+#else /* !DOSPATH */
+ pclose(fp);
+#endif /* DOSPATH */
+ fclose(fd); /* Close the tmpfile. */
CTRACE(tfp, "%s\n", cmd);
#endif /* VMS */
@@ -1907,21 +2100,24 @@ PUBLIC void reply_by_mail ARGS4(
*/
cleanup:
signal(SIGINT, cleanup_sig);
-#if !defined(VMS) && !defined(DOSPATH)
+#if !defined(VMS) && !defined(DOSPATH) || defined(SH_EX)
FREE(header);
#endif /* !VMS */
-#if defined(VMS) || defined(DOSPATH)
+#if defined(VMS)
cleandown:
#endif /* VMS */
term_letter = FALSE;
#ifdef VMS
FREE(command);
+ while (LYRemoveTemp(my_tmpfile) == 0)
+ ; /* Delete the tmpfile(s). */
if (isPMDF) {
- LYRemoveTemp(hdrfile);
+ LYRemoveTemp(hdrfile); /* Delete the hdrfile. */
}
+#else
+ LYRemoveTemp(my_tmpfile); /* Delete the tmpfile. */
#endif /* VMS */
- LYRemoveTemp(my_tmpfile);
FREE(address);
FREE(ccaddr);
FREE(keywords);
@@ -1934,7 +2130,7 @@ PRIVATE void terminate_letter ARGS1(int,sig GCC_UNUSED)
term_letter = TRUE;
/* Reassert the AST */
signal(SIGINT, terminate_letter);
-#if defined(VMS) || defined(DOSPATH)
+#if defined(VMS) || defined(DOSPATH) || defined(WIN_EX)
/*
* Refresh the screen to get rid of the "interrupt" message.
*/
diff --git a/src/LYMain.c b/src/LYMain.c
index 1c7f6c87..84a9ab1c 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -275,6 +275,34 @@ PUBLIC BOOLEAN local_host_only = FALSE;
PUBLIC BOOLEAN override_no_download = FALSE;
PUBLIC BOOLEAN show_dotfiles = FALSE; /* From rcfile if no_dotfiles is false */
PUBLIC BOOLEAN LYforce_HTML_mode = FALSE;
+
+#ifdef WIN_EX
+#undef SYSTEM_MAIL
+#undef SYSTEM_MAIL_FLAGS
+#define SYSTEM_MAIL "BLATJ"
+#define SYSTEM_MAIL_FLAGS ""
+PUBLIC BOOLEAN focus_window = FALSE; /* 1998/10/05 (Mon) 17:18:42 */
+PUBLIC char windows_drive[4]; /* 1998/01/13 (Tue) 21:13:24 */
+#endif
+
+#ifdef _WINDOWS
+#define TIMEOUT 180 /* 1998/03/30 (Mon) 14:50:44 */
+PUBLIC int lynx_timeout = TIMEOUT;
+PUBLIC CRITICAL_SECTION critSec_DNS; /* 1998/09/03 (Thu) 22:01:56 */
+PUBLIC CRITICAL_SECTION critSec_READ; /* 1998/09/03 (Thu) 22:01:56 */
+#endif /* _WINDOWS */
+
+#if defined(WIN_EX)
+PUBLIC BOOLEAN system_is_NT = FALSE;
+#endif
+
+#ifdef SH_EX
+PUBLIC BOOLEAN show_cfg = FALSE;
+PUBLIC BOOLEAN mail_is_blat = TRUE;
+PUBLIC int debug_delay = 0; /* 1998/10/06 (Tue) 08:41:20 */
+PUBLIC BOOLEAN no_table_center = FALSE; /* 1998/10/09 (Fri) 15:12:49 */
+#endif /* SH_EX */
+
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 */
@@ -401,6 +429,19 @@ PUBLIC BOOLEAN LYPreparsedSource = FALSE; /* Show source as preparsed? */
PUBLIC BOOLEAN LYPrependBaseToSource = TRUE;
PUBLIC BOOLEAN LYPrependCharsetToSource = TRUE;
PUBLIC BOOLEAN LYQuitDefaultYes = QUIT_DEFAULT_YES;
+PUBLIC BOOLEAN dont_wrap_pre = FALSE;
+
+#ifdef EXP_JUSTIFY_ELTS
+PUBLIC BOOL ok_justify = TRUE;
+#endif
+
+#ifndef NO_DUMP_WITH_BACKSPACES
+PUBLIC BOOLEAN with_backspaces = FALSE;
+#endif
+
+#ifndef NO_EMPTY_HREFLESS_A
+PUBLIC BOOL force_empty_hrefless_a = FALSE;
+#endif
#ifdef DISP_PARTIAL
PUBLIC BOOLEAN display_partial_flag = TRUE; /* Display document during download */
@@ -440,6 +481,12 @@ PRIVATE HTList *LYStdinArgs = NULL;
#define EXTENDED_STARTFILE_RECALL 1
#endif
+#ifndef OPTNAME_ALLOW_DASHES
+/* if set, then will allow dashes and underscores to be used interchangeable
+ in commandline option's names - VH */
+#define OPTNAME_ALLOW_DASHES 1
+#endif
+
#if EXTENDED_OPTION_LOGIC
PRIVATE BOOLEAN no_options_further=FALSE; /* set to TRUE after '--' argument */
#endif
@@ -480,6 +527,20 @@ PRIVATE void reset_break(void)
}
#endif /* __DJGPP__ */
+#if defined(WIN_EX)
+PUBLIC int is_windows_nt(void)
+{
+ DWORD version;
+
+ version = GetVersion();
+ if ((version & 0x80000000) == 0)
+ return 1;
+ else
+ return 0;
+}
+#endif
+
+
#ifdef LY_FIND_LEAKS
PRIVATE void free_lynx_globals NOARGS
{
@@ -661,7 +722,18 @@ PRIVATE int argcmp ARGS2(
char*, what)
{
if (str[0] == '-' && str[1] == '-' ) ++str;
+#if !OPTNAME_ALLOW_DASHES
return strcmp(str,what);
+#else
+ ++str; ++what; /*skip leading dash in both strings*/
+ {
+ int l1 = strlen(str);
+ int l2 = strlen(what);
+ if (l1 != l2)
+ return 1; /* this function simulates strcmp!*/
+ return !strn_dash_equ(str, what, l2);
+ }
+#endif
}
PRIVATE int argncmp ARGS2(
@@ -669,7 +741,12 @@ PRIVATE int argncmp ARGS2(
char*, what)
{
if (str[0] == '-' && str[1] == '-' ) ++str;
+#if OPTNAME_ALLOW_DASHES
return strncmp(str, what, strlen(what));
+#else
+ ++str; ++what; /*skip leading dash in both strings*/
+ return !strn_dash_equ(str, what, strlen(what));
+#endif
}
/*
@@ -704,11 +781,35 @@ PUBLIC int main ARGS2(
{
printf(gettext("No Winsock found, sorry."));
sleep(5);
- return;
+ return 1;
}
}
+
+ /* 1998/09/03 (Thu) 22:02:32 */
+ InitializeCriticalSection(&critSec_DNS);
+ InitializeCriticalSection(&critSec_READ);
+
#endif /* _WINDOWS */
+#if defined(__CYGWIN__) && defined(DOSPATH)
+ if (strcmp(ttyname(fileno(stdout)), "/dev/conout") != 0) {
+ printf("please \"$CYGWIN=notty\"\n");
+ exit(0);
+ }
+#endif
+
+#if defined(WIN_EX)
+ /* 1997/10/19 (Sun) 21:40:54 */
+ system_is_NT = is_windows_nt();
+
+ /* 1998/01/13 (Tue) 21:13:47 */
+ GetWindowsDirectory(filename, sizeof filename);
+ windows_drive[0] = filename[0];
+ windows_drive[1] = filename[1];
+ windows_drive[2] = '\0';
+#endif
+
+
#ifdef __DJGPP__
if (LY_get_ctrl_break() == 0) {
LY_set_ctrl_break(TRUE);
@@ -740,6 +841,12 @@ PUBLIC int main ARGS2(
* Set up the argument list.
*/
pgm = argv[0];
+ cp = NULL;
+#ifdef DOSPATH
+ if ((cp = strrchr(pgm, '\\')) != NULL) {
+ pgm = cp + 1;
+ } else if (cp == NULL)
+#endif
if ((cp = strrchr(pgm, '/')) != NULL) {
pgm = cp + 1;
}
@@ -751,6 +858,11 @@ PUBLIC int main ARGS2(
if (argncmp(argv[i], "-help") == 0) {
parse_arg(&argv[i], &i);
}
+#ifdef SH_EX
+ if (strncmp(argv[i], "-show_cfg", 9) == 0) {
+ show_cfg = TRUE;
+ }
+#endif
}
#ifdef LY_FIND_LEAKS
@@ -849,9 +961,9 @@ PUBLIC int main ARGS2(
#endif
#if defined (DOSPATH) || defined (__EMX__)
else if ((cp = getenv("TEMP")) != NULL)
- StrAllocCopy(lynx_temp_space, HTDOS_name(cp));
+ StrAllocCopy(lynx_temp_space, HTSYS_name(cp));
else if ((cp = getenv("TMP")) != NULL)
- StrAllocCopy(lynx_temp_space, HTDOS_name(cp));
+ StrAllocCopy(lynx_temp_space, HTSYS_name(cp));
#endif
else
#ifdef TEMP_SPACE
@@ -1190,7 +1302,14 @@ PUBLIC int main ARGS2(
/*
* Set up the TRACE log path, and logging if appropriate. - FM
*/
- LYAddPathToHome(LYTraceLogPath = malloc(LY_MAXPATH), LY_MAXPATH, "Lynx.trace");
+#ifdef FNAMES_8_3
+ LYAddPathToHome(LYTraceLogPath =
+ malloc(LY_MAXPATH), LY_MAXPATH, "LY-TRACE.LOG");
+#else
+ LYAddPathToHome(LYTraceLogPath =
+ malloc(LY_MAXPATH), LY_MAXPATH, "Lynx.trace");
+#endif
+
LYOpenTraceLog();
/*
@@ -1346,7 +1465,7 @@ PUBLIC int main ARGS2(
}
#endif /* USE_HASH */
-#if USE_COLOR_TABLE
+#ifdef USE_COLOR_TABLE
/*
* Set up default foreground and background colors.
*/
@@ -1541,6 +1660,13 @@ PUBLIC int main ARGS2(
#endif /* SYSLOG_REQUESTED_URLS */
#endif /* !VMS */
+#ifdef SH_EX
+ if (show_cfg) {
+ cleanup();
+ exit(0);
+ }
+#endif
+
#ifdef USE_SLANG
if (LYShowColor >= SHOW_COLOR_ON &&
!(Lynx_Color_Flags & SL_LYNX_USE_COLOR)) {
@@ -1773,7 +1899,7 @@ PUBLIC int main ARGS2(
ftp_ok = !no_inside_ftp && !no_outside_ftp && ftp_ok;
rlogin_ok = !no_inside_rlogin && !no_outside_rlogin && rlogin_ok;
#else
- CTRACE(tfp,"LYMain.c: User in Local domain\n");
+ CTRACE(tfp,"LYMain: User in Local domain\n");
telnet_ok = !no_inside_telnet && telnet_ok;
#ifndef DISABLE_NEWS
news_ok = !no_inside_news && news_ok;
@@ -1782,7 +1908,7 @@ PUBLIC int main ARGS2(
rlogin_ok = !no_inside_rlogin && rlogin_ok;
#endif /* !HAVE_UTMP || VMS */
} else {
- CTRACE(tfp,"LYMain.c: User in REMOTE domain\n");
+ CTRACE(tfp,"LYMain: User in REMOTE domain\n");
telnet_ok = !no_outside_telnet && telnet_ok;
#ifndef DISABLE_NEWS
news_ok = !no_outside_news && news_ok;
@@ -1832,7 +1958,7 @@ PUBLIC int main ARGS2(
if (!nolist &&
!crawl && /* For -crawl it has already been done! */
(keypad_mode == LINKS_ARE_NUMBERED ||
- keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED))
+ keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED))
printlist(stdout,FALSE);
#ifdef EXP_PERSISTENT_COOKIES
/*
@@ -1856,7 +1982,13 @@ PUBLIC int main ARGS2(
cache_tag_styles();
#endif
- ena_csi((LYlowest_eightbit[current_char_set] > 155));
+#ifndef NO_DUMP_WITH_BACKSPACES
+ if (with_backspaces) {
+ /* we should warn about this somehow (nop for now) -VH */
+ with_backspaces = FALSE;
+ }
+#endif
+ ena_csi((BOOLEAN)(LYlowest_eightbit[current_char_set] > 155));
LYOpenCloset();
status = mainloop();
LYCloseCloset();
@@ -2671,6 +2803,22 @@ static int version_fun ARGS1(
"See http://lynx.browser.org/ and the online help for more information.\n\n"
));
+#ifdef SH_EX
+#ifdef __CYGWIN__
+ printf("Compiled by CYGWIN (%s %s).\n", __DATE__, __TIME__);
+#else
+#ifdef __BORLANDC__
+ printf("Compiled by Borland C++ (%s %s).\n", __DATE__, __TIME__);
+#else
+#ifdef _MSC_VER
+ printf("Compiled by Microsoft Visual C++ (%s %s).\n", __DATE__, __TIME__);
+#else
+ printf("Compiled at (%s %s).\n", __DATE__, __TIME__);
+#endif /* _MSC_VER */
+#endif /* __BORLANDC__ */
+#endif /* __CYGWIN__ */
+#endif /* SH_EX */
+
SetOutputMode( O_BINARY );
exit(0);
@@ -2744,6 +2892,12 @@ static Parse_Args_Type Arg_Table [] =
"case", SET_ARG, &case_sensitive,
"enable case sensitive user searching"
),
+#ifdef SH_EX
+ PARSE_SET(
+ "center", TOGGLE_ARG, &no_table_center,
+ "Toggle center alignment in HTML TABLE"
+ ),
+#endif
PARSE_STR(
"cfg", IGNORE_ARG|NEED_NEXT_ARG, 0,
"=FILENAME\nspecifies a lynx.cfg file other than the default"
@@ -2785,10 +2939,20 @@ with -dump, format output as with -traversal, but to stdout"
"incremental display stages with MessageSecs delay"
),
#endif
+#ifdef SH_EX
+ PARSE_SET(
+ "delay", NEED_INT_ARG, &debug_delay,
+ "=NNN\nset the NNN msec delay at statusline message"
+ ),
+#endif
PARSE_FUN(
"display", NEED_FUNCTION_ARG, display_fun,
"=DISPLAY\nset the display variable for X exec'ed programs"
),
+ PARSE_SET(
+ "dont_wrap_pre", SET_ARG, &dont_wrap_pre,
+ "inhibit wrapping of text in <pre> when -dump'ing and -crawl'ing"
+ ),
PARSE_FUN(
"dump", FUNCTION_ARG, dump_output_fun,
"dump the first file to stdout and exit"
@@ -2844,6 +3008,12 @@ keys (may be incompatible with some curses packages)"
"from", TOGGLE_ARG, &LYNoFromHeader,
"toggle transmissions of From headers"
),
+#ifndef NO_EMPTY_HREFLESS_A
+ PARSE_SET(
+ "force_empty_hrefless_a", SET_ARG, &force_empty_hrefless_a,
+ "force HREF-less 'A' elements to be empy (close them as soon as they are seen)"
+ ),
+#endif
#if !defined(NO_OPTION_FORMS) && !defined(NO_OPTION_MENU)
PARSE_SET(
"forms_options", TOGGLE_ARG, &LYUseFormsOptions,
@@ -2890,6 +3060,12 @@ keys (may be incompatible with some curses packages)"
"ismap", TOGGLE_ARG, &LYNoISMAPifUSEMAP,
"toggles inclusion of ISMAP links when client-side\nMAPs are present"
),
+#ifdef EXP_JUSTIFY_ELTS
+ PARSE_SET(
+ "justify", SET_ARG, &ok_justify,
+ "do justification of text"
+ ),
+#endif
PARSE_INT(
"link", NEED_INT_ARG, &ccount,
"=NUMBER\nstarting count for lnk#.dat files produced by -crawl"
@@ -2913,6 +3089,8 @@ keys (may be incompatible with some curses packages)"
"toggles minimal versus valid comment parsing"
),
#ifndef DISABLE_NEWS
+#endif
+#ifndef DISABLE_NEWS
PARSE_FUN(
"newschunksize", NEED_FUNCTION_ARG, newschunksize_fun,
"=NUMBER\nnumber of articles in chunked news listings"
@@ -2922,6 +3100,12 @@ keys (may be incompatible with some curses packages)"
"=NUMBER\nmaximum news articles in listings before chunking"
),
#endif
+#ifdef SH_EX
+ PARSE_SET(
+ "noblat", TOGGLE_ARG, &mail_is_blat,
+ "select mail tool (`BLAT' ==> `sendmail')"
+ ),
+#endif
PARSE_FUN(
"nobrowse", FUNCTION_ARG, nobrowse_fun,
"disable directory browsing"
@@ -3026,7 +3210,8 @@ to visualize how lynx behaves with invalid HTML"
),
PARSE_SET(
"raw", UNSET_ARG, &LYUseDefaultRawMode,
- "toggles default setting of 8-bit character translations\nor CJK mode for the startup character set"
+ "toggles default setting of 8-bit character translations\n\
+or CJK mode for the startup character set"
),
PARSE_SET(
"realm", SET_ARG, &check_realm,
@@ -3054,6 +3239,12 @@ with the PREV_DOC command or from the History List"
"selective", FUNCTION_ARG, selective_fun,
"require .www_browsable files to browse directories"
),
+#ifdef SH_EX
+ PARSE_SET(
+ "show_cfg", SET_ARG, &show_cfg,
+ "Show `LYNX.CFG' setting"
+ ),
+#endif
PARSE_SET(
"show_cursor", TOGGLE_ARG, &LYUseDefShoCur,
"toggles hiding of the cursor in the lower right corner"
@@ -3099,6 +3290,12 @@ treated '>' as a co-terminator for double-quotes and tags"
"tlog", IGNORE_ARG, 0,
"toggles use of a Lynx Trace Log for the current session"
),
+#ifdef _WINDOWS
+ PARSE_SET(
+ "timeout", SET_ARG, &lynx_timeout,
+ "set TCP/IP timeout"
+ ),
+#endif
PARSE_SET(
"trace", IGNORE_ARG, 0,
"turns on Lynx trace mode"
@@ -3141,6 +3338,12 @@ treated '>' as a co-terminator for double-quotes and tags"
"width", NEED_FUNCTION_ARG, width_fun,
"=NUMBER\nscreen width for formatting of dumps (default is 80)"
),
+#ifndef NO_DUMP_WITH_BACKSPACES
+ PARSE_SET(
+ "with_backspaces", SET_ARG, &with_backspaces,
+ "emit backspaces in output if -dumping or -crawling (like 'man' does)"
+ ),
+#endif
{NULL, 0, 0, NULL}
};
@@ -3277,6 +3480,9 @@ static int arg_eqs_parse ARGS3(
return 0;
}
} else {
+#if OPTNAME_ALLOW_DASHES
+ if (!(*a == '_' && *b == '-'))
+#endif
return 0;
}
}
@@ -3317,6 +3523,18 @@ PRIVATE void parse_arg ARGS2(
#endif
StrAllocCopy(startfile, arg_name);
LYTrimStartfile(startfile);
+#ifdef _WINDOWS /* 1998/01/14 (Wed) 20:11:17 */
+ HTUnEscape(startfile);
+ {
+ char *p;
+
+ p = startfile;
+ while (*p++) {
+ if (*p == '|')
+ *p = ':';
+ }
+ }
+#endif
return;
}
#if EXTENDED_OPTION_LOGIC
@@ -3487,6 +3705,19 @@ Do NOT mail the core file if one was generated.\r\n");
if (sig != 0) {
fprintf(stderr, "\r\n\
Lynx now exiting with signal: %d\r\n\r\n", sig);
+#ifdef WIN_EX /* 1998/08/09 (Sun) 09:58:25 */
+ {
+ char *msg;
+ switch (sig) {
+ case SIGABRT: msg = "SIGABRT"; break;
+ case SIGFPE: msg = "SIGFPE"; break;
+ case SIGILL: msg = "SIGILL"; break;
+ case SIGSEGV: msg = "SIGSEGV"; break;
+ default: msg = "Not-def"; break;
+ }
+ fprintf(stderr, "signal code = %s\n", msg);
+ }
+#endif
}
/*
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index 47ac1d67..3d7a737f 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -39,6 +39,107 @@
#include <LYMainLoop.h>
#include <LYPrettySrc.h>
+#if defined(CJK_EX) /* 1999/05/25 (Tue) 11:10:45 */
+#include <HTCJK.h>
+extern HTCJKlang HTCJK;
+extern char *string_short(char *str, int cut_pos); /* LYExtern.c */
+
+#define CHARSET_TRANS 14 /* "Transparent" in LYCharSets.c */
+
+PRIVATE char *str_sjis(char *to, char *from)
+{
+ if (!LYRawMode) {
+ strcpy(to, from);
+ } else if (last_kcode == EUC) {
+ EUC_TO_SJIS(from, to);
+ } else if (last_kcode == SJIS) {
+ strcpy(to, from);
+ } else {
+ TO_SJIS(from, to);
+ }
+ return to;
+}
+
+PUBLIC char *str_kcode(HTkcode code)
+{
+ char *p;
+ static char buff[8];
+
+ if (current_char_set == CHARSET_TRANS) {
+ p = "THRU";
+ } else {
+ if (!LYRawMode) {
+ p = "RAW";
+ } else {
+ switch (code) {
+ case NOKANJI:
+ p = "AUTO";
+ break;
+
+ case EUC:
+ p = "EUC+";
+ break;
+
+ case SJIS:
+ p = "SJIS";
+ break;
+
+ case JIS:
+ p = " JIS";
+ break;
+
+ default:
+ p = " ???";
+ break;
+ }
+ }
+ }
+
+#ifdef SH_EX /* 1999/05/25 (Tue) 11:12:05 */
+ if (no_table_center) {
+ buff[0] = '!';
+ strcpy(buff + 1, p);
+ } else {
+ strcpy(buff, p);
+ }
+#else
+ strcpy(buff, p);
+#endif
+
+ return buff;
+}
+
+
+PUBLIC void set_ws_title(char * str)
+{
+#ifdef WIN_EX
+ SetConsoleTitle(str);
+#endif
+}
+
+/* 1998/10/30 (Fri) 10:06:47 */
+
+#define NOT_EQU 1
+
+PRIVATE int str_n_cmp(const char *p, const char *q, int n)
+{
+ if (n == 0)
+ return 0;
+
+ if (p == NULL)
+ return NOT_EQU;
+
+ if (q == NULL)
+ return NOT_EQU;
+
+ return strncmp(p, q, n);
+}
+
+#undef strncmp
+#define strncmp(p, q, r) str_n_cmp(p, q, r)
+
+#endif /* SH_EX */
+
#ifdef USE_EXTERNALS
#include <LYExtern.h>
#endif
@@ -239,9 +340,9 @@ PRIVATE int do_change_link ARGS1(
int mouse_tmp = get_mouse_link();
/* If yes, use it as the link */
if (mouse_tmp != -1) {
- if (curdoc.link >= 0 && curdoc.link < nlinks &&
- curdoc.link != mouse_tmp) {
- highlight(OFF, curdoc.link, prev_target);
+ if (curdoc.link >= 0 && curdoc.link < nlinks
+ && curdoc.link != mouse_tmp) {
+ highlight(OFF, curdoc.link, prev_target);
}
if (mouse_tmp < 0 || mouse_tmp >= nlinks) {
char *msgtmp = NULL;
@@ -268,6 +369,15 @@ PRIVATE int do_change_link ARGS1(
int mainloop NOARGS
{
+#if defined(SH_EX) /* 1997/10/08 (Wed) 14:52:06 */
+#undef STRING_MAX
+#define STRING_MAX 4096
+ char title_buff[STRING_MAX];
+ char temp_buff[STRING_MAX];
+
+#define BUFF_MAX 1024
+ char sjis_buff[BUFF_MAX];
+#endif
int c = 0, real_c = 0, old_c = 0;
int cmd = LYK_DO_NOTHING, real_cmd = LYK_DO_NOTHING;
int getresult;
@@ -1155,22 +1265,22 @@ try_again:
* WINDOW structures are already filled based on the old size.
* So we notify the ncurses library directly here. - kw
*/
-#ifdef NCURSES_VERSION /* FIXME: check for specific version? */
+#if defined(NCURSES_VERSION) && !defined(PDCURSES) /* FIXME: check for specific version? */
resizeterm(LYlines, LYcols);
#else
- stop_curses();
- start_curses();
- clear();
+ stop_curses();
+ start_curses();
+ clear();
#endif
- refresh_screen = TRUE; /* to force a redraw */
- if (HTMainText) /* to REALLY force it... - kw */
- HText_setStale(HTMainText);
- recent_sizechange = FALSE;
- if (user_mode == NOVICE_MODE) {
- display_lines = LYlines-4;
- } else {
- display_lines = LYlines-2;
- }
+ refresh_screen = TRUE; /* to force a redraw */
+ if (HTMainText) /* to REALLY force it... - kw */
+ HText_setStale(HTMainText);
+ recent_sizechange = FALSE;
+ if (user_mode == NOVICE_MODE) {
+ display_lines = LYlines-4;
+ } else {
+ display_lines = LYlines-2;
+ }
}
if (www_search_result != -1) {
@@ -1446,6 +1556,74 @@ try_again:
}
+#if defined(SH_EX) /* 1997/10/08 (Wed) 14:52:06 */
+ if (nlinks > 0) {
+ char *p = "LYNX (unknown link type)";
+
+ /* Show the URL & kanji code . */
+ if (strlen(links[curdoc.link].lname) == 0) {
+
+ if (links[curdoc.link].type == WWW_FORM_LINK_TYPE)
+
+ switch(links[curdoc.link].form->type) {
+ case F_TEXT_SUBMIT_TYPE:
+ case F_SUBMIT_TYPE:
+ case F_IMAGE_SUBMIT_TYPE:
+ p = "[SUBMIT]";
+ break;
+ case F_PASSWORD_TYPE:
+ p = "Password";
+ break;
+ case F_OPTION_LIST_TYPE:
+ p = "Option list";
+ break;
+ case F_CHECKBOX_TYPE:
+ p = "Check box";
+ break;
+ case F_RADIO_TYPE:
+ p = "[Radio]";
+ break;
+ case F_RESET_TYPE:
+ p = "[Reset]";
+ break;
+ case F_TEXT_TYPE:
+ p = "Text input";
+ break;
+ case F_TEXTAREA_TYPE:
+ p = "Text input lines";
+ break;
+ default:
+ break;
+ }
+ set_ws_title(p);
+ } else {
+ if (user_mode == ADVANCED_MODE) {
+ p = curdoc.title;
+ } else {
+ p = links[curdoc.link].lname;
+ }
+
+ if (strlen(p) < 500) {
+ strcpy(temp_buff, p);
+ if (strchr(temp_buff, '%')) {
+ HTUnEscape(temp_buff);
+ }
+ str_sjis(sjis_buff, temp_buff);
+ SetConsoleTitle(string_short(sjis_buff, 10));
+ }
+ }
+ } else {
+ if (strlen(curdoc.address) < 1000) {
+ if (user_mode == ADVANCED_MODE) {
+ str_sjis(temp_buff, curdoc.title);
+ } else {
+ strcpy(temp_buff, curdoc.address);
+ }
+ set_ws_title(HTUnEscape(temp_buff));
+ }
+ }
+#endif /* SH_EX */
+
/*
* Report unread or new mail, if appropriate.
*/
@@ -1749,6 +1927,11 @@ new_keyboard_input:
} /* right link not NULL or link to another site*/
} /* traversal */
+#ifdef WIN_EX
+ if (c == DO_NOTHING)
+ cmd = LYK_DO_NOTHING;
+ else
+#endif
cmd = LKC_TO_LAC(keymap,c); /* adds 1 to map EOF to 0 */
#if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE)
@@ -1778,9 +1961,9 @@ new_cmd: /*
show_main_statusline(links[curdoc.link]);
else if (more)
- _statusline(MOREHELP);
+ HTInfoMsg(MOREHELP);
else
- _statusline(HELP);
+ HTInfoMsg(HELP);
show_help = TRUE;
if (TRACE) {
@@ -2071,6 +2254,18 @@ new_cmd: /*
LYforce_no_cache = TRUE;
break;
+#ifdef SH_EX /* 1999/01/01 (Fri) */
+ case LYK_CHG_CENTER: /* ^Q */
+
+ if (no_table_center) {
+ no_table_center = FALSE;
+ HTInfoMsg("TABLE center enable.");
+ } else {
+ no_table_center = TRUE;
+ HTInfoMsg("TABLE center disable.");
+ }
+ /* goto RELOAD */
+#endif
case LYK_RELOAD: /* control-R to reload and refresh */
/*
* Check if this is a reply from a POST, and if so,
@@ -2448,6 +2643,43 @@ new_cmd: /*
}
break;
+#if defined(SH_EX) && defined(DOSPATH) /*1997/12/22 (Mon) 09:28:56 */
+ case LYK_TO_CLIPBOARD: /* ^S */
+ {
+ if (put_clip(links[curdoc.link].lname) == 0) {
+ HTInfoMsg("URL to Clip Borad.");
+ } else {
+ HTInfoMsg("Current URL is empty.");
+ }
+ }
+ break;
+#endif
+
+#if defined(CJK_EX) && defined(SH_EX) /* 1999/02/25 (Thu) 15:29:05 */
+ case LYK_CHG_KCODE: /* ^L */
+ if (LYRawMode && (HTCJK == JAPANESE)) {
+ switch(last_kcode) {
+ case NOKANJI:
+ last_kcode = SJIS;
+ break;
+ case SJIS:
+ last_kcode = EUC;
+ break;
+ case EUC:
+ last_kcode = NOKANJI;
+ break;
+ default:
+ break;
+ }
+ }
+ move(0, 0);
+ lynx_start_title_color ();
+ addstr(str_kcode(last_kcode));
+ lynx_stop_title_color ();
+
+ break;
+#endif
+
case LYK_REFRESH:
refresh_screen = TRUE;
lynx_force_repaint();
@@ -3045,7 +3277,7 @@ new_cmd: /*
}
} /* fall through to LYK_ACTIVATE */
- case LYK_ACTIVATE: /* follow a link */
+ case LYK_ACTIVATE: /* follow a link */
case LYK_SUBMIT: /* follow a link, submit TEXT_SUBMIT input */
if (do_change_link(prev_target) == -1) {
LYforce_no_cache = FALSE;
@@ -3739,6 +3971,37 @@ new_cmd: /*
}
check_recall:
+#ifdef WIN_EX /* 1998/10/11 (Sun) 10:41:05 */
+ {
+ int len;
+ char last_2, last_1, last;
+
+ len = strlen(user_input_buffer);
+
+ if (len >= 3) {
+
+ last_2 = user_input_buffer[len - 3];
+ last_1 = user_input_buffer[len - 2];
+ last = user_input_buffer[len - 1];
+
+ if (last_2 == '/' && isalpha(last_1) && last == ':')
+ LYAddHtmlSep0(user_input_buffer);
+
+ } else if (len == 2) {
+ if (user_input_buffer[1] == ':') {
+ if (isalpha(user_input_buffer[0]))
+ LYAddHtmlSep0(user_input_buffer);
+ else {
+ HTUserMsg2(WWW_ILLEGAL_URL_MESSAGE,
+ user_input_buffer);
+ strcpy(user_input_buffer, temp);
+ FREE(temp);
+ break;
+ }
+ }
+ }
+ }
+#endif
/*
* Get rid of leading spaces (and any other spaces).
*/
@@ -4042,6 +4305,11 @@ check_goto_URL:
}
} else {
+#ifdef CJK_EX /* 1997/12/13 (Sat) 15:20:18 */
+ if (HTCJK == JAPANESE) {
+ last_kcode = NOKANJI; /* AUTO */
+ }
+#endif
StrAllocCopy(newdoc.address, indexfile);
StrAllocCopy(newdoc.title, gettext("System Index")); /* name it */
FREE(newdoc.post_data);
@@ -4596,6 +4864,15 @@ if (!LYUseFormsOptions) {
}
/*
+ * If we're in a forms TEXTAREA, invoke the editor on it.
+ */
+ if (links[curdoc.link].type == WWW_FORM_LINK_TYPE &&
+ links[curdoc.link].form->type == F_TEXTAREA_TYPE) {
+ cmd = LYK_EDIT_TEXTAREA;
+ goto new_cmd;
+ }
+
+ /*
* If we're in a forms TEXT type, tell user the request
* is bogus (though in reality, without this trap, if the
* document with the TEXT field is local, the editor *would*
@@ -5389,6 +5666,11 @@ check_add_bookmark_to_self:
refresh_screen = TRUE;
break;
}
+#if defined(CJK_EX) /* 1997/12/13 (Sat) 15:20:18 */
+ if (HTCJK == JAPANESE) {
+ last_kcode = NOKANJI; /* AUTO */
+ }
+#endif
LYforce_no_cache = TRUE; /*force the document to be reloaded*/
StrAllocCopy(newdoc.title, BOOKMARK_TITLE);
StrAllocCopy(newdoc.bookmark, BookmarkPage);
@@ -5409,11 +5691,15 @@ check_add_bookmark_to_self:
}
break;
- case LYK_SHELL: /* shell escape */
+ case LYK_SHELL: /* (!) shell escape */
if (!no_shell) {
stop_curses();
printf("%s\r\n", SPAWNING_MSG);
+#if defined(__CYGWIN_) && defined(DOSPATH)
+ Cygwin_Shell();
+#else
LYSystem(LYSysShell());
+#endif
start_curses();
refresh_screen = TRUE; /* for an HText_pageDisplay() */
} else {
@@ -6409,9 +6695,9 @@ PRIVATE void show_main_statusline ARGS1(
_statusline(buf);
} else if (more) {
if (user_mode == NOVICE_MODE)
- _statusline(MORE);
+ _statusline(MORE);
else
- _statusline(MOREHELP);
+ _statusline(MOREHELP);
} else {
_statusline(HELP);
}
diff --git a/src/LYNews.c b/src/LYNews.c
index 1b27f644..538f1287 100644
--- a/src/LYNews.c
+++ b/src/LYNews.c
@@ -25,6 +25,10 @@
BOOLEAN term_message = FALSE;
PRIVATE void terminate_message PARAMS((int sig));
+#ifdef CJK_EX /* 1998/05/15 (Fri) 09:10:38 */
+extern HTCJKlang HTCJK;
+#endif
+
PRIVATE BOOLEAN message_has_content ARGS1(
CONST char *, filename)
{
@@ -213,6 +217,23 @@ PUBLIC char *LYNewsPost ARGS2(
* Add the default subject.
*/
kp = LYSkipCBlanks(kp);
+#ifdef CJK_EX /* 1998/05/15 (Fri) 09:10:38 */
+ if (HTCJK == JAPANESE) {
+ CJKinput[0] = '\0';
+ switch(kanji_code) {
+ case EUC:
+ TO_EUC(kp, CJKinput);
+ kp = CJKinput;
+ break;
+ case SJIS:
+ TO_SJIS(kp, CJKinput);
+ kp = CJKinput;
+ break;
+ default:
+ break;
+ }
+ }
+#endif
if (strncasecomp(kp, "Re:", 3)) {
strcat(user_input, "Re: ");
}
@@ -238,8 +259,9 @@ PUBLIC char *LYNewsPost ARGS2(
} else if (((org = getenv("NEWS_ORGANIZATION")) != NULL) &&
*org != '\0') {
StrAllocCat(cp, org);
-#ifndef VMS
- } else if ((fp = fopen("/etc/organization", "r")) != NULL) {
+ }
+#ifdef UNIX
+ else if ((fp = fopen("/etc/organization", "r")) != NULL) {
char *buffer = 0;
if (LYSafeGets(&buffer, fp) != NULL) {
if ((org = strchr(buffer, '\n')) != NULL) {
@@ -251,8 +273,31 @@ PUBLIC char *LYNewsPost ARGS2(
}
FREE(buffer);
fclose(fp);
-#endif /* !VMS */
}
+#else
+#ifdef _WINDOWS /* 1998/05/14 (Thu) 17:47:01 */
+ else {
+ char *p, fname[256];
+
+ strcpy(fname, LynxSigFile);
+ p = strrchr(fname, '/');
+ if (p) {
+ strcpy(p + 1, "LYNX_ETC.TXT");
+ if ((fp = fopen(fname, TXT_R)) != NULL) {
+ if (fgets(user_input, sizeof(user_input), fp) != NULL) {
+ if ((org = strchr(user_input, '\n')) != NULL) {
+ *org = '\0';
+ }
+ if (user_input[0] != '\0') {
+ StrAllocCat(cp, user_input);
+ }
+ }
+ fclose(fp);
+ }
+ }
+ }
+#endif /* _WINDOWS */
+#endif /* !UNIX */
LYstrncpy(user_input, cp, (sizeof(user_input) - 16));
FREE(cp);
addstr(gettext("\n\n Please provide or edit the Organization: header\n"));
@@ -375,7 +420,7 @@ PUBLIC char *LYNewsPost ARGS2(
clear(); /* clear the screen */
goto cleanup;
}
- if ((LynxSigFile != NULL) && (fp = fopen(LynxSigFile, "r")) != NULL) {
+ if ((LynxSigFile != NULL) && (fp = fopen(LynxSigFile, TXT_R)) != NULL) {
char *msg = NULL;
HTSprintf0(&msg, APPEND_SIG_FILE, LynxSigFile);
@@ -406,7 +451,7 @@ PUBLIC char *LYNewsPost ARGS2(
* use the temp file as is. - FM
*/
if (CJKfile[0] != '\0') {
- if ((fd = fopen(my_tempfile, "r")) != NULL) {
+ if ((fd = fopen(my_tempfile, TXT_R)) != NULL) {
char *buffer = NULL;
while (LYSafeGets(&buffer, fd) != NULL) {
TO_JIS((unsigned char *)buffer,
diff --git a/src/LYOptions.c b/src/LYOptions.c
index 7bc6e1d0..3028c965 100644
--- a/src/LYOptions.c
+++ b/src/LYOptions.c
@@ -1683,15 +1683,15 @@ draw_options:
case '>': /* Save current options to RC file. */
if (!no_option_save) {
- _statusline(SAVING_OPTIONS);
+ HTInfoMsg(SAVING_OPTIONS);
if (save_rc()) {
LYrcShowColor = LYChosenShowColor;
- _statusline(OPTIONS_SAVED);
+ HTInfoMsg(OPTIONS_SAVED);
} else {
HTAlert(OPTIONS_NOT_SAVED);
}
} else {
- _statusline(R_TO_RETURN_TO_LYNX);
+ HTInfoMsg(R_TO_RETURN_TO_LYNX);
/*
* Change response so that we don't exit
* the options menu.
@@ -1706,9 +1706,9 @@ draw_options:
default:
if (!no_option_save) {
- _statusline(SAVE_OR_R_TO_RETURN_TO_LYNX);
+ HTInfoMsg(SAVE_OR_R_TO_RETURN_TO_LYNX);
} else {
- _statusline(R_TO_RETURN_TO_LYNX);
+ HTInfoMsg(R_TO_RETURN_TO_LYNX);
}
} /* end switch */
} /* end while */
@@ -2023,13 +2023,13 @@ draw_bookmark_list:
*/
if (response == '>') {
if (!no_option_save) {
- _statusline(SAVING_OPTIONS);
+ HTInfoMsg(SAVING_OPTIONS);
if (save_rc())
- _statusline(OPTIONS_SAVED);
+ HTInfoMsg(OPTIONS_SAVED);
else
HTAlert(OPTIONS_NOT_SAVED);
} else {
- _statusline(R_TO_RETURN_TO_LYNX);
+ HTInfoMsg(R_TO_RETURN_TO_LYNX);
/*
* Change response so that we don't exit
* the options menu.
@@ -2372,7 +2372,7 @@ PUBLIC int popup_choice ARGS7(
lx = 1;
}
}
-
+
/*
* Set up the overall window, including the boxing characters ('*'),
* if it all fits. Otherwise, set up the widest window possible. - FM
@@ -2393,7 +2393,7 @@ PUBLIC int popup_choice ARGS7(
#ifdef NCURSES
LYsubwindow(form_window);
#endif
-#if defined(HAVE_GETBKGD) /* not defined in ncurses 1.8.7 */
+#if defined(HAVE_GETBKGD) && !defined(PDCURSES)/* not defined in ncurses 1.8.7 */
wbkgd(form_window, getbkgd(stdscr));
wbkgdset(form_window, getbkgd(stdscr));
#endif
@@ -2525,9 +2525,17 @@ redraw:
#else
wmove(form_window, ((i + 1) - window_offset), 2);
waddstr(form_window, Cnum);
+#if defined(WIN_EX) /* 1997/10/18 (Sat) 00:10:51 */
+ wattron(form_window, A_REVERSE);
+#else
wstart_reverse(form_window);
+#endif
waddstr(form_window, Cptr[i]);
+#if defined(WIN_EX) /* 1997/10/18 (Sat) 00:10:58 */
+ wattroff(form_window, A_REVERSE);
+#else
wstop_reverse(form_window);
+#endif
/*
* If LYShowCursor is ON, move the cursor to the left
* of the current choice, so that blind users, who are
@@ -3267,7 +3275,7 @@ static char * keypad_mode_string = "keypad_mode";
static OptValues keypad_mode_values[] = {
{ NUMBERS_AS_ARROWS, "Numbers act as arrows", "number_arrows" },
{ LINKS_ARE_NUMBERED, "Links are numbered", "links_numbered" },
- { LINKS_AND_FORM_FIELDS_ARE_NUMBERED,
+ { LINKS_AND_FIELDS_ARE_NUMBERED,
"Links and form fields are numbered",
"links_and_forms" },
{ 0, 0, 0 }};
@@ -3299,12 +3307,14 @@ static char * vi_keys_string = "vi_keys";
/*
* Document Layout
*/
+#ifndef SH_EX /* 1999/01/19 (Tue) */
static char * DTD_recovery_string = "DTD";
static OptValues DTD_type_values[] = {
/* Old_DTD variable */
{ TRUE, "relaxed (TagSoup mode)", "tagsoup" },
{ FALSE, "strict (SortaSGML mode)", "sortasgml" },
{ 0, 0, 0 }};
+#endif
static char * select_popups_string = "select_popups";
static char * images_string = "images";
static char * images_ignore_all_string = "ignore";
@@ -3690,6 +3700,7 @@ PUBLIC int postoptions ARGS1(
case_sensitive = code;
}
+#ifndef SH_EX /* 1999/01/19 (Tue) */
/* HTML error tolerance: SELECT */
if (!strcmp(data[i].tag, DTD_recovery_string)
&& GetOptValues(DTD_type_values, data[i].value, &code)) {
@@ -3699,6 +3710,7 @@ PUBLIC int postoptions ARGS1(
need_reload = TRUE;
}
}
+#endif
/* Select Popups: ON/OFF */
if (!strcmp(data[i].tag, select_popups_string)
@@ -3895,7 +3907,7 @@ PUBLIC int postoptions ARGS1(
/*
* charset settings: the order is essential here.
*/
- if (display_char_set_old != current_char_set) {
+ if (display_char_set_old != current_char_set) {
/*
* Set the LYUseDefaultRawMode value and character
* handling if LYRawMode was changed. - FM
@@ -3906,7 +3918,7 @@ PUBLIC int postoptions ARGS1(
if (assume_char_set_changed) {
LYRawMode = (UCLYhndl_for_unspec == current_char_set);
}
- if (raw_mode_old != LYRawMode || assume_char_set_changed) {
+ if (raw_mode_old != LYRawMode || assume_char_set_changed) {
/*
* Set the raw 8-bit or CJK mode defaults and
* character set if changed. - FM
@@ -3924,10 +3936,10 @@ PUBLIC int postoptions ARGS1(
FREE(newdoc->post_data);
FREE(data);
if (save_all) {
- _statusline(SAVING_OPTIONS);
+ HTInfoMsg(SAVING_OPTIONS);
if (save_rc()) {
LYrcShowColor = LYChosenShowColor;
- _statusline(OPTIONS_SAVED);
+ HTInfoMsg(OPTIONS_SAVED);
} else {
HTAlert(OPTIONS_NOT_SAVED);
}
@@ -3941,7 +3953,7 @@ PUBLIC int postoptions ARGS1(
CTRACE(tfp, " need_reload = %s\n",
need_reload ? "TRUE" : "FALSE");
CTRACE(tfp, " need_end_reload = %s\n",
- need_end_reload ? "TRUE" : "FALSE");
+ need_end_reload ? "TRUE" : "FALSE");
/* Options menu was pushed before postoptions(), so pop-up. */
LYpop(newdoc);
@@ -4344,11 +4356,13 @@ PRIVATE int gen_options ARGS1(
PutOptValues(fp0, LYRawMode, bool_values);
EndSelect(fp0);
+#ifndef SH_EX /* 1999/01/19 (Tue) */
/* HTML error recovery: SELECT */
PutLabel(fp0, gettext("HTML error recovery"));
BeginSelect(fp0, DTD_recovery_string);
PutOptValues(fp0, Old_DTD, DTD_type_values);
EndSelect(fp0);
+#endif
/* Select Popups: ON/OFF */
PutLabel(fp0, gettext("Popups for select fields"));
diff --git a/src/LYPrint.c b/src/LYPrint.c
index 489e88ae..9a80ede4 100644
--- a/src/LYPrint.c
+++ b/src/LYPrint.c
@@ -21,6 +21,10 @@
#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
@@ -362,7 +366,7 @@ check_recall:
*/
CTRACE(tfp, "LYPrint: filename is %s, action is `%c'\n", buffer, c);
-#if HAVE_POPEN
+#if HAVE_POPEN || !defined(__CYGWIN__)
if (*buffer == '|') {
if (no_shell) {
HTUserMsg(SPAWNING_DISABLED);
@@ -435,11 +439,11 @@ check_recall:
}
}
- print_wwwfile_to_fd(outfile_fp,0);
+ print_wwwfile_to_fd(outfile_fp, 0); /* FILE */
if (keypad_mode)
printlist(outfile_fp,FALSE);
-#if HAVE_POPEN
+#if HAVE_POPEN || !defined(__CYGWIN__)
if (LYIsPipeCommand(buffer))
pclose(outfile_fp);
else
@@ -476,7 +480,7 @@ PRIVATE void send_file_to_mail ARGS3(
char hdrfile[LY_MAXPATH];
char my_temp[LY_MAXPATH];
#endif
-#ifdef DOSPATH
+#if defined(DOSPATH) || defined(WIN_EX)
char my_temp[LY_MAXPATH];
#endif
@@ -615,11 +619,12 @@ PRIVATE void send_file_to_mail ARGS3(
} else if (!isPMDF) {
fprintf(outfile_fp, "X-URL: %s\n\n", newdoc->address);
}
- print_wwwfile_to_fd(outfile_fp, 0);
+ print_wwwfile_to_fd(outfile_fp, 0); /* MAIL */
if (keypad_mode)
printlist(outfile_fp, FALSE);
LYCloseTempFP(outfile_fp);
+ buffer = NULL;
if (isPMDF) {
/*
* For PMDF, put the subject in the header file and close it. - FM
@@ -651,6 +656,9 @@ PRIVATE void send_file_to_mail ARGS3(
}
stop_curses();
+#ifdef SH_EX
+ SetOutputMode(O_TEXT);
+#endif
printf(MAILING_FILE);
LYSystem(buffer);
sleep(AlertSecs);
@@ -658,9 +666,9 @@ PRIVATE void send_file_to_mail ARGS3(
if (isPMDF)
LYRemoveTemp(hdrfile);
LYRemoveTemp(my_temp);
-#else /* Unix or DOS */
+#else /* !VMS (Unix or DOS) */
-#ifdef DOSPATH
+#if defined(DOSPATH) || defined(WIN_EX)
outfile_fp = LYOpenTemp(my_temp, ".txt", "w");
#else
HTSprintf0(&buffer, "%s %s", system_mail, system_mail_flags);
@@ -758,25 +766,37 @@ PRIVATE void send_file_to_mail ARGS3(
"<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n\n",
newdoc->address, content_base);
}
- print_wwwfile_to_fd(outfile_fp, 0);
+ print_wwwfile_to_fd(outfile_fp, 0); /* MAIL */
if (keypad_mode)
printlist(outfile_fp, FALSE);
-#ifdef DOSPATH
- HTSprintf0(&buffer, "%s -t \"%s\" -F %s", system_mail, user_response, my_temp);
+#if defined(WIN_EX) /* 1998/08/17 (Mon) 16:29:49 */
+ buffer = NULL;
+ if (mail_is_blat)
+ HTSprintf0(&buffer, "%s %s -t \"%s\"",
+ system_mail, my_temp, user_response);
+ else
+ HTSprintf0(&buffer, "%s -t \"%s\" -F %s",
+ system_mail, user_response, my_temp);
LYCloseTempFP(outfile_fp); /* Close the tmpfile. */
stop_curses();
+#ifdef SH_EX
+ SetOutputMode(O_TEXT);
+#endif
printf("%s\n\n$ %s\n\n%s", gettext("Sending"), buffer, PLEASE_WAIT);
LYSystem(buffer);
sleep(MessageSecs);
start_curses();
+#ifdef SH_EX
+ SetOutputMode( O_BINARY );
+#endif
LYRemoveTemp(my_temp); /* Delete the tmpfile. */
#else
pclose(outfile_fp);
#endif
#endif /* VMS */
-done:
+done: /* send_file_to_mail() */
FREE(buffer);
FREE(subject);
return;
@@ -816,7 +836,7 @@ PRIVATE void send_file_to_printer ARGS4(
"<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n\n",
newdoc->address, content_base);
}
- print_wwwfile_to_fd(outfile_fp, 0);
+ print_wwwfile_to_fd(outfile_fp, 0); /* PRINTER */
if (keypad_mode)
printlist(outfile_fp, FALSE);
@@ -877,17 +897,34 @@ check_again:
if (!strncasecomp(my_file, "nl:", 3) ||
!strncasecomp(my_file, "/nl/", 4))
#else
+#if defined(DOSPATH) /* 1997/10/15 (Wed) 16:41:30 */
+ if (!strcmp(my_file, "nul"))
+#else
if (!strcmp(my_file, "/dev/null"))
+#endif /* DOSPATH */
#endif /* VMS */
{
CancelPrint(PRINT_REQUEST_CANCELLED);
}
HTAddSugFilename(my_file);
}
+#ifdef SH_EX /* 1999/01/04 (Mon) 09:37:03 */
+ else {
+ my_file[0] = '\0';
+ }
HTAddParam (&the_command, cur_printer->command, 1, my_temp);
+ if (my_file[0]) {
+ HTAddParam (&the_command, cur_printer->command, 2, my_file);
+ HTEndParam (&the_command, cur_printer->command, 3);
+ } else {
+ HTEndParam (&the_command, cur_printer->command, 2);
+ }
+#else
+ HTAddParam (&the_command, cur_printer->command, 1, my_temp);
HTAddParam (&the_command, cur_printer->command, 2, my_file);
HTEndParam (&the_command, cur_printer->command, 2);
+#endif
/*
* Move the cursor to the top of the screen so that output from system'd
@@ -897,6 +934,9 @@ check_again:
stop_curses();
CTRACE(tfp, "command: %s\n", the_command);
+#ifdef SH_EX
+ SetOutputMode( O_TEXT );
+#endif
printf(PRINTING_FILE);
/*
* Set various bits of document information as environment variables, for
@@ -926,10 +966,15 @@ check_again:
#ifndef VMS
signal(SIGINT, cleanup_sig);
#endif /* !VMS */
+#ifdef SH_EX
+ fprintf(stdout," Print job complite.\n");
+ fflush(stdout);
+ SetOutputMode( O_BINARY );
+#endif
sleep(MessageSecs);
start_curses();
-done:
+done: /* send_file_to_printer() */
return;
}
@@ -955,6 +1000,10 @@ PRIVATE void send_file_to_screen ARGS3(
outfile_fp = stdout;
stop_curses();
+#ifdef SH_EX
+ SetOutputMode( O_TEXT );
+#endif
+
#ifndef VMS
signal(SIGINT, SIG_IGN);
#endif /* !VMS */
@@ -972,7 +1021,7 @@ PRIVATE void send_file_to_screen ARGS3(
}
if (Lpansi)
printf("\033[5i");
- print_wwwfile_to_fd(outfile_fp, 0);
+ print_wwwfile_to_fd(outfile_fp, 0); /* SCREEN */
if (keypad_mode)
printlist(outfile_fp, FALSE);
@@ -996,9 +1045,13 @@ PRIVATE void send_file_to_screen ARGS3(
HadVMSInterrupt = FALSE;
#endif /* VMS */
}
+#ifdef SH_EX
+ fprintf(stdout,"\n");
+ SetOutputMode( O_BINARY );
+#endif
start_curses();
-done:
+done: /* send_file_to_screen() */
return;
}
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c
index 5a535ffc..68c5450c 100644
--- a/src/LYReadCFG.c
+++ b/src/LYReadCFG.c
@@ -332,7 +332,7 @@ static CONST char *Color_Strings[16] =
"white"
};
-#ifdef DOSPATH
+#if defined(DOSPATH) || defined(WIN_EX)
/*
* PDCurses (and possibly some other implementations) use a non-ANSI set of
* codes for colors.
@@ -898,7 +898,7 @@ static int viewer_fun ARGS1(
}
static int nonrest_sigwinch_fun ARGS1(
- char *, value)
+ char *, value)
{
if (!strncasecomp(value, "XWINDOWS", 8)) {
LYNonRestartingSIGWINCH = (LYgetXDisplay() != NULL);
@@ -957,8 +957,13 @@ static int parse_html_src_spec ARGS3(
return 0;
}
+#ifdef __STDC__
#define defHTSRC_parse_fun(x) static int html_src_set_##x ARGS1( char*,str) \
{ parse_html_src_spec(HTL_##x,str,#x); return 0; }
+#else
+#define defHTSRC_parse_fun(x) static int html_src_set_/**/x ARGS1( char*,str) \
+ { parse_html_src_spec(HTL_/**/x,str,"x"); return 0; }
+#endif
defHTSRC_parse_fun(comm)
defHTSRC_parse_fun(tag)
@@ -1006,8 +1011,14 @@ static int read_htmlsrc_tagname_xform ARGS1( char*,str)
}
+#ifdef __STDC__
#define defHTSRC_option(x) \
PARSE_FUN( "htmlsrc_" #x ,CONF_FUN, html_src_set_##x),
+#else
+#define defHTSRC_option(x) \
+ PARSE_FUN( "htmlsrc_" #x ,CONF_FUN, html_src_set_/**/x),
+ /* ^^ (cannot adapt to K&R) */
+#endif
#endif
@@ -1066,7 +1077,13 @@ static Config_Type Config_Table [] =
PARSE_ADD("external", CONF_ADD_ITEM, externals),
#endif
PARSE_ENV("finger_proxy", CONF_ENV, 0 ),
+#if defined(_WINDOWS) /* 1998/10/05 (Mon) 17:34:15 */
+ PARSE_SET("focus_window", CONF_BOOL, &focus_window),
+#endif
PARSE_SET("force_8bit_toupper", CONF_BOOL, &UCForce8bitTOUPPER),
+#ifndef NO_EMPTY_HREFLESS_A
+ PARSE_SET("force_empty_hrefless_a", CONF_BOOL, &force_empty_hrefless_a),
+#endif
PARSE_SET("force_ssl_cookies_secure", CONF_BOOL, &LYForceSSLCookiesSecure),
#if !defined(NO_OPTION_FORMS) && !defined(NO_OPTION_MENU)
PARSE_SET("forms_options", CONF_BOOL, &LYUseFormsOptions),
@@ -1079,7 +1096,7 @@ static Config_Type Config_Table [] =
PARSE_STR("helpfile", CONF_STR, &helpfile),
PARSE_SET("historical_comments", CONF_BOOL, &historical_comments),
-#ifdef USE_PSRC
+#if defined(USE_PSRC) && defined(__STDC__)
defHTSRC_option(abracket)
defHTSRC_option(attrib)
@@ -1110,6 +1127,9 @@ static Config_Type Config_Table [] =
PARSE_STR("jump_prompt", CONF_STR, &jumpprompt),
PARSE_SET("jumpbuffer", CONF_BOOL, &jump_buffer),
PARSE_FUN("jumpfile", CONF_FUN, jumpfile_fun),
+#ifdef EXP_JUSTIFY_ELTS
+ PARSE_SET("justify", CONF_BOOL, &ok_justify),
+#endif
#ifdef EXP_KEYBOARD_LAYOUT
PARSE_FUN("keyboard_layout", CONF_FUN, keyboard_layout_fun),
#endif
@@ -1143,7 +1163,7 @@ static Config_Type Config_Table [] =
PARSE_SET("make_pseudo_alts_for_inlines", CONF_BOOL, &pseudo_inline_alts),
PARSE_INT("messagesecs", CONF_INT, &MessageSecs),
PARSE_SET("minimal_comments", CONF_BOOL, &minimal_comments),
- PARSE_SET("multi_bookmark_support", CONF_BOOL, &LYMultiBookmarks),
+ PARSE_INT("multi_bookmark_support", CONF_BOOL, &LYMultiBookmarks),
PARSE_SET("ncr_in_bookmarks", CONF_BOOL, &UCSaveBookmarksInUnicode),
#ifndef DISABLE_NEWS
PARSE_FUN("news_chunk_size", CONF_FUN, news_chunk_size_fun),
@@ -1155,6 +1175,9 @@ static Config_Type Config_Table [] =
PARSE_ENV("nntp_proxy", CONF_ENV, 0),
PARSE_ENV("nntpserver", CONF_ENV2, 0), /* actually NNTPSERVER */
#endif
+#ifdef SH_EX
+ PARSE_SET("no_table_center", CONF_BOOL, &no_table_center),
+#endif
PARSE_SET("no_dot_files", CONF_BOOL, &no_dotfiles),
PARSE_SET("no_file_referer", CONF_BOOL, &no_filereferer),
#ifndef VMS
@@ -1208,6 +1231,9 @@ static Config_Type Config_Table [] =
PARSE_STR("system_mail", CONF_STR, &system_mail),
PARSE_STR("system_mail_flags", CONF_STR, &system_mail_flags),
PARSE_SET("tagsoup", CONF_BOOL, &Old_DTD),
+#if defined(_WINDOWS)
+ PARSE_INT("timeout", CONF_INT, &lynx_timeout),
+#endif
#ifdef EXEC_LINKS
PARSE_DEF("trusted_exec", CONF_ADD_TRUSTED, EXEC_PATH),
#endif
@@ -1262,7 +1288,7 @@ PUBLIC void free_lynx_cfg NOARGS
unsetenv(name);
# else
if (putenv(name))
- break;
+ break;
# endif
#endif
}
@@ -1355,7 +1381,7 @@ PRIVATE void do_read_cfg ARGS5(
strcat(mypath, cfg_filename+1);
cfg_filename = mypath;
}
- if ((fp = fopen(cfg_filename,"r")) == 0) {
+ if ((fp = fopen(cfg_filename, TXT_R)) == 0) {
CTRACE(tfp,"lynx.cfg file not found as %s\n",cfg_filename);
return;
}
@@ -1364,6 +1390,13 @@ PRIVATE void do_read_cfg ARGS5(
/*
* Process each line in the file.
*/
+#ifdef SH_EX
+ if (show_cfg) {
+ time_t t;
+ time(&t);
+ printf("### Lynx %s, at %s", LYNX_VERSION, ctime(&t));
+ }
+#endif
while (LYSafeGets(&buffer, fp) != 0) {
char *name, *value;
char *cp;
@@ -1415,6 +1448,10 @@ PRIVATE void do_read_cfg ARGS5(
/* lynx ignores unknown keywords */
continue;
}
+#ifdef SH_EX
+ if (show_cfg)
+ printf("%s:%s\n", name, value);
+#endif
if ( allowed && (*allowed)[ tbl-Config_Table ] ) {
if (fp0 == NULL)
@@ -1484,7 +1521,7 @@ PRIVATE void do_read_cfg ARGS5(
case CONF_INCLUDE: {
/* include another file */
- optidx_set_t cur_set,anded_set;
+ optidx_set_t cur_set, anded_set;
optidx_set_t* resultant_set = NULL;
char* p1, *p2, savechar;
BOOL any_optname_found = FALSE;
@@ -1558,10 +1595,10 @@ PRIVATE void do_read_cfg ARGS5(
}
#ifndef NO_CONFIG_INFO
- /*
+ /*
* Now list the opts that are allowed in included file. If all
* opts are allowed, then emit nothing, else emit an effective set
- * of allowed options in <ul>. Option names will be uppercased.
+ * of allowed options in <ul>. Option names will be uppercased.
* FIXME: uppercasing option names can be considered redundant.
*/
if (fp0 != 0 && !no_lynxcfg_xinfo && resultant_set) {
diff --git a/src/LYStrings.c b/src/LYStrings.c
index 01981de5..a26e4c58 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -32,6 +32,14 @@ extern unsigned short *LYKbLayout;
extern BOOL HTPassHighCtrlRaw;
extern HTCJKlang HTCJK;
+#ifdef SUPPORT_MULTIBYTE_EDIT
+#define IS_KANA(c) (0xa0 <= c && c <= 0xdf)
+#endif
+
+#if defined(WIN_EX)
+#define BUTTON_CTRL 0 /* Quick hack */
+#endif
+
/*Allowing the user to press tab when entering URL to get the closest
match in the closet*/
#define LYClosetSize 100
@@ -59,14 +67,14 @@ static int mouse_link = -1;
static int have_levent;
-#ifdef NCURSES_MOUSE_VERSION
+#if defined(NCURSES_MOUSE_VERSION) && !defined(WIN_EX)
static MEVENT levent;
#endif
/* Return the value of mouse_link */
PUBLIC int peek_mouse_levent NOARGS
{
-#ifdef NCURSES_MOUSE_VERSION
+#if defined(NCURSES_MOUSE_VERSION) && !defined(WIN_EX)
if (have_levent > 0) {
ungetmouse(&levent);
have_levent--;
@@ -99,13 +107,70 @@ PUBLIC int fancy_mouse ARGS3(
int *, position)
{
int cmd = LYK_DO_NOTHING;
-#ifdef NCURSES_MOUSE_VERSION
+#if defined(NCURSES_MOUSE_VERSION)
#ifndef getbegx
#define getbegx(win) ((win)->_begx)
#endif
#ifndef getbegy
#define getbegy(win) ((win)->_begy)
#endif
+
+#if defined(WIN_EX) /* 1998/12/05 (Sat) 08:10:42 */
+
+ request_mouse_pos();
+
+ if (BUTTON_STATUS(1)
+ && (MOUSE_X_POS >= getbegx(win)
+ && (MOUSE_X_POS < (getbegx(win) + getmaxx(win))))) {
+ int mypos = MOUSE_Y_POS - getbegy(win);
+ int delta = mypos - row;
+
+ if (mypos+1 == getmaxy(win)) {
+ /* At the decorative border: scroll forward */
+ if (BUTTON_STATUS(1) & BUTTON1_TRIPLE_CLICKED)
+ cmd = LYK_END;
+ else if (BUTTON_STATUS(1) & BUTTON1_DOUBLE_CLICKED)
+ cmd = LYK_NEXT_PAGE;
+ else
+ cmd = LYK_NEXT_LINK;
+ } else if (mypos >= getmaxy(win)) {
+ if (BUTTON_STATUS(1) & (BUTTON1_DOUBLE_CLICKED | BUTTON1_TRIPLE_CLICKED))
+ cmd = LYK_END;
+ else
+ cmd = LYK_NEXT_PAGE;
+ } else if (mypos == 0) {
+ /* At the decorative border: scroll back */
+ if (BUTTON_STATUS(1) & BUTTON1_TRIPLE_CLICKED)
+ cmd = LYK_HOME;
+ else if (BUTTON_STATUS(1) & BUTTON1_DOUBLE_CLICKED)
+ cmd = LYK_PREV_PAGE;
+ else
+ cmd = LYK_PREV_LINK;
+ } else if (mypos < 0) {
+ if (BUTTON_STATUS(1) & (BUTTON1_DOUBLE_CLICKED | BUTTON1_TRIPLE_CLICKED))
+ cmd = LYK_HOME;
+ else
+ cmd = LYK_PREV_PAGE;
+#ifdef KNOW_HOW_TO_TOGGLE
+ } else if (BUTTON_STATUS(1) & (BUTTON_CTRL)) {
+ cur_selection += delta;
+ cmd = LYX_TOGGLE;
+#endif
+ } else if (BUTTON_STATUS(1) & (BUTTON_ALT | BUTTON_SHIFT | BUTTON_CTRL)) {
+ /* Probably some unrelated activity, such as selecting some text.
+ * Select, but do nothing else.
+ */
+ *position += delta;
+ cmd = -1;
+ } else {
+ /* No scrolling or overflow checks necessary. */
+ *position += delta;
+ cmd = LYK_ACTIVATE;
+ }
+ } else if (BUTTON_STATUS(1) & (BUTTON3_CLICKED | BUTTON3_DOUBLE_CLICKED | BUTTON3_TRIPLE_CLICKED)) {
+ cmd = LYK_QUIT;
+ }
+#else
MEVENT event;
getmouse(&event);
@@ -186,6 +251,7 @@ PUBLIC int fancy_mouse ARGS3(
} else if (event.bstate & (BUTTON3_CLICKED | BUTTON3_DOUBLE_CLICKED | BUTTON3_TRIPLE_CLICKED)) {
cmd = LYK_QUIT;
}
+#endif /* _WINDOWS */
#endif
return cmd;
}
@@ -518,8 +584,10 @@ PRIVATE WINDOW *my_subwindow;
PUBLIC void LYsubwindow ARGS1(WINDOW *, param)
{
+#if !defined(WIN_EX)
if ((my_subwindow = param) != 0)
keypad(param, TRUE);
+#endif
}
#endif
@@ -614,11 +682,18 @@ static SLKeyMap_List_Type *Keymap_List;
* the CSI logic and other special cases for VMS, NCSA telnet, etc.
*/
#ifdef USE_SLANG
-#define DEFINE_KEY(string,lynx,curses) {string,lynx}
+# ifdef VMS
+# define EXTERN_KEY(string,string1,lynx,curses) {string,lynx}
+# else
+# define EXTERN_KEY(string,string1,lynx,curses) {string1,lynx}
+# endif
+# define INTERN_KEY(string,lynx,curses) {string,lynx}
#else
-#define DEFINE_KEY(string,lynx,curses) {string,curses}
+#define INTERN_KEY(string,lynx,curses) {string,curses}
+#define EXTERN_KEY(string,string1,lynx,curses) {string,curses}
#endif
+
typedef struct
{
char *string;
@@ -628,22 +703,22 @@ Keysym_String_List;
static Keysym_String_List Keysym_Strings [] =
{
- DEFINE_KEY( "UPARROW", UPARROW, KEY_UP ),
- DEFINE_KEY( "DNARROW", DNARROW, KEY_DOWN ),
- DEFINE_KEY( "RTARROW", RTARROW, KEY_RIGHT ),
- DEFINE_KEY( "LTARROW", LTARROW, KEY_LEFT ),
- DEFINE_KEY( "PGDOWN", PGDOWN, KEY_NPAGE ),
- DEFINE_KEY( "PGUP", PGUP, KEY_PPAGE ),
- DEFINE_KEY( "HOME", HOME, KEY_HOME ),
- DEFINE_KEY( "END", END_KEY, KEY_END ),
- DEFINE_KEY( "F1", F1, KEY_F(1) ),
- DEFINE_KEY( "DO_KEY", DO_KEY, KEY_F(16) ),
- DEFINE_KEY( "FIND_KEY", FIND_KEY, KEY_FIND ),
- DEFINE_KEY( "SELECT_KEY", SELECT_KEY, KEY_SELECT ),
- DEFINE_KEY( "INSERT_KEY", INSERT_KEY, KEY_IC ),
- DEFINE_KEY( "REMOVE_KEY", REMOVE_KEY, KEY_DC ),
- DEFINE_KEY( "DO_NOTHING", DO_NOTHING, DO_NOTHING|LKC_ISLKC ),
- DEFINE_KEY( NULL, -1, ERR )
+ INTERN_KEY( "UPARROW", UPARROW, KEY_UP ),
+ INTERN_KEY( "DNARROW", DNARROW, KEY_DOWN ),
+ INTERN_KEY( "RTARROW", RTARROW, KEY_RIGHT ),
+ INTERN_KEY( "LTARROW", LTARROW, KEY_LEFT ),
+ INTERN_KEY( "PGDOWN", PGDOWN, KEY_NPAGE ),
+ INTERN_KEY( "PGUP", PGUP, KEY_PPAGE ),
+ INTERN_KEY( "HOME", HOME, KEY_HOME ),
+ INTERN_KEY( "END", END_KEY, KEY_END ),
+ INTERN_KEY( "F1", F1, KEY_F(1) ),
+ INTERN_KEY( "DO_KEY", DO_KEY, KEY_F(16) ),
+ INTERN_KEY( "FIND_KEY", FIND_KEY, KEY_FIND ),
+ INTERN_KEY( "SELECT_KEY", SELECT_KEY, KEY_SELECT ),
+ INTERN_KEY( "INSERT_KEY", INSERT_KEY, KEY_IC ),
+ INTERN_KEY( "REMOVE_KEY", REMOVE_KEY, KEY_DC ),
+ INTERN_KEY( "DO_NOTHING", DO_NOTHING, DO_NOTHING|LKC_ISLKC ),
+ INTERN_KEY( NULL, -1, ERR )
};
#ifdef NCURSES_VERSION
@@ -1008,26 +1083,26 @@ PRIVATE int read_keymap_file NOARGS
PRIVATE void setup_vtXXX_keymap NOARGS
{
static Keysym_String_List table[] = {
- DEFINE_KEY( "\033[A", UPARROW, KEY_UP ),
- DEFINE_KEY( "\033OA", UPARROW, KEY_UP ),
- DEFINE_KEY( "\033[B", DNARROW, KEY_DOWN ),
- DEFINE_KEY( "\033OB", DNARROW, KEY_DOWN ),
- DEFINE_KEY( "\033[C", RTARROW, KEY_RIGHT ),
- DEFINE_KEY( "\033OC", RTARROW, KEY_RIGHT ),
- DEFINE_KEY( "\033[D", LTARROW, KEY_LEFT ),
- DEFINE_KEY( "\033OD", LTARROW, KEY_LEFT ),
- DEFINE_KEY( "\033[1~", FIND_KEY, KEY_FIND ),
- DEFINE_KEY( "\033[2~", INSERT_KEY, KEY_IC ),
- DEFINE_KEY( "\033[3~", REMOVE_KEY, KEY_DC ),
- DEFINE_KEY( "\033[4~", SELECT_KEY, KEY_SELECT ),
- DEFINE_KEY( "\033[5~", PGUP, KEY_PPAGE ),
- DEFINE_KEY( "\033[6~", PGDOWN, KEY_NPAGE ),
- DEFINE_KEY( "\033[8~", END_KEY, KEY_END ),
- DEFINE_KEY( "\033[7~", HOME, KEY_HOME),
- DEFINE_KEY( "\033[28~", F1, KEY_F(1) ),
- DEFINE_KEY( "\033OP", F1, KEY_F(1) ),
- DEFINE_KEY( "\033[OP", F1, KEY_F(1) ),
- DEFINE_KEY( "\033[29~", DO_KEY, KEY_F(16) ),
+ EXTERN_KEY( "\033[A", "^(ku)", UPARROW, KEY_UP ),
+ EXTERN_KEY( "\033OA", "^(ku)", UPARROW, KEY_UP ),
+ EXTERN_KEY( "\033[B", "^(kd)", DNARROW, KEY_DOWN ),
+ EXTERN_KEY( "\033OB", "^(kd)", DNARROW, KEY_DOWN ),
+ EXTERN_KEY( "\033[C", "^(kr)", RTARROW, KEY_RIGHT ),
+ EXTERN_KEY( "\033OC", "^(kr)", RTARROW, KEY_RIGHT ),
+ EXTERN_KEY( "\033[D", "^(kl)", LTARROW, KEY_LEFT ),
+ EXTERN_KEY( "\033OD", "^(kl)", LTARROW, KEY_LEFT ),
+ EXTERN_KEY( "\033[1~", "^(@0)", FIND_KEY, KEY_FIND ),
+ EXTERN_KEY( "\033[2~", "^(kI)", INSERT_KEY, KEY_IC ),
+ EXTERN_KEY( "\033[3~", "^(kD)", REMOVE_KEY, KEY_DC ),
+ EXTERN_KEY( "\033[4~", "^(*6)", SELECT_KEY, KEY_SELECT ),
+ EXTERN_KEY( "\033[5~", "^(kP)", PGUP, KEY_PPAGE ),
+ EXTERN_KEY( "\033[6~", "^(kN)", PGDOWN, KEY_NPAGE ),
+ EXTERN_KEY( "\033[8~", "^(@7)", END_KEY, KEY_END ),
+ EXTERN_KEY( "\033[7~", "^(kh)", HOME, KEY_HOME),
+ EXTERN_KEY( "\033[28~", "^(k1)", F1, KEY_F(1) ),
+ EXTERN_KEY( "\033OP", "^(k1)", F1, KEY_F(1) ),
+ EXTERN_KEY( "\033[OP", "^(k1)", F1, KEY_F(1) ),
+ EXTERN_KEY( "\033[29~", "^(F6)", DO_KEY, KEY_F(16) ),
};
size_t n;
for (n = 0; n < TABLESIZE(table); n++)
@@ -1040,6 +1115,11 @@ PUBLIC int lynx_initialize_keymaps NOARGS
int i;
char keybuf[2];
+ /* The escape sequences may contain embedded termcap strings. Make
+ * sure the library is initialized for that.
+ */
+ SLtt_get_terminfo();
+
if (NULL == (Keymap_List = SLang_create_keymap ("Lynx", NULL)))
return -1;
@@ -1529,6 +1609,26 @@ re_read:
case KEY_RIGHT: /* ... */
c = RTARROW;
break;
+#if defined(SH_EX) && defined(DOSPATH) /* for NEC PC-9800 1998/08/30 (Sun) 21:50:35 */
+ case KEY_C2:
+ c = DNARROW;
+ break;
+ case KEY_A2:
+ c = UPARROW;
+ break;
+ case KEY_B1:
+ c = LTARROW;
+ break;
+ case KEY_B3:
+ c = RTARROW;
+ break;
+ case PAD0: /* PC-9800 Ins */
+ c = INSERT_KEY;
+ break;
+ case PADSTOP: /* PC-9800 DEL */
+ c = REMOVE_KEY;
+ break;
+#endif /* SH_EX */
case KEY_HOME: /* Home key (upward+left arrow) */
c = HOME;
break;
@@ -1694,7 +1794,7 @@ re_read:
getmouse(&event); /* Completely ignore event - kw */
c = DO_NOTHING;
} else {
-#ifndef DOSPATH
+#if !defined(WIN_EX)
MEVENT event;
int err;
int lac = LYK_UNKNOWN;
@@ -1759,17 +1859,101 @@ re_read:
c = MOUSE_KEY;
}
#else /* pdcurses version */
+
+ /* _WINDOWS 1997/10/18 (Sat) 19:41:59 */
+
+#define H_CMD_AREA 6
+#define HIST_CMD_2 12
+#define V_CMD_AREA 1
+
+ int left,right;
+ extern BOOLEAN system_is_NT;
+ /* yes, I am assuming that my screen will be a certain width. */
+
+ int tick_count;
+ char *p = NULL;
+ char mouse_info[128];
+ static int old_click = 0; /* [m Sec] */
+
+ left = H_CMD_AREA;
+ right = (LYcols - H_CMD_AREA);
c = -1;
mouse_link = -1;
- request_mouse_pos();
- if (BUTTON_STATUS(1) & BUTTON_CLICKED) {
- c = set_clicked_link(MOUSE_X_POS, MOUSE_Y_POS,FOR_PANEL,1);
- } else if (BUTTON_STATUS(3) & BUTTON_CLICKED) {
- c = LAC_TO_LKC(LYK_PREV_DOC);
+
+ if (system_is_NT) {
+ /* for Windows NT */
+ request_mouse_pos();
+
+ if (BUTTON_STATUS(1) & BUTTON_CLICKED) {
+ if (MOUSE_Y_POS > (LYlines - V_CMD_AREA)) {
+ /* Screen BOTTOM */
+ if (MOUSE_X_POS < left) {
+ c = LTARROW; p = "<-";
+ } else if (MOUSE_X_POS < HIST_CMD_2) {
+ c = RTARROW; p = "->";
+ } else if (MOUSE_X_POS > right) {
+ c = 'z'; p = "Cancel";
+ } else {
+ c = PGDOWN; p = "PGDOWN";
+ }
+ } else if (MOUSE_Y_POS < V_CMD_AREA) {
+ /* Screen TOP */
+ if (MOUSE_X_POS < left) {
+ c = LTARROW; p = "<-";
+ } else if (MOUSE_X_POS < HIST_CMD_2) {
+ c = RTARROW; p = "->";
+ } else if (MOUSE_X_POS > right) {
+ c = 'z'; p = "Cancel";
+ } else {
+ c = PGUP; p = "PGUP";
+ }
+ } else {
+ c = set_clicked_link(MOUSE_X_POS, MOUSE_Y_POS, FOR_PANEL);
+ }
+ }
+ } else {
+ /* for Windows 95 */
+ tick_count = GetTickCount();
+
+ /* Guard Mouse button miss click */
+ if ((tick_count - old_click) < 700) {
+ c = DO_NOTHING;
+ break;
+ } else {
+ old_click = tick_count;
+ }
+ request_mouse_pos();
+ if (MOUSE_Y_POS > (LYlines - V_CMD_AREA)) {
+ /* Screen BOTTOM */
+ if (MOUSE_X_POS < left) {
+ c = LTARROW; p = "<-";
+ } else if (MOUSE_X_POS < HIST_CMD_2) {
+ c = RTARROW; p = "->";
+ } else if (MOUSE_X_POS > right) {
+ c = '\b'; p = "History";
+ } else {
+ c = PGDOWN; p = "PGDOWN";
+ }
+ } else if (MOUSE_Y_POS < V_CMD_AREA) {
+ /* Screen TOP */
+ if (MOUSE_X_POS < left) {
+ c = LTARROW; p = "<-";
+ } else if (MOUSE_X_POS < HIST_CMD_2) {
+ c = RTARROW; p = "->";
+ } else if (MOUSE_X_POS > right) {
+ c = 'z'; p = "Cancel";
+ } else {
+ c = PGUP; p = "PGUP";
+ }
+ } else {
+ c = set_clicked_link(MOUSE_X_POS, MOUSE_Y_POS, FOR_PANEL);
+ }
}
-#endif /* DOSPATH */
-/* if (c < 0)
- c = 0; */
+ if (p && c != -1) {
+ sprintf(mouse_info, "Mouse = 0x%x, [%s]", c, p);
+ SetConsoleTitle(mouse_info);
+ }
+#endif /* !(WIN_EX) */
if ((c+1) >= KEYMAP_SIZE && (c&LKC_ISLAC))
return(c);
}
@@ -1906,22 +2090,48 @@ PUBLIC int LYgetch NOARGS
* Convert a null-terminated string to lowercase
*/
PUBLIC void LYLowerCase ARGS1(
- char *, buffer)
+ unsigned char *, buffer)
{
size_t i;
for (i = 0; buffer[i]; i++)
+#ifdef SUPPORT_MULTIBYTE_EDIT /* 1998/11/23 (Mon) 17:04:55 */
+ {
+ if (buffer[i] & 0x80) {
+ if (IS_KANA(buffer[i])) {
+ continue;
+ }
+ i++;
+ } else {
+ buffer[i] = TOLOWER(buffer[i]);
+ }
+ }
+#else
buffer[i] = TOLOWER(buffer[i]);
+#endif
}
/*
* Convert a null-terminated string to uppercase
*/
PUBLIC void LYUpperCase ARGS1(
- char *, buffer)
+unsigned char *, buffer)
{
size_t i;
for (i = 0; buffer[i]; i++)
+#ifdef SUPPORT_MULTIBYTE_EDIT /* 1998/11/23 (Mon) 17:05:10 */
+ {
+ if (buffer[i] & 0x80) {
+ if (IS_KANA(buffer[i])) {
+ continue;
+ }
+ i++;
+ } else {
+ buffer[i] = TOUPPER(buffer[i]);
+ }
+ }
+#else
buffer[i] = TOUPPER(buffer[i]);
+#endif
}
/*
@@ -2110,6 +2320,36 @@ PUBLIC void LYSetupEdit ARGS4(
}
}
+#ifdef SUPPORT_MULTIBYTE_EDIT
+
+PRIVATE int prev_pos ARGS2(
+ EDREC *, edit,
+ int, pos)
+{
+ int i = 0;
+
+ if (pos <= 0)
+ return 0;
+ if (HTCJK == NOCJK)
+ return (pos - 1);
+ else {
+ while (i < pos - 1) {
+ int c;
+ c = Buf[i];
+
+ if (!(isascii(c) || IS_KANA(c))) {
+ i++;
+ }
+ i++;
+ }
+ if (i == pos)
+ return (i - 2);
+ else
+ return i;
+ }
+}
+#endif /* SUPPORT_MULTIBYTE_EDIT */
+
PUBLIC int LYEdit1 ARGS4(
EDREC *, edit,
int, ch,
@@ -2139,6 +2379,7 @@ PUBLIC int LYEdit1 ARGS4(
map_active = ~map_active;
break;
#endif
+#ifndef CJK_EX
case LYE_AIX:
/*
* Hex 97.
@@ -2148,6 +2389,7 @@ PUBLIC int LYEdit1 ARGS4(
*/
if (HTCJK == NOCJK && LYlowest_eightbit[current_char_set] > 0x97)
return(ch);
+#endif
case LYE_CHAR:
#ifdef EXP_KEYBOARD_LAYOUT
if (map_active && ch < 128 && ch >= 0 &&
@@ -2197,12 +2439,16 @@ PUBLIC int LYEdit1 ARGS4(
Buf[length+1]='\0';
Buf[Pos] = (unsigned char) ch;
Pos++;
- } else if (maxMessage) {
+ } else {
+ if (maxMessage) {
_statusline(MAXLEN_REACHED_DEL_OR_MOV);
}
+ return(ch);
+ }
break;
case LYE_BACKW:
+#ifndef SUPPORT_MULTIBYTE_EDIT
/*
* Backword.
* Definition of word is very naive: 1 or more a/n characters.
@@ -2211,16 +2457,58 @@ PUBLIC int LYEdit1 ARGS4(
Pos--;
while (Pos && isalnum(Buf[Pos-1]))
Pos--;
+#else /* SUPPORT_MULTIBYTE_EDIT */
+ /*
+ * Backword.
+ * Definition of word is very naive: 1 or more a/n characters,
+ * or 1 or more multibyte character.
+ */
+ {
+ int pos0;
+
+ pos0 = prev_pos(edit, Pos);
+ while (Pos &&
+ (HTCJK == NOCJK || isascii(Buf[pos0])) &&
+ !isalnum(Buf[pos0])) {
+ Pos = pos0;
+ pos0 = prev_pos(edit, Pos);
+ }
+ if (HTCJK != NOCJK && !isascii(Buf[pos0])) {
+ while (Pos && !isascii(Buf[pos0])) {
+ Pos = pos0;
+ pos0 = prev_pos(edit, Pos);
+ }
+ } else {
+ while (Pos && isascii(Buf[pos0]) && isalnum(Buf[pos0])) {
+ Pos = pos0;
+ pos0 = prev_pos(edit, Pos);
+ }
+ }
+ }
+#endif /* SUPPORT_MULTIBYTE_EDIT */
break;
case LYE_FORWW:
/*
* Word forward.
*/
+#ifndef SUPPORT_MULTIBYTE_EDIT
while (isalnum(Buf[Pos]))
Pos++; /* '\0' is not a/n */
while (!isalnum(Buf[Pos]) && Buf[Pos])
Pos++ ;
+#else /* SUPPORT_MULTIBYTE_EDIT */
+ if (HTCJK != NOCJK && !isascii(Buf[Pos])) {
+ while (!isascii(Buf[Pos]))
+ Pos += 2;
+ } else {
+ while (isascii(Buf[Pos]) && isalnum(Buf[Pos]))
+ Pos++; /* '\0' is not a/n */
+ }
+ while ((HTCJK == NOCJK || isascii(Buf[Pos])) &&
+ !isalnum(Buf[Pos]) && Buf[Pos])
+ Pos++;
+#endif /* SUPPORT_MULTIBYTE_EDIT */
break;
case LYE_ERASE:
@@ -2283,7 +2571,7 @@ PUBLIC int LYEdit1 ARGS4(
}
break;
- case LYE_DELEL:
+ case LYE_DELEL: /* @@@ */
/*
* Delete from current cursor position thru EOL.
*/
@@ -2303,6 +2591,10 @@ PUBLIC int LYEdit1 ARGS4(
*/
if (Pos >= length)
break;
+#ifdef SUPPORT_MULTIBYTE_EDIT
+ if (HTCJK != NOCJK && !isascii(Buf[Pos]))
+ Pos++;
+#endif
Pos++;
/* fall through - DO NOT RELOCATE the LYE_DELN case wrt LYE_DELP */
@@ -2310,6 +2602,7 @@ PUBLIC int LYEdit1 ARGS4(
/*
* Delete preceding character.
*/
+#ifndef SUPPORT_MULTIBYTE_EDIT
if (length == 0 || Pos == 0)
break;
#ifdef ENHANCED_LINEEDIT
@@ -2320,6 +2613,23 @@ PUBLIC int LYEdit1 ARGS4(
for (i = Pos; i < length; i++)
Buf[i] = Buf[i+1];
i--;
+#else /* SUPPORT_MULTIBYTE_EDIT */
+ {
+ int offset = 1;
+ int pos0 = Pos;
+
+ if (length == 0 || Pos == 0)
+ break;
+ if (HTCJK != NOCJK) {
+ Pos = prev_pos(edit, pos0);
+ offset = pos0 - Pos;
+ } else
+ Pos--;
+ for (i = Pos; i < length; i++)
+ Buf[i] = Buf[i + offset];
+ i -= offset;
+ }
+#endif /* SUPPORT_MULTIBYTE_EDIT */
Buf[i] = 0;
break;
@@ -2327,16 +2637,33 @@ PUBLIC int LYEdit1 ARGS4(
/*
* Move cursor to the right.
*/
+#ifndef SUPPORT_MULTIBYTE_EDIT
if (Pos < length)
Pos++;
+#else /* SUPPORT_MULTIBYTE_EDIT */
+ if (Pos < length) {
+ Pos++;
+ if (HTCJK != NOCJK && !isascii(Buf[Pos-1]))
+ Pos++;
+ }
+#endif /* SUPPORT_MULTIBYTE_EDIT */
break;
case LYE_BACK:
/*
* Left-arrow move cursor to the left.
*/
+#ifndef SUPPORT_MULTIBYTE_EDIT
if (Pos > 0)
Pos--;
+#else /* SUPPORT_MULTIBYTE_EDIT */
+ if (Pos > 0) {
+ if (HTCJK != NOCJK)
+ Pos = prev_pos(edit, Pos);
+ else
+ Pos--;
+ }
+#endif /* SUPPORT_MULTIBYTE_EDIT */
break;
#ifdef ENHANCED_LINEEDIT
@@ -2449,6 +2776,10 @@ PUBLIC void LYRefreshEdit ARGS1(
int padsize;
char *str;
char buffer[3];
+#ifdef SUPPORT_MULTIBYTE_EDIT
+ int begin_multi = 0;
+ int end_multi = 0;
+#endif /* SUPPORT_MULTIBYTE_EDIT */
buffer[0] = buffer[1] = buffer[2] = '\0';
if (!edit->dirty || (DspWdth == 0))
@@ -2473,16 +2804,52 @@ PUBLIC void LYRefreshEdit ARGS1(
* data entry at low baudrates.
*/
if ((DspStart + DspWdth) <= length)
+#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;
+
+ while (DspStart < tmp) {
+ if (!isascii(Buf[DspStart]))
+ DspStart++;
+ DspStart++;
+ }
+ } else
+ DspStart=(Pos - DspWdth) + Margin;
+ }
+#endif /* SUPPORT_MULTIBYTE_EDIT */
if (Pos < DspStart + Margin) {
+#ifndef SUPPORT_MULTIBYTE_EDIT
+ DspStart = Pos - Margin;
+ if (DspStart < 0)
+ DspStart = 0;
+#else /* SUPPORT_MULTIBYTE_EDIT */
+ if (HTCJK != NOCJK) {
+ int tmp = Pos - Margin;
+
+ DspStart = 0;
+ while (DspStart < tmp) {
+ if (!isascii(Buf[DspStart]))
+ DspStart++;
+ DspStart++;
+ }
+ } else {
DspStart = Pos - Margin;
if (DspStart < 0)
DspStart = 0;
}
+#endif /* SUPPORT_MULTIBYTE_EDIT */
+ }
str = &Buf[DspStart];
+#ifdef SUPPORT_MULTIBYTE_EDIT
+ if (HTCJK != NOCJK && !isascii(str[0]))
+ begin_multi = 1;
+#endif /* SUPPORT_MULTIBYTE_EDIT */
nrdisplayed = length-DspStart;
if (nrdisplayed > DspWdth)
@@ -2515,15 +2882,29 @@ PUBLIC void LYRefreshEdit ARGS1(
!(LYCharSet_UC[current_char_set].like8859
& UCT_R_8859SPECL))))) {
addch(' ');
+#ifdef SUPPORT_MULTIBYTE_EDIT
+ end_multi = 0;
+#endif /* SUPPORT_MULTIBYTE_EDIT */
} else {
/* For CJK strings, by Masanobu Kimura */
if (HTCJK != NOCJK && !isascii(buffer[0])) {
+#ifndef SUPPORT_MULTIBYTE_EDIT
if (i < (nrdisplayed - 1))
buffer[1] = str[++i];
+#else /* SUPPORT_MULTIBYTE_EDIT */
+ if (i < (nrdisplayed - 1)) {
+ buffer[1] = str[++i];
+ end_multi = 1;
+ } else
+ end_multi = 0;
+#endif /* SUPPORT_MULTIBYTE_EDIT */
addstr(buffer);
buffer[1] = '\0';
} else {
addstr(buffer);
+#ifdef SUPPORT_MULTIBYTE_EDIT
+ end_multi = 0;
+#endif /* SUPPORT_MULTIBYTE_EDIT */
}
}
}
@@ -2540,16 +2921,39 @@ PUBLIC void LYRefreshEdit ARGS1(
*/
if (edit->panon) {
if ((DspStart + nrdisplayed) < length) {
+#ifndef SUPPORT_MULTIBYTE_EDIT
move(edit->sy, edit->sx+nrdisplayed-1);
addch('}');
+#else /* SUPPORT_MULTIBYTE_EDIT */
+ if (end_multi) {
+ move(edit->sy, edit->sx+nrdisplayed-2);
+ addstr(" }");
+ } else {
+ move(edit->sy, edit->sx+nrdisplayed-1);
+ addch('}');
+ }
+#endif /* SUPPORT_MULTIBYTE_EDIT */
}
if (DspStart) {
move(edit->sy, edit->sx);
+#ifndef SUPPORT_MULTIBYTE_EDIT
+ addch('{');
+#else /* SUPPORT_MULTIBYTE_EDIT */
+ if (begin_multi)
+ addstr("{ ");
+ else
addch('{');
+#endif /* SUPPORT_MULTIBYTE_EDIT */
}
}
move(edit->sy, edit->sx + Pos - DspStart);
+#ifdef SUPPORT_MULTIBYTE_EDIT
+#if (!USE_SLANG && !defined(USE_MULTIBYTE_CURSES))
+ if (HTCJK != NOCJK)
+ lynx_force_repaint();
+#endif /* !USE_SLANG && !defined(USE_MULTIBYTE_CURSES) */
+#endif /* SUPPORT_MULTIBYTE_EDIT */
refresh();
}
@@ -2567,6 +2971,9 @@ PUBLIC int LYgetstr ARGS4(
int last_xlkc = -1;
EditFieldData MyEdit;
char *res;
+#ifdef SUPPORT_MULTIBYTE_EDIT
+ BOOL refresh = TRUE;
+#endif /* SUPPORT_MULTIBYTE_EDIT */
LYGetYX(y, x); /* Use screen from cursor position to eol */
MaxStringSize = (bufsize < sizeof(MyEdit.buffer)) ?
@@ -2576,8 +2983,25 @@ PUBLIC int LYgetstr ARGS4(
for (;;) {
again:
+#ifndef SUPPORT_MULTIBYTE_EDIT
LYRefreshEdit(&MyEdit);
+#else /* SUPPORT_MULTIBYTE_EDIT */
+ if (refresh)
+ LYRefreshEdit(&MyEdit);
+#endif /* SUPPORT_MULTIBYTE_EDIT */
ch = LYgetch_for(FOR_PROMPT);
+#ifdef SUPPORT_MULTIBYTE_EDIT
+#ifdef CJK_EX /* for SJIS code */
+ if (!refresh
+ && (EditBinding(ch) != LYE_CHAR))
+ goto again;
+#else
+ if (!refresh
+ && (EditBinding(ch) != LYE_CHAR)
+ && (EditBinding(ch) != LYE_AIX))
+ goto again;
+#endif
+#endif /* SUPPORT_MULTIBYTE_EDIT */
#ifdef VMS
if (term_letter || term_options ||
#ifndef DISABLE_NEWS
@@ -2607,8 +3031,10 @@ again:
ch |= LKC_MOD3;
last_xlkc = -1; /* consumed */
}
+#ifndef WIN_EX
if (LKC_TO_LAC(keymap,ch) == LYK_REFRESH)
goto again;
+#endif
xlec = EditBinding(ch);
if ((xlec & LYE_DF) && !(xlec & LYE_FORM_LAC)) {
last_xlkc = ch;
@@ -2644,6 +3070,8 @@ again:
ch = '\0';
}
break;
+
+#ifndef CJK_EX /* 1997/11/03 (Mon) 20:13:45 */
case LYE_AIX:
/*
* Hex 97.
@@ -2653,10 +3081,12 @@ again:
*/
if (ch != '\t' &&
(HTCJK != NOCJK ||
- LYlowest_eightbit[current_char_set] <= 0x97)) {
+ LYlowest_eightbit[current_char_set] <= 0x97))
+ {
LYLineEdit(&MyEdit,ch, FALSE);
break;
}
+#endif
case LYE_ENTER:
/*
* Terminate the string and return.
@@ -2665,6 +3095,32 @@ again:
LYAddToCloset(MyEdit.buffer);
return(ch);
+#if defined(WIN_EX)
+ /* 1998/10/01 (Thu) 15:05:49 */
+
+#define PASTE_MAX 512
+
+ case LYE_PASTE:
+ {
+ unsigned char buff[PASTE_MAX];
+ int i, len;
+
+ len = get_clip(buff, PASTE_MAX);
+
+ if (len > 0) {
+ i = 0;
+ while ((ch = buff[i]) != '\0') {
+ if (ch == '\r' || ch == '\n')
+ break;
+ if (ch >= ' ')
+ LYLineEdit(&MyEdit, ch, FALSE);
+ i++;
+ }
+ }
+ break;
+ }
+#endif
+
case LYE_ABORT:
/*
* Control-C or Control-G aborts.
@@ -2698,7 +3154,20 @@ again:
break;
}
+#ifndef SUPPORT_MULTIBYTE_EDIT
LYLineEdit(&MyEdit, ch, FALSE);
+#else /* SUPPORT_MULTIBYTE_EDIT */
+ if (LYLineEdit(&MyEdit, ch, FALSE) == 0) {
+ if (refresh && HTCJK != NOCJK && (0x81 <= ch) && (ch <= 0xfe))
+ refresh = FALSE;
+ else
+ refresh = TRUE;
+ } else {
+ if (!refresh) {
+ LYEdit1(&MyEdit, 0, LYE_DELP, FALSE);
+ }
+ }
+#endif /* SUPPORT_MULTIBYTE_EDIT */
}
}
}
@@ -2824,6 +3293,63 @@ PUBLIC char * LYno_attr_char_case_strstr ARGS2(
return(NULL);
}
+PUBLIC void LYOpenCloset NOARGS
+{
+ /* We initialize the list-looka-like, i.e., the Closet */
+ int i = 0;
+ while(i < LYClosetSize){
+ LYCloset[i] = NULL;
+ i = i + 1;
+ }
+ LYClosetTop = 0;
+}
+
+PUBLIC void LYCloseCloset NOARGS
+{
+ int i = 0;
+
+ /* Clean up the list-looka-like, i.e., the Closet */
+ while (i < LYClosetSize){
+ FREE(LYCloset[i]);
+ i = i + 1;
+ }
+}
+
+/*
+ * Strategy: We begin at the top and search downwards. We return the first
+ * match, i.e., the newest since we search from the top. This should be made
+ * more intelligent, but works for now.
+ */
+PRIVATE char * LYFindInCloset ARGS1(char*, base)
+{
+ int shelf;
+ unsigned len = strlen(base);
+
+ shelf = (LYClosetTop - 1 + LYClosetSize) % LYClosetSize;
+
+ while (LYCloset[shelf] != NULL){
+ if (!strncmp(base, LYCloset[shelf], len)) {
+ return(LYCloset[shelf]);
+ }
+ shelf = (shelf - 1 + LYClosetSize) % LYClosetSize;
+ }
+ return(0);
+}
+
+PRIVATE int LYAddToCloset ARGS1(char*, str)
+{
+ unsigned len = strlen(str);
+
+ LYCloset[LYClosetTop] = malloc(len+1);
+ if (!LYCloset[LYClosetTop])
+ outofmem(__FILE__, "LYAddToCloset");
+ strcpy(LYCloset[LYClosetTop], str);
+
+ LYClosetTop = (LYClosetTop + 1) % LYClosetSize;
+ FREE(LYCloset[LYClosetTop]);
+ return(1);
+}
+
/*
* LYno_attr_char_strstr will find the first occurrence of the
* string pointed to by tarptr in the string pointed to by chptr.
@@ -3161,63 +3687,6 @@ PUBLIC char * LYno_attr_mbcs_strstr ARGS5(
return(NULL);
}
-PUBLIC void LYOpenCloset NOARGS
-{
- /* We initialize the list-looka-like, i.e., the Closet */
- int i = 0;
- while(i < LYClosetSize){
- LYCloset[i] = NULL;
- i = i + 1;
- }
- LYClosetTop = 0;
-}
-
-PUBLIC void LYCloseCloset NOARGS
-{
- int i = 0;
-
- /* Clean up the list-looka-like, i.e., the Closet */
- while (i < LYClosetSize){
- FREE(LYCloset[i]);
- i = i + 1;
- }
-}
-
-/*
- * Strategy: We begin at the top and search downwards. We return the first
- * match, i.e., the newest since we search from the top. This should be made
- * more intelligent, but works for now.
- */
-PRIVATE char * LYFindInCloset ARGS1(char*, base)
-{
- int shelf;
- unsigned len = strlen(base);
-
- shelf = (LYClosetTop - 1 + LYClosetSize) % LYClosetSize;
-
- while (LYCloset[shelf] != NULL){
- if (!strncmp(base, LYCloset[shelf], len)) {
- return(LYCloset[shelf]);
- }
- shelf = (shelf - 1 + LYClosetSize) % LYClosetSize;
- }
- return(0);
-}
-
-PRIVATE int LYAddToCloset ARGS1(char*, str)
-{
- unsigned len = strlen(str);
-
- LYCloset[LYClosetTop] = malloc(len+1);
- if (!LYCloset[LYClosetTop])
- outofmem(__FILE__, "LYAddToCloset");
- strcpy(LYCloset[LYClosetTop], str);
-
- LYClosetTop = (LYClosetTop + 1) % LYClosetSize;
- FREE(LYCloset[LYClosetTop]);
- return(1);
-}
-
/*
* Allocate a new copy of a string, and returns it.
*/
@@ -3386,9 +3855,9 @@ PUBLIC int UPPER8 ARGS2(int,ch1, int,ch2)
charset_in = current_char_set; /* display character set */
charset_out = UCGetLYhndl_byMIME("us-ascii");
- uck1 = UCTransCharStr(replace_buf1, sizeof(replace_buf1), ch1,
+ uck1 = UCTransCharStr(replace_buf1, sizeof(replace_buf1), (char)ch1,
charset_in, charset_out, YES);
- uck2 = UCTransCharStr(replace_buf2, sizeof(replace_buf2), ch2,
+ uck2 = UCTransCharStr(replace_buf2, sizeof(replace_buf2), (char)ch2,
charset_in, charset_out, YES);
if ((uck1 > 0) && (uck2 > 0)) /* both replacement strings found */
diff --git a/src/LYStrings.h b/src/LYStrings.h
index 33e38a67..c61ab0c7 100644
--- a/src/LYStrings.h
+++ b/src/LYStrings.h
@@ -237,15 +237,19 @@ typedef struct _EditFieldData {
#define LYE_FORM_LAC 0x1000 /* Flag to pass lynxactioncode given by
lower bits. Doesn't fit in a char! */
+#if defined(WIN_EX)
+#define LYE_PASTE (LYE_AIX +1) /* ClipBoard to Lynx */
+#endif
+
#if defined(USE_KEYMAPS)
extern int lynx_initialize_keymaps NOPARAMS;
extern int map_string_to_keysym PARAMS((char * src, int *lec));
#endif
extern void LYLowerCase PARAMS((
- char * buffer));
+ unsigned char * buffer));
extern void LYUpperCase PARAMS((
- char * buffer));
+ unsigned char * buffer));
extern void LYRemoveBlanks PARAMS((
char * buffer));
extern char * LYSkipBlanks PARAMS((
diff --git a/src/LYStyle.c b/src/LYStyle.c
index a2accfb8..062c2715 100644
--- a/src/LYStyle.c
+++ b/src/LYStyle.c
@@ -1,6 +1,6 @@
/* character level styles for Lynx
* (c) 1996 Rob Partington -- donated to the Lyncei (if they want it :-)
- * $Id: LYStyle.c,v 1.21 1999/05/28 14:18:50 tom Exp $
+ * $Id: LYStyle.c,v 1.22 1999/07/14 16:44:55 tom Exp $
*/
#include <HTUtils.h>
#include <HTML.h>
@@ -22,6 +22,7 @@
#include <LYexit.h>
#include <LYLeaks.h>
#include <LYStrings.h>
+#include <LYUtils.h>
#ifdef USE_COLOR_STYLE
@@ -404,7 +405,7 @@ PUBLIC int style_readFromFile ARGS1(char*, file)
CTRACE(tfp, "CSS:Reading styles from file: %s\n", file ? file : "?!? empty ?!?");
if (file == NULL || *file == '\0')
return -1;
- fh = fopen(file, "r");
+ fh = fopen(file, TXT_R);
if (!fh)
{
/* this should probably be an alert or something */
diff --git a/src/LYTraversal.c b/src/LYTraversal.c
index 04c18154..6af29e1c 100644
--- a/src/LYTraversal.c
+++ b/src/LYTraversal.c
@@ -37,7 +37,7 @@ PUBLIC BOOLEAN lookup ARGS1(char *,target)
char *line = NULL;
int result = FALSE;
- if ((ifp = fopen(TRAVERSE_FILE,"r")) == NULL) {
+ if ((ifp = fopen(TRAVERSE_FILE, TXT_R)) == NULL) {
if ((ifp = LYNewTxtFile(TRAVERSE_FILE)) == NULL) {
exit_with_perror(CANNOT_OPEN_TRAV_FILE);
} else {
@@ -144,7 +144,7 @@ PUBLIC BOOLEAN lookup_reject ARGS1(char *,target)
int len;
int result = FALSE;
- if ((ifp = fopen(TRAVERSE_REJECT_FILE,"r")) == NULL){
+ if ((ifp = fopen(TRAVERSE_REJECT_FILE, TXT_R)) == NULL){
return(FALSE);
}
diff --git a/src/LYUtils.c b/src/LYUtils.c
index 73ff1bf3..84b4037f 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -21,6 +21,16 @@
#include <HTFile.h>
#endif
+#if _WIN_CC
+extern int exec_command(char * cmd, int wait_flag); /* xsystem.c */
+#endif
+
+#ifdef _WINDOWS /* 1998/04/30 (Thu) 19:04:25 */
+#define GETPID() (getpid() & 0xffff)
+#else
+#define GETPID() getpid()
+#endif /* _WINDOWS */
+
#ifdef DJGPP_KEYHANDLER
#include <bios.h>
#endif /* DJGPP_KEYHANDLER */
@@ -94,7 +104,6 @@ extern int BSDselect PARAMS((int nfds, fd_set * readfds, fd_set * writefds,
#define COPY_COMMAND "%s %s %s"
-extern HTkcode kanji_code;
extern BOOLEAN LYHaveCJKCharacterSet;
extern HTCJKlang HTCJK;
@@ -1840,6 +1849,9 @@ PUBLIC void statusline ARGS1(
unsigned char *temp = NULL;
int max_length, len, i, j;
unsigned char k;
+ char *p;
+ char text_buff[256];
+ int text_len;
if (text == NULL)
return;
@@ -1860,6 +1872,25 @@ PUBLIC void statusline ARGS1(
}
mustshow = FALSE;
+ /* "LYNXDOWNLOAD://Method=-1/File=%s/SugFile=%s%s\">Save to disk</a>\n" */
+ /* 1997/12/23 (Tue) 15:58:58 */
+ text_len = strlen(text);
+ if (text_len < 256) {
+ strcpy(text_buff, text);
+ } else {
+ strncpy(text_buff, text, 255);
+ text_buff[255] = '\0';
+ p = strchr(text_buff, '\n');
+ if (p)
+ p= '\0';
+ }
+ if (strncmp(text, "LYNXDOWNLOAD:", 13) == 0) {
+ p = strstr(text + 13, "SugFile=");
+ if (p != NULL) {
+ strcpy(text_buff, p + 3);
+ }
+ }
+
/*
* Deal with any CJK escape sequences and Kanji if we have a CJK
* character set selected, otherwise, strip any escapes. Also,
@@ -1867,21 +1898,28 @@ PUBLIC void statusline ARGS1(
*/
max_length = ((LYcols - 2) < (int)sizeof(buffer))
? (LYcols - 2) : (int)sizeof(buffer)-1;
- if ((text[0] != '\0') &&
+ if ((text_buff[0] != '\0') &&
(LYHaveCJKCharacterSet)) {
/*
* Translate or filter any escape sequences. - FM
*/
- if ((temp = (unsigned char *)calloc(1, strlen(text) + 1)) == NULL)
+ if ((temp = (unsigned char *)calloc(1, strlen(text_buff) + 1)) == NULL)
outofmem(__FILE__, "statusline");
if (kanji_code == EUC) {
- TO_EUC((CONST unsigned char *)text, temp);
+ TO_EUC((CONST unsigned char *)text_buff, temp);
} else if (kanji_code == SJIS) {
- TO_SJIS((CONST unsigned char *)text, temp);
+#ifdef CJK_EX
+ if (!LYRawMode || last_kcode == SJIS)
+ strcpy(temp, text_buff);
+ else
+ TO_SJIS((CONST unsigned char *)text_buff, temp);
+#else
+ strcpy(temp, text_buff);
+#endif
} else {
- for (i = 0, j = 0; text[i]; i++) {
- if (text[i] != CH_ESC) { /* S/390 -- gil -- 2119 */
- temp[j++] = text[i];
+ for (i = 0, j = 0; text_buff[i]; i++) {
+ if (text_buff[i] != CH_ESC) { /* S/390 -- gil -- 2119 */
+ temp[j++] = text_buff[i];
}
}
temp[j] = '\0';
@@ -1922,9 +1960,9 @@ PUBLIC void statusline ARGS1(
* code added here for determining the displayed string length,
* as we do above for CJK. - FM
*/
- for (i = 0, len = 0; text[i] != '\0' && len < max_length; i++) {
- if (text[i] != CH_ESC) { /* S/390 -- gil -- 2136 */
- buffer[len++] = text[i];
+ for (i = 0, len = 0; text_buff[i] != '\0' && len < max_length; i++) {
+ if (text_buff[i] != CH_ESC) { /* S/390 -- gil -- 2119 */
+ buffer[len++] = text_buff[i];
}
}
buffer[len] = '\0';
@@ -1950,6 +1988,7 @@ PUBLIC void statusline ARGS1(
move(LYlines-1, 0);
}
clrtoeol();
+
if (text != NULL && text[0] != '\0') {
#ifdef HAVE_UTF8_STATUSLINES
if (LYCharSet_UC[current_char_set].enc == UCT_ENC_UTF8) {
@@ -2024,7 +2063,6 @@ PUBLIC void noviceline ARGS1(
clrtoeol();
addstr(NOVICE_LINE_ONE);
clrtoeol();
-
#if defined(DIRED_SUPPORT ) && defined(OK_OVERRIDE)
if (lynx_edit_mode && !no_dired_support)
addstr(DIRED_NOVICELINE);
@@ -2148,6 +2186,7 @@ PUBLIC int HTCheckForInterrupt NOARGS
if (DontCheck())
return((int)FALSE);
+#ifndef _WINDOWS /* 1998/03/30 (Mon) 17:07:41 */
#ifdef USE_SLANG
/** No keystroke was entered
Note that this isn't taking possible SOCKSification
@@ -2176,13 +2215,14 @@ PUBLIC int HTCheckForInterrupt NOARGS
&socket_timeout);
/** Suspended? **/
- if ((ret == -1) && (errno == EINTR))
+ if ((ret == -1) && (SOCKET_ERRNO == EINTR))
return((int)FALSE);
/** No keystroke was entered? **/
if (!FD_ISSET(0,&readfds))
return((int)FALSE);
#endif /* USE_SLANG */
+#endif /* !_WINDOWS */
#if defined (DOSPATH) && defined (NCURSES)
nodelay(stdscr,TRUE);
@@ -2359,7 +2399,7 @@ PUBLIC BOOLEAN LYisRootPath ARGS1(
&& isalpha(path[0])
&& path[1] == ':'
&& LYIsPathSep(path[2]))
- return TRUE;
+ return TRUE;
#endif
return ((strlen(path) == 1) && LYIsPathSep(path[0]));
}
@@ -3039,6 +3079,7 @@ extern char *ttyname PARAMS((int fd));
PUBLIC BOOLEAN inlocaldomain NOARGS
{
#if ! HAVE_UTMP
+ CTRACE(tfp, "LYUtils: inlocaldomain() not support.\n");
return(TRUE);
#else
int n;
@@ -3293,11 +3334,19 @@ PUBLIC void change_sug_filename ARGS1(
if (temp == NULL)
outofmem(__FILE__, "change_sug_filename");
cp = wwwName(lynx_temp_space);
+#ifdef FNAMES_8_3
+ if (LYIsHtmlSep(*cp)) {
+ sprintf(temp, "file://localhost%s%04x", cp, GETPID());
+ } else {
+ sprintf(temp, "file://localhost/%s%04x", cp, GETPID());
+ }
+#else
if (LYIsHtmlSep(*cp)) {
sprintf(temp, "file://localhost%s%d", cp, (int)getpid());
} else {
sprintf(temp, "file://localhost/%s%d", cp, (int)getpid());
}
+#endif
if (!strncmp(fname, temp, strlen(temp))) {
cp = strrchr(fname, '.');
if (strlen(cp) > (strlen(temp) - 4))
@@ -3330,6 +3379,19 @@ PUBLIC void change_sug_filename ARGS1(
}
*cp1 = '\0';
}
+#ifdef _WINDOWS /* 1998/05/05 (Tue) 10:08:05 */
+ if ((cp = strrchr(fname,'=')) != NULL && strlen(cp) > 1) {
+ cp1 = fname;
+ /*
+ * Go past the '='.
+ */
+ cp++;
+ for (; *cp != '\0'; cp++, cp1++) {
+ *cp1 = *cp;
+ }
+ *cp1 = '\0';
+ }
+#endif
/*
* Trim off date-size suffix, if present.
@@ -3564,6 +3626,15 @@ PRIVATE int fmt_tempname ARGS3(
if (suffix == 0)
suffix = "";
counter++;
+#ifdef _WINDOWS /* 1998/05/25 (Mon) 20:51:22 */
+ {
+ char *p = result;
+ while (*p++) {
+ if (*p == '/')
+ *p = '\\';
+ }
+ }
+#endif
#ifdef FNAMES_8_3
/*
* The 'lynx_temp_space' string ends with a '/' or '\\', so we only have to
@@ -3571,7 +3642,11 @@ PRIVATE int fmt_tempname ARGS3(
* the suffix may contain more than a ".htm", e.g., "-txt.gz", so we trim
* off from the filename portion to make room.
*/
+#ifdef _WINDOWS
+ sprintf(leaf, "%04x%04x", counter, (unsigned)GETPID());
+#else
sprintf(leaf, "%u%u", counter, (unsigned)getpid());
+#endif
if (strlen(leaf) > 8)
leaf[8] = 0;
if (strlen(suffix) > 4 || *suffix != '.') {
@@ -3756,6 +3831,52 @@ PRIVATE BOOLEAN *restrict_flag[] = {
#endif
(BOOLEAN *) 0 };
+
+/* This will make no difference between '-' and '_'. It does only in/equality
+ compare. It assumes that p2 can't contain dashes, but p1 can.
+ This function is also used (if macro OPTNAME_ALLOW_DASHES doesn't have
+ value of zero) for compare of commandline options -VH
+ */
+PUBLIC BOOL strn_dash_equ ARGS3(
+ CONST char* ,p1,
+ CONST char* ,p2,
+ int ,len)
+{
+ while (len--) {
+ if (!*p2)
+ return 0;/* canonical name is shorter */
+ switch (*p1) {
+ case 0:
+ return 0;
+ case '-':
+ case '_':
+ if (*p2!='_')
+ return 0;
+ else
+ break;
+ default:
+ if (*p1!=*p2)
+ return 0;
+ }
+ ++p1; ++p2;
+ }
+ return 1;
+}
+
+/* Uncomment following lines to allow only exact string matching */
+/* #define RESTRICT_NM_ALLOW_DASHES 0 */
+
+#ifndef RESTRICT_NM_ALLOW_DASHES
+# define RESTRICT_NM_ALLOW_DASHES 1
+#endif
+
+#if RESTRICT_NM_ALLOW_DASHES
+# define RESTRICT_NM_EQU(a,b,len) strn_dash_equ(a,b,len)
+#else
+# define RESTRICT_NM_EQU(a,b,len) STRNEQ(a,b,len)
+#endif
+
+
PUBLIC void parse_restrictions ARGS1(
CONST char *, s)
{
@@ -3772,13 +3893,13 @@ PUBLIC void parse_restrictions ARGS1(
while (*p != ',' && *p != '\0')
p++;
- if (STRNEQ(word, "all", p-word)) {
+ if (RESTRICT_NM_EQU(word, "all", p-word)) {
/* set all restrictions */
for (i=N_SPECIAL_RESTRICT_OPTIONS; restrict_flag[i]; i++)
*restrict_flag[i] = TRUE;
}
- if (STRNEQ(word, "default", p-word)) {
+ if (RESTRICT_NM_EQU(word, "default", p-word)) {
/* set all restrictions */
for (i=N_SPECIAL_RESTRICT_OPTIONS; restrict_flag[i]; i++)
*restrict_flag[i] = TRUE;
@@ -3839,7 +3960,7 @@ PUBLIC void parse_restrictions ARGS1(
}
for (i=0; restrict_name[i]; i++) {
- if (STRNEQ(word, restrict_name[i], p-word)) {
+ if (RESTRICT_NM_EQU(word, restrict_name[i], p-word)) {
*restrict_flag[i] = TRUE;
break;
}
@@ -4232,7 +4353,26 @@ PUBLIC void LYConvertToURL ARGS2(
have_VMS_URL:
CTRACE(tfp, "Trying: '%s'\n", *AllocatedString);
#else /* not VMS: */
-#ifdef DOSPATH
+#if defined(DOSPATH)
+#ifdef _WINDOWS
+ if (*old_string == '.') {
+ char fullpath[MAX_PATH + 1];
+ char *filepart = NULL;
+ DWORD chk;
+
+ chk = GetFullPathNameA(old_string, MAX_PATH + 1,
+ fullpath, &filepart);
+ if (chk != 0) {
+ StrAllocCopy(temp, HTDOS_wwwName(fullpath));
+ StrAllocCat(*AllocatedString, temp);
+ FREE(temp);
+ CTRACE(tfp, "Converted '%s' to '%s'\n",
+ old_string, *AllocatedString);
+ } else {
+ StrAllocCat(*AllocatedString, old_string);
+ }
+ }
+#else
if (strlen(old_string) == 1 && *old_string == '.') {
/*
* They want .
@@ -4243,7 +4383,9 @@ have_VMS_URL:
FREE(temp);
CTRACE(tfp, "Converted '%s' to '%s'\n",
old_string, *AllocatedString);
- } else
+ }
+#endif
+ else
#endif /* DOSPATH */
if (*old_string == '~') {
/*
@@ -4275,15 +4417,25 @@ have_VMS_URL:
* Concatenate and simplify, trimming any
* residual relative elements. - FM
*/
-#if defined (DOSPATH) || defined (__EMX__)
+#if defined (DOSPATH) || defined (__EMX__) || defined (WIN_EX)
if (old_string[1] != ':' && old_string[1] != '|') {
+#ifdef DOSPATH
+ StrAllocCopy(temp, HTDOS_wwwName(curdir));
+#else
StrAllocCopy(temp, wwwName(curdir));
+#endif
LYAddHtmlSep(&temp);
LYstrncpy(curdir, temp, (sizeof(curdir) - 1));
StrAllocCat(temp, old_string);
} else {
curdir[0] = '\0';
+ /* 1998/01/13 (Tue) 12:24:33 */
+ if (old_string[1] == '|')
+ old_string[1] = ':';
StrAllocCopy(temp, old_string);
+
+ if (strlen(temp) == 2 && temp[1] == ':')
+ StrAllocCat(temp, "/");
}
#else
StrAllocCopy(temp, curdir);
@@ -4302,12 +4454,13 @@ have_VMS_URL:
/* especially when we really have file://localhost/ */
/* at the beginning. To avoid any confusion we allow */
/* escaping the path if URL specials % or # present. */
- if (strchr(temp, '#') == NULL &&
- strchr(temp, '%') == NULL)
- StrAllocCopy(cp, temp);
+ if (strchr(temp, '#') == NULL && strchr(temp, '%') == NULL)
+ StrAllocCopy(cp, temp);
else
-#endif /* DOSPATH */
+ cp = HTEscape(temp, URL_PATH);
+#else
cp = HTEscape(temp, URL_PATH);
+#endif /* DOSPATH */
StrAllocCat(*AllocatedString, cp);
FREE(cp);
CTRACE(tfp, "Converted '%s' to '%s'\n",
@@ -4324,6 +4477,9 @@ have_VMS_URL:
StrAllocCat(temp2, cp); /* append to current dir */
StrAllocCopy(cp2, temp2); /* keep a copy in cp2 */
LYTrimRelFromAbsPath(temp2);
+#ifdef WIN_EX /* 1998/07/31 (Fri) 09:09:03 */
+ HTUnEscape(temp2); /* for LFN */
+#endif
if (strcmp(temp2, temp) != 0 &&
((stat(temp2, &st) > -1) ||
@@ -4392,9 +4548,28 @@ have_VMS_URL:
*/
CTRACE(tfp, "Can't stat() or fopen() '%s'\n",
temp2 ? temp2 : temp);
+#ifdef WIN_EX /* 1998/01/13 (Tue) 09:07:37 */
+ {
+ char *p, *q, buff[LY_MAXPATH + 128];
+
+ p = (char *)Home_Dir();
+ q = temp2 ? temp2 : temp;
+
+ if (strlen(q) == 3 && isalpha(q[0]) && q[1] == ':') {
+ sprintf(buff,
+ "'%s' not exist, Goto LynxHome '%s'.", q, p);
+ _statusline(buff);
+ sleep(AlertSecs);
+ FREE(temp);
+ StrAllocCat(*AllocatedString, p);
+ goto Retry;
+ }
+ }
+#endif
if (LYExpandHostForURL((char **)&old_string,
URLDomainPrefixes,
- URLDomainSuffixes)) {
+ URLDomainSuffixes))
+ {
if (!LYAddSchemeForURL((char **)&old_string, "http://")) {
StrAllocCopy(*AllocatedString, "http://");
StrAllocCat(*AllocatedString, old_string);
@@ -4405,6 +4580,9 @@ have_VMS_URL:
/* RW 1998Mar16 Restore AllocatedString to 'old_string' */
StrAllocCopy(*AllocatedString, old_string);
}
+#ifdef WIN_EX
+ Retry:
+#endif
CTRACE(tfp, "Trying: '%s'\n", *AllocatedString);
}
FREE(temp);
@@ -4484,6 +4662,38 @@ have_VMS_URL:
CTRACE_SLEEP(AlertSecs);
}
+#if defined(_WINDOWS) /* 1998/06/23 (Tue) 16:45:20 */
+
+PUBLIC int win32_check_interrupt()
+{
+ int c;
+
+ if (kbhit()) {
+ c = getch();
+ /** Keyboard 'Z' or 'z', or Control-G or Control-C **/
+ if (TOUPPER(c) == 'Z' || c == 7 || c == 3 || c == 0x1b) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+void sleep(unsigned sec)
+{
+ int i, j, c;
+
+ for (j = 0; j < sec; j++) {
+ for (i = 0; i < 10; i++) {
+ Sleep(100);
+ if (kbhit()) {
+ c = getch();
+ return;
+ }
+ }
+ }
+}
+#endif
+
/*
* This function rewrites and reallocates a previously allocated
* string so that the first element is a confirmed Internet host,
@@ -4515,6 +4725,10 @@ PUBLIC BOOLEAN LYExpandHostForURL ARGS3(
char *Fragment = NULL;
BOOLEAN GotHost = FALSE;
BOOLEAN Startup = (helpfilepath == NULL);
+#ifdef _WINDOWS
+ int hoststat;
+ struct hostent *phost; /* Pointer to host - See netdb.h */
+#endif
/*
* If it's a NULL or zero-length string,
@@ -4596,7 +4810,8 @@ PUBLIC BOOLEAN LYExpandHostForURL ARGS3(
* Clear any residual interrupt. - FM
*/
if (LYCursesON && HTCheckForInterrupt()) {
- CTRACE(tfp, "LYExpandHostForURL: Ignoring interrupt because '%s' resolved.\n",
+ CTRACE(tfp,
+ "LYExpandHostForURL: Ignoring interrupt because '%s' resolved.\n",
host);
}
@@ -4608,15 +4823,18 @@ PUBLIC BOOLEAN LYExpandHostForURL ARGS3(
FREE(Str);
FREE(MsgStr);
return GotHost;
+ }
#ifndef DJGPP
- } else if (LYCursesON && (lynx_nsl_status == HT_INTERRUPTED)) {
+ else if (LYCursesON && (lynx_nsl_status == HT_INTERRUPTED))
#else /* DJGPP */
- } else if (LYCursesON && HTCheckForInterrupt()) {
+ else if (LYCursesON && HTCheckForInterrupt())
#endif /* DJGPP */
+ {
/*
* Give the user chance to interrupt lookup cycles. - KW & FM
*/
- CTRACE(tfp, "LYExpandHostForURL: Interrupted while '%s' failed to resolve.\n",
+ CTRACE(tfp,
+ "LYExpandHostForURL: Interrupted while '%s' failed to resolve.\n",
host);
/*
@@ -4707,10 +4925,10 @@ PUBLIC BOOLEAN LYExpandHostForURL ARGS3(
} else if (Startup && !dump_output_immediately) {
fprintf(stdout, "%s '%s'%s\n", WWW_FIND_MESSAGE, host, GUESSING_SEGMENT);
}
-#ifndef DJGPP
- GotHost = (LYGetHostByName(host) != NULL);
-#else
+#ifdef DJGPP
GotHost = (resolve(host) != 0);
+#else
+ GotHost = (LYGetHostByName(host) != NULL);
#endif /* DJGPP */
if (HostColon != NULL) {
*HostColon = ':';
@@ -4719,13 +4937,14 @@ PUBLIC BOOLEAN LYExpandHostForURL ARGS3(
/*
* Give the user chance to interrupt lookup cycles. - KW
*/
-#ifndef DJGPP
- if (LYCursesON && (lynx_nsl_status == HT_INTERRUPTED))
-#else /* DJGPP */
+#ifdef DJGPP
if (LYCursesON && HTCheckForInterrupt())
+#else /* !DJGPP */
+ if (LYCursesON && (lynx_nsl_status == HT_INTERRUPTED))
#endif /* DJGPP */
{
- CTRACE(tfp, "LYExpandHostForURL: Interrupted while '%s' failed to resolve.\n",
+ CTRACE(tfp,
+ "LYExpandHostForURL: Interrupted while '%s' failed to resolve.\n",
host);
FREE(Str);
FREE(MsgStr);
@@ -5220,6 +5439,12 @@ PUBLIC BOOLEAN LYPathOffHomeOK ARGS2(
return(FALSE);
}
}
+#ifdef _WINDOWS /* 1997/10/16 (Thu) 22:08:17 */
+ strcpy(buff, homedir);
+ p = buff;
+ while (*p++) if (*p == '\\') *p = '/';
+ homedir = buff;
+#endif
}
#endif /* VMS */
if (*cp == '~') {
@@ -5705,7 +5930,7 @@ PUBLIC time_t LYmktime ARGS2(
return(clock2);
}
-#if ! HAVE_PUTENV
+#if !defined(HAVE_PUTENV) && !defined(_WINDOWS)
/*
* No putenv on the next so we use this code instead!
*/
@@ -5802,7 +6027,7 @@ int remove ARGS1(char *, name)
}
#endif
-#ifdef UNIX
+#if defined(UNIX)
/*
* Verify if this is really a file, not accessed by a link, except for the
* special case of its directory being pointed to by a link from a directory
@@ -5886,6 +6111,10 @@ PRIVATE FILE *OpenHiddenFile ARGS2(char *, name, char *, mode)
fd = open(name, O_CREAT|O_EXCL|O_WRONLY, HIDE_CHMOD);
}
if (fd >= 0) {
+#ifdef O_BINARY /* for __CYGWIN_ */
+ if (mode[1] == 'b')
+ setmode(fd, O_BINARY);
+#endif
fp = fdopen(fd, mode);
}
}
@@ -5914,7 +6143,7 @@ PRIVATE FILE *OpenHiddenFile ARGS2(char *, name, char *, mode)
}
return fp;
}
-#else
+#else /* !UNIX */
# ifndef VMS
# define OpenHiddenFile(name, mode) fopen(name, mode)
# endif
@@ -6206,13 +6435,14 @@ PUBLIC FILE *LYOpenTempRewrite ARGS3(
* We truncate and then append, this avoids having a small
* window in which the file doesn't exist. - kw
*/
+#if HAVE_TRUNCATE
if (truncate(fname, 0) != 0) {
CTRACE(tfp, "... truncate(%s,0) failed: %s\n",
fname, LYStrerror(errno));
return (LYOpenTemp(fname, suffix, mode));
- } else {
- return (LYReopenTemp(fname));
}
+#endif
+ return (LYReopenTemp(fname));
} else if (writable_exists) {
/*
* File exists, writable if we checked, but something is wrong
@@ -6662,7 +6892,7 @@ PUBLIC void LYTrimPathSep ARGS1(
#endif
/*
- * Add a trailing path-separator to avoid confusing other programs when we concatenate
+ * Add a trailing path-separator to avoid confusing other programs when we concateate
* to it. This only applies to local filesystems.
*/
PUBLIC void LYAddPathSep ARGS1(
@@ -6767,6 +6997,31 @@ PUBLIC int LYCopyFile ARGS2(
char *, src,
char *, dst)
{
+#ifdef SH_EX
+
+#define BUF_SIZE 1024
+
+ FILE *fin, *fout;
+ unsigned char buff[BUF_SIZE];
+ int len;
+
+ fin = fopen(src, "rb");
+ if (fin == NULL)
+ return EOF;
+
+ fout = fopen(dst, "wb");
+ if (fout == NULL)
+ return EOF;
+
+ while ((len = fread(buff, 1, BUF_SIZE, fin)) > 0) {
+ fwrite(buff, 1, len, fout);
+ }
+ fclose(fin);
+ fclose(fout);
+
+ return 0;
+
+#else
int code;
char *the_command = 0;
@@ -6781,8 +7036,8 @@ PUBLIC int LYCopyFile ARGS2(
start_curses();
FREE(the_command);
-
return code;
+#endif
}
/*
@@ -6830,12 +7085,67 @@ PUBLIC int LYSystem ARGS1(
}
}
# endif
+
+#if defined(__CYGWIN__) && defined(DOSPATH) /* 1999/02/26 (Fri) */
+ {
+ char cmd[LY_MAXPATH];
+ char win32_name[LY_MAXPATH];
+ char new_cmd[LY_MAXPATH];
+ char new_command[LY_MAXPATH * 2 + 10];
+ char *p, *q;
+
+ p = command;
+ q = cmd;
+ while (*p) {
+ if (*p == ' ')
+ break;
+ else
+ *q = *p;
+ p++;
+ q++;
+ }
+ *q = '\0';
+
+ if (cmd[0] == '/')
+ cygwin_conv_to_full_posix_path(cmd, new_cmd);
+ else
+ strcpy(new_cmd, cmd);
+
+ while (*p == ' ')
+ p++;
+
+ if (strchr(p, '\\') == NULL) {
+ /* for Windows Application */
+ cygwin_conv_to_full_win32_path(p, win32_name);
+ sprintf(new_command, "%s \"%s\"", new_cmd, win32_name);
+ } else {
+ /* for DOS like editor */
+ q = win32_name;
+ while (*p) {
+ if (*p == '\\') {
+ if (*(p+1) == '\\')
+ p++;
+ }
+ *q = *p;
+ q++, p++;
+ }
+ *q = '\0';
+ sprintf(new_command, "%s %s", new_cmd, win32_name);
+ }
+ command = new_command;
+ }
+#endif
+
+#if _WIN_CC
+ code = exec_command(command, TRUE); /* Wait exec */
+#else
if (restore_sigpipe_for_children)
signal(SIGPIPE, SIG_DFL); /* Some commands expect the default */
code = system(command);
if (restore_sigpipe_for_children)
signal(SIGPIPE, SIG_IGN); /* Ignore it again - kw */
#endif
+#endif
#ifdef __DJGPP__
__djgpp_set_ctrl_c(1);
@@ -6853,15 +7163,73 @@ PUBLIC int LYSystem ARGS1(
/*
* Return a string which can be used in LYSystem() for spawning a subshell
*/
+#if defined(__CYGWIN__) && defined(DOSPATH) /* 1999/02/26 (Fri) */
+PUBLIC int Cygwin_Shell NOARGS
+{
+ char *shell;
+ int code;
+ STARTUPINFO startUpInfo;
+ PROCESS_INFORMATION procInfo;
+ SECURITY_ATTRIBUTES sa;
+
+ /* Set up security attributes to allow inheritance of the file handle */
+
+ sa.nLength = sizeof(SECURITY_ATTRIBUTES);
+ sa.lpSecurityDescriptor = 0;
+ sa.bInheritHandle=TRUE;
+
+ /* Init a startup structure */
+ GetStartupInfo(&startUpInfo);
+
+ shell = getenv("COMSPEC");
+
+ /* Create the child process, specifying
+ inherited handles. Pass the value of the
+ handle as a command line parameter */
+ code = 0;
+ if (shell) {
+ code = CreateProcess(0, shell, 0, 0,
+ TRUE, 0,
+ 0, 0, &startUpInfo, &procInfo);
+
+ if (!code) {
+ printf("shell = [%s], code = %d\n", shell, GetLastError());
+ }
+
+ /* wait for the child to return (this is not a requirement
+ since the child is its own independent process) */
+ WaitForSingleObject(procInfo.hProcess, INFINITE);
+ }
+
+ return code;
+}
+#endif
+
PUBLIC char *LYSysShell NOARGS
{
char *shell = 0;
#ifdef DOSPATH
- if (getenv("SHELL") != NULL) {
- shell = getenv("SHELL");
- } else {
- shell = (getenv("COMSPEC") == NULL) ? "command.com" : getenv("COMSPEC");
+#ifdef SH_EX
+ shell = getenv("SHELL");
+ if (shell) {
+ if (access(shell, 0) != 0)
+ shell = getenv("COMSPEC");
+ }
+ if (shell == NULL) {
+ if (system_is_NT)
+ shell = "cmd.exe";
+ else
+ shell = "command.com";
+ }
+#else
+ shell = getenv("SHELL");
+ if (shell == NULL) {
+ shell = getenv("COMSPEC");
+ }
+ if (shell == NULL) {
+ shell = "command.com";
}
+#endif /* SH_EX */
#else
#ifdef __EMX__
if (getenv("SHELL") != NULL) {
@@ -6922,3 +7290,195 @@ PUBLIC void LYsetXDisplay ARGS1(
}
}
}
+
+#if defined(WIN_EX) /* 1997/10/16 (Thu) 20:13:28 */
+
+#define MAX_DOS_PATH 128 /* exactly 80 */
+
+PUBLIC int put_clip(char *szBuffer)
+{
+ HANDLE hWnd;
+ HANDLE m_hLogData;
+ LPTSTR pLogData;
+ HANDLE hClip;
+ int len;
+
+ if (szBuffer == NULL)
+ return EOF;
+
+ len = strlen(szBuffer);
+ if (len == 0)
+ return EOF;
+ else
+ len ++;
+
+ m_hLogData = GlobalAlloc(GHND, len);
+ if (m_hLogData == NULL) {
+ return EOF;
+ }
+
+ hWnd = NULL;
+ if (!OpenClipboard(hWnd)) {
+ return EOF;
+ }
+ /* Remove the current Clipboard contents */
+ if (!EmptyClipboard()) {
+ GlobalFree(m_hLogData);
+ return EOF;
+ }
+
+ /* Lock the global memory while we write to it. */
+ pLogData = (LPTSTR) GlobalLock(m_hLogData);
+
+ lstrcpy((LPTSTR) pLogData, szBuffer);
+ GlobalUnlock(m_hLogData);
+
+ /* If there were any lines at all then copy them to clipboard. */
+ hClip = SetClipboardData(CF_TEXT, m_hLogData);
+ if (!hClip) {
+ /* If we couldn't clip the data then free the global handle. */
+ GlobalFree(m_hLogData);
+ }
+
+ CloseClipboard();
+ return 0;
+}
+
+PUBLIC int get_clip(char *szBuffer, int size)
+{
+ HANDLE hWnd;
+ HANDLE m_hLogData;
+ LPTSTR pLogData;
+ int val;
+
+ hWnd = NULL;
+ if (!OpenClipboard(hWnd)) {
+ return 0;
+ }
+
+ lstrcpy(szBuffer, "");
+ m_hLogData = GetClipboardData(CF_TEXT);
+
+ if (m_hLogData == NULL) {
+ val = 0;
+ } else {
+ pLogData = (LPTSTR) GlobalLock(m_hLogData);
+
+ val = strlen((LPTSTR) pLogData);
+ if (size > val)
+ lstrcpy(szBuffer, (LPTSTR) pLogData);
+ else {
+ val = size - 1;
+ lstrcpyn(szBuffer, (LPTSTR) pLogData, val);
+ szBuffer[val] = '\0';
+ }
+
+ GlobalUnlock(m_hLogData);
+ }
+ CloseClipboard();
+
+ return val;
+}
+
+
+PUBLIC char *HTDOS_short_name(char *path)
+{
+ static char sbuf[MAX_DOS_PATH];
+ char *ret;
+ DWORD r;
+
+ r = GetShortPathName(path, sbuf, sizeof sbuf);
+ if (r >= sizeof sbuf) {
+#if 0 /* DEBUG */
+ fprintf(stderr, "bug: recompile with MAX_DOS_PATH > %d\n", r);
+#endif
+ ret = path;
+ }
+ if (r == 0) {
+ ret = path;
+ } else {
+ ret = sbuf;
+ }
+ return ret;
+}
+#endif
+
+#if defined(WIN_EX)
+
+#ifndef WSABASEERR
+#define WSABASEERR 10000
+#endif
+
+/*
+ * Description: the windows32 version of perror()
+ *
+ * Returns: a pointer to a static error
+ *
+ * Notes/Dependencies: I got this from
+ * comp.os.ms-windows.programmer.win32
+ */
+PUBLIC char * w32_strerror(DWORD ercode)
+{
+/* __declspec(thread) necessary if you will use multiple threads */
+#ifdef __CYGWIN__
+ static char msg_buff[256];
+#else
+ __declspec(thread) static char msg_buff[256];
+#endif
+ HMODULE hModule;
+ int i, msg_type;
+ unsigned char *p, *q, tmp_buff[256];
+
+ hModule = NULL;
+ msg_type = FORMAT_MESSAGE_FROM_SYSTEM;
+ /* Fill message buffer with a default message in
+ * case FormatMessage fails
+ */
+ wsprintf(msg_buff, "Error %ld", ercode);
+
+ /*
+ * Special code for winsock error handling.
+ */
+ if (ercode > WSABASEERR) {
+ hModule = GetModuleHandle("wsock32");
+#if 0
+ if (hModule == NULL) {
+ hModule = LoadLibrary("wsock32");
+ }
+#endif
+ if (hModule == NULL)
+ ercode = GetLastError();
+ else
+ msg_type = FORMAT_MESSAGE_FROM_HMODULE;
+ }
+ /*
+ * message handling
+ */
+ FormatMessage(msg_type,
+ hModule,
+ ercode,
+ LANG_NEUTRAL,
+ msg_buff,
+ sizeof(msg_buff),
+ NULL);
+
+#if 0
+ if (hModule) {
+ FreeLibrary(hModule);
+ }
+#endif
+
+ strcpy(tmp_buff, msg_buff);
+ p = q = tmp_buff;
+ i = 0;
+ while (*p) {
+ if (!(*p == '\n' || *p == '\r'))
+ msg_buff[i++] = *p;
+ p++;
+ }
+ msg_buff[i] = '\0';
+
+ return msg_buff;
+}
+
+#endif
diff --git a/src/LYUtils.h b/src/LYUtils.h
index 10cf755b..9d962a7c 100644
--- a/src/LYUtils.h
+++ b/src/LYUtils.h
@@ -128,6 +128,15 @@ 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));
+
+
+#if defined(WIN_EX) /* 1997/10/16 (Thu) 20:13:28 */
+extern int put_clip(char *szBuffer);
+extern int get_clip(char *szBuffer, int size);
+extern char *HTDOS_short_name(char *path);
+extern char *w32_strerror(DWORD ercode);
+#endif
#ifdef VMS
extern void Define_VMSLogical PARAMS((char *LogicalName, char *LogicalValue));
@@ -220,4 +229,14 @@ extern HTList *sug_filenames;
#define HIDE_CHMOD 0600
#define HIDE_UMASK 0077
+#if defined(DOSPATH) || defined(WIN_EX) || defined(__CYGWIN__)
+#define TXT_R "rt"
+#define TXT_W "wt"
+#define TXT_A "at+"
+#else
+#define TXT_R "r"
+#define TXT_W "w"
+#define TXT_A "a+"
+#endif
+
#endif /* LYUTILS_H */
diff --git a/src/LYexit.c b/src/LYexit.c
index 92cfe6b0..75046338 100644
--- a/src/LYexit.c
+++ b/src/LYexit.c
@@ -92,6 +92,12 @@ PUBLIC void LYexit ARGS1(
{
#ifndef VMS /* On VMS, the VMSexit() handler does these. - FM */
#ifdef _WINDOWS
+ extern CRITICAL_SECTION critSec_DNS; /* 1998/09/03 (Thu) 22:01:56 */
+ extern CRITICAL_SECTION critSec_READ; /* 1998/09/03 (Thu) 22:01:56 */
+
+ DeleteCriticalSection(&critSec_DNS);
+ DeleteCriticalSection(&critSec_READ);
+
WSACleanup();
#endif
if (LYOutOfMemory == TRUE) {
diff --git a/src/LYrcFile.c b/src/LYrcFile.c
index efe6b22e..cc9d6221 100644
--- a/src/LYrcFile.c
+++ b/src/LYrcFile.c
@@ -49,7 +49,7 @@ PUBLIC void read_rc NOPARAMS
/*
* Open the RC file for reading.
*/
- if ((fp = fopen(rcfile, "r")) == NULL) {
+ if ((fp = fopen(rcfile, TXT_R)) == NULL) {
return;
}
@@ -333,7 +333,7 @@ PUBLIC void read_rc NOPARAMS
if (LYstrstr(cp, "LINKS_ARE_NUMBERED"))
keypad_mode = LINKS_ARE_NUMBERED;
else if (LYstrstr(cp, "LINKS_AND_FORM_FIELDS_ARE_NUMBERED"))
- keypad_mode = LINKS_AND_FORM_FIELDS_ARE_NUMBERED;
+ keypad_mode = LINKS_AND_FIELDS_ARE_NUMBERED;
else
keypad_mode = NUMBERS_AS_ARROWS;
diff --git a/src/UCdomap.c b/src/UCdomap.c
index 6ba65391..b77bacfd 100644
--- a/src/UCdomap.c
+++ b/src/UCdomap.c
@@ -763,7 +763,7 @@ PRIVATE void con_set_default_unimap NOARGS
p = dfont_unitable;
for (i = 0; i < 256; i++) {
for (j = dfont_unicount[i]; j; j--) {
- con_insert_unipair(*(p++), i, 1);
+ con_insert_unipair(*(p++), (u16)i, 1);
}
}
@@ -820,7 +820,7 @@ PRIVATE int UC_con_set_unimap ARGS2(
for (i = 0; i < 256 && UCInfo[UC_charset_out_hndl].unicount != NULL; i++) {
for (j = UCInfo[UC_charset_out_hndl].unicount[i]; j; j--) {
- con_insert_unipair(*(p++), i, 0);
+ con_insert_unipair(*(p++), (u16)i, 0);
}
}
diff --git a/src/Xsystem.c b/src/Xsystem.c
new file mode 100644
index 00000000..e82cc5a4
--- /dev/null
+++ b/src/Xsystem.c
@@ -0,0 +1,598 @@
+/* $Id: Xsystem.c,v 1.1 1999/07/14 16:44:55 tom Exp $
+ * like system("cmd") but return with exit code of "cmd"
+ * for Turbo-C/MS-C/LSI-C
+ * This code is in the public domain.
+ *
+ * $Log: Xsystem.c,v $
+ * Revision 1.1 1999/07/14 16:44:55 tom
+ * Initial revision
+ *
+ *
+ * Revision 1.14 1997/10/17 (Fri) 16:28:24 senshu
+ * *** for Win32 version ***
+ *
+ * Revision 1.13 1992/02/24 06:59:13 serow
+ * *** empty log message ***
+ *
+ * Revision 1.12 1991/04/09 08:48:20 serow
+ * ignore new line at command line tail
+ *
+ * Revision 1.11 1991/03/12 07:12:50 serow
+ * CMDLINE
+ *
+ * Revision 1.10 91/02/24 05:10:14 serow
+ * 2>&1
+ *
+ * Revision 1.9 91/02/22 07:01:17 serow
+ * NEAR for ms-c
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <io.h>
+#include <process.h>
+#ifndef __CYGWIN__
+#include <dos.h>
+#endif
+
+#ifndef USECMDLINE
+#define USECMDLINE 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#define FALSE 0
+#endif
+
+#define STR_MAX 512 /* MAX command line */
+
+extern char *mktemp(char *);
+
+#define UCH(c) ((unsigned char)(c))
+#define isk1(c) ((0x81<=UCH(c)&&UCH(c)<=0x9F)||(0xE0<=UCH(c)&&UCH(c)<=0xFC))
+#define isq(c) ((c) == '"')
+#define isspc(c) ((c) == ' ' || (c) == '\t')
+#define issep(c) (isspc(c) || (c) == '"' || (c) == '\'' || (c) == '<' || (c) == '>' || (c) == 0)
+#define issep2(c) (issep(c) || (c) == '.' || (c) == '\\' || (c) == '/')
+#define isdeg(c) ('0' <= (c) && (c) <= '9')
+
+#if 0 /* MS-C */
+#define NEAR _near
+#else
+#define NEAR
+#endif
+
+typedef struct _proc {
+ struct _proc *next;
+ char *line;
+ char *cmd;
+ char *arg;
+ char *inf;
+ int infmod;
+ char *outf;
+ int outfmod;
+ int ored[10];
+ int sred[10];
+} PRO;
+
+static PRO *p1 = 0;
+
+static char *NEAR
+xmalloc(size_t n)
+{
+ char *bp;
+
+ if ((bp = calloc(1, n)) == (char *) 0) {
+ write(2, "xsystem: Out of memory.!\n", 25);
+ exit(1);
+ }
+ return bp;
+}
+
+static char *NEAR
+xrealloc(void *p, size_t n)
+{
+ char *bp;
+
+ if ((bp = realloc(p, n)) == (char *) 0) {
+ write(2, "xsystem: Out of memory!.\n", 25);
+ exit(1);
+ }
+ return bp;
+}
+
+static int NEAR
+is_builtin_command(char *s)
+{
+ extern int system_is_NT; /* 1997/11/05 (Wed) 22:10:35 */
+
+ static char *cmdtab[]=
+ {
+ "dir", "type", "rem", "ren", "rename", "erase", "del",
+ "copy", "pause", "date", "time", "ver", "vol", "label",
+ "cd", "chdir", "md", "mkdir", "rd", "rmdir", "break",
+ "verify", "set", "prompt", "path", "exit", "ctty", "echo",
+ "if", "for", "cls", "goto", "shift"
+ ,"start" /* start is NT only */
+ };
+ int i, l, lc, count;
+
+ l = strlen(s);
+ count = sizeof(cmdtab) / sizeof(cmdtab[0]);
+ if (!system_is_NT)
+ count--;
+ for (i = 0; i < count; i++) {
+ if (stricmp(s, cmdtab[i]) == 0)
+ return 1;
+ lc = strlen(cmdtab[i]);
+ if (lc < l && strnicmp(s, cmdtab[i], lc) == 0 && issep2(s[lc]))
+ return 1;
+ }
+ return 0;
+}
+
+static int NEAR
+getswchar(void)
+{
+#ifdef __WIN32__
+ return '/';
+#else
+ union REGS reg;
+
+ reg.x.ax = 0x3700;
+ intdos(&reg, &reg);
+ return reg.h.dl;
+#endif
+}
+
+static int NEAR
+csystem(PRO * p, int flag)
+{
+ char *cmp;
+ char SW[3];
+ int rc;
+
+ if ((cmp = getenv("COMSPEC")) == 0)
+ return -2;
+ SW[0] = getswchar();
+ SW[1] = 'c';
+ SW[2] = 0;
+ rc = spawnl(flag, cmp, cmp, SW, p->cmd, p->arg, (char *) 0);
+ return rc < 0 ? -2 : rc;
+}
+
+static PRO *NEAR
+pars1c(char *s)
+{
+ PRO *pp;
+ char *fnp;
+ int ms, mi;
+ int fs, fi, inpf;
+ int q;
+
+ pp = (PRO *) xmalloc(sizeof(PRO));
+ for (q = 0; q < sizeof(pp->ored) / sizeof(pp->ored[0]); q++)
+ pp->ored[q] = q;
+ while (isspc(*s))
+ s++;
+ pp->line = strdup(s);
+ pp->cmd = xmalloc(ms = 8);
+ mi = 0;
+ while (!issep(*s)) {
+ if (mi >= ms - 1)
+ pp->cmd = xrealloc(pp->cmd, ms += 8);
+ pp->cmd[mi++] = *s++;
+ }
+ pp->cmd[mi] = 0;
+ q = 0;
+ pp->arg = xmalloc(ms = 32);
+ if (isspc(*s))
+ s++;
+ mi = 0;
+ while (*s) {
+ if (mi >= ms - 1) {
+ pp->arg = xrealloc(pp->arg, ms += 32);
+ }
+ if (q == 0) {
+ inpf = 0;
+ if ((mi == 0 || isspc(s[-1])) &&
+ isdeg(s[0]) && s[1] == '>' &&
+ s[2] == '&' && isdeg(s[3])) {
+
+ pp->ored[s[0] & 15] = s[3] & 15;
+ s += 4;
+ continue;
+ } else if (s[0] == '<') {
+ if (pp->inf == 0) {
+ pp->infmod = O_RDONLY;
+ }
+ inpf = 1;
+ } else if (s[0] == '>' && s[1] == '>') {
+ if (pp->outf == 0) {
+ pp->outfmod = O_WRONLY | O_CREAT | O_APPEND;
+ }
+ s++;
+ } else if (s[0] == '>') {
+ if (pp->outf == 0) {
+ pp->outfmod = O_WRONLY | O_CREAT | O_TRUNC;
+ }
+ } else {
+ if (*s == '"')
+ q = !q;
+ pp->arg[mi++] = *s++;
+ continue;
+ }
+ fnp = xmalloc(fs = 16);
+ fi = 0;
+ s++;
+ while (isspc(*s))
+ s++;
+ while (!issep(*s)) {
+ if (fi >= fs - 1)
+ fnp = xrealloc(fnp, fs += 16);
+ fnp[fi++] = *s++;
+ }
+ fnp[fi] = 0;
+ if (inpf) {
+ if (pp->inf == 0)
+ pp->inf = fnp;
+ } else {
+ if (pp->outf == 0)
+ pp->outf = fnp;
+ }
+ } else if (s[0] == '"') {
+ q = !q;
+ pp->arg[mi++] = *s++;
+ } else {
+ pp->arg[mi++] = *s++;
+ }
+ }
+ pp->arg[mi] = 0;
+ return pp;
+}
+
+static PRO *NEAR
+pars(char *s)
+{
+ char *lb;
+ int li, ls, q;
+ int c;
+ PRO *pp;
+
+ lb = xmalloc(ls = STR_MAX); /* about */
+ li = q = 0;
+ p1 = 0;
+
+ for (;;) {
+ c = *s++;
+ if (li >= ls - 2)
+ lb = xrealloc(lb, ls += STR_MAX);
+ if (isk1(c) && *s) {
+ lb[li++] = c;
+ lb[li++] = *s++;
+ } else if ((!q && c == '|') || c == 0 || (c == '\n' && *s == 0)) {
+ lb[li++] = 0;
+ if (p1 == 0) {
+ pp = p1 = pars1c(lb);
+ } else {
+ pp->next = pars1c(lb);
+ pp = pp->next;
+ }
+ li = 0;
+ if (c == 0 || (c == '\n' && *s == 0))
+ break;
+ } else if (c == '"') {
+ q = !q;
+ lb[li++] = c;
+ } else {
+ lb[li++] = c;
+ }
+ }
+ free(lb);
+ return p1;
+}
+
+static int NEAR
+try3(char *cnm, PRO * p, int flag)
+{
+ char cmdb[STR_MAX];
+ int rc;
+
+ strcat(strcpy(cmdb, cnm), ".com");
+ if ((rc = open(cmdb, O_RDONLY)) >= 0) {
+ close(rc);
+ return spawnl(flag, cmdb, cmdb, p->arg, (char *) 0);
+ }
+ strcat(strcpy(cmdb, cnm), ".exe");
+ if ((rc = open(cmdb, O_RDONLY)) >= 0) {
+ close(rc);
+ return spawnl(flag, cmdb, cmdb, p->arg, (char *) 0);
+ }
+ strcat(strcpy(cmdb, cnm), ".bat");
+ if ((rc = open(cmdb, O_RDONLY)) >= 0) {
+ close(rc);
+ return csystem(p, flag);
+ }
+ return -1;
+}
+
+static int NEAR
+prog_go(PRO * p, int flag)
+{
+ char *s;
+ char *extp = 0;
+ char cmdb[STR_MAX];
+ char *ep;
+ int rc, lc, cmd_len;
+
+ cmd_len = strlen(p->cmd);
+
+ s = p->cmd + cmd_len - 1;
+ while (cmd_len && (*s != '\\') && (*s != '/') && (*s != ':')) {
+ if (*s == '.')
+ extp = s;
+ cmd_len--;
+ s--;
+ }
+
+ if (is_builtin_command(p->cmd) || (extp && stricmp(extp, ".bat") == 0))
+ return csystem(p, flag);
+
+ if (s < p->cmd) { /* cmd has no PATH nor Drive */
+ ep = getenv("PATH");
+ strcpy(cmdb, p->cmd);
+ for (;;) {
+ if (extp) { /* has extention */
+ if ((rc = open(cmdb, O_RDONLY)) >= 0) {
+ close(rc);
+ rc = spawnl(flag, cmdb, cmdb, p->arg, (char *) 0);
+ }
+ } else {
+ rc = try3(cmdb, p, flag);
+ }
+ if (rc >= 0)
+ return rc;
+
+ if (ep && *ep) {
+ int i;
+ for (i = 0; *ep != ';' && *ep != '\0'; ep++, i++)
+ lc = cmdb[i] = *ep;
+ if (*ep == ';')
+ ep++;
+ if (i > 0 && lc != ':' && lc != '\\' && lc != '/')
+ cmdb[i++] = '\\';
+ cmdb[i] = 0;
+ strcat(cmdb, p->cmd);
+ } else {
+ if (rc == -2)
+ return rc;
+ return -1;
+ }
+ }
+ } else { /* has PATH or Drive */
+ if (extp) { /* has extention */
+ if ((rc = open(p->cmd, O_RDONLY)) >= 0) {
+ close(rc);
+ return spawnl(flag, p->cmd, p->cmd, p->arg, (char *) 0);
+ }
+ return -1;
+ } else {
+ return try3(p->cmd, p, flag);
+ }
+ }
+}
+
+static char *NEAR
+tmpf(char *tp)
+{
+ char tplate[STR_MAX];
+ char *ev;
+ int i;
+
+ if ((ev = getenv("TMP")) != 0) {
+ strcpy(tplate, ev);
+ i = strlen(ev);
+ if (i && ev[i - 1] != '\\' && ev[i - 1] != '/')
+ strcat(tplate, "\\");
+ } else {
+ tplate[0] = 0;
+ }
+ strcat(tplate, tp);
+ return strdup(mktemp(tplate));
+}
+
+static int NEAR
+redopen(char *fn, int md, int sfd)
+{
+ int rc;
+ int fd;
+
+ if ((fd = open(fn, md, 0666)) != -1) {
+ if (md & O_APPEND)
+ lseek(fd, 0L, SEEK_END);
+ rc = dup(sfd);
+ if (fd != sfd) {
+ dup2(fd, sfd);
+ close(fd);
+ }
+ return rc;
+ }
+ return -1;
+}
+
+static int NEAR
+redclose(int fd, int sfd)
+{
+ if (fd != -1) {
+ dup2(fd, sfd);
+ close(fd);
+ }
+ return -1;
+}
+
+static void NEAR
+redswitch(PRO * p)
+{
+ int d;
+
+ for (d = 0; d < sizeof(p->ored) / sizeof(p->ored[0]); d++) {
+ if (d != p->ored[d]) {
+ p->sred[d] = dup(d);
+ dup2(p->ored[d], d);
+ }
+ }
+}
+
+static void NEAR
+redunswitch(PRO * p)
+{
+ int d;
+
+ for (d = 0; d < sizeof(p->ored) / sizeof(p->ored[0]); d++) {
+ if (d != p->ored[d]) {
+ dup2(p->sred[d], d);
+ close(p->sred[d]);
+ }
+ }
+}
+
+int
+xsystem(char *cmd)
+{
+ PRO *p, *pn;
+ char *pof, *pif, *pxf;
+ int psstdin, psstdout;
+ int rdstdin, rdstdout;
+ int rc = 0;
+ static char *cmdline = 0;
+#if USECMDLINE
+ char *oldcmdline;
+#endif
+
+#ifdef SH_EX /* 1997/11/01 (Sat) 10:04:03 add by JH7AYN */
+ pif = cmd;
+ while (*pif++) {
+ if (*pif == '\r') {
+ *pif = '\0';
+ break;
+ } else if (*pif == '\n') {
+ *pif = '\0';
+ break;
+ }
+ }
+#endif
+
+ pof = pif = pxf = 0;
+ p = pars(cmd);
+ pof = tmpf("p1XXXXXX");
+ pif = tmpf("p2XXXXXX");
+ psstdin = psstdout = rdstdin = rdstdout = -1;
+ while (p) {
+#if USECMDLINE
+ if (!getenv("NOCMDLINE")) {
+ oldcmdline = cmdline;
+ cmdline = xmalloc(strlen(p->cmd) + strlen(p->arg) + 10);
+ strcat(strcat(strcat(strcpy(cmdline, "CMDLINE="), p->cmd), " "), p->arg);
+ putenv(cmdline);
+ if (oldcmdline)
+ free(oldcmdline);
+ }
+#endif
+ if (p->next)
+ psstdout = redopen(pof, O_WRONLY | O_CREAT | O_TRUNC, 1);
+ if (p->inf)
+ rdstdin = redopen(p->inf, p->infmod, 0);
+ if (p->outf)
+ rdstdout = redopen(p->outf, p->outfmod, 1);
+ redswitch(p);
+ rc = prog_go(p, P_WAIT);
+ redunswitch(p);
+ rdstdin = redclose(rdstdin, 0);
+ rdstdout = redclose(rdstdout, 1);
+ psstdout = redclose(psstdout, 1);
+ psstdin = redclose(psstdin, 0);
+ if ((p = p->next) != 0) {
+ pxf = pif;
+ pif = pof;
+ pof = pxf;
+ psstdin = redopen(pif, O_RDONLY, 0);
+ }
+ }
+ unlink(pif);
+ free(pif);
+ unlink(pof);
+ free(pof);
+ for (pn = p = p1; p; p = pn) {
+ pn = p->next;
+ if (p->line)
+ free(p->line);
+ if (p->cmd)
+ free(p->cmd);
+ if (p->arg)
+ free(p->arg);
+ if (p->inf)
+ free(p->inf);
+ if (p->outf)
+ free(p->outf);
+ free(p);
+ }
+ if (rc == -2)
+ return 127;
+ return rc < 0 ? 0xFF00 : rc;
+}
+
+int exec_command(char * cmd, int wait_flag)
+{
+ PRO *p;
+ char *pif;
+ int rc = 0;
+ int cmd_str;
+
+ pif = cmd;
+ while(*pif == ' ')
+ pif++;
+
+ cmd = pif;
+ cmd_str = TRUE;
+
+ while (*pif++) {
+ if (*pif == '\r') {
+ *pif = '\0';
+ break;
+ } else if (*pif == '\n') {
+ *pif = '\0';
+ break;
+ } else if (cmd_str) {
+ if (*pif == '/')
+ *pif = '\\';
+ } else if (cmd_str) {
+ if (*pif == ' ')
+ cmd_str = FALSE;
+ }
+ }
+ p = pars(cmd);
+
+ if (wait_flag)
+ rc = prog_go(p, P_WAIT);
+ else
+ rc = prog_go(p, P_NOWAIT);
+
+ return rc;
+}
+
+
+#ifdef TEST
+#include <stdio.h>
+
+void
+main()
+{
+ char line_buff[STR_MAX];
+
+ while (gets(line_buff)) {
+ printf("\nreturn %04X\n", xsystem(line_buff));
+ }
+}
+#endif /* TEST */
diff --git a/src/chrtrans/README.format b/src/chrtrans/README.format
index df7d335e..7437b503 100644
--- a/src/chrtrans/README.format
+++ b/src/chrtrans/README.format
@@ -82,7 +82,7 @@ c) character translation definitions:
* <range> idem
* <range> <unicode range>
*
- * where <range> ::= <fontpos>-<fontpos>
+ * where <unicode range> ::= <unicode>-<unicode>
* and <unicode> ::= U+<h><h><h><h>
* and <h> ::= <hexadecimal digit>
*
diff --git a/src/chrtrans/UCkd.h b/src/chrtrans/UCkd.h
index 104882d7..a6020696 100644
--- a/src/chrtrans/UCkd.h
+++ b/src/chrtrans/UCkd.h
@@ -1,8 +1,5 @@
#ifndef _UC_KD_H
#define _UC_KD_H
-#ifdef NOTDEFINED
-#include <sys/types.h> /* Included via tcp.h. */
-#endif /* NOTDEFINED */
/*
* NOTE: THE FOLLOWING #define MAY NEED ADJUSTMENT.
diff --git a/src/chrtrans/jcuken_kb.h b/src/chrtrans/jcuken_kb.h
index 8fbe458b..75c8da96 100644
--- a/src/chrtrans/jcuken_kb.h
+++ b/src/chrtrans/jcuken_kb.h
@@ -1,4 +1,4 @@
-static unsigned short kb_layout_jcuken[128] = {
+static LYKeymap_t kb_layout_jcuken[128] = {
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, /* 00..07 */
0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, /* 08..0F */
0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, /* 10..17 */
diff --git a/src/chrtrans/make-msc.bat b/src/chrtrans/make-msc.bat
new file mode 100644
index 00000000..7e69d642
--- /dev/null
+++ b/src/chrtrans/make-msc.bat
@@ -0,0 +1,49 @@
+@echo If .tbl files are added or removed you will need to hand edit
+@echo this batch file.
+@echo .
+@echo off
+REM make -f makefile.w32
+
+nmake -f makefile.msc
+
+makeuctb cp1250_uni.tbl > cp1250_uni.h
+makeuctb cp1251_uni.tbl > cp1251_uni.h
+makeuctb cp1252_uni.tbl > cp1252_uni.h
+makeuctb cp1253_uni.tbl > cp1253_uni.h
+makeuctb cp1255_uni.tbl > cp1255_uni.h
+makeuctb cp1256_uni.tbl > cp1256_uni.h
+makeuctb cp1257_uni.tbl > cp1257_uni.h
+makeuctb cp437_uni.tbl > cp437_uni.h
+makeuctb cp737_uni.tbl > cp737_uni.h
+makeuctb cp775_uni.tbl > cp775_uni.h
+makeuctb cp850_uni.tbl > cp850_uni.h
+makeuctb cp852_uni.tbl > cp852_uni.h
+makeuctb cp862_uni.tbl > cp862_uni.h
+makeuctb cp864_uni.tbl > cp864_uni.h
+makeuctb cp866_uni.tbl > cp866_uni.h
+makeuctb cp866u_uni.tbl > cp866u_uni.h
+makeuctb cp869_uni.tbl > cp869_uni.h
+makeuctb def7_uni.tbl > def7_uni.h
+makeuctb dmcs_uni.tbl > dmcs_uni.h
+makeuctb hp_uni.tbl > hp_uni.h
+makeuctb iso01_uni.tbl > iso01_uni.h
+makeuctb iso02_uni.tbl > iso02_uni.h
+makeuctb iso03_uni.tbl > iso03_uni.h
+makeuctb iso04_uni.tbl > iso04_uni.h
+makeuctb iso05_uni.tbl > iso05_uni.h
+makeuctb iso06_uni.tbl > iso06_uni.h
+makeuctb iso07_uni.tbl > iso07_uni.h
+makeuctb iso08_uni.tbl > iso08_uni.h
+makeuctb iso09_uni.tbl > iso09_uni.h
+makeuctb iso10_uni.tbl > iso10_uni.h
+makeuctb iso15_uni.tbl > iso15_uni.h
+makeuctb koi8r_uni.tbl > koi8r_uni.h
+makeuctb koi8u_uni.tbl > koi8u_uni.h
+makeuctb mac_uni.tbl > mac_uni.h
+makeuctb mnem_suni.tbl > mnem_suni.h
+makeuctb mnem2_suni.tbl > mnem2_suni.h
+makeuctb mnem_suni.tbl > mnem_suni.h
+makeuctb next_uni.tbl > next_uni.h
+makeuctb rfc_suni.tbl > rfc_suni.h
+makeuctb utf8_uni.tbl > utf8_uni.h
+makeuctb viscii_uni.tbl > viscii_uni.h
diff --git a/src/chrtrans/makefile.dos b/src/chrtrans/makefile.dos
index 3a830a4f..cc9884cf 100644
--- a/src/chrtrans/makefile.dos
+++ b/src/chrtrans/makefile.dos
@@ -15,8 +15,8 @@ CC = gcc
MCFLAGS = -O3 -DDOSPATH -DNO_TTYTYP \
-I. \
-I../../WWW/Library/Implementation \
--I../../djgpp/tcplib/include \
--I../../djgpp/tcplib/include/tcp \
+-I../../djgpp/watt32/inc \
+-I../../djgpp/watt32/inc/sys \
-I../..
.SUFFIXES: .tbl
diff --git a/src/chrtrans/makefile.in b/src/chrtrans/makefile.in
index 2e2f2681..87a39825 100644
--- a/src/chrtrans/makefile.in
+++ b/src/chrtrans/makefile.in
@@ -94,7 +94,7 @@ default: $(FONTMAP_INC)
tables: $(TABLES)
makeuctb$x: makeuctb.o
- $(CC) $(CC_OPTS) -o $@ makeuctb.o $(INTLLIB) $(LIBS)
+ $(CC) $(CC_OPTS) $(LDFLAGS) -o $@ makeuctb.o $(INTLLIB) $(LIBS)
makeuctb.o: $(srcdir)/UCkd.h $(srcdir)/makeuctb.c
diff --git a/src/chrtrans/makefile.msc b/src/chrtrans/makefile.msc
new file mode 100644
index 00000000..6885a616
--- /dev/null
+++ b/src/chrtrans/makefile.msc
@@ -0,0 +1,23 @@
+#
+# Makefile for Microsoft Visual C++ 4.2 or later
+#
+
+CC = cl
+LD = link
+
+INCLUDES = /I "." /I ".." /I "..\.." /I "..\..\WWW\Library\Implementation" /I "..\..\lib"
+DEFS = /D "NDEBUG" /D "__WIN32__" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "NO_FILEIO_H" /D "NO_UNISTD_H" /D "_WINDOWS" /D "DOSPATH"
+CFLAGS = /nologo /MT /W3 /GX /O2 /c
+
+LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386
+LIBS = user32.lib wsock32.lib
+
+COMPILE = $(CC) $(CFLAGS) $(INCLUDES) $(DEFS)
+LINK = $(LD) $(LDFLAGS) /out:$@
+
+makeuctb.exe : makeuctb.obj
+ $(LINK) makeuctb.obj $(LIBS)
+
+makeuctb.obj : makeuctb.c
+ $(COMPILE) makeuctb.c
+
diff --git a/src/chrtrans/MAKEFILE.W32 b/src/chrtrans/makefile.w32
index 4968995f..4968995f 100644
--- a/src/chrtrans/MAKEFILE.W32
+++ b/src/chrtrans/makefile.w32
diff --git a/src/chrtrans/makeuctb.c b/src/chrtrans/makeuctb.c
index 1207d3d1..7e6b18da 100644
--- a/src/chrtrans/makeuctb.c
+++ b/src/chrtrans/makeuctb.c
@@ -18,7 +18,6 @@
#define DONT_USE_SOCKS5
#include <HTUtils.h>
-#include <tcp.h>
/*
* Don't try to use LYexit().
*/
diff --git a/src/chrtrans/MAKEW32.BAT b/src/chrtrans/makew32.bat
index 3ad8c16f..47b8ae69 100644
--- a/src/chrtrans/MAKEW32.BAT
+++ b/src/chrtrans/makew32.bat
@@ -1,44 +1,44 @@
-@echo If .tbl files are added or removed you will need to hand edit
-@echo this batch file.
-@echo .
-make -f makefile.w32
-makeuctb cp1250_uni.tbl > cp1250_uni.h
-makeuctb cp1251_uni.tbl > cp1251_uni.h
-makeuctb cp1252_uni.tbl > cp1252_uni.h
-makeuctb cp1253_uni.tbl > cp1253_uni.h
-makeuctb cp1255_uni.tbl > cp1255_uni.h
-makeuctb cp1256_uni.tbl > cp1256_uni.h
-makeuctb cp1257_uni.tbl > cp1257_uni.h
-makeuctb cp437_uni.tbl > cp437_uni.h
-makeuctb cp737_uni.tbl > cp737_uni.h
-makeuctb cp775_uni.tbl > cp775_uni.h
-makeuctb cp850_uni.tbl > cp850_uni.h
-makeuctb cp852_uni.tbl > cp852_uni.h
-makeuctb cp862_uni.tbl > cp862_uni.h
-makeuctb cp864_uni.tbl > cp864_uni.h
-makeuctb cp866_uni.tbl > cp866_uni.h
-makeuctb cp866u_uni.tbl > cp866u_uni.h
-makeuctb cp869_uni.tbl > cp869_uni.h
-makeuctb def7_uni.tbl > def7_uni.h
-makeuctb dmcs_uni.tbl > dmcs_uni.h
-makeuctb hp_uni.tbl > hp_uni.h
-makeuctb iso01_uni.tbl > iso01_uni.h
-makeuctb iso02_uni.tbl > iso02_uni.h
-makeuctb iso03_uni.tbl > iso03_uni.h
-makeuctb iso04_uni.tbl > iso04_uni.h
-makeuctb iso05_uni.tbl > iso05_uni.h
-makeuctb iso06_uni.tbl > iso06_uni.h
-makeuctb iso07_uni.tbl > iso07_uni.h
-makeuctb iso08_uni.tbl > iso08_uni.h
-makeuctb iso09_uni.tbl > iso09_uni.h
-makeuctb iso10_uni.tbl > iso10_uni.h
-makeuctb iso15_uni.tbl > iso15_uni.h
-makeuctb koi8r_uni.tbl > koi8r_uni.h
-makeuctb koi8u_uni.tbl > koi8u_uni.h
-makeuctb mac_uni.tbl > mac_uni.h
-makeuctb mnem2_suni.tbl > mnem2_suni.h
-makeuctb mnem_suni.tbl > mnem_suni.h
-makeuctb next_uni.tbl > next_uni.h
-makeuctb rfc_suni.tbl > rfc_suni.h
-makeuctb utf8_uni.tbl > utf8_uni.h
-makeuctb viscii_uni.tbl > viscii_uni.h
+@echo If .tbl files are added or removed you will need to hand edit
+@echo this batch file.
+@echo .
+make -f makefile.w32
+makeuctb cp1250_uni.tbl > cp1250_uni.h
+makeuctb cp1251_uni.tbl > cp1251_uni.h
+makeuctb cp1252_uni.tbl > cp1252_uni.h
+makeuctb cp1253_uni.tbl > cp1253_uni.h
+makeuctb cp1255_uni.tbl > cp1255_uni.h
+makeuctb cp1256_uni.tbl > cp1256_uni.h
+makeuctb cp1257_uni.tbl > cp1257_uni.h
+makeuctb cp437_uni.tbl > cp437_uni.h
+makeuctb cp737_uni.tbl > cp737_uni.h
+makeuctb cp775_uni.tbl > cp775_uni.h
+makeuctb cp850_uni.tbl > cp850_uni.h
+makeuctb cp852_uni.tbl > cp852_uni.h
+makeuctb cp862_uni.tbl > cp862_uni.h
+makeuctb cp864_uni.tbl > cp864_uni.h
+makeuctb cp866_uni.tbl > cp866_uni.h
+makeuctb cp866u_uni.tbl > cp866u_uni.h
+makeuctb cp869_uni.tbl > cp869_uni.h
+makeuctb def7_uni.tbl > def7_uni.h
+makeuctb dmcs_uni.tbl > dmcs_uni.h
+makeuctb hp_uni.tbl > hp_uni.h
+makeuctb iso01_uni.tbl > iso01_uni.h
+makeuctb iso02_uni.tbl > iso02_uni.h
+makeuctb iso03_uni.tbl > iso03_uni.h
+makeuctb iso04_uni.tbl > iso04_uni.h
+makeuctb iso05_uni.tbl > iso05_uni.h
+makeuctb iso06_uni.tbl > iso06_uni.h
+makeuctb iso07_uni.tbl > iso07_uni.h
+makeuctb iso08_uni.tbl > iso08_uni.h
+makeuctb iso09_uni.tbl > iso09_uni.h
+makeuctb iso10_uni.tbl > iso10_uni.h
+makeuctb iso15_uni.tbl > iso15_uni.h
+makeuctb koi8r_uni.tbl > koi8r_uni.h
+makeuctb koi8u_uni.tbl > koi8u_uni.h
+makeuctb mac_uni.tbl > mac_uni.h
+makeuctb mnem2_suni.tbl > mnem2_suni.h
+makeuctb mnem_suni.tbl > mnem_suni.h
+makeuctb next_uni.tbl > next_uni.h
+makeuctb rfc_suni.tbl > rfc_suni.h
+makeuctb utf8_uni.tbl > utf8_uni.h
+makeuctb viscii_uni.tbl > viscii_uni.h
diff --git a/src/chrtrans/rot13_kb.h b/src/chrtrans/rot13_kb.h
index 8bc1a9dc..41a6a870 100644
--- a/src/chrtrans/rot13_kb.h
+++ b/src/chrtrans/rot13_kb.h
@@ -1,4 +1,4 @@
-static unsigned short kb_layout_rot13[128] = {
+static LYKeymap_t kb_layout_rot13[128] = {
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, /* 00..07 */
0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, /* 08..0F */
0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, /* 10..17 */
diff --git a/src/chrtrans/yawerty_kb.h b/src/chrtrans/yawerty_kb.h
index 2592b822..8698d965 100644
--- a/src/chrtrans/yawerty_kb.h
+++ b/src/chrtrans/yawerty_kb.h
@@ -1,4 +1,4 @@
-static unsigned short kb_layout_yawerty[128] = {
+static LYKeymap_t kb_layout_yawerty[128] = {
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, /* 00..07 */
0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, /* 08..0F */
0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, /* 10..17 */
diff --git a/src/makefile.dos b/src/makefile.dos
index 1a69fc84..a10c0b2d 100644
--- a/src/makefile.dos
+++ b/src/makefile.dos
@@ -1,62 +1,62 @@
-OBJS= UCdomap.o UCAux.o UCAuto.o \
-LYClean.o LYShowInfo.o LYEdit.o LYStrings.o \
-LYMail.o HTAlert.o GridText.o LYGetFile.o \
-LYMain.o LYMainLoop.o LYCurses.o LYBookmark.o LYUtils.o \
-LYOptions.o LYReadCFG.o LYSearch.o LYHistory.o \
-LYForms.o LYPrint.o LYrcFile.o LYDownload.o LYNews.o LYKeymap.o \
-HTML.o HTFWriter.o HTInit.o DefaultStyle.o LYLocal.o LYUpload.o \
-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
-
-CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC)
-
-CC = gcc
-MCFLAGS = -O2 -DHAVE_GETBKGD -DDISP_PARTIAL -DUSE_ZLIB \
- -DSOURCE_CACHE -DUSE_PSRC \
- -DUSE_EXTERNALS -DCOLOR_CURSES -DNCURSES -DFANCY_CURSES \
- -DACCESS_AUTH -DNO_CUSERID -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP \
- -Ichrtrans -I../WWW/library/implementation \
- -I../curses -I../djgpp/tcplib/include -I../djgpp/tcplib/include/tcp
-WWWLIB = ../WWW/library/djgpp/libwww.a ../curses/pdcurses.a ../djgpp/tcplib/obj/libtcp.a
-LIBS=-lz
-
-all: lynx
-
-lynx: message $(OBJS) $(WWWLIB)
- @echo "Linking and creating Lynx executable"
- $(CC) $(CFLAGS) -o lynx.exe $(OBJS) $(WWWLIB) $(SLANGLIB) $(LIBS)
- @echo "Welcome to Lynx!"
-
-message:
- @echo "Compiling Lynx sources"
-
-dbg: $(OBJS) $(WWWLIB)
- @echo "Making Lynx code"
- $(CC) -g $(OBJS) $(CFLAGS) $(WWWLIB) $(SLANGLIB) $(LIBS)
-
-lint:
- lint *.c > ../lint.out
-
-clean:
- rm -f lynx.exe core *.[ob]
-
-DefaultStyle.o: ../userdefs.h
-HTFWriter.o: ../userdefs.h
-LYBookmark.o: ../userdefs.h
-LYCharSets.o: ../userdefs.h
-LYCharUtils.o: ../userdefs.h
-LYCookie.o: ../userdefs.h
-LYDownload.o: ../userdefs.h
-LYEditmap.o: ../userdefs.h
-LYExtern.o: ../userdefs.h
-LYGetFile.o: ../userdefs.h
-LYHistory.o: ../userdefs.h
-LYKeymap.o: ../userdefs.h
-LYMain.o: ../userdefs.h
-LYMainLoop.o: ../userdefs.h
-LYOptions.o: ../userdefs.h
-LYReadCFG.o: ../userdefs.h
-LYShowInfo.o: ../userdefs.h
-LYStrings.o: ../userdefs.h
-LYTraversal.o: ../userdefs.h
+OBJS= UCdomap.o UCAux.o UCAuto.o \
+LYClean.o LYShowInfo.o LYEdit.o LYStrings.o \
+LYMail.o HTAlert.o GridText.o LYGetFile.o \
+LYMain.o LYMainLoop.o LYCurses.o LYBookmark.o LYUtils.o \
+LYOptions.o LYReadCFG.o LYSearch.o LYHistory.o \
+LYForms.o LYPrint.o LYrcFile.o LYDownload.o LYNews.o LYKeymap.o \
+HTML.o HTFWriter.o HTInit.o DefaultStyle.o LYLocal.o LYUpload.o \
+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
+
+CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC)
+
+CC = gcc
+MCFLAGS = -O2 -DHAVE_GETBKGD -DDISP_PARTIAL -DUSE_ZLIB \
+ -DSOURCE_CACHE -DUSE_PSRC \
+ -DUSE_EXTERNALS -DCOLOR_CURSES -DNCURSES -DFANCY_CURSES \
+ -DACCESS_AUTH -DNO_CUSERID -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP \
+ -Ichrtrans -I../WWW/library/implementation \
+ -I../curses -I../djgpp/tcplib/include -I../djgpp/tcplib/include/tcp
+WWWLIB = ../WWW/library/djgpp/libwww.a ../curses/pdcurses.a ../djgpp/tcplib/obj/libtcp.a
+LIBS=-lz
+
+all: lynx
+
+lynx: message $(OBJS) $(WWWLIB)
+ @echo "Linking and creating Lynx executable"
+ $(CC) $(CFLAGS) -o lynx.exe $(OBJS) $(WWWLIB) $(SLANGLIB) $(LIBS)
+ @echo "Welcome to Lynx!"
+
+message:
+ @echo "Compiling Lynx sources"
+
+dbg: $(OBJS) $(WWWLIB)
+ @echo "Making Lynx code"
+ $(CC) -g $(OBJS) $(CFLAGS) $(WWWLIB) $(SLANGLIB) $(LIBS)
+
+lint:
+ lint *.c > ../lint.out
+
+clean:
+ rm -f lynx.exe core *.[ob]
+
+DefaultStyle.o: ../userdefs.h
+HTFWriter.o: ../userdefs.h
+LYBookmark.o: ../userdefs.h
+LYCharSets.o: ../userdefs.h
+LYCharUtils.o: ../userdefs.h
+LYCookie.o: ../userdefs.h
+LYDownload.o: ../userdefs.h
+LYEditmap.o: ../userdefs.h
+LYExtern.o: ../userdefs.h
+LYGetFile.o: ../userdefs.h
+LYHistory.o: ../userdefs.h
+LYKeymap.o: ../userdefs.h
+LYMain.o: ../userdefs.h
+LYMainLoop.o: ../userdefs.h
+LYOptions.o: ../userdefs.h
+LYReadCFG.o: ../userdefs.h
+LYShowInfo.o: ../userdefs.h
+LYStrings.o: ../userdefs.h
+LYTraversal.o: ../userdefs.h
diff --git a/src/makefile.dsl b/src/makefile.dsl
index 326fa90c..9eb56338 100644
--- a/src/makefile.dsl
+++ b/src/makefile.dsl
@@ -1,69 +1,70 @@
-OBJS= UCdomap.o UCAux.o UCAuto.o \
-LYClean.o LYShowInfo.o LYEdit.o LYStrings.o \
-LYMail.o HTAlert.o GridText.o LYGetFile.o \
-LYMain.o LYMainLoop.o LYCurses.o LYBookmark.o LYUtils.o \
-LYOptions.o LYReadCFG.o LYSearch.o LYHistory.o \
-LYForms.o LYPrint.o LYrcFile.o LYDownload.o LYNews.o LYKeymap.o \
-HTML.o HTFWriter.o HTInit.o DefaultStyle.o LYLocal.o LYUpload.o \
-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
-
-CFLAGS= $(MCFLAGS) $(INTLFLAGS) -I. -I.. $(SLANGINC)
-
-# comment this line to suppress DIRED support
-DIRED_DEFS = -DDIRED_SUPPORT -DOK_UUDECODE -DOK_TAR -DOK_GZIP -DOK_ZIP
-
-CC = gcc
-MCFLAGS = -O2 -DDISP_PARTIAL -DUSE_ZLIB -DUSE_EXTERNALS \
-$(DIRED_DEFS) \
--DSOURCE_CACHE -DUSE_PSRC \
--DUSE_SLANG -DDJGPP_KEYHANDLER -DACCESS_AUTH -DNO_CUSERID \
--DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -I../WWW/Library/Implementation \
--I../djgpp/tcplib/include -I./chrtrans -I../djgpp/tcplib/include/tcp
-WWWLIB = ../WWW/Library/djgpp/libwww.a ../djgpp/tcplib/obj/libtcp.a
-LIBS= -lslang -lz # -lintl
-CHRTR= ./chrtrans/
-#INTLFLAGS = -DHAVE_GETTEXT -DHAVE_LIBINTL_H
-
-all: lynx.exe
-
-lynx.exe: message $(OBJS) $(WWWLIB)
- @echo "Linking and creating Lynx executable"
- $(CC) $(CFLAGS) -o lynx.exe $(OBJS) $(WWWLIB) $(SLANGLIB) $(LIBS)
- @echo "Welcome to Lynx!"
-
-message:
- @echo "Compiling Lynx sources"
-
-dbg: $(OBJS) $(WWWLIB)
- @echo "Making Lynx code"
- $(CC) $(OBJS) $(CFLAGS) $(WWWLIB) $(SLANGLIB) $(LIBS)
-
-lint:
- lint *.c > ../lint.out
-
-clean:
- rm -f lynx.exe core *.[ob]
-
-DefaultStyle.o: ../userdefs.h
-HTFWriter.o: ../userdefs.h
-LYBookmark.o: ../userdefs.h
-LYCharSets.o: ../userdefs.h
-LYCharUtils.o: ../userdefs.h
-LYCookie.o: ../userdefs.h
-LYDownload.o: ../userdefs.h
-LYEditmap.o: ../userdefs.h
-LYExtern.o: ../userdefs.h
-LYGetFile.o: ../userdefs.h
-LYHistory.o: ../userdefs.h
-LYKeymap.o: ../userdefs.h
-LYMain.o: ../userdefs.h
-LYMainLoop.o: ../userdefs.h
-LYOptions.o: ../userdefs.h
-LYReadCFG.o: ../userdefs.h
-LYReadCFG.o: ../userdefs.h
-LYShowInfo.o: ../userdefs.h
-LYStrings.o: ../userdefs.h
-LYTraversal.o: ../userdefs.h
-LYUtils.o: ../userdefs.h
+OBJS= UCdomap.o UCAux.o UCAuto.o \
+LYClean.o LYShowInfo.o LYEdit.o LYStrings.o \
+LYMail.o HTAlert.o GridText.o LYGetFile.o \
+LYMain.o LYMainLoop.o LYCurses.o LYBookmark.o LYUtils.o \
+LYOptions.o LYReadCFG.o LYSearch.o LYHistory.o \
+LYForms.o LYPrint.o LYrcFile.o LYDownload.o LYNews.o LYKeymap.o \
+HTML.o HTFWriter.o HTInit.o DefaultStyle.o LYLocal.o LYUpload.o \
+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
+
+CFLAGS= $(MCFLAGS) $(INTLFLAGS) -I. -I.. $(SLANGINC)
+
+# comment this line to suppress DIRED support
+DIRED_DEFS = -DDIRED_SUPPORT -DOK_UUDECODE -DOK_TAR -DOK_GZIP -DOK_ZIP
+
+CC = gcc
+MCFLAGS = -O2 -DDISP_PARTIAL -DUSE_ZLIB -DUSE_EXTERNALS \
+-DWATT32 \
+$(DIRED_DEFS) \
+-DSOURCE_CACHE -DUSE_PSRC \
+-DUSE_SLANG -DDJGPP_KEYHANDLER -DACCESS_AUTH -DNO_CUSERID \
+-DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -I../WWW/Library/Implementation \
+-I../djgpp/watt32/inc -I./chrtrans -I../djgpp/watt32/inc/sys
+WWWLIB = ../WWW/Library/djgpp/libwww.a ../djgpp/watt32/lib/libwatt.a
+LIBS= -lslang -lz # -lintl
+CHRTR= ./chrtrans/
+#INTLFLAGS = -DHAVE_GETTEXT -DHAVE_LIBINTL_H
+
+all: lynx.exe
+
+lynx.exe: message $(OBJS) $(WWWLIB)
+ @echo "Linking and creating Lynx executable"
+ $(CC) $(CFLAGS) -o lynx.exe $(OBJS) $(WWWLIB) $(SLANGLIB) $(LIBS)
+ @echo "Welcome to Lynx!"
+
+message:
+ @echo "Compiling Lynx sources"
+
+dbg: $(OBJS) $(WWWLIB)
+ @echo "Making Lynx code"
+ $(CC) $(OBJS) $(CFLAGS) $(WWWLIB) $(SLANGLIB) $(LIBS)
+
+lint:
+ lint *.c > ../lint.out
+
+clean:
+ rm -f lynx.exe core *.[ob]
+
+DefaultStyle.o: ../userdefs.h
+HTFWriter.o: ../userdefs.h
+LYBookmark.o: ../userdefs.h
+LYCharSets.o: ../userdefs.h
+LYCharUtils.o: ../userdefs.h
+LYCookie.o: ../userdefs.h
+LYDownload.o: ../userdefs.h
+LYEditmap.o: ../userdefs.h
+LYExtern.o: ../userdefs.h
+LYGetFile.o: ../userdefs.h
+LYHistory.o: ../userdefs.h
+LYKeymap.o: ../userdefs.h
+LYMain.o: ../userdefs.h
+LYMainLoop.o: ../userdefs.h
+LYOptions.o: ../userdefs.h
+LYReadCFG.o: ../userdefs.h
+LYReadCFG.o: ../userdefs.h
+LYShowInfo.o: ../userdefs.h
+LYStrings.o: ../userdefs.h
+LYTraversal.o: ../userdefs.h
+LYUtils.o: ../userdefs.h
diff --git a/src/makefile.wsl b/src/makefile.wsl
index a54731d2..a97b51bf 100644
--- a/src/makefile.wsl
+++ b/src/makefile.wsl
@@ -1,64 +1,64 @@
-OBJS= UCdomap.o UCAux.o UCAuto.o \
-LYClean.o LYShowInfo.o LYEdit.o LYStrings.o \
-LYMail.o HTAlert.o GridText.o LYGetFile.o \
-LYMain.o LYMainLoop.o LYCurses.o LYBookmark.o LYUtils.o \
-LYOptions.o LYReadCFG.o LYSearch.o LYHistory.o \
-LYForms.o LYPrint.o LYrcFile.o LYDownload.o LYNews.o LYKeymap.o \
-HTML.o HTFWriter.o HTInit.o DefaultStyle.o LYLocal.o LYUpload.o \
-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
-
-CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC)
-
-CC = gcc
-MCFLAGS = -O2 -DDISP_PARTIAL -DUSE_ZLIB -DUSE_EXTERNALS \
--DSOURCE_CACHE -DUSE_PSRC \
--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
-WWWLIB = ../WWW/library/djgpp/libwww.a ../djgpp/tcplib/obj/libtcp.a
-LIBS= -lslang -lz
-CHRTR= ./chrtrans/
-
-all: lynx.exe
-
-lynx.exe: message $(OBJS) $(WWWLIB)
- @echo "Linking and creating Lynx executable"
- $(CC) $(CFLAGS) -o lynx.exe $(OBJS) $(WWWLIB) $(SLANGLIB) $(LIBS)
- @echo "Welcome to Lynx!"
-
-message:
- @echo "Compiling Lynx sources"
-
-dbg: $(OBJS) $(WWWLIB)
- @echo "Making Lynx code"
- $(CC) $(OBJS) $(CFLAGS) $(WWWLIB) $(SLANGLIB) $(LIBS)
-
-lint:
- lint *.c > ../lint.out
-
-clean:
- rm -f lynx.exe core *.[ob]
-
-DefaultStyle.o: ../userdefs.h
-HTFWriter.o: ../userdefs.h
-LYBookmark.o: ../userdefs.h
-LYCharSets.o: ../userdefs.h
-LYCharUtils.o: ../userdefs.h
-LYCookie.o: ../userdefs.h
-LYDownload.o: ../userdefs.h
-LYEditmap.o: ../userdefs.h
-LYExtern.o: ../userdefs.h
-LYGetFile.o: ../userdefs.h
-LYHistory.o: ../userdefs.h
-LYKeymap.o: ../userdefs.h
-LYMain.o: ../userdefs.h
-LYMainLoop.o: ../userdefs.h
-LYOptions.o: ../userdefs.h
-LYReadCFG.o: ../userdefs.h
-LYReadCFG.o: ../userdefs.h
-LYShowInfo.o: ../userdefs.h
-LYStrings.o: ../userdefs.h
-LYTraversal.o: ../userdefs.h
-LYUtils.o: ../userdefs.h
+OBJS= UCdomap.o UCAux.o UCAuto.o \
+LYClean.o LYShowInfo.o LYEdit.o LYStrings.o \
+LYMail.o HTAlert.o GridText.o LYGetFile.o \
+LYMain.o LYMainLoop.o LYCurses.o LYBookmark.o LYUtils.o \
+LYOptions.o LYReadCFG.o LYSearch.o LYHistory.o \
+LYForms.o LYPrint.o LYrcFile.o LYDownload.o LYNews.o LYKeymap.o \
+HTML.o HTFWriter.o HTInit.o DefaultStyle.o LYLocal.o LYUpload.o \
+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
+
+CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC)
+
+CC = gcc
+MCFLAGS = -O2 -DDISP_PARTIAL -DUSE_ZLIB -DUSE_EXTERNALS \
+-DSOURCE_CACHE -DUSE_PSRC \
+-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
+WWWLIB = ../WWW/library/djgpp/libwww.a ../djgpp/tcplib/obj/libtcp.a
+LIBS= -lslang -lz
+CHRTR= ./chrtrans/
+
+all: lynx.exe
+
+lynx.exe: message $(OBJS) $(WWWLIB)
+ @echo "Linking and creating Lynx executable"
+ $(CC) $(CFLAGS) -o lynx.exe $(OBJS) $(WWWLIB) $(SLANGLIB) $(LIBS)
+ @echo "Welcome to Lynx!"
+
+message:
+ @echo "Compiling Lynx sources"
+
+dbg: $(OBJS) $(WWWLIB)
+ @echo "Making Lynx code"
+ $(CC) $(OBJS) $(CFLAGS) $(WWWLIB) $(SLANGLIB) $(LIBS)
+
+lint:
+ lint *.c > ../lint.out
+
+clean:
+ rm -f lynx.exe core *.[ob]
+
+DefaultStyle.o: ../userdefs.h
+HTFWriter.o: ../userdefs.h
+LYBookmark.o: ../userdefs.h
+LYCharSets.o: ../userdefs.h
+LYCharUtils.o: ../userdefs.h
+LYCookie.o: ../userdefs.h
+LYDownload.o: ../userdefs.h
+LYEditmap.o: ../userdefs.h
+LYExtern.o: ../userdefs.h
+LYGetFile.o: ../userdefs.h
+LYHistory.o: ../userdefs.h
+LYKeymap.o: ../userdefs.h
+LYMain.o: ../userdefs.h
+LYMainLoop.o: ../userdefs.h
+LYOptions.o: ../userdefs.h
+LYReadCFG.o: ../userdefs.h
+LYReadCFG.o: ../userdefs.h
+LYShowInfo.o: ../userdefs.h
+LYStrings.o: ../userdefs.h
+LYTraversal.o: ../userdefs.h
+LYUtils.o: ../userdefs.h