N_("* dump - dump an RRD to XML\n\n"
"\trrdtool dump [--header|-h {none,xsd,dtd}]\n"
"\t\t[--no-header|-n]\n"
- "\t\t[--daemon|-d address]\n"
- "\t\tfile.rrd [file.xml]");
+ "\t\t[--daemon|-d address]\n" "\t\tfile.rrd [file.xml]");
const char *help_info =
N_("* info - returns the configuration and status of the RRD\n\n"
const char *help_last =
N_("* last - show last update time for RRD\n\n"
- "\trrdtool last filename.rrd\n"
- "\t\t[--daemon|-d address]\n");
+ "\trrdtool last filename.rrd\n" "\t\t[--daemon|-d address]\n");
const char *help_lastupdate =
N_("* lastupdate - returns the most recent datum stored for\n"
"\trrdtool update filename\n"
"\t\t[--template|-t ds-name:ds-name:...]\n"
"\t\t[--skip-past-updates|-s]\n"
- "\t\t[--daemon|-d <address>]\n"
+ "\t\t[--daemon|-d <address>]\n"
"\t\ttime|N:value[:value...]\n\n"
"\t\tat-time@value[:value...]\n\n"
"\t\t[ time:value[:value...] ..]\n");
"\trrdtool fetch filename.rrd CF\n"
"\t\t[-r|--resolution resolution]\n"
"\t\t[-s|--start start] [-e|--end end]\n"
- "\t\t[-a|--align-start]\n"
- "\t\t[-d|--daemon <address>]\n");
+ "\t\t[-a|--align-start]\n" "\t\t[-d|--daemon <address>]\n");
const char *help_flushcached =
N_("* flushcached - flush cached data out to an RRD file\n\n"
"\trrdtool flushcached filename.rrd\n"
- "\t\t[-d|--daemon <address>]\n");
+ "\t\t[-d|--daemon <address>]\n");
/* break up very large strings (help_graph, help_tune) for ISO C89 compliance*/
"\t\t[--smoothing-window|-s fraction-of-season]\n"
"\t\t[--smoothing-window-deviation|-S fraction-of-season]\n"
"\t\t[--aberrant-reset|-b ds-name]\n");
- const char *help_tune3 =
+ const char *help_tune3 =
N_("\t\t[--step|-t newstep]\n"
"\t\t[--daemon|-D address]\n"
"\t\t[DEL:ds-name]\n"
"\t\t[DS:ds-spec]\n"
"\t\t[DELRRA:index]\n"
- "\t\t[RRA:rra-spec]\n"
- "\t\t[RRA#index:[+-=]number]\n");
+ "\t\t[RRA:rra-spec]\n" "\t\t[RRA#index:[+-=]number]\n");
const char *help_resize =
N_
(" * resize - alter the length of one of the RRAs in an RRD\n\n"
"\t\t[--enumds] [--json]\n"
"\t\t[-d|--daemon address]\n"
"\t\t[DEF:vname=rrd:ds-name:CF]\n"
- "\t\t[CDEF:vname=rpn-expression]\n"
- "\t\t[XPORT:vname:legend]\n");
+ "\t\t[CDEF:vname=rpn-expression]\n" "\t\t[XPORT:vname:legend]\n");
const char *help_quit =
N_(" * quit - closing a session in remote mode\n\n"
"\trrdtool quit\n");
case C_TUNE:
puts(_(help_tune1));
puts(_(help_tune2));
- puts(_(help_tune3));
+ puts(_(help_tune3));
break;
case C_RESIZE:
puts(_(help_resize));
exit(1);
}
}
- if (linebuf[0]){
- return *aLinePtr = linebuf;
+ if (linebuf[0]) {
+ return *aLinePtr = linebuf;
}
free(linebuf);
return *aLinePtr = 0;
#endif
/* initialize locale settings
- according to localeconv(3) */
+ according to localeconv(3) */
setlocale(LC_ALL, "");
#if defined(_WIN32) && !defined(__CYGWIN__)
#endif
RemoteMode = 1;
if ((argc == 3) && strcmp("", argv[2])) {
- int test_euid = 0;
+ int test_euid = 0;
+
#ifdef HAVE_GETEUID
test_euid = geteuid() == 0;
#endif
if (test_euid) {
#ifdef HAVE_CHROOT
- if (chroot(argv[2]) != 0){
- fprintf(stderr, "ERROR: chroot %s: %s\n", argv[2],rrd_strerror(errno));
+ if (chroot(argv[2]) != 0) {
+ fprintf(stderr, "ERROR: chroot %s: %s\n", argv[2],
+ rrd_strerror(errno));
exit(errno);
}
ChangeRoot = 1;
}
}
if (strcmp(firstdir, "")) {
- if (chdir(firstdir) != 0){
- fprintf(stderr, "ERROR: chdir %s %s\n", firstdir,rrd_strerror(errno));
+ if (chdir(firstdir) != 0) {
+ fprintf(stderr, "ERROR: chdir %s %s\n", firstdir,
+ rrd_strerror(errno));
exit(errno);
}
}
while (fgetslong(&aLine, stdin)) {
- char *aLineOrig = aLine;
+ char *aLineOrig = aLine;
+
if ((argc = CountArgs(aLine)) == 0) {
free(aLine);
printf("ERROR: not enough arguments\n");
- continue;
+ continue;
}
if ((myargv = (char **) malloc((argc + 1) *
sizeof(char *))) == NULL) {
if ((argc = CreateArgs(argv[0], aLine, myargv)) < 0) {
printf("ERROR: creating arguments\n");
} else {
- if ( HandleInputLine(argc, myargv, stdout) == 0 ){
+ if (HandleInputLine(argc, myargv, stdout) == 0) {
#ifdef HAVE_GETRUSAGE
getrusage(RUSAGE_SELF, &myusage);
gettimeofday(¤ttime, NULL);
return (1);
}
#endif
- if (chdir(argv[2]) != 0){
+ if (chdir(argv[2]) != 0) {
printf("ERROR: chdir %s %s\n", argv[2], rrd_strerror(errno));
return (1);
}
return (0);
}
if (argc > 1 && strcmp("pwd", argv[1]) == 0) {
- char *cwd; /* To hold current working dir on call to pwd */
+ char *cwd; /* To hold current working dir on call to pwd */
+
if (argc != 2) {
printf("ERROR: invalid parameter count for pwd\n");
return (1);
return (1);
}
#endif
- if(mkdir(argv[2], 0777)!=0){
- printf("ERROR: mkdir %s: %s\n", argv[2],rrd_strerror(errno));
+ if (mkdir(argv[2], 0777) != 0) {
+ printf("ERROR: mkdir %s: %s\n", argv[2], rrd_strerror(errno));
return (1);
}
return (0);
}
if ((curdir = opendir(".")) != NULL) {
struct stat st;
+
while ((dent = readdir(curdir)) != NULL) {
if (!stat(dent->d_name, &st)) {
if (S_ISDIR(st.st_mode)) {
rrd_info_t *data;
if (strcmp("info", argv[1]) == 0)
-
data = rrd_info(argc - 1, &argv[1]);
else
data = rrd_update_v(argc - 1, &argv[1]);
rrd_info_print(data);
rrd_info_free(data);
- }
- else if (strcmp("list", argv[1]) == 0) {
- char *list;
+ } else if (strcmp("list", argv[1]) == 0) {
+ char *list;
+
list = rrd_list(argc - 1, &argv[1]);
- if (list) {
- printf("%s", list);
- free(list);
- }
- }
- else if (strcmp("--version", argv[1]) == 0 ||
- strcmp("version", argv[1]) == 0 ||
- strcmp("v", argv[1]) == 0 ||
- strcmp("-v", argv[1]) == 0 || strcmp("-version", argv[1]) == 0)
+ if (list) {
+ printf("%s", list);
+ free(list);
+ }
+ } else if (strcmp("--version", argv[1]) == 0 ||
+ strcmp("version", argv[1]) == 0 ||
+ strcmp("v", argv[1]) == 0 ||
+ strcmp("-v", argv[1]) == 0 || strcmp("-version", argv[1]) == 0)
printf("RRDtool " PACKAGE_VERSION
- " Copyright by Tobi Oetiker (%f)\n",
- rrd_version());
+ " Copyright by Tobi Oetiker (%f)\n", rrd_version());
else if (strcmp("restore", argv[1]) == 0)
#ifdef HAVE_RRD_RESTORE
rrd_restore(argc - 1, &argv[1]);
#else
- rrd_set_error("the instance of rrdtool has been compiled without XML import functions");
+ rrd_set_error
+ ("the instance of rrdtool has been compiled without XML import functions");
#endif
else if (strcmp("resize", argv[1]) == 0)
rrd_resize(argc - 1, &argv[1]);
}
} else if (strcmp("xport", argv[1]) == 0) {
#ifdef HAVE_RRD_GRAPH
- time_t start, end;
- unsigned long step, col_cnt;
- rrd_value_t *data;
- char **legend_v;
- rrd_xport
- (argc - 1, &argv[1], NULL, &start, &end, &step, &col_cnt,
- &legend_v, &data);
+ time_t start, end;
+ unsigned long step, col_cnt;
+ rrd_value_t *data;
+ char **legend_v;
+
+ rrd_xport
+ (argc - 1, &argv[1], NULL, &start, &end, &step, &col_cnt,
+ &legend_v, &data);
#else
- rrd_set_error("the instance of rrdtool has been compiled without graphics");
+ rrd_set_error
+ ("the instance of rrdtool has been compiled without graphics");
#endif
} else if (strcmp("graph", argv[1]) == 0) {
#ifdef HAVE_RRD_GRAPH
}
#else
- rrd_set_error("the instance of rrdtool has been compiled without graphics");
+ rrd_set_error
+ ("the instance of rrdtool has been compiled without graphics");
#endif
} else if (strcmp("graphv", argv[1]) == 0) {
#ifdef HAVE_RRD_GRAPH
rrd_info_free(grinfo);
}
#else
- rrd_set_error("the instance of rrdtool has been compiled without graphics");
+ rrd_set_error
+ ("the instance of rrdtool has been compiled without graphics");
#endif
} else if (strcmp("tune", argv[1]) == 0)
rrd_tune(argc - 1, &argv[1]);