Commit Graph

27 Commits

Author SHA1 Message Date
pfg
5c3b3f706f 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
pfg
767e032691 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
delphij
0842b7d53f Revert most part of 200420 as requested, as more review and polish is
needed.
2009-12-13 03:14:06 +00:00
delphij
b963db4652 Remove unneeded header includes from usr.bin/ except contributed code.
Tested with:	make universe
2009-12-11 23:35:38 +00:00
jmallett
4f4dc1955c 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
tjr
9811ba2d67 Add support for multibyte characters. 2004-08-02 11:10:20 +00:00
tjr
21f820d4c3 Avoid passing negative values to isspace() on systems with signed chars. 2004-07-15 08:27:04 +00:00
tjr
8fb57041b7 Use warn() instead of perror(). 2004-07-15 04:45:24 +00:00
obrien
bc61fc95d8 Consistently use FBSDID 2002-06-30 05:25:07 +00:00
des
4d6b787d2d 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
ru
6540e7cdd9 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
ru
c14d208cbd 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
6c97019ad9 Don't call errx() with a variable format string
MFC after:	1 week
2001-08-11 00:49:11 +00:00
jlemon
cad6c25631 Cast size_t -> int to satisfy printf %* constraints on the alpha. 2001-06-16 06:22:09 +00:00
ru
f8f4f45d97 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
3b842d34e8 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
joerg
c8deb2dc55 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
jlemon
5d3c68aeda 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
charnier
e800470198 Add rcsid, prototypes. Use err(3). 1997-07-03 07:19:46 +00:00
bde
3f969c2fa3 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
phk
fe6f3f9eab Add -c flag to fmt to center lines. 1996-09-10 19:50:23 +00:00
smpatel
791bb4af0a 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
ed683028f0 Dynamically allocate line buffers, instead of assuming that all the
world would fit into BUFSIZ.
1995-11-15 15:01:01 +00:00
ache
f30cf8615c Add setlocale LC_CTYPE 1995-10-24 06:15:05 +00:00
rgrimes
a14d555c87 Remove trailing whitespace. 1995-05-30 06:41:30 +00:00
ache
cd84e329a9 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
rgrimes
f9ab90d9d6 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00