X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_tool.c;h=bb1bc3ed5304164e63d1778567ba2979d5e20864;hb=2d99eb86ab3bc3a01be6c65502a04151335316ba;hp=ea94ea14380fd0aebcfe5e0e43e551e3d51fe904;hpb=19f031713115921bebf5949ce63926d66dd8c6a5;p=rrdtool.git diff --git a/src/rrd_tool.c b/src/rrd_tool.c index ea94ea1..bb1bc3e 100644 --- a/src/rrd_tool.c +++ b/src/rrd_tool.c @@ -534,7 +534,7 @@ int HandleInputLine( */ if (RemoteMode) { if (argc > 1 && strcmp("quit", argv[1]) == 0) { - if (argc > 2) { + if (argc != 2) { printf("ERROR: invalid parameter count for quit\n"); return (1); } @@ -542,7 +542,7 @@ int HandleInputLine( } #if defined(HAVE_OPENDIR) && defined(HAVE_READDIR) && defined(HAVE_CHDIR) if (argc > 1 && strcmp("cd", argv[1]) == 0) { - if (argc > 3) { + if (argc != 3) { printf("ERROR: invalid parameter count for cd\n"); return (1); } @@ -562,7 +562,7 @@ int HandleInputLine( } if (argc > 1 && strcmp("pwd", argv[1]) == 0) { char *cwd; /* To hold current working dir on call to pwd */ - if (argc > 2) { + if (argc != 2) { printf("ERROR: invalid parameter count for pwd\n"); return (1); } @@ -576,7 +576,7 @@ int HandleInputLine( return (0); } if (argc > 1 && strcmp("mkdir", argv[1]) == 0) { - if (argc > 3) { + if (argc != 3) { printf("ERROR: invalid parameter count for mkdir\n"); return (1); } @@ -595,7 +595,7 @@ int HandleInputLine( return (0); } if (argc > 1 && strcmp("ls", argv[1]) == 0) { - if (argc > 2) { + if (argc != 2) { printf("ERROR: invalid parameter count for ls\n"); return (1); } @@ -695,6 +695,7 @@ int HandleInputLine( free(data); } } else if (strcmp("xport", argv[1]) == 0) { +#ifdef HAVE_RRD_GRAPH int xxsize; unsigned long int j = 0; time_t start, end, ti; @@ -714,17 +715,18 @@ int HandleInputLine( if (rrd_xport (argc - 1, &argv[1], &xxsize, &start, &end, &step, &col_cnt, &legend_v, &data) != -1) { - char *old_locale = setlocale(LC_NUMERIC, "C"); + char *old_locale = setlocale(LC_NUMERIC,NULL); + setlocale(LC_NUMERIC, "C"); row_cnt = (end - start) / step; ptr = data; printf("\n\n", XML_ENCODING); printf("<%s>\n", ROOT_TAG); printf(" <%s>\n", META_TAG); - printf(" <%s>%lu\n", META_START_TAG, - (unsigned long) start + step, META_START_TAG); + printf(" <%s>%lld\n", META_START_TAG, + (long long int) start + step, META_START_TAG); printf(" <%s>%lu\n", META_STEP_TAG, step, META_STEP_TAG); - printf(" <%s>%lu\n", META_END_TAG, (unsigned long) end, + printf(" <%s>%lld\n", META_END_TAG, (long long int) end, META_END_TAG); printf(" <%s>%lu\n", META_ROWS_TAG, row_cnt, META_ROWS_TAG); @@ -745,7 +747,7 @@ int HandleInputLine( printf(" <%s>\n", DATA_TAG); for (ti = start + step; ti <= end; ti += step) { printf(" <%s>", DATA_ROW_TAG); - printf("<%s>%lu", COL_TIME_TAG, ti, COL_TIME_TAG); + printf("<%s>%lld", COL_TIME_TAG, (long long int)ti, COL_TIME_TAG); for (j = 0; j < col_cnt; j++) { rrd_value_t newval = DNAN; @@ -770,7 +772,11 @@ int HandleInputLine( setlocale(LC_NUMERIC, old_locale); } free(vtag); +#else + rrd_set_error("the instance of rrdtool has been compiled without graphics"); +#endif } else if (strcmp("graph", argv[1]) == 0) { +#ifdef HAVE_RRD_GRAPH char **calcpr; #ifdef notused /*XXX*/ @@ -804,7 +810,11 @@ int HandleInputLine( } } +#else + 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_t *grinfo = NULL; /* 1 to distinguish it from the NULL that rrd_graph sends in */ grinfo = rrd_graph_v(argc - 1, &argv[1]); @@ -812,11 +822,15 @@ int HandleInputLine( rrd_info_print(grinfo); rrd_info_free(grinfo); } - +#else + 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]); +#ifndef WIN32 else if (strcmp("flushcached", argv[1]) == 0) rrd_flushcached(argc - 1, &argv[1]); +#endif else { rrd_set_error("unknown function '%s'", argv[1]); }