[comp.sources.misc] v15i090: dmake version 3.6 patch 1

dvadura@watdragon.waterloo.edu (Dennis Vadura) (12/17/90)

Posting-number: Volume 15, Issue 90
Submitted-by: Dennis Vadura <dvadura@watdragon.waterloo.edu>
Archive-name: dmake-3.6/patch01

#!/bin/sh
# shar:	Shell Archiver  (v1.22)
#
# This is part 1 of a multipart archive                                    
# do not concatenate these parts, unpack them in order with /bin/sh        
#
#	Run the following text with /bin/sh to create:
#	  dm36.p1
#
if test -r s2_seq_.tmp
then echo "Must unpack archives in sequence!"
     next=`cat s2_seq_.tmp`; echo "Please unpack part $next next"
     exit 1; fi
sed 's/^X//' << 'SHAR_EOF' > dm36.p1 &&
X#!/bin/sh
X# dodiff:  Directory tree maintainer (v1.1)
X#
X# DMAKE Version 3.6, patch #1
X# ---------------------------
X# 
X# Severity: Medium
X# 
X# Nature:   Minor teething problems with UNIX, and major problems with MSC
X#           6.0, and TCC 2.0 swapping versions fixed.
X# 
X# Format:   Shar containing new versions of affected files.  With appropriate
X#           patches.  (run the patch file through sh in the source distribution
X#           directory and it will do the rest)
X# 
X#           Also available as pub/src/dmake-3.6-patch1 on watmsg.uwaterloo.edu
X#           (129.97.129.9)
X# 
X#           Archived source on watmsg incorporates this patch.
X# 
X# Prerequisites: dmake version 3.6, patchlevel 1 source distribution
X# 
X# 
X# Description of Fixes:
X# ---------------------
X# 1. Compilation problems with Microsoft compilers, and swapping versions of
X#    dmake.  To the best of my knowledge versions 4.0, 5.0, 5.1 and 6.0 of MSC
X#    now fully compile and generate running binaries both for swapping and non
X#    swapping versions of dmake.
X# 
X# 2. Other fixes include a hack to allow parsing of makefiles shipped over from
X#    DOS that contain cr-lf combinations.  This doesn't seem to impact processing
X#    of normal UNIX makefiles at all.
X# 
X# 3. Changed DOS versions of tempnam.c to use _psp to generate temporary file
X#    names instead of the current time as supplied by time().  The reason for
X#    this is too bizzare to go into here.
X# 
X# 4. Xenix is now a supported make target, as is Atari-ST TOS using GCC.
X# 
X# 5. A number of small tweaks here and there, not serious but might make
X#    compiles on a number of systems cleaner.
X# 
X# 6. Clarification of the documentation in several spots.
X# 
X# 7. Patch to dmake.tf to remove ^G control characters.  NOTE:  This patch
X#    may fail if you never received the ^G characters in the first place.  If
X#    so then please apply the patch by hand.
X# 
X# 8. inferred targets that infer recipes from rules having a .SETDIR attribute
X#    now have the .SETDIR applied prior to making the prerequisites and the
X#    target.
X# 
X# Many thanks to all those that helped find and identify and in some cases
X# provided fixes and/or new code for the above enhancements.
X# 
X# -dennis
X#
X# Remove Obsolete files from distribution
Xrm -f msdos/mscdos/obj60swp.rsp
Xrm -f msdos/mscdos/obj60.rsp
Xrm -f msdos/mscdos/mkswp.bat
Xrm -f msdos/mscdos/mk.bat
Xrm -f msdos/mscdos/lib60swp.rsp
Xrm -f msdos/mscdos/lib60.rsp
X
X# Now use a shar archive to add any new files to the distribution
X# shar:	Shell Archiver  (v1.22)
X#
X#	Run the following text with /bin/sh to create:
X#	  msdos/mscdos/mk40.bat
X#	  msdos/mscdos/mk40swp.bat
X#	  msdos/mscdos/mk50.bat
X#	  msdos/mscdos/mk50swp.bat
X#	  msdos/mscdos/mk51.bat
X#	  msdos/mscdos/mk51swp.bat
X#	  msdos/mscdos/optoff.h
X#	  readme/atari.tos
X#	  readme/patch1
X#	  tos
X#	  tos/arlib.c
X#	  tos/config.h
X#	  tos/config.mk
X#	  tos/dirbrk.c
X#	  tos/make.sh
X#	  tos/rmprq.c
X#	  tos/ruletab.c
X#	  tos/runargv.c
X#	  tos/startup.h
X#	  tos/startup.mk
X#	  tos/sysintf.h
X#
Xsed 's/^X//' << 'SHAR_EOF' > msdos/mscdos/mk40.bat &&
XXmkdir objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  infer.c
XXmv infer.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  make.c
XXmv make.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  stat.c
XXmv stat.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  expand.c
XXmv expand.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  string.c
XXmv string.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  hash.c
XXmv hash.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  dag.c
XXmv dag.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  dmake.c
XXmv dmake.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  path.c
XXmv path.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  imacs.c
XXmv imacs.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  sysintf.c
XXmv sysintf.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  parse.c
XXmv parse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  getinp.c
XXmv getinp.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  quit.c
XXmv quit.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  basename.c
XXmv basename.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  dump.c
XXmv dump.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  macparse.c
XXmv macparse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  rulparse.c
XXmv rulparse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  percent.c
XXmv percent.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  function.c
XXmv function.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\ruletab.c
XXmv ruletab.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\dirbrk.c
XXmv dirbrk.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\runargv.c
XXmv runargv.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\arlib.c
XXmv arlib.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\_chdir.c
XXmv _chdir.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\switchar.c
XXmv switchar.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\rmprq.c
XXmv rmprq.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\mscdos\tempnam.c
XXmv tempnam.obj objects
XXlink @msdos\mscdos\obj.rsp,dmake.exe,NUL.MAP;
XSHAR_EOF
Xchmod 0640 msdos/mscdos/mk40.bat || echo "restore of msdos/mscdos/mk40.bat fails"
Xset `wc -c msdos/mscdos/mk40.bat`;Sum=$1
Xif test "$Sum" != "3127"
Xthen echo original size 3127, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > msdos/mscdos/mk40swp.bat &&
XXmkdir objects
XXmasm -t -mx -Dmcompact msdos\exec.asm;
XXmv exec.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  infer.c
XXmv infer.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  make.c
XXmv make.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  stat.c
XXmv stat.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  expand.c
XXmv expand.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  string.c
XXmv string.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  hash.c
XXmv hash.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  dag.c
XXmv dag.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  dmake.c
XXmv dmake.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  path.c
XXmv path.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  imacs.c
XXmv imacs.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  sysintf.c
XXmv sysintf.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  parse.c
XXmv parse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  getinp.c
XXmv getinp.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  quit.c
XXmv quit.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  basename.c
XXmv basename.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  dump.c
XXmv dump.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  macparse.c
XXmv macparse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  rulparse.c
XXmv rulparse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  percent.c
XXmv percent.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  function.c
XXmv function.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\ruletab.c
XXmv ruletab.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\dirbrk.c
XXmv dirbrk.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\runargv.c
XXmv runargv.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\arlib.c
XXmv arlib.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\_chdir.c
XXmv _chdir.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\switchar.c
XXmv switchar.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\rmprq.c
XXmv rmprq.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\find.c
XXmv find.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\spawn.c
XXmv spawn.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -mC -DM_I86=1 -D__STDC__=1  msdos\mscdos\tempnam.c
XXmv tempnam.obj objects
XXlink @msdos\mscdos\objswp.rsp,dmake.exe,NUL.MAP;
XSHAR_EOF
Xchmod 0640 msdos/mscdos/mk40swp.bat || echo "restore of msdos/mscdos/mk40swp.bat fails"
Xset `wc -c msdos/mscdos/mk40swp.bat`;Sum=$1
Xif test "$Sum" != "3411"
Xthen echo original size 3411, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > msdos/mscdos/mk50.bat &&
XXmkdir objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs infer.c
XXmv infer.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs make.c
XXmv make.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs stat.c
XXmv stat.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs expand.c
XXmv expand.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs string.c
XXmv string.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs hash.c
XXmv hash.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs dag.c
XXmv dag.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs dmake.c
XXmv dmake.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs path.c
XXmv path.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs imacs.c
XXmv imacs.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs sysintf.c
XXmv sysintf.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs parse.c
XXmv parse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs getinp.c
XXmv getinp.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs quit.c
XXmv quit.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs basename.c
XXmv basename.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs dump.c
XXmv dump.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs macparse.c
XXmv macparse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs rulparse.c
XXmv rulparse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs percent.c
XXmv percent.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs function.c
XXmv function.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\ruletab.c
XXmv ruletab.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\dirbrk.c
XXmv dirbrk.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\runargv.c
XXmv runargv.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\arlib.c
XXmv arlib.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\_chdir.c
XXmv _chdir.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\switchar.c
XXmv switchar.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\rmprq.c
XXmv rmprq.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\mscdos\tempnam.c
XXmv tempnam.obj objects
XXlink @msdos\mscdos\obj.rsp,dmake.exe,NUL.MAP;
XSHAR_EOF
Xchmod 0640 msdos/mscdos/mk50.bat || echo "restore of msdos/mscdos/mk50.bat fails"
Xset `wc -c msdos/mscdos/mk50.bat`;Sum=$1
Xif test "$Sum" != "3155"
Xthen echo original size 3155, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > msdos/mscdos/mk50swp.bat &&
XXmkdir objects
XXmasm -t -mx -Dmcompact msdos\exec.asm;
XXmv exec.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs infer.c
XXmv infer.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs make.c
XXmv make.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs stat.c
XXmv stat.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs expand.c
XXmv expand.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs string.c
XXmv string.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs hash.c
XXmv hash.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs dag.c
XXmv dag.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs dmake.c
XXmv dmake.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs path.c
XXmv path.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs imacs.c
XXmv imacs.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs sysintf.c
XXmv sysintf.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs parse.c
XXmv parse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs getinp.c
XXmv getinp.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs quit.c
XXmv quit.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs basename.c
XXmv basename.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs dump.c
XXmv dump.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs macparse.c
XXmv macparse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs rulparse.c
XXmv rulparse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs percent.c
XXmv percent.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs function.c
XXmv function.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\ruletab.c
XXmv ruletab.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\dirbrk.c
XXmv dirbrk.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\runargv.c
XXmv runargv.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\arlib.c
XXmv arlib.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\_chdir.c
XXmv _chdir.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\switchar.c
XXmv switchar.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\rmprq.c
XXmv rmprq.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\find.c
XXmv find.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\spawn.c
XXmv spawn.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=500 -Oscl -Gs msdos\mscdos\tempnam.c
XXmv tempnam.obj objects
XXlink @msdos\mscdos\objswp.rsp,dmake.exe,NUL.MAP;
XSHAR_EOF
Xchmod 0640 msdos/mscdos/mk50swp.bat || echo "restore of msdos/mscdos/mk50swp.bat fails"
Xset `wc -c msdos/mscdos/mk50swp.bat`;Sum=$1
Xif test "$Sum" != "3441"
Xthen echo original size 3441, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > msdos/mscdos/mk51.bat &&
XXmkdir objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs infer.c
XXmv infer.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs make.c
XXmv make.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs stat.c
XXmv stat.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs expand.c
XXmv expand.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs string.c
XXmv string.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs hash.c
XXmv hash.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs dag.c
XXmv dag.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs dmake.c
XXmv dmake.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs path.c
XXmv path.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs imacs.c
XXmv imacs.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs sysintf.c
XXmv sysintf.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs parse.c
XXmv parse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs getinp.c
XXmv getinp.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs quit.c
XXmv quit.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs basename.c
XXmv basename.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs dump.c
XXmv dump.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs macparse.c
XXmv macparse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs rulparse.c
XXmv rulparse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs percent.c
XXmv percent.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs function.c
XXmv function.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\ruletab.c
XXmv ruletab.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\dirbrk.c
XXmv dirbrk.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\runargv.c
XXmv runargv.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\arlib.c
XXmv arlib.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\_chdir.c
XXmv _chdir.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\switchar.c
XXmv switchar.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\rmprq.c
XXmv rmprq.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\mscdos\tempnam.c
XXmv tempnam.obj objects
XXlink @msdos\mscdos\obj.rsp,dmake.exe,NUL.MAP;
XSHAR_EOF
Xchmod 0640 msdos/mscdos/mk51.bat || echo "restore of msdos/mscdos/mk51.bat fails"
Xset `wc -c msdos/mscdos/mk51.bat`;Sum=$1
Xif test "$Sum" != "3155"
Xthen echo original size 3155, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > msdos/mscdos/mk51swp.bat &&
XXmkdir objects
XXmasm -t -mx -Dmcompact msdos\exec.asm;
XXmv exec.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs infer.c
XXmv infer.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs make.c
XXmv make.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs stat.c
XXmv stat.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs expand.c
XXmv expand.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs string.c
XXmv string.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs hash.c
XXmv hash.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs dag.c
XXmv dag.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs dmake.c
XXmv dmake.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs path.c
XXmv path.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs imacs.c
XXmv imacs.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs sysintf.c
XXmv sysintf.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs parse.c
XXmv parse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs getinp.c
XXmv getinp.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs quit.c
XXmv quit.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs basename.c
XXmv basename.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs dump.c
XXmv dump.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs macparse.c
XXmv macparse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs rulparse.c
XXmv rulparse.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs percent.c
XXmv percent.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs function.c
XXmv function.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\ruletab.c
XXmv ruletab.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\dirbrk.c
XXmv dirbrk.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\runargv.c
XXmv runargv.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\arlib.c
XXmv arlib.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\_chdir.c
XXmv _chdir.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\switchar.c
XXmv switchar.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\rmprq.c
XXmv rmprq.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\find.c
XXmv find.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\spawn.c
XXmv spawn.obj objects
XXcl -c -DHELP -I. -Icommon -Imsdos -Imsdos\mscdos -AC -D_MSC_VER=510 -Oscl -Gs msdos\mscdos\tempnam.c
XXmv tempnam.obj objects
XXlink @msdos\mscdos\objswp.rsp,dmake.exe,NUL.MAP;
XSHAR_EOF
Xchmod 0640 msdos/mscdos/mk51swp.bat || echo "restore of msdos/mscdos/mk51swp.bat fails"
Xset `wc -c msdos/mscdos/mk51swp.bat`;Sum=$1
Xif test "$Sum" != "3441"
Xthen echo original size 3441, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > msdos/mscdos/optoff.h &&
XX#if _MSC_VER < 600
XX# pragma loop_opt(off)
XX#endif
XSHAR_EOF
Xchmod 0640 msdos/mscdos/optoff.h || echo "restore of msdos/mscdos/optoff.h fails"
Xset `wc -c msdos/mscdos/optoff.h`;Sum=$1
Xif test "$Sum" != "49"
Xthen echo original size 49, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > readme/atari.tos &&
XXThis file describes the Atari-tos distribution of dmake.
XX
XXThe code to compile on an Atari-ST using GCC was supplied by Edgar Roeder
XX(roeder@cs.uni-sb.de).  I do not have an ST to verify the distribution sources
XXon but I have no reason to believe them to not work.  If there are any
XXproblems please let Edgar or myself know.
XX
XXI know of no bugs or limitation to the the Atari-ST implementation.  Note that
XXit is similar to the DOS version but it does not swap itself out.  This does
XXnot appear to be as much of a problem on the Atari as it is on MSDOS boxes.
XX
XX-dennis
XSHAR_EOF
Xchmod 0640 readme/atari.tos || echo "restore of readme/atari.tos fails"
Xset `wc -c readme/atari.tos`;Sum=$1
Xif test "$Sum" != "566"
Xthen echo original size 566, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > readme/patch1 &&
XXDMAKE Version 3.6, patch #1
XX---------------------------
XX
XXSeverity: Medium
XX
XXNature:   Minor teething problems with UNIX, and major problems with MSC
XX	  6.0, and TCC 2.0 swapping versions fixed.
XX
XXFormat:   Shar containing new versions of affected files.  With appropriate
XX          patches.  (run the patch file through sh in the source distribution
XX          directory and it will do the rest)
XX
XX          Also available as pub/src/dmake-3.6-patch1 on watmsg.uwaterloo.edu
XX          (129.97.129.9)
XX
XX          Archived source on watmsg incorporates this patch.
XX
XXPrerequisites: dmake version 3.6, patchlevel 1 source distribution
XX
XX
XXDescription of Fixes:
XX---------------------
XX1. Compilation problems with Microsoft compilers, and swapping versions of
XX   dmake.  To the best of my knowledge versions 4.0, 5.0, 5.1 and 6.0 of MSC
XX   now fully compile and generate running binaries both for swapping and non
XX   swapping versions of dmake.
XX
XX2. Other fixes include a hack to allow parsing of makefiles shipped over from
XX   DOS that contain cr-lf combinations.  This doesn't seem to impact processing
XX   of normal UNIX makefiles at all.
XX
XX3. Changed DOS versions of tempnam.c to use _psp to generate temporary file
XX   names instead of the current time as supplied by time().  The reason for
XX   this is too bizzare to go into here.
XX
XX4. Xenix is now a supported make target, as is Atari-ST TOS using GCC.
XX
XX5. A number of small tweaks here and there, not serious but might make
XX   compiles on a number of systems cleaner.
XX
XX6. Clarification of the documentation in several spots.
XX
XX7. Patch to dmake.tf to remove ^G control characters.  NOTE:  This patch
XX   may fail if you never received the ^G characters in the first place.  If
XX   so then please apply the patch by hand.
XX
XX8. inferred targets that infer recipes from rules having a .SETDIR attribute
XX   now have the .SETDIR applied prior to making the prerequisites and the
XX   target.
XX
XXMany thanks to all those that helped find and identify and in some cases
XXprovided fixes and/or new code for the above enhancements.
XX
XX-dennis
XSHAR_EOF
Xchmod 0640 readme/patch1 || echo "restore of readme/patch1 fails"
Xset `wc -c readme/patch1`;Sum=$1
Xif test "$Sum" != "2063"
Xthen echo original size 2063, current size $Sum;fi
Xecho mkdir - tos
Xmkdir tos
Xsed 's/^X//' << 'SHAR_EOF' > tos/arlib.c &&
XX/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/RCS/arlib.c,v 1.1 90/10/06 12:06:53 dvadura Exp $
XX-- SYNOPSIS -- Unix archive manipulation code.
XX-- 
XX-- DESCRIPTION
XX-- 	Originally this code was provided by Eric Gisin of MKS.  I took
XX--	his code and completely rewrote it adding cacheing of lib members
XX--	and other various optimizations.  I kept the overal functional
XX--	idea of the library routines as they are similar to those in GNU
XX--	make and felt it advantageous to maintain a similar interface.
XX--
XX-- AUTHOR
XX--      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
XX--      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
XX--
XX-- COPYRIGHT
XX--      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
XX-- 
XX--      This program is free software; you can redistribute it and/or
XX--      modify it under the terms of the GNU General Public License
XX--      (version 1), as published by the Free Software Foundation, and
XX--      found in the file 'LICENSE' included with this distribution.
XX-- 
XX--      This program is distributed in the hope that it will be useful,
XX--      but WITHOUT ANY WARRANTY; without even the implied warrant of
XX--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
XX--      GNU General Public License for more details.
XX-- 
XX--      You should have received a copy of the GNU General Public License
XX--      along with this program;  if not, write to the Free Software
XX--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
XX--
XX-- LOG
XX--     $Log:	arlib.c,v $
XX * Revision 1.1  90/10/06  12:06:53  dvadura
XX * dmake Release, Version 3.6
XX * 
XX*/
XX
XX#include "extern.h"
XX#include "sysintf.h"
XX#include <ar.h>
XX#include <stdio.h>
XX
XX/* By defining the defines below it is possible to configure the library
XX * code for library cacheing/non-cacheing, ASCII archive headers, and a full
XX * decode of the ar_hdr fields in the scan_ar function. */
XX
XX#define ASCARCH			1	/* ASCII time stored in archive	*/
XX#define LC			1	/* Turn on library cacheing	*/
XX#define DECODE_ALL_AR_FIELDS	0	/* decode only fields make needs*/
XX
XX#if LC
XX#  define FOUND_MEMBER	FALSE
XX#else
XX#  define FOUND_MEMBER	TRUE
XX#  define _cache_member(a, b, c)
XX#  define _check_cache(a, b, c, d)	FALSE
XX#endif
XX
XX#define	MAXFNAME	32	/* Longest file name in archive	*/
XX#define	MAXMNAME	8	/* Max module name < MAXFNAME	*/
XX
XX
XX/* This struct is used to pass the library and member information about the
XX * routines that perform the library seeking/cacheing */
XXstruct ar_args {
XX   char   *lib;
XX   char   *member;
XX   time_t time;
XX};
XX
XX
XXtypedef struct AR {
XX   char    ar_name[MAXFNAME+1];      /* File name */
XX   long    ar_size;                  /* Size in bytes */
XX   time_t  ar_time;                  /* Modification time */
XX
XX#ifdef DOS
XX   char    ar_modname[MAXMNAME+1];   /* DOS module name */
XX#endif
XX
XX#if DECODE_ALL_AR_FIELDS
XX   uint16  ar_mode;         	     /* File mode */
XX   uint16  ar_uid;            	     /* File owner */
XX   uint16  ar_gid;                   /* File group owner */
XX#endif
XX} AR, *ARPTR;
XX
XX
XXstatic int ar_scan  ANSI((FILE *,
XX			  int (*) ANSI((FILE *, struct AR *, struct ar_args *)),
XX			  struct ar_args *));
XXstatic int ar_touch ANSI(( FILE *, time_t ));
XXstatic int time_function  ANSI(( FILE *, struct AR *, struct ar_args * ));
XXstatic int touch_function ANSI(( FILE *, struct AR *, struct ar_args * ));
XX
XX#if LC
XXstatic int _cache_member ANSI((char *, char *, time_t));
XXstatic int _check_cache  ANSI((char *, char *, time_t *, int));
XX#endif
XX
XX/* decoded archive header */
XXstatic AR _ar;
XX
XX
XXtime_t
XXseek_arch(name, lib)/*
XX======================
XX   Look for module 'name' inside 'lib'.  If compiled with cacheing then first
XX   check to see if the specified lib is cached.  If so then return that time
XX   stamp instead of looking into the library. */
XXchar    *name;
XXchar 	*lib;
XX{
XX   FILE   *f;
XX   int    rv;
XX   time_t mtime;
XX   struct ar_args args;
XX
XX   /* Check the cache first (if there is a cache) */
XX   if( _check_cache(name, lib, &mtime, FALSE) )  return( mtime );
XX
XX   /* Open the lib file and perform the scan of the members, looking
XX    * for our particular member.  If cacheing is enabled it will be
XX    * taken care of automatically during the scan. */
XX
XX   args.lib    = lib;
XX   args.member = name;
XX   args.time   = (time_t)0L;
XX
XX   if( (f = fopen(lib, "rb")) == NIL(FILE) ) return( (time_t)0L );
XX   rv = ar_scan(f, time_function, &args );
XX   fclose( f );
XX
XX   if( rv < 0 ) Fatal("(%s): Invalid library format", lib);
XX
XX   return( args.time );
XX}
XX
XX
XXint
XXtouch_arch(name, lib)/*
XX=======================
XX   Look for module 'name' inside 'lib'.  If compiled with cacheing then first
XX   check to see if the specified lib is cached.  If so then set that time
XX   stamp and write it into the library.  Returns 0 on success, non-zero
XX   on failure. */
XXchar   *name;
XXchar   *lib;
XX{
XX   FILE   *f;
XX   int    rv;
XX   struct ar_args args;
XX
XX   /* Open the lib file and perform the scan of the members, looking
XX    * for our particular member.  If cacheing is enabled it will be
XX    * taken care of automatically during the scan. */
XX
XX   args.lib    = lib;
XX   args.member = name;
XX   args.time   = (time_t)0L;
XX
XX   if( (f = fopen(lib, "rb+")) == NIL(FILE) ) return( (time_t)1L );
XX   rv = ar_scan(f, touch_function, &args );
XX   fclose( f );
XX
XX   if( rv < 0 ) Fatal("(%s): Invalid library format", lib);
XX
XX   return( 0 );
XX}
XX
XX
XX
XXstatic int
XXtime_function(f, arp, argp)/*
XX=============================
XX   get library member's time, if it matches than return it in argp, if
XX   cacheing is enabled than cache the library members also. */
XXFILE           *f;      /* library file          */
XXstruct AR      *arp;    /* library member header */
XXstruct ar_args *argp;
XX{
XX   int rv = _cache_member( arp->ar_name, argp->lib, arp->ar_time );
XX
XX   if( strcmp(argp->member, arp->ar_name) == 0 ) {
XX      argp->time = arp->ar_time;
XX
XX      if( arp->ar_time == 0 && !(Glob_attr & A_SILENT) )
XX         Warning( "(%s): Can't extract library member timestamp; using EPOCH",
XX	          argp->member);
XX
XX      return( rv );  /* 1 => no cacheing, 0 => cacheing */
XX   }
XX
XX   return( FALSE ); /* continue scan */
XX}
XX
XX
XX
XXstatic int
XXtouch_function(f, arp, argp)/*
XX==============================
XX   Update library member's time stamp, and write new time value into cache
XX   if required. */
XXFILE           *f;      /* library file */
XXstruct AR      *arp;    /* library member header */
XXstruct ar_args *argp;
XX{
XX   extern time_t time ANSI(( time_t * ));
XX   time_t now = time((time_t*) NULL);  /* Current time.		  */
XX
XX   if( strcmp(argp->member, arp->ar_name) == 0 ) {
XX      _check_cache( argp->member, argp->lib, &now, TRUE );
XX      ar_touch(f, now );
XX
XX      return( TRUE );
XX   }
XX
XX   return( FALSE ); /* continue scan */
XX}
XX
XX
XX
XX
XXstatic int
XXar_scan(f, function, arg)/*
XX===========================
XX   Scan the opened archive, and call the given function for each member found.
XX   The function will be called with the file positioned at the beginning of
XX   the member and it can read up to arp->ar_size bytes of the archive member.
XX   If the function returns 1, we stop and return 1.  We return 0 at the end
XX   of the archive, or -1 if the archive has invalid format.  This interface
XX   is more general than required by "make", but it can be used by other
XX   utilities.  */
XXregister FILE *f;
XXint      (*function) ANSI((FILE *, struct AR *, struct ar_args *));
XXstruct ar_args *arg;
XX{
XX   extern long atol ANSI((char *));
XX   register char *p;
XX   struct ar_hdr arhdr;   /* external archive header */
XX   off_t         offset;  /* member seek offset      */
XX
XX#if ASCARCH
XX   char magic[SARMAG];
XX#else
XX   unsigned short word;
XX#endif
XX
XX   fseek( f, 0L, 0 );	/* Start at the beginning of the archive file */
XX
XX#if ASCARCH
XX   fread( magic, sizeof(magic), 1, f );
XX   if( strncmp(magic, ARMAG, SARMAG) != 0 ) return( -1 );
XX#else
XX   fread( (char*)&word, sizeof(word), 1, f );
XX   if( word != ARMAG ) return( -1 );
XX#endif
XX
XX   /* scan the library, calling `function' for each member
XX    */
XX   while( 1 ) {
XX      if( fread((char*) &arhdr, sizeof(arhdr), 1, f) != 1 ) break;
XX      offset = ftell(f);
XX      strncpy(_ar.ar_name, arhdr.ar_name, sizeof(arhdr.ar_name));
XX
XX      for( p = &_ar.ar_name[sizeof(arhdr.ar_name)];
XX           --p >= _ar.ar_name && *p == ' ';);
XX
XX      p[1] = '\0';
XX      if( *p == '/' ) *p = 0; 	/* Only SysV has trailing '/' */
XX
XX#if ASCARCH
XX      if( strncmp(arhdr.ar_fmag, ARFMAG, sizeof(arhdr.ar_fmag)) != 0 )
XX         return( -1 );
XX      _ar.ar_time = atol(arhdr.ar_date);
XX      _ar.ar_size = atol(arhdr.ar_size);
XX#else
XX      _ar.ar_time = arhdr.ar_date;
XX      _ar.ar_size = arhdr.ar_size;
XX#endif
XX
XX
XX#if DECODE_ALL_AR_FIELDS
XX#if ASCARCH
XX      _ar.ar_mode = atoi(arhdr.ar_mode);
XX      _ar.ar_uid  = atoi(arhdr.ar_uid);
XX      _ar.ar_gid  = atoi(arhdr.ar_gid);
XX#else
XX      _ar.ar_mode = arhdr.ar_mode;
XX      _ar.ar_size = arhdr.ar_size;
XX      _ar.ar_uid = arhdr.ar_uid;
XX      _ar.ar_gid = arhdr.ar_gid;
XX#endif
XX#endif
XX
XX      if( (*function)(f, &_ar, arg) ) return( 1 );
XX      fseek( f, offset + (_ar.ar_size+1 & ~1L), 0 );
XX   }
XX
XX   if( !feof(f) ) return( -1 );
XX   return 0;
XX}
XX
XX
XX
XXstatic int
XXar_touch( f, now )/*
XX====================
XX   touch module header timestamp. */
XXFILE   *f;
XXtime_t now;
SHAR_EOF
echo "End of part 1, continue with part 2"
echo "2" > s2_seq_.tmp
exit 0