[comp.unix.xenix] Monitor source Part 1 of 9

jct@jct.UUCP (jct) (07/11/89)

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 9)."
# Contents:  README README.TOO help help/help.hlp include include/km
#   include/km/ascii.h include/km/defs.h include/km/docmd.h
#   include/km/rdspec.h include/km/string1.h include/km/string2.h
#   include/km/termcap.h lib lib/makeMmonlib lib/makefile
#   lib/scrout2.c lib/scrout4.c lib/scrout7.c lib/tputs.c makefile
# Wrapped by jct@ on Mon Jul 10 22:47:59 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(16274 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
This is the README file for monitor. Isn't that news.
X
Written and copyrighted by John C. Tompkins 1989. You may use this for
noncommercial use only. I don't have an army of lawyers but you won't sleep
well if you do try and steal it! :-) 
X
John C. Tompkins
X4616 NW 59th St.
Oklahoma City, Oklahoma 73122
X(405) 728-1208
X
This monitor program reads various kernal data structures concerning 
system capacity and performance and displays them in a very easy to 
understand and "move about" display. 
X
This supplied version will run on XENIX 286 and Convergent CTIX. If you are 
a normal user and don't know quite a bit about programming and don't have 
XXENIX or CTIX, I'm afraid you won't be able to get this program to compile. 
You'll have to wait for someone who has a system like yours to do it for you.
Sorry, it can't be helped. Since its reads kernal data, it is VERY dependent 
on how your UNIX is implemented. The System V's I've seen are similar but 
still vary. XENIX 286 is similar to System V but again different. XENIX 386, 
prior to UNIX compatibility, I understand has many Berkley kernal data 
structures. And of course Berkley is different. There is no way for me to 
implement all the different versions. I have done XENIX 286 and Convergent 
Technologies CTIX (at least on a MiniFrame), this should give porters a good 
start for places to look. Search for the symbol "#ifdef CTIX", "#ifdef XENIX",
and "#ifdef SYSV".
X
To get an idea of porting difficulity, look in the system include directory,
X<sys/*.h>. On 286 XENIX, include files used, among others, are sysinfo.h, 
proc.h, user.h, inode.h and file.h. Data structures used are, among others,
sysinfo, proc, user, inode and file. These include files define what data is
available to monitor and how it is organized, this is what changes for 
different UNIX versions. Many versions, such as Convergent CTIX, include data 
on disk IO queues and response times. Berkley based versions have similar data
but it is organized very much differently. I understand 386 Unix has a lot 
more interesting data than whats available on 286 XENIX. Anyhow, the porting
process involves understanding these data structures, whats available in them,
and what would be interesting to put on the screen. Its really not too 
difficult, just a matter of many small details. Some things, such as on top
CPU monitor the percentages for each process, may be a little tricky and
not immediately obvious how it works. Actually the most difficulity I had
in porting to CTIX and XENIX was figuring out where on the swap device
the kernal stored the "user" structure. I had to experiment till I found
what worked and it isn't the same on CTIX as XENIX! This is true on several
data items, they are not part of the normal system documentation. You
just have to keep poking your nose where it doesn't belong and eventually
you will accomplish something.
X
The library routines sould be fairly easy to port. One problem could be the 
system is based on 'termcap' entries and not the newer System V 'terminfo'.
Someone needs to port that, no big deal. It also uses System V style 'ioctl'
calls for terminal line mode control, not Berkley 'stty/gtty'.
X
If you do a port to another system, PLEASE send me your results or diffs
so I can keep up to date. Also, I would strongly suggest posting your port
or diffs so others can use it.
X
Some things I've thought about monitoring, but so far haven't gotten
around to are inter-process communication (message queues, shared memory and
semaphores) [as in ipcs], logins/logouts [as in who], free disk space [as in
df], print spooler queues [as in lpstat], serial line status [as in stty] etc.
One reason I haven't done these is on the 286 medium model I'm limited to
X64k data+stack and I've used up 99.99% of that. I don't want to go to a large
model because all the far data references will slow down the program too
much. I wanted to keep the CPU usage down to a reasonable level. If someone
expands the capabilities I would appreciate a "#ifdef XENIX286" mode so
I can still use it! Actually, I'm so pressed for memory I've made some
of the popup help windows smaller and decreased the stack size, it still 
runs out on some help windows but the main program still runs.
X
I have included some sample screens (captured directly to a disk file)
showing some of the capabilities. This is by no means a through example, it 
doesn't show any help windows, dynamic scaling of graphs, menu usage, 
modification of sample intervals. If you study sysinfo.h, proc.h, user.h, 
file.h, text.h, inode.h, vars.h you should be able to figure out where the
data comes from for each display. (And of course if its as user friendly as I
hope, I don't even have to explain what you are looking at!) If you can figure 
it out, porting should be no problem. (Hey, I figured it out and nobody told 
me how!) I have run into real problems, I'm drop me a line, I'll see what I
can do. Note that the '*' characters indicate reverse video spaces and line 
drawing sets are used instead of '-' and '|' (you just can't "capture" these 
since they are not true ASCII characters. I do have a "Uniplex" capture mode 
where you can get everything except color).
X
Sample screens :
X
X                            *System*Monitor*Menu*       18:37 Fri, Jun  2, 1989
X
X
X           A : CPU Monitor
X           B : Disk Monitor
X           C : I/O Monitor
X           D : Capacity Monitor
X           E : Miscellaneous Monitor
X           F : User Process Monitor
X           G : Top CPU Process Monitor
X
X
X
X
X
X
X
X
X
X
X
X
X
X*(Q)uit*or*selection*
X
X                                *CPU*Monitor*           18:38 Fri, Jun  2, 1989
X
X  +-( 59)---------------------------+     +-(  8)---------------------------+
X  | *******************             |     | **                              |
X  | +-----+-----+-----+-----+-----+ |     | +-----+-----+-----+-----+-----+ |
X  | 0     20    40    60    80   100|     | 0     20    40    60    80   100|
X  +----------- % CPU Idle ----------+     +----------- % Wait I/O ----------+
X
X
X  +-( 19)---------------------------+     +-( 47)---------------------------+
X  | *******                         |     | ***************                 |
X  | +-----+-----+-----+-----+-----+ |     | +-----+-----+-----+-----+-----+ |
X  | 0     20    40    60    80   100|     | 0     20    40    60    80   100|
X  +----------- % CPU User ----------+     +---------- % Wait Swap ----------+
X
X
X  +-( 21)---------------------------+     +-(  0)---------------------------+
X  | ******                          |     |                                 |
X  | +-----+-----+-----+-----+-----+ |     | +-----+-----+-----+-----+-----+ |
X  | 0     20    40    60    80   100|     | 0     20    40    60    80   100|
X  +---------- % CPU System ---------+     +------ % Wait Physical I/O ------+
X
X
X*(Q)uit,*(T)op,*(W)hen*or*<SPACE>*to*backup*
X
X                                *Disk*Monitor*          18:38 Fri, Jun  2, 1989
X
X  +-(        49)--------------------+     +-(         4)--------------------+
X  | ****************                |     | *************                   |
X  | +-----+-----+-----+-----+-----+ |     | +-----+-----+-----+-----+-----+ |
X  | 0     20    40    60    80   100|     | 0     2     4     6     8     10|
X  +--------- Reads / Second --------+     +-------- Writes / Second --------+
X
X
X  +-(100)---------------------------+     +-( 25)---------------------------+
X  | ******************************* |     | *******                         |
X  | +-----+-----+-----+-----+-----+ |     | +-----+-----+-----+-----+-----+ |
X  | 0     20    40    60    80   100|     | 0     20    40    60    80   100|
X  +---------- % Read Cache ---------+     +--------- % Write Cache ---------+
X
X
X  +-(         0)--------------------+     +-(         0)--------------------+
X  |                                 |     |                                 |
X  | +-----+-----+-----+-----+-----+ |     | +-----+-----+-----+-----+-----+ |
X  | 0     2     4     6     8     10|     | 0     2     4     6     8     10|
X  +------- Swap Ins / Second -------+     +------- Swap Outs / Second ------+
X
X
X*(Q)uit,*(T)op,*(W)hen*or*<SPACE>*to*backup*
X
X                                *I/O*Monitor*           18:38 Fri, Jun  2, 1989
X
X  +-(     30202)--------------------+     +-(       172)--------------------+
X  | **********                      |     | ******                          |
X  | +-----+-----+-----+-----+-----+ |     | +-----+-----+-----+-----+-----+ |
X  | 0    20K   40K   60K   80K  100K|     | 0    200   400   600   800    1K|
X  +---- Read Characters / Second ---+     +--- Write Characters / Second ---+
X
X
X  +-(         0)--------------------+     +-(         0)--------------------+
X  |                                 |     |                                 |
X  | +-----+-----+-----+-----+-----+ |     | +-----+-----+-----+-----+-----+ |
X  | 0     2     4     6     8     10|     | 0     2     4     6     8     10|
X  +---- Read Interrupts / Second ---+     +--- Write Interrupts / Second ---+
X
X
X  +-(         1)--------------------+     +-(       174)--------------------+
X  | ****                            |     | ******                          |
X  | +-----+-----+-----+-----+-----+ |     | +-----+-----+-----+-----+-----+ |
X  | 0     2     4     6     8     10|     | 0    200   400   600   800    1K|
X  +---- Read TTY Chars / Second ----+     +---- Write TTY Chars / Second ---+
X
X
X*(Q)uit,*(T)op,*(W)hen*or*<SPACE>*to*backup*
X
X                              *Capacity*Monitor*        18:38 Fri, Jun  2, 1989
X
X  +-(    345600)--------------------+     Wait count    : 0
X  | ***********                     |     Free mem size : 107520
X  | +-----+-----+-----+-----+-----+ |                     84480
X  | 0   200K  400K  600K  800K    1M|                     74240
X  +------ Free Memory in Bytes -----+                     39424
X                                                          22528
X
X  +-(        11)-------(        60)-+     +-(        11)-------(        40)-+
X  | ****                            |     | ****                            |
X  | +-----+-----+-----+-----+-----+ |     | +-----+-----+-----+-----+-----+ |
X  | 0     20    40    60    80   100|     | 0     20    40    60    80   100|
X  +--------- Process Count ---------+     +---- Open Text Segment Count ----+
X
X
X  +-(        20)-------(       100)-+     +-(        33)-------(       100)-+
X  | *******                         |     | ***********                     |
X  | +-----+-----+-----+-----+-----+ |     | +-----+-----+-----+-----+-----+ |
X  | 0     20    40    60    80   100|     | 0     20    40    60    80   100|
X  +-------- Open File Count --------+     +-------- Open Inode Count -------+
X
X
X*(Q)uit,*(T)op,*(W)hen*or*<SPACE>*to*backup*
X
X                           *Miscellaneous*Monitor*      18:39 Fri, Jun  2, 1989
X
X  +-(        17)--------------------+
X  | ******                          |
X  | +-----+-----+-----+-----+-----+ |
X  | 0     20    40    60    80   100|
X  +----- System Calls / Second -----+
X
X
X  +-(         1)--------------------+     +-(         0)--------------------+
X  | ****                            |     |                                 |
X  | +-----+-----+-----+-----+-----+ |     | +-----+-----+-----+-----+-----+ |
X  | 0     2     4     6     8     10|     | 0     2     4     6     8     10|
X  +--- Process Switches / Second ---+     +--------- Igets / Second --------+
X
X
X  +-(         0)--------------------+     +-(         0)--------------------+
X  |                                 |     |                                 |
X  | +-----+-----+-----+-----+-----+ |     | +-----+-----+-----+-----+-----+ |
X  | 0     2     4     6     8     10|     | 0     2     4     6     8     10|
X  +-------- Nameis / Second --------+     +-------- Dirblks / Second -------+
X
X
X*(Q)uit,*(T)op,*(W)hen*or*<SPACE>*to*backup*
X
X                              *Top*CPU*Monitor*         18:39 Fri, Jun  2, 1989
X
X                            +------------------------------------------------+
X  A : idle                  | ************************************           |
X                            |                                                |
X  B : sh               1639 | *****                                          |
X                            |                                                |
X  C : sh               1638 | **                                             |
X                            |                                                |
X  D : monitor          1620 |                                                |
X                            |                                                |
X                            |                                                |
X                            |                                                |
X                            |                                                |
X                            |                                                |
X                            |                                                |
X                            |                                                |
X                            |                                                |
X                            | +--------+--------+--------+--------+--------+ |
X                            | 0        20       40       60       80      100|
X                            +--------------- % CPU Utilization --------------+
X
X
X*(Q)uit,*(T)op,*(W)hen,*<SPACE>*to*backup*or*selection*
X
X User - jct              *User*Process*Monitor*Menu*    18:39 Fri, Jun  2, 1989
X
X
X           A : 38    -      - sh
X           B : 39    -      - sh
X           C : 1620  -   8% - monitor
X           D : 1639  -      - uucico
X           E : 1638  -      - sh
X           F : 1640  -      - dialHA24
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X*(Q)uit,*(T)op,*(U)ser,*(W)hen,*(Z)ap,*<SPACE>*to*backup*or*selection*
X
X 39 - sh                      *Process*Monitor*         18:40 Fri, Jun  2, 1989
X
X  +-(  0)---------------------------+     Start Time      : 18:19:41
X  |                                 |     Start Date      : Fri, May 26, 1989
X  | +-----+-----+-----+-----+-----+ |     User ID         : jct, jct
X  | 0     20    40    60    80   100|     Group ID        : psm, psm
X  +----------- % CPU User ----------+     TTY             : tty02
X                                          Parent PID      : 1
X                                          Process Group   : 39
X  +-(  0)---------------------------+     Process Status  : Sleeping
X  |                                 |     Process Flags   : Loaded Valid
X  | +-----+-----+-----+-----+-----+ |     Priority        : 28, 20
X  | 0     20    40    60    80   100|     Run Time        : 606038
X  +---------- % CPU System ---------+     Total CPU Time  : 7          - 0%
X                                          CPU User Time   : 2          - 0%
X                                          CPU Sys Time    : 4          - 0%
X  +-(         0)--------------------+     Open Files      : 3
X  |                                 |     Block Reads     : 88
X  | +-----+-----+-----+-----+-----+ |     Block Writes    : 89
X  | 0     2     4     6     8     10|     I/O Count       : 28384
X  +------- I/O Chars / Second ------+     Curr Dir I-node : 1518
X                                          Root Dir I-node : 0
X
X*(Q)uit,*(T)op,*(S)witch,*(W)hen,*(Z)ap*or*<SPACE>*to*backup*
X
X 39 - sh                      *Process*Monitor*         18:40 Fri, Jun  2, 1989
X
X  Umask Value     : -------w-                         Open File Status
X  Ulimit Value    : 2097152                  Fid Typ Mode Cnt Offset     I-node
X  Text Size       : 34816/2                  0   C   RW   3   239175     117
X  Data Size       : 14336                    1   C   RW   3   239175     117
X  Stack Size      : 25088                    2   C   RW   3   239175     117
X  Pending Signals : None
X  Time to Alarm   : 0
X
X  Signal Hangup             Trapped
X  Signal Interrupt          Trapped
X  Signal Quit               Ignored
X  Signal Illegal instruct   Trapped
X  Signal Trace trap         Trapped
X  Signal IOT                Trapped
X  Signal EMT                Trapped
X  Signal FP error           Trapped
X
X
X
X
X
X*(Q)uit,*(T)op,*(S)witch,*(W)hen,*(Z)ap*or*<SPACE>*to*backup*
X
END_OF_FILE
if test 16274 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'README.TOO' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README.TOO'\"
else
echo shar: Extracting \"'README.TOO'\" \(12401 characters\)
sed "s/^X//" >'README.TOO' <<'END_OF_FILE'
Copyright 1989 John C. Tompkins
X
John C. Tompkins
X4616 NW 59th St.
Oklahoma City, OK 73122
X(405) 728-1208
X
This software may be freely copied for private use only. Of course if you
feel the urge or guilt when you see what this program can do for you, I
wouldn't be offended by a contribution.
X
NOTE: This software is VERY dependent on your operating system version.
It has only been tested, in this binary form, on SCO XENIX 286 2.2.1.
It should run, but has not been tested, on other XENIX 286 2.x releases.
It will probably NOT run, in this binary form, on XENIX 386.  It will NOT
run, in this binary form, on Microport UNIX, VENIX or anything else. It will
run on these, and other systems, but not in this binary format. For example,
it also currently runs on a Convergent MiniFrame CTIX system, in another
binary format.
X
The monitor program is a full screen, menu driven performance monitor for
XXENIX and UNIX. It will show all kinds of information about what your
computer is doing in real time. It does most everything ps, pstat ... do
and a lot more, in a lot better format. It will, for example, show free RAM
memory space, per process signal handling, per process open files, top CPU
usage processes, system call frequency, CPU idle time, number of free process
slots and so on. I find it to be VERY useful in program development and 
system operation.
X
Monitor requires a "glass" tty, line printer terminals will not work.  It 
contains context sensitive help on all screens and, I hope, is easy to use. 
All menus have 2 second type-ahead, if you make a valid entry in 2 seconds 
the menu is not shown. Entrys are made by using the up and down arrows and 
pressing ENTER or by pressing the key corresponding to the menu entry. Help 
may be called by function key 1, escape-h or '?'. If you are in a menu and 
have an entry highlighted, help is given on that entry, if no entry is 
highlighted, general help. After an entry is selected, help gives help for 
that entry. Help may be moved through by the down arrow for the next page or 
the up arrow for the previous page.
X
Monitor will typically consume 1 to 2.5 percent of your CPU time for a 5 second
sample interval. If you flip among screens or call help the CPU time will of
course go up. Under static displays (which still update at the sample interval)
X1 to 2.5 percent on the console of an 8 mHZ IBM-AT is typical. It depends
somewhat on what you are currently monitoring. Output to remote serial
terminals, more so if monochrome, will be lower consumers. Faster machines will
have lower consumption of course while a shorter sample interval will increase
CPU usage. 
X
XFive files are included-> monitor, monitor.hlp, help.hlp, screen.hlp and hindex.
X
Installation requires a few more steps than most programs. Because it must
read operating system and user data structures (just like ps), it requires
read access to the following files :
X
X	/xenix
X        /dev/mem
X        /dev/kmem
X        /dev/swap
X
It only needs read access, write access is not required. This can be done
by the following. /xenix is readable by everyone. On XENIX the 3 /dev files
are owned by 'sysinfo', the group is also 'sysinfo', they have read/write 
access for the owner and no access for group or others. Setting the monitor 
program to set-userid and making the owner of monitor to be sysinfo gives 
read/write access to the monitor program. However, write access, as mentioned,
is not needed. Since you have no reason to trust me, I wouldn't either if 
someone could write to my kernel, you should instead change the group on 
monitor to sysinfo and make it set-groupid and remove the set-userid. 
The owner can still be sysinfo, it doesn't matter. Also, add group read 
privilege to the files /dev/mem, /dev/kmem and /dev/swap. This gives read 
only access to these files. After program startup, monitor will set its 
effective uid and gid back to the real uid and gid. Monitor has no facilities 
for creating subproceses.
X
The program needs to be able to read the namelist from /xenix, so read
access is required. By default XENIX allows that. The program will start up
faster, without reading the namelist each time, if you allow it to write a
data file named 'monitor.dat' in the directory /usr/lib/ps. Normally this
directory is owned by sysinfo but the group is bin. Change the group to
sysinfo and add group write access to the directory. The created file,
X'monitor.dat' will be set to mode 0644 on creation. If the /xenix
modification time is newer than the modification time on monitor.dat,
monitor will update monitor.dat when it is started.
X
The program uses an enhanced termcap entry. The following are special key
entries (along with default keystrokes) :
X
KI (^V)   - Insert toggle key
BB (^Q^R) - Top or Home key (beginning of buffer)
XEB (^Q^C) - Bottom or End key (end of buffer)
XFS (^C)   - Page forward (down) key (forward screen)
RS (^R)   - Page back (up) key (reverse screen)
KH (ESCh) - Help key
DC (^G)   - Delete character under cursor key
KC (ESCc) - Cancel input and return key
KP (ESCp) - Print screen key
KQ (ESCq) - Quit key
KB (ESC ) - Backup key
X
See scrout1.c function setterm() for a complete list of directly supported
keys. Note that monitor does not use all of them, other programs may.
X
The program uses screen routines, like curses, but allows for color and
use of a terminals line drawing set. These features make it look much
nicer but are not required. If color is not defined for a terminal, no
color is used and if the line drawing set is not defined, a '-' is used
for horizontal lines, '|' for vertical lines and '+' for corners and ticks.
Having reverse video (standout) defined also helps but is not required.
An example using the console terminal will help explain. The console is
listed in /etc/termcap as 'ansi' and the following additions are used :
X
X        GS=\E12m:GE=\E10m:GB=D3EZB?4YA@C:
X
This defines the line drawing set, using single lines. GS is the sequence
to start 'graphic' mode. GE ends 'graphic' mode and GB is the 11 character
set to draw, horizontal, vertical, center cross, upper left corner, down
tick (like a T), upper right corner, left tick (-|), lower right corner,
up tick (inverted T), lower left corner and right tick (|-).
X
Colors are defined as follows, Although this scheme may be too simple for
many color capable terminals it does work on the console and Tektronix 41xx :
X
X        RC:SC=\E[2;%f;%bm\E[3m%c0,4,2,14,1,5,3,7,8,9,10,11,12,13,6,15:
X
RC is a boolean that means, if color is defined and reverse video (standout)
is requested, Reverse Color instead. SC is the Set Color string, %f is the
location in the string where Foreground color is set, %b is where Background
color is set. %c is the end of the set color string and the start of the
color definition. 16 colors must be specified even if some or all repeat
the same color. In order they are: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA,
CYAN, WHITE, COLOR_8, COLOR_9, COLOR_10, COLOR_11, COLOR_12, COLOR_13,
COLOR_14, COLOR_15. Each color entry is delimited by a comma and is a string
of one or more characters. This example just happens to use strings that
look like numbers. COLOR_8 thru COLOR_15 are not used in the program but
must be given a value.
X
Here is the complete entry I use for the main console on my AT clone :
X
li|ansi|Ansi standard crt:\
X :al=\E[L:am:bs:bw:cd=\E[J:ce=\E[K:cl=\E[2J\E[H:cm=\E[%i%d;%dH:co#80:\
X :dc=\E[P:dl=\E[M:do=\E[B:ei=:ho=\E[H:ic=\E[@:im=:li#25:\
X :nd=\E[C:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:up=\E[A:\
X :kb=^h:ku=\E[A:kd=\E[B:kl=\E[D:kr=\E[C:ms:pt:eo:\
X :GS=\E[12m:GE=\E[10m:GV=\63:GH=D:GB=D3EZB?4YA@C:\
X :G1=?:G2=Z:G3=@:G4=Y:KI=\E[L:BB=\E\E[A:EB=\E\E[B:FS=\E[G:RS=\E[I:\
X :GU=A:GD=B:GC=E:GL=C:GR=\64:RT=^J:\
X :k0=\E[M:k1=\E[N:k2=\E[O:k3=\E[P:\
X :k4=\E[Q:k5=\E[R:k6=\E[S:k7=\E[T:k8=\E[U:k9=\E[V:\
X :BS=\E[5m:BE=\E[0m:HS=\E[1m:HE=\E[0m:RC:\
X :FW=^n:RW=^p:\
X :SC=\E[2;%f;%bm\E[3m%c0,4,2,14,1,5,3,7,8,9,10,11,12,13,6,15:
X
Who said Unix is hard?
X
Now, to specify colors, a file /etc/monitorc is used, if a '.monitorc'
is in a users HOME directory it is used instead. It is quite simple and
contains lines like :
X
XFG BLUE
BG WHITE
HELP_FG WHITE
HELP_BG RED
X
Which means, if the terminal can do color, make the foreground blue and
the background white. Also, the default help foreground is white and the
default help background is red. Specifications in the help file itself may
be used to override the default. The program only uses 2 colors but I have
tried many more, I think 2 works best. The named colors may be any of those
given above, upper or lower case makes no difference.
X
Lastly, the help files 'monitor.hlp', 'help.hlp' and 'screen.hlp' should be
put in the directory /usr/lib/help. If you make any changes to the help
information, issue the command 'hindex monitor.hlp', otherwise the indexes in
the help file are not up to date and you get funny looking help.
X
The help file may also contain various formatting information such as colors,
pop-up window size and location, subhelp menus and many others we don't want
to get into here. The formatting takes the form of "dot commands", for
example .XXC GREEN BLACK starting in the first column says set the
foreground color, for this help screen only, to green and the background
to black. .XXW 12 50 7 15 make this help screen a pop-up window 12 lines
by 50 columns starting at the 7th line and 15th column. .XXT sets the "title"
for a subhelp menu and .XXS sets the available subhelp "selections".
There are a lot of options in the help files that I don't cover completely
here. Please look at the included help files and I think you can figure out
most of it given this start.
X
Note that the screen will update its data every 5 seconds, by default. Use the 
command line option -i # or the runtime menu entry 'W' to tell how often to
update the screen. If you have a pop-up help window, the data under the window 
will still update every time interval seconds.
X
You may set environment variable SCR_PRINTER or SCR_FILE to specify
destinations for copying screen contents when the ESC-p sequence is pressed.
XFor example :
X
SCR_FILE=+monitor.scr
SCR_PRINTER=dumb
X
Says to append the screen dump to the file monitor.scr, without the leading
X'+' the file will be overwritten. Note that in this format the line drawing
characters will always be dumped as '-', '|' and '+'. The printer that is
dumped to is any valid lp printer name.
X
Valid command line options are :
X
X        -i number       - set update interval to "number" of seconds
X                          instead  of default 5.
X        -u user_name    - set initial user process monitor name to
X                          "user_name". The default is the invoking user
X                          name unless you are root which sets it to "All".
X        -a              - set initial user process monitor name to "All".
X
Known problems :
X
On a system doing a lot of swapping (heavy CPU and memory loads) the 
program will sometimes display the wrong name or data for a process. The
problem is finding the location of the process data and reading the 
process data takes 2 seperate steps. If the system moves thing around
between the steps, things get messed up. The program tries to detect
this and just show empty data but its not foolproof. Ps will do the 
same thing by the way ...
X
XFor some reason the initial login shell process start time will often (but
not always) be wrong -> it will show several hours or days before the actual
start. The normal utilities such as 'ps' also show the same incorrect time. 
So, I figure its not really my problem, its in XENIX itself.
X
Under user process monitor, the second screen, you will only see the first
X10 or 11 (depending on the number of lines on your screen) non-default signal
statuses. There is no way to scroll down. Likewise, only the first 18 or 19
open files are shown. I just haven't gotten around to fixing these.
X
Open files are only listed as i-node numbers, there is no efficient way
I know of to get a pathname from an i-number. Everything, such as ncheck,
takes way too much CPU time. Again, its not my fault, its just the way 
UNIX/XENIX stores open files in the kernel to save data space.
X
I've been lazy and haven't updated the help files for a while. The ones
in the worst shape are monitor.hlp section #proc (the user process
monitor). I've been changing it around so much its hard too keep up.
X
END_OF_FILE
if test 12401 -ne `wc -c <'README.TOO'`; then
    echo shar: \"'README.TOO'\" unpacked with wrong size!
fi
# end of 'README.TOO'
fi
if test ! -d 'help' ; then
    echo shar: Creating directory \"'help'\"
    mkdir 'help'
fi
if test -f 'help/help.hlp' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'help/help.hlp'\"
else
echo shar: Extracting \"'help/help.hlp'\" \(2057 characters\)
sed "s/^X//" >'help/help.hlp' <<'END_OF_FILE'
X.XXIstandard         45       2057
X#standard
Help With Help
X.XXW 12 60 7 10
X.XXC BLUE WHITE
X........L.......T.......T.......T.......T.......T.......T.......T.......R......
X        Help may be requested at any time by pressing the HELP key, by@@
X                                                          AAAA        
X        function key 1 or, if you are in a menu, by the "?" key.  One of
X        these keys is how you got to here.  Help may be ended by the
X        pressing "Q" for quit.  You may go to the next help page by
X        RETURN, PAGE_DOWN, NEXT_SCREEN or the DOWN_ARROW key.  You may@@
X        AAAAAA  AAAAAAAAA  AAAAAAAAAAA        AAAAAAAAAA              
X        review a previous page by the SPACE, PAGE_UP, PREV_SCREEN or the@@
X                                      AAAAA  AAAAAAA  AAAAAAAAAAA       
X        UP_ARROW key.  You may return directly to the first page of help by@@
X        AAAAAAAA                                                           
X        pressing "T" for top or the HOME key.  You may end the current@@
X                                    AAAA                              
X        help section and go to the sub-help menu, if it exists, by the
X        "S" key for stop or the END key.@@
X                                AAA     
X
X        From a help menu, you may press a key to make a selection from
X        that help menu.  That menu item may have its own sub-help menu
X        and so on.  Some menus may have entry selections shown as
X        numbers, in this case enter the number and press RETURN to make@@
X                                                         AAAAAA        
X        a selection.  In screen mode, you may use the arrow keys to
X        highlight a menu choice, then press RETURN to select the@@
X                                            AAAAAA              
X        highlighted entry.  Pressing SPACE will back you up through@@
X                                     AAAAA                         
X        help menus, "Q" for quit will take you all the way out of the
X        help menus.
X))
END_OF_FILE
if test 2057 -ne `wc -c <'help/help.hlp'`; then
    echo shar: \"'help/help.hlp'\" unpacked with wrong size!
fi
# end of 'help/help.hlp'
fi
if test ! -d 'include' ; then
    echo shar: Creating directory \"'include'\"
    mkdir 'include'
fi
if test ! -d 'include/km' ; then
    echo shar: Creating directory \"'include/km'\"
    mkdir 'include/km'
fi
if test -f 'include/km/ascii.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'include/km/ascii.h'\"
else
echo shar: Extracting \"'include/km/ascii.h'\" \(1205 characters\)
sed "s/^X//" >'include/km/ascii.h' <<'END_OF_FILE'
X/* ascii.h */
X
X/*
X   Contains control character definitions for the ASCII character set
X*/
X
X/*
X   Created January 16, 1986 by JCT
X*/
X
X#define	NUL	0x00
X#define	SOH	0x01
X#define	STX	0x02
X#define	ETX	0x03
X#define	EOT	0x04
X#define	ENG	0x05
X#define	ACK	0x06
X#define	BEL	0x07
X#define	BS	0x08
X#define	HT	0x09
X#define	LF	0x0a
X#define	VT	0x0b
X#define	FF	0x0c
X#define	CR	0x0d
X#define	SO	0x0e
X#define	SI	0x0f
X#define	DLE	0x10
X#define	DC1	0x11
X#define	DC2	0x12
X#define	DC3	0x13
X#define	DC4	0x14
X#define	NAK	0x15
X#define	SYN	0x16
X#define	ETB	0x17
X#define	CAN	0x18
X#define	EM	0x19
X#define	SUB	0x1a
X#define	ESC	0x1b
X#define	FS	0x1c
X#define	GS	0x1d
X#define	RS	0x1e
X#define	VS	0x1f
X#define	DEL	0x7f
X
X#define CTRL_A	0x01
X#define CTRL_B	0x02
X#define CTRL_C	0x03
X#define CTRL_D	0x04
X#define CTRL_E	0x05
X#define CTRL_F  0x06
X#define CTRL_G	0x07
X#define CTRL_H	0x08
X#define CTRL_I	0x09
X#define CTRL_J	0x0a
X#define CTRL_K	0x0b
X#define CTRL_L	0x0c
X#define CTRL_M	0x0d
X#define CTRL_N	0x0e
X#define CTRL_O	0x0f
X#define CTRL_P	0x10
X#define CTRL_Q	0x11
X#define CTRL_R	0x12
X#define CTRL_S	0x13
X#define CTRL_T	0x14
X#define CTRL_U	0x15
X#define CTRL_V	0x16
X#define CTRL_W	0x17
X#define CTRL_X	0x18
X#define CTRL_Y	0x19
X#define CTRL_Z	0x1a
X
END_OF_FILE
if test 1205 -ne `wc -c <'include/km/ascii.h'`; then
    echo shar: \"'include/km/ascii.h'\" unpacked with wrong size!
fi
# end of 'include/km/ascii.h'
fi
if test -f 'include/km/defs.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'include/km/defs.h'\"
else
echo shar: Extracting \"'include/km/defs.h'\" \(538 characters\)
sed "s/^X//" >'include/km/defs.h' <<'END_OF_FILE'
X/* defs.h */
X
X/*
X   Defines various standard things
X*/
X
X/*
X   Created January 16, 1986 by JCT
X*/
X
X#ifndef UNIX
X#define UNIX		(1)
X#endif
X
X#ifndef XENIX
X#define XENIX		(1)
X#endif
X
X#ifndef XENIX86
X#define XENIX86		(1)
X#endif
X
X#ifndef TRUE
X#define TRUE		(1)
X#endif
X
X#ifndef FALSE
X#define FALSE		(0)
X#endif
X
X#define ERROR		(-1)
X#define UNDETERMINED	(-1)
X
X#if DIAG
X#define DEBUG(x)	x
X#else
X#define DEBUG(x)
X#endif
X
X#define REGISTER	register
X
X#if MIXED
X#define FAR		far
X#define FNULL		(char far *)0
X#else
X#define FAR
X#define FNULL		NULL
X#endif
X
END_OF_FILE
if test 538 -ne `wc -c <'include/km/defs.h'`; then
    echo shar: \"'include/km/defs.h'\" unpacked with wrong size!
fi
# end of 'include/km/defs.h'
fi
if test -f 'include/km/docmd.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'include/km/docmd.h'\"
else
echo shar: Extracting \"'include/km/docmd.h'\" \(92 characters\)
sed "s/^X//" >'include/km/docmd.h' <<'END_OF_FILE'
X/* Include file for do command */
X
X/*
X   August 1, 1988 by JCT
X*/
X
extern int do_command();
END_OF_FILE
if test 92 -ne `wc -c <'include/km/docmd.h'`; then
    echo shar: \"'include/km/docmd.h'\" unpacked with wrong size!
fi
# end of 'include/km/docmd.h'
fi
if test -f 'include/km/rdspec.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'include/km/rdspec.h'\"
else
echo shar: Extracting \"'include/km/rdspec.h'\" \(1727 characters\)
sed "s/^X//" >'include/km/rdspec.h' <<'END_OF_FILE'
X/* Header file for read spec file */
X
X/*
X   Contains definitions and external declarations for using
X   read spec file
X*/
X
X/*
X   Created August 14, 1986 by JCT
X*/
X
X#define NONE	    0
X#define LOWER_CASE  1
X#define UPPER_CASE  2
X
extern char   cspec, *sspec, *lspec, *espec;
extern int    ispec, rs_abort, rs_eol, rs_eof, rs_errs, rs_stdin, rs_rd_decimal;
extern long   lispec, dspec, tspec;
extern double fspec;
extern int    rs_raw_mode, rs_line_mode;
X
extern int  rs_get_key_with_timeout();
extern void rs_check_continue();
extern void num_format_error();
extern void str_format_error();
extern void date_format_error();
extern void time_format_error();
extern void int_data_error();
extern void long_data_error();
extern void flt_data_error();
extern void str_data_error();
extern void date_data_error();
extern void time_data_error();
extern void rs_error();
extern int  sline_cnt();
extern int  sline_index();
extern int  get_sline();
extern int  get_lspec();
extern int  get_schar();
extern int  put_schar();
extern int  get_rspec();
extern int  put_rspec();
extern int  get_cspec();
extern int  put_cspec();
extern int  eat_sspc();
extern int  get_sspc();
extern int  test_number();
extern int  get_sint();
extern int  get_ispec();
extern int  get_slong();
extern int  get_lispec();
extern int  get_sflt();
extern int  get_fspec();
extern int  get_sstr();
extern int  get_sspec();
extern long tz_fix();
extern int  get_sdate();
extern int  get_dspec();
extern int  get_stime();
extern int  get_tspec();
extern int  set_sexpr();
extern int  get_sexpr();
extern int  get_espec();
extern int  open_stdin();
extern int  open_spec();
extern int  rewind_spec();
extern int  close_spec();
X
X#define test_ispec()	(test_number())
X
END_OF_FILE
if test 1727 -ne `wc -c <'include/km/rdspec.h'`; then
    echo shar: \"'include/km/rdspec.h'\" unpacked with wrong size!
fi
# end of 'include/km/rdspec.h'
fi
if test -f 'include/km/string1.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'include/km/string1.h'\"
else
echo shar: Extracting \"'include/km/string1.h'\" \(355 characters\)
sed "s/^X//" >'include/km/string1.h' <<'END_OF_FILE'
X/* Include file for string1 */
X
extern char *strend();
extern char *strlwr();
extern char *strupr();
extern char *strrev();
extern char *strset();
extern char *strnset();
extern char *strint();
extern char *strleft();
extern char *strpad();
extern int  streq();
extern int  strneq();
extern int  substr();
extern char *strpos();
extern char *basename();
X
END_OF_FILE
if test 355 -ne `wc -c <'include/km/string1.h'`; then
    echo shar: \"'include/km/string1.h'\" unpacked with wrong size!
fi
# end of 'include/km/string1.h'
fi
if test -f 'include/km/string2.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'include/km/string2.h'\"
else
echo shar: Extracting \"'include/km/string2.h'\" \(249 characters\)
sed "s/^X//" >'include/km/string2.h' <<'END_OF_FILE'
X/* Include file for string2 */
X
X/*
X   Definitions used in date and time formatting
X*/
X
X#define TIME_SECONDS	0x0001
X#define DATE_NUMERIC	0x0002
X#define DATE_FIRST	0x0004
X#define DATE_LONG       0x0008
X
extern char *strdate();
extern char *strtime();
END_OF_FILE
if test 249 -ne `wc -c <'include/km/string2.h'`; then
    echo shar: \"'include/km/string2.h'\" unpacked with wrong size!
fi
# end of 'include/km/string2.h'
fi
if test -f 'include/km/termcap.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'include/km/termcap.h'\"
else
echo shar: Extracting \"'include/km/termcap.h'\" \(1360 characters\)
sed "s/^X//" >'include/km/termcap.h' <<'END_OF_FILE'
X/* Include file for get termcap capabilities */
X
X#ifdef UNIX
X#ifndef IOCTYPE
X#include <termio.h>
X#endif
X#endif
X
X/*
X   Define special keys
X*/
X
X#define K_UP		0x80
X#define K_DOWN		0x81
X#define K_LEFT		0x82
X#define K_RIGHT		0x83
X#define K_BACKTAB	0x84
X
X#define K_BEG_SCREEN	0x90
X#define K_END_SCREEN	0x91
X#define K_BEG_BUF	0x92
X#define K_END_BUF	0x93
X#define K_BEG_LINE	0x94
X#define K_END_LINE	0x95
X
X#define K_FWD_SCREEN	0xA0
X#define K_BWD_SCREEN	0xA1
X#define K_FWD_WORD	0xA2
X#define K_BWD_WORD	0xA3
X
X#define K_DEL_LINE	0xB0
X#define K_DEL_WORD	0xB1
X#define K_DEL_CHAR	0xB2
X
X#define K_INSERT	0xC0
X#define K_HELP		0xC1
X#define K_CANCEL	0xC2
X#define K_QUIT		0xC3
X#define K_BACKUP	0xC4
X#define K_PRINT		0xC5
X
X#define K_F0		0xD0
X#define K_F1		0xD1
X#define K_F2		0xD2
X#define K_F3		0xD3
X#define K_F4		0xD4
X#define K_F5		0xD5
X#define K_F6		0xD6
X#define K_F7		0xD7
X#define K_F8		0xD8
X#define K_F9		0xD9
X#define K_F10		0xDA
X#define K_F11		0xDB
X
X#ifdef DOS
typedef struct
X  {
X    int code;
X    int key;
X  } LOOKUP;
X#else
X#define KEY_BUF_SIZE 20
X#define KEY_TBL_SIZE 40
X
typedef struct
X  {
X    char *str;
X    int  key;
X  } KEY_TBL;
X#endif
X
X#ifdef UNIX
typedef	struct termio TERMIO;
X#else
typedef int TERMIO;
X#endif
extern char   *Def_term, ttytype[];
extern int    My_term;
extern short  ospeed;
extern char   *BC, *UP, PC;
extern TERMIO _tty, _stty;
extern int    _tty_ch;
X
END_OF_FILE
if test 1360 -ne `wc -c <'include/km/termcap.h'`; then
    echo shar: \"'include/km/termcap.h'\" unpacked with wrong size!
fi
# end of 'include/km/termcap.h'
fi
if test ! -d 'lib' ; then
    echo shar: Creating directory \"'lib'\"
    mkdir 'lib'
fi
if test -f 'lib/makeMmonlib' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'lib/makeMmonlib'\"
else
echo shar: Extracting \"'lib/makeMmonlib'\" \(1689 characters\)
sed "s/^X//" >'lib/makeMmonlib' <<'END_OF_FILE'
LIB = ./Mlibmon.a
IKMDIR = ../include
SDIR = ./
LIBOBJS = $(LIB)(docmd.o)\
X	  $(LIB)(string1.o)\
X	  $(LIB)(string2.o)\
X	  $(LIB)(scrops1.o)\
X	  $(LIB)(scrhelp.o)\
X	  $(LIB)(scrin1.o)\
X	  $(LIB)(scrin2.o)\
X	  $(LIB)(scrinput.o)\
X	  $(LIB)(scrout1.o)\
X	  $(LIB)(scrout2.o)\
X	  $(LIB)(scrout3.o)\
X	  $(LIB)(scrout4.o)\
X	  $(LIB)(scrout5.o)\
X	  $(LIB)(scrout6.o)\
X	  $(LIB)(scrout7.o)\
X	  $(LIB)(scrout8.o)\
X	  $(LIB)(scrout9.o)\
X	  $(LIB)(rdspec.o)\
X	  $(LIB)(termcap.o)\
X	  $(LIB)(tgoto.o)\
X	  $(LIB)(tputs.o)
X
X$(LIB):	$(LIBOBJS)
X	ranlib $(LIB)
X	@echo $(LIB) is now up to date
X
X$(LIB)(scrops1.o):
X	/bin/cc -c -Ox -Mme2 -LARGE -I$(IKMDIR) scrops1.c
X	ar rv $@ scrops1.o
X	size scrops1.o
X	rm -f scrops1.o
X
X$(LIB)(scrops2.o):
X	/bin/cc -c -Ox -Mme2 -LARGE -I$(IKMDIR) scrops2.c
X	ar rv $@ scrops2.o
X	size scrops2.o
X	rm -f scrops2.o
X
X$(LIB)(scrhelp.o): help.c
X	/bin/cc -c -Ox -Mme2 -LARGE -I$(IKMDIR) help.c
X	mv help.o scrhelp.o
X	ar rv $@ scrhelp.o
X	size scrhelp.o
X	rm -f scrhelp.o
X
X$(LIB)(scrin1.o):
X	/bin/cc -c -Ox -Mme2 -LARGE -I$(IKMDIR) scrin1.c
X	ar rv $@ scrin1.o
X	size scrin1.o
X	rm -f scrin1.o
X
X$(LIB)(scrin2.o):
X	/bin/cc -c -Ox -Mme2 -LARGE -I$(IKMDIR) scrin2.c
X	ar rv $@ scrin2.o
X	size scrin2.o
X	rm -f scrin2.o
X
X$(LIB)(scrinput.o):
X	/bin/cc -c -Ox -Mme2 -LARGE -I$(IKMDIR) scrinput.c
X	ar rv $@ scrinput.o
X	size scrinput.o
X	rm -f scrinput.o
X
X$(LIB)(scrout1.o):
X	/bin/cc -c -Ox -Mme2 -LARGE -I$(IKMDIR) scrout1.c
X	ar rv $@ scrout1.o
X	size scrout1.o
X	rm -f scrout1.o
X
X$(LIB)(scrout5.o):
X	/bin/cc -c -Ox -Mme2 -LARGE -I$(IKMDIR) scrout5.c
X	ar rv $@ scrout5.o
X	size scrout5.o
X	rm -f scrout5.o
X
X.c.a:
X	/bin/cc -c -Ox -Mme2 -I$(IKMDIR) $<
X	ar rv $@ $*.o
X	size $*.o
X	rm -f $*.o
X
X.PRECIOUS:	$(LIB)
X
END_OF_FILE
if test 1689 -ne `wc -c <'lib/makeMmonlib'`; then
    echo shar: \"'lib/makeMmonlib'\" unpacked with wrong size!
fi
# end of 'lib/makeMmonlib'
fi
if test -f 'lib/makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'lib/makefile'\"
else
echo shar: Extracting \"'lib/makefile'\" \(51 characters\)
sed "s/^X//" >'lib/makefile' <<'END_OF_FILE'
TARGETS = Mmonlib
X
Mmonlib:
X	@make -f makeMmonlib
X
END_OF_FILE
if test 51 -ne `wc -c <'lib/makefile'`; then
    echo shar: \"'lib/makefile'\" unpacked with wrong size!
fi
# end of 'lib/makefile'
fi
if test -f 'lib/scrout2.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'lib/scrout2.c'\"
else
echo shar: Extracting \"'lib/scrout2.c'\" \(2546 characters\)
sed "s/^X//" >'lib/scrout2.c' <<'END_OF_FILE'
X/* module screen output */
X
X/*
X   provides UNIX "curses" type routines
X*/
X
X/*
X   created May 5, 1987 by JCT
X*/
X
X/*
X *	Copyright (c) John C. Tompkins 1989
X *	All rights reserved.
X *
X *	Permission is granted to use this for any personal, noncommercial use.
X *	You may not distribute source or executable code for profit, nor
X *	may you distribute it with a commercial product without the prior
X *      written consent of the author.  Please send modifications to the 
X *      author for inclusion in updates to the program.
X */
X
X#include <stdio.h>
X
X#include <km/defs.h>
X#include <km/scrio.h>
X
int box(win)				/* draw a box around a window */
X  REGISTER WINDOW *win;
X{
X  if (draw_box(win, 0, 0, win->y_max - 1, win->x_max - 1))
X    {
X      win->flags |= BOX_FLAG;
X      return(TRUE);
X    }
X  else
X    return(FALSE);
X}
X
int draw_box(win, y_min, x_min, y_max, x_max)
X  WINDOW *win;
X  int    y_min;
X  int    x_min;
X  int    y_max;
X  int    x_max;
X{
X  int y, x;
X
X  if (win->flags & BOX_FLAG)
X    {
X      if ((y_min < 1) || (x_min < 1) ||
X	  (y_max >= (win->y_max - 1)) || (x_max >= (win->x_max - 1)))
X        return(FALSE);
X    }
X  else
X    {
X      if ((y_min < 0) || (x_min < 0) ||
X	  (y_max >= win->y_max) || (x_max >= win->x_max))
X        return(FALSE);
X    }
X  wmove(win, y_min, x_min);
X  waddgraphic(win, G_UL);		/* upper left corner */
X  for (x = x_min + 1; x < x_max; x++)	/* top line */
X    waddgraphic(win, G_H);
X  waddgraphic(win, G_UR);		/* upper right corner */
X  for (y = y_min + 1; y < y_max; y++)	/* vertical lines */
X    {
X      wmove(win, y, x_min);		/* left side */
X      waddgraphic(win, G_V);
X      wmove(win, y, x_max);		/* right side */
X      waddgraphic(win, G_V);
X    }
X  wmove(win, y_max, x_min);
X  waddgraphic(win, G_LL);		/* lower left corner */
X  for (x = x_min + 1; x < x_max; x++)	/* bottom line */
X    waddgraphic(win, G_H);
X  waddgraphic(win, G_LR);		/* lower right corner */
X  return(TRUE);
X}
X
int unbox(win)				/* get rid of box border */
X  REGISTER WINDOW *win;
X{
X  int y, x;
X
X  if (win && (win->flags & BOX_FLAG))
X    {
X      for (x = 0; x < win->x_max; x++)		/* top line */
X        waddch(win, ' ');
X      for (y = 1; y < (win->y_max - 1); y++)	/* vertical lines */
X        {
X          wmove(win, y, 0);			/* left side */
X          waddch(win, ' ');
X          wmove(win, y, win->x_max - 1);	/* right side */
X          waddch(win, ' ');
X        }
X      for (x = 0; x < win->x_max; x++)		/* bottom line */
X        waddch(win, ' ');
X      win->flags &= ~BOX_FLAG;
X      return(TRUE);
X    }
X  else
X    return(FALSE);
X}
X
END_OF_FILE
if test 2546 -ne `wc -c <'lib/scrout2.c'`; then
    echo shar: \"'lib/scrout2.c'\" unpacked with wrong size!
fi
# end of 'lib/scrout2.c'
fi
if test -f 'lib/scrout4.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'lib/scrout4.c'\"
else
echo shar: Extracting \"'lib/scrout4.c'\" \(1919 characters\)
sed "s/^X//" >'lib/scrout4.c' <<'END_OF_FILE'
X/* module screen output */
X
X/*
X   provides UNIX "curses" type routines
X*/
X
X/*
X   created May 5, 1987 by JCT
X*/
X
X/*
X *	Copyright (c) John C. Tompkins 1989
X *	All rights reserved.
X *
X *	Permission is granted to use this for any personal, noncommercial use.
X *	You may not distribute source or executable code for profit, nor
X *	may you distribute it with a commercial product without the prior
X *      written consent of the author.  Please send modifications to the 
X *      author for inclusion in updates to the program.
X */
X
X#include <stdio.h>
X
X#include <km/defs.h>
X#include <km/scrio.h>
X
X#ifdef DOS				/* must come after <km/defs.h> */
X#include <stdarg.h>
X#include <dos.h>
X#else
X#include <varargs.h>
X#endif
X
X#ifdef DOS
int printw(format)
X  int format;
X{
X  va_list args;
X  char    *fmt;
X  char    str[150];
X
X  va_start(args, format);
X  args = (void *)(((int *)args)--);	/* WARNING only for bug fix in TurboC */
X  fmt = va_arg(args, char*);
X  vsprintf(str, fmt, args);
X  va_end(args);
X  return(waddstr(stdscr, str));
X}
X#else
int printw(va_alist)			/* printf on stdscr */
X  va_dcl
X{
X  va_list args;
X  char    *fmt;
X  char    str[150];
X
X  va_start(args);
X  fmt = va_arg(args, char*);
X  vsprintf(str, fmt, args);
X  va_end(args);
X  return(waddstr(stdscr, str));
X}
X#endif
X
X#ifdef DOS
int wprintw(format)
X  int format;
X{
X  va_list args;
X  WINDOW  *win;
X  char    *fmt;
X  char    str[150];
X
X  va_start(args, format);
X  args = (void *)(((int *)args)--);	/* WARNING only for bug fix in TurboC */
X  win = va_arg(args, WINDOW*);
X  fmt = va_arg(args, char*);
X  vsprintf(str, fmt, args);
X  va_end(args);
X  return(waddstr(win, str));
X}
X#else
int wprintw(va_alist)			/* printf on a window */
X  va_dcl
X{
X  va_list args;
X  WINDOW  *win;
X  char    *fmt;
X  char    str[150];
X
X  va_start(args);
X  win = va_arg(args, WINDOW*);
X  fmt = va_arg(args, char*);
X  vsprintf(str, fmt, args);
X  va_end(args);
X  return(waddstr(win, str));
X}
X#endif
X
END_OF_FILE
if test 1919 -ne `wc -c <'lib/scrout4.c'`; then
    echo shar: \"'lib/scrout4.c'\" unpacked with wrong size!
fi
# end of 'lib/scrout4.c'
fi
if test -f 'lib/scrout7.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'lib/scrout7.c'\"
else
echo shar: Extracting \"'lib/scrout7.c'\" \(2509 characters\)
sed "s/^X//" >'lib/scrout7.c' <<'END_OF_FILE'
X/* module screen output */
X
X/*
X   provides UNIX "curses" type routines
X*/
X
X/*
X   created May 5, 1987 by JCT
X*/
X
X/*
X *	Copyright (c) John C. Tompkins 1989
X *	All rights reserved.
X *
X *	Permission is granted to use this for any personal, noncommercial use.
X *	You may not distribute source or executable code for profit, nor
X *	may you distribute it with a commercial product without the prior
X *      written consent of the author.  Please send modifications to the 
X *      author for inclusion in updates to the program.
X */
X
X#include <stdio.h>
X
X#include <km/defs.h>
X#include <km/scrio.h>
X
int winsch(win, ch)			/* insert a char in window */
X  WINDOW *win;
X  int    ch;
X{
X  int                 i;
X  YX_ELEMENT	      *last;
X  REGISTER YX_ELEMENT *ptr1;
X  REGISTER YX_ELEMENT *ptr2;
X
X  i = win->x_max - win->x_cur - 1;
X  if (win->flags & BOX_FLAG)
X    i--;
X  ptr1 = win->ch_cur + i;
X  ptr2 = ptr1 - 1;
X  last = ptr1;
X  for ( ; i; i--)
X    *ptr1-- = *ptr2--;
X  ptr1->ch = ch;
X  ptr1->color = win->color;
X  ptr1->attrib = win->attrib;
X  ptr1->ch_flags = 0;
X  if (win->ch_cur < win->ch_first)
X    win->ch_first = win->ch_cur;
X  if (last > win->ch_last)
X    win->ch_last = last;
X  win->flags &= ~NO_CHANGE;
X  return(TRUE);
X}
X
int winsertln(win)          		/* insert a line in window */
X  WINDOW *win;
X{
X  int                 i, j, x;
X  YX_ELEMENT          buf, *first;
X  REGISTER YX_ELEMENT *ptr1;
X  REGISTER YX_ELEMENT *ptr2;
X
X  buf.ch = ' ';
X  if (win->ch_flags & REVERSED_COLOR)
X    buf.color = (((win->color >> 4) & 0x0f) || ((win->color << 4) & 0xf0));
X  else
X    buf.color = win->color;
X  buf.attrib = 0;
X  buf.ch_flags = 0;
X  ptr1 = win->buf + win->buf_len - 1;
X  ptr2 = ptr1 - win->x_max;
X  first = win->ch_cur - win->x_cur;
X  i = (win->buf + win->buf_len) - first;
X  j = i - win->x_max;
X  if (win->flags & BOX_FLAG)
X    {
X      ptr1 -= (win->x_max + 1);
X      ptr2 -= (win->x_max + 1);
X      i -= (win->x_max + 2);
X      j -= (win->x_max + 2);
X      x = win->x_max - 2;
X      for ( ; j; )
X        {
X	  if (x)
X	    {
X	      x--;
X              *ptr1-- = *ptr2--;
X	      i--;
X	      j--;
X	    }
X	  else
X	    {
X	      x = win->x_max - 2;
X	      ptr1 -= 2;
X	      ptr2 -= 2;
X	      i -= 2;
X	      j -= 2;
X	    }
X	}
X      ptr1 -=2;
X      i -= 2;
X    }
X  else
X    {
X      for ( ; j; i--, j--)
X        *ptr1-- = *ptr2--;
X    }
X  for ( ; i; i--)
X    *ptr1-- = buf;
X  if (first < win->ch_first)
X    win->ch_first = first;
X  win->ch_last = win->buf + win->buf_len - 1;
X  win->flags &= ~NO_CHANGE;
X  return(TRUE);
X}
X
END_OF_FILE
if test 2509 -ne `wc -c <'lib/scrout7.c'`; then
    echo shar: \"'lib/scrout7.c'\" unpacked with wrong size!
fi
# end of 'lib/scrout7.c'
fi
if test -f 'lib/tputs.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'lib/tputs.c'\"
else
echo shar: Extracting \"'lib/tputs.c'\" \(1995 characters\)
sed "s/^X//" >'lib/tputs.c' <<'END_OF_FILE'
X/* Module put terminal string */
X
X/*
X   Provides the Berckley UNIX tputs() function of termcap
X*/
X
X/*
X   Created October 17, 1987 by JCT
X*/
X
X/*
X *	Copyright (c) John C. Tompkins 1989
X *	All rights reserved.
X *
X *	Permission is granted to use this for any personal, noncommercial use.
X *	You may not distribute source or executable code for profit, nor
X *	may you distribute it with a commercial product without the prior
X *      written consent of the author.  Please send modifications to the 
X *      author for inclusion in updates to the program.
X */
X
X#include <ctype.h>
X
extern char  PC;
extern short ospeed;
X
void tputs(cp, cnt, outc)
X  char *cp;
X  int  cnt;
X  void (*outc)();
X{
X#ifdef DOS
X  if (cp)
X    {
X      while (*cp)
X	(*outc)(*cp++);
X    }
X#else
X  int total;
X
X/*
X   MAX_BAUD and tbl[] are system dependent
X   
X   Define MAX_BAUD to be the integer equivlent of the maximum baud rate
X   the system supports. See sgtty.h or termio.h.
X
X   Fill tbl[] with 0 thru MAX_BAUD values, one per baud rate such that
X   value = 100000 / baud_rate
X*/
X
X#define MAX_BAUD 13
X
X  static int tbl[] =
X    {
X      0,		/* Baud 0 */
X      2000,		/* Baud 50 */
X      1333,		/* Baud 75 */
X      909,		/* Baud 110 */
X      746,		/* Baud 134 */
X      666,		/* Baud 150 */
X      500,		/* Baud 200 */
X      333,		/* Baud 300 */
X      166,		/* Baud 600 */
X      83,		/* Baud 1200 */
X      55,		/* Baud 1800 */
X      41,		/* Baud 2400 */
X      20,		/* Baud 4800 */
X      10,		/* Baud 9600 */
X    };
X
X  if (cp)
X    {
X      total = 0;
X      if (isdigit(*cp))
X	{
X	  while (isdigit(*cp))
X	    total = (total * 10) + *cp++ - '0';
X          total *= 10;
X	}
X      else if (*cp == '.')
X	{
X	  if (isdigit(*++cp))
X	    {
X	      total += *cp++ - '0';
X	      while (isdigit(*cp))
X		cp++;
X	    }
X	}
X      else if (*cp == '*')
X	{
X	  cp++;
X	  total *= cnt;
X	}
X      while (*cp)
X	(*outc)(*cp++);
X      if (total && ospeed && (ospeed <= MAX_BAUD))
X	{
X	  total /= tbl[ospeed];
X	  while (total--)
X	    (*outc)(PC);
X	}
X    }
X#endif
X}
X
END_OF_FILE
if test 1995 -ne `wc -c <'lib/tputs.c'`; then
    echo shar: \"'lib/tputs.c'\" unpacked with wrong size!
fi
# end of 'lib/tputs.c'
fi
if test -f 'makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'makefile'\"
else
echo shar: Extracting \"'makefile'\" \(699 characters\)
sed "s/^X//" >'makefile' <<'END_OF_FILE'
X#
X# Makefile for XENIX 286 version of monitor.
X# Don't forget to go to the ./lib directory and make the library!
X#
X
LIB = ./lib/Mlibmon.a
IKMDIR = ./include
X
monitor:	monitor1.o\
X	monitor2.o\
X	monproc.o\
X	montop.o\
X	$(MONLIB)
X	cc -o monitor -Mm -F 600 monitor1.o monitor2.o monproc.o montop.o $(LIB)
X
monitor1.o:	monitor1.c
X	cc -c -Ox -Mme2 -LARGE -I$(IKMDIR) monitor1.c
X	
monitor2.o:	monitor2.c
X	cc -c -Ox -Mme2 -LARGE -I$(IKMDIR) monitor2.c
X	
monproc.o:	monproc.c
X	cc -c -Ox -Mme2 -LARGE -I$(IKMDIR) monproc.c
X
montop.o:	montop.c
X	cc -c -Ox -Mme2 -LARGE -I$(IKMDIR) montop.c
X
hindex:	hindex.o\
X	$(KMLIB)
X	cc -o hindex -Mm hindex.o $(LIB)
X
hindex.o:	hindex.c
X	cc -c -Ox -Mme2 -I$(IKMDIR) hindex.c
X
END_OF_FILE
if test 699 -ne `wc -c <'makefile'`; then
    echo shar: \"'makefile'\" unpacked with wrong size!
fi
# end of 'makefile'
fi
echo shar: End of archive 1 \(of 9\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 9 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0