From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67811 invoked by alias); 22 Sep 2019 07:34:49 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 67804 invoked by uid 89); 22 Sep 2019 07:34:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=Having, HX-Languages-Length:905 X-HELO: lb1-smtp-cloud8.xs4all.net Received: from lb1-smtp-cloud8.xs4all.net (HELO lb1-smtp-cloud8.xs4all.net) (194.109.24.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 22 Sep 2019 07:34:47 +0000 Received: from tmp.pwK8haUZzh ([83.162.234.136]) by smtp-cloud8.xs4all.net with ESMTPSA id BwOKinedSKKNGBwOLigctT; Sun, 22 Sep 2019 09:34:45 +0200 Date: Sun, 22 Sep 2019 09:47:00 -0000 Message-ID: From: Houder Reply-To: cygwin@cygwin.com To: cygwin@cygwin.com Subject: Re: Solved. Odd, is it not? mkdir 'e:\' cannot be undone by rmdir 'e:\' ... References: <8e310c59702b57501ca2fd80edf19d2e@smtp-cloud9.xs4all.net> <18fad38d-8b50-959c-1b4c-4b3080bd8c62@cornell.edu> In-Reply-to: <18fad38d-8b50-959c-1b4c-4b3080bd8c62@cornell.edu> Content-Type: text/plain; charset=UTF-8; format=fixed User-Agent: mua.awk 0.99 X-SW-Source: 2019-09/txt/msg00223.txt.bz2 On Sat, 21 Sep 2019 21:02:37, Ken Brown wrote: [snip] > I think you can simplify this by eliminating the second part and changing > the first part to the following: > > char sep = dir[strlen (dir) - 1]; > if (isdirsep (sep) > { > /* This converts // to /, but since both give EEXIST, we're okay. */ > char *buf; > char *p = stpcpy (buf = tp.c_get (), dir) - 1; > dir = buf; > while (p > dir && isdirsep (*p)) > *p-- = '\0'; > /* Reattach dirsep in case of "x:". */ > if (p == dir + 1 && *p == ':' && isalpha (dir[0])) > p[1] = sep; > } Hi Ken, The ball is your court now. Having said that, in case of multiple trailing dirseps, your code will reattach the last one. My code will reattach the first dirsep, not the last one. And dirseps can be both \ and /. But again, the ball is your court now ... Regards, Henri ===== -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple