home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include "eclproto.h"
- #include "xc.h"
- #define ESC 0x001B
-
- int port = COM1;
-
- void main(void)
- {
- unsigned int ch;
- int stat;
-
- stat = xc_entr(8);
- if (stat == 0) {
- stat = xc_tport(port);
- if (!stat) {
- xc_link(port, 0);
- xc_init(port, BAUD2400, NOPAR, DATA8, STOP1);
- for (;;) {
- if (xck_keyt()) { /* A key is struck */
- if ((ch = xck_getc() & 0xFF) == ESC)
- break; /* Exit */
- xc_putc(port, ch);
- }
- if (xc_test(port)) /* Incoming char */
- xcv_wtty(xc_getc(port));
- }
- xc_unlk(port);
- }
- else {
- printf("\nxc_tport() fail with status = %d",stat);
- }
- }
- else {
- printf("\nxc_entr() fail with status = %d",stat);
- }
- xc_exit();
- }