Commit e4836e08 authored by Craig Small's avatar Craig Small

ncurses and configure again

Another fix to link properly to ncurses
Some minor top fixes
Added *~ to gitignore because these files crop up sometimes
parent ed01cfb8
......@@ -47,3 +47,4 @@ uptime
vmstat
w
watch
*~
......@@ -42,7 +42,7 @@ bin_PROGRAMS = kill
dist_man_MANS += kill.1
endif
if HAVE_NCURSES
if WITH_NCURSES
usrbin_exec_PROGRAMS += \
slabtop \
top \
......
......@@ -92,44 +92,27 @@ AC_CHECK_FUNCS([\
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],
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
have_ncurses=no
AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h], [
if test "x$with_ncurses" = xyes; then
UTIL_CHECK_LIB(ncursesw, initscr, ncurses)
if test "x$have_ncurses" = xyes; then
AC_CHECK_HEADERS([ncursesw/ncurses.h])
NCURSES_LIBS="-lncursesw"
fi
fi
])
if test "x$with_ncurses" = xno; then
AM_CONDITIONAL(WITH_NCURSES, false)
else
AC_CHECK_LIB(ncursesw, initscr, [have_ncurses=yes], [have_ncurses=no])
AC_CHECK_HEADERS(ncursesw/ncurses.h, [], [have_ncurses=no])
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
AM_CONDITIONAL(WITH_NCURSES, true)
NCURSES_LIBS="-lncursesw"
fi
AC_SUBST([NCURSES_LIBS])
usrbin_execdir='${exec_prefix}/usr/bin'
AC_SUBST([usrbin_execdir])
AC_ARG_ENABLE([kill],
AS_HELP_STRING([--disable-kill], [do not build kill]),
[], enable_kill=yes
......
......@@ -3608,20 +3608,15 @@ static int window_show (WIN_t *q, int wmax) {
* This guy's just a *Helper* function who apportions the
* remaining amount of screen real estate under multiple windows */
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
for (i = wix, rsvd = 0, wins = 0; i < GROUPSMAX; i++) {
if (CHKw(&Winstk[i], Show_TASKON)) {
rsvd += Winstk[i].rc.maxtasks;
// calc remaining number of visible windows
for (i = wix, wins = 0; i < GROUPSMAX; i++)
if (CHKw(&Winstk[i], Show_TASKON))
++wins;
if (max <= rsvd) break;
}
}
if (!wins) wins = 1;
// set aside 'rsvd' & deduct 1 line/window for the columns heading
size = (max - wins) - rsvd;
if (0 <= size) size = max;
// deduct 1 line/window for the columns heading
size = (max - wins) / wins;
/* for subject window, set WIN_t winlines to either the user's
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment