From 58e7efce3d5ac71e308e7e44176473cd66e8ad26 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 4 May 2011 14:39:37 +0200 Subject: move $ABRT_foo checking and setting into helper routines. I'm sick of fixing incorrect PROGNAME defines. Now g_progname is a variable and it is set from argv[0]. Signed-off-by: Denys Vlasenko --- src/plugins/abrt-dump-oops.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/plugins/abrt-dump-oops.c') diff --git a/src/plugins/abrt-dump-oops.c b/src/plugins/abrt-dump-oops.c index f716c3db..c2879caa 100644 --- a/src/plugins/abrt-dump-oops.c +++ b/src/plugins/abrt-dump-oops.c @@ -23,8 +23,6 @@ #include "abrtlib.h" #include "parse_options.h" -#define PROGNAME "abrt-dump-oops" - static bool world_readable_dump = false; static const char *debug_dumps_dir = "."; @@ -560,13 +558,11 @@ static unsigned save_oops_to_dump_dir(GList *oops_list, unsigned oops_cnt) int main(int argc, char **argv) { - char *env_verbose = getenv("ABRT_VERBOSE"); - if (env_verbose) - g_verbose = atoi(env_verbose); + abrt_init(argv); /* Can't keep these strings/structs static: _() doesn't support that */ const char *program_usage_string = _( - PROGNAME" [-vsrowx] [-d DIR] FILE\n" + "\b [-vsrowx] [-d DIR] FILE\n" "\n" "Extract oops from syslog/dmesg file" ); @@ -595,11 +591,11 @@ int main(int argc, char **argv) }; unsigned opts = parse_opts(argc, argv, program_options, program_usage_string); - putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose)); - msg_prefix = PROGNAME; - if ((opts & OPT_s) - || getenv("ABRT_SYSLOG") - ) { + export_abrt_envvars(0); + + msg_prefix = g_progname; + if ((opts & OPT_s) || getenv("ABRT_SYSLOG")) + { openlog(msg_prefix, 0, LOG_DAEMON); logmode = LOGMODE_SYSLOG; } -- cgit