SYNOPSIS
#include <unistd.h>
int rexec(char **ahost, int inport, char *user, char *passwd, char *cmd, int *fd2p);
DESCRIPTION
- Note:
-
This interface is made obsolete by
rcmd() . It is available only for backwards compatibility, and code that uses it should be updated to newer functions.
The
The specified port is used the Internet port to use for the connection. The call
getservbyname("exec", "tcp");
returns a pointer to a structure that contains the standard port number.
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 stdin and stdout. If fd2p is non-null, then an auxiliary channel to a control process is set up, and a descriptor for it is placed in that location to which it refers. The control process returns diagnostic output (stderr) from the command on this channel, and also accepts bytes on this channel as being UNIX signal numbers, to be forwarded to the process group of the command. The diagnostic information returned does not include remote authorization failure, as the secondary connection is set up after authorization has been verified. If fd2p is null, then the stderr of the remote command is made the same as the stdout and no provision is made for sending arbitrary signals to the remote process, although you may be able to get its attention by using out-of-band data.
PARAMETERS
- ahost
-
Points to the name of the host to which the connection is made. If the connection is successful, this name is updated with the standard name for the host.
- inport
-
Is the Internet port number on which the connection should be attempted.
- user
-
Is the user name to use for authentication. If this is a null pointer, the user's .netrc file is searched, and if an entry is not found, the user is prompted.
- passwd
-
Password to use for authentication. If this is a null pointer, the user's .netrc file is searched, and if an entry is not found, the user is prompted.
- cmd
-
Is the command to be executed on the remote host.
- fd2p
-
If non-null, a second connection is made to stderr of the remote command, and the file descriptor is returned through this pointer. If null, stderr of the remote command is connected to its stdout.
RETURN VALUES
On success,
CONFORMANCE
4.4BSD
MULTITHREAD SAFETY LEVEL
Unsafe.
PORTING ISSUES
None.
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Functions:
gethostbyname() ,getservbyname() ,rcmd() ,socket()
PTC MKS Toolkit 10.5 Documentation Build 40.