dvadura@watdragon.waterloo.edu (Dennis Vadura) (05/13/91)
Submitted-by: Dennis Vadura <dvadura@watdragon.waterloo.edu> Posting-number: Volume 19, Issue 52 Archive-name: dmake/part31 Supersedes: dmake-3.6: Volume 15, Issue 52-77 ---- Cut Here and feed the following to sh ---- #!/bin/sh # this is dmake.shar.31 (part 31 of a multipart archive) # do not concatenate these parts, unpack them in order with /bin/sh # file dmake/sysintf.c continued # if test ! -r _shar_seq_.tmp; then echo 'Please unpack part 1 first!' exit 1 fi (read Scheck if test "$Scheck" != 31; then echo Please unpack part "$Scheck" next! exit 1 else exit 0 fi ) < _shar_seq_.tmp || exit 1 if test -f _shar_wnt_.tmp; then sed 's/^X//' << 'SHAR_EOF' >> 'dmake/sysintf.c' && X rem = (prq->ce_flag & F_REMOVE) && X (prq->ce_flag & F_MADE ) && X !(prq->ce_attr & A_PHONY) && X !(attr & A_PRECIOUS) && X !Force; X X if( rem ) { X CELLPTR tmp = prq; X do { X (Add_prerequisite(tcp,prq,FALSE,FALSE))->cl_flag |= F_TARGET; X prq->ce_flag &= ~F_REMOVE; X prq = prq->ce_all; X } X while( prq != NIL(CELL) && prq != tmp ); X flag = TRUE; X } X } X X if( flag ) { X Remove_prq( tcp ); X X for( dp=tcp->ce_prq; dp != NIL(LINK); dp=dp->cl_next ) { X register CELLPTR prq = dp->cl_prq; X X prq->ce_flag &= ~(F_MADE|F_VISITED|F_STAT); X prq->ce_flag |= F_REMOVE; X prq->ce_time = (time_t)0L; X } X } X } } SHAR_EOF chmod 0640 dmake/sysintf.c || echo 'restore of dmake/sysintf.c failed' Wc_c="`wc -c < 'dmake/sysintf.c'`" test 14629 -eq "$Wc_c" || echo 'dmake/sysintf.c: original size 14629, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/tos/arlib.c ============== if test ! -d 'dmake/tos'; then mkdir 'dmake/tos' fi if test -f 'dmake/tos/arlib.c' -a X"$1" != X"-c"; then echo 'x - skipping dmake/tos/arlib.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/arlib.c' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/tos/RCS/arlib.c,v 1.1 91/05/06 15:32:14 dvadura Exp $ -- SYNOPSIS -- Unix archive manipulation code. -- -- DESCRIPTION -- Originally this code was provided by Eric Gisin of MKS. I took -- his code and completely rewrote it adding cacheing of lib members -- and other various optimizations. I kept the overal functional -- idea of the library routines as they are similar to those in GNU -- make and felt it advantageous to maintain a similar interface. -- -- AUTHOR -- Dennis Vadura, dvadura@watdragon.uwaterloo.ca -- CS DEPT, University of Waterloo, Waterloo, Ont., Canada -- -- COPYRIGHT -- Copyright (c) 1990 by Dennis Vadura. All rights reserved. -- -- This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- (version 1), as published by the Free Software Foundation, and -- found in the file 'LICENSE' included with this distribution. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warrant of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -- -- LOG -- $Log: arlib.c,v $ X * Revision 1.1 91/05/06 15:32:14 dvadura X * dmake Release Version 3.7 X * */ X #include <ar.h> #include "extern.h" #include "sysintf.h" X /* By defining the defines below it is possible to configure the library X * code for library cacheing/non-cacheing, ASCII archive headers, and a full X * decode of the ar_hdr fields in the scan_ar function. */ X #define ASCARCH 1 /* ASCII time stored in archive */ #define LC 1 /* Turn on library cacheing */ #define DECODE_ALL_AR_FIELDS 0 /* decode only fields make needs*/ X #if LC # define FOUND_MEMBER FALSE #else # define FOUND_MEMBER TRUE # define _cache_member(a, b, c) # define _check_cache(a, b, c, d) FALSE #endif X #define MAXFNAME 32 /* Longest file name in archive */ #define MAXMNAME 8 /* Max module name < MAXFNAME */ X X /* This struct is used to pass the library and member information about the X * routines that perform the library seeking/cacheing */ struct ar_args { X char *lib; X char *member; X time_t time; }; X X typedef struct AR { X char ar_name[MAXFNAME+1]; /* File name */ X long ar_size; /* Size in bytes */ X time_t ar_time; /* Modification time */ X #ifdef DOS X char ar_modname[MAXMNAME+1]; /* DOS module name */ #endif X #if DECODE_ALL_AR_FIELDS X uint16 ar_mode; /* File mode */ X uint16 ar_uid; /* File owner */ X uint16 ar_gid; /* File group owner */ #endif } AR, *ARPTR; X X static int ar_scan ANSI((FILE *, X int (*) ANSI((FILE *, struct AR *, struct ar_args *)), X struct ar_args *)); static int ar_touch ANSI(( FILE *, time_t )); static int time_function ANSI(( FILE *, struct AR *, struct ar_args * )); static int touch_function ANSI(( FILE *, struct AR *, struct ar_args * )); X #if LC static int _cache_member ANSI((char *, char *, time_t)); static int _check_cache ANSI((char *, char *, time_t *, int)); #endif X /* decoded archive header */ static AR _ar; X X PUBLIC time_t seek_arch(name, lib)/* ====================== X Look for module 'name' inside 'lib'. If compiled with cacheing then first X check to see if the specified lib is cached. If so then return that time X stamp instead of looking into the library. */ char *name; char *lib; { X FILE *f; X int rv; X time_t mtime; X struct ar_args args; X X /* Check the cache first (if there is a cache) */ X if( _check_cache(name, lib, &mtime, FALSE) ) return( mtime ); X X /* Open the lib file and perform the scan of the members, looking X * for our particular member. If cacheing is enabled it will be X * taken care of automatically during the scan. */ X X args.lib = lib; X args.member = name; X args.time = (time_t)0L; X X if( (f = fopen(lib, "rb")) == NIL(FILE) ) return( (time_t)0L ); X rv = ar_scan(f, time_function, &args ); X fclose( f ); X X if( rv < 0 ) Fatal("(%s): Invalid library format", lib); X X return( args.time ); } X X PUBLIC int touch_arch(name, lib)/* ======================= X Look for module 'name' inside 'lib'. If compiled with cacheing then first X check to see if the specified lib is cached. If so then set that time X stamp and write it into the library. Returns 0 on success, non-zero X on failure. */ char *name; char *lib; { X FILE *f; X int rv; X struct ar_args args; X X /* Open the lib file and perform the scan of the members, looking X * for our particular member. If cacheing is enabled it will be X * taken care of automatically during the scan. */ X X args.lib = lib; X args.member = name; X args.time = (time_t)0L; X X if( (f = fopen(lib, "rb+")) == NIL(FILE) ) return( (time_t)1L ); X rv = ar_scan(f, touch_function, &args ); X fclose( f ); X X if( rv < 0 ) Fatal("(%s): Invalid library format", lib); X X return( 0 ); } X X X static int time_function(f, arp, argp)/* ============================= X get library member's time, if it matches than return it in argp, if X cacheing is enabled than cache the library members also. */ FILE *f; /* library file */ struct AR *arp; /* library member header */ struct ar_args *argp; { X int rv = _cache_member( arp->ar_name, argp->lib, arp->ar_time ); X X if( strcmp(argp->member, arp->ar_name) == 0 ) { X argp->time = arp->ar_time; X X if( arp->ar_time == 0 && !(Glob_attr & A_SILENT) ) X Warning( "(%s): Can't extract library member timestamp; using EPOCH", X argp->member); X X return( rv ); /* 1 => no cacheing, 0 => cacheing */ X } X X return( FALSE ); /* continue scan */ } X X X static int touch_function(f, arp, argp)/* ============================== X Update library member's time stamp, and write new time value into cache X if required. */ FILE *f; /* library file */ struct AR *arp; /* library member header */ struct ar_args *argp; { X extern time_t time ANSI(( time_t * )); X time_t now = time((time_t*) NULL); /* Current time. */ X X if( strcmp(argp->member, arp->ar_name) == 0 ) { X _check_cache( argp->member, argp->lib, &now, TRUE ); X ar_touch(f, now ); X X return( TRUE ); X } X X return( FALSE ); /* continue scan */ } X X X X static int ar_scan(f, function, arg)/* =========================== X Scan the opened archive, and call the given function for each member found. X The function will be called with the file positioned at the beginning of X the member and it can read up to arp->ar_size bytes of the archive member. X If the function returns 1, we stop and return 1. We return 0 at the end X of the archive, or -1 if the archive has invalid format. This interface X is more general than required by "make", but it can be used by other X utilities. */ register FILE *f; int (*function) ANSI((FILE *, struct AR *, struct ar_args *)); struct ar_args *arg; { X extern long atol ANSI((char *)); X register char *p; X struct ar_hdr arhdr; /* external archive header */ X off_t offset; /* member seek offset */ X #if ASCARCH X char magic[SARMAG]; #else X unsigned short word; #endif X X fseek( f, 0L, 0 ); /* Start at the beginning of the archive file */ X #if ASCARCH X fread( magic, sizeof(magic), 1, f ); X if( strncmp(magic, ARMAG, SARMAG) != 0 ) return( -1 ); #else X fread( (char*)&word, sizeof(word), 1, f ); X if( word != ARMAG ) return( -1 ); #endif X X /* scan the library, calling `function' for each member X */ X while( 1 ) { X if( fread((char*) &arhdr, sizeof(arhdr), 1, f) != 1 ) break; X offset = ftell(f); X strncpy(_ar.ar_name, arhdr.ar_name, sizeof(arhdr.ar_name)); X X for( p = &_ar.ar_name[sizeof(arhdr.ar_name)]; X --p >= _ar.ar_name && *p == ' ';); X X p[1] = '\0'; X if( *p == '/' ) *p = 0; /* Only SysV has trailing '/' */ X #if ASCARCH X if( strncmp(arhdr.ar_fmag, ARFMAG, sizeof(arhdr.ar_fmag)) != 0 ) X return( -1 ); X _ar.ar_time = atol(arhdr.ar_date); X _ar.ar_size = atol(arhdr.ar_size); #else X _ar.ar_time = arhdr.ar_date; X _ar.ar_size = arhdr.ar_size; #endif X X #if DECODE_ALL_AR_FIELDS #if ASCARCH X _ar.ar_mode = atoi(arhdr.ar_mode); X _ar.ar_uid = atoi(arhdr.ar_uid); X _ar.ar_gid = atoi(arhdr.ar_gid); #else X _ar.ar_mode = arhdr.ar_mode; X _ar.ar_size = arhdr.ar_size; X _ar.ar_uid = arhdr.ar_uid; X _ar.ar_gid = arhdr.ar_gid; #endif #endif X X if( (*function)(f, &_ar, arg) ) return( 1 ); X fseek( f, offset + (_ar.ar_size+1 & ~1L), 0 ); X } X X if( !feof(f) ) return( -1 ); X return 0; } X X X static int ar_touch( f, now )/* ==================== X touch module header timestamp. */ FILE *f; time_t now; { X struct ar_hdr arhdr; /* external archive header */ X X fseek(f, - (off_t) (sizeof(arhdr) - sizeof(arhdr.ar_name)), 1); X #if ASCARCH X fprintf(f, "%lu", now); #else X fwrite((char *)now, sizeof(now), 1, f); #endif X X return( ferror(f) ? 0 : 1 ); } X X #if LC typedef struct mem { X time_t m_time; /* modify time of member*/ X struct mem *m_next; /* next member in lib */ X char m_valid; /* valid cache entry */ X char m_name[1]; /* lib member name */ } MEM, *MEMPTR; X typedef struct lib { X struct lib *lb_next; /* next library in list */ X struct mem *lb_members; /* list of lib members */ X char lb_valid; /* valid cache entry */ X char *lb_name; /* library name */ } LIB, *LIBPTR; X static LIBPTR _cache = NIL(LIB); static MEMPTR _find_member ANSI(( LIBPTR, char * )); X static int _check_cache( name, lib, pmtime, touch )/* ========================================== X Check to see if we have cached member in lib, if so return time in pmtime X and return TRUE, otherwise return FALSE, if touch is TRUE then touch X the archive member instead. */ char *name; char *lib; time_t *pmtime; int touch; { X register MEMPTR mp; X register LIBPTR lp; X X for( lp=_cache; lp != NIL(LIB) && lp->lb_name != lib; lp=lp->lb_next ); X if( lp == NIL(LIB) ) return( FALSE ); X X mp = _find_member( lp, name ); X if( mp == NIL(MEM) || !mp->m_valid ) return( FALSE ); X X if( touch == TRUE ) X { X mp->m_time = *pmtime; X mp->m_valid = 1; X } X else X *pmtime = mp->m_time; X X lp->lb_valid = 1; X lp->lb_members = mp; X X return( TRUE ); } X X X static int _cache_member( name, lib, mtime )/* =================================== X Cache name in lib along with it's time */ char *name; char *lib; time_t mtime; { X register MEMPTR mp; X register LIBPTR lp; X X for( lp=_cache; X lp != NIL(LIB) && lp->lb_name != NIL(char) && lp->lb_name != lib; X lp=lp->lb_next); X X if( lp == NIL(LIB) ) X { X lp = (LIBPTR) malloc(sizeof(LIB)); X if( lp == NIL(LIB) ) No_ram(); X X lp->lb_name = lib; X lp->lb_members = NIL(MEM); X lp->lb_next = _cache; X lp->lb_valid = 0; X _cache = lp; X } X X /* On UNIX ar does not allow multiple copies of the same .o file to live X * in the same AR file. If this is not TRUE then use the commented out X * version to set the value of mp. */ X X /*mp = _find_member(lp, name);*/ X mp = NIL(MEM); X X if( mp == NIL(MEM) ) X { X mp = (MEMPTR) malloc(sizeof(char)*offsetof(MEM,m_name[strlen(name)+1])); X if( mp == NIL(MEM) ) No_ram(); X X strcpy( mp->m_name, name ); X mp->m_time = mtime; X X if( lp->lb_members == NIL(MEM) ) { X mp->m_next = mp; X lp->lb_members = mp; X } X else { X mp->m_next = lp->lb_members->m_next; X lp->lb_members->m_next = mp; X lp->lb_members = mp; X } X } X else X mp->m_time = mtime; X X mp->m_valid = 1; X X return( lp->lb_valid ); } X X static MEMPTR _find_member( lp, name ) LIBPTR lp; char *name; { X register MEMPTR mp = lp->lb_members; X X if( mp == NIL(MEM) ) return(mp); X X do { X if( !strcmp(mp->m_name, name ) ) return( mp ); X mp = mp->m_next; X } X while( mp != lp->lb_members ); X X return( NIL(MEM) ); } #endif X X X void void_lcache( lib, member )/* ============================ X Void the library cache for lib. If member is NIL(char) then nuke all X of the members, if member is NOT NIL(char) then invalidate only that X member. */ char *lib; char *member; { #if LC X register LIBPTR lp; X register MEMPTR mp; X register MEMPTR tmp; X X for( lp=_cache; lp != NIL(LIB) && lp->lb_name != lib; lp=lp->lb_next ); X if( lp == NIL(LIB) ) return; X X if( member == NIL(char) ) { X mp = lp->lb_members; X do { X tmp = mp->m_next; X (void) free( mp ); X mp = tmp; X } while( mp != lp->lb_members ); X X lp->lb_valid = 0; X lp->lb_members = NIL(MEM); X lp->lb_name = NIL(char); X } X else { X mp=lp->lb_members; X do { X if( strcmp( member, mp->m_name) == 0 ) { X lp->lb_members = mp->m_next; X mp->m_valid = 0; X } X X mp=mp->m_next; X } while( mp != lp->lb_members ); X } #endif } SHAR_EOF chmod 0640 dmake/tos/arlib.c || echo 'restore of dmake/tos/arlib.c failed' Wc_c="`wc -c < 'dmake/tos/arlib.c'`" test 13294 -eq "$Wc_c" || echo 'dmake/tos/arlib.c: original size 13294, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/tos/config.h ============== if test -f 'dmake/tos/config.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/tos/config.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/config.h' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/tos/RCS/config.h,v 1.1 91/05/06 15:32:16 dvadura Exp $ -- SYNOPSIS -- Configurarion include file. -- -- DESCRIPTION -- There is one of these for each specific machine configuration. -- It can be used to further tweek the machine specific sources -- so that they compile. -- -- AUTHOR -- Dennis Vadura, dvadura@watdragon.uwaterloo.ca -- CS DEPT, University of Waterloo, Waterloo, Ont., Canada -- -- COPYRIGHT -- Copyright (c) 1990 by Dennis Vadura. All rights reserved. -- -- This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- (version 1), as published by the Free Software Foundation, and -- found in the file 'LICENSE' included with this distribution. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warrant of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -- -- LOG -- $Log: config.h,v $ X * Revision 1.1 91/05/06 15:32:16 dvadura X * dmake Release Version 3.7 X * */ X #include <osbind.h> X /* define this for configurations that don't have the coreleft function X * so that the code compiles. To my knowledge coreleft exists only on X * Turbo C, but it is needed here since the function is used in many debug X * macros. */ #define coreleft() Malloc(-1L) X /* Define the getcwd function that is used in the code, since BSD does X * not have getcwd, but call it getwd instead. */ extern char *getcwd ANSI((char *, int)); SHAR_EOF chmod 0640 dmake/tos/config.h || echo 'restore of dmake/tos/config.h failed' Wc_c="`wc -c < 'dmake/tos/config.h'`" test 1874 -eq "$Wc_c" || echo 'dmake/tos/config.h: original size 1874, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/tos/config.mk ============== if test -f 'dmake/tos/config.mk' -a X"$1" != X"-c"; then echo 'x - skipping dmake/tos/config.mk (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/config.mk' && # This is an OS specific configuration file # It assumes that OBJDIR, TARGET and DEBUG are previously defined. # It defines CFLAGS, LDARGS, CPPFLAGS, STARTUPFILE, LDOBJS # PRINTER, PRINTFLAGS # It augments SRC, OBJDIR, TARGET, CFLAGS, LDLIBS # PRINTER = hw PRINTFLAGS = -P$(PRINTER) STARTUPFILE = $(OS)/startup.mk CPPFLAGS = $(CFLAGS) LDOBJS = $(CSTARTUP) $(OBJDIR)/{$(<:f)} LDARGS = $(LDFLAGS) -o $@ $(OBJDIR)/*$O LDFLAGS += -s LD = $(CC) X # Debug flags DB_CFLAGS = -g -DDBUG DB_LDFLAGS = -g DB_LDLIBS = X # NO Debug flags NDB_CFLAGS = -O NDB_LDFLAGS = NDB_LDLIBS = X # Local configuration modifications for CFLAGS. CFLAGS += -I$(OS) X # Sources that must be defined for each different version OS_SRC += arlib.c ruletab.c runargv.c DOS_SRC = rmprq.c runargv.c dirbrk.c rmprq.c UNIX_SRC = arlib.c BSD_SRC = putenv.c tempnam.c X .SETDIR=$(OS) : $(OS_SRC) .SETDIR=msdos : $(DOS_SRC) .SETDIR=unix : $(UNIX_SRC) .SETDIR=unix/bsd43 : $(BSD_SRC) X SRC += $(OS_SRC) $(DOS_SRC) $(UNIX_SRC) $(BSD_SRC) X # Set source dirs so that we can find files named in this # config file. .SOURCE.h : $(OS) X # See if we modify anything in the lower levels. .IF $(OSRELEASE) != $(NULL) X .INCLUDE .IGNORE : $(OS)$(DIRSEPSTR)$(OSRELEASE)$(DIRSEPSTR)config.mk .END SHAR_EOF chmod 0640 dmake/tos/config.mk || echo 'restore of dmake/tos/config.mk failed' Wc_c="`wc -c < 'dmake/tos/config.mk'`" test 1262 -eq "$Wc_c" || echo 'dmake/tos/config.mk: original size 1262, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/tos/dirbrk.c ============== if test -f 'dmake/tos/dirbrk.c' -a X"$1" != X"-c"; then echo 'x - skipping dmake/tos/dirbrk.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/dirbrk.c' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/tos/RCS/dirbrk.c,v 1.1 91/05/06 15:32:18 dvadura Exp $ -- SYNOPSIS -- define the directory separator string. -- -- DESCRIPTION -- Define this string for any character that may appear in a path name -- and can be used as a directory separator. Also provide a function -- to indicate if a given path begins at the root of the file system. -- -- AUTHOR -- Dennis Vadura, dvadura@watdragon.uwaterloo.ca -- CS DEPT, University of Waterloo, Waterloo, Ont., Canada -- -- COPYRIGHT -- Copyright (c) 1990 by Dennis Vadura. All rights reserved. -- -- This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- (version 1), as published by the Free Software Foundation, and -- found in the file 'LICENSE' included with this distribution. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warrant of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -- -- LOG -- $Log: dirbrk.c,v $ X * Revision 1.1 91/05/06 15:32:18 dvadura X * dmake Release Version 3.7 X * */ X #include "extern.h" #include <ctype.h> X /* tos uses /, \, and : */ char* DirBrkStr = "/\\:"; X /* ** Return TRUE if the name is the full specification of a path name to a file ** starting at the root of the file system, otherwise return FALSE */ int If_root_path(name) char *name; { X return( (strchr(DirBrkStr, *name) != NIL(char)) || X (isalpha(*name) && name[1] == ':') ); } SHAR_EOF chmod 0640 dmake/tos/dirbrk.c || echo 'restore of dmake/tos/dirbrk.c failed' Wc_c="`wc -c < 'dmake/tos/dirbrk.c'`" test 1881 -eq "$Wc_c" || echo 'dmake/tos/dirbrk.c: original size 1881, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/tos/make.sh ============== if test -f 'dmake/tos/make.sh' -a X"$1" != X"-c"; then echo 'x - skipping dmake/tos/make.sh (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/make.sh' && mkdir objects gcc -c -I. -Itos -O infer.c mv infer.o objects gcc -c -I. -Itos -O make.c mv make.o objects gcc -c -I. -Itos -O stat.c mv stat.o objects gcc -c -I. -Itos -O expand.c mv expand.o objects gcc -c -I. -Itos -O dmstring.c mv dmstring.o objects gcc -c -I. -Itos -O hash.c mv hash.o objects gcc -c -I. -Itos -O dag.c mv dag.o objects gcc -c -I. -Itos -O dmake.c mv dmake.o objects gcc -c -I. -Itos -O path.c mv path.o objects gcc -c -I. -Itos -O imacs.c mv imacs.o objects gcc -c -I. -Itos -O sysintf.c mv sysintf.o objects gcc -c -I. -Itos -O parse.c mv parse.o objects gcc -c -I. -Itos -O getinp.c mv getinp.o objects gcc -c -I. -Itos -O quit.c mv quit.o objects gcc -c -I. -Itos -O state.c mv state.o objects gcc -c -I. -Itos -O basename.c mv basename.o objects gcc -c -I. -Itos -O dmdump.c mv dmdump.o objects gcc -c -I. -Itos -O macparse.c mv macparse.o objects gcc -c -I. -Itos -O rulparse.c mv rulparse.o objects gcc -c -I. -Itos -O percent.c mv percent.o objects gcc -c -I. -Itos -O function.c mv function.o objects gcc -c -I. -Itos -O tos/arlib.c mv arlib.o objects gcc -c -I. -Itos -O tos/ruletab.c mv ruletab.o objects gcc -c -I. -Itos -O tos/runargv.c mv runargv.o objects gcc -c -I. -Itos -O msdos/rmprq.c mv rmprq.o objects gcc -c -I. -Itos -O msdos/dirbrk.c mv dirbrk.o objects gcc -c -I. -Itos -O unix/bsd43/putenv.c mv putenv.o objects gcc -c -I. -Itos -O unix/bsd43/tempnam.c mv tempnam.o objects gcc -s -o dmake objects/*.o cp tos/startup.mk startup.mk SHAR_EOF chmod 0640 dmake/tos/make.sh || echo 'restore of dmake/tos/make.sh failed' Wc_c="`wc -c < 'dmake/tos/make.sh'`" test 1480 -eq "$Wc_c" || echo 'dmake/tos/make.sh: original size 1480, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/tos/public.h ============== if test -f 'dmake/tos/public.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/tos/public.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/public.h' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/tos/RCS/public.h,v 1.1 91/05/06 15:32:18 dvadura Exp Locker: dvadura $ -- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT -- -- SYNOPSIS -- Local functions exported to be visible by others. -- -- DESCRIPTION -- This file is generated by 'genpub'. Function declarations -- that appear in this file are extracted by 'genpub' from -- source files. Any function in the source file whose definition -- appears like: -- -- PUBLIC return_type -- function( arg_list ); -- type_expr1 arg1; -- ... -- -- has its definition extracted and a line of the form: -- -- return_type function ANSI((type_expr1,type_expr2,...)); -- -- entered into the output file. -- -- AUTHOR -- Dennis Vadura, dvadura@watdragon.uwaterloo.ca -- CS DEPT, University of Waterloo, Waterloo, Ont., Canada -- -- COPYRIGHT -- Copyright (c) 1990 by Dennis Vadura. All rights reserved. -- -- This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- (version 1), as published by the Free Software Foundation, and -- found in the file 'LICENSE' included with this distribution. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warrant of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -- -- LOG -- $Log: public.h,v $ X * Revision 1.1 91/05/06 15:32:18 dvadura X * dmake Release Version 3.7 X * */ X #ifndef _DMAKE_PUBLIC_h #define _DMAKE_PUBLIC_h X void Infer_recipe ANSI((CELLPTR, CELLPTR)); int Make_targets ANSI(()); int Exec_commands ANSI((CELLPTR)); void Pop_dir ANSI((int)); void Append_line ANSI((char *, int, FILE *, char *, int, int)); void Stat_target ANSI((CELLPTR, int)); char * Expand ANSI((char *)); char * Apply_edit ANSI((char *, char *, char *, int, int)); void Map_esc ANSI((char *)); char* Apply_modifiers ANSI((int, char *)); char* Tokenize ANSI((char *, char *)); char * _strjoin ANSI((char *, char *, int, int)); char * _stradd ANSI((char *, char *, int)); char * _strapp ANSI((char *, char *)); char * _strdup ANSI((char *)); char * _strpbrk ANSI((char *, char *)); char * _strspn ANSI((char *, char *)); char * _strstr ANSI((char *, char *)); char * _substr ANSI((char *, char *)); uint16 Hash ANSI((char *, uint32 *)); HASHPTR Get_name ANSI((char *, HASHPTR *, int)); HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); HASHPTR Def_macro ANSI((char *, char *, int)); CELLPTR Def_cell ANSI((char *)); LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); void Clear_prerequisites ANSI((CELLPTR)); int Test_circle ANSI((CELLPTR, int)); STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); t_attr Rcp_attribute ANSI((char *)); int main ANSI((int, char **)); FILE * Openfile ANSI((char *, int, int)); FILE * Closefile ANSI(()); FILE * Search_file ANSI((char *, char **)); char * Filename ANSI(()); void No_ram ANSI(()); int Usage ANSI((int)); int Version ANSI(()); char * Get_suffix ANSI((char *)); char * Build_path ANSI((char *, char *)); void Make_rules ANSI(()); void Create_macro_vars ANSI(()); time_t Do_stat ANSI((char *, char *, char **)); int Do_touch ANSI((char *, char *, char **)); void Void_lib_cache ANSI((char *, char *)); time_t Do_time ANSI(()); int Do_cmnd ANSI((char *, int, int, CELLPTR, int, int, int)); char ** Pack_argv ANSI((int, int, char *)); char * Read_env_string ANSI((char *)); int Write_env_string ANSI((char *, char *)); void ReadEnvironment ANSI(()); void Catch_signals ANSI((void (*)())); void Clear_signals ANSI(()); void Prolog ANSI((int, char* [])); void Epilog ANSI((int)); char * Get_current_dir ANSI(()); int Set_dir ANSI((char*)); char Get_switch_char ANSI(()); FILE* Get_temp ANSI((char **, char *, int)); FILE * Start_temp ANSI((char *, CELLPTR, char **)); void Open_temp_error ANSI((char *, char *)); void Link_temp ANSI((CELLPTR, FILE *, char *)); void Close_temp ANSI((CELLPTR, FILE *)); void Unlink_temp_files ANSI((CELLPTR)); void Handle_result ANSI((int, int, int, CELLPTR)); void Update_time_stamp ANSI((CELLPTR)); void Parse ANSI((FILE *)); int Get_line ANSI((char *, FILE *)); char * Do_comment ANSI((char *, char **, int)); char * Get_token ANSI((TKSTRPTR, char *, int)); void Quit ANSI(()); void Read_state ANSI(()); void Write_state ANSI(()); int Check_state ANSI((CELLPTR, STRINGPTR *, int)); char* basename ANSI((char *)); void Dump ANSI(()); void Dump_recipe ANSI((STRINGPTR)); int Parse_macro ANSI((char *, int)); int Macro_op ANSI((char *)); int Parse_rule_def ANSI((int *)); int Rule_op ANSI((char *)); void Add_recipe_to_list ANSI((char *, int, int)); void Bind_rules_to_targets ANSI((int)); int Set_group_attributes ANSI((char *)); DFALINKPTR Match_dfa ANSI((char *)); void Check_circle_dfa ANSI(()); void Add_nfa ANSI((char *)); char * Exec_function ANSI((char *)); time_t seek_arch ANSI((char *, char *)); int touch_arch ANSI((char *, char *)); int runargv ANSI((CELLPTR, int, int, int, int, char *)); void Clean_up_processes ANSI(()); int Wait_for_child ANSI((int, int)); void Remove_prq ANSI((CELLPTR)); int If_root_path ANSI((char *)); X #endif SHAR_EOF chmod 0640 dmake/tos/public.h || echo 'restore of dmake/tos/public.h failed' Wc_c="`wc -c < 'dmake/tos/public.h'`" test 5553 -eq "$Wc_c" || echo 'dmake/tos/public.h: original size 5553, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/tos/putenv.c ============== if test -f 'dmake/tos/putenv.c' -a X"$1" != X"-c"; then echo 'x - skipping dmake/tos/putenv.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/putenv.c' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/tos/RCS/putenv.c,v 1.1 91/05/06 15:32:19 dvadura Exp $ -- SYNOPSIS -- my own putenv for BSD like systems. -- -- DESCRIPTION -- This originally came from MKS, but I rewrote it to fix a bug with -- replacing existing strings, probably never happened but the code -- was wrong nonetheless. -- -- AUTHOR -- Dennis Vadura, dvadura@watdragon.uwaterloo.ca -- CS DEPT, University of Waterloo, Waterloo, Ont., Canada -- -- COPYRIGHT -- Copyright (c) 1990 by Dennis Vadura. All rights reserved. -- -- This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- (version 1), as published by the Free Software Foundation, and -- found in the file 'LICENSE' included with this distribution. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warrant of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -- -- LOG -- $Log: putenv.c,v $ X * Revision 1.1 91/05/06 15:32:19 dvadura X * dmake Release Version 3.7 X * */ X #include <stdio.h> #include <string.h> X int putenv( str )/* =============== X Take a string of the form NAME=value and stick it into the environment. X We do this by allocating a new set of pointers if we have to add a new X string and by replacing an existing pointer if the value replaces the value X of an existing string. */ char *str; { X extern char **environ; /* The current environment. */ X static char **ourenv = NULL; /* A new environment */ X register char **p; X register char *q; X int size; X X /* First search the current environment and see if we can replace a X * string. */ X for( p=environ; *p; p++ ) { X register char *s = str; X X for( q = *p; *q && *s && *s == *q; q++, s++ ) X if( *s == '=' ) { X *p = str; X return(0); /* replaced it so go away */ X } X } X X /* Ok, can't replace a string so need to grow the environment. */ X size = p - environ + 2; /* size of new environment */ X /* size of old is size-1 */ X X /* It's the first time, so allocate a new environment since we don't know X * where the old one is comming from. */ X if( ourenv == NULL ) { X if( (ourenv = (char **) malloc( sizeof(char *)*size )) == NULL ) X return(1); X X memcpy( (char *)ourenv, (char *)environ, (size-2)*sizeof(char *) ); X } X else if( (ourenv = (char **)realloc( ourenv, size*sizeof(char *))) == NULL ) X return(1); X X ourenv[--size] = NULL; X ourenv[--size] = str; X X environ = ourenv; X return(0); } SHAR_EOF chmod 0640 dmake/tos/putenv.c || echo 'restore of dmake/tos/putenv.c failed' Wc_c="`wc -c < 'dmake/tos/putenv.c'`" test 2923 -eq "$Wc_c" || echo 'dmake/tos/putenv.c: original size 2923, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/tos/rmprq.c ============== if test -f 'dmake/tos/rmprq.c' -a X"$1" != X"-c"; then echo 'x - skipping dmake/tos/rmprq.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/rmprq.c' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/tos/RCS/rmprq.c,v 1.1 91/05/06 15:32:20 dvadura Exp $ -- SYNOPSIS -- remove prerequisites code. -- -- DESCRIPTION -- This code is different for DOS and for UNIX and parallel make -- architectures since the parallel case requires the rm's to be -- run in parallel, whereas DOS guarantees to run them sequentially. -- -- AUTHOR -- Dennis Vadura, dvadura@watdragon.uwaterloo.ca -- CS DEPT, University of Waterloo, Waterloo, Ont., Canada -- -- COPYRIGHT -- Copyright (c) 1990 by Dennis Vadura. All rights reserved. -- -- This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- (version 1), as published by the Free Software Foundation, and -- found in the file 'LICENSE' included with this distribution. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warrant of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -- -- LOG -- $Log: rmprq.c,v $ X * Revision 1.1 91/05/06 15:32:20 dvadura X * dmake Release Version 3.7 X * */ X #include "extern.h" #include "alloc.h" X void Remove_prq( tcp ) CELLPTR tcp; { X tcp->ce_flag &= ~(F_MADE|F_VISITED); X tcp->CE_HOW->hw_flag &= ~(F_MADE|F_VISITED); X tcp->ce_time = 0L; X X Make( tcp, tcp->CE_HOW, NIL(CELL) ); } SHAR_EOF chmod 0640 dmake/tos/rmprq.c || echo 'restore of dmake/tos/rmprq.c failed' Wc_c="`wc -c < 'dmake/tos/rmprq.c'`" test 1716 -eq "$Wc_c" || echo 'dmake/tos/rmprq.c: original size 1716, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/tos/ruletab.c ============== if test -f 'dmake/tos/ruletab.c' -a X"$1" != X"-c"; then echo 'x - skipping dmake/tos/ruletab.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/ruletab.c' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/tos/RCS/ruletab.c,v 1.1 91/05/06 15:32:21 dvadura Exp $ -- SYNOPSIS -- Default initial configuration of dmake. -- -- DESCRIPTION -- Define here the initial set of rules that are defined before -- dmake performs any processing. -- -- AUTHOR -- Dennis Vadura, dvadura@watdragon.uwaterloo.ca -- CS DEPT, University of Waterloo, Waterloo, Ont., Canada -- -- COPYRIGHT -- Copyright (c) 1990 by Dennis Vadura. All rights reserved. -- -- This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- (version 1), as published by the Free Software Foundation, and -- found in the file 'LICENSE' included with this distribution. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warrant of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -- -- LOG -- $Log: ruletab.c,v $ X * Revision 1.1 91/05/06 15:32:21 dvadura X * dmake Release Version 3.7 X * */ X /* These are control macros for dmake that MUST be defined at some point X * if they are NOT dmake will not work! These are default definitions. They X * may be overridden inside the .STARTUP makefile, they are here X * strictly so that dmake can parse the STARTUP makefile */ X static char *_rules[] = { X "MAXPROCESSLIMIT := 1", X "MAXPROCESS := 1", X "MAXLINELENGTH := 8190", X ".IMPORT .IGNORE: ROOTDIR", X ".MAKEFILES : makefile.mk Makefile makefile", X ".SOURCE : .NULL", #include "startup.h" X 0 }; X char **Rule_tab = _rules; /* for sundry reasons in Get_environment() */ SHAR_EOF chmod 0640 dmake/tos/ruletab.c || echo 'restore of dmake/tos/ruletab.c failed' Wc_c="`wc -c < 'dmake/tos/ruletab.c'`" test 1957 -eq "$Wc_c" || echo 'dmake/tos/ruletab.c: original size 1957, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/tos/runargv.c ============== if test -f 'dmake/tos/runargv.c' -a X"$1" != X"-c"; then echo 'x - skipping dmake/tos/runargv.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/runargv.c' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/tos/RCS/runargv.c,v 1.1 91/05/06 15:32:22 dvadura Exp $ -- SYNOPSIS -- run a sub process. -- -- DESCRIPTION -- Use spawn to run a subprocess. -- -- AUTHOR -- Dennis Vadura, dvadura@watdragon.uwaterloo.ca -- CS DEPT, University of Waterloo, Waterloo, Ont., Canada -- -- COPYRIGHT -- Copyright (c) 1990 by Dennis Vadura. All rights reserved. -- -- This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- (version 1), as published by the Free Software Foundation, and -- found in the file 'LICENSE' included with this distribution. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warrant of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -- -- LOG -- $Log: runargv.c,v $ X * Revision 1.1 91/05/06 15:32:22 dvadura X * dmake Release Version 3.7 X * */ X #include <process.h> #include <errno.h> #include "extern.h" #include "sysintf.h" X static int _abort_flg = FALSE; static void _add_child ANSI((CELLPTR, int)); static void _finished_child ANSI((int)); SHAR_EOF true || echo 'restore of dmake/tos/runargv.c failed' fi echo 'End of part 31, continue with part 32' echo 32 > _shar_seq_.tmp exit 0 exit 0 # Just in case... -- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM Sterling Software, IMD UUCP: uunet!sparky!kent Phone: (402) 291-8300 FAX: (402) 291-4362 Please send comp.sources.misc-related mail to kent@uunet.uu.net.