{
char help_main[] =
- "RRDtool 1.1.x Copyright 1997-2001 by Tobias Oetiker <tobi@oetiker.ch>\n\n"
+ "RRDtool 1.1.x Copyright 1997-2003 by Tobias Oetiker <tobi@oetiker.ch>\n"
+ " Compiled " MAKE_TIMESTAMP "\n\n"
"Usage: rrdtool [options] command command_options\n\n";
char help_list[] =
return 0;
}
+/* HandleInputLine is NOT thread safe - due to readdir issues,
+ resolving them portably is not really simple. */
int HandleInputLine(int argc, char **argv, FILE* out)
{
#if defined(HAVE_OPENDIR) && defined (HAVE_READDIR)
strcmp("v", argv[1]) == 0 ||
strcmp("-v", argv[1]) == 0 ||
strcmp("-version", argv[1]) == 0 )
- printf("RRDtool 1.1.x Copyright (C) 1997-2001 by Tobias Oetiker <tobi@oetiker.ch>\n");
+ printf("RRDtool 1.1.x Copyright (C) 1997-2003 by Tobias Oetiker <tobi@oetiker.ch>\n");
else if (strcmp("restore", argv[1]) == 0)
rrd_restore(argc-1, &argv[1]);
else if (strcmp("resize", argv[1]) == 0)
else if (strcmp("update", argv[1]) == 0)
rrd_update(argc-1, &argv[1]);
else if (strcmp("fetch", argv[1]) == 0) {
- time_t start,end;
+ time_t start,end, ti;
unsigned long step, ds_cnt,i,ii;
rrd_value_t *data,*datai;
char **ds_namv;
for (i = 0; i<ds_cnt;i++)
printf("%14s",ds_namv[i]);
printf ("\n\n");
- for (i = start+step; i <= end; i += step){
- printf("%10lu:", i);
+ for (ti = start+step; ti <= end; ti += step){
+ printf("%10lu:", ti);
for (ii = 0; ii < ds_cnt; ii++)
printf(" %0.10e", *(datai++));
printf("\n");
}
} else if (strcmp("xport", argv[1]) == 0) {
int xxsize;
- unsigned long int i = 0, j = 0;
- time_t start,end;
+ unsigned long int j = 0;
+ time_t start,end, ti;
unsigned long step, col_cnt,row_cnt;
rrd_value_t *data,*ptr;
char **legend_v;
printf(" </%s>\n", LEGEND_TAG);
printf(" </%s>\n", META_TAG);
printf(" <%s>\n", DATA_TAG);
- for (i = start+step; i <= end; i += step) {
+ for (ti = start+step; ti <= end; ti += step) {
printf (" <%s>", DATA_ROW_TAG);
- printf ("<%s>%lu</%s>", COL_TIME_TAG, i, COL_TIME_TAG);
+ printf ("<%s>%lu</%s>", COL_TIME_TAG, ti, COL_TIME_TAG);
for (j = 0; j < col_cnt; j++) {
rrd_value_t newval = DNAN;
newval = *ptr;
const char *imgfile = argv[2]; /* rrd_graph changes argv pointer */
int xsize, ysize;
int i;
+ int tostdout = (strcmp(argv[2],"-") == 0);
if( rrd_graph(argc-1, &argv[1], &calcpr, &xsize, &ysize) != -1 ) {
- if (strcmp(imgfile,"-") != 0)
+ if (!tostdout)
printf ("%dx%d\n",xsize,ysize);
if (calcpr) {
for(i=0;calcpr[i];i++){
- if (strcmp(imgfile,"-") != 0)
+ if (!tostdout)
printf("%s\n",calcpr[i]);
free(calcpr[i]);
}