| 1 | <?xml version="1.0" ?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | <head> |
| 5 | <title>copyright-update - Update Copyright information in files</title> |
| 6 | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
| 7 | <link rev="made" href="mailto:root@localhost" /> |
| 8 | </head> |
| 9 | |
| 10 | <body> |
| 11 | |
| 12 | |
| 13 | |
| 14 | <ul id="index"> |
| 15 | <li><a href="#NAME">NAME</a></li> |
| 16 | <li><a href="#USAGE">USAGE</a></li> |
| 17 | <li><a href="#DESCRIPTION">DESCRIPTION</a></li> |
| 18 | <li><a href="#REQUIRED-ARGUMENTS">REQUIRED ARGUMENTS</a></li> |
| 19 | <li><a href="#OPTIONS">OPTIONS</a> |
| 20 | <ul> |
| 21 | <li><a href="#Run-options">Run options</a></li> |
| 22 | <li><a href="#Miscellaneus-options">Miscellaneus options</a></li> |
| 23 | </ul> |
| 24 | </li> |
| 25 | <li><a href="#EXAMPLES">EXAMPLES</a></li> |
| 26 | <li><a href="#TROUBLESHOOTING">TROUBLESHOOTING</a></li> |
| 27 | <li><a href="#ENVIRONMENT">ENVIRONMENT</a></li> |
| 28 | <li><a href="#DIAGNOSTICS">DIAGNOSTICS</a></li> |
| 29 | <li><a href="#EXIT-STATUS">EXIT STATUS</a></li> |
| 30 | <li><a href="#CONFIGURATION">CONFIGURATION</a></li> |
| 31 | <li><a href="#DEPENDENCIES">DEPENDENCIES</a></li> |
| 32 | <li><a href="#INCOMPATIBILITIES">INCOMPATIBILITIES</a></li> |
| 33 | <li><a href="#FILES">FILES</a></li> |
| 34 | <li><a href="#SEE-ALSO">SEE ALSO</a></li> |
| 35 | <li><a href="#BUGS-AND-LIMITATIONS">BUGS AND LIMITATIONS</a></li> |
| 36 | <li><a href="#STANDARDS">STANDARDS</a></li> |
| 37 | <li><a href="#AVAILABILITY">AVAILABILITY</a></li> |
| 38 | <li><a href="#AUTHOR">AUTHOR</a></li> |
| 39 | <li><a href="#LICENSE-AND-COPYRIGHT">LICENSE AND COPYRIGHT</a></li> |
| 40 | </ul> |
| 41 | |
| 42 | <h1 id="NAME">NAME</h1> |
| 43 | |
| 44 | <p>copyright-update - Update Copyright information in files</p> |
| 45 | |
| 46 | <h1 id="USAGE">USAGE</h1> |
| 47 | |
| 48 | <pre><code>copyright-update [options] FILE [FILE ...] |
| 49 | copyright-update [options] --recursive PATH [PATH ...]</code></pre> |
| 50 | |
| 51 | <h1 id="DESCRIPTION">DESCRIPTION</h1> |
| 52 | |
| 53 | <p>Update the copyright information in a set of files, possibly recursively, matching content criteria. The update affects the copyright year, GPL address information, etc.</p> |
| 54 | |
| 55 | <p>The line must contain the word "Copyright," a space, three characters '(C)' (or a U+00A9 UTF copyright sign), a space, and the range of years. A varying amount of spaces and tabs are permitted, but there must be no spaces around the dash character in YEAR-YEAR. Examples:</p> |
| 56 | |
| 57 | <pre><code> A whitespace, or multiple, required |
| 58 | | | No space between years |
| 59 | | | | |
| 60 | Copyright (C) YYYY-YYYY |
| 61 | Copyright: (C) YYYY-YYYY |
| 62 | | |
| 63 | A colon is optional</code></pre> |
| 64 | |
| 65 | <p>By default, certain files and paths are always ignored, such as version control directories, backup files, object files, and binary files according to Perl's <code>-T</code> file test. Run the program with the option <b>--help-exclude</b> to see the excluded path list.</p> |
| 66 | |
| 67 | <h1 id="REQUIRED-ARGUMENTS">REQUIRED ARGUMENTS</h1> |
| 68 | |
| 69 | <p>Either FILE or PATH with <code>--recursive</code> option.</p> |
| 70 | |
| 71 | <h1 id="OPTIONS">OPTIONS</h1> |
| 72 | |
| 73 | <h2 id="Run-options">Run options</h2> |
| 74 | |
| 75 | <dl> |
| 76 | |
| 77 | <dt id="a---auto"><b>-a, --auto</b></dt> |
| 78 | <dd> |
| 79 | |
| 80 | <p>In automatic mode, the author's name is read from the environment variable NAME, and only lines matching 'Copyright.*$NAME' are affected. If NAME is not set, the information is read from EMAIL.</p> |
| 81 | |
| 82 | <p>If neither NAME nor EMAIL exists in the environment, or if their values are not in a recognizable format (see section ENVIRONMENT), this option does nothing.</p> |
| 83 | |
| 84 | <p>This option effectively tries to preset a value for the <b>--line</b> option.</p> |
| 85 | |
| 86 | </dd> |
| 87 | <dt id="c---code"><b>-c, --code</b></dt> |
| 88 | <dd> |
| 89 | |
| 90 | <p>Preset <b>--include</b> to match common code files: .c, .h, .cc, .hh, .cpp, .c++, .hpp, .C, .pl, .py, .sh, and .rb.</p> |
| 91 | |
| 92 | </dd> |
| 93 | <dt id="D---debug-LEVEL"><b>-D, --debug LEVEL</b></dt> |
| 94 | <dd> |
| 95 | |
| 96 | <p>Turn on debugging. LEVEL can be in the range of 0-10.</p> |
| 97 | |
| 98 | </dd> |
| 99 | <dt id="f---fsf-address"><b>-f, --fsf-address</b></dt> |
| 100 | <dd> |
| 101 | |
| 102 | <p>Change license paragraphs that refer to the FSF address. The FSF's current recommendation is to redirect inquiries about licenses to their URL.</p> |
| 103 | |
| 104 | <p>Effectively replace the paragraphs:</p> |
| 105 | |
| 106 | <pre><code>You should have received a copy of the GNU General Public License |
| 107 | along with this program; if not, write to the Free Software |
| 108 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 109 | |
| 110 | You should have received a copy of the GNU General Public License |
| 111 | along with this package; if not, write to the Free Software |
| 112 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</code></pre> |
| 113 | |
| 114 | <p>With this:</p> |
| 115 | |
| 116 | <pre><code>You should have received a copy of the GNU General Public License |
| 117 | along with this program. If not, see <http://www.gnu.org/licenses/>.</code></pre> |
| 118 | |
| 119 | </dd> |
| 120 | <dt id="i---include-REGEXP"><b>-i, --include REGEXP</b></dt> |
| 121 | <dd> |
| 122 | |
| 123 | <p>Include files matching regexp. The match is done against whole path.</p> |
| 124 | |
| 125 | <p>If this option is not supplied, every file is automatically included. The matches can be further filtered by using option <b>--exclude</b>.</p> |
| 126 | |
| 127 | <p>This option can be used multiple times. See also option <b>--code</b>.</p> |
| 128 | |
| 129 | </dd> |
| 130 | <dt id="l---line-REGEXP"><b>-l, --line REGEXP</b></dt> |
| 131 | <dd> |
| 132 | |
| 133 | <p>Change only lines which match REGEXP. The match is case-insensitive.</p> |
| 134 | |
| 135 | </dd> |
| 136 | <dt id="r---recursive"><b>-r, --recursive</b></dt> |
| 137 | <dd> |
| 138 | |
| 139 | <p>Recursively search all directories given in command line.</p> |
| 140 | |
| 141 | </dd> |
| 142 | <dt id="R---regexp-REGEXP"><b>-R, --regexp REGEXP</b></dt> |
| 143 | <dd> |
| 144 | |
| 145 | <p>Change only files whose content matches REGEXP. The file is read in as a one big string so that it's possible to match using Perl regular expressions across the whole file. An example: <code>'(?smi)This.*multi.*line.*match'</code>. See <code>perlre(1)</code> for more information about <code>'smi'</code> and other modifiers.</p> |
| 146 | |
| 147 | <p>This option can be used as a preliminary <i>Content criteria</i>, to select files before <b>--line</b> option finds the correct Copyright lines.</p> |
| 148 | |
| 149 | </dd> |
| 150 | <dt id="t---test---dry-run"><b>-t, --test, --dry-run</b></dt> |
| 151 | <dd> |
| 152 | |
| 153 | <p>Run in test mode. Show what would happen. No files are changed.</p> |
| 154 | |
| 155 | </dd> |
| 156 | <dt id="v---verbose-LEVEL"><b>-v, --verbose LEVEL</b></dt> |
| 157 | <dd> |
| 158 | |
| 159 | <p>Print informational messages. Increase numeric LEVEL for more verbosity.</p> |
| 160 | |
| 161 | </dd> |
| 162 | <dt id="x---exclude-REGEXP"><b>-x, --exclude REGEXP</b></dt> |
| 163 | <dd> |
| 164 | |
| 165 | <p>Ignore files matching regexp. The match is done against whole path. The option can be used multiple times.</p> |
| 166 | |
| 167 | <p>This option is applied after possible <b>--include</b> matches.</p> |
| 168 | |
| 169 | </dd> |
| 170 | <dt id="y---year-YEAR"><b>-y, --year YEAR</b></dt> |
| 171 | <dd> |
| 172 | |
| 173 | <p>Update files using YEAR. Value must be four digits.</p> |
| 174 | |
| 175 | <p>The default operation is to use currect year, so this option is not necessary in normal use. Use case: you plan to take a long holiday before year's end and want to update the next year's value beforehand.</p> |
| 176 | |
| 177 | </dd> |
| 178 | <dt id="Y---no-year"><b>-Y, --no-year</b></dt> |
| 179 | <dd> |
| 180 | |
| 181 | <p>Disable updating year.</p> |
| 182 | |
| 183 | </dd> |
| 184 | </dl> |
| 185 | |
| 186 | <h2 id="Miscellaneus-options">Miscellaneus options</h2> |
| 187 | |
| 188 | <dl> |
| 189 | |
| 190 | <dt id="h---help"><b>-h, --help</b></dt> |
| 191 | <dd> |
| 192 | |
| 193 | <p>Display help.</p> |
| 194 | |
| 195 | </dd> |
| 196 | <dt id="help-exclude"><b>--help-exclude</b></dt> |
| 197 | <dd> |
| 198 | |
| 199 | <p>Display default values used to exclude paths and files.</p> |
| 200 | |
| 201 | </dd> |
| 202 | <dt id="help-html"><b>--help-html</b></dt> |
| 203 | <dd> |
| 204 | |
| 205 | <p>Display help in HTML format.</p> |
| 206 | |
| 207 | </dd> |
| 208 | <dt id="help-man"><b>--help-man</b></dt> |
| 209 | <dd> |
| 210 | |
| 211 | <p>Display help in manual page <code>man(1)</code> format.</p> |
| 212 | |
| 213 | </dd> |
| 214 | <dt id="V---version"><b>-V, --version</b></dt> |
| 215 | <dd> |
| 216 | |
| 217 | <p>Display contact and version information.</p> |
| 218 | |
| 219 | </dd> |
| 220 | </dl> |
| 221 | |
| 222 | <h1 id="EXAMPLES">EXAMPLES</h1> |
| 223 | |
| 224 | <p>The primary use is to update files to reflect current year; option <b>--year</b> is implicit:</p> |
| 225 | |
| 226 | <pre><code>copyright-update *</code></pre> |
| 227 | |
| 228 | <p>To test what would happen:</p> |
| 229 | |
| 230 | <pre><code>copyright-update --verbose 1 --test *</code></pre> |
| 231 | |
| 232 | <p>Update only C-code file:</p> |
| 233 | |
| 234 | <pre><code>copyright-update --verbose 1 --include '\.[ch]$' --recursive .</code></pre> |
| 235 | |
| 236 | <p>It is possible to restrict updating files recursively to only those files whose content match regexp. Here, the lines affected are those that match <b>--line</b> regular expression.</p> |
| 237 | |
| 238 | <pre><code>copyright-update \ |
| 239 | --regexp '(?i)Author:.*John.*Doe' \ |
| 240 | --line '\bFoo\b' \ |
| 241 | --ignore '\.(bak|bup|[~#]])$' \ |
| 242 | --verbose 1 \ |
| 243 | --year 2013 \ |
| 244 | --test \ |
| 245 | --recursive \ |
| 246 | .</code></pre> |
| 247 | |
| 248 | <h1 id="TROUBLESHOOTING">TROUBLESHOOTING</h1> |
| 249 | |
| 250 | <p>See option <b>--debug</b>.</p> |
| 251 | |
| 252 | <h1 id="ENVIRONMENT">ENVIRONMENT</h1> |
| 253 | |
| 254 | <dl> |
| 255 | |
| 256 | <dt id="EMAIL">EMAIL</dt> |
| 257 | <dd> |
| 258 | |
| 259 | <p>In the form "[email protected]"; that is, without the angles <>. If set, the value is used in option <b>--auto</b> only if environment variable NAME is not set.</p> |
| 260 | |
| 261 | <p>In order to find first and lastname, the localpart in email address must match case insensitive regexp <code>'^[a-z-]+\.[a-z-]+@'</code>:</p> |
| 262 | |
| 263 | <pre><code>[email protected] Not used, not in form First.Last |
| 264 | +------ +---------- |
| 265 | |
| 266 | [email protected] Not used, likewise |
| 267 | +---------------- +---------- |
| 268 | | | |
| 269 | Localpart Domain part</code></pre> |
| 270 | |
| 271 | </dd> |
| 272 | <dt id="NAME1">NAME</dt> |
| 273 | <dd> |
| 274 | |
| 275 | <p>In the form "Firstname Lastname". If set, the value is used in option <b>--auto</b>.</p> |
| 276 | |
| 277 | </dd> |
| 278 | </dl> |
| 279 | |
| 280 | <h1 id="DIAGNOSTICS">DIAGNOSTICS</h1> |
| 281 | |
| 282 | <p>See option <code>--debug LEVEL</code></p> |
| 283 | |
| 284 | <h1 id="EXIT-STATUS">EXIT STATUS</h1> |
| 285 | |
| 286 | <p>Value 0 on normal exit and non-zero on error.</p> |
| 287 | |
| 288 | <h1 id="CONFIGURATION">CONFIGURATION</h1> |
| 289 | |
| 290 | <p>None.</p> |
| 291 | |
| 292 | <h1 id="DEPENDENCIES">DEPENDENCIES</h1> |
| 293 | |
| 294 | <p>None. Uses only standard Perl modules.</p> |
| 295 | |
| 296 | <h1 id="INCOMPATIBILITIES">INCOMPATIBILITIES</h1> |
| 297 | |
| 298 | <p>None.</p> |
| 299 | |
| 300 | <h1 id="FILES">FILES</h1> |
| 301 | |
| 302 | <p>None.</p> |
| 303 | |
| 304 | <h1 id="SEE-ALSO">SEE ALSO</h1> |
| 305 | |
| 306 | <p>licensecheck(1)</p> |
| 307 | |
| 308 | <h1 id="BUGS-AND-LIMITATIONS">BUGS AND LIMITATIONS</h1> |
| 309 | |
| 310 | <p>The Copyright stanzas searched with option <b>--fsf-address</b> must be exactly like in the FSF recommendation in order for them to be noticed. See STANDARDS.</p> |
| 311 | |
| 312 | <h1 id="STANDARDS">STANDARDS</h1> |
| 313 | |
| 314 | <p><code>How to use GNU licenses for your own software</code> http://www.gnu.org/copyleft/gpl-howto.html</p> |
| 315 | |
| 316 | <p><code>Information for maintainers of GNU software (6.5 Copyright Notices)</code> http://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html</p> |
| 317 | |
| 318 | <p><code>Information for maintainers of GNU software (6.6 License Notices)</code> http://www.gnu.org/prep/maintain/html_node/License-Notices.html#License-Notices</p> |
| 319 | |
| 320 | <h1 id="AVAILABILITY">AVAILABILITY</h1> |
| 321 | |
| 322 | <p>Homepage is at https://github.com/jaalto/project--copyright-update</p> |
| 323 | |
| 324 | <h1 id="AUTHOR">AUTHOR</h1> |
| 325 | |
| 326 | <p>Jari Aalto</p> |
| 327 | |
| 328 | <h1 id="LICENSE-AND-COPYRIGHT">LICENSE AND COPYRIGHT</h1> |
| 329 | |
| 330 | <p>Copyright (C) 2000-2025 Jari Aalto</p> |
| 331 | |
| 332 | <p>This program is free software; you can redistribute and/or modify program under the terms of GNU General Public license either version 2 of the License, or (at your option) any later version. For more information, see see <http://www.gnu.org/licenses/>.</p> |
| 333 | |
| 334 | |
| 335 | </body> |
| 336 | |
| 337 | </html> |
| 338 | |
| 339 |