mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Merge branch 'obsd-master'
This commit is contained in:
		
							
								
								
									
										17
									
								
								format.c
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								format.c
									
									
									
									
									
								
							@@ -867,27 +867,18 @@ fail:
 | 
				
			|||||||
char *
 | 
					char *
 | 
				
			||||||
format_expand_time(struct format_tree *ft, const char *fmt, time_t t)
 | 
					format_expand_time(struct format_tree *ft, const char *fmt, time_t t)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char		*tmp, *expanded;
 | 
					 | 
				
			||||||
	size_t		 tmplen;
 | 
					 | 
				
			||||||
	struct tm	*tm;
 | 
						struct tm	*tm;
 | 
				
			||||||
 | 
						char		 s[2048];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (fmt == NULL || *fmt == '\0')
 | 
						if (fmt == NULL || *fmt == '\0')
 | 
				
			||||||
		return (xstrdup(""));
 | 
							return (xstrdup(""));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	tm = localtime(&t);
 | 
						tm = localtime(&t);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	tmp = NULL;
 | 
						if (strftime(s, sizeof s, fmt, tm) == 0)
 | 
				
			||||||
	tmplen = strlen(fmt);
 | 
							return (xstrdup(""));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	do {
 | 
						return (format_expand(ft, s));
 | 
				
			||||||
		tmp = xreallocarray(tmp, 2, tmplen);
 | 
					 | 
				
			||||||
		tmplen *= 2;
 | 
					 | 
				
			||||||
	} while (strftime(tmp, tmplen, fmt, tm) == 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	expanded = format_expand(ft, tmp);
 | 
					 | 
				
			||||||
	free(tmp);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return (expanded);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Expand keys in a template. */
 | 
					/* Expand keys in a template. */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user