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

📄 skipequiv.c

📁 这是一个同样来自贝尔实验室的和UNIX有着渊源的操作系统, 其简洁的设计和实现易于我们学习和理解
💻 C
字号:
#include "common.h"#include "send.h"#define isspace(c) ((c)==' ' || (c)=='\t' || (c)=='\n')/* *  skip past all systems in equivlist */extern char*skipequiv(char *base){	char *sp;	static Biobuf *fp;	while(*base){		sp = strchr(base, '!');		if(sp==0)			break;		*sp = '\0';		if(lookup(base, "equivlist", &fp, 0, 0)==1){			/* found or us, forget this system */			*sp='!';			base=sp+1;		} else {			/* no files or system is not found, and not us */			*sp='!';			break;		}	}	return base;}static intokfile(char *cp, Biobuf *fp){	char *buf;	int len;	char *bp, *ep;	int c;	len = strlen(cp);	Bseek(fp, 0, 0);		/* one iteration per system name in the file */	while(buf = Brdline(fp, '\n')) {		ep = &buf[Blinelen(fp)];		for(bp=buf; bp < ep;){			while(isspace(*bp) || *bp==',')				bp++;			if(strncmp(bp, cp, len) == 0) {				c = *(bp+len);				if(isspace(c) || c==',')					return 1;			}			while(bp < ep && (!isspace(*bp)) && *bp!=',')				bp++;		}	}	/* didn't find it, prohibit forwarding */	return 0;}/* return 1 if name found in one of the files *	  0 if name not found in one of the files *	  -1 if neither file exists */extern intlookup(char *cp, char *local, Biobuf **lfpp, char *global, Biobuf **gfpp){	static String *file = 0;	if (local) {		if (file == 0)			file = s_new();		abspath(local, UPASLIB, s_restart(file));		if (*lfpp != 0 || (*lfpp = sysopen(s_to_c(file), "r", 0)) != 0) {			if (okfile(cp, *lfpp))				return 1;		} else			local = 0;	}	if (global) {		abspath(global, UPASLIB, s_restart(file));		if (*gfpp != 0 || (*gfpp = sysopen(s_to_c(file), "r", 0)) != 0) {			if (okfile(cp, *gfpp))				return 1;		} else			global = 0;	}	return (local || global)? 0 : -1;}

⌨️ 快捷键说明

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