From 6cee6073073b0098fe861bf36c0bcbd8e2c3f359 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 19 Nov 2010 13:18:21 +0100 Subject: [PATCH] die() now reports the correct program name --- mdup.c | 2 ++ mrate.c | 2 ++ smail.c | 2 ++ util.c | 2 +- util.h | 1 + 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/mdup.c b/mdup.c index 877d375..aefe341 100644 --- a/mdup.c +++ b/mdup.c @@ -18,6 +18,8 @@ #include "util.h" +const char progname[] = "mdup"; + static char *db_name; static uns max_age = 86400; static uns now; diff --git a/mrate.c b/mrate.c index 5c76b00..8caddf4 100644 --- a/mrate.c +++ b/mrate.c @@ -16,6 +16,8 @@ #include "util.h" +const char progname[] = "mrate"; + static char *db_name; static int db_fd; diff --git a/smail.c b/smail.c index c6cd754..0e886f8 100644 --- a/smail.c +++ b/smail.c @@ -15,6 +15,8 @@ #include "util.h" +const char progname[] = "smail"; + static char *local_user; static char *local_domain; static char *from_user; diff --git a/util.c b/util.c index d3e24a1..24837d8 100644 --- a/util.c +++ b/util.c @@ -18,7 +18,7 @@ die(char *c, ...) { va_list args; va_start(args, c); - fprintf(stderr, "mdup: "); + fprintf(stderr, "%s: ", progname); vfprintf(stderr, c, args); fputc('\n', stderr); va_end(args); diff --git a/util.h b/util.h index 66c78ce..cd1a132 100644 --- a/util.h +++ b/util.h @@ -30,6 +30,7 @@ typedef uint64_t u64; /* util.c */ extern int verbose; +extern const char progname[]; void NONRET die(char *x, ...); void verb(int level, char *x, ...); -- 2.39.2