From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on sa.int.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.5 Date: Mon, 18 May 2009 20:00:13 +0200 From: Michael Schutte To: kbd@lists.altlinux.org, 528357@bugs.debian.org, Jakub Wilk Message-ID: <20090518180013.GA29833@graeme> Mail-Followup-To: kbd@lists.altlinux.org, 528357@bugs.debian.org, Jakub Wilk References: <20090512115626.GA7660@cavendish.icomputing.pl> <20090516155022.GA10925@graeme> <20090516162709.GA3212@cavendish.icomputing.pl> <20090516191525.GA23674@graeme> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ZfOjI3PrQbgiZnxM" Content-Disposition: inline In-Reply-To: <20090516191525.GA23674@graeme> Jabber-ID: schm@yne.at User-Agent: Mutt/1.5.17 (2007-11-01) Subject: Re: [kbd] Bug#528357: /usr/bin/showconsolefont: produces garbage X-BeenThere: kbd@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Linux console tools development discussion List-Id: Linux console tools development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 May 2009 18:00:32 -0000 Archived-At: List-Archive: --ZfOjI3PrQbgiZnxM Content-Type: multipart/mixed; boundary="EeQfGwPcQSOJBaQU" Content-Disposition: inline --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable tag 528357 + patch thanks On Sat, May 16, 2009 at 09:15:25PM +0200, Michael Schutte wrote: > One way to solve this would be to check which mode the VT is in and then > using the appropriate way to print spaces. The attached patch uses this approach. --=20 Michael Schutte --EeQfGwPcQSOJBaQU Content-Type: text/x-diff; charset=utf-8 Content-Description: 528357.patch Content-Disposition: attachment; filename="0001-showconsolefont-Print-adequate-space-chars.patch" Content-Transfer-Encoding: quoted-printable =46rom 8c30fa09c9738b6b3605d94d681cee5e5ca2b371 Mon Sep 17 00:00:00 2001 =46rom: Michael Schutte Date: Mon, 18 May 2009 19:47:00 +0200 Subject: [PATCH] showconsolefont: Print adequate space chars MIME-Version: 1.0 Content-Type: text/plain; charset=3Dutf-8 Content-Transfer-Encoding: 8bit Figure out whether the console is in Unicode or XLATE mode to decide whether to use a direct-to-font (U+F020) or a simple ASCII space character, respectively. This avoids showconsolefont=E2=80=99s output beco= ming a mess, cf. . Signed-off-by: Michael Schutte --- src/showconsolefont.c | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/showconsolefont.c b/src/showconsolefont.c index c0b58d6..733e634 100644 --- a/src/showconsolefont.c +++ b/src/showconsolefont.c @@ -116,7 +116,8 @@ usage(void) { int main (int argc, char **argv) { int c, n, cols, rows, nr, i, j, k; - char *sep, *console =3D NULL; + int mode; + char *space, *sep, *console =3D NULL; int list[64], lth, info =3D 0, verbose =3D 0; =20 set_progname(argv[0]); @@ -148,6 +149,17 @@ main (int argc, char **argv) { if (optind !=3D argc) usage(); =20 + fd =3D getfd(console); + + if (ioctl(fd, KDGKBMODE, &mode)) { + perror("KDGKBMODE"); + leave(1); + } + if (mode =3D=3D K_UNICODE) + space =3D "\xef\x80\xa0"; /* U+F020 (direct-to-font space) */ + else + space =3D " "; + if (info) { nr =3D rows =3D cols =3D 0; n =3D getfont(fd, NULL, &nr, &rows, &cols); @@ -164,8 +176,6 @@ main (int argc, char **argv) { leave(0); } =20 - fd =3D getfd(console); - settrivialscreenmap(); getoldunicodemap(); =20 @@ -175,7 +185,7 @@ main (int argc, char **argv) { cols =3D ((n > 256) ? 32 : 16); nr =3D 64/cols; rows =3D (n+cols-1)/cols; - sep =3D ((cols =3D=3D 16) ? " " : " "); + sep =3D ((cols =3D=3D 16) ? "%1$s%1$s" : "%1$s"); =20 for (i=3D0; i