chiark / gitweb /
Merge branch 'master' of git.distorted.org.uk:public-git/misc
[misc] / space.1
CommitLineData
df33ee54
MW
1.\" -*-nroff-*-
2.ie t .ds o \(bu
3.el .ds o *
4.de hP
5.IP
6\fB\h'-\w'\\$1'u-1m'\\$1\h'1m'\fP\c
7..
8.TH space 1 "27 January 2007" "Straylight/Edgeware"
9.SH NAME
10space \- check and fix whitespace in files
11.SH SYNOPSIS
12.B space
13.RB [ \-cmtuv ]
14.RB [ \-i \c
15.RI [ backup ]]
16.RI [ file ...]
17.SH DESCRIPTION
18The (low-budget)
19.B space
20program identifies and fixes problematic use of whitespace in text
21files. In particular, it will notice and (if you want) fix
22.hP \*o
23.I trailing whitespace
24\(en tabs and spaces just before a newline;
25.hP \*o
26.I spaces before tabs
27\(en which are obviously pointless;
28.hP \*o
29.I end-of-file in mid-line
30\(en which confuses a number of programs,
31.BR diff (1)
32not least;
c5ed60be
MW
33.hP \*o
34.I groups of spaces which could be replaced by tabs
35\(en replacing them with the appropriate tab characters; or
df33ee54
MW
36.hP \*o
37.I all tab characters
38\(en replacing them with appropriate numbers of spaces.
39.PP
40The program is capable of fixing files in place (leaving backups if you
41ask for them).
42.PP
43The following command-line options are recognized.
44.TP
45.B \-h
46Give a short help message describing the options available.
47.TP
48.B \-c
49Just check files, exiting zero if they're all OK, or 1 if there are
50whitespace problems with any of them; exit 32 if there are actual
51errors. You may want the
52.B \-v
53option with this; without it,
54.B space
55is silent.
56.TP
57.BR \-i [ \fIbackup ]
58Modify all the
59.IR file s
60in place. During processing, the fixed copy of the file is written to
61some new name not currently in use. If the processing was successful,
62the old
63.I file
64is renamed to
c5ed60be 65.I file "" backup
df33ee54
MW
66and the new file is renamed to
67.IR file .
68If something very complicated goes wrong at just the right moment, it's
69possible that you'll be left with just
70.I filebackup
71but that's not very likely. The new file is created with the same
72permissions as the old file, but no attempt is made to give it the same
73owner or anything like that.
74.TP
75.B \-m
76Worry about tabs in the middle of lines as well as tabs forming the
77initial indentation. Normally, identify (and fix) tabs preceded by
78spaces in the middle of lines; with
79.BR \-t ,
80fix all groups of whitespace which could be turned into tabs.
81.TP
82.B \-t
83Turn runs of horizontal whitespace into tabs where possible.
84With
85.BR \-c ,
86only complain about runs of space which could be turned into tabs but
87don't actually do anything. By default, only runs of whitespace at the
88starts of lines are affected. With
89.BR \-m ,
90however, all runs of whitespace are considered to be fair game. The
91rules for internal whitespace are as follows. A run at the start of a
92line, or which contains a tab is always fair game; a run of two or more
93spaces is fair game
94.I unless
95it follows a
96.RB ` . '
97or
98.RB ` : '
99character, either immediately or separated only by
100.RB ` """" '
101or
102.RB ` ' '
103characters, in which case three spaces are required. This is because
104some typists (including the author) put two spaces after a full stop,
105and don't want them randomly turning into tabs for no good reason.
106.TP
107.B \-u
108Turn tabs into appropriate numbers of spaces. With
109.BR \-c ,
110only complain about finding tabs, but don't actually do anything. All
111tabs are considered fair game here and the
112.B \-m
113option is ignored.
114.PP
115Tab stops are assumed to occur every eight columns, as is usual.
116.SH BUGS
117There's no way yet of controlling where the tab stops are.
118.PP
119This space program doesn't even attempt moon landings. The space man
120page doesn't have wiggly antennae.
c5ed60be
MW
121.PP
122The jokes in the man page are somewhat lame.
df33ee54
MW
123.SH AUTHOR
124Mark Wooding, <mdw@distorted.org.uk>