diff options
| author | Denys Vlasenko <dvlasenk@redhat.com> | 2011-04-23 17:21:17 +0200 |
|---|---|---|
| committer | Denys Vlasenko <dvlasenk@redhat.com> | 2011-04-23 17:21:17 +0200 |
| commit | 042d62126a0ca8b6b9d2fb4d417f07691be90536 (patch) | |
| tree | 9e43a823767d875bb35f3deb6f60df49bbd26f33 /src/cli | |
| parent | d3da30c4726a193101ee9c17a71c23cf32fa63ca (diff) | |
| download | abrt-042d62126a0ca8b6b9d2fb4d417f07691be90536.tar.gz abrt-042d62126a0ca8b6b9d2fb4d417f07691be90536.tar.xz abrt-042d62126a0ca8b6b9d2fb4d417f07691be90536.zip | |
mass replace of crash_data with problem_data
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/cli')
| -rw-r--r-- | src/cli/abrt-cli.1 | 4 | ||||
| -rw-r--r-- | src/cli/cli.c | 58 | ||||
| -rw-r--r-- | src/cli/report.c | 56 |
3 files changed, 59 insertions, 59 deletions
diff --git a/src/cli/abrt-cli.1 b/src/cli/abrt-cli.1 index 1622fb14..9e0a630e 100644 --- a/src/cli/abrt-cli.1 +++ b/src/cli/abrt-cli.1 @@ -8,8 +8,8 @@ abrt\-cli \- a command line interface to abrt .I abrt\-cli is a command line tool that manages application crashes catched by .I abrtd -daemon. It enables access to crash data, and allows to report -crashes depending on active abrt plugins. +daemon. It enables access to problem data, and allows to report +problems depending on active abrt plugins. .SH OPTIONS .B Basic startup options .IP "\-V, \-\-version" diff --git a/src/cli/cli.c b/src/cli/cli.c index 50baed7b..85c6f5f6 100644 --- a/src/cli/cli.c +++ b/src/cli/cli.c @@ -23,7 +23,7 @@ #include "abrt_dbus.h" #include "report.h" -static crash_data_t *FillCrashInfo(const char *dump_dir_name) +static problem_data_t *FillCrashInfo(const char *dump_dir_name) { int sv_logmode = logmode; logmode = 0; /* suppress EPERM/EACCES errors in opendir */ @@ -33,14 +33,14 @@ static crash_data_t *FillCrashInfo(const char *dump_dir_name) if (!dd) return NULL; - crash_data_t *crash_data = create_crash_data_from_dump_dir(dd); + problem_data_t *problem_data = create_problem_data_from_dump_dir(dd); dd_close(dd); - add_to_crash_data_ext(crash_data, CD_DUMPDIR, dump_dir_name, CD_FLAG_TXT + CD_FLAG_ISNOTEDITABLE); + add_to_problem_data_ext(problem_data, CD_DUMPDIR, dump_dir_name, CD_FLAG_TXT + CD_FLAG_ISNOTEDITABLE); - return crash_data; + return problem_data; } -static void GetCrashInfos(vector_of_crash_data_t *retval, const char *dir_name) +static void GetCrashInfos(vector_of_problem_data_t *retval, const char *dir_name) { VERB1 log("Loading dumps from '%s'", dir_name); @@ -59,9 +59,9 @@ static void GetCrashInfos(vector_of_crash_data_t *retval, const char *dir_name) if (stat(dump_dir_name, &statbuf) == 0 && S_ISDIR(statbuf.st_mode) ) { - crash_data_t *crash_data = FillCrashInfo(dump_dir_name); - if (crash_data) - g_ptr_array_add(retval, crash_data); + problem_data_t *problem_data = FillCrashInfo(dump_dir_name); + if (problem_data) + g_ptr_array_add(retval, problem_data); } free(dump_dir_name); } @@ -70,20 +70,20 @@ static void GetCrashInfos(vector_of_crash_data_t *retval, const char *dir_name) } /** Prints basic information about a crash to stdout. */ -static void print_crash(crash_data_t *crash_data) +static void print_crash(problem_data_t *problem_data) { - struct crash_item *item = g_hash_table_lookup(crash_data, CD_DUMPDIR); + struct problem_item *item = g_hash_table_lookup(problem_data, CD_DUMPDIR); if (item) printf("\tDirectory : %s\n", item->content); - GList *list = g_hash_table_get_keys(crash_data); + GList *list = g_hash_table_get_keys(problem_data); GList *l = list = g_list_sort(list, (GCompareFunc)strcmp); while (l) { const char *key = l->data; - item = g_hash_table_lookup(crash_data, key); + item = g_hash_table_lookup(problem_data, key); if (item && (item->flags & CD_FLAG_LIST) && !strchr(item->content, '\n')) { - char *formatted = format_crash_item(item); + char *formatted = format_problem_item(item); printf("\t%-12s: %s\n", key, formatted ? formatted : item->content); free(formatted); } @@ -97,15 +97,15 @@ static void print_crash(crash_data_t *crash_data) * @param include_reported * Do not skip entries marked as already reported. */ -static void print_crash_list(vector_of_crash_data_t *crash_list, bool include_reported) +static void print_crash_list(vector_of_problem_data_t *crash_list, bool include_reported) { unsigned i; for (i = 0; i < crash_list->len; ++i) { - crash_data_t *crash = get_crash_data(crash_list, i); + problem_data_t *crash = get_problem_data(crash_list, i); if (!include_reported) { - const char *msg = get_crash_item_content_or_NULL(crash, FILENAME_REPORTED_TO); + const char *msg = get_problem_item_content_or_NULL(crash, FILENAME_REPORTED_TO); if (msg) continue; } @@ -118,13 +118,13 @@ static void print_crash_list(vector_of_crash_data_t *crash_list, bool include_re /** * Prints full information about a crash */ -static void print_crash_info(crash_data_t *crash_data, bool show_multiline) +static void print_crash_info(problem_data_t *problem_data, bool show_multiline) { - struct crash_item *item = g_hash_table_lookup(crash_data, CD_DUMPDIR); + struct problem_item *item = g_hash_table_lookup(problem_data, CD_DUMPDIR); if (item) printf("%-16s: %s\n", "Directory", item->content); - GList *list = g_hash_table_get_keys(crash_data); + GList *list = g_hash_table_get_keys(problem_data); GList *l = list = g_list_sort(list, (GCompareFunc)strcmp); bool multi_line = 0; while (l) @@ -132,10 +132,10 @@ static void print_crash_info(crash_data_t *crash_data, bool show_multiline) const char *key = l->data; if (strcmp(key, CD_DUMPDIR) != 0) { - item = g_hash_table_lookup(crash_data, key); + item = g_hash_table_lookup(problem_data, key); if (item) { - char *formatted = format_crash_item(item); + char *formatted = format_problem_item(item); char *output = formatted ? formatted : item->content; char *last_eol = strrchr(output, '\n'); if (show_multiline || !last_eol) @@ -327,7 +327,7 @@ int main(int argc, char** argv) { case OPT_GET_LIST: { - vector_of_crash_data_t *ci = new_vector_of_crash_data(); + vector_of_problem_data_t *ci = new_vector_of_problem_data(); while (D_list) { char *dir = (char *)D_list->data; @@ -335,7 +335,7 @@ int main(int argc, char** argv) D_list = g_list_remove(D_list, dir); } print_crash_list(ci, full); - free_vector_of_crash_data(ci); + free_vector_of_problem_data(ci); break; } case OPT_REPORT: @@ -370,7 +370,7 @@ int main(int argc, char** argv) } case OPT_INFO: { - /* Load crash_data from dump dir */ + /* Load problem_data from dump dir */ struct dump_dir *dd = dd_opendir(dump_dir_name, DD_OPEN_READONLY); if (!dd) return -1; @@ -393,21 +393,21 @@ int main(int argc, char** argv) if (analyzer_result != 0) return 1; - /* Reload crash_data from (possibly updated by analyze) dump dir */ + /* Reload problem_data from (possibly updated by analyze) dump dir */ dd = dd_opendir(dump_dir_name, DD_OPEN_READONLY); if (!dd) return -1; } else free(analyze_events_as_lines); - crash_data_t *crash_data = create_crash_data_from_dump_dir(dd); + problem_data_t *problem_data = create_problem_data_from_dump_dir(dd); dd_close(dd); - add_to_crash_data_ext(crash_data, CD_DUMPDIR, dump_dir_name, + add_to_problem_data_ext(problem_data, CD_DUMPDIR, dump_dir_name, CD_FLAG_TXT + CD_FLAG_ISNOTEDITABLE); - print_crash_info(crash_data, full); - free_crash_data(crash_data); + print_crash_info(problem_data, full); + free_problem_data(problem_data); break; } diff --git a/src/cli/report.c b/src/cli/report.c index 2e2bd002..96bf0062 100644 --- a/src/cli/report.c +++ b/src/cli/report.c @@ -113,10 +113,10 @@ static void remove_comments_and_unescape(char *str) * Writes a field of crash report to a file. * Field must be writable. */ -static void write_crash_report_field(FILE *fp, crash_data_t *crash_data, +static void write_crash_report_field(FILE *fp, problem_data_t *problem_data, const char *field, const char *description) { - const struct crash_item *value = get_crash_data_item_or_NULL(crash_data, field); + const struct problem_item *value = get_problem_data_item_or_NULL(problem_data, field); if (!value) { // exit silently, all fields are optional for now @@ -142,7 +142,7 @@ static void write_crash_report_field(FILE *fp, crash_data_t *crash_data, * If the report is successfully stored to the file, a zero value is returned. * On failure, nonzero value is returned. */ -static void write_crash_report(crash_data_t *report, FILE *fp) +static void write_crash_report(problem_data_t *report, FILE *fp) { fprintf(fp, "# Please check this report. Lines starting with '#' will be ignored.\n" "# Lines starting with '%%----' separate fields, please do not delete them.\n\n"); @@ -171,7 +171,7 @@ static void write_crash_report(crash_data_t *report, FILE *fp) * 1 if the field was changed. * Changes to read-only fields are ignored. */ -static int read_crash_report_field(const char *text, crash_data_t *report, +static int read_crash_report_field(const char *text, problem_data_t *report, const char *field) { char separator[sizeof("\n" FIELD_SEP)-1 + strlen(field) + 2]; // 2 = '\n\0' @@ -188,7 +188,7 @@ static int read_crash_report_field(const char *text, crash_data_t *report, else length = end - textfield; - struct crash_item *value = get_crash_data_item_or_NULL(report, field); + struct problem_item *value = get_problem_data_item_or_NULL(report, field); if (!value) { error_msg("Field %s not found", field); @@ -226,7 +226,7 @@ static int read_crash_report_field(const char *text, crash_data_t *report, * 1 if any field was changed. * Changes to read-only fields are ignored. */ -static int read_crash_report(crash_data_t *report, const char *text) +static int read_crash_report(problem_data_t *report, const char *text) { int result = 0; result |= read_crash_report_field(text, report, FILENAME_COMMENT); @@ -245,13 +245,13 @@ static int read_crash_report(crash_data_t *report, const char *text) } /** - * Ensures that the fields needed for editor are present in the crash data. + * Ensures that the fields needed for editor are present in the problem data. * Fields: comments. */ -static void create_fields_for_editor(crash_data_t *crash_data) +static void create_fields_for_editor(problem_data_t *problem_data) { - if (!get_crash_data_item_or_NULL(crash_data, FILENAME_COMMENT)) - add_to_crash_data_ext(crash_data, FILENAME_COMMENT, "", CD_FLAG_TXT + CD_FLAG_ISEDITABLE); + if (!get_problem_data_item_or_NULL(problem_data, FILENAME_COMMENT)) + add_to_problem_data_ext(problem_data, FILENAME_COMMENT, "", CD_FLAG_TXT + CD_FLAG_ISEDITABLE); } /** @@ -291,11 +291,11 @@ static int launch_editor(const char *path) /** * Returns: - * 0 on success, crash data has been updated + * 0 on success, problem data has been updated * 2 on failure, unable to create, open, or close temporary file * 3 on failure, cannot launch text editor */ -static int run_report_editor(crash_data_t *crash_data) +static int run_report_editor(problem_data_t *problem_data) { /* Open a temporary file and write the crash report to it. */ char filename[] = "/tmp/abrt-report.XXXXXX"; @@ -312,7 +312,7 @@ static int run_report_editor(crash_data_t *crash_data) die_out_of_memory(); } - write_crash_report(crash_data, fp); + write_crash_report(problem_data, fp); if (fclose(fp)) /* errno is set */ { @@ -354,7 +354,7 @@ static int run_report_editor(crash_data_t *crash_data) remove_comments_and_unescape(text); // Updates the crash report from the file text. - int report_changed = read_crash_report(crash_data, text); + int report_changed = read_crash_report(problem_data, text); free(text); if (report_changed) puts(_("\nThe report has been updated")); @@ -658,7 +658,7 @@ GList *str_to_glist(char *str, int delim) /* Report the crash */ int report(const char *dump_dir_name, int flags) { - /* Load crash_data from (possibly updated by analyze) dump dir */ + /* Load problem_data from (possibly updated by analyze) dump dir */ struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0); if (!dd) return -1; @@ -681,23 +681,23 @@ int report(const char *dump_dir_name, int flags) return 1; } - /* Load crash_data from (possibly updated by analyze) dump dir */ + /* 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"); - crash_data_t *crash_data = create_crash_data_from_dump_dir(dd); + problem_data_t *problem_data = create_problem_data_from_dump_dir(dd); dd_close(dd); if (!(flags & CLI_REPORT_BATCH)) { /* Open text editor and give a chance to review the backtrace etc */ - create_fields_for_editor(crash_data); - int result = run_report_editor(crash_data); + create_fields_for_editor(problem_data); + int result = run_report_editor(problem_data); if (result != 0) { - free_crash_data(crash_data); + free_problem_data(problem_data); free(report_events_as_lines); return 1; } @@ -705,9 +705,9 @@ int report(const char *dump_dir_name, int flags) dd = dd_opendir(dump_dir_name, /*flags:*/ 0); if (dd) { -//TODO: we should iterate through crash_data and modify all modifiable fields - const char *comment = get_crash_item_content_or_NULL(crash_data, FILENAME_COMMENT); - const char *backtrace = get_crash_item_content_or_NULL(crash_data, FILENAME_BACKTRACE); +//TODO: we should iterate through problem_data and modify all modifiable fields + const char *comment = get_problem_item_content_or_NULL(problem_data, FILENAME_COMMENT); + const char *backtrace = get_problem_item_content_or_NULL(problem_data, FILENAME_BACKTRACE); if (comment) dd_save_text(dd, FILENAME_COMMENT, comment); if (backtrace) @@ -725,7 +725,7 @@ int report(const char *dump_dir_name, int flags) if (!report_events) { - free_crash_data(crash_data); + free_problem_data(problem_data); error_msg_and_die("The dump directory '%s' has no defined reporters", dump_dir_name); } @@ -743,7 +743,7 @@ int report(const char *dump_dir_name, int flags) } else { - const char *rating_str = get_crash_item_content_or_NULL(crash_data, FILENAME_RATING); + const char *rating_str = get_problem_item_content_or_NULL(problem_data, FILENAME_RATING); unsigned rating = rating_str ? xatou(rating_str) : 4; /* For every reporter, ask if user really wants to report using it. */ @@ -777,7 +777,7 @@ int report(const char *dump_dir_name, int flags) { puts(_("Reporting disabled because the backtrace is unusable")); - const char *package = get_crash_item_content_or_NULL(crash_data, FILENAME_PACKAGE); + const char *package = get_problem_item_content_or_NULL(problem_data, FILENAME_PACKAGE); if (package && package[0]) printf(_("Please try to install debuginfo manually using the command: \"debuginfo-install %s\" and try again\n"), package); @@ -801,8 +801,8 @@ int report(const char *dump_dir_name, int flags) } } - printf(_("Crash reported via %d report events (%d errors)\n"), plugins, errors); - free_crash_data(crash_data); + printf(_("Problem reported via %d report events (%d errors)\n"), plugins, errors); + free_problem_data(problem_data); list_free_with_free(report_events); return errors; } |
