dj(1): add a variable for skipping in the main loop
This commit is contained in:
		
							parent
							
								
									8c33f0116c
								
							
						
					
					
						commit
						fe175cab19
					
				
							
								
								
									
										37
									
								
								src/dj.c
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								src/dj.c
									
									
									
									
									
								
							@ -269,22 +269,29 @@ int main(int argc, char *argv[]){
 | 
				
			|||||||
		if(io[i].seek > 0)
 | 
							if(io[i].seek > 0)
 | 
				
			||||||
			return oserr(io[i].fn);
 | 
								return oserr(io[i].fn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	do{	/* read */
 | 
						do{
 | 
				
			||||||
		if(Io_read(&io[0])->bufuse == 0 && !noerror)
 | 
							{ /* read */
 | 
				
			||||||
			Io_read(&io[0]); /* second chance */
 | 
								static char skipping = 0;
 | 
				
			||||||
		if(io[0].bufuse == 0) /* that's all she wrote */
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if(io[0].bufuse < io[0].bs){
 | 
								if(io[0].seek > 0)
 | 
				
			||||||
			fprintf(stderr, "%s: Partial read:\n\t", program_name);
 | 
									skipping = 1;
 | 
				
			||||||
			fprintio(stderr, fmt, io);
 | 
					
 | 
				
			||||||
			if(!noerror)
 | 
								if(Io_read(&io[0])->bufuse == 0 && !noerror)
 | 
				
			||||||
				count = 1;
 | 
									Io_read(&io[0]); /* second chance */
 | 
				
			||||||
			if(align >= 0){
 | 
								if(io[0].bufuse == 0) /* that's all she wrote */
 | 
				
			||||||
				/* fill the rest of the ibuf with padding */
 | 
									break;
 | 
				
			||||||
				memset(io[0].buf + io[0].bufuse, align,
 | 
					
 | 
				
			||||||
					io[0].bs - io[0].bufuse);
 | 
								if(io[0].bufuse < io[0].bs){
 | 
				
			||||||
				io->bufuse = io->bs;
 | 
									fprintf(stderr, "%s: Partial read:\n\t", program_name);
 | 
				
			||||||
 | 
									fprintio(stderr, fmt, io);
 | 
				
			||||||
 | 
									if(!noerror)
 | 
				
			||||||
 | 
										count = 1;
 | 
				
			||||||
 | 
									if(align >= 0){
 | 
				
			||||||
 | 
										/* fill the rest of the ibuf with padding */
 | 
				
			||||||
 | 
										memset(io[0].buf + io[0].bufuse, align,
 | 
				
			||||||
 | 
											io[0].bs - io[0].bufuse);
 | 
				
			||||||
 | 
										io->bufuse = io->bs;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user