From 7d0beb6599c53544739409ca4aec104bf27a3f35 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Tue, 15 Oct 2013 20:07:26 +0300 Subject: Add version and help output to command line utilities. --- src/binlogcat.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/binlogcat.c') diff --git a/src/binlogcat.c b/src/binlogcat.c index 656d8f2..ada8efe 100644 --- a/src/binlogcat.c +++ b/src/binlogcat.c @@ -140,7 +140,20 @@ catlog(const char *fname) void help() { - printf("usage: %s [-dhnv] [-t FORMAT] [FILE...]\n", progname); + printf("usage: %s [-dhnVv] [-t FORMAT] [FILE...]\n", progname); + printf("Format binary log files in human-readable form\n"); + printf("\nOptions are:\n\n"); + printf(" -d print timestamps relative to first record in the file\n"); + printf(" -n output record numbers\n"); + printf(" -v print information about each file\n"); + printf(" -t FORMAT format timestamps according to FORMAT\n"); + printf("\n"); + printf(" -h print this help summary\n"); + printf(" -V show program version\n"); + printf("\n"); + printf("Report bugs and suggestions to <%s>\n", PACKAGE_BUGREPORT); + if (sizeof(PACKAGE_URL) > 1) + printf("%s home page: <%s>\n", PACKAGE_NAME, PACKAGE_URL); } int @@ -149,7 +162,7 @@ main(int argc, char **argv) int c; setprogname(argv[0]); - while ((c = getopt(argc, argv, "dht:nv")) != EOF) + while ((c = getopt(argc, argv, "dht:nVv")) != EOF) switch (c) { case 'd': timediff_option = 1; @@ -164,6 +177,9 @@ main(int argc, char **argv) case 'n': number_option = 1; break; + case 'V': + version(); + exit(0); case 'v': verbose_option = 1; break; -- cgit v1.2.1