home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / MSDOS / WATTCP / UNZIPPED / MSWATTCP / SRC / SOCK_INI.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-24  |  921 b   |  46 lines

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