docs/95059: Incorrect example in wordexp(3) manpage

Jos Backus jos at catnook.com
Wed Mar 29 00:10:15 UTC 2006


>Number:         95059
>Category:       docs
>Synopsis:       Incorrect example in wordexp(3) manpage
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 29 00:10:13 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Jos Backus
>Release:        -current
>Organization:
>Environment:
FreeBSD lizzy.catnook.local 7.0-CURRENT FreeBSD 7.0-CURRENT #20: Sun Mar 19 17:20:05 PST 2006     root at lizzy.catnook.local:/usr/obj/usr/src/sys/LIZZY  i386
>Description:
The wordexp(3) manpage has an incorrect example: it uses pointer dereferencing whereas it should simply be accessing structure members:

lizzy:/tmp% cat we.c
#include <wordexp.h>

int
main(int argc, char **argv)
{
    wordexp_t we;

    wordexp("${EDITOR:-vi} *.c /etc/motd", &we, 0);
    execvp(we->we_wordv[0], we->we_wordv);
    exit(0);
}
lizzy:/tmp% lizzy:/tmp% make we  
cc -O2 -fno-strict-aliasing -pipe    we.c  -o we
we.c: In function `main':
we.c:9: error: invalid type argument of `->'
we.c:9: error: invalid type argument of `->'
*** Error code 1

Stop in /tmp.
lizzy:/tmp% 


>How-To-Repeat:

>Fix:
Patch the manpage:

--- wordexp.3.orig      Tue Mar 28 15:36:44 2006
+++ wordexp.3   Tue Mar 28 15:37:15 2006
@@ -167,7 +167,7 @@
 wordexp_t we;
 
 wordexp("${EDITOR:-vi} *.c /etc/motd", &we, 0);
-execvp(we->we_wordv[0], we->we_wordv);
+execvp(we.we_wordv[0], we.we_wordv);
 .Ed
 .Sh DIAGNOSTICS
 Diagnostic messages from the shell are written to the standard error output
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-doc mailing list