From 1e4ce977502b492954fe0ae47056203fa33d4fbc Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 20 Oct 2021 04:49:08 -0400 Subject: [PATCH] [banner] display OS in init banner --- src/lib/banner.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/lib/banner.c b/src/lib/banner.c index a44149abe..e65d14fc8 100644 --- a/src/lib/banner.c +++ b/src/lib/banner.c @@ -17,6 +17,21 @@ init_banner_warnings(const notcurses* nc, fbuf* f, const char* clreol){ 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 // (if applicable) warnings to ttyfp. we are not yet on the alternate screen. int init_banner(const notcurses* nc, fbuf* f){ @@ -26,10 +41,11 @@ int init_banner(const notcurses* nc, fbuf* f){ } if(!nc->suppress_banner){ 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(), 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 ? 14 % nc->tcache.caps.colors : 0x2080e0); if(nc->tcache.cellpixy && nc->tcache.cellpixx){