From dd4e9f38d1457d2002e9b824a380e34eac1a6331 Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Thu, 5 Dec 2002 16:08:34 +0000 Subject: [w3m-dev 03528] area without alt * map.c (getCurrentMapLabel): when a->alt is empty From: Hironori SAKAMOTO --- ChangeLog | 7 ++++++- map.c | 23 ++++++++++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f67920..1178968 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-12-06 Hironori SAKAMOTO + + * [w3m-dev 03528] area without alt + * map.c (getCurrentMapLabel): when a->alt is empty + 2002-12-06 Hironori SAKAMOTO * [w3m-dev 03527] fix frame.c @@ -5465,4 +5470,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.591 2002/12/05 16:04:00 ukai Exp $ +$Id: ChangeLog,v 1.592 2002/12/05 16:08:34 ukai Exp $ diff --git a/map.c b/map.c index 7311b34..6c1eaaf 100644 --- a/map.c +++ b/map.c @@ -1,4 +1,4 @@ -/* $Id: map.c,v 1.18 2002/12/02 17:55:50 ukai Exp $ */ +/* $Id: map.c,v 1.19 2002/12/05 16:08:34 ukai Exp $ */ /* * client-side image maps */ @@ -137,7 +137,7 @@ getCurrentMapLabel(Buffer *buf) ListItem *al; MapArea *a; int i, n; - Str s; + Str s = NULL; a_img = retrieveCurrentImg(buf); if (!(a_img && a_img->image && a_img->image->map)) @@ -159,11 +159,15 @@ getCurrentMapLabel(Buffer *buf) a = (MapArea *) al->ptr; if (!(a && i == n)) continue; - s = Sprintf("[%s]", a->alt); - if (*a->alt) { + if (*a->alt) + s = Sprintf("[%s]", a->alt); + if (*a->url) { ParsedURL pu; parseURL2(a->url, &pu, baseURL(buf)); - Strcat_char(s, ' '); + if (s) + Strcat_char(s, ' '); + else + s = Strnew(); Strcat(s, parsedURL2Str(&pu)); } return s; @@ -280,8 +284,9 @@ follow_map_panel(Buffer *buf, char *name) continue; parseURL2(a->url, &pu, baseURL(buf)); url = html_quote(parsedURL2Str(&pu)->ptr); - Strcat_m_charp(mappage, "", html_quote(a->alt), - "", url, "\n", NULL); + Strcat_m_charp(mappage, "", + html_quote(*a->alt ? a->alt : mybasename(a->url)), + "", url, NULL); } Strcat_charp(mappage, ""); @@ -409,8 +414,8 @@ append_map_info(Buffer *buf, Str tmp, FormItemList *fi) parseURL2(a->url, &pu, baseURL(buf)); url = html_quote(parsedURL2Str(&pu)->ptr); Strcat_m_charp(tmp, "  ", - html_quote(a->alt), "", html_quote(a->url), - "\n", NULL); + html_quote(*a->alt ? a->alt : mybasename(a->url)), + "", html_quote(a->url), "\n", NULL); } Strcat_charp(tmp, ""); } -- cgit v1.2.3