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.c117
-rw-r--r--src/GridText.h3
-rw-r--r--src/HTAlert.c8
-rw-r--r--src/HTAlert.h4
-rw-r--r--src/LYGlobalDefs.h5
-rw-r--r--src/LYList.c162
-rw-r--r--src/LYMain.c83
-rw-r--r--src/LYReadCFG.c5
-rw-r--r--src/LYrcFile.h3
9 files changed, 234 insertions, 156 deletions
diff --git a/src/GridText.c b/src/GridText.c
index f2e79fba..ab027889 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: GridText.c,v 1.198 2010/09/25 12:43:30 tom Exp $
+ * $LynxId: GridText.c,v 1.203 2010/09/27 10:42:01 tom Exp $
  *
  *		Character grid hypertext object
  *		===============================
@@ -372,6 +372,7 @@ typedef struct _TextAnchor {
     struct _TextAnchor *prev;	/* www_user_search only! */
     int sgml_offset;		/* used for updating position after reparsing */
     int number;			/* For user interface */
+    int show_number;		/* For user interface (unique-urls) */
     int line_num;		/* Place in document */
     short line_pos;		/* Bytes/chars - extent too */
     short extent;		/* (see HText_trimHightext) */
@@ -459,6 +460,7 @@ struct _HText {
     BOOL page_has_target;	/* has target on screen */
     BOOL has_utf8;		/* has utf-8 on screen or line */
     BOOL had_utf8;		/* had utf-8 when last displayed */
+    int next_number;		/* next a->number value */
 #ifdef DISP_PARTIAL
     int first_lineno_last_disp_partial;
     int last_lineno_last_disp_partial;
@@ -1088,6 +1090,7 @@ HText *HText_new(HTParentAnchor *anchor)
     self->stale = YES;
     self->toolbar = NO;
     self->tabs = NULL;
+    self->next_number = 1;
 #ifdef USE_SOURCE_CACHE
     /*
      * Remember the parse settings.
@@ -2296,7 +2299,7 @@ static void display_page(HText *text,
 	     */
 	    if (Anchor_ptr->show_anchor
 		&& non_empty(hi_string)
-		&& (Anchor_ptr->link_type & HYPERTEXT_ANCHOR)) {
+		&& (Anchor_ptr->link_type == HYPERTEXT_ANCHOR)) {
 		int count;
 		char *s;
 
@@ -3017,7 +3020,8 @@ static void split_line(HText *text, unsigned split)
 	       style->spaceBefore || style->spaceAfter)) {
 	p--;			/*  Strip trailers. */
     }
-    TailTrim = previous->data + previous->size - 1 - p;		/*  Strip trailers. */
+    /*  Strip trailers. */
+    TailTrim = (int) (previous->data + previous->size - 1 - p);
     previous->size = (unsigned short) (previous->size - TailTrim);
     p[1] = '\0';
 
@@ -3142,11 +3146,11 @@ static void split_line(HText *text, unsigned split)
 	    for (n = 0; n < line->numstyles; n++)
 		line->styles[n] = to[n + 1];
 	} else if (line->numstyles == 0) {
-	    line->styles[0].sc_horizpos = (unsigned) (~0);	/* ?!!! */
+	    line->styles[0].sc_horizpos = (~0);		/* ?!!! */
 	}
 	previous->numstyles = (unsigned short) (at_end - previous->styles + 1);
 	if (previous->numstyles == 0) {
-	    previous->styles[0].sc_horizpos = (unsigned) (~0);	/* ?!!! */
+	    previous->styles[0].sc_horizpos = (~0);	/* ?!!! */
 	}
     }
 #endif /*USE_COLOR_STYLE */
@@ -5073,6 +5077,41 @@ void HText_startStblRowGroup(HText *me, int alignment)
 	HText_cancelStbl(me);	/* give up */
 }
 
+static void compute_show_number(TextAnchor *a)
+{
+    HTAnchor *cur, *tst;
+    TextAnchor *b;
+    int match;
+
+    a->show_number = a->number;
+    if (unique_urls
+	&& HTMainText != 0
+	&& HTMainText->first_anchor != 0
+	&& a->anchor != 0
+	&& (cur = a->anchor->dest) != 0
+	&& cur->parent != 0
+	&& cur->parent->address != 0) {
+
+	match = 0;
+	for (b = HTMainText->first_anchor; b != a; b = b->next) {
+	    if (b->anchor != 0
+		&& (tst = b->anchor->dest) != 0
+		&& tst->parent != 0
+		&& tst->parent->address != 0
+		&& !strcmp(cur->parent->address,
+			   tst->parent->address)
+		&& !strcmp(NonNull(a->anchor->tag), NonNull(b->anchor->tag))) {
+		match = b->show_number;
+		break;
+	    }
+	}
+	if (match)
+	    a->show_number = match;
+	else
+	    a->show_number = HTMainText->next_number++;
+    }
+}
+
 /*		Anchor handling
  *		---------------
  */
@@ -5091,7 +5130,9 @@ static void add_link_number(HText *text, TextAnchor *a, int save_position)
 	char saved_lastchar = text->LastChar;
 	int saved_linenum = text->Lines;
 
-	sprintf(marker, "[%d]", a->number);
+	compute_show_number(a);
+
+	sprintf(marker, "[%d]", a->show_number);
 	HText_appendText(text, marker);
 	if (saved_linenum && text->Lines && saved_lastchar != ' ')
 	    text->LastChar = ']';	/* if marker not after space caused split */
@@ -5143,6 +5184,7 @@ int HText_beginAnchor(HText *text, int underline,
     } else {
 	a->number = 0;
     }
+    a->show_number = 0;
 
     if (number_links_on_left)
 	add_link_number(text, a, TRUE);
@@ -5842,7 +5884,7 @@ static void HText_trimHightext(HText *text,
 	     * is not yet done with it.  - kw
 	     */
 	    if (!anchor_ptr->extent && anchor_ptr->number &&
-		(anchor_ptr->link_type & HYPERTEXT_ANCHOR) &&
+		(anchor_ptr->link_type == HYPERTEXT_ANCHOR) &&
 		!anchor_ptr->show_anchor &&
 		anchor_ptr->number == text->last_anchor_number)
 		continue;
@@ -5876,7 +5918,7 @@ static void HText_trimHightext(HText *text,
 	 * Strip off any spaces or SpecialAttrChars at the beginning,
 	 * if they exist, but only on HYPERTEXT_ANCHORS.
 	 */
-	if (anchor_ptr->link_type & HYPERTEXT_ANCHOR) {
+	if (anchor_ptr->link_type == HYPERTEXT_ANCHOR) {
 	    ch = UCH(line_ptr->data[anchor_ptr->line_pos]);
 	    while (isspace(ch) ||
 		   IsSpecialAttrChar(ch)) {
@@ -5975,7 +6017,7 @@ static void HText_trimHightext(HText *text,
 		/*handle LY_SOFT_NEWLINEs -VH */
 		hi_offset += remove_special_attr_chars(hi_string);
 
-		if (anchor_ptr->link_type & HYPERTEXT_ANCHOR) {
+		if (anchor_ptr->link_type == HYPERTEXT_ANCHOR) {
 		    LYTrimTrailing(hi_string);
 		}
 		if (non_empty(hi_string)) {
@@ -5994,7 +6036,7 @@ static void HText_trimHightext(HText *text,
 
 	hilite_str = LYGetHiTextStr(anchor_ptr, 0);
 	remove_special_attr_chars(hilite_str);
-	if (anchor_ptr->link_type & HYPERTEXT_ANCHOR) {
+	if (anchor_ptr->link_type == HYPERTEXT_ANCHOR) {
 	    LYTrimTrailing(hilite_str);
 	}
 
@@ -6082,6 +6124,20 @@ HTChildAnchor *HText_childNextNumber(int number, void **prev)
     return a->anchor;
 }
 
+/*
+ * For the -unique-urls option, find the anchor-number of the first occurrence
+ * of a given address.
+ */
+int HText_findAnchorNumber(void *avoid)
+{
+    TextAnchor *a = (TextAnchor *) avoid;
+
+    if (a->number > 0 && a->show_number == 0)
+	compute_show_number(a);
+
+    return a->show_number;
+}
+
 static const char *inputFieldDesc(FormInfo * input)
 {
     const char *result = 0;
@@ -7046,7 +7102,6 @@ void HText_pageDisplay(int line_num,
 	HText_trimHightext(HTMainText, FALSE, stop_before);
     }
 #endif
-
     display_page(HTMainText, line_num - 1, target);
 
 #ifdef DISP_PARTIAL
@@ -7140,8 +7195,7 @@ static BOOL anchor_is_numbered(TextAnchor *Anchor_ptr)
     BOOL result = FALSE;
 
     if (Anchor_ptr->show_anchor
-    /* FIXME: && non_empty(hi_string) */
-	&& (Anchor_ptr->link_type & HYPERTEXT_ANCHOR)) {
+	&& (Anchor_ptr->link_type == HYPERTEXT_ANCHOR)) {
 	result = TRUE;
     } else if (Anchor_ptr->link_type == INPUT_ANCHOR
 	       && Anchor_ptr->input_field->type != F_HIDDEN_TYPE) {
@@ -7415,13 +7469,7 @@ BOOL HTFindPoundSelector(const char *selector)
 BOOL HText_selectAnchor(HText *text, HTChildAnchor *anchor)
 {
     TextAnchor *a;
-
-/* This is done later, hence HText_select is unused in GridText.c
-   Should it be the contrary ? @@@
-    if (text != HTMainText) {
-	HText_select(text);
-    }
-*/
+    int l;
 
     for (a = text->first_anchor; a; a = a->next) {
 	if (a->anchor == anchor)
@@ -7435,19 +7483,18 @@ BOOL HText_selectAnchor(HText *text, HTChildAnchor *anchor)
     if (text != HTMainText) {	/* Comment out by ??? */
 	HTMainText = text;	/* Put back in by tbl 921208 */
 	HTMainAnchor = text->node_anchor;
-    } {
-	int l = a->line_num;
+    }
+    l = a->line_num;
 
-	CTRACE((tfp, "HText: Selecting anchor [%d] at line %d\n",
-		a->number, l));
+    CTRACE((tfp, "HText: Selecting anchor [%d] at line %d\n",
+	    a->number, l));
 
-	if (!text->stale &&
-	    (l >= text->top_of_screen) &&
-	    (l < text->top_of_screen + display_lines + 1))
-	    return YES;
+    if (!text->stale &&
+	(l >= text->top_of_screen) &&
+	(l < text->top_of_screen + display_lines + 1))
+	return YES;
 
-	www_search_result = l - (display_lines / 3);	/* put in global variable */
-    }
+    www_search_result = l - (display_lines / 3);	/* put in global variable */
 
     return YES;
 }
@@ -10309,7 +10356,12 @@ int HText_beginInput(HText *text,
 	break;
     }
     if (fields_are_numbered() && (a->number > 0)) {
-	sprintf(marker, "[%d]", a->number);
+	if (HTMainText != 0) {
+	    a->show_number = HTMainText->next_number++;
+	} else {
+	    a->show_number = a->number;
+	}
+	sprintf(marker, "[%d]", a->show_number);
 	adjust_marker = (int) strlen(marker);
 	if (number_fields_on_left) {
 	    BOOL had_bracket = (BOOL) (f->type == F_OPTION_LIST_TYPE);
@@ -10449,7 +10501,7 @@ void HText_endInput(HText *text)
 	&& text->last_anchor->number > 0) {
 	char marker[20];
 
-	sprintf(marker, "[%d]", text->last_anchor->number);
+	sprintf(marker, "[%d]", text->last_anchor->show_number);
 	HText_appendText(text, marker);
     }
 }
@@ -13424,6 +13476,7 @@ int HText_InsertFile(LinkInfo * form_link)
     /*  [anything "special" needed based on ->show_anchor value ?] */
     a->next = anchor_ptr;
     a->number = anchor_ptr->number;
+    a->show_number = anchor_ptr->show_number;
     a->line_pos = anchor_ptr->line_pos;
     a->extent = anchor_ptr->extent;
     a->sgml_offset = SGML_offset();
diff --git a/src/GridText.h b/src/GridText.h
index c4f72813..c5ffb088 100644
--- a/src/GridText.h
+++ b/src/GridText.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: GridText.h,v 1.63 2010/09/24 23:01:59 tom Exp $
+ * $LynxId: GridText.h,v 1.65 2010/09/26 23:31:23 tom Exp $
  *
  * Specialities of GridText as subclass of HText
  */
@@ -67,6 +67,7 @@ US-ASCII control characters <32 which are not defined in Unicode standard
 #endif				/* VMS && VAXC && !__DECC */
 
     extern HTChildAnchor *HText_childNextNumber(int n, void **prev);
+    extern int HText_findAnchorNumber(void *avoid);
     extern void HText_FormDescNumber(int n, const char **desc);
 
 /*	Is there any file left?
diff --git a/src/HTAlert.c b/src/HTAlert.c
index d46f04e0..29dcf518 100644
--- a/src/HTAlert.c
+++ b/src/HTAlert.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTAlert.c,v 1.92 2010/09/25 11:19:25 tom Exp $
+ * $LynxId: HTAlert.c,v 1.93 2010/09/26 16:36:38 tom Exp $
  *
  *	Displaying messages and getting input for Lynx Browser
  *	==========================================================
@@ -152,7 +152,7 @@ void HTProgress(const char *Msg)
     statusline(Msg);
     LYstore_message(Msg);
     CTRACE((tfp, "%s\n", Msg));
-    LYSleepDebug();
+    LYSleepDelay();
 }
 
 const char *HTProgressUnits(int rate)
@@ -1138,10 +1138,10 @@ void LYSleepAlert(void)
 	LYSleep(AlertSecs);
 }
 
-void LYSleepDebug(void)
+void LYSleepDelay(void)
 {
     if (okToSleep())
-	LYSleep(DebugSecs);
+	LYSleep(DelaySecs);
 }
 
 void LYSleepInfo(void)
diff --git a/src/HTAlert.h b/src/HTAlert.h
index a2ad1f59..9c96755a 100644
--- a/src/HTAlert.h
+++ b/src/HTAlert.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTAlert.h,v 1.33 2010/09/25 11:36:09 tom Exp $
+ * $LynxId: HTAlert.h,v 1.34 2010/09/26 16:36:38 tom Exp $
  *
  *      Displaying messages and getting input for WWW Library
  *      =====================================================
@@ -151,7 +151,7 @@ extern "C" {
 				     int server_status);
 
     extern void LYSleepAlert(void);
-    extern void LYSleepDebug(void);
+    extern void LYSleepDelay(void);
     extern void LYSleepInfo(void);
     extern void LYSleepMsg(void);
     extern void LYSleepReplay(void);
diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h
index 4cabe593..95290ef2 100644
--- a/src/LYGlobalDefs.h
+++ b/src/LYGlobalDefs.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYGlobalDefs.h,v 1.124 2010/06/18 00:12:13 tom Exp $
+ * $LynxId: LYGlobalDefs.h,v 1.126 2010/09/26 17:03:15 tom Exp $
  *
  * global variable definitions
  */
@@ -390,6 +390,7 @@ extern "C" {
     extern char *personal_extension_map;
     extern char *LYHostName;
     extern char *LYLocalDomain;
+    extern BOOLEAN unique_urls;
     extern BOOLEAN use_underscore;
     extern BOOLEAN no_list;
     extern BOOLEAN no_margins;
@@ -454,7 +455,7 @@ extern "C" {
     extern int AlertSecs;
     extern int InfoSecs;
     extern int MessageSecs;
-    extern int DebugSecs;
+    extern int DelaySecs;
     extern int ReplaySecs;
 
     extern char *LYUserAgent;	/* Lynx User-Agent header */
diff --git a/src/LYList.c b/src/LYList.c
index 2922748a..15564691 100644
--- a/src/LYList.c
+++ b/src/LYList.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYList.c,v 1.45 2010/09/25 12:46:05 tom Exp $
+ * $LynxId: LYList.c,v 1.48 2010/09/27 08:41:28 tom Exp $
  *
  *			Lynx Document Reference List Support	      LYList.c
  *			====================================
@@ -43,6 +43,7 @@ int showlist(DocInfo *newdoc, int titles)
 {
     int cnt;
     int refs, hidden_links;
+    int result;
     static char tempfile[LY_MAXPATH];
     static BOOLEAN last_titles = TRUE;
     FILE *fp0;
@@ -100,8 +101,10 @@ int showlist(DocInfo *newdoc, int titles)
 	    hidden_links = 0;
     }
     helper = NULL;		/* init */
+    result = 1;
     for (cnt = 1; cnt <= refs; cnt++) {
 	HTChildAnchor *child = HText_childNextNumber(cnt, &helper);
+	int value = HText_findAnchorNumber(helper);
 	HTAnchor *dest_intl = NULL;
 	HTAnchor *dest;
 	HTParentAnchor *parent;
@@ -127,63 +130,64 @@ int showlist(DocInfo *newdoc, int titles)
 			"<li><a id=%d href=\"#%d\">form field</a> = <em>%s</em>\n",
 			cnt, cnt, desc);
 	    }
-	    continue;
-	}
+	} else if (value >= result) {
 #ifndef DONT_TRACK_INTERNAL_LINKS
-	dest_intl = HTAnchor_followTypedLink(child, HTInternalLink);
+	    dest_intl = HTAnchor_followTypedLink(child, HTInternalLink);
 #endif
-	dest = dest_intl ?
-	    dest_intl : HTAnchor_followLink(child);
-	parent = HTAnchor_parent(dest);
-	if (!intern_w_post && dest_intl &&
-	    HTMainAnchor &&
-	    HTMainAnchor->post_data &&
-	    parent->post_data &&
-	    BINEQ(HTMainAnchor->post_data, parent->post_data)) {
-	    /*
-	     * Set flag to note that we had at least one internal link, if the
-	     * document from which we are generating the list has associated
-	     * POST data; after an extra check that the link destination really
-	     * has the same POST data so that we can believe it is an internal
-	     * link.
-	     */
-	    intern_w_post = TRUE;
-	}
-	address = HTAnchor_address(dest);
-	title = titles ? HTAnchor_title(parent) : NULL;
-	if (dest_intl) {
-	    HTSprintf0(&LinkTitle, "(internal)");
-	} else if (titles && child->type &&
-		   dest == child->dest &&
-		   !StrNCmp(HTAtom_name(child->type),
-			    "RelTitle: ", 10)) {
-	    HTSprintf0(&LinkTitle, "(%s)", HTAtom_name(child->type) + 10);
-	} else {
-	    FREE(LinkTitle);
-	}
-	StrAllocCopy(Address, address);
-	FREE(address);
-	LYEntify(&Address, TRUE);
-	if (non_empty(title)) {
-	    LYformTitle(&Title, title);
-	    LYEntify(&Title, TRUE);
-	    if (*Title) {
-		cp = findPoundSelector(Address);
+	    dest = dest_intl ?
+		dest_intl : HTAnchor_followLink(child);
+	    parent = HTAnchor_parent(dest);
+	    if (!intern_w_post && dest_intl &&
+		HTMainAnchor &&
+		HTMainAnchor->post_data &&
+		parent->post_data &&
+		BINEQ(HTMainAnchor->post_data, parent->post_data)) {
+		/*
+		 * Set flag to note that we had at least one internal link, if
+		 * the document from which we are generating the list has
+		 * associated POST data; after an extra check that the link
+		 * destination really has the same POST data so that we can
+		 * believe it is an internal link.
+		 */
+		intern_w_post = TRUE;
+	    }
+	    address = HTAnchor_address(dest);
+	    title = titles ? HTAnchor_title(parent) : NULL;
+	    if (dest_intl) {
+		HTSprintf0(&LinkTitle, "(internal)");
+	    } else if (titles && child->type &&
+		       dest == child->dest &&
+		       !StrNCmp(HTAtom_name(child->type),
+				"RelTitle: ", 10)) {
+		HTSprintf0(&LinkTitle, "(%s)", HTAtom_name(child->type) + 10);
 	    } else {
-		FREE(Title);
+		FREE(LinkTitle);
+	    }
+	    StrAllocCopy(Address, address);
+	    FREE(address);
+	    LYEntify(&Address, TRUE);
+	    if (non_empty(title)) {
+		LYformTitle(&Title, title);
+		LYEntify(&Title, TRUE);
+		if (*Title) {
+		    cp = findPoundSelector(Address);
+		} else {
+		    FREE(Title);
+		}
 	    }
-	}
 
-	fprintf(fp0, "<li><a href=\"%s\"%s>%s%s%s%s%s</a>\n", Address,
-		dest_intl ? " TYPE=\"internal link\"" : "",
-		NonNull(LinkTitle),
-		((HTAnchor *) parent != dest) && Title ? "in " : "",
-		(char *) (Title ? Title : Address),
-		(Title && cp) ? " - " : "",
-		(Title && cp) ? (cp + 1) : "");
+	    fprintf(fp0, "<li><a href=\"%s\"%s>%s%s%s%s%s</a>\n", Address,
+		    dest_intl ? " TYPE=\"internal link\"" : "",
+		    NonNull(LinkTitle),
+		    ((HTAnchor *) parent != dest) && Title ? "in " : "",
+		    (char *) (Title ? Title : Address),
+		    (Title && cp) ? " - " : "",
+		    (Title && cp) ? (cp + 1) : "");
 
-	FREE(Address);
-	FREE(Title);
+	    FREE(Address);
+	    FREE(Title);
+	}
+	result = value + 1;
     }
     FREE(LinkTitle);
 
@@ -235,9 +239,11 @@ int showlist(DocInfo *newdoc, int titles)
     return (0);
 }
 
-static void print_refs(FILE *fp, int titles, int refs)
+static int print_refs(FILE *fp, int titles, int refs)
 {
+    int result = 0;
     int cnt;
+    int value;
     char *address = NULL;
     const char *desc = gettext("unknown field or link");
     void *helper = NULL;	/* init */
@@ -247,6 +253,7 @@ static void print_refs(FILE *fp, int titles, int refs)
 	HTAnchor *dest;
 	HTParentAnchor *parent;
 	const char *title;
+	int counter = result + 1;
 
 	if (child == 0) {
 	    /*
@@ -260,33 +267,40 @@ static void print_refs(FILE *fp, int titles, int refs)
 	     */
 	    if (fields_are_numbered()) {
 		HText_FormDescNumber(cnt, &desc);
-		fprintf(fp, "%4d. form field = %s\n", cnt, desc);
+		fprintf(fp, "%4d. form field = %s\n", counter, desc);
+	    }
+	} else {
+	    dest = HTAnchor_followLink(child);
+	    /*
+	     * Ignore if child anchor points to itself, i.e., we had something
+	     * like <A NAME=xyz HREF="#xyz"> and it is not treated as a hidden
+	     * link.  Useful if someone 'P'rints the List Page (which isn't a
+	     * very useful action to do, but anyway...) - kw
+	     */
+	    if (dest != (HTAnchor *) child) {
+		parent = HTAnchor_parent(dest);
+		title = titles ? HTAnchor_title(parent) : NULL;
+		if (links_are_numbered()) {
+		    value = HText_findAnchorNumber(helper);
+		    if (value <= result)
+			continue;
+		    fprintf(fp, "%4d. ", value);
+		}
+		address = HTAnchor_address(dest);
+		fprintf(fp, "%s%s\n",
+			((HTAnchor *) parent != dest) && title ? "in " : "",
+			(title ? title : address));
+		FREE(address);
 	    }
-	    continue;
 	}
-	dest = HTAnchor_followLink(child);
-	/*
-	 * Ignore if child anchor points to itself, i.e., we had something
-	 * like <A NAME=xyz HREF="#xyz"> and it is not treated as a hidden
-	 * link.  Useful if someone 'P'rints the List Page (which isn't a
-	 * very useful action to do, but anyway...) - kw
-	 */
-	if (dest == (HTAnchor *) child)
-	    continue;
-	parent = HTAnchor_parent(dest);
-	title = titles ? HTAnchor_title(parent) : NULL;
-	address = HTAnchor_address(dest);
-	if (links_are_numbered())
-	    fprintf(fp, "%4d. ", cnt);
-	fprintf(fp, "%s%s\n",
-		((HTAnchor *) parent != dest) && title ? "in " : "",
-		(title ? title : address));
-	FREE(address);
+	if (counter > result)
+	    result = counter;
 #ifdef VMS
 	if (HadVMSInterrupt)
 	    break;
 #endif /* VMS */
     }
+    return result;
 }
 
 static void print_hidden_refs(FILE *fp, int refs, int hidden_links)
@@ -338,7 +352,7 @@ void printlist(FILE *fp, int titles)
 	    if (hidden_links > 0) {
 		fprintf(fp, "   %s\n", gettext("Visible links"));
 	    }
-	    print_refs(fp, titles, refs);
+	    refs = print_refs(fp, titles, refs);
 
 	    if (hidden_links > 0) {
 		print_hidden_refs(fp, refs, hidden_links);
diff --git a/src/LYMain.c b/src/LYMain.c
index a046f784..fcf4838e 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMain.c,v 1.221 2010/09/25 11:12:44 tom Exp $
+ * $LynxId: LYMain.c,v 1.224 2010/09/27 00:23:43 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTP.h>
@@ -219,6 +219,7 @@ BOOLEAN number_fields_on_left = TRUE;
 BOOLEAN number_links_on_left = TRUE;
 BOOLEAN recent_sizechange = FALSE;	/* the window size changed recently? */
 BOOLEAN soft_dquotes = FALSE;
+BOOLEAN unique_urls = FALSE;
 BOOLEAN use_underscore = SUBSTITUTE_UNDERSCORES;
 BOOLEAN verbose_img = VERBOSE_IMAGES;	/* show filenames or not */
 BOOLEAN vi_keys = VI_KEYS_ALWAYS_ON;
@@ -479,7 +480,7 @@ LinkInfo links[MAXLINKS];
 
 BOOLEAN nomore = FALSE;		/* display -more- string in statusline messages */
 int AlertSecs;			/* time-delay for HTAlert() messages   */
-int DebugSecs;			/* time-delay for HTProgress messages */
+int DelaySecs;			/* time-delay for HTProgress messages */
 int InfoSecs;			/* time-delay for Information messages */
 int LYMultiBookmarks = MULTI_BOOKMARK_SUPPORT;
 int LYStatusLine = -1;		/* Line for statusline() if > -1 */
@@ -1134,7 +1135,7 @@ int main(int argc,
     StrAllocCopy(ftp_format, FTP_FORMAT);
 
     AlertSecs = SECS2Secs(ALERTSECS);
-    DebugSecs = SECS2Secs(DEBUGSECS);
+    DelaySecs = SECS2Secs(DEBUGSECS);
     InfoSecs = SECS2Secs(INFOSECS);
     MessageSecs = SECS2Secs(MESSAGESECS);
     ReplaySecs = SECS2Secs(REPLAYSECS);
@@ -1518,43 +1519,45 @@ int main(int argc,
     read_cfg(lynx_cfg_file, "main program", 1, (FILE *) 0);
 
 #if defined(USE_COLOR_STYLE)
-    /*
-     * A command-line "-lss" always overrides the config-file, even if it is
-     * an empty string such as -lss="".
-     */
-    if (lynx_lss_file2 != 0) {
-	FREE(lynx_lss_file);
-	lynx_lss_file = lynx_lss_file2;
-	lynx_lss_file2 = 0;
-    }
+    if (!dump_output_immediately) {
+	/*
+	 * A command-line "-lss" always overrides the config-file, even if it is
+	 * an empty string such as -lss="".
+	 */
+	if (lynx_lss_file2 != 0) {
+	    FREE(lynx_lss_file);
+	    lynx_lss_file = lynx_lss_file2;
+	    lynx_lss_file2 = 0;
+	}
 
-    /*
-     * If no alternate lynx-style file was specified on the command line, see
-     * if it's in the environment.
-     */
-    if (!lynx_lss_file) {
-	if (((cp = LYGetEnv("LYNX_LSS")) != NULL) ||
-	    (cp = LYGetEnv("lynx_lss")) != NULL)
-	    StrAllocCopy(lynx_lss_file, cp);
-    }
+	/*
+	 * If no alternate lynx-style file was specified on the command line, see
+	 * if it's in the environment.
+	 */
+	if (!lynx_lss_file) {
+	    if (((cp = LYGetEnv("LYNX_LSS")) != NULL) ||
+		(cp = LYGetEnv("lynx_lss")) != NULL)
+		StrAllocCopy(lynx_lss_file, cp);
+	}
 
-    /*
-     * If we still don't have a lynx-style file, use the userdefs.h definition.
-     */
-    if (!lynx_lss_file)
-	StrAllocCopy(lynx_lss_file, LYNX_LSS_FILE);
+	/*
+	 * If we still don't have a lynx-style file, use the userdefs.h definition.
+	 */
+	if (!lynx_lss_file)
+	    StrAllocCopy(lynx_lss_file, LYNX_LSS_FILE);
 
-    LYTildeExpand(&lynx_lss_file, TRUE);
+	LYTildeExpand(&lynx_lss_file, TRUE);
 
-    /*
-     * If the lynx-style file is not available, inform the user and exit.
-     */
-    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);
-    } else {
-	style_readFromFile(lynx_lss_file);
+	/*
+	 * If the lynx-style file is not available, inform the user and exit.
+	 */
+	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);
+	} else {
+	    style_readFromFile(lynx_lss_file);
+	}
     }
 #endif /* USE_COLOR_STYLE */
 
@@ -3399,7 +3402,7 @@ with -dump, format output as with -traversal, but to stdout"
    ),
 #endif
    PARSE_INT(
-      "delay",		4|NEED_TIME_ARG,	DebugSecs,
+      "delay",		4|NEED_TIME_ARG,	DelaySecs,
       "=NNN\nset NNN-second delay at statusline message"
    ),
    PARSE_FUN(
@@ -3416,7 +3419,7 @@ with -dump, format output as with -traversal, but to stdout"
 -crawl'ing, mark wrapped lines in interactive session"
    ),
    PARSE_FUN(
-      "dump",		4|FUNCTION_ARG,		dump_output_fun,
+      "dump",		1|FUNCTION_ARG,		dump_output_fun,
       "dump the first file to stdout and exit"
    ),
    PARSE_FUN(
@@ -3908,6 +3911,10 @@ bug which treated '>' as a co-terminator for\ndouble-quotes and tags"
       "underscore",	4|TOGGLE_ARG,		use_underscore,
       "toggles use of _underline_ format in dumps"
    ),
+   PARSE_SET(
+      "unique_urls",	4|TOGGLE_ARG,		unique_urls,
+      "toggles use of unique-urls setting for -dump and -listonly options"
+   ),
 #if defined(USE_MOUSE)
    PARSE_SET(
       "use_mouse",	4|SET_ARG,		LYUseMouse,
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c
index 4e9357ec..08c08af8 100644
--- a/src/LYReadCFG.c
+++ b/src/LYReadCFG.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYReadCFG.c,v 1.154 2010/09/24 22:57:51 tom Exp $
+ * $LynxId: LYReadCFG.c,v 1.156 2010/09/27 10:45:02 tom Exp $
  */
 #ifndef NO_RULES
 #include <HTRules.h>
@@ -1371,7 +1371,7 @@ static Config_Type Config_Table [] =
 #ifdef VMS
      PARSE_PRG(RC_CSWING_PATH,          ppCSWING),
 #endif
-     PARSE_TIM(RC_DELAYSECS,            DebugSecs),
+     PARSE_TIM(RC_DELAYSECS,            DelaySecs),
      PARSE_FUN(RC_DEFAULT_BOOKMARK_FILE, default_bookmark_file_fun),
      PARSE_FUN(RC_DEFAULT_CACHE_SIZE,   default_cache_size_fun),
 #ifdef USE_DEFAULT_COLORS
@@ -1616,6 +1616,7 @@ static Config_Type Config_Table [] =
 #endif
      PARSE_PRG(RC_UNCOMPRESS_PATH,      ppUNCOMPRESS),
      PARSE_SET(RC_UNDERLINE_LINKS,      LYUnderlineLinks),
+     PARSE_SET(RC_UNIQUE_URLS,          unique_urls),
      PARSE_PRG(RC_UNZIP_PATH,           ppUNZIP),
 #ifdef DIRED_SUPPORT
      PARSE_ADD(RC_UPLOADER,             uploaders),
diff --git a/src/LYrcFile.h b/src/LYrcFile.h
index 7915b64b..13488d22 100644
--- a/src/LYrcFile.h
+++ b/src/LYrcFile.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYrcFile.h,v 1.35 2010/06/18 00:08:05 tom Exp $
+ * $LynxId: LYrcFile.h,v 1.36 2010/09/26 17:05:07 tom Exp $
  */
 #ifndef LYRCFILE_H
 #define LYRCFILE_H
@@ -243,6 +243,7 @@
 #define RC_TRUSTED_LYNXCGI              "trusted_lynxcgi"
 #define RC_UNCOMPRESS_PATH              "uncompress_path"
 #define RC_UNDERLINE_LINKS              "underline_links"
+#define RC_UNIQUE_URLS                  "unique_urls"
 #define RC_UNZIP_PATH                   "unzip_path"
 #define RC_UPLOADER                     "uploader"
 #define RC_URL_DOMAIN_PREFIXES          "url_domain_prefixes"