Newsgroups: comp.sources.misc From: Warren Tucker Subject: v22i071: ecu - ECU async comm package rev 3.10, Patch03b/3 Message-ID: <1991Aug28.030146.19474@sparky.IMD.Sterling.COM> X-Md4-Signature: fefc41d7daa787a147df25c830d3d561 Date: Wed, 28 Aug 1991 03:01:46 GMT Approved: kent@sparky.imd.sterling.com Submitted-by: Warren Tucker Posting-number: Volume 22, Issue 71 Archive-name: ecu/patch03b Environment: SCO, XENIX, ISC, SUNOS4.1, SYSVR4 Patch-To: ecu: Volume 21, Issue 53-89 #!/bin/sh # this is ecu/patch3b (ECU 3.10 patch 3 part 2) # do not concatenate these parts, unpack them in order with /bin/sh # file PATCH3.01 continued # if test ! -r _shar_seq_.tmp; then echo 'Please unpack part 1 first!' exit 1 fi (read Scheck if test "$Scheck" != 2; then echo Please unpack part "$Scheck" next! exit 1 else exit 0 fi ) < _shar_seq_.tmp || exit 1 if test ! -f _shar_wnt_.tmp; then echo 'x - still skipping PATCH3.01' else echo 'x - continuing file PATCH3.01' sed 's/^X//' << 'SHAR_EOF' >> 'PATCH3.01' && --- 35,45 ---- X # include X #endif X + #ifdef SVR4 + # include + extern int hx_flag; + #endif + X extern KDE keyset_table[]; X extern char *makedate; X extern char curr_dir[CURR_DIRSIZ]; *************** *** 511,525 **** X break; X X case CTrtscts: ! #if defined(RTSFLOW) /* only SCO has this */ X if(narg > 1) X { X lRTSCTS_control(yes_or_no(arg[1])); X } X ff(se," RTS %s CTS %s\r\n", X (Ltermio.c_cflag & RTSFLOW) ? "on" : "off", X (Ltermio.c_cflag & CTSFLOW) ? "on" : "off"); X #else X ff(se," command not available\r\n"); X #endif X break; --- 518,544 ---- X break; X X case CTrtscts: ! #if defined(RTSFLOW) || defined(SVR4) || defined(sun) X if(narg > 1) X { X lRTSCTS_control(yes_or_no(arg[1])); X } X ff(se," RTS %s CTS %s\r\n", + #ifdef SVR4 + (hx_flag & RTSXOFF) ? "on" : "off", + (hx_flag & CTSXON) ? "on" : "off"); + #else + #if defined(RTSFLOW) /* SCO */ X (Ltermio.c_cflag & RTSFLOW) ? "on" : "off", X (Ltermio.c_cflag & CTSFLOW) ? "on" : "off"); X #else + #if defined(sun) + "N/A", + (Ltermio.c_cflag & CRTSCTS) ? "on" : "off"); + #endif /* sun */ + #endif /* RTSFLOW */ + #endif /* SVR4 */ + #else /* no RTS/CTS flow manipulation known to exist */ X ff(se," command not available\r\n"); X #endif X break; *************** *** 661,677 **** X */ X X case CTmemstat: ! #if defined(WHT) && defined(MALLOC_3X) X { X struct mallinfo minfo; X extern char *startbrk; X char *sbrk(); - #define DEBUG_SURETY - #ifdef DEBUG_SURETY /* malloc has been called a zillion times, but ... */ - char *cptr = malloc(100); - free(cptr); - pprintf("we got %08lx\n",cptr); - #endif X minfo = mallinfo(); X pputs("\n"); /* all this casting for 16- vs 32- bit ints */ X pprintf("%10lu total space in arena\n",(ulong)minfo.arena); --- 680,690 ---- X */ X X case CTmemstat: ! #if defined(MALLOC_3X) X { X struct mallinfo minfo; X extern char *startbrk; X char *sbrk(); X minfo = mallinfo(); X pputs("\n"); /* all this casting for 16- vs 32- bit ints */ X pprintf("%10lu total space in arena\n",(ulong)minfo.arena); *************** *** 691,697 **** X } X #else X ff(se," not available\r\n"); ! #endif /* WHT */ X break; X X case 0: --- 704,715 ---- X } X #else X ff(se," not available\r\n"); ! #endif ! break; ! ! case CTkbdtest: ! ff(se,"\r\n"); ! kbd_test(); X break; X X case 0: diff -c /export/home/wht/src/ecu312/ecuicmhelp.c ./ecuicmhelp.c *** /export/home/wht/src/ecu312/ecuicmhelp.c Sun Aug 25 17:28:22 1991 --- ./ecuicmhelp.c Sun Aug 25 14:39:26 1991 *************** *** 14,19 **** --- 14,20 ---- X X --------------------------------------------------------------------------*/ X /*+:EDITS:*/ + /*:08-25-1991-14:39-wht@n4hgf-SVR4 port thanks to aega84!lh */ X /*:08-01-1991-03:52-wht@n4hgf-when editing string, set cursor to end */ X /*:07-25-1991-12:56-wht@n4hgf-ECU release 3.10 */ X /*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */ *************** *** 259,265 **** X waddstr(stdscr,s80); X X if(!x) ! waddch(stdscr,(unsigned)sVR); X y++; X if(y >= LINES - 2) X { --- 260,270 ---- X waddstr(stdscr,s80); X X if(!x) ! #ifdef SVR4 ! wvline(stdscr,sVR & 0x00ff, 1); ! #else ! waddch(stdscr,sVR); ! #endif X y++; X if(y >= LINES - 2) X { diff -c /export/home/wht/src/ecu312/eculine.c ./eculine.c *** /export/home/wht/src/ecu312/eculine.c Sun Aug 25 17:29:16 1991 --- ./eculine.c Mon Aug 26 05:51:00 1991 *************** *** 36,41 **** --- 36,42 ---- X X ------------------------------------------------------------------------*/ X /*+:EDITS:*/ + /*:08-25-1991-14:39-wht@n4hgf-SVR4 port thanks to aega84!lh */ X /*:08-11-1991-18:06-wht@n4hgf-SCO_TTY_NAMING considerations */ X /*:08-06-1991-14:18-wht@n4hgf-baud rates below 300 get two stop bits */ X /*:07-29-1991-01:55-wht@n4hgf-remove unused externs */ *************** *** 56,61 **** --- 57,67 ---- X #include X X extern int errno; + #ifdef SVR4 + # include + # include + int hx_flag; + #endif X extern int sigint; /* SIGINT flag: see xmtr_SIGINT_handler */ X X int lgetc_count; *************** *** 180,186 **** X X register actual_count = 0; X register char *cptr = lrwt->buffer; ! register echo_flag = lrwt->echo; X int max_count = lrwt->bufsize; X char *rtn_val; X int timeout_counter; --- 186,192 ---- X X register actual_count = 0; X register char *cptr = lrwt->buffer; ! register echo_flag = lrwt->echo_flag; X int max_count = lrwt->bufsize; X char *rtn_val; X int timeout_counter; *************** *** 284,290 **** X register char *cptr = lrwt->buffer; X register max_count = lrwt->bufsize; X register raw_mode = lrwt->raw_flag & 0x0F; ! register echo_flag = lrwt->echo; X int check_sigint = (lrwt->raw_flag & 0x80); X int old_ttymode = get_ttymode(); /* save original tty mode */ X int fdmask; --- 290,296 ---- X register char *cptr = lrwt->buffer; X register max_count = lrwt->bufsize; X register raw_mode = lrwt->raw_flag & 0x0F; ! register echo_flag = lrwt->echo_flag; X int check_sigint = (lrwt->raw_flag & 0x80); X int old_ttymode = get_ttymode(); /* save original tty mode */ X int fdmask; *************** *** 685,690 **** --- 691,727 ---- X lRTSCTS_control(flag) X int flag; X { + #ifdef SVR4 + struct termiox flowctrl; + + ioctl(shm->Liofd, TCGETX, &flowctrl); + switch(flag) + { + case 0: + flowctrl.x_hflag &= ~(RTSXOFF | CTSXON); + Ltermio.c_iflag |= (IXOFF); + break; + + case 1: + flowctrl.x_hflag |= CTSXON; + flowctrl.x_hflag &= ~RTSXOFF; + Ltermio.c_iflag &= ~(IXON | IXOFF | IXANY); + break; + case 2: + flowctrl.x_hflag |= RTSXOFF; + flowctrl.x_hflag &= ~CTSXON; + Ltermio.c_iflag &= ~(IXON | IXOFF | IXANY); + break; + case 3: + flowctrl.x_hflag |= (RTSXOFF | CTSXON); + Ltermio.c_iflag &= ~(IXON | IXOFF | IXANY); + break; + } + shm->Lxonxoff = Ltermio.c_iflag & (IXON|IXOFF); + ioctl(shm->Liofd,TCSETA,(char *)&Ltermio); + ioctl(shm->Liofd, TCSETX, &flowctrl); + hx_flag = flowctrl.x_hflag; + #else !SVR4 X #if defined(RTSFLOW) /* only SCO */ X switch(flag) X { *************** *** 713,719 **** --- 750,776 ---- X shm->Lxonxoff = Ltermio.c_iflag & (IXON|IXOFF); X ioctl(shm->Liofd,TCSETA,(char *)&Ltermio); X + #else + #if defined(sun) + switch(flag) + { + case 0: + Ltermio.c_iflag |= (IXOFF); + Ltermio.c_cflag &= ~(CRTSCTS); + break; + + default: + Ltermio.c_iflag &= ~(IXON | IXOFF | IXANY); + Ltermio.c_cflag |= ~(CRTSCTS); + break; + + } + shm->Lxonxoff = Ltermio.c_iflag & (IXON|IXOFF); + ioctl(shm->Liofd,TCSETA,(char *)&Ltermio); + + #endif /* sun */ X #endif /* RTSFLOW */ + #endif /* SVR4 */ X } /* end of lRTSCTS_control */ X X /*+------------------------------------------------------------------------- *************** *** 754,762 **** X Ltermio.c_iflag |= ISTRIP; X break; X default: ! ff(se,"invalid parity: %c ... defaulting to no parity\r\n"); ! case 0: X case 'n': X Ltermio.c_cflag |= CS8; X Ltermio.c_iflag &= ~(ISTRIP); X shm->Lparity = 0; --- 811,821 ---- X Ltermio.c_iflag |= ISTRIP; X break; X default: ! ff(se,"invalid parity: '%c' ... defaulting to no parity\r\n", ! to_lower(shm->Lparity)); X case 'n': + shm->Lparity = 0; + case 0: X Ltermio.c_cflag |= CS8; X Ltermio.c_iflag &= ~(ISTRIP); X shm->Lparity = 0; *************** *** 868,873 **** --- 927,935 ---- X X lopen_err_str[0] = 0; X return(0); + #ifdef SVR4 + hx_flag = 0; + #endif X X } /* end of lopen */ X *************** *** 932,943 **** X ltoggle_dtr() X { X struct termio b0t; ! X b0t = Ltermio; X b0t.c_cflag &= ~CBAUD; X X ioctl(shm->Liofd,TCSETA,(char *)&b0t); /* drop DTR */ X Nap(1000L); X ioctl(shm->Liofd,TCSETA,(char *)&Ltermio); /* raise DTR */ X Nap(300L); X --- 994,1011 ---- X ltoggle_dtr() X { X struct termio b0t; ! #if defined(SVR4) || defined(sun) ! int tempfd; ! #endif X b0t = Ltermio; X b0t.c_cflag &= ~CBAUD; X X ioctl(shm->Liofd,TCSETA,(char *)&b0t); /* drop DTR */ X Nap(1000L); + #if defined(SVR4) || defined(sun) + if ((tempfd = open(shm->Lline, O_RDONLY, 0777)) != -1) + close(tempfd); + #endif X ioctl(shm->Liofd,TCSETA,(char *)&Ltermio); /* raise DTR */ X Nap(300L); X diff -c /export/home/wht/src/ecu312/eculock.c ./eculock.c *** /export/home/wht/src/ecu312/eculock.c Mon Aug 12 01:50:00 1991 --- ./eculock.c Sun Aug 25 14:39:27 1991 *************** *** 19,24 **** --- 19,25 ---- X aged XENIX revision. X ------------------------------------------------------------------------*/ X /*+:EDITS:*/ + /*:08-25-1991-14:39-wht@n4hgf-SVR4 port thanks to aega84!lh */ X /*:08-10-1991-17:39-wht@n4hgf-US_WEGOTIT handling */ X /*:08-09-1991-11:07-wht@n4hgf-configurable lock directory */ X /*:07-25-1991-12:56-wht@n4hgf-ECU release 3.10 */ *************** *** 52,60 **** X status = LOPEN_ENABLED_IN_USE; X break; X case US_NOTFOUND: /* not in utmp, or getty dead */ - status = LOPEN_WE_GOT_IT; /* not really an error */ X break; X case US_WEGOTIT: /* we own the line */ X break; X case US_LOGIN: /* enabled for login, idle */ X status = ungetty_get_line(); --- 53,61 ---- X status = LOPEN_ENABLED_IN_USE; X break; X case US_NOTFOUND: /* not in utmp, or getty dead */ X break; X case US_WEGOTIT: /* we own the line */ + status = LOPEN_WE_GOT_IT; /* not really an error */ X break; X case US_LOGIN: /* enabled for login, idle */ X status = ungetty_get_line(); *************** *** 100,107 **** --- 101,112 ---- X #endif X X errno = 0; + #ifdef SVR4 + sprintf(LTMP_fname,"/var/spool/locks/LTMP.%d",pid); + #else X strcpy(LTMP_fname,lock_dir_name); X sprintf(LTMP_fname + strlen(LTMP_fname),"/LTMP.%05d",pid); + #endif X if((fd = creat(LTMP_fname,0444)) < 0) X { X if(errno == EACCES) *************** *** 149,154 **** --- 154,160 ---- X if(itmp = make_lock_name(shm->Lline,LLCKname)) X return(itmp); X + #ifndef SVR4 X if(itmp = check_utmp()) X { X if(itmp == LOPEN_WE_GOT_IT) /* if we already have the line ... */ *************** *** 156,161 **** --- 162,168 ---- X if(itmp != LOPEN_ENABLED) /* if other than enabled idle ... */ X return(itmp); /* ... return the error */ X } + #endif X X #if defined(GETTY_LOCKS_TTY) X if(!ungetty_ttyname[0]) /* if getty did not lock line */ diff -c /export/home/wht/src/ecu312/ecunumrev.c ./ecunumrev.c *** /export/home/wht/src/ecu312/ecunumrev.c Sun Aug 25 17:28:24 1991 --- ./ecunumrev.c Tue Aug 27 04:57:22 1991 *************** *** 3,8 **** --- 3,9 ---- X wht@n4hgf.Mt-Park.GA.US X ------------------------------------------------------------------------*/ X /*+:EDITS:*/ + /*:08-25-1991-14:39-wht@n4hgf-SVR4 port thanks to aega84!lh */ X /*:07-25-1991-12:56-wht@n4hgf-ECU release 3.10 */ X /*:07-12-1991-14:14-wht@n4hgf-GCC140 differentiation */ X /*:04-27-1991-01:52-wht@n4hgf-overhaul revision numbers */ *************** *** 22,51 **** X #endif X X #ifdef WHT ! char *numeric_revision = "x3.54"; X #else X char *numeric_revision = "3"; X #endif X char *revstr = ""; X - #if defined(ISC) - char *revision_modifier = "-386i wht@n4hgf"; - #else - #if defined(M_UNIX) - char *revision_modifier = "-386u wht@n4hgf"; - #else - #if defined(M_I386) - #if defined(NO_SELECT) - char *revision_modifier = "-386n wht@n4hgf"; - #else - char *revision_modifier = "-386s wht@n4hgf"; - #endif /* */ - #else - char *revision_modifier = "-286n wht@n4hgf"; - #endif /* M_I386 */ - #endif /* M_UNIX */ - #endif /* ISC */ - X /*+------------------------------------------------------------------------- X build_revision_string() X --------------------------------------------------------------------------*/ --- 23,34 ---- X #endif X X #ifdef WHT ! char *numeric_revision = "x3.6r"; X #else X char *numeric_revision = "3"; X #endif X char *revstr = ""; X X /*+------------------------------------------------------------------------- X build_revision_string() X --------------------------------------------------------------------------*/ *************** *** 58,66 **** X X #if defined(M_I286) X strcat(s128,"286"); ! #endif /* M_I286 */ ! ! #if defined(M_I386) || defined(i386) X strcat(s128,"386"); X # if defined(M_XENIX) X # if defined(NO_SELECT) --- 41,48 ---- X X #if defined(M_I286) X strcat(s128,"286"); ! #else ! #if defined(M_I386) || defined(i386) && (!defined(sun) && !defined(SVR4)) X strcat(s128,"386"); X # if defined(M_XENIX) X # if defined(NO_SELECT) *************** *** 72,81 **** X # if defined(M_UNIX) X strcat(s128,"u"); X # endif /* M_UNIX */ ! # if defined(ISC) ! strcat(s128,"i"); ! # endif /* ISC */ X #endif /* M_I386 || i386 */ X X #if defined(__GNUC__) X #if defined(GCC140) --- 54,71 ---- X # if defined(M_UNIX) X strcat(s128,"u"); X # endif /* M_UNIX */ ! #else ! #if defined(sun) ! strcat(s128,"sun"); ! #else ! #if defined(SVR4) ! strcat(s128,"SVR4"); ! #else ! # include "porting.attention.needed.here" ! #endif /* SVR4 */ ! #endif /* sun */ X #endif /* M_I386 || i386 */ + #endif /* M_I286 */ X X #if defined(__GNUC__) X #if defined(GCC140) *************** *** 100,106 **** X exit(255); X } X strcpy(revstr,s128); - X X } /* end of build_revision_string */ X --- 90,95 ---- diff -c /export/home/wht/src/ecu312/ecuphone.c ./ecuphone.c *** /export/home/wht/src/ecu312/ecuphone.c Sun Aug 25 17:29:18 1991 --- ./ecuphone.c Sun Aug 25 14:39:28 1991 *************** *** 71,76 **** --- 71,78 ---- X X --------------------------------------------------------------------------*/ X /*+:EDITS:*/ + /*:08-25-1991-14:39-wht@n4hgf-SVR4 port thanks to aega84!lh */ + /*:08-15-1991-18:13-wht@n4hgf-do not allow edit of non-existent entry */ X /*:08-11-1991-19:56-wht@n4hgf-soup up tty name for ISC vs. SCO */ X /*:08-07-1991-13:48-root@n4hgf-w subcommand was not asking both questions */ X /*:08-01-1991-03:52-wht@n4hgf-when editing string, set cursor to end */ *************** *** 206,213 **** --- 208,219 ---- X else X { X itmp = 10; + #ifdef SVR4 + whline(dirw, (unsigned long)(sHR & 0x00ff), itmp); + #else X while(itmp--) X waddch(dirw,(unsigned)sHR); + #endif X } X wrefresh(dirw); X } *************** *** 435,443 **** X waddstr(dirw,s80); X waddch(dirw,' '); X getyx(dirw,itmp,x); X while(x < DIRW_COLS - 1) X waddch(dirw,sHR),x++; ! X } /* end of dirw_display_phonedir_name */ X X /*+----------------------------------------------------------------------- --- 441,452 ---- X waddstr(dirw,s80); X waddch(dirw,' '); X getyx(dirw,itmp,x); + #ifdef SVR4 + whline(dirw, (unsigned long)(sHR & 0x00ff), DIRW_COLS - 1 - x); + #else X while(x < DIRW_COLS - 1) X waddch(dirw,sHR),x++; ! #endif X } /* end of dirw_display_phonedir_name */ X X /*+----------------------------------------------------------------------- *************** *** 614,619 **** --- 623,632 ---- X { X register y,x; X + #ifdef SVR4 + wmove(dirw,DIRW_LINES - DIRW_BOT_LINES,1); + whline(dirw, (unsigned long)(sHR & 0x00ff), DIRW_COLS - 2); + #else X wmove(dirw,DIRW_LINES - DIRW_BOT_LINES,0); X waddch(dirw,sLT); X getyx(dirw,y,x); *************** *** 620,625 **** --- 633,639 ---- X while(x++ < (DIRW_COLS - 1)) X waddch(dirw,sHR); X waddch(dirw,sRT); + #endif X if(pde_marked_for_redial_count) X { X wmove(dirw,DIRW_LINES - DIRW_BOT_LINES,2); *************** *** 650,656 **** --- 664,674 ---- X wstandout(dirw); X wprintw(dirw, X " entry name %c telephone number %c tty %c baud P %c description ", + #ifdef SVR4 + '|','|','|','|'); + #else X sVR,sVR,sVR,sVR); + #endif X wstandend(dirw); X dirw_display_phonedir_name(); X dirw_display_config(); *************** *** 679,686 **** --- 697,708 ---- X if((itmp = strlen(msg)) == 0) X { X itmp2 = last_msglen + 2; + #ifdef SVR4 + whline(dirw, (unsigned long)(sHR & 0x00ff), itmp2); + #else X for(itmp = 0; itmp < itmp2; itmp++) X waddch(dirw,(unsigned)sHR); + #endif X last_msglen = 0; X } X else *************** *** 701,708 **** --- 723,734 ---- X waddch(dirw,' '); X if((itmp2 = last_msglen - itmp) > 0) X { + #ifdef SVR4 + whline(dirw, (unsigned long)(sHR & 0x00ff), itmp2); + #else X while(itmp2--) X waddch(dirw,(unsigned)sHR); + #endif X } X last_msglen = itmp; /* remember last message length */ X } *************** *** 719,725 **** --- 745,756 ---- X int stand_out; X { X wmove(scrw,line,0); + #ifdef SVR4 + wvline(scrw, (unsigned long)(sVR & 0x00ff), 1); + wmove(scrw,line,1); + #else X waddch(scrw,(unsigned)sVR); + #endif X X if(tpde->redial) X { *************** *** 753,760 **** --- 784,806 ---- X X pde_display_logical(line,tpde,stand_out); X waddch(scrw,' '); + #ifdef SVR4 + wmove(scrw, line, 13); + waddch(scrw,'|'); + #else X waddch(scrw,(unsigned)sVR); + #endif X waddch(scrw,' '); + #ifdef SVR4 + wprintw(scrw,"%-16.16s %c",tpde->telno,'|'); + if(tpde->tty[0]) + wprintw(scrw,"%-5.5s%c",tpde->tty,'|'); + else + wprintw(scrw,"Any %c",'|'); + wprintw(scrw,"%5u %c %c ",tpde->baud, + (tpde->parity) ? to_upper(tpde->parity) : 'N','|'); + wprintw(scrw,"%-29.29s",tpde->descr); + #else X wprintw(scrw,"%-16.16s %c",tpde->telno,sVR); X if(tpde->tty[0]) X wprintw(scrw,"%-5.5s%c",tpde->tty,sVR); *************** *** 763,768 **** --- 809,815 ---- X wprintw(scrw,"%5u %c %c ",tpde->baud, X (tpde->parity) ? to_upper(tpde->parity) : 'N',sVR); X wprintw(scrw,"%-29.29s %c",tpde->descr,sVR); + #endif X return(0); X X } /* end of pde_display */ *************** *** 791,800 **** --- 838,856 ---- X else X { X wmove(scrw,line,0); + #ifdef SVR4 + wvline(scrw, (unsigned long)(sVR & 0x00ff), 1); + wmove(scrw,line,1); + #else X waddch(scrw,(unsigned)sVR); + #endif X wclrtoeol(scrw); X wmove(scrw,line,SCRW_COLS - 1); + #ifdef SVR4 + wvline(scrw, (unsigned long)(sVR & 0x00ff), 1); + #else X waddch(scrw,(unsigned)sVR); + #endif X } X } X wrefresh(scrw); *************** *** 1119,1124 **** --- 1175,1183 ---- X int wgpos = -1; X char s80[80]; X + if(!check_curr_pde()) + return; + X wmove(addw,9,2); X waddstr(addw,prompt); X *************** *** 2099,2110 **** X strcpy(shm->Lline,"/dev/tty"); X strcat(shm->Lline,tpde->tty); X #else - #if defined(ISC) X strcpy(shm->Lline,"/dev/"); X strcat(shm->Lline,tpde->tty); - #else - # include "need.porting.attention.here" - #endif /* ISC */ X #endif /* M_SYSV */ X } X else /* "Any" */ --- 2158,2165 ---- diff -c /export/home/wht/src/ecu312/ecurcvr.c ./ecurcvr.c *** /export/home/wht/src/ecu312/ecurcvr.c Thu Jul 25 12:56:00 1991 --- ./ecurcvr.c Mon Aug 26 16:49:35 1991 *************** *** 1,7 **** ! #define DEFENSIVE /* lots of changes this rev: defining this ! * will make for screwed up screen image ! * but no core dump if nassssty bugs show up ! */ X /* #define ANSI_DEBUG */ /* debug ansi */ X /* #define ANSI_DEBUG_2 */ /* debug ansi intensive output */ X /* #define ANSI_DEBUG_3 */ /* debug ansi selected output */ --- 1,4 ---- ! /* #define DEFENSIVE */ X /* #define ANSI_DEBUG */ /* debug ansi */ X /* #define ANSI_DEBUG_2 */ /* debug ansi intensive output */ X /* #define ANSI_DEBUG_3 */ /* debug ansi selected output */ *************** *** 49,54 **** --- 46,52 ---- X X --------------------------------------------------------------------------*/ X /*+:EDITS:*/ + /*:08-26-1991-16:39-wht@n4hgf2-SD was still hopelessly manic */ X /*:07-25-1991-12:56-wht@n4hgf-ECU release 3.10 */ X /*:07-05-1991-06:13-wht@n4hgf-SD was in baaaaadd shape */ X /*:01-09-1991-22:31-wht@n4hgf-ISC port */ *************** *** 686,692 **** X if(!tty_is_ansi) X { X tcap_cursor(0,0); ! tcap_insert_lines(count); X tcap_cursor(shm->cursor_y,shm->cursor_x); X } X --- 684,690 ---- X if(!tty_is_ansi) X { X tcap_cursor(0,0); ! tcap_insert_lines(param); X tcap_cursor(shm->cursor_y,shm->cursor_x); X } X diff -c /export/home/wht/src/ecu312/ecusetup.c ./ecusetup.c *** /export/home/wht/src/ecu312/ecusetup.c Sun Aug 25 17:29:19 1991 --- ./ecusetup.c Mon Aug 26 15:56:02 1991 *************** *** 34,39 **** --- 34,40 ---- X X --------------------------------------------------------------------------*/ X /*+:EDITS:*/ + /*:08-25-1991-14:39-wht@n4hgf-SVR4 port thanks to aega84!lh */ X /*:08-12-1991-00:58-wht@n4hgf-ISC tty names */ X /*:07-25-1991-12:56-wht@n4hgf-ECU release 3.10 */ X /*:07-17-1991-07:04-wht@n4hgf-avoid SCO UNIX nap bug */ *************** *** 73,90 **** X #define DESCR_LX 3 X X #define TTY_Y 6 - #if defined(M_SYSV) - #define TTY_X 16 - #define TTY_LEN 5 - #else - #if defined(ISC) X #define TTY_X 13 X #define TTY_LEN 8 - #else - # include "porting.attention.needed.here" - #endif /* ISC */ - #endif /* M_SYSV */ - X #define TTY_LX 3 X X #define TTYOPN_LY 6 --- 74,81 ---- *************** *** 150,157 **** X if((itmp = strlen(msg)) == 0) X { X itmp2 = *last_msglen + 2; ! for(itmp = 0; itmp < itmp2; itmp++) ! waddch(setw,fillch & 0xFF); X *last_msglen = 0; X } X else --- 141,152 ---- X if((itmp = strlen(msg)) == 0) X { X itmp2 = *last_msglen + 2; ! #ifdef SVR4 ! whline(setw, (unsigned long)(fillch & 0x00ff), itmp2); ! #else ! for(itmp = 0; itmp < itmp2; itmp++) ! waddch(setw,fillch & 0xFF); ! #endif X *last_msglen = 0; X } X else *************** *** 172,179 **** X waddch(setw,' '); X if((itmp2 = *last_msglen - itmp) > 0) X { X while(itmp2--) ! waddch(setw,fillch & 0xFF); X } X *last_msglen = itmp; /* remember last message length */ X } --- 167,178 ---- X waddch(setw,' '); X if((itmp2 = *last_msglen - itmp) > 0) X { + #ifdef SVR4 + whline(setw, (unsigned long)(fillch & 0x00ff), itmp2); + #else X while(itmp2--) ! waddch(setw,fillch & 0xFF); ! #endif X } X *last_msglen = itmp; /* remember last message length */ X } *************** *** 188,194 **** X char *msg; X { X static int last_msglen = 0; - X setw_msg(msg,SETW_MSG_BOT_Y,sHR,&last_msglen); X } /* end of setw_bot_msg */ X --- 187,192 ---- *************** *** 250,265 **** X void X setup_display_tty() X { X clear_area(setw,TTY_Y,TTY_X,TTY_LEN); ! #if defined(M_SYSV) ! waddstr(setw,&shm->Lline[8]); ! #else ! #if defined(ISC) ! waddstr(setw,&shm->Lline[5]); ! #else ! # include "porting.attention.needed.here" ! #endif /* ISC */ ! #endif /* M_SYSV */ X X } /* end of setup_display_tty */ X --- 248,259 ---- X void X setup_display_tty() X { + char s[TTY_LEN + 1]; + + strncpy(s,shm->Lline + 5,TTY_LEN); + s[TTY_LEN] = 0; X clear_area(setw,TTY_Y,TTY_X,TTY_LEN); ! waddstr(setw,s); X X } /* end of setup_display_tty */ X *************** *** 485,508 **** X X case 1: X #if defined(M_SYSV) ! setw_bot_msg("comm line: i.e., 1a, 2a, 4a, 4b, 4c, 4d"); ! #define _TTYPOS 8 X #else ! #if defined(ISC) X setw_bot_msg("comm line: i.e., acu00, tty00"); - #define _TTYPOS 5 X #else X # include "porting.attention.needed.here" X #endif /* ISC */ X #endif /* M_SYSV */ X X setup_display_tty(); ! strcpy(s80,&shm->Lline[_TTYPOS]); X itmp = wingets(setw,TTY_Y,TTY_X,s80,TTY_LEN + 1,&delim, X 1,(int *)0); X setw_err_msg(""); X if(strchr(use_input_delim,delim)) ! strcpy(&shm->Lline[_TTYPOS],s80); X setup_display_tty(); X break; X --- 479,504 ---- X X case 1: X #if defined(M_SYSV) ! setw_bot_msg("comm line: i.e., tty1a, tty4d"); X #else ! #if defined(ISC) || defined(SVR4) X setw_bot_msg("comm line: i.e., acu00, tty00"); X #else + #if defined(sun) + setw_bot_msg("comm line: i.e., cua0, ttyd0"); + #else X # include "porting.attention.needed.here" + #endif /* sun */ X #endif /* ISC */ X #endif /* M_SYSV */ X X setup_display_tty(); ! strcpy(s80,&shm->Lline[5]); X itmp = wingets(setw,TTY_Y,TTY_X,s80,TTY_LEN + 1,&delim, X 1,(int *)0); X setw_err_msg(""); X if(strchr(use_input_delim,delim)) ! strcpy(&shm->Lline[5],s80); X setup_display_tty(); X break; X *************** *** 593,598 **** --- 589,595 ---- X X switch(delim) X { + case XFcurup: X case CTL_B: X if(input_state) X input_state--; *************** *** 600,605 **** --- 597,603 ---- X input_state = 6; X break; X + case XFcurdn: X case TAB: X case NL: X input_state++; *************** *** 681,687 **** X DCE_dial(); X #endif X } ! else X start_rcvr_process(1); X X } /* end of setup_screen */ --- 679,685 ---- X DCE_dial(); X #endif X } ! else X start_rcvr_process(1); X X } /* end of setup_screen */ diff -c /export/home/wht/src/ecu312/ecushm.h ./ecushm.h *** /export/home/wht/src/ecu312/ecushm.h Thu Jul 25 12:56:00 1991 --- ./ecushm.h Fri Aug 23 14:21:59 1991 *************** *** 4,9 **** --- 4,10 ---- X wht@n4hgf.Mt-Park.GA.US X --------------------------------------------------------------------------*/ X /*+:EDITS:*/ + /*:08-21-1991-01:34-wht@n4hgf-FAR depends only on M_I286 */ X /*:07-25-1991-12:56-wht@n4hgf-ECU release 3.10 */ X /*:12-19-1990-17:09-wht@n4hgf-make cursor variables unsigned */ X /*:11-30-1990-19:01-wht@n4hgf-add ttyinit_param */ *************** *** 10,19 **** X /*:11-28-1990-17:43-wht@n4hgf-move cursor_y, cursor_x to right after revision */ X /*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */ X ! #if defined(i386) || defined(M_I386) ! #define FAR ! #else X #define FAR far X #endif X X #if !defined(ushort) --- 11,20 ---- X /*:11-28-1990-17:43-wht@n4hgf-move cursor_y, cursor_x to right after revision */ X /*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */ X ! #if defined(M_I286) X #define FAR far + #else + #define FAR X #endif X X #if !defined(ushort) diff -c /export/home/wht/src/ecu312/ecusighdl.c ./ecusighdl.c *** /export/home/wht/src/ecu312/ecusighdl.c Sun Aug 25 17:29:20 1991 --- ./ecusighdl.c Mon Aug 26 16:08:51 1991 *************** *** 5,11 **** X X Defined functions: X child_signals() - termecu(sig) X kill_rcvr_process(sig) X rcvr_SIGHUP_handler() X rcvr_SIGINT_handler() --- 5,10 ---- *************** *** 16,31 **** X rcvr_death_handler(sig) X rcvr_signals() X start_rcvr_process(notify_flag) X xmtr_SIGHUP_handler(sig) X xmtr_SIGINT_handler() X xmtr_SIGTERM_handler(sig) X xmtr_SIGUSR2_handler() ! xmtr_bsd4_SIGCHLD_handler() X xmtr_signals() - xmtr_SIGCLD_handler() X X ------------------------------------------------------------------------*/ X /*+:EDITS:*/ X /*:07-25-1991-12:56-wht@n4hgf-ECU release 3.10 */ X /*:07-17-1991-07:04-wht@n4hgf-avoid SCO UNIX nap bug */ X /*:06-29-1991-15:42-wht@n4hgf-if WHT and xterm, play with title bar */ --- 15,33 ---- X rcvr_death_handler(sig) X rcvr_signals() X start_rcvr_process(notify_flag) + termecu(sig) + termecu_code_text(code) + xmtr_SIGCLD_handler() X xmtr_SIGHUP_handler(sig) X xmtr_SIGINT_handler() X xmtr_SIGTERM_handler(sig) X xmtr_SIGUSR2_handler() ! xmtr_death_handler(sig) X xmtr_signals() X X ------------------------------------------------------------------------*/ X /*+:EDITS:*/ + /*:08-25-1991-23:56-wht@n4hgf2-handle xmtr core dump gracefully */ X /*:07-25-1991-12:56-wht@n4hgf-ECU release 3.10 */ X /*:07-17-1991-07:04-wht@n4hgf-avoid SCO UNIX nap bug */ X /*:06-29-1991-15:42-wht@n4hgf-if WHT and xterm, play with title bar */ *************** *** 69,74 **** --- 71,77 ---- X void xmtr_SIGHUP_handler(); X void xmtr_SIGTERM_handler(); X void xmtr_SIGCLD_handler(); + void Xcvr_death_handler(); X void rcvr_common_signal_handler(); X void rcvr_death_handler(); X *************** *** 351,371 **** X { X rcvr_common_signal_handler(); X } X void X rcvr_death_handler(sig) X int sig; X { ! fprintf(stderr,"\r\nreceiver process caught signal %s\r\n", ! signal_name_text(sig)); ! fprintf(stderr,"cursor y=%d x=%d\r\n",shm->cursor_y,shm->cursor_x); ! #ifdef SIGABRT ! signal(SIGABRT,SIG_DFL); X #else ! signal(SIGIOT,SIG_IOT); X #endif ! abort(); X _exit(-1); ! } X /*+------------------------------------------------------------------------- X xmtr_SIGINT_handler() X --------------------------------------------------------------------------*/ --- 354,383 ---- X { X rcvr_common_signal_handler(); X } + /*+------------------------------------------------------------------------- + rcvr_death_handler(sig) + --------------------------------------------------------------------------*/ X void X rcvr_death_handler(sig) X int sig; X { ! int itmp; ! #ifdef lint ! int *open_elevator_shaft = (int *)0; X #else ! int *open_elevator_shaft = (int *)(shm - 1); X #endif ! ! ttymode(0); ! fprintf(stderr,"\r\nreceiver process caught signal %s\r\n", ! signal_name_text(sig)); ! fprintf(stderr,"cursor y=%d x=%d\r\n",shm->cursor_y,shm->cursor_x); ! signal(SIGSEGV,SIG_DFL); ! signal(SIGBUS,SIG_DFL); ! itmp = *open_elevator_shaft; X _exit(-1); ! } /* end of rcvr_death_handler */ ! X /*+------------------------------------------------------------------------- X xmtr_SIGINT_handler() X --------------------------------------------------------------------------*/ *************** *** 401,406 **** --- 413,445 ---- X } X X /*+------------------------------------------------------------------------- + xmtr_death_handler(sig) + --------------------------------------------------------------------------*/ + void + xmtr_death_handler(sig) + int sig; + { + int itmp; + #ifdef lint + int *open_elevator_shaft = (int *)0; + #else + int *open_elevator_shaft = (int *)(shm - 1); + #endif + + ttymode(0); + fprintf(stderr,"\r\ntransmitter process caught signal %s\n", + signal_name_text(sig)); + for(itmp = 1; itmp < NSIG; itmp++) + signal(itmp,SIG_IGN); + kill_rcvr_process(SIGUSR1); + signal(SIGSEGV,SIG_DFL); + signal(SIGBUS,SIG_DFL); + itmp = *open_elevator_shaft; + printf("itmp=%d oes=%08lx\n",itmp,open_elevator_shaft); + _exit(-1); + } /* end of xmtr_death_handler */ + + /*+------------------------------------------------------------------------- X xmtr_SIGCLD_handler() X --------------------------------------------------------------------------*/ X void *************** *** 453,458 **** --- 492,498 ---- X void X xmtr_signals() X { + X signal(SIGHUP,xmtr_SIGHUP_handler); X signal(SIGQUIT,SIG_IGN); X signal(SIGINT,xmtr_SIGINT_handler); *************** *** 459,464 **** --- 499,525 ---- X signal(SIGTERM,xmtr_SIGTERM_handler); X signal(SIGCLD,xmtr_SIGCLD_handler); X signal(SIGUSR2,xmtr_SIGUSR2_handler); + #ifdef SIGILL + signal(SIGILL,xmtr_death_handler); + #endif + #ifdef SIGIOT + signal(SIGIOT,xmtr_death_handler); + #endif + #ifdef SIGABRT + signal(SIGABRT,xmtr_death_handler); + #endif + #ifdef SIGEMT + signal(SIGEMT,xmtr_death_handler); + #endif + #ifdef SIGFPE + signal(SIGFPE,xmtr_death_handler); + #endif + #ifdef SIGBUS + signal(SIGBUS,xmtr_death_handler); + #endif + #ifdef SIGSEGV + signal(SIGSEGV,xmtr_death_handler); + #endif X X } /* end of xmtr_signals */ X *************** *** 472,478 **** X signal(SIGQUIT,SIG_IGN); X #ifdef RCVR_CLEAN_CORE_DUMP X signal(SIGILL,SIG_DFL); - signal(SIGTRAP,SIG_DFL); X signal(SIGIOT,SIG_DFL); X signal(SIGABRT,SIG_DFL); X signal(SIGEMT,SIG_DFL); --- 533,538 ---- *************** *** 482,490 **** X #else X #ifdef SIGILL X signal(SIGILL,rcvr_death_handler); - #endif - #ifdef SIGTRAP - signal(SIGTRAP,rcvr_death_handler); X #endif X #ifdef SIGIOT X signal(SIGIOT,rcvr_death_handler); --- 542,547 ---- diff -c /export/home/wht/src/ecu312/ecutty.c ./ecutty.c *** /export/home/wht/src/ecu312/ecutty.c Sun Aug 25 17:29:21 1991 --- ./ecutty.c Mon Aug 26 05:29:24 1991 *************** *** 1,3 **** --- 1,4 ---- + /* #define NAP_DEBUG */ X /*+------------------------------------------------------------------------- X ecutty.c - local tty (console) functions X wht@n4hgf.Mt-Park.GA.US *************** *** 43,48 **** --- 44,51 ---- X X --------------------------------------------------------------------------*/ X /*+:EDITS:*/ + /*:08-25-1991-14:39-wht@n4hgf-SVR4 port thanks to aega84!lh */ + /*:08-17-1991-18:29-wht@n4hgf-add kbdtest command */ X /*:07-25-1991-12:57-wht@n4hgf-ECU release 3.10 */ X /*:07-14-1991-18:18-wht@n4hgf-new ttygets functions */ X /*:07-10-1991-16:19-wht@n4hgf-improve multi-char func key read timeout */ *************** *** 64,72 **** X #if defined(M_SYSV) X # include X #else X # include X # include ! #endif X X #define DEFINE_TTY_DATA X #include "ecutty.h" --- 67,77 ---- X #if defined(M_SYSV) X # include X #else + #if defined(ISC) X # include X # include ! #endif /* ISC */ ! #endif /* M_SYSV */ X X #define DEFINE_TTY_DATA X #include "ecutty.h" *************** *** 112,117 **** --- 117,123 ---- X extern int COLS; X extern char screen_dump_file_name[]; X + char *kde_text(); X X uint LINESxCOLS; X int current_ttymode = 0; *************** *** 120,125 **** --- 126,132 ---- X int tty_is_pts; X int tty_is_pty; X int tty_is_multiscreen; + static int kbd_test_active = 0; X X struct termio tty_termio_at_entry; X struct termio tty_termio_current; *************** *** 147,152 **** --- 154,168 ---- X uchar *dole_out_tgc_accum = (uchar *)0; X int dole_out_tgc_accum_count = 0; X + #ifdef SVR4 + ulong colors_current = 0x00003740; + ulong colors_normal = 0x00003740; /* */ + ulong colors_initial = 0x00003740; /* */ + ulong colors_success = 0x00003740; /* */ + ulong colors_alert = 0x00003740L; /* */ + ulong colors_error = 0x00003140L; /* */ + ulong colors_notify = 0x00003340L; /* */ + #else X ulong colors_current = 0x04070A00L; X ulong colors_normal = 0x04070A00L; /* default lt_green/black red/white */ X ulong colors_initial = 0x04070A00L; /* default initial colors */ *************** *** 154,159 **** --- 170,176 ---- X ulong colors_alert = 0x0E000E00L; /* yellow */ X ulong colors_error = 0x04000400L; /* red */ X ulong colors_notify = 0x08000800L; /* gray */ + #endif X X int use_colors = 0; /* set by ttyinit, but default no */ X int tty_not_char_special; *************** *** 228,244 **** X _setcolor(clrs) X ulong clrs; X { X if(!use_colors || tty_not_char_special) X return; X X /* normal */ X ff(se,"\033[=%ldF\033[=%ldG",(clrs >> 8) & 0xFF,clrs & 0xFF); X X /* reverse */ X ff(se,"\033[=%ldH\033[=%ldI",(clrs >> 24) & 0xFF,(clrs >> 16) & 0xFF); ! X colors_current = clrs; - X } /* end of _setcolor */ X X /*+------------------------------------------------------------------------- --- 245,269 ---- X _setcolor(clrs) X ulong clrs; X { + char fg[4], bg[4]; + X if(!use_colors || tty_not_char_special) X return; X + #ifdef SVR4 X /* normal */ + sprintf(fg,"%s", (clrs >> 8) & 0xFF); + sprintf(bg,"%s", clrs & 0xFF); + ff(se,"\033[%sm", fg); + ff(se,"\033[%sm", bg); + #else + /* normal */ X ff(se,"\033[=%ldF\033[=%ldG",(clrs >> 8) & 0xFF,clrs & 0xFF); X X /* reverse */ X ff(se,"\033[=%ldH\033[=%ldI",(clrs >> 24) & 0xFF,(clrs >> 16) & 0xFF); ! #endif X colors_current = clrs; X } /* end of _setcolor */ X X /*+------------------------------------------------------------------------- *************** *** 266,272 **** X } X _setcolor(new_colors); X tcap_stand_end(); - X } /* end of setcolor */ X X /*+------------------------------------------------------------------------- --- 291,296 ---- *************** *** 549,554 **** --- 573,579 ---- X * (I ain't proud of this beyond being a valiant attempt) X */ X use_colors = 0; + #if defined(M_SYSV) || defined(ISC) X if( ((itmp = ioctl(TTYIN,CONS_GET,&monitor_type)) >= 0) && X (use_colors = (monitor_type != MONO))) X { *************** *** 556,561 **** --- 581,587 ---- X setcolor(colors_normal); X } X tty_is_multiscreen = !(itmp < 0); + #endif X X /* X * save initial tty state *************** *** 624,631 **** X 0 restore attributes saved at start of execution X 1 raw mode (send xon/xoff, but do not respond to it, no ISIG/SIGINT) X 2 raw mode (same as 1 but allow keyboard interrupts) ! 3 attributes at start of execution, but with echo disabled and no parity ! 4 same as 2 but terminate program on SIGINT X X ------------------------------------------------------------------------*/ X void --- 650,656 ---- X 0 restore attributes saved at start of execution X 1 raw mode (send xon/xoff, but do not respond to it, no ISIG/SIGINT) X 2 raw mode (same as 1 but allow keyboard interrupts) ! 3 same as 2 but terminate program on SIGINT X X ------------------------------------------------------------------------*/ X void *************** *** 648,654 **** X X case 1: X case 2: ! case 4: X tty_termio_current = tty_termio_at_entry; X X tty_termio_current.c_cflag &= ~(PARENB | PARODD); --- 673,679 ---- X X case 1: X case 2: ! case 3: X tty_termio_current = tty_termio_at_entry; X X tty_termio_current.c_cflag &= ~(PARENB | PARODD); *************** *** 673,688 **** X current_ttymode = arg; X break; X - case 3: - tty_termio_current = tty_termio_at_entry; - tty_termio_current.c_cflag &= ~(PARENB | PARODD); - tty_termio_current.c_cflag |= CS8; - tty_termio_current.c_iflag &= ~(ISTRIP); - tty_termio_current.c_lflag &= ~(ICANON | ISIG | ECHO); - ioctl(TTYIN,TCSETAW,(char *)&tty_termio_current); - current_ttymode = 3; - break; - X default: X ff(se,"\r\nttymode: invalid argument %d\r\n",arg); X break; --- 698,703 ---- *************** *** 751,756 **** --- 766,780 ---- X } /* end of ttyflush */ X X /*+------------------------------------------------------------------------- + ttyrdchk() - see if key pressed and not read + --------------------------------------------------------------------------*/ + int + ttyrdchk() + { + return(rdchk(TTYIN) || dole_out_tgc_accum_count); + } /* end of ttyrdchk */ + + /*+------------------------------------------------------------------------- X ttygetc(xkey_ok) -- get a key from the keyboard X if UNIX or XENIX, map extended keys to sign-bit-set special value X if xkey_ok is 0, disallow extended keys *************** *** 777,782 **** --- 801,808 ---- X { X ctmp = *dole_out_tgc_accum++; X dole_out_tgc_accum_count--; + if(kbd_is_7bit) + ctmp &= 0x7F; X return((uint)ctmp); X } X *************** *** 790,799 **** X termecu(TERMECU_TTYIN_READ_ERROR); X } X ! if(kbd_is_7bit) ! ctmp &= 0x7F; ! ! if(tty_is_ansi && (ctmp == ESC)) /* if escape from ansi terminal */ X { X itmp = 0; X timeout_remaining = tty_escape_timeout; --- 816,823 ---- X termecu(TERMECU_TTYIN_READ_ERROR); X } X ! /* if escape from SCO/"ansi" terminal */ ! if(tty_is_ansi && ((ctmp & 0x7F) == ESC)) X { X itmp = 0; X timeout_remaining = tty_escape_timeout; *************** *** 811,825 **** X if(!rdchk(TTYIN)) X continue; X read(TTYIN,(char *)&ctmp,1); - if(kbd_is_7bit) - ctmp &= 0x7F; - if(itmp == (sizeof(tgc_accum) - 1)) /* do not allow overflow */ - break; X tgc_accum[itmp++] = ctmp; X if(itmp == 2) X break; X } X tgc_accum[itmp] = 0; X if(!itmp) /* no subsequent chars, so ... */ X return(ESC); /* return the escape */ X else if((itmp == 2) && (tgc_accum[0] == '[')) --- 835,852 ---- X if(!rdchk(TTYIN)) X continue; X read(TTYIN,(char *)&ctmp,1); X tgc_accum[itmp++] = ctmp; X if(itmp == 2) X break; X } X tgc_accum[itmp] = 0; + if(kbd_test_active) + { + char title[32]; + sprintf(title,"--> func key '%s' (%d key codes received)", + kde_text(ctmp),itmp); + hex_dump(tgc_accum,-itmp,title,1); + } X if(!itmp) /* no subsequent chars, so ... */ X return(ESC); /* return the escape */ X else if((itmp == 2) && (tgc_accum[0] == '[')) *************** *** 835,841 **** X case XF7: case XF8: case XF9: case XF10: case XF11: case XF12: X case XFbktab: X if(xkey_ok) ! return(tgc_accum[1] | 0x80); X /* fall thru -- xkey not allowed */ X default: X ring_bell(); --- 862,868 ---- X case XF7: case XF8: case XF9: case XF10: case XF11: case XF12: X case XFbktab: X if(xkey_ok) ! return((uint)tgc_accum[1] | 0x80); X /* fall thru -- xkey not allowed */ X default: X ring_bell(); *************** *** 844,854 **** X /*NOTREACHED*/ X } X /* not func key -- must be typamatic control key */ X dole_out_tgc_accum_count = itmp - 1; X dole_out_tgc_accum = tgc_accum + 1; X return((uint)tgc_accum[0]); X } ! else if(!tty_is_ansi && (ctmp >= 0x01) && (ctmp <= 0x1F) && X (ctmp != kbderase) && (ctmp != kbdkill) && X (ctmp != kbdeol) && (ctmp != kbdeol2) && X (ctmp != kbdintr) && (ctmp != kbdeof) ) --- 871,895 ---- X /*NOTREACHED*/ X } X /* not func key -- must be typamatic control key */ + if(kbd_test_active) + { + char title[32]; + if(itmp > 1) + { + sprintf(title, + "--> no func key recognized (%d key codes received)",itmp); + hex_dump(tgc_accum,-itmp,title,1); + } + } X dole_out_tgc_accum_count = itmp - 1; X dole_out_tgc_accum = tgc_accum + 1; + if(kbd_is_7bit) + tgc_accum[0] &= 0x7F; X return((uint)tgc_accum[0]); X } ! else if(!tty_is_ansi && /* this is getting crazy */ ! ((ctmp >= 0x01) && (ctmp <= 0x1F) || ! (ctmp >= 0x81) && (ctmp <= 0x9F)) && X (ctmp != kbderase) && (ctmp != kbdkill) && X (ctmp != kbdeol) && (ctmp != kbdeol2) && X (ctmp != kbdintr) && (ctmp != kbdeof) ) *************** *** 870,887 **** X if(!rdchk(TTYIN)) X continue; X read(TTYIN,(char *)&ctmp,1); - timeout_remaining = tty_escape_timeout; - if(kbd_is_7bit) - ctmp &= 0x7F; X if(itmp == (sizeof(tgc_accum) - 1)) /* do not allow overflow */ X break; X tgc_accum[itmp++] = ctmp; X } X tgc_accum[itmp] = 0; X if((ctmp == XF_not_yet) && (itmp == 1)) ! return(tgc_accum[0]); X else if(ctmp < XF_no_way) /* if we got a map */ X { X if(!xkey_ok) X { X ring_bell(); --- 911,940 ---- X if(!rdchk(TTYIN)) X continue; X read(TTYIN,(char *)&ctmp,1); X if(itmp == (sizeof(tgc_accum) - 1)) /* do not allow overflow */ + { + ctmp = XF_no_way; X break; + } + timeout_remaining = tty_escape_timeout; X tgc_accum[itmp++] = ctmp; X } X tgc_accum[itmp] = 0; X if((ctmp == XF_not_yet) && (itmp == 1)) ! { ! if(kbd_is_7bit) ! tgc_accum[0] &= 0x7F; ! return((uint)tgc_accum[0]); ! } X else if(ctmp < XF_no_way) /* if we got a map */ X { + if(kbd_test_active) + { + char title[32]; + sprintf(title,"--> func key '%s' (%d key codes received)", + kde_text(ctmp),itmp); + hex_dump(tgc_accum,-itmp,title,1); + } X if(!xkey_ok) X { X ring_bell(); *************** *** 893,908 **** X screen_dump(screen_dump_file_name); X goto GET_KEY; X default: ! return(KDEk_to_XF[ctmp]); X } X /*NOTREACHED*/ X } X /* not func key -- must be typamatic control key */ X dole_out_tgc_accum_count = itmp - 1; X dole_out_tgc_accum = tgc_accum + 1; X return((uint)tgc_accum[0]); X } ! return(ctmp); X } /* end if ttygetc */ X X /*+----------------------------------------------------------------------- --- 946,979 ---- X screen_dump(screen_dump_file_name); X goto GET_KEY; X default: ! return((uint)KDEk_to_XF[ctmp]); X } X /*NOTREACHED*/ X } X /* not func key -- must be typamatic control key */ + if(kbd_test_active) + { + char title[32]; + if(itmp > 1) + { + sprintf(title, + "--> no func key recognized (%d key codes received)",itmp); + hex_dump(tgc_accum,-itmp,title,1); + } + } X dole_out_tgc_accum_count = itmp - 1; X dole_out_tgc_accum = tgc_accum + 1; + if(kbd_is_7bit) + tgc_accum[0] &= 0x7F; X return((uint)tgc_accum[0]); X } ! ! /* ! * simple key, not special ! */ ! if(kbd_is_7bit) ! ctmp &= 0x7F; ! return((uint)ctmp); X } /* end if ttygetc */ X X /*+----------------------------------------------------------------------- *************** *** 1080,1086 **** X ring_bell(); X continue; X } ! str[strcount++] = inch & 0x7F; X strpos++; X fputc(inch,se); X } --- 1151,1157 ---- X ring_bell(); X continue; X } ! str[strcount++] = inch; X strpos++; X fputc(inch,se); X } *************** *** 1172,1177 **** --- 1243,1286 ---- X return(0); X X } /* end of ttygets_esd */ + + /*+------------------------------------------------------------------------- + kbd_test() - test keyboard handler + --------------------------------------------------------------------------*/ + void + kbd_test() + { + uint ctmp = 0; + + pputs("Press keys to test (ESCape to exit)\n"); + kbd_test_active = 1; + while(ctmp != ESC) + { + ctmp = ttygetc(1); + + if((ctmp < 0x80) && dole_out_tgc_accum_count) + { + pprintf(" got %d key sequence %s ", + dole_out_tgc_accum_count,hex_to_ascii_name(ctmp)); + while(dole_out_tgc_accum_count) + { + pprintf("%s ",hex_to_ascii_name(*dole_out_tgc_accum++)); + dole_out_tgc_accum_count--; + } + pputs("\n"); + ctmp = 0; + continue; + } + pputs(" got "); + if(ctmp >= 0x80) + pprintf("fkey '%s'\n",xf_text(ctmp)); + else + pprintf("key '%s'\n",hex_to_ascii_name(ctmp)); + } + kbd_test_active = 0; + pputs("keyboard test complete\n\n"); + + } /* end of kbd_test */ X X /*+------------------------------------------------------------------------- X char *get_ttyname() - return pointer to static string Common subdirectories: /export/home/wht/src/ecu312/ecuungetty and ./ecuungetty diff -c /export/home/wht/src/ecu312/ecuutil.c ./ecuutil.c *** /export/home/wht/src/ecu312/ecuutil.c Sun Aug 25 17:29:22 1991 --- ./ecuutil.c Sun Aug 25 16:05:22 1991 *************** *** 33,38 **** --- 33,40 ---- X X ------------------------------------------------------------------------*/ X /*+:EDITS:*/ + /*:08-25-1991-14:39-wht@n4hgf-SVR4 port thanks to aega84!lh */ + /*:08-17-1991-14:11-root@n4hgf-ascii_to_hex supports "csi" */ X /*:08-13-1991-13:53-wht@n4hgf-UNIX and ISC nap() broken; XENIX still wins */ X /*:07-25-1991-12:57-wht@n4hgf-ECU release 3.10 */ X /*:04-16-1991-15:45-wht@n4hgf-gcc cannot use memmove */ *************** *** 49,54 **** --- 51,84 ---- X #include "ecukey.h" X #include X + #if defined(sun) + #undef ECHO + #undef NL0 + #undef NL1 + #undef TAB0 + #undef TAB1 + #undef TAB2 + #undef XTABS + #undef CR0 + #undef CR1 + #undef CR2 + #undef CR3 + #undef FF0 + #undef FF1 + #undef BS0 + #undef BS1 + #undef TOSTOP + #undef FLUSHO + #undef PENDIN + #undef NOFLSH + #include + #endif + + #ifdef SVR4 + # include + extern int hx_flag; + #endif + X char *getenv(); X X extern int errno; *************** *** 627,637 **** X (flag & CREAD ) ? 1 : 0, X (flag & HUPCL ) ? 1 : 0, X (flag & CLOCAL) ? 1 : 0); ! #if defined(RTSFLOW) /* only SCO */ X pprintf(" RTSFLOW:%d CTSFLOW:%d", X (flag & RTSFLOW ) ? 1 : 0, X (flag & CTSFLOW ) ? 1 : 0); X #endif X pprintf("\n"); X X flag = ttt->c_lflag; --- 657,672 ---- X (flag & CREAD ) ? 1 : 0, X (flag & HUPCL ) ? 1 : 0, X (flag & CLOCAL) ? 1 : 0); ! #if defined(RTSFLOW) || defined(SVR4) /* only SCO and SVR4 */ X pprintf(" RTSFLOW:%d CTSFLOW:%d", + #ifdef SVR4 + (hx_flag & RTSXOFF ) ? 1 : 0, + (hx_flag & CTSXON ) ? 1 : 0); + #else X (flag & RTSFLOW ) ? 1 : 0, X (flag & CTSFLOW ) ? 1 : 0); X #endif + #endif X pprintf("\n"); X X flag = ttt->c_lflag; *************** *** 720,725 **** --- 755,761 ---- X ascii_name_to_hex(str3char) X X return value of ascii ctl char name (e.g., "NUL") 0 - 0x1F + support CSI "ascii" 0x9B (for ESC + '[' ANSI) X returns -1 if input not valid X ------------------------------------------------------------------------*/ X ascii_name_to_hex(str3char) *************** *** 728,735 **** X register char *cptr = ascii_ctlstr; X register intval; X ! if(ulcmpb(str3char,"del") < 0) ! return(127); X X for(intval = 0; intval <= SPACE; intval++) X { --- 764,773 ---- X register char *cptr = ascii_ctlstr; X register intval; X ! if((strlen(str3char) == 3) && (ulcmpb(str3char,"del") < 0)) ! return(0x7F); ! if((strlen(str3char) == 3) && (ulcmpb(str3char,"csi") < 0)) ! return(0x9B); X X for(intval = 0; intval <= SPACE; intval++) X { *************** *** 1041,1046 **** --- 1079,1090 ---- X Nap(msec) X long msec; X { + #if defined(sun) + struct timeval timer; + timer.tv_sec = 0; + timer.tv_usec = 1000L * msec; + select(0,0,0,0,&timer); + #else X #if defined(M_XENIX) || defined(WORKING_UNIX_NAP) X return(nap(msec)); X #else *************** *** 1049,1056 **** X if(nap(msec) < 0) X return(-1); X return(msec); ! #endif X } /* end of Nap */ X X /* end of ecuutil.c */ X /* vi: set tabstop=4 shiftwidth=4: */ --- 1093,1118 ---- X if(nap(msec) < 0) X return(-1); X return(msec); ! #endif /* defined(M_XENIX) || defined(WORKING_UNIX_NAP) */ ! #endif /* sun */ ! X } /* end of Nap */ + + /*+------------------------------------------------------------------------- + rdchk(fd) - for systems without it but with FIONREAD + --------------------------------------------------------------------------*/ + #if defined(sun) + int + rdchk(fd) + { + int chars_waiting; + + if(ioctl(fd,FIONREAD,&chars_waiting)) + return(0); + else + return(!!chars_waiting); + } /* end of rdchk */ + #endif X X /* end of ecuutil.c */ X /* vi: set tabstop=4 shiftwidth=4: */ SHAR_EOF true || echo 'restore of PATCH3.01 failed' fi echo 'End of ecu/patch part 2' echo 'File PATCH3.01 is continued in part 3' echo 3 > _shar_seq_.tmp exit 0 exit 0 # Just in case...