From 46f706319695dc77d66ab5f7cbc5cbdcad707366 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 25 Mar 2011 00:33:43 +0100 Subject: make $ABRT_PROG_PREFIX control whether log messages are prefixed by abrt-action-foo programs. abrtd, abrt-server and abrt-handle-crashdump now have option -p which sets ABRT_PROG_PREFIX=1 for their children and thus makes them emit program name prefixes. Signed-off-by: Denys Vlasenko --- src/plugins/abrt-action-analyze-c.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/plugins/abrt-action-analyze-c.c') diff --git a/src/plugins/abrt-action-analyze-c.c b/src/plugins/abrt-action-analyze-c.c index 635a3316..3c7d4f1d 100644 --- a/src/plugins/abrt-action-analyze-c.c +++ b/src/plugins/abrt-action-analyze-c.c @@ -153,31 +153,27 @@ int main(int argc, char **argv) /* Can't keep these strings/structs static: _() doesn't support that */ const char *program_usage_string = _( - PROGNAME" [-v] -d DIR\n\n" - "Calculates and saves UUID of coredumps" + PROGNAME" [-v] -d DIR\n" + "\n" + "Calculates and saves UUID of coredump in dump directory DIR" ); enum { OPT_v = 1 << 0, OPT_d = 1 << 1, -// OPT_s = 1 << 2, }; /* Keep enum above and order of options below in sync! */ struct options program_options[] = { OPT__VERBOSE(&g_verbose), - OPT_STRING('d', NULL, &dump_dir_name, "DIR", _("Crash dump directory")), -// OPT_BOOL( 's', NULL, NULL, _("Log to syslog" )), + OPT_STRING('d', NULL, &dump_dir_name, "DIR", _("Dump directory")), OPT_END() }; /*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string); putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose)); - msg_prefix = PROGNAME; -//Maybe we will want this... later -// if (opts & OPT_s) -// { -// openlog(msg_prefix, 0, LOG_DAEMON); -// logmode = LOGMODE_SYSLOG; -// } + + char *pfx = getenv("ABRT_PROG_PREFIX"); + if (pfx && string_to_bool(pfx)) + msg_prefix = PROGNAME; /* Run unstrip -n and trim its output, leaving only sizes and build ids */ -- cgit