aboutsummaryrefslogtreecommitdiff
path: root/hardinfo2/util.c
diff options
context:
space:
mode:
authorLeandro A. F. Pereira <leandro@hardinfo.org>2008-07-04 19:57:57 -0300
committerLeandro A. F. Pereira <leandro@hardinfo.org>2008-07-04 19:57:57 -0300
commit7ebff5f725c632fe3f8ff364e961e34471f58656 (patch)
treee34e1b8a025f01c1c99eb953025a06f8925fffcf /hardinfo2/util.c
parente102d515fb20d154aade1f680d793ebaeea1786f (diff)
Add crash handler (based on old Sylpheed Claws code)
Diffstat (limited to 'hardinfo2/util.c')
-rw-r--r--hardinfo2/util.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/hardinfo2/util.c b/hardinfo2/util.c
index d742233a..7d27b966 100644
--- a/hardinfo2/util.c
+++ b/hardinfo2/util.c
@@ -41,6 +41,8 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include <crash.h>
+
#define KiB 1024
#define MiB 1048576
#define GiB 1073741824
@@ -324,8 +326,19 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param)
static gboolean autoload_deps = FALSE;
static gchar *report_format = NULL;
static gchar **use_modules = NULL;
+#ifdef CRASH_DIALOG
+ static gchar *crash_args = NULL;
+#endif
static GOptionEntry options[] = {
+#ifdef CRASH_DIALOG
+ {
+ .long_name = "crash",
+ .short_name = 'c',
+ .arg = G_OPTION_ARG_STRING,
+ .arg_data = &crash_args,
+ .description = "invokes HardInfo crash handler; do not use directly"},
+#endif
{
.long_name = "generate-report",
.short_name = 'r',
@@ -387,6 +400,18 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param)
param->list_modules = list_modules;
param->use_modules = use_modules;
param->autoload_deps = autoload_deps;
+ param->argv0 = *(argv)[0];
+
+#ifdef CRASH_DIALOG
+ if (crash_args) {
+ DEBUG("invoking crash handler: %s", crash_args);
+
+ gtk_init(argc, argv);
+ crash_main(crash_args);
+
+ exit(0);
+ }
+#endif
if (report_format && g_str_equal(report_format, "html"))
param->report_format = REPORT_FORMAT_HTML;