[comp.sys.att] lint -I

brown@cs.rochester.edu (Chris Brown) (04/17/88)

Does lint -I/u/doe/include foo.c
work on 3b1 under 3.51a?  lint is advertised to understand cc flags
and cc is OK with the above, but lint doesn't seem to recognize the flag...
maybe I have something set up wrong somewhere? thanks...if this is just
simplemindedness, feel free to say so.  Thanks, Chris Brown

brant@manta.UUCP (Brant Cheikes) (04/19/88)

In article <8723@sol.ARPA> brown@cs.rochester.edu (Chris Brown) writes:
>Does lint -I/u/doe/include foo.c
>work on 3b1 under 3.51a?  lint is advertised to understand cc flags
>and cc is OK with the above, but lint doesn't seem to recognize the flag...

I've run across this, and AT&T dufosity is to blame.  lint wants a
space between the option and the argument, so "lint -I /u/doe/include
file" will do what you want.  Same for things like "lint -D UNIXPC
foo.c".  Bletch.
-- 
Brant Cheikes
University of Pennsylvania
Department of Computer and Information Science
ARPA: brant@linc.cis.upenn.edu, UUCP: ...drexel!manta!brant

john@banzai.UUCP (John Canning) (04/22/88)

I hate to spoil the fun of blaming AT&T for lint -I/foobar/include
not working the way you want it to, but if you make your $SHELL
variable use /bin/sh instead of /bin/ksh, it works quite nicely.

The ksh interprets one of the lines inside the lint script a tad
differently than sh would.  This has something to do with the way
it handles backslashes inside of single vs. double quotes.

If you want to make lint work properly when run under the korne shell,
change line 55 so that it reads as follows (this will work for ksh
as well as sh):

			O=`echo $OPT | sed "s/\\(.\\).*/\\1/p"`

The original line used single quotes in place of double quotes.


    In case you want more detail as to what this line does, or
    where it really is, keep reading...


    The line appears in a case statement which tries to parse out
    the options.  When it finds a -, it starts to look for
    another ONE character option.  Under the ksh, the line is
    interpreted so that the sed script looks for the next word,
    rather than just the next character.  Changing the single
    quotes to double quotes will make the ksh work correctly.

    Here is the original line in context:

	case "$OPT" in
	*.c)	FILES="$FILES $OPT"	NDOTC="x$NDOTC";;
	*.ln)	FILES="$FILES $OPT";;
	-*)	OPT=`echo $OPT | sed s/-//p`
		while [ "$OPT" ]
		do
			O=`echo $OPT | sed 's/\\(.\\).*/\\1/p'`
			OPT=`echo $OPT | sed s/.//p`
			case $O in
			p)	LINTF="$LINTF -p"
			.
			.
			.
    
I hope this clears up the confusion over lint and its bugs...

John Canning
The People's Computer Company
Burlington, Vermont