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

📄 ndbparse.c

📁 这是一个同样来自贝尔实验室的和UNIX有着渊源的操作系统, 其简洁的设计和实现易于我们学习和理解
💻 C
字号:
#include <u.h>#include <libc.h>#include <bio.h>#include <ctype.h>#include <ndb.h>#include "ndbhf.h"/* *  Parse a data base entry.  Entries may span multiple *  lines.  An entry starts on a left margin.  All subsequent *  lines must be indented by white space.  An entry consists *  of tuples of the forms: *	attribute-name *	attribute-name=value *	attribute-name="value with white space" * *  The parsing returns a 2-dimensional structure.  The first *  dimension joins all tuples. All tuples on the same line *  form a ring along the second dimension. *//* *  parse the next entry in the file */Ndbtuple*ndbparse(Ndb *db){	char *line;	Ndbtuple *t;	Ndbtuple *first, *last;	int len;	first = last = 0;	for(;;){		if((line = Brdline(&db->b, '\n')) == 0)			break;		len = Blinelen(&db->b);		if(line[len-1] != '\n')			break;		if(first && !ISWHITE(*line) && *line != '#'){			Bseek(&db->b, -len, 1);			break;		}		t = _ndbparseline(line);		if(t == 0)			continue;		setmalloctag(t, getcallerpc(&db));		if(first)			last->entry = t;		else			first = t;		last = t;		while(last->entry)			last = last->entry;	}	ndbsetmalloctag(first, getcallerpc(&db));	return first;}

⌨️ 快捷键说明

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