Release coccinelle-0.1.7
[bpt/coccinelle.git] / docs / spatch.1
CommitLineData
faf9a90c
C
1.\" -*- nroff -*-
2.\" Please adjust this date whenever revising the manpage.
3.TH SPATCH 1 "December 30, 2008"
4
5.\" see http://www.fnal.gov/docs/products/ups/ReferenceManual/html/manpages.html
6.\" see http://www.linuxjournal.com/article/1158
7.\" see http://www.schweikhardt.net/man_page_howto.html
8.\" groff -Tascii -man ./spatch.1 | more
9.\"
10.\" Some roff macros, for reference:
11.\" .nh disable hyphenation
12.\" .hy enable hyphenation
13.\" .ad l left justify
14.\" .ad b justify to both left and right margins
15.\" .nf disable filling
16.\" .fi enable filling
17.\" .br insert line break
18.\" .sp <n> insert n+1 empty lines
19.\" for manpage-specific macros, see man(7)
20.\"
21.\" TeX users may be more comfortable with the \fB<whatever>\fP and
22.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
23.\" respectively. Also \fR for roman.
24.SH NAME
25spatch \- apply a semantic patch file to a set of C files
26
27.SH SYNOPSIS
28.B spatch
29.B -sp_file
30.I <SP>
31.I <files>
32.B [-o
33.I <outfile>
34.B ]
35.B [-iso_file
36.I <iso>
37.B ]
38.B [
39.I options
40.B ]
41.\"
42.SH DESCRIPTION
43\fBspatch\fP is a program matching and transformation tool for C.
44The programmer describes the code to match and the transformation to
45perform as a semantic patch, which looks like a standard patch, but can
46transform multiple files at any number of code sites.
47
48.PP
49Further information about spatch is available at
50\fBhttp://www.emn.fr/x-info/coccinelle\fP.
51
52.SH OPTIONS
53Here is a summary of the most commonly used options:
54
55.TP
56.B -sp_file \fI<file>\fP
57the semantic patch file
58.TP
59.B -dir \fI<dir>\fP
60process all files in directory recursively
61.TP
62.B -iso_file \fI<file>\fP
63(default=/usr/local/share/coccinelle/standard.iso)
64.TP
65.B -macro_file \fI<file>\fP
66(default=/usr/local/share/coccinelle/standard.h)
67.TP
68.B -debug
69print some information to help debug the matching process
70.TP
71.B -all_includes
72causes all available include files to be used
73.TP
74.B -no_includes
75causes not even local include files to be used
76.TP
77.B -I \fI<dir>\fP
78the directory containing the include files
79.TP
80.B -include_headers
81process header files independently
82.TP
83.B -use_glimpse
84works with -dir, use information generated by glimpseindex
85.TP
86.B -o \fI<file>\fP
87the output file. If none is specified, a patch is generated on the standard
88output
89.TP
90.B -inplace
91do the modification on the file directly
92.TP
93.B -outplace
94store modifications in a .cocci_res file
95.TP
96.B -version
97show the version of spatch
98.TP
99.B -date
100show the date on which spatch was compiled
101.TP
102.B -shorthelp
103see short list of options
104.TP
105.B -longhelp
106see all the available options in different categories
107.TP
108.B \-help, \-\-help
109show summary of options.
110
111
112
113.SH EXAMPLES
114
115 ./spatch -sp_file foo.cocci foo.c
116
117Apply the semantic patch foo.cocci to the C file foo.c. The semantic patch
118is applied modulo a set of isomorphisms contained in standard.iso
119(standard.iso is by default located in
120/usr/local/share/coccinelle/standard.iso). A patch showing the effect of
121the application, if any, will be generated on the standard output.
122
123 ./spatch -sp_file foo.cocci foo.c -o /tmp/newfoo.c
124
125The same as the above, except that a modified version of foo.c is stored in
126/tmp/newfoo.c.
127
128It is also possible to apply spatch to all of the C files in
129a directory:
130
131 ./spatch -cocci_file foo.cocci -dir foodir .
132
133If the semantic patch is not working as expected, the option -debug
134shows selection of information about the application of
135a semantic patch to a file or directory.
136
137.SH FILES
138.I /usr/local/share/coccinelle/standard.iso
139.RS
140This file contains the default set of isomorphisms.
141.RE
142.I /usr/local/share/coccinelle/standard.h
143.RS
144This file contains the default set of macro hints.
145
146.SH ENVIRONMENT
147.IP COCCINELLE_HOME
148The path to coccinelle share directory. Defaut is
149.I /usr/local/share/coccinelle
150
151.SH REFERENCES
152Y. Padioleau, J.L. Lawall, R.R Hansen, G. Muller
153"Documenting and Automating Collateral Evolutions in Linux Device Driver"
154.I EuroSys 2008,
155Glasgow, Scotland (April 2008) pp. 247-260.
156
157.SH AUTHOR
158\fBspatch\fP was written by Julia Lawall <julia@diku.dk>, Yoann Padioleau
159<yoann.padioleau@gmail.com>, Rene Rydhof Hansen <rrhansen@diku.dk> and
160Henrik Stuart <henrik@hstuart.dk>.
161.PP
162This manual page was written by Yoann Padioleau <yoann.padioleau@gmail.com>
163and Julia Lawall <julia@diku.dk>.
164
165.SH REPORTING BUGS
0708f913 166Send a mail to <cocci@diku.dk>
faf9a90c
C
167
168.SH COPYRIGHT
169Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen.
170spatch is free software: you can redistribute it and/or modify
171it under the terms of the GNU General Public License as published by
172the Free Software Foundation, according to version 2 of the License.
173
174.SH SEE ALSO
175.BR patch (1).
176