Skip to content

Instantly share code, notes, and snippets.

@schweikert
Created April 27, 2012 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schweikert/2506666 to your computer and use it in GitHub Desktop.
Save schweikert/2506666 to your computer and use it in GitHub Desktop.
fping 3.1 Solaris 8 patch
--- fping.c-orig 2011-12-22 16:05:18.000000000 +0100
+++ fping.c 2012-01-13 17:47:08.000000000 +0100
@@ -386,6 +386,37 @@
#endif /* _NO_PROTO */
+#if defined (__SVR4) && defined (__sun)
+/* on Solaris use code from glibc's misc/err.c because the IPv6 support needs it */
+#include <stdarg.h>
+extern char *prog; /* set by fping.c */
+extern int errno;
+
+static void err(int status, const char* format, ...) {
+ int error = errno;
+ fprintf (stderr, "%s: ", prog);
+ if (format) {
+ va_list ap;
+ va_start(ap, format);
+ vfprintf (stderr, format, ap);
+ va_end (ap);
+ }
+ fprintf (stderr, "%s\n", strerror(error));
+ exit(status);
+}
+
+static void warnx(const char* format, ...) {
+ fprintf (stderr, "%s: ", prog);
+ if (format) {
+ va_list ap;
+ va_start (ap, format);
+ vfprintf (stderr, format, ap);
+ va_end (ap);
+ }
+ fprintf (stderr, "\n");
+}
+#endif /* Solaris */
+
/*** function definitions ***/
/************************************************************
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment