dvadura@watdragon.waterloo.edu (Dennis Vadura) (05/13/91)
Submitted-by: Dennis Vadura <dvadura@watdragon.waterloo.edu> Posting-number: Volume 19, Issue 56 Archive-name: dmake/part35 Supersedes: dmake-3.6: Volume 15, Issue 52-77 ---- Cut Here and feed the following to sh ---- #!/bin/sh # this is dmake.shar.35 (part 35 of a multipart archive) # do not concatenate these parts, unpack them in order with /bin/sh # file dmake/unix/ruletab.c continued # if test ! -r _shar_seq_.tmp; then echo 'Please unpack part 1 first!' exit 1 fi (read Scheck if test "$Scheck" != 35; 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/unix/ruletab.c' && -- 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:27:29 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 := 10", 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/unix/ruletab.c || echo 'restore of dmake/unix/ruletab.c failed' Wc_c="`wc -c < 'dmake/unix/ruletab.c'`" test 1939 -eq "$Wc_c" || echo 'dmake/unix/ruletab.c: original size 1939, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/runargv.c ============== if test -f 'dmake/unix/runargv.c' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/runargv.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/runargv.c' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/unix/RCS/runargv.c,v 1.1 91/05/06 15:27:29 dvadura Exp $ -- SYNOPSIS -- invoke a sub process. -- -- DESCRIPTION -- Use the standard methods of executing a sub process. -- -- 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:27:29 dvadura X * dmake Release Version 3.7 X * */ X #include <signal.h> #include "extern.h" #include "sysintf.h" X typedef struct prp { X char *prp_cmd; X int prp_group; X int prp_ignore; X int prp_last; X int prp_shell; X struct prp *prp_next; } RCP, *RCPPTR; X typedef struct pr { X int pr_valid; X int pr_pid; X CELLPTR pr_target; X int pr_ignore; X int pr_last; X RCPPTR pr_recipe; X RCPPTR pr_recipe_end; X char *pr_dir; } PR; X static PR *_procs = NIL(PR); static int _proc_cnt = 0; static int _abort_flg= FALSE; static int _use_i = -1; static int _do_upd = 0; X static void _add_child ANSI((int, CELLPTR, int, int)); static void _attach_cmd ANSI((char *, int, int, CELLPTR, int, int)); static void _finished_child ANSI((int, int)); static int _running ANSI((CELLPTR)); X PUBLIC int runargv(target, ignore, group, last, shell, cmd) CELLPTR target; int ignore; int group; int last; int shell; char *cmd; { X extern int errno; X extern char *sys_errlist[]; X int pid; X char **argv; X X if( _running(target) /*&& Max_proc != 1*/ ) { X /* The command will be executed when the previous recipe X * line completes. */ X _attach_cmd( cmd, group, ignore, target, last, shell ); X return(1); X } X X while( _proc_cnt == Max_proc ) X if( Wait_for_child(FALSE, -1) == -1 ) Fatal( "Lost a child" ); X X argv = Pack_argv( group, shell, cmd ); X X switch( pid=fork() ){ X int wid; X int status; X X case -1: /* fork failed */ X Error("%s: %s", argv[0], sys_errlist[errno]); X Handle_result(-1, ignore, _abort_flg, target); X return(-1); X X case 0: /* child */ X execvp(argv[0], argv); X Continue = TRUE; /* survive error message */ X Error("%s: %s", argv[0], sys_errlist[errno]); X kill(getpid(), SIGTERM); X /*NOTREACHED*/ X X default: /* parent */ X _add_child(pid, target, ignore, last); X } X X return(1); } X X PUBLIC int Wait_for_child( abort_flg, pid ) int abort_flg; int pid; { X int wid; X int status; X int waitchild; X X waitchild = (pid == -1)? FALSE : Wait_for_completion; X X do { X if( (wid = wait(&status)) == -1 ) return(-1); X X _abort_flg = abort_flg; X _finished_child(wid, status); X _abort_flg = FALSE; X } X while( waitchild && pid != wid ); X X return(0); } X X PUBLIC void Clean_up_processes() { X register int i; X X if( _procs != NIL(PR) ) { X for( i=0; i<Max_proc; i++ ) X if( _procs[i].pr_valid ) X kill(_procs[i].pr_pid, SIGTERM); X X while( Wait_for_child(TRUE, -1) != -1 ); X } } X X static void _add_child( pid, target, ignore, last ) int pid; CELLPTR target; int ignore; int last; { X register int i; X register PR *pp; X X if( _procs == NIL(PR) ) { X TALLOC( _procs, Max_proc, PR ); X } X X if( (i = _use_i) == -1 ) X for( i=0; i<Max_proc; i++ ) X if( !_procs[i].pr_valid ) X break; X X pp = _procs+i; X X pp->pr_valid = 1; X pp->pr_pid = pid; X pp->pr_target = target; X pp->pr_ignore = ignore; X pp->pr_last = last; X pp->pr_dir = _strdup(Get_current_dir()); X X Current_target = NIL(CELL); X X _proc_cnt++; X X if( Wait_for_completion ) Wait_for_child( FALSE, pid ); } X X static void _finished_child(pid, status) int pid; int status; { X register int i; X register PR *pp; X char *dir; X X for( i=0; i<Max_proc; i++ ) X if( _procs[i].pr_valid && _procs[i].pr_pid == pid ) X break; X X /* Some children we didn't make esp true if using /bin/sh to execute a X * a pipe and feed the output as a makefile into dmake. */ X if( i == Max_proc ) return; X _procs[i].pr_valid = 0; X _proc_cnt--; X dir = _strdup(Get_current_dir()); X Set_dir( _procs[i].pr_dir ); X X if( _procs[i].pr_recipe != NIL(RCP) && !_abort_flg ) { X RCPPTR rp = _procs[i].pr_recipe; X X X Current_target = _procs[i].pr_target; X Handle_result( status, _procs[i].pr_ignore, FALSE, _procs[i].pr_target ); X Current_target = NIL(CELL); X X _procs[i].pr_recipe = rp->prp_next; X X _use_i = i; X runargv( _procs[i].pr_target, rp->prp_ignore, rp->prp_group, X rp->prp_last, rp->prp_shell, rp->prp_cmd ); X _use_i = -1; X X FREE( rp->prp_cmd ); X FREE( rp ); X X if( _proc_cnt == Max_proc ) Wait_for_child( FALSE, -1 ); X } X else { X Unlink_temp_files( _procs[i].pr_target ); X Handle_result(status,_procs[i].pr_ignore,_abort_flg,_procs[i].pr_target); X X if( _procs[i].pr_last ) { X FREE(_procs[i].pr_dir ); X X if( !Doing_bang ) Update_time_stamp( _procs[i].pr_target ); X } X } X X Set_dir(dir); X FREE(dir); } X X static int _running( cp ) CELLPTR cp; { X register int i; X X if( !_procs ) return(FALSE); X X for( i=0; i<Max_proc; i++ ) X if( _procs[i].pr_valid && X _procs[i].pr_target == cp ) X break; X X return( i != Max_proc ); } X X static void _attach_cmd( cmd, group, ignore, cp, last, shell ) char *cmd; int group; int ignore; CELLPTR cp; int last; int shell; { X register int i; X RCPPTR rp; X X for( i=0; i<Max_proc; i++ ) X if( _procs[i].pr_valid && X _procs[i].pr_target == cp ) X break; X X TALLOC( rp, 1, RCP ); X rp->prp_cmd = _strdup(cmd); X rp->prp_group = group; X rp->prp_ignore= ignore; X rp->prp_last = last; X rp->prp_shell = shell; X X if( _procs[i].pr_recipe == NIL(RCP) ) X _procs[i].pr_recipe = _procs[i].pr_recipe_end = rp; X else { X _procs[i].pr_recipe_end->prp_next = rp; X _procs[i].pr_recipe_end = rp; X } } SHAR_EOF chmod 0640 dmake/unix/runargv.c || echo 'restore of dmake/unix/runargv.c failed' Wc_c="`wc -c < 'dmake/unix/runargv.c'`" test 6758 -eq "$Wc_c" || echo 'dmake/unix/runargv.c: original size 6758, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/startup.h ============== if test -f 'dmake/unix/startup.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/startup.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/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)/usr/software/dmake/data/startup.mk", SHAR_EOF chmod 0640 dmake/unix/startup.h || echo 'restore of dmake/unix/startup.h failed' Wc_c="`wc -c < 'dmake/unix/startup.h'`" test 412 -eq "$Wc_c" || echo 'dmake/unix/startup.h: original size 412, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/sysintf.h ============== if test -f 'dmake/unix/sysintf.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/sysintf.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/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. */ #define STAT stat #define VOID_LCACHE(l,m) (void) void_lcache(l,m) #define Hook_std_writes(A) #define 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/unix/sysintf.h || echo 'restore of dmake/unix/sysintf.h failed' Wc_c="`wc -c < 'dmake/unix/sysintf.h'`" test 441 -eq "$Wc_c" || echo 'dmake/unix/sysintf.h: original size 441, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/sysvr1/config.h ============== if test ! -d 'dmake/unix/sysvr1'; then mkdir 'dmake/unix/sysvr1' fi if test -f 'dmake/unix/sysvr1/config.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/sysvr1/config.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/sysvr1/config.h' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/unix/sysvr1/RCS/config.h,v 1.1 91/05/06 15:28:02 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:28:02 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/sysvr1/config.h || echo 'restore of dmake/unix/sysvr1/config.h failed' Wc_c="`wc -c < 'dmake/unix/sysvr1/config.h'`" test 1999 -eq "$Wc_c" || echo 'dmake/unix/sysvr1/config.h: original size 1999, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/sysvr1/config.mk ============== if test -f 'dmake/unix/sysvr1/config.mk' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/sysvr1/config.mk (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/sysvr1/config.mk' && # This is the SysV R3 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 := vfprintf.c X .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/sysvr1/config.mk || echo 'restore of dmake/unix/sysvr1/config.mk failed' Wc_c="`wc -c < 'dmake/unix/sysvr1/config.mk'`" test 761 -eq "$Wc_c" || echo 'dmake/unix/sysvr1/config.mk: original size 761, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/sysvr1/make.sh ============== if test -f 'dmake/unix/sysvr1/make.sh' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/sysvr1/make.sh (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/sysvr1/make.sh' && mkdir objects cc -c -I. -Iunix -Iunix/sysvr1 -O infer.c mv infer.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O make.c mv make.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O stat.c mv stat.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O expand.c mv expand.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O dmstring.c mv dmstring.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O hash.c mv hash.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O dag.c mv dag.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O dmake.c mv dmake.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O path.c mv path.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O imacs.c mv imacs.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O sysintf.c mv sysintf.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O parse.c mv parse.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O getinp.c mv getinp.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O quit.c mv quit.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O state.c mv state.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O basename.c mv basename.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O dmdump.c mv dmdump.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O macparse.c mv macparse.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O rulparse.c mv rulparse.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O percent.c mv percent.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O function.c mv function.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O unix/arlib.c mv arlib.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O unix/dirbrk.c mv dirbrk.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O unix/rmprq.c mv rmprq.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O unix/ruletab.c mv ruletab.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O unix/runargv.c mv runargv.o objects cc -c -I. -Iunix -Iunix/sysvr1 -O unix/sysvr1/vfprintf.c mv vfprintf.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 objects/vfprintf.o cp unix/sysvr1/startup.mk startup.mk SHAR_EOF chmod 0640 dmake/unix/sysvr1/make.sh || echo 'restore of dmake/unix/sysvr1/make.sh failed' Wc_c="`wc -c < 'dmake/unix/sysvr1/make.sh'`" test 2251 -eq "$Wc_c" || echo 'dmake/unix/sysvr1/make.sh: original size 2251, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/sysvr1/public.h ============== if test -f 'dmake/unix/sysvr1/public.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/sysvr1/public.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/sysvr1/public.h' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/unix/sysvr1/RCS/public.h,v 1.1 91/05/06 15:28:03 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:28:03 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/sysvr1/public.h || echo 'restore of dmake/unix/sysvr1/public.h failed' Wc_c="`wc -c < 'dmake/unix/sysvr1/public.h'`" test 5522 -eq "$Wc_c" || echo 'dmake/unix/sysvr1/public.h: original size 5522, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/sysvr1/putenv.c ============== if test -f 'dmake/unix/sysvr1/putenv.c' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/sysvr1/putenv.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/sysvr1/putenv.c' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/unix/sysvr1/RCS/putenv.c,v 1.1 91/05/06 15:28:04 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:28:04 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/unix/sysvr1/putenv.c || echo 'restore of dmake/unix/sysvr1/putenv.c failed' Wc_c="`wc -c < 'dmake/unix/sysvr1/putenv.c'`" test 2931 -eq "$Wc_c" || echo 'dmake/unix/sysvr1/putenv.c: original size 2931, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/sysvr1/startup.mk ============== if test -f 'dmake/unix/sysvr1/startup.mk' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/sysvr1/startup.mk (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/sysvr1/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/sysvr1/startup.mk || echo 'restore of dmake/unix/sysvr1/startup.mk failed' Wc_c="`wc -c < 'dmake/unix/sysvr1/startup.mk'`" test 3221 -eq "$Wc_c" || echo 'dmake/unix/sysvr1/startup.mk: original size 3221, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/sysvr1/stdarg.h ============== if test -f 'dmake/unix/sysvr1/stdarg.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/sysvr1/stdarg.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/sysvr1/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_H__) #define __STDARG_H__ X #if !defined(_VA_LIST_) #define _VA_LIST_ typedef char *va_list; #endif 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/sysvr1/stdarg.h || echo 'restore of dmake/unix/sysvr1/stdarg.h failed' Wc_c="`wc -c < 'dmake/unix/sysvr1/stdarg.h'`" test 430 -eq "$Wc_c" || echo 'dmake/unix/sysvr1/stdarg.h: original size 430, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/sysvr1/stdlib.h ============== if test -f 'dmake/unix/sysvr1/stdlib.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/sysvr1/stdlib.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/sysvr1/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/sysvr1/stdlib.h || echo 'restore of dmake/unix/sysvr1/stdlib.h failed' Wc_c="`wc -c < 'dmake/unix/sysvr1/stdlib.h'`" test 346 -eq "$Wc_c" || echo 'dmake/unix/sysvr1/stdlib.h: original size 346, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/sysvr1/time.h ============== if test -f 'dmake/unix/sysvr1/time.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/sysvr1/time.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/sysvr1/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/sysvr1/time.h || echo 'restore of dmake/unix/sysvr1/time.h failed' Wc_c="`wc -c < 'dmake/unix/sysvr1/time.h'`" test 133 -eq "$Wc_c" || echo 'dmake/unix/sysvr1/time.h: original size 133, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/sysvr1/vfprintf.c ============== if test -f 'dmake/unix/sysvr1/vfprintf.c' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/sysvr1/vfprintf.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/sysvr1/vfprintf.c' && /* From: X * John Limpert johnl@gronk.UUCP uunet!n3dmc!gronk!johnl X */ X #include <stdio.h> #include <varargs.h> X #ifndef BUFSIZ #include <stdio.h> #endif X #ifndef va_dcl #include <varargs.h> #endif X int vsprintf(str, fmt, ap) X char *str, *fmt; X va_list ap; { X FILE f; X int len; X X f._flag = _IOWRT+_IOMYBUF; X f._ptr = (char *)str; /* My copy of BSD stdio.h has this as (char *) X * with a comment that it should be X * (unsigned char *). Since this code is X * intended for use on a vanilla BSD system, X * we'll stick with (char *) for now. X */ X f._cnt = 32767; X len = _doprnt(fmt, ap, &f); X *f._ptr = 0; X return (len); } X int vfprintf(iop, fmt, ap) X FILE *iop; X char *fmt; X va_list ap; { X int len; X X len = _doprnt(fmt, ap, iop); X return (ferror(iop) ? EOF : len); } X int vprintf(fmt, ap) X char *fmt; X va_list ap; { X int len; X X len = _doprnt(fmt, ap, stdout); X return (ferror(stdout) ? EOF : len); } SHAR_EOF chmod 0640 dmake/unix/sysvr1/vfprintf.c || echo 'restore of dmake/unix/sysvr1/vfprintf.c failed' Wc_c="`wc -c < 'dmake/unix/sysvr1/vfprintf.c'`" test 934 -eq "$Wc_c" || echo 'dmake/unix/sysvr1/vfprintf.c: original size 934, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/sysvr3/config.h ============== if test ! -d 'dmake/unix/sysvr3'; then mkdir 'dmake/unix/sysvr3' fi if test -f 'dmake/unix/sysvr3/config.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/sysvr3/config.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/sysvr3/config.h' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/unix/sysvr3/RCS/config.h,v 1.1 91/05/06 15:28:20 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:28:20 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 #ifndef M_XENIX /* Define setvbuf, SysV doesn't have one */ #define setvbuf(fp, bp, type, len) setbuf( fp, NULL ); #endif X #ifdef M_XENIX #define ASCARCH 0 /* Use binary archive headers if Xenix */ #endif X /* We don't care about CONST */ #define CONST SHAR_EOF chmod 0640 dmake/unix/sysvr3/config.h || echo 'restore of dmake/unix/sysvr3/config.h failed' Wc_c="`wc -c < 'dmake/unix/sysvr3/config.h'`" test 2106 -eq "$Wc_c" || echo 'dmake/unix/sysvr3/config.h: original size 2106, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/unix/sysvr3/config.mk ============== if test -f 'dmake/unix/sysvr3/config.mk' -a X"$1" != X"-c"; then echo 'x - skipping dmake/unix/sysvr3/config.mk (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/sysvr3/config.mk' && # This is the SysV R3 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) SHAR_EOF true || echo 'restore of dmake/unix/sysvr3/config.mk failed' fi echo 'End of part 35, continue with part 36' echo 36 > _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.