From 4f9696b2783130754c5d897b6d3b3c7c42ae0013 Mon Sep 17 00:00:00 2001 From: oetiker Date: Mon, 13 Aug 2012 14:04:15 +0000 Subject: [PATCH] =?utf8?q?integrate=20rrdinfo=20and=20rrdcreate=20into=20t?= =?utf8?q?he=20rrdupdate=20binary=20-=20Sven-G=C3=B6ran=20Bergh?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@2300 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/Makefile.am | 7 ++++-- program/src/rrdupdate.c | 52 +++++++++++++++++++++++++++++++---------- 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/program/src/Makefile.am b/program/src/Makefile.am index 1c62157a..772533b1 100644 --- a/program/src/Makefile.am +++ b/program/src/Makefile.am @@ -16,6 +16,8 @@ AM_CFLAGS = @CFLAGS@ ## no including this by default @WERROR@ UPD_C_FILES = \ + rrd_create.c \ + hash_32.c \ rrd_parsetime.c \ rrd_hw.c \ rrd_hw_math.c \ @@ -32,8 +34,6 @@ UPD_C_FILES = \ rrd_update.c RRD_C_FILES = \ - rrd_create.c \ - hash_32.c \ rrd_version.c \ rrd_last.c \ rrd_lastupdate.c \ @@ -129,3 +129,6 @@ EXTRA_DIST= librrd.pc.in strftime.c strftime.h rrd_getopt.c rrd_getopt1.c rrd_g librrd.sym: librrd.sym.in $(AM_V_GEN)grep -v LIBC_HAS_GETOPT_LONG librrd.sym.in >$@ + +install-exec-hook: + (cd $(DESTDIR)$(bindir) && $(LN_S) rrdupdate rrdcreate && $(LN_S) rrdupdate rrdinfo) diff --git a/program/src/rrdupdate.c b/program/src/rrdupdate.c index ad1d77ba..5a6301ed 100644 --- a/program/src/rrdupdate.c +++ b/program/src/rrdupdate.c @@ -15,24 +15,52 @@ #endif #include "rrd.h" +#include "plbasename.h" int main( int argc, char **argv) { - rrd_update(argc, argv); - if (rrd_test_error()) { - printf("RRDtool " PACKAGE_VERSION - " Copyright by Tobi Oetiker, 1997-2008\n\n" - "Usage: rrdupdate filename\n" - "\t\t\t[--template|-t ds-name:ds-name:...]\n" - "\t\t\ttime|N:value[:value...]\n\n" - "\t\t\tat-time@value[:value...]\n\n" - "\t\t\t[ time:value[:value...] ..]\n\n"); + char *name=basename(argv[0]); + rrd_info_t *info; - printf("ERROR: %s\n", rrd_get_error()); - rrd_clear_error(); - return 1; + if (!strcmp(name, "rrdcreate")) { + rrd_create(argc, argv); + } + else if (!strcmp(name, "rrdinfo")) { + info=rrd_info(argc, argv); + rrd_info_print(info); + rrd_info_free(info); + } + else { + rrd_update(argc, argv); } + + if (rrd_test_error()) { + printf("RRDtool " PACKAGE_VERSION + " Copyright by Tobi Oetiker, 1997-2010\n\n"); + if (!strcmp(name, "rrdcreate")) { + printf("Usage: rrdcreate \n" + "\t\t\t[--start|-b start time]\n" + "\t\t\t[--step|-s step]\n" + "\t\t\t[--no-overwrite]\n" + "\t\t\t[DS:ds-name:DST:dst arguments]\n" + "\t\t\t[RRA:CF:cf arguments]\n\n"); + } + else if (!strcmp(name, "rrdinfo")) { + printf("Usage: rrdinfo \n"); + } + else { + printf("Usage: rrdupdate \n" + "\t\t\t[--template|-t ds-name[:ds-name]...]\n" + "\t\t\ttime|N:value[:value...]\n\n" + "\t\t\tat-time@value[:value...]\n\n" + "\t\t\t[ time:value[:value...] ..]\n\n"); + } + + printf("ERROR: %s\n", rrd_get_error()); + rrd_clear_error(); + return 1; + } return 0; } -- 2.30.2