From owner-freebsd-bugs@FreeBSD.ORG Fri Jul 1 21:20:10 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 897A91065670 for ; Fri, 1 Jul 2011 21:20:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 5A5168FC12 for ; Fri, 1 Jul 2011 21:20:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p61LKA4k011603 for ; Fri, 1 Jul 2011 21:20:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p61LKAks011602; Fri, 1 Jul 2011 21:20:10 GMT (envelope-from gnats) Resent-Date: Fri, 1 Jul 2011 21:20:10 GMT Resent-Message-Id: <201107012120.p61LKAks011602@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Tobias Rehbein Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EEEE0106566C for ; Fri, 1 Jul 2011 21:18:03 +0000 (UTC) (envelope-from tobias.rehbein@web.de) Received: from fmmailgate02.web.de (fmmailgate02.web.de [217.72.192.227]) by mx1.freebsd.org (Postfix) with ESMTP id 81F1E8FC12 for ; Fri, 1 Jul 2011 21:18:03 +0000 (UTC) Received: from smtp03.web.de ( [172.20.0.65]) by fmmailgate02.web.de (Postfix) with ESMTP id 7C7091A40A6CA for ; Fri, 1 Jul 2011 23:18:02 +0200 (CEST) Received: from [78.46.73.134] (helo=sushi.pseudo.local) by smtp03.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #2) id 1Qcl6A-00032p-00 for FreeBSD-gnats-submit@freebsd.org; Fri, 01 Jul 2011 23:18:02 +0200 Received: from sushi.pseudo.local (localhost [127.0.0.1]) by sushi.pseudo.local (8.14.4/8.14.4) with ESMTP id p61LI0nP029653 for ; Fri, 1 Jul 2011 23:18:01 +0200 (CEST) (envelope-from tobi@sushi.pseudo.local) Received: (from tobi@localhost) by sushi.pseudo.local (8.14.4/8.14.4/Submit) id p61LI02m029652; Fri, 1 Jul 2011 23:18:00 +0200 (CEST) (envelope-from tobi) Message-Id: <201107012118.p61LI02m029652@sushi.pseudo.local> Date: Fri, 1 Jul 2011 23:18:00 +0200 (CEST) From: Tobias Rehbein Sender: tobias.rehbein@web.de To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/158580: [patch] Disable ncal(1)s date highlighting if stdout is not a tty X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Tobias Rehbein List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2011 21:20:10 -0000 >Number: 158580 >Category: bin >Synopsis: [patch] Disable ncal(1)s date highlighting if stdout is not a tty >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Jul 01 21:20:09 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Tobias Rehbein >Release: FreeBSD 8.2-RELEASE-p2 i386 >Organization: >Environment: System: FreeBSD sushi.pseudo.local 8.2-RELEASE-p2 FreeBSD 8.2-RELEASE-p2 #4: Thu Jun 2 16:42:39 CEST 2011 tobi@sushi.pseudo.local:/usr/obj/usr/src/sys/SUSHI i386 >Description: ncal(1) highlights the current date (or a date provided via parameter) even if stdout is not a tty. If stdout is not a tty the data is normally processed by other tools and no control sequences are expected. The attached patch disables the higlighting of dates if stdout is not a tty which seems to be "the right thing to do". >How-To-Repeat: >Fix: --- usr.bin-ncal_conditional-highlight.diff begins here --- diff -ruN usr.bin/ncal.orig/ncal.1 usr.bin/ncal/ncal.1 --- usr.bin/ncal.orig/ncal.1 2011-07-01 22:37:47.000000000 +0200 +++ usr.bin/ncal/ncal.1 2011-07-01 22:36:58.000000000 +0200 @@ -171,6 +171,8 @@ will warn about these combinations. .Pp A year starts on January 1. +.Pp +Highlighting of dates is diabled if stdout is not a tty. .Sh SEE ALSO .Xr calendar 3 , .Xr strftime 3 diff -ruN usr.bin/ncal.orig/ncal.c usr.bin/ncal/ncal.c --- usr.bin/ncal.orig/ncal.c 2011-07-01 22:37:47.000000000 +0200 +++ usr.bin/ncal/ncal.c 2011-07-01 22:34:26.000000000 +0200 @@ -822,7 +822,7 @@ dt.d = j - jan1 + 1; else sdater(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 --- usr.bin-ncal_conditional-highlight.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: