From owner-freebsd-current@FreeBSD.ORG Tue Sep 5 07:28: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 0B17B16A4E2 for ; Tue, 5 Sep 2006 07:28:35 +0000 (UTC) (envelope-from gad@FreeBSD.org) Received: from smtp8.server.rpi.edu (smtp8.server.rpi.edu [128.113.2.228]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4C77643D46 for ; Tue, 5 Sep 2006 07:28:26 +0000 (GMT) (envelope-from gad@FreeBSD.org) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp8.server.rpi.edu (8.13.1/8.13.1) with ESMTP id k857SML0029229; Tue, 5 Sep 2006 03:28:22 -0400 Mime-Version: 1.0 Message-Id: In-Reply-To: <20060904192006.GA3292@turion.vk2pj.dyndns.org> References: <200608281545.k7SFjn6l063922@lurza.secnetix.de> <200609020956.54008.Lucas.James@ldjcs.com.au> <20060902031247.GE749@turion.vk2pj.dyndns.org> <20060904192006.GA3292@turion.vk2pj.dyndns.org> To: Peter Jeremy , freebsd-current@FreeBSD.org From: Garance A Drosehn Content-Type: multipart/mixed; boundary="============_-1054681193==_============" X-CanItPRO-Stream: default X-RPI-SA-Score: undef - spam-scanning disabled X-Scanned-By: CanIt (www . canit . ca) Cc: Julian Elischer Subject: Adding a '-D date' option to `cat' 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: Tue, 05 Sep 2006 07:28:35 -0000 Date: Tue, 05 Sep 2006 07:28:35 -0000 X-Original-Date: Tue, 5 Sep 2006 03:28:21 -0400 X-List-Received-Date: Tue, 05 Sep 2006 07:28:35 -0000 --============_-1054681193==_============ Content-Type: text/plain; charset="us-ascii" ; format="flowed" In the thread on "Re: suggested addition to 'date'" on Sept 5/2006, Peter Jeremy wrote: >On Sat, 2006-Sep-02 13:12:48 +1000, I (Peter Jeremy) wrote: > > The justification for extending date(1) is that it already has the > > code to handle date/time stamps. In reality, this code is all in > > strftime(3) and cat(1) already has hooks to insert a string at the > > beginning of a line so I believe that the attached patch is more > > appropriate > >Following some off-list comments, I have updated the patch to >correct a bug, change the option character to 'D' (for date) and >provide a man page update. I have picked up Peter's patch, and spent some time testing it. About all I changed in the source file was to update the 'usage' message, and to use errx() instead of err() if the format is too long. The update increases the size of /bin/cat by 696 bytes on i386. The more I think about this option, the more I think it would be a useful option to have readily available. I am slightly tempted to move the call to time()+strftime() into a separate routine, and call that routine during the processing of options. That way, if some user *does* specify a format which is over 1024 bytes, they'll get an immediate error message. As it is, they won't see an error until `cat' actually goes to print the first line that it has read in. On the other hand, it seems pretty unlikely that many people will be triggering that error. I've also made a number of changes to the description Peter added to the man page, trying to include several more details. I am never happy with man pages that I write though, so I will not be insulted if anyone wants to change this. I intend to commit this within a few days, unless there are major objections to it. I am posting this HEADSUP under a new subject, so people can dump all kinds of paint over me before I commit it. -- Garance Alistair Drosehn = drosehn@rpi.edu Senior Systems Programmer or gad@FreeBSD.org Rensselaer Polytechnic Institute; Troy, NY; USA --============_-1054681193==_============ Content-Id: Content-Type: application/octet-stream; name="cat-date.diff" ; x-mac-type="00000000" ; x-mac-creator="00000000" Content-Disposition: attachment; filename="cat-date.diff" ; modification-date="Tue, 5 Sep 2006 03:02:57 -0400" Content-Transfer-Encoding: x-uuencode begin 644 cat-date.dif M26YD97@Z(&-A="XQ"CT]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T] M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T*4D-3(&9I;&4Z M("]H;VUE+VYC=G,O2!T:&4**RY.;0HK=71I;&ET>2X**U1H M92!F;W)M870@;V8@=&AA="!P2!AF-A="`Q("P*+2Y86QE+"!OPH@ E"0D):68@*&5F;&%G("8F('!U=&-H87(H)R0G*2`]/2!%3T8I"FED ` end --============_-1054681193==_============--