Date: Mon, 3 Jul 2000 12:14:26 +0200 (CEST) From: Oliver Fromme <olli@dorifer.heim3.tu-clausthal.de> To: freebsd-arch@FreeBSD.ORG Subject: Re: truncate(1) implementation details Message-ID: <200007031014.MAA60328@dorifer.heim3.tu-clausthal.de> In-Reply-To: <8jpj8m$27nt$1@atlantis.rz.tu-clausthal.de>
next in thread | previous in thread | raw e-mail | index | archive | help
In list.freebsd-arch Sheldon Hearn <sheldonh@uunet.co.za> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200007031014.MAA60328>