jsj@acl.lanl.gov (John Stephen Junkins) (01/18/91)
Hey there! I have been trying to write an incredibly simple code using
rexec to fire off another process. However the little code below core
dumps. Dbx says that it is bombing in a call to getservbyname() which I
assume means that I have a problem with the way I have defined hostname[][].
Can anyone please tell me what I am doing wrong or send me a piece of
code which uses rexec() and works()?
Please send solutions directly to me as this newsgroup is too big! Thanks
in advance!!
Stephen.
main()
{
char hostname [2][50];
struct servent *s;
int fd2p = 0;
gethostname (hostname[0], 50);
sprintf (hostname[1], "%s", "");
s = getservbyname ("exec", "tcp");
rexec (hostname, s->s_port, "jsj", "xxxxxxxx", "xlock", &fd2p);
printf ("Mission accomplished!");
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!! whoami: J. Stephen. Junkins !!
!! whereami: jsj@emu.lanl.gov !!
!! whereireallyam: POB 1032 Los Alamos NM 87544 ph: 505-665-2479 !!
!! home: 505-662-1478 !!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~