static char *sccsid
= "@(#)filter.c 1.2 (Berkeley) %G%";
extern char* processname
;
* Read the file ERRORNAME of the names of functions in lint
* to ignore complaints about.
struct passwd
*passwdentry
;
if (auxname
== 0){ /* use the default */
if ( (username
= (char *)getlogin()) == NULL
){
if ( (passwdentry
= (struct passwd
*)getpwuid(uid
)) == NULL
){
if ( (passwdentry
= (struct passwd
*)getpwnam(username
)) == NULL
)
strcpy(filename
, passwdentry
->pw_dir
);
(void)strcat(filename
, ERRORNAME
);
(void)strcpy(filename
, auxname
);
printf("Opening file \"%s\" to read names to ignore.\n",
if ( (fyle
= fopen(filename
, "r")) == NULL
){
fprintf(stderr
, "%s: Can't open file \"%s\"\n",
* Make the first pass through the file, counting lines
for (nignored
= 0; fgets(inbuffer
, 255, fyle
) != NULL
; nignored
++)
names_ignored
= (char **)Calloc(nignored
+1, sizeof (char *));
if (freopen(filename
, "r", fyle
) == NULL
){
fprintf(stderr
, "%s: Failure to open \"%s\" for second read.\n",
for (i
=0; i
< nignored
&& (fgets (inbuffer
, 255, fyle
) != NULL
); i
++){
names_ignored
[i
] = strsave(inbuffer
);
(void)substitute(names_ignored
[i
], '\n', '\0');
qsort(names_ignored
, nignored
, sizeof *names_ignored
, lexsort
);
printf("Names to ignore follow.\n");
for (i
=0; i
< nignored
; i
++){
printf("\tIgnore: %s\n", names_ignored
[i
]);
return(strcmp(*cpp1
, *cpp2
));
for(lb
= 0, ub
= nignored
- 1; ub
>= lb
; ){
if ( (order
= strcmp(key
, names_ignored
[halfway
])) == 0)
if (order
< 0) /*key is less than probe, throw away above*/
* Tell if the error text is to be ignored.
* The error must have been canonicalized, with
* the file name the zeroth entry in the errorv,
* and the linenumber the second.
* Return the new categorization of the error class.
Errorclass
discardit(errorp
)
Errorclass errorclass
= errorp
->error_e_class
;
case C_UNKNOWN
: return(errorclass
);
if(errorp
->error_lgtext
< 2){
language
= errorp
->error_language
;
if (errorclass
!= C_NONSPEC
){ /* no file */
for(i
=0; lint_libs
[i
] != 0; i
++){
if (strcmp(errorp
->error_text
[0], lint_libs
[i
]) == 0){
/* check if the argument to the error message is to be ignored*/
if (ispunct(lastchar(errorp
->error_text
[2])))
clob_last(errorp
->error_text
[2], '\0');
if (search_ignore(errorp
->error_text
[errorclass
== C_NONSPEC
? 0 : 2]) >= 0){