ccc script for the UNIX-PC - New Version No. 1.5

C. Jeffery Small jeff at cjsa.UUCP
Sat Jul 23 00:23:41 AEST 1988


# This is a shell archive.  Remove anything before this line
# then unpack it by saving it in a file and typing "sh file"
# (Files unpacked will be owned by you and have default permissions).
# This archive contains the following files:
#	./README
#	./ccc
#	./Size
#	./Name
#	./Files
#	./Install
#	./Remove
#	./Makefile
#	./OLD_NAME
#	./README.old
#	./Revisions
#
if `test ! -s ./README`
then
echo "extracting ./README ..."
sed 's/^X//' > ./README << 'END__of_the__FILE'
XDate:	07-21-88
XFrom:	Jeffery Small (uunet!hsi!cjsa!jeff)
X
XRe:	ccc  -  A front end to the c-compiler to allow easier use of the
X		shared libraries on the UNIX-PC [aka 7300/3B1].
X
XEnclosed is the latest version (1.5) of the  "ccc"  script.  Since the
Xlast published release (ver. 1.3) the following changes have been made:
X
X  1:  A bug in the order of the arguments passed to  ld  caused ccc to
X      fail when the -g or -p flags were specified.  Thanks to both David
X      Wexelblat and Kevin O'Gorman for bring this to my attention.
X
X  2:  Jim Apedaile provided some input on the requirements for the missing
X      routines in /lib/shlib.ifile which allowed me to pair down the set
X      of names for 3.51 (which includes version 3.51a).  He also supplied
X      some additional missing routines for OS version 3.5.  The new Install
X      script tries to figure out which version of the OS you are running and
X      acts accordingly.  Sorry that there is currently no support for version
X      3.0.  Any hacker running version 3.0 want to track down the appropriate
X      set of OFILES (see Install) and send me the diffs?
X
X  3:  There was a bug which occurred when -lcurses was specified and either
X      the -g or -p flags had been previously processed.  In that case, the
X      ccc shell variable $libc was being set by -[gp] properly to /lib/libc.a
X      and was then being reassigned at the -lcurses step improperly to
X      /lib/shlib.iCURSES.  This has been fixed.
X      
X  4:  Most importantly, I have added a new command line option:
X    
X		-~ symbolname
X		  ^
X		  |
X		  -----------(Note: Space is required)
X      
X      which allows you to specify individual symbol names which are causing
X      conflict with the shared library.  Even though we have tried to
X      address this problem in the past for curses, etc.  there are still
X      times when you need to resolve a special name conflict.  The old
X      standby method is to make a copy of /lib/shlib.ifile and edit the
X      conflicting name.  That is exactly what we do here, but "ccc" does
X      the editing for you automatically so that all you have to do is add
X      the flag to your Makefile.
X
X      For example, let's say you are trying to build perl using the supplied
X      malloc instead of the system-resident one.  If you use the previous
X      version of ccc, you get the following:
X
Xld shlib.ifile 190 warning: symbol malloc from file malloc.o being redefined
Xld shlib.ifile 191 warning: symbol free from file malloc.o being redefined
Xld shlib.ifile 192 warning: symbol realloc from file malloc.o being redefined
X
X	Now, in this case, this is not going to be a serious problem but no
X	one likes to see these kind of messages, so ... to resolve this
X	problem, simply add the following to your CFLAG (or LDFLAG) variable
X	in the Makefile:
X
X	CFLAG = ....  -~ malloc  -~ free  -~ realloc
X
X
X	Ccc will make a temporary copy of the appropriate ifile and edit out
X	the specified symbol names to resolve the conflict, link your program
X	and then dispose of the temporary file.
X
X	Note that if you don't specify any names with the -~ flag, then ccc
X	works just as it has in the past.
X
X	Yes, I consciously chose -~ to be a very strange flag so that it
X	stands out and won't be confused with valid cpp/cc/ld flags.  There
X	are no problems with sh or ksh when used in this context.  Anyone
X	running csh?
X
X    
XFinally, the new Install script is smart enough to automatically remove the
Xprevious version (version 1.4) before attempting to install the new version
X1.5.  However, since most (all?) of you do not have version 1.4, you will
Xhave to use the User Agent to remove the previous package prior to installing
Xthis one. :-(
X
X-----------------
X
XTo Install this program:
X
X	1:  Unshar this package
X
X	2:  Type:  make 
X
X	3:  If you have a previous version of  "ccc" on the system, remove
X	    it using "Remove Installed Software" from the "Software" Menu
X	    in the "Administration" Window.
X
X	4:  Use the "Install Software sent by Electronic Mail" item in
X		the "Software Setup" menu from the "Administration" menu
X		to install the file "CCC".  This step will allow you to
X		create a Backup Installable Floppy if you decide you
X		would like it.
X
X	5:  Use "ccc"  just as you would "cc".  In your Makefiles, define
X	    CC=/bin/ccc  to force make to use the interface program.
X
X	(For those of you not running the User Agent, you can install
X	 this program by: 1:  become root [su root]
X			  2:  Type: sh Install
X			  3:  Keep a copy of the Remove file if you like.)
X
X
X"README.old" contains the README information from previous versions of ccc.
X"Revisions" contains the revision history for this script.
X--
XJeffery Small          (203) 776-2000     UUCP:   uunet!---\
XC. Jeffery Small and Associates	                  ihnp4!--- hsi!cjsa!jeff
X123 York Street, New Haven, CT  06511          hao!noao!---/
END__of_the__FILE
if test `wc -c < ./README` -ne 4865 
then
    echo "\tWAIT A MINUTE ... Expecting file size of     4865 bytes"
    echo "\t                  but got a file size of  `wc -c < ./README` bytes"
    echo "\tWARNING ......... Suggest you check file contents."
fi
else
  echo "will not over write ./README"
fi
if `test ! -s ./ccc`
then
echo "extracting ./ccc ..."
sed 's/^X//' > ./ccc << 'END__of_the__FILE'
X#########################################################################
X#									#
X# Program:		/bin/ccc		(Bourne Shell Script)	#
X# Version:		1.5			Date: 07-21-88		#
X#									#
X# Original coding by:	Arnold Robbins - Emory Univ. Computing Center	#
X# Keeper of the flame:	Jeffery Small  - (uunet!hsi!cjsa!jeff)		#
X#									#
X# SYNOPSIS								#
X#	ccc  [ flags ]  file  [ file ... ]				#
X#									#
X# DESCRIPTION								#
X#	"ccc" is an interface for the standard C-compiler (/bin/cc) on	#
X#	the AT&T UNIX-pc (aka 3B1) which allows a more natural usage of	#
X#	the shared library facilities on this machine.			#
X#									#
X#	Flags are any of the valid flags which may be passed to  cc	#
X#	with the addition of:						#
X#									#
X#	    -~ symbolname						#
X#									#
X#	where "symbolname" is the name of a shared library symbol which	#
X#	conflicts with your program and which you wish to have  ccc 	#
X#	automatically resolve for you.  This is done by eliminating the	#
X#	symbol from the shared library ifile (temporarily).		#
X#									#
X#	To use this script, you need to run the Install program	which:	#
X#		- installs /bin/ccc					#
X#		- creates  /lib/shlib.iCURSES				#
X#		- creates  /lib/libcSHLIB.a				#
X#									#
X#	You may use this replacement "ccc" as you would the original	#
X#	with the added benefit that programs will now be compiled using	#
X#	the shared library.						#
X#									#
X#	For the revision history of this script, see file "Revisions".	#
X#									#
X#########################################################################
X
XPATH=/bin:/usr/bin
Xexport PATH
X
XTMP=/tmp/ccc$$
Xtrap "rm -f $TMP; trap 0; exit 99" 1 2 3 15
Xtrap "rm -f $TMP; exit $exitcode"  0
X
XOCC=${OCC-/bin/cc}			# allows compiler to be renamed
X
Xstartoff=/lib/crt0s.o			# use the shared library by default
Xlibc=/lib/shlib.ifile
Xextralib=-lcSHLIB
X
Xfiles=
Xofiles=
Xccargs=-c				# have to run $OCC with this
Xldargs=
Xldlibs=
X
Xload=1					# run ld  (1=yes  0=no)
Xjustprint=0				# just print what would do, -#
Xverbose=0				# be verbose, -v
X
Xeditsym=				# symbol names to be edited out of the
X					# shlib.ifile which cause conflicts
Xwhile [ $# -gt 0 ]
Xdo
X	case "$1" in
X	-~)		editsym="$editsym $2"		# special shlib flag
X			shift
X			;;
X	-C)		ccargs="$ccargs $1"		# cpp flag
X			;;
X	-[UDI]*)	ccargs="$ccargs $1"		# cpp flags
X			;;
X	-#)		ccargs="$ccargs $1"		# cc flag
X			justprint=1
X			;;
X	-c)		load=0				# cc flag
X			;;
X	-[EPS])		ccargs="$ccargs $1"		# cc flags
X			load=0
X			;;
X	-g)		ccargs="$ccargs $1"		# cc & ld flags
X			ldlibs="$ldlibs -lg"
X			startoff=/lib/crt0.o
X			libc=/lib/libc.a
X			extralib=
X			;;
X	-O)		ccargs="$ccargs $1"		# cc flag
X			;;
X	-p)		ccargs="$ccargs $1"		# cc & ld flags
X			ldargs="$ldargs -L/lib/libp"
X			startoff=/lib/mcrt0.o
X			libc=/lib/libc.a
X			extralib=
X			;;
X	-W*)		ccargs="$ccargs $1"		# cc flag
X			;;
X	-680[012]0)	ccargs="$ccargs $1"		# cc flags
X			;;
X	-v)		ccargs="$ccargs $1"		# cc flag
X			verbose=1
X			;;
X	-T)		ccargs="$ccargs $1"		# cc & ld flags
X			ldargs="$ldargs -G"
X			;;
X	-[efouL])	ldargs="$ldargs $1 $2"		# ld flags
X			shift
X			;;
X	-VS)		ldargs="$ldargs $1 $2"		#ld flags
X			shift
X			;;
X	-[nNzF])	;;				# ifile sets load type
X	-ltam)		;;				# get from shared lib
X	-lc)		;;				# get from shared lib
X	-ltermlib)	;;				# get from shared lib
X	-ltermcap)	;;				# get from shared lib
X	-lcurses)	ldlibs="$ldlibs $1"
X			if [ "$startoff" = "/lib/crt0s.o" ] ; then \
X			    libc="/lib/shlib.iCURSES" ; fi
X			;;
X	-l*)		ldlibs="$ldlibs $1"		# other misc libraries
X			;;
X	-*)		ldargs="$ldargs $1"		# other flags go to ld
X			;;
X	*.[ao])		ofiles="$ofiles $1"		# files for ld
X			;;
X	*.[cs])		files="$files $1"		# files for cc and ld
X			ofiles="$ofiles `basename $1 .[cs]`.o"
X			;;
X	*)		files="$files $1"		# files(?) for cc & ld
X			ofiles="$ofiles $1"
X			;;
X	esac
X	shift
Xdone
X
X$OCC $ccargs $files					# compile source files
X
Xexitcode=$?
X
Xif [ "$exitcode" != "0" ]				# exit upon error
Xthen							# do not attempt ld
X	exit
X
Xelif [ "$load" -eq 1 ]					# run ld phase
Xthen
X
X    if [ "x$editsym" != "x" ]				# if symbols specified
X    then
X      if [ "$libc" = "/lib/libc.a" ]
X      then
X	echo "$0: Warning. /lib/libc.a is being used.  Ignoring all  -~  flags!"
X      else
X    	if [ "$verbose" -eq 1 ]
X    	then
X	  echo Modifying ifile ...
X    	fi
X	# Dumb & slow - but it works!
X	cp  $libc  $TMP
X	for i in $editsym
X	do
X		ed - $TMP <<-ENDofEDIT
X		g/^$i/s/^/x/
X		w
X		q
X		ENDofEDIT
X	done
X	libc=$TMP
X      fi
X    fi
X
X    run="/bin/ld $ldargs $startoff $ofiles $ldlibs $extralib $libc"
X     
X    if [ "$verbose" -eq 1 ]
X    then
X	echo Loading ...
X    fi
X
X    if [ "$justprint" -eq 1 ]
X    then
X	echo callsys $run
X    else
X	eval $run
X    fi
Xfi
Xexitcode=$?
Xexit
END__of_the__FILE
if test `wc -c < ./ccc` -ne 4653 
then
    echo "\tWAIT A MINUTE ... Expecting file size of     4653 bytes"
    echo "\t                  but got a file size of  `wc -c < ./ccc` bytes"
    echo "\tWARNING ......... Suggest you check file contents."
fi
else
  echo "will not over write ./ccc"
fi
if `test ! -s ./Size`
then
echo "extracting ./Size ..."
sed 's/^X//' > ./Size << 'END__of_the__FILE'
X90
END__of_the__FILE
if test `wc -c < ./Size` -ne 3 
then
    echo "\tWAIT A MINUTE ... Expecting file size of        3 bytes"
    echo "\t                  but got a file size of  `wc -c < ./Size` bytes"
    echo "\tWARNING ......... Suggest you check file contents."
fi
else
  echo "will not over write ./Size"
fi
if `test ! -s ./Name`
then
echo "extracting ./Name ..."
sed 's/^X//' > ./Name << 'END__of_the__FILE'
Xccc - A C-compiler interface for the UNIX-PC. (Ver 1.5  07-21-88)
END__of_the__FILE
if test `wc -c < ./Name` -ne 66 
then
    echo "\tWAIT A MINUTE ... Expecting file size of       66 bytes"
    echo "\t                  but got a file size of  `wc -c < ./Name` bytes"
    echo "\tWARNING ......... Suggest you check file contents."
fi
else
  echo "will not over write ./Name"
fi
if `test ! -s ./Files`
then
echo "extracting ./Files ..."
sed 's/^X//' > ./Files << 'END__of_the__FILE'
XSize
XName
XFiles
XInstall
XRemove
Xccc
XMakefile
XOLD_NAME
XREADME
XREADME.old
XRevisions
END__of_the__FILE
if test `wc -c < ./Files` -ne 81 
then
    echo "\tWAIT A MINUTE ... Expecting file size of       81 bytes"
    echo "\t                  but got a file size of  `wc -c < ./Files` bytes"
    echo "\tWARNING ......... Suggest you check file contents."
fi
else
  echo "will not over write ./Files"
fi
if `test ! -s ./Install`
then
echo "extracting ./Install ..."
sed 's/^X//' > ./Install << 'END__of_the__FILE'
X# A model install script for User Agent applications.
X#
X# C. Jeffery Small and Associates			Date: 07-21-88
X
X
X#########################################################################
X# Insert the name of the Application in NAME="", exactly as it should	#
X# appear in the User Agent Menu.  "NAME"  MUST be identical to that in	#
X# both the "Remove" Script and in the "UA_UPDATE" File.			#
X#########################################################################
X
XNAME="ccc"
X
X
X#########################################################################
X# List the application files below & assign the appropriate directory,	#
X# owner, group, and mode to each group.					#
X#########################################################################
X
XBINFILES="ccc"
X
XBIN=/bin
X
XBINMOD=755
X
XBINOWN=bin
X
XBINGRP=bin
X
X
X#########################################################################
X# Step 1:  If file OLD_NAME exists, check to see if an old version of	#
X#	   this application is installed on the system.  If so, prompt	#
X#	   for its removal prior to installing this new version.	#
X#########################################################################
X
Xif [ -s OLD_NAME ]
Xthen
X    OLDNAME=`cat OLD_NAME`
X    OLDNAME=`echo $OLDNAME`
X
X    KEY=`grep "^[0-9]* $OLDNAME$" /usr/installed/CONTENTS | cut -d' ' -f1`
X
X    if [ "x$KEY" != "x" ]
X    then
X	UNFILE="/usr/installed/${KEY}.un"
X
X	if [ ! -s "$UNFILE" ]
X	then
X	    clear
X	    echo "\007You have an old version of this application on this"
X	    echo "machine, but I am unable to find the instructions for"
X	    echo "removing it.  Please check with your system administrator"
X	    echo "and clear up this problem before attempting to install"
X	    echo "this application.\n"
X	    echo "I am aborting the installation process at this time.\n"
X	    echo "Touch  ENTER  to continue ... \c"
X	    read ANS
X	    exit 64
X	else
X	    clear
X	    echo "There is a previous version of this application called:\n"
X	    echo "    $OLDNAME \n"
X	    echo "on this system which needs to be removed before we install"
X	    echo "the new version.  If you are prepared for me to remove the"
X	    echo "old version, type a 'y' followed by a <RETURN>.  If you"
X	    echo "wish to quit the install process, type 'n'.\n\n"
X	    echo "Do you wish to proceed with the removal? (y or n): \c"
X	    read ANS
X	    if [ "$ANS" = "y" -o "$ANS" = "Y" ]
X	    then
X		echo "OK.  Beginning removal of $OLDNAME ..... \n\n"
X	        chmod +rx $UNFILE
X	        $UNFILE
X	        if [ "$?" != "64" ]
X	        then
X    		  grep -v "^[0-9]* $OLDNAME$" /usr/installed/CONTENTS > /tmp/$$
X		  mv /tmp/$$ /usr/installed/CONTENTS
X		  grep -v "^Name=$OLDNAME$" $UA/Uninstall.menu > /tmp/$$
X		  mv /tmp/$$ $UA/Uninstall.menu
X		  grep -v "^Name=$OLDNAME$" $UA/Showsoft.menu > /tmp/$$
X		  mv /tmp/$$ $UA/Showsoft.menu
X
X		  rm $UNFILE
X		  echo "\nRemoval of $OLDNAME has been completed."
X		fi
X	    else
X		echo "\nOK.  Aborting instalation.  Bye bye!"
X	        echo "\nTouch  ENTER  to continue ... \c"
X	        read ANS
X		exit 64
X	    fi
X	fi
X    fi
Xfi
X
Xecho "\n\nNow beginning the installation of $NAME ...\n"
X
X#########################################################################
X# Step 2:  See if the C compiler exists on this system.			#
X#########################################################################
X
Xif [ ! -x  $BIN/cc ]
Xthen
X    echo "    \007The C-compiler is not installed on this machine.\n"
X    echo "    To install this application you must first load the"
X    echo "    Development Set Utilities onto this system.\n\n"
X    echo "    $NAME cannot be installed at this time.\n"
X    echo "    Hit  <ENTER>  to continue ... \c"
X    read ANS
X    exit 64				# This aborts the Install process
Xfi
X
X#########################################################################
X# Step 3:  Link files into the proper directories.			#
X#########################################################################
X
Xecho "\n    Installing the files ..."
X
Xfor i in $BINFILES
Xdo
X    chown $BINOWN $i
X    chgrp $BINGRP $i
X    chmod $BINMOD $i
X    ln $i $BIN
Xdone
X
X#########################################################################
X# Step 4:  Put any special work here.					#
X#########################################################################
X
Xecho "\n    Creating a curses compatible shared-library ifile."
Xecho   "    .... working ..."
X
Xif [ ! -f /lib/shlib.ifile ]
Xthen
X    echo "    \007Error:  /lib/shlib.ifile is missing!"
X    echo "    Make sure that you have loaded the Development Set."
X    echo "    Hit <ENTER> to continue ... \c"
X    read ANS
Xelse
X    # The following is credited to Emmet P. Gray (fthood!gray)  Thanks Emmet!
X
X    cp /lib/shlib.ifile  /lib/shlib.iCURSES
X    chmod 644 /lib/shlib.iCURSES
X    chown bin /lib/shlib.iCURSES
X    chgrp bin /lib/shlib.iCURSES
X
X    ed  -  /lib/shlib.iCURSES  <<-'ENDofEDIT'
X	1,$s/^PC/xPC/
X	1,$s/^BC/xBC/
X	1,$s/^UP/xUP/
X	1,$s/^ospeed/xospeed/
X	1,$s/^LINES/xLINES/
X	1,$s/^COLS/xCOLS/
X	1,$s/^tgetflag/xtgetflag/
X	1,$s/^tgetent/xtgetent/
X	1,$s/^tgetstr/xtgetstr/
X	1,$s/^tgetnum/xtgetnum/
X	1,$s/^tgoto/xtgoto/
X	1,$s/^tputs/xtputs/
X	1,$s/^wrefresh/xwrefresh/
X	1,$s/^initscr/xinitscr/
X	1,$s/^cbreak/xcbreak/
X	1,$s/^nl/xnl/
X	1,$s/^flushinp/xflushinp/
X	1,$s/^noecho/xnoecho/
X	1,$s/^savetty/xsavetty/
X	1,$s/^resetty/xresetty/
X	1,$s/^echo/xecho/
X	1,$s/^nocbreak/xnocbreak/
X	1,$s/^nonl/xnonl/
X	1,$s/^keypad/xkeypad/
X	1,$s/^endwin/xendwin/
X	1,$s/^printw/xprintw/
X	1,$s/^fixterm/xfixterm/
X	1,$s/^resetterm/xresetterm/
X	1,$s/^setterm/xsetterm/
X	1,$s/^baudrate/xbaudrate/
X	w
X	q
XENDofEDIT
Xfi
X
Xgrep "daylight" /lib/shlib.ifile > /dev/null 2>&1
X
Xif [ $? -ne 0 ]
Xthen
X  echo "\n    The 'daylight' variable is missing from the shlib.ifile."
X  echo   "    Our best guess is that the entry should be:  daylight = 0x303658;"
X  echo   "    Would you like to add it to the file? (y or n): \c"
X  read ANS
X
X  if [ "$ANS" = "y"  -o  "$ANS" = "Y" ]
X  then
X    echo "daylight = 0x303658;" >> /lib/shlib.ifile
X
X    grep "daylight" /lib/shlib.iCURSES > /dev/null 2>&1
X
X    if [ $? -ne 0 ]
X    then
X        echo "daylight = 0x303658;" >> /lib/shlib.iCURSES
X    fi
X
X    echo "\n    OK.  The daylight variable has been added.\n"
X  else
X    echo "\n    OK.  We will skip this step.\n"
X  fi
Xfi
X
Xecho "\n    Creating a supplemental library of routines missing from"
Xecho   "    the shared-library ... working ..."
X
Xif [ ! -f /lib/libc.a ]
Xthen
X    echo "    \007Error:  /lib/libc.a  is missing!"
X    echo "    Make sure that you have loaded the Development Set."
X    echo "    Hit <ENTER> to continue ... \c"
X    read ANS
Xelse
X    if [ -s /UNIX3.5 ]
X    then
X	Uver="3.5"
X    elif [ -s /UNIX3.51  -o  -s /UNIX3.51a ]
X    then
X	Uver="3.51"
X    else
X	ANS="n"
X    fi
X
X    if [ "$Uver" = "3.5"  -o  "$Uver" = "3.51" ]
X    then
X	echo "\n\n    You seem to be running UNIX version ${Uver}."
X	echo     "    Is this correct?  (y or n): \c"
X	read ANS
X    fi
X
X    if [ "$ANS" != "y"  -a  "$ANS" != "Y" ]
X    then
X	echo "\n\n    Please tell me what version of UNIX you are using."
X	echo     "    At this time, I only know how to make installations"
X	echo     "    for versions 3.5 and 3.51 (which includes 3.51a)."
X	echo     "    If you are running 3.0 I'm afraid I can't help you"
X	echo     "    at this time.  Sorry!"
X
X	while true
X	do
X	    echo   "\n    Your version is? (3.5 or 3.51): \c"
X	    read Uver
X	    if [ "$Uver" = "3.5"  -o  "$Uver" = "3.51" ]
X	    then
X		break
X	    else
X		echo "\007    You may only enter <3.5> or <3.51>."
X		echo     "    Please try again."
X	    fi
X	done
X    fi
X
X    if [ "$Uver" = "3.5" ]
X    then
X	# Mods for 3.5 credited to Jim Apedaile.  Thanks Jim!
X
X        OFILES="acct.o assert.o aulrem.o biglitpow.o bsearch.o clrerr.o \
X		doprnt.o doscan.o dtop.o fakcu.o findiop.o hsearch.o \
X	        lfind.o lockf.o lsearch.o ltostr.o mcount.o mon.o ptod.o \
X		setvbuf.o sigrte.o strtod.o sigtrap.o tell.o tfind.o \
X		tsearch.o vfprintf.o vprintf.o vsprintf.o"
X    else
X        OFILES="acct.o aulrem.o biglitpow.o clrerr.o doprnt.o doscan.o \
X		dtop.o fakcu.o findiop.o lfind.o lockf.o lsearch.o ltostr.o \
X		mcount.o ptod.o setvbuf.o sigrte.o strtod.o tell.o tfind.o \
X		vfprintf.o vprintf.o vsprintf.o"
X    fi
X    
X    ar     x   /lib/libc.a  $OFILES
X    chown root $OFILES
X    chgrp root $OFILES
X
X    ar     qc  libcSHLIB.a  $OFILES
X    chmod  644 libcSHLIB.a  
X    chown  bin libcSHLIB.a  
X    chgrp  bin libcSHLIB.a  
X
X    ln  libcSHLIB.a  /lib
Xfi
X
X#########################################################################
X# Step 5:  Close out with any explanatory comments.			#
X#########################################################################
X
Xecho "\nInstallation of $NAME is now complete."
Xecho "\nUse ccc just as you would cc.  In Makefiles, define"
Xecho   "CC=/bin/ccc at the head of your file to force make"
Xecho   "to use the ccc compiler interface."
Xecho "\nHit  <ENTER>  to continue ... \c"
Xread ANS
Xexit 0
END__of_the__FILE
if test `wc -c < ./Install` -ne 8872 
then
    echo "\tWAIT A MINUTE ... Expecting file size of     8872 bytes"
    echo "\t                  but got a file size of  `wc -c < ./Install` bytes"
    echo "\tWARNING ......... Suggest you check file contents."
fi
else
  echo "will not over write ./Install"
fi
if `test ! -s ./Remove`
then
echo "extracting ./Remove ..."
sed 's/^X//' > ./Remove << 'END__of_the__FILE'
X# A model Remove script for User Agent applications.
X#
X# C. Jeffery Small and Associates			Date: 07-21-88
X
X
X#########################################################################
X# Insert the name of the Application in NAME="", exactly as it should	#
X# appear in the User Agent Menu.  "NAME"  MUST be identical to that in	#
X# both the "Install" Script and in the "UA_UPDATE" File.		#
X#########################################################################
X
XNAME="ccc"
X
XBINFILES="ccc"
XLIBFILES="shlib.iCURSES libcSHLIB.a"
X
XBIN=/bin
XLIB=/lib
X
X
Xecho "Now beginning the removal of $NAME ...\n"
X
Xfor i in $BINFILES
Xdo
X    rm -f  $BIN/$i
Xdone
X
Xfor i in $LIBFILES
Xdo
X    rm -f $LIB/$i
Xdone
X
X#########################################################################
X# Step 2:  Put any special work here.					#
X#########################################################################
X
X# The daylight variable may have been added to /lib/shlib.ifile.
X# Check to see if it is there and then ask if it should be removed.
X
Xgrep  'daylight = 0x303658;'  /lib/shlib.ifile  > /dev/null  2>&1
X
Xif [ $?  -eq  0 ]
Xthen
X    echo "\n    Previously, the 'daylight' variable was added to your"
X    echo   "    /lib/shlib.ifile file.  Do you want me to remove this"
X    echo   "    entry now?  (y or n): \c"
X    read ANS
X
X    if [ "$ANS" = "y"  -o  "$ANS" = "Y" ]
X    then
X	ed  -  /lib/shlib.ifile  <<-'ENDofEDIT'
X	/daylight = 0x303658/d
X	w
X	q
XENDofEDIT
X    fi
Xfi
X
X
X#########################################################################
X# Step 3:  Close out with any explanatory comments.			#
X#########################################################################
X
X
Xecho "\nThe Removal of $NAME is now complete."
Xexit 0
END__of_the__FILE
if test `wc -c < ./Remove` -ne 1708 
then
    echo "\tWAIT A MINUTE ... Expecting file size of     1708 bytes"
    echo "\t                  but got a file size of  `wc -c < ./Remove` bytes"
    echo "\tWARNING ......... Suggest you check file contents."
fi
else
  echo "will not over write ./Remove"
fi
if `test ! -s ./Makefile`
then
echo "extracting ./Makefile ..."
sed 's/^X//' > ./Makefile << 'END__of_the__FILE'
XSHELL=/bin/sh
X
X
Xinstall:	ccc
X	cat ./Files | cpio -ocBv > /usr/spool/uucppublic/CCC+IN
X
Xshar:
X	shar -f CCC README ccc Size Name Files Install Remove Makefile \
X		    OLD_NAME README.old Revisions
END__of_the__FILE
if test `wc -c < ./Makefile` -ne 195 
then
    echo "\tWAIT A MINUTE ... Expecting file size of      195 bytes"
    echo "\t                  but got a file size of  `wc -c < ./Makefile` bytes"
    echo "\tWARNING ......... Suggest you check file contents."
fi
else
  echo "will not over write ./Makefile"
fi
if `test ! -s ./OLD_NAME`
then
echo "extracting ./OLD_NAME ..."
sed 's/^X//' > ./OLD_NAME << 'END__of_the__FILE'
Xccc - A C-compiler interface for the UNIX-pc. (Ver 1.4  04-29-88)
END__of_the__FILE
if test `wc -c < ./OLD_NAME` -ne 66 
then
    echo "\tWAIT A MINUTE ... Expecting file size of       66 bytes"
    echo "\t                  but got a file size of  `wc -c < ./OLD_NAME` bytes"
    echo "\tWARNING ......... Suggest you check file contents."
fi
else
  echo "will not over write ./OLD_NAME"
fi
if `test ! -s ./README.old`
then
echo "extracting ./README.old ..."
sed 's/^X//' > ./README.old << 'END__of_the__FILE'
X-------- Original README for ccc Version 1.3 ---------------------------------
X
XDate:	04-20-88
XFrom:	Jeffery Small  (uunet!hsi!cjsa!jeff)
X
XAttached is a new version (1.3) of the  "ccc"  script which I previously
Xposted to the net.  A few people who were using version 1.2 of the script
Xhad problems compiling programs because there are a number of routines
Xcontained in /lib/libc.a which are not built into the shared libraries.
XWhile I attempted to address this problem in version 1.2 for curses-based
Xprograms, I did not provide a generalized solution to the problem.
X
XWhat I have now done is take a look at all of the routines contained in the
Xstd. library (ar -t /lib/libc.a) and compared them to the reference addresses
Xin /lib/shlib.ifile.  The following, is a complete list of all non-matching
Xnames.
X
X  __cerror.o   __msgsys.o  __semsys.o  __setpgrp.o  __shmsys.o   __stime.o
X  __utssys.o   acct.o  	   assert.o    aulrem.o     biglitpow.o  bufctl.o
X  clrerr.o     ctdata.o    ctype.o     cuexit.o     data.o       doprnt.o
X  doscan.o     dtop.o      errlst.o    fakcu.o      filbuf.o     findiop.o
X  fladd.o      flcvt.o     fldvmd.o    flmul.o      flsbuf.o     fpa_decs.o
X  fpachk.o     getut.o     highbuf.o   l3.o         lfind.o      lockf.o
X  lsearch.o    ltostr.o    mcount.o    mon.o        msgsys.o     nlist.o
X  ptod.o       rew.o       semsys.o    setvbuf.o    shmsys.o     sigrte.o
X  strtod.o     tell.o      tfind.o     vfprintf.o   vprintf.o    vsprintf.o
X
XHowever, many of these modules are in fact, supported by the shared library,
Xso I then tested each module individually to determine which ones did and
Xdid not conflict with the shared library symbols.  The following list are
Xthe non-conflicting modules.
X
X  __cerror.o   __msgsys.o  __semsys.o  __setpgrp.o  __shmsys.o   __stime.o
X  __utssys.o   acct.o       aulrem.o   biglitpow.o  bufctl.o     clrerr.o
X  doprnt.o     doscan.o    dtop.o      fakcu.o      findiop.o    lfind.o
X  lockf.o      lsearch.o   ltostr.o    mcount.o     ptod.o       setvbuf.o
X  sigrte.o     strtod.o    tell.o       tfind.o      vfprintf.o  vprintf.o
X  vsprintf.o
X
XIt is obvious that missing routines such as  doprnt, lockf, vprintf, etc.
Xcan be a real problem.  What some of the other more obscure routines do is
Xa mystery to me.  An examination of the contents using  "strings"  reveals
Xthat some of thease modules depend upon one another.  I have extracted all
Xof these missing modules and constructed an adjunct support library for
Xshlib.ifile which I call "/lib/libcSHLIB.a" and I have modified "ccc" to
Xaccess this library.
X
XMy guess is that certain of these routines (eg: __msgsys.o) don't really
Xbelong in the adjunct library, but I can't predict what some future program
Xmay actually need - and (so far!) their inclusion doesn't appear to be
Xcausing any problems.  Perhaps someone more knowledgeable can shed some
Xlight on this list and possible pare it down.
X
XThere has also been some recent discussion about  "daylight"  being missing
Xfrom the shlib.ifile.  The idea of adding the line "daylight = 0x303658;"
Xwas recently suggested in an article originally posted by Ken Brassler.
XI have provided an option (during installation) of having this variable
Xadded to your ifile and thus, hopefully plug one more gap.
X
XI have tested this version of "ccc" by compiling a number of programs using
Xa variety of #include files and libraries (-lcurses, -lm -lld) and have had
Xno problems to date.  I would appreciate receiving feedback from anyone who
Xdiscovers problems created by the approach I have taken or finds a program
Xwhich compiles with the standard library but fails to compile using the
Xshared library and ccc.
X
XBuy the way, this work applies to version 3.51 of the Development Set.  I
Xam not sure how well all of this works under earlier versions of the OS.
XPossible someone running 3.0 or 3.5 could let me know.
X
XIf you previously installed version 1.2 of "ccc" with my Install script, 
Xthen be sure to use the  User Agent  to remove that version before you
Xinstall this one.  To install this program, follow the instructions below.
X
XWith regards,
X
XJeff
X
X-------- Original README for ccc Version 1.2 ---------------------------------
X
XThe enclosed files provide a updated c-compiler interface for the UNIX-PC
Xwhich automates the use of the shared libraries when compiling programs on
Xthis machine.
X
XCredit for the initial idea of a compiler interface goes to Arnold Robbins
Xof Emory University Computing Center who distributed the original interface
Xprogram.  To this original work I have done the following:
X
X	- Added and/or modify support for -[CUefouLW] & -VS flags
X	- Expanded comments throughout the script for readability.
X	- Performed some minor reorganization for clarity.
X	- Modified the script so as not to rename /bin/cc.  Instead, this
X		script is called /bin/ccc and it references the original cc.
X	- Added a test which prevents the loader-step from starting up if
X	  an error occurs in the compiling stage.  Prior to this, linking
X	  would be attempted even if one of the .o files was missing.
X
X
XRecently, Emmet Gray of the US Army HQ III Corp sent out a script for
Xmodifying the /lib/shlib.ifile to allow curses programs to be compiled
Xusing the shared libraries.  This was a great idea but I found three
Xadditions which I wanted to make:
X
X	(1) I wanted a permanent copy of the edited .ifile so that I didn't
X	    have to re-edit the original file each time I compiled a curses
X	    program.
X
X	(2) I found that there were a few routines contained in /lib/libc.a
X	    which were not duplicated in the shared libraries but which
X	    were required by the curses library /usr/lib/libcurses.a.
X
X	(3) I wanted curses programs to compile transparently like any
X	    other program - which meant modifying /bin/ccc to handle the
X	    work.
X	    
X
XFinally, I like the way that the UNIX-PC keeps track of installed software
Xby hiding a Remove script which cleans up if you decide to remove the
Xthe software at a later date.  So what you have here is a set of files
Xto make a UNIX-PC Installable File.  To Install this program:
X
X	1:  Unshar this package
X
X	2:  Type:  make 
X
X	3:  Use the "Install Software sent by Electronic Mail" item in
X		the "Software Setup" menu from the "Administration" menu
X		to install the file "CCC".  This step will allow you to
X		create a Backup Installable Floppy if you decide you
X		would like it.
X
X	4:  Use "ccc"  just as you would "cc".  In your Makefiles, define
X	    CC=/bin/ccc  to force make to use the interface program.
X
X	(For those of you not running the User Agent, you can install
X	 this program by: 1:  become root [su root]
X			  2:  Type: sh Install
X			  3:  Keep a copy of the Remove file if you like.)
X
X
XI have compiled a number of curses program using this modified script and
Xhave encountered no problems to date.  Should you find any problems with
Xthis script and support files, I would appreciate hearing about them.
X
X--
XJeffery Small          (203) 776-2000     UUCP:   uunet!---\
XC. Jeffery Small and Associates	                  ihnp4!--- hsi!cjsa!jeff
X123 York Street, New Haven, CT  06511          hao!noao!---/
END__of_the__FILE
if test `wc -c < ./README.old` -ne 7139 
then
    echo "\tWAIT A MINUTE ... Expecting file size of     7139 bytes"
    echo "\t                  but got a file size of  `wc -c < ./README.old` bytes"
    echo "\tWARNING ......... Suggest you check file contents."
fi
else
  echo "will not over write ./README.old"
fi
if `test ! -s ./Revisions`
then
echo "extracting ./Revisions ..."
sed 's/^X//' > ./Revisions << 'END__of_the__FILE'
XProgram Name:		/bin/ccc
XCurrent Version:	1.5
X
XLatest Revision:	07-21-88
X
XThis revision history was moved to a seperate file since it was adding
Xtoo much bulk to the ccc shell script.
X
XThe original script, which formed a very substantial basis for the current
Xincarnation of ccc, was received from Arnold Robbins of the Emory University
XComputing Center.
X
X
XREVISION HISTORY:
X
X09-10-87  V1.0: Jeffery Small  (uunet!hsi!cjsa!jeff)
X		  - Add/modify support for -[CUefouLW] & -VS flag
X		  - Expanded comments
X		  - Performed some minor reorganization.
X
X09-22-87  V1.1: Jeffery Small  (uunet!hsi!cjsa!jeff)
X		  - Modified script to leave /bin/cc alone
X		  - Rename this script to /bin/ccc
X		  - Prevent loader-step from starting if an error
X		      occurs in the compiling stage.
X
X01-20-88  V1.2: Jeffery Small  (uunet!hsi!cjsa!jeff)
X		  - Added support to allow curses programs to be
X		      compiled with the shared library.  This
X		      requires the following two support files.
X		      (1) /lib/shlib.iCURSES - edited version of
X			  /lib/shlib.ifile modified to eliminate
X			  conflicts with the curses library. Idea
X			  credits to Emmet P. Gray (fthood!egray)
X		      (2) /lib/libCURSES.a - missing routines
X			  from /lib/libc.a not defined by the
X			  shared libraries.
X
X04-20-88  V1.3:	Jeffery Small  (uunet!hsi!cjsa!jeff)
X		  - Modified script to add support for ALL libc.a
X		      routines which are missing from shlib.ifile.
X		      This replaces /lib/libCURSES.a with the new
X		      library /lib/libcSHLIB.a which is created by
X		      an accompanying Install script.
X
X04-29-88  V1.4: David Wexelblat (uunet!wucs1!wucs2!thorin!dwex) &
X		Kevin O'Gorman (mtune!ethos!ihtlt!kosman!kevin)
X		  - Fix bug in ordering of /bin/ld library arguments
X
X		Jim Apedaile (ames!pacbell!pttesac!apedaile)
X		  - Modified Install to handle OS version 3.5 and
X		    3.51.  Thanks to Jim Apedaile for mods.
X
X07-21-88  V1.5: Jeffery Small (uunet!hsi!cjsa!jeff)
X		  - Added exit traps
X		  - Fixed -lcurses bug where $libc was being reassigned
X		      improperly when the -g or -p flags had been
X		      previously set.
X		  - Added -~ flag which allows user to specify individual
X		      symbols which conflict with the shared library that
X		      should be automatically resolved.
END__of_the__FILE
if test `wc -c < ./Revisions` -ne 2268 
then
    echo "\tWAIT A MINUTE ... Expecting file size of     2268 bytes"
    echo "\t                  but got a file size of  `wc -c < ./Revisions` bytes"
    echo "\tWARNING ......... Suggest you check file contents."
fi
else
  echo "will not over write ./Revisions"
fi
echo "Finished archive 1 of 1"
# if you want to concatenate archives, remove anything after this line
exit



More information about the Unix-pc.sources mailing list