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

1990/1202/power/bboot.c (diff list | history)

1990/1127/sys/src/9/power/bboot.c:7,181990/1202/sys/src/9/power/bboot.c:7,17 (short | long | prev | next)
1990/1127    
#define DEFSYS "bit!bootes" 
1990/0427    
 
Fcall	hdr; 
char	*sys; 
char	*scmd; 
char	*bootfile; 
1990/1202    
char	bootfile[5*NAMELEN]; 
char	conffile[5*NAMELEN]; 
char	sys[NAMELEN]; 
1990/0427    
 
char	sbuf[2*NAMELEN]; 
char	bbuf[5*NAMELEN]; 
1990/0424    
char	buf[4*1024]; 
 
1990/0427    
int fd; 
1990/1127/sys/src/9/power/bboot.c:66,721990/1202/sys/src/9/power/bboot.c:65,71
1990/0427    
int	readseg(int, int, long, long, int); 
int	readkernel(int); 
1990/0504    
int	readconf(int); 
1990/0427    
int	outin(char *, char *, char *, int); 
1990/1202    
int	outin(char *, char *, int); 
1990/0427    
void	prerror(char *); 
void	error(char *); 
1990/0504    
void	boot(int, char *); 
1990/1127/sys/src/9/power/bboot.c:97,1111990/1202/sys/src/9/power/bboot.c:96,110
1990/0427    
			break; 
	} 
1990/0424    
 
1990/0427    
	sys = DEFSYS; 
	bootfile = DEFFILE; 
1990/1202    
	strcpy(sys, DEFSYS); 
	strcpy(bootfile, DEFFILE); 
1990/0427    
	switch(argc){ 
	case 1: 
		bootfile = argv[0]; 
1990/1202    
		strcpy(bootfile, argv[0]); 
1990/0427    
		break; 
	case 2: 
		bootfile = argv[0]; 
		sys = argv[1]; 
1990/1202    
		strcpy(bootfile, argv[0]); 
		strcpy(sys, argv[1]); 
1990/0427    
		break; 
	} 
1990/0424    
 
1990/1127/sys/src/9/power/bboot.c:255,2681990/1202/sys/src/9/power/bboot.c:254,264
1990/1127    
boot(int ask, char *addr) 
{ 
	int n, tries; 
	char conffile[128]; 
	char *srvname; 
 
	if(ask){ 
		outin("bootfile", bootfile, bbuf, sizeof(bbuf)); 
		bootfile = bbuf; 
		outin("server", sys, sbuf, sizeof(sbuf)); 
		sys = sbuf; 
1990/1202    
		outin("bootfile", bootfile, sizeof(bootfile)); 
		outin("server", sys, sizeof(sys)); 
1990/1127    
	} 
 
	for(tries = 0; tries < 5; tries++){ 
1990/1127/sys/src/9/power/bboot.c:271,2781990/1202/sys/src/9/power/bboot.c:267,274
1990/1127    
			fd = bitdial(srvname = &sys[4]); 
		else if(strncmp(sys, "dk!", 3) == 0) 
			fd = dkdial(srvname = &sys[3]); 
		else if(strncmp(sys, "nonet!", 5) == 0) 
			fd = nonetdial(srvname = &sys[5]); 
1990/1202    
		else if(strncmp(sys, "nonet!", 6) == 0) 
			fd = nonetdial(srvname = &sys[6]); 
1990/1127    
		else 
			fd = nonetdial(srvname = sys); 
		if(fd >= 0) 
1990/1127/sys/src/9/power/bboot.c:361,3671990/1202/sys/src/9/power/bboot.c:357,363
1990/0504    
	sprint(conffile, "/mips/conf/%s", addr); 
	print("%s...", conffile); 
	while((fd = open(conffile, OREAD)) < 0){ 
		outin("conffile", conffile, conffile, sizeof(conffile)); 
1990/1202    
		outin("conffile", conffile, sizeof(conffile)); 
1990/0504    
	} 
	if(readconf(fd) < 0) 
		prerror("readconf"); 
1990/1127/sys/src/9/power/bboot.c:369,3761990/1202/sys/src/9/power/bboot.c:365,371
1990/0504    
 
	print("%s...", bootfile); 
1990/0427    
	while((fd = open(bootfile, OREAD)) < 0){ 
1990/0504    
		outin("bootfile", bootfile, bbuf, sizeof(bbuf)); 
1990/0427    
		bootfile = bbuf; 
1990/1202    
		outin("bootfile", bootfile, sizeof(bootfile)); 
1990/0427    
	} 
1990/0424    
	readkernel(fd); 
1990/0427    
	prerror("couldn't read kernel"); 
1990/1127/sys/src/9/power/bboot.c:551,5571990/1202/sys/src/9/power/bboot.c:546,552
1990/0427    
 *  prompt and get input 
 */ 
int 
outin(char *prompt, char *def, char *buf, int len) 
1990/1202    
outin(char *prompt, char *def, int len) 
1990/0427    
{ 
	int n; 
 
1990/1127/sys/src/9/power/bboot.c:561,5691990/1202/sys/src/9/power/bboot.c:556,564
1990/0427    
	}while(n==0); 
	if(n < 0) 
		error("can't read #c/cons; please reboot"); 
	if(n == 1) 
		strcpy(buf, def); 
	else 
1990/1202    
	if(n != 1){ 
1990/0427    
		buf[n-1] = 0; 
1990/1202    
		strcpy(def, buf); 
	} 
1990/0427    
	return n; 
1990/0424    
} 


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