diff options
| author | Alan Somers <asomers@FreeBSD.org> | 2023-01-13 20:19:03 +0000 |
|---|---|---|
| committer | Alan Somers <asomers@FreeBSD.org> | 2023-01-27 19:30:53 +0000 |
| commit | 0811d18fea9177b8c378d9d28ea34d6d3c81a5f6 (patch) | |
| tree | d2d5fee4e8ef13560c926c9799230eb48cdf5ec5 | |
| parent | 8b7b81fd64ec054e6cbe0f1a817bad44aa355669 (diff) | |
| download | src-0811d18fea9177b8c378d9d28ea34d6d3c81a5f6.tar.gz src-0811d18fea9177b8c378d9d28ea34d6d3c81a5f6.zip | |
cal: don't print terminal control characters unless stdout is a TTY
A similar change was made in svn r223931, but it was incomplete, working
only when the utility was invoked as "ncal". Fix the same issue when
invoking as "cal".
PR: 268936
Reported by: Ray Bellis <ray@bellis.me.uk>
Sponsored by: Axcient
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D38045
(cherry picked from commit 92e978439f0c3139775ad96d412959f5a74b17b6)
| -rw-r--r-- | usr.bin/ncal/ncal.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/ncal/ncal.c b/usr.bin/ncal/ncal.c index 3f0df22e37fc..641c59f71e10 100644 --- a/usr.bin/ncal/ncal.c +++ b/usr.bin/ncal/ncal.c @@ -930,7 +930,8 @@ mkmonthb(int y, int m, int jd_flag, struct monthlines *mlines) dt.d = j - jan1 + 1; else sdateb(j, &dt); - if (j == highlightdate && !flag_nohighlight) + if (j == highlightdate && !flag_nohighlight + && isatty(STDOUT_FILENO)) highlight(mlines->lines[i] + k, ds + dt.d * dw, dw, &l); else |
