Page MenuHomeFreeBSD

tzsetup
ClosedPublic

Authored by bapt on Nov 22 2021, 10:37 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 30, 6:28 PM
Unknown Object (File)
Sun, Apr 28, 1:17 PM
Unknown Object (File)
Sat, Apr 27, 10:39 PM
Unknown Object (File)
Sat, Apr 27, 12:32 PM
Unknown Object (File)
Sat, Apr 27, 12:31 PM
Unknown Object (File)
Sat, Apr 27, 12:31 PM
Unknown Object (File)
Sat, Apr 27, 12:31 PM
Unknown Object (File)
Sat, Apr 27, 10:55 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.