delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/01/29/22:21:59

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:to:from:subject:message-id:date:mime-version
:content-type:content-transfer-encoding; q=dns; s=default; b=gXw
tiRIQWdj54Xwu1Rbr1gNetj4WupFzghb6Yfi9XVorHgV+5YEXrnsxb+WWUkfH2mU
6BdEqTz6V8oEGSlj05mD0YalWC4N/2dvavIX0KDXV8MGXPHeaqmxVgL1SBr0wzHG
LzHCInvg3UYpiYoXKCX3EyYUtSCxnEl661KXknMY=
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:to:from:subject:message-id:date:mime-version
:content-type:content-transfer-encoding; s=default; bh=h2kuzO6uj
z1vNOcSjYFDdkdDhWo=; b=wbZ0hpQPzWbgeB9tCRkTersQvPMFHMexwFSOPN6XO
QO4tEBn/K8B9WbzZ/DbdzjvEidzRQswbxv1Gx9aACkjd8fxb9oAJ29ly1po5hVqT
qNy6U6g7pQbT6sFSHGrfKu8s75VOyclwWFSLSx79jTpNtfCndoCJiskcW8NrmwDb
08=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=Win32, ld, win32, ssize_t
X-HELO: limerock04.mail.cornell.edu
X-CornellRouted: This message has been Routed already.
To: cygwin <cygwin AT cygwin DOT com>
From: Ken Brown <kbrown AT cornell DOT edu>
Subject: cygwin_conv_path sometimes removes trailing slash
Message-ID: <56AC2C35.9060903@cornell.edu>
Date: Fri, 29 Jan 2016 22:21:25 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1
MIME-Version: 1.0
X-IsSubscribed: yes

I'm using cygwin_conv_path to convert Win32 paths to POSIX paths, and 
I'm puzzled by the conversion

   d:/ --> /cygdrive/d

without the trailing slash.  By contrast, we have

   d:/foo/ --> /cygdrive/d/foo/

Is the removal of the trailing slash in the first example a deliberate 
design decision?  I find it counter-intuitive.

My tests are essentially based on the example at the end of 
https://cygwin.com/cygwin-api/func-cygwin-conv-path.html:

#include <sys/cygwin.h>
#include <stdio.h>
#include <stdlib.h>

int
main ()
{
   wchar_t *win32 = L"d:/";
   ssize_t size;
   char *posix;
   size = cygwin_conv_path (CCP_WIN_W_TO_POSIX, win32, NULL, 0);
   if (size < 0)
     perror ("cygwin_conv_path");
   else
     {
       posix = (char *) malloc (size);
       if (cygwin_conv_path (CCP_WIN_W_TO_POSIX, win32, posix, size))
	perror ("cygwin_conv_path");
     }
   printf ("%s\n", posix);
}

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019