From pa.dec.com!shlump.nac.dec.com!lemans.dec.com!decuac!haven!uflorida!caen!sdd.hp.com!cs.utexas.edu!uunet!sparky!kent Wed Feb 20 15:24:54 PST 1991 Article: 2044 of comp.sources.misc Path: pa.dec.com!shlump.nac.dec.com!lemans.dec.com!decuac!haven!uflorida!caen!sdd.hp.com!cs.utexas.edu!uunet!sparky!kent From: wht@n4hgf (Warren Tucker) Newsgroups: comp.sources.misc Subject: v16i097: ECU 3 Patch 5, Part 1 of 2 Message-ID: <1991Feb11.004440.2689@sparky.IMD.Sterling.COM> Date: 11 Feb 91 00:44:40 GMT Sender: kent@sparky.IMD.Sterling.COM (Kent Landfield) Organization: Sterling Software, IMD Lines: 1619 Approved: kent@sparky.imd.sterling.com X-Checksum-Snefru: 40a64d0d 6618a44f 12036ab4 3d58f753 Submitted-by: wht@n4hgf.Mt-Park.GA.US (Warren Tucker) Posting-number: Volume 16, Issue 97 Archive-name: ecu3/patch05a Patch-To: ecu3: Volume 16, Issue 25-59 .---------------. | ECU 3 PATCH 5 | -----> to apply see "TO USE" below `---------------' 1. Fixed memory leak + bad free in feval_str(). 2. Some common types of procedure string operations have been made faster by redesign of the realloc_esd() function. 3. Octal integer constants were implemented; they may be denoted by prefixing them with "0o". Leading zero octal constants are not supported due to ECUs mutiple use of the same integer constant parser. I thought most people would rather %itos("0200") return 200(10) than 128(10). 4. Many line drivers, particularly FAS, will wait a process closing a tty line until all characters queued for output have been sent. When closing a tty line that has been permanently XOFF'ed by a dead remote system or a noisy XOFF, this can result in a hang. Now, a SIGALRM/setjmp scheme is used to recover from this condition and flush line output before reattempting the close. Five seconds are allowed for the draining to occur. 5. Multiscreen normal and reverse foreground and background colors in effect at the beginning of ecu execution are restored when the program terminates (thanks to staceyc@sco for illuminating the undocumented GIO_IOCTL ioctl; I've wanted to be able to do this for a long time). 6. lamy@glsys.in-berlin.de reported a core dump immediately after the one-line startup message under XENIX 286. Others have had the problem too. I am puzzled -- it is happening in get_home_dir(), which seems rather straightforward. A patch to avoid the problem is included: get the home directory from the environment variable HOME if possible rather than invoke libpwent.a. 7. An embarassing nroff problem was reported by slerner@eingedi. Patches are included for the nroff source. Mr. Lerner also pointed out an obsolete reference to samplproc.man. The models subdirectory contain many sample, even useful, procedures and samplproc.man was discarded a long time ago. If you do not have nroff or the spare CPU cycles to make the manual from nroff source, I'll email you one. Just mail me at wht@n4hgf.Mt-Park.GA.US or emory!n4hgf!wht and put "send ecu305 manual" in the subject line. If I get enough requests, I'll repost it to c.s.m as ecuman305. 8. A make bug in the trial ISC port was fixed in Make.ecu (thanks to jmd@p1so). 9. During non-curses file transfer, the cumulative elapsed time is reported once per complete line of 'RRRTRR..' status. 10. ache@hq.demos.su reported a bug in XENIX utmp handler code. This is a fix for most XENIX systems, but define OLD_WAY in utmpstat.c if you have problems. 11. Sometimes upon adding a new phone entry, it would be marked for redial upon creation. This has been fixed by using calloc() instead malloc(). 12. We seem to be bumping some limits on 286 systems. I added more code to handle more core dumps reported by lamy@glsys.in-berlin.de: somehow newwin() managed to return zero (probably memory alloc fail). The patch to ecuwinutil.c won't fix the problem, but will at least report it and die gracefully, rather than splatter on the pavement with a core dump. Please write me with bug reports and crash info: see below. .--------------------. | NOTES and REQUESTS | `--------------------' 1. I do not have any XENIX system to test with. It is a tribute to SCO orthogonality that 35,000+ line program works so well across 2 CPUs and two operating systems of many minor releases and many versions of development systems. I continue to point this out when I hear SCO-bashers do their thing. However, since s**t does happen, if you are reporting a problem that results in a core dump, please run the following for me (I would APPRECIATE it): % cd where ecu is % ./ecu ----- kaboom ----- % ^Jstty sane^J if needed (probably) % adb ./ecu |& tee to.wht * $x * $c * $r * $q If you are a really industrious one and have sdb and compiled with -g, % sdb ./ecu |& tee -a to.wht % t % q Then % mail -s 'ecu 3.xx core dump' wht@n4hgf.mt-park.ga.us < to.wht 2. ache@hq.demos.su has made some excellent suggestions which would enhance the line handling/choosing algorithms. They will require a change in the phone directory. He suggests I interpret old directory formats, while writing only new ones. The changes are far reaching and I haven't the time now to plug them in, but kudos to him and I'll try to find A Round Tuit. .--------. | TO USE | `--------' To apply this patch, 1. unshar both parts (patch05a and patch05b); the order is unimportant a. overlays these files: doc/_proc.txt ecunumrev.c patchlevel.h utmpstat.c b. produces new files: PATCH5.01 PATCH5.02 2. patch -p < PATCH5.01 3. patch -p < PATCH5.02 4. make 5. su root 6. make install 7. "un-su" 8. cd doc;mm ecu.txt > ecu.man (or write e-mail to me for an update) #!/bin/sh # This is ecu3/patch05a, a shell archive (shar 3.46) # made 02/08/1991 08:39 UTC by wht@n4hgf # Source directory /u1/src/ecu # # existing files WILL be overwritten # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 170 -rw-r--r-- doc/_proc.txt # 1000 -rw-r--r-- ecunumrev.c # 21 -rw-r--r-- patchlevel.h # 3791 -rw-r--r-- utmpstat.c # 32621 -rw-r--r-- PATCH5.01 # # ============= doc/_proc.txt ============== if test ! -d 'doc'; then echo 'x - creating directory doc' mkdir 'doc' fi echo 'x - extracting doc/_proc.txt (Text)' sed 's/^X//' << 'SHAR_EOF' > 'doc/_proc.txt' && X.*s 1 "Procedure Language" X XSample procedures are found in the models subdirectory of the release. X X.so _p_param.txt X X.so _p_cmd.txt X X.so _p_ifunc.txt X X.so _p_sfunc.txt X SHAR_EOF chmod 0644 doc/_proc.txt || echo 'restore of doc/_proc.txt failed' Wc_c="`wc -c < 'doc/_proc.txt'`" test 170 -eq "$Wc_c" || echo 'doc/_proc.txt: original size 170, current size' "$Wc_c" # ============= ecunumrev.c ============== echo 'x - extracting ecunumrev.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'ecunumrev.c' && X/*+----------------------------------------------------------------------- X ecunumrev.c - revision numbers X wht@n4hgf.Mt-Park.GA.US X------------------------------------------------------------------------*/ X/*+:EDITS:*/ X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */ X X#if defined(M_I286) && !defined(NO_SELECT) X#define NO_SELECT X#endif X X#ifdef WHT Xchar *numeric_revision = "wht3.06"; X#else X#ifdef SCO Xchar *numeric_revision = "sco3"; X#else X#ifdef __GNUC__ Xchar *numeric_revision = "gcc3"; X#else Xchar *numeric_revision = "unet3"; X#endif X#endif X#endif X X#if defined(ISC) Xchar *revision_modifier = "-386i wht@n4hgf"; X#else X#if defined(M_UNIX) Xchar *revision_modifier = "-386u wht@n4hgf"; X#else X#if defined(M_I386) X#if defined(NO_SELECT) Xchar *revision_modifier = "-386n wht@n4hgf"; X#else Xchar *revision_modifier = "-386s wht@n4hgf"; X#endif X#else Xchar *revision_modifier = "-286n wht@n4hgf"; X#endif /* M_I386 */ X#endif /* M_UNIX */ X#endif /* ISC */ X X/* vi: set tabstop=4 shiftwidth=4: */ SHAR_EOF chmod 0644 ecunumrev.c || echo 'restore of ecunumrev.c failed' Wc_c="`wc -c < 'ecunumrev.c'`" test 1000 -eq "$Wc_c" || echo 'ecunumrev.c: original size 1000, current size' "$Wc_c" # ============= patchlevel.h ============== echo 'x - extracting patchlevel.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'patchlevel.h' && X#define PATCHLEVEL 5 SHAR_EOF chmod 0644 patchlevel.h || echo 'restore of patchlevel.h failed' Wc_c="`wc -c < 'patchlevel.h'`" test 21 -eq "$Wc_c" || echo 'patchlevel.h: original size 21, current size' "$Wc_c" # ============= utmpstat.c ============== echo 'x - extracting utmpstat.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'utmpstat.c' && X#if defined(SHARE_DEBUG) X#define LOG_UTMP X#endif X/*+------------------------------------------------------------------------- X utmpstat.c - utmp status for XENIX/UNIX line X wht@n4hgf.Mt-Park.GA.US X X Defined functions: X strcmpi(s1,s2) X utmp_status(line) X X--------------------------------------------------------------------------*/ X/*+:EDITS:*/ X/*:02-07-1991-00:28-wht@n4hgf-utmp_status() was really messed up */ X/*:02-03-1991-17:52-ache@hq.demos.su-fix for XENIX utmp handling bug */ X/*:10-16-1990-20:43-wht@n4hgf-add SHARE_DEBUG */ X/*:09-19-1990-19:36-wht@n4hgf-ecu_log_event now gets pid for log from caller */ X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */ X X#include "ecu.h" X#include "ecuhangup.h" X#include "utmpstatus.h" X#include "ecuungetty.h" X#include "dialprog.h" X#include X#include X X#if !defined(ut_name) /* nobody can keep their mind made up; ... */ X#define ut_name ut_user /* ... this is getting verry difficult, very old */ X#endif X Xextern int errno; X Xchar *utmp_file = "/etc/utmp"; Xstruct utmp last_utmp; X X/*+------------------------------------------------------------------------- X strcmpi(s1,s2) - case-insensitive strcmp XIn here rather than ecuutil.c since other executables besides ecu Xuses this module and strcmpi needed there too X--------------------------------------------------------------------------*/ Xint Xstrcmpi(s1,s2) Xregister char *s1; Xregister char *s2; X{ Xregister char c1,c2; X X for ( ; *s1 ; s1++, s2++) X { X if(isupper(*s1)) X c1 = tolower(*s1); X else X c1 = *s1; X if(isupper(*s2)) X c2 = tolower(*s2); X else X c2 = *s2; X if(c1 != c2) X break; X } X return (*s1 - *s2); X} /* end of strcmpi */ X X/*+------------------------------------------------------------------------- X utmp_status(line) - check line status in utmp X'line' is "/dev/ttyxx"-style Xreturns US_ value and global utmp struct last_utmp; X--------------------------------------------------------------------------*/ Xint Xutmp_status(line) Xchar *line; X{ Xregister ufd; Xregister itmp; Xregister status = US_NOTFOUND; X#if defined(LOG_UTMP) Xchar logstr[128]; X#endif X X/* X * crock/bozo alert: X * ut_name ain't but EIGHT characters long, but X * EIGHT characters are often stored, so ya don't get no null X * ut_id ain't but FOUR characters long, but X * FOUR characters are routinely stored, so ya don't get no null X */ Xchar namecopy[sizeof(last_utmp.ut_name) + 1]; Xchar idcopy[sizeof(last_utmp.ut_id) + 1]; X X if((ufd = open(utmp_file,O_RDONLY,755)) < 0) X { X perror(utmp_file); X hangup(HANGUP_LINE_OPEN_ERROR); X } X X while((status == US_NOTFOUND) && X (read(ufd,(char *)&last_utmp,sizeof(last_utmp)) > 0)) X { X if(strcmpi(last_utmp.ut_line,line + 5)) X continue; X X strncpy(namecopy,last_utmp.ut_name,sizeof(last_utmp.ut_name)); X namecopy[sizeof(namecopy) - 1] = 0; X X strncpy(idcopy,last_utmp.ut_id,sizeof(last_utmp.ut_id)); X idcopy[sizeof(idcopy) - 1] = 0; X X if(!strcmp(namecopy,"LOGIN")) X status = US_DIALOUT; X else if(!strcmp(namecopy,"DIALOUT")) X status = US_LOGIN; X else if((!strcmp(namecopy,"uugetty") || !strcmp(namecopy,"getty"))) X { X if(itmp = line_locked(line)) X status = US_DIALOUT; X else X status = US_LOGIN; X } X else if(!kill(last_utmp.ut_pid,0) || (errno != ESRCH)) X status = US_LOGGEDIN; X } X X#if defined(LOG_UTMP) X if(status == US_NOTFOUND) X sprintf(logstr,"UTMP %s: no entry in utmp, status=%d",line,status); X else X { X char *ctime(); X sprintf(logstr,"UTMP %s:%s:%s:%d:status=%d:%s", X namecopy,idcopy,last_utmp.ut_line, X last_utmp.ut_pid,status, ctime(&last_utmp.ut_time)); X logstr[strlen(logstr) - 1] = 0; /* kill NL from ctime() */ X } X ecu_log_event(getpid(),logstr); X#endif X X close(ufd); X return(status); X X} /* end of utmp_status */ X X/* vi: set tabstop=4 shiftwidth=4: */ X/* end of utmpstat.c */ SHAR_EOF chmod 0644 utmpstat.c || echo 'restore of utmpstat.c failed' Wc_c="`wc -c < 'utmpstat.c'`" test 3791 -eq "$Wc_c" || echo 'utmpstat.c: original size 3791, current size' "$Wc_c" # ============= PATCH5.01 ============== echo 'x - extracting PATCH5.01 (Text)' sed 's/^X//' << 'SHAR_EOF' > 'PATCH5.01' && X: X#------------------------------------------------------- X# PATCH5.01 X# created by gendiff x1.03 on 08 Feb 1991 08:23 UTC X#------------------------------------------------------- X*** /u4/src/ecu3.04/Make.ecu Fri Feb 8 03:22:07 1991 X--- Make.ecu Thu Feb 7 18:09:26 1991 X*************** X*** 45,50 X # lint_args.h, please do squirrel away the release copy first X #-------------------------------------------------------------------- X #+:EDITS: X #:01-22-1991-14:33-wht@n4hgf-XENIX calloc/memmove fix X #:01-08-1991-03:26-wht@n4hgf-add ISC support X #:11-28-1990-19:45-wht@n4hgf-improve M_ dependency description X X--- 45,51 ----- X # lint_args.h, please do squirrel away the release copy first X #-------------------------------------------------------------------- X #+:EDITS: X+ #:02-03-1991-15:05-wht@n4hgf-fix error in passing -DISC around X #:01-22-1991-14:33-wht@n4hgf-XENIX calloc/memmove fix X #:01-08-1991-03:26-wht@n4hgf-add ISC support X #:11-28-1990-19:45-wht@n4hgf-improve M_ dependency description X*************** X*** 62,68 X ECULIBDIR = /usr/local/lib/ecu X X #--> leave commented unless you are making for ISC 2.2 X! #ISC = -DISC -DISC22 -O X X #--> leave commented unless you have my morse speaker driver X #MORSE=-DMORSE X X--- 63,69 ----- X ECULIBDIR = /usr/local/lib/ecu X X #--> leave commented unless you are making for ISC 2.2 X! #NONSCO = -DISC -DISC22 -O X X #--> leave commented unless you have my morse speaker driver X #MORSE=-DMORSE X*************** X*** 92,100 X X #make some composites based on above X SYSTEM = `sysdep =M_UNIX UNIX/386 =M_I386 Xenix/386 =M_I286 Xenix/286 =ISC ISC` X! U3C = $(ZI) -Octl -CSON X! X3C = -DDUFF $(ZI) -Ot -CSON -i X! X2C = -DDUFF -M2let32 -LARGE -F 8000 -Ot -i X CURSES = -DM_TERMCAP X CURSES_LIB = -ltcap -ltermlib X COMFLAGS = `sysdep =M_UNIX $(U3C) =M_I386 $(X3C) =M_I286 $(X2C) =ISC $(NONSCO)` X X--- 93,101 ----- X X #make some composites based on above X SYSTEM = `sysdep =M_UNIX UNIX/386 =M_I386 Xenix/386 =M_I286 Xenix/286 =ISC ISC` X! U3C = $(ZI) -Octl -CSON -DLINT_ARGS X! X3C = -DDUFF $(ZI) -Ot -CSON -i -DLINT_ARGS X! X2C = -DDUFF -M2let32 -LARGE -F 8000 -Ot -i -DLINT_ARGS X CURSES = -DM_TERMCAP X CURSES_LIB = -ltcap -ltermlib X COMFLAGS = `sysdep =M_UNIX $(U3C) =M_I386 $(X3C) =M_I286 $(X2C) =ISC $(NONSCO)` X*************** X*** 98,104 X CURSES = -DM_TERMCAP X CURSES_LIB = -ltcap -ltermlib X COMFLAGS = `sysdep =M_UNIX $(U3C) =M_I386 $(X3C) =M_I286 $(X2C) =ISC $(NONSCO)` X! CFLAGS = -DLINT_ARGS $(CURSES) $(CRYPT) $(MORSE) $(NOSEL) $(ADPROC) $(COMFLAGS) X LDSYS = `sysdep =M_UNIX -lmalloc =ISC -lmalloc =M_I386 =M_I286 -SEG 256` X LDFLAGS = $(LDSYS) -lx $(LCRYPT) $(CURSES_LIB) X X X--- 99,105 ----- X CURSES = -DM_TERMCAP X CURSES_LIB = -ltcap -ltermlib X COMFLAGS = `sysdep =M_UNIX $(U3C) =M_I386 $(X3C) =M_I286 $(X2C) =ISC $(NONSCO)` X! CFLAGS = -DECULIBDIR='"$(ECULIBDIR)"' $(CURSES) $(CRYPT) $(MORSE) $(NOSEL) $(ADPROC) $(COMFLAGS) X LDSYS = `sysdep =M_UNIX -lmalloc =ISC -lmalloc =M_I386 =M_I286 -SEG 256` X LDFLAGS = $(LDSYS) -lx $(LCRYPT) $(CURSES_LIB) X X*************** X*** 293,299 X chmod 755 $(LBIN)/ecu $(LBIN)/ecusz $(LBIN)/ecurz $(LBIN)/ecusea X -mkdir $(ECULIBDIR) X -chmod 755 $(ECULIBDIR) X! cd ecuungetty;make CRYPT=$(CRYPT) LCRYPT=$(LCRYPT) ECULIBDIR=$(ECULIBDIR)\ X install X cp help/ecuhelp.data $(ECULIBDIR) X @echo "--------------------------------------------------------------------" X X--- 294,300 ----- X chmod 755 $(LBIN)/ecu $(LBIN)/ecusz $(LBIN)/ecurz $(LBIN)/ecusea X -mkdir $(ECULIBDIR) X -chmod 755 $(ECULIBDIR) X! cd ecuungetty;make CRYPT=$(CRYPT) LCRYPT=$(LCRYPT) ECULIBDIR='"$(ECULIBDIR)"'\ X install X cp help/ecuhelp.data $(ECULIBDIR) X @echo "--------------------------------------------------------------------" X*** /u4/src/ecu3.04/doc/_p_cmd.txt Mon Dec 24 15:15:00 1990 X--- doc/_p_cmd.txt Thu Jan 10 06:13:27 1991 X*************** X*** 1356,1361 X 1 | 1 | 1 X 2 | 1 | 0 X 3 | 0 | 1 X X .DS L X Examples: X X--- 1356,1362 ----- X 1 | 1 | 1 X 2 | 1 | 0 X 3 | 0 | 1 X+ .DE X X .DS L X Examples: X*** /u4/src/ecu3.04/doc/_p_param.txt Wed Aug 15 16:04:00 1990 X--- doc/_p_param.txt Thu Jan 31 16:47:43 1991 X*************** X*** 45,51 X .*s 4 "Constants" X X Integer constants are numeric strings, optionally with an initial X! minus sign, the absolue value of which must be less than 2147483648. X X .*s 4 "Variables" X X X--- 45,62 ----- X .*s 4 "Constants" X X Integer constants are numeric strings, optionally with an initial X! minus sign, the absolute value of which must be less than 2147483648. X! If the constant begins with the string "0x", it is interpreted X! as hexadecimal. Octal, like FORTRAN and COBOL will be dead soon; until X! then, however, octal constants may be denoted by a leading "0o". X! X! .DS L X! Examples: X! 123 --> 123(10) X! 0123 --> 123(10) X! 0x123 --> 291(10) X! 0o123 --> 83(10) X! .DE X X .*s 4 "Variables" X X*** /u4/src/ecu3.04/doc/_top.txt Tue Dec 18 19:09:00 1990 X--- doc/_top.txt Sun Feb 3 18:00:12 1991 X*************** X*** 28,34 X .sp 1i X .ce 100 X Technical Description X! Revision 3.00 X \n(mo/\n(dy/\n(yr X .ce 0 X .ls 1 X X--- 28,34 ----- X .sp 1i X .ce 100 X Technical Description X! Revision 3.05 X \n(mo/\n(dy/\n(yr X .ce 0 X .ls 1 X*** /u4/src/ecu3.04/ecuhangup.h Mon Dec 24 22:29:00 1990 X--- ecuhangup.h Wed Feb 6 12:52:11 1991 X*************** X*** 23,28 X #define HANGUP_PWENT_ERROR 138 X #define HANGUP_USAGE 139 X #define HANGUP_CONFIG_ERROR 140 X #define HANGUP_RCVR_LOGIC_ERROR 142 X X #define HANGUP_INIT_PROC_ERROR 192 X X--- 23,29 ----- X #define HANGUP_PWENT_ERROR 138 X #define HANGUP_USAGE 139 X #define HANGUP_CONFIG_ERROR 140 X+ #define HANGUP_CURSES_ERROR 141 X #define HANGUP_RCVR_LOGIC_ERROR 142 X X #define HANGUP_INIT_PROC_ERROR 192 X*** /u4/src/ecu3.04/ecuicmd.c Fri Feb 8 03:22:29 1991 X--- ecuicmd.c Mon Feb 4 19:03:23 1991 X*************** X*** 9,14 X X ------------------------------------------------------------------------*/ X /*+:EDITS:*/ X /*:01-09-1991-22:31-wht@n4hgf-ISC port */ X /*:12-24-1990-04:31-wht@n4hgf-experimental esio driver command */ X /*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */ X X--- 9,15 ----- X X ------------------------------------------------------------------------*/ X /*+:EDITS:*/ X+ /*:02-04-1991-19:03-wht@n4hgf-add multiscreen tag to stat */ X /*:01-09-1991-22:31-wht@n4hgf-ISC port */ X /*:12-24-1990-04:31-wht@n4hgf-experimental esio driver command */ X /*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */ X*************** X*** 31,36 X extern char rcvr_log_file[]; /* if rcvr_log!= 0,log filename */ X extern int interrupt; X extern int current_ttymode; X extern int errno; X extern int proc_level; X extern int proctrace; X X--- 32,38 ----- X extern char rcvr_log_file[]; /* if rcvr_log!= 0,log filename */ X extern int interrupt; X extern int current_ttymode; X+ extern int tty_is_multiscreen; X extern int errno; X extern int proc_level; X extern int proctrace; X*************** X*** 508,515 X ff(se,"\r\n\r\nDate/time"); X get_tod(4,cmd); X ff(se,": %s\r\n",cmd); X! ff(se,"Console: %s communications line: %s ", X! get_ttyname(),shm->Lline); X ff(se,"%u-%c-1\r\n",shm->Lbaud, X (shm->Lparity) ? to_upper(shm->Lparity) : 'N'); X if(shm->Lmodem_off_hook) X X--- 510,518 ----- X ff(se,"\r\n\r\nDate/time"); X get_tod(4,cmd); X ff(se,": %s\r\n",cmd); X! ff(se,"Console: %s%s communications line: %s ", X! get_ttyname(),(tty_is_multiscreen) ? " (multiscreen)" : "", X! shm->Lline); X ff(se,"%u-%c-1\r\n",shm->Lbaud, X (shm->Lparity) ? to_upper(shm->Lparity) : 'N'); X if(shm->Lmodem_off_hook) X*** /u4/src/ecu3.04/eculine.c Fri Feb 8 03:22:30 1991 X--- eculine.c Thu Feb 7 01:01:01 1991 X*************** X*** 7,12 X lbreak() X lclear_xmtr_xoff() X lclose() X ldraino(inflush_flag) X lflush(flush_type) X lget_xon_xoff(ixon,ixoff) X X--- 7,13 ----- X lbreak() X lclear_xmtr_xoff() X lclose() X+ lclose_failed() X ldraino(inflush_flag) X lflush(flush_type) X lget_xon_xoff(ixon,ixoff) X*************** X*** 35,40 X X ------------------------------------------------------------------------*/ X /*+:EDITS:*/ X /*:01-25-1991-05:57-wht@n4hgf-cringe - lflush was flushing console not line */ X /*:01-09-1991-22:31-wht@n4hgf-ISC port */ X /*:01-09-1991-21:26-wht@n4hgf-don't prototype nap() (ISC port) */ X X--- 36,43 ----- X X ------------------------------------------------------------------------*/ X /*+:EDITS:*/ X+ /*:02-07-1991-01:00-wht@n4hgf-fix code in for lclose retry on remote XOFF */ X+ /*:01-29-1991-14:54-wht@n4hgf-put code in for lclose retry on remote XOFF */ X /*:01-25-1991-05:57-wht@n4hgf-cringe - lflush was flushing console not line */ X /*:01-09-1991-22:31-wht@n4hgf-ISC port */ X /*:01-09-1991-21:26-wht@n4hgf-don't prototype nap() (ISC port) */ X*************** X*** 50,55 X #include X #endif X #endif X X extern int rcvr_pid; X extern int errno; X X--- 53,59 ----- X #include X #endif X #endif X+ #include X X extern int rcvr_pid; X extern int errno; X*************** X*** 833,838 X X } /* end of lopen */ X X /*+----------------------------------------------------------------------- X lclose() X ------------------------------------------------------------------------*/ X X--- 837,857 ----- X X } /* end of lopen */ X X+ static jmp_buf lclose_insurance; X+ X+ /*+------------------------------------------------------------------------- X+ lclose_failed(sig) - see lclose() below X+ --------------------------------------------------------------------------*/ X+ void X+ lclose_failed(sig) X+ int sig; X+ { X+ if(sig != SIGALRM) X+ ff(se,"error %d in lclose_failed: tell wht@n4hgf\r\n",sig); X+ longjmp(lclose_insurance,1); X+ X+ } /* end of lclose_failed */ X+ X /*+----------------------------------------------------------------------- X lclose() - close the line X X*************** X*** 834,840 X } /* end of lopen */ X X /*+----------------------------------------------------------------------- X! lclose() X ------------------------------------------------------------------------*/ X void X lclose() X X--- 853,866 ----- X } /* end of lclose_failed */ X X /*+----------------------------------------------------------------------- X! lclose() - close the line X! X! The FAS driver and others hang on a close until all output for a line X! has drained. Sometimes during a hangup, a noisy XOFF can be received. X! Other changeces for failure include a DCE which drops CTS and leaves X! it off, locking the line up if there is output waiting to go out. X! To make sure the line is actually closed in these situations, a SIGLARM X! handler is used. X ------------------------------------------------------------------------*/ X void X lclose() X*************** X*** 842,847 X if(shm->Liofd < 0) X return; X unlock_tty(); /* kill lock file (writes to line; must go before close) */ X close(shm->Liofd); X shm->Liofd = -1; X X X--- 868,889 ----- X if(shm->Liofd < 0) X return; X unlock_tty(); /* kill lock file (writes to line; must go before close) */ X+ signal(SIGALRM,lclose_failed); X+ alarm(10); X+ if(setjmp(lclose_insurance)) X+ { /* close failed */ X+ signal(SIGALRM,SIG_IGN); X+ ff(se,"\r\nclose failed (remote XOFF?) ... retrying close\r\n"); X+ lclear_xmtr_xoff(); X+ lflush(2); X+ } X+ else X+ { X+ lclear_xmtr_xoff(); X+ ldraino(1); X+ } X+ signal(SIGALRM,SIG_IGN); X+ alarm(0); X close(shm->Liofd); X shm->Liofd = -1; X X*************** X*** 853,858 X void X ltoggle_dtr() X { X close(shm->Liofd); X nap(500L); X shm->Liofd = open(shm->Lline,O_RDWR,0777); X X--- 895,910 ----- X void X ltoggle_dtr() X { X+ signal(SIGALRM,lclose_failed); X+ alarm(10); X+ if(setjmp(lclose_insurance)) X+ { /* close failed */ X+ signal(SIGALRM,SIG_IGN); X+ ff(se,"\r\nclose failed (remote XOFF?) ... retrying close\r\n"); X+ lflush(2); X+ } X+ else X+ ldraino(1); X close(shm->Liofd); X signal(SIGALRM,SIG_IGN); X alarm(0); X*************** X*** 854,859 X ltoggle_dtr() X { X close(shm->Liofd); X nap(500L); X shm->Liofd = open(shm->Lline,O_RDWR,0777); X ioctl(shm->Liofd,TCSETA,(char *)&Ltermio); X X--- 906,913 ----- X else X ldraino(1); X close(shm->Liofd); X+ signal(SIGALRM,SIG_IGN); X+ alarm(0); X nap(500L); X if((shm->Liofd = open(shm->Lline,O_RDWR,0777)) < 0) X { X*************** X*** 855,861 X { X close(shm->Liofd); X nap(500L); X! shm->Liofd = open(shm->Lline,O_RDWR,0777); X ioctl(shm->Liofd,TCSETA,(char *)&Ltermio); X nap(300L); X } /* end of ltoggle_dtr */ X X--- 909,919 ----- X signal(SIGALRM,SIG_IGN); X alarm(0); X nap(500L); X! if((shm->Liofd = open(shm->Lline,O_RDWR,0777)) < 0) X! { X! pprintf("!! Lost line during DTR toggle operation !!\n"); X! hangup(HANGUP_LINE_OPEN_ERROR); X! } X ioctl(shm->Liofd,TCSETA,(char *)&Ltermio); X nap(300L); X } /* end of ltoggle_dtr */ X*** /u4/src/ecu3.04/ecuphone.c Fri Feb 8 03:22:32 1991 X--- ecuphone.c Thu Feb 7 15:57:01 1991 X*************** X*** 58,63 X X --------------------------------------------------------------------------*/ X /*+:EDITS:*/ X /*:01-09-1991-22:31-wht@n4hgf-ISC port */ X /*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */ X X X--- 58,64 ----- X X --------------------------------------------------------------------------*/ X /*+:EDITS:*/ X+ /*:02-05-1991-14:51-wht@n4hgf-calloc PDE instead of malloc */ X /*:01-09-1991-22:31-wht@n4hgf-ISC port */ X /*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */ X X*************** X*** 1327,1333 X } X else X { X! if(!(tpde = (PDE *)malloc(sizeof(PDE )))) X { X dirw_bot_msg("Out of memory -- cannot add new entry"); X return; X X--- 1328,1334 ----- X } X else X { X! if(!(tpde = (PDE *)calloc(1,sizeof(PDE )))) X { X dirw_bot_msg("Out of memory -- cannot add new entry"); X return; X*** /u4/src/ecu3.04/ecusighdl.c Fri Feb 8 03:21:12 1991 X--- ecusighdl.c Wed Feb 6 12:53:12 1991 X*************** X*** 26,31 X X ------------------------------------------------------------------------*/ X /*+:EDITS:*/ X /*:12-18-1990-20:02-wht@n4hgf-add rcvr_death_handler */ X /*:09-19-1990-19:36-wht@n4hgf-ecu_log_event now gets pid for log from caller */ X /*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */ X X--- 26,32 ----- X X ------------------------------------------------------------------------*/ X /*+:EDITS:*/ X+ /*:01-29-1991-12:57-wht@n4hgf-on exit, restore setcolor colors if possible */ X /*:12-18-1990-20:02-wht@n4hgf-add rcvr_death_handler */ X /*:09-19-1990-19:36-wht@n4hgf-ecu_log_event now gets pid for log from caller */ X /*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */ X*************** X*** 195,200 X case HANGUP_USAGE: return("usage"); X case HANGUP_INIT_PROC_ERROR: return("error during initial procedure"); X case HANGUP_CONFIG_ERROR: return("configuration error"); X default: X sprintf(errant,"code %u?",code); X return(errant); X X--- 196,202 ----- X case HANGUP_USAGE: return("usage"); X case HANGUP_INIT_PROC_ERROR: return("error during initial procedure"); X case HANGUP_CONFIG_ERROR: return("configuration error"); X+ case HANGUP_CURSES_ERROR: return("error in curses use"); X default: X sprintf(errant,"code %u?",code); X return(errant); X*************** X*** 273,279 X pperror("errno may not apply, but"); X } X } X! setcolor(colors_normal); X } X else /* we are rcvr */ X { X X--- 275,281 ----- X pperror("errno may not apply, but"); X } X } X! restore_initial_colors(); X } X else /* we are rcvr */ X { X*************** X*** 290,296 X if(errno) X pperror("errno may not apply, but"); X } X! setcolor(colors_normal); X kill(xmtr_pid,SIGHUP); X } X exit(sig); X X--- 292,298 ----- X if(errno) X pperror("errno may not apply, but"); X } X! restore_initial_colors(); X kill(xmtr_pid,SIGHUP); X } X exit(sig); X*** /u4/src/ecu3.04/ecutty.c Fri Feb 8 03:21:12 1991 X--- ecutty.c Mon Feb 4 19:30:40 1991 X*************** X*** 6,11 X _setcolor(clrs) X B_to_timeout_msec(c_cflag,st_rdev) X color_name_to_num(cname) X get_ttymode() X get_ttyname() X ring_bell() X X--- 6,12 ----- X _setcolor(clrs) X B_to_timeout_msec(c_cflag,st_rdev) X color_name_to_num(cname) X+ get_initial_colors() X get_ttymode() X get_ttyname() X ring_bell() X*************** X*** 18,23 X ttyinit(param) X ttymode(arg) X X --------------------------------------------------------------------------*/ X /*+:EDITS:*/ X /*:12-01-1990-14:33-wht@n4hgf-more non-ansi - fkey mapping with nonansi.c */ X X--- 19,44 ----- X ttyinit(param) X ttymode(arg) X X+ In SCO versions, ECU keeps the the state of the normal and X+ reverse video foreground and background colors in a 32-bit value: X+ X+ 00000000001111111111222222222233 X+ 01234567890123456789012345678901 X+ 0000|--|0000|--|0000|--|0000|--| X+ fg bk fg bk X+ reverse normal X+ X+ The color values are per the SCO extended color definitons: X+ X+ black 0 gray 8 X+ blue 1 lt_blue 9 X+ green 2 lt_green 10 X+ cyan 3 lt_cyan 11 X+ red 4 lt_red 12 X+ magenta 5 lt_magenta 13 X+ brown 6 yellow 14 X+ white 7 hi_white 15 X+ X --------------------------------------------------------------------------*/ X /*+:EDITS:*/ X /*:01-29-1991-14:03-wht@n4hgf-more time for ESC vs fkey discrimination */ X*************** X*** 20,25 X X --------------------------------------------------------------------------*/ X /*+:EDITS:*/ X /*:12-01-1990-14:33-wht@n4hgf-more non-ansi - fkey mapping with nonansi.c */ X /*:11-28-1990-15:56-wht@n4hgf-add non-ansi terminal support */ X /*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */ X X--- 41,48 ----- X X --------------------------------------------------------------------------*/ X /*+:EDITS:*/ X+ /*:01-29-1991-14:03-wht@n4hgf-more time for ESC vs fkey discrimination */ X+ /*:01-29-1991-13:44-wht@n4hgf-load colors_normal w/ioctl GIO_ATTR if M_UNIX */ X /*:12-01-1990-14:33-wht@n4hgf-more non-ansi - fkey mapping with nonansi.c */ X /*:11-28-1990-15:56-wht@n4hgf-add non-ansi terminal support */ X /*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */ X*************** X*** 108,114 X long TOmsec = 20L; /* timeout on waiting for char after ESC */ X X ulong colors_current = 0x04070A00L; X! ulong colors_normal = 0x04070A00L; /* lt_green/black red/white */ X ulong colors_success = 0x07000A00L; /* lt_green/black red/white */ X ulong colors_alert = 0x0E000E00L; /* yellow */ X ulong colors_error = 0x04000400L; /* red */ X X--- 131,138 ----- X long TOmsec = 20L; /* timeout on waiting for char after ESC */ X X ulong colors_current = 0x04070A00L; X! ulong colors_normal = 0x04070A00L; /* default lt_green/black red/white */ X! ulong colors_initial = 0x04070A00L; /* default initial colors */ X ulong colors_success = 0x07000A00L; /* lt_green/black red/white */ X ulong colors_alert = 0x0E000E00L; /* yellow */ X ulong colors_error = 0x04000400L; /* red */ X*************** X*** 127,133 X ushort c_cflag; X ushort st_rdev; X { X! long ms = 0L; X X /* if multiscreen, 20 msec is pu-lenty */ X X X--- 151,157 ----- X ushort c_cflag; X ushort st_rdev; X { X! long ms; X X /* if multiscreen, 20 msec is pu-lenty */ X if(tty_is_multiscreen) X*************** X*** 130,139 X long ms = 0L; X X /* if multiscreen, 20 msec is pu-lenty */ X! X! if(((st_rdev & 0xFF00) == (tty01.st_rdev & 0xFF00)) || X! ((st_rdev & 0xFF00) == (console.st_rdev & 0xFF00)) ) X! { X return(20L); X } X X X--- 154,160 ----- X long ms; X X /* if multiscreen, 20 msec is pu-lenty */ X! if(tty_is_multiscreen) X return(20L); X X /* make network/xterm/pty sweat, but don't make as many mistakes */ X*************** X*** 135,141 X ((st_rdev & 0xFF00) == (console.st_rdev & 0xFF00)) ) X { X return(20L); X- } X X /* baud rate fiddling */ X X X--- 156,161 ----- X /* if multiscreen, 20 msec is pu-lenty */ X if(tty_is_multiscreen) X return(20L); X X /* make network/xterm/pty sweat, but don't make as many mistakes */ X if(((st_rdev & 0xFF00) == (ttyp0.st_rdev & 0xFF00))) X*************** X*** 137,143 X return(20L); X } X X! /* baud rate fiddling */ X X switch(c_cflag & CBAUD) X { X X--- 157,165 ----- X if(tty_is_multiscreen) X return(20L); X X! /* make network/xterm/pty sweat, but don't make as many mistakes */ X! if(((st_rdev & 0xFF00) == (ttyp0.st_rdev & 0xFF00))) X! return(100L); X X /* baud rate fiddling */ X switch(c_cflag & CBAUD) X*************** X*** 139,144 X X /* baud rate fiddling */ X X switch(c_cflag & CBAUD) X { X /* char times * time/char */ X X--- 161,167 ----- X if(((st_rdev & 0xFF00) == (ttyp0.st_rdev & 0xFF00))) X return(100L); X X+ /* baud rate fiddling */ X switch(c_cflag & CBAUD) X { X /* char times * time/char */ X*************** X*** 141,156 X X switch(c_cflag & CBAUD) X { X! /* char times * time/char */ X! case B110: ms = 3 * 100; X! case B300: ms = 3 * 33; X! case B600: ms = 3 * 16; X! case B1200: ms = 3 * 8; X! case B2400: ms = 3 * 4; X! case B4800: ms = 8 * 2; X! case B9600: ms = 8 * 1; X! case EXTA: ms = 8 * 1; X! case EXTB: ms = 8 * 1; X } X X X X--- 164,177 ----- X /* baud rate fiddling */ X switch(c_cflag & CBAUD) X { X! /* char times * time/char */ X! case B110: ms = 10 * 100; X! case B300: ms = 10 * 33; X! case B600: ms = 10 * 16; X! case B1200: ms = 10 * 8; X! case B2400: ms = 10 * 4; X! default: /* many character times for packetized ... */ X! ms = 100L; /* ... modems used for console */ X } X return(ms); X X*************** X*** 152,166 X case EXTA: ms = 8 * 1; X case EXTB: ms = 8 * 1; X } X- X- X- /* make network/xterm/pty sweat, but don't make as many mistakes */ X- X- if(((st_rdev & 0xFF00) == (ttyp0.st_rdev & 0xFF00)) && (ms < 80L)) X- ms = 80L; X- else if(ms < 20L) /* enforce minimum time for obvious reasons + */ X- ms = 20L; /* make sure we don't incur the UNIX nap() bug */ X- X return(ms); X X } /* end of B_to_timeout_msec */ X X--- 173,178 ----- X default: /* many character times for packetized ... */ X ms = 100L; /* ... modems used for console */ X } X return(ms); X X } /* end of B_to_timeout_msec */ X*************** X*** 287,292 X } /* end of setcolor_internal */ X X /*+------------------------------------------------------------------------- X read_colors_file() X --------------------------------------------------------------------------*/ X void X X--- 299,365 ----- X } /* end of setcolor_internal */ X X /*+------------------------------------------------------------------------- X+ restore_initial_colors() - under UNIX, restore color scheme at execution X+ X+ Under non-SCO-S5R3, don't have initial color, so use colors_normal X+ --------------------------------------------------------------------------*/ X+ void X+ restore_initial_colors() X+ { X+ #ifdef M_UNIX X+ setcolor(colors_initial); X+ #else X+ setcolor(colors_normal); X+ #endif X+ } /* end of restore_initial_colors */ X+ X+ /*+------------------------------------------------------------------------- X+ get_initial_colors() - read colors at time of execution from driver X+ X+ 00000000001111111111222222222233 X+ 01234567890123456789012345678901 X+ 0000|--|0000|--|0000|--|0000|--| X+ fg bk fg bk X+ reverse normal X+ X+ Thanks for the G2 on this to staceyc@sco.COM (Stacey Campbell) X+ --------------------------------------------------------------------------*/ X+ #if defined(M_UNIX) X+ void X+ get_initial_colors() X+ { X+ #if !defined(GIO_ATTR) X+ #define GIO_ATTR ('a' << 8) | 0 /* Ioctl call for current attribute */ X+ #endif X+ uint cur_attr; X+ ulong fgnd; X+ ulong bgnd; X+ X+ colors_normal = 0L; X+ X+ /* X+ * first, reverse, so we can end up with normal colors selected X+ */ X+ write(1,"\033[7m",4); /* select reverse */ X+ cur_attr = (uint)ioctl(0, GIO_ATTR, 0); X+ fgnd = (ulong)cur_attr & 0x0F; X+ bgnd = (ulong) (cur_attr >> 4) & 0x0F; X+ colors_normal |= (fgnd << 24) | (bgnd << 16); X+ X+ /* X+ * now, normal X+ */ X+ write(1,"\033[m",3); /* select normal */ X+ cur_attr = (uint)ioctl(0, GIO_ATTR, 0); X+ fgnd = (ulong)cur_attr & 0x0F; X+ bgnd = (ulong) (cur_attr >> 4) & 0x0F; X+ colors_normal |= (fgnd << 8) | bgnd; X+ colors_initial = colors_normal; /* save for restore_initial_colors */ X+ X+ } /* end of get_initial_colors */ X+ #endif X+ X+ /*+------------------------------------------------------------------------- X read_colors_file() X --------------------------------------------------------------------------*/ X void X*************** X*** 303,308 X if(tty_not_char_special) X return; X X get_home_dir(s128); X strcat(s128,"/.ecu/colors"); X if(access(s128,4)) X X--- 376,385 ----- X if(tty_not_char_special) X return; X X+ #if defined(M_UNIX) X+ get_initial_colors(); X+ #endif X+ X get_home_dir(s128); X strcat(s128,"/.ecu/colors"); X if(access(s128,4)) X*************** X*** 380,386 X return; X } X X! /* save initial tty state */ X ioctl(TTYIN,TCGETA,(char *)&tty_termio_at_entry); X TOmsec = B_to_timeout_msec(tty_termio_at_entry.c_cflag,tty_stat.st_rdev); X X X--- 457,479 ----- X return; X } X X! /* X! * use color if we are on a multiscreen and video supports it X! * also, remember whether or not we are on a multiscreen X! * (I ain't proud of this beyond being a valiant attempt) X! */ X! use_colors = 0; X! if( ((itmp = ioctl(TTYIN,CONS_GET,&monitor_type)) >= 0) && X! (use_colors = (monitor_type != MONO))) X! { X! read_colors_file(); X! setcolor(colors_normal); X! } X! tty_is_multiscreen = !(itmp < 0); X! X! /* X! * save initial tty state X! */ X ioctl(TTYIN,TCGETA,(char *)&tty_termio_at_entry); X TOmsec = B_to_timeout_msec(tty_termio_at_entry.c_cflag,tty_stat.st_rdev); X X*************** X*** 441,466 X if(tcap_COLS > 80) X tcap_COLS = 80; X LINESxCOLS = tcap_LINES * tcap_COLS; X- X- /* X- * use color if we are on a multiscreen and video supports it X- * also, remember whether or not we are on a multiscreen X- * (I ain't proud of this beyond being a valiant attempt) X- */ X- tty_is_multiscreen = X- ((tty_stat.st_rdev & 0xFF00) == (tty01.st_rdev & 0xFF00)) || X- ((tty_stat.st_rdev & 0xFF00) == (console.st_rdev & 0xFF00)); X- use_colors = 0; X- itmp = 0; X- if(tty_is_multiscreen && X- ((itmp = ioctl(TTYIN,CONS_GET,&monitor_type)) >= 0) && X- (use_colors = (monitor_type != MONO))) X- { X- read_colors_file(); X- setcolor(colors_normal); X- } X- if(itmp < 0) X- tty_is_multiscreen = 0; X X } /* end of ttyinit */ X X X--- 534,539 ----- X if(tcap_COLS > 80) X tcap_COLS = 80; X LINESxCOLS = tcap_LINES * tcap_COLS; X X } /* end of ttyinit */ X X*** /u4/src/ecu3.04/ecuutil.c Fri Feb 8 03:22:34 1991 X--- ecuutil.c Sun Feb 3 14:23:21 1991 X*************** X*** 31,36 X X ------------------------------------------------------------------------*/ X /*+:EDITS:*/ X /*:01-25-1991-16:23-wht@n4hgf-source name wrong in headers */ X /*:12-26-1990-14:32-wht@n4hgf-use memmove or Duff's Device in mem_cpy() */ X /*:12-04-1990-00:58-wht@n4hgf-allow alternating between str/arg_token */ X X--- 31,37 ----- X X ------------------------------------------------------------------------*/ X /*+:EDITS:*/ X+ /*:02-03-1991-14:23-wht@n4hgf-hack workaround for get_home_dir under x286 */ X /*:01-25-1991-16:23-wht@n4hgf-source name wrong in headers */ X /*:12-26-1990-14:32-wht@n4hgf-use memmove or Duff's Device in mem_cpy() */ X /*:12-04-1990-00:58-wht@n4hgf-allow alternating between str/arg_token */ X*************** X*** 736,741 X { X static char home_directory[256] = ""; X struct passwd *pwent; X X if(home_directory[0]) X { X X--- 737,743 ----- X { X static char home_directory[256] = ""; X struct passwd *pwent; X+ char *cptr; X X if(home_directory[0]) X { X*************** X*** 740,745 X if(home_directory[0]) X { X strcpy(home_dir,home_directory); X return(0); X } X X X--- 742,754 ----- X if(home_directory[0]) X { X strcpy(home_dir,home_directory); X+ return(0); X+ } X+ X+ if(cptr = getenv("HOME")) /* x286 seems to blow up ... */ X+ { /* ... in pwent code ... hmmm */ X+ strcpy(home_directory,cptr); X+ strcpy(home_dir,cptr); X return(0); X } X X*** /u4/src/ecu3.04/ecuwinutil.c Fri Feb 8 03:20:15 1991 X--- ecuwinutil.c Wed Feb 6 13:27:14 1991 X*************** X*** 97,103 X { X fprintf(stderr,"curses features unavailable\r\n"); X abort(); X! hangup(HANGUP_TTYIN_READ_ERROR); X } X X ttymode_before_window_start = get_ttymode(); X X--- 97,103 ----- X { X fprintf(stderr,"curses features unavailable\r\n"); X abort(); X! hangup(HANGUP_CURSES_ERROR); X } X X ttymode_before_window_start = get_ttymode(); X*************** X*** 105,111 X if(!initscr()) X { X fprintf(stderr,"curses init failure ... check terminal type\r\n"); X! hangup(HANGUP_USAGE); X } X savetty(); raw(); noecho(); nonl(); clear(); X #if defined(M_TERMINFO) X X--- 105,111 ----- X if(!initscr()) X { X fprintf(stderr,"curses init failure ... check terminal type\r\n"); X! hangup(HANGUP_CURSES_ERROR); X } X savetty(); raw(); noecho(); nonl(); clear(); X #if defined(M_TERMINFO) X*************** X*** 218,223 X X if(nwin) X window_setup(nwin,title,title_x); X return(nwin); X } /* end of window_create */ X X X--- 218,228 ----- X X if(nwin) X window_setup(nwin,title,title_x); X+ else X+ { X+ fprintf(stderr,"\r\ncurses error: cannot create new window\r\n"); X+ hangup(HANGUP_CURSES_ERROR); X+ } X return(nwin); X } /* end of window_create */ X X*** /u4/src/ecu3.04/esdutil.c Mon Dec 24 22:37:00 1990 X--- esdutil.c Thu Jan 31 16:19:44 1991 X*************** X*** 34,39 X This is old code; give me a break X -----------------------------------------------------------------*/ X /*+:EDITS:*/ X /*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */ X X #include X X--- 34,40 ----- X This is old code; give me a break X -----------------------------------------------------------------*/ X /*+:EDITS:*/ X+ /*:01-31-1991-14:49-wht@n4hgf-rework realloc_esd for speed X /*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */ X X #include "ecu.h" X*************** X*** 36,42 X /*+:EDITS:*/ X /*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */ X X- #include X #include "ecu.h" X #include "ecuerror.h" X #include "esd.h" X X--- 37,42 ----- X /*:01-31-1991-14:49-wht@n4hgf-rework realloc_esd for speed X /*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */ X X #include "ecu.h" X #include "ecuerror.h" X #include "esd.h" X*************** X*** 115,120 X X /*+----------------------------------------------------------------------- X esdptr = realloc_esd(maxcb) - realloc an esd buffer X ------------------------------------------------------------------------*/ X int X realloc_esd(tesd,maxcb) X X--- 115,124 ----- X X /*+----------------------------------------------------------------------- X esdptr = realloc_esd(maxcb) - realloc an esd buffer X+ X+ may only be used to enlarge an esd buffer X+ this used to use realloc(), which did a lot of unnecessary copying X+ also no more abnormal program termination on memory failure X ------------------------------------------------------------------------*/ X int X realloc_esd(tesd,maxcb) X*************** X*** 122,127 X register maxcb; /* desired maxcb */ X { X register actual_cb; X X if(!tesd) X return(eInternalLogicError); X X--- 126,132 ----- X register maxcb; /* desired maxcb */ X { X register actual_cb; X+ char *newpb; X X if(!tesd || (tesd->maxcb > maxcb)) X return(eInternalLogicError); X*************** X*** 123,129 X { X register actual_cb; X X! if(!tesd) X return(eInternalLogicError); X X /* we get an extra character to ensure room for null past maxcb */ X X--- 128,134 ----- X register actual_cb; X char *newpb; X X! if(!tesd || (tesd->maxcb > maxcb)) X return(eInternalLogicError); X X /* we get an extra character to ensure room for null past maxcb */ X*************** X*** 131,143 X if(actual_cb & 1) /* even allocation */ X ++actual_cb; X X! if(!(tesd->pb = realloc(tesd->pb,actual_cb))) X! { X! errno = ENOMEM; X! ff(se,"\r\n\r\nMEMORY REALLOC FAILED. FATAL ERROR. SORRY.\r\n"); X! hangup(HANGUP_XMTR_LOGIC_ERROR); X! } X! X return(0); X X } /* end of realloc_esd */ X X--- 136,148 ----- X if(actual_cb & 1) /* even allocation */ X ++actual_cb; X X! if(!(newpb = malloc(actual_cb))) X! return(eNoMemory); X! if(tesd->cb) X! memcpy(newpb,tesd->pb,tesd->cb); X! free(tesd->pb); X! tesd->pb = newpb; X! tesd->maxcb = actual_cb; X return(0); X X } /* end of realloc_esd */ SHAR_EOF chmod 0644 PATCH5.01 || echo 'restore of PATCH5.01 failed' Wc_c="`wc -c < 'PATCH5.01'`" test 32621 -eq "$Wc_c" || echo 'PATCH5.01: original size 32621, current size' "$Wc_c" exit 0 exit 0 # Just in case... -- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM Sterling Software, IMD UUCP: uunet!sparky!kent Phone: (402) 291-8300 FAX: (402) 291-4362 Please send comp.sources.misc-related mail to kent@uunet.uu.net.