From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 4816 invoked from network); 2 Feb 2021 22:12:01 -0000 Received: from 1ess.inri.net (216.126.196.35) by inbox.vuxu.org with ESMTPUTF8; 2 Feb 2021 22:12:01 -0000 Received: from orthanc.ca ([208.79.93.154]) by 1ess; Tue Feb 2 17:06:40 -0500 2021 Received: from orthanc.ca (localhost [127.0.0.1]) by orthanc.ca (OpenSMTPD) with ESMTP id 73c49a37; Tue, 2 Feb 2021 14:06:37 -0800 (PST) From: Lyndon Nerenberg To: 9front@9front.org, Steve Simon In-reply-to: References: <606D02A096CBB28137E68175AE4EB31D@hog> Comments: In-reply-to Steve Simon message dated "Tue, 02 Feb 2021 19:56:44 +0000." MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <35354.1612303548.0@orthanc.ca> Date: Tue, 02 Feb 2021 14:06:37 -0800 Message-ID: <1efc0fc214467d1e@orthanc.ca> List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: immutable database shader polling controller Subject: Re: [9front] patch ssh.c extract window resolution Reply-To: 9front@9front.org Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <35354.1612303548.1@orthanc.ca> > this means the environment variables ssh expects from vt dont exist. as = a re=3D > sult some unix apps like ls and man don=3DE2=3D80=3D99t format their out= put correc=3D > tly. this patch allows them to work as expected In my UNIX .env (only sourced for "interactive" shells), if $TERM is unset I set TERM=3Ddumb, PAGER=3D'col -b', and EDITOR=3Ded. That seems to get around most of the terminal-related issues. And if you need more than 80 columns of output, setting cols via stty(1) will take care of that for programs that pay attention. I also have a tiny UNIX program that prints column rulers, to help with this sort of thing. --lyndon ------- =_aaaaaaaaaa0 Content-Type: multipart/mixed; boundary="upas-awuzbsyoozolyatgpmesjkgqyb" Content-Disposition: inline This is a multi-part message in MIME format. --upas-awuzbsyoozolyatgpmesjkgqyb Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit from postmaster@1ess: The following attachment had content that we can't prove to be harmless. To avoid possible automatic execution, we changed the content headers. The original header was: Content-Type: text/x-c; name="ruler.c"; charset="us-ascii" Content-Description: ruler.c Content-Disposition: attachment; filename="ruler.c" Content-Transfer-Encoding: quoted-printable --upas-awuzbsyoozolyatgpmesjkgqyb Content-Type: application/octet-stream Content-Disposition: attachment; filename="ruler.c.suspect" Content-Transfer-Encoding: quoted-printable /* ruler [cols] -- print a column-count ruler */ #include #include #include #include int main (int argc, char **argv) { int cols, rows, i, j, skip; char *buf, *p; cols =3D -1; if (argc > 1) { cols =3D atoi(argv[1]); if (cols =3D=3D 0) exit(1); } if (cols =3D=3D -1) { struct winsize ws; if (ioctl(0, TIOCGWINSZ, &ws) =3D=3D -1) exit(1); if (ws.ws_col > 0) cols =3D ws.ws_col; } if (cols <=3D 0) cols =3D 80; = buf =3D malloc(cols + 1); if (buf =3D=3D NULL) { fprintf(stderr, "out of memory"); exit(1); } rows =3D log10(cols); for (i =3D rows; i >=3D 0 ; i--) { skip =3D pow(10, i); p =3D buf; for (j =3D 1; j <=3D cols; j++) { if (j % skip) *p++ =3D ' '; else sprintf(p++, "%d", (j / skip) % 10); } buf[cols] =3D '\0'; printf("%s\n", buf); } exit(0); } --upas-awuzbsyoozolyatgpmesjkgqyb--