#define NET14MASTER #ifdef __TURBOC__ #include "turboc.h" #endif #include #include #include #include #include #include #include #include #include #ifdef MSC #include #include #include #endif #ifdef MEMORY_DEBUG #include "memdebug.h" #endif #include "netevent.h" #include "hostform.h" #include "whatami.h" #include "externs.h" /* #define DEBUG */ /* * Global variables */ static unsigned char path_name[_MAX_DRIVE+_MAX_DIR], /* character storage for the path name */ temp_str[100],temp_data[100]; /* temporary character storage */ #ifdef CHECKNULL unsigned char nullbuf[1024]; /* buffer to hold the lowest 1024 bytes */ #endif unsigned char buf[256]; static char *config; int debug = 0; /* enable with -D option */ #define SERIAL 0x14 #define NUM_COMM_PORTS 4 /* the number of comm. ports supported, remember to change this variable in int14.asm also */ extern volatile unsigned char *data_begin[NUM_COMM_PORTS]; /* pointers to the beginning of the data buffer for the comm.ports */ extern unsigned char *data_max[NUM_COMM_PORTS]; /* pointers to the maximum value for the data_end pointers */ extern volatile unsigned char *data_end[NUM_COMM_PORTS]; /* pointers to the end of the data buffer for the comm. ports */ extern unsigned char *data_start[NUM_COMM_PORTS]; /* pointers to the start of the data buffer for the comm. ports */ #define PORT_DATA_SIZE 2048 /* this is sort of a guess, might need larger */ unsigned char port_data[NUM_COMM_PORTS][PORT_DATA_SIZE]; /* data buffer for data read in from the comm. port */ int comm_port_index[NPORTS]; /* lookup table from a network port number to a comm port number */ unsigned char myipnum[4]; /* the ip number for this machine */ uint speedup=2; #ifdef OLD_WAY int bypass_passwd=0; /* whether to bypass the password check, not used */ struct machinfo *mp; extern struct config def; /* Default settings obtained from host file */ extern unsigned char initialized_flags; /* flags indicating whether a port has been initialized */ extern unsigned char connected_flags; /* flags indicating whether a port is connected yet */ extern unsigned char opening_flags; /* flags indicating whether a port is negotiating an open connection */ extern unsigned char port_buffer[NUM_COMM_PORTS][64]; /* four buffers to store the machine name to connect to */ extern unsigned char buffer_offset[NUM_COMM_PORTS]; /* the offset into the buffer currently */ extern int pnum[NUM_COMM_PORTS]; /* the port number we are connected to */ unsigned char parsedat[32]; /* character buffer to store network writes */ int telstate[NUM_COMM_PORTS]={STNORM,STNORM,STNORM,STNORM}; /* the telnet state for each comm. port */ int substate[NUM_COMM_PORTS]={0,0,0,0}; /* the telnet state for each comm. port */ int echo[NUM_COMM_PORTS]={1,1,1,1}; int igoahead[NUM_COMM_PORTS]={0,0,0,0}; int ugoahead[NUM_COMM_PORTS]={0,0,0,0}; int timing[NUM_COMM_PORTS]={0,0,0,0}; char c; #ifdef QAK int buffer_stat=0,max_buffer_stat=0; #endif #endif /* * main ( argc, argv ) * * Entry : * * parameter 1 : machine name * */ /* #define TSR #define PORT 1 */ int main(argc,argv) int argc; char *argv[]; { #ifdef TSR union REGS inregs; /* register set going into the interrupt */ union REGS outregs; /* register set going out of the interrupt */ unsigned int str_length; #endif int i, #ifdef TSR cnt,ev,what,dat, #endif exec_num; /* the argument number which is the name of the file to execute */ char file_name[_MAX_PATH], *str, spawn_str[_MAX_PATH]; /* file name oft he executable to spawn */ #ifdef QAK printf("stackavail=%u\n",stackavail()); #endif #ifdef __TURBOC__ fnsplit(argv[0],path_name,buf,temp_str,temp_data); #else _splitpath(argv[0],path_name,buf,temp_str,temp_data); /* split the full path name of net14.exe into it's components */ #endif strcat(path_name,buf); /* append the real path name to the drive specifier */ config = (getenv("CONFIG.TEL")); /* check for a config.tel in the environment */ if(config) /* set a different config.tel file */ Shostfile(config); #ifdef QAK puts("National Center for Supercomputing Applications"); /* put the banner on the screen */ puts("Interrupt 14h driver"); puts("January 1991\n"); #endif #ifndef TSR if(argc<2) { puts("Usage: net14 [-h hostfile] childname [child_param]\n"); exit(1); } /* end if */ #endif /* * work on parms */ for(i=1; i] filename [param]\n"); exit(1); } } else { /* must be the name of the file to execute */ exec_num=i; /* save the argument number of the name to execute */ break; /* break out of the loop (any further arguments must pertain to the program to execute) */ } /* end else */ } if(!int14init()) /* install the network stuff */ exit(1); for(i=0; i