Package: manpages-dev
Version: 3.05-1
Severity: normal

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The basename (3) man page says that there are two different versions
of basename(): the POSIX one and the GNU version. This is
correct. However, it goes on to say that you get the GNU version with

    #define _GNU_SOURCE
    #include <string.h>

Confusingly, it also says (a little further down the page):

> With glibc, one gets the POSIX version of basename() when <libgen.h> is
> included, and the GNU version otherwise.

Both are actually incorrect. If you have a program with

> #include <stdio.h>
>
> int main(void)
> {
>       char *p, *path = "/usr/nowhere/nothing";
> 
>       p = basename(path);
> 
>       return 0;
> }

and try to compile it, you'll get

> bt.c: In function 'main':
> bt.c:7: warning: assignment makes pointer from integer without a cast

   (since basename hasn't been defined, its return type defaults to
'int').

Defining _GNU_SOURCE and including string.h, as the man page suggests,
makes no difference. In fact, /usr/include/string.h doesn't use
_GNU_SOURCE at all (though it does mention it in passing).

If you #define __USE_GNU instead, however, then basename() is defined
as the GNU version, and no compiler warnings result (the basename()
definition in string.h is contained in a "#ifdef __USE_GNU"
construct).

To be honest, I'm not sure whether this is a manpage error or a
glibc/header file error, but this seemed a good place to start.

Thanks,

 .....Ron

- -- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.27.7-khufu-0 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages manpages-dev depends on:
ii  manpages                      3.05-1     Manual pages about using a GNU/Lin

manpages-dev recommends no packages.

Versions of packages manpages-dev suggests:
ii  konqueror [man-browser] 4:3.5.9.dfsg.1-5 KDE's advanced file manager, web b
ii  man-db [man-browser]    2.5.2-3          on-line manual pager

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFJMhuAitqjxNhsdN4RAmkvAKCELIGNHt5gmU2CXNeAx2P9D57BLACfXlJU
NqPyJSZx4+Yq79gyr3aGEOs=
=LGNS
-----END PGP SIGNATURE-----



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

Reply via email to