1 /* $NetBSD: main2.c,v 1.2 1995/07/03 21:24:53 cgd Exp $ */
4 * Copyright (c) 1994, 1995 Jochen Pohl
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Jochen Pohl for
19 * 4. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * $NetBSD: main2.c,v 1.2 1995/07/03 21:24:53 cgd Exp $
34 * $DragonFly: src/usr.bin/xlint/lint2/main2.c,v 1.6 2004/07/07 12:24:01 asmodai Exp $
44 /* warnings for symbols which are declared but not defined or used */
48 * warnings for symbols which are used and not defined or defined
53 /* Create a lint library in the current directory with name libname. */
60 * warnings for (tentative) definitions of the same name in more then
61 * one translation unit
68 * If a complaint stems from a included file, print the name of the included
69 * file instead of the name spezified at the command line followed by '?'
75 /* Print full path names, not only the last component */
79 * List of libraries (from -l flag). These libraries are read after all
80 * other input files has been read and, for Cflag, after the new lint library
85 static void usage(void);
89 main(int argc
, char *argv
[])
95 libs
= xcalloc(1, sizeof (char *));
98 while ((c
= getopt(argc
, argv
, "hpstxuC:HFl:")) != -1) {
116 len
= strlen(optarg
);
117 lname
= xmalloc(len
+ 10);
118 (void)sprintf(lname
, "llib-l%s.ln", optarg
);
133 for (i
= 0; libs
[i
] != NULL
; i
++) ;
134 libs
= xrealloc(libs
, (i
+ 2) * sizeof (char *));
135 libs
[i
] = xstrdup(optarg
);
151 /* initialize hash table */
156 for (i
= 0; i
< argc
; i
++)
159 /* write the lint library */
165 /* read additional libraries */
166 for (i
= 0; libs
[i
] != NULL
; i
++)
173 /* perform all tests */
183 (void)fprintf(stderr
,
184 "usage: lint2 -hpstxuHF -Clib -l lib ... src1 ...\n");