Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在用 C 制作一个基本的 shell,我想抓住 Ctrl+C 这样它就不会杀死我的程序,而是会杀死在我的程序下运行的所有进程。我不知道在我的信号处理程序中设置什么代码来获得这种效果。
此外,一旦我有代码来捕获 SIGINT 并让它不杀死我的进程,我是将它全局放在我的程序中,还是将它放在它自己的函数中,我在某个时候在 main 中运行,或者我会放例如,它在哪里创建和执行流程int execCmd(char **cmds){...}?
int execCmd(char **cmds){...}
非常感谢您的任何帮助和建议。