install C version of _doprnt
[unix-history] / usr / src / lib / libc / net / rcmd.3
index 942053f..ba150de 100644 (file)
@@ -2,20 +2,18 @@
 .\" All rights reserved.  The Berkeley software License Agreement
 .\" specifies the terms and conditions for redistribution.
 .\"
 .\" All rights reserved.  The Berkeley software License Agreement
 .\" specifies the terms and conditions for redistribution.
 .\"
-.\"    @(#)rcmd.3      6.4 (Berkeley) %G%
+.\"    @(#)rcmd.3      6.8 (Berkeley) %G%
 .\"
 .\"
-.TH RCMD 3X ""
+.TH RCMD 3 ""
 .UC 5
 .SH NAME
 rcmd, rresvport, ruserok \- routines for returning a stream to a remote command
 .SH SYNOPSIS
 .nf
 .PP
 .UC 5
 .SH NAME
 rcmd, rresvport, ruserok \- routines for returning a stream to a remote command
 .SH SYNOPSIS
 .nf
 .PP
-.B "#include <sys/types.h>"
-.PP
 .B "rem = rcmd(ahost, inport, locuser, remuser, cmd, fd2p);"
 .B char **ahost;
 .B "rem = rcmd(ahost, inport, locuser, remuser, cmd, fd2p);"
 .B char **ahost;
-.B u_short inport;
+.B int inport;
 .B "char *locuser, *remuser, *cmd;"
 .B int *fd2p;
 .PP
 .B "char *locuser, *remuser, *cmd;"
 .B int *fd2p;
 .PP
@@ -57,7 +55,8 @@ and a connection is established to a server
 residing at the well-known Internet port
 .IR inport .
 .PP
 residing at the well-known Internet port
 .IR inport .
 .PP
-If the call succeeds, a socket of type SOCK_STREAM
+If the connection succeeds,
+a socket in the Internet domain of type SOCK_STREAM
 is returned to the caller, and given to the remote
 command as 
 .B stdin
 is returned to the caller, and given to the remote
 command as 
 .B stdin
@@ -93,21 +92,20 @@ routine is used to obtain a socket with a privileged
 address bound to it.  This socket is suitable for use
 by 
 .I rcmd
 address bound to it.  This socket is suitable for use
 by 
 .I rcmd
-and several other routines.  Privileged addresses consist
-of a port in the range 0 to 1023.  Only the super-user
+and several other routines.  Privileged Internet ports are those
+in the range 0 to 1023.  Only the super-user
 is allowed to bind an address of this sort to a socket.
 .PP
 .I Ruserok
 takes a remote host's name, as returned by a
 is allowed to bind an address of this sort to a socket.
 .PP
 .I Ruserok
 takes a remote host's name, as returned by a
-.IR gethostent (3N)
-routine, two user names and a flag indicating if
-the local user's name is the super-user.  It then
+.IR gethostbyaddr (3N)
+routine, two user names and a flag indicating whether
+the local user's name is that of the super-user.  It then
 checks the file
 .I /etc/hosts.equiv
 and, possibly, 
 .I .rhosts
 checks the file
 .I /etc/hosts.equiv
 and, possibly, 
 .I .rhosts
-in the current working directory (normally the local
-user's home directory) to see if the request for
+in the local user's home directory to see if the request for
 service is allowed.  A 0 is returned if the machine
 name is listed in the ``hosts.equiv'' file, or the
 host and remote user name are found in the ``.rhosts''
 service is allowed.  A 0 is returned if the machine
 name is listed in the ``hosts.equiv'' file, or the
 host and remote user name are found in the ``.rhosts''
@@ -115,19 +113,26 @@ file; otherwise
 .I ruserok
 returns \-1.  If the
 .I superuser
 .I ruserok
 returns \-1.  If the
 .I superuser
-flag is 1, the checking of the ``host.equiv'' file is
+flag is 1, the checking of the ``hosts.equiv'' file is
 bypassed.
 bypassed.
+If the local domain (as obtained from \fIgethostname\fP\|(2))
+is the same as the remote domain, only the machine name need be specified.
 .SH SEE ALSO
 rlogin(1C),
 rsh(1C),
 .SH SEE ALSO
 rlogin(1C),
 rsh(1C),
-rexec(3X),
+intro(2),
+rexec(3),
 rexecd(8C),
 rlogind(8C),
 rshd(8C)
 rexecd(8C),
 rlogind(8C),
 rshd(8C)
-.SH BUGS
-There is no way to specify options to the
-.I socket
-call
-which
-.I rcmd
-makes.
+.SH DIAGNOSTICS
+.I Rcmd
+returns a valid socket descriptor on success.
+It returns -1 on error and prints a diagnostic message on the standard error.
+.PP
+.I Rresvport
+returns a valid, bound socket descriptor on success.
+It returns -1 on error with the global value
+.I errno
+set according to the reason for failure.
+The error code EAGAIN is overloaded to mean ``All network ports in use.''