Move edit logic to an individual function
It is better to separate this logic from the parameter logic in main().
This commit is contained in:
		
				
					committed by
					
						
						sin
					
				
			
			
				
	
			
			
			
						parent
						
							05af2156b6
						
					
				
				
					commit
					6135cad495
				
			
							
								
								
									
										27
									
								
								ed.c
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								ed.c
									
									
									
									
									
								
							@@ -1343,6 +1343,22 @@ sighup(int dummy)
 | 
			
		||||
	quit();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
edit(void)
 | 
			
		||||
{
 | 
			
		||||
	setjmp(savesp);
 | 
			
		||||
	for (;;) {
 | 
			
		||||
		newcmd = 1;
 | 
			
		||||
		ocurln = curln;
 | 
			
		||||
		cmdsiz = 0;
 | 
			
		||||
		repidx = -1;
 | 
			
		||||
		if (optprompt)
 | 
			
		||||
			fputs(prompt, stdout);
 | 
			
		||||
		getlst();
 | 
			
		||||
		chkglobal() ? doglobal() : docmd();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
main(int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
@@ -1373,16 +1389,7 @@ main(int argc, char *argv[])
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for (;;) {
 | 
			
		||||
		newcmd = 1;
 | 
			
		||||
		ocurln = curln;
 | 
			
		||||
		cmdsiz = 0;
 | 
			
		||||
		repidx = -1;
 | 
			
		||||
		if (optprompt)
 | 
			
		||||
			fputs(prompt, stdout);
 | 
			
		||||
		getlst();
 | 
			
		||||
		chkglobal() ? doglobal() : docmd();
 | 
			
		||||
	}
 | 
			
		||||
	edit();
 | 
			
		||||
 | 
			
		||||
	/* not reached */
 | 
			
		||||
	return 0;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user