plan 9 kernel history: overview | file list | diff list

1993/0725/port/devcons.c (diff list | history)

1993/0601/sys/src/9/port/devcons.c:446,4571993/0725/sys/src/9/port/devcons.c:446,457 (short | long | prev | next)
1990/0227    
long 
1991/0411    
consread(Chan *c, void *buf, long n, ulong offset) 
1990/0227    
{ 
1992/0814    
	int ch, i, k, id; 
1990/0227    
	ulong l; 
	char *cbuf = buf; 
1993/0330    
	char *b, *bp; 
1992/0814    
	char tmp[128];	/* must be >= 6*NUMSIZE */ 
1991/0425    
	Mach *mp; 
1993/0725    
	char *b, *bp; 
	char tmp[128];		/* must be >= 6*NUMSIZE */ 
	char *cbuf = buf; 
	int ch, i, k, id, eol; 
1990/0227    
 
	if(n <= 0) 
		return n; 
1993/0601/sys/src/9/port/devcons.c:474,4791993/0725/sys/src/9/port/devcons.c:474,480
1993/0601    
				splx(i); 
				continue; 
			} 
1993/0725    
			eol = 0; 
1993/0601    
			switch(ch){ 
			case '\b': 
				if(kbd.x) 
1993/0601/sys/src/9/port/devcons.c:482,4991993/0725/sys/src/9/port/devcons.c:483,505
1993/0601    
			case 0x15: 
				kbd.x = 0; 
				break; 
1993/0725    
			case '\n': 
			case 0x04: 
				eol = 1; 
1993/0601    
			default: 
				kbd.line[kbd.x++] = ch; 
				break; 
			} 
			if(kbd.x == sizeof(kbd.line) || ch == '\n' || ch == 0x04){ 
1993/0725    
			if(kbd.x == sizeof(kbd.line) || eol){ 
1993/0601    
				if(ch == 0x04) 
					kbd.x--; 
				qwrite(lineq, kbd.line, kbd.x, 1); 
1993/0725    
				kbd.x = 0; 
1993/0601    
			} 
1990/0227    
		} 
1993/0601    
		n = qread(lineq, buf, n); 
		qunlock(&kbd); 
1993/0725    
		poperror(); 
1993/0601    
		return n; 
1990/0227    
 
	case Qcputime: 
1993/0601/sys/src/9/port/devcons.c:697,7021993/0725/sys/src/9/port/devcons.c:703,709
1993/0601    
				qunlock(&kbd); 
1991/1224    
			} else if(strncmp(a, "rawoff", 6) == 0){ 
1993/0601    
				kbd.raw = 0; 
1993/0725    
				kbd.x = 0; 
1991/1224    
			} 
			if(a = strchr(a, ' ')) 
				a++; 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)