From nobody Wed Jan 19 08:33:13 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E82981967CF1; Wed, 19 Jan 2022 08:33:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JdzRs66Nyz4q6n; Wed, 19 Jan 2022 08:33:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642581193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oOA/yXLe14senQ6Y6is+uitC2UDP9arJUX/IA1eaGrU=; b=ACKjdwL2U9tzZOdgDKs2bFS8jwE6bv6Ieub/tl1HZ1YpNFdu5R3PEj0pV0SU9gBxz8FD1a NLCJUEHsCH8s3IKQyw7yGzrbOtvFE2OJgsk3fuMtZO4PlqORINFOjHMpbJsxW2z0GffpxD dvWTDJM6N9LGO9GzbRXbK+Pc1vtFKrAoQPf3Oy+R2AbILkqm0W/7ITZs9C9Lmk+Ww12DF6 UQi+PioCkWoagIBDxlbwEOGjaYtyh07/8cYXJYM7Spfugc9zOhD2xHQIjkzZUmGv5RtNb4 g0SlSFbokPFWf8jeEYMHxXTv6HvOPa85Vc/YnfwSP6760AcdKDNIyHxj1UEV0Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A867911F34; Wed, 19 Jan 2022 08:33:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20J8XDPP042539; Wed, 19 Jan 2022 08:33:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20J8XDo7042538; Wed, 19 Jan 2022 08:33:13 GMT (envelope-from git) Date: Wed, 19 Jan 2022 08:33:13 GMT Message-Id: <202201190833.20J8XDo7042538@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 8ea2d22e6d54 - main - bsddialog: Fix for terminals without colours List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8ea2d22e6d54d492b6b169014841eb27d4617459 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642581193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oOA/yXLe14senQ6Y6is+uitC2UDP9arJUX/IA1eaGrU=; b=w5Gikgeht4ff5YZvJ7S9qMHpA8Grv7DtX3LWK70S3FVFK2PPtwsZxe1UOhFDUe7ezsTBmD D60iS1k2ziQL5kU+Kb3iTkNbnma18uwamBUJ9R7yf7sZFlHgtn0csPclaZjoEBwCxZ6WUq VgrfAVpiqd2VGRAqnj5rOTDdYGofx5T4zhE7RMcZAUGN0z6jG/aUmhp/nvnwzKsnWhh1hF LaSAt/Eo4m74XYK3ot7h/YeAg5fJ+N+ynl8HynqMHUJMm/i4EmtaujL4Dx9XdrXOPgffTh OslAk65KxBEGCs3pT3JNjlJ8zn3MO83QyYaTHWraf9q5F1o3Npgw2xAawlS4BA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642581193; a=rsa-sha256; cv=none; b=pdfCnF9JLTLiQklzjLsgVMOjYJg0LIKlUY+spoCnots0pUgp5xhMABB3xRY0T8+OVVn6ol VqOMkrU8qVgvZzMtEFahjrfa/ztAH5EvIsCN+AUy8eDJprEGVeoFFA0iGqRXuzLlKECZWM hIHxxbMvBVZESMbu49NR3CAQW8mnnSkXVFiBr2QUqcPPEpBoLJ2xOQIholmpFijpoAN3Hi boVb5+80FhuogpO3DaebmZ60qppfhf16/RfH/7r+RZXYkVee/a916TEwBK6CsQEX64oyy0 x5VZ3WYAA6imQ2ZUTXM4tzdcKnxWtqqoo3/onC2JWpQtygz7ktFuiosoNQVBcg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=8ea2d22e6d54d492b6b169014841eb27d4617459 commit 8ea2d22e6d54d492b6b169014841eb27d4617459 Author: Alfonso Siciliano AuthorDate: 2022-01-19 08:28:42 +0000 Commit: Baptiste Daroussin CommitDate: 2022-01-19 08:28:42 +0000 bsddialog: Fix for terminals without colours When running the installer, in particular disextract (which is so far the only part converted to bsddialog), on serial console or vt100 or actually any terminal without color support, it failed to start. This change makes bsddialog fallback on the black and white theme. This is incorporated in newer version of bsddialog which will be imported soon. PR: 261272 Reported by: thj Differential Revision: https://reviews.freebsd.org/D33920 --- contrib/bsddialog/lib/libbsddialog.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/contrib/bsddialog/lib/libbsddialog.c b/contrib/bsddialog/lib/libbsddialog.c index aea3b152adfd..ed4001382e31 100644 --- a/contrib/bsddialog/lib/libbsddialog.c +++ b/contrib/bsddialog/lib/libbsddialog.c @@ -57,11 +57,12 @@ extern struct bsddialog_theme t; int bsddialog_init(void) { int i, j, c, error; + enum bsddialog_default_theme theme; set_error_string(""); - if(initscr() == NULL) - RETURN_ERROR("Cannot init ncurses (initscr)"); + if (initscr() == NULL) + RETURN_ERROR("Cannot init curses (initscr)"); error = OK; error += keypad(stdscr, TRUE); @@ -69,9 +70,9 @@ int bsddialog_init(void) error += cbreak(); error += noecho(); curs_set(0); - if(error != OK) { + if (error != OK) { bsddialog_end(); - RETURN_ERROR("Cannot init ncurses (keypad and cursor)"); + RETURN_ERROR("Cannot init curses (keypad and cursor)"); } c = 1; @@ -81,12 +82,13 @@ int bsddialog_init(void) error += init_pair(c, i, j); c++; } - if(error != OK) { - bsddialog_end(); - RETURN_ERROR("Cannot init ncurses (colors)"); - } - if (bsddialog_set_default_theme(BSDDIALOG_THEME_DEFAULT) != 0) { + if (error == OK) + theme = BSDDIALOG_THEME_DEFAULT; + else + theme = BSDDIALOG_THEME_BLACKWHITE; + + if (bsddialog_set_default_theme(theme) != 0) { bsddialog_end(); return (BSDDIALOG_ERROR); }