xref: /csrg-svn/usr.bin/uucp/libuu/setline.c (revision 48652)
1*48652Sbostic /*-
2*48652Sbostic  * Copyright (c) 1985 The Regents of the University of California.
3*48652Sbostic  * All rights reserved.
4*48652Sbostic  *
5*48652Sbostic  * %sccs.include.proprietary.c%
6*48652Sbostic  */
7*48652Sbostic 
813668Ssam #ifndef lint
9*48652Sbostic static char sccsid[] = "@(#)setline.c	5.4 (Berkeley) 04/24/91";
10*48652Sbostic #endif /* not lint */
1113668Ssam 
1213668Ssam #include "uucp.h"
1317838Sralph #ifdef	USG
1413668Ssam #include <termio.h>
1513668Ssam #endif
1613668Ssam 
1713668Ssam #define PACKSIZE	64
1813668Ssam #define SNDFILE	'S'
1913668Ssam #define RCVFILE 'R'
2013668Ssam #define RESET	'X'
2113668Ssam 
2223617Sbloom /*LINTLIBRARY*/
2323617Sbloom 
2417838Sralph /*
2517838Sralph  *	optimize line setting for sending or receiving files
2617838Sralph  *
2717838Sralph  *	return code - none
2817838Sralph  */
2923617Sbloom /*ARGSUSED*/
3023617Sbloom setupline(type)
3113668Ssam char type;
3213668Ssam {
3317838Sralph #ifdef	USG
3413668Ssam 	static struct termio tbuf, sbuf;
3513668Ssam 	static int set = 0;
3613668Ssam 
3713668Ssam 	DEBUG(2, "setline - %c\n", type);
3817838Sralph 	if (IsTcpIp)
3913668Ssam 		return;
4013668Ssam 	switch(type) {
4113668Ssam 	case SNDFILE:
4213668Ssam 		break;
4313668Ssam 	case RCVFILE:
4413668Ssam 		ioctl(Ifn, TCGETA, &tbuf);
4513668Ssam 		sbuf = tbuf;
4613668Ssam 		tbuf.c_cc[VMIN] = PACKSIZE;
4713668Ssam 		ioctl(Ifn, TCSETAW, &tbuf);
4813668Ssam 		set++;
4913668Ssam 		break;
5013668Ssam 	case RESET:
5113668Ssam 		if (set == 0) break;
5213668Ssam 		set = 0;
5313668Ssam 		ioctl(Ifn, TCSETAW, &sbuf);
5413668Ssam 		break;
5513668Ssam 	}
5613668Ssam #endif
5713668Ssam }
58