delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/03/15/09:39:42

Date: Sun, 15 Mar 1998 16:38:40 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: DJ Delorie <dj AT delorie DOT com>
cc: djgpp-workers AT delorie DOT com
Subject: Docs for `_fixpath' fixed
Message-ID: <Pine.SUN.3.91.980315163713.10360B-100000@is>
MIME-Version: 1.0

Somebody complained that the docs didn't say explicitly that the return 
value may be much longer than the input.  Now they do.

*** src/libc/posix/sys/stat/fixpath.t~0	Sun Sep  1 01:09:32 1996
--- src/libc/posix/sys/stat/fixpath.txh	Sat Mar 14 20:42:30 1998
***************
*** 13,19 ****
  result in the buffer pointed to by @var{out_path}.
  
  The path is fixed by removing consecutive and trailing slashes, making
! the path absolute if it's relative, removing "." components, collapsing
  ".." components, adding a drive specifier if needed, and converting all
  slashes to '/'.  DOS-style 8+3 names of directories which are part of
  the pathname, as well as its final filename part, are returned
--- 13,20 ----
  result in the buffer pointed to by @var{out_path}.
  
  The path is fixed by removing consecutive and trailing slashes, making
! the path absolute if it's relative by prepending the current drive
! letter and working directory, removing "." components, collapsing
  ".." components, adding a drive specifier if needed, and converting all
  slashes to '/'.  DOS-style 8+3 names of directories which are part of
  the pathname, as well as its final filename part, are returned
***************
*** 21,26 ****
--- 22,33 ----
  @xref{_preserve_fncase}, for more details on letter-case conversions in
  filenames.
  
+ Since the returned path name can be longer than the original one, the
+ caller should ensure there is enough space in the buffer pointed to by
+ @var{out_path}.  Using ANSI-standard constant @code{FILENAME_MAX}
+ (defined on @file{stdio.h}) or Posix-standard constant @code{PATH_MAX}
+ (defined on @file{limits.h}) is recommended.
+ 
  @subheading Return Value
  
  None.
***************
*** 28,34 ****
  @subheading Example
  
  @example
! char oldpath[100], newpath[100];
  scanf(oldpath);
  _fixpath(oldpath, newpath);
  printf("that really is %s\n", newpath);
--- 35,41 ----
  @subheading Example
  
  @example
! char oldpath[100], newpath[FILENAME_MAX];
  scanf(oldpath);
  _fixpath(oldpath, newpath);
  printf("that really is %s\n", newpath);

- Raw text -


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