🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9371

Abusing `curses' WINDOW structure

#9371
From: Brian Yost
Date: Sat, 20 Sep 1986 05:19
37 lines
1611 bytes
I have a question concerning termcap -vs- terminfo implementations
of the curses library.

I'm writing a program which uses the curses library, and need to
include a "print screen" type of utility.  Rather than reproducing
my display logic in order to print a text file image, I was thinking
of simply copying the screen from stdscr->_y directly into my textfile
(adding newlines where appropriate).  Something along these lines:

	PrintScr(f, win)
	FILE *f;
	WINDOW *win;
	{
		register short i, j;

		for (i = 0; i < win->_begy; i++)
			fputc('\n', f);

		for (i = 0; i < win->_maxy; i++) {
			for (j = 0; j < win->_begx; j++)
				fputc(' ', f);
			for (j = 0; j < win->_maxx; j++)
				fputc(win->_y[i][j], f);
			fputc('\n', f);
		}
		fflush(f);
	}

Now, my machine uses termcap, and this seems to work OK.  The question
is, is the WINDOW structure different in the terminfo implementation?
And if so, can the routine above be rewritten and made to work?

Please reply by mail, and thanks.

Brian Yost		 {clyde,topaz}!infopro!bty!yost

``This is a sic (sic) joke.''
Technical Details
Message-ID: <314@bty.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!lll-lcc!qantel!ihnp4!cbatt!clyde!burl!ulysses!bellcore!whuxcc!infopro!bty!yost

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!lll-lcc!qantel!ihnp4!cbatt!clyde!burl!ulysses!bellcore!whuxcc!infopro!bty!yost
From: yost@bty.UUCP (Brian Yost)
Newsgroups: net.lang.c
Subject: Abusing `curses' WINDOW structure
Message-ID: <314@bty.UUCP>
Date: Sat, 20-Sep-86 01:19:49 EDT
Article-I.D.: bty.314
Posted: Sat Sep 20 01:19:49 1986
Date-Received: Tue, 23-Sep-86 22:17:12 EDT
Distribution: net
Organization: BTY, Inc., Rockaway, NJ
Lines: 37