home *** CD-ROM | disk | FTP | other *** search
- /*
- ** hterm.c: halca terminal emulator main
- *
- * Author: HIRANO Satoshi
- *
- * (C) 1986 Halca Computer Science Laboratory UEC TM
- * University of Electro Communications
- * University of Tokyo
- *
- *
- * Edition history:
- * 1.0 86/10/20 Halca.Hirano creation for PC-9801
- * 1.2 87/01/09 Halca.Hirano support kana character
- * 1.3 87/01/13 Halca.Hirano able to change print spacing
- * 1.4 87/02/23 Halca.Hirano IBM-PC (MS-DOS & MSC) support
- * 1.5 87/06/09 Halca.Hirano fix PC-9801 keyboard bug
- * 2.1 87/06/17 Halca.Hirano combine hterm/pc hterm/98 into one source
- * 2.2 89/05/16 Halca.Hirano
- * ---- V2.2 distribution ----
- * 2.3 89/06/15 Halca.Hirano
- * 1 remove #else
- * 2.4 89/06/21 Halca.Hirano add CRT saver hook
- * 2.5 89/07/20 Halca.Hirano add redial, upload, download, CTRL-PFkey
- * 2.6 89/07/26 Halca.Hirano change set-up file search method
- * 2.6 89/07/28 Halca.Hirano support multiple ports, add line option
- * ---- V2.3.-1 distribution ----
- * 2.7 89/09/25 Halca.Hirano add paste key
- * ---- V2.4.0 distribution ----
- * 2.8 89/10/08 Halca.Hirano add auto login
- * 2.9 89/11/10 Tominaga@Titech ported to J3100, now we can use 38400 baud on IBM-PC
- * 3.1 89/11/23 Halca.Hirano fix warning message bug
- * 3.2 89/11/23 Halca.Hirano add critical error message handler
- * 3.3 89/12/03 Halca.Hirano add bs key watcher
- * add hterm control by meta-function keys
- * 3.4 90/06/17 Halca.Hirano support soft font
- */
-
- static char version[] = "$Header: hterm.cv 1.19 90/07/05 03:27:10 hirano Exp $";
-
- #include <stdio.h>
- #include <ctype.h>
- #include <time.h>
- #include <stdlib.h>
- #include <string.h>
- #define MAIN 1
- #include "config.h"
- #include "hterm.h"
- #include "option.h"
- #include "default.h"
- #include "global.h"
- #include "version.h"
- #ifdef FEP
- #include "fepctrl.h"
- #endif /* FEP */
-
- /*
- ** messages
- */
- char *helpmsg = "\
- Function: terminal system\n\
- Syntax: hterm [options] [set-up file]\n\
- Example: hterm -b38400 -l2 (com2: 38400 baud)\n\
- hterm -d seiken (call seiken)\n\
- Options:\n\
- -ns don't read set-up file\n\
- -d auto dialing\n\
- -nd no auto dialing\n\
- -l<dev> serial port device\n\
- -f[fontfile] soft font mode\n\
- ";
-
- #ifdef IBMPC
- char *machineOption = "\
- -b<num> set baudrate to 300,1200,2400,4800,9600,19200,38400\n\
- ";
- #endif /* IBMPC */
-
- #ifdef J3100
- char *machineOption = "\
- -b<num> set baudrate to 300,1200,2400,4800,9600,19200,38400\n\
- ";
- #endif /* J3100 */
-
- #ifdef PC98
- char *machineOption = "\
- -b<num> set baudrate to 300,1200,2400,4800,9600,19200,38400\n\
- -a ANSI keyboard mode\n\
- -p PC9801 keyboard mode\n\
- ";
- #endif /* PC98 */
-
- static int optSoftFont;
- static char *optFontName;
- static int mainArgc;
- static char **mainArgv;
-
- void initialize(void );
- void options(int argc,char * *argv);
- void cant(void );
- void doDial(short c);
- void htermCtrl(unsigned short c);
- void bsKeyWatcher(void );
-
- /*
- ** main()
- *
- * hterm main loop
- */
- main(argc, argv)
- char **argv;
- {
- register short c;
- int pri;
-
- time(&starTime);
- mainArgc = argc;
- mainArgv = argv;
- initialize();
-
- timerValue = timerLoadValue;
- /*
- * dialing at startup
- */
- redial = dialStartup;
-
- /*
- * hterm main loop
- */
- for (;;) {
- /*
- * display data from the remote system to console
- */
- for (pri = 0; pri < SERIAL_PRIORITY; pri++) {
- if (online && (c = getSerial()) != -1) {
- decodeAnsi(c & cMask);
- timerValue = timerLoadValue;
- }
- if (redial)
- doDial(c);
- }
- /*
- * send user's key to the remote system
- */
- if ((c = keyin()) != -1) {
- redial = NO; /* disturb dialing */
- /* timerValue is updated in keyin() */
- if (c && ((c & 0x00ff) == 0))
- htermCtrl(c); /* special key controls hterm */
- else
- if (!maskFlag) /* if not XOFFed from host */
- outPort(c); /* send it */
- }
- if (!maskFlag) {
- /*
- * file upload
- */
- if (upLoading) {
- if ((c = upGet()) == EOF) {
- upStop();
- conPrint("\n\r");
- putComment("up load done", msg_null);
- } else if (c != -2)
- outPort(c);
- }
- #ifdef COPY_PASTE
- /*
- * history paste
- */
- if (copyBufferSize)
- if ((c = getCopyBuffer()) != ERR)
- outPort(c);
- #endif /* COPY_PASTE */
- }
-
- #ifdef BS_WATCHER
- /*
- * BS key watcher; indicate 'take a rest' by too many BS/DEL
- */
- if (bsKeyWatcherTimer <= 0 && bsKeyRatio)
- bsKeyWatcher();
- #endif /* BS_WATCHER */
-
- /*
- * CRT saver
- */
- if (timerValue <= 0 && saver) {
- CRTSaver();
- }
- }
- }
-
- void initialize()
- {
- char *path, *diag, *diag2 = 0;
- int flag;
-
- optBaudrate = optAsckey = optRedial = optPortNo = -1;
- optNoSetup = optSoftFont = NO;
- optFontName = (char *)NULL;
- setupSpecified = NO;
- strcpy(defaultCommandLine, DEFAULT_COMMAND_LINE);
-
- options(mainArgc, mainArgv); /* get option flags */
-
- /*
- * now we are in communication mode
- */
- mode = M_COMM;
- /*
- * DON'T USE BEEP(), BELL()
- */
- #ifdef FEP
- fep_init(); /* iniz FEP control */
- #endif /* FEP */
- #ifdef UOP_GRAPHICS
- graph_init(); /* iniz UOP graphics */
- #endif /* UOP_GRAPHICS */
- #ifdef COPY_PASTE
- editInit(); /* iniz copy&paste, history */
- #endif /* COPY_PASTE */
- #ifdef XMODEM
- xinit(); /* iniz xmodem defaults */
- #endif /* XMODEM */
- printInit(); /* iniz printer */
- consoleInit(); /* iniz console */
- fontInit(); /* iniz soft font */
-
- /*
- * Now, we can't leave without termination()!
- */
- ansiInit(); /* iniz ansi decorder */
- saverInit(); /* iniz CRT Saver, timer (do before portInit()) */
-
- /*
- * We can use beep(), bell()
- */
- portInit(); /* iniz serial port */
- keyInit(); /* iniz keyboard mode */
- fileInit(); /* iniz file Xfer */
- setCritHandler(); /* set critical error handler */
-
- /*
- * load set-up file, reset parameters as user's
- */
- if (setupSpecified == NO)
- setFile = SETUP_FILE;
- if ((path = searchPath(setFile)) == NULL)
- strcpy(setFileName, setFile); /* use hterm.set */
- else
- strcpy(setFileName, path);
- if (optNoSetup)
- diag = NULL;
- else
- diag = loadSetup(setFileName, &flag); /* load setup file */
-
- /*
- * search hterm help file hterm.db
- */
- if ((path = searchPath(HELP_FILE)) == NULL)
- strcpy(helpFileName, HELP_FILE);
- else
- strcpy(helpFileName, path);
-
-
- /*
- * set overridden option
- */
- if (optAsckey != -1)
- asckey = optAsckey;
- if (optBaudrate != -1L)
- baudrate = (u_long)optBaudrate & 0xffff;
- if (optRedial != -1)
- dialStartup = optRedial;
- if (optPortNo != -1)
- portNo = optPortNo;
- if (optSoftFont) {
- softFont = YES;
- if (optFontName) {
- strcpy(fontName, optFontName);
- if (strchr(fontName, '.') == NULL)
- strcat(fontName, ".hft");
- }
- }
-
-
- /*
- * reinitialize fit to user's preference
- */
- #ifdef SOFT_FONT
- if (softFont) {
- attrib = eraseAttr = _NORMAL;
- fprintf(stderr, "\nloading font %s ...", fontName); fflush(stderr);
- diag2 = fontLoad(fontName); /* load soft font */
- if (diag2)
- softFont = NO;
- }
- #else
- softFont = NO;
- #endif
- consoleSetup(); /* setup console */
- keySetup(); /* setup keyboard mode */
- saverSetup(); /* setup screen saver */
- fileSetup(); /* setup file utils */
- ansiSetup();
-
- /*
- * print HELLO message
- */
- conPrint(versionString());
- #if defined IBMPC || defined J3100
- conPrint("exit: ALT-F10 key set-up: ALT-F9 key\n\n\r");
- #endif /* IBMPC || J3100 */
- #ifdef PC98
- conPrint("exit: STOP key set-up: COPY key\n\r");
- conPrint(asckey ? "ANSI" : "PC9801");
- conPrint(" keyboard mode\n\n\r");
- #endif /* PC98 */
- /*
- * print DIAG/WARNING messages
- */
- if (diag) {
- conPrint(diag);
- if (flag == NO) { /* if set-up file did not be loaded */
- conPrint(".\n\rDefault setting is used.\n\r");
- conPrint("Make it by 'save set-up' in set-up.\n\r");
- conPrint("hterm will search 'hterm.set' on current dir, HOME and PATH at startup.\n\r");
- }
- conPrint("\n\r");
- }
- if (diag2) { /* font load failed */
- conPrint(diag2);
- conPrint(". ROM font is used.\n\r");
- }
-
- /*
- * if printMode is YES in setup, enable the printer
- */
- printSetup();
-
- /*
- * reiniz serial port (this routine may put warning messages)
- */
- portSetup(); /* setup serial port */
- conPrint("\n");
- }
-
- void termination()
- {
- long endTime;
-
- endAll();
- time(&endTime);
- endTime -= starTime;
- printf("\x1b[1;1fhterm: User exits to the local system. (%d.%02d min)\n", (int)(endTime/60), (int)(endTime%60));
- exit(0);
- }
-
- /*
- ** resetTerminal()
- *
- * reset hterm
- */
- void resetTerminal()
- {
- int oldMode = mode;
- int cursorSave = cursor;
-
- endAll();
- initialize();
- showPage1();
- redial = NO;
- mode = oldMode;
- cursorOnOff(cursor = cursorSave);
- }
-
- /*
- ** deinitialize all of items
- */
- void endAll()
- {
- if (dropER)
- ER_RS_Off(); /* if drop ER, negate ER and RS */
- printEnd();
- fileEnd();
- portEnd();
- saverEnd();
- consoleEnd();
- keyEnd();
- #ifdef COPY_PASTE
- editEnd();
- #endif /* COPY_PASTE */
- #ifdef SOFT_FONT
- fontEnd();
- #endif
- #ifdef FEP
- fep_term();
- #endif /* FEP */
- restoreCritHandler(); /* restore critical error handler */
- }
-
- void printCompileOptions()
- {
- fprintf(stderr, "configured:");
- #ifdef SETUP
- fprintf(stderr, " setup");
- #endif
- #ifdef MOUSE
- fprintf(stderr, " mouse");
- #endif
- #ifdef BS_WATCHER
- fprintf(stderr, " BS-Key-Watcher");
- #endif
- #ifdef KERMIT
- fprintf(stderr, " kermit");
- #endif
- #ifdef XMODEM
- fprintf(stderr, " x/ymodem");
- #endif
- #ifdef COPY_PASTE
- fprintf(stderr, " history");
- #endif
- #ifdef SOFT_FONT
- fprintf(stderr, " soft-font");
- #endif
- #ifdef NEC_KANJI
- fprintf(stderr, " NEC-kanji");
- #endif
- #ifdef UOP_GRAPHICS
- fprintf(stderr, " graphics");
- #endif
- #ifdef ICO_SAVER
- fprintf(stderr, " ico-screen-saver");
- #endif
- #ifdef OVERLAY
- fprintf(stderr, " overlay");
- #endif
- fprintf(stderr, "\nnot configured:");
- #ifndef SETUP
- fprintf(stderr, " setup");
- #endif
- #ifndef MOUSE
- fprintf(stderr, " mouse");
- #endif
- #ifndef BS_WATCHER
- fprintf(stderr, " BS-Key-Watcher");
- #endif
- #ifndef KERMIT
- fprintf(stderr, " kermit");
- #endif
- #ifndef XMODEM
- fprintf(stderr, " x/ymodem");
- #endif
- #ifndef COPY_PASTE
- fprintf(stderr, " history");
- #endif
- #ifndef SOFT_FONT
- fprintf(stderr, " soft-font");
- #endif
- #ifndef NEC_KANJI
- fprintf(stderr, " NEC-kanji");
- #endif
- #ifndef UOP_GRAPHICS
- fprintf(stderr, " graphics");
- #endif
- #ifndef ICO_SAVER
- fprintf(stderr, " ico-screen-saver");
- #endif
- #ifndef OVERLAY
- fprintf(stderr, " overlay");
- #endif
- fprintf(stderr, "\n");
- }
-
- /*
- ** options(int argc, char **argv)
- *
- * parse command line options
- */
- static void options(argc, argv)
- char **argv;
- {
- register char *p;
-
- setFileName[0] = '\0'; /* default no set file */
- setupSpecified = NO;
-
- nextopt:
- while (--argc > 0)
- if (*(p = *++argv) == '-')
- for (++p; *p; p++)
- switch(tolower(*p)) {
- #ifdef PC98
- case 'a': optAsckey = YES; break;
- case 'p': optAsckey = NO; break;
- #endif /* PC98 */
- case 'b': optBaudrate = atol(++p);
- if (baudNum((u_short)optBaudrate) == -1) {
- cant();
- fprintf(stderr, msg_baudrate, optBaudrate);
- #ifdef PC98 /* funny baudrate %ld */
- fprintf(stderr, msg_pc98baud);
- #endif /* PC98 */ /* up to 9600 baud on 8/16Mhz PC9801 */
- exit(1);
- }
- goto nextopt;
- case 'd': optRedial = DIAL_STATE_START; break;
- case 'n':
- switch (*++p) {
- case 'd': optRedial = DIAL_STATE_NONE;
- break;
- case 's': optNoSetup = YES; break;
- default:
- cant(); exit(1);
- }
- break;
- case 'l': optPortNo = atoi(++p) - PORT_BASE;
- if (optPortNo < 0 || optPortNo > MAX_PORT) {
- cant();
- fprintf(stderr, "port com%d: is not supported\n", optPortNo);
- exit(1);
- }
- goto nextopt;
- #ifdef SOFT_FONT
- case 'f':
- optSoftFont++;
- if (*++p)
- optFontName = p;
- goto nextopt;
- #else
- case 'f':
- cant();
- fprintf(stderr, "Soft font not configured\n");
- exit(1);
- #endif /* SOFT_FONT */
- case 'h':
- case '?': cant(); exit(0);
- default: cant();
- fprintf(stderr, "unknown option '%c'.\n", *p);
- exit(1);
- }
- else {
- setFile = *argv;
- setupSpecified = YES;
- }
- }
-
- /*
- ** static void cant()
- *
- * print version string and invocation options
- */
- static void cant()
- {
- fprintf(stderr, versionString());
- fprintf(stderr, helpmsg);
- fprintf(stderr, machineOption);
- printCompileOptions();
- fprintf(stderr, "\n");
- }
-
- /*
- ** static void doDial(short c)
- *
- * simple state machine for auto dialing and login
- * You need this, haan? Yes, I want this. :-)
- */
- static void doDial(c)
- short c;
- {
- static char *scriptPtr;
- static dialPause = DIAL_DELAY;
-
- if (redial == DIAL_STATE_START) {
- putComment("dialing...", msg_null);
- kermitTimer = timerLoadValue;
- scriptPtr = phone; redial = DIAL_STATE_PUT;
- }
- if (redial != DIAL_STATE_WAIT && (timerLoadValue - kermitTimer <= dialPause))
- return;
- kermitTimer = timerLoadValue;
- if (dialPause != DIAL_DELAY) /* end pause */
- dialPause = DIAL_DELAY;
- switch (redial) {
- case DIAL_STATE_PUT:
- switch (*scriptPtr) {
- case 0: /* end of script */
- redial = DIAL_STATE_NONE;
- conPrint("\r\n");
- putComment("dialing end", msg_null);
- time(&starTime);
- break;
- case DIAL_BEGIN_WAIT_CHAR:
- redial = DIAL_STATE_WAIT;
- scriptPtr++;
- break;
- case DIAL_PAUSE_CHAR:
- scriptPtr++;
- if (isdigit(*scriptPtr))
- dialPause = atoi(scriptPtr++) * TICK_SEC;
- else
- dialPause = DEFAULT_DIAL_PAUSE * TICK_SEC;
- break;
- default: /* ordinary characters */
- outPort(*scriptPtr++);
- break;
- }
- break;
- case DIAL_STATE_WAIT: /* template matching */
- if (c != -1 && ((c & cMask) == *scriptPtr || *scriptPtr == '?'))
- scriptPtr++;
- if (*scriptPtr == 0)
- redial = DIAL_STATE_PUT;
- else if (*scriptPtr == DIAL_END_WAIT_CHAR) {
- scriptPtr++;
- redial = DIAL_STATE_PUT;
- }
- break;
- }
- }
-
- /*
- ** static void htermCtrl(u_short c)
- *
- * hterm control by special key or mouse
- * upper 8 bit of c is special code
- */
- static void htermCtrl(c)
- u_short c;
- {
- extern char *sge_lineMode[]; /* in setup.c */
- extern char *sc_baud; /* in setup.c */
- extern char *sc_par[]; /* in setup.c */
-
- switch (c) {
- /*
- * setup, exit
- */
- case META_PF10:
- case STOP_KEY: termination();break; /* exit hterm */
- case META_PF9:
- case SETUP_KEY:
- #ifdef SETUP
- setup(); break; /* set-up mode */
- #else
- putComment("Set-up not configured", msg_null);
- break;
- #endif /* SETUP */
-
- /*
- * CTRL-PF: hterm control
- */
- case PF_CLEAR_TEXT: /* clear text screen */
- attrib = eraseAttr;
- initPage();
- clearSavedPage(ansiVramSave);
- break;
- case PF_CLEAR_GRAPHIC: /* clear graphic screen */
- #ifdef UOP_GRAPHICS
- plot_erase();
- #endif /* UOP_GRAPHICS */
- break;
- case PF_LINE_MODE: /* 19line/20line/24line/25line mode */
- if (++lineMode > MAX_LINE_MODE) lineMode = 0;
- setLineMode(lineMode);
- lowScrRegion = bottomLine;
- initPage();
- cursorOnOff(cursor);
- flushComment(sge_lineMode[lineMode]);
- break;
- #ifdef COPY_PASTE
- case PF_PASTE:
- paste();
- break;
- case PF_HIST_EDIT:
- historyEditor();
- break;
- #else
- case PF_PASTE:
- case PF_HIST_EDIT:
- putComment("history not configured", msg_null);
- break;
- #endif /* COPY_PASTE */
- case PF_REDIAL: /* send dialing sequence */
- redial = DIAL_STATE_START;
- break;
- case PF_BAUD: /* change baud rate */
- baud++; if (baud > BAUD_NUM_MAX) baud = 1;
- if (numBaud(baud) == 0)
- baud = 1;
- initPortDevice(baud, parity);
- baudrate = numBaud(baud);
- sprintf(tmpBuf, sc_baud, numBaud(baud));
- flushComment(tmpBuf);
- break;
- case PF_PARITY: /* change parity/stop bit */
- paritybit++; if (paritybit > MAX_PARITY) paritybit = 0;
- parity = parcalc(paritybit, stopbit);
- initPortDevice(baud, parity);
- flushComment(sc_par[paritybit]);
- break;
- case PF_LOGGING: /* logging on/off */
- setLogging(); break;
- case PF_UPLOAD: /* up load */
- setUpLoad(); break;
- case PF_CHDIR: /* META_PF1: change directory */
- changeDirectory(); break;
- #ifdef XMODEM
- case PF_XMODEM_REC: /* META_PF2: xmodem receive */
- xrec(); break;
- case PF_XMODEM_SEND: /* META_PF3: xmodem send */
- xsend(); break;
- #else
- case PF_XMODEM_REC: /* META_PF2: xmodem receive */
- case PF_XMODEM_SEND: /* META_PF3: xmodem send */
- putComment("xmodem not configured", msg_null);
- break;
- #endif /* XMODEM */
- #ifdef KERMIT
- case PF_KERM_REC: /* META_PF4: kermit receive */
- krec(); break;
- case PF_KERM_SEND: /* META_PF5: kermit send */
- ksend(); break;
- case PF_KERM_GET: /* META_PF6: (optional) kermit get */
- kget(); break;
- case PF_KERM_FINISH: /* META_PF7: (optional) kermit finish */
- kfinish(); break;
- #else
- case PF_KERM_REC: /* META_PF4: kermit receive */
- case PF_KERM_SEND: /* META_PF5: kermit send */
- case PF_KERM_GET: /* META_PF6: (optional) kermit get */
- case PF_KERM_FINISH: /* META_PF7: (optional) kermit finish */
- putComment("kermit not configured", msg_null);
- break;
- #endif /* KERMIT */
- case PF_CALL_OS: /* META_PF8: (optional) call OS */
- showPage1();
- callOS();
- showPage0();
- break;
- /* META PF6-PF8 are reserved for users. */
- /* You can use these keys freely. */
- /* See config.h and search PF_USER */
- /* META PF9-PF10 are used by hterm for IBM-PC set-up and exit */
- }
- }
-
- #ifdef BS_WATCHER
- /* #define BS_DEBUG */
- /*
- * BS key watcher
- *
- * 'Hey, take a rest!' message will appear if
- *
- * 1) bsKeyRatio is not zero, and
- * 2) SAMPLING_TIME is over, and
- * 3) not reached SAMPLING_TIME+60 sec, and
- * 4) at least INTERVAL_TIME sec is over from last message, and
- * 5) total key count is over THRESH_KEY, and
- * 6) BS/total ratio is over bsKeyRatio
- */
- static void bsKeyWatcher()
- {
- static time_t lasTime = 0; /* This means first call always fails */
- static time_t lastMsgTime = 0;
- time_t curTime;
- struct tm *curLocalTime;
- int ratio;
-
- time(&curTime);
- if ((curTime- lasTime) > BS_WATCHER_SAMPLING_TIME + 60) {
- #ifdef BS_DEBUG
- conPrint("too long absense");
- #endif
- /* First call of bsKeyWatcher() always fails */
- keyCount = 0; /* too long absense */
- }
- bsKeyWatcherTimer = BS_WATCHER_SAMPLING_TIME*TICK_SEC;
- lasTime = curTime;
-
- /*
- * if last message was too near, return
- */
- if ((curTime - lastMsgTime) < BS_WATCHER_INTERVAL_TIME) {
- #ifdef BS_DEBUG
- sprintf(tmpBuf, "diftime %d", (int)difftime(curTime, lasTime));
- conPrint(tmpBuf);
- #endif
- bsKeyCount = keyCount = 0;
- return;
- }
-
- if (keyCount < BS_WATCHER_THRESH_KEY) {
- bsKeyCount = keyCount = 0;
- return;
- }
-
- ratio = (bsKeyCount*100)/keyCount;
-
- /*
- * if too many BS keys were not typed.
- */
- if (ratio < bsKeyRatio) {
- #ifdef BS_DEBUG
- sprintf(tmpBuf, "ratio %d", ratio);
- conPrint(tmpBuf);
- #endif
- bsKeyCount = keyCount = 0;
- return;
- }
-
- showPage1(); /* save page0 and show page 1 */
-
- /*
- * select proper message
- */
- curLocalTime = localtime(&curTime);
- if (8 <= curLocalTime->tm_hour && curLocalTime->tm_hour < 12) {
- sprintf(tmpBuf, "morning %u", (int)curTime % 3);
- } else if (0 <= curLocalTime->tm_hour && curLocalTime->tm_hour < 7) {
- sprintf(tmpBuf, "sleep %u", (int)curTime % 3);
- } else {
- sprintf(tmpBuf, "coffee %u", (int)curTime % 3);
- }
- /*
- * pick it up, display
- */
- bell();
- (void)helpSystem(tmpBuf);
- sprintf(tmpBuf, "\tLast %d minutes key count %d, BS/DEL key %d (%d%%)",
- BS_WATCHER_SAMPLING_TIME/60,
- keyCount, bsKeyCount, ratio);
- conPrint(tmpBuf);
- /*
- * show message for short time
- */
- bsKeyWatcherTimer = BS_WATCHER_MESSAGE_TIME*TICK_SEC;
- while (bsKeyWatcherTimer > 0) {
- #if 0
- if (checkEvent())
- break;
- #endif
- nullFunction();
- }
- bell();
- showPage0();
- /*
- * prepare for next time
- */
- bsKeyWatcherTimer = BS_WATCHER_SAMPLING_TIME*TICK_SEC;
- bsKeyCount = keyCount = 0;
- lastMsgTime = curTime;
- }
- #endif /* BS_WATCHER */
-