% lint file1.c file2.c
lint examines code in two passes. In the first pass, lint checks for error conditions within C source files; in the second pass, it checks for inconsistencies across C source files. This process is invisible to the user unless lint is invoked with -c:
% lint -c file1.c file2.c
This command directs lint to execute the first pass only and collect information relevant to the second pass in intermediate files named file1.ln and file2.ln. The second pass covers inconsistencies in definition and use across file1.c and file2.c.
% ls file1.c file1.ln file2.c file2.ln
In this way, the -c option to lint is analogous to the -c option to cc, which suppresses the link editing phase of compilation. The lint’s command-line syntax closely follows cc’s.
When the .ln files are linted the second pass is executed.
% lint file1.ln file2.ln
lint processes any number of .c or .ln files in their command-line order. For example, the following command, directs lint to check file3.c for errors internal to it and all three files for consistency.
% lint file1.ln file2.ln file3.c
lint searches directories for included header files in the same order as cc. You can use the -I option to lint as you would the -I option to cc. See How to Specify Include Files.
You can specify multiple options to lint on the same command line. Options can be concatenated unless one of the options takes an argument or if the option has more than one letter.
% lint -cp -Idir1 -Idir2 file1.c file2.c
This command directs lint to perform the following actions:
Execute the first pass only
Perform additional portability checks
lint has many options you can use to direct lint to perform certain tasks and report on certain conditions.
Use the environment variable LINT_OPTIONS to define default set of options to lint. LINT_OPTIONS is read by lint as if its value had been placed on the command line, immediately following the name used to invoke lint.
lint $LINT_OPTIONS ... other-arguments ...
The lint command also recognizes the SPRO_DEFAULTS_PATH environment variable to locate a user-supplied default options file lint.defaults. See User-Supplied Default Options File.