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.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 30958 invoked from network); 19 Jun 2021 05:34:11 -0000 Received: from 1ess.inri.net (216.126.196.35) by inbox.vuxu.org with ESMTPUTF8; 19 Jun 2021 05:34:11 -0000 Received: from mail.9lab.org ([168.119.8.41]) by 1ess; Fri Jun 18 18:48:01 -0400 2021 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9lab.org; s=20210803; t=1624055680; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CssgFhOuK95Bf+HRMJaTNfyGSBFypiOrQvvYGTlukC4=; b=MlXGC+60Pm62nZ2g4+pWQkmbiJx5+bCkT1+pfsbnJYHmvtk0l9luPNVbd/Ini9pJKM0OXa WZSLblu6n7Oy33HPzLuD6J1ZCCmFpOvbfanPGIERgXoZeCLpc4tTxL9qfePzNJcqJdRIqv DH8iZCohgDIWCSdIUUkUlao5w8UW8sE= Received: from pjw (host-185-64-155-70.ecsnet.at [185.64.155.70]) by mail.9lab.org (OpenSMTPD) with ESMTPSA id 93a7a35e (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO); Sat, 19 Jun 2021 00:34:39 +0200 (CEST) Message-ID: <4813B9A38B4F2483B8CEB8EC70C9CA96@9lab.org> To: 9front@9front.org CC: igor@9lab.org Date: Sat, 19 Jun 2021 00:34:06 +0200 From: igor@9lab.org MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: structured SQL over YAML injection just-in-time backend Subject: [9front] cmd/cal: fix days of week alignment for year view (patch) Reply-To: 9front@9front.org Precedence: bulk Inline below is a patch fixing the alignment of the rows printing days of the week when viewing the whole year. term% cal -s1 2021 2021 Jan Feb Mar M Tu W Th F Sa Su M Tu W Th F Sa Su M Tu W Th F Sa Su 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5 6 7 4 5 6 7 8 9 10 8 9 10 11 12 13 14 8 9 10 11 12 13 14 11 12 13 14 15 16 17 15 16 17 18 19 20 21 15 16 17 18 19 20 21 18 19 20 21 22 23 24 22 23 24 25 26 27 28 22 23 24 25 26 27 28 25 26 27 28 29 30 31 29 30 31 … Note how the days (i.e. ' M Tu W Th F Sa Su') for Feb and Mar do not align with the day numbers. This is because an extra space is left *before* adding the terminating '\0' via the pointer `dayw`. With the patch applied the calendar aligns nicely for the year view: term% cal -s1 2021 2021 Jan Feb Mar M Tu W Th F Sa Su M Tu W Th F Sa Su M Tu W Th F Sa Su 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5 6 7 4 5 6 7 8 9 10 8 9 10 11 12 13 14 8 9 10 11 12 13 14 11 12 13 14 15 16 17 15 16 17 18 19 20 21 15 16 17 18 19 20 21 18 19 20 21 22 23 24 22 23 24 25 26 27 28 22 23 24 25 26 27 28 25 26 27 28 29 30 31 29 30 31 … Patch: term% git/diff /sys/src/cmd/cal.c --- //.git/fs/object/b3215c807556cdaaa0f949f1fb3f97c484ffd1da/tree//sys/src/cmd/cal.c +++ /sys/src/cmd/cal.c @@ -60,7 +60,7 @@ Binit(&bout, 1, OWRITE); dayw = dayws + 3*wstart; - dayw[3*7] = '\0'; + dayw[(3*7)-1] = '\0'; /* * no arg, print current month