From owner-freebsd-current@FreeBSD.ORG Fri Sep 1 16:44:02 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 25A2516A4F1; Fri, 1 Sep 2006 16:44:02 +0000 (UTC) (envelope-from prvs=julian=392b3a9d5@elischer.org) Received: from a50.ironport.com (a50.ironport.com [63.251.108.112]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3D2E643DA4; Fri, 1 Sep 2006 16:43:33 +0000 (GMT) (envelope-from prvs=julian=392b3a9d5@elischer.org) Received: from unknown (HELO [192.168.2.3]) ([10.251.60.33]) by a50.ironport.com with ESMTP; 01 Sep 2006 09:43:34 -0700 Message-ID: <44F86335.70907@elischer.org> Date: Fri, 01 Sep 2006 09:43:33 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.13) Gecko/20060414 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Oliver Fromme References: <200608281545.k7SFjn6l063922@lurza.secnetix.de> In-Reply-To: <200608281545.k7SFjn6l063922@lurza.secnetix.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org Subject: Re: suggested addition to 'date' X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Sep 2006 16:44:02 -0000 Oliver Fromme wrote: >John Baldwin wrote: > > Oliver Fromme wrote: > > > There's another possibility, which doesn't require a new > > > option letter at all. You could add a new escape sequence > > > to the format string, e.g. "%*". Whenever date(1) is > > > called with a format string containing that sequence, it > > > goes into filter mode and replaces the sequence with the > > > current line. That would also enable you to be more > > > flexible with the placement of the timestamps. > > > For example: > > > > > > $ printf 'foo\nbar\nbaz\n' | date +'%H:%M:%S %*' > > > 16:39:58 foo > > > 16:39:58 bar > > > 16:39:58 baz > > > > I prefer this of all the suggestions so far. > >It's not very difficult, so I created a patch which does >exactly that (includes an addition for the manpage, too). >I've submitted it as bin/102609: > >http://www.freebsd.org/cgi/query-pr.cgi?pr=102609 > >Best regards > Oliver > > > A couple of comments: you don't need to run strftime for each line if the time hasn't changed. (My original patch checks this) What is the effective maximum line length for a single fgetln?