Jilles Tjoelker
fc96358cdd
truncate: Detect integer overflow, fix relative sizes, add tests.
...
The change to expand_number (r204654) broke detection of too large sizes and
relative sizes ('+'/'-').
Also add some tests.
PR: 190735
Submitted by: Kirk Russell
MFC after: 1 week
2014-06-09 10:39:55 +00:00
Maxim Sobolev
32bdc2b685
Use expand_number(3) from libutil instead of home-grown function to parse
...
human-friendly power-of-two numbers (i.e. 2k, 5M etc).
Suggested by: many
MFC after: 1 week
2010-03-03 19:25:28 +00:00
Xin LI
614595dcc7
Initialize 'sz' as 0.
2009-02-21 03:42:31 +00:00
Colin Percival
d59e8ae886
Don't close file descriptor number <whatever random garbage was on the
...
stack>.
Found by: LLVM/Clang Static Checker
MFC after: 1 week
2008-08-04 06:48:54 +00:00
Ruslan Ermilov
5eccbe45a7
The -r option can also cause the files to be extended (not
...
necessarily truncated).
2006-12-19 11:20:34 +00:00
Ruslan Ermilov
cb29445a92
Markup fixes.
2006-09-29 15:20:48 +00:00
Maxim Konovalov
a39846b5e4
o Don't leak fd on error.
...
o parselength() returns 0 or -1 so int is enough for its return type.
Submitted by: Ighighi Ighighi, sheldonh
MFC after: 3 weeks
2006-09-18 16:39:23 +00:00
Ceri Davies
0033dba88b
Chase revision 1.10 in usage string and a comment.
2006-09-07 17:10:26 +00:00
Pawel Jakub Dawidek
e6f3621dd3
Allow to specify size in terabytes by using T or t suffix.
...
This speeds up my testing a bit. Because truncate(1) doesn't allocate
blocks on file system before they are used, it is very useful to
emulate huge file systems:
# truncate -s 16T fs.img
# mdconfig -a -f fs.img
# newfs /dev/mdX
(-t swap can be used as well)
2006-04-09 19:16:24 +00:00
Ruslan Ermilov
f682f10c76
Sync program's usage() with manpage's SYNOPSIS.
2005-05-21 09:55:10 +00:00
Ruslan Ermilov
a866e17077
Added the EXIT STATUS section where appropriate.
2005-01-17 07:44:44 +00:00
Lukas Ertl
6b61c155e6
Make size suffix case insensitive.
...
PR: bin/27604
Submitted by: David Xu <davidx@viasoft.com.cn>
2004-07-22 13:38:10 +00:00
Warner Losh
3f330d7d1a
remove __P
2002-03-22 01:42:45 +00:00
Mark Murray
131f7ce586
Remove WARNS?=2 and -Wall. WARNS?=2 is going to be the default.
2001-12-12 00:06:52 +00:00
Sheldon Hearn
d1050cb33c
* Update author's e-mail address.
...
* When the author of an utility also wrote its manual page (a rarety, I
know), it is not necessary to say that the utility "and this manual
page" were written by the author.
2001-08-16 08:40:54 +00:00
Sheldon Hearn
b63c01391e
Use the .Cm macro to mark up the modifiers of the -s flag's size argument.
2001-08-16 08:19:09 +00:00
Ruslan Ermilov
d628d776c4
mdoc(7) police: utilize the new .Ex macro.
2001-08-15 09:09:47 +00:00
Dima Dorfman
f247324df7
Remove whitespace at EOL.
2001-07-15 08:06:20 +00:00
Dima Dorfman
f6751868e4
Set WARNS=2 on programs that compile cleanly with it; add $FreeBSD$
...
where necessary.
Submitted by: Mike Barcroft <mike@q9media.com>
2001-06-30 05:39:36 +00:00
Ruslan Ermilov
d7b336c076
mdoc(7) police: use canonical form of .Dd macro.
2000-12-11 15:47:53 +00:00
Ruslan Ermilov
8fe908ef0c
mdoc(7) police: use the new features of the Nm macro.
2000-11-20 19:21:22 +00:00
Sheldon Hearn
e62d73a2a1
Merge the truncate(1) utility onto the RELENG_4 branch and adjust
...
the HISTORY section to reflect the first release of FreeBSD in
which this utility will appear.
2000-08-04 08:05:52 +00:00
Sheldon Hearn
b86e825a0c
Simplify some conditionals.
2000-07-24 21:50:38 +00:00
Sheldon Hearn
dee82c612a
Shut an optimizing compiler up about possibly (but never) unused
...
variables.
Submitted by: charnier
2000-07-24 21:46:12 +00:00
Sheldon Hearn
6b88e76b89
truncate.c:
...
Do not include unused header files.
Add rcsid.
Change copyright.
truncate.1:
Add AUTHORS section.
Submitted by: charnier
2000-07-24 08:56:42 +00:00
Sheldon Hearn
4d532a362e
Close file descriptors after use so as not to abuse the descriptor
...
table when a long argument list is given. :-)
Reported by: Sven Agnew <afterhours80@hotmail.com>
2000-07-23 13:24:01 +00:00
Sheldon Hearn
75bc7bff6e
Add a STANDARDS section to discourage the use of this utility
...
in environments where portability is a concern.
2000-07-21 13:05:15 +00:00
Sheldon Hearn
edeb84a1b2
Import the new truncate(1) utility.
...
Approved by: jdp
2000-07-18 17:03:58 +00:00