NetBSD doesn't use ncurses, but instead has its own version of curses.
So, if we don't find ncurses during configure, try linking against
curses.
On NetBSD, we must include limits.h to find CHAR_MAX.
On OpenBSD, we must include sys/socket.h to get sockaddr_storage.
mtr_SOURCES += ui/asn.c ui/asn.h
endif
-if WITH_NCURSES
+if WITH_CURSES
mtr_SOURCES += ui/curses.c
endif
[AS_HELP_STRING([--without-ncurses], [Build without the ncurses interface])],
[], [with_ncurses=yes])
AS_IF([test "x$with_ncurses" = "xyes"],
- [AC_CHECK_LIB([ncurses], [initscr], [], [with_ncurses=no])
+ [AC_SEARCH_LIBS(
+ [initscr], [ncurses curses],
+ [AC_DEFINE([HAVE_CURSES], [1], [Define if a curses library available])],
+ [with_ncurses=no])
])
-AM_CONDITIONAL([WITH_NCURSES], [test "x$with_ncurses" = xyes])
+AM_CONDITIONAL([WITH_CURSES], [test "x$with_ncurses" = xyes])
AC_CHECK_LIB([cap], [cap_set_proc], [],
AS_IF([test "$host_os" = linux-gnu],
#include <netinet/in.h>
#include <stdbool.h>
+#include <sys/socket.h>
#include <sys/time.h>
#include "portability/queue.h"
#include "dns.h"
#include "asn.h"
-#ifdef HAVE_LIBNCURSES
+#ifdef HAVE_CURSES
# include "mtr-curses.h"
#endif
#include "split.h"
-#ifdef HAVE_LIBNCURSES
+#ifdef HAVE_CURSES
# define DEFAULT_DISPLAY DisplayCurses
#else
# define DEFAULT_DISPLAY DisplayReport
case DisplayCSV:
csv_open();
break;
-#ifdef HAVE_LIBNCURSES
+#ifdef HAVE_CURSES
case DisplayCurses:
mtr_curses_open(ctl);
# ifdef HAVE_IPINFO
case DisplayCSV:
csv_close(ctl, now);
break;
-#ifdef HAVE_LIBNCURSES
+#ifdef HAVE_CURSES
case DisplayCurses:
# ifdef HAVE_IPINFO
asn_close(ctl);
{
switch(ctl->DisplayMode) {
-#ifdef HAVE_LIBNCURSES
+#ifdef HAVE_CURSES
case DisplayCurses:
mtr_curses_redraw(ctl);
break;
extern int display_keyaction(struct mtr_ctl *ctl)
{
switch(ctl->DisplayMode) {
-#ifdef HAVE_LIBNCURSES
+#ifdef HAVE_CURSES
case DisplayCurses:
return mtr_curses_keyaction(ctl);
#endif
extern void display_clear(struct mtr_ctl *ctl)
{
-#ifdef HAVE_LIBNCURSES
+#ifdef HAVE_CURSES
if (ctl->DisplayMode == DisplayCurses)
mtr_curses_clear(ctl);
#endif
enum {
DisplayReport,
-#ifdef HAVE_LIBNCURSES
+#ifdef HAVE_CURSES
DisplayCurses,
#endif
#ifdef HAVE_GTK
#include <ctype.h>
#include <assert.h>
#include <fcntl.h>
+#include <limits.h>
#include <sys/stat.h>
#include <sys/time.h>
fputs(" -C, --csv output comma separated values\n", out);
fputs(" -l, --raw output raw format\n", out);
fputs(" -p, --split split output\n", out);
-#ifdef HAVE_LIBNCURSES
+#ifdef HAVE_CURSES
fputs(" -t, --curses use curses terminal interface\n", out);
#endif
fputs(" --displaymode MODE select initial display mode\n", out);
{ "report", 0, NULL, 'r' },
{ "report-wide", 0, NULL, 'w' },
{ "xml", 0, NULL, 'x' },
-#ifdef HAVE_LIBNCURSES
+#ifdef HAVE_CURSES
{ "curses", 0, NULL, 't' },
#endif
#ifdef HAVE_GTK
ctl->reportwide = 1;
ctl->DisplayMode = DisplayReport;
break;
-#ifdef HAVE_LIBNCURSES
+#ifdef HAVE_CURSES
case 't':
ctl->DisplayMode = DisplayCurses;
break;
#include "split.h"
#include "utils.h"
-#ifdef HAVE_LIBNCURSES
+#ifdef HAVE_CURSES
# if defined(HAVE_NCURSES_H)
# include <ncurses.h>
# elif defined(HAVE_NCURSES_CURSES_H)
extern int split_keyaction(void)
{
-#ifdef HAVE_LIBNCURSES
+#ifdef HAVE_CURSES
char c = getch();
#else
fd_set readfds;