dmake 3.6 patch 1 (part 02/05)

Dennis Vadura dvadura at watdragon.waterloo.edu
Thu Nov 1 12:27:34 AEST 1990


#!/bin/sh
# this is part 2 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file dm36.p1 continued
#
CurArch=2
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
sed 's/^X//' << 'SHAR_EOF' >> dm36.p1
XX{
XX   struct ar_hdr arhdr;                /* external archive header */
XX
XX   fseek(f, - (off_t) (sizeof(arhdr) - sizeof(arhdr.ar_name)), 1);
XX
XX#if ASCARCH
XX   fprintf(f, "%lu", now);
XX#else
XX   fwrite((char *)now, sizeof(now), 1, f);
XX#endif
XX
XX   return( ferror(f) ? 0 : 1 );
XX}
XX
XX
XX#if LC
XXtypedef struct mem {
XX   time_t	m_time;		/* modify time of member*/
XX   struct mem	*m_next;	/* next member in lib	*/
XX   char		m_valid;	/* valid cache entry    */
XX   char 	m_name[1];	/* lib member name	*/
XX} MEM, *MEMPTR;
XX
XXtypedef struct lib {
XX   struct lib	*lb_next;	/* next library in list */
XX   struct mem	*lb_members;	/* list of lib members	*/
XX   char		lb_valid;	/* valid cache entry    */
XX   char 	*lb_name;	/* library name		*/
XX} LIB, *LIBPTR;
XX
XXstatic LIBPTR _cache = NIL(LIB);
XXstatic MEMPTR _find_member ANSI(( LIBPTR, char * ));
XX
XXstatic int
XX_check_cache( name, lib, pmtime, touch )/*
XX==========================================
XX   Check to see if we have cached member in lib, if so return time in pmtime
XX   and return TRUE, otherwise return FALSE, if touch is TRUE then touch
XX   the archive member instead. */
XXchar   *name;
XXchar   *lib;
XXtime_t *pmtime;
XXint    touch;
XX{
XX   register MEMPTR mp;
XX   register LIBPTR lp;
XX
XX   for( lp=_cache; lp != NIL(LIB) && lp->lb_name != lib; lp=lp->lb_next );
XX   if( lp == NIL(LIB) ) return( FALSE );
XX
XX   mp = _find_member( lp, name );
XX   if( mp == NIL(MEM) || !mp->m_valid ) return( FALSE );
XX
XX   if( touch == TRUE )
XX   {
XX      mp->m_time = *pmtime;
XX      mp->m_valid = 1;
XX   }
XX   else
XX      *pmtime = mp->m_time;
XX
XX   lp->lb_valid   = 1;
XX   lp->lb_members = mp;
XX
XX   return( TRUE );
XX}
XX
XX
XX
XXstatic int
XX_cache_member( name, lib, mtime )/*
XX===================================
XX   Cache name in lib along with it's time */
XXchar   *name;
XXchar   *lib;
XXtime_t mtime;
XX{
XX   register MEMPTR mp;
XX   register LIBPTR lp;
XX
XX   for( lp=_cache;
XX	lp != NIL(LIB) && lp->lb_name != NIL(char) && lp->lb_name != lib;
XX	lp=lp->lb_next);
XX
XX   if( lp == NIL(LIB) )
XX   {
XX      lp = (LIBPTR) malloc(sizeof(LIB));
XX      if( lp == NIL(LIB) ) No_ram();
XX
XX      lp->lb_name    = lib;
XX      lp->lb_members = NIL(MEM);
XX      lp->lb_next    = _cache;
XX      lp->lb_valid   = 0;
XX      _cache = lp;
XX   }
XX
XX   /* On UNIX ar does not allow multiple copies of the same .o file to live
XX    * in the same AR file.  If this is not TRUE then use the commented out
XX    * version to set the value of mp. */
XX
XX   /*mp = _find_member(lp, name);*/
XX   mp = NIL(MEM);
XX
XX   if( mp == NIL(MEM) )
XX   {
XX      mp = (MEMPTR) malloc(sizeof(char)*offsetof(MEM,m_name[strlen(name)+1]));
XX      if( mp == NIL(MEM) ) No_ram();
XX
XX      strcpy( mp->m_name, name );
XX      mp->m_time     = mtime;
XX
XX      if( lp->lb_members == NIL(MEM) ) {
XX	 mp->m_next     = mp;
XX	 lp->lb_members = mp;
XX      }
XX      else {
XX	 mp->m_next = lp->lb_members->m_next;
XX	 lp->lb_members->m_next = mp;
XX	 lp->lb_members = mp;
XX      }
XX   }
XX   else
XX      mp->m_time = mtime;
XX
XX   mp->m_valid = 1;
XX
XX   return( lp->lb_valid );
XX}
XX
XX
XXstatic MEMPTR
XX_find_member( lp, name )
XXLIBPTR lp;
XXchar   *name;
XX{
XX   register MEMPTR mp = lp->lb_members;
XX
XX   if( mp == NIL(MEM) ) return(mp);
XX
XX   do {
XX      if( !strcmp(mp->m_name, name ) ) return( mp );
XX      mp = mp->m_next;
XX   }
XX   while( mp != lp->lb_members );
XX
XX   return( NIL(MEM) );
XX}
XX#endif
XX
XX
XX
XXvoid
XXvoid_lcache( lib, member )/*
XX============================
XX   Void the library cache for lib.  If member is NIL(char) then nuke all
XX   of the members, if member is NOT NIL(char) then invalidate only that
XX   member. */
XXchar *lib;
XXchar *member;
XX{
XX#if LC
XX   register LIBPTR lp;
XX   register MEMPTR mp;
XX   register MEMPTR tmp;
XX
XX   for( lp=_cache; lp != NIL(LIB) && lp->lb_name != lib; lp=lp->lb_next );
XX   if( lp == NIL(LIB) ) return;
XX
XX   if( member == NIL(char) ) {
XX      mp = lp->lb_members;
XX      do {
XX	 tmp = mp->m_next;
XX	 (void) free( mp );
XX	 mp = tmp;
XX      } while( mp != lp->lb_members );
XX
XX      lp->lb_valid   = 0;
XX      lp->lb_members = NIL(MEM);
XX      lp->lb_name    = NIL(char);
XX   }
XX   else {
XX      mp=lp->lb_members;
XX      do {
XX	 if( strcmp( member, mp->m_name) == 0 ) {
XX	    lp->lb_members = mp->m_next;
XX	    mp->m_valid = 0;
XX	 }
XX	   
XX	 mp=mp->m_next;
XX      } while( mp != lp->lb_members );
XX   }
XX#endif
XX}
XSHAR_EOF
Xchmod 0640 tos/arlib.c || echo "restore of tos/arlib.c fails"
Xset `wc -c tos/arlib.c`;Sum=$1
Xif test "$Sum" != "13301"
Xthen echo original size 13301, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > tos/config.h &&
XX/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/sysvr3/RCS/config.h,v 1.1 90/10/06 12:06:39 dvadura Exp $
XX-- SYNOPSIS -- Configurarion include file.
XX-- 
XX-- DESCRIPTION
XX-- 	There is one of these for each specific machine configuration.
XX--	It can be used to further tweek the machine specific sources
XX--	so that they compile.
XX--
XX-- AUTHOR
XX--      Dennis Vadura, dvadura at 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:	config.h,v $
XX * Revision 1.1  90/10/06  12:06:39  dvadura
XX * dmake Release, Version 3.6
XX * 
XX*/
XX
XX#include <osbind.h>
XX
XX/* define this for configurations that don't have the coreleft function
XX * so that the code compiles.  To my knowledge coreleft exists only on
XX * Turbo C, but it is needed here since the function is used in many debug
XX * macros. */
XX#define coreleft() Malloc(-1L)
XX
XX/* Define the getcwd function that is used in the code, since BSD does
XX * not have getcwd, but call it getwd instead. */
XXextern char *getcwd ANSI((char *, int));
XX
XX/*No parallelism in TOS so don't need to explode the graph. */
XX#define Explode_prq(a,b,c)
XSHAR_EOF
Xchmod 0640 tos/config.h || echo "restore of tos/config.h fails"
Xset `wc -c tos/config.h`;Sum=$1
Xif test "$Sum" != "1974"
Xthen echo original size 1974, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > tos/config.mk &&
XX# This is an OS specific configuration file
XX#	It assumes that OBJDIR, TARGET and DEBUG are previously defined.
XX#	It defines	CFLAGS, LDARGS, CPPFLAGS, STARTUPFILE, LDOBJS
XX#			PRINTER, PRINTFLAGS
XX#	It augments	SRC, OBJDIR, TARGET, CFLAGS, LDLIBS
XX#
XXPRINTER		= hw
XXPRINTFLAGS	= -P$(PRINTER)
XXSTARTUPFILE	= $(OS)/startup.mk
XXCPPFLAGS 	= $(CFLAGS)
XXLDOBJS		= $(CSTARTUP) $(OBJDIR)/{$(<:f)}
XXLDARGS		= $(LDFLAGS) -o $@ $(OBJDIR)/*$O
XXLDFLAGS	       += -s
XXLD		= $(CC)
XX
XX# Debug flags
XXDB_CFLAGS	= -g -DDBUG
XXDB_LDFLAGS	= -g
XXDB_LDLIBS	=
XX
XX# NO Debug flags
XXNDB_CFLAGS	= -O
XXNDB_LDFLAGS	=
XXNDB_LDLIBS	=
XX
XX# Local configuration modifications for CFLAGS.
XXCFLAGS         += -I$(OS)
XX
XX# Sources that must be defined for each different version
XXOSSRC := arlib.c dirbrk.c rmprq.c ruletab.c runargv.c
XXSRC  += $(OSSRC)
XX.SETDIR=$(OS) : $(OSSRC)
XX
XX# Set source dirs so that we can find files named in this
XX# config file.
XX.SOURCE.h : $(OS)
XX
XX# See if we modify anything in the lower levels.
XX.IF $(OSRELEASE) != $(NULL)
XX   .INCLUDE .IGNORE : $(OS)$(DIRSEPSTR)$(OSRELEASE)$(DIRSEPSTR)config.mk
XX.END
XX
XX# Set the proper macros based on whether we are making the debugging version
XX# or not.
XX.IF $(DEBUG)
XX   CFLAGS	+= $(DB_CFLAGS)
XX   LDFLAGS	+= $(DB_LDFLAGS)
XX   LDLIBS	+= $(DB_LDLIBS)
XX
XX   SILENT	:= $(.SILENT)
XX   .SILENT	:= yes
XX   TARGET	:= db$(TARGET)
XX   OBJDIR	:= $(OBJDIR).dbg
XX   .SILENT	:= $(SILENT)
XX
XX    SRC		+= dbug.c malloc.c
XX    HDR		+= db.h 
XX    .SETDIR=common : dbug.c malloc.c
XX.ELSE
XX   CFLAGS	+= $(NDB_CFLAGS)
XX   LDFLAGS	+= $(NDB_LDFLAGS)
XX   LDLIBS	+= $(NDB_LDLIBS)
XX.END
XSHAR_EOF
Xchmod 0640 tos/config.mk || echo "restore of tos/config.mk fails"
Xset `wc -c tos/config.mk`;Sum=$1
Xif test "$Sum" != "1536"
Xthen echo original size 1536, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > tos/dirbrk.c &&
XX/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/RCS/dirbrk.c,v 1.1 90/10/06 12:07:00 dvadura Exp $
XX-- SYNOPSIS -- define the directory separator string.
XX-- 
XX-- DESCRIPTION
XX-- 	Define this string for any character that may appear in a path name
XX--	and can be used as a directory separator.  Also provide a function
XX--	to indicate if a given path begins at the root of the file system.
XX--
XX-- AUTHOR
XX--      Dennis Vadura, dvadura at 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:	dirbrk.c,v $
XX * Revision 1.1  90/10/06  12:07:00  dvadura
XX * dmake Release, Version 3.6
XX * 
XX*/
XX
XX#include "extern.h"
XX#include <ctype.h>
XX
XX/* tos uses /, \, and : */
XXchar*	DirBrkStr = "/\\:";
XX
XX/*
XX** Return TRUE if the name is the full specification of a path name to a file
XX** starting at the root of the file system, otherwise return FALSE
XX*/
XXint
XXIf_root_path(name)
XXchar *name;
XX{
XX   return( (strchr(DirBrkStr, *name) != NIL(char)) ||
XX           (isalpha(*name) && name[1] == ':') );
XX}
XSHAR_EOF
Xchmod 0640 tos/dirbrk.c || echo "restore of tos/dirbrk.c fails"
Xset `wc -c tos/dirbrk.c`;Sum=$1
Xif test "$Sum" != "1883"
Xthen echo original size 1883, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > tos/make.sh &&
XXmkdir objects
XXgcc -c -DHELP -I. -Icommon -Itos -O infer.c
XXmv infer.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O make.c
XXmv make.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O stat.c
XXmv stat.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O expand.c
XXmv expand.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O string.c
XXmv string.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O hash.c
XXmv hash.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O dag.c
XXmv dag.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O dmake.c
XXmv dmake.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O path.c
XXmv path.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O imacs.c
XXmv imacs.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O sysintf.c
XXmv sysintf.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O parse.c
XXmv parse.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O getinp.c
XXmv getinp.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O quit.c
XXmv quit.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O basename.c
XXmv basename.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O dump.c
XXmv dump.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O macparse.c
XXmv macparse.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O rulparse.c
XXmv rulparse.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O percent.c
XXmv percent.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O function.c
XXmv function.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O tos/arlib.c
XXmv arlib.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O tos/dirbrk.c
XXmv dirbrk.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O tos/rmprq.c
XXmv rmprq.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O tos/ruletab.c
XXmv ruletab.o objects
XXgcc -c -DHELP -I. -Icommon -Itos -O tos/runargv.c
XXmv runargv.o objects
XXgcc -s  -o dmake objects/*.o
XSHAR_EOF
Xchmod 0640 tos/make.sh || echo "restore of tos/make.sh fails"
Xset `wc -c tos/make.sh`;Sum=$1
Xif test "$Sum" != "1670"
Xthen echo original size 1670, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > tos/rmprq.c &&
XX/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/RCS/rmprq.c,v 1.1 90/10/06 12:07:06 dvadura Exp $
XX-- SYNOPSIS -- remove prerequisites code.
XX-- 
XX-- DESCRIPTION
XX--	This code is different for DOS and for UNIX and parallel make
XX--	architectures since the parallel case requires the rm's to be
XX--	run in parallel, whereas DOS guarantees to run them sequentially.
XX-- 
XX-- AUTHOR
XX--      Dennis Vadura, dvadura at 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:	rmprq.c,v $
XX * Revision 1.1  90/10/06  12:07:06  dvadura
XX * dmake Release, Version 3.6
XX * 
XX*/
XX
XX#include "extern.h"
XX#include "alloc.h"
XX
XXvoid
XXRemove_prq( tcp )
XXCELLPTR tcp;
XX{
XX   tcp->ce_flag         &= ~(F_MADE|F_VISITED);
XX   tcp->CE_HOW->hw_flag &= ~(F_MADE|F_VISITED);
XX   tcp->ce_time          = 0L;
XX
XX   Make( tcp, tcp->CE_HOW, NIL(CELL) );
XX}
XSHAR_EOF
Xchmod 0640 tos/rmprq.c || echo "restore of tos/rmprq.c fails"
Xset `wc -c tos/rmprq.c`;Sum=$1
Xif test "$Sum" != "1718"
Xthen echo original size 1718, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > tos/ruletab.c &&
XX/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/RCS/ruletab.c,v 1.1 90/10/06 12:07:08 dvadura Exp $
XX-- SYNOPSIS -- Default initial configuration of dmake.
XX-- 
XX-- DESCRIPTION
XX-- 	Define here the initial set of rules that are defined before
XX--	dmake performs any processing.
XX--
XX-- AUTHOR
XX--      Dennis Vadura, dvadura at 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:	ruletab.c,v $
XX * Revision 1.1  90/10/06  12:07:08  dvadura
XX * dmake Release, Version 3.6
XX * 
XX*/
XX
XX/* These are control macros for dmake that MUST be defined at some point
XX * if they are NOT dmake will not work!  These are default definitions.  They
XX * may be overridden inside the .STARTUP makefile, they are here
XX * strictly so that dmake can parse the STARTUP makefile */
XX
XXstatic char *_rules[] = {
XX	"MAXPROCESSLIMIT := 10",
XX	"MAXLINELENGTH := 8190",
XX	".IMPORT .IGNORE: ROOTDIR",
XX	".MAKEFILES : makefile.mk Makefile makefile",
XX	".SOURCE    : .NULL",
XX#include "startup.h"
XX	0 };
XX
XXchar **Rule_tab = _rules; /* for sundry reasons in Get_environment() */
XSHAR_EOF
Xchmod 0640 tos/ruletab.c || echo "restore of tos/ruletab.c fails"
Xset `wc -c tos/ruletab.c`;Sum=$1
Xif test "$Sum" != "1940"
Xthen echo original size 1940, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > tos/runargv.c &&
XX/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/msdos/RCS/runargv.c,v 1.1 90/10/06 12:05:30 dvadura Exp $
XX-- SYNOPSIS -- run a sub process.
XX-- 
XX-- DESCRIPTION
XX--	Use spawn to run a subprocess.
XX--
XX-- AUTHOR
XX--      Dennis Vadura, dvadura at 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:	runargv.c,v $
XX * Revision 1.1  90/10/06  12:05:30  dvadura
XX * dmake Release, Version 3.6
XX * 
XX*/
XX
XX#include "sysintf.h"
XX#include "extern.h"
XX#include <process.h>
XX#include <string.h>
XX#include <errno.h>
XX
XXstatic int  _abort_flg = FALSE;
XXstatic void _add_child ANSI((CELLPTR, HOWPTR, int));
XXstatic void _finished_child ANSI((int));
XX
XXint
XXrunargv(target, how, ignore, group, last, shell, cmd)
XXCELLPTR target;
XXHOWPTR  how;
XXint     ignore;
XXint	group;
XXint	last;
XXint	shell;
XXchar	*cmd;
XX{
XX   int status;
XX   char **argv;
XX
XX   argv = Pack_argv( group, shell, cmd );
XX   _add_child(target, how, ignore);
XX   status = spawnvp(P_WAIT, *argv, argv);
XX   if( status == -1 ) Error("%s: %s", argv[0], strerror(errno));
XX   _finished_child(status);
XX   if( last && !Doing_bang ) Update_time_stamp( target, how );
XX
XX   return( 0 );
XX}
XX
XX
XXvoid
XXClean_up_processes()
XX{
XX   _abort_flg = TRUE;
XX   _finished_child(-1);
XX}
XX
XX
XXint
XXWait_for_child( abort_flg, pid )
XXint abort_flg;
XXint pid;
XX{
XX   return(1);
XX}
XX
XX
XXstatic int     _valid = -1;
XXstatic CELLPTR _tg;
XXstatic HOWPTR  _how;
XXstatic int     _ignore;
XX
XXstatic void
XX_add_child( target, how, ignore )
XXCELLPTR target;
XXHOWPTR  how;
XXint	ignore;
XX{
XX   _tg = target;
XX   _ignore = ignore;
XX   _how    = how;
XX   _valid = 0;
XX
XX   Current_target = NIL(HOW);
XX}
XX
XX
XXstatic void
XX_finished_child(status)
XXint	status;
XX{
XX   if( _valid == -1 ) return;
XX   Unlink_temp_files( _how );
XX   _valid = -1;
XX   Handle_result( status, _ignore, _abort_flg, _tg );
XX}
XSHAR_EOF
Xchmod 0640 tos/runargv.c || echo "restore of tos/runargv.c fails"
Xset `wc -c tos/runargv.c`;Sum=$1
Xif test "$Sum" != "2637"
Xthen echo original size 2637, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > tos/startup.h &&
XX/* This file contains the default value of the MAKESTARTUP variable.
XX * You must set the quoted string below to the default path to the startup
XX * variable, so that it gets compiled in.  LEAVE ROOTDIR at the front of
XX * the path.  This allows the user to customize his environment for dmake
XX * by setting up a new ROOTDIR environment variable. */
XX
XX"MAKESTARTUP := $(ROOTDIR)/etc/startup.mk",
XSHAR_EOF
Xchmod 0640 tos/startup.h || echo "restore of tos/startup.h fails"
Xset `wc -c tos/startup.h`;Sum=$1
Xif test "$Sum" != "392"
Xthen echo original size 392, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > tos/startup.mk &&
XX# Generic UNIX DMAKE startup file.  Customize to suit your needs.
XX# Should work for both SYSV, and BSD 4.3
XX# See the documentation for a description of internally defined macros.
XX#
XX# Disable warnings for macros redefined here that were given
XX# on the command line.
XX__.SILENT := $(.SILENT)
XX.SILENT   := yes
XX
XX# Configuration parameters for DMAKE startup.mk file
XX# Set these to NON-NULL if you wish to turn the parameter on.
XX_HAVE_RCS	:= 		# yes => RCS  is installed.
XX_HAVE_SCCS	:= 		# yes => SCCS is installed.
XX
XX# Applicable suffix definitions
XXA := .olb	# Libraries
XXE :=		# Executables
XXF := .f		# Fortran
XXO := .o		# Objects
XXP := .p		# Pascal
XXS := .s		# Assembler sources
XXV := ,v		# RCS suffix
XX
XX# Recipe execution configurations
XXSHELL		:= /bin/sh
XXSHELLFLAGS	:= 
XXGROUPSHELL	:= $(SHELL)
XXGROUPFLAGS	:= 
XXSHELLMETAS	:= |();&<>?*][$$:\\#`'"
XXGROUPSUFFIX	:= .bat
XXDIVFILE		 = $(TMPFILE)
XX
XX# Standard C-language command names and flags
XX   CPP	   := /gnu/lib/cpp	# C-preprocessor
XX   CC      := gcc		# C-compiler and flags
XX   CFLAGS  +=
XX
XX   AS      := /gnu/lib/as	# Assembler and flags
XX   ASFLAGS += 
XX
XX   LD       = $(CC)		# Loader and flags
XX   LDFLAGS +=
XX   LDLIBS   =
XX
XX# Definition of $(MAKE) macro for recursive makes.
XX   MAKE = $(MAKECMD) $(MFLAGS)
XX
XX# Definition of Print command for this system.
XX   PRINT = lpr
XX
XX# Language and Parser generation Tools and their flags
XX   YACC	  := yacc		# standard yacc
XX   YFLAGS +=
XX   YTAB	  := y.tab		# yacc output files name stem.
XX
XX   LEX	  := lex		# standard lex
XX   LFLAGS +=
XX   LEXYY  := lex.yy		# lex output file
XX
XX# Other Compilers, Tools and their flags
XX   PC	:= pc			# pascal compiler
XX   RC	:= f77			# ratfor compiler
XX   FC	:= f77			# fortran compiler
XX
XX   CO	   := co		# check out for RCS
XX   COFLAGS += -q
XX
XX   AR     := gar		# archiver
XX   ARFLAGS+= ruv
XX
XX   RM	   := /gnu/bin/rm	# remove a file command
XX   RMFLAGS +=
XX
XX# Implicit generation rules for making inferences.
XX# We don't provide .yr or .ye rules here.  They're obsolete.
XX# Rules for making *$O
XX   %$O : %.c ; $(CC) $(CFLAGS) -c $<
XX   %$O : %$P ; $(PC) $(PFLAGS) -c $<
XX   %$O : %$S ; $(AS) $(ASFLAGS) $<
XX   %$O : %.cl ; class -c $<
XX   %$O : %.e %.r %.F %$F
XX	$(FC) $(RFLAGS) $(EFLAGS) $(FFLAGS) -c $<
XX
XX# Executables
XX   %$E : %$O ; $(LD) $(LDFLAGS) -o $@ $< $(LDLIBES)
XX
XX# lex and yacc rules
XX   %.c : %.y ; $(YACC)  $(YFLAGS) $<; mv $(YTAB).c $@
XX   %.c : %.l ; $(LEX)   $(LFLAGS) $<; mv $(LEXYY).c $@
XX
XX# This rule tells how to make *.out from it's immediate list of prerequisites
XX# UNIX only.
XX   %.out :; $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
XX
XX# RCS support
XX.IF $(_HAVE_RCS)
XX   % : %$V $$(@:d)RCS/$$(@:f)$V;- $(CO) $(COFLAGS) $@
XX   .NOINFER : %$V $$(@:d)RCS/$$(@:f)$V
XX.END
XX
XX# SCCS support
XX.IF $(_HAVE_SCCS)
XX   % : s.% ; get $@
XX   .NOINFER : s.%
XX.END
XX
XX# Recipe to make archive files.
XX%$A :
XX[
XX   $(AR) $(ARFLAGS) $@ $?
XX   $(RM) $(RMFLAGS) $?
XX   ranlib $@
XX]
XX
XX# DMAKE uses this recipe to remove intermediate targets
XX.REMOVE :; $(RM) -f $<
XX
XX# AUGMAKE extensions for SYSV compatibility
XX at B = $(@:b)
XX at D = $(@:d)
XX at F = $(@:f)
XX*B = $(*:b)
XX*D = $(*:d)
XX*F = $(*:f)
XX<B = $(<:b)
XX<D = $(<:d)
XX<F = $(<:f)
XX?B = $(?:b)
XX?F = $(?:f)
XX?D = $(?:d)
XX
XX# Turn warnings back to previous setting.
XX.SILENT := $(__.SILENT)
XX
XX# Local startup file if any
XX.INCLUDE .IGNORE: "_startup.mk"
XSHAR_EOF
Xchmod 0640 tos/startup.mk || echo "restore of tos/startup.mk fails"
Xset `wc -c tos/startup.mk`;Sum=$1
Xif test "$Sum" != "3233"
Xthen echo original size 3233, current size $Sum;fi
Xsed 's/^X//' << 'SHAR_EOF' > tos/sysintf.h &&
XX/*
XX** assorted bits of system interface, for common routines inside dmake.
XX** System specific code can be found in the config.h files for each
XX** of the system specifications.
XX*/
XX#include <sys/stat.h>
XX#include <signal.h>
XX
XX#define STAT stat
XX#define VOID_LCACHE(l,m) (void) void_lcache(l,m)
XX
XX/*
XX** standard C items
XX*/
XX#include "stdmacs.h"
XX
XX/*
XX** DOS interface standard items
XX*/
XX#define	getswitchar()	'-'
XX
XX/*
XX** make parameters
XX*/
XX#define	MAX_PATH_LEN	1024
XSHAR_EOF
Xchmod 0640 tos/sysintf.h || echo "restore of tos/sysintf.h fails"
Xset `wc -c tos/sysintf.h`;Sum=$1
Xif test "$Sum" != "454"
Xthen echo original size 454, current size $Sum;fi
X
X
X# Now create the file of patches and apply patch appropriately
X# shar:	Shell Archiver  (v1.22)
X#
X#	Run the following text with /bin/sh to create:
X#	  _patches
X#
Xsed 's/^X//' << 'SHAR_EOF' > _patches &&
XX*** /u2/dvadura/src/generic/dmake/src-patchlvl1/unix/sysvr3/config.h	Sat Oct  6 12:06:40 1990
XX--- unix/sysvr3/config.h	Mon Oct 22 18:01:13 1990
XX***************
XX*** 44,51 ****
XX--- 44,55 ----
XX   * not have getcwd, but call it getwd instead. */
XX  extern char *getcwd ANSI((char *, int));
XX  
XX+ #ifdef M_XENIX
XX+ #define PORTAR 1
XX+ #else
XX  /* Define setvbuf, SysV doesn't have one */
XX  #define setvbuf(fp, bp, type, len) setbuf( fp, NULL );
XX+ #endif
XX  
XX  /* NCR Tower's don't define size_t */
XX  #ifdef tower
XX*** /u2/dvadura/src/generic/dmake/src-patchlvl1/unix/sysintf.h	Sat Oct  6 12:07:12 1990
XX--- unix/sysintf.h	Mon Oct 22 17:08:18 1990
XX***************
XX*** 3,8 ****
XX--- 3,9 ----
XX  ** System specific code can be found in the config.h files for each
XX  ** of the system specifications.
XX  */
XX+ #include <sys/types.h>
XX  #include <sys/stat.h>
XX  #include <signal.h>
XX  
XX*** /u2/dvadura/src/generic/dmake/src-patchlvl1/sysintf.c	Sat Oct  6 12:04:18 1990
XX--- sysintf.c	Sun Oct 28 23:16:20 1990
XX***************
XX*** 1,4 ****
XX! /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/RCS/sysintf.c,v 1.1 90/10/06 12:04:17 dvadura Exp $
XX  -- SYNOPSIS -- system independent interface
XX  -- 
XX  -- DESCRIPTION
XX--- 1,4 ----
XX! /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/RCS/sysintf.c,v 1.1 90/10/06 12:04:17 dvadura Exp Locker: dvadura $
XX  -- SYNOPSIS -- system independent interface
XX  -- 
XX  -- DESCRIPTION
XX***************
XX*** 69,76 ****
XX  */
XX  
XX  #include <stdio.h>
XX- #include "extern.h"
XX  #include "sysintf.h"
XX  #include "alloc.h"
XX  
XX  /*
XX--- 69,76 ----
XX  */
XX  
XX  #include <stdio.h>
XX  #include "sysintf.h"
XX+ #include "extern.h"
XX  #include "alloc.h"
XX  
XX  /*
XX***************
XX*** 97,103 ****
XX     if( lib != NIL(char) )
XX        return( seek_arch(basename(name), lib) );
XX     else
XX!       return( (STAT(name, &buf) == -1) ? (time_t)0 : buf.st_mtime );
XX  }
XX  
XX  
XX--- 97,103 ----
XX     if( lib != NIL(char) )
XX        return( seek_arch(basename(name), lib) );
XX     else
XX!       return( (STAT(name, &buf) == -1) ? (time_t)0L : (time_t) buf.st_mtime );
XX  }
XX  
XX  
XX***************
XX*** 245,251 ****
XX--- 245,253 ----
XX  Read_env_string(ename)
XX  char *ename;
XX  {
XX+ #if !defined(_MSC_VER) || _MSC_VER < 600
XX     extern char *getenv();
XX+ #endif
XX     return( getenv(ename) );
XX  }
XX  
XX***************
XX*** 277,283 ****
XX--- 279,287 ----
XX  ReadEnvironment()
XX  {
XX     extern char **Rule_tab;
XX+ #if !defined(_MSC_VER)
XX     extern char **environ;
XX+ #endif
XX     char **rsave;
XX  
XX     rsave    = Rule_tab;
XX*** /u2/dvadura/src/generic/dmake/src-patchlvl1/readme/msdos	Mon Oct  8 13:30:26 1990
XX--- readme/msdos	Mon Oct 29 10:31:02 1990
XX***************
XX*** 1,89 ****
XX! Some notes on the MSDOS implementation of dmake.
XX  
XX! Making the binary:
XX! ------------------
XX  
XX!    Turbo-C:  By default the turbo-C (make tcc) script will make a version
XX! 	     of the binary that is compiled for an 8088 and up cpu.  Once made
XX! 	     you can make a version for a 186 or 286 by modifying
XX! 	     msdos/tccdos/config.mk and setting CFLAGS to contain the right
XX! 	     flags, comments are supplied in the makefile to do so.
XX  
XX! 	     The contents of the default response files
XX! 	     (named in msdos/tccdos/mk*.bat) assume specific locations for
XX! 	     your turbo-C libraries, you may need to edit these before actually
XX! 	     getting a successful binary linked.
XX  
XX!    Microsoft-C 4.0 to 5.1:
XX! 	     Is straight forward, just type 'make msc' and the compile will
XX! 	     chunk along.
XX  
XX!    Microsoft-C 6.0:
XX! 	     Is equally easy, just type 'make msc60' and the compile will
XX! 	     chunk along.  Once made, if you want to use dmake to compile
XX! 	     itself then set the environment variable MSC_VER=6.0, otherwise
XX! 	     the compile flags will not be correct.  You may also supply this
XX! 	     as an option on the dmake command line.
XX  
XX-    Memory Requirements and Swapping:
XX- 	     dmake requires quite a bit of memory to run.  As a result
XX- 	     a swapping version of dmake is made if you issue the command
XX- 	     'make tccswp', 'make mscswp' or 'make msc60swp'.  If you leave
XX- 	     the 'swp' off then corresponding (as described above) non-swapping
XX- 	     versions are made.
XX  
XX! 	     The swapping code currently only swaps to DISK, I have left hooks
XX! 	     in to accomodate XMS and EMS, I have some code that performs the
XX! 	     necessary XMS/EMS accesses but have not incorporated it in yet.
XX! 	     It appears that a ramdisk seems to work just fine.  If anyone
XX! 	     wishes to fill in the hooks please do and I'll be happy to include
XX! 	     them in future distributions.
XX  
XX!    dmake 'makefile.mk' control variables:
XX! 	     Initially dmake is compiled for the compact memory model.
XX! 	     Setting MODEL={s,c,m,l} on the command line will select a different
XX! 	     memory model.  Setting NOSWAP:=1 on the command line
XX! 	     will disable the compile and linking of the swap code.
XX! 	     A summary of the available configuration variables follows:
XX  
XX! 	          MODEL={s,c,m,l}  - Select {small, compact, medium, large}
XX! 		  		     memory model respectively.
XX! 		  NOSWAP:=y	   - If set, do not compile the dmake
XX! 		  		     swapping version of spawnvpe.
XX! 		  MSC_VER:=6.0	   - Must be set if using MSC 6.0 and dmake
XX! 		  		     is used to make a new version of dmake.
XX  
XX!    ^C and stopping a make:
XX! 	     Handling of ^C in the swapping version seems to be somewhat
XX! 	     broken.  I don't know what is wrong and would be happy to hear
XX! 	     of suggestions on how to fix the current mess :-)  If you hit
XX! 	     ^C more than once when dmake is executing a child then I think
XX! 	     it will hang most machines.  If you hit it only once or not at
XX! 	     all then things seem to work fine :-).  I tried to get this right
XX! 	     by looking at other code, and making some assumptions about what
XX! 	     DOS does... NEVER ASSUME ANYTHING ABOUT WHAT DOS DOES :-)
XX  
XX  
XX  Other notes:
XX  ------------
XX! dmake does not care if you are running command.com or some other command
XX! interpretter, you must however specify the proper values of the environment
XX! variables SHELL, SHELLFLAGS, GROUPSHELL, and GROUPFLAGS in order for things
XX! to work correctly.  Read the man page first.
XX  
XX! Group recipes under DOS that use command.com as the command interpretter
XX! require you to set the GROUPSUFFIX macro.
XX  
XX! As shipped the startup.mk files for the DOS version try to figure out what
XX! command interpretter you are using and set things up appropriately.
XX! Two command interpretters are supported in the shipped startup.mk file,
XX! command.com, and the MKS Korn shell.
XX  
XX! dmake does not contain any builtin commands.  It gets all commands it executes
XX! from an external file system.  It is therefore most useful if it is used in
XX! conjunction with an environment similar to that provided by the MKS Tool kit,
XX! or equivalent.
XX  
XX! dmake now supports the MKS argument passing conventions.  The facility is
XX! enabled by setting .MKSARGS:=1 and is set by default in the startup.mk file
XX! if an MKS Korn shell is detected as being the active command interpretter.
XX--- 1,127 ----
XX! Notes on the MSDOS implementation of dmake.
XX  
XX! Bootstrapping the binary:
XX! -------------------------
XX!    A make.bat file is provided to bootstrap the binary.  The file contains
XX!    several targets for bootstrapping and invoking the batch file with no
XX!    arguments lists the possibilities shown below.
XX  
XX!       INDEX:  You must specify one of:
XX! 	 tcc      - Turbo C 2.0, compile.
XX! 	 tccswp   - Turbo C 2.0 compile of swapping dmake.
XX! 	 msc40    - Microsoft C 4.0 compile.
XX! 	 msc50    - Microsoft C 5.0 compile.
XX! 	 msc51    - Microsoft C 5.1 compile.
XX! 	 msc60    - Microsoft C 6.0 compile.
XX! 	 msc40swp - Microsoft C 4.0, MASM 5.1 compile of swapping dmake.
XX! 	 msc50swp - Microsoft C 5.0, MASM 5.1 compile of swapping dmake.
XX! 	 msc51swp - Microsoft C 5.1, MASM 5.1 compile of swapping dmake.
XX! 	 msc60swp - Microsoft C 6.0, MASM 5.1 compile of swapping dmake.
XX  
XX!    Based on the compiler you have installed and the whether or not you
XX!    want the swapping version of dmake, you should select the appropriate
XX!    target and issue 'make.bat target'.
XX  
XX!    The batch file runs a second batch script that comes with the distribution
XX!    which compiles the sources using the appropriate compiler and flags.  The
XX!    MSC Versions of the batch files should not require any further user
XX!    intervention during the compile.  The Turbo-C version, as a final step,
XX!    invokes tlink with two response files.  The second of these response files,
XX!    named in msdos/tccdos/mk*.bat, contains absolute path names to Turbo-C
XX!    libraries.  You may need to edit these before getting a successful binary
XX!    linked.
XX  
XX!    By default the batch files make an executable that will run on an 8088
XX!    cpu and up.  You can change that by making the initial version and then
XX!    editing the config.mk files found in either msdos/tccdos or msdos/mscdos
XX!    (depending on compiler you use), and selecting a diferrent cpu type by
XX!    supplying the appropriate compiler flags.  You then need to remake dmake
XX!    again but this time use dmake itself, see below.
XX  
XX  
XX! Using dmake to Make itself:
XX! ---------------------------
XX!    If you use dmake to make itself you must first set a number of makefile
XX!    control variables, either through the environment or on the command line.
XX  
XX!    The following variables must be set:
XX  
XX! 	OS	       - defines operating system (must be set)
XX! 	OSRELEASE      - particular version of it.
XX! 	OSENVIRNOMENT  - more customization
XX  
XX!    These three variables should be defined in your environment.  Valid values
XX!    for them are listed in the dmake makefile.mk file.  For example, if you
XX!    are using MSDOS, with Turbo-C then the valid settings are:
XX  
XX+ 	set OS=msdos
XX+ 	set OSRELEASE=tccdos
XX+ 	set OSENVIRONMENT=
XX  
XX+    dmake searches for an initial startup file, you should set the environment
XX+    variable MAKESTARTUP to contain the full path to the startup file, eg:
XX+ 
XX+ 	set MAKESTARTUP=d:\usr\lib\startup.mk
XX+ 
XX+    The dmake makefile has several variables that can be user specified and
XX+    default to reasonable values if not set.
XX+ 
XX+ 	MODEL   - defines the model to compile, valid values are
XX+ 		  {s,c,m, or l}, defaults to 'c' (ie. compact) model
XX+ 		  if unspecified.
XX+ 
XX+ 	MSC_VER - defines the version of Microsoft C in use, should be set to
XX+ 		  one of 4.0, 5.0, 5.1 or 6.0; defaults to 6.0.
XX+ 
XX+ 	NOSWAP  - If set to 'y', do not compile the dmake swapping version of
XX+ 		  spawnvpe.  This has the effect of turning off swapping.
XX+ 
XX+ 	DEBUG   - If set to '1' then make the debugging version of dmake, this
XX+ 		  will also set MODEL to 'l'.
XX+ 
XX+    To set the above variables you must specify them on the dmake command line
XX+    or insert them into the makefile.mk script.
XX+ 
XX+ 
XX+ Memory Requirements and Swapping:
XX+ ---------------------------------
XX+    The swapping code currently only swaps to DISK, I have left hooks
XX+    in to accomodate XMS and EMS, I have some code that performs the
XX+    necessary XMS/EMS accesses but have not incorporated it in yet.
XX+    It appears that a ramdisk seems to work just fine.  If anyone
XX+    wishes to fill in the hooks please do and I'll be happy to include
XX+    them in future distributions.
XX+ 
XX+ 
XX+ ^C and stopping a make:
XX+ -----------------------
XX+    Thanks to the efforts of Len Reed, appears to now work.  I have been unable
XX+    to hang my machine if it's swapped out and I hit ^C a couple thousand times.
XX+    It does stop and cleans up nicely.  So I guess it works :-).  Actually, let
XX+    me know if you encounter problems with this and I'll try to duplicate
XX+    them.
XX+ 
XX+ 
XX  Other notes:
XX  ------------
XX!    dmake does not care if you are running command.com or some other command
XX!    interpretter, you must however specify the proper values of the environment
XX!    variables SHELL, SHELLFLAGS, GROUPSHELL, and GROUPFLAGS in order for things
XX!    to work correctly.  Read the man page first.
XX  
XX!    Group recipes under DOS that use command.com as the command interpretter
XX!    require you to set the GROUPSUFFIX macro.
XX  
XX!    As shipped the startup.mk files for the DOS version try to figure out what
XX!    command interpretter you are using and set things up appropriately.
SHAR_EOF
echo "End of part 2, continue with part 3"
echo "3" > s2_seq_.tmp
exit 0
-- 
--------------------------------------------------------------------------------
"This is almost worth the HIGH blood pressure!" he  |Dennis Vadura
thought as yet another mosquito exploded.-R.Patching|dvadura at dragon.uwaterloo.ca
================================================================================



More information about the Comp.sources.bugs mailing list