diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-10-15 20:07:26 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-10-15 20:07:26 +0300 |
commit | 7d0beb6599c53544739409ca4aec104bf27a3f35 (patch) | |
tree | b561fbba7c9acedec17cbc398cee12a465faad6e | |
parent | ef3f928cc712f6774e19f8cb8f880cbeac15e8ff (diff) | |
download | vmod-binlog-7d0beb6599c53544739409ca4aec104bf27a3f35.tar.gz vmod-binlog-7d0beb6599c53544739409ca4aec104bf27a3f35.tar.bz2 |
Add version and help output to command line utilities.
-rw-r--r-- | src/binlogcat.c | 20 | ||||
-rw-r--r-- | src/binlogsel.c | 25 | ||||
-rw-r--r-- | src/err.c | 9 | ||||
-rw-r--r-- | src/err.h | 1 |
4 files changed, 51 insertions, 4 deletions
diff --git a/src/binlogcat.c b/src/binlogcat.c index 656d8f2..ada8efe 100644 --- a/src/binlogcat.c +++ b/src/binlogcat.c | |||
@@ -142,3 +142,16 @@ help() | |||
142 | { | 142 | { |
143 | printf("usage: %s [-dhnv] [-t FORMAT] [FILE...]\n", progname); | 143 | printf("usage: %s [-dhnVv] [-t FORMAT] [FILE...]\n", progname); |
144 | printf("Format binary log files in human-readable form\n"); | ||
145 | printf("\nOptions are:\n\n"); | ||
146 | printf(" -d print timestamps relative to first record in the file\n"); | ||
147 | printf(" -n output record numbers\n"); | ||
148 | printf(" -v print information about each file\n"); | ||
149 | printf(" -t FORMAT format timestamps according to FORMAT\n"); | ||
150 | printf("\n"); | ||
151 | printf(" -h print this help summary\n"); | ||
152 | printf(" -V show program version\n"); | ||
153 | printf("\n"); | ||
154 | printf("Report bugs and suggestions to <%s>\n", PACKAGE_BUGREPORT); | ||
155 | if (sizeof(PACKAGE_URL) > 1) | ||
156 | printf("%s home page: <%s>\n", PACKAGE_NAME, PACKAGE_URL); | ||
144 | } | 157 | } |
@@ -151,3 +164,3 @@ main(int argc, char **argv) | |||
151 | setprogname(argv[0]); | 164 | setprogname(argv[0]); |
152 | while ((c = getopt(argc, argv, "dht:nv")) != EOF) | 165 | while ((c = getopt(argc, argv, "dht:nVv")) != EOF) |
153 | switch (c) { | 166 | switch (c) { |
@@ -166,2 +179,5 @@ main(int argc, char **argv) | |||
166 | break; | 179 | break; |
180 | case 'V': | ||
181 | version(); | ||
182 | exit(0); | ||
167 | case 'v': | 183 | case 'v': |
diff --git a/src/binlogsel.c b/src/binlogsel.c index 8f1cfce..b05b12c 100644 --- a/src/binlogsel.c +++ b/src/binlogsel.c | |||
@@ -55,3 +55,21 @@ help() | |||
55 | { | 55 | { |
56 | printf("usage: %s [-dhnv] [-t FORMAT] [-F FROMTIME] [-T TOTIME] [-p PATTERN] [-D DIR] [FILE...]\n", progname); | 56 | printf("usage: %s [-dhnVv] [-t FORMAT] [-F TIME] [-T TIME] [-p PATTERN] [-D DIR] [FILE...]\n", progname); |
57 | printf("Select records from binary logs\n"); | ||
58 | printf("\nOptions are:\n\n"); | ||
59 | printf(" -D DIR log file storage directory\n"); | ||
60 | printf(" -F TIME print records starting from TIME\n"); | ||
61 | printf(" -T TIME print records starting up to TIME\n"); | ||
62 | printf(" -p PATTERN select files matching PATTERN\n"); | ||
63 | printf("\n"); | ||
64 | printf(" -d print timestamps relative to first record in the file\n"); | ||
65 | printf(" -n output record numbers\n"); | ||
66 | printf(" -v print information about each file\n"); | ||
67 | printf(" -t FMT format timestamps according to FMT\n"); | ||
68 | printf("\n"); | ||
69 | printf(" -h print this help summary\n"); | ||
70 | printf(" -V show program version\n"); | ||
71 | printf("\n"); | ||
72 | printf("Report bugs and suggestions to <%s>\n", PACKAGE_BUGREPORT); | ||
73 | if (sizeof(PACKAGE_URL) > 1) | ||
74 | printf("%s home page: <%s>\n", PACKAGE_NAME, PACKAGE_URL); | ||
57 | } | 75 | } |
@@ -616,3 +634,3 @@ main(int argc, char **argv) | |||
616 | setprogname(argv[0]); | 634 | setprogname(argv[0]); |
617 | while ((c = getopt(argc, argv, "D:dF:hi:p:T:t:nv")) != EOF) | 635 | while ((c = getopt(argc, argv, "D:dF:hi:p:T:t:nV")) != EOF) |
618 | switch (c) { | 636 | switch (c) { |
@@ -660,2 +678,5 @@ main(int argc, char **argv) | |||
660 | break; | 678 | break; |
679 | case 'V': | ||
680 | version(); | ||
681 | exit(0); | ||
661 | case 'v': | 682 | case 'v': |
@@ -62 +62,10 @@ packerror(const char *fmt, ...) | |||
62 | 62 | ||
63 | void | ||
64 | version(void) | ||
65 | { | ||
66 | printf("%s (%s) %s\n", progname, PACKAGE_TARNAME, PACKAGE_VERSION); | ||
67 | printf("Copyright (C) 2013 Sergey Poznyakoff\n"); | ||
68 | printf("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n"); | ||
69 | printf("This is free software: you are free to change and redistribute it.\n"); | ||
70 | printf("There is NO WARRANTY, to the extent permitted by law.\n"); | ||
71 | } | ||
@@ -21 +21,2 @@ void error(const char *fmt, ...); | |||
21 | void packerror(const char *fmt, ...); | 21 | void packerror(const char *fmt, ...); |
22 | void version(void); | ||