let rrd_graph return the actual value range it picked ...
[rrdtool.git] / src / rrd_tool.c
index 6aa53cc..94c2b15 100644 (file)
@@ -96,7 +96,8 @@ void PrintUsage(char *cmd)
           "\t\t[-h|--height pixels] [-o|--logarithmic]\n"
           "\t\t[-u|--upper-limit value] [-z|--lazy]\n"
           "\t\t[-l|--lower-limit value] [-r|--rigid]\n"
-           "\t\t[-g|--no-legend]\n";
+           "\t\t[-g|--no-legend]\n"
+          "\t\t[-F|--force-rules-legend]\n";
     char help_graph2[] =
            "\t\t[-j|--only-graph]\n"
           "\t\t[--font FONTTAG:size:font]\n"
@@ -384,8 +385,11 @@ int main(int argc, char *argv[])
                PrintUsage(argv[2]);
                exit(0);
        }
-    else
-       HandleInputLine(argc, argv, stderr);    
+    else {
+        if(HandleInputLine(argc, argv, stderr)) {
+            return 1;
+        }
+    }
     return 0;
 }
 
@@ -539,7 +543,7 @@ int HandleInputLine(int argc, char **argv, FILE* out)
     else if (strcmp("resize", argv[1]) == 0)
        rrd_resize(argc-1, &argv[1]);
     else if (strcmp("last", argv[1]) == 0)
-        printf("%ld\n",rrd_last(argc-1, argv[1]));
+        printf("%ld\n",rrd_last(argc-1, &argv[1]));
     else if (strcmp("update", argv[1]) == 0)
        rrd_update(argc-1, &argv[1]);
     else if (strcmp("fetch", argv[1]) == 0) {
@@ -619,9 +623,10 @@ int HandleInputLine(int argc, char **argv, FILE* out)
        const char *imgfile = argv[2]; /* rrd_graph changes argv pointer */
 #endif
        int xsize, ysize;
+       double ymin,ymax;
        int i;
        int tostdout = (strcmp(argv[2],"-") == 0);      
-       if( rrd_graph(argc-1, &argv[1], &calcpr, &xsize, &ysize, NULL) != -1 ) {
+       if( rrd_graph(argc-1, &argv[1], &calcpr, &xsize, &ysize, NULL, &ymin, &ymax) != -1 ) {
            if (!tostdout) 
                printf ("%dx%d\n",xsize,ysize);
            if (calcpr) {
@@ -642,6 +647,7 @@ int HandleInputLine(int argc, char **argv, FILE* out)
     if (rrd_test_error()) {
        fprintf(out, "ERROR: %s\n",rrd_get_error());
        rrd_clear_error();
+       return 1;
     }
     return(0);
 }