home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CPROG
/
ASYNCPEC.ZIP
/
TERMINAL.C
< prev
Wrap
C/C++ Source or Header
|
1989-05-03
|
1KB
|
42 lines
/************************************************************/
/************************************************************/
/* Simple terminal program for Microsoft C 5.1 */
/* Copyright 1989, Quinn-Curtis */
/************************************************************/
/************************************************************/
# include <stdlib.h>
# include <stdio.h>
# include "asyncpec.h"
int err;
char transmit_ch;
char receive_ch;
void main()
{ /* Com port 1, 9600 baud, no parity, 1 stop bit, 8 data bits */
open_com(0,9600,0,1,8,&err);
do {
do {
transmit_ch = getche(); /* Get Character with echo */
if (transmit_ch != 27) send_com(transmit_ch,&err);
/* Grab characters until CR or ESC */
} while ((transmit_ch != 13) && (transmit_ch != 27));
putch(10); /* Send a LF to screen */
do { /* Read com buffer until no characters left */
check_com(&receive_ch,&err);
if (err==0) {
putch(receive_ch); /* If good character the write to screen*/
if (receive_ch==13) putch(10); /* Add LF if CR */
}
else if (err==7){
putch(receive_ch);
printf("BUFFER OVERRUN");
reset_buffer();
}
} while (err == 0);
} while (transmit_ch != 27); /* Exit program by pressing ESC key */
close_com();
}