Use g_strsignal for signal description

This commit is contained in:
Yevgen Muntyan 2006-08-02 22:21:57 -05:00
parent 3e4c09904d
commit f3f47fd623
2 changed files with 15 additions and 28 deletions

View File

@ -291,16 +291,16 @@
</kdevdoctreeview>
<kdevfilecreate>
<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>
</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>
</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>
</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>
</type>
</filetypes>

View File

@ -328,6 +328,12 @@ moo_cmd_view_running (MooCmdView *view)
#ifndef __WIN32__
char *
get_signal_message (int sig)
{
return g_strdup_printf ("Aborted (%s)", g_strsignal (sig));
}
static gboolean
moo_cmd_view_cmd_exit (MooCmdView *view,
int status)
@ -347,27 +353,7 @@ moo_cmd_view_cmd_exit (MooCmdView *view,
char *msg;
if (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);
}
msg = get_signal_message (exit_code - 128);
else
msg = g_strdup_printf ("*** Exited with status %d ***",
exit_code);
@ -388,9 +374,10 @@ moo_cmd_view_cmd_exit (MooCmdView *view,
#endif
else if (WIFSIGNALED (status))
{
moo_line_view_write_line (MOO_LINE_VIEW (view),
"*** Killed ***", -1,
char *msg = get_signal_message (WTERMSIG (status));
moo_line_view_write_line (MOO_LINE_VIEW (view), msg, -1,
view->priv->error_tag);
g_free (msg);
}
else
{