Code

prepare for the release of rrdtool-1.3.9
[rrdtool-all.git] / program / src / rrd_tool.c
index 3df092b3d4378ed33620838c8a39024ab6a040bc..cd27b5fde634d5c37f33edb706c80a4b79e2957a 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.7  Copyright by Tobi Oetiker, 1997-2009
+ * RRDtool 1.3.9  Copyright by Tobi Oetiker, 1997-2009
  *****************************************************************************
  * rrd_tool.c  Startup wrapper
  *****************************************************************************/
@@ -29,7 +29,6 @@ int       CountArgs(
 int       CreateArgs(
     char *,
     char *,
-    int,
     char **);
 int       HandleInputLine(
     int,
@@ -143,6 +142,7 @@ void PrintUsage(
            "\t\t[-m|--zoom factor]\n"
            "\t\t[-A|--alt-autoscale]\n"
            "\t\t[-M|--alt-autoscale-max]\n"
+           "\t\t[-G|--graph-render-mode {normal,mono}]\n"
            "\t\t[-R|--font-render-mode {normal,light,mono}]\n"
            "\t\t[-B|--font-smoothing-threshold size]\n"
            "\t\t[-T|--tabwidth width]\n"
@@ -452,24 +452,21 @@ int main(
         }
 
         while (fgetslong(&aLine, stdin)) {
+            char *aLineOrig = aLine;
             if ((argc = CountArgs(aLine)) == 0) {
                 free(aLine);
                 printf("ERROR: not enough arguments\n");
+                continue;                
             }
             if ((myargv = (char **) malloc((argc + 1) *
                                            sizeof(char *))) == NULL) {
                 perror("malloc");
                 exit(1);
             }
-            if ((argc = CreateArgs(argv[0], aLine, argc, myargv)) < 0) {
-                free(aLine);
-                free(myargv);
+            if ((argc = CreateArgs(argv[0], aLine, myargv)) < 0) {
                 printf("ERROR: creating arguments\n");
             } else {
-                int       ret = HandleInputLine(argc, myargv, stdout);
-
-                free(myargv);
-                if (ret == 0) {
+                if ( HandleInputLine(argc, myargv, stdout) == 0 ){
 #if HAVE_GETRUSAGE
                     getrusage(RUSAGE_SELF, &myusage);
                     gettimeofday(&currenttime, NULL);
@@ -488,7 +485,8 @@ int main(
                 }
             }
             fflush(stdout); /* this is important for pipes to work */
-            free(aLine);
+            free(myargv);
+            free(aLineOrig);
         }
     } else if (argc == 2) {
         PrintUsage(argv[1]);
@@ -858,7 +856,6 @@ int CountArgs(
 int CreateArgs(
     char *pName,
     char *aLine,
-    int argc,
     char **argv)
 {
     char     *getP, *putP;
@@ -866,6 +863,7 @@ int CreateArgs(
     char      Quote = 0;
     int       inArg = 0;
     int       len;
+    int       argc = 1;
 
     len = strlen(aLine);
     /* remove trailing space and newlines */