diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-10-13 12:44:12 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-10-13 12:48:04 +0300 |
commit | 23f262e8c6181465347c3bb47644f9d86fcb7432 (patch) | |
tree | cdf5ac3a861395ade00b71e7b8cdd641db67032c /src/binlogcat.c | |
parent | 510fc646f13b843d046323e3477edb6c1bc2258d (diff) | |
download | vmod-binlog-23f262e8c6181465347c3bb47644f9d86fcb7432.tar.gz vmod-binlog-23f262e8c6181465347c3bb47644f9d86fcb7432.tar.bz2 |
* src/Makefile.am: New convenience library libbinlog.a
* src/binlogcat.c: Use functions from libbinlog.a
* src/err.h: New file.
* src/err.c: New file.
* tests/.gitignore: Add binpack.c
* tests/Makefile.am: Build binpack.c
* tests/binpack.c: New file.
Diffstat (limited to 'src/binlogcat.c')
-rw-r--r-- | src/binlogcat.c | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/src/binlogcat.c b/src/binlogcat.c index 8cdfaaa..bdeb992 100644 --- a/src/binlogcat.c +++ b/src/binlogcat.c @@ -26,42 +26,14 @@ #include <string.h> #include "vmod-binlog.h" #include "pack.h" +#include "err.h" -char *progname; char *timefmt = "%c"; int number_option; int verbose_option; int timediff_option; void -verror(const char *fmt, va_list ap) -{ - fprintf(stderr, "%s: ", progname); - vfprintf(stderr, fmt, ap); - fputc('\n', stderr); -} - -void -error(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - verror(fmt, ap); - va_end(ap); -} - -void -packerror(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - verror(fmt, ap); - va_end(ap); -} - -void catlog(const char *fname) { FILE *fp; @@ -98,7 +70,7 @@ catlog(const char *fname) } if (header.version != BINLOG_VERSION) { - error("%s: unknown version", progname, fname); + error("%s: unknown version", fname); exit(1); } @@ -176,9 +148,9 @@ help() int main(int argc, char **argv) { - progname = argv[0]; int c; + setprogname(argv[0]); while ((c = getopt(argc, argv, "dht:nv")) != EOF) switch (c) { case 'd': |