Back to index

radiance  4R0+20100331
Functions | Variables
win_netproc.c File Reference
#include <direct.h>
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include "rtprocess.h"
#include "netproc.h"
#include "paths.h"

Go to the source code of this file.

Functions

PSERVERaddpserver (char *host, char *dir, char *usr, int np)
void delpserver (PSERVER *ps)
PSERVERfindjob (int *pnp)
int startjob (PSERVER *pPS, char *command, pscompfunc *compf)
int wait4job (PSERVER *pPS, int pID)

Variables

static const char RCSid [] = "$Id: win_netproc.c,v 2.4 2004/10/23 18:55:53 schorsch Exp $"
static int maxfd
static char ourdir [PATH_MAX]
static char ourhost [64]
static char * ourshell
static char ouruser [32]
PSERVERpslist = NULL

Function Documentation

PSERVER* addpserver ( char *  host,
char *  dir,
char *  usr,
int  np 
)

Definition at line 31 of file win_netproc.c.

{
       PSERVER* ps;
       if (np < 1)
              return(NULL);
       // For now
       if(strcmp(host, LHOSTNAME))
              return(NULL);
       if((ps = (PSERVER *)malloc(sizeof(PSERVER)+(np-1)*sizeof(NETPROC))) == NULL)
              return(NULL);
       if (!ourhost[0]) {
              char   dirtmp[PATH_MAX];
              register char *cp;
              register int  len;

              strcpy(ourhost, myhostname());
              getcwd(dirtmp, sizeof(dirtmp));
              if ((cp = getenv("HOME")) != NULL) {
                     if (!strcmp(cp, dirtmp))
                            ourdir[0] = '\0';
                     else if (!strncmp(cp, dirtmp, len=strlen(cp)) &&
                                   dirtmp[len] == '/')
                            strcpy(ourdir, dirtmp+len+1);
                     else
                            strcpy(ourdir, dirtmp);
              } else
                     strcpy(ourdir, dirtmp);
              if ((cp = getenv("USER")) != NULL)
                     strcpy(ouruser, cp);
              if ((ourshell = getenv("SHELL")) == NULL)
                     ourshell = "/bin/sh";
              //FD_ZERO(&errdesc);
              maxfd = -1;
       }

       if (host == NULL || !strcmp(host, ourhost) ||
                     !strcmp(host, LHOSTNAME))
              ps->hostname[0] = '\0';
       else
              strcpy(ps->hostname, host);
       if (dir == NULL)
              strcpy(ps->directory, ourdir);
       else
              strcpy(ps->directory, dir);
       if (usr == NULL || !strcmp(usr, ouruser))
              ps->username[0] = '\0';
       else
              strcpy(ps->username, usr);
       ps->nprocs = np;
       while (np--) {
              ps->proc[np].com = NULL;
              ps->proc[np].pid = -1;
              ps->proc[np].efd = -1;
              ps->proc[np].errs = NULL;
              ps->proc[np].elen = 0;
              ps->proc[np].cf = NULL;
       }
       
       ps->next = pslist;
       pslist = ps;
       
       if (!pserverOK(ps)) {
              delpserver(ps);
              return(NULL);
       }
       return(ps);
}

Here is the call graph for this function:

void delpserver ( PSERVER ps)

Definition at line 104 of file win_netproc.c.

{
       return;
}

Here is the call graph for this function:

PSERVER* findjob ( int *  pnp)

Definition at line 109 of file win_netproc.c.

{
       static PSERVER ps;
       return &ps;
}
int startjob ( PSERVER pPS,
char *  command,
pscompfunc compf 
)

Definition at line 116 of file win_netproc.c.

{
       return 0;
}
int wait4job ( PSERVER pPS,
int  pID 
)

Definition at line 125 of file win_netproc.c.

                                    {
       if(pID == -1)
              return -1;
       return 0;
}

Here is the call graph for this function:


Variable Documentation

int maxfd [static]

Definition at line 23 of file win_netproc.c.

char ourdir[PATH_MAX] [static]

Definition at line 24 of file win_netproc.c.

char ourhost[64] [static]

Definition at line 25 of file win_netproc.c.

char* ourshell [static]

Definition at line 26 of file win_netproc.c.

char ouruser[32] [static]

Definition at line 27 of file win_netproc.c.

PSERVER* pslist = NULL

Definition at line 28 of file win_netproc.c.

const char RCSid[] = "$Id: win_netproc.c,v 2.4 2004/10/23 18:55:53 schorsch Exp $" [static]

Definition at line 2 of file win_netproc.c.