diff --git a/plugins/common.h b/plugins/common.h
index 56d5376123775711d28cd190aa1e87476b43c04b..91b454dbe2ea23750e435f3684fba748001f5ede 100644 (file)
--- a/plugins/common.h
+++ b/plugins/common.h
*
*****************************************************************************/
+#include "config.h"
+
+#ifdef HAVE_FEATURES_H
+#include <features.h>
+#endif
+
#include <stdio.h> /* obligatory includes */
#include <stdlib.h>
#include <errno.h>
-#include "config.h"
-
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#if HAVE_LWRES_NETDB_H
#include <lwres/netdb.h>
-#elif !HAVE_GETADDRINFO
-#include "getaddrinfo.h"
#else
-#include <netdb.h>
+# if !HAVE_GETADDRINFO
+# include "getaddrinfo.h"
+# else
+# include <netdb.h>
+# endif
#endif
/*
*
*/
-#define OK 0
-#define ERROR -1
-
-#define TRUE 1
-#define FALSE 0
-
-#define STATE_CRITICAL 2 /* service state return codes */
-#define STATE_WARNING 1
-#define STATE_OK 0
-#define STATE_UNKNOWN 3
-#define STATE_DEPENDENT 4
+enum {
+ OK = 0,
+ ERROR = -1
+};
+
+enum {
+ FALSE,
+ TRUE
+};
+
+enum {
+ STATE_OK,
+ STATE_WARNING,
+ STATE_CRITICAL,
+ STATE_UNKNOWN,
+ STATE_DEPENDENT
+};
+
+enum {
+ DEFAULT_SOCKET_TIMEOUT = 10, /* timeout after 10 seconds */
+ MAX_INPUT_BUFFER = 1024, /* max size of most buffers we use */
+ MAX_HOST_ADDRESS_LENGTH = 256 /* max size of a host address */
+};
-#define DEFAULT_SOCKET_TIMEOUT 10 /* timeout after 10 seconds */
-
-#define MAX_INPUT_BUFFER 1024 /* max size of most buffers we use */
-
-#define MAX_HOST_ADDRESS_LENGTH 256 /* max size of a host address */
-
-
-#ifndef HAVE_SNPRINTF
/*
-int snprintf (char *str, size_t n, const char *fmt, ...);
-int snprintf (char *str, size_t n, const char *fmt, ...)
-{
- char *buf;
- int i;
- int j=0;
- va_list ap;
- int d;
- char c, *p, *s;
-
- if((buf=malloc(n))==NULL){
- puts("could not malloc snprintf buffer\n");
- exit(-1);
- }
- va_start(ap,fmt);
- i=strlen(fmt);
- while((jj=index(&fmt[j],'%'))){
- j+=jj+1;
- switch fmt[j]
- {
- case 's':
- s = va_arg(ap, char *);
- i+=strlen(s);
- break;
- case 'd':
- d = va_arg(ap, int);
- i++;
- if (d<0) i++;
- while((d=d/10)>0) i++;
- break;
- case 'c':
- c = va_arg(ap, char);
- i++;
- break;
- }
- }
- va_end(ap);
- vsprintf(buf,fmt,ap);
- strcpy(str,buf[1:n-1]);
- exit(result);
-}
-*/
+ *
+ * Internationalization
+ *
+ */
+
+#if ENABLE_NLS
+# include "gettext.h"
+# define _(String) gettext (String)
+# define S_(String) gettext (String)
+# define gettext_noop(String) String
+# define N_(String) gettext_noop String
+#else
+# define _(String) (String)
+# define S_(String) (String)
+# define N_(String) String
+# define textdomain(Domain)
+# define bindtextdomain(Package, Directory)
#endif