Subject: Fw: Re: Fw: Re: SSL telnet 0.9 port to gnu-win32 (select)
From: [email-masked] (Keith Gary Boyce )

28 Dec 1996 06:38:02 -0800
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Original-To: [email-masked]
X-Mailer: Chameleon ATX 6.0.1, Standards Based IntraNet Solutions, NetManage Inc.
X-Face: ^DH_.wR&WxVpl/6xSwb1zT".+d0hm%R>&bOD<uhG0]C5^PtJ*C-{,0kzA+{][f&K9_svTdC
 WN/[+/~KR3H&Q`>: y{?
X-Priority: 3 (Normal)
Original-Sender: [email-masked]

I never received an answer about gnu win32 licencing issues. Please
respond. Here is some further information about bugs with gnu-win32.
--- On Sat, 28 Dec 1996 18:29:08 +1000 (EST)  Tim Hudson <[email-masked]> 
wrote:
According to Keith Gary Boyce:
> Hey you're good ... Look what I got today...
    You might want to pass the following on too ... there is another bug 
that
also will break things. This is a simple program that *should* work ... 
however other programs do nasty GNU WIN32 specific stuff when they should 
be
doing things like the following (if a bug is fixed). Look at the code in
less to see what I mean.

Tim.

/* gnusel.c - test GNU WIN32 select 
 *
 *	The GNU WIN32 select code is unfinished it appears and also
 *	broken in a few places.
 *	
 *	- the following should simply echo each character as it is 
 *	typed, unfortunately select() returns data when the shift key
 *	is pressed and the following read() blocks (as there is no
 *	character to be read).
 *
 *	- sockets and console handles cannot be mixed. The code in 
 *	select.cc indicates that a thread will be added to fix this. An
 *	alternative is to use messages ... but I cannot be bothered to
 *	hack either approach in myself.
 *
 *	- the current GNU WIN32 license puts cygwin.dll under the GPL
 *	which is plainly insane in making all linked code have to be
 *	covered by the GPL ... this will prevent a significant section
 *	of people from using (and contributing to) this effort.
 *
 * 	Type "Q" to quit
 *
 * Tim Hudson
 * [email-masked]
 *
 */

#include <stdio.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <errno.h>

#include <unistd.h>
#include <sys/file.h>

#include <sys/termio.h>

/*
#define SYS_ERR (errno>0 && errno<sys_nerr) ? sys_errlist[errno] : "<unknown>"
*/

#define SYS_ERR "<unknown>"

int my_cfmakeraw(struct termios *termios_p)
{
   termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
   termios_p->c_oflag &= ~OPOST;
   termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
   termios_p->c_cflag &= ~(CSIZE|PARENB);
   termios_p->c_cflag |= CS8;
}

main(argc,argv)
int argc;
char *argv[];
{
	int readsock;
	int writesock;
	fd_set readfds;
	int res;
	char buf[BUFSIZ];
	int on;
	struct termio tc;
	struct termios tci;

	errno=0;
	readsock=fileno(stdin);
	writesock=fileno(stdout);

	readsock=open("/dev/tty",O_RDWR);
	
	fprintf(stderr,"readsock=%d - %d\n",readsock,errno);

	on=1;
	errno=0;
	res=ioctl(readsock,FIONBIO,&on);
	if (res!=0) {
		fprintf(stderr,"ioctl(FIONBIO) failed - %d\n",errno);
		fflush(stderr);
	}

	errno=0;
	res=tcgetattr(readsock,&tci);
	if (res!=0) {
		fprintf(stderr,"tcgetattr failed - %d\n",errno);
		fflush(stderr);
	}

	my_cfmakeraw(&tci);

	errno=0;
	res=tcsetattr(readsock,TCSANOW,&tci);
	if (res!=0) {
		fprintf(stderr,"tcsetattr failed - %d\n",errno);
		fflush(stderr);
	}

	while(1) {
		FD_ZERO(&readfds);
		FD_SET(readsock,&readfds);
		do {
			fprintf(stderr,"Entering select\n");
			fflush(stderr);
			errno=0;
			res=select(FD_SETSIZE,&readfds,NULL,NULL,NULL);
			if ((res==-1) && (errno!=EINTR)) {
				fprintf(stderr,"select: %s\n",SYS_ERR);
				exit(1);
			}
			fprintf(stderr,"select returned %d - %d\n",res,errno);
			fflush(stderr);
		} while (errno==EINTR);
		if (FD_ISSET(readsock,&readfds)) {
			errno=0;
			res=read(readsock,buf,BUFSIZ-1);
			if (res==-1) {
				fprintf(stderr,"read failed: %s\n",SYS_ERR);
				exit(1);
			}
			if (res==0) {
				fprintf(stderr,"read: closed\n");
				break;
			}

			/* allow for quiting */
			if (buf[0]=='Q')
				break;

			errno=0;
			res=write(writesock,buf,res);
			if (res==-1) {
				fprintf(stderr,"write failed: %s\n",SYS_ERR);
				exit(1);
			}
		}
	}
	exit(0);

}

---------------End of Original Message-----------------

-------------------------------------
Name: Garry Boyce
E-mail: [email-masked] (Garry Boyce)
Date: 12/01/94
Time: 08:46:10

This message was sent by Chameleon 
-------------------------------------

-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".