diff options
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': |