Previous: , Up: Writing boilerplate   [Index]

4.4 notice: Create and write a copyright and license notice to a file.

The notice command is a simple way to add a boilerplate to a set of source code files.

The copyright option -c, license option -l and commenting style option -s are required options in the notice command. When -s is specified more than once only the final option is used. Options -c and -l can be specified more than once to add more than one copyright holder, or more than one license notice.

The notice command is most often used like so:

$ licensing notice -c 'Yoyodyne,\ Inc.\ 2001' -l gpl -s c -n *.[ch] 
apply: foo.c -> Boilerplate applied.
apply: bar.c -> Boilerplate applied.
apply: qux.c -> Boilerplate applied.
apply: foo.h -> Boilerplate applied.

This example creates a boilerplate and adds it to the beginning of all .c and .h files, while not retaining any backup files. Everything in the argument to -c is passed to the copyright command to operate on. The boilerplate includes the GNU GPL notice and a copyright line for Yoyodyne, Inc. The -s option is being used to set the commenting style to the C-style. The -n turns off backups. To see what licenses and styles are available, type ‘licensing notice --help’.

The backslashes in the -c command ensure that the argument is parsed as a single argument.

Often greater precision is required than the notice command provides. This command is included to offer a simpler way to add boilerplate in small cases.

When the copyright option -c is given an argument that results in an error in the copyright command (for example a malformed year specification), notices are not applied to any source code files.

Previous: , Up: Writing boilerplate   [Index]