Use the new getmaxx and getmaxy macros instead of directly accessing
the private fields of WINDOW.
This commit is contained in:
parent
e84c875c31
commit
8fd3f56f2c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: iostat.c,v 1.6 1996/10/25 18:30:52 scottr Exp $ */
|
||||
/* $NetBSD: iostat.c,v 1.7 1997/05/24 00:48:24 jtc Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1992, 1993
|
||||
@ -37,7 +37,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)iostat.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
static char rcsid[] = "$NetBSD: iostat.c,v 1.6 1996/10/25 18:30:52 scottr Exp $";
|
||||
static char rcsid[] = "$NetBSD: iostat.c,v 1.7 1997/05/24 00:48:24 jtc Exp $";
|
||||
#endif not lint
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -132,7 +132,7 @@ numlabels(row)
|
||||
int i, col, regions, ndrives;
|
||||
|
||||
#define COLWIDTH 14
|
||||
#define DRIVESPERLINE ((wnd->maxx - INSET) / COLWIDTH)
|
||||
#define DRIVESPERLINE ((getmaxx(wnd) - INSET) / COLWIDTH)
|
||||
for (ndrives = 0, i = 0; i < dk_ndrive; i++)
|
||||
if (cur.dk_select[i])
|
||||
ndrives++;
|
||||
@ -140,7 +140,7 @@ numlabels(row)
|
||||
/*
|
||||
* Deduct -regions for blank line after each scrolling region.
|
||||
*/
|
||||
linesperregion = (wnd->maxy - row - regions) / regions;
|
||||
linesperregion = (getmaxy(wnd) - row - regions) / regions;
|
||||
/*
|
||||
* Minimum region contains space for two
|
||||
* label lines and one line of statistics.
|
||||
@ -150,9 +150,9 @@ numlabels(row)
|
||||
col = 0;
|
||||
for (i = 0; i < dk_ndrive; i++)
|
||||
if (cur.dk_select[i] /*&& cur.dk_bytes[i] != 0.0*/) {
|
||||
if (col + COLWIDTH >= wnd->maxx - INSET) {
|
||||
if (col + COLWIDTH >= getmaxx(wnd) - INSET) {
|
||||
col = 0, row += linesperregion + 1;
|
||||
if (row > wnd->maxy - (linesperregion + 1))
|
||||
if (row > getmaxy(wnd) - (linesperregion + 1))
|
||||
break;
|
||||
}
|
||||
mvwaddstr(wnd, row, col + 4, cur.dk_name[i]);
|
||||
@ -175,7 +175,7 @@ barlabels(row)
|
||||
linesperregion = 2 + secs;
|
||||
for (i = 0; i < dk_ndrive; i++)
|
||||
if (cur.dk_select[i] /*&& cur.dk_bytes[i] != 0.0*/) {
|
||||
if (row > wnd->maxy - linesperregion)
|
||||
if (row > getmaxy(wnd) - linesperregion)
|
||||
break;
|
||||
mvwprintw(wnd, row++, 0, "%3.3s KBps|", cur.dk_name[i]);
|
||||
mvwaddstr(wnd, row++, 0, " tps|");
|
||||
@ -214,7 +214,7 @@ showiostat()
|
||||
row += 2;
|
||||
for (i = 0; i < dk_ndrive; i++)
|
||||
if (cur.dk_select[i] /*&& cur.dk_bytes[i] != 0.0*/) {
|
||||
if (row > wnd->maxy - linesperregion)
|
||||
if (row > getmaxy(wnd) - linesperregion)
|
||||
break;
|
||||
row = stats(row, INSET, i);
|
||||
}
|
||||
@ -227,9 +227,9 @@ showiostat()
|
||||
winsertln(wnd);
|
||||
for (i = 0; i < dk_ndrive; i++)
|
||||
if (cur.dk_select[i] /*&& cur.dk_bytes[i] != 0.0*/) {
|
||||
if (col + COLWIDTH >= wnd->maxx) {
|
||||
if (col + COLWIDTH >= getmaxx(wnd)) {
|
||||
col = 0, row += linesperregion + 1;
|
||||
if (row > wnd->maxy - (linesperregion + 1))
|
||||
if (row > getmaxy(wnd) - (linesperregion + 1))
|
||||
break;
|
||||
wmove(wnd, row + linesperregion, 0);
|
||||
wdeleteln(wnd);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mbufs.c,v 1.2 1995/01/20 08:52:02 jtc Exp $ */
|
||||
/* $NetBSD: mbufs.c,v 1.3 1997/05/24 00:48:26 jtc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1992, 1993
|
||||
@ -37,7 +37,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
static char rcsid[] = "$NetBSD: mbufs.c,v 1.2 1995/01/20 08:52:02 jtc Exp $";
|
||||
static char rcsid[] = "$NetBSD: mbufs.c,v 1.3 1997/05/24 00:48:26 jtc Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -105,9 +105,9 @@ showmbufs()
|
||||
|
||||
if (mb == 0)
|
||||
return;
|
||||
for (j = 0; j < wnd->maxy; j++) {
|
||||
for (j = 0; j < getmaxy(wnd); j++) {
|
||||
max = 0, index = -1;
|
||||
for (i = 0; i < wnd->maxy; i++)
|
||||
for (i = 0; i < getmaxy(wnd); i++)
|
||||
if (mb->m_mtypes[i] > max) {
|
||||
max = mb->m_mtypes[i];
|
||||
index = i;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: netstat.c,v 1.5 1996/12/13 19:26:21 scottr Exp $ */
|
||||
/* $NetBSD: netstat.c,v 1.6 1997/05/24 00:48:28 jtc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1992, 1993
|
||||
@ -37,7 +37,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)netstat.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
static char rcsid[] = "$NetBSD: netstat.c,v 1.5 1996/12/13 19:26:21 scottr Exp $";
|
||||
static char rcsid[] = "$NetBSD: netstat.c,v 1.6 1997/05/24 00:48:28 jtc Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -81,7 +81,6 @@ static char *inetname __P((struct in_addr));
|
||||
static void inetprint __P((struct in_addr *, int, char *));
|
||||
|
||||
#define streq(a,b) (strcmp(a,b)==0)
|
||||
#define YMAX(w) ((w)->maxy-1)
|
||||
|
||||
WINDOW *
|
||||
opennetstat()
|
||||
@ -340,7 +339,7 @@ shownetstat()
|
||||
/*
|
||||
* Add a new entry if possible.
|
||||
*/
|
||||
if (lastrow > YMAX(wnd))
|
||||
if (lastrow > getmaxy(wnd))
|
||||
continue;
|
||||
p->ni_line = lastrow++;
|
||||
p->ni_flags |= NIF_LACHG|NIF_FACHG;
|
||||
@ -367,9 +366,9 @@ shownetstat()
|
||||
tcpstates[p->ni_state]);
|
||||
wclrtoeol(wnd);
|
||||
}
|
||||
if (lastrow < YMAX(wnd)) {
|
||||
if (lastrow < getmaxy(wnd)) {
|
||||
wmove(wnd, lastrow, 0); wclrtobot(wnd);
|
||||
wmove(wnd, YMAX(wnd), 0); wdeleteln(wnd); /* XXX */
|
||||
wmove(wnd, getmaxy(wnd), 0); wdeleteln(wnd); /* XXX */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pigs.c,v 1.4 1996/12/13 19:26:22 scottr Exp $ */
|
||||
/* $NetBSD: pigs.c,v 1.5 1997/05/24 00:48:29 jtc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1992, 1993
|
||||
@ -37,7 +37,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)pigs.c 8.2 (Berkeley) 9/23/93";
|
||||
#endif
|
||||
static char rcsid[] = "$NetBSD: pigs.c,v 1.4 1996/12/13 19:26:22 scottr Exp $";
|
||||
static char rcsid[] = "$NetBSD: pigs.c,v 1.5 1997/05/24 00:48:29 jtc Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -116,8 +116,8 @@ showpigs()
|
||||
qsort(pt, nproc + 1, sizeof (struct p_times), compar);
|
||||
y = 1;
|
||||
i = nproc + 1;
|
||||
if (i > wnd->maxy-1)
|
||||
i = wnd->maxy-1;
|
||||
if (i > getmaxy(wnd)-1)
|
||||
i = getmaxy(wnd)-1;
|
||||
for (k = 0; i > 0 && pt[k].pt_pctcpu > 0.01; i--, y++, k++) {
|
||||
if (pt[k].pt_kp == NULL) {
|
||||
uname = "";
|
||||
|
Loading…
Reference in New Issue
Block a user