Commit Graph

27 Commits

Author SHA1 Message Date
Pedro F. Giffuni
074e77e66e fmt(1): for pointers use NULL instead of 0
While here clean excessive not lint comment indentation.
2016-04-13 01:57:06 +00:00
Pedro F. Giffuni
86aba0f293 fmt(1): reformat with indent(1).
Failed attempt to get nearer to style(9) and the format from the
original OpenBSD code. At least it should be readable now.

No functional change.
2016-04-13 01:46:48 +00:00
Xin LI
821df508e8 Revert most part of 200420 as requested, as more review and polish is
needed.
2009-12-13 03:14:06 +00:00
Xin LI
6f2d322192 Remove unneeded header includes from usr.bin/ except contributed code.
Tested with:	make universe
2009-12-11 23:35:38 +00:00
Juli Mallett
a2229407e5 Prevent strange crashes in fmt with absurd goal lengths introduced by the
support for wide characters.

If the sizeof (wchar_t) times max_length would yield a value beyond
representation in a size_t, exit with a usage error up front, rather than
strange errors down the line from trying to malloc (well, realloc) with a size
of 0.

This is perhaps not the optimal behaviour - a clamp may be more appropriate as
we clamp the value of max_length now anyway, but this is at least better than
segfaulting or worse.  On systems which are friendly to malloc with a value of 0
the results could end up being strange corruption of the output.
2007-10-17 11:41:40 +00:00
Tim J. Robbins
28d92b747e Add support for multibyte characters. 2004-08-02 11:10:20 +00:00
Tim J. Robbins
80209ec51c Avoid passing negative values to isspace() on systems with signed chars. 2004-07-15 08:27:04 +00:00
Tim J. Robbins
7bd73b069c Use warn() instead of perror(). 2004-07-15 04:45:24 +00:00
David E. O'Brien
e026a48c34 Consistently use FBSDID 2002-06-30 05:25:07 +00:00
Dag-Erling Smørgrav
d397408818 Usage style sweep: spell "usage" with a small 'u'.
Also change one case of blatant __progname abuse (several more remain)
This commit does not touch anything in src/{contrib,crypto,gnu}/.
2002-04-22 13:44:47 +00:00
Ruslan Ermilov
deba245176 Don't format lines that look like troff requests, for
compatibility with old fmt(1).  New option -n permits
formatting of lines beginning with a dot character.

PR:		bin/31392
MFC after:	3 days
2002-01-11 19:06:48 +00:00
Ruslan Ermilov
ccb8bea4f0 The old fmt(1) always did what the new ``-l 8'' option does.
POLA: Changed the default to ``-l 8'' while still providing
a way to disable this feature with ``-l 0''.

PR:		bin/29247
Reviewed by:	iedowse
2001-08-15 14:53:55 +00:00
Kris Kennaway
57c6bd978f Don't call errx() with a variable format string
MFC after:	1 week
2001-08-11 00:49:11 +00:00
Jonathan Lemon
84982751aa Cast size_t -> int to satisfy printf %* constraints on the alpha. 2001-06-16 06:22:09 +00:00
Ruslan Ermilov
1438aefc25 fmt(1) rewrite by Gareth McCaughan.
PR:		bin/5901, bin/12242, bin/19071
Submitted by:	Gareth McCaughan <gjm11@dpmms.cam.ac.uk>
Obtained from:	OpenBSD + ctype(3), WARNS=2, and manpage cleanup
MFC after:	2 weeks
2001-06-06 10:17:05 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Joerg Wunsch
9c61e1111e Fix a number of fixed-size buffers etc.
PR:		bin/4520
Submitted by:	gjm11@dpmms.cam.ac.uk (Gareth McCaughan)
1997-09-30 19:42:05 +00:00
Jonathan Lemon
dc3001cf35 Pre-allocate buffer to avoid core dump in corner cases.
PR:		2968
Submitted by:	Gareth McCaughan <gjm11@dpmms.cam.ac.uk>
1997-08-21 03:41:41 +00:00
Philippe Charnier
63ffb11347 Add rcsid, prototypes. Use err(3). 1997-07-03 07:19:46 +00:00
Bruce Evans
f4c1975c26 Removed inconsistent declaration of malloc(). `make world' with DESTDIR
set to something other than "/" now actually works.
1997-04-23 10:16:58 +00:00
Poul-Henning Kamp
3f8da92bc8 Add -c flag to fmt to center lines. 1996-09-10 19:50:23 +00:00
Sujal Patel
003aaef883 Fix a segfault which occurs when it gets an empty input line.
Closes PR bin/1153

Reviewed by:	smpatel
Submitted by:	Matthew C. Mead (mmead@Glock.COM)
1996-04-22 18:37:22 +00:00
Joerg Wunsch
e6c267f18c Dynamically allocate line buffers, instead of assuming that all the
world would fit into BUFSIZ.
1995-11-15 15:01:01 +00:00
Andrey A. Chernov
8bbd907273 Add setlocale LC_CTYPE 1995-10-24 06:15:05 +00:00
Rodney W. Grimes
7799f52a32 Remove trailing whitespace. 1995-05-30 06:41:30 +00:00
Andrey A. Chernov
d293af2d2e Make fmt ctype-aware
Fix non-critical bug with getting EOF double times
Not call strlen for zero length test
1995-05-11 21:32:35 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00