int opt;
char *tmplt = NULL;
int rc = -1;
- char *daemon = NULL;
+ char *opt_daemon = NULL;
optind = 0;
opterr = 0; /* initialize getopt */
break;
case 'd':
- if (daemon != NULL)
- free (daemon);
- daemon = strdup (optarg);
- if (daemon == NULL)
+ if (opt_daemon != NULL)
+ free (opt_daemon);
+ opt_daemon = strdup (optarg);
+ if (opt_daemon == NULL)
{
rrd_set_error("strdup failed.");
goto out;
goto out;
}
- if ((tmplt != NULL) && (daemon != NULL))
+ if ((tmplt != NULL) && (opt_daemon != NULL))
{
- rrd_set_error("The caching daemon cannot be used together with "
+ rrd_set_error("The caching opt_daemon cannot be used together with "
"templates yet.");
goto out;
}
- if ((tmplt == NULL) && (daemon == NULL))
+ if ((tmplt == NULL) && (opt_daemon == NULL))
{
char *temp;
temp = getenv (ENV_RRDCACHED_ADDRESS);
if (temp != NULL)
{
- daemon = strdup (temp);
- if (daemon == NULL)
+ opt_daemon = strdup (temp);
+ if (opt_daemon == NULL)
{
rrd_set_error("strdup failed.");
goto out;
}
}
- if (daemon != NULL)
+ if (opt_daemon != NULL)
{
int status;
- status = rrdc_connect (daemon);
+ status = rrdc_connect (opt_daemon);
if (status != 0)
{
- rrd_set_error("Unable to connect to daemon: %s",
+ rrd_set_error("Unable to connect to opt_daemon: %s",
(status < 0)
? "Internal error"
: rrd_strerror (status));
/* values = */ (void *) (argv + optind + 1));
if (status != 0)
{
- rrd_set_error("Failed sending the values to the daemon: %s",
+ rrd_set_error("Failed sending the values to the opt_daemon: %s",
(status < 0)
? "Internal error"
: rrd_strerror (status));
rrdc_disconnect ();
goto out;
- } /* if (daemon != NULL) */
+ } /* if (opt_daemon != NULL) */
rc = rrd_update_r(argv[optind], tmplt,
argc - optind - 1, (const char **) (argv + optind + 1));
free(tmplt);
tmplt = NULL;
}
- if (daemon != NULL)
+ if (opt_daemon != NULL)
{
- free (daemon);
- daemon = NULL;
+ free (opt_daemon);
+ opt_daemon = NULL;
}
return rc;
}