- ack

On 06/28/2012 04:45 PM, Jakub Filak wrote:
- report-only command line option removed
- report()'s REPORT_ONLY flag removed
- report() assumes that report-only is never set
- report-cli must be rewritten to meet the new style of reporting

Signed-off-by: Jakub Filak <[email protected]>
---
  src/cli/cli-report.c |   51 ++++++++++++++++++++++++--------------------------
  src/cli/cli-report.h |    1 -
  src/cli/cli.c        |   12 ++++--------
  3 files changed, 28 insertions(+), 36 deletions(-)

diff --git a/src/cli/cli-report.c b/src/cli/cli-report.c
index 5df8c6d..eff507a 100644
--- a/src/cli/cli-report.c
+++ b/src/cli/cli-report.c
@@ -770,44 +770,41 @@ int report(const char *dump_dir_name, int flags)
          xfunc_die();
      }

-    if (!(flags & CLI_REPORT_ONLY))
-    {
-        char *analyze_events_as_lines = list_possible_events(dd, NULL, 
"analyze");
-        dd_close(dd);
+    char *analyze_events_as_lines = list_possible_events(dd, NULL, "analyze");
+    dd_close(dd);

-        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);
+    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);

-            char *event = select_event_option(list_analyze_events);
-            list_free_with_free(list_analyze_events);
+        char *event = select_event_option(list_analyze_events);
+        list_free_with_free(list_analyze_events);

-            int analyzer_result = run_analyze_event(dump_dir_name, event);
-            free(event);
+        int analyzer_result = run_analyze_event(dump_dir_name, event);
+        free(event);

-            if (analyzer_result != 0)
-                return 1;
-        }
+        if (analyzer_result != 0)
+            return 1;
+    }

-        /* Run collect events if there are any */
-        int collect_res = collect(dump_dir_name, flags & CLI_REPORT_BATCH);
-        if (collect_res == -1)
-            return -1;
-        else if (collect_res > 0)
-            printf(_("There were %d errors while collecting additional 
data\n"), collect_res);
+    /* Run collect events if there are any */
+    int collect_res = collect(dump_dir_name, flags & CLI_REPORT_BATCH);
+    if (collect_res == -1)
+        return -1;
+    else if (collect_res > 0)
+        printf(_("There were %d errors while collecting additional data\n"), 
collect_res);

-        /* Load dd from (possibly updated by collect) dump dir */
-        dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
-        if (!dd)
-            return -1;
-    }
+    /* Load dd from (possibly updated by collect) 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 | CLI_REPORT_ONLY)))
+    if (!(flags & (CLI_REPORT_BATCH)))
      {
          /* Open text editor and give a chance to review the backtrace etc */
          create_fields_for_editor(problem_data);
diff --git a/src/cli/cli-report.h b/src/cli/cli-report.h
index 77af8d8..b34293d 100644
--- a/src/cli/cli-report.h
+++ b/src/cli/cli-report.h
@@ -29,7 +29,6 @@ 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);
  int collect(const char *dump_dir_name, int batch);
diff --git a/src/cli/cli.c b/src/cli/cli.c
index 244dce0..83f86f6 100644
--- a/src/cli/cli.c
+++ b/src/cli/cli.c
@@ -70,10 +70,9 @@ int main(int argc, char** argv)
          OPTMASK_op       = 
OPT_list_events|OPT_run_event|OPT_analyze|OPT_collect|OPT_report|OPT_version,
          OPTMASK_need_arg = OPT_run_event|OPT_analyze|OPT_collect|OPT_report,
          OPT_y            = 1 << 7,
-        OPT_o            = 1 << 8,
-        OPT_v            = 1 << 9,
-        OPT_s            = 1 << 10,
-        OPT_p            = 1 << 11,
+        OPT_v            = 1 << 8,
+        OPT_s            = 1 << 9,
+        OPT_p            = 1 << 10,
      };
      /* Keep enum above and order of options below in sync! */
      struct options program_options[] = {
@@ -86,7 +85,6 @@ int main(int argc, char** argv)
          OPT_BOOL(     'V', "version", NULL,                    _("Display version 
and exit")),
          OPT_BOOL(     'd', "delete" , NULL,                    _("Remove DUMP_DIR 
after reporting")),
          OPT_BOOL(     'y', "always" , NULL,                    _("Noninteractive: 
don't ask questions, assume 'yes'")),
-        OPT_BOOL(     'o', "report-only" , NULL,               _("With -r: do not 
run analyzers, run only reporters")),
          OPT__VERBOSE(&g_verbose),
          OPT_BOOL(     's', NULL     , NULL,                    _("Log to 
syslog")),
          OPT_BOOL(     'p', NULL     , NULL,                    _("Add program 
names to log")),
@@ -125,7 +123,6 @@ int main(int argc, char** argv)

      char *dump_dir_name = argv[0];
      bool always = (opts & OPT_y);
-    bool report_only = (opts & OPT_o);

      if (!D_list)
      {
@@ -213,8 +210,7 @@ int main(int argc, char** argv)
              }

              exitcode = report(dump_dir_name,
-                    (always ? CLI_REPORT_BATCH : 0) |
-                    (report_only ? CLI_REPORT_ONLY : 0));
+                    (always ? CLI_REPORT_BATCH : 0));
              if (exitcode == -1)
                  error_msg_and_die("Crash '%s' not found", dump_dir_name);




Reply via email to