1: #ifndef lint
   2: static char sccsid[] = "@(#)unet.c	4.1 (Berkeley) 1/22/85";
   3: #endif
   4: 
   5: #include "../condevs.h"
   6: #ifdef UNETTCP
   7: 
   8: /*
   9:  *	unetopn -- make UNET (tcp-ip) connection
  10:  *
  11:  *	return codes:
  12:  *		>0 - file number - ok
  13:  *		FAIL - failed
  14:  */
  15: 
  16: /* Default port of uucico server */
  17: #define DFLTPORT    33
  18: 
  19: unetopn(flds)
  20: register char *flds[];
  21: {
  22:     register int ret, port;
  23:     int unetcls();
  24: 
  25:     port = atoi(flds[F_PHONE]);
  26:     if (port <= 0 || port > 255)
  27:         port = DFLTPORT;
  28:     DEBUG(4, "unetopn host %s, ", flds[F_NAME]);
  29:     DEBUG(4, "port %d\n", port);
  30:     if (setjmp(Sjbuf)) {
  31:         logent("tcpopen", "TIMEOUT");
  32:         endhnent(); /* see below */
  33:         return CF_DIAL;
  34:     }
  35:     signal(SIGALRM, alarmtr);
  36:     alarm(30);
  37:     ret = tcpopen(flds[F_NAME], port, 0, TO_ACTIVE, "rw");
  38:     alarm(0);
  39:     endhnent(); /* wave magic wand at 3com and incant "eat it, bruce" */
  40:     if (ret < 0) {
  41:         DEBUG(5, "tcpopen failed: errno %d\n", errno);
  42:         logent("tcpopen", _FAILED);
  43:         return CF_DIAL;
  44:     }
  45:     CU_end = unetcls;
  46:     return ret;
  47: }
  48: 
  49: /*
  50:  * unetcls -- close UNET connection.
  51:  */
  52: unetcls(fd)
  53: register int fd;
  54: {
  55:     DEBUG(4, "UNET CLOSE called\n", 0);
  56:     if (fd > 0) {
  57: #ifdef notdef
  58:         /* disable this until a timeout is put in */
  59:         if (ioctl(fd, UIOCCLOSE, STBNULL))
  60:             logent("UNET CLOSE", _FAILED);
  61: #endif notdef
  62:         close(fd);
  63:         DEBUG(4, "closed fd %d\n", fd);
  64:     }
  65: }
  66: #endif UNETTCP

Defined functions

unetcls defined in line 52; used 2 times
unetopn defined in line 19; never used

Defined variables

sccsid defined in line 2; never used

Defined macros

DFLTPORT defined in line 17; used 1 times
  • in line 27
Last modified: 1986-01-11
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 958
Valid CSS Valid XHTML 1.0 Strict