From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 31 10:49:31 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 151951065679 for ; Fri, 31 Dec 2010 10:49:31 +0000 (UTC) (envelope-from rea@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id A40128FC14 for ; Fri, 31 Dec 2010 10:49:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codelabs.ru; s=two; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=Mn/kn3MrCwSkGybq+TDwgEfAFmT01ZgkohEiZDLoGo8=; b=X4EhRerBIqfczHOUfWl/0BEzL0Vc/I+6UxeMWCBm/+k7Nc3I3cC5fN2bzaU3QRBmVwv0jDaY0cOrURJHB6Mu0iIUzKjpDnPWi0KV3m/BKaasgayrER9oK9vSoIkkNv35Ja5u9Trt2LObqSo9QwTdtaEyAWFp6WEcgMxjOPx/28nv7PeBFRC0hFry1tLaHSB8RuvtvYezym9Q8EyLFxyobHvNQAxovZDrxuFVeOYEflhX4bA3tuAl8FYCJkK5dk5v/HBzQq9ZIhVrAwhpOx7JZJNmsOLDVGD6BaS8waz5O/cKBgxLJmanGN7X6lOTUmbL2vui/Nn/wMyTayTw+rDesA==; Received: from void.codelabs.ru (void.codelabs.ru [144.206.177.25]) by 0.mx.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1PYcY5-000Jas-7m; Fri, 31 Dec 2010 13:49:29 +0300 Date: Fri, 31 Dec 2010 13:49:27 +0300 From: Eygene Ryabinkin To: Eitan Adler Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="BYl/BInBdgsQr4gH" Content-Disposition: inline In-Reply-To: Sender: rea@codelabs.ru Cc: freebsd-hackers@freebsd.org Subject: Re: questions relating to ncurses and dialog(1) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Dec 2010 10:49:31 -0000 --BYl/BInBdgsQr4gH Content-Type: multipart/mixed; boundary="ynll37MX3Fmyj3VY" Content-Disposition: inline --ynll37MX3Fmyj3VY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Thu, Dec 30, 2010 at 07:03:44PM -0500, Eitan Adler wrote: > 2) The "help" screen just doesn't show up despite having text and a > border and not generating any errors (which are all checked) You're using 'frameCols' while calculating windowStatList[HELP].rowStart, so your window is starting somewhere around line 76 at the 80x25 terminal, thus it is just invisible. Use 'frameRows' and you'll get something that will be top-aligned with the buttons. There's one more thing: the lone 'dialog4ports --hfile=3D' will dump core, because prev is NULL in this case. The attached patch should fix the first item and will apply a quick-fix for the second one. --=20 Eygene Ryabinkin ,,,^..^,,, [ Life's unfair - but root password helps! | codelabs.ru ] [ 82FE 06BC D497 C0DE 49EC 4FF0 16AF 9EAE 8152 ECFB | freebsd.org ] --ynll37MX3Fmyj3VY Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Fix-help-handling.patch" Content-Transfer-Encoding: quoted-printable =46rom 824820c0c938bf677728314477664f190448a648 Mon Sep 17 00:00:00 2001 =46rom: Eygene Ryabinkin Date: Fri, 31 Dec 2010 13:46:08 +0300 Subject: [PATCH] Fix help handling - we should use frame's rows when calculating the starting line for the help window; - we should check if there was a previous argument that can have --hfile for it. The latter fix is a quick one, we should really check that the previous argument was one of the --option, --radio or --input. Signed-off-by: Eygene Ryabinkin --- dialog4ports.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/dialog4ports.c b/dialog4ports.c index 026b0b9..cc7a9f8 100644 --- a/dialog4ports.c +++ b/dialog4ports.c @@ -385,6 +385,8 @@ parseArguments(const int argc, char * argv[]) stage =3D OPEN; } else if (stage =3D=3D PREV_HFILE) { + if (prev =3D=3D NULL) + errx(EX_USAGE, "--hfile requires previous --option, --radio or --input= option."); prev->longDescrFile =3D argv[arg]; stage =3D OPEN; } @@ -632,7 +634,7 @@ main(int argc, char* argv[]) else windowStatList[LICENCE].colStart =3D 0; =20 - windowStatList[HELP].rowStart =3D frameCols - windowStatList[EXIT].rows -= windowStatList[LICENCE].rows; + windowStatList[HELP].rowStart =3D frameRows - windowStatList[EXIT].rows -= windowStatList[LICENCE].rows; windowStatList[HELP].colStart =3D 0 ; windowStatList[HELP].rows =3D 6; windowStatList[HELP].cols =3D frameCols; --=20 1.7.3.2 --ynll37MX3Fmyj3VY-- --BYl/BInBdgsQr4gH Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iF4EAREIAAYFAk0dtTYACgkQFq+eroFS7PtIjgD8DJui9Aq6dC8iktuKYrXWYnJv wGn6pKf7Ip52PeobX/4A/0QSqoGy8nnH9JM1gIaOL1aYnf++z93oLh2jWrXCL3rX =49Io -----END PGP SIGNATURE----- --BYl/BInBdgsQr4gH--