| delorie.com/archives/browse.cgi | search | 
| X-Recipient: | archive-cygwin AT delorie DOT com | 
| X-Spam-Check-By: | sourceware.org | 
| Date: | Thu, 30 Oct 2008 13:10:50 +0100 | 
| From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> | 
| To: | cygwin AT cygwin DOT com | 
| Subject: | Re: canonicalize_file_name | 
| Message-ID: | <20081030121050.GL6478@calimero.vinschen.de> | 
| Reply-To: | cygwin AT cygwin DOT com | 
| Mail-Followup-To: | cygwin AT cygwin DOT com | 
| References: | <001b01c93a65$97134460$4001a8c0 AT mycomputer> <49099F53 DOT 9060105 AT byu DOT net> | 
| MIME-Version: | 1.0 | 
| In-Reply-To: | <49099F53.9060105@byu.net> | 
| User-Agent: | Mutt/1.5.16 (2007-06-09) | 
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm | 
| List-Id: | <cygwin.cygwin.com> | 
| List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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 | 
On Oct 30 05:49, Eric Blake wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> According to John Emmas on 10/30/2008 2:00 AM:
> > On my Linux boxes, /usr/include/stdlib.h declares a function called
> > 'canonicalize_file_name()'.  AFAICT its purpose is to return the
> > absolute path to a file (or folder) after resolving any symbolic links
> > in the supplied path.  Cygwin's stdlib.h doesn't contain this function. 
> > I just wondered if it's available anywhere else or if there's an
> > equivalent function elsewhere.
> 
> Cygwin doesn't (yet) provide it (http://cygwin.com/acronyms/#PTC).  But
> gnulib provides a variant that is used within several cygwin packages:
> http://www.gnu.org/software/gnulib/MODULES.html#module=canonicalize
The following should do the same under Cygwin:
  #include <sys/cygwin.h>
  #include <cygwin/version.h>
  #ifdef CYGWIN_VERSION_DLL_MAJOR >= 1007  /* Cygwin 1.7.0 and later */
    char *out_path = (char *) cygwin_create_path (CCP_WIN_A_TO_POSIX, in_path);
    if (out_path == NULL)
      /* Check errno */
    else
      {
        /* Do what ever you want with out_path. */
	free (out_path);
      }
  #else
    char out_path[PATH_MAX];
    cygwin_conv_to_full_posix_path (in_path, out_path);
  #endif
Corinna
-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
| webmaster | delorie software privacy | 
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |