* Updated perl compile system. It now uses Makefile.PL for everything,
[rrdtool.git] / src / rrd_last.c
index b9caa64..d50e760 100644 (file)
 time_t
 rrd_last(int argc, char **argv)
 {
+    if(argc < 2){
+        rrd_set_error("please specify an rrd");
+        return(-1);
+    }
+
+    return( rrd_last_r(argv[1]) );
+}
+
+time_t
+rrd_last_r(const char *filename)
+{
     FILE       *in_file;
     time_t       lastup;
 
     rrd_t       rrd;
 
-    if(argc < 2){
-        rrd_set_error("please specify an rrd");
-        return(-1);
-    }
-    if(rrd_open(argv[1], &in_file, &rrd, RRD_READONLY)==-1){
+    if(rrd_open(filename, &in_file, &rrd, RRD_READONLY)==-1){
         return(-1);
     }
     lastup = rrd.live_head->last_up;
@@ -28,7 +36,5 @@ rrd_last(int argc, char **argv)
     fclose(in_file);
     return(lastup);
 }
-