ncurses and configure again
Another fix to link properly to ncurses Some minor top fixes Added *~ to gitignore because these files crop up sometimes
This commit is contained in:
parent
ed01cfb8a9
commit
e4836e08ee
1
.gitignore
vendored
1
.gitignore
vendored
@ -47,3 +47,4 @@ uptime
|
|||||||
vmstat
|
vmstat
|
||||||
w
|
w
|
||||||
watch
|
watch
|
||||||
|
*~
|
||||||
|
@ -42,7 +42,7 @@ bin_PROGRAMS = kill
|
|||||||
dist_man_MANS += kill.1
|
dist_man_MANS += kill.1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if HAVE_NCURSES
|
if WITH_NCURSES
|
||||||
usrbin_exec_PROGRAMS += \
|
usrbin_exec_PROGRAMS += \
|
||||||
slabtop \
|
slabtop \
|
||||||
top \
|
top \
|
||||||
|
41
configure.ac
41
configure.ac
@ -92,44 +92,27 @@ AC_CHECK_FUNCS([\
|
|||||||
wcwidth
|
wcwidth
|
||||||
])
|
])
|
||||||
|
|
||||||
usrbin_execdir='${exec_prefix}/usr/bin'
|
|
||||||
AC_SUBST([usrbin_execdir])
|
|
||||||
|
|
||||||
dnl UTIL_CHECK_LIB(LIBRARY, FUNCTION, [VARSUFFIX = $1]))
|
|
||||||
dnl The VARSUFFIX is optional and overrides the default behaviour. For example:
|
|
||||||
dnl UTIL_CHECK_LIB(yyy, func, xxx) generates have_xxx and HAVE_LIBXXX
|
|
||||||
dnl UTIL_CHECK_LIB(yyy, func) generates have_yyy and HAVE_LIBYYY
|
|
||||||
dnl ---------------------------------
|
|
||||||
AC_DEFUN([UTIL_CHECK_LIB], [
|
|
||||||
m4_define([suffix], m4_default([$3],$1))
|
|
||||||
[have_]suffix=yes
|
|
||||||
m4_ifdef([$3], [AC_CHECK_LIB([$1], [$2], [], [[have_]suffix=no])], [])
|
|
||||||
AM_CONDITIONAL(AS_TR_CPP([HAVE_]suffix), [test [$have_]suffix = yes])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_ARG_WITH([ncurses],
|
AC_ARG_WITH([ncurses],
|
||||||
AS_HELP_STRING([--without-ncurses], [build only applications not needing ncurses]),
|
AS_HELP_STRING([--without-ncurses], [build only applications not needing ncurses]),
|
||||||
[], with_ncurses=yes
|
[with_ncurses=no], [with_ncurses=yes]
|
||||||
)
|
)
|
||||||
AM_CONDITIONAL(HAVE_NCURSES, false)
|
|
||||||
|
|
||||||
if test "x$with_ncurses" != xno; then
|
if test "x$with_ncurses" = xno; then
|
||||||
have_ncurses=no
|
AM_CONDITIONAL(WITH_NCURSES, false)
|
||||||
AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h], [
|
else
|
||||||
if test "x$with_ncurses" = xyes; then
|
AC_CHECK_LIB(ncursesw, initscr, [have_ncurses=yes], [have_ncurses=no])
|
||||||
UTIL_CHECK_LIB(ncursesw, initscr, ncurses)
|
AC_CHECK_HEADERS(ncursesw/ncurses.h, [], [have_ncurses=no])
|
||||||
if test "x$have_ncurses" = xyes; then
|
|
||||||
AC_CHECK_HEADERS([ncursesw/ncurses.h])
|
|
||||||
NCURSES_LIBS="-lncursesw"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
if test "x$have_ncurses" = xno; then
|
if test "x$have_ncurses" = xno; then
|
||||||
AC_MSG_ERROR([ncurses selected, but library not found (--without-ncurses to disable)])
|
AC_MSG_ERROR([ncurses support missing (for partial build use --without-ncurses)])
|
||||||
fi
|
fi
|
||||||
|
AM_CONDITIONAL(WITH_NCURSES, true)
|
||||||
|
NCURSES_LIBS="-lncursesw"
|
||||||
fi
|
fi
|
||||||
AC_SUBST([NCURSES_LIBS])
|
AC_SUBST([NCURSES_LIBS])
|
||||||
|
|
||||||
|
usrbin_execdir='${exec_prefix}/usr/bin'
|
||||||
|
AC_SUBST([usrbin_execdir])
|
||||||
|
|
||||||
AC_ARG_ENABLE([kill],
|
AC_ARG_ENABLE([kill],
|
||||||
AS_HELP_STRING([--disable-kill], [do not build kill]),
|
AS_HELP_STRING([--disable-kill], [do not build kill]),
|
||||||
[], enable_kill=yes
|
[], enable_kill=yes
|
||||||
|
17
top.c
17
top.c
@ -3608,20 +3608,15 @@ static int window_show (WIN_t *q, int wmax) {
|
|||||||
* This guy's just a *Helper* function who apportions the
|
* This guy's just a *Helper* function who apportions the
|
||||||
* remaining amount of screen real estate under multiple windows */
|
* remaining amount of screen real estate under multiple windows */
|
||||||
static void framehlp (int wix, int max) {
|
static void framehlp (int wix, int max) {
|
||||||
int i, rsvd, size, wins;
|
int i, size, wins;
|
||||||
|
|
||||||
// calc remaining number of visible windows + total 'user' lines
|
// calc remaining number of visible windows
|
||||||
for (i = wix, rsvd = 0, wins = 0; i < GROUPSMAX; i++) {
|
for (i = wix, wins = 0; i < GROUPSMAX; i++)
|
||||||
if (CHKw(&Winstk[i], Show_TASKON)) {
|
if (CHKw(&Winstk[i], Show_TASKON))
|
||||||
rsvd += Winstk[i].rc.maxtasks;
|
|
||||||
++wins;
|
++wins;
|
||||||
if (max <= rsvd) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!wins) wins = 1;
|
if (!wins) wins = 1;
|
||||||
// set aside 'rsvd' & deduct 1 line/window for the columns heading
|
// deduct 1 line/window for the columns heading
|
||||||
size = (max - wins) - rsvd;
|
|
||||||
if (0 <= size) size = max;
|
|
||||||
size = (max - wins) / wins;
|
size = (max - wins) / wins;
|
||||||
|
|
||||||
/* for subject window, set WIN_t winlines to either the user's
|
/* for subject window, set WIN_t winlines to either the user's
|
||||||
|
Loading…
Reference in New Issue
Block a user