summaryrefslogtreecommitdiffstats
path: root/src/CLI
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2009-10-20 17:11:08 +0200
committerKarel Klic <kklic@redhat.com>2009-10-20 17:11:08 +0200
commitc88b42d31d786dddf4dda5a4beb6bc34a405fecc (patch)
treec0a76447ee76386c07bbb810f13210b37ec36673 /src/CLI
parent8f5fdfffdb74a69b5008f11d4d922eba11c842ac (diff)
downloadabrt-c88b42d31d786dddf4dda5a4beb6bc34a405fecc.tar.gz
abrt-c88b42d31d786dddf4dda5a4beb6bc34a405fecc.tar.xz
abrt-c88b42d31d786dddf4dda5a4beb6bc34a405fecc.zip
More comments.
Diffstat (limited to 'src/CLI')
-rw-r--r--src/CLI/report.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/CLI/report.cpp b/src/CLI/report.cpp
index e1a0cd2f..88cb1cef 100644
--- a/src/CLI/report.cpp
+++ b/src/CLI/report.cpp
@@ -122,7 +122,8 @@ static char *remove_comments_and_unescape(char *str)
*dest = '\0';
}
-/* Writes a field of crash report to a file.
+/*
+ * Writes a field of crash report to a file.
* Field must be writable.
*/
static void write_crash_report_field(FILE *fp, const map_crash_report_t &report,
@@ -277,10 +278,12 @@ int launch_editor(const char *path)
/* Reports the crash with corresponding uuid over DBus. */
int report(const char *uuid, bool always)
{
+ // Ask for an initial report.
map_crash_report_t cr = call_CreateReport(uuid);
if (always)
{
+ // Send the report immediately.
call_Report(cr);
return 0;
}
@@ -308,9 +311,11 @@ int report(const char *uuid, bool always)
error_msg("could not close '%s'", filename);
return 2;
}
-
+
+ // Start a text editor on the temporary file.
launch_editor(filename);
+ // Read the file back and update the report from the file.
fp = fopen(filename, "r");
if (!fp)
{
@@ -332,12 +337,13 @@ int report(const char *uuid, bool always)
fclose(fp);
remove_comments_and_unescape(text);
- read_crash_report(cr, text);
+ read_crash_report(cr, text); // Updates the crash report from the file text.
free(text);
- if (unlink(filename) != 0)
+ if (unlink(filename) != 0) // Delete the tempfile.
error_msg("could not unlink %s: %s", filename, strerror(errno));
+ // Report only if the user is sure.
printf(_("\nThe report has been updated.\nDo you want to send the report? [y/N]: "));
fflush(NULL);
char answer[16] = "n";