--- ray/src/util/netproc.c 1996/02/07 16:42:45 2.2 +++ ray/src/util/netproc.c 1997/10/16 13:48:49 2.7 @@ -10,20 +10,14 @@ static char SCCSid[] = "$SunId$ LBL"; #include #include +#ifdef INCL_SEL_H +#include +#endif #include #include #include "netproc.h" +#include "paths.h" #include "vfork.h" - /* Remote shell location */ -#ifdef sgi -#define RSH "/usr/bsd/rsh" -#endif -#ifdef _AUX_SOURCE -#define RSH "/usr/bin/remsh" -#endif -#ifndef RSH -#define RSH "/usr/ucb/rsh" -#endif /* select call compatibility stuff */ #ifndef FD_SETSIZE #include @@ -47,13 +41,15 @@ PSERVER *pslist = NULL; /* global process server list static PROC *pindex[FD_SETSIZE]; /* process index table */ static char ourhost[64]; /* this host name */ -static char ourdir[128]; /* our working directory */ +static char ourdir[MAXPATH]; /* our working directory */ static char ouruser[32]; /* our user name */ static char *ourshell; /* our user's shell */ static fd_set errdesc; /* error file descriptors */ static int maxfd; /* maximum assigned descriptor */ +extern char *remsh; /* externally defined remote shell program */ + extern char *malloc(), *realloc(); extern char *getenv(); @@ -71,12 +67,12 @@ int np; if (ps == NULL) return(NULL); if (!ourhost[0]) { /* initialize */ - char dirtmp[128]; + char dirtmp[MAXPATH]; register char *cp; register int len; strcpy(ourhost, myhostname()); - getcwd(dirtmp, sizeof(dirtmp)); + getwd(dirtmp); if ((cp = getenv("HOME")) != NULL) { if (!strcmp(cp, dirtmp)) ourdir[0] = '\0'; @@ -177,7 +173,8 @@ register PSERVER *ps; char *command; int (*compf)(); { - char *av[12]; + char udirt[MAXPATH]; + char *av[16]; int pfd[2], pid; register int i; @@ -205,14 +202,19 @@ int (*compf)(); close(pfd[1]); } if (ps->hostname[0]) { /* rsh command */ - av[i=0] = RSH; + av[i=0] = remsh; av[++i] = ps->hostname; - av[++i] = "-n"; /* no stdin */ - if (ps->username[0]) { + av[++i] = "-n"; /* no stdin */ + if (ps->username[0]) { /* different user */ av[++i] = "-l"; av[++i] = ps->username; + av[++i] = "cd"; + udirt[0] = '~'; + strcpy(udirt+1, ouruser); + av[++i] = udirt; + av[++i] = ";"; } - if (ps->directory[0]) { + if (ps->directory[0]) { /* change directory */ av[++i] = "cd"; av[++i] = ps->directory; av[++i] = ";";