DataMuseum.dk

Presents historical artifacts from the history of:

Commodore CBM-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Commodore CBM-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦cd662dfa5⟧ TextFile

    Length: 1240 (0x4d8)
    Types: TextFile
    Notes: UNIX file
    Names: »wind.c«

Derivation

└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
    └─⟦f4b8d8c84⟧ UNIX V7 Filesystem
        └─ ⟦this⟧ »unimenu/src/menu/wind.c« 

TextFile

/*
 * interface to some window ioctl functions
 */
#ifndef LINT
static	char	sccs_id[] = "@(#)wind.c	1.2 15:38:42 4/6/85";
#endif

#include	"defs.h"

wr_blck(buf, row, col, nrows, ncols)
int	*buf;
int	row;
int	col;
int	nrows;
int	ncols;
{
union	wioctl	wbuf;

	wbuf.blockinfo.w_toprow = row;
	wbuf.blockinfo.w_leftcol = col;
	wbuf.blockinfo.w_nbrrows = nrows;
	wbuf.blockinfo.w_nbrcols = ncols;

	if ( ioctl(1, WR_BLOCK, &wbuf) == -1 )
	{
		pcurs(1, 1);
		printf("wr_block failed: %d %d %d %d", row, col, nrows, ncols);
		return (-1);
	}

	write(1, buf, (nrows * ncols) * sizeof(int));
	return (0);
}

dump_win(wbuf)
WINDOW	*wbuf;
{
char	*d, *s;
int	i;
union	wioctl	warg;

	if ( ioctl(1, DUMPWIN, &warg) == -1 )
		return (-1);

	d = (char *) wbuf;
	s = (char *) &(warg.wininfo);

	for ( i = 0; i < sizeof(WINDOW); i++ )
		*d++ = *s++;

	return (0);
}

swap_attr(row, col, nrows, ncols)
int	row;
int	col;
int	nrows;
int	ncols;
{
union	wioctl	warg;

	warg.blockinfo.w_toprow = row;
	warg.blockinfo.w_leftcol = col;
	warg.blockinfo.w_nbrrows = nrows;
	warg.blockinfo.w_nbrcols = ncols;
	
	if ( ioctl(1, SWPATTR, &warg) == -1)
	{
		printf("window call failed: SWPATTR %d %d %d %d", 
			row, col, nrows, ncols);
		return ( -1 );
	}
	return (0);
}