tags 381692 fixed-upstream
thanks

Salut Samuel,

> Along get_current_dir_name(3) are documented getcwd and getwd, which are
> posix, but get_current_dir_name is _not_, and #define _GNU_SOURCE is
> needed for getting it. The manpage should hence note in SYNOPSIS that
> #define _GNU_SOURCE is needed for get_current_dir_name, and in
> CONFORMING TO that get_current_dir_name is a GNU extension.

In fact the required feature test macros are already documented
in the manual page body:

       get_current_dir_name(), which is only  prototyped  if
       _GNU_SOURCE  is  defined, will malloc(3) an array big
       enough to hold the current directory  name. ...

       getwd(), which is only prototyped if  _BSD_SOURCE  or
       _XOPEN_SOURCE_EXTENDED is defined, will not malloc(3)
       any memory.

But I agree that they would better be documented in the SYNOPSIS,
and I have changed the manual page so they are documented there:

   SYNOPSIS
       #include <unistd.h>

       char *getcwd(char *buf, size_t size);

       #define _BSD_SOURCE     /* Or: #define _XOPEN_SOURCE 500 */
       #include <unistd.h>

       char *getwd(char *buf);

       #define _GNU_SOURCE
       #include <unistd.h>

       char *get_current_dir_name(void);

I also fixed the CONFORMING TO section, which now reads:

   CONFORMING TO
       getcwd()  conforms  to  POSIX.1-2001.    getwd()   is
       present in POSIX.1-2001, but marked LEGACY.  get_cur-
       rent_dir_name() is a GNU extension.

Fixes will be in upstream 2.40.  Thanks for your report.

Cheers,

Michael

-- 
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7

Want to help with man page maintenance?  Grab the latest tarball at
ftp://ftp.win.tue.nl/pub/linux-local/manpages/,
read the HOWTOHELP file and grep the source files for 'FIXME'.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to