2 .\" Please adjust this date whenever revising the manpage.
3 .TH SPATCH 1 "may 17, 2011"
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.
24 .\" pad: src: deputy man page
26 spatch \- apply a semantic patch file to a set of C files
44 \fBspatch\fP is a program matching and transformation tool for C.
45 The programmer describes the code to match and the transformation to
46 perform as a semantic patch, which looks like a standard patch, but can
47 transform multiple files at any number of code sites.
50 Further information about spatch is available at
51 \fBhttp://coccinelle.lip6.fr/\fP.
54 Here is a summary of the most commonly used options:
57 .B -sp_file \fI<file>\fP
58 the semantic patch file
61 process all files in directory recursively
63 .B -iso_file \fI<file>\fP
64 (default=SHAREDIR/standard.iso)
66 .B -macro_file \fI<file>\fP
67 (default=SHAREDIR/standard.h)
70 print some information to help debug the matching process
73 causes all available include files to be used
76 causes not even local include files to be used
79 the directory containing the include files
82 process header files independently
85 works with -dir, use information generated by glimpseindex
88 the output file. If none is specified, a patch is generated on the standard
92 do the modification on the file directly
95 store modifications in a .cocci_res file
98 show the version of spatch
101 show the date on which spatch was compiled
104 see short list of options
107 see all the available options in different categories
110 show summary of options.
116 ./spatch -sp_file foo.cocci foo.c
118 Apply the semantic patch foo.cocci to the C file foo.c. The semantic patch
119 is applied modulo a set of isomorphisms contained in standard.iso
120 (standard.iso is by default located in
121 SHAREDIR/standard.iso). A patch showing the effect of
122 the application, if any, will be generated on the standard output.
124 ./spatch -sp_file foo.cocci foo.c -o /tmp/newfoo.c
126 The same as the above, except that a modified version of foo.c is stored in
129 It is also possible to apply spatch to all of the C files in
132 ./spatch -cocci_file foo.cocci -dir foodir
134 If the semantic patch is not working as expected, the option -debug
135 shows selection of information about the application of
136 a semantic patch to a file or directory.
139 .I SHAREDIR/standard.iso
141 This file contains the default set of isomorphisms.
143 .I SHAREDIR/standard.h
145 This file contains the default set of macro hints.
149 The path to the Coccinelle share directory. Default is
153 Y. Padioleau, J.L. Lawall, R.R Hansen, G. Muller
154 "Documenting and Automating Collateral Evolutions in Linux Device Driver"
156 Glasgow, Scotland (April 2008) pp. 247-260.
159 \fBspatch\fP was written by Julia Lawall <julia@diku.dk>, Yoann Padioleau
160 <yoann.padioleau@gmail.com>, Rene Rydhof Hansen <rrhansen@diku.dk> and
161 Henrik Stuart <henrik@hstuart.dk>.
163 This manual page was written by Yoann Padioleau <yoann.padioleau@gmail.com>
164 and Julia Lawall <julia@diku.dk>.
167 Send a mail to <cocci@diku.dk>
170 Copyright 2010, 2011, University of Copenhagen DIKU and INRIA.
171 Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen.
172 spatch is free software: you can redistribute it and/or modify
173 it under the terms of the GNU General Public License as published by
174 the Free Software Foundation, according to version 2 of the License.
177 \fIpatch\fP(1), \fIdiff\fP(1)