Code

rrd_first code contributed by Burton Strauss <Burton@ntopSupport.com>
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Sat, 12 Mar 2005 17:06:46 +0000 (17:06 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Sat, 12 Mar 2005 17:06:46 +0000 (17:06 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@309 a5681a0c-68f1-0310-ab6d-d61299d08faa

bindings/perl-shared/RRDs.xs
doc/Makefile.am
src/Makefile.am
src/rrd.h
src/rrd_tool.c

index 558bdc0720b27183ca6eee891d2e5c6f9df4acd7..b97872e00d65b906c5796788c70334430143cd71 100644 (file)
@@ -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(...)
index 3074b613c72487deca38dfb6b82c43075cacd01b..d23f49f4bacf796019ac2da171d164b81a9aeafd 100644 (file)
@@ -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 \
index 68875df779550a2cbb4db6a8c48eb667213daf5a..246ef789a4579fab9c9941bd5f85f166534e09b0 100644 (file)
@@ -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   \
index 2868ebb9098d3f74e583174fd821390ed1a57308..49164e381fdd9e9baeb1d13fabb8f664778e2326 100644 (file)
--- a/src/rrd.h
+++ b/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 {
index 94c2b157bc94f79a4afdcb503647750ab89e505f..f4cfa11af0e3153cd1f68b3c65237b189319152b 100644 (file)
@@ -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) {