[comp.sources.d] Sc 3.1 and curses

rgb@nscpdc.UUCP (01/28/87)

I got the following letter from Eric Goldman and appreciate  with his comments.
Using curses is like wearing a "KICK ME" sign.  No two versions are the same.
This will NOT go into my normal distribution because folks should be
encouraged to fix <curses.h>

     sc compiled and ran fine on a VAX running 4.3 BSD at my site.  However,
it compiled, but screwed up the nl()/nonl() stuff, when run on my MicroVAX II
running Ultrix 1.2; the same problem occurred on a VAX running vanilla 4.2 BSD.
I traced it to a bug in the nl()/nonl() definitions in /usr/include/curses.h
that appears to exist only in the 4.2 BSD and Ultrix 1.X versions of that file.
I suspect that someone had fixed those definitions on the 4.2 BSD system you
tested it on.  (In fact, on a Sun 2 at my site running Sun UNIX 3.0 [basically
4.2 BSD with Sun enhancements], the nl()/nonl() stuff in /usr/include/curses.h
has been fixed [by Sun].  I haven't tried compiling sc on it yet, however.) 

     The following patch to sc.c is necessary for vanilla 4.2 BSD machines and
Ultrix 1.2 (and presumably Ultrix 1.0 and 1.1) machines: 

*** sc.c	Tue Jan 27 15:54:31 1987
--- sc.c.new	Tue Jan 27 15:55:06 1987
***************
*** 14,19 ****
--- 14,26 ----
  #include <curses.h>
  
+ #ifdef BSD42
+ #undef nl
+ #undef nonl
+ #define nl()	 (_tty.sg_flags |= CRMOD,_pfast = _rawmode,stty(_tty_ch, &_tty))
+ #define nonl()	 (_tty.sg_flags &= ~CRMOD, _pfast = TRUE, stty(_tty_ch, &_tty))
+ #endif
+ 
  #ifdef BSD42
  #include <strings.h>
  #else
  #ifndef SYSIII

Perhaps you should post it to comp.sources.d.  Thanks.

--Eric
-------------------------------------------
  Eric S. Goldman, M.D.
  UCSF School of Medicine
  INET: goldman@cope.ucsf.edu
  UUCP: ...ucbvax!ucsfcgl!cope.ucsf!goldman
  BITNET: GOLDMAN@UCSFCOPE.BITNET

-- 
    Robert Bond 			ihnp4!nsc!nscpdc!rgb
    National Semiconductor		tektronix!nscpdc!rgb