Ultrix curses problem

Mohamed_el_Lozy mohamed at hscfvax.harvard.edu
Sun Mar 13 00:31:18 AEST 1988


In a recent posting to comp.unix.ultrix, George Robbins writes:

>The /usr/include/curses.h header file for Ultrix 1.2 contains a kludge
>that is supposed to correct a problem with CRMOD action in curses.
>It's not clear exactly what the situation is, but the "fix" keeps sc
>from working correctly.  I don't know whether the problem exists with
>other releases of Ultrix.
>
>The fix is to include the following lines a the end of sc.h:
>
>#ifdef ultrix
>#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
>

The problem is not confined to sc, but is general.  The same patch had to
be added to make bpatch (recently posted to comp.sources.unix) work under
Ultrix 1.2.

Probably the best fix is for the system administrator to add these lines
to the end of the curses.h file if the problem exists on his system.  The
following shar contains a little program to test out whether the fix is needed,
and whether it works.  The correct output is:

Line 1
Line 2
Line 3

while the bug manifests itself by producing:

Line 1
      Line 2
            Line 3

I have found the bug, fixable as above, in both Ultrix 1.2 and 2.0.  Feedback
from those brave souls who have brought up 2.2 would be most welcome.

-------------------Cut here------------------Cut here-------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	Makefile
#	bug.c
#	fix.h
# This archive created: Sat Mar 12 09:19:47 1988
export PATH; PATH=/bin:$PATH
echo shar: extracting "'Makefile'" '(150 characters)'
if test -f 'Makefile'
then
	echo shar: will not over-write existing file "'Makefile'"
else
sed 's/^	X//' << \SHAR_EOF > 'Makefile'
	Xall:	original modified
	X
	Xoriginal:	bug.o
	X	cc -o original bug.c -lcurses -ltermcap
	X
	Xmodified:	bug.o
	X	cc -o modified -DMODIFIED bug.c -lcurses -ltermcap
SHAR_EOF
if test 150 -ne "`wc -c < 'Makefile'`"
then
	echo shar: error transmitting "'Makefile'" '(should have been 150 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'bug.c'" '(251 characters)'
if test -f 'bug.c'
then
	echo shar: will not over-write existing file "'bug.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'bug.c'
	X#include <curses.h>
	X
	X#ifdef MODIFIED
	X#include "fix.h"
	X#endif MODIFIED
	X
	Xmain()
	X{
	X	initscr();
	X	nonl();
	X
	X	mvaddstr(1, 0, "Line 1");
	X	mvaddstr(2, 0, "Line 2");
	X	mvaddstr(3, 0, "Line 3");
	X	refresh();
	X
	X	mvcur(0, COLS -1, LINES -1, 0);
	X	endwin();
	X	exit();
	X}
SHAR_EOF
if test 251 -ne "`wc -c < 'bug.c'`"
then
	echo shar: error transmitting "'bug.c'" '(should have been 251 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'fix.h'" '(179 characters)'
if test -f 'fix.h'
then
	echo shar: will not over-write existing file "'fix.h'"
else
sed 's/^	X//' << \SHAR_EOF > 'fix.h'
	X#undef nl
	X#undef nonl
	X#define nl()	 (_tty.sg_flags |= CRMOD,_pfast = _rawmode,stty(_tty_ch, &_tty))
	X#define nonl()	 (_tty.sg_flags &= ~CRMOD, _pfast = TRUE, stty(_tty_ch, &_tty))
SHAR_EOF
if test 179 -ne "`wc -c < 'fix.h'`"
then
	echo shar: error transmitting "'fix.h'" '(should have been 179 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0



More information about the Comp.bugs.4bsd.ucb-fixes mailing list