---
src/cli/cli.c | 15 ++++++++++-----
src/cli/report-cli.txt | 5 ++++-
src/cli/report.c | 39 +++++++++++++++++++++------------------
src/cli/report.h | 1 +
4 files changed, 36 insertions(+), 24 deletions(-)
diff --git a/src/cli/cli.c b/src/cli/cli.c
index 14c24c7..9503c87 100644
--- a/src/cli/cli.c
+++ b/src/cli/cli.c
@@ -169,7 +169,7 @@ int main(int argc, char** argv)
"or: \b [-vsp] -L[PREFIX] [DUMP_DIR]\n"
"or: \b [-vsp] -e EVENT DUMP_DIR\n"
"or: \b [-vsp] -a[y] DUMP_DIR\n"
- "or: \b [-vsp] -r[y] DUMP_DIR\n"
+ "or: \b [-vsp] -r[y|o] DUMP_DIR\n"
"or: \b [-vsp] -d DUMP_DIR"
);
enum {
@@ -186,9 +186,10 @@ int main(int argc, char** argv)
OPTMASK_need_arg = OPT_info|OPT_run_event|OPT_analyze|OPT_report|OPT_delete,
OPT_f = 1 << 9,
OPT_y = 1 << 10,
- OPT_v = 1 << 11,
- OPT_s = 1 << 12,
- OPT_p = 1 << 13,
+ OPT_o = 1 << 11,
+ OPT_v = 1 << 12,
+ OPT_s = 1 << 13,
+ OPT_p = 1 << 14,
};
/* Keep enum above and order of options below in sync! */
struct options program_options[] = {
@@ -204,6 +205,7 @@ int main(int argc, char** argv)
OPT_BOOL( 'V', "version", NULL,
_("Display version and exit")),
OPT_BOOL( 'f', "full" , NULL,
_("Full listing")),
OPT_BOOL( 'y', "always" , NULL,
_("Noninteractive: don't ask questions, assume 'yes'")),
+ OPT_BOOL( 'o', "report-only" , NULL,
_("Report pre-filled problem data")),
OPT__VERBOSE(&g_verbose),
OPT_BOOL( 's', NULL , NULL, _("Log to
syslog")),
OPT_BOOL( 'p', NULL , NULL, _("Add
program names to log")),
@@ -243,6 +245,7 @@ int main(int argc, char** argv)
char *dump_dir_name = argv[0];
bool full = (opts & OPT_f);
bool always = (opts & OPT_y);
+ bool report_only = (opts & OPT_o);
if (!D_list)
{
@@ -334,7 +337,9 @@ int main(int argc, char** argv)
}
}
- exitcode = report(dump_dir_name, (always ? CLI_REPORT_BATCH : 0));
+ exitcode = report(dump_dir_name,
+ (always ? CLI_REPORT_BATCH : 0) |
+ (report_only ? CLI_REPORT_ONLY : 0));
if (exitcode == -1)
error_msg_and_die("Crash '%s' not found",
dump_dir_name);
break;
diff --git a/src/cli/report-cli.txt b/src/cli/report-cli.txt
index 114cc3a..9745ceb 100644
--- a/src/cli/report-cli.txt
+++ b/src/cli/report-cli.txt
@@ -17,7 +17,7 @@ SYNOPSIS
'report-cli' [-vsp] -a[y] DUMP_DIR
-'report-cli' [-vsp] -r[y] DUMP_DIR
+'report-cli' [-vsp] -r[y|o] DUMP_DIR
'report-cli' [-vsp] -d DUMP_DIR
@@ -59,6 +59,9 @@ OPTIONS
-y, --always::
Noninteractive: don't ask questions, assume positive answer to all of them
+-o, --report-only::
+ Report pre-filled problem data, ask only which reporter should be used.
+
-v, --verbose::
Be verbose
diff --git a/src/cli/report.c b/src/cli/report.c
index 2507f2d..95a704f 100644
--- a/src/cli/report.c
+++ b/src/cli/report.c
@@ -684,34 +684,37 @@ int report(const char *dump_dir_name, int flags)
if (!dd)
return -1;
- char *analyze_events_as_lines = list_possible_events(dd, NULL, "analyze");
- dd_close(dd);
-
- if (analyze_events_as_lines && *analyze_events_as_lines)
+ if (!(flags & CLI_REPORT_ONLY))
{
- GList *list_analyze_events = str_to_glist(analyze_events_as_lines,
'\n');
- free(analyze_events_as_lines);
+ char *analyze_events_as_lines = list_possible_events(dd, NULL,
"analyze");
+ dd_close(dd);
- char *event = select_event_option(list_analyze_events);
- list_free_with_free(list_analyze_events);
+ if (analyze_events_as_lines && *analyze_events_as_lines)
+ {
+ GList *list_analyze_events = str_to_glist(analyze_events_as_lines,
'\n');
+ free(analyze_events_as_lines);
- int analyzer_result = run_analyze_event(dump_dir_name, event);
- free(event);
+ char *event = select_event_option(list_analyze_events);
+ list_free_with_free(list_analyze_events);
- if (analyzer_result != 0)
- return 1;
- }
+ int analyzer_result = run_analyze_event(dump_dir_name, event);
+ free(event);
- /* Load problem_data from (possibly updated by analyze) dump dir */
- dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
- if (!dd)
- return -1;
+ if (analyzer_result != 0)
+ return 1;
+ }
+
+ /* Load problem_data from (possibly updated by analyze) dump dir */
+ dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
+ if (!dd)
+ return -1;
+ }
char *report_events_as_lines = list_possible_events(dd, NULL, "report");
problem_data_t *problem_data = create_problem_data_from_dump_dir(dd);
dd_close(dd);
- if (!(flags & CLI_REPORT_BATCH))
+ if (!(flags & (CLI_REPORT_BATCH | CLI_REPORT_ONLY)))
{
/* Open text editor and give a chance to review the backtrace etc */
create_fields_for_editor(problem_data);
diff --git a/src/cli/report.h b/src/cli/report.h
index a393784..5b1fdcb 100644
--- a/src/cli/report.h
+++ b/src/cli/report.h
@@ -29,6 +29,7 @@ GList *str_to_glist(char *str, int delim);
/* Report the crash */
enum {
CLI_REPORT_BATCH = 1 << 0,
+ CLI_REPORT_ONLY = 1 << 1,
};
int report(const char *dump_dir_name, int flags);
--
1.7.5.4