📄 signal.c
字号:
/* Copyright (C) 1992 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com)This file is part of groff.groff is free software; you can redistribute it and/or modify it underthe terms of the GNU General Public License as published by the FreeSoftware Foundation; either version 2, or (at your option) any laterversion.groff is distributed in the hope that it will be useful, but WITHOUT ANYWARRANTY; without even the implied warranty of MERCHANTABILITY orFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public Licensefor more details.You should have received a copy of the GNU General Public License alongwith groff; see the file COPYING. If not, write to the Free SoftwareFoundation, 675 Mass Ave, Cambridge, MA 02139, USA. *//* Unfortunately vendors seem to have problems writing a <signal.h>that is correct for C++, so we implement all signal handling in C. */#include <sys/types.h>#include <signal.h>#ifdef HAVE_UNISTD_H#include <unistd.h>#endif#ifndef RETSIGTYPE#define RETSIGTYPE void#endifextern void cleanup();static RETSIGTYPE handle_fatal_signal(signum) int signum;{ signal(signum, SIG_DFL); cleanup(); kill(getpid(), signum);}void catch_fatal_signals(){#ifdef SIGHUP signal(SIGHUP, handle_fatal_signal);#endif signal(SIGINT, handle_fatal_signal); signal(SIGTERM, handle_fatal_signal);}#ifndef HAVE_RENAMEvoid ignore_fatal_signals(){#ifdef SIGHUP signal(SIGHUP, SIG_IGN);#endif signal(SIGINT, SIG_IGN); signal(SIGTERM, SIG_IGN);}#endif /* not HAVE_RENAME */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -