main.c, first setsig then the business
This commit is contained in:
parent
b16a1ccf92
commit
44362f6760
56
src/main.c
56
src/main.c
|
|
@ -1054,6 +1054,35 @@ main(int argc, char **argv)
|
||||||
fcn is in cpitf.c*/
|
fcn is in cpitf.c*/
|
||||||
ft_cpinit();
|
ft_cpinit();
|
||||||
|
|
||||||
|
|
||||||
|
/* Set up signal handling */
|
||||||
|
if (!ft_batchmode) {
|
||||||
|
/* Set up interrupt handler */
|
||||||
|
(void) signal(SIGINT, (SIGNAL_FUNCTION) ft_sigintr);
|
||||||
|
|
||||||
|
/* floating point exception */
|
||||||
|
(void) signal(SIGFPE, (SIGNAL_FUNCTION) sigfloat);
|
||||||
|
|
||||||
|
#ifdef SIGTSTP
|
||||||
|
signal(SIGTSTP, (SIGNAL_FUNCTION) sigstop);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set up signal handling for fatal errors. */
|
||||||
|
signal(SIGILL, (SIGNAL_FUNCTION) sigill);
|
||||||
|
|
||||||
|
#ifdef SIGBUS
|
||||||
|
signal(SIGBUS, (SIGNAL_FUNCTION) sigbus);
|
||||||
|
#endif
|
||||||
|
#if defined(SIGSEGV) && !defined(NGDEBUG) && defined(HAS_WINDOWS)
|
||||||
|
/* Allow a comment and graceful shutdown after seg fault */
|
||||||
|
signal(SIGSEGV, (SIGNAL_FUNCTION) sigsegv);
|
||||||
|
#endif
|
||||||
|
#ifdef SIGSYS
|
||||||
|
signal(SIGSYS, (SIGNAL_FUNCTION) sig_sys);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* To catch interrupts during .spiceinit... */
|
/* To catch interrupts during .spiceinit... */
|
||||||
if (SETJMP(jbuf, 1)) {
|
if (SETJMP(jbuf, 1)) {
|
||||||
|
|
||||||
|
|
@ -1061,33 +1090,6 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* Set up signal handling */
|
|
||||||
if (!ft_batchmode) {
|
|
||||||
/* Set up interrupt handler */
|
|
||||||
(void) signal(SIGINT, (SIGNAL_FUNCTION) ft_sigintr);
|
|
||||||
|
|
||||||
/* floating point exception */
|
|
||||||
(void) signal(SIGFPE, (SIGNAL_FUNCTION) sigfloat);
|
|
||||||
|
|
||||||
#ifdef SIGTSTP
|
|
||||||
signal(SIGTSTP, (SIGNAL_FUNCTION) sigstop);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set up signal handling for fatal errors. */
|
|
||||||
signal(SIGILL, (SIGNAL_FUNCTION) sigill);
|
|
||||||
|
|
||||||
#ifdef SIGBUS
|
|
||||||
signal(SIGBUS, (SIGNAL_FUNCTION) sigbus);
|
|
||||||
#endif
|
|
||||||
#if defined(SIGSEGV) && !defined(NGDEBUG) && defined(HAS_WINDOWS)
|
|
||||||
/* Allow a comment and graceful shutdown after seg fault */
|
|
||||||
signal(SIGSEGV, (SIGNAL_FUNCTION) sigsegv);
|
|
||||||
#endif
|
|
||||||
#ifdef SIGSYS
|
|
||||||
signal(SIGSYS, (SIGNAL_FUNCTION) sig_sys);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (readinit) {
|
if (readinit) {
|
||||||
/* load user's initialisation file
|
/* load user's initialisation file
|
||||||
try accessing the initialisation file in the current directory
|
try accessing the initialisation file in the current directory
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue