[comp.sources.unix] v20i021: Tools for generating software metrics, Part14/14

rsalz@uunet.uu.net (Rich Salz) (09/20/89)

Submitted-by: Brian Renaud <huron.ann-arbor.mi.us!bdr>
Posting-number: Volume 20, Issue 21
Archive-name: metrics/part14

---- Cut Here and unpack ----
#!/bin/sh
# this is part 14 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file src/utils/stripstr.c continued
#
CurArch=14
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file src/utils/stripstr.c"
sed 's/^X//' << 'SHAR_EOF' >> src/utils/stripstr.c
X	exit(0);
X}
X
XFILE *
Xnextfp( argc, argv, p_filename)
X	int	argc;
X	char	*argv[];
X	char	**p_filename;
X{
X	/* looks through parameters trying to return next FILE * to next
X	 * specified file
X	 * passes back a pointer to the filename as a side effect
X	 */
X	
X	static Bool	first = True;
X	static int	index = 1;
X	static FILE	*result = FNULL;
X
X	*p_filename = CNULL;
X
X	if ( result != FNULL )
X	{
X		fclose( result );
X		result = FNULL;
X	}
X	while ( index < argc && *argv[index] == '-' )
X		index++;
X
X	if ( index < argc )
X	{
X		if ( (result = fopen( argv[index], "r")) == NULL )
X		{
X			fprintf(stderr, "%s: unable to open %s for read\n",
X				argv[0], argv[index]);
X			exit(1);
X		}
X		else
X			*p_filename = argv[index];
X		index++;
X	}
X	if ( first )
X	{
X		/* if no files specified, read from stdin */
X		/* filename remains null */
X		if ( result == FNULL )
X			result = stdin;
X		first = False;
X	}
X	return ( result );
X}
SHAR_EOF
echo "File src/utils/stripstr.c is complete"
chmod 0644 src/utils/stripstr.c || echo "restore of src/utils/stripstr.c fails"
echo "x - extracting src/Makefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/Makefile
X# master make for metrics
X
X# where to put binaries (from the perspective of our subdirectories)
XBIN=../bin
X
XDIRS= mccabe halstead utils kdsi
X
XCFLAGS=-O
XLDFLAGS=
X
Xall: 	clean  progs install
X
Xprogs:
X	cd kdsi; $(MAKE) -e kdsi
X	cd utils; $(MAKE) -e all
X	cd halstead; $(MAKE) -e all
X	cd mccabe; $(MAKE)  -e all
X	@echo metrics software made
X
Xinstall:
X	cd kdsi; $(MAKE) install BIN=$(BIN)
X	cd utils; $(MAKE) install BIN=$(BIN)
X	cd halstead; $(MAKE) install BIN=$(BIN)
X	cd mccabe; $(MAKE) install BIN=$(BIN)
X	@echo metrics software installed
X
Xclean:
X	for i in $(DIRS); do (cd $$i; $(MAKE) clean); done;
X
Xtest:
X	@echo testing kdsi
X	@cd kdsi;  PATH=$(BIN):$$PATH; export PATH; $(MAKE) -i test
X	@echo " "
X	@echo testing halstead
X	@cd halstead;  PATH=$(BIN):$$PATH; export PATH; $(MAKE) -i test
X	@echo " "
X	@echo test mccabe
X	@cd mccabe;  PATH=$(BIN):$$PATH; export PATH; $(MAKE) -i test
SHAR_EOF
chmod 0644 src/Makefile || echo "restore of src/Makefile fails"
rm -f s2_seq_.tmp
echo "You have unpacked the last part"
exit 0


-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.