openbsd-ports/audio/ncmpc/patches/patch-src_screen_c

26 lines
651 B
Plaintext

$OpenBSD: patch-src_screen_c,v 1.2 2010/04/05 19:05:11 landry Exp $
--- src/screen.c.orig Sun Jan 17 16:54:56 2010
+++ src/screen.c Sun Mar 21 08:36:06 2010
@@ -47,6 +47,7 @@
#include <string.h>
#include <time.h>
#include <locale.h>
+#include <termios.h>
#ifndef NCMPC_MINI
/** welcome message time [s] */
@@ -200,6 +201,13 @@ screen_exit(void)
void
screen_resize(struct mpdclient *c)
{
+ struct winsize ws;
+
+ if (ioctl(fileno(stdout), TIOCGWINSZ, &ws) == 0) {
+ LINES = ws.ws_row;
+ COLS = ws.ws_col;
+ }
+
if (COLS<SCREEN_MIN_COLS || LINES<SCREEN_MIN_ROWS) {
screen_exit();
fprintf(stderr, "%s", _("Error: Screen too small"));