% lint file1.c file2.c
% lint -Nlevel=3 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
That command directs lint to execute the first pass only and collect information relevant to the second—about inconsistencies in definition and use across file1.c and file2.c—in intermediate files named file1.ln and file2.ln:
% ls file1.c file1.ln file2.c file2.ln
This way, the -c option to lint is analogous to the -c option to cc, which suppresses the link editing phase of compilation. Generally speaking, lint’s command-line syntax closely follows cc’s.
When the .ln files are linted:
% lint file1.ln file2.ln
the second pass is executed. lint processes any number of .c or .ln files in their command-line order. Thus,
% lint file1.ln file2.ln file3.c
directs lint to check file3.c for errors internal to it and all three files for consistency.
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 2.16 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
That command directs lint to:
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.