[comp.sys.atari.st] rmgr works!

david@doe.utoronto.ca (David Megginson) (01/13/91)

Howard Chu's rmgr is now working with my ST and a Sparcstation! rmgr
does _not_ require mgr on the Unix machine, only on yours. Right now,
I have two windows open talking to the SparcStation over my (1200 baud)
modem, and two windows open to my ST. I just tried cutting and pasting
between Sun and ST windows, and it worked fine. I don't know why I
waited so long to try this out. It's like Unix windows, except that
some of the windows can be open to your ST too.

To use rmgr, I wrote a simple (ie. REALLY simple) terminal program
term.c to set up a terminal over the modem. To quit the program, you
type ^]. You must set baud rate, etc, elsewhere. Here are the sources
for the program. The binaries are only 1265 bytes on my machine (with
optimisation, stripping symbol table, etc). Here is the source (I am
posting it here because it is so small):

===== CUT HERE =====

/****************************************************************/
/*	term.c:	a _really_ simple terminal emulator		*/
/*	by David Megginson, 1991				*/
/*	This program is released to the public domain		*/
/****************************************************************/

#include <osbind.h>
#include <mintbind.h>
#include <minimal.h>

#define	QUIT	0x1d		/* ^] to quit the terminal		*/
#define	MAXWAIT	20000L		/* Maximum number of failed attempts	*/
				/* to read a character before we	*/
				/* start snoozing			*/


main()
{
	long counter = 0;
	short c, found;

	do{
		/* We haven't found any activity yet	*/
		
		found = 0;

		/* Check for a character from the modem	*/
		
		if( Bconstat(1) ) {
			found = 1;
			c = Bconin(1) & 0x7f;
			Bconout(2,c);
		}

		/* Check for a character from the cons	*/
		
		if( Bconstat(2) ) {
			found = 1;
			c = Bconin(2) & 0x7f;
			if( c == QUIT )
				break;
			Bconout(1,c);
		}


		/* Don't soak up CPU time if there is	*/
		/* nothing going on!			*/
		
		if( found ) {
			counter = 0L;
		} else if( counter < MAXWAIT ) {
			counter++;
		} else {
			Syield();
		}

	} while( 1 );
	
	return 0;
}

/* end of term.c */

====== CUT HERE =====

David

-- 
////////////////////////////////////////////////////////////////////////
/  David Megginson                      david@doe.utoronto.ca          /
/  Centre for Medieval Studies          meggin@vm.epas.utoronto.ca     /
////////////////////////////////////////////////////////////////////////