⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trap.c

📁 这是一个同样来自贝尔实验室的和UNIX有着渊源的操作系统, 其简洁的设计和实现易于我们学习和理解
💻 C
字号:
#include "rc.h"#include "exec.h"#include "fns.h"#include "io.h"char *Signame[];voiddotrap(void){	int i;	struct var *trapreq;	struct word *starval;	starval = vlook("*")->val;	while(ntrap) for(i = 0;i!=NSIG;i++) while(trap[i]){		--trap[i];		--ntrap;		if(getpid()!=mypid) Exit(getstatus());		trapreq = vlook(Signame[i]);		if(trapreq->fn){			start(trapreq->fn, trapreq->pc, (struct var *)0);			runq->local = newvar(strdup("*"), runq->local);			runq->local->val = copywords(starval, (struct word *)0);			runq->local->changed = 1;			runq->redir = runq->startredir = 0;		}		else if(i==SIGINT || i==SIGQUIT){			/*			 * run the stack down until we uncover the			 * command reading loop.  Xreturn will exit			 * if there is none (i.e. if this is not			 * an interactive rc.)			 */			while(!runq->iflag) Xreturn();		}		else Exit(getstatus());	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -