This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
[PATCH setup v2 4/5] Display full URL of non-mirrors in the site list
- From: Ken Brown <kbrown at cornell dot edu>
- To: cygwin-apps at cygwin dot com
- Date: Mon, 4 Dec 2017 10:18:07 -0500
- Subject: [PATCH setup v2 4/5] Display full URL of non-mirrors in the site list
- Authentication-results: sourceware.org; auth=none
- References: <20171204151808.4804-1-kbrown@cornell.edu>
Set displayed_url to full URL in the site_list_type constructor if
from_mirrors_lst is false. Modify check_for_user_urls() to change
displayed_url back to the short form if a site in all_site_list turns
out to be a stale mirror.
---
site.cc | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/site.cc b/site.cc
index 9b7b816..9972a29 100644
--- a/site.cc
+++ b/site.cc
@@ -183,6 +183,12 @@ site_list_type::site_list_type (const string &_url,
idx = 0;
} while (idx > 0);
key += url;
+ /* Display the full URL (without trailing slash) of a non-mirror. */
+ if (!from_mirrors_lst)
+ {
+ displayed_url = url;
+ displayed_url.erase (displayed_url.end () - 1);
+ }
}
site_list_type::site_list_type (site_list_type const &rhs)
@@ -242,19 +248,31 @@ save_dialog (HWND h)
}
}
-// Does the_site_list contain any sites that are not mirrors (possibly stale)?
+// Set allow_user_url = true if all_site_list contains any sites that
+// are not mirrors (possibly stale). At the same time, fixup the
+// stored information about stale mirrors.
static void
check_for_user_urls ()
{
- for (SiteList::const_iterator i = all_site_list.begin ();
+ for (SiteList::iterator i = all_site_list.begin ();
i != all_site_list.end (); i++)
{
- if (!i->from_mirrors_lst
- && (find (cached_site_list.begin (), cached_site_list.end (), *i)
- == cached_site_list.end ()))
+ if (!i->from_mirrors_lst)
{
- allow_user_url = true;
- return;
+ // Is it a stale mirror?
+ SiteList::iterator j = find (cached_site_list.begin (),
+ cached_site_list.end (), *i);
+ if (j == cached_site_list.end ())
+ allow_user_url = true;
+ else
+ {
+ i->servername = j->servername;
+ i->area = j->area;
+ i->location = j->location;
+ // i->from_mirrors_lst stays false.
+ i->displayed_url = j->displayed_url;
+ i->key = j->key;
+ }
}
}
}
--
2.15.1