www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/09/24/20:18:37

From: "Mark E." <snowball3 AT softhome DOT net>
To: djgpp-workers AT delorie DOT com
Date: Tue, 24 Sep 2002 20:18:37 -0400
MIME-Version: 1.0
Subject: _fixpath doc update and realpath
Message-ID: <3D90C89D.18334.AA135B@localhost>
X-mailer: Pegasus Mail for Windows (v4.02a)
Reply-To: djgpp-workers AT delorie DOT com

This updates _fixpath to reflect that errno may be set.

Index: fixpath.txh
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/sys/stat/fixpath.txh,v
retrieving revision 1.4
diff -c -p -r1.4 fixpath.txh
*** fixpath.txh	20 Jul 2000 07:16:39 -0000	1.4
--- fixpath.txh	25 Sep 2002 00:15:43 -0000
*************** caller should ensure there is enough spa
*** 30,36 ****
  
  @subheading Return Value
  
! None.
  
  @subheading Portability
  
--- 30,37 ----
  
  @subheading Return Value
  
! None.  If the length of the returned path name exceeds @code{FILENAME_MAX},
! @code{errno} is set to @code{ENAMETOOLONG}.
  
  @subheading Portability
  

And the realpath wrapper:
/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
#include <libc/stubs.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#include <limits.h>
#include <libc/symlink.h>

/* Return the canonicalized form of the path in variable IN.  */
char *
realpath(const char *in, char *out)
{
  char in1[PATH_MAX];

  if (in == NULL || out == NULL)
  {
    errno = EINVAL;
    return NULL;
  }

  if (in[0] == '\0')
  {
    errno = ENOENT;
    return NULL;
  }

  if (!__solve_symlinks(in, in1))
    return NULL; /* Return errno from from __solve_dir_symlinks().  */

  if (__canonicalize_path(in1, out, PATH_MAX) == NULL)
    return NULL; /* Return errno from __canonicalize_path().  */

  return out;
}

- Raw text -


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