コード例 #1
0
ファイル: deroff.c プロジェクト: n-t-roff/Plan9_troff
void
inpic(void)
{
	int c1;
	Rune *p1;

/*	SKIP1;*/
	while(C1 != '\n')
		if(c == '<'){
			SKIP1;
			return;
		}
	p1 = line;
	c = '\n';
	for(;;) {
		c1 = c;
		if(C1 == '.' && c1 == '\n') {
			if(C1 != 'P' || C1 != 'E') {
				if(c != '\n'){
					SKIP1;
					c = '\n';
				}
				continue;
			}
			SKIP1;
			return;
		} else
		if(c == '\"') {
			while(C1 != '\"') {
				if(c == '\\') {
					if(C1 == '\"')
						continue;
					Bungetrune(&(infile->Biobufhdr));
					backsl();
				} else
					*p1++ = c;
			}
			*p1++ = ' ';
		} else
		if(c == '\n' && p1 != line) {
			*p1 = '\0';
			if(wordflag)
				putwords();
			else
				Bprint(&(bout.Biobufhdr), "%S\n\n", line);
			p1 = line;
		}
	}
}
コード例 #2
0
ファイル: deroff.c プロジェクト: n-t-roff/Plan9_troff
void
regline(int macline, int vconst)
{
	line[0] = c;
	lp = line;
	for(;;) {
		if(c == '\\') {
			*lp = ' ';
			backsl();
			if(c == '%')	/* no blank for hyphenation char */
				lp--;
		}
		if(c == '\n')
			break;
		if(intable && c=='T') {
			*++lp = C;
			if(c=='{' || c=='}') {
				lp[-1] = ' ';
				*lp = C;
			}
		} else {
			if(msflag == 1 && eqnflag == 1) {
				eqnflag = 0;
				*++lp = 'x';
			}
			*++lp = C;
		}
	}
	*lp = '\0';
	if(lp != line) {
		if(wordflag)
			putwords();
		else
		if(macline)
			putmac(line,vconst);
		else
			Bprint(&(bout.Biobufhdr), "%S\n", line);
	}
}
コード例 #3
0
ファイル: ctest.c プロジェクト: forwhat/OS
void test_main()
{
	int s, pid;
	s = SemaGet(1);
	if (s == -1) {
		print("Error in getting semaphore!");
		getline();
		exit(-1);
	}
	pid = fork();
	if (pid == -1) {
		print("Error in fork!");
		getline();
		exit(-1);
	}
	else if (pid == 0) {
		while (1) {
			P(s);
			putwords("one word after another word");
			V(s);
		}
		exit(0);
	}
	else {
		while (1) {
			P(s);
			int i;
			for (i = 0; i < size; ++i) {
				print(words[i]);
				print(" ");
			}
			print("\n");
			V(s);
		}
		exit(0);
	}
}