From owner-svn-src-all@FreeBSD.ORG Mon Jul 11 10:41:09 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 550101065674; Mon, 11 Jul 2011 10:41:09 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 459738FC1D; Mon, 11 Jul 2011 10:41:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6BAf9AG086660; Mon, 11 Jul 2011 10:41:09 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6BAf9Vp086657; Mon, 11 Jul 2011 10:41:09 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201107111041.p6BAf9Vp086657@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 11 Jul 2011 10:41:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r223931 - head/usr.bin/ncal X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2011 10:41:09 -0000 Author: edwin Date: Mon Jul 11 10:41:08 2011 New Revision: 223931 URL: http://svn.freebsd.org/changeset/base/223931 Log: 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. PR: bin/158580 MFC after: 1 week Modified: head/usr.bin/ncal/ncal.1 head/usr.bin/ncal/ncal.c Modified: head/usr.bin/ncal/ncal.1 ============================================================================== --- head/usr.bin/ncal/ncal.1 Mon Jul 11 10:02:27 2011 (r223930) +++ head/usr.bin/ncal/ncal.1 Mon Jul 11 10:41:08 2011 (r223931) @@ -171,6 +171,8 @@ that, two after that and the whole year. will warn about these combinations. .Pp A year starts on January 1. +.P +Highlighting of dates is disabled if stdout is not a tty. .Sh SEE ALSO .Xr calendar 3 , .Xr strftime 3 Modified: head/usr.bin/ncal/ncal.c ============================================================================== --- head/usr.bin/ncal/ncal.c Mon Jul 11 10:02:27 2011 (r223930) +++ head/usr.bin/ncal/ncal.c Mon Jul 11 10:41:08 2011 (r223931) @@ -822,7 +822,8 @@ mkmonthr(int y, int m, int jd_flag, stru 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