Page MenuHomeFreeBSD

tzsetup
ClosedPublic

Authored by bapt on Nov 22 2021, 10:37 AM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 10 2024, 1:47 PM
Unknown Object (File)
Nov 2 2024, 7:45 PM
Unknown Object (File)
Oct 31 2024, 3:42 AM
Unknown Object (File)
Oct 24 2024, 10:55 PM
Unknown Object (File)
Oct 24 2024, 8:44 AM
Unknown Object (File)
Oct 20 2024, 12:37 AM
Unknown Object (File)
Oct 13 2024, 8:53 PM
Unknown Object (File)
Oct 5 2024, 3:04 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.