Date: Mon, 03 Jul 2000 13:41:55 -0700 From: Doug Barton <DougB@gorean.org> To: Sheldon Hearn <sheldonh@uunet.co.za> Cc: Ben Smithurst <ben@scientia.demon.co.uk>, arch@FreeBSD.ORG Subject: Re: truncate(1) implementation details Message-ID: <3960FA93.4AE5B9EE@gorean.org> References: <32476.962635052@axl.ops.uunet.co.za>
next in thread | previous in thread | raw e-mail | index | archive | help
Sheldon Hearn wrote:
>
> On Mon, 03 Jul 2000 14:37:16 +0100, Ben Smithurst wrote:
>
> > I agree with alex that it should create files iff -c (or something)
> > is given on the command line, and the default should be NOT to create
> > anything.
>
> Cool. That seems to be agreed all around.
Errr.. no. I agree that truncate(1) should be consistent with
truncate(2). Rod also made the excellent point that -c means exactly the
opposite in touch than you are proposing here. Even in a script,
[ truncate foo ] || touch foo
is not that hard to write.
> So we've got:
>
> truncate [-cv] [+|-]size file [...]
> -c Create files as necessary
> -v Warn about attempts to truncate below zero bytes
>
> where + and - turn the size argument into a delta to be applied, rather
> than an absolute size.
Assuming that 'truncate 1024 foo' turns foo into a file with 1024 bytes
in the absence of any +/- signs, I don't see anything wrong with the
addition of the "delta" business. I'm also assuming that the -v option
is only relevant in the presence of the - sign, yes?
Doug
--
"Live free or die"
- State motto of my ancestral homeland, New Hampshire
Do YOU Yahoo!?
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?3960FA93.4AE5B9EE>
