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=<foo>'
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.
-- 
Eygene Ryabinkin                                        ,,,^..^,,,
[ Life's unfair - but root password helps!           | codelabs.ru ]
[ 82FE 06BC D497 C0DE 49EC  4FF0 16AF 9EAE 8152 ECFB | freebsd.org ]
From 824820c0c938bf677728314477664f190448a648 Mon Sep 17 00:00:00 2001
From: Eygene Ryabinkin <r...@freebsd.org>
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 <r...@freebsd.org>
---
 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 = OPEN;
 		}
 		else if (stage == PREV_HFILE) {
+			if (prev == NULL)
+				errx(EX_USAGE, "--hfile requires previous --option, --radio or --input option.");
 			prev->longDescrFile = argv[arg];
 			stage = OPEN;
 		}
@@ -632,7 +634,7 @@ main(int argc, char* argv[])
 	else
 		windowStatList[LICENCE].colStart = 0;
 
-	windowStatList[HELP].rowStart = frameCols - windowStatList[EXIT].rows - windowStatList[LICENCE].rows;
+	windowStatList[HELP].rowStart = frameRows - windowStatList[EXIT].rows - windowStatList[LICENCE].rows;
 	windowStatList[HELP].colStart = 0 ;
 	windowStatList[HELP].rows = 6;
 	windowStatList[HELP].cols = frameCols;
-- 
1.7.3.2

Attachment: pgpTIG7vaj4xA.pgp
Description: PGP signature

Reply via email to