Subject: lib/3368: another typo in fts(3); fts_open takes a pointer to function
To: None <gnats-bugs@gnats.netbsd.org>
From: None <enami@ba2.so-net.or.jp>
List: netbsd-bugs
Date: 03/20/1997 16:12:49
>Number: 3368
>Category: lib
>Synopsis: another typo in fts(3); fts_open takes a pointer to function which returns int.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: lib-bug-people (Library Bug People)
>State: open
>Class: doc-bug
>Submitter-Id: net
>Arrival-Date: Thu Mar 20 14:50:00 1997
>Last-Modified:
>Originator: enami tsugutomo
>Organization:
an individual
>Release: NetBSD-current 1997 Mar. 18
>Environment:
System: NetBSD pavlov.enami.ba2.so-net.or.jp 1.2D NetBSD 1.2D (PAVLOV) #200: Thu Mar 20 11:01:57 JST 1997 enami@pavlov.enami.ba2.so-net.or.jp:/b/netbsd/kernel/compile/PAVLOV i386
>Description:
There is another typo in fts(3); fts_open takes a pointer to
function which returns not pointer to int but just int.
In fts(3), there is a description like this:
FTS *
fts_open(char * const *path_argv, int options,
int *compar(const FTSENT **, const FTSENT **))
Because function call operator () has high priority than dereference
operator *, it means that `compar' is a function which returns
pointer to int (and the value fts_open is passed is a pointer to it).
But in /usr/include/fts.h, fts_open is prototyped like this:
FTS *fts_open __P((char * const *, int,
int (*)(const FTSENT **, const FTSENT **)));
It says that third argument is a pointer to function which returns int.
>How-To-Repeat:
Type man fts and read it. Then, read /usr/include/fts.h or
/usr/src/lib/libc/gen/fts.c.
>Fix:
Give parentheses around `*compar'.
Index: fts.3
===================================================================
RCS file: /a/cvsroot/NetBSD/src/lib/libc/gen/fts.3,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 fts.3
--- fts.3 1996/11/16 10:04:49 1.1.1.1
+++ fts.3 1997/03/20 06:58:47
@@ -44,7 +44,7 @@
.Fd #include <sys/stat.h>
.Fd #include <fts.h>
.Ft FTS *
-.Fn fts_open "char * const *path_argv" "int options" "int *compar(const FTSENT **, const FTSENT **)"
+.Fn fts_open "char * const *path_argv" "int options" "int (*compar)(const FTSENT **, const FTSENT **)"
.Ft FTSENT *
.Fn fts_read "FTS *ftsp"
.Ft FTSENT *
>Audit-Trail:
>Unformatted: