summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 87e0f85)
raw | patch | inline | side by side (parent: 87e0f85)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 22 Oct 2009 23:18:53 +0000 (23:18 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 22 Oct 2009 23:18:53 +0000 (23:18 +0000) |
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.3/program@1943 a5681a0c-68f1-0310-ab6d-d61299d08faa
src/rrd_tool.c | patch | blob | history |
diff --git a/src/rrd_tool.c b/src/rrd_tool.c
index 673598790e1d1849fa74eeea806e13607aaabe47..78252baa83bea3f820bf982b619104ca9896a357 100644 (file)
--- a/src/rrd_tool.c
+++ b/src/rrd_tool.c
int CreateArgs(
char *,
char *,
- int,
char **);
int HandleInputLine(
int,
}
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(¤ttime, NULL);
}
}
fflush(stdout); /* this is important for pipes to work */
- free(aLine);
+ free(myargv);
+ free(aLineOrig);
}
} else if (argc == 2) {
PrintUsage(argv[1]);
int CreateArgs(
char *pName,
char *aLine,
- int argc,
char **argv)
{
char *getP, *putP;
char Quote = 0;
int inArg = 0;
int len;
+ int argc = 1;
len = strlen(aLine);
/* remove trailing space and newlines */