home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / t / tel2305s.zip / NET14 / INIT14.C next >
C/C++ Source or Header  |  1980-01-13  |  3KB  |  91 lines

  1. #ifdef __TURBOC__
  2. #include "turboc.h"
  3. #endif
  4. #include <stdio.h>
  5. #include <conio.h>
  6. #include <string.h>
  7. #include <stdlib.h>
  8. #include <malloc.h>
  9. #include <dos.h>
  10. #include <ctype.h>
  11. #include <errno.h>
  12. #ifdef MSC
  13. #include <direct.h>
  14. #include <signal.h>
  15. #include <time.h>
  16. #endif
  17.  
  18.  
  19. #ifdef MEMORY_DEBUG
  20. #include "memdebug.h"
  21. #endif
  22. #include "netevent.h"
  23. #include "hostform.h"
  24. #include "whatami.h"
  25. #include "externs.h"
  26.  
  27. /* #define DEBUG */
  28.  
  29. /*
  30. *    Global variables
  31. */
  32. extern unsigned char buf[256];
  33. extern unsigned char myipnum[4];           /* the ip number for this machine */
  34.  
  35. #define SERIAL  0x14
  36. #define NUM_COMM_PORTS  4   /* the number of comm. ports supported, remember to change this variable in int14.asm also */
  37.  
  38. extern struct config def;   /* Default settings obtained from host file */
  39. #ifdef QAK
  40.  
  41. extern unsigned char initialized_flags;     /* flags indicating whether a port has been initialized */
  42. extern unsigned char connected_flags;       /* flags indicating whether a port is connected yet */
  43. extern unsigned char opening_flags;         /* flags indicating whether a port is negotiating an open connection */
  44. extern unsigned char port_buffer[NUM_COMM_PORTS][64];    /* four buffers to store the machine name to connect to */
  45. extern unsigned char buffer_offset[NUM_COMM_PORTS];      /* the offset into the buffer currently */
  46. extern int pnum[NUM_COMM_PORTS];                         /* the port number we are connected to */
  47.  
  48. #define PORT_DATA_SIZE      2048        /* this is sort of a guess, might need larger */
  49. #endif
  50.  
  51. /*
  52. *   int14init
  53. *
  54. *   Entry :  none
  55. *
  56. */
  57. int int14init(void)
  58. {
  59. #ifdef QAK
  60.     config = (getenv("CONFIG.TEL"));    /* check for a config.tel in the environment */
  61.     if(config)                  /* set a different config.tel file */
  62.         Shostfile(config);
  63. #endif
  64.  
  65.     puts("National Center for Supercomputing Applications");    /* put the banner on the screen */
  66.     puts("Interrupt 14h driver");
  67.     puts("January 1991\n");
  68.  
  69.     if(Snetinit()) {            /* call session initialization */
  70. #ifdef QAK
  71.         errhandle();            /* Snetinit() reads config.tel file */
  72. #else
  73.         puts("Snetinit() failed");
  74. #endif
  75.         return(0);
  76.       }
  77.     netgetip(myipnum);          /* get my IP number (in case of BOOTP or RARP) */
  78.     Sgetconfig(&def);       /* get information provided in hosts file */
  79.  
  80. /*
  81. *  Display my Ethernet (or Appletelk) and IP address for the curious people
  82. */
  83.     pcgetaddr(&buf[200],def.address,def.ioaddr);
  84.     printf("My Ethernet address: %x:%x:%x:%x:%x:%x\r\n",buf[200],buf[201],buf[202],buf[203],buf[204],buf[205]);
  85.     printf("My IP address: %d.%d.%d.%d\r\n\n",myipnum[0],myipnum[1],myipnum[2],myipnum[3]);
  86.  
  87.     Stask();                    /* any packets for me? (return ARPs) */
  88.     return(1);      /* inidicate sucessful initialization */
  89. }   /* end int14init() */
  90.  
  91.