home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / MSDOS / WATTCP / NEWWATCP.ZIP / SRC / SOCK_INI.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-22  |  906 b   |  41 lines

  1. /*
  2.  * sock_init - easy way to guarentee:
  3.  *    - card is ready
  4.  *    - shutdown is handled
  5.  *    - cbreaks are handled
  6.  *      - config file is read
  7.  *    - bootp is run
  8.  *
  9.  * 0.1 : May 2, 1991  Erick - reorganized operations
  10.  */
  11.  
  12. #include <copyright.h>
  13. #include <wattcp.h>
  14. #include <stdlib.h>
  15.  
  16. word _survivebootp = 0;
  17.  
  18. void sock_exit()
  19. {
  20.     tcp_shutdown();
  21. }
  22.  
  23. sock_init()
  24. {
  25.     tcp_init();        /* must precede tcp_config because we need eth addr */
  26.     atexit(sock_exit);    /* must not precede tcp_init() incase no PD */
  27.     tcp_cbrk( 0x10 );    /* allow control breaks, give message */
  28.  
  29.     if (tcp_config( NULL )) {    /* if no config file use BOOTP w/broadcast */
  30.     _bootpon = 1;
  31.         outs("Configuring through BOOTP\r\n");
  32.     }
  33.  
  34.     if (_bootpon)    /* non-zero if we use bootp */
  35.     if (_dobootp()) {
  36.             outs("BOOTP failed\r\n");
  37.         if ( !_survivebootp )
  38.         exit( 3 );
  39.     }
  40. }
  41.