Bug 53621

Summary: devname(3)'s man page needs an example
Product: Documentation Reporter: fn <fn>
Component: Books & ArticlesAssignee: Tom Rhodes <trhodes>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
devname.3-patch none

Description fn 2003-06-23 01:00:25 UTC
	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.

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
How-To-Repeat: 	man 3 devname
Comment 1 Tom Rhodes freebsd_committer freebsd_triage 2003-08-09 20:39:37 UTC
Responsible Changed
From-To: freebsd-doc->trhodes

I like things like this, assign this PR to me.
Comment 2 Marc Silver 2004-03-04 13:25:00 UTC
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
Comment 3 Tom Rhodes freebsd_committer freebsd_triage 2005-02-23 02:31:49 UTC
State Changed
From-To: open->patched

Patched in CURRENT, MFC pending.
Comment 4 Tom Rhodes freebsd_committer freebsd_triage 2005-02-24 05:11:26 UTC
State Changed
From-To: patched->closed

MFC complete, close this PR.  Thanks!