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.1 by greg, Thu Jan 18 11:24:53 1996 UTC vs.
Revision 2.8 by gregl, Tue Oct 28 14:01:39 1997 UTC

# Line 9 | Line 9 | static char SCCSid[] = "$SunId$ LBL";
9   */
10  
11   #include <stdio.h>
12 #include <sys/types.h>
12   #include <signal.h>
13   #include <fcntl.h>
14 + #include "selcall.h"
15   #include "netproc.h"
16 + #include "paths.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
27                                        /* select call compatibility stuff */
28 #ifndef FD_SETSIZE
29 #include <sys/param.h>
30 #define FD_SETSIZE      NOFILE          /* maximum # select file descriptors */
31 #endif
32 #ifndef FD_SET
33 #ifndef NFDBITS
34 #define NFDBITS         (8*sizeof(int)) /* number of bits per fd_mask */
35 #endif
36 #define FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
37 #define FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
38 #define FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
39 #ifndef BSD
40 #define bzero(d,n)      (void)memset(d,0,n)
41 #endif
42 #define FD_ZERO(p)      bzero((char *)(p), sizeof(*(p)))
43 #endif
18  
19   PSERVER *pslist = NULL;         /* global process server list */
20  
21   static PROC     *pindex[FD_SETSIZE];    /* process index table */
22  
23   static char     ourhost[64];    /* this host name */
24 < static char     ourdir[128];    /* our working directory */
24 > static char     ourdir[MAXPATH];        /* our working directory */
25   static char     ouruser[32];    /* our user name */
26   static char     *ourshell;      /* our user's shell */
27  
28   static fd_set   errdesc;        /* error file descriptors */
29   static int      maxfd;          /* maximum assigned descriptor */
30  
31 + extern char     *remsh;         /* externally defined remote shell program */
32 +
33   extern char     *malloc(), *realloc();
34   extern char     *getenv();
35  
# Line 71 | Line 47 | int    np;
47          if (ps == NULL)
48                  return(NULL);
49          if (!ourhost[0]) {              /* initialize */
50 <                char    dirtmp[128];
50 >                char    dirtmp[MAXPATH];
51                  register char   *cp;
52                  register int    len;
53  
54 <                gethostname(ourhost, sizeof(ourhost));
55 <                getcwd(dirtmp, sizeof(dirtmp));
54 >                strcpy(ourhost, myhostname());
55 >                getwd(dirtmp);
56                  if ((cp = getenv("HOME")) != NULL) {
57                          if (!strcmp(cp, dirtmp))
58                                  ourdir[0] = '\0';
# Line 177 | Line 153 | register PSERVER       *ps;
153   char    *command;
154   int     (*compf)();
155   {
156 <        char    *av[12];
156 >        char    udirt[MAXPATH];
157 >        char    *av[16];
158          int     pfd[2], pid;
159          register int    i;
160  
# Line 205 | Line 182 | int    (*compf)();
182                          close(pfd[1]);
183                  }
184                  if (ps->hostname[0]) {          /* rsh command */
185 <                        av[i=0] = RSH;
185 >                        av[i=0] = remsh;
186                          av[++i] = ps->hostname;
187 <                        av[++i] = "-n";         /* no stdin */
188 <                        if (ps->username[0]) {
187 >                        av[++i] = "-n";                 /* no stdin */
188 >                        if (ps->username[0]) {          /* different user */
189                                  av[++i] = "-l";
190                                  av[++i] = ps->username;
191 +                                av[++i] = "cd";
192 +                                udirt[0] = '~';
193 +                                strcpy(udirt+1, ouruser);
194 +                                av[++i] = udirt;
195 +                                av[++i] = ";";
196                          }
197 <                        if (ps->directory[0]) {
197 >                        if (ps->directory[0]) {         /* change directory */
198                                  av[++i] = "cd";
199                                  av[++i] = ps->directory;
200                                  av[++i] = ";";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines