Page MenuHomeFreeBSD

tzsetup
ClosedPublic

Authored by bapt on Nov 22 2021, 10:37 AM.
Tags
None
Referenced Files
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
Unknown Object (File)
Mar 22 2023, 6:16 PM
Subscribers

Details

Summary

Rework to use bsddialog

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 42913
Build 39801: arc lint + arc unit

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
151–152

bsddialog_terminalheight())

152

bsddialog_terminalheight())

172–173

bsddialog_terminalwidth())

173

bsddialog_terminalwidth();

181

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

asiciliano added inline comments.
usr.sbin/tzsetup/tzsetup.c
139–141

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

145

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
151–152

fix
if (height > terminalheight() -2)

152

fix
bsddialog_terminalheight() -2;

172–173

if (width > terminalwidth() -3)

173

width = terminalwidth() -3;

This revision was automatically updated to reflect the committed changes.