From owner-freebsd-bugs Mon Feb 24 9: 0:35 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6586537B401 for ; Mon, 24 Feb 2003 09:00:30 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5A0AC43FAF for ; Mon, 24 Feb 2003 09:00:29 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1OH0TNS026821 for ; Mon, 24 Feb 2003 09:00:29 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1OH0T3g026820; Mon, 24 Feb 2003 09:00:29 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B670D37B401 for ; Mon, 24 Feb 2003 08:57:06 -0800 (PST) Received: from alexwang.com (alexwang.com [61.218.0.204]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5757943F3F for ; Mon, 24 Feb 2003 08:57:05 -0800 (PST) (envelope-from alex@alexwang.com) Received: (from root@localhost) by alexwang.com (8.12.6/8.12.6) id h1OGvkdI009481; Tue, 25 Feb 2003 00:57:46 +0800 (CST) Received: from alexwang.com (localhost.alexwang.com [127.0.0.1]) by alexwang.com (8.12.6/8.12.6av) with ESMTP id h1OGvacE009448; Tue, 25 Feb 2003 00:57:36 +0800 (CST) Received: (from root@localhost) by alexwang.com (8.12.6/8.12.6/Submit) id h1OGvZZt009447; Tue, 25 Feb 2003 00:57:35 +0800 (CST) Message-Id: <200302241657.h1OGvZZt009447@alexwang.com> Date: Tue, 25 Feb 2003 00:57:35 +0800 (CST) From: Alex Wang Reply-To: Alex Wang To: FreeBSD-gnats-submit@FreeBSD.org Cc: alex@alexwang.com X-Send-Pr-Version: 3.113 Subject: gnu/48638: [PATCH] some bug fixs in libdialog Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48638 >Category: gnu >Synopsis: [PATCH] some bug fixs in libdialog >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Feb 24 09:00:28 PST 2003 >Closed-Date: >Last-Modified: >Originator: Alex Wang >Release: FreeBSD 4.7-RELEASE i386 >Organization: >Environment: System: FreeBSD alexwang.com 4.7-RELEASE FreeBSD 4.7-RELEASE #0: Mon Oct 14 05:21:51 CST 2002 alex@alexwang.com:/usr/src/sys/compile/ALEX i386 >Description: 1.checklist.c: Enable user to set the position of checklist. 2.fselect.c: Memory leak problem in dir select memu. In dialog_dselect() menu, press cancel but return TURE, which should be FALSE. 3.menubox.c: In dialog_menu(), if we can input a (int *) to set the position of light bar. After user move the light bar, we have to change the (int *) that user input to record the current position. This enables user to memorize the selected item and places the light bar in the right position next time we show the menu. >How-To-Repeat: >Fix: ***************** For RELENG_4 ********************** Index: checklist.c =================================================================== RCS file: /home/ncvs/src/gnu/lib/libdialog/checklist.c,v retrieving revision 1.35.2.2 diff -u -b -r1.35.2.2 checklist.c --- checklist.c 2001/08/31 03:04:59 1.35.2.2 +++ checklist.c 2003/02/24 16:20:03 @@ -113,7 +113,7 @@ height = LINES; /* center dialog box on screen */ x = (COLS - width)/2; - y = (LINES - height)/2; + y = DialogY ? DialogY : (LINES - height)/2; #ifdef HAVE_NCURSES if (use_shadow) Index: fselect.c =================================================================== RCS file: /home/ncvs/src/gnu/lib/libdialog/fselect.c,v retrieving revision 1.5 diff -u -b -r1.5 fselect.c --- fselect.c 1997/02/18 14:26:19 1.5 +++ fselect.c 2003/02/24 16:20:03 @@ -210,7 +210,10 @@ * Desc: Choose a directory */ { - if (dialog_dfselect(dir, fmask, FALSE)) { + char *szSelDir; + szSelDir = dialog_dfselect(dir, fmask, FALSE); + if (szSelDir) { + free(szSelDir); return(FALSE); /* esc or cancel was pressed */ } else { return(TRUE); /* directory was selected */ @@ -391,12 +394,14 @@ FreeNames(fnames, nf); delwin(fs_win); - if (cancel || (strlen(o_sel) == 0)) { + if (is_fselect && cancel) { return(NULL); - } else { + }else if (cancel || (is_fselect &&(strlen(o_sel) != 0))) { ret_name = (char *) malloc( strlen(o_sel) + 1 ); strcpy(ret_name, o_sel); return(ret_name); + } else { + return(NULL); } } /* dialog_fselect() */ Index: menubox.c =================================================================== RCS file: /home/ncvs/src/gnu/lib/libdialog/menubox.c,v retrieving revision 1.35.2.1 diff -u -b -r1.35.2.1 menubox.c --- menubox.c 2001/07/31 20:34:00 1.35.2.1 +++ menubox.c 2003/02/24 16:20:03 @@ -392,6 +392,9 @@ delwin(menu); delwin(dialog); dialog_clear(); + if (ch) { + *ch = choice; + } goto draw; } } ***************** End of RELENG_4 **************** ***************** FOR CURRENT ****************** Index: checklist.c =================================================================== RCS file: /home/ncvs/src/gnu/lib/libdialog/checklist.c,v retrieving revision 1.38 diff -u -b -r1.38 checklist.c --- checklist.c 2001/08/31 01:56:06 1.38 +++ checklist.c 2003/02/24 16:20:51 @@ -113,7 +113,7 @@ height = LINES; /* center dialog box on screen */ x = (COLS - width)/2; - y = (LINES - height)/2; + y = DialogY ? DialogY : (LINES - height)/2; #ifdef HAVE_NCURSES if (use_shadow) Index: fselect.c =================================================================== RCS file: /home/ncvs/src/gnu/lib/libdialog/fselect.c,v retrieving revision 1.5 diff -u -b -r1.5 fselect.c --- fselect.c 1997/02/18 14:26:19 1.5 +++ fselect.c 2003/02/24 16:20:51 @@ -210,7 +210,10 @@ * Desc: Choose a directory */ { - if (dialog_dfselect(dir, fmask, FALSE)) { + char *szSelDir; + szSelDir = dialog_dfselect(dir, fmask, FALSE); + if (szSelDir) { + free(szSelDir); return(FALSE); /* esc or cancel was pressed */ } else { return(TRUE); /* directory was selected */ @@ -391,12 +394,14 @@ FreeNames(fnames, nf); delwin(fs_win); - if (cancel || (strlen(o_sel) == 0)) { + if (is_fselect && cancel) { return(NULL); - } else { + }else if (cancel || (is_fselect &&(strlen(o_sel) != 0))) { ret_name = (char *) malloc( strlen(o_sel) + 1 ); strcpy(ret_name, o_sel); return(ret_name); + } else { + return(NULL); } } /* dialog_fselect() */ Index: menubox.c =================================================================== RCS file: /home/ncvs/src/gnu/lib/libdialog/menubox.c,v retrieving revision 1.36 diff -u -b -r1.36 menubox.c --- menubox.c 2001/07/18 05:21:36 1.36 +++ menubox.c 2003/02/24 16:20:51 @@ -392,6 +392,9 @@ delwin(menu); delwin(dialog); dialog_clear(); + if (ch) { + *ch = choice; + } goto draw; } } ======================================================== >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message