ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/netproc.c
(Generate patch)

Comparing ray/src/util/netproc.c (file contents):
Revision 2.2 by greg, Wed Feb 7 16:42:45 1996 UTC vs.
Revision 2.4 by greg, Mon Mar 4 09:22:50 1996 UTC

# Line 10 | Line 10 | static char SCCSid[] = "$SunId$ LBL";
10  
11   #include <stdio.h>
12   #include <sys/types.h>
13 + #include <sys/param.h>
14   #include <signal.h>
15   #include <fcntl.h>
16   #include "netproc.h"
17   #include "vfork.h"
17                                        /* Remote shell location */
18 #ifdef sgi
19 #define RSH             "/usr/bsd/rsh"
20 #endif
21 #ifdef _AUX_SOURCE
22 #define RSH             "/usr/bin/remsh"
23 #endif
24 #ifndef RSH
25 #define RSH             "/usr/ucb/rsh"
26 #endif
18                                          /* select call compatibility stuff */
19   #ifndef FD_SETSIZE
20   #include <sys/param.h>
# Line 47 | Line 38 | PSERVER        *pslist = NULL;         /* global process server list
38   static PROC     *pindex[FD_SETSIZE];    /* process index table */
39  
40   static char     ourhost[64];    /* this host name */
41 < static char     ourdir[128];    /* our working directory */
41 > static char     ourdir[MAXPATHLEN];     /* our working directory */
42   static char     ouruser[32];    /* our user name */
43   static char     *ourshell;      /* our user's shell */
44  
45   static fd_set   errdesc;        /* error file descriptors */
46   static int      maxfd;          /* maximum assigned descriptor */
47  
48 + extern char     *remsh;         /* externally defined remote shell program */
49 +
50   extern char     *malloc(), *realloc();
51   extern char     *getenv();
52  
# Line 71 | Line 64 | int    np;
64          if (ps == NULL)
65                  return(NULL);
66          if (!ourhost[0]) {              /* initialize */
67 <                char    dirtmp[128];
67 >                char    dirtmp[MAXPATHLEN];
68                  register char   *cp;
69                  register int    len;
70  
71                  strcpy(ourhost, myhostname());
72 <                getcwd(dirtmp, sizeof(dirtmp));
72 >                getwd(dirtmp);
73                  if ((cp = getenv("HOME")) != NULL) {
74                          if (!strcmp(cp, dirtmp))
75                                  ourdir[0] = '\0';
# Line 177 | Line 170 | register PSERVER       *ps;
170   char    *command;
171   int     (*compf)();
172   {
173 <        char    *av[12];
173 >        char    udirt[MAXPATHLEN];
174 >        char    *av[16];
175          int     pfd[2], pid;
176          register int    i;
177  
# Line 205 | Line 199 | int    (*compf)();
199                          close(pfd[1]);
200                  }
201                  if (ps->hostname[0]) {          /* rsh command */
202 <                        av[i=0] = RSH;
202 >                        av[i=0] = remsh;
203                          av[++i] = ps->hostname;
204 <                        av[++i] = "-n";         /* no stdin */
205 <                        if (ps->username[0]) {
204 >                        av[++i] = "-n";                 /* no stdin */
205 >                        if (ps->username[0]) {          /* different user */
206                                  av[++i] = "-l";
207                                  av[++i] = ps->username;
208 +                                av[++i] = "cd";
209 +                                udirt[0] = '~';
210 +                                strcpy(udirt+1, ouruser);
211 +                                av[++i] = udirt;
212 +                                av[++i] = ";";
213                          }
214 <                        if (ps->directory[0]) {
214 >                        if (ps->directory[0]) {         /* change directory */
215                                  av[++i] = "cd";
216                                  av[++i] = ps->directory;
217                                  av[++i] = ";";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines