From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45826 invoked by alias); 21 Sep 2019 21:02:41 -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 45816 invoked by uid 89); 21 Sep 2019 21:02:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: NAM05-BY2-obe.outbound.protection.outlook.com Received: from mail-eopbgr710130.outbound.protection.outlook.com (HELO NAM05-BY2-obe.outbound.protection.outlook.com) (40.107.71.130) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 21 Sep 2019 21:02:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SJR/ahW5S7WurVWZs1yB7mI0ExhDXwA7JA4z3kbeBZlEbqDA6Zk6rLMA6vHQHdPPTusS8GeatvgbwslefmKinsZsReJvxP1fxEupKm+mQ1nacMdR6d9NnsQgt6g114oF9IW6R1IKNzoKUrN/697L5xzOCqo1iSqDW31AYkf17GUzIFPrDQn3PEW6i4Ghvrt+GmlCPlrDI8YxKhZOQrM5T8jLRnrxdBEI/i+xUNX9rNv3snsNUcCu4QHfxEVu+nSuZ2EtigGLIs9dC6xG7mCkfwIhyYqokrxNfhyKHtdRGf+GkcyPZkurfMC3Y85yTWq1oWBjdv7nIx/TUFpC6/A0BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yHBDGhNo9B4MLI1NTB4Q7Dnl/fBS2IJ2Zvvk0klXGI4=; b=O8Jk3pDb3ZagOc9p402v53i1TWq1NJLp/srcwcLHYfMzzPE/ZROpFTiEZSupEZNWD0jndS+tSFGnEcoFtymHxrJ29hbX3lIc/PWFKsDW7+H1vqoEhkVarNqX+xhEvbcQ4r/Lk8NGpRjAP2dp1sRoaUd9CiYC4wTVdPUy9DDxPQOJDGGCMSZZwAGuFPPLxLss+UA/gfvzKgwOMn4/o0EQw2V7kq3dcA6aARyPFp2MZaVtZrqeBDPk1G8OA640ocRhDiseoZqRVGhDNmRBZyEAFUDLsTy/yqCqX/zaMwDeYYWPcHZUdnBnJ2S0+IRrf/nJ3hK0Y2MXjz+pZJAtiDRN5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cornell.edu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yHBDGhNo9B4MLI1NTB4Q7Dnl/fBS2IJ2Zvvk0klXGI4=; b=Ri3tpwFyTKVIDZJSmkSATbo/22Rkc3r3LJIb+hWLN7NhuVK+Lbu+ZNiF+sYgSVDOV8ACEDp157GYNoWXJvIEsyH0CAKCYMFWLHWckviYvM4GsLaWLBfvFXd14s5QuDaavLTLhzuNt2+GNdZkUtxH0YC7TcStosLoOi5ZYNe3DRs= Received: from DM6PR04MB5738.namprd04.prod.outlook.com (20.179.51.81) by DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.22; Sat, 21 Sep 2019 21:02:37 +0000 Received: from DM6PR04MB5738.namprd04.prod.outlook.com ([fe80::998b:a76c:fc2b:1473]) by DM6PR04MB5738.namprd04.prod.outlook.com ([fe80::998b:a76c:fc2b:1473%4]) with mapi id 15.20.2263.023; Sat, 21 Sep 2019 21:02:37 +0000 From: Ken Brown To: "cygwin@cygwin.com" Subject: Re: Solved. Odd, is it not? mkdir 'e:\' cannot be undone by rmdir 'e:\' ... Date: Sat, 21 Sep 2019 22:45:00 -0000 Message-ID: <18fad38d-8b50-959c-1b4c-4b3080bd8c62@cornell.edu> References: <8e310c59702b57501ca2fd80edf19d2e@smtp-cloud9.xs4all.net> In-Reply-To: <8e310c59702b57501ca2fd80edf19d2e@smtp-cloud9.xs4all.net> user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 authentication-results: spf=none (sender IP is ) smtp.mailfrom=kbrown@cornell.edu; x-ms-oob-tlc-oobclassifiers: OLM:7691; received-spf: None (protection.outlook.com: cornell.edu does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="Windows-1252" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: XE4HMJCmfhMfovTybNn0pDfsan+N/2boAyRtotZnEAEw0iEVN3R2rnAnwUSF1wEnkifZKxrCeOxSOAiLR37/Hw== X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg00219.txt.bz2 On 9/6/2019 5:53 PM, Houder wrote: > However an exception can be made for e:/ (or e:\), as follows: >=20 > -- > char flag =3D '\0'; > // strip trailing dirsep's, while remembering the last one > if (isdirsep (dir[strlen (dir) - 1])) > { > flag =3D dir[strlen (dir) - 1]; > /* This converts // to /, but since both give EEXIST, we're ok= ay. */ > char *buf; > char *p =3D stpcpy (buf =3D tp.c_get (), dir) - 1; > dir =3D buf; > while (p > dir && isdirsep (*p)) > { > flag =3D *p; > *p-- =3D '\0'; > } > } >=20 > // reattach dirsep in case of x: and flag !=3D '\0' > if ( (strlen (dir) =3D=3D 2) > && (dir[1] =3D=3D ':') > && isalpha (dir[0]) && flag !=3D '\0' ) > { > char *buf =3D tp.c_get (); > buf[0] =3D dir[0]; > buf[1] =3D ':'; > buf[2] =3D flag; > buf[3] =3D '\0'; > dir =3D buf; > } I think you can simplify this by eliminating the second part and changing t= he=20 first part to the following: char sep =3D dir[strlen (dir) - 1]; if (isdirsep (sep) { /* This converts // to /, but since both give EEXIST, we're ok= ay. */ char *buf; char *p =3D stpcpy (buf =3D tp.c_get (), dir) - 1; dir =3D buf; while (p > dir && isdirsep (*p)) *p-- =3D '\0'; /* Reattach dirsep in case of "x:". */ if (p =3D=3D dir + 1 && *p =3D=3D ':' && isalpha (dir[0])) p[1] =3D sep; } Ken -- 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