Use g_strsignal for signal description
This commit is contained in:
parent
3e4c09904d
commit
f3f47fd623
10
moo.kdevelop
10
moo.kdevelop
@ -48,7 +48,7 @@
|
|||||||
</run>
|
</run>
|
||||||
<configurations>
|
<configurations>
|
||||||
<debug>
|
<debug>
|
||||||
<configargs>--enable-debug --enable-all-gcc-warnings</configargs>
|
<configargs>--enable-debug --enable-all-gcc-warnings </configargs>
|
||||||
<builddir>build/debug</builddir>
|
<builddir>build/debug</builddir>
|
||||||
<ccompiler>kdevgccoptions</ccompiler>
|
<ccompiler>kdevgccoptions</ccompiler>
|
||||||
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||||
@ -291,16 +291,16 @@
|
|||||||
</kdevdoctreeview>
|
</kdevdoctreeview>
|
||||||
<kdevfilecreate>
|
<kdevfilecreate>
|
||||||
<filetypes>
|
<filetypes>
|
||||||
<type icon="source" ext="g" name="GAP source" create="template" >
|
<type icon="source" ext="g" create="template" name="GAP source" >
|
||||||
<descr>A new empty GAP source file</descr>
|
<descr>A new empty GAP source file</descr>
|
||||||
</type>
|
</type>
|
||||||
<type icon="source_cpp" ext="cpp" name="C++ Source" create="template" >
|
<type icon="source_cpp" ext="cpp" create="template" name="C++ Source" >
|
||||||
<descr>A new empty C++ file.</descr>
|
<descr>A new empty C++ file.</descr>
|
||||||
</type>
|
</type>
|
||||||
<type icon="source_h" ext="h" name="C/C++ Header" create="template" >
|
<type icon="source_h" ext="h" create="template" name="C/C++ Header" >
|
||||||
<descr>A new empty header file for C/C++.</descr>
|
<descr>A new empty header file for C/C++.</descr>
|
||||||
</type>
|
</type>
|
||||||
<type icon="source_c" ext="c" name="C Source" create="template" >
|
<type icon="source_c" ext="c" create="template" name="C Source" >
|
||||||
<descr>A new empty C file.</descr>
|
<descr>A new empty C file.</descr>
|
||||||
</type>
|
</type>
|
||||||
</filetypes>
|
</filetypes>
|
||||||
|
@ -328,6 +328,12 @@ moo_cmd_view_running (MooCmdView *view)
|
|||||||
|
|
||||||
|
|
||||||
#ifndef __WIN32__
|
#ifndef __WIN32__
|
||||||
|
char *
|
||||||
|
get_signal_message (int sig)
|
||||||
|
{
|
||||||
|
return g_strdup_printf ("Aborted (%s)", g_strsignal (sig));
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
moo_cmd_view_cmd_exit (MooCmdView *view,
|
moo_cmd_view_cmd_exit (MooCmdView *view,
|
||||||
int status)
|
int status)
|
||||||
@ -347,27 +353,7 @@ moo_cmd_view_cmd_exit (MooCmdView *view,
|
|||||||
char *msg;
|
char *msg;
|
||||||
|
|
||||||
if (exit_code > 128)
|
if (exit_code > 128)
|
||||||
{
|
msg = get_signal_message (exit_code - 128);
|
||||||
static const char *signals[] = {
|
|
||||||
NULL, "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
|
|
||||||
"SIGTRAP", "SIGABRT", "SIGBUS", "SIGFPE",
|
|
||||||
"SIGKILL", "SIGUSR", "SIGSEGV", "SIGUSR",
|
|
||||||
"SIGPIPE", "SIGALRM", "SIGTERM", "SIGSTKFLT",
|
|
||||||
"SIGCHLD", "SIGCONT", "SIGSTOP", "SIGTSTP",
|
|
||||||
"SIGTTIN", "SIGTTOU", "SIGURG", "SIGXCPU",
|
|
||||||
"SIGXFSZ", "SIGVTALRM", "SIGPROF", "SIGWINCH",
|
|
||||||
"SIGIO", "SIGPWR", "SIGSYS"
|
|
||||||
};
|
|
||||||
|
|
||||||
int sig = exit_code - 128;
|
|
||||||
|
|
||||||
if (sig > 0 && sig < (int) G_N_ELEMENTS (signals))
|
|
||||||
msg = g_strdup_printf ("*** Killed by signal %d (%s) ***",
|
|
||||||
exit_code - 128, signals[sig]);
|
|
||||||
else
|
|
||||||
msg = g_strdup_printf ("*** Killed by signal %d ***",
|
|
||||||
exit_code - 128);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
msg = g_strdup_printf ("*** Exited with status %d ***",
|
msg = g_strdup_printf ("*** Exited with status %d ***",
|
||||||
exit_code);
|
exit_code);
|
||||||
@ -388,9 +374,10 @@ moo_cmd_view_cmd_exit (MooCmdView *view,
|
|||||||
#endif
|
#endif
|
||||||
else if (WIFSIGNALED (status))
|
else if (WIFSIGNALED (status))
|
||||||
{
|
{
|
||||||
moo_line_view_write_line (MOO_LINE_VIEW (view),
|
char *msg = get_signal_message (WTERMSIG (status));
|
||||||
"*** Killed ***", -1,
|
moo_line_view_write_line (MOO_LINE_VIEW (view), msg, -1,
|
||||||
view->priv->error_tag);
|
view->priv->error_tag);
|
||||||
|
g_free (msg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user