]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - io/truncate.c
a74b6131ede3f38cc9f1b8bc9a23ebe527f56aba
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2003-2005 Silicon Graphics, Inc.
12 static cmdinfo_t truncate_cmd
;
20 size_t blocksize
, sectsize
;
22 init_cvtnum(&blocksize
, §size
);
23 offset
= cvtnum(blocksize
, sectsize
, argv
[1]);
25 printf(_("non-numeric truncate argument -- %s\n"), argv
[1]);
30 if (ftruncate(file
->fd
, offset
) < 0) {
41 truncate_cmd
.name
= "truncate";
42 truncate_cmd
.altname
= "t";
43 truncate_cmd
.cfunc
= truncate_f
;
44 truncate_cmd
.argmin
= 1;
45 truncate_cmd
.argmax
= 1;
46 truncate_cmd
.flags
= CMD_NOMAP_OK
| CMD_FOREIGN_OK
;
47 truncate_cmd
.args
= _("off");
48 truncate_cmd
.oneline
=
49 _("truncates the current file at the given offset");
51 add_command(&truncate_cmd
);