From: sources@anomaly.sbs.risc.net
Subject: v01i124 - u386mon v3.40, SCO UNIX Performance Monitor - Part 04/06
Reply-To: sources@anomaly.sbs.risc.net
Organization: The Rhode Island Internet Systems Cooperative Network
Date: Mon, 14 Sep 1992 14:18:52 GMT
Followup-To: biz.sco.general


#!/bin/sh
# this is part.04 (part 4 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file detail.c continued
#
if test ! -r shar3_seq_.tmp; then
	echo "Please unpack part 1 first!"
	exit 1
fi
(read Scheck
 if test "$Scheck" != 4; then
	echo "Please unpack part $Scheck next!"
	exit 1
 else
	exit 0
 fi
) < shar3_seq_.tmp || exit 1
echo "x - Continuing file detail.c"
sed 's/^X//' << 'SHAR_EOF' >> detail.c &&
X#if defined(M_UNIX)
X		case 's':
X			if(detpanel_type == DPT_SIO)
X				break;
X			if(detpanel_type != DPT_NONE)
X				detpanel_destroy();
X			detpanel_sio_init();
X			detpanel_type = DPT_SIO;
X			break;
X#if defined(SCO322)
X		case 'w':
X			if(detpanel_type == DPT_WD)
X				break;
X			if(detpanel_type != DPT_NONE)
X				detpanel_destroy();
X			detpanel_wd_init();
X			detpanel_type = DPT_WD;
X			break;
X#endif
X#endif
X
X	}
X}	/* end of detail_panel_cmd */
X
X/*+-------------------------------------------------------------------------
X	detail_panel_update()
X--------------------------------------------------------------------------*/
Xvoid
Xdetail_panel_update()
X{
X	switch(detpanel_type)
X	{
X		case DPT_PS:
X		case DPT_PS_LONG:
X			detpanel_ps_update();
X			break;
X		case DPT_EXTRA:
X			detpanel_extra_update();
X			break;
X#if defined(M_UNIX)
X		case DPT_SIO:
X			detpanel_sio_update();
X			break;
X#endif
X#if defined(M_UNIX) || defined (SYSVR31)
X		case DPT_STREAMS:
X			detpanel_streams_update();
X			break;
X		case DPT_TABLE:
X			detpanel_table_update();
X			break;
X#if defined(SCO322)
X		case DPT_WD:
X			detpanel_wd_update();
X			break;
X#endif
X#endif
X	}
X}	/* end of detail_panel_update */
X
X/*+-------------------------------------------------------------------------
X	detail_init()
X--------------------------------------------------------------------------*/
Xvoid
Xdetail_init()
X{
X	det_proc_init();	/* see det_proc.c */
X#if defined(M_UNIX) || defined(SVR31)
X	init_stream();
X	init_table();
X#ifdef SCO322
X	init_wd();
X#endif
X#endif
X}	/* end of detail_init */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of detail.c */
SHAR_EOF
echo "File detail.c is complete" &&
# ============= disputil.c ==============
echo "x - extracting disputil.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > disputil.c &&
X/*+-------------------------------------------------------------------------
X	disputil.c - u386mon display utilities
X
X  Defined functions:
X	clear_area(win,y,x,len)
X	clear_area_char(win,y,x,len,fillchar)
X	disp_info_int(win,label,fmt,value)
X	disp_info_long(win,label,fmt,value)
X	disp_msg(cp,msg)
X	disp_static_int(win,label,fmt,value)
X	disp_static_long(win,label,fmt,value)
X	mkpanel(rows,cols,tly,tlx,userp)
X	pflush()
X	wperror(win,desc)
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-01-1991-23:34-wht@n4hgf-release 3.40 source control point */
X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
X/*:07-10-1990-19:06-root@n4hgf-redesign attributes/color pairs */
X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
X/*:06-17-1990-15:15-wht-creation */
X
X#include "config.h"
X#define M_TERMINFO
X#include <curses.h>
X#undef timeout
X#undef reg     /* per nba@sysware.dk */
X#ifdef NATIVE_PANELS
X# include <panel.h>
X#else
X# include "libpanel.h"
X#endif
X#include <sys/types.h>
X#include "u386mon.h"
X
X#ifdef COLOR_PAIR
Xlong color_attr[] =
X{
X	COLOR_PAIR(0),
X	COLOR_PAIR(cpINFO),
X	COLOR_PAIR(cpREVERSE),
X	COLOR_PAIR(cpBANWARN),
X	COLOR_PAIR(cpLOW) | A_BOLD,
X	COLOR_PAIR(cpMED) | A_BOLD,
X	COLOR_PAIR(cpHIGH),
X	COLOR_PAIR(cpBANNER),
X	COLOR_PAIR(cpLIT),
X	0
X};
X#endif
X
Xlong mono_attr[] =
X{
X	0,						/* 0 */
X	0,						/* cpINFO */
X	A_REVERSE,				/* cpREVERSE */
X	A_BOLD,			 		/* cpBANWARN */
X	0,						/* cpLOW */
X	A_UNDERLINE,			/* cpMED */
X	A_BLINK,				/* cpHIGH */
X	A_REVERSE,				/* cpBANNER */
X	A_DIM,					/* cpLIT */
X};
X
Xextern WINDOW *wdet, *wscr;
X
X/*+-------------------------------------------------------------------------
X	clear_area_char(win,y,x,len,fillchar)
X--------------------------------------------------------------------------*/
Xvoid
Xclear_area_char(win,y,x,len,fillchar)
XWINDOW *win;
Xint y;
Xint x;
Xint len;
Xu_char fillchar;
X{
X	wmove(win,y,x);
X	while(len-- > 0)
X		waddch(win,(chtype)fillchar);
X	wmove(win,y,x);
X
X}	/* end of clear_area_char */
X
X/*+-------------------------------------------------------------------------
X	clear_area(win,y,x,len)
X--------------------------------------------------------------------------*/
Xvoid
Xclear_area(win,y,x,len)
XWINDOW *win;
Xint y;
Xint x;
Xint len;
X{
X	clear_area_char(win,y,x,len,' ');
X}	/* end of clear_area_char */
X
X/*+-------------------------------------------------------------------------
X	pflush() - do update_panels() and doupdate()
X--------------------------------------------------------------------------*/
Xvoid
Xpflush()
X{
X	update_panels();
X	curs_set(0);
X	doupdate();
X	curs_set(1);
X}	/* end of pflush */
X
X/*+-------------------------------------------------------------------------
X	wperror(win,desc)
X--------------------------------------------------------------------------*/
Xvoid
Xwperror(win,desc)
XWINDOW *win;
Xchar *desc;
X{
Xextern int errno;
Xextern int sys_nerr;
Xextern char *sys_errlist[];
X
X	waddstr(win,desc);
X	waddstr(win,": ");
X	if(errno < sys_nerr)
X		waddstr(win,sys_errlist[errno]);
X	else
X		wprintw(win,"error %u",errno);
X
X}	/* end of wperror */
X
X/*+-------------------------------------------------------------------------
X	mkpanel(rows,cols,tly,tlx,userp) - alloc win and pan and associate them
X--------------------------------------------------------------------------*/
XPANEL *
Xmkpanel(rows,cols,tly,tlx,userp)
Xint rows;
Xint cols;
Xint tly;
Xint tlx;
Xchar *userp;
X{
XWINDOW *win = newwin(rows,cols,tly,tlx);
XPANEL *pan;
X
X	if(!win)
X		return((PANEL *)0);
X	if(pan = new_panel(win))
X	{
X		set_panel_userptr(pan,userp);
X		return(pan);
X	}
X	delwin(win);
X	return((PANEL *)0);
X}	/* end of mkpanel */
X
X/*+-------------------------------------------------------------------------
X	disp_info_long(win,label,fmt,value)
X--------------------------------------------------------------------------*/
Xvoid
Xdisp_info_long(win,label,fmt,value)
XWINDOW *win;
Xchar *label;
Xchar *fmt;
Xlong value;
X{
X	use_cp(win,cpLIT);
X	waddstr(win,label);
X	use_cp(win,cpINFO);
X	wprintw(win,fmt,value);
X}	/* end of disp_info_long */
X
X/*+-------------------------------------------------------------------------
X	disp_info_int(win,label,fmt,value)
X--------------------------------------------------------------------------*/
Xvoid
Xdisp_info_int(win,label,fmt,value)
XWINDOW *win;
Xchar *label;
Xchar *fmt;
Xint value;
X{
X	use_cp(win,cpLIT);
X	waddstr(win,label);
X	use_cp(win,cpINFO);
X	wprintw(win,fmt,value);
X}	/* end of disp_info_int */
X
X/*+-------------------------------------------------------------------------
X	disp_static_long(win,label,fmt,value)
X--------------------------------------------------------------------------*/
Xvoid
Xdisp_static_long(win,label,fmt,value)
XWINDOW *win;
Xchar *label;
Xchar *fmt;
Xlong value;
X{
X	use_cp(win,cpLIT);
X	waddstr(win,label);
X	wprintw(win,fmt,value);
X}	/* end of disp_static_long */
X
X/*+-------------------------------------------------------------------------
X	disp_static_int(win,label,fmt,value)
X--------------------------------------------------------------------------*/
Xvoid
Xdisp_static_int(win,label,fmt,value)
XWINDOW *win;
Xchar *label;
Xchar *fmt;
Xint value;
X{
X	use_cp(win,cpLIT);
X	waddstr(win,label);
X	wprintw(win,fmt,value);
X}	/* end of disp_static_int */
X
X/*+-------------------------------------------------------------------------
X	disp_msg(cp,msg)
X--------------------------------------------------------------------------*/
Xvoid
Xdisp_msg(cp,msg)
Xchtype cp;
Xchar *msg;
X{
Xextern WINDOW *wscr;
Xint y;
Xregister int x;
X
X	wmove(wscr,MSG_TLY,0);
X	use_cp(wscr,cp);
X	waddstr(wscr,msg);
X	getyx(wscr,y,x);
X	while(x < getmaxx(wscr))
X		waddch(wscr,(chtype)' '),x++;
X}	/* end of disp_msg */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of disputil.c */
SHAR_EOF
# ============= kludge.c ==============
echo "x - extracting kludge.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > kludge.c &&
X
X/*+-------------------------------------------------------------------------
X	kludge.c - u386mon KLUDGE
X
XWe want S5R3 curses #define PERFORMANCE because it has several macro
Xreplacements for functions, but one of the macros has a bug in it.  The
Xmacro has_colors() refers to an undefined 'max_pairs' ...  in the interest
Xof speed, we do the has_colors() call here and get the function
Xhas_colors() without the bogus extern reference.
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-01-1991-23:34-wht@n4hgf-release 3.40 source control point */
X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
X/*:08-03-1990-05:04-wht-creation */
X
X#define M_TERMINFO
X#include <curses.h>
X
X/*+-------------------------------------------------------------------------
X	has_colors_kludge() - don't ask
X--------------------------------------------------------------------------*/
X#if defined(COLOR_PAIR)
Xvoid
Xhas_colors_kludge()
X{
Xextern int color_avail;
X	color_avail = has_colors();
X}	/* end of has_colors_kludge */
X#endif
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of kludge.c */
SHAR_EOF
# ============= libkmem.c ==============
echo "x - extracting libkmem.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libkmem.c &&
X/*LINTLIBRARY*/
X/*+-------------------------------------------------------------------------
X	libkmem.c -- /dev/kmem routines for SCO UNIX/386 (maybe other *NIX)
X	...!{gatech,emory}!n4hgf!wht
X
X  Defined functions:
X	kinit(write_needed)
X	kread(caddr,kaddr,len)
X	kwrite(kaddr,caddr,len)
X
X routines were originally written by Mike "Ford" Ditto: kudos!!!
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-01-1991-23:34-wht@n4hgf-release 3.40 source control point */
X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
X/*:08-01-1990-19:33-jdc@dell.com-add more error text */
X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
X/*:12-07-1988-22:06-wht-put in test for initialized fdkmem */
X/*:10-27-1988-22:44-wht-creation of file */
X
X#include <sys/types.h>
X#include <sys/errno.h>
X#include <fcntl.h>
X#include "libkmem.h"
X
Xvoid leave_text();
X
Xextern int errno;
X
Xstatic int fdkmem = -2;
Xdaddr_t lseek();
X
X/*+-------------------------------------------------------------------------
X	kinit(write_needed)
X--------------------------------------------------------------------------*/
Xvoid
Xkinit(write_needed)
Xint write_needed;
X{
X	if(fdkmem >= 0)
X		return;
X	if((fdkmem=open("/dev/kmem",(write_needed) ? O_RDWR : O_RDONLY,0)) < 0)
X	{
X		if (write_needed)
X		{
X			leave_text("can't open /dev/kmem for read/write access",255);
X		}
X		else
X		{
X			leave_text("can't open /dev/kmem for read access",255);
X		}
X	}
X
X}	/* end of kinit */
X
X/*+-------------------------------------------------------------------------
X	kread(caddr,kaddr,len)
X--------------------------------------------------------------------------*/
Xvoid
Xkread(caddr,kaddr,len)
Xcaddr_t caddr;
Xdaddr_t kaddr;
Xint len;
X{
Xchar s80[80];
Xextern daddr_t myreadlen;
Xextern int myreadcnt;
X
X#if defined(M_I286)
X	kaddr &= 0xFFFFL;
X#endif
X#if defined(mips)
X	kaddr &= 0x7FFFFFFFL;
X#endif
X
X	if(fdkmem == -2)
X		leave_text("kinit() not called",1);
X
X	if(lseek(fdkmem,kaddr,0) == -1L)
X	{
X		(void)sprintf(s80,"kmem read seek error addr %08lx",kaddr);
X		leave_text(s80,255);
X	}
X
X	if(read(fdkmem,caddr,len) != len)
X	{
X		(void)sprintf(s80,"kmem read error len %d addr %08lx",len,kaddr);
X		leave_text(s80,255);
X	}
X	myreadlen += len;
X	myreadcnt++;
X}	/* end of kread */
X
X/*+-------------------------------------------------------------------------
X	kwrite(kaddr,caddr,len)
X--------------------------------------------------------------------------*/
X#ifdef KWRITE_NEEDED
Xvoid
Xkwrite(kaddr,caddr,len)
Xdaddr_t kaddr;
Xcaddr_t caddr;
Xint len;
X{
Xchar s80[80];
X
X#if defined(M_I286)
X	kaddr &= 0xFFFFL;
X#endif
X
X	if(fdkmem == -2)
X		leave_text("kinit() not called",1);
X
X	if(lseek(fdkmem,kaddr,0) == -1L)
X	{
X		(void)sprintf(s80,
X			"/dev/kmem write seek error addr %08lx",kaddr);
X		leave_text(s80,255);
X	}
X	if(write(fdkmem,caddr,len) != len)
X	{
X		(void)sprintf(s80,
X			"/dev/kmem write error addr %08lx len %08lx",kaddr,len);
X		leave_text(s80,255);
X	}
X}	/* end of kwrite */
X#endif
X
X/* vi: set tabstop=4 shiftwidth=4: */
SHAR_EOF
# ============= libkmem.h ==============
echo "x - extracting libkmem.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > libkmem.h &&
X/*+-----------------------------------------------------------------------
X	libkmem.h
X	...!{gatech,emory}!n4hgf!wht
X------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-01-1991-23:34-wht@n4hgf-release 3.40 source control point */
X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
X/*:10-28-1988-14:46-afterlint-creation */
X
X#ifndef BUILDING_LINT_ARGS
X#ifdef LINT_ARGS
X
X/* libkmem.c */
Xvoid kinit(int );
Xvoid kread(char  *,long ,int );
Xvoid kwrite(long ,char  *,int );
X
X#else		/* compiler doesn't know about prototyping */
X
X/* libkmem.c */
Xvoid kinit();
Xvoid kread();
Xvoid kwrite();
X
X#endif /* LINT_ARGS */
X#endif /* BUILDING_LINT_ARGS */
X
X/* end of libkmem.h */
SHAR_EOF
# ============= libmem.c ==============
echo "x - extracting libmem.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libmem.c &&
X/*LINTLIBRARY*/
X/*+-------------------------------------------------------------------------
X	libmem.c -- /dev/mem routines for SCO UNIX/386 (maybe other *NIX)
X	...!{gatech,emory}!n4hgf!wht
X
X  Defined functions:
X	minit(write_needed)
X	mread(caddr,maddr,len)
X	mwrite(maddr,caddr,len)
X
X routines were originally written by Mike "Ford" Ditto: kudos!!!
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-01-1991-23:34-wht@n4hgf-release 3.40 source control point */
X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
X/*:12-07-1988-22:06-wht-put in test for initialized fdmem */
X/*:10-27-1988-22:44-wht-creation of file */
X
X#include <sys/types.h>
X#include <fcntl.h>
X#include "libmem.h"
X
Xvoid leave_text();
X
Xextern int errno;
X
Xstatic int fdmem = -2;
Xdaddr_t lseek();
X
X/*+-------------------------------------------------------------------------
X	minit(write_needed)
X--------------------------------------------------------------------------*/
Xvoid
Xminit(write_needed)
Xint write_needed;
X{
X	if(fdmem >= 0)
X		return;
X	if((fdmem=open("/dev/mem",(write_needed) ? O_RDWR : O_RDONLY,0)) < 0)
X		leave_text("can't open /dev/mem",255);
X
X}	/* end of minit */
X
X/*+-------------------------------------------------------------------------
X	mread(caddr,maddr,len)
X--------------------------------------------------------------------------*/
Xvoid
Xmread(caddr,maddr,len)
Xcaddr_t caddr;
Xdaddr_t maddr;
Xint len;
X{
Xchar s80[80];
Xextern daddr_t myreadlen;
Xextern int myreadcnt;
X
X#if defined(M_I286)
X	maddr &= 0xFFFFL;
X#endif
X
X	if(fdmem == -2)
X		leave_text("minit() not called",1);
X
X	if(lseek(fdmem,maddr,0) == -1L)
X	{
X		(void)sprintf(s80,"mem seek err (%08lx)",maddr);
X		leave_text(s80,1);
X	}
X
X	if(read(fdmem,caddr,len) != len)
X	{
X		(void)sprintf(s80,
X			"mem read errno %d len %d addr %08lx",errno,len,maddr);
X		leave_text(s80,1);
X	}
X	myreadlen += len;
X	myreadcnt++;
X}	/* end of mread */
X
X/*+-------------------------------------------------------------------------
X	mwrite(maddr,caddr,len)
X--------------------------------------------------------------------------*/
X#ifdef MWRITE_NEEDED
Xvoid
Xmwrite(maddr,caddr,len)
Xdaddr_t maddr;
Xcaddr_t caddr;
Xint len;
X{
Xchar s80[80];
X
X#if defined(M_I286)
X	maddr &= 0xFFFFL;
X#endif
X
X	if(fdmem == -2)
X		leave_text("minit() not called",1);
X
X	if(lseek(fdkmem,kaddr,0) == -1L)
X	{
X		(void)sprintf(s80,
X			"/dev/kmem seek error addr %08lx",kaddr);
X		leave_text(s80,255);
X	}
X	if(write(fdkmem,caddr,len) != len)
X	{
X		(void)sprintf(s80,
X			"/dev/kmem write error addr %08lx len %08lx",kaddr,len);
X		leave_text(s80,255);
X	}
X}	/* end of mwrite */
X#endif /* MWRITE_NEEDED */
X
X/* vi: set tabstop=4 shiftwidth=4: */
SHAR_EOF
# ============= libmem.h ==============
echo "x - extracting libmem.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > libmem.h &&
X/*+-----------------------------------------------------------------------
X	libmem.h
X	...!{gatech,emory}!n4hgf!wht
X------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-01-1991-23:34-wht@n4hgf-release 3.40 source control point */
X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
X/*:10-28-1988-14:46-afterlint-creation */
X
X#ifndef BUILDING_LINT_ARGS
X#ifdef LINT_ARGS
X
X/* libmem.c */
Xvoid minit(int );
Xvoid mread(char  *,long ,int );
Xvoid mwrite(long ,char  *,int );
X
X#else		/* compiler doesn't mnow about prototyping */
X
X/* libmem.c */
Xvoid minit();
Xvoid mread();
Xvoid mwrite();
X
X#endif /* LINT_ARGS */
X#endif /* BUILDING_LINT_ARGS */
X
X/* end of libmem.h */
SHAR_EOF
# ============= libnlsym.c ==============
echo "x - extracting libnlsym.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libnlsym.c &&
X/*LINTLIBRARY*/
X/*+-------------------------------------------------------------------------
X	libnlsym.c -- common runtime for nlsym users
X	...!{gatech,emory}!n4hgf!wht
X
X  Defined functions:
X	nlsym_error(text)
X	nlsym_read()
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-01-1991-23:34-wht@n4hgf-release 3.40 source control point */
X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
X/*:07-15-1990-01:41-wht@n4hgf-keep indicator nlsym has been read */
X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
X/*:06-27-1990-01:55-wht@n4hgf-use 64 bits of unique check */
X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
X/*:10-27-1988-11:44-wht-creation */
X
X#include "config.h"
X#include <stdio.h>
X#include <sys/types.h>
X#include <sys/stat.h>
X#include <fcntl.h>
X#include <nlist.h>
X#if defined(mips)
X#define n_sclass n_type
X#endif
X
Xvoid leave_text();
X
X#define DEFINE_NLSYM
X#include "nlsym.h"
X#include "libnlsym.h"
X
Xextern int errno;
Xextern char *sys_errlist[];
X
Xint nlsym_has_been_read = 0;
X
X/*+-------------------------------------------------------------------------
X	nlsym_error(text)
X--------------------------------------------------------------------------*/
Xvoid
Xnlsym_error(text)
Xchar *text;
X{
Xchar s128[128];
X
X	(void)strcpy(s128,text);
X	(void)strcat(s128,": run nlsym");
X	leave_text(s128,(errno) ? 255 : 1);
X}	/* end of nlsym_error */
X
X/*+-------------------------------------------------------------------------
X	nlsym_read()
X--------------------------------------------------------------------------*/
Xvoid
Xnlsym_read()
X{
Xchar s80[80];
Xint fdnlsym;
Xstruct stat curstat;	/* current /unix status */
Xstruct stat unixstat;		/* /unix status at nlsym run (void)time */
Xlong unique1 = 0;
Xlong unique2 = 0;
X
X	if(nlsym_has_been_read)
X		return;
X
X	if(stat(UNIX_KERNEL,&curstat) < 0)
X	{
X		(void)sprintf(s80,"cannot stat %s",UNIX_KERNEL);
X		nlsym_error(s80);
X	}
X
X	errno = 0;
X	if((fdnlsym = open(UNIX_NLSYM,O_RDONLY,0)) < 0)
X	{
X		(void)sprintf(s80,"%s open error\n",UNIX_NLSYM);
X		nlsym_error(s80);
X	}
X
X	if(read(fdnlsym,(char *)&unixstat,sizeof(unixstat)) != sizeof(unixstat))
X		nlsym_error("nlsym_read: /unix stat read error");
X
X	if(read(fdnlsym,(char *)nlsym,sizeof(nlsym)) != sizeof(nlsym))
X		nlsym_error("nlsym_read: nlsym read error");
X
X	if(read(fdnlsym,(char *)&unique1,sizeof(unique1)) != sizeof(unique1))
X		nlsym_error("nlsym_read: `unique' read error");
X
X	if(read(fdnlsym,(char *)&unique2,sizeof(unique2)) != sizeof(unique2))
X		nlsym_error("nlsym_read: `unique' read error");
X
X	(void)close(fdnlsym);
X
X	if( (unique1 != NLSYM_UNIQUE1) ||
X		(unique2 != NLSYM_UNIQUE2) ||
X		(unixstat.st_ino != curstat.st_ino) ||
X		(unixstat.st_mtime != curstat.st_mtime) ||
X		(unixstat.st_size != curstat.st_size))
X	{
X		(void)sprintf(s80,"%s out of date",UNIX_NLSYM);
X		nlsym_error(s80);
X	}
X	nlsym_has_been_read = 1;
X
X}	/* end of nlsym_read */
SHAR_EOF
# ============= libnlsym.h ==============
echo "x - extracting libnlsym.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > libnlsym.h &&
X/*+-----------------------------------------------------------------------
X	libnlsym.h
X	...!{gatech,emory}!n4hgf!wht
X------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-01-1991-23:34-wht@n4hgf-release 3.40 source control point */
X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
X/*:10-28-1988-14:47-afterlint-creation */
X
X#ifndef BUILDING_LINT_ARGS
X#ifdef LINT_ARGS
X
X/* libnlsym.c */
Xvoid nlsym_error(char * );
Xvoid nlsym_read(void);
X
X#else		/* compiler doesn't know about prototyping */
X
X/* libnlsym.c */
Xvoid nlsym_error();
Xvoid nlsym_read();
X
X#endif /* LINT_ARGS */
X#endif /* BUILDING_LINT_ARGS */
X
X/* end of libnlsym.h */
SHAR_EOF
# ============= libpanel.c ==============
echo "x - extracting libpanel.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libpanel.c &&
X/*LINTLIBRARY*/
X/*+-------------------------------------------------------------------------
X	libpanel.c - panel support for u386mon
X	wht@n4hgf.Mt-Park.GA.US
X
X  This module is not an efficient replacement for the SVR3.2 panel
X  facility.  It is, however, fully featured and serves the needs of
X  u386mon, assisting a port to SVR3.1.  It seems efficient enough to
X  use in lieu of native (vendor-supplied) panels.
X
X  To use a native panels library, use -DNATIVE_PANELS, omit libpanel.o
X  from OBJ, and compile the whole of u386mon, linking with -lpanel.
X
X  Some auld curses do not have is_linetouched() and is_wintouched().
X  Defining NO_ISTOUCH will turn on some brain-damaged attempts at
X  supplying these routines.
X
X  Defined functions:
X	Touchline(pan,start,count)
X	Touchpan(pan)
X	Wnoutrefresh(pan)
X	__calculate_obscure()
X	__free_obscure(pan)
X	__override(pan,show)
X	__panel_is_linked(pan)
X	__panel_link_bottom(pan)
X	__panel_link_top(pan)
X	__panel_unlink(pan)
X	__panels_overlapped(pan1,pan2)
X	bottom_panel(pan)
X	dPanel(text,pan)
X	dStack(fmt,num,pan)
X	del_panel(pan)
X	hide_panel(pan)
X	is_linetouched(win,line)
X	is_wintouched(win)
X	move_panel(pan,starty,startx)
X	new_panel(win)
X	open_dfp()
X	panel_above(pan)
X	panel_below(pan)
X	panel_hidden(pan)
X	panel_userptr(pan)
X	panel_window(pan)
X	replace_panel(pan,win)
X	set_panel_userptr(pan,uptr)
X	show_panel(pan)
X	top_panel(pan)
X	update_panels()
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-01-1991-23:34-wht@n4hgf-release 3.40 source control point */
X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
X/*:08-02-1990-14:55-wht@n4hgf-add is_linetouched/is_wintouched hacks */
X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
X/*:07-23-1990-05:25-wht@n4hgf-needed __override call in update_panels */
X/*:07-23-1990-00:56-wht@n4hgf-full library working */
X/*:07-21-1990-22:37-wht@n4hgf-flush out rest of routines */
X/*:07-20-1990-18:58-wht-creation */
X
X#include "config.h"
X
X#if !defined(NATIVE_PANELS)
X#define M_TERMINFO
X#include <curses.h>
X# include "libpanel.h"
X#ifdef U386MON
X#include "u386mon.h"
X#endif
X
X#ifdef __STDC__
X#ifdef LINT_ARGS	/* use Microsoft "ANSI" prototypes
X					 * (the "best" divination of the "standard")
X					 */
Xvoid *malloc(int);
Xvoid free(void *);
X#else	/* LINT_ARGS */
Xvoid *malloc();
Xvoid free();
X#endif	/* LINT_ARGS */
X#else	/* __STDC__ */
Xchar *malloc();
Xvoid free();
X#endif	/* __STDC__ */
X
XPANEL *__bottom_panel = (PANEL *)0;
XPANEL *__top_panel = (PANEL *)0;
XPANEL __stdscr_pseudo_panel = { (WINDOW *)0 };
X
X#ifndef lint
X/*
X * I don't like lint, but some do, so we try to calm the
X * nervous bastard (lint, that is); I only get the notorious
X * "warning: possible pointer alignment problem" on two
X * usages of malloc.
X */
Xstatic char pident[] = "@(#) wht@n4hgf libpanel.c 1.2 07/23/90";
X#endif
X
X#define STATIC static
X
X#ifdef PANEL_DEBUG
XFILE *dfp = (FILE *)0;
XFILE *open_dfp()
X{
X	if(!dfp)
X	{
X		dfp = fopen("p.log","w");
X		fputs("-------\n",dfp);
X	}
X	return(dfp);
X}
X#define dBug(fmt,p1,p2) fprintf(open_dfp(),(fmt),(p1),(p2))
X#else
X#define dBug(fmt,p1,p2)
X#endif
X
X/*+-------------------------------------------------------------------------
X	dPanel(text,pan)
X--------------------------------------------------------------------------*/
X#ifdef PANEL_DEBUG
XdPanel(text,pan)
Xchar *text;
XPANEL *pan;
X{
X	open_dfp();
X	fprintf(dfp,"%s id=%s b=%s a=%s y=%d x=%d\n",
X		text,pan->user,
X		(pan->below) ? pan->below->user : "--",
X		(pan->above) ? pan->above->user : "--",
X		pan->wstarty, pan->wstartx);
X	fflush(dfp);
X}	/* end of dPanel */
X#else
X#define dPanel(text,pan)
X#endif
X
X/*+-------------------------------------------------------------------------
X	dStack(fmt,num,pan)
X--------------------------------------------------------------------------*/
X#ifdef PANEL_DEBUG
Xvoid
XdStack(fmt,num,pan)
Xchar *fmt;
Xint num;
XPANEL *pan;
X{
Xchar s80[80];
X
X	open_dfp();
X	sprintf(s80,fmt,num,pan);
X	fprintf(dfp,"%s b=%s t=%s\n",s80,
X		(__bottom_panel) ? __bottom_panel->user : "--",
X		(__top_panel)    ? __top_panel->user    : "--");
X	if(pan)
X		fprintf(dfp,"pan id=%s\n",pan->user);
X	pan = __bottom_panel;
X	while(pan)
X	{
X		dPanel("stk",pan);
X		pan = pan->above;
X	}
X	if(num == 9)
X		fprintf(dfp,"\n");
X
X	fflush(dfp);
X}	/* end of dStack */
X#else
X#define dStack(fmt,num,pan)
X#endif
X
X/*+-------------------------------------------------------------------------
X	Wnoutrefresh(pan) - debugging hook for wnoutrefresh
X--------------------------------------------------------------------------*/
X#ifdef PANEL_DEBUG
XSTATIC int
XWnoutrefresh(pan)
XPANEL *pan;
X{
X	dPanel("wnoutrefresh",pan);
X	wnoutrefresh(pan->win);
X}	/* end of Wnoutrefresh */
X#else
X#define Wnoutrefresh(pan) wnoutrefresh((pan)->win)
X#endif
X
X/*+-------------------------------------------------------------------------
X	Touchpan(pan)
X--------------------------------------------------------------------------*/
X#ifdef PANEL_DEBUG
XSTATIC int
XTouchpan(pan)
XPANEL *pan;
X{
X	dPanel("Touchpan",pan);
X	touchwin(pan->win);
X}	/* end of Touchpan */
X#else
X#define Touchpan(pan) touchwin((pan)->win)
X#endif
X
X/*+-------------------------------------------------------------------------
X	Touchline(pan,start,count)
X--------------------------------------------------------------------------*/
X#ifdef PANEL_DEBUG
XSTATIC int
XTouchline(pan,start,count)
XPANEL *pan;
Xint start;
Xint count;
X{
Xchar s80[80];
X	sprintf(s80,"Touchline s=%d c=%d",start,count);
X	dPanel(s80,pan);
X	touchline(pan->win,start,count);
X}	/* end of Touchline */
X#else
X#define Touchline(pan,start,count) touchline((pan)->win,start,count)
X#endif
X
X/*+-------------------------------------------------------------------------
X	is_linetouched(win,line) - check to see if line has been touched
XI don't know much about this - no guarantees - comments appreciated
X--------------------------------------------------------------------------*/
X#ifdef NO_ISTOUCH
Xint
Xis_linetouched(win,line)
XWINDOW *win;
Xint line;
X{
X	if(!win || (getmaxy(win) <= line) || (line < 0))
X		return(ERR);
X#ifdef _INFINITY
X    return((win->_firstch[line] == _INFINITY) ? FALSE : TRUE);
X#else /* _INFINITY */
X#ifdef _NOCHANGE
X    return(((win->_lastch[line] == _NOCHANGE) ||
X    		(win->_firstch[line] == _NOCHANGE))
X			? FALSE : TRUE);
X#else /* _NOCHANGE */
X    return((win->_firstch[line] >= getmaxx(win)) ? FALSE : TRUE);
X#endif /* _NOCHANGE */
X#endif	/* _INFINITY */
X}	/* end of is_linetouched */
X#endif /* NO_ISTOUCH */
X
X/*+-------------------------------------------------------------------------
X	is_wintouched(win) - check to see if window has been touched
XI don't know much about this - no guarantees - comments appreciated
X--------------------------------------------------------------------------*/
X#ifdef NO_ISTOUCH
Xint
Xis_wintouched(win)
XWINDOW *win;
X{
X#ifdef _WINCHANGED
X	if(!win)
X		return(ERR);
X	return((win->_flags & _WINCHANGED) ? TRUE : FALSE);
X#else /* _WINCHANGED */
Xregister int line;
X
X	if(!win)
X		return(ERR);
X	/*
X	 * could not discover a _WINCHANGED analog in old curses
X	 */
X	for(line = 0; line < getmaxy(win); line++)
X	{
X		if(is_linetouched(win,line))
X			return(TRUE);
X	}
X	return(FALSE);
X#endif /* _WINCHANGED */
X
X}	/* end of is_wintouched */
X#endif /* NO_ISTOUCH */
X
X/*+-------------------------------------------------------------------------
X	__panels_overlapped(pan1,pan2) - check panel overlapped
X--------------------------------------------------------------------------*/
XSTATIC int
X__panels_overlapped(pan1,pan2)
Xregister PANEL *pan1;
Xregister PANEL *pan2;
X{
X	if(!pan1 || !pan2)
X		return(0);
X	dBug("__panels_overlapped %s %s\n",pan1->user,pan2->user);
X	if((pan1->wstarty >= pan2->wstarty) && (pan1->wstarty < pan2->wendy) &&
X		(pan1->wstartx >= pan2->wstartx) && (pan1->wstartx < pan2->wendx))
X		return(1);
X	if((pan1->wstarty >= pan1->wstarty) && (pan2->wstarty < pan1->wendy) &&
X		(pan1->wstartx >= pan1->wstartx) && (pan2->wstartx < pan1->wendx))
X		return(1);
X	dBug("  no\n",0,0);
X	return(0);
X}	/* end of __panels_overlapped */
X
X/*+-------------------------------------------------------------------------
X	__free_obscure(pan)
X--------------------------------------------------------------------------*/
XSTATIC void
X__free_obscure(pan)
XPANEL *pan;
X{
XPANELOBS *tobs = pan->obscure;				/* "this" one */
XPANELOBS *nobs;								/* "next" one */
X
X	while(tobs)
X	{
X		nobs = tobs->above;
X		free((char *)tobs);
X		tobs = nobs;
X	}
X	pan->obscure = (PANELOBS *)0;
X}	/* end of __free_obscure */
X
X/*+-------------------------------------------------------------------------
X	__override(pan,show)
X--------------------------------------------------------------------------*/
XSTATIC void
X__override(pan,show)
XPANEL *pan;
Xint show;
X{
Xregister y;
Xregister PANEL *pan2;
XPANELOBS *tobs = pan->obscure;				/* "this" one */
X
X	dBug("__override %s,%d\n",pan->user,show);
X
X	if(show == 1)
X		Touchpan(pan);
X	else if(!show)
X	{
X		Touchpan(pan);
X/*
X		Touchline(&__stdscr_pseudo_panel,pan->wendy,getmaxy(pan->win));
X*/
X		Touchpan(&__stdscr_pseudo_panel);
X	}
X	else if(show == -1)
X	{
X		while(tobs && (tobs->pan != pan))
X			tobs = tobs->above;
X	}
X
X	while(tobs)
X	{
X		if((pan2 = tobs->pan) != pan)
X		{
X			dBug("test obs pan=%s pan2=%s\n",pan->user,pan2->user);
X			for(y = pan->wstarty; y < pan->wendy; y++)
X			{
X				if( (y >= pan2->wstarty) && (y < pan2->wendy) &&
X					((is_linetouched(pan->win,y - pan->wstarty) == 1) ||
X					(is_linetouched(stdscr,y) == 1)))
X				{
X					Touchline(pan2,y - pan2->wstarty,1);
X				}
X			}
X		}
X		tobs = tobs->above;
X	}
X}	/* end of __override */
X
X/*+-------------------------------------------------------------------------
X	__calculate_obscure()
X--------------------------------------------------------------------------*/
XSTATIC void
X__calculate_obscure()
X{
XPANEL *pan;
Xregister PANEL *pan2;
Xregister PANELOBS *tobs;			/* "this" one */
XPANELOBS *lobs = (PANELOBS *)0;		/* last one */
X
X	pan = __bottom_panel;
X	while(pan)
X	{
X		if(pan->obscure)
X			__free_obscure(pan);
X		dBug("--> __calculate_obscure %s\n",pan->user,0);
X		lobs = (PANELOBS *)0;		/* last one */
X		pan2 = __bottom_panel;
X		while(pan2)
X		{
X			if(__panels_overlapped(pan,pan2))
X			{
X				if(!(tobs = (PANELOBS *)malloc(sizeof(PANELOBS))))
X					return;
X				tobs->pan = pan2;
X				dPanel("obscured",pan2);
X				tobs->above = (PANELOBS *)0;
X				if(lobs)
X					lobs->above = tobs;
X				else
X					pan->obscure = tobs;
X				lobs  = tobs;
X			}
X			pan2 = pan2->above;
X		}
X		__override(pan,1);
X		pan = pan->above;
X	}
X
X}	/* end of __calculate_obscure */
X
X/*+-------------------------------------------------------------------------
X	__panel_is_linked(pan) - check to see if panel is in the stack
X--------------------------------------------------------------------------*/
XSTATIC int
X__panel_is_linked(pan)
XPANEL *pan;
X{
Xregister PANEL *pan2 = __bottom_panel;
X
X	while(pan2)
X	{
X		if(pan2 == pan)
X			return(1);
X		pan2 = pan2->above;
X	}
X	return(OK);
X}	/* end of __panel_is_linked */
X
X/*+-------------------------------------------------------------------------
X	__panel_link_top(pan) - link panel into stack at top
X--------------------------------------------------------------------------*/
XSTATIC void
X__panel_link_top(pan)
XPANEL *pan;
X{
X
X#ifdef PANEL_DEBUG
X	dStack("<lt%d>",1,pan);
X	if(__panel_is_linked(pan))
X		return;
X#endif
X
X	pan->above = (PANEL *)0;
X	pan->below = (PANEL *)0;
X	if(__top_panel)
X	{
X		__top_panel->above = pan;
X		pan->below = __top_panel;
X	}
X	__top_panel = pan;
X	if(!__bottom_panel)
X		__bottom_panel = pan;
X	__calculate_obscure();
X	dStack("<lt%d>",9,pan);
X
X}	/* end of __panel_link_top */
X
X/*+-------------------------------------------------------------------------
X	__panel_link_bottom(pan) - link panel into stack at bottom
X--------------------------------------------------------------------------*/
XSTATIC void
X__panel_link_bottom(pan)
XPANEL *pan;
X{
X
X#ifdef PANEL_DEBUG
X	dStack("<lb%d>",1,pan);
X	if(__panel_is_linked(pan))
X		return;
X#endif
X
X	pan->above = (PANEL *)0;
X	pan->below = (PANEL *)0;
X	if(__bottom_panel)
X	{
X		__bottom_panel->below = pan;
X		pan->above = __bottom_panel;
X	}
X	__bottom_panel = pan;
X	if(!__top_panel)
X		__top_panel = pan;
X	__calculate_obscure();
X	dStack("<lb%d>",9,pan);
X
X}	/* end of __panel_link_bottom */
X
X/*+-------------------------------------------------------------------------
X	__panel_unlink(pan) - unlink panel from stack
X--------------------------------------------------------------------------*/
XSTATIC void
X__panel_unlink(pan)
XPANEL *pan;
X{
Xregister PANEL *prev;
Xregister PANEL *next;
X
X#ifdef PANEL_DEBUG
X	dStack("<u%d>",1,pan);
X	if(!__panel_is_linked(pan))
X		return;
X#endif
X
X	__override(pan,0);
X	__free_obscure(pan);
X
X	prev = pan->below;
X	next = pan->above;
X
X	if(prev)		/* if non-zero, we will not update the list head */
X	{
X		prev->above = next;
X		if(next)
X			next->below = prev;
X	}
X	else if(next)
X		next->below = prev;
X	if(pan == __bottom_panel)
X		__bottom_panel = next;
X	if(pan == __top_panel)
X		__top_panel = prev;
X
X	__calculate_obscure();
X
X	pan->above = (PANEL *)0;
X	pan->below = (PANEL *)0;
X	dStack("<u%d>",9,pan);
X
X}	/* end of __panel_unlink */
X
X/*+-------------------------------------------------------------------------
X	panel_window(pan) - get window associated with panel
X--------------------------------------------------------------------------*/
XWINDOW *
Xpanel_window(pan)
XPANEL *pan;
X{
X	return(pan->win);
X}	/* end of panel_window */
X
X/*+-------------------------------------------------------------------------
X	update_panels() - wnoutrefresh windows in an orderly fashion
X--------------------------------------------------------------------------*/
Xvoid
Xupdate_panels()
X{
XPANEL *pan;
X
X	dBug("--> update_panels\n",0,0);
X	pan = __bottom_panel;
X	while(pan)
X	{
X		__override(pan,-1);
X		pan = pan->above;
X	}
X
X	if(is_wintouched(stdscr))
X		Wnoutrefresh(&__stdscr_pseudo_panel);
X	
X	if(pan = __bottom_panel)
X	{
X		while(pan)
X		{
X			if(is_wintouched(pan->win))
X				Wnoutrefresh(pan);
X			pan = pan->above;
X		}
X	}
X}	/* end of update_panels */
X
X/*+-------------------------------------------------------------------------
X	hide_panel(pan) - remove a panel from stack
X--------------------------------------------------------------------------*/
Xint
Xhide_panel(pan)
Xregister PANEL *pan;
X{
X
X	if(!pan)
X		return(ERR);
X
X	dBug("--> hide_panel %s\n",pan->user,0);
X
X	if(!__panel_is_linked(pan))
X	{
X		pan->above = (PANEL *)0;
X		pan->below = (PANEL *)0;
X		return(ERR);
X	}
X
X	__panel_unlink(pan);
X
X	return(OK);
X}	/* end of hide_panel */
X
X/*+-------------------------------------------------------------------------
X	show_panel(pan) - place a panel on top of stack
Xmay already be in stack
X--------------------------------------------------------------------------*/
Xint
Xshow_panel(pan)
Xregister PANEL *pan;
X{
X
X	if(!pan)
X		return(ERR);
X	if(pan == __top_panel)
X		return(OK);
X	dBug("--> show_panel %s\n",pan->user,0);
X	if(__panel_is_linked(pan))
X		(void)hide_panel(pan);
X	__panel_link_top(pan);
X	return(OK);
X}	/* end of show_panel */
X
X/*+-------------------------------------------------------------------------
X	top_panel(pan) - place a panel on top of stack
X--------------------------------------------------------------------------*/
Xint
Xtop_panel(pan)
Xregister PANEL *pan;
X{
X	return(show_panel(pan));
X}	/* end of top_panel */
X
X/*+-------------------------------------------------------------------------
X	del_panel(pan) - remove a panel from stack, if in it, and free struct
X--------------------------------------------------------------------------*/
Xint
Xdel_panel(pan)
Xregister PANEL *pan;
X{
X	if(pan)
X	{
X		dBug("--> del_panel %s\n",pan->user,0);
X		if(__panel_is_linked(pan))
X			(void)hide_panel(pan);
X		free((char *)pan);
X		return(OK);
X	}
X	return(ERR);
X}	/* end of del_panel */
X
X/*+-------------------------------------------------------------------------
X	bottom_panel(pan) - place a panel on bottom of stack
Xmay already be in stack
X--------------------------------------------------------------------------*/
Xint
Xbottom_panel(pan)
Xregister PANEL *pan;
X{
X	if(!pan)
X		return(ERR);
X	if(pan == __bottom_panel)
X		return(OK);
X	dBug("--> bottom_panel %s\n",pan->user,0);
X	if(__panel_is_linked(pan))
X		(void)hide_panel(pan);
X	__panel_link_bottom(pan);
X	return(OK);
X}	/* end of bottom_panel */
X
X/*+-------------------------------------------------------------------------
X	new_panel(win) - create a panel and place on top of stack
X--------------------------------------------------------------------------*/
XPANEL *
Xnew_panel(win)
XWINDOW *win;
X{
XPANEL *pan = (PANEL *)malloc(sizeof(PANEL));
X
X	if(!__stdscr_pseudo_panel.win)
X	{
X		__stdscr_pseudo_panel.win = stdscr;
X		__stdscr_pseudo_panel.wstarty = 0;
X		__stdscr_pseudo_panel.wstartx = 0;
X		__stdscr_pseudo_panel.wendy = LINES;
X		__stdscr_pseudo_panel.wendx = COLS;
X		__stdscr_pseudo_panel.user = "stdscr";
X		__stdscr_pseudo_panel.obscure = (PANELOBS *)0;
X	}
X
X	if(pan)
X	{
X		pan->win = win;
X		pan->above = (PANEL *)0;
X		pan->below = (PANEL *)0;
X		pan->wstarty = getbegy(win);
X		pan->wstartx = getbegx(win);
X		pan->wendy = pan->wstarty + getmaxy(win);
X		pan->wendx = pan->wstartx + getmaxx(win);
X#ifdef PANEL_DEBUG
X		pan->user = "new";
X#else
X		pan->user = (char *)0;
X#endif
X		pan->obscure = (PANELOBS *)0;
X		(void)show_panel(pan);
X	}
X
X	return(pan);
X}	/* end of new_panel */
X
X/*+-------------------------------------------------------------------------
X	panel_above(pan)
X--------------------------------------------------------------------------*/
XPANEL *
Xpanel_above(pan)
XPANEL *pan;
X{
X	if(!pan)
X		return(__bottom_panel);
X	else
X		return(pan->above);
X}	/* end of panel_above */
X
X/*+-------------------------------------------------------------------------
X	panel_below(pan)
X--------------------------------------------------------------------------*/
XPANEL *
Xpanel_below(pan)
XPANEL *pan;
X{
X	if(!pan)
X		return(__top_panel);
X	else
X		return(pan->below);
X}	/* end of panel_below */
X
X/*+-------------------------------------------------------------------------
X	set_panel_userptr(pan,uptr)
X--------------------------------------------------------------------------*/
Xint
Xset_panel_userptr(pan,uptr)
XPANEL *pan;
Xchar *uptr;
X{
X	if(!pan)
X		return(ERR);
X	pan->user = uptr;
X	return(OK);
X}	/* end of set_panel_userptr */
X
X/*+-------------------------------------------------------------------------
X	panel_userptr(pan)
X--------------------------------------------------------------------------*/
Xchar *
Xpanel_userptr(pan)
XPANEL *pan;
X{
X	if(!pan)
X		return((char *)0);
X	return(pan->user);
X}	/* end of panel_userptr */
X
X/*+-------------------------------------------------------------------------
X	move_panel(pan,starty,startx)
X--------------------------------------------------------------------------*/
Xint
Xmove_panel(pan,starty,startx)
XPANEL *pan;
Xint starty;
Xint startx;
X{
XWINDOW *win;
X
X	if(!pan)
X		return(ERR);
X	if(__panel_is_linked(pan))
X		__override(pan,0);
X	win = pan->win;
X	if(mvwin(win,starty,startx))
X		return(ERR);
X	pan->wstarty = getbegy(win);
X	pan->wstartx = getbegx(win);
X	pan->wendy = pan->wstarty + getmaxy(win);
X	pan->wendx = pan->wstartx + getmaxx(win);
X	if(__panel_is_linked(pan))
X		__calculate_obscure();
X	return(OK);
X}	/* end of move_panel */
X
X/*+-------------------------------------------------------------------------
X	replace_panel(pan,win)
X--------------------------------------------------------------------------*/
Xint
Xreplace_panel(pan,win)
XPANEL *pan;
XWINDOW *win;
X{
X	if(!pan)
X		return(ERR);
X	if(__panel_is_linked(pan))
X		__override(pan,0);
X	pan->win = win;
X	if(__panel_is_linked(pan))
X		__calculate_obscure();
X	return(OK);
X}	/* end of replace_panel */
X
X/*+-------------------------------------------------------------------------
X	panel_hidden(pan)
X--------------------------------------------------------------------------*/
Xint
Xpanel_hidden(pan)
XPANEL *pan;
X{
X	if(!pan)
X		return(ERR);
X	return(__panel_is_linked(pan) ? ERR : OK);
X}	/* end of panel_hidden */
X
X#endif /* !defined(NATIVE_PANELS) */
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of libpanel.c */
SHAR_EOF
# ============= libpanel.h ==============
echo "x - extracting libpanel.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > libpanel.h &&
X
X/*+-------------------------------------------------------------------------
X	libpanel.h - libpanel.c <panel.h> surrogate
X	wht@n4hgf.Mt-Park.GA.US
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-01-1991-23:34-wht@n4hgf-release 3.40 source control point */
X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
X/*:07-31-1990-08:18-wht@n4hgf-some cpps wont take #error even in untrue ifdef */
X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
X/*:07-23-1990-00:56-wht@n4hgf-full library working */
X/*:07-21-1990-15:42-wht-creation */
X
X#ifdef NATIVE_PANELS
X# include <panel.h>
X#else
X
Xtypedef struct panelobs
X{
X	struct panelobs *above;
X	struct panel *pan;
X} PANELOBS;
X
Xtypedef struct panel
X{
X	WINDOW *win;
X	int wstarty;
X	int wendy;
X	int wstartx;
X	int wendx;
X	struct panel *below;
X	struct panel *above;
X	char *user;
X	struct panelobs *obscure;
X} PANEL;
X
X#ifndef BUILDING_LINT_ARGS
X#ifdef LINT_ARGS
X
Xextern  WINDOW *panel_window(PANEL *pan);
Xextern  void update_panels(void );
Xextern  int hide_panel(PANEL *pan);
Xextern  int show_panel(PANEL *pan);
Xextern  int del_panel(PANEL *pan);
Xextern  int top_panel(PANEL *pan);
Xextern  int bottom_panel(PANEL *pan);
Xextern  PANEL *new_panel(WINDOW *win);
Xextern  PANEL *panel_above(PANEL *pan);
Xextern  PANEL *panel_below(PANEL *pan);
Xextern  int set_panel_userptr(PANEL *pan,char *uptr);
Xextern  char *panel_userptr(PANEL *pan);
Xextern  int move_panel(PANEL *pan,int starty,int startx);
Xextern  int replace_panel(PANEL *pan,WINDOW *win);
X
X#else		/* compiler doesn't know about prototyping */
X
Xextern  WINDOW *panel_window();
Xextern  void update_panels();
Xextern  int hide_panel();
Xextern  int show_panel();
Xextern  int del_panel();
Xextern  int top_panel();
Xextern  int bottom_panel();
Xextern  PANEL *new_panel();
Xextern  PANEL *panel_above();
Xextern  PANEL *panel_below();
Xextern  int set_panel_userptr();
Xextern  char *panel_userptr();
Xextern  int move_panel();
Xextern  int replace_panel();
X
X#endif /* LINT_ARGS */
X#endif /* BUILDING_LINT_ARGS */
X
X#endif	/* NATIVE_PANELS */
X
X/* end of function declarations */
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of libpanel.h */
SHAR_EOF
# ============= libswap.c ==============
echo "x - extracting libswap.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libswap.c &&
X/*LINTLIBRARY*/
X/*+-------------------------------------------------------------------------
X	libswap.c -- /dev/swap routines for SCO UNIX/386 (maybe other *NIX)
X	...!{gatech,emory}!n4hgf!wht
X
X  Defined functions:
X	sinit()
X	sread(caddr,maddr,len)
X
X routines were originally written by Mike "Ford" Ditto: kudos!!!
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-01-1991-23:34-wht@n4hgf-release 3.40 source control point */
X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
X/*:06-22-1990-02:00-root@n4hgf-creation from libmem */
X
X#include <sys/types.h>
X#include <fcntl.h>
X#include "libswap.h"
X
Xvoid leave_text();
X
Xextern int errno;
X
Xstatic int fdswap = -2;
Xdaddr_t lseek();
X
X/*+-------------------------------------------------------------------------
X	sinit()
X--------------------------------------------------------------------------*/
Xvoid
Xsinit()
X{
X	if(fdswap >= 0)
X		return;
X	if((fdswap=open("/dev/swap",O_RDONLY)) < 0)
X#ifdef M_SYS5
X		leave_text("can't open /dev/swap (chgrp mem /dev/swap)",1);
X#else
X		leave_text("can't open /dev/swap (chgrp sys /dev/swap)",1);
X#endif
X
X}	/* end of sinit */
X
X/*+-------------------------------------------------------------------------
X	sread(caddr,maddr,len)
X--------------------------------------------------------------------------*/
Xvoid
Xsread(caddr,maddr,len)
Xcaddr_t caddr;
Xdaddr_t maddr;
Xint len;
X{
Xchar s80[80];
Xextern daddr_t myreadlen;
Xextern int myreadcnt;
X
X#if defined(M_I286)
X	maddr &= 0xFFFFL;
X#endif
X
X	if(fdswap == -2)
X		leave_text("sinit() not called",1);
X
X	if(lseek(fdswap,maddr,0) == -1L)
X	{
X		(void)sprintf(s80,"swap seek error addr %08lx",maddr);
X		leave_text(s80,1);
X	}
X
X	if(read(fdswap,caddr,len) != len)
X	{
X		(void)sprintf(s80,"swap read error len %d addr %08lx",len,maddr);
X		leave_text(s80,255);
X	}
X	myreadlen += len;
X	myreadcnt++;
X}	/* end of sread */
X
X/* vi: set tabstop=4 shiftwidth=4: */
SHAR_EOF
# ============= libswap.h ==============
echo "x - extracting libswap.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > libswap.h &&
X/*+-----------------------------------------------------------------------
X	libswap.h
X	...!{gatech,emory}!n4hgf!wht
X------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-01-1991-23:34-wht@n4hgf-release 3.40 source control point */
X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
X/*:06-22-1990-02:03-root@n4hgf-creation from libmem */
X
X#ifndef BUILDING_LINT_ARGS
X#ifdef LINT_ARGS
X
X/* libswap.c */
Xvoid sinit(void );
Xvoid sread(char  *,long ,int );
X
X#else		/* compiler doesn't mnow about prototyping */
X
X/* libswap.c */
Xvoid sinit();
Xvoid sread();
Xvoid swrite();
X
X#endif /* LINT_ARGS */
X#endif /* BUILDING_LINT_ARGS */
X
X/* end of libswap.h */
SHAR_EOF
# ============= lint_args.h ==============
echo "x - extracting lint_args.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > lint_args.h &&
X/*+-----------------------------------------------------------------------
X	lint_args.h
X------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-01-1991-23:34-wht@n4hgf-release 3.40 source control point */
X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
X/*:07-21-1990-16:01-afterlint-creation */
X
X#ifndef BUILDING_LINT_ARGS
X#ifdef LINT_ARGS
X
X/* bootinfo.c */
Xextern  char *bmemf_text(unsigned long flags);
Xextern  void display_bootinfo(struct _win_st *win,int y,int x);
X/* det_proc.c */
Xextern  char *get_cpu_time_str(long ticks);
Xextern  char *pgrp_to_ttyname(int pgrp);
Xextern  char *uid_to_name(unsigned short uid);
Xextern  int det_proc_init(void );
Xextern  int get_user(struct proc *tproc,struct user *tuser);
Xextern  int getpwent_and_enter(unsigned short uid);
Xextern  int ppproc_pid_compare(struct proc * *ppp1,struct proc * *ppp2);
Xextern  int uid_name_enter(unsigned short uid,char *name);
Xextern  struct utmp *find_utmp_for_pgrp(int pgrp);
Xextern  void display_proc_stat(struct _win_st *win,int iproc,int initial);
Xextern  void display_proc_stats(struct _win_st *win,int initial);
Xextern  void init_uid_name_hash(void );
Xextern  void read_and_sort_procs(int initial);
Xextern  void read_utmp(void );
X/* det_sio.c */
Xextern  char *B_to_baud_rate(int code);
Xextern  char *cflag_to_baud_d_p_s(int cflag);
Xextern  int display_sio_summary(struct _win_st *win,int initial);
Xextern  int tty_slot_compare(struct tty *sio1,struct tty *sio2);
Xextern  void display_siofull_init(struct _win_st *win,int tly,int tlx,int show_flag);
Xextern  void display_siofull_update(struct _win_st *win,int tly,int tlx,struct tty *tsio);
Xextern  void display_siosum_update(struct _win_st *win,int y,struct tty *tsio);
Xextern  void grok_sio_tty(void );
X/* detail.c */
Xextern  void detail_init(void );
Xextern  void detail_panel_cmd(unsigned long cmd);
Xextern  void detail_panel_update(void );
Xextern  void detpanel_destroy(void );
Xextern  void detpanel_extra_init(void );
Xextern  void detpanel_extra_update(void );
Xextern  void detpanel_ps_init(int full43);
Xextern  void detpanel_ps_update(void );
Xextern  void detpanel_sio_init(void );
Xextern  void detpanel_sio_update(void );
X/* disputil.c */
Xextern  PANEL *mkpanel(int rows,int cols,int tly,int tlx,char *userp);
Xextern  void clear_area(struct _win_st *win,int y,int x,int len);
Xextern  void clear_area_char(struct _win_st *win,int y,int x,int len,unsigned char fillchar);
Xextern  void disp_info_int(struct _win_st *win,char *label,char *fmt,int value);
Xextern  void disp_info_long(struct _win_st *win,char *label,char *fmt,long value);
Xextern  void disp_msg(unsigned long cp,char *msg);
Xextern  void disp_static_int(struct _win_st *win,char *label,char *fmt,int value);
Xextern  void disp_static_long(struct _win_st *win,char *label,char *fmt,long value);
Xextern  void pflush(void );
Xextern  void wperror(struct _win_st *win,char *desc);
X/* libkmem.c */
Xextern  void kinit(int write_needed);
Xextern  void kread(char *caddr,long kaddr,int len);
X/* libmem.c */
Xextern  void minit(int write_needed);
Xextern  void mread(char *caddr,long maddr,int len);
X/* libnlsym.c */
Xextern  void nlsym_error(char *text);
Xextern  void nlsym_read(void );
X/* libswap.c */
Xextern  void sinit(void );
Xextern  void sread(char *caddr,long maddr,int len);
X/* nlsym.c */
Xextern  int main(int argc,char * *argv,char * *envp);
Xextern  void nlsym_write_error(int code);
X/* proc.c */
Xextern  char *pstat_text(char pstat);
Xextern  void display_proc(struct _win_st *win,int y,int x);
Xextern  void grok_proc(void );
X/* tune.c */
Xextern  void display_tune(struct _win_st *win,int y,int x);
X/* u386mon.c */
Xextern  char *get_elapsed_time(long elapsed_seconds);
Xextern  int get_cpu_avg(long *cpu_ticks,int period);
Xextern  int get_wait_avg(long *wait_ticks,int period);
Xextern  int main(int argc,char * *argv,char * *envp);
Xextern  long update_cpuscale(struct _win_st *win,int y,int x,int width,long *per_state);
Xextern  long update_waitscale(struct _win_st *win,int y,int x,int width,long *per_state,long total_ticks);
Xextern  void calc_cpu_avg(long *per_state);
Xextern  void calc_wait_avg(long *per_state);
Xextern  void caught_signal(int sig);
Xextern  void draw_cpuscale_literals(struct _win_st *win,int y,int x);
Xextern  void draw_per_sec_literals(struct _win_st *win,int y,int x);
Xextern  void draw_waitscale_literals(struct _win_st *win,int y,int x);
Xextern  void extra_info_stuff(void );
Xextern  void extra_static_stuff(void );
Xextern  void leave(int exit_code);
Xextern  void leave_text(char *text,int exit_code);
Xextern  void leaving(void );
Xextern  void read_sysinfo_and_minfo(void );
X/* var.c */
Xextern  void display_var(struct _win_st *win,int y,int x);
X
X#else		/* compiler doesn't know about prototyping */
X
X/* bootinfo.c */
Xextern  char *bmemf_text();
Xextern  void display_bootinfo();
X/* det_proc.c */
Xextern  char *get_cpu_time_str();
Xextern  char *pgrp_to_ttyname();
Xextern  char *uid_to_name();
Xextern  int det_proc_init();
Xextern  int get_user();
Xextern  int getpwent_and_enter();
Xextern  int ppproc_pid_compare();
Xextern  int uid_name_enter();
Xextern  struct utmp *find_utmp_for_pgrp();
Xextern  void display_proc_stat();
Xextern  void display_proc_stats();
Xextern  void init_uid_name_hash();
Xextern  void read_and_sort_procs();
Xextern  void read_utmp();
X/* det_sio.c */
Xextern  char *B_to_baud_rate();
Xextern  char *cflag_to_baud_d_p_s();
Xextern  int display_sio_summary();
Xextern  int tty_slot_compare();
Xextern  void display_siofull_init();
Xextern  void display_siofull_update();
Xextern  void display_siosum_update();
Xextern  void grok_sio_tty();
X/* detail.c */
Xextern  void detail_init();
Xextern  void detail_panel_cmd();
Xextern  void detail_panel_update();
Xextern  void detpanel_destroy();
Xextern  void detpanel_extra_init();
Xextern  void detpanel_extra_update();
Xextern  void detpanel_ps_init();
Xextern  void detpanel_ps_update();
Xextern  void detpanel_sio_init();
Xextern  void detpanel_sio_update();
X/* disputil.c */
Xextern  PANEL *mkpanel();
Xextern  void clear_area();
Xextern  void clear_area_char();
Xextern  void disp_info_int();
Xextern  void disp_info_long();
Xextern  void disp_msg();
Xextern  void disp_static_int();
Xextern  void disp_static_long();
Xextern  void pflush();
Xextern  void wperror();
X/* libkmem.c */
Xextern  void kinit();
Xextern  void kread();
X/* libmem.c */
Xextern  void minit();
Xextern  void mread();
X/* libnlsym.c */
Xextern  void nlsym_error();
Xextern  void nlsym_read();
X/* libswap.c */
Xextern  void sinit();
Xextern  void sread();
X/* nlsym.c */
Xextern  int main();
Xextern  void nlsym_write_error();
X/* proc.c */
Xextern  char *pstat_text();
Xextern  void display_proc();
Xextern  void grok_proc();
X/* tune.c */
Xextern  void display_tune();
X/* u386mon.c */
Xextern  char *get_elapsed_time();
Xextern  int get_cpu_avg();
Xextern  int get_wait_avg();
Xextern  int main();
Xextern  long update_cpuscale();
Xextern  long update_waitscale();
Xextern  void calc_cpu_avg();
Xextern  void calc_wait_avg();
Xextern  void caught_signal();
Xextern  void draw_cpuscale_literals();
Xextern  void draw_per_sec_literals();
Xextern  void draw_waitscale_literals();
Xextern  void extra_info_stuff();
Xextern  void extra_static_stuff();
Xextern  void leave();
Xextern  void leave_text();
Xextern  void leaving();
Xextern  void read_sysinfo_and_minfo();
X/* var.c */
Xextern  void display_var();
X
X#endif /* LINT_ARGS */
X#endif /* BUILDING_LINT_ARGS */
X
X/* end of lint_args.h */
SHAR_EOF
# ============= nlsym.c ==============
echo "x - extracting nlsym.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > nlsym.c &&
X/*+-------------------------------------------------------------------------
X	nlsym.c -- utility nlist - fast access to kernel /dev/kmem offsets
X	...!{gatech,emory}!n4hgf!wht
X
X  Defined functions:
X	main(argc,argv,envp)
X	nlsym_write_error(code)
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-01-1991-23:34-wht@n4hgf-release 3.40 source control point */
X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
X/*:06-27-1990-01:55-wht@n4hgf-use 64 bits of unique check */
X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
X/*:05-12-1989-18:27-wht-fix endless loop error on cannot nlist */
X/*:10-27-1988-10:58-wht-creation */
X
X#include "config.h"
X#include <stdio.h>
X#include <sys/types.h>
X#include <sys/stat.h>
X#include <fcntl.h>
X#include <nlist.h>
X#if defined(mips)
X#define n_sclass n_type
X#endif
X
X#define DEFINE_NLSYM
X#include "nlsym.h"
X
X/*+-------------------------------------------------------------------------
X	nlsym_write_error(code)
X--------------------------------------------------------------------------*/
Xvoid
Xnlsym_write_error(code)
Xint code;
X{
X	(void)fprintf(stderr,"code %d: ",code);
X	perror(UNIX_NLSYM);
X	exit(1);
X}	/* end of nlsym_write_error */
X
X/*+-------------------------------------------------------------------------
X	main(argc,argv,envp)
X--------------------------------------------------------------------------*/
X/*ARGSUSED*/
Xmain(argc,argv,envp)
Xint argc;
Xchar **argv;
Xchar **envp;
X{
Xregister int itmp;
Xregister struct nlist *nn;
Xstruct stat unixstat;		/* /unix status at nlsym run (void)time */
Xint fdnlsym;
Xint nlist_error = 0;
Xlong unique;
XFILE *kludge;
X
X	(void)nlist(UNIX_KERNEL,nlsym);
X
X	nn = nlsym;
X	while(nn->n_name)
X	{
X		if(!nn->n_sclass)
X		{
X#if !defined(mips)
X			(void)printf("%s: can't nlist\n", nn->n_name);
X			nlist_error = 1;
X#endif
X			nn++;
X			continue;
X		}
X		(void)printf("%-12.12s  storage class: %04x value: %08lx\n",
X			nn->n_name,
X			nn->n_sclass,
X			nn->n_value);
X		nn++;
X	}
X
X	if(nlist_error > 1)
X	{
X		(void)fprintf(stderr,"%s NOT produced\n",UNIX_NLSYM);
X		exit(1);
X	}
X
X	if((kludge = fopen(UNIX_NLSYM,"w")) == NULL)	/* scratch/create */
X		nlsym_write_error(-1);
X	(void)fclose(kludge);
X
X	if((fdnlsym = open(UNIX_NLSYM,O_WRONLY,0)) < 0)
X		nlsym_write_error(fdnlsym);
X
X	if(stat(UNIX_KERNEL,&unixstat) < 0)
X	{
X		(void)fputs("cannot stat ",stderr);
X		perror(UNIX_KERNEL);
X		exit(1);
X	}
X
X	if((itmp = write(fdnlsym,&unixstat,sizeof(unixstat))) != sizeof(unixstat))
X		nlsym_write_error(itmp);
X
X	if((itmp = write(fdnlsym,nlsym,sizeof(nlsym))) != sizeof(nlsym))
X		nlsym_write_error(itmp);
X
X	unique = NLSYM_UNIQUE1;
X	if((itmp = write(fdnlsym,&unique,sizeof(unique))) != sizeof(unique))
X		nlsym_write_error(itmp);
X
X	unique = NLSYM_UNIQUE2;
X	if((itmp = write(fdnlsym,&unique,sizeof(unique))) != sizeof(unique))
X		nlsym_write_error(itmp);
X
X	(void)close(fdnlsym);
X	exit(0);
X	/*NOTREACHED*/
X}	/* end of main */
X
X/* vi: set tabstop=4 shiftwidth=4: */
SHAR_EOF
# ============= nlsym.h ==============
echo "x - extracting nlsym.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > nlsym.h &&
X/*+-------------------------------------------------------------------------
X	nlsym.h -- utility nlist - fast access to kernel /dev/kmem offsets
X	...!{gatech,emory}!n4hgf!wht
X
XThe nlsym file contains three records:
X1.  struct stat unixstat - stat buffer from /unix at file creation time
X2.  struct nlist nlsym - the structure of nlist'd information
X3.  long unique - a unique identifier to help ensure correct nlsym length
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-01-1991-23:34-wht@n4hgf-release 3.40 source control point */
X/*:05-15-1991-17:22-wht@n4hgf-2.3 patches for SVR31 from nba@sysware.dk */
X/*:04-16-1991-02:25-martin@hppcmart additions for SCO 3.2.2 */
X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
SHAR_EOF
echo "End of  part 4"
echo "File nlsym.h is continued in part 5"
echo "5" > shar3_seq_.tmp
exit 0
Newsgroups: biz.sco.sources