[comp.unix.xenix] Create Lint Libraries?

toppin@melpar.UUCP (Doug Toppin) (05/16/89)

I have been trying to create a lint library with
an SCO Xenix 386 system and have not been able to
do it properly. I have not been able to find an example
on how to use the '-o' option with lint.
My questions are:
    * what do you start with? a normal source file
      or a file that just has prototypes in it?
    * do you run lint with the '-o' option on a
      normal source file or on the prototype file?
    * do you need both the hash'd '.ln' and 'llib*'
      (displayable) files?
    * does the resultant lint library have to be in
      /usr/lib or can it be referred to with a full
      path at lint invocation?
If anyone knows exactly how to use this please send me
a complete small example.
thanks
Doug Toppin
uunet!melpar!toppin

chip@ateng.ateng.com (Chip Salzenberg) (05/20/89)

According to toppin@melpar.UUCP (Doug Toppin):
>I have been trying to create a lint library with
>an SCO Xenix 386 system and have not been able to
>do it properly. I have not been able to find an example
>on how to use the '-o' option with lint.

Here are the scripts I use with Xenix/286.  They should be close to what's
needed for Xenix/386; perhaps the line with "-LARGE" can be removed.

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  mkllib mklall
# Wrapped by chip@ateng on Fri May 19 15:28:24 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'mkllib' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mkllib'\"
else
echo shar: Extracting \"'mkllib'\" \(265 characters\)
sed "s/^X//" >'mkllib' <<'END_OF_FILE'
X: llib
X# Generate a lint library
X
Xcd /usr/lib
X
Xfor a
Xdo
X    LIB=llib$a
X
X    if [ ! -f $LIB ]
X    then
X	echo >&2 "$LIB: no such file"
X	continue
X    fi
X
X    ln $LIB $LIB.c
X    (
X	set -x
X	lint -n -o$a        $LIB.c
X	lint -n -o$a -LARGE $LIB.c
X    )
X    rm $LIB.c
Xdone
END_OF_FILE
if test 265 -ne `wc -c <'mkllib'`; then
    echo shar: \"'mkllib'\" unpacked with wrong size!
fi
chmod +x 'mkllib'
# end of 'mkllib'
fi
if test -f 'mklall' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mklall'\"
else
echo shar: Extracting \"'mklall'\" \(88 characters\)
sed "s/^X//" >'mklall' <<'END_OF_FILE'
X: mklall
X# Make all lint libraries
X
X./mkllib c curses dbm m port tcap termcap termlib x
END_OF_FILE
if test 88 -ne `wc -c <'mklall'`; then
    echo shar: \"'mklall'\" unpacked with wrong size!
fi
chmod +x 'mklall'
# end of 'mklall'
fi
echo shar: End of shell archive.
exit 0
-- 
Chip Salzenberg             <chip@ateng.com> or <uunet!ateng!chip>
A T Engineering             Me?  Speak for my company?  Surely you jest!
	  "It's no good.  They're tapping the lines."

fnf@estinc.UUCP (Fred Fish) (05/21/89)

In article <202@melpar.UUCP> toppin@melpar.UUCP (Doug Toppin) writes:
>I have been trying to create a lint library with
>an SCO Xenix 386 system and have not been able to
>do it properly. I have not been able to find an example
>on how to use the '-o' option with lint.

Here is the shell script I use to make lint libraries on a variety of
different systems.  I just tested it under SCO 2.3.1 and it seemed to
work just fine.  If the name of your library is mylib.c, just make a
lint source file in mylib.lint by stripping out the bodies of all the
functions and adding "/*LINTLIBRARY*/" at the beginning of mylib.lint.
Then do "mklintlib mylib.lint llibmylib.ln", install the file as
/usr/lib/llibmylib.ln, and to use with a program myprog.c that references
the library, run "lint myprog.c -lmylib".

-Fred

# mklintlib --- make a lint library, under either System V or 4.2 BSD
#
# usage:  mklintlib <infile> <outfile>
#

if test $# -ne 2
then
	echo "usage: mklintlib <infile> <outfile>"
	exit 1
fi

if grep SIGTSTP /usr/include/signal.h >/dev/null
then							# BSD
	if test -r /usr/include/whoami.h		# 4.1
	then
		/lib/cpp -C -Dlint $1 >hlint
		(/usr/lib/lint/lint1 <hlint >$2) 2>&1 | grep -v warning
	else						# 4.2
		lint -Cxxxx $1
		mv llib-lxxxx.ln $2
	fi
else							# USG
	cc -E -C -Dlint $1 | /usr/lib/lint1 -vx -Hhlint >$2
	rm -f hlint
fi
exit 0							# don't kill make
-- 
# Fred Fish, 1835 E. Belmont Drive, Tempe, AZ 85284,  USA
# 1-602-491-0048           asuvax!{nud,mcdphx}!estinc!fnf

jbu@sfsup.UUCP (+Urban J.) (05/25/89)

In article <1989May19.152951.27404@ateng.ateng.com> chip@ateng.ateng.com (Chip Salzenberg) writes:
>According to toppin@melpar.UUCP (Doug Toppin):
>>I have been trying to create a lint library with

On most UNIX/XENIX boxes lint(1) is just a shell script that calls lint1
and lint2.  You goal in life is to just call lint1.  Look at the source
for lint and you'll get the correct option.

The input file (proto_type.c) should just be a proto type file, e.g. like this:

$ cat proto_type.c
tyee(x, y) int x, y; {return (1);}
char *apples(pear) char *part; {return ("RC");}

Then when you lint it (first pass only), lint will create a proto_type.ln file.
This .ln file can be used by lint2 (second pass lint, that checks for
arguments/return codes, et. al.).

If you want, you can always just suppy the proto_type.c file every time,
this would slow down lint(1) because it would always have to recreate the .ln
guy each time.

Sincerely,

John Urban