Small tool: fixwhite(1)

Ed Schouten ed at 80386.nl
Mon Feb 6 21:26:09 UTC 2012


Hi folks,

I just added a small tool to the tools/ directory in src called
fixwhite(1) that attempts to fix commonly made whitespace bugs in source
files. I wrote it in such a way that it's quite conservative, to make
sure it won't make too many annoying changes that you have to roll back
manually. It should be useful especially when copy-pasting code between
terminals.

As mentioned in the commit message, you can just use :%!fixwhite if
you're a vi(1) user. Other editors probably support a similar construct.

Have fun!

-- 
 Ed Schouten <ed at 80386.nl>
 WWW: http://80386.nl/


----- Forwarded message from Ed Schouten <ed at FreeBSD.org> -----
> Date: Mon, 6 Feb 2012 10:23:11 +0000 (UTC)
> From: Ed Schouten <ed at FreeBSD.org>
> To: src-committers at freebsd.org, svn-src-all at freebsd.org,
> 	svn-src-head at freebsd.org
> Subject: svn commit: r231071 - head/tools/tools/fixwhite
>
> Author: ed
> Date: Mon Feb  6 10:23:11 2012
> New Revision: 231071
> URL: http://svn.freebsd.org/changeset/base/231071
>
> Log:
>   Add fixwhite(1).
>
>   This small utility can be used to `sanitize' the whitespace in source
>   code. It does the following things:
>
>   Global:
>   - Remove empty lines at the beginning and the end of a file.
>   - Merge successive empty lines into a single empty line.
>
>   Per-line:
>   - Remove trailing whitespace.
>   - Merge spaces preceeding tabs into the tabs.
>
>   It operated on stdin/stdout. This means that if you use vi(1), you can
>   just run :%!fixwhite to reorganize the file.
----- End forwarded message -----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20120206/5a09151d/attachment.pgp


More information about the freebsd-hackers mailing list