forked from vitrine/wmaker
56 lines
1.3 KiB
C
56 lines
1.3 KiB
C
/*
|
|
* Window Maker miscelaneous function library
|
|
*
|
|
* Copyright (c) 1997-2003 Alfredo K. Kojima
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
|
* MA 02110-1301, USA.
|
|
*/
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include "WUtil.h"
|
|
|
|
#include <assert.h>
|
|
#include <signal.h>
|
|
#include <stdlib.h>
|
|
#include <stdnoreturn.h>
|
|
#include <unistd.h>
|
|
|
|
static void defaultHandler(int bla)
|
|
{
|
|
if (bla)
|
|
kill(getpid(), SIGABRT);
|
|
else
|
|
exit(1);
|
|
}
|
|
|
|
static waborthandler *aborthandler = defaultHandler;
|
|
|
|
static inline noreturn void wAbort(int bla)
|
|
{
|
|
(*aborthandler)(bla);
|
|
exit(-1);
|
|
}
|
|
|
|
waborthandler *wsetabort(waborthandler * handler)
|
|
{
|
|
waborthandler *old = aborthandler;
|
|
|
|
aborthandler = handler;
|
|
|
|
return old;
|
|
}
|