X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:message-id:from:reply-to:to:subject :references:in-reply-to:content-type; q=dns; s=default; b=ySaJ9A Vb3YkejJZ2KP5JdHBSAOOibE20T7GsNVaFfQuqIi8a5ccPTpugvt5buEtgQOXM04 No8/axr6quWFFM0R9sMfovUmlpH9SBt296+LkMpMVi/3PS+B/dbBFWM9pH29I4vh c1tqYkGVDG4D76guYlKiUDUOaPaDq+IxF/YD8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:message-id:from:reply-to:to:subject :references:in-reply-to:content-type; s=default; bh=evKmQTNWwExf LkDTgR29L7OQXso=; b=pbPFM6RTLnDCTO0/eQmImY+Z/zAx2qSfRs+4IYPCS2vK Xwq9L48aakZG/uJe9LMehnK9o7uMF/aPCuJGjAik3Z4dc/NTUeFM4Eb9+4CCaAXh FeJ137kvgdqnl3/fG3+AadSYWa4DuSXASnEjc1PJh9cbBh+08tNaNgbD8wONwYo= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 Date: Sun, 22 Sep 2019 09:34:45 +0200 Message-ID: From: Houder Reply-To: cygwin AT cygwin DOT com To: cygwin AT cygwin DOT com Subject: Re: Solved. Odd, is it not? mkdir 'e:\' cannot be undone by rmdir 'e:\' ... References: <8e310c59702b57501ca2fd80edf19d2e AT smtp-cloud9 DOT xs4all DOT net> <18fad38d-8b50-959c-1b4c-4b3080bd8c62 AT cornell DOT 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 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