From owner-freebsd-questions@FreeBSD.ORG Fri Jul 23 19:24:59 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE1251065676 for ; Fri, 23 Jul 2010 19:24:59 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email1.allantgroup.com (email1.emsphone.com [199.67.51.115]) by mx1.freebsd.org (Postfix) with ESMTP id 71CE88FC08 for ; Fri, 23 Jul 2010 19:24:59 +0000 (UTC) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email1.allantgroup.com (8.14.0/8.14.0) with ESMTP id o6NJOtwK083966 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 23 Jul 2010 14:24:56 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.4/8.14.4) with ESMTP id o6NJOtiP074152 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 23 Jul 2010 14:24:55 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.4/8.14.3/Submit) id o6NJOtTE074151; Fri, 23 Jul 2010 14:24:55 -0500 (CDT) (envelope-from dan) Date: Fri, 23 Jul 2010 14:24:54 -0500 From: Dan Nelson To: Polytropon Message-ID: <20100723192454.GB7343@dan.emsphone.com> References: <20100723202450.ea80c86f.freebsd@edvax.de> <20100723210814.44ff8bd1.freebsd@edvax.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100723210814.44ff8bd1.freebsd@edvax.de> X-OS: FreeBSD 8.1-PRERELEASE User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: clamav-milter 0.96 at email1.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (email1.allantgroup.com [199.67.51.78]); Fri, 23 Jul 2010 14:24:56 -0500 (CDT) X-Scanned-By: MIMEDefang 2.45 Cc: "A. Wright" , FreeBSD Questions Subject: Re: Text mode screen size max. compatibility X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jul 2010 19:24:59 -0000 In the last episode (Jul 23), Polytropon said: > On Fri, 23 Jul 2010 15:44:27 -0300 (ADT), "A. Wright" wrote: > > > > On Fri, 23 Jul 2010, Polytropon wrote: > > > Is there a way to easily determine the terminal output size at program > > > startup so the program can be preconfigured for certain screen sizes, > > > and even refuse to run if it's less than 80x25? > > > > The "curses" library will do this. The variables LINES and COLS will > > tell you what you want. > > Cool - I planned to use (n)curses anyway. But one question remains: Is > there an "interrupt line" (or something functionally similar, a flag or > whatever) that will give the chance for a notification if LINES or COLS > has recently changed, e. g. through a window size modification? If you haven't trapped the SIGWINCH signal (which is sent on terminal size changes) yourself, ncurses will install its own handler. It will queue a virtual KEY_RESIZE keypress that you can check for in your input loop. You can then redraw your display to fit the new window size. -- Dan Nelson dnelson@allantgroup.com