chiark / gitweb /
Release 1.2.0.
[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;
33.hP \*o groups of spaces
34which could be replaced by tabs; or
35.hP \*o
36.I all tab characters
37\(en replacing them with appropriate numbers of spaces.
38.PP
39The program is capable of fixing files in place (leaving backups if you
40ask for them).
41.PP
42The following command-line options are recognized.
43.TP
44.B \-h
45Give a short help message describing the options available.
46.TP
47.B \-c
48Just check files, exiting zero if they're all OK, or 1 if there are
49whitespace problems with any of them; exit 32 if there are actual
50errors. You may want the
51.B \-v
52option with this; without it,
53.B space
54is silent.
55.TP
56.BR \-i [ \fIbackup ]
57Modify all the
58.IR file s
59in place. During processing, the fixed copy of the file is written to
60some new name not currently in use. If the processing was successful,
61the old
62.I file
63is renamed to
64.I filebackup
65and the new file is renamed to
66.IR file .
67If something very complicated goes wrong at just the right moment, it's
68possible that you'll be left with just
69.I filebackup
70but that's not very likely. The new file is created with the same
71permissions as the old file, but no attempt is made to give it the same
72owner or anything like that.
73.TP
74.B \-m
75Worry about tabs in the middle of lines as well as tabs forming the
76initial indentation. Normally, identify (and fix) tabs preceded by
77spaces in the middle of lines; with
78.BR \-t ,
79fix all groups of whitespace which could be turned into tabs.
80.TP
81.B \-t
82Turn runs of horizontal whitespace into tabs where possible.
83With
84.BR \-c ,
85only complain about runs of space which could be turned into tabs but
86don't actually do anything. By default, only runs of whitespace at the
87starts of lines are affected. With
88.BR \-m ,
89however, all runs of whitespace are considered to be fair game. The
90rules for internal whitespace are as follows. A run at the start of a
91line, or which contains a tab is always fair game; a run of two or more
92spaces is fair game
93.I unless
94it follows a
95.RB ` . '
96or
97.RB ` : '
98character, either immediately or separated only by
99.RB ` """" '
100or
101.RB ` ' '
102characters, in which case three spaces are required. This is because
103some typists (including the author) put two spaces after a full stop,
104and don't want them randomly turning into tabs for no good reason.
105.TP
106.B \-u
107Turn tabs into appropriate numbers of spaces. With
108.BR \-c ,
109only complain about finding tabs, but don't actually do anything. All
110tabs are considered fair game here and the
111.B \-m
112option is ignored.
113.PP
114Tab stops are assumed to occur every eight columns, as is usual.
115.SH BUGS
116There's no way yet of controlling where the tab stops are.
117.PP
118This space program doesn't even attempt moon landings. The space man
119page doesn't have wiggly antennae.
120.SH AUTHOR
121Mark Wooding, <mdw@distorted.org.uk>