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 /src/binlogcat.c | |
parent | ef3f928cc712f6774e19f8cb8f880cbeac15e8ff (diff) | |
download | vmod-binlog-7d0beb6599c53544739409ca4aec104bf27a3f35.tar.gz vmod-binlog-7d0beb6599c53544739409ca4aec104bf27a3f35.tar.bz2 |
Add version and help output to command line utilities.
Diffstat (limited to 'src/binlogcat.c')
-rw-r--r-- | src/binlogcat.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/binlogcat.c b/src/binlogcat.c index 656d8f2..ada8efe 100644 --- a/src/binlogcat.c +++ b/src/binlogcat.c | |||
@@ -137,22 +137,35 @@ catlog(const char *fname) | |||
137 | fclose(fp); | 137 | fclose(fp); |
138 | } | 138 | } |
139 | 139 | ||
140 | void | 140 | void |
141 | help() | 141 | 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 | } |
145 | 158 | ||
146 | int | 159 | int |
147 | main(int argc, char **argv) | 160 | main(int argc, char **argv) |
148 | { | 161 | { |
149 | int c; | 162 | int c; |
150 | 163 | ||
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) { |
154 | case 'd': | 167 | case 'd': |
155 | timediff_option = 1; | 168 | timediff_option = 1; |
156 | timefmt = "%s"; | 169 | timefmt = "%s"; |
157 | break; | 170 | break; |
158 | case 'h': | 171 | case 'h': |
@@ -161,12 +174,15 @@ main(int argc, char **argv) | |||
161 | case 't': | 174 | case 't': |
162 | timefmt = optarg; | 175 | timefmt = optarg; |
163 | break; | 176 | break; |
164 | case 'n': | 177 | case 'n': |
165 | number_option = 1; | 178 | number_option = 1; |
166 | break; | 179 | break; |
180 | case 'V': | ||
181 | version(); | ||
182 | exit(0); | ||
167 | case 'v': | 183 | case 'v': |
168 | verbose_option = 1; | 184 | verbose_option = 1; |
169 | break; | 185 | break; |
170 | default: | 186 | default: |
171 | exit(1); | 187 | exit(1); |
172 | } | 188 | } |