2 .\" Please adjust this date whenever revising the manpage.
3 .TH SPATCH 1 "December 30, 2008"
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
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)
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.
25 spatch \- apply a semantic patch file to a set of C files
43 \fBspatch\fP is a program matching and transformation tool for C.
44 The programmer describes the code to match and the transformation to
45 perform as a semantic patch, which looks like a standard patch, but can
46 transform multiple files at any number of code sites.
49 Further information about spatch is available at
50 \fBhttp://www.emn.fr/x-info/coccinelle\fP.
53 Here is a summary of the most commonly used options:
56 .B -sp_file \fI<file>\fP
57 the semantic patch file
60 process all files in directory recursively
62 .B -iso_file \fI<file>\fP
63 (default=/usr/local/share/coccinelle/standard.iso)
65 .B -macro_file \fI<file>\fP
66 (default=/usr/local/share/coccinelle/standard.h)
69 print some information to help debug the matching process
72 causes all available include files to be used
75 causes not even local include files to be used
78 the directory containing the include files
81 process header files independently
84 works with -dir, use information generated by glimpseindex
87 the output file. If none is specified, a patch is generated on the standard
91 do the modification on the file directly
94 store modifications in a .cocci_res file
97 show the version of spatch
100 show the date on which spatch was compiled
103 see short list of options
106 see all the available options in different categories
109 show summary of options.
115 ./spatch -sp_file foo.cocci foo.c
117 Apply the semantic patch foo.cocci to the C file foo.c. The semantic patch
118 is 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
121 the application, if any, will be generated on the standard output.
123 ./spatch -sp_file foo.cocci foo.c -o /tmp/newfoo.c
125 The same as the above, except that a modified version of foo.c is stored in
128 It is also possible to apply spatch to all of the C files in
131 ./spatch -cocci_file foo.cocci -dir foodir .
133 If the semantic patch is not working as expected, the option -debug
134 shows selection of information about the application of
135 a semantic patch to a file or directory.
138 .I /usr/local/share/coccinelle/standard.iso
140 This file contains the default set of isomorphisms.
142 .I /usr/local/share/coccinelle/standard.h
144 This file contains the default set of macro hints.
148 The path to coccinelle share directory. Defaut is
149 .I /usr/local/share/coccinelle
152 Y. Padioleau, J.L. Lawall, R.R Hansen, G. Muller
153 "Documenting and Automating Collateral Evolutions in Linux Device Driver"
155 Glasgow, Scotland (April 2008) pp. 247-260.
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
160 Henrik Stuart <henrik@hstuart.dk>.
162 This manual page was written by Yoann Padioleau <yoann.padioleau@gmail.com>
163 and Julia Lawall <julia@diku.dk>.
166 Send a mail to <cocci@diku.dk>
169 Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen.
170 spatch is free software: you can redistribute it and/or modify
171 it under the terms of the GNU General Public License as published by
172 the Free Software Foundation, according to version 2 of the License.