about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GridText.c30
-rw-r--r--src/HTAlert.c6
-rw-r--r--src/HTML.c22
-rw-r--r--src/LYCharSets.c10
-rw-r--r--src/LYCharSets.h8
-rw-r--r--src/LYCharUtils.c4
-rw-r--r--src/LYCookie.c8
-rw-r--r--src/LYCurses.c63
-rw-r--r--src/LYCurses.h3
-rw-r--r--src/LYEdit.c36
-rw-r--r--src/LYForms.c6
-rw-r--r--src/LYGlobalDefs.h4
-rw-r--r--src/LYJustify.h14
-rw-r--r--src/LYKeymap.c4
-rw-r--r--src/LYLocal.c294
-rw-r--r--src/LYMail.c50
-rw-r--r--src/LYMain.c22
-rw-r--r--src/LYMainLoop.c10
-rw-r--r--src/LYOptions.c6
-rw-r--r--src/LYReadCFG.c14
-rw-r--r--src/LYStrings.c12
-rw-r--r--src/LYStrings.h6
-rw-r--r--src/LYUtils.c26
-rw-r--r--src/LYUtils.h6
-rw-r--r--src/chrtrans/makeuctb.c4
25 files changed, 382 insertions, 286 deletions
diff --git a/src/GridText.c b/src/GridText.c
index 19d634f7..d57d4364 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: GridText.c,v 1.171 2009/05/30 12:54:35 tom Exp $
+ * $LynxId: GridText.c,v 1.174 2009/11/21 17:05:33 Bela.Lubkin Exp $
  *
  *		Character grid hypertext object
  *		===============================
@@ -514,7 +514,7 @@ void *HText_pool_calloc(HText *text, unsigned size)
 
 static void HText_AddHiddenLink(HText *text, TextAnchor *textanchor);
 
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_JUSTIFY_ELTS
 BOOL can_justify_here;
 BOOL can_justify_here_saved;
 
@@ -578,7 +578,7 @@ void mark_justify_start_position(void *text)
 	!IS_CJK_TTY && !in_DT && \
 	can_justify_here && can_justify_this_line && !form_in_htext )
 
-#endif /* EXP_JUSTIFY_ELTS */
+#endif /* USE_JUSTIFY_ELTS */
 
 /*
  * Boring static variable used for moving cursor across
@@ -1211,7 +1211,7 @@ HText *HText_new(HTParentAnchor *anchor)
     ResetPartialLinenos(self);
 #endif
 
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_JUSTIFY_ELTS
     ht_justify_cleanup();
 #endif
     return self;
@@ -1779,7 +1779,7 @@ static void display_title(HText *text)
 	if (i <= 0) {		/* no room at all */
 	    title[0] = '\0';
 	} else {
-	    strcpy(title + LYstrExtent2(title, i), "...");
+	    strcpy(title + LYstrFittable(title, i), "...");
 	}
 	i = 0;
     }
@@ -2939,7 +2939,7 @@ static void split_line(HText *text, unsigned split)
 	 */
 	p = prevdata + split;
 	while (((*p == ' '
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_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
@@ -2987,7 +2987,7 @@ static void split_line(HText *text, unsigned split)
     p = previous->data + previous->size - 1;
     while (p >= previous->data
 	   && (*p == ' '
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_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
@@ -3168,7 +3168,7 @@ static void split_line(HText *text, unsigned split)
      */
     spare = 0;
     if (
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_JUSTIFY_ELTS
 	   this_line_was_split ||
 #endif
 	   (alignment == HT_CENTER ||
@@ -3371,7 +3371,7 @@ static void split_line(HText *text, unsigned split)
 		break;
 	}
     }
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_JUSTIFY_ELTS
     /* now perform justification - by VH */
 
     if (this_line_was_split
@@ -3504,7 +3504,7 @@ static void split_line(HText *text, unsigned split)
     justify_start_position = 0;
     this_line_was_split = FALSE;
     have_raw_nbsps = FALSE;
-#endif /* EXP_JUSTIFY_ELTS */
+#endif /* USE_JUSTIFY_ELTS */
     return;
 }				/* split_line */
 
@@ -4321,7 +4321,7 @@ void HText_appendCharacter(HText *text, int ch)
 		) > (LYcols_cu(text) - 1)))) {
 
 	if (style->wordWrap && HTOutputFormat != WWW_SOURCE) {
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_JUSTIFY_ELTS
 	    if (REALLY_CAN_JUSTIFY(text))
 		this_line_was_split = TRUE;
 #endif
@@ -4366,12 +4366,12 @@ void HText_appendCharacter(HText *text, int ch)
      * Insert normal characters.
      */
     if (ch == HT_NON_BREAK_SPACE
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_JUSTIFY_ELTS
 	&& !REALLY_CAN_JUSTIFY(text)
 #endif
 	)
 	ch = ' ';
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_JUSTIFY_ELTS
     else
 	have_raw_nbsps = TRUE;
 #endif
@@ -11762,13 +11762,13 @@ void HText_setKcode(HText *text, const char *charset,
     /*
      * If no explicit charset string, use the implied one.  - kw
      */
-    if (!charset || *charset == '\0') {
+    if (isEmpty(charset)) {
 	charset = p_in->MIMEname;
     }
     /*
      * Check whether we have a specified charset.  -FM
      */
-    if (!charset || *charset == '\0') {
+    if (isEmpty(charset)) {
 	return;
     }
 
diff --git a/src/HTAlert.c b/src/HTAlert.c
index aba28b9e..ce237e54 100644
--- a/src/HTAlert.c
+++ b/src/HTAlert.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTAlert.c,v 1.85 2009/04/07 00:09:34 tom Exp $
+ * $LynxId: HTAlert.c,v 1.86 2009/11/21 16:32:23 tom Exp $
  *
  *	Displaying messages and getting input for Lynx Browser
  *	==========================================================
@@ -1152,13 +1152,13 @@ void LYSleepMsg(void)
 	LYSleep(MessageSecs);
 }
 
-#ifdef EXP_CMD_LOGGING
+#ifdef USE_CMD_LOGGING
 void LYSleepReplay(void)
 {
     if (okToSleep())
 	LYSleep(ReplaySecs);
 }
-#endif /* EXP_CMD_LOGGING */
+#endif /* USE_CMD_LOGGING */
 
 /*
  * LYstrerror emulates the ANSI strerror() function.
diff --git a/src/HTML.c b/src/HTML.c
index 03d45e80..bb7e2025 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTML.c,v 1.130 2009/08/27 21:17:55 tom Exp $
+ * $LynxId: HTML.c,v 1.132 2009/11/21 17:05:33 Bela.Lubkin Exp $
  *
  *		Structured stream to Rich hypertext converter
  *		============================================
@@ -4219,7 +4219,7 @@ static int HTML_start_element(HTStructured * me, int element_number,
 	     * Set to know we are in a new form.
 	     */
 	    me->inFORM = TRUE;
-	    EMIT_IFDEF_EXP_JUSTIFY_ELTS(form_in_htext = TRUE);
+	    EMIT_IFDEF_USE_JUSTIFY_ELTS(form_in_htext = TRUE);
 
 	    if (present && present[HTML_FORM_ACCEPT_CHARSET]) {
 		accept_cs = (value[HTML_FORM_ACCEPT_CHARSET]
@@ -4405,7 +4405,7 @@ static int HTML_start_element(HTStructured * me, int element_number,
 		 */
 		LYReduceBlanks(I.value);
 	    } else if (!strcasecomp(I.type, "button")) {
-		if (!isEmpty(I.name)) {
+		if (non_empty(I.name)) {
 		    StrAllocCopy(I.value, I.name);
 		} else {
 		    StrAllocCopy(I.value, "BUTTON");
@@ -5565,13 +5565,13 @@ static int HTML_start_element(HTStructured * me, int element_number,
 	(me->sp)--;
 	me->sp[0].style = me->new_style;	/* Stack new style */
 	me->sp[0].tag_number = ElementNumber;
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_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 + MAX_NESTING;
 #endif
     }
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_JUSTIFY_ELTS
     if (in_DT && ElementNumber == HTML_DD)
 	in_DT = FALSE;
     else if (ElementNumber == HTML_DT)
@@ -5620,7 +5620,7 @@ static int HTML_end_element(HTStructured * me, int element_number,
     BOOL BreakFlag = FALSE;
     BOOL intern_flag = FALSE;
     BOOL skip_stack_requested = FALSE;
-    EMIT_IFDEF_EXP_JUSTIFY_ELTS(BOOL reached_awaited_stacked_elt = FALSE);
+    EMIT_IFDEF_USE_JUSTIFY_ELTS(BOOL reached_awaited_stacked_elt = FALSE);
 
 #ifdef USE_PRETTYSRC
     if (psrc_view && !sgml_in_psrc_was_initialized) {
@@ -5770,7 +5770,7 @@ static int HTML_end_element(HTStructured * me, int element_number,
 	     */
 	    return HT_OK;
 	} else if (me->sp < (me->stack + MAX_NESTING - 1)) {
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_JUSTIFY_ELTS
 	    if (wait_for_this_stacked_elt == me->stack - me->sp + MAX_NESTING)
 		reached_awaited_stacked_elt = TRUE;
 #endif
@@ -5806,7 +5806,7 @@ static int HTML_end_element(HTStructured * me, int element_number,
 	}
     }
     if (BreakFlag == TRUE) {
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_JUSTIFY_ELTS
 	if (reached_awaited_stacked_elt)
 	    wait_for_this_stacked_elt = -1;
 #endif
@@ -6189,7 +6189,7 @@ static int HTML_end_element(HTStructured * me, int element_number,
 	me->List_Nesting_Level--;
 	CTRACE((tfp, "HTML_end_element: Reducing List Nesting Level to %d\n",
 		me->List_Nesting_Level));
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_JUSTIFY_ELTS
 	if (element_number == HTML_DL)
 	    in_DT = FALSE;	/*close the term that was without definition. */
 #endif
@@ -6706,7 +6706,7 @@ static int HTML_end_element(HTStructured * me, int element_number,
 		LYShowBadHTML("Bad HTML: Unmatched FORM end tag\n");
 	    }
 	}
-	EMIT_IFDEF_EXP_JUSTIFY_ELTS(form_in_htext = FALSE);
+	EMIT_IFDEF_USE_JUSTIFY_ELTS(form_in_htext = FALSE);
 
 	/*
 	 * Check if we still have a SELECT element open.  FORM may have been
@@ -7182,7 +7182,7 @@ static int HTML_end_element(HTStructured * me, int element_number,
 
     }				/* switch */
 
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_JUSTIFY_ELTS
     if (reached_awaited_stacked_elt)
 	wait_for_this_stacked_elt = -1;
 #endif
diff --git a/src/LYCharSets.c b/src/LYCharSets.c
index 10208de6..900478e0 100644
--- a/src/LYCharSets.c
+++ b/src/LYCharSets.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYCharSets.c,v 1.63 2009/05/25 17:57:41 tom Exp $
+ * $LynxId: LYCharSets.c,v 1.64 2009/11/21 15:52:05 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTCJK.h>
@@ -28,7 +28,7 @@ const char **p_entity_values = NULL;	/* Pointer, for HTML_put_entity() */
 
 			      /* obsolete and probably not used(???)        */
 			      /* will be initialized in HTMLUseCharacterSet */
-#ifdef EXP_CHARSET_CHOICE
+#ifdef USE_CHARSET_CHOICE
 charset_subset_t charset_subsets[MAXCHARSETS];
 BOOL custom_display_charset = FALSE;
 BOOL custom_assumed_doc_charset = FALSE;
@@ -41,7 +41,7 @@ const char *display_charset_choices[MAXCHARSETS + 1];
 const char *assumed_charset_choices[MAXCHARSETS + 1];
 int displayed_display_charset_idx;
 #endif
-#endif /* EXP_CHARSET_CHOICE */
+#endif /* USE_CHARSET_CHOICE */
 
 /*
  * New character sets now declared with UCInit() in UCdomap.c
@@ -1122,7 +1122,7 @@ int LYCharSetsDeclared(void)
     return UCInitialized;
 }
 
-#ifdef EXP_CHARSET_CHOICE
+#ifdef USE_CHARSET_CHOICE
 void init_charset_subsets(void)
 {
     int i, n;
@@ -1154,4 +1154,4 @@ void init_charset_subsets(void)
     }
 #endif
 }
-#endif /* EXP_CHARSET_CHOICE */
+#endif /* USE_CHARSET_CHOICE */
diff --git a/src/LYCharSets.h b/src/LYCharSets.h
index 6ca20fc6..0b698be1 100644
--- a/src/LYCharSets.h
+++ b/src/LYCharSets.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYCharSets.h,v 1.31 2009/05/25 13:48:24 tom Exp $
+ * $LynxId: LYCharSets.h,v 1.32 2009/11/21 15:52:05 tom Exp $
  */
 #ifndef LYCHARSETS_H
 #define LYCHARSETS_H
@@ -70,11 +70,11 @@ extern "C" {
     extern BOOL force_old_UCLYhndl_on_reload;
     extern int forced_UCLYhdnl;
 
-#ifndef  EXP_CHARSET_CHOICE
+#ifndef  USE_CHARSET_CHOICE
 # define ALL_CHARSETS_IN_O_MENU_SCREEN 1
 #endif
 
-#ifdef EXP_CHARSET_CHOICE
+#ifdef USE_CHARSET_CHOICE
     typedef struct {
 	BOOL hide_display;	/* if FALSE, show in "display-charset" menu */
 	BOOL hide_assumed;	/* if FALSE, show in "assumed-charset" menu */
@@ -117,7 +117,7 @@ extern "C" {
 #endif
 /* this will be called after lynx.cfg and .lynxrc are read */
     extern void init_charset_subsets(void);
-#endif				/* EXP_CHARSET_CHOICE */
+#endif				/* USE_CHARSET_CHOICE */
 
 #if !defined(NO_AUTODETECT_DISPLAY_CHARSET)
 #  ifdef __EMX__
diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c
index aacd902e..66040e2a 100644
--- a/src/LYCharUtils.c
+++ b/src/LYCharUtils.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYCharUtils.c,v 1.103 2009/08/27 22:07:54 tom Exp $
+ * $LynxId: LYCharUtils.c,v 1.104 2009/11/21 17:05:33 Bela.Lubkin Exp $
  *
  *  Functions associated with LYCharSets.c and the Lynx version of HTML.c - FM
  *  ==========================================================================
@@ -1136,7 +1136,7 @@ char **LYUCFullyTranslateString(char **str,
     /*
      * Make sure we have a non-empty string.  - FM
      */
-    if (!str || isEmpty(*str))
+    if (isEmpty(*str))
 	return str;
 
     /*
diff --git a/src/LYCookie.c b/src/LYCookie.c
index e3ce7976..ceb9630a 100644
--- a/src/LYCookie.c
+++ b/src/LYCookie.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYCookie.c,v 1.95 2009/01/01 22:28:57 tom Exp $
+ * $LynxId: LYCookie.c,v 1.96 2009/11/24 10:48:33 tom Exp $
  *
  *			       Lynx Cookie Support		   LYCookie.c
  *			       ===================
@@ -1764,8 +1764,10 @@ void LYSetCookie(const char *SetCookie,
 			 PARSE_PATH | PARSE_PUNCTUATION)) != NULL) &&
 	(ptr = strrchr(path, '/')) != NULL) {
 	if (ptr == path) {
-	    *(ptr + 1) = '\0';	/* Leave a single '/' alone */
-	} else {
+	    ++ptr;		/* Leave a single '/' alone */
+	}
+	if (*ptr != '\0') {
+	    CTrace((tfp, "discarding \"%s\" in cookie-path\n", ptr));
 	    *ptr = '\0';
 	}
     }
diff --git a/src/LYCurses.c b/src/LYCurses.c
index 258873ee..c902769d 100644
--- a/src/LYCurses.c
+++ b/src/LYCurses.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYCurses.c,v 1.141 2009/04/07 00:00:40 tom Exp $ */
+/* $LynxId: LYCurses.c,v 1.145 2009/11/21 17:05:33 Bela.Lubkin Exp $ */
 #include <HTUtils.h>
 #include <HTAlert.h>
 
@@ -1228,7 +1228,7 @@ void start_curses(void)
 
 #ifdef USE_COLOR_STYLE
 	/* Curses forgets color settings when we call delscreen() */
-	if (!isEmpty(lynx_lss_file) && LYCanReadFile(lynx_lss_file)) {
+	if (non_empty(lynx_lss_file) && LYCanReadFile(lynx_lss_file)) {
 	    style_readFromFile(lynx_lss_file);
 	}
 	parse_userstyles();
@@ -1485,7 +1485,7 @@ void stop_curses(void)
 
 #ifdef __DJGPP__
     ScreenClear();
-#else /* some flavor of win32?  */
+#elif !defined(PDCURSES)	/* some flavor of win32?  */
     clrscr();
 #endif /* win32 */
 
@@ -1973,28 +1973,25 @@ void LYwaddnstr(WINDOW * w GCC_UNUSED,
 
 /*
  * Determine the number of cells the given string would take up on the screen,
- * limited by the maxCells parameter.  This is used for constructing aligned
- * text in the options and similar forms.
+ * limited (in the case of wide characters) by the maxCells parameter.
  *
- * FIXME: make this account for wrapping, too.
- * FIXME: make this useful for "lynx -dump", which hasn't initialized curses.
+ * If the returnCellNum parameter is TRUE, return the number of cells;
+ * otherwise, return the length (limited by the len parameter) of the prefix of
+ * the string that fits in maxCells cells.
  */
-int LYstrExtent(const char *string, int len, int maxCells)
+static
+int LYstrExtent0(const char *string,
+		 int len,
+		 int maxCells GCC_UNUSED,
+		 BOOL retCellNum GCC_UNUSED)
 {
-    int result = 0;
-    int used;
-
-    if (len < 0)
-	used = (int) strlen(string);
-    else
-	used = len;
+    int used = (len < 0 ? (int) strlen(string) : len);
+    int result = used;
 
-    result = used;
 #ifdef WIDEC_CURSES
     if (used > 0 && lynx_called_initscr) {
 	static WINDOW *fake_win;
 	static int fake_max;
-	int n;
 
 	if (fake_max < maxCells) {
 	    fake_max = (maxCells + 1) * 2;
@@ -2009,8 +2006,9 @@ int LYstrExtent(const char *string, int len, int maxCells)
 	if (fake_win != 0) {
 	    int new_x = 0;
 	    int new_y = 0;
+	    int x = 0;
+	    int n;
 
-	    result = 0;
 	    wmove(fake_win, 0, 0);
 	    for (n = 0; n < used; ++n) {
 		if (IsNormalChar(string[n])) {
@@ -2018,18 +2016,32 @@ int LYstrExtent(const char *string, int len, int maxCells)
 		    getyx(fake_win, new_y, new_x);
 		    if (new_y > 0 || new_x > maxCells)
 			break;
-		    result = new_x;
+		    x = new_x;
 		}
 	    }
+	    result = (retCellNum ? x : n);
 	}
     }
 #endif
-    if (result > maxCells)
-	result = maxCells;
     return result;
 }
 
 /*
+ * Determine the number of cells the given string would take up on the screen,
+ * limited by the maxCells parameter.  This is used for constructing aligned
+ * text in the options and similar forms.
+ *
+ * FIXME: make this account for wrapping, too.
+ * FIXME: make this useful for "lynx -dump", which hasn't initialized curses.
+ */
+int LYstrExtent(const char *string, int len, int maxCells)
+{
+    int result = LYstrExtent0(string, len, maxCells, TRUE);
+
+    return (result > maxCells ? maxCells : result);
+}
+
+/*
  * Return the number of cells in the first 'len' bytes of the string.
  *
  * This relies upon the coincidence that multicell characters use at least as
@@ -2042,6 +2054,15 @@ int LYstrExtent2(const char *string, int len)
 }
 
 /*
+ * Determine the longest prefix of a string that fits in a given number of
+ * cells and return its length.
+ */
+int LYstrFittable(const char *string, int maxCells)
+{
+    return LYstrExtent0(string, -1, maxCells, FALSE);
+}
+
+/*
  * Returns the total number of cells that the string would use.
  */
 int LYstrCells(const char *string)
diff --git a/src/LYCurses.h b/src/LYCurses.h
index 0753e7aa..646bc52b 100644
--- a/src/LYCurses.h
+++ b/src/LYCurses.h
@@ -1,4 +1,4 @@
-/* $LynxId: LYCurses.h,v 1.80 2009/04/07 00:03:47 tom Exp $ */
+/* $LynxId: LYCurses.h,v 1.81 2009/11/21 14:40:20 Bake.Timmons Exp $ */
 #ifndef LYCURSES_H
 #define LYCURSES_H
 
@@ -457,6 +457,7 @@ extern "C" {
     extern int LYscreenWidth(void);
     extern int LYstrExtent(const char *string, int len, int maxCells);
     extern int LYstrExtent2(const char *string, int len);
+    extern int LYstrFittable(const char *string, int maxCells);
     extern int LYstrCells(const char *string);
     extern void LYclear(void);
     extern void LYclrtoeol(void);
diff --git a/src/LYEdit.c b/src/LYEdit.c
index 07c8eda6..4763652f 100644
--- a/src/LYEdit.c
+++ b/src/LYEdit.c
@@ -1,10 +1,11 @@
-/* $LynxId: LYEdit.c,v 1.38 2008/12/29 01:00:53 tom Exp $ */
+/* $LynxId: LYEdit.c,v 1.40 2009/11/22 17:25:19 tom Exp $ */
 #include <HTUtils.h>
 #include <HTParse.h>
 #include <HTAlert.h>
 #include <LYCurses.h>
 #include <LYUtils.h>
 #include <LYGlobalDefs.h>
+#include <LYStrings.h>
 #include <LYEdit.h>
 #ifdef VMS
 #include <unixio.h>
@@ -21,28 +22,29 @@ BOOLEAN editor_can_position(void)
     {
 #ifdef VMS
 	"sedt",
-	"SEDT"
 #else
-	"emacs",
+	"emacs",		/* + xemacs */
 	"jed",
 	"jmacs",
-	"joe",
+	"joe",			/* + rjoe */
 	"jove",
-	"jpico",
 	"jstar",
 	"nano",
-	"pico",
-	"rjoe",
-	"vi"
+	"pico",			/* + jpico */
+	"vi"			/* + vim, xvi, vile, elvis, view... + likely false matches */
 #endif
     };
     unsigned n;
 
     for (n = 0; n < TABLESIZE(table); n++) {
-	if (strstr(editor, table[n]) != 0) {
+	if (LYstrstr(editor, table[n]) != 0) {
 	    return TRUE;
 	}
     }
+    /*
+     * This really isn't right.  LYstrstr() might be too lax,
+     * but this should at least match basename to basename...
+     */
     if (positionable_editor != NULL) {
 	while ((value = (char *) HTList_nextObject(p)) != NULL) {
 	    if (strcmp(editor, value) == 0) {
@@ -152,13 +154,17 @@ int edit_current_file(char *newfile,
     /*
      * Set up the command for the editor.  - FM
      */
-    *position = 0;
+    if (lineno >= 0) {
+	*position = 0;
 #ifdef VMS
-    lineno--;
+	lineno--;
 #endif
-    lineno += (nlinks ? links[cur].ly : 0);
-    if (lineno > 0)
-	sprintf(position, "%d", lineno);
+	lineno += (nlinks ? links[cur].ly : 0);
+	if (lineno > 0)
+	    sprintf(position, "%d", lineno);
+    } else {
+	*position = '\0';
+    }
 
     edit_temporary_file(filename, position, NULL);
     result = TRUE;
@@ -187,7 +193,7 @@ void edit_temporary_file(char *filename,
     int params = 1;
     int rv;
 
-    if (strstr(editor, "pico")) {
+    if (LYstrstr(editor, "pico")) {
 	editor_arg = " -t";	/* No prompt for filename to use */
     }
     if (editor_can_position() && *position) {
diff --git a/src/LYForms.c b/src/LYForms.c
index d6ea2fe9..4a1c5757 100644
--- a/src/LYForms.c
+++ b/src/LYForms.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYForms.c,v 1.81 2009/05/28 23:10:06 tom Exp $ */
+/* $LynxId: LYForms.c,v 1.82 2009/11/21 17:05:33 Bela.Lubkin Exp $ */
 #include <HTUtils.h>
 #include <HTCJK.h>
 #include <HTTP.h>
@@ -266,7 +266,7 @@ int change_form_link_ex(int cur,
 		break;
 	    }
 #endif
-	    if (!form->submit_action || *form->submit_action == '\0') {
+	    if (isEmpty(form->submit_action)) {
 		HTUserMsg(NO_FORM_ACTION);
 		c = DO_NOTHING;
 		break;
@@ -1012,7 +1012,7 @@ void show_formlink_statusline(const FormInfo * form,
 	    char *submit_str = NULL;
 	    char *xkey_info = NULL;
 
-	    if (!no_editor && editor && editor) {
+	    if (!no_editor && non_empty(editor)) {
 		xkey_info = key_for_func_ext(LYK_EDIT_TEXTAREA, for_what);
 #ifdef TEXTAREA_AUTOEXTEDIT
 		if (!xkey_info)
diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h
index d0c5ab1f..fa92e044 100644
--- a/src/LYGlobalDefs.h
+++ b/src/LYGlobalDefs.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYGlobalDefs.h,v 1.121 2009/06/30 08:35:47 tom Exp $
+ * $LynxId: LYGlobalDefs.h,v 1.122 2009/11/21 15:24:48 tom Exp $
  *
  * global variable definitions
  */
@@ -572,7 +572,7 @@ extern "C" {
     extern int LYNoZapKey;	/* 0: off (do 'z' checking), 1: full, 2: initially */
 #endif
 
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_JUSTIFY_ELTS
     extern BOOLEAN ok_justify;
     extern int justify_max_void_percent;
 #endif
diff --git a/src/LYJustify.h b/src/LYJustify.h
index 209d58a8..997cd050 100644
--- a/src/LYJustify.h
+++ b/src/LYJustify.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYJustify.h,v 1.7 2009/04/07 00:24:15 tom Exp $
+ * $LynxId: LYJustify.h,v 1.8 2009/11/21 15:24:48 tom Exp $
  *
  * Justification for lynx - implemented by Vlad Harchev <hvv@hippo.ru>
  * 11 July 1999
@@ -13,7 +13,7 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_JUSTIFY_ELTS
     extern BOOL can_justify_here;
     extern BOOL can_justify_here_saved;
 
@@ -58,24 +58,24 @@ extern "C" {
  */
 #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
+#define EMIT_IFDEF_USE_JUSTIFY_ELTS(x) x
     /*defined in order not to wrap single line of code  into #ifdef/#endif */
 
     extern void ht_justify_cleanup(void);
     extern void mark_justify_start_position(void *text);
 
-#else				/* ! EXP_JUSTIFY_ELTS */
+#else				/* ! USE_JUSTIFY_ELTS */
 /*
  * define empty macros so that they can be used without wrapping them in
- * #ifdef EXP_JUSTIFY_ELTS/#endif
+ * #ifdef USE_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 EMIT_IFDEF_USE_JUSTIFY_ELTS(x)
+#endif				/* USE_JUSTIFY_ELTS */
 #define CAN_JUSTIFY_PUSH_F CAN_JUSTIFY_PUSH(FALSE)
 #ifdef __cplusplus
 }
diff --git a/src/LYKeymap.c b/src/LYKeymap.c
index f5c1af27..c0c4205a 100644
--- a/src/LYKeymap.c
+++ b/src/LYKeymap.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYKeymap.c,v 1.68 2009/01/25 18:34:57 tom Exp $ */
+/* $LynxId: LYKeymap.c,v 1.69 2009/11/21 17:05:33 Bela.Lubkin Exp $ */
 #include <HTUtils.h>
 #include <LYUtils.h>
 #include <LYGlobalDefs.h>
@@ -1204,7 +1204,7 @@ int LYStringToKeycode(char *src)
 	char *dst = 0;
 
 	key = strtol(src, &dst, 0);
-	if (!isEmpty(dst))
+	if (non_empty(dst))
 	    key = -1;
     } else if (len > 6 && !strncasecomp(src, "key-", 4)) {
 	char *dst = 0;
diff --git a/src/LYLocal.c b/src/LYLocal.c
index af1430d6..a2aa3d5b 100644
--- a/src/LYLocal.c
+++ b/src/LYLocal.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYLocal.c,v 1.95 2009/08/26 10:47:37 tom Exp $
+ * $LynxId: LYLocal.c,v 1.104 2009/11/22 16:23:43 tom Exp $
  *
  *  Routines to manipulate the local filesystem.
  *  Written by: Rick Mallett, Carleton University
@@ -103,12 +103,30 @@ struct dired_menu {
 #define DE_FILE    3
 #define DE_SYMLINK 4
     char *sfx;
+    const char *c_sfx;
     char *link;
+    const char *c_link;
     char *rest;
+    const char *c_rest;
     char *href;
+    const char *c_href;
     struct dired_menu *next;
 };
 
+#define GetDiredSuffix(p) ((p)->sfx  ? (p)->sfx  : (p)->c_sfx)
+#define GetDiredLink(p)   ((p)->link ? (p)->link : (p)->c_link)
+#define GetDiredRest(p)   ((p)->rest ? (p)->rest : (p)->c_rest)
+#define GetDiredHref(p)   ((p)->href ? (p)->href : (p)->c_href)
+
+#undef DATA
+#define DATA(cond, sfx, link, rest, href) { \
+	cond, \
+	NULL, sfx, \
+	NULL, link, \
+	NULL, rest, \
+	NULL, href, \
+	NULL }
+
 static struct dired_menu *menu_head = NULL;
 static struct dired_menu defmenu[] = {
 
@@ -119,149 +137,150 @@ static struct dired_menu defmenu[] = {
  * discarded entirely.
  */
 #ifdef SUPPORT_CHDIR
-{ 0,		      "", "Change directory",
-		      "", "LYNXDIRED://CHDIR",			NULL },
+DATA( 0,              "", "Change directory",
+                      "", "LYNXDIRED://CHDIR"),
 #endif
-{ 0,		      "", "New File",
-"(in current directory)", "LYNXDIRED://NEW_FILE%d",		NULL },
+DATA( 0,              "", "New File",
+"(in current directory)", "LYNXDIRED://NEW_FILE%d"),
 
-{ 0,		      "", "New Directory",
-"(in current directory)", "LYNXDIRED://NEW_FOLDER%d",		NULL },
+DATA( 0,              "", "New Directory",
+"(in current directory)", "LYNXDIRED://NEW_FOLDER%d"),
 
 #ifdef OK_INSTALL
-{ DE_FILE,	      "", "Install",
-"selected file to new location", "LYNXDIRED://INSTALL_SRC%p",	NULL },
+DATA( DE_FILE,        "", "Install",
+"selected file to new location", "LYNXDIRED://INSTALL_SRC%p"),
 /* The following (installing a directory) doesn't work for me, at least
    with the "install" from GNU fileutils 4.0.  I leave it in anyway, in
    case one compiles with INSTALL_PATH / INSTALL_ARGS defined to some
    other command for which it works (like a script, or maybe "cp -a"). - kw
 */
-{ DE_DIR,	      "", "Install",
-"selected directory to new location", "LYNXDIRED://INSTALL_SRC%p",	NULL },
+DATA( DE_DIR,         "", "Install",
+"selected directory to new location", "LYNXDIRED://INSTALL_SRC%p"),
 #endif /* OK_INSTALL */
 
-{ DE_FILE,	      "", "Modify File Name",
-"(of current selection)", "LYNXDIRED://MODIFY_NAME%p",		NULL },
-{ DE_DIR,	      "", "Modify Directory Name",
-"(of current selection)", "LYNXDIRED://MODIFY_NAME%p",		NULL },
+DATA( DE_FILE,        "", "Modify File Name",
+"(of current selection)", "LYNXDIRED://MODIFY_NAME%p"),
+DATA( DE_DIR,         "", "Modify Directory Name",
+"(of current selection)", "LYNXDIRED://MODIFY_NAME%p"),
 #ifdef S_IFLNK
-{ DE_SYMLINK,	      "", "Modify Name",
-"(of selected symbolic link)", "LYNXDIRED://MODIFY_NAME%p",	NULL },
+DATA( DE_SYMLINK,     "", "Modify Name",
+"(of selected symbolic link)", "LYNXDIRED://MODIFY_NAME%p"),
 #endif  /* S_IFLNK */
 
 #ifdef OK_PERMIT
-{ DE_FILE,	      "", "Modify File Permissions",
-"(of current selection)", "LYNXDIRED://PERMIT_SRC%p",		NULL },
-{ DE_DIR,	      "", "Modify Directory Permissions",
-"(of current selection)", "LYNXDIRED://PERMIT_SRC%p",		NULL },
+DATA( DE_FILE,        "", "Modify File Permissions",
+"(of current selection)", "LYNXDIRED://PERMIT_SRC%p"),
+DATA( DE_DIR,         "", "Modify Directory Permissions",
+"(of current selection)", "LYNXDIRED://PERMIT_SRC%p"),
 #endif /* OK_PERMIT */
 
-{ DE_FILE,	      "", "Change Location",
-"(of selected file)"	, "LYNXDIRED://MODIFY_LOCATION%p",	NULL },
-{ DE_DIR,	      "", "Change Location",
-"(of selected directory)", "LYNXDIRED://MODIFY_LOCATION%p",	NULL },
+DATA( DE_FILE,        "", "Change Location",
+"(of selected file)"    , "LYNXDIRED://MODIFY_LOCATION%p"),
+DATA( DE_DIR,         "", "Change Location",
+"(of selected directory)", "LYNXDIRED://MODIFY_LOCATION%p"),
 #ifdef S_IFLNK
-{ DE_SYMLINK,	      "", "Change Location",
-"(of selected symbolic link)", "LYNXDIRED://MODIFY_LOCATION%p", NULL },
+DATA( DE_SYMLINK,     "", "Change Location",
+"(of selected symbolic link)", "LYNXDIRED://MODIFY_LOCATION%p"),
 #endif /* S_IFLNK */
 
-{ DE_FILE,	      "", "Remove File",
-   "(current selection)", "LYNXDIRED://REMOVE_SINGLE%p",	NULL },
-{ DE_DIR,	      "", "Remove Directory",
-   "(current selection)", "LYNXDIRED://REMOVE_SINGLE%p",	NULL },
+DATA( DE_FILE,        "", "Remove File",
+   "(current selection)", "LYNXDIRED://REMOVE_SINGLE%p"),
+DATA( DE_DIR,         "", "Remove Directory",
+   "(current selection)", "LYNXDIRED://REMOVE_SINGLE%p"),
 #ifdef S_IFLNK
-{ DE_SYMLINK,	      "", "Remove Symbolic Link",
-   "(current selection)", "LYNXDIRED://REMOVE_SINGLE%p",	NULL },
+DATA( DE_SYMLINK,     "", "Remove Symbolic Link",
+   "(current selection)", "LYNXDIRED://REMOVE_SINGLE%p"),
 #endif /* S_IFLNK */
 
 #if defined(OK_UUDECODE) && !defined(ARCHIVE_ONLY)
-{ DE_FILE,	      "", "UUDecode",
-   "(current selection)", "LYNXDIRED://UUDECODE%p",		NULL },
+DATA( DE_FILE,        "", "UUDecode",
+   "(current selection)", "LYNXDIRED://UUDECODE%p"),
 #endif /* OK_UUDECODE && !ARCHIVE_ONLY */
 
 #if defined(OK_TAR) && !defined(ARCHIVE_ONLY)
-{ DE_FILE,	EXT_TAR_Z, "Expand",
-   "(current selection)", "LYNXDIRED://UNTAR_Z%p",		NULL },
+DATA( DE_FILE,        EXT_TAR_Z, "Expand",
+   "(current selection)", "LYNXDIRED://UNTAR_Z%p"),
 #endif /* OK_TAR && !ARCHIVE_ONLY */
 
 #if defined(OK_TAR) && defined(OK_GZIP) && !defined(ARCHIVE_ONLY)
-{ DE_FILE,     ".tar.gz", "Expand",
-   "(current selection)", "LYNXDIRED://UNTAR_GZ%p",		NULL },
+DATA( DE_FILE,        ".tar.gz", "Expand",
+   "(current selection)", "LYNXDIRED://UNTAR_GZ%p"),
 
-{ DE_FILE,	  ".tgz", "Expand",
-   "(current selection)", "LYNXDIRED://UNTAR_GZ%p",		NULL },
+DATA( DE_FILE,        ".tgz", "Expand",
+   "(current selection)", "LYNXDIRED://UNTAR_GZ%p"),
 #endif /* OK_TAR && OK_GZIP && !ARCHIVE_ONLY */
 
 #ifndef ARCHIVE_ONLY
-{ DE_FILE,	   EXT_Z, "Uncompress",
-   "(current selection)", "LYNXDIRED://DECOMPRESS%p",		NULL },
+DATA( DE_FILE,        EXT_Z, "Uncompress",
+   "(current selection)", "LYNXDIRED://DECOMPRESS%p"),
 #endif /* ARCHIVE_ONLY */
 
 #if defined(OK_GZIP) && !defined(ARCHIVE_ONLY)
-{ DE_FILE,	   ".gz", "Uncompress",
-   "(current selection)", "LYNXDIRED://UNGZIP%p",		NULL },
+DATA( DE_FILE,        ".gz", "Uncompress",
+   "(current selection)", "LYNXDIRED://UNGZIP%p"),
 #endif /* OK_GZIP && !ARCHIVE_ONLY */
 
 #if defined(OK_ZIP) && !defined(ARCHIVE_ONLY)
-{ DE_FILE,	  ".zip", "Uncompress",
-   "(current selection)", "LYNXDIRED://UNZIP%p",		NULL },
+DATA( DE_FILE,        ".zip", "Uncompress",
+   "(current selection)", "LYNXDIRED://UNZIP%p"),
 #endif /* OK_ZIP && !ARCHIVE_ONLY */
 
 #if defined(OK_TAR) && !defined(ARCHIVE_ONLY)
-{ DE_FILE,	  ".tar", "UnTar",
-   "(current selection)", "LYNXDIRED://UNTAR%p",		NULL },
+DATA( DE_FILE,        ".tar", "UnTar",
+   "(current selection)", "LYNXDIRED://UNTAR%p"),
 #endif /* OK_TAR && !ARCHIVE_ONLY */
 
 #ifdef OK_TAR
-{ DE_DIR,	      "", "Tar",
-   "(current selection)", "LYNXDIRED://TAR%p",			NULL },
+DATA( DE_DIR,         "", "Tar",
+   "(current selection)", "LYNXDIRED://TAR%p"),
 #endif /* OK_TAR */
 
 #if defined(OK_TAR) && defined(OK_GZIP)
-{ DE_DIR,	      "", "Tar and compress",
-      "(using GNU gzip)", "LYNXDIRED://TAR_GZ%p",		NULL },
+DATA( DE_DIR,         "", "Tar and compress",
+      "(using GNU gzip)", "LYNXDIRED://TAR_GZ%p"),
 #endif /* OK_TAR && OK_GZIP */
 
 #if defined(OK_TAR) && defined(USE_COMPRESS)
-{ DE_DIR,	      "", "Tar and compress",
-      "(using compress)", "LYNXDIRED://TAR_Z%p",		NULL },
+DATA( DE_DIR,         "", "Tar and compress",
+      "(using compress)", "LYNXDIRED://TAR_Z%p"),
 #endif /* OK_TAR && USE_COMPRESS */
 
 #ifdef OK_ZIP
-{ DE_DIR,	      "", "Package and compress",
-	   "(using zip)", "LYNXDIRED://ZIP%p",			NULL },
+DATA( DE_DIR,         "", "Package and compress",
+           "(using zip)", "LYNXDIRED://ZIP%p"),
 #endif /* OK_ZIP */
 
-{ DE_FILE,	      "", "Compress",
- "(using Unix compress)", "LYNXDIRED://COMPRESS%p",		NULL },
+DATA( DE_FILE,        "", "Compress",
+ "(using Unix compress)", "LYNXDIRED://COMPRESS%p"),
 
 #ifdef OK_GZIP
-{ DE_FILE,	      "", "Compress",
-	  "(using gzip)", "LYNXDIRED://GZIP%p",			NULL },
+DATA( DE_FILE,        "", "Compress",
+          "(using gzip)", "LYNXDIRED://GZIP%p"),
 #endif /* OK_GZIP */
 
 #ifdef OK_ZIP
-{ DE_FILE,	      "", "Compress",
-	   "(using zip)", "LYNXDIRED://ZIP%p",			NULL },
+DATA( DE_FILE,        "", "Compress",
+           "(using zip)", "LYNXDIRED://ZIP%p"),
 #endif /* OK_ZIP */
 
-{ DE_TAG,	      "", "Move all tagged items to another location.",
-		      "", "LYNXDIRED://MOVE_TAGGED%d",		NULL },
+DATA( DE_TAG,         "", "Move all tagged items to another location.",
+                      "", "LYNXDIRED://MOVE_TAGGED%d"),
 
 #ifdef OK_INSTALL
-{ DE_TAG,	      "", "Install tagged files into another directory.",
-		      "", "LYNXDIRED://INSTALL_SRC%00",		NULL },
+DATA( DE_TAG,         "", "Install tagged files into another directory.",
+                      "", "LYNXDIRED://INSTALL_SRC%00"),
 #endif
 
-{ DE_TAG,	      "", "Remove all tagged files and directories.",
-		      "", "LYNXDIRED://REMOVE_TAGGED",		NULL },
+DATA( DE_TAG,         "", "Remove all tagged files and directories.",
+                      "", "LYNXDIRED://REMOVE_TAGGED"),
 
-{ DE_TAG,	      "", "Untag all tagged files and directories.",
-		      "", "LYNXDIRED://CLEAR_TAGGED",		NULL },
+DATA( DE_TAG,         "", "Untag all tagged files and directories.",
+                      "", "LYNXDIRED://CLEAR_TAGGED"),
 
-{ 0,		    NULL, NULL,
-		    NULL, NULL,					NULL }
+DATA( 0,              NULL, NULL,
+                      NULL, NULL),
 };
+#undef DATA
 /* *INDENT-ON* */
 
 static BOOLEAN cannot_stat(const char *name)
@@ -278,11 +297,42 @@ static BOOLEAN cannot_stat(const char *name)
 
 static BOOLEAN ok_stat(const char *name, struct stat *sb)
 {
+    BOOLEAN rc = TRUE;
+
     CTRACE((tfp, "testing ok_stat(%s)\n", name));
     if (!OK_STAT(name, sb)) {
-	return cannot_stat(name);
+#ifdef DOSPATH
+	size_t len = strlen(name);
+
+	/*
+	 * If a path ends with '\' or ':', we can guess that it may be
+	 * a directory name.  Adding a '.' (after a '\') will produce a
+	 * pathname that stat() will accept as a directory name.
+	 */
+	if (len != 0 && (name[len - 1] == '\\' || name[len - 1] == ':')) {
+	    char *temp = malloc(len + 3);
+
+	    if (temp != 0) {
+		strcpy(temp, name);
+		if (temp[len - 1] == '\\') {
+		    strcpy(temp + len, ".");
+		} else {
+		    strcpy(temp + len, "\\.");
+		}
+		rc = OK_STAT(temp, sb);
+		free(temp);
+	    } else {
+		rc = FALSE;
+	    }
+	} else
+#endif
+	    rc = FALSE;
     }
-    return TRUE;
+
+    if (rc == FALSE)
+	rc = cannot_stat(name);
+
+    return rc;
 }
 
 #ifdef HAVE_LSTAT
@@ -335,13 +385,13 @@ static int LYExecv(const char *path,
 {
     int rc = 0;
 
-#if defined(VMS) || defined(_WINDOWS)
+#if defined(VMS)
     CTRACE((tfp, "LYExecv:  Called inappropriately! (path=%s)\n", path));
 #else
     int n;
     char *tmpbuf = 0;
 
-#ifdef __DJGPP__
+#if defined(__DJGPP__) || defined(_WINDOWS)
     stop_curses();
     HTSprintf0(&tmpbuf, "%s", path);
     for (n = 1; argv[n] != 0; n++)
@@ -425,6 +475,7 @@ static int LYExecv(const char *path,
 	FREE(tmpbuf);
     }
 #endif /* VMS || _WINDOWS */
+    CTRACE((tfp, "LYexecv ->%d\n", rc));
     return (rc);
 }
 
@@ -449,6 +500,7 @@ static int make_directory(char *path)
 #else
 	code = mkdir(path, 0777) ? -1 : 1;
 #endif
+	CTRACE((tfp, "builtin mkdir ->%d\n\t%s\n", code, path));
     }
     return (code);
 }
@@ -471,6 +523,7 @@ static int remove_file(char *path)
 	FREE(tmpbuf);
     } else {
 	code = remove(path) ? -1 : 1;
+	CTRACE((tfp, "builtin remove ->%d\n\t%s\n", code, path));
     }
     return (code);
 }
@@ -492,6 +545,7 @@ static int remove_directory(char *path)
 	FREE(tmpbuf);
     } else {
 	code = rmdir(path) ? -1 : 1;
+	CTRACE((tfp, "builtin rmdir ->%d\n\t%s\n", code, path));
     }
     return (code);
 }
@@ -514,12 +568,13 @@ static int touch_file(char *path)
     } else {
 	FILE *fp;
 
-	if ((fp = fopen(path, "w")) != 0) {
+	if ((fp = fopen(path, BIN_W)) != 0) {
 	    fclose(fp);
 	    code = 1;
 	} else {
 	    code = -1;
 	}
+	CTRACE((tfp, "builtin touch ->%d\n\t%s\n", code, path));
     }
     return (code);
 }
@@ -551,9 +606,15 @@ static int move_file(char *source, char *target)
 	    CTRACE((tfp, "move_file source=%s, target=%s\n", source, target));
 	    target = actual;
 	}
-	if ((code = rename(source, target)) != 0)
-	    if ((code = LYCopyFile(source, target)) >= 0)
+	code = rename(source, target);
+	CTRACE((tfp, "builtin move ->%d\n\tsource=%s\n\ttarget=%s\n",
+		code, source, target));
+	if (code != 0) {	/* it failed */
+	    if ((code = LYCopyFile(source, target)) >= 0) {
 		code = remove(source);
+		CTRACE((tfp, "...remove source after copying ->%d\n", code));
+	    }
+	}
 	if (code == 0)
 	    code = 1;
 	if (actual != target) {
@@ -732,11 +793,11 @@ static int modify_tagged(char *testpath)
 	 * If path is relative, prefix it with current location.
 	 */
 	if (!LYIsPathSep(given_target[0])) {
-	    StrAllocCopy(dst_path, testpath);
+	    dst_path = HTLocalName(testpath);
 	    LYAddPathSep(&dst_path);
 	    StrAllocCat(dst_path, given_target);
 	} else {
-	    StrAllocCopy(dst_path, given_target);
+	    dst_path = HTLocalName(given_target);
 	}
 
 	if (!ok_stat(dst_path, &dst_info)) {
@@ -866,12 +927,7 @@ static int modify_location(char *testpath)
      * Change the location of the file or directory.
      */
     if (S_ISDIR(dir_info.st_mode)) {
-	if (HTGetProgramPath(ppMV) != NULL) {
-	    cp = gettext("Enter new location for directory: ");
-	} else {
-	    HTAlert(COULD_NOT_ACCESS_DIR);
-	    return 0;
-	}
+	cp = gettext("Enter new location for directory: ");
     } else if (S_ISREG(dir_info.st_mode)) {
 	cp = gettext("Enter new location for file: ");
     } else {
@@ -1239,9 +1295,10 @@ static int permit_location(char *destpath,
 			   char *srcpath,
 			   char **newpath)
 {
+    int code = 0;
+
 #ifndef UNIX
     HTAlert(gettext("Sorry, don't know how to permit non-UNIX files yet."));
-    return (0);
 #else
     static char tempfile[LY_MAXPATH] = "\0";
     char *cp;
@@ -1264,14 +1321,14 @@ static int permit_location(char *destpath,
 	 */
 	if (!ok_lstat(srcpath, &dir_info)
 	    || !ok_file_or_dir(&dir_info))
-	    return 0;
+	    return code;
 
 	user_filename = LYPathLeaf(srcpath);
 
 	LYRemoveTemp(tempfile);
 	if ((fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w")) == NULL) {
 	    HTAlert(gettext("Unable to open permit options file"));
-	    return (0);
+	    return (code);
 	}
 
 	/*
@@ -1358,7 +1415,7 @@ static int permit_location(char *destpath,
 	LYCloseTempFP(fp0);
 
 	LYforce_no_cache = TRUE;
-	return (PERMIT_FORM_RESULT);	/* Special flag for LYMainLoop */
+	code = PERMIT_FORM_RESULT;	/* Special flag for LYMainLoop */
 
     } else {			/* The form being activated. */
 	mode_t new_mode = 0;
@@ -1375,24 +1432,24 @@ static int permit_location(char *destpath,
 	    CTRACE((tfp, "permit_location: called for <%s>.\n",
 		    (destpath ?
 		     destpath : "NULL URL pointer")));
-	    return 0;
+	    return code;
 	}
 	cp = destpath;
 	while (*cp != '\0' && *cp != '?') {	/* Find filename */
 	    cp++;
 	}
 	if (*cp == '\0') {
-	    return (0);		/* Nothing to permit. */
+	    return (code);	/* Nothing to permit. */
 	}
 	*cp++ = '\0';		/* Null terminate file name and
 				   start working on the masks. */
 
 	/* Will now operate only on filename part. */
 	if ((destpath = HTURLPath_toFile(destpath, TRUE, FALSE)) == 0)
-	    return (0);
+	    return (code);
 	if (strlen(destpath) >= LY_MAXPATH) {
 	    FREE(destpath);
-	    return (0);
+	    return (code);
 	}
 	strcpy(tmpdst, destpath);
 	FREE(destpath);
@@ -1409,7 +1466,7 @@ static int permit_location(char *destpath,
 		fprintf(stderr, "%s\n", INVALID_PERMIT_URL);
 	    CTRACE((tfp, "permit_location: called for file '%s'.\n",
 		    destpath));
-	    return 0;
+	    return code;
 	}
 
 	/*
@@ -1418,7 +1475,7 @@ static int permit_location(char *destpath,
 	destpath = strip_trailing_slash(destpath);
 	if (!ok_stat(destpath, &dir_info)
 	    || !ok_file_or_dir(&dir_info)) {
-	    return 0;
+	    return code;
 	}
 
 	/*
@@ -1447,11 +1504,11 @@ static int permit_location(char *destpath,
 			new_mode |= mask;
 		} else {
 		    HTAlert(gettext("Invalid mode format."));
-		    return 0;
+		    return code;
 		}
 	    } else {
 		HTAlert(gettext("Invalid syntax format."));
-		return 0;
+		return code;
 	    }
 
 	    cp = cr;
@@ -1460,6 +1517,7 @@ static int permit_location(char *destpath,
 	/*
 	 * Call chmod().
 	 */
+	code = 1;
 	if ((program = HTGetProgramPath(ppCHMOD)) != NULL) {
 	    char *args[5];
 	    char amode[10];
@@ -1472,18 +1530,21 @@ static int permit_location(char *destpath,
 	    args[2] = destpath;
 	    args[3] = (char *) 0;
 	    if (LYExecv(program, args, tmpbuf) <= 0) {
-		FREE(tmpbuf);
-		return (-1);
+		code = -1;
 	    }
 	    FREE(tmpbuf);
 	} else {
-	    if (chmod(destpath, new_mode) < 0)
-		return (-1);
+	    if (chmod(destpath, new_mode) < 0) {
+		code = -1;
+	    }
+	    CTRACE((tfp, "builtin chmod %.4o ->%d\n\t%s\n",
+		    new_mode, code, destpath));
 	}
-	LYforce_no_cache = TRUE;	/* Force update of dired listing. */
-	return 1;
+	if (code == 1)
+	    LYforce_no_cache = TRUE;	/* Force update of dired listing. */
     }
 #endif /* !UNIX */
+    return code;
 }
 #endif /* OK_PERMIT */
 
@@ -1833,7 +1894,7 @@ int local_dired(DocInfo *doc)
 	handle_LYK_CHDIR();
 	do_pop_doc = FALSE;
 #endif
-	arg = "blah";		/* do something to avoid cc's complaints */
+	arg = 0;		/* do something to avoid cc's complaints */
     } else if ((arg = match_op("NEW_FILE", line)) != 0) {
 	if (create_file(arg) > 0)
 	    LYforce_no_cache = TRUE;
@@ -1937,6 +1998,7 @@ int local_dired(DocInfo *doc)
 int dired_options(DocInfo *doc, char **newfile)
 {
     static char tempfile[LY_MAXPATH];
+    const char *my_suffix;
     char *path;
     char *dir;
     lynx_list_item_type *nxt;
@@ -2028,7 +2090,7 @@ int dired_options(DocInfo *doc, char **newfile)
      * If menu_head is NULL then use defaults and link them together now.
      */
     if (menu_head == NULL) {
-	for (mp = defmenu; mp->href != NULL; mp++)
+	for (mp = defmenu; GetDiredHref(mp) != NULL; mp++)
 	    mp->next = (mp + 1);
 	(--mp)->next = NULL;
 	menu_head = defmenu;
@@ -2050,18 +2112,22 @@ int dired_options(DocInfo *doc, char **newfile)
 	    (!*path || !S_ISLNK(dir_info.st_mode)))
 	    continue;
 #endif
-	if (*mp->sfx &&
-	    (strlen(path) < strlen(mp->sfx) ||
-	     strcmp(mp->sfx, &path[(strlen(path) - strlen(mp->sfx))]) != 0))
+	my_suffix = GetDiredSuffix(mp);
+	if (non_empty(my_suffix) &&
+	    (strlen(path) < strlen(my_suffix) ||
+	     strcmp(my_suffix, &path[(strlen(path) - strlen(my_suffix))]) != 0))
 	    continue;
 	dir_url = HTEscape(dir, URL_PATH);
 	path_url = HTEscape(path, URL_PATH);
 	fprintf(fp0, "<a href=\"%s",
-		render_item(mp->href, path_url, dir_url, buf, sizeof(buf), YES));
+		render_item(GetDiredHref(mp),
+			    path_url, dir_url, buf, sizeof(buf), YES));
 	fprintf(fp0, "\">%s</a> ",
-		render_item(mp->link, path, dir, buf, sizeof(buf), NO));
+		render_item(GetDiredLink(mp),
+			    path, dir, buf, sizeof(buf), NO));
 	fprintf(fp0, "%s<br>\n",
-		render_item(mp->rest, path, dir, buf, sizeof(buf), NO));
+		render_item(GetDiredRest(mp),
+			    path, dir, buf, sizeof(buf), NO));
 	FREE(dir_url);
 	FREE(path_url);
     }
diff --git a/src/LYMail.c b/src/LYMail.c
index 1aea8ea0..fb14a338 100644
--- a/src/LYMail.c
+++ b/src/LYMail.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMail.c,v 1.71 2009/01/03 00:39:50 tom Exp $
+ * $LynxId: LYMail.c,v 1.72 2009/11/21 17:05:33 Bela.Lubkin Exp $
  */
 #include <HTUtils.h>
 #include <HTParse.h>
@@ -364,10 +364,10 @@ static char *blat_cmd(char *mail_cmd,
     fprintf(fp, "-t\n%s\n", address);
     if (subject)
 	fprintf(fp, "-s\n%s\n", subject);
-    if (!isEmpty(mail_addr)) {
+    if (non_empty(mail_addr)) {
 	fprintf(fp, "-f\n%s\n", mail_addr);
     }
-    if (!isEmpty(ccaddr)) {
+    if (non_empty(ccaddr)) {
 	fprintf(fp, "-c\n%s\n", ccaddr);
     }
     LYCloseOutput(fp);
@@ -647,7 +647,7 @@ void mailform(const char *mailto_address,
      * Allow user to edit the default Subject - FM
      */
     if (subject[0] == '\0') {
-	if (!isEmpty(mailto_subject)) {
+	if (non_empty(mailto_subject)) {
 	    LYstrncpy(subject, mailto_subject, MAX_SUBJECT);
 	} else {
 	    sprintf(subject, "mailto:%.63s", address);
@@ -690,17 +690,17 @@ void mailform(const char *mailto_address,
 	goto cleanup;
     }
 
-    if (!isEmpty(mailto_type)) {
+    if (non_empty(mailto_type)) {
 	fprintf(fd, "Mime-Version: 1.0\n");
 	fprintf(fd, "Content-Type: %s\n", mailto_type);
     }
     fprintf(fd, "To: %s\n", address);
-    if (!isEmpty(personal_mail_address))
+    if (non_empty(personal_mail_address))
 	fprintf(fd, "From: %s\n", personal_mail_address);
-    if (!isEmpty(ccaddr))
+    if (non_empty(ccaddr))
 	fprintf(fd, "Cc: %s\n", ccaddr);
     fprintf(fd, "Subject: %s\n\n", subject);
-    if (!isEmpty(keywords))
+    if (non_empty(keywords))
 	fprintf(fd, "Keywords: %s\n", keywords);
     _statusline(SENDING_FORM_CONTENT);
 #else /* e.g., VMS, DOS */
@@ -717,17 +717,17 @@ void mailform(const char *mailto_address,
 	    LYCloseTempFP(fd);
 	    goto cleanup;
 	}
-	if (!isEmpty(mailto_type)) {
+	if (non_empty(mailto_type)) {
 	    fprintf(hfd, "Mime-Version: 1.0\n");
 	    fprintf(hfd, "Content-Type: %s\n", mailto_type);
-	    if (!isEmpty(personal_mail_address))
+	    if (non_empty(personal_mail_address))
 		fprintf(hfd, "From: %s\n", personal_mail_address);
 	}
 	/*
 	 * For PMDF, put any keywords and the subject in the header file and
 	 * close it.  - FM
 	 */
-	if (!isEmpty(keywords)) {
+	if (non_empty(keywords)) {
 	    fprintf(hfd, "Keywords: %s\n", keywords);
 	}
 	fprintf(hfd, "Subject: %s\n\n", subject);
@@ -749,12 +749,12 @@ void mailform(const char *mailto_address,
     } else
 #endif
     {
-	if (!isEmpty(mailto_type)) {
+	if (non_empty(mailto_type)) {
 	    fprintf(fd, "Mime-Version: 1.0\n");
 	    fprintf(fd, "Content-Type: %s\n", mailto_type);
 	}
 	fprintf(fd, "To: %s\n", address);
-	if (!isEmpty(personal_mail_address))
+	if (non_empty(personal_mail_address))
 	    fprintf(fd, "From: %s\n", personal_mail_address);
 	fprintf(fd, "Subject: %.70s\n\n", subject);
     }
@@ -829,7 +829,7 @@ void mailform(const char *mailto_address,
     StrAllocCopy(command, cmd);
 
     vms_append_addrs(&command, address, "");
-    if (!isEmpty(ccaddr)) {
+    if (non_empty(ccaddr)) {
 	vms_append_addrs(&command, ccaddr, "/CC");
     }
 
@@ -969,7 +969,7 @@ void mailmsg(int cur,
 
     fprintf(fd, "To: %s\n", address);
     fprintf(fd, "Subject: Lynx Error in %s\n", filename);
-    if (!isEmpty(personal_mail_address)) {
+    if (non_empty(personal_mail_address)) {
 	fprintf(fd, "Cc: %s\n", personal_mail_address);
     }
     fprintf(fd, "X-URL: %s\n", filename);
@@ -992,7 +992,7 @@ void mailmsg(int cur,
 	    return;
 	}
 
-	if (!isEmpty(personal_mail_address)) {
+	if (non_empty(personal_mail_address)) {
 	    fprintf(fd, "Cc: %s\n", personal_mail_address);
 	}
 	fprintf(fd, "X-URL: %s\n", filename);
@@ -1230,7 +1230,7 @@ void reply_by_mail(char *mail_address,
     /*
      * Set the default subject.  - FM
      */
-    if ((default_subject[0] == '\0') && !isEmpty(title)) {
+    if ((default_subject[0] == '\0') && non_empty(title)) {
 	strncpy(default_subject, title, MAX_SUBJECT);
 	default_subject[MAX_SUBJECT] = '\0';
     }
@@ -1289,14 +1289,14 @@ void reply_by_mail(char *mail_address,
     /*
      * Put the X-URL and X-Mailer lines in the header.
      */
-    if (!isEmpty(filename)) {
+    if (non_empty(filename)) {
 	HTSprintf(&header, "X-URL: %s\n", filename);
     } else {
 	HTSprintf(&header, "X-URL: mailto:%s\n", to_address);
     }
     HTSprintf(&header, "X-Mailer: %s, Version %s\n", LYNX_NAME, LYNX_VERSION);
 
-    if (!isEmpty(refid)) {
+    if (non_empty(refid)) {
 	HTSprintf(&header, "In-Reply-To: <%s>\n", refid);
     }
 #endif /* VMS */
@@ -1396,7 +1396,7 @@ void reply_by_mail(char *mail_address,
     label = "Subject";
     if (*default_subject) {
 	StrAllocCopy(the_subject, default_subject);
-    } else if (!isEmpty(filename)) {
+    } else if (non_empty(filename)) {
 	HTSprintf(&the_subject, "%s", filename);
     } else {
 	HTSprintf(&the_subject, "mailto:%s", to_address);
@@ -1429,14 +1429,14 @@ void reply_by_mail(char *mail_address,
     /*
      * Add the Cc:  header.  - FM
      */
-    if (!isEmpty(ccaddr)) {
+    if (non_empty(ccaddr)) {
 	HTSprintf(&header, "Cc: %s\n", ccaddr);
     }
 
     /*
      * Add the Keywords:  header.  - FM
      */
-    if (!isEmpty(keywords)) {
+    if (non_empty(keywords)) {
 	HTSprintf(&header, "Keywords: %s\n", keywords);
     }
 
@@ -1447,7 +1447,7 @@ void reply_by_mail(char *mail_address,
     CTRACE((tfp, "**header==\n%s", header));
 #endif /* !VMS */
 
-    if (!no_editor && !isEmpty(editor)) {
+    if (!no_editor && non_empty(editor)) {
 
 	if (body) {
 	    cp1 = body;
@@ -1602,7 +1602,7 @@ void reply_by_mail(char *mail_address,
 	 * For PMDF, put any keywords and the subject in the header file and
 	 * close it.  - FM
 	 */
-	if (!isEmpty(keywords)) {
+	if (non_empty(keywords)) {
 	    fprintf(hfd, "Keywords: %s\n", keywords);
 	}
 	fprintf(hfd, "Subject: %s\n\n", the_subject);
@@ -1630,7 +1630,7 @@ void reply_by_mail(char *mail_address,
     }
 
     vms_append_addrs(&command, to_address, "");
-    if (!isEmpty(ccaddr)) {
+    if (non_empty(ccaddr)) {
 	vms_append_addrs(&command, ccaddr, "/CC");
     }
 
diff --git a/src/LYMain.c b/src/LYMain.c
index bc456a65..1f54575d 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMain.c,v 1.206 2009/08/25 23:07:22 tom Exp $
+ * $LynxId: LYMain.c,v 1.210 2009/11/21 17:05:33 Bela.Lubkin Exp $
  */
 #include <HTUtils.h>
 #include <HTTP.h>
@@ -562,7 +562,7 @@ int ssl_noprompt = FORCE_PROMPT_DFT;
 int connect_timeout = 18000; /*=180000*0.1 - used in HTDoConnect.*/
 int reading_timeout = 18000; /*=180000*0.1 - used in HTDoConnect.*/
 
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_JUSTIFY_ELTS
 BOOLEAN ok_justify = FALSE;
 int justify_max_void_percent = 35;
 #endif
@@ -989,7 +989,7 @@ int main(int argc,
     ftp_lasthost = typecalloc(char);
 #endif
 
-#ifdef EXP_CHARSET_CHOICE
+#ifdef USE_CHARSET_CHOICE
     memset((char *) charset_subsets, 0, sizeof(charset_subset_t) * MAXCHARSETS);
 #endif
 
@@ -1378,7 +1378,7 @@ int main(int argc,
 	LYRestricted = TRUE;
 	LYUseTraceLog = FALSE;
     }
-#ifdef EXP_CMD_LOGGING
+#ifdef USE_CMD_LOGGING
     /*
      * Open command-script, if specified
      */
@@ -1551,7 +1551,7 @@ int main(int argc,
     /*
      * If the lynx-style file is not available, inform the user and exit.
      */
-    if (!isEmpty(lynx_lss_file) && !LYCanReadFile(lynx_lss_file)) {
+    if (non_empty(lynx_lss_file) && !LYCanReadFile(lynx_lss_file)) {
 	fprintf(stderr, gettext("\nLynx file \"%s\" is not available.\n\n"),
 		lynx_lss_file);
 	exit_immediately(EXIT_FAILURE);
@@ -2067,13 +2067,13 @@ int main(int argc,
      * Make sure our bookmark default strings are all allocated and
      * synchronized.  - FM
      */
-    if (!bookmark_page || *bookmark_page == '\0') {
+    if (isEmpty(bookmark_page)) {
 	temp = NULL;
 	HTSprintf0(&temp, "lynx_bookmarks%s", HTML_SUFFIX);
 	set_default_bookmark_page(temp);
 	FREE(temp);
     }
-    if (!BookmarkPage || *BookmarkPage == '\0') {
+    if (isEmpty(BookmarkPage)) {
 	set_default_bookmark_page(bookmark_page);
     }
 #if defined(SYSLOG_REQUESTED_URLS)
@@ -2298,7 +2298,7 @@ void reload_read_cfg(void)
 	}
 #endif
 
-#ifdef EXP_CHARSET_CHOICE
+#ifdef USE_CHARSET_CHOICE
 	custom_assumed_doc_charset = FALSE;
 	custom_display_charset = FALSE;
 	memset((char *) charset_subsets, 0, sizeof(charset_subset_t) * MAXCHARSETS);
@@ -2326,7 +2326,7 @@ void reload_read_cfg(void)
 	LYRemoveTemp(tempfile);
 	FREE(tempfile);		/* done with it - kw */
 
-#ifdef EXP_CHARSET_CHOICE
+#ifdef USE_CHARSET_CHOICE
 	init_charset_subsets();
 #endif
 
@@ -3338,7 +3338,7 @@ outputs for -source dumps"
       "child_relaxed",	4|FUNCTION_ARG,		child_relaxed_fun,
       "exit on left-arrow in startfile (allows save to disk)"
    ),
-#ifdef EXP_CMD_LOGGING
+#ifdef USE_CMD_LOGGING
    PARSE_STR(
       "cmd_log",	2|NEED_LYSTRING_ARG,	lynx_cmd_logfile,
       "=FILENAME\nlog keystroke commands to the given file"
@@ -3524,7 +3524,7 @@ soon as they are seen)"
       "ismap",		4|TOGGLE_ARG,		LYNoISMAPifUSEMAP,
       "toggles inclusion of ISMAP links when client-side\nMAPs are present"
    ),
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_JUSTIFY_ELTS
    PARSE_SET(
       "justify",	4|SET_ARG,		ok_justify,
       "do justification of text"
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index b8a0fa98..db7862e9 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMainLoop.c,v 1.160 2009/02/01 12:51:11 tom Exp $
+ * $LynxId: LYMainLoop.c,v 1.162 2009/11/22 17:27:48 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTAccess.h>
@@ -2460,7 +2460,7 @@ static void handle_LYK_EDIT(int *old_c,
 		    if (S_ISREG(dir_info.st_mode)) {
 			StrAllocCopy(tp, links[curdoc.link].lname);
 			HTUnEscapeSome(tp, "/");
-			if (edit_current_file(tp, curdoc.link, LYGetNewline())) {
+			if (edit_current_file(tp, curdoc.link, -1)) {
 			    DIRED_UNCACHE_1;
 			    move_address(&newdoc, &curdoc);
 #ifdef NO_SEEK_OLD_POSITION
@@ -2539,7 +2539,7 @@ static void handle_LYK_EDIT_TEXTAREA(BOOLEAN *refresh_screen,
 	    *old_c = real_c;
 	    HTUserMsg(ANYEDIT_DISABLED);
 	}
-    } else if (!editor || *editor == '\0') {
+    } else if (isEmpty(editor)) {
 	if (*old_c != real_c) {
 	    *old_c = real_c;
 	    HTUserMsg(NO_EDITOR);
@@ -6123,7 +6123,7 @@ int mainloop(void)
 	     */
 	    temp = HTParse(curdoc.address, "",
 			   PARSE_ACCESS + PARSE_HOST + PARSE_PUNCTUATION);
-	    if (!temp || *temp == '\0') {
+	    if (isEmpty(temp)) {
 		StrAllocCopy(startrealm, NO_NOTHING);
 	    } else {
 		StrAllocCopy(startrealm, temp);
@@ -6183,7 +6183,7 @@ int mainloop(void)
 		} else {
 		    temp = HTParse(curdoc.address, "",
 				   PARSE_ACCESS + PARSE_HOST + PARSE_PUNCTUATION);
-		    if (!temp || *temp == '\0') {
+		    if (isEmpty(temp)) {
 			StrAllocCopy(traversal_host, NO_NOTHING);
 		    } else {
 			StrAllocCopy(traversal_host, temp);
diff --git a/src/LYOptions.c b/src/LYOptions.c
index 24cac109..9ea2cd2a 100644
--- a/src/LYOptions.c
+++ b/src/LYOptions.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYOptions.c,v 1.133 2009/06/07 18:24:50 tom Exp $ */
+/* $LynxId: LYOptions.c,v 1.134 2009/11/21 15:52:05 tom Exp $ */
 #include <HTUtils.h>
 #include <HTFTP.h>
 #include <HTTP.h>		/* 'reloading' flag */
@@ -3660,7 +3660,7 @@ static int gen_options(char **newfile)
 	if (len > cset_len)
 	    cset_len = len;
 	sprintf(temp, "%d", i);
-#ifdef EXP_CHARSET_CHOICE
+#ifdef USE_CHARSET_CHOICE
 	if (!charset_subsets[i].hide_display)
 #endif
 	    PutOption(fp0, i == current_char_set, temp, LYchar_set_names[i]);
@@ -3685,7 +3685,7 @@ static int gen_options(char **newfile)
 	PutLabel(fp0, gettext("Assumed document character set"), assume_char_set_string);
 	BeginSelect(fp0, assume_char_set_string);
 	for (i = 0; i < LYNumCharsets; i++) {
-#ifdef EXP_CHARSET_CHOICE
+#ifdef USE_CHARSET_CHOICE
 	    if (!charset_subsets[i].hide_assumed)
 #endif
 		PutOption(fp0, i == curval,
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c
index e8b20dd2..08478a87 100644
--- a/src/LYReadCFG.c
+++ b/src/LYReadCFG.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYReadCFG.c,v 1.139 2009/06/07 16:57:29 tom Exp $
+ * $LynxId: LYReadCFG.c,v 1.142 2009/11/21 16:32:23 tom Exp $
  */
 #ifndef NO_RULES
 #include <HTRules.h>
@@ -1038,7 +1038,7 @@ static int nonrest_sigwinch_fun(char *value)
     return 0;
 }
 
-#ifdef EXP_CHARSET_CHOICE
+#ifdef USE_CHARSET_CHOICE
 static void matched_charset_choice(BOOL display_charset,
 				   int i)
 {
@@ -1119,7 +1119,7 @@ static int parse_assumed_doc_charset_choice(char *p)
     return parse_charset_choice(p, 0);
 }
 
-#endif /* EXP_CHARSET_CHOICE */
+#endif /* USE_CHARSET_CHOICE */
 
 #ifdef USE_PRETTYSRC
 static void html_src_bad_syntax(char *value,
@@ -1300,7 +1300,7 @@ static Config_Type Config_Table [] =
 #ifdef EXP_ASSUMED_COLOR
      PARSE_FUN(RC_ASSUMED_COLOR,        assumed_color_fun),
 #endif
-#ifdef EXP_CHARSET_CHOICE
+#ifdef USE_CHARSET_CHOICE
      PARSE_FUN(RC_ASSUMED_DOC_CHARSET_CHOICE, parse_assumed_doc_charset_choice),
 #endif
 #ifdef DIRED_SUPPORT
@@ -1369,7 +1369,7 @@ static Config_Type Config_Table [] =
 #ifdef DIRED_SUPPORT
      PARSE_FUN(RC_DIRED_MENU,           dired_menu_fun),
 #endif
-#ifdef EXP_CHARSET_CHOICE
+#ifdef USE_CHARSET_CHOICE
      PARSE_FUN(RC_DISPLAY_CHARSET_CHOICE, parse_display_charset_choice),
 #endif
      PARSE_ADD(RC_DOWNLOADER,           downloaders),
@@ -1421,7 +1421,7 @@ static Config_Type Config_Table [] =
      PARSE_STR(RC_JUMP_PROMPT,          jumpprompt),
      PARSE_SET(RC_JUMPBUFFER,           jump_buffer),
      PARSE_FUN(RC_JUMPFILE,             jumpfile_fun),
-#ifdef EXP_JUSTIFY_ELTS
+#ifdef USE_JUSTIFY_ELTS
      PARSE_SET(RC_JUSTIFY,              ok_justify),
      PARSE_INT(RC_JUSTIFY_MAX_VOID_PERCENT, justify_max_void_percent),
 #endif
@@ -1524,7 +1524,7 @@ static Config_Type Config_Table [] =
      PARSE_SET(RC_QUIT_DEFAULT_YES,     LYQuitDefaultYes),
      PARSE_INT(RC_READ_TIMEOUT,         reading_timeout),
      PARSE_FUN(RC_REFERER_WITH_QUERY,   referer_with_query_fun),
-#ifdef EXP_CMD_LOGGING
+#ifdef USE_CMD_LOGGING
      PARSE_TIM(RC_REPLAYSECS,           ReplaySecs),
 #endif
      PARSE_SET(RC_REUSE_TEMPFILES,      LYReuseTempfiles),
diff --git a/src/LYStrings.c b/src/LYStrings.c
index 498975a5..e7d58b7e 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYStrings.c,v 1.166 2009/06/07 19:32:16 tom Exp $ */
+/* $LynxId: LYStrings.c,v 1.168 2009/11/21 17:06:11 Bela.Lubkin Exp $ */
 #include <HTUtils.h>
 #include <HTCJK.h>
 #include <UCAux.h>
@@ -35,7 +35,7 @@
 #include <LYMainLoop.h>
 #endif
 
-#ifdef EXP_CMD_LOGGING
+#ifdef USE_CMD_LOGGING
 #include <LYReadCFG.h>
 #endif
 
@@ -642,7 +642,7 @@ const char *LYmbcs_skip_glyphs(const char *data,
     if (n_glyphs < 0)
 	n_glyphs = 0;
 
-    if (!isEmpty(data)) {
+    if (non_empty(data)) {
 	if (!utf_flag) {
 	    while (n_glyphs-- > 0) {
 		if (!*++data)
@@ -5302,7 +5302,7 @@ int LYscanFloat2(const char **source, float *result)
 #ifdef _WIN32_WINNT
 #define WIN32_FIX (float)
 #else
-#define WIN32_FIX /* nothing */
+#define WIN32_FIX		/* nothing */
 #endif
 	    *result = WIN32_FIX strtol(src, &temp, 10);
 	    src = temp;
@@ -5994,7 +5994,7 @@ char *LYSafeGets(char **src,
     return result;
 }
 
-#ifdef EXP_CMD_LOGGING
+#ifdef USE_CMD_LOGGING
 static FILE *cmd_logfile;
 static FILE *cmd_script;
 
@@ -6111,4 +6111,4 @@ void LYCloseCmdLogfile(void)
     FREE(lynx_cmd_logfile);
     FREE(lynx_cmd_script);
 }
-#endif /* EXP_CMD_LOGGING */
+#endif /* USE_CMD_LOGGING */
diff --git a/src/LYStrings.h b/src/LYStrings.h
index 207a7be7..4f2ab677 100644
--- a/src/LYStrings.h
+++ b/src/LYStrings.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYStrings.h,v 1.72 2009/01/25 19:49:28 tom Exp $
+ * $LynxId: LYStrings.h,v 1.74 2009/11/21 17:05:33 Bela.Lubkin Exp $
  */
 #ifndef LYSTRINGS_H
 #define LYSTRINGS_H
@@ -81,8 +81,6 @@ extern "C" {
 						  int *nstartp,
 						  int *nendp);
 
-#define non_empty(s) !isEmpty(s)
-
 #define LYno_attr_mb_strstr(chptr, tarptr, utf_flag, count_gcells, nstartp, nendp) \
 	(case_sensitive \
 	    ? LYno_attr_mbcs_strstr(chptr, tarptr, utf_flag, count_gcells, nstartp, nendp) \
@@ -110,7 +108,7 @@ extern "C" {
 
     extern char *LYSafeGets(char **src, FILE *fp);
 
-#ifdef EXP_CMD_LOGGING
+#ifdef USE_CMD_LOGGING
     extern BOOL LYHaveCmdScript(void);
     extern int LYReadCmdKey(int mode);
     extern void LYCloseCmdLogfile(void);
diff --git a/src/LYUtils.c b/src/LYUtils.c
index 1781ef22..e4439c73 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYUtils.c,v 1.188 2009/08/25 22:36:48 tom Exp $
+ * $LynxId: LYUtils.c,v 1.193 2009/11/22 22:30:06 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTCP.h>
@@ -160,9 +160,9 @@ extern int BSDselect(int nfds, fd_set * readfds, fd_set * writefds,
  * 'O'ption page, for which Lynx will store a temporary filename even when
  * it no longer applies, since it will reuse that filename at a later time.
  */
-#ifdef EXP_RAND_TEMPNAME
+#ifdef USE_RAND_TEMPNAME
 #if defined(LYNX_RAND_MAX)
-#define USE_RAND_TEMPNAME 1
+#define HAVE_RAND_TEMPNAME 1
 #define MAX_TEMPNAME 10000
 #ifndef BITS_PER_CHAR
 #define BITS_PER_CHAR 8
@@ -281,7 +281,7 @@ char *LYGetEnv(const char *name)
  * Turkish locales tolower("I") is not "i". That's fatal for case
  * sensitive operations with charset names, HTML tags etc.
  */
-#ifdef EXP_ASCII_CTYPES
+#ifdef USE_ASCII_CTYPES
 int ascii_tolower(int i)
 {
     if (91 > i && i > 64)
@@ -305,7 +305,7 @@ int ascii_isupper(int i)
     else
 	return 0;
 }
-#endif /* EXP_ASCII_CTYPES */
+#endif /* USE_ASCII_CTYPES */
 
 /*
  * Check for UTF-8 data, returning the length past the first character.
@@ -2803,7 +2803,7 @@ BOOLEAN LYCanReadFile(const char *filename)
 {
     FILE *fp;
 
-    if (!isEmpty(filename)) {
+    if (non_empty(filename)) {
 	if ((fp = fopen(filename, "r")) != 0) {
 	    return LYCloseInput(fp);
 	}
@@ -3421,7 +3421,7 @@ static int fmt_tempname(char *result,
 {
     int code;
 
-#ifdef USE_RAND_TEMPNAME
+#ifdef HAVE_RAND_TEMPNAME
 #define SIZE_TEMPNAME ((MAX_TEMPNAME / BITS_PER_CHAR) + 1)
     static BOOL first = TRUE;
     static int names_used = 0;
@@ -3438,7 +3438,7 @@ static int fmt_tempname(char *result,
     /*
      * Prefer a random value rather than a counter.
      */
-#ifdef USE_RAND_TEMPNAME
+#ifdef HAVE_RAND_TEMPNAME
     if (first) {
 	lynx_srand((unsigned) ((long) time((time_t *) 0) + (long) result));
 	first = FALSE;
@@ -4014,7 +4014,7 @@ void LYConvertToURL(char **AllocatedString,
     struct stat st;
 #endif /* !VMS */
 
-    if (!old_string || *old_string == '\0')
+    if (isEmpty(old_string))
 	return;
 
 #if defined(USE_DOS_DRIVES)
@@ -5039,13 +5039,13 @@ void Define_VMSLogical(char *LogicalName,
     $DESCRIPTOR(lvalue, "");
     $DESCRIPTOR(ltable, "LNM$PROCESS");
 
-    if (!LogicalName || *LogicalName == '\0')
+    if (isEmpty(LogicalName))
 	return;
 
     lname.dsc$w_length = strlen(LogicalName);
     lname.dsc$a_pointer = LogicalName;
 
-    if (!LogicalValue || *LogicalValue == '\0') {
+    if (isEmpty(LogicalValue)) {
 	lib$delete_logical(&lname, &ltable);
 	return;
     }
@@ -5239,7 +5239,7 @@ BOOLEAN LYPathOffHomeOK(char *fbuffer,
     /*
      * Make sure we have an fbuffer and a string in it.  - FM
      */
-    if (!fbuffer || fbuffer_size < 2 || fbuffer[0] == '\0') {
+    if (fbuffer_size < 2 || isEmpty(fbuffer)) {
 	return (FALSE);
     }
     StrAllocCopy(file, fbuffer);
@@ -7002,6 +7002,8 @@ int LYCopyFile(char *src,
 	    }
 	    LYCloseInput(fin);
 	}
+	CTRACE((tfp, "builtin copy ->%d\n\tsource=%s\n\ttarget=%s\n",
+		code, src, dst));
     }
 
     if (code) {
diff --git a/src/LYUtils.h b/src/LYUtils.h
index 7e7adabd..0486a31e 100644
--- a/src/LYUtils.h
+++ b/src/LYUtils.h
@@ -1,4 +1,4 @@
-/* $LynxId: LYUtils.h,v 1.80 2009/02/01 23:28:26 tom Exp $ */
+/* $LynxId: LYUtils.h,v 1.82 2009/11/21 15:46:24 tom Exp $ */
 #ifndef LYUTILS_H
 #define LYUTILS_H
 
@@ -206,7 +206,7 @@ extern "C" {
 #define IsOurFile(name) TRUE
 #endif
 
-#ifdef EXP_ASCII_CTYPES
+#ifdef USE_ASCII_CTYPES
     extern int ascii_tolower(int i);
     extern int ascii_toupper(int i);
     extern int ascii_isupper(int i);
@@ -269,7 +269,7 @@ extern "C" {
 #endif
 
 #if defined(WIN_EX)		/* 1997/10/16 (Thu) 20:13:28 */
-    extern char *HTDOS_short_name(char *path);
+    extern char *HTDOS_short_name(const char *path);
     extern char *w32_strerror(DWORD ercode);
 #endif
 
diff --git a/src/chrtrans/makeuctb.c b/src/chrtrans/makeuctb.c
index e36b8902..3afe5e38 100644
--- a/src/chrtrans/makeuctb.c
+++ b/src/chrtrans/makeuctb.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: makeuctb.c,v 1.39 2009/01/01 17:01:15 tom Exp $
+ * $LynxId: makeuctb.c,v 1.40 2009/11/21 15:46:24 tom Exp $
  *
  *  makeuctb.c, derived from conmakehash.c   - kw
  *
@@ -87,7 +87,7 @@ static void usage(void)
     done(EX_USAGE);
 }
 
-#ifdef EXP_ASCII_CTYPES
+#ifdef USE_ASCII_CTYPES
 int ascii_tolower(int i)
 {
     if (91 > i && i > 64)