[banner] display OS in init banner

This commit is contained in:
nick black 2021-10-20 04:49:08 -04:00
parent 6411b628a4
commit 1e4ce97750
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -17,6 +17,21 @@ init_banner_warnings(const notcurses* nc, fbuf* f, const char* clreol){
return 0; return 0;
} }
static inline const char*
osname(void){
#ifdef __MINGW64__
return "Windows";
#elif defined(__APPLE__)
return "macOS";
#elif defined(__gnu_hurd__)
return "GNU Hurd";
#elif defined(BSD)
return "BSD";
#else
return "Linux";
#endif
}
// unless the suppress_banner flag was set, print some version information and // unless the suppress_banner flag was set, print some version information and
// (if applicable) warnings to ttyfp. we are not yet on the alternate screen. // (if applicable) warnings to ttyfp. we are not yet on the alternate screen.
int init_banner(const notcurses* nc, fbuf* f){ int init_banner(const notcurses* nc, fbuf* f){
@ -26,10 +41,11 @@ int init_banner(const notcurses* nc, fbuf* f){
} }
if(!nc->suppress_banner){ if(!nc->suppress_banner){
term_fg_palindex(nc, f, 50 % nc->tcache.caps.colors); term_fg_palindex(nc, f, 50 % nc->tcache.caps.colors);
fbuf_printf(f, "%snotcurses %s on %s %s" NL, fbuf_printf(f, "%snotcurses %s on %s %s (%s)" NL,
clreol, notcurses_version(), clreol, notcurses_version(),
nc->tcache.termname ? nc->tcache.termname : "?", nc->tcache.termname ? nc->tcache.termname : "?",
nc->tcache.termversion ? nc->tcache.termversion : ""); nc->tcache.termversion ? nc->tcache.termversion : "",
osname());
term_fg_palindex(nc, f, nc->tcache.caps.colors <= 256 ? term_fg_palindex(nc, f, nc->tcache.caps.colors <= 256 ?
14 % nc->tcache.caps.colors : 0x2080e0); 14 % nc->tcache.caps.colors : 0x2080e0);
if(nc->tcache.cellpixy && nc->tcache.cellpixx){ if(nc->tcache.cellpixy && nc->tcache.cellpixx){