public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Houder <houder@xs4all.nl>
To: cygwin@cygwin.com
Subject: Re: Solved. Odd, is it not? mkdir 'e:\' cannot be undone by rmdir 'e:\' ...
Date: Sun, 22 Sep 2019 09:47:00 -0000	[thread overview]
Message-ID: <d22a4e39e17ccb7ef759fa504192b594@smtp-cloud8.xs4all.net> (raw)
In-Reply-To: <18fad38d-8b50-959c-1b4c-4b3080bd8c62@cornell.edu>

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

  reply	other threads:[~2019-09-22  7:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06 21:53 Houder
2019-09-21 22:45 ` Ken Brown
2019-09-22  9:47   ` Houder [this message]
2019-09-22 11:55 ` Houder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d22a4e39e17ccb7ef759fa504192b594@smtp-cloud8.xs4all.net \
    --to=houder@xs4all.nl \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).