From: oetiker Date: Sat, 12 Mar 2005 17:06:46 +0000 (+0000) Subject: rrd_first code contributed by Burton Strauss X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=61aa0e89bbac5ebea30187b49a2ecb2d84c70e16;p=rrdtool-all.git rrd_first code contributed by Burton Strauss git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@309 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/bindings/perl-shared/RRDs.xs b/program/bindings/perl-shared/RRDs.xs index 558bdc07..b97872e0 100644 --- a/program/bindings/perl-shared/RRDs.xs +++ b/program/bindings/perl-shared/RRDs.xs @@ -132,6 +132,17 @@ rrd_last(...) OUTPUT: RETVAL +int +rrd_last(...) + PROTOTYPE: @ + PREINIT: + int i; + char **argv; + CODE: + rrdcode(rrd_first); + OUTPUT: + RETVAL + int rrd_create(...) diff --git a/program/doc/Makefile.am b/program/doc/Makefile.am index 3074b613..d23f49f4 100644 --- a/program/doc/Makefile.am +++ b/program/doc/Makefile.am @@ -13,7 +13,7 @@ SRC = rrdgraph.src rrdgraph_examples.src rrdgraph_rpn.src \ PODOLD = rrdgraph-old.pod -POD = rrdtool.pod rrdlast.pod rrdcreate.pod rrdupdate.pod rrdtutorial.es.pod \ +POD = rrdtool.pod rrdlast.pod rrdfirst.pod rrdcreate.pod rrdupdate.pod rrdtutorial.es.pod \ cdeftutorial.pod rpntutorial.pod rrdthreads.pod bin_dec_hex.pod \ rrdfetch.pod rrdrestore.pod rrddump.pod rrdtune.pod rrdresize.pod \ rrdcgi.pod rrdtutorial.pod rrdinfo.pod rrdxport.pod rrd-beginners.pod \ diff --git a/program/src/Makefile.am b/program/src/Makefile.am index 68875df7..246ef789 100644 --- a/program/src/Makefile.am +++ b/program/src/Makefile.am @@ -29,6 +29,7 @@ RRD_C_FILES = \ rrd_graph.c \ rrd_graph_helper.c \ rrd_last.c \ + rrd_first.c \ rrd_open.c \ rrd_resize.c \ rrd_restore.c \ diff --git a/program/src/rrd.h b/program/src/rrd.h index 2868ebb9..49164e38 100644 --- a/program/src/rrd.h +++ b/program/src/rrd.h @@ -70,6 +70,7 @@ int rrd_restore(int, char **); int rrd_dump(int, char **); int rrd_tune(int, char **); time_t rrd_last(int, char **); +time_t rrd_first(int, char **); int rrd_resize(int, char **); int rrd_xport(int, char **, int *, time_t *, time_t *, unsigned long *, unsigned long *, @@ -85,6 +86,7 @@ int rrd_update_r(char *filename, char *_template, int argc, char **argv); int rrd_dump_r(char *filename); time_t rrd_last_r(const char *filename); +time_t rrd_first_r(const char *filename, int rraindex); /* Transplanted from parsetime.h */ typedef enum { diff --git a/program/src/rrd_tool.c b/program/src/rrd_tool.c index 94c2b157..f4cfa11a 100644 --- a/program/src/rrd_tool.c +++ b/program/src/rrd_tool.c @@ -32,7 +32,7 @@ void PrintUsage(char *cmd) char help_list[] = "Valid commands: create, update, updatev, graph, dump, restore,\n" - "\t\tlast, info, fetch, tune, resize, xport\n\n"; + "\t\tlast, first, info, fetch, tune, resize, xport\n\n"; char help_listremote[] = "Valid remote commands: quit, ls, cd, mkdir\n\n"; @@ -61,6 +61,10 @@ void PrintUsage(char *cmd) "* last - show last update time for RRD\n\n" "\trrdtool last filename.rrd\n\n"; + char help_first[] = + "* first - show first update time for RRA within an RRD\n\n" + "\trrdtool first filename.rrd [--rraindex number]\n\n"; + char help_update[] = "* update - update an RRD\n\n" "\trrdtool update filename\n" @@ -173,7 +177,7 @@ void PrintUsage(char *cmd) "For more information read the RRD manpages\n\n"; - enum { C_NONE, C_CREATE, C_DUMP, C_INFO, C_RESTORE, C_LAST, + enum { C_NONE, C_CREATE, C_DUMP, C_INFO, C_RESTORE, C_LAST, C_FIRST, C_UPDATE, C_FETCH, C_GRAPH, C_TUNE, C_RESIZE, C_XPORT, C_QUIT, C_LS, C_CD, C_MKDIR, C_UPDATEV }; @@ -191,6 +195,8 @@ void PrintUsage(char *cmd) help_cmd = C_RESTORE; else if (!strcmp(cmd,"last")) help_cmd = C_LAST; + else if (!strcmp(cmd,"first")) + help_cmd = C_FIRST; else if (!strcmp(cmd,"update")) help_cmd = C_UPDATE; else if (!strcmp(cmd,"updatev")) @@ -238,6 +244,9 @@ void PrintUsage(char *cmd) case C_LAST: fputs(help_last, stdout); break; + case C_FIRST: + fputs(help_first, stdout); + break; case C_UPDATE: fputs(help_update, stdout); break; @@ -544,6 +553,8 @@ int HandleInputLine(int argc, char **argv, FILE* out) rrd_resize(argc-1, &argv[1]); else if (strcmp("last", argv[1]) == 0) printf("%ld\n",rrd_last(argc-1, &argv[1])); + else if (strcmp("first", argv[1]) == 0) + printf("%ld\n",rrd_first(argc-1, &argv[1])); else if (strcmp("update", argv[1]) == 0) rrd_update(argc-1, &argv[1]); else if (strcmp("fetch", argv[1]) == 0) {