summaryrefslogtreecommitdiffstats
path: root/src/daemon/abrt-action-print.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2010-11-03 18:07:56 +0100
committerDenys Vlasenko <dvlasenk@redhat.com>2010-11-03 18:07:56 +0100
commita8f39ad24b77926929fe6780dfeba44ac0558a92 (patch)
tree34afaa6667ff688df49d0fe8597295d6a3a55b27 /src/daemon/abrt-action-print.cpp
parentb6bb9e0ad581b5534ef51c627f274b0a24ebb7d7 (diff)
abrtd: convert reporting step to run_action, part 1 (main)
There are a few things which are missing in this commit: for example, the list of possible reporting "paths" is not extracted from abrt_event.conf yet. Part 2 will deal with it. Tested: reporting thru bugzilla and thru logger. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/daemon/abrt-action-print.cpp')
-rw-r--r--src/daemon/abrt-action-print.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/daemon/abrt-action-print.cpp b/src/daemon/abrt-action-print.cpp
index c6988921..75f5bd92 100644
--- a/src/daemon/abrt-action-print.cpp
+++ b/src/daemon/abrt-action-print.cpp
@@ -27,6 +27,7 @@
#define PROGNAME "abrt-action-print"
static const char *dump_dir_name = ".";
+static const char *output_file = NULL;
int main(int argc, char **argv)
{
@@ -35,24 +36,38 @@ int main(int argc, char **argv)
g_verbose = atoi(env_verbose);
const char *program_usage = _(
- PROGNAME" [-v] -d DIR\n"
+ PROGNAME" [-v] [-o FILE] -d DIR\n"
"\n"
"Print information about the crash to standard output");
enum {
OPT_v = 1 << 0,
OPT_d = 1 << 1,
+ OPT_o = 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_STRING('d', NULL, &dump_dir_name, "DIR" , _("Crash dump directory")),
+ OPT_STRING('o', NULL, &output_file , "FILE", _("Output file")),
OPT_END()
};
+//BITROT: restore handling of:
+// $Logger_AppendLogs=yes
+// $Logger_LogPath=/var/log/abrt.log
+
/*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage);
putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose));
+ if (output_file)
+ {
+ if (!freopen(output_file, "w", stdout))
+ {
+ perror_msg_and_die("Can't open '%s'", output_file);
+ }
+ }
+
try
{
struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
@@ -73,5 +88,7 @@ int main(int argc, char **argv)
return 1;
}
+ if (output_file)
+ log("The report was stored to %s", output_file);
return 0;
}