dvadura@watdragon.waterloo.edu (Dennis Vadura) (05/13/91)
Submitted-by: Dennis Vadura <dvadura@watdragon.waterloo.edu> Posting-number: Volume 19, Issue 53 Archive-name: dmake/part32 Supersedes: dmake-3.6: Volume 15, Issue 52-77 ---- Cut Here and feed the following to sh ---- #!/bin/sh # this is dmake.shar.32 (part 32 of a multipart archive) # do not concatenate these parts, unpack them in order with /bin/sh # file dmake/tos/runargv.c continued # if test ! -r _shar_seq_.tmp; then echo 'Please unpack part 1 first!' exit 1 fi (read Scheck if test "$Scheck" != 32; 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/tos/runargv.c' && X PUBLIC int runargv(target, ignore, group, last, shell, cmd) CELLPTR target; int ignore; int group; int last; int shell; char *cmd; { X int status; X char **argv; X X argv = Pack_argv( group, shell, cmd ); X _add_child(target, ignore); X status = spawnvp(P_WAIT, *argv, argv); X if( status == -1 ) Error("%s: %s", argv[0], strerror(errno)); X _finished_child(status); X if( last && !Doing_bang ) Update_time_stamp( target ); X X return( 0 ); } X X PUBLIC void Clean_up_processes() { X _abort_flg = TRUE; X _finished_child(-1); } X X PUBLIC int Wait_for_child( abort_flg, pid ) int abort_flg; int pid; { X return(1); } X X static int _valid = -1; static CELLPTR _tg; static int _ignore; X static void _add_child( target, ignore ) CELLPTR target; int ignore; { X _tg = target; X _ignore = ignore; X _valid = 0; X X Current_target = NIL(CELL); } X X static void _finished_child(status) int status; { X if( _valid == -1 ) return; X Unlink_temp_files( _tg ); X _valid = -1; X Handle_result( status, _ignore, _abort_flg, _tg ); } SHAR_EOF chmod 0640 dmake/tos/runargv.c || echo 'restore of dmake/tos/runargv.c failed' Wc_c="`wc -c < 'dmake/tos/runargv.c'`" test 2542 -eq "$Wc_c" || echo 'dmake/tos/runargv.c: original size 2542, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/tos/startup.h ============== if test -f 'dmake/tos/startup.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/tos/startup.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/startup.h' && /* This file contains the default value of the MAKESTARTUP variable. X * You must set the quoted string below to the default path to the startup X * variable, so that it gets compiled in. LEAVE ROOTDIR at the front of X * the path. This allows the user to customize his environment for dmake X * by setting up a new ROOTDIR environment variable. */ X "MAKESTARTUP := $(ROOTDIR)/etc/startup.mk", SHAR_EOF chmod 0640 dmake/tos/startup.h || echo 'restore of dmake/tos/startup.h failed' Wc_c="`wc -c < 'dmake/tos/startup.h'`" test 392 -eq "$Wc_c" || echo 'dmake/tos/startup.h: original size 392, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/tos/startup.mk ============== if test -f 'dmake/tos/startup.mk' -a X"$1" != X"-c"; then echo 'x - skipping dmake/tos/startup.mk (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/startup.mk' && # Generic UNIX DMAKE startup file. Customize to suit your needs. # Should work for both SYSV, and BSD 4.3 # See the documentation for a description of internally defined macros. # # Disable warnings for macros redefined here that were given # on the command line. __.SILENT := $(.SILENT) .SILENT := yes X # Configuration parameters for DMAKE startup.mk file # Set these to NON-NULL if you wish to turn the parameter on. _HAVE_RCS := # yes => RCS is installed. _HAVE_SCCS := # yes => SCCS is installed. X # Applicable suffix definitions A := .olb # Libraries E := # Executables F := .f # Fortran O := .o # Objects P := .p # Pascal S := .s # Assembler sources V := ,v # RCS suffix X # Recipe execution configurations SHELL := /bin/sh SHELLFLAGS := GROUPSHELL := $(SHELL) GROUPFLAGS := SHELLMETAS := |();&<>?*][$$:\\#`'" GROUPSUFFIX := .bat DIVFILE = $(TMPFILE) X # Standard C-language command names and flags X CPP := /gnu/lib/cpp # C-preprocessor X CC := gcc # C-compiler and flags X CFLAGS += X X AS := /gnu/lib/as # Assembler and flags X ASFLAGS += X X LD = $(CC) # Loader and flags X LDFLAGS += X LDLIBS = X # Definition of $(MAKE) macro for recursive makes. X MAKE = $(MAKECMD) $(MFLAGS) X # Definition of Print command for this system. X PRINT = lpr X # Language and Parser generation Tools and their flags X YACC := yacc # standard yacc X YFLAGS += X YTAB := y.tab # yacc output files name stem. X X LEX := lex # standard lex X LFLAGS += X LEXYY := lex.yy # lex output file X # Other Compilers, Tools and their flags X PC := pc # pascal compiler X RC := f77 # ratfor compiler X FC := f77 # fortran compiler X X CO := co # check out for RCS X COFLAGS += -q X X AR := gar # archiver X ARFLAGS+= ruv X X RM := /gnu/bin/rm # remove a file command X RMFLAGS += X # Implicit generation rules for making inferences. # We don't provide .yr or .ye rules here. They're obsolete. # Rules for making *$O X %$O : %.c ; $(CC) $(CFLAGS) -c $< X %$O : %$P ; $(PC) $(PFLAGS) -c $< X %$O : %$S ; $(AS) $(ASFLAGS) $< X %$O : %.cl ; class -c $< X %$O : %.e %.r %.F %$F X $(FC) $(RFLAGS) $(EFLAGS) $(FFLAGS) -c $< X # Executables X %$E : %$O ; $(LD) $(LDFLAGS) -o $@ $< $(LDLIBES) X # lex and yacc rules X %.c : %.y ; $(YACC) $(YFLAGS) $<; mv $(YTAB).c $@ X %.c : %.l ; $(LEX) $(LFLAGS) $<; mv $(LEXYY).c $@ X # This rule tells how to make *.out from it's immediate list of prerequisites # UNIX only. X %.out :; $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) X # RCS support .IF $(_HAVE_RCS) X % : %$V $$(@:d)RCS/$$(@:f)$V;- $(CO) $(COFLAGS) $@ X .NOINFER : %$V $$(@:d)RCS/$$(@:f)$V .END X # SCCS support .IF $(_HAVE_SCCS) X % : s.% ; get $@ X .NOINFER : s.% .END X # Recipe to make archive files. %$A : [ X $(AR) $(ARFLAGS) $@ $? X $(RM) $(RMFLAGS) $? X ranlib $@ ] X # DMAKE uses this recipe to remove intermediate targets .REMOVE :; $(RM) -f $< X # AUGMAKE extensions for SYSV compatibility @B = $(@:b) @D = $(@:d) @F = $(@:f) *B = $(*:b) *D = $(*:d) *F = $(*:f) <B = $(<:b) <D = $(<:d) <F = $(<:f) ?B = $(?:b) ?F = $(?:f) ?D = $(?:d) X # Turn warnings back to previous setting. .SILENT := $(__.SILENT) X # Local startup file if any .INCLUDE .IGNORE: "_startup.mk" SHAR_EOF chmod 0640 dmake/tos/startup.mk || echo 'restore of dmake/tos/startup.mk failed' Wc_c="`wc -c < 'dmake/tos/startup.mk'`" test 3233 -eq "$Wc_c" || echo 'dmake/tos/startup.mk: original size 3233, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/tos/sysintf.h ============== if test -f 'dmake/tos/sysintf.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/tos/sysintf.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/sysintf.h' && /* ** assorted bits of system interface, for common routines inside dmake. ** System specific code can be found in the config.h files for each ** of the system specifications. */ X #define STAT stat #define VOID_LCACHE(l,m) (void) void_lcache(l,m) #define Hook_std_writes(A) #definf GETPID getpid() X /* ** standard C items */ X /* ** DOS interface standard items */ #define getswitchar() '-' X /* ** make parameters */ #define MAX_PATH_LEN 1024 SHAR_EOF chmod 0640 dmake/tos/sysintf.h || echo 'restore of dmake/tos/sysintf.h failed' Wc_c="`wc -c < 'dmake/tos/sysintf.h'`" test 442 -eq "$Wc_c" || echo 'dmake/tos/sysintf.h: original size 442, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/tos/tempnam.c ============== if test -f 'dmake/tos/tempnam.c' -a X"$1" != X"-c"; then echo 'x - skipping dmake/tos/tempnam.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/tempnam.c' && /*LINTLIBRARY*/ #include <stdio.h> #include <string.h> #include <stdlib.h> X #define max(A,B) (((A)<(B))?(B):(A)) X extern char *mktemp(); extern int access(); X static char *cpdir(); static char *seed="AAA"; X /* BSD stdio.h doesn't define P_tmpdir, so let's do it here */ #ifndef P_tmpdir static char *P_tmpdir = "/tmp"; #endif X char * tempnam(dir, prefix) char *dir; /* use this directory please (if non-NULL) */ char *prefix; /* use this (if non-NULL) as filename prefix */ { X register char *p, *q, *tmpdir; X int tl=0, dl=0, pl; X X pl = strlen(P_tmpdir); X X if( (tmpdir = getenv("TMPDIR")) != NULL ) tl = strlen(tmpdir); X if( dir != NULL ) dl = strlen(dir); X X if( (p = malloc((unsigned)(max(max(dl,tl),pl)+16))) == NULL ) X return(NULL); X X *p = '\0'; X X if( (tl == 0) || (access( cpdir(p, tmpdir), 3) != 0) ) X if( (dl == 0) || (access( cpdir(p, dir), 3) != 0) ) X if( access( cpdir(p, P_tmpdir), 3) != 0 ) X if( access( cpdir(p, "/tmp"), 3) != 0 ) X return(NULL); X X (void) strcat(p, "/"); X if(prefix) X { X *(p+strlen(p)+5) = '\0'; X (void)strncat(p, prefix, 5); X } X X (void)strcat(p, seed); X (void)strcat(p, "XXXXXX"); X X q = seed; X while(*q == 'Z') *q++ = 'A'; X ++*q; X X if(*mktemp(p) == '\0') return(NULL); X return(p); } X X X static char * cpdir(buf, str) char *buf; char *str; { X char *p; X X if(str != NULL) X { X (void) strcpy(buf, str); X p = buf - 1 + strlen(buf); X if(*p == '/') *p = '\0'; X } X X return(buf); } SHAR_EOF chmod 0640 dmake/tos/tempnam.c || echo 'restore of dmake/tos/tempnam.c failed' Wc_c="`wc -c < 'dmake/tos/tempnam.c'`" test 1506 -eq "$Wc_c" || echo 'dmake/tos/tempnam.c: original size 1506, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/386ix/ar.h ============== if test ! -d 'dmake/unix'; then mkdir 'dmake/unix' fi if test ! -d 'dmake/unix/386ix'; then mkdir 'dmake/unix/386ix' fi if test -f 'dmake/unix/386ix/ar.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/386ix/ar.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/386ix/ar.h' && #define PORTAR 1 #include "/usr/include/ar.h" SHAR_EOF chmod 0640 dmake/unix/386ix/ar.h || echo 'restore of dmake/unix/386ix/ar.h failed' Wc_c="`wc -c < 'dmake/unix/386ix/ar.h'`" test 46 -eq "$Wc_c" || echo 'dmake/unix/386ix/ar.h: original size 46, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/386ix/config.h ============== if test -f 'dmake/unix/386ix/config.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/386ix/config.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/386ix/config.h' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/unix/386ix/RCS/config.h,v 1.1 91/05/06 15:27:43 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:27:43 dvadura X * dmake Release Version 3.7 X * */ 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() 0L 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)); X /* Define setvbuf, SysV doesn't have one */ #define setvbuf(fp, bp, type, len) setbuf( fp, NULL ); X /* We don't care about CONST */ #define CONST SHAR_EOF chmod 0640 dmake/unix/386ix/config.h || echo 'restore of dmake/unix/386ix/config.h failed' Wc_c="`wc -c < 'dmake/unix/386ix/config.h'`" test 1998 -eq "$Wc_c" || echo 'dmake/unix/386ix/config.h: original size 1998, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/386ix/config.mk ============== if test -f 'dmake/unix/386ix/config.mk' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/386ix/config.mk (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/386ix/config.mk' && # This is the 386IX UNIX configuration file for DMAKE # It simply modifies the values of SRC, and checks to see if # OSENVIRONMENT is defined. If so it includes the appropriate # config.mk file. # # It also sets the values of .SOURCE.c and .SOURCE.h to include the local # directory. # osrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE) X # The following are required sources OSDSRC := .IF $(OSDSRC) X SRC += $(OSDSRC) X .SETDIR=$(osrdir) : $(OSDSRC) .END X .SOURCE.h : $(osrdir) X # Local configuration modifications for CFLAGS, there's local SysV includes # too. CFLAGS += -I$(osrdir) X # See if we modify anything in the lower levels. .IF $(OSENVIRONMENT) != $(NULL) X .INCLUDE .IGNORE : $(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT)$(DIRSEPSTR)config.mk .END SHAR_EOF chmod 0640 dmake/unix/386ix/config.mk || echo 'restore of dmake/unix/386ix/config.mk failed' Wc_c="`wc -c < 'dmake/unix/386ix/config.mk'`" test 745 -eq "$Wc_c" || echo 'dmake/unix/386ix/config.mk: original size 745, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/386ix/make.sh ============== if test -f 'dmake/unix/386ix/make.sh' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/386ix/make.sh (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/386ix/make.sh' && mkdir objects cc -c -I. -Iunix -Iunix/386ix -O infer.c mv infer.o objects cc -c -I. -Iunix -Iunix/386ix -O make.c mv make.o objects cc -c -I. -Iunix -Iunix/386ix -O stat.c mv stat.o objects cc -c -I. -Iunix -Iunix/386ix -O expand.c mv expand.o objects cc -c -I. -Iunix -Iunix/386ix -O dmstring.c mv dmstring.o objects cc -c -I. -Iunix -Iunix/386ix -O hash.c mv hash.o objects cc -c -I. -Iunix -Iunix/386ix -O dag.c mv dag.o objects cc -c -I. -Iunix -Iunix/386ix -O dmake.c mv dmake.o objects cc -c -I. -Iunix -Iunix/386ix -O path.c mv path.o objects cc -c -I. -Iunix -Iunix/386ix -O imacs.c mv imacs.o objects cc -c -I. -Iunix -Iunix/386ix -O sysintf.c mv sysintf.o objects cc -c -I. -Iunix -Iunix/386ix -O parse.c mv parse.o objects cc -c -I. -Iunix -Iunix/386ix -O getinp.c mv getinp.o objects cc -c -I. -Iunix -Iunix/386ix -O quit.c mv quit.o objects cc -c -I. -Iunix -Iunix/386ix -O state.c mv state.o objects cc -c -I. -Iunix -Iunix/386ix -O basename.c mv basename.o objects cc -c -I. -Iunix -Iunix/386ix -O dmdump.c mv dmdump.o objects cc -c -I. -Iunix -Iunix/386ix -O macparse.c mv macparse.o objects cc -c -I. -Iunix -Iunix/386ix -O rulparse.c mv rulparse.o objects cc -c -I. -Iunix -Iunix/386ix -O percent.c mv percent.o objects cc -c -I. -Iunix -Iunix/386ix -O function.c mv function.o objects cc -c -I. -Iunix -Iunix/386ix -O unix/arlib.c mv arlib.o objects cc -c -I. -Iunix -Iunix/386ix -O unix/dirbrk.c mv dirbrk.o objects cc -c -I. -Iunix -Iunix/386ix -O unix/rmprq.c mv rmprq.o objects cc -c -I. -Iunix -Iunix/386ix -O unix/ruletab.c mv ruletab.o objects cc -c -I. -Iunix -Iunix/386ix -O unix/runargv.c mv runargv.o objects cc -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o objects/quit.o objects/state.o objects/basename.o objects/dmdump.o objects/macparse.o objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o cp unix/386ix/startup.mk startup.mk SHAR_EOF chmod 0640 dmake/unix/386ix/make.sh || echo 'restore of dmake/unix/386ix/make.sh failed' Wc_c="`wc -c < 'dmake/unix/386ix/make.sh'`" test 2126 -eq "$Wc_c" || echo 'dmake/unix/386ix/make.sh: original size 2126, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/386ix/public.h ============== if test -f 'dmake/unix/386ix/public.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/386ix/public.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/386ix/public.h' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/unix/386ix/RCS/public.h,v 1.1 91/05/06 15:27:45 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:27:45 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 If_root_path ANSI((char *)); void Remove_prq ANSI((CELLPTR)); int runargv ANSI((CELLPTR, int, int, int, int, char *)); int Wait_for_child ANSI((int, int)); void Clean_up_processes ANSI(()); X #endif SHAR_EOF chmod 0640 dmake/unix/386ix/public.h || echo 'restore of dmake/unix/386ix/public.h failed' Wc_c="`wc -c < 'dmake/unix/386ix/public.h'`" test 5521 -eq "$Wc_c" || echo 'dmake/unix/386ix/public.h: original size 5521, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/386ix/startup.mk ============== if test -f 'dmake/unix/386ix/startup.mk' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/386ix/startup.mk (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/386ix/startup.mk' && # Generic UNIX DMAKE startup file. Customize to suit your needs. # Should work for both SYSV, and BSD 4.3 # See the documentation for a description of internally defined macros. # # Disable warnings for macros redefined here that were given # on the command line. __.SILENT := $(.SILENT) .SILENT := yes X # Configuration parameters for DMAKE startup.mk file # Set these to NON-NULL if you wish to turn the parameter on. _HAVE_RCS := yes # yes => RCS is installed. _HAVE_SCCS := yes # yes => SCCS is installed. X # Applicable suffix definitions A := .a # Libraries E := # Executables F := .f # Fortran O := .o # Objects P := .p # Pascal S := .s # Assembler sources V := ,v # RCS suffix X # Recipe execution configurations SHELL := /bin/sh SHELLFLAGS := -ce GROUPSHELL := $(SHELL) GROUPFLAGS := SHELLMETAS := |();&<>?*][$$:\\#`'" GROUPSUFFIX := DIVFILE = $(TMPFILE) X # Standard C-language command names and flags X CPP := /lib/cpp # C-preprocessor X CC := cc # C-compiler and flags X CFLAGS += X X AS := as # Assembler and flags X ASFLAGS += X X LD = $(CC) # Loader and flags X LDFLAGS += X LDLIBS = X # Definition of $(MAKE) macro for recursive makes. X MAKE = $(MAKECMD) $(MFLAGS) X # Definition of Print command for this system. X PRINT = lpr X # Language and Parser generation Tools and their flags X YACC := yacc # standard yacc X YFLAGS += X YTAB := y.tab # yacc output files name stem. X X LEX := lex # standard lex X LFLAGS += X LEXYY := lex.yy # lex output file X # Other Compilers, Tools and their flags X PC := pc # pascal compiler X RC := f77 # ratfor compiler X FC := f77 # fortran compiler X X CO := co # check out for RCS X COFLAGS += -q X X AR := ar # archiver X ARFLAGS+= ruv X X RM := /bin/rm # remove a file command X RMFLAGS += X # Implicit generation rules for making inferences. # We don't provide .yr or .ye rules here. They're obsolete. # Rules for making *$O X %$O : %.c ; $(CC) $(CFLAGS) -c $< X %$O : %$P ; $(PC) $(PFLAGS) -c $< X %$O : %$S ; $(AS) $(ASFLAGS) $< X %$O : %.cl ; class -c $< X %$O : %.e %.r %.F %$F X $(FC) $(RFLAGS) $(EFLAGS) $(FFLAGS) -c $< X # Executables X %$E : %$O ; $(LD) $(LDFLAGS) -o $@ $< $(LDLIBES) X # lex and yacc rules X %.c : %.y ; $(YACC) $(YFLAGS) $<; mv $(YTAB).c $@ X %.c : %.l ; $(LEX) $(LFLAGS) $<; mv $(LEXYY).c $@ X # This rule tells how to make *.out from it's immediate list of prerequisites # UNIX only. X %.out :; $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) X # RCS support .IF $(_HAVE_RCS) X % : %$V $$(@:d)RCS/$$(@:f)$V;- $(CO) $(COFLAGS) $@ X .NOINFER : %$V $$(@:d)RCS/$$(@:f)$V .END X # SCCS support .IF $(_HAVE_SCCS) X % : s.% ; get $@ X .NOINFER : s.% .END X # Recipe to make archive files. %$A : [ X $(AR) $(ARFLAGS) $@ $? X $(RM) $(RMFLAGS) $? X ranlib $@ ] X # DMAKE uses this recipe to remove intermediate targets .REMOVE :; $(RM) -f $< X # AUGMAKE extensions for SYSV compatibility @B = $(@:b) @D = $(@:d) @F = $(@:f) *B = $(*:b) *D = $(*:d) *F = $(*:f) <B = $(<:b) <D = $(<:d) <F = $(<:f) ?B = $(?:b) ?F = $(?:f) ?D = $(?:d) X # Turn warnings back to previous setting. .SILENT := $(__.SILENT) X # Local startup file if any .INCLUDE .IGNORE: "_startup.mk" SHAR_EOF chmod 0640 dmake/unix/386ix/startup.mk || echo 'restore of dmake/unix/386ix/startup.mk failed' Wc_c="`wc -c < 'dmake/unix/386ix/startup.mk'`" test 3221 -eq "$Wc_c" || echo 'dmake/unix/386ix/startup.mk: original size 3221, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/386ix/stdarg.h ============== if test -f 'dmake/unix/386ix/stdarg.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/386ix/stdarg.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/386ix/stdarg.h' && /* X * stdarg.h X * X * defines ANSI style macros for accessing arguments of a function which takes X * a variable number of arguments X * X */ X #if !defined(__STDARG) #define __STDARG X typedef char *va_list; X #define va_dcl int va_alist #define va_start(ap,v) ap = (va_list)&va_alist #define va_arg(ap,t) ((t*)(ap += sizeof(t)))[-1] #define va_end(ap) ap = NULL #endif SHAR_EOF chmod 0640 dmake/unix/386ix/stdarg.h || echo 'restore of dmake/unix/386ix/stdarg.h failed' Wc_c="`wc -c < 'dmake/unix/386ix/stdarg.h'`" test 373 -eq "$Wc_c" || echo 'dmake/unix/386ix/stdarg.h: original size 373, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/386ix/stdlib.h ============== if test -f 'dmake/unix/386ix/stdlib.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/386ix/stdlib.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/386ix/stdlib.h' && #ifndef _STDLIB_INCLUDED_ #define _STDLIB_INCLUDED_ X extern /*GOTO*/ _exit(); extern /*GOTO*/ exit(); extern /*GOTO*/ abort(); extern int system(); extern char *getenv(); extern char *calloc(); extern char *malloc(); extern char *realloc(); extern free(); extern int errno; X #ifndef EIO # include <errno.h> #endif X #endif /* _STDLIB_INCLUDED_ */ SHAR_EOF chmod 0640 dmake/unix/386ix/stdlib.h || echo 'restore of dmake/unix/386ix/stdlib.h failed' Wc_c="`wc -c < 'dmake/unix/386ix/stdlib.h'`" test 346 -eq "$Wc_c" || echo 'dmake/unix/386ix/stdlib.h: original size 346, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/386ix/time.h ============== if test -f 'dmake/unix/386ix/time.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/386ix/time.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/386ix/time.h' && /* ** Berkeley get this wrong! */ #ifndef TIME_h #define TIME_h X typedef long time_t; /* this is the thing we use */ X #endif TIME_h X SHAR_EOF chmod 0640 dmake/unix/386ix/time.h || echo 'restore of dmake/unix/386ix/time.h failed' Wc_c="`wc -c < 'dmake/unix/386ix/time.h'`" test 133 -eq "$Wc_c" || echo 'dmake/unix/386ix/time.h: original size 133, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/arlib.c ============== if test -f 'dmake/unix/arlib.c' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/arlib.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/arlib.c' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/unix/RCS/arlib.c,v 1.1 91/05/06 15:27:25 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:27:25 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 #ifndef ASCARCH #define ASCARCH 1 /* ASCII time stored in archive */ #endif X #ifndef LC #define LC 1 /* Turn on library cacheing */ #endif X #ifndef DECODE_ALL_AR_FIELDS #define DECODE_ALL_AR_FIELDS 0 /* decode only fields make needs*/ #endif 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 255 /* Max length of member name */ #define MAXMNAME 8 /* Max module name < MAXFNAME */ X X /* This struct is used to pass the library and member inrmation 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; static off_t arhdroffset; /* member seek offset */ 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, "r")) == 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 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, "r+")) == 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; /* archive member header */ X int nsize; /* size of member name */ #if defined(_AIX) X struct fl_hdr flhdr; /* archive file header */ X char magic[SAIAMAG]; /* size of magic string */ #else #if ASCARCH X char magic[SARMAG]; #else X unsigned short word; #endif #endif X X fseek( f, 0L, 0 ); /* Start at the beginning of the archive file */ X #if ASCARCH #if defined(_AIX) X fread( (char *)&flhdr, sizeof(flhdr), 1, f ); X if( strncmp(flhdr.fl_magic,AIAMAG, SAIAMAG) != 0 ) return(-1); X fseek(f, atol(flhdr.fl_fstmoff), 0 ); /* postition to first member */ #else X fread( magic, sizeof(magic), 1, f ); X if( strncmp(magic, ARMAG, SARMAG) != 0 ) return( -1 ); #endif #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 arhdroffset = ftell(f); #if defined(_AIX) X if( fread((char*)&arhdr,sizeof(arhdr)-sizeof(arhdr._ar_name),1,f)!=1) X break; X nsize = atoi(arhdr.ar_namlen); X fseek(f, arhdroffset+(unsigned long)(((struct ar_hdr *)0)->_ar_name.ar_name), 0); X if( fread((char*)_ar.ar_name,nsize,1,f)!=1) X break; X _ar.ar_name[nsize]='\0'; #else X if( fread((char*) &arhdr, sizeof(arhdr), 1, f) != 1 ) break; X strncpy(_ar.ar_name, arhdr.ar_name, nsize = sizeof(arhdr.ar_name)); #endif X X for( p = &_ar.ar_name[nsize]; X --p >= _ar.ar_name && *p == ' ';); X X p[1] = '\0'; X if( *p == '/' ) *p = 0; /* SysV has trailing '/' */ X #if !defined(_AIX) #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 #else #if ASCARCH X _ar.ar_time = atol(arhdr.ar_date); X _ar.ar_size = atol(arhdr.ar_nxtmem); #else X _ar.ar_time = arhdr.ar_date; X _ar.ar_size = arhdr.ar_nxtmem; #endif #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_uid = arhdr.ar_uid; X _ar.ar_gid = arhdr.ar_gid; #endif #endif X X if( (*function)(f, &_ar, arg) ) return( 1 ); #if defined(_AIX) X if( _ar.ar_size == 0L ) break; X fseek( f, (long) _ar.ar_size, 0 ); #else X fseek( f, arhdroffset + sizeof(arhdr) + (_ar.ar_size+1 & ~1L), 0 ); #endif X } X #if !defined(_AIX) X if( !feof(f) ) return( -1 ); #endif 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 */ SHAR_EOF true || echo 'restore of dmake/unix/arlib.c failed' fi echo 'End of part 32, continue with part 33' echo 33 > _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.