in pipe mode, make rrd_tool send errors to STDOUT (most of the time) -- tobi
[rrdtool.git] / src / rrd_tool.c
index 2e0bf9c..2334431 100644 (file)
@@ -22,7 +22,7 @@ void PrintUsage(char *cmd)
 {
 
     char help_main[] =
-          "RRDtool " PACKAGE_VERSION "  Copyright 1997-2005 by Tobias Oetiker <tobi@oetiker.ch>\n"
+          "RRDtool " PACKAGE_VERSION "  Copyright 1997-2006 by Tobias Oetiker <tobi@oetiker.ch>\n"
            "               Compiled " __DATE__ " " __TIME__ "\n\n"
           "Usage: rrdtool [options] command command_options\n\n";
 
@@ -363,7 +363,7 @@ int main(int argc, char *argv[])
 
            while (fgets(aLine, sizeof(aLine)-1, stdin)){
                if ((argc = CountArgs(aLine)) == 0)  {
-                   fprintf(stderr,"ERROR: not enough arguments\n");
+                   printf("ERROR: not enough arguments\n");
                }
                if ((myargv = (char **) malloc((argc+1) * 
                                               sizeof(char *))) == NULL)   {
@@ -650,8 +650,15 @@ int HandleInputLine(int argc, char **argv, FILE* out)
        double ymin,ymax;
        int i;
        int tostdout = (strcmp(argv[2],"-") == 0);      
+       int imginfo = 0;
+       for (i=2;i<argc;i++){
+               if (strcmp(argv[i],"--imginfo") == 0 || strcmp(argv[i],"-f") == 0){
+                       imginfo = 1;
+                       break;
+               }
+       }
        if( rrd_graph(argc-1, &argv[1], &calcpr, &xsize, &ysize, NULL, &ymin, &ymax) != -1 ) {
-           if (!tostdout) 
+           if (!tostdout && !imginfo
                printf ("%dx%d\n",xsize,ysize);
            if (calcpr) {
                for(i=0;calcpr[i];i++){