> The man page claims:
>
> NOTE
> Library routines suitable for use as the compar argument include
> strcmp(), alphasort(), and versionsort().
>
> But strcmp is not suitable (see
> http://www.lysator.liu.se/c/c-faq/c-12.html#12-2).
Hello Falk,
The statement on that page is only true if one includes its
proviso:
By "array of strings" you probably mean
"array of pointers to char."
If one is talking about an array of (fixed-length) strings,
rather than an array of pointers to strings, then strcmp()
is okay. But I agree that that is likely the less common
case, and therefore the reader of the manual page could
be misled.
I have fixed this in the upstream 2.21 release by including
a small example that demonstrates how strcmp() should
be used (like in the page you refer to).
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]