HP-UX Reference (11i v2 04/09) - 3 Library Functions N-Z (vol 7)

r
rcmd(3N) rcmd(3N)
struct passwd *getpwuid();
char *host[] = { "hpxzgy" };
char *cmd = "date";
char *ruser = "chm";
main(argc,argv)
int argc;
char **argv;
{
struct servent *sp;
struct passwd *pwd;
FILE *fp;
char ch;
int rem;
sp = getservbyname("shell","tcp");
pwd = getpwuid(getuid());
rem = rcmd(host, sp->s_port, pwd->pw_name, ruser, cmd, 0);
if (rem < 0)
exit(1); /* rcmd outputs its own error messages */
fp = fdopen(rem, "r");
while ((ch = getc(fp)) != EOF)
putchar(ch);
}
WARNINGS
There is no way to specify options to the socket() call that rcmd() makes. Since rcmd()
replaces
the pointer to the host name (
*ahost) with a pointer to the standard name of the host in a static data
area, this value must be copied into the user’s data area if it is to be used later. Otherwise, unpredictable
results will occur.
IPv6 is supported on HP-UX 11i Version 1.0, with the optional IPv6 software installed. Currently, IPv6 is
not supported on systems running HP-UX 11i Version 1.6.
AUTHOR
rcmd() was developed by the University of California, Berkeley.
SEE ALSO
login(1), rlogin(1), remsh(1), named(1M), remshd(1M), rexecd(1M), gethostent(3N), rexec(3N),
hosts.equiv(4), thread_safety(5).
HP-UX 11i Version 2: September 2004 4 Hewlett-Packard Company Section 3861