mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
use explicit CRLF where necessary on windows #2237
This commit is contained in:
parent
c63b3d31a4
commit
1456422d89
@ -16,6 +16,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW64__
|
||||
#define NL "\r\n"
|
||||
#include <Lmcons.h>
|
||||
#include <winsock2.h>
|
||||
#define tcgetattr(x, y) (0)
|
||||
@ -56,6 +57,7 @@ struct winsize {
|
||||
};
|
||||
#define WNOHANG 0
|
||||
#else
|
||||
#define NL "\n"
|
||||
#include <poll.h>
|
||||
#include <termios.h>
|
||||
#include <sys/wait.h>
|
||||
|
@ -8,11 +8,11 @@ init_banner_warnings(const notcurses* nc, fbuf* f, const char* clreol){
|
||||
term_fg_palindex(nc, f, nc->tcache.caps.colors <= 88 ? 1 : 0xcb);
|
||||
if(!notcurses_canutf8(nc)){
|
||||
fbuf_puts(f, clreol);
|
||||
fbuf_puts(f, " Warning! Encoding is not UTF-8; output may be degraded.\n");
|
||||
fbuf_puts(f, " Warning! Encoding is not UTF-8; output may be degraded." NL);
|
||||
}
|
||||
if(!get_escape(&nc->tcache, ESCAPE_HPA)){
|
||||
fbuf_puts(f, clreol);
|
||||
fbuf_puts(f, " Warning! No absolute horizontal placement.\n");
|
||||
fbuf_puts(f, " Warning! No absolute horizontal placement." NL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -26,7 +26,7 @@ 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\n",
|
||||
fbuf_printf(f, "%snotcurses %s on %s %s" NL,
|
||||
clreol, notcurses_version(),
|
||||
nc->tcache.termname ? nc->tcache.termname : "?",
|
||||
nc->tcache.termversion ? nc->tcache.termversion : "");
|
||||
@ -54,7 +54,7 @@ int init_banner(const notcurses* nc, fbuf* f){
|
||||
14 % nc->tcache.caps.colors : 0x2080e0);
|
||||
fbuf_putc(f, '+');
|
||||
}
|
||||
fbuf_printf(f, "%u colors\n%s%s%s (%s)\n%sterminfo from %s zlib %s GPM %s\n",
|
||||
fbuf_printf(f, "%u colors" NL "%s%s%s (%s)" NL "%sterminfo from %s zlib %s GPM %s" NL,
|
||||
nc->tcache.caps.colors, clreol,
|
||||
#ifdef __clang__
|
||||
"", // name is contained in __VERSION__
|
||||
|
@ -174,7 +174,7 @@ void summarize_stats(notcurses* nc){
|
||||
qprefix(stats->render_min_ns, NANOSECS_IN_SEC, minbuf, 0);
|
||||
qprefix(stats->render_max_ns, NANOSECS_IN_SEC, maxbuf, 0);
|
||||
qprefix(stats->render_ns / stats->renders, NANOSECS_IN_SEC, avgbuf, 0);
|
||||
fprintf(stderr, "%s%"PRIu64" render%s, %ss (%ss min, %ss avg, %ss max)\n",
|
||||
fprintf(stderr, "%s%"PRIu64" render%s, %ss (%ss min, %ss avg, %ss max)" NL,
|
||||
clreol, stats->renders, stats->renders == 1 ? "" : "s",
|
||||
totalbuf, minbuf, avgbuf, maxbuf);
|
||||
}
|
||||
@ -184,7 +184,7 @@ void summarize_stats(notcurses* nc){
|
||||
qprefix(stats->raster_max_ns, NANOSECS_IN_SEC, maxbuf, 0);
|
||||
qprefix(stats->raster_ns / (stats->writeouts + stats->failed_writeouts),
|
||||
NANOSECS_IN_SEC, avgbuf, 0);
|
||||
fprintf(stderr, "%s%"PRIu64" raster%s, %ss (%ss min, %ss avg, %ss max)\n",
|
||||
fprintf(stderr, "%s%"PRIu64" raster%s, %ss (%ss min, %ss avg, %ss max)" NL,
|
||||
clreol, stats->writeouts, stats->writeouts == 1 ? "" : "s",
|
||||
totalbuf, minbuf, avgbuf, maxbuf);
|
||||
qprefix(stats->writeout_ns, NANOSECS_IN_SEC, totalbuf, 0);
|
||||
@ -193,7 +193,7 @@ void summarize_stats(notcurses* nc){
|
||||
qprefix(stats->writeout_max_ns, NANOSECS_IN_SEC, maxbuf, 0);
|
||||
qprefix(stats->writeouts ? stats->writeout_ns / stats->writeouts : 0,
|
||||
NANOSECS_IN_SEC, avgbuf, 0);
|
||||
fprintf(stderr, "%s%"PRIu64" write%s, %ss (%ss min, %ss avg, %ss max)\n",
|
||||
fprintf(stderr, "%s%"PRIu64" write%s, %ss (%ss min, %ss avg, %ss max)" NL,
|
||||
clreol, stats->writeouts, stats->writeouts == 1 ? "" : "s",
|
||||
totalbuf, minbuf, avgbuf, maxbuf);
|
||||
}
|
||||
@ -203,24 +203,24 @@ void summarize_stats(notcurses* nc){
|
||||
1, minbuf, 1),
|
||||
bprefix(stats->renders ? stats->render_bytes / stats->renders : 0, 1, avgbuf, 1);
|
||||
bprefix(stats->render_max_bytes, 1, maxbuf, 1),
|
||||
fprintf(stderr, "%s%sB (%sB min, %sB avg, %sB max) %"PRIu64" input%s\n",
|
||||
fprintf(stderr, "%s%sB (%sB min, %sB avg, %sB max) %"PRIu64" input%s" NL,
|
||||
clreol, totalbuf, minbuf, avgbuf, maxbuf,
|
||||
stats->input_events,
|
||||
stats->input_events == 1 ? "" : "s");
|
||||
}
|
||||
fprintf(stderr, "%s%"PRIu64" failed render%s, %"PRIu64" failed raster%s, %"PRIu64" refresh%s, %"PRIu64" input error%s\n",
|
||||
fprintf(stderr, "%s%"PRIu64" failed render%s, %"PRIu64" failed raster%s, %"PRIu64" refresh%s, %"PRIu64" input error%s" NL,
|
||||
clreol, stats->failed_renders, stats->failed_renders == 1 ? "" : "s",
|
||||
stats->failed_writeouts, stats->failed_writeouts == 1 ? "" : "s",
|
||||
stats->refreshes, stats->refreshes == 1 ? "" : "es",
|
||||
stats->input_errors, stats->input_errors == 1 ? "" : "s");
|
||||
fprintf(stderr, "%sRGB emits:elides: def %"PRIu64":%"PRIu64" fg %"PRIu64":%"PRIu64" bg %"PRIu64":%"PRIu64"\n",
|
||||
fprintf(stderr, "%sRGB emits:elides: def %"PRIu64":%"PRIu64" fg %"PRIu64":%"PRIu64" bg %"PRIu64":%"PRIu64"" NL,
|
||||
clreol, stats->defaultemissions,
|
||||
stats->defaultelisions,
|
||||
stats->fgemissions,
|
||||
stats->fgelisions,
|
||||
stats->bgemissions,
|
||||
stats->bgelisions);
|
||||
fprintf(stderr, "%sCell emits:elides: %"PRIu64":%"PRIu64" (%.2f%%) %.2f%% %.2f%% %.2f%%\n",
|
||||
fprintf(stderr, "%sCell emits:elides: %"PRIu64":%"PRIu64" (%.2f%%) %.2f%% %.2f%% %.2f%%" NL,
|
||||
clreol, stats->cellemissions, stats->cellelisions,
|
||||
(stats->cellemissions + stats->cellelisions) == 0 ? 0 :
|
||||
(stats->cellelisions * 100.0) / (stats->cellemissions + stats->cellelisions),
|
||||
@ -231,7 +231,7 @@ void summarize_stats(notcurses* nc){
|
||||
(stats->bgemissions + stats->bgelisions) == 0 ? 0 :
|
||||
(stats->bgelisions * 100.0) / (stats->bgemissions + stats->bgelisions));
|
||||
bprefix(stats->sprixelbytes, 1, totalbuf, 1);
|
||||
fprintf(stderr, "%sBitmap emits:elides: %"PRIu64":%"PRIu64" (%.2f%%) %sB (%.2f%%) SuM: %"PRIu64" (%.2f%%)\n",
|
||||
fprintf(stderr, "%sBitmap emits:elides: %"PRIu64":%"PRIu64" (%.2f%%) %sB (%.2f%%) SuM: %"PRIu64" (%.2f%%)" NL,
|
||||
clreol, stats->sprixelemissions, stats->sprixelelisions,
|
||||
(stats->sprixelemissions + stats->sprixelelisions) == 0 ? 0 :
|
||||
(stats->sprixelelisions * 100.0) / (stats->sprixelemissions + stats->sprixelelisions),
|
||||
|
@ -687,7 +687,7 @@ int ffmpeg_init(int logl){
|
||||
}
|
||||
|
||||
void ffmpeg_printbanner(fbuf* f){
|
||||
fbuf_printf(f, "avformat %u.%u.%u avutil %u.%u.%u swscale %u.%u.%u avcodec %u.%u.%u\n",
|
||||
fbuf_printf(f, "avformat %u.%u.%u avutil %u.%u.%u swscale %u.%u.%u avcodec %u.%u.%u" NL,
|
||||
LIBAVFORMAT_VERSION_MAJOR, LIBAVFORMAT_VERSION_MINOR, LIBAVFORMAT_VERSION_MICRO,
|
||||
LIBAVUTIL_VERSION_MAJOR, LIBAVUTIL_VERSION_MINOR, LIBAVUTIL_VERSION_MICRO,
|
||||
LIBSWSCALE_VERSION_MAJOR, LIBSWSCALE_VERSION_MINOR, LIBSWSCALE_VERSION_MICRO,
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
static void
|
||||
printbanner(fbuf* f){
|
||||
fbuf_puts(f, "built without multimedia support\n");
|
||||
fbuf_puts(f, "built without multimedia support" NL);
|
||||
}
|
||||
|
||||
const ncvisual_implementation local_visual_implementation = {
|
||||
|
@ -198,7 +198,7 @@ auto oiio_destroy(ncvisual* ncv) -> void {
|
||||
void oiio_printbanner(fbuf* f){
|
||||
fbuf_puts(f, "openimageio ");
|
||||
fbuf_puts(f, OIIO_VERSION_STRING);
|
||||
fbuf_putc(f, '\n');
|
||||
fbuf_puts(f, NL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user