1REXEC(3)                   Library Functions Manual                   REXEC(3)
2
3
4

NAME

6       rexec - return stream to a remote command
7

SYNOPSIS

9       rem = rexec(ahost, inport, user, passwd, cmd, fd2p);
10       char **ahost;
11       int inport;
12       char *user, *passwd, *cmd;
13       int *fd2p;
14

DESCRIPTION

16       Rexec looks up the host *ahost using gethostbyname(3N), returning -1 if
17       the host does not exist.  Otherwise *ahost is set to the standard  name
18       of the host.  If a username and password are both specified, then these
19       are used to authenticate to the foreign host; otherwise the environment
20       and  then the user's .netrc file in his home directory are searched for
21       appropriate information.  If all this fails, the user is  prompted  for
22       the information.
23
24       The  port  inport specifies which well-known DARPA Internet port to use
25       for the connection; the call ``getservbyname("exec", "tcp")'' (see get‐
26       servent(3N))  will  return a pointer to a structure, which contains the
27       necessary port.  The protocol for connection is described in detail  in
28       rexecd(8C).
29
30       If  the  connection  succeeds,  a socket in the Internet domain of type
31       SOCK_STREAM is returned to the caller, and given to the remote  command
32       as stdin and stdout.  If fd2p is non-zero, then an auxiliary channel to
33       a control process will be setup, and a descriptor for it will be placed
34       in  *fd2p.   The control process will return diagnostic output from the
35       command (unit 2) on this channel, and will also accept  bytes  on  this
36       channel  as  being  UNIX signal numbers, to be forwarded to the process
37       group of the command.  The diagnostic  information  returned  does  not
38       include  remote  authorization  failure, as the secondary connection is
39       set up after authorization has been verified.  If fd2p is 0,  then  the
40       stderr (unit 2 of the remote command) will be made the same as the std‐
41       out and no provision is made  for  sending  arbitrary  signals  to  the
42       remote  process, although you may be able to get its attention by using
43       out-of-band data.
44

SEE ALSO

46       rcmd(3), rexecd(8C)
47
48
49
504.2 Berkeley Distribution        May 14, 1986                         REXEC(3)
Impressum