10#include <ascii-chat/options/manpage/formatter.h>
11#include <ascii-chat/common.h>
12#include <ascii-chat/platform/system.h>
25 return str ? str :
"";
29 if (!f || !section_name) {
32 fprintf(f,
".SH %s\n", section_name);
46 fprintf(f,
".B %s\n", text);
53 fprintf(f,
".I %s\n", text);
69 fprintf(f,
"%s\n", text);
76 if (!f || !program_name || !brief_description) {
80 time_t now = time(NULL);
84 strftime(date_str,
sizeof(date_str),
"%B %Y", &tm_buf);
89 safe_snprintf(full_name,
sizeof(full_name),
"%s-%s", program_name, mode_name);
91 safe_snprintf(full_name,
sizeof(full_name),
"%s", program_name);
96 fprintf(f,
".TH %s 1 \"%s\" \"%s\" \"User Commands\"\n", full_name, date_str, program_name);
97 fprintf(f,
".SH NAME\n");
98 fprintf(f,
".B %s\n", full_name);
int safe_snprintf(char *buffer, size_t buffer_size, const char *format,...)
Safe formatted string printing to buffer.
asciichat_error_t platform_localtime(const time_t *timer, struct tm *result)