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.6 by gregl, Thu Sep 18 16:10:19 1997 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines