Use getline in place of fgetln
This commit is contained in:
		
							parent
							
								
									5fcd801783
								
							
						
					
					
						commit
						c4c4de6923
					
				
							
								
								
									
										12
									
								
								log.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								log.c
									
									
									
									
									
								
							@ -132,12 +132,14 @@ void logReplay(struct Tag tag) {
 | 
				
			|||||||
	FILE *file = logFile(tag, time);
 | 
						FILE *file = logFile(tag, time);
 | 
				
			||||||
	rewind(file);
 | 
						rewind(file);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	size_t len;
 | 
						char *line = NULL;
 | 
				
			||||||
	char *line;
 | 
						size_t cap = 0;
 | 
				
			||||||
	while (NULL != (line = fgetln(file, &len))) {
 | 
						ssize_t len;
 | 
				
			||||||
 | 
						while (0 < (len = getline(&line, &cap, file))) {
 | 
				
			||||||
 | 
							if (len < 1 + StampLen + 2 + 1) continue;
 | 
				
			||||||
		line[len - 1] = '\0';
 | 
							line[len - 1] = '\0';
 | 
				
			||||||
		if (len > 1 + StampLen + 2) line = &line[1 + StampLen + 2];
 | 
							uiFmt(tag, UICold, "\3%d%s", IRCGray, &line[1 + StampLen + 2]);
 | 
				
			||||||
		uiFmt(tag, UICold, "\3%d%s", IRCGray, line);
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (ferror(file)) err(EX_IOERR, "%s", tag.name);
 | 
						if (ferror(file)) err(EX_IOERR, "%s", tag.name);
 | 
				
			||||||
 | 
						free(line);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user