img/mtr_icon.xpm \
mtr-gtk.h
+if WITH_ERROR
+mtr_SOURCES += \
+ portability/error.h \
+ portability/error.c
+endif
+
if WITH_GETOPT
mtr_SOURCES += \
portability/getopt.h \
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
+#ifdef HAVE_ERROR_H
#include <error.h>
+#else
+#include "portability/error.h"
+#endif
#include <errno.h>
#ifdef __APPLE__
AM_INIT_AUTOMAKE([
1.7.9
foreign
+ subdir-objects
])
# --enable-silent-rules
arpa/nameser_compat.h \
curses.h \
cursesX.h \
+ error.h \
fcntl.h \
ncurses.h \
ncurses/curses.h \
fcntl \
])
+AC_CHECK_FUNC([error], [with_error=no],
+ [AC_CHECK_FUNCS([verr verrx vwarn vwarnx], [with_error=yes],
+ [AC_MSG_ERROR([cannot find working error printing function])
+ ])
+])
+AM_CONDITIONAL([WITH_ERROR], [test "x$with_error" = "xyes"])
+
AC_CHECK_FUNC([getopt_long], [with_getopt=no], [with_getopt=yes])
AS_IF([test "x$with_getopt" = "xno"], [
AC_DEFINE([HAVE_GETOPT], [1], [Define if libc has getopt_long])
//#endif
//#include <netdb.h>
//#include <resolv.h>
+#ifdef HAVE_ERROR_H
#include <error.h>
+#else
+#include "portability/error.h"
+#endif
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <strings.h>
+#ifdef HAVE_ERROR_H
#include <error.h>
+#else
+#include "portability/error.h"
+#endif
#ifdef HAVE_VALUES_H
#include <values.h>
#endif
#include <math.h>
#include <errno.h>
#include <string.h>
+#ifdef HAVE_ERROR_H
#include <error.h>
+#else
+#include "portability/error.h"
+#endif
#include "mtr.h"
--- /dev/null
+/.deps
+/.dirstamp
--- /dev/null
+ /*
+ Linux error(3) function go around for systems that has err(3) and
+ warn(3), but no error(3). MacOS is good example of such.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation version 2.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+*/
+
+#include <stdarg.h>
+#include <err.h>
+
+void error(int status, int errnum, const char *format, ...) {
+ va_list arg;
+
+ va_start(arg, format);
+ if (errnum == 0) {
+ if (status == 0)
+ vwarnx(format, arg);
+ else
+ verrx(status, format, arg);
+ } else {
+ if (status == 0)
+ vwarn(format, arg);
+ else
+ verr(status, format, arg);
+ }
+ va_end(arg);
+}
--- /dev/null
+ /*
+ Linux error(3) function go around for systems that has err(3) and
+ warn(3), but no error(3). MacOS is good example of such.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation version 2.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+*/
+
+void error(int status, int errnum, const char *format, ...);
#include <string.h>
#include <math.h>
#include <errno.h>
+#ifdef HAVE_ERROR_H
#include <error.h>
+#else
+#include "portability/error.h"
+#endif
#include "mtr.h"
#include "dns.h"