Bug 126451

Summary: Exit status of nc(1) is not documented
Product: Documentation Reporter: Ronald F. Guilmette <rfg>
Component: Books & ArticlesAssignee: Xin LI <delphij>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Ronald F. Guilmette 2008-08-11 11:40:01 UTC
	The man page for nc(1) fails to document the possible exit stati
	of the program.

Fix: 

Add an EXIT STATUS section to the man page for nc(1).

	The exit status seems to be 0 if all goes well, or else 1 if any
	of the following errors occurs: (a) hostname given on the command
	line does not resolve or (b) connection is refused by the remote
	host or (c) connection to remote host times out before connection
	is established or (d) -l option used with privledged portno (<1024)
	when nc is executed by an unprivledged user or (e) -l option used,
	but hostname does not correspond to any IP address associated with
	any local IP interface.

	There are probably man other conditions that could be associated
	with a non-zero exit status.  Ideally, they should all be listed
	in the man page.
How-To-Repeat: 	man 1 nc
Comment 1 Xin LI freebsd_committer freebsd_triage 2008-08-12 22:55:54 UTC
Responsible Changed
From-To: freebsd-doc->delphij

Take.
Comment 2 Xin LI freebsd_committer freebsd_triage 2009-05-29 08:18:39 UTC
State Changed
From-To: open->patched

I have added a "default" EXIT STATUS section for now.  It 
would be probably better if we teach nc(1) about sysexits(3) 
instead of enumerating everything in the manpage.
Comment 3 dfilter service freebsd_committer freebsd_triage 2009-05-29 08:18:40 UTC
Author: delphij
Date: Fri May 29 07:18:31 2009
New Revision: 193021
URL: http://svn.freebsd.org/changeset/base/193021

Log:
  Add an EXIT STATUS section to the manual page.  Currently, nc(1)
  does not follow sysexits(3), and returns 1 for all error cases.
  
  PR:		docs/126451

Modified:
  head/contrib/netcat/nc.1

Modified: head/contrib/netcat/nc.1
==============================================================================
--- head/contrib/netcat/nc.1	Fri May 29 06:57:45 2009	(r193020)
+++ head/contrib/netcat/nc.1	Fri May 29 07:18:31 2009	(r193021)
@@ -445,6 +445,8 @@ The same example again, this time enabli
 if the proxy requires it:
 .Pp
 .Dl $ nc -x10.2.3.4:8080 -Xconnect -Pruser host.example.com 42
+.Sh EXIT STATUS
+.Ex -std
 .Sh SEE ALSO
 .Xr cat 1 ,
 .Xr ssh 1 ,
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 4 dfilter service freebsd_committer freebsd_triage 2009-08-03 19:43:38 UTC
Author: delphij
Date: Mon Aug  3 18:43:26 2009
New Revision: 196051
URL: http://svn.freebsd.org/changeset/base/196051

Log:
  MFC r193021:
  
  Add an EXIT STATUS section to the manual page. Currently, nc(1)
  does not follow sysexits(3), and returns 1 for all error cases.
  
  PR:	docs/126451

Modified:
  stable/7/contrib/netcat/   (props changed)
  stable/7/contrib/netcat/nc.1

Modified: stable/7/contrib/netcat/nc.1
==============================================================================
--- stable/7/contrib/netcat/nc.1	Mon Aug  3 09:58:46 2009	(r196050)
+++ stable/7/contrib/netcat/nc.1	Mon Aug  3 18:43:26 2009	(r196051)
@@ -433,6 +433,8 @@ The same example again, this time enabli
 if the proxy requires it:
 .Pp
 .Dl $ nc -x10.2.3.4:8080 -Xconnect -Pruser host.example.com 42
+.Sh EXIT STATUS
+.Ex -std
 .Sh SEE ALSO
 .Xr cat 1 ,
 .Xr ssh 1
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 5 dfilter service freebsd_committer freebsd_triage 2009-08-03 19:45:02 UTC
Author: delphij
Date: Mon Aug  3 18:44:42 2009
New Revision: 196052
URL: http://svn.freebsd.org/changeset/base/196052

Log:
  MFC r193021:
  
  Add an EXIT STATUS section to the manual page. Currently, nc(1)
  does not follow sysexits(3), and returns 1 for all error cases.
  
  PR:	docs/126451

Modified:
  stable/6/contrib/netcat/   (props changed)
  stable/6/contrib/netcat/nc.1

Modified: stable/6/contrib/netcat/nc.1
==============================================================================
--- stable/6/contrib/netcat/nc.1	Mon Aug  3 18:43:26 2009	(r196051)
+++ stable/6/contrib/netcat/nc.1	Mon Aug  3 18:44:42 2009	(r196052)
@@ -433,6 +433,8 @@ The same example again, this time enabli
 if the proxy requires it:
 .Pp
 .Dl $ nc -x10.2.3.4:8080 -Xconnect -Pruser host.example.com 42
+.Sh EXIT STATUS
+.Ex -std
 .Sh SEE ALSO
 .Xr cat 1 ,
 .Xr ssh 1
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 6 Xin LI freebsd_committer freebsd_triage 2009-08-03 19:46:35 UTC
State Changed
From-To: patched->closed

I've merged the change back to RELENG_6 and RELENG_7. 

Thanks for your submission!