diff --git a/plugins/check_fping.c b/plugins/check_fping.c
index 9a2dd5570ba2b3b73f41fc5ec6ac775c6b341c05..ac203f523d3a646cd8e2dd11f54f098857cd0426 100644 (file)
--- a/plugins/check_fping.c
+++ b/plugins/check_fping.c
#include "popen.h"
#include "utils.h"
#include "popen.h"
#include "utils.h"
-#define PROGNAME "check_fping"
+const char *progname = "check_fping";
#define PACKET_COUNT 1
#define PACKET_SIZE 56
#define UNKNOWN_PACKET_LOSS 200 /* 200% */
#define PACKET_COUNT 1
#define PACKET_SIZE 56
#define UNKNOWN_PACKET_LOSS 200 /* 200% */
server = strscpy (server, server_name);
/* compose the command */
server = strscpy (server, server_name);
/* compose the command */
- command_line = ssprintf
- (command_line, "%s -b %d -c %d %s",
- PATH_TO_FPING, packet_size, packet_count, server);
+ asprintf (&command_line, "%s -b %d -c %d %s", PATH_TO_FPING,
+ packet_size, packet_count, server);
if (verbose)
printf ("%s\n", command_line);
if (verbose)
printf ("%s\n", command_line);
int c;
char *rv[2];
int c;
char *rv[2];
-#ifdef HAVE_GETOPT_H
int option_index = 0;
static struct option long_options[] = {
{"hostname", required_argument, 0, 'H'},
int option_index = 0;
static struct option long_options[] = {
{"hostname", required_argument, 0, 'H'},
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0}
};
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0}
};
-#endif
rv[PL] = NULL;
rv[RTA] = NULL;
rv[PL] = NULL;
rv[RTA] = NULL;
}
while (1) {
}
while (1) {
-#ifdef HAVE_GETOPT_H
- c =
- getopt_long (argc, argv, "+hVvH:c:w:b:n:", long_options, &option_index);
-#else
- c = getopt (argc, argv, "+hVvH:c:w:b:n:");
-#endif
+ c = getopt_long (argc, argv, "+hVvH:c:w:b:n:", long_options, &option_index);
if (c == -1 || c == EOF || c == 1)
break;
switch (c) {
case '?': /* print short usage statement if args not parsable */
if (c == -1 || c == EOF || c == 1)
break;
switch (c) {
case '?': /* print short usage statement if args not parsable */
- printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg);
+ printf ("%s: Unknown argument: %s\n\n", progname, optarg);
print_usage ();
exit (STATE_UNKNOWN);
case 'h': /* help */
print_help ();
exit (STATE_OK);
case 'V': /* version */
print_usage ();
exit (STATE_UNKNOWN);
case 'h': /* help */
print_help ();
exit (STATE_OK);
case 'V': /* version */
- print_revision (my_basename (argv[0]), "$Revision$");
+ print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'v': /* verbose mode */
verbose = TRUE;
exit (STATE_OK);
case 'v': /* verbose mode */
verbose = TRUE;
arg1[strcspn (arg1, ",:")] = 0;
if (strstr (arg1, "%") && strstr (arg2, "%"))
terminate (STATE_UNKNOWN,
arg1[strcspn (arg1, ",:")] = 0;
if (strstr (arg1, "%") && strstr (arg2, "%"))
terminate (STATE_UNKNOWN,
- "%s: Only one threshold may be packet loss (%s)\n", PROGNAME,
+ "%s: Only one threshold may be packet loss (%s)\n", progname,
arg);
if (!strstr (arg1, "%") && !strstr (arg2, "%"))
terminate (STATE_UNKNOWN,
"%s: Only one threshold must be packet loss (%s)\n",
arg);
if (!strstr (arg1, "%") && !strstr (arg2, "%"))
terminate (STATE_UNKNOWN,
"%s: Only one threshold must be packet loss (%s)\n",
- PROGNAME, arg);
+ progname, arg);
}
if (arg2 && strstr (arg2, "%")) {
}
if (arg2 && strstr (arg2, "%")) {
void
print_usage (void)
{
void
print_usage (void)
{
- printf ("Usage: %s <host_address>\n", PROGNAME);
+ printf ("Usage: %s <host_address>\n", progname);
}
}
print_help (void)
{
print_help (void)
{
- print_revision (PROGNAME, "$Revision$");
+ print_revision (progname, "$Revision$");
printf
("Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)\n\n"
printf
("Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)\n\n"