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 --- map.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'map.c') 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