Date: Tue, 28 Mar 2006 23:39:29 GMT From: Jos Backus <jos@catnook.com> To: freebsd-gnats-submit@FreeBSD.org Subject: docs/95059: Incorrect example in wordexp(3) manpage Message-ID: <200603282339.k2SNdTxW024015@www.freebsd.org> Resent-Message-ID: <200603290010.k2T0ADuX027330@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603282339.k2SNdTxW024015>