static int updateline(int row, struct video *vp1, struct video *vp2) { #if SCROLLCODE unicode_t *cp1; unicode_t *cp2; int nch; cp1 = &vp1->v_text[0]; cp2 = &vp2->v_text[0]; nch = term.t_ncol; do { *cp2 = *cp1; ++cp2; ++cp1; } while (--nch); #endif #if COLOR scwrite(row, vp1->v_text, vp1->v_rfcolor, vp1->v_rbcolor); vp1->v_fcolor = vp1->v_rfcolor; vp1->v_bcolor = vp1->v_rbcolor; #else if (vp1->v_flag & VFREQ) scwrite(row, vp1->v_text, 0, 7); else scwrite(row, vp1->v_text, 7, 0); #endif vp1->v_flag &= ~(VFCHG | VFCOL); /* flag this line as changed */ }
char *start_auth(struct in_addr *in, int oport, int iport, char *buf) { struct sockaddr_in sin; int fd, n, Tablesize, len; fd_set Sockets, sockcheck; struct timeval t; char outstr[80]; t.tv_sec = 10L; t.tv_usec = 0L; sin.sin_addr.s_addr = in->s_addr; sin.sin_family = AF_INET; sin.sin_port = htons(113); fd = socket(AF_INET, SOCK_STREAM, 0); if(fd < 0) return((char *)0); if(connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) return((char *)0); FD_ZERO(&Sockets); FD_SET(fd, &Sockets); /* Generate request string */ sprintf(outstr, "%d , %d\r\n", oport, iport); len = strlen(outstr); Tablesize = getdtablesize(); sockcheck = Sockets; /* Wait until we can send our request */ if(select(Tablesize, 0, &sockcheck, 0, &t) <= 0) return((char *)0); /* Send the request */ n = scwrite(fd, outstr, len); if(n < len) return((char *)0); /* Wait until the other side responds */ sockcheck = Sockets; if(select(Tablesize, &sockcheck, 0, 0, &t) <= 0) return((char *)0); /* Read the response */ n = scread(fd, buf, 80); scclose(fd); if(n <= 0) return((char *)0); else { buf[n-1] = 0; parse_response(buf); return(buf); } }