From owner-freebsd-arch Mon Jul 3 3:14:33 2000 Delivered-To: freebsd-arch@freebsd.org Received: from dorifer.heim3.tu-clausthal.de (dorifer.heim3.tu-clausthal.de [139.174.243.252]) by hub.freebsd.org (Postfix) with ESMTP id 86A2B37BEAA for ; Mon, 3 Jul 2000 03:14:28 -0700 (PDT) (envelope-from olli@dorifer.heim3.tu-clausthal.de) Received: (from olli@localhost) by dorifer.heim3.tu-clausthal.de (8.9.3/8.9.3) id MAA60328; Mon, 3 Jul 2000 12:14:26 +0200 (CEST) (envelope-from olli) Date: Mon, 3 Jul 2000 12:14:26 +0200 (CEST) Message-Id: <200007031014.MAA60328@dorifer.heim3.tu-clausthal.de> From: Oliver Fromme To: freebsd-arch@FreeBSD.ORG Reply-To: freebsd-arch@FreeBSD.ORG Subject: Re: truncate(1) implementation details X-Newsgroups: list.freebsd-arch In-Reply-To: <8jpj8m$27nt$1@atlantis.rz.tu-clausthal.de> Organization: Administration TU Clausthal MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: tin/1.4.1-19991201 ("Polish") (UNIX) (FreeBSD/3.4-19991219-STABLE (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In list.freebsd-arch Sheldon Hearn wrote: > I'm looking through Alexander Langer's truncate(1) with a view to > importing it shortly. Ah. I was considering to submit my own truncate(1) which I've written long time ago. Not needed anymore, it seems. :-) > I raised some issues with Alexander and he responded with the message > below. The issue I'd like feedback on is whether or not truncate(1) > should create files given on the command-line when those files do not > exist at the time of invocation. My implementation of truncate(1) doesn't create files either, because I think it's part of the Unix philosophy to have many simple tools, each for their specific job. The strenght of Unix comes from combining those tools. And we already have touch(1). Furthermore, I wouldn't expect a tool called "truncate" to create a file if it doesn't exist. I'd rather expect it to exit with EX_NOINPUT. It's just the same as "chmod" and similar tools -- those don't create files either (and they don't have an option to do so), but they work on existing files, because that's their job. By the way, does Alexander's implementation handle negative numbers as well (meaning the numbers of bytes to strip from the end of the file)? If not, I'd like to submit a patch for this, as I've found that feature to be extremely useful (e.g. ``truncate -128 foo.mp3'' to strip ID3 junk from mp3 files). Regards Oliver -- Oliver Fromme, Leibnizstr. 18/61, 38678 Clausthal, Germany (Info: finger userinfo:olli@dorifer.heim3.tu-clausthal.de) "In jedem Stück Kohle wartet ein Diamant auf seine Geburt" (Terry Pratchett) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message