Subject: Re: Suggestion: inclusion of the truncate(1) utility into the tree
To: Alexander Langer <alex@FreeBSD.ORG>
From: Matthew Orgass <firstname.lastname@example.org>
Date: 07/22/2000 12:41:03
On Sat, 22 Jul 2000, Alexander Langer wrote:
> Thus spake Jason R Thorpe (email@example.com):
> > Oh, puhleeze! perl is far from necessary to do many of thing things
> > its used for in `base distributions'.
> No, it provides some functionality, sed, awk and the other tools
> cannot give.
Such as truncate :). However, those of us with hpc machines are glad
that NetBSD does not rely on perl in the base distribution.
I think there should a truncate(1), however the proposed version is the
wrong implementation because:
1) truncate(2) is not general enough. This should be fixed *before* a
utility to use it is created.
2) truncate(1) should not create the file by default.
3) Even when doing file relative truncate you should be able to specify an
additional relative size.
4) "truncate file" should mean truncate to zero.
I would prefer:
truncate [-c] [-r rfile] file [[+|-]size[K|M|G]]
truncate file offset[K|M|G] [+|-]offset[K|M|G]
Where -c means create if not existing and - is the default when size is
given with -r and without + or -. The second form would need to be
supported by a new syscall, say rtruncate(const char *path, off_t start,
off_t end) and the corresponding frtruncate.