History log of /freebsd-head/usr.bin/truncate/truncate.c
Revision Date Author Comments
9452bfa342eccbb771edadc69be3f4d4a9bcfc09 29-Jul-2018 eadler <eadler@FreeBSD.org> truncate: delintify
c2c13092ebc2ddfd1ac7dfc05c0794c4955b7d0e 29-Jul-2018 eadler <eadler@FreeBSD.org> truncate: use better type for 'round'
76772b9dc37e4b19c6774e8501386d34a9d4438c 09-Jul-2018 manu <manu@FreeBSD.org> truncate: Add support for -s % and /

% round up to the multiple size and / round down
This is compatible with gnu truncate.
Add tests and document in the man page.
930c5c942c1ba595249b65d8f9830605be097fe0 09-Jul-2018 manu <manu@FreeBSD.org> truncate: style(9) some parts
7551d83c353e040b32c6ac205e577dbc5f2c8955 27-Nov-2017 pfg <pfg@FreeBSD.org> various: general adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
00d578928eca75be320b36d37543a7e2a4f9fbdb 27-May-2016 grehan <grehan@FreeBSD.org> Create branch for bhyve graphics import.
26dad09e504647f7c89715ad31cf37b57a372e97 07-Dec-2014 jilles <jilles@FreeBSD.org> MFC r267265: 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.

The usr.bin/truncate/Makefile is slightly different in the MFC because
src.opts.mk does not exist in stable/10.

PR: 190735
Submitted by: Kirk Russell
f663e7e8d0d0f5e52e8ad7df469033c3e45da1ee 09-Jun-2014 jilles <jilles@FreeBSD.org> 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
eb1a5f8de9f7ea602c373a710f531abbf81141c4 21-Feb-2014 gjb <gjb@FreeBSD.org> Move ^/user/gjb/hacking/release-embedded up one directory, and remove
^/user/gjb/hacking since this is likely to be merged to head/ soon.

Sponsored by: The FreeBSD Foundation
6b01bbf146ab195243a8e7d43bb11f8835c76af8 27-Dec-2013 gjb <gjb@FreeBSD.org> Copy head@r259933 -> user/gjb/hacking/release-embedded for initial
inclusion of (at least) arm builds with the release.

Sponsored by: The FreeBSD Foundation
09f9c897d33c41618ada06fbbcf1a9b3812dee53 19-Oct-2010 jamie <jamie@FreeBSD.org> A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.
f1216d1f0ade038907195fc114b7e630623b402c 19-Mar-2010 delphij <delphij@FreeBSD.org> Create a custom branch where I will be able to do the merge.
8d2851aaa183c7a82819ef35816ab8ff778e5448 03-Mar-2010 sobomax <sobomax@FreeBSD.org> 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
a9845d8d05b87fe7067cadf2fcb2579d8b65e660 21-Feb-2009 delphij <delphij@FreeBSD.org> Initialize 'sz' as 0.
19b6af98ec71398e77874582eb84ec5310c7156f 22-Nov-2008 dfr <dfr@FreeBSD.org> Clone Kip's Xen on stable/6 tree so that I can work on improving FreeBSD/amd64
performance in Xen's HVM mode.
cf5320822f93810742e3d4a1ac8202db8482e633 19-Oct-2008 lulf <lulf@FreeBSD.org> - Import the HEAD csup code which is the basis for the cvsmode work.
3d73d62726d98c4aeaa9c06d1a4e2c60141ddea3 31-Aug-2008 cperciva <cperciva@FreeBSD.org> MFC r181279: Don't close file descriptor <whatever random gargage was on the
c2b17121d9de5c37c98a46696b4373695bbbc67b 30-Aug-2008 cperciva <cperciva@FreeBSD.org> MFC r181279: Don't close file descriptor <whatever random gargage was on the
16fd05844bbb7394ac778ed5a036553d6536c18b 04-Aug-2008 cperciva <cperciva@FreeBSD.org> Don't close file descriptor number <whatever random garbage was on the

Found by: LLVM/Clang Static Checker
MFC after: 1 week
c3620bcdb10ff37911b20ac96a19cb191681e2db 08-Oct-2006 maxim <maxim@FreeBSD.org> MFC rev. 1.12: don't leak fd on error, change parselength() prototype.

Approved by: re (kensmith)
874a6896031bbd128d669ec459ce5d358e2798cb 23-Sep-2006 ceri <ceri@FreeBSD.org> MFC:
src/usr.bin/truncate/truncate.1 r1.33
src/usr.bin/truncate/truncate.c r1.10 through r1.11

Approved by: re (hrs), pjd
3839b5384ddf1f9b95604f79429c842af6ee2a54 18-Sep-2006 maxim <maxim@FreeBSD.org> 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
1510e4aa4d382a842693caec932646e4c8fb1774 07-Sep-2006 ceri <ceri@FreeBSD.org> Chase revision 1.10 in usage string and a comment.
a6661f4c728b5c43df159bb1738d216d5527df92 09-Apr-2006 pjd <pjd@FreeBSD.org> 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)
0491ba1f6311b421efbea894a9c8c6c704b48cac 21-May-2005 ru <ru@FreeBSD.org> Sync program's usage() with manpage's SYNOPSIS.
8295db903869b2df8493758b549ce7a7ba1907eb 22-Jul-2004 le <le@FreeBSD.org> Make size suffix case insensitive.

PR: bin/27604
Submitted by: David Xu <davidx@viasoft.com.cn>
0b20191705a346bc322deac818912bd4eab96a1b 22-Mar-2002 imp <imp@FreeBSD.org> remove __P
fa8e7cc20713f567566a54aafd4a6a41a800d4eb 24-Jul-2000 sheldonh <sheldonh@FreeBSD.org> Simplify some conditionals.
1951291f8f92a47df03a630735e21c023e3ef3ea 24-Jul-2000 sheldonh <sheldonh@FreeBSD.org> Shut an optimizing compiler up about possibly (but never) unused

Submitted by: charnier
04a5c2bdc28764b20c1c640156c311a76bb26540 24-Jul-2000 sheldonh <sheldonh@FreeBSD.org> truncate.c:
Do not include unused header files.
Add rcsid.
Change copyright.

Add AUTHORS section.

Submitted by: charnier
2ae5c3dffce3ca0150eb28e8e2e79b27183490c4 23-Jul-2000 sheldonh <sheldonh@FreeBSD.org> 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>
5df055483d2201b685994082d68c1235a690c99a 18-Jul-2000 sheldonh <sheldonh@FreeBSD.org> Import the new truncate(1) utility.

Approved by: jdp