This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=b8df9e1e97bd13715677b2f12d8894135c20b4a5 commit b8df9e1e97bd13715677b2f12d8894135c20b4a5 Author: Guillem Jover <[email protected]> AuthorDate: Mon Oct 6 10:01:34 2025 +0200 dselect: Rework curses enable/disable functions to reduce nesting level Changelog: internal --- dselect/main.cc | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/dselect/main.cc b/dselect/main.cc index 7773ad827..4ca490482 100644 --- a/dselect/main.cc +++ b/dselect/main.cc @@ -330,33 +330,37 @@ static const struct cmdinfo cmdinfos[]= { static bool cursesareon = false; void curseson() { - if (!cursesareon) { - const char *cup, *smso; - initscr(); - cup= tigetstr("cup"); - smso= tigetstr("smso"); - if (!cup || !smso) { - endwin(); - if (!cup) - fputs(_("Terminal does not appear to support cursor addressing.\n"),stderr); - if (!smso) - fputs(_("Terminal does not appear to support highlighting.\n"),stderr); - fprintf(stderr, - _("Set your TERM variable correctly, use a better terminal,\n" - "or make do with the per-package management tool %s.\n"), - DPKG); - ohshit(_("terminal lacks necessary features, giving up")); - } + if (cursesareon) + return; + + const char *cup, *smso; + initscr(); + cup = tigetstr("cup"); + smso = tigetstr("smso"); + if (!cup || !smso) { + endwin(); + if (!cup) + fputs(_("Terminal does not appear to support cursor addressing.\n"), stderr); + if (!smso) + fputs(_("Terminal does not appear to support highlighting.\n"), stderr); + fprintf(stderr, + _("Set your TERM variable correctly, use a better terminal,\n" + "or make do with the per-package management tool %s.\n"), + DPKG); + ohshit(_("terminal lacks necessary features, giving up")); } + cursesareon = true; } void cursesoff() { - if (cursesareon) { - clear(); - refresh(); - endwin(); - } + if (!cursesareon) + return; + + clear(); + refresh(); + endwin(); + cursesareon = false; } -- Dpkg.Org's dpkg

