delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/08/23/18:04:01

Date: Sat, 23 Aug 2003 22:46:56 +0100
From: "Richard Dawe" <rich AT phekda DOT freeserve DOT co DOT uk>
Sender: rich AT phekda DOT freeserve DOT co DOT uk
To: djgpp-workers AT delorie DOT com
X-Mailer: Emacs 21.3.50 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6
Subject: getcwd docs: describe extensions to POSIX [PATCH]
Message-Id: <E19qg5E-0000fW-00@phekda.freeserve.co.uk>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Our getcwd supports an extension to the POSIX behaviour. We should
document it. It also doesn't say that you need to specify
the size of the buffer that it should allocate, when it's allocating
the buffer. Below is a patch to fix both of these.

OK to commit?

Thanks, bye, Rich =]

Index: src/libc/posix/unistd/getcwd.txh
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/getcwd.txh,v
retrieving revision 1.3
diff -p -u -3 -r1.3 getcwd.txh
--- src/libc/posix/unistd/getcwd.txh	29 Jan 2003 12:51:41 -0000	1.3
+++ src/libc/posix/unistd/getcwd.txh	23 Aug 2003 21:35:51 -0000
@@ -11,9 +11,14 @@ char *getcwd(char *buffer, int max);
 @subheading Description
 
 Get the current directory.  The return value includes the drive
-specifier.  If @var{buffer} is @code{NULL}, @code{getcwd} allocates
-memory with @code{malloc}.  This call fails if more than @var{max}
-characters are required to specify the current directory.
+specifier.
+
+If @var{buffer} is @code{NULL}, @code{getcwd} allocates
+a buffer of size @var{max} with @code{malloc}.  This is an extension
+of the POSIX standard, which is compatible with the behaviour on Linux.
+
+This call fails if more than @var{max} characters are required
+to specify the current directory.
 
 @subheading Return Value
 
@@ -23,6 +28,8 @@ The buffer, either @var{buffer} or a new
 @subheading Portability
 
 @portability !ansi, posix
+
+@port-note posix The behaviour when @var{buffer} is @code{NULL} is unspecified for POSIX.
 
 @subheading Example
 

- Raw text -


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