From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13317 invoked by alias); 21 Apr 2014 14:10:33 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 13305 invoked by uid 89); 21 Apr 2014 14:10:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: mho-01-ewr.mailhop.org Received: from mho-03-ewr.mailhop.org (HELO mho-01-ewr.mailhop.org) (204.13.248.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 21 Apr 2014 14:10:31 +0000 Received: from pool-173-76-43-57.bstnma.fios.verizon.net ([173.76.43.57] helo=cgf.cx) by mho-01-ewr.mailhop.org with esmtpa (Exim 4.72) (envelope-from ) id 1WcEvV-0004sW-Rc for cygwin-apps@cygwin.com; Mon, 21 Apr 2014 14:10:29 +0000 Received: from ednor (ednor.casa.cgf.cx [192.168.187.5]) by cgf.cx (Postfix) with SMTP id 34A40600D0 for ; Mon, 21 Apr 2014 10:10:28 -0400 (EDT) Received: by ednor (sSMTP sendmail emulation); Mon, 21 Apr 2014 10:10:28 -0400 X-Mail-Handler: Dyn Standard SMTP by Dyn X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1+rqyjad5lBFI90kGlzbaUk Date: Mon, 21 Apr 2014 14:10:00 -0000 From: Christopher Faylor To: cygwin-apps@cygwin.com Subject: Re: [PATCH setup 3/3] Add the last element of URL path to site chooser, if interesting. Message-ID: <20140421141028.GD661@ednor.casa.cgf.cx> Reply-To: cygwin-apps@cygwin.com Mail-Followup-To: cygwin-apps@cygwin.com References: <1398078987-5116-1-git-send-email-jon.turney@dronecode.org.uk> <1398078987-5116-4-git-send-email-jon.turney@dronecode.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1398078987-5116-4-git-send-email-jon.turney@dronecode.org.uk> User-Agent: Mutt/1.5.20 (2009-06-14) X-SW-Source: 2014-04/txt/msg00056.txt.bz2 On Mon, Apr 21, 2014 at 12:16:27PM +0100, Jon TURNEY wrote: >If I add the site http://mirrors.kernel.org/sources.redhat.com/cygwinports/ to >setup's mirror list, using the GUI or --site option, I get two indistinguishable >entries named http://mirrors.kernel.org in the mirror list box. > >So, to make the site chooser list entries more distinguishable, add the last >element of the URL path to the site chooser, if it exists and isn't 'cygwin' (or >some other alternatives used by current mirrors) > >As Corinna pointed out in Nov 2010, there is still a corner case of URLs which >share protocol, hostname and the last element of the URL path being >indistinguishable. Additionally, it will need updating for any new mirrors which >don't use one of the expected strings for the last path element in the URL. > >2014-04-19 Jon TURNEY > > * site.cc (init): If interesting, show the last element > of URL, as well as the protocol and sitename in the site chooser. > >Signed-off-by: Jon TURNEY >--- > site.cc | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > >diff --git a/site.cc b/site.cc >index 48ec0aa..70f6303 100644 >--- a/site.cc >+++ b/site.cc >@@ -173,6 +173,27 @@ site_list_type::init (const string &_url, const string &_servername, > idx = 0; > } while (idx > 0); > key += url; >+ >+ /* add last element of url if it exists, and isn't "cygwin" to displayed_url */ >+ if (path_offset+1 < url.length()) >+ { >+ string url_path = url.substr(path_offset+1); >+ >+ /* trim any trailing / */ >+ if (url_path.at(url_path.length()-1) == '/') >+ url_path.erase(url_path.length()-1); >+ >+ /* add the last path element, if it exists, and isn't "cygwin" >+ (or some aliases used by existing sites) */ >+ string::size_type pos = url_path.rfind('/'); >+ string lpe = url_path.substr(pos+1); >+ if ((pos != string::npos) && (lpe.compare("cygwin") != 0) && >+ (lpe.compare("cygwin.com") != 0) && (lpe.compare("cygwin32") != 0) && >+ (lpe.compare("gnu-win32") != 0)) >+ { >+ displayed_url.append(" (" + lpe + ")"); >+ } >+ } > } I'd actually be ok with just displaying the whole URL even if it ends with Cygwin. Is there a reason not to do that? cgf