1 |
– |
/* Copyright (c) 1996 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Parallel network process handling routines |
6 |
|
*/ |
8 |
|
#include <stdio.h> |
9 |
|
#include <signal.h> |
10 |
|
#include <fcntl.h> |
11 |
+ |
#include <unistd.h> |
12 |
+ |
|
13 |
|
#include "selcall.h" |
14 |
|
#include "netproc.h" |
15 |
|
#include "paths.h" |
20 |
|
static PROC *pindex[FD_SETSIZE]; /* process index table */ |
21 |
|
|
22 |
|
static char ourhost[64]; /* this host name */ |
23 |
< |
static char ourdir[MAXPATH]; /* our working directory */ |
23 |
> |
static char ourdir[PATH_MAX]; /* our working directory */ |
24 |
|
static char ouruser[32]; /* our user name */ |
25 |
|
static char *ourshell; /* our user's shell */ |
26 |
|
|
29 |
|
|
30 |
|
extern char *remsh; /* externally defined remote shell program */ |
31 |
|
|
33 |
– |
extern char *malloc(), *realloc(); |
32 |
|
extern char *getenv(); |
33 |
|
|
34 |
|
|
45 |
|
if (ps == NULL) |
46 |
|
return(NULL); |
47 |
|
if (!ourhost[0]) { /* initialize */ |
48 |
< |
char dirtmp[MAXPATH]; |
48 |
> |
char dirtmp[PATH_MAX]; |
49 |
|
register char *cp; |
50 |
|
register int len; |
51 |
|
|
52 |
|
strcpy(ourhost, myhostname()); |
53 |
< |
getwd(dirtmp); |
53 |
> |
getcwd(dirtmp, sizeof(dirtmp)); |
54 |
|
if ((cp = getenv("HOME")) != NULL) { |
55 |
|
if (!strcmp(cp, dirtmp)) |
56 |
|
ourdir[0] = '\0'; |
124 |
|
/* remove server from list */ |
125 |
|
psp->next = ps->next; |
126 |
|
pslist = pstart.next; |
127 |
< |
free((char *)ps); /* free associated memory */ |
127 |
> |
free((void *)ps); /* free associated memory */ |
128 |
|
} |
129 |
|
|
130 |
|
|
151 |
|
char *command; |
152 |
|
int (*compf)(); |
153 |
|
{ |
154 |
< |
char udirt[MAXPATH]; |
154 |
> |
char udirt[PATH_MAX]; |
155 |
|
char *av[16]; |
156 |
|
int pfd[2], pid; |
157 |
|
register int i; |
247 |
|
if (pp->elen == 0) |
248 |
|
pp->errs = (char *)malloc(nr+1); |
249 |
|
else |
250 |
< |
pp->errs = (char *)realloc(pp->errs, pp->elen+nr+1); |
250 |
> |
pp->errs = (char *)realloc((void *)pp->errs, pp->elen+nr+1); |
251 |
|
if (pp->errs == NULL) { |
252 |
|
perror("malloc failed"); |
253 |
|
exit(1); |
294 |
|
close(pp->efd); /* close error stream */ |
295 |
|
pindex[pp->efd] = NULL; |
296 |
|
FD_CLR(pp->efd, &errdesc); |
297 |
< |
free((char *)pp->errs); |
297 |
> |
free((void *)pp->errs); |
298 |
|
pp->com = NULL; /* clear settings */ |
299 |
|
pp->pid = -1; |
300 |
|
pp->efd = -1; |