Beispiel #1
0
int
net_write(unsigned char *str, int len)
{
	if (nfrontp + len < netobuf + BUFSIZ) {
		output_datalen(str, len);
		return(len);
	}
	return(0);
}
Beispiel #2
0
/*
 * end_slc
 *
 * Finish up the slc negotiation.  If something to send, then send it.
 */
int
end_slc(unsigned char **bufp)
{
	int len;

	/*
	 * If a change has occured, store the new terminal control
	 * structures back to the terminal driver.
	 */
	if (slcchange) {
		set_termbuf();
	}

	/*
	 * If the pty state has not yet been fully processed and there is a
	 * deferred slc request from the client, then do not send any
	 * sort of slc negotiation now.  We will respond to the client's
	 * request very soon.
	 */
	if (def_slcbuf && (terminit() == 0)) {
		return(0);
	}

	if (slcptr > (slcbuf + 4)) {
		if (bufp) {
			*bufp = &slcbuf[4];
			return(slcptr - slcbuf - 4);
		} else {
			(void) sprintf((char *)slcptr, "%c%c", IAC, SE);
			slcptr += 2;
			len = slcptr - slcbuf;
			output_datalen(slcbuf, len);
			netflush();  /* force it out immediately */
			DIAG(TD_OPTIONS, printsub('>', slcbuf+2, len-2););
		}
	}