Page MenuHomeFreeBSD

tzsetup
ClosedPublic

Authored by bapt on Nov 22 2021, 10:37 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 3, 10:54 AM
Unknown Object (File)
Feb 19 2024, 6:53 PM
Unknown Object (File)
Dec 21 2023, 3:11 PM
Unknown Object (File)
Dec 20 2023, 12:14 AM
Unknown Object (File)
Nov 7 2023, 3:01 AM
Unknown Object (File)
Sep 6 2023, 3:49 AM
Unknown Object (File)
May 29 2023, 10:21 AM
Unknown Object (File)
May 27 2023, 7:40 AM
Subscribers

Details

Summary

Rework to use bsddialog

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bapt requested review of this revision.Nov 22 2021, 10:37 AM

catchup with bsddialog_initconf

I changed the api, sorry, you should change
terminalwidth() -> bsddialog_terminalwidth();
terminalwidth(); -> bsddialog_terminalwidth();
if (listitems[i].on == 'X') -> if (listitems[i].on == true)
Now warnings are fixed.

Important: "Bus error (core dump)", to reproduce:
<NO> -> Europe -> Italy -> <No> -> <Cancel>

I am investigating

usr.sbin/tzsetup/tzsetup.c
155–156

bsddialog_terminalheight())

156

bsddialog_terminalheight())

176–177

bsddialog_terminalwidth())

177

bsddialog_terminalwidth();

185

if (listitems[i].on == true)

asiciliano added inline comments.
usr.sbin/tzsetup/tzsetup.c
140–142

This fix the overflow:
listitems = calloc(item_no + 1, sizeof(struct bsddialog_menuitem));

149

To be sure, I would add also:

listitems[i].depth = 0;
listitems[i].bottomdesc = "";
listitems[i].on = false;

This revision is now accepted and ready to land.Nov 22 2021, 11:28 PM

Important:
Please, for now use

terminalheight() - 2

and

terminalwidth() -3

to fix a silent error (unpleasant consequence: the enter key has not effect with long menus)

I am going to write documented functions:
getwidget_height()/width() (they already exist but as internal utils).
Sorry for the fix after the "Accept"

usr.sbin/tzsetup/tzsetup.c
155–156

fix
if (height > terminalheight() -2)

156

fix
bsddialog_terminalheight() -2;

176–177

if (width > terminalwidth() -3)

177

width = terminalwidth() -3;

This revision was automatically updated to reflect the committed changes.