From owner-freebsd-current@FreeBSD.ORG Fri Aug 25 19:17:35 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 46A9916A4DA; Fri, 25 Aug 2006 19:17:35 +0000 (UTC) (envelope-from prvs=julian=38535a252@elischer.org) Received: from a50.ironport.com (a50.ironport.com [63.251.108.112]) by mx1.FreeBSD.org (Postfix) with ESMTP id E137243D49; Fri, 25 Aug 2006 19:17:34 +0000 (GMT) (envelope-from prvs=julian=38535a252@elischer.org) Received: from unknown (HELO [192.168.2.6]) ([10.251.60.50]) by a50.ironport.com with ESMTP; 25 Aug 2006 12:17:29 -0700 Message-ID: <44EF4CC9.7020909@elischer.org> Date: Fri, 25 Aug 2006 12:17:29 -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: John Baldwin References: <200608181445.k7IEjA9f020038@lurza.secnetix.de> <200608251003.28528.jhb@freebsd.org> In-Reply-To: <200608251003.28528.jhb@freebsd.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org, Oliver Fromme 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, 25 Aug 2006 19:17:35 -0000 John Baldwin wrote: >On Friday 18 August 2006 10:45, Oliver Fromme wrote: > > >>Julian Elischer wrote: >> > BTW I chose 's' without any research.. Date only has the short getopt so >> > '--' doesn't work, but >> > there are lots of unsed letters.. a quick survey suggests maybe -p (pipe?) >> > (suggestions welcome) my favourites of s and f are already used on one >> > system or another. >> >>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. > > The trouble wih this is that the format string is interpretted by strftime() and not by date, so you would have to pre-parse the string which would be quite a bit of work. The size of the patch wold blow out from the current 20 lines (or less) to many more.