X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_tool.c;h=d46d1959901f04c0e21affeddae2d68543b5d073;hp=9e60847dadfbe1c529483b479ff5d6c70870fe0c;hb=a3f32f5a1f6c5c58a3028aca1e4b6ae5472e76b6;hpb=e3e38675dd28f4573c144b8aecc1a30ef6c7362f diff --git a/src/rrd_tool.c b/src/rrd_tool.c index 9e60847..d46d195 100644 --- a/src/rrd_tool.c +++ b/src/rrd_tool.c @@ -1,5 +1,5 @@ /***************************************************************************** - * RRDtool 1.4.2 Copyright by Tobi Oetiker, 1997-2009 + * RRDtool 1.4.3 Copyright by Tobi Oetiker, 1997-2010 ***************************************************************************** * rrd_tool.c Startup wrapper *****************************************************************************/ @@ -8,6 +8,8 @@ #include "../win32/config.h" #include #include +#include +#include #else #ifdef HAVE_CONFIG_H #include "../rrd_config.h" @@ -65,6 +67,7 @@ void PrintUsage( N_("* create - create a new RRD\n\n" "\trrdtool create filename [--start|-b start time]\n" "\t\t[--step|-s step]\n" + "\t\t[--no-overwrite|-O]\n" "\t\t[DS:ds-name:DST:dst arguments]\n" "\t\t[RRA:CF:cf arguments]\n"); @@ -171,6 +174,7 @@ void PrintUsage( "\t\t[PRINT:vdefname:format]\n" "\t\t[GPRINT:vdefname:format]\n" "\t\t[COMMENT:text]\n" "\t\t[SHIFT:vname:offset]\n" + "\t\t[TEXTALIGN:{left|right|justified|center}]\n" "\t\t[TICK:vname#rrggbb[aa][:[fraction][:legend]]]\n" "\t\t[HRULE:value#rrggbb[aa][:legend]]\n" "\t\t[VRULE:value#rrggbb[aa][:legend]]\n" @@ -412,6 +416,12 @@ int main( according to localeconv(3) */ setlocale(LC_ALL, ""); +#if defined(WIN32) && !defined(__CYGWIN__) + setmode(fileno(stdout), O_BINARY); + setmode(fileno(stdin), O_BINARY); +#endif + + #if defined(HAVE_LIBINTL_H) && defined(BUILD_LIBINTL) bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); textdomain(GETTEXT_PACKAGE); @@ -532,7 +542,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); } @@ -540,7 +550,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); } @@ -560,7 +570,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); } @@ -574,7 +584,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); } @@ -593,7 +603,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); } @@ -693,6 +703,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; @@ -712,17 +723,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); @@ -743,7 +755,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; @@ -768,7 +780,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*/ @@ -802,7 +818,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]); @@ -810,11 +830,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]); }