From fn@hungry.org  Sun Jun 22 16:53:40 2003
Return-Path: <fn@hungry.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id AF24037B401
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 22 Jun 2003 16:53:40 -0700 (PDT)
Received: from loops.nilpotent.org (loops.nilpotent.org [12.17.163.70])
	by mx1.FreeBSD.org (Postfix) with SMTP id CF42643FDF
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 22 Jun 2003 16:53:39 -0700 (PDT)
	(envelope-from fn@hungry.org)
Received: (qmail 2148 invoked from network); 22 Jun 2003 23:53:38 -0000
Received: from unknown (203.215.182.84)
  by loops.nilpotent.org with QMTP; 22 Jun 2003 23:53:38 -0000
Received: (qmail 1033 invoked by uid 500); 22 Jun 2003 23:48:57 -0000
Message-Id: <20030622234857.1032.qmail@xpf.nilpotent.org>
Date: 22 Jun 2003 23:48:57 -0000
From: Faried Nawaz <fn@hungry.com>
Reply-To: Faried Nawaz <fn@hungry.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: devname(3)'s man page needs an example
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         53621
>Category:       docs
>Synopsis:       devname(3)'s man page needs an example
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    trhodes
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 22 17:00:25 PDT 2003
>Closed-Date:    Thu Feb 24 05:11:58 GMT 2005
>Last-Modified:  Thu Feb 24 05:11:58 GMT 2005
>Originator:     Faried Nawaz
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
Hungry Programmers, Inc
>Environment:
System: FreeBSD semuta.nilpotent.org 5.1-CURRENT FreeBSD 5.1-CURRENT #0: Mon Jun 23 00:16:32 PKST 2003 root@semuta.nilpotent.org:/usr/obj/usr/src/sys/semuta i386
>Description:
	devname(3)'s man page is hard to figure out.  Sure, it includes an
	xref to stat(2), but I think a little bit more info can help.
>How-To-Repeat:
	man 3 devname
>Fix:
	I suggest adding an example.  Something like

EXAMPLE

     int fd;
     struct stat buf;
     char *name;

     fd = open("/dev/tun", O_RDWR);
     fstat(fd, &buf)
     printf("devname is /dev/%s\n", devname(buf.st_rdev, S_IFCHR))

     prints out

     devname is /dev/tun5

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-doc->trhodes 
Responsible-Changed-By: trhodes 
Responsible-Changed-When: Sat Aug 9 12:39:37 PDT 2003 
Responsible-Changed-Why:  
I like things like this, assign this PR to me. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=53621 

From: Marc Silver <marcs@draenor.org>
To: freebsd-gnats-submit@FreeBSD.org, fn@hungry.com
Cc:  
Subject: Re: docs/53621: devname(3)'s man page needs an example
Date: Thu, 4 Mar 2004 13:25:00 +0000

 --x+6KMIRAuhnl3hBn
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Hey there,
 
 I tested this code against FreeBSD 5.2.1 and it seemed to execute fine,
 though I could not get it to work with the O_RDWR flag added to fd().
 That more likely has something to do with my being a cruddy c programmer
 though, so if someone more in the know could look at that portion it
 might be good.  :)
 
 I've attached the manpage diff to add this example to the devname(3) man
 page.
 
 Cheers,
 Marc
 
 --x+6KMIRAuhnl3hBn
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="devname.3-patch"
 
 --- devname.3-orig	Thu Mar  4 14:59:30 2004
 +++ devname.3	Thu Mar  4 15:18:05 2004
 @@ -78,6 +78,16 @@
  on subsequent calls.
  .Fn devname_r
  takes a buffer and length as argument to avoid this problem.
 +.Sh EXAMPLES
 +.Bd -literal -compact
 +int fd;
 +struct stat buf;
 +char *name;
 +
 +	fd = open("/dev/tun");
 +	fstat(fd, &buf);
 +	printf("devname is /dev/%s\en", devname(buf.st_rdev, S_IFCHR));
 +.Ed
  .Sh SEE ALSO
  .Xr stat 2
  .Sh HISTORY
 
 --x+6KMIRAuhnl3hBn--
State-Changed-From-To: open->patched 
State-Changed-By: trhodes 
State-Changed-When: Wed Feb 23 02:31:49 GMT 2005 
State-Changed-Why:  
Patched in CURRENT, MFC pending. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=53621 
State-Changed-From-To: patched->closed 
State-Changed-By: trhodes 
State-Changed-When: Thu Feb 24 05:11:26 GMT 2005 
State-Changed-Why:  
MFC complete, close this PR.  Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=53621 
>Unformatted:
