home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume14 / dmake / patch01pt2 < prev    next >
Text File  |  1990-08-03  |  40KB  |  1,335 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v14i047: dmake version 3.5 patch 1 part 02/04
  3. From: dvadura@watdragon.waterloo.edu (Dennis Vadura)
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 14, Issue 47
  7. Submitted-by: dvadura@watdragon.waterloo.edu (Dennis Vadura)
  8. Archive-name: dmake/patch01pt2
  9.  
  10. #!/bin/sh
  11. # this is part 2 of a multipart archive
  12. # do not concatenate these parts, unpack them in order with /bin/sh
  13. # file dmake-3.5-patch1 continued
  14. #
  15. CurArch=2
  16. if test ! -r s2_seq_.tmp
  17. then echo "Please unpack part 1 first!"
  18.      exit 1; fi
  19. ( read Scheck
  20.   if test "$Scheck" != $CurArch
  21.   then echo "Please unpack part $Scheck next!"
  22.        exit 1;
  23.   else exit 0; fi
  24. ) < s2_seq_.tmp || exit 1
  25. sed 's/^X//' << 'SHAR_EOF' >> dmake-3.5-patch1
  26. XX
  27. XX/* Define the getcwd function that is used in the code, since BSD does
  28. XX * not have getcwd, but call it getwd instead. */
  29. XXextern char *getcwd ANSI((char *, int));
  30. XX
  31. XX/* Define setvbuf, SysV doesn't have one */
  32. XX#define setvbuf(fp, bp, type, len) setbuf( fp, NULL );
  33. XX
  34. XX/* need to define size_t */
  35. XXtypedef long size_t;
  36. XSHAR_EOF
  37. Xchmod 0440 unix/sysvr1/config.h || echo "restore of unix/sysvr1/config.h fails"
  38. Xset `wc -c unix/sysvr1/config.h`;Sum=$1
  39. Xif test "$Sum" != "2003"
  40. Xthen echo original size 2003, current size $Sum;fi
  41. Xsed 's/^X//' << 'SHAR_EOF' > unix/sysvr1/config.mk &&
  42. XX# This is the SysV R3 UNIX configuration file for DMAKE
  43. XX#    It simply modifies the values of SRC, and checks to see if
  44. XX#    OSENVIRONMENT is defined.  If so it includes the appropriate
  45. XX#    config.mk file.
  46. XX#
  47. XX# It also sets the values of .SOURCE.c and .SOURCE.h to include the local
  48. XX# directory.
  49. XX#
  50. XXosrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE)
  51. XX
  52. XX# The following are required sources
  53. XXOSDSRC := runargv.c vfprintf.c
  54. XXSRC    += $(OSDSRC)
  55. XX.SETDIR=$(osrdir) : $(OSDSRC)
  56. XX
  57. XX.SOURCE.h : $(osrdir)
  58. XX
  59. XX# Local configuration modifications for CFLAGS, there's local SysV includes
  60. XX# too.
  61. XXCFLAGS += -I$(osrdir)
  62. XX
  63. XX# See if we modify anything in the lower levels.
  64. XX.IF $(OSENVIRONMENT) != $(NULL)
  65. XX   .INCLUDE .IGNORE : $(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT)$(DIRSEPSTR)config.mk
  66. XX.END
  67. XSHAR_EOF
  68. Xchmod 0640 unix/sysvr1/config.mk || echo "restore of unix/sysvr1/config.mk fails"
  69. Xset `wc -c unix/sysvr1/config.mk`;Sum=$1
  70. Xif test "$Sum" != "745"
  71. Xthen echo original size 745, current size $Sum;fi
  72. Xsed 's/^X//' << 'SHAR_EOF' > unix/sysvr1/make.sh &&
  73. XXmkdir objects
  74. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O infer.c
  75. XXmv infer.o objects 
  76. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O make.c
  77. XXmv make.o objects 
  78. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O stat.c
  79. XXmv stat.o objects 
  80. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O expand.c
  81. XXmv expand.o objects 
  82. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O string.c
  83. XXmv string.o objects 
  84. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O hash.c
  85. XXmv hash.o objects 
  86. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O dag.c
  87. XXmv dag.o objects 
  88. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O dmake.c
  89. XXmv dmake.o objects 
  90. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O path.c
  91. XXmv path.o objects 
  92. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O imacs.c
  93. XXmv imacs.o objects 
  94. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O sysintf.c
  95. XXmv sysintf.o objects 
  96. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O parse.c
  97. XXmv parse.o objects 
  98. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O getinp.c
  99. XXmv getinp.o objects 
  100. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O quit.c
  101. XXmv quit.o objects 
  102. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O basename.c
  103. XXmv basename.o objects 
  104. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O dump.c
  105. XXmv dump.o objects 
  106. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O macparse.c
  107. XXmv macparse.o objects 
  108. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O rulparse.c
  109. XXmv rulparse.o objects 
  110. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O percent.c
  111. XXmv percent.o objects 
  112. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O unix/arlib.c
  113. XXmv arlib.o objects 
  114. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O unix/dirbrk.c
  115. XXmv dirbrk.o objects 
  116. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O unix/explode.c
  117. XXmv explode.o objects 
  118. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O unix/rmprq.c
  119. XXmv rmprq.o objects 
  120. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O unix/ruletab.c
  121. XXmv ruletab.o objects 
  122. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O unix/sysvr1/runargv.c
  123. XXmv runargv.o objects 
  124. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr1 -O unix/sysvr1/vfprintf.c
  125. XXmv vfprintf.o objects 
  126. XXcc  -o dmake  objects/infer.o objects/make.o objects/stat.o objects/expand.o objects/string.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/basename.o objects/dump.o objects/macparse.o objects/rulparse.o objects/percent.o objects/arlib.o objects/dirbrk.o objects/explode.o objects/rmprq.o objects/ruletab.o objects/runargv.o objects/vfprintf.o 
  127. XSHAR_EOF
  128. Xchmod 0640 unix/sysvr1/make.sh || echo "restore of unix/sysvr1/make.sh fails"
  129. Xset `wc -c unix/sysvr1/make.sh`;Sum=$1
  130. Xif test "$Sum" != "2576"
  131. Xthen echo original size 2576, current size $Sum;fi
  132. Xsed 's/^X//' << 'SHAR_EOF' > unix/sysvr1/putenv.c &&
  133. XX/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/sysvr1/RCS/putenv.c,v 1.1 90/07/31 11:00:17 dvadura Exp $
  134. XX-- SYNOPSIS -- our own putenv for BSD systems.
  135. XX-- 
  136. XX-- DESCRIPTION
  137. XX--     This originally came from MKS, but I rewrote it to fix a bug with
  138. XX--    replacing existing strings, probably never happened but the code
  139. XX--    was wrong nonetheless.
  140. XX--
  141. XX-- AUTHOR
  142. XX--      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  143. XX--      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  144. XX--
  145. XX-- COPYRIGHT
  146. XX--      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  147. XX-- 
  148. XX--      This program is free software; you can redistribute it and/or
  149. XX--      modify it under the terms of the GNU General Public License
  150. XX--      (version 1), as published by the Free Software Foundation, and
  151. XX--      found in the file 'LICENSE' included with this distribution.
  152. XX-- 
  153. XX--      This program is distributed in the hope that it will be useful,
  154. XX--      but WITHOUT ANY WARRANTY; without even the implied warrant of
  155. XX--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  156. XX--      GNU General Public License for more details.
  157. XX-- 
  158. XX--      You should have received a copy of the GNU General Public License
  159. XX--      along with this program;  if not, write to the Free Software
  160. XX--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  161. XX--
  162. XX-- LOG
  163. XX--     $Log:    putenv.c,v $
  164. XX * Revision 1.1  90/07/31  11:00:17  dvadura
  165. XX * Initial Revision Dmake 3.5
  166. XX * 
  167. XX*/
  168. XX
  169. XX#include <string.h>
  170. XX#include <stdio.h>
  171. XX
  172. XX/* Put a string containing "name=value" into the environment.
  173. XX *
  174. XX * First search the environment for the string name, if found then
  175. XX * replace that string with the new one.  Otherwise add the string to the
  176. XX * environment as a new string.
  177. XX *
  178. XX * Return 0 if OK, non-zero otherwise.
  179. XX */
  180. XXint
  181. XXputenv(string)
  182. XXchar *string;
  183. XX{
  184. XX   extern   char **environ;
  185. XX   static   char **newenv = NULL;
  186. XX   register char *tmp;
  187. XX   register char **env;
  188. XX   register int  size;
  189. XX
  190. XX   for( env = environ; (tmp = *env) != NULL; env++ ) {
  191. XX      register char *np = string;
  192. XX      register char c;
  193. XX
  194. XX      /* Search the strings in environ, if name= matches then replace the
  195. XX       * string with the new one. */
  196. XX      while( (c = *tmp++) == *np++ ) {
  197. XX     if( c == '\0' ) break;        /* skip this string */
  198. XX     if( c == '='  ) {
  199. XX        *env = string;
  200. XX        return (0);
  201. XX     }
  202. XX      }
  203. XX   }
  204. XX
  205. XX   /* Need to grow the environment, so compute its new size */
  206. XX   size = (env-environ)+2;
  207. XX
  208. XX   /* make sure we don't try to realloc the original environment */
  209. XX   if( environ != newenv ) {
  210. XX      if( (newenv = (char**) malloc(size*sizeof(char))) == NULL )
  211. XX     return(1);
  212. XX
  213. XX      memcpy((char*)newenv, (char*)environ, (size-2)*sizeof(char));
  214. XX   }
  215. XX   else
  216. XX      /* realloc the environment to make room for the new string. */
  217. XX      if( (newenv = (char**) realloc(environ, size*sizeof(char*))) == NULL )
  218. XX     return(1);
  219. XX
  220. XX   newenv[--size] = NULL;
  221. XX   newenv[--size] = string;
  222. XX   environ = newenv;
  223. XX
  224. XX   return (0);
  225. XX}
  226. XSHAR_EOF
  227. Xchmod 0440 unix/sysvr1/putenv.c || echo "restore of unix/sysvr1/putenv.c fails"
  228. Xset `wc -c unix/sysvr1/putenv.c`;Sum=$1
  229. Xif test "$Sum" != "2929"
  230. Xthen echo original size 2929, current size $Sum;fi
  231. Xsed 's/^X//' << 'SHAR_EOF' > unix/sysvr1/runargv.c &&
  232. XX/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/sysvr1/RCS/runargv.c,v 1.1 90/07/31 11:00:17 dvadura Exp $
  233. XX-- SYNOPSIS -- invoke a sub process.
  234. XX-- 
  235. XX-- DESCRIPTION
  236. XX--     Use the standard methods of executing a sub process.
  237. XX--
  238. XX-- AUTHOR
  239. XX--      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  240. XX--      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  241. XX--
  242. XX-- COPYRIGHT
  243. XX--      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  244. XX-- 
  245. XX--      This program is free software; you can redistribute it and/or
  246. XX--      modify it under the terms of the GNU General Public License
  247. XX--      (version 1), as published by the Free Software Foundation, and
  248. XX--      found in the file 'LICENSE' included with this distribution.
  249. XX-- 
  250. XX--      This program is distributed in the hope that it will be useful,
  251. XX--      but WITHOUT ANY WARRANTY; without even the implied warrant of
  252. XX--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  253. XX--      GNU General Public License for more details.
  254. XX-- 
  255. XX--      You should have received a copy of the GNU General Public License
  256. XX--      along with this program;  if not, write to the Free Software
  257. XX--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  258. XX--
  259. XX-- LOG
  260. XX--     $Log:    runargv.c,v $
  261. XX * Revision 1.1  90/07/31  11:00:17  dvadura
  262. XX * Initial Revision Dmake 3.5
  263. XX * 
  264. XX*/
  265. XX
  266. XX#include <signal.h>
  267. XX#include "extern.h"
  268. XX#include "sysintf.h"
  269. XX#include "alloc.h"
  270. XX
  271. XXtypedef struct prp {
  272. XX   char *prp_cmd;
  273. XX   int   prp_group;
  274. XX   int   prp_ignore;
  275. XX   int   prp_last;
  276. XX   struct prp *prp_next;
  277. XX   char  *prp_dir;
  278. XX} RCP, *RCPPTR;
  279. XX
  280. XXtypedef struct pr {
  281. XX   int        pr_valid;
  282. XX   int        pr_pid;
  283. XX   CELLPTR    pr_target;
  284. XX   HOWPTR    pr_how;
  285. XX   int        pr_ignore;
  286. XX   int        pr_last;
  287. XX   RCPPTR      pr_recipe;
  288. XX   RCPPTR      pr_recipe_end;
  289. XX} PR;
  290. XX
  291. XXstatic PR  *_procs    = NIL(PR);
  292. XXstatic int  _proc_cnt = 0;
  293. XXstatic int  _abort_flg= FALSE;
  294. XXstatic int  _use_i    = -1;
  295. XXstatic int  _do_upd   = 0;
  296. XX
  297. XXstatic  void    _add_child ANSI((int, CELLPTR, HOWPTR, int, int));
  298. XXstatic  void    _attach_cmd ANSI((char *, int, int, CELLPTR, HOWPTR, int));
  299. XXstatic  void    _finished_child ANSI((int, int));
  300. XXstatic  int     _running ANSI((CELLPTR, HOWPTR));
  301. XX
  302. XXint
  303. XXrunargv(target, how, ignore, group, last, cmd)
  304. XXCELLPTR target;
  305. XXHOWPTR  how;
  306. XXint     ignore;
  307. XXint    group;
  308. XXint    last;
  309. XXchar    *cmd;
  310. XX{
  311. XX   extern  int  errno;
  312. XX   extern  char *sys_errlist[];
  313. XX   int          pid;
  314. XX   char         *argv[MAXARGV];
  315. XX
  316. XX   if( _running(target, how) /*&& Max_proc != 1*/ ) {
  317. XX      /* The command will be executed when the previous recipe
  318. XX       * line completes. */
  319. XX      _attach_cmd( cmd, group, ignore, target, how, last );
  320. XX      return(1);
  321. XX   }
  322. XX
  323. XX   Pack_argv( argv, MAXARGV, group, cmd );
  324. XX
  325. XX   while( _proc_cnt == Max_proc )
  326. XX      if( Wait_for_child(FALSE, -1) == -1 )  Fatal( "Lost a child" );
  327. XX
  328. XX   switch( pid=fork() ){
  329. XX      int   wid;
  330. XX      int   status;
  331. XX
  332. XX   case -1: /* fork failed */
  333. XX      Error("%s: %s", argv[0], sys_errlist[errno]);
  334. XX      Handle_result(-1, ignore, _abort_flg, target);
  335. XX      return(-1);
  336. XX
  337. XX   case 0:  /* child */
  338. XX      execvp(argv[0], argv);
  339. XX      Continue = TRUE;   /* survive error message */
  340. XX      Error("%s: %s", argv[0], sys_errlist[errno]);
  341. XX      kill(getpid(), SIGTERM);
  342. XX      /*NOTREACHED*/
  343. XX
  344. XX   default: /* parent */
  345. XX      _add_child(pid, target, how, ignore, last);
  346. XX   }
  347. XX
  348. XX   return(1);
  349. XX}
  350. XX
  351. XX
  352. XXint
  353. XXWait_for_child( abort_flg, pid )
  354. XXint abort_flg;
  355. XXint pid;
  356. XX{
  357. XX   int wid;
  358. XX   int status;
  359. XX   int waitchild;
  360. XX
  361. XX   waitchild = (pid == -1)? FALSE : Wait_for_completion;
  362. XX
  363. XX   do {
  364. XX      if( (wid = wait(&status)) == -1 ) return(-1);
  365. XX
  366. XX      _abort_flg = abort_flg;
  367. XX      _finished_child(wid, status);
  368. XX      _abort_flg = FALSE;
  369. XX   }
  370. XX   while( waitchild && pid != wid );
  371. XX
  372. XX   return(0);
  373. XX}
  374. XX
  375. XX
  376. XXvoid
  377. XXClean_up_processes()
  378. XX{
  379. XX   register int i;
  380. XX
  381. XX   if( _procs != NIL(PR) ) {
  382. XX      for( i=0; i<Max_proc; i++ )
  383. XX     if( _procs[i].pr_valid )
  384. XX        kill(_procs[i].pr_pid, SIGTERM);
  385. XX
  386. XX      while( Wait_for_child(TRUE, -1) != -1 );
  387. XX   }
  388. XX}
  389. XX
  390. XX
  391. XXstatic void
  392. XX_add_child( pid, target, how, ignore, last )
  393. XXint    pid;
  394. XXCELLPTR target;
  395. XXHOWPTR  how;
  396. XXint    ignore;
  397. XXint     last;
  398. XX{
  399. XX   register int i;
  400. XX   register PR *pp;
  401. XX
  402. XX   if( _procs == NIL(PR) ) {
  403. XX      TALLOC( _procs, Max_proc, PR );
  404. XX   }
  405. XX
  406. XX   if( (i = _use_i) == -1 )
  407. XX      for( i=0; i<Max_proc; i++ )
  408. XX     if( !_procs[i].pr_valid )
  409. XX        break;
  410. XX
  411. XX   pp = _procs+i;
  412. XX
  413. XX   pp->pr_valid  = 1;
  414. XX   pp->pr_pid    = pid;
  415. XX   pp->pr_target = target;
  416. XX   pp->pr_how    = how;
  417. XX   pp->pr_ignore = ignore;
  418. XX   pp->pr_last   = last;
  419. XX
  420. XX   Current_target = NIL(HOW);
  421. XX
  422. XX   _proc_cnt++;
  423. XX
  424. XX   if( Wait_for_completion ) Wait_for_child( FALSE, pid );
  425. XX}
  426. XX
  427. XX
  428. XXstatic void
  429. XX_finished_child(pid, status)
  430. XXint    pid;
  431. XXint    status;
  432. XX{
  433. XX   register int i;
  434. XX   register PR *pp;
  435. XX
  436. XX   for( i=0; i<Max_proc; i++ )
  437. XX      if( _procs[i].pr_valid && _procs[i].pr_pid == pid )
  438. XX     break;
  439. XX
  440. XX   _procs[i].pr_valid = 0;
  441. XX   _proc_cnt--;
  442. XX
  443. XX   if( _procs[i].pr_recipe != NIL(RCP) && !_abort_flg ) {
  444. XX      RCPPTR rp = _procs[i].pr_recipe;
  445. XX      char   *dir;
  446. XX
  447. XX      Current_target = _procs[i].pr_how;
  448. XX      Handle_result( status, _procs[i].pr_ignore, FALSE, _procs[i].pr_target );
  449. XX      Current_target = NIL(HOW);
  450. XX
  451. XX      _procs[i].pr_recipe = rp->prp_next;
  452. XX
  453. XX      _use_i = i;
  454. XX      dir = _strdup(Get_current_dir());
  455. XX      Set_dir( rp->prp_dir );
  456. XX      runargv( _procs[i].pr_target, _procs[i].pr_how, rp->prp_ignore,
  457. XX                 rp->prp_group, rp->prp_last, rp->prp_cmd );
  458. XX      Set_dir(dir);
  459. XX      FREE(dir);
  460. XX      FREE(rp->prp_dir);
  461. XX      _use_i = -1;
  462. XX
  463. XX      FREE( rp->prp_cmd );
  464. XX      FREE( rp );
  465. XX
  466. XX      if( _proc_cnt == Max_proc ) Wait_for_child( FALSE, -1 );
  467. XX   }
  468. XX   else {
  469. XX      Unlink_temp_files( _procs[i].pr_how );
  470. XX      Handle_result(status,_procs[i].pr_ignore,_abort_flg,_procs[i].pr_target);
  471. XX
  472. XX      if( _procs[i].pr_last && !Doing_bang )
  473. XX     Update_time_stamp( _procs[i].pr_target, _procs[i].pr_how );
  474. XX   }
  475. XX}
  476. XX
  477. XX
  478. XXstatic int
  479. XX_running( cp, how )
  480. XXCELLPTR cp;
  481. XXHOWPTR  how;
  482. XX{
  483. XX   register int i;
  484. XX
  485. XX   if( !_procs ) return(FALSE);
  486. XX
  487. XX   for( i=0; i<Max_proc; i++ )
  488. XX      if( _procs[i].pr_valid &&
  489. XX      _procs[i].pr_how == how &&
  490. XX      _procs[i].pr_target == cp  )
  491. XX     break;
  492. XX     
  493. XX   return( i != Max_proc );
  494. XX}
  495. XX
  496. XX
  497. XXstatic void
  498. XX_attach_cmd( cmd, group, ignore, cp, how, last )
  499. XXchar    *cmd;
  500. XXint    group;
  501. XXint     ignore;
  502. XXCELLPTR cp;
  503. XXHOWPTR  how;
  504. XXint     last;
  505. XX{
  506. XX   register int i;
  507. XX   RCPPTR rp;
  508. XX
  509. XX   for( i=0; i<Max_proc; i++ )
  510. XX      if( _procs[i].pr_valid &&
  511. XX      _procs[i].pr_how == how &&
  512. XX      _procs[i].pr_target == cp  )
  513. XX     break;
  514. XX
  515. XX   TALLOC( rp, 1, RCP );
  516. XX   rp->prp_cmd   = _strdup(cmd);
  517. XX   rp->prp_group = group;
  518. XX   rp->prp_ignore= ignore;
  519. XX   rp->prp_last  = last;
  520. XX   rp->prp_dir   = _strdup(Get_current_dir());
  521. XX
  522. XX   if( _procs[i].pr_recipe == NIL(RCP) )
  523. XX      _procs[i].pr_recipe = _procs[i].pr_recipe_end = rp;
  524. XX   else {
  525. XX      _procs[i].pr_recipe_end->prp_next = rp;
  526. XX      _procs[i].pr_recipe_end = rp;
  527. XX   }
  528. XX}
  529. XSHAR_EOF
  530. Xchmod 0440 unix/sysvr1/runargv.c || echo "restore of unix/sysvr1/runargv.c fails"
  531. Xset `wc -c unix/sysvr1/runargv.c`;Sum=$1
  532. Xif test "$Sum" != "6722"
  533. Xthen echo original size 6722, current size $Sum;fi
  534. Xsed 's/^X//' << 'SHAR_EOF' > unix/sysvr1/startup.mk &&
  535. XX# Generic UNIX DMAKE startup file.  Customize to suit your needs.
  536. XX# Should work for both SYSV, and BSD 4.3
  537. XX# See the documentation for a description of internally defined macros.
  538. XX#
  539. XX# Disable warnings for macros redefined here that were given
  540. XX# on the command line.
  541. XX__.SILENT := $(.SILENT)
  542. XX.SILENT   := yes
  543. XX
  544. XX# Configuration parameters for DMAKE startup.mk file
  545. XX# Set these to NON-NULL if you wish to turn the parameter on.
  546. XX_HAVE_RCS    := yes        # yes => RCS  is installed.
  547. XX_HAVE_SCCS    := yes        # yes => SCCS is installed.
  548. XX
  549. XX# Applicable suffix definitions
  550. XXA := .a        # Libraries
  551. XXE :=        # Executables
  552. XXF := .f        # Fortran
  553. XXO := .o        # Objects
  554. XXP := .p        # Pascal
  555. XXS := .s        # Assembler sources
  556. XXV := ,v        # RCS suffix
  557. XX
  558. XX# Recipe execution configurations
  559. XXSHELL        := /bin/sh
  560. XXSHELLFLAGS    := -ce
  561. XXGROUPSHELL    := $(SHELL)
  562. XXGROUPFLAGS    := 
  563. XXSHELLMETAS    := |();&<>?*][$$:\\#`'"
  564. XXGROUPSUFFIX    :=
  565. XX
  566. XX# Standard C-language command names and flags
  567. XX   CPP       := /lib/cpp        # C-preprocessor
  568. XX   CC      := cc        # C-compiler and flags
  569. XX   CFLAGS   =
  570. XX
  571. XX   AS      := as        # Assembler and flags
  572. XX   ASFLAGS  = 
  573. XX
  574. XX   LD       = $(CC)        # Loader and flags
  575. XX   LDFLAGS  =
  576. XX   LDLIBS   =
  577. XX
  578. XX# Definition of $(MAKE) macro for recursive makes.
  579. XX   MAKE = $(MAKECMD) $(MFLAGS)
  580. XX
  581. XX# Definition of Print command for this system.
  582. XX   PRINT = lpr
  583. XX
  584. XX# Language and Parser generation Tools and their flags
  585. XX   YACC      := yacc        # standard yacc
  586. XX   YFLAGS  =
  587. XX   YTAB      := y.tab        # yacc output files name stem.
  588. XX
  589. XX   LEX      := lex        # standard lex
  590. XX   LFLAGS  =
  591. XX   LEXYY  := lex.yy        # lex output file
  592. XX
  593. XX# Other Compilers, Tools and their flags
  594. XX   PC    := pc            # pascal compiler
  595. XX   RC    := f77            # ratfor compiler
  596. XX   FC    := f77            # fortran compiler
  597. XX
  598. XX   CO       := co        # check out for RCS
  599. XX   COFLAGS := -q
  600. XX
  601. XX   AR     := ar            # archiver
  602. XX   ARFLAGS = ruv
  603. XX
  604. XX   RM       := /bin/rm        # remove a file command
  605. XX   RMFLAGS  =
  606. XX
  607. XX# Implicit generation rules for making inferences.
  608. XX# We don't provide .yr or .ye rules here.  They're obsolete.
  609. XX# Rules for making *$O
  610. XX   %$O : %.c ; $(CC) $(CFLAGS) -c $<
  611. XX   %$O : %$P ; $(PC) $(PFLAGS) -c $<
  612. XX   %$O : %$S ; $(AS) $<
  613. XX   %$O : %.cl ; class -c $<
  614. XX   %$O : %.e %.r %.F %$F
  615. XX    $(FC) $(RFLAGS) $(EFLAGS) $(FFLAGS) -c $<
  616. XX
  617. XX# Executables
  618. XX   %$E : %$O ; $(LD) $(LDFLAGS) -o $@ $< $(LDLIBES)
  619. XX
  620. XX# lex and yacc rules
  621. XX   %.c : %.y ; $(YACC)  $(YFLAGS) $<; mv $(YTAB).c $@
  622. XX   %.c : %.l ; $(LEX)   $(LFLAGS) $<; mv $(LEXYY).c $@
  623. XX
  624. XX# This rule tells how to make *.out from it's immediate list of prerequisites
  625. XX# UNIX only.
  626. XX   %.out :; $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
  627. XX
  628. XX# RCS support
  629. XX.IF $(_HAVE_RCS)
  630. XX   % : %$V $$(@:d)RCS/$$(@:f)$V;- $(CO) $(COFLAGS) $@
  631. XX   .NOINFER : %$V $$(@:d)RCS/$$(@:f)$V
  632. XX.END
  633. XX
  634. XX# SCCS support
  635. XX.IF $(_HAVE_SCCS)
  636. XX   % : s.% ; get $@
  637. XX   .NOINFER : s.%
  638. XX.END
  639. XX
  640. XX# Recipe to make archive files.
  641. XX%$A :
  642. XX[
  643. XX   $(AR) $(ARFLAGS) $@ $?
  644. XX   $(RM) $(RMFLAGS) $?
  645. XX   ranlib $@
  646. XX]
  647. XX
  648. XX# DMAKE uses this recipe to remove intermediate targets
  649. XX.REMOVE :; $(RM) -f $<
  650. XX
  651. XX# AUGMAKE extensions for SYSV compatibility
  652. XX@B = $(@:b)
  653. XX@D = $(@:d)
  654. XX@F = $(@:f)
  655. XX*B = $(*:b)
  656. XX*D = $(*:d)
  657. XX*F = $(*:f)
  658. XX<B = $(<:b)
  659. XX<D = $(<:d)
  660. XX<F = $(<:f)
  661. XX?B = $(?:b)
  662. XX?F = $(?:f)
  663. XX?D = $(?:d)
  664. XX
  665. XX# Turn warnings back to previous setting.
  666. XX.SILENT := $(__.SILENT)
  667. XX
  668. XX# Local startup file if any
  669. XX.INCLUDE .IGNORE: "_startup.mk"
  670. XSHAR_EOF
  671. Xchmod 0640 unix/sysvr1/startup.mk || echo "restore of unix/sysvr1/startup.mk fails"
  672. Xset `wc -c unix/sysvr1/startup.mk`;Sum=$1
  673. Xif test "$Sum" != "3187"
  674. Xthen echo original size 3187, current size $Sum;fi
  675. Xsed 's/^X//' << 'SHAR_EOF' > unix/sysvr1/stdarg.h &&
  676. XX/*
  677. XX * stdarg.h
  678. XX *
  679. XX * defines ANSI style macros for accessing arguments of a function which takes
  680. XX * a variable number of arguments
  681. XX *
  682. XX */
  683. XX
  684. XX#if !defined(__STDARG)
  685. XX#define __STDARG
  686. XX
  687. XXtypedef char *va_list;
  688. XX
  689. XX#define va_dcl int va_alist
  690. XX#define va_start(ap,v)  ap = (va_list)&va_alist
  691. XX#define va_arg(ap,t)    ((t*)(ap += sizeof(t)))[-1]
  692. XX#define va_end(ap)      ap = NULL
  693. XX#endif
  694. XSHAR_EOF
  695. Xchmod 0440 unix/sysvr1/stdarg.h || echo "restore of unix/sysvr1/stdarg.h fails"
  696. Xset `wc -c unix/sysvr1/stdarg.h`;Sum=$1
  697. Xif test "$Sum" != "373"
  698. Xthen echo original size 373, current size $Sum;fi
  699. Xsed 's/^X//' << 'SHAR_EOF' > unix/sysvr1/stdlib.h &&
  700. XX#ifndef _STDLIB_INCLUDED_
  701. XX#define _STDLIB_INCLUDED_
  702. XX
  703. XXextern /*GOTO*/ _exit();
  704. XXextern /*GOTO*/ exit();
  705. XXextern /*GOTO*/ abort();
  706. XXextern int system();
  707. XXextern char *getenv();
  708. XXextern char *calloc();
  709. XXextern char *malloc();
  710. XXextern char *realloc();
  711. XXextern free();
  712. XXextern int errno;
  713. XX
  714. XX#ifndef EIO
  715. XX#    include <errno.h>
  716. XX#endif
  717. XX
  718. XX#endif /* _STDLIB_INCLUDED_ */
  719. XSHAR_EOF
  720. Xchmod 0440 unix/sysvr1/stdlib.h || echo "restore of unix/sysvr1/stdlib.h fails"
  721. Xset `wc -c unix/sysvr1/stdlib.h`;Sum=$1
  722. Xif test "$Sum" != "346"
  723. Xthen echo original size 346, current size $Sum;fi
  724. Xsed 's/^X//' << 'SHAR_EOF' > unix/sysvr1/time.h &&
  725. XX/*
  726. XX** Berkeley get this wrong!
  727. XX*/
  728. XX#ifndef    TIME_h
  729. XX#define    TIME_h
  730. XX
  731. XXtypedef    long    time_t;    /* this is the thing we use */
  732. XX
  733. XX#endif    TIME_h
  734. XX
  735. XSHAR_EOF
  736. Xchmod 0440 unix/sysvr1/time.h || echo "restore of unix/sysvr1/time.h fails"
  737. Xset `wc -c unix/sysvr1/time.h`;Sum=$1
  738. Xif test "$Sum" != "133"
  739. Xthen echo original size 133, current size $Sum;fi
  740. Xsed 's/^X//' << 'SHAR_EOF' > unix/sysvr1/vfprintf.c &&
  741. XX/* From:
  742. XX * John Limpert            johnl@gronk.UUCP        uunet!n3dmc!gronk!johnl
  743. XX */
  744. XX
  745. XX#include <stdio.h>
  746. XX#include <varargs.h>
  747. XX
  748. XX#ifndef BUFSIZ
  749. XX#include <stdio.h>
  750. XX#endif
  751. XX
  752. XX#ifndef va_dcl
  753. XX#include <varargs.h>
  754. XX#endif
  755. XX
  756. XXint
  757. XXvsprintf(str, fmt, ap)
  758. XX    char *str, *fmt;
  759. XX    va_list ap;
  760. XX{
  761. XX    FILE f;
  762. XX    int len;
  763. XX
  764. XX    f._flag = _IOWRT+_IOMYBUF;
  765. XX    f._ptr = (char *)str;    /* My copy of BSD stdio.h has this as (char *)
  766. XX                 * with a comment that it should be
  767. XX                 * (unsigned char *).  Since this code is
  768. XX                 * intended for use on a vanilla BSD system,
  769. XX                 * we'll stick with (char *) for now.
  770. XX                 */
  771. XX    f._cnt = 32767;
  772. XX    len = _doprnt(fmt, ap, &f);
  773. XX    *f._ptr = 0;
  774. XX    return (len);
  775. XX}
  776. XX
  777. XXint
  778. XXvfprintf(iop, fmt, ap)
  779. XX    FILE *iop;
  780. XX    char *fmt;
  781. XX    va_list ap;
  782. XX{
  783. XX    int len;
  784. XX
  785. XX    len = _doprnt(fmt, ap, iop);
  786. XX    return (ferror(iop) ? EOF : len);
  787. XX}
  788. XX
  789. XXint
  790. XXvprintf(fmt, ap)
  791. XX    char *fmt;
  792. XX    va_list ap;
  793. XX{
  794. XX    int len;
  795. XX
  796. XX    len = _doprnt(fmt, ap, stdout);
  797. XX    return (ferror(stdout) ? EOF : len);
  798. XX}
  799. XSHAR_EOF
  800. Xchmod 0644 unix/sysvr1/vfprintf.c || echo "restore of unix/sysvr1/vfprintf.c fails"
  801. Xset `wc -c unix/sysvr1/vfprintf.c`;Sum=$1
  802. Xif test "$Sum" != "934"
  803. Xthen echo original size 934, current size $Sum;fi
  804. Xsed 's/^X//' << 'SHAR_EOF' > unix/sysvr3/runargv.c &&
  805. XX/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/sysvr3/RCS/runargv.c,v 1.1 90/07/31 10:51:27 dvadura Exp $
  806. XX-- SYNOPSIS -- invoke a sub process.
  807. XX-- 
  808. XX-- DESCRIPTION
  809. XX--     Use the standard methods of executing a sub process.
  810. XX--
  811. XX-- AUTHOR
  812. XX--      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  813. XX--      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  814. XX--
  815. XX-- COPYRIGHT
  816. XX--      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  817. XX-- 
  818. XX--      This program is free software; you can redistribute it and/or
  819. XX--      modify it under the terms of the GNU General Public License
  820. XX--      (version 1), as published by the Free Software Foundation, and
  821. XX--      found in the file 'LICENSE' included with this distribution.
  822. XX-- 
  823. XX--      This program is distributed in the hope that it will be useful,
  824. XX--      but WITHOUT ANY WARRANTY; without even the implied warrant of
  825. XX--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  826. XX--      GNU General Public License for more details.
  827. XX-- 
  828. XX--      You should have received a copy of the GNU General Public License
  829. XX--      along with this program;  if not, write to the Free Software
  830. XX--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  831. XX--
  832. XX-- LOG
  833. XX--     $Log:    runargv.c,v $
  834. XX * Revision 1.1  90/07/31  10:51:27  dvadura
  835. XX * Initial Revision Dmake 3.5
  836. XX * 
  837. XX * Revision 1.1  90/07/20  16:54:53  dvadura
  838. XX * Initial Revision of Version 3.5
  839. XX * 
  840. XX*/
  841. XX
  842. XX#include <signal.h>
  843. XX#include "extern.h"
  844. XX#include "sysintf.h"
  845. XX#include "alloc.h"
  846. XX
  847. XXtypedef struct prp {
  848. XX   char *prp_cmd;
  849. XX   int   prp_group;
  850. XX   int   prp_ignore;
  851. XX   int   prp_last;
  852. XX   struct prp *prp_next;
  853. XX   char  *prp_dir;
  854. XX} RCP, *RCPPTR;
  855. XX
  856. XXtypedef struct pr {
  857. XX   int        pr_valid;
  858. XX   int        pr_pid;
  859. XX   CELLPTR    pr_target;
  860. XX   HOWPTR    pr_how;
  861. XX   int        pr_ignore;
  862. XX   int        pr_last;
  863. XX   RCPPTR      pr_recipe;
  864. XX   RCPPTR      pr_recipe_end;
  865. XX} PR;
  866. XX
  867. XXstatic PR  *_procs    = NIL(PR);
  868. XXstatic int  _proc_cnt = 0;
  869. XXstatic int  _abort_flg= FALSE;
  870. XXstatic int  _use_i    = -1;
  871. XXstatic int  _do_upd   = 0;
  872. XX
  873. XXstatic  void    _add_child ANSI((int, CELLPTR, HOWPTR, int, int));
  874. XXstatic  void    _attach_cmd ANSI((char *, int, int, CELLPTR, HOWPTR, int));
  875. XXstatic  void    _finished_child ANSI((int, int));
  876. XXstatic  int     _running ANSI((CELLPTR, HOWPTR));
  877. XX
  878. XXint
  879. XXrunargv(target, how, ignore, group, last, cmd)
  880. XXCELLPTR target;
  881. XXHOWPTR  how;
  882. XXint     ignore;
  883. XXint    group;
  884. XXint    last;
  885. XXchar    *cmd;
  886. XX{
  887. XX   extern  int  errno;
  888. XX   extern  char *sys_errlist[];
  889. XX   int          pid;
  890. XX   char         *argv[MAXARGV];
  891. XX
  892. XX   if( _running(target, how) /*&& Max_proc != 1*/ ) {
  893. XX      /* The command will be executed when the previous recipe
  894. XX       * line completes. */
  895. XX      _attach_cmd( cmd, group, ignore, target, how, last );
  896. XX      return(1);
  897. XX   }
  898. XX
  899. XX   Pack_argv( argv, MAXARGV, group, cmd );
  900. XX
  901. XX   while( _proc_cnt == Max_proc )
  902. XX      if( Wait_for_child(FALSE, -1) == -1 )  Fatal( "Lost a child" );
  903. XX
  904. XX   switch( pid=fork() ){
  905. XX      int   wid;
  906. XX      int   status;
  907. XX
  908. XX   case -1: /* fork failed */
  909. XX      Error("%s: %s", argv[0], sys_errlist[errno]);
  910. XX      Handle_result(-1, ignore, _abort_flg, target);
  911. XX      return(-1);
  912. XX
  913. XX   case 0:  /* child */
  914. XX      execvp(argv[0], argv);
  915. XX      Continue = TRUE;   /* survive error message */
  916. XX      Error("%s: %s", argv[0], sys_errlist[errno]);
  917. XX      kill(getpid(), SIGTERM);
  918. XX      /*NOTREACHED*/
  919. XX
  920. XX   default: /* parent */
  921. XX      _add_child(pid, target, how, ignore, last);
  922. XX   }
  923. XX
  924. XX   return(1);
  925. XX}
  926. XX
  927. XX
  928. XXint
  929. XXWait_for_child( abort_flg, pid )
  930. XXint abort_flg;
  931. XXint pid;
  932. XX{
  933. XX   int wid;
  934. XX   int status;
  935. XX   int waitchild;
  936. XX
  937. XX   waitchild = (pid == -1)? FALSE : Wait_for_completion;
  938. XX
  939. XX   do {
  940. XX      if( (wid = wait(&status)) == -1 ) return(-1);
  941. XX
  942. XX      _abort_flg = abort_flg;
  943. XX      _finished_child(wid, status);
  944. XX      _abort_flg = FALSE;
  945. XX   }
  946. XX   while( waitchild && pid != wid );
  947. XX
  948. XX   return(0);
  949. XX}
  950. XX
  951. XX
  952. XXvoid
  953. XXClean_up_processes()
  954. XX{
  955. XX   register int i;
  956. XX
  957. XX   if( _procs != NIL(PR) ) {
  958. XX      for( i=0; i<Max_proc; i++ )
  959. XX     if( _procs[i].pr_valid )
  960. XX        kill(_procs[i].pr_pid, SIGTERM);
  961. XX
  962. XX      while( Wait_for_child(TRUE, -1) != -1 );
  963. XX   }
  964. XX}
  965. XX
  966. XX
  967. XXstatic void
  968. XX_add_child( pid, target, how, ignore, last )
  969. XXint    pid;
  970. XXCELLPTR target;
  971. XXHOWPTR  how;
  972. XXint    ignore;
  973. XXint     last;
  974. XX{
  975. XX   register int i;
  976. XX   register PR *pp;
  977. XX
  978. XX   if( _procs == NIL(PR) ) {
  979. XX      TALLOC( _procs, Max_proc, PR );
  980. XX   }
  981. XX
  982. XX   if( (i = _use_i) == -1 )
  983. XX      for( i=0; i<Max_proc; i++ )
  984. XX     if( !_procs[i].pr_valid )
  985. XX        break;
  986. XX
  987. XX   pp = _procs+i;
  988. XX
  989. XX   pp->pr_valid  = 1;
  990. XX   pp->pr_pid    = pid;
  991. XX   pp->pr_target = target;
  992. XX   pp->pr_how    = how;
  993. XX   pp->pr_ignore = ignore;
  994. XX   pp->pr_last   = last;
  995. XX
  996. XX   Current_target = NIL(HOW);
  997. XX
  998. XX   _proc_cnt++;
  999. XX
  1000. XX   if( Wait_for_completion ) Wait_for_child( FALSE, pid );
  1001. XX}
  1002. XX
  1003. XX
  1004. XXstatic void
  1005. XX_finished_child(pid, status)
  1006. XXint    pid;
  1007. XXint    status;
  1008. XX{
  1009. XX   register int i;
  1010. XX   register PR *pp;
  1011. XX
  1012. XX   for( i=0; i<Max_proc; i++ )
  1013. XX      if( _procs[i].pr_valid && _procs[i].pr_pid == pid )
  1014. XX     break;
  1015. XX
  1016. XX   _procs[i].pr_valid = 0;
  1017. XX   _proc_cnt--;
  1018. XX
  1019. XX   if( _procs[i].pr_recipe != NIL(RCP) && !_abort_flg ) {
  1020. XX      RCPPTR rp = _procs[i].pr_recipe;
  1021. XX      char   *dir;
  1022. XX
  1023. XX      Current_target = _procs[i].pr_how;
  1024. XX      Handle_result( status, _procs[i].pr_ignore, FALSE, _procs[i].pr_target );
  1025. XX      Current_target = NIL(HOW);
  1026. XX
  1027. XX      _procs[i].pr_recipe = rp->prp_next;
  1028. XX
  1029. XX      _use_i = i;
  1030. XX      dir = _strdup(Get_current_dir());
  1031. XX      Set_dir( rp->prp_dir );
  1032. XX      runargv( _procs[i].pr_target, _procs[i].pr_how, rp->prp_ignore,
  1033. XX                 rp->prp_group, rp->prp_last, rp->prp_cmd );
  1034. XX      Set_dir(dir);
  1035. XX      FREE(dir);
  1036. XX      FREE(rp->prp_dir);
  1037. XX      _use_i = -1;
  1038. XX
  1039. XX      FREE( rp->prp_cmd );
  1040. XX      FREE( rp );
  1041. XX
  1042. XX      if( _proc_cnt == Max_proc ) Wait_for_child( FALSE, -1 );
  1043. XX   }
  1044. XX   else {
  1045. XX      Unlink_temp_files( _procs[i].pr_how );
  1046. XX      Handle_result(status,_procs[i].pr_ignore,_abort_flg,_procs[i].pr_target);
  1047. XX
  1048. XX      if( _procs[i].pr_last && !Doing_bang )
  1049. XX     Update_time_stamp( _procs[i].pr_target, _procs[i].pr_how );
  1050. XX   }
  1051. XX}
  1052. XX
  1053. XX
  1054. XXstatic int
  1055. XX_running( cp, how )
  1056. XXCELLPTR cp;
  1057. XXHOWPTR  how;
  1058. XX{
  1059. XX   register int i;
  1060. XX
  1061. XX   if( !_procs ) return(FALSE);
  1062. XX
  1063. XX   for( i=0; i<Max_proc; i++ )
  1064. XX      if( _procs[i].pr_valid &&
  1065. XX      _procs[i].pr_how == how &&
  1066. XX      _procs[i].pr_target == cp  )
  1067. XX     break;
  1068. XX     
  1069. XX   return( i != Max_proc );
  1070. XX}
  1071. XX
  1072. XX
  1073. XXstatic void
  1074. XX_attach_cmd( cmd, group, ignore, cp, how, last )
  1075. XXchar    *cmd;
  1076. XXint    group;
  1077. XXint     ignore;
  1078. XXCELLPTR cp;
  1079. XXHOWPTR  how;
  1080. XXint     last;
  1081. XX{
  1082. XX   register int i;
  1083. XX   RCPPTR rp;
  1084. XX
  1085. XX   for( i=0; i<Max_proc; i++ )
  1086. XX      if( _procs[i].pr_valid &&
  1087. XX      _procs[i].pr_how == how &&
  1088. XX      _procs[i].pr_target == cp  )
  1089. XX     break;
  1090. XX
  1091. XX   TALLOC( rp, 1, RCP );
  1092. XX   rp->prp_cmd   = _strdup(cmd);
  1093. XX   rp->prp_group = group;
  1094. XX   rp->prp_ignore= ignore;
  1095. XX   rp->prp_last  = last;
  1096. XX   rp->prp_dir   = _strdup(Get_current_dir());
  1097. XX
  1098. XX   if( _procs[i].pr_recipe == NIL(RCP) )
  1099. XX      _procs[i].pr_recipe = _procs[i].pr_recipe_end = rp;
  1100. XX   else {
  1101. XX      _procs[i].pr_recipe_end->prp_next = rp;
  1102. XX      _procs[i].pr_recipe_end = rp;
  1103. XX   }
  1104. XX}
  1105. XSHAR_EOF
  1106. Xchmod 0440 unix/sysvr3/runargv.c || echo "restore of unix/sysvr3/runargv.c fails"
  1107. Xset `wc -c unix/sysvr3/runargv.c`;Sum=$1
  1108. Xif test "$Sum" != "6806"
  1109. Xthen echo original size 6806, current size $Sum;fi
  1110. X
  1111. X
  1112. X# Now create the file of patches and apply patch appropriately
  1113. X# shar:    Shell Archiver  (v1.22)
  1114. X#
  1115. X#    Run the following text with /bin/sh to create:
  1116. X#      _patches
  1117. X#
  1118. Xsed 's/^X//' << 'SHAR_EOF' > _patches &&
  1119. XX*** /u2/dvadura/src/generic/dmake/src.dist/vextern.h    Mon Jul 30 11:50:36 1990
  1120. XX--- vextern.h    Tue Jul 31 13:38:47 1990
  1121. XX***************
  1122. XX*** 1,4 ****
  1123. XX! /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/RCS/vextern.h,v 1.1 90/07/19 13:55:39 dvadura Exp $
  1124. XX  -- SYNOPSIS -- global variable declarations.
  1125. XX  -- 
  1126. XX  -- DESCRIPTION
  1127. XX--- 1,4 ----
  1128. XX! /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/RCS/vextern.h,v 1.2 90/07/31 11:10:51 dvadura Exp $
  1129. XX  -- SYNOPSIS -- global variable declarations.
  1130. XX  -- 
  1131. XX  -- DESCRIPTION
  1132. XX***************
  1133. XX*** 29,40 ****
  1134. XX  --
  1135. XX  -- LOG
  1136. XX  --     $Log:    vextern.h,v $
  1137. XX   * Revision 1.1  90/07/19  13:55:39  dvadura
  1138. XX   * Initial Revision of Version 3.5
  1139. XX   * 
  1140. XX  */
  1141. XX  #include <stdio.h>
  1142. XX! #include "macros.h"
  1143. XX  #include "struct.h"
  1144. XX  #include "dmake.h"
  1145. XX  
  1146. XX--- 29,43 ----
  1147. XX  --
  1148. XX  -- LOG
  1149. XX  --     $Log:    vextern.h,v $
  1150. XX+  * Revision 1.2  90/07/31  11:10:51  dvadura
  1151. XX+  * renamed macros.h include to stdmacs.h
  1152. XX+  * 
  1153. XX   * Revision 1.1  90/07/19  13:55:39  dvadura
  1154. XX   * Initial Revision of Version 3.5
  1155. XX   * 
  1156. XX  */
  1157. XX  #include <stdio.h>
  1158. XX! #include "stdmacs.h"
  1159. XX  #include "struct.h"
  1160. XX  #include "dmake.h"
  1161. XX  
  1162. XX*** /u2/dvadura/src/generic/dmake/src.dist/unix/sysvr3/make.sh    Mon Jul 30 11:50:39 1990
  1163. XX--- unix/sysvr3/make.sh    Tue Jul 31 20:26:17 1990
  1164. XX***************
  1165. XX*** 1,52 ****
  1166. XX  mkdir objects
  1167. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O infer.c
  1168. XX! mv infer.o objects
  1169. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O make.c
  1170. XX! mv make.o objects
  1171. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O stat.c
  1172. XX! mv stat.o objects
  1173. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O expand.c
  1174. XX! mv expand.o objects
  1175. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O string.c
  1176. XX! mv string.o objects
  1177. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O hash.c
  1178. XX! mv hash.o objects
  1179. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O dag.c
  1180. XX! mv dag.o objects
  1181. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O dmake.c
  1182. XX! mv dmake.o objects
  1183. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O path.c
  1184. XX! mv path.o objects
  1185. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O imacs.c
  1186. XX! mv imacs.o objects
  1187. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O sysintf.c
  1188. XX! mv sysintf.o objects
  1189. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O parse.c
  1190. XX! mv parse.o objects
  1191. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O getinp.c
  1192. XX! mv getinp.o objects
  1193. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O quit.c
  1194. XX! mv quit.o objects
  1195. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O basename.c
  1196. XX! mv basename.o objects
  1197. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O dump.c
  1198. XX! mv dump.o objects
  1199. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O macparse.c
  1200. XX! mv macparse.o objects
  1201. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O rulparse.c
  1202. XX! mv rulparse.o objects
  1203. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O percent.c
  1204. XX! mv percent.o objects
  1205. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/arlib.c
  1206. XX! mv arlib.o objects
  1207. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/dirbrk.c
  1208. XX! mv dirbrk.o objects
  1209. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/explode.c
  1210. XX! mv explode.o objects
  1211. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/rmprq.c
  1212. XX! mv rmprq.o objects
  1213. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/ruletab.c
  1214. XX! mv ruletab.o objects
  1215. XX! cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/runargv.c
  1216. XX! mv runargv.o objects
  1217. XX  cc  -o dmake  objects/infer.o objects/make.o objects/stat.o objects/expand.o objects/string.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/basename.o objects/dump.o objects/macparse.o objects/rulparse.o objects/percent.o objects/arlib.o objects/dirbrk.o objects/explode.o objects/rmprq.o objects/ruletab.o objects/runargv.o 
  1218. XX--- 1,52 ----
  1219. XX  mkdir objects
  1220. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O infer.c
  1221. XX! mv infer.o objects 
  1222. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O make.c
  1223. XX! mv make.o objects 
  1224. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O stat.c
  1225. XX! mv stat.o objects 
  1226. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O expand.c
  1227. XX! mv expand.o objects 
  1228. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O string.c
  1229. XX! mv string.o objects 
  1230. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O hash.c
  1231. XX! mv hash.o objects 
  1232. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O dag.c
  1233. XX! mv dag.o objects 
  1234. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O dmake.c
  1235. XX! mv dmake.o objects 
  1236. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O path.c
  1237. XX! mv path.o objects 
  1238. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O imacs.c
  1239. XX! mv imacs.o objects 
  1240. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O sysintf.c
  1241. XX! mv sysintf.o objects 
  1242. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O parse.c
  1243. XX! mv parse.o objects 
  1244. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O getinp.c
  1245. XX! mv getinp.o objects 
  1246. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O quit.c
  1247. XX! mv quit.o objects 
  1248. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O basename.c
  1249. XX! mv basename.o objects 
  1250. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O dump.c
  1251. XX! mv dump.o objects 
  1252. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O macparse.c
  1253. XX! mv macparse.o objects 
  1254. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O rulparse.c
  1255. XX! mv rulparse.o objects 
  1256. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O percent.c
  1257. XX! mv percent.o objects 
  1258. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/arlib.c
  1259. XX! mv arlib.o objects 
  1260. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/dirbrk.c
  1261. XX! mv dirbrk.o objects 
  1262. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/explode.c
  1263. XX! mv explode.o objects 
  1264. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/rmprq.c
  1265. XX! mv rmprq.o objects 
  1266. XX  cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/ruletab.c
  1267. XX! mv ruletab.o objects 
  1268. XX! cc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/sysvr3/runargv.c
  1269. XX! mv runargv.o objects 
  1270. XX  cc  -o dmake  objects/infer.o objects/make.o objects/stat.o objects/expand.o objects/string.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/basename.o objects/dump.o objects/macparse.o objects/rulparse.o objects/percent.o objects/arlib.o objects/dirbrk.o objects/explode.o objects/rmprq.o objects/ruletab.o objects/runargv.o 
  1271. XX*** /u2/dvadura/src/generic/dmake/src.dist/unix/sysvr3/config.mk    Mon Jul 30 11:50:40 1990
  1272. XX--- unix/sysvr3/config.mk    Tue Jul 31 10:51:50 1990
  1273. XX***************
  1274. XX*** 8,17 ****
  1275. XX  #
  1276. XX  osrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE)
  1277. XX  
  1278. XX! # The following sources are required for SysV R3
  1279. XX! SRC +=  #zero for now. we do have some .h's though
  1280. XX  
  1281. XX- #.SOURCE.c : $(osrdir)
  1282. XX  .SOURCE.h : $(osrdir)
  1283. XX  
  1284. XX  # Local configuration modifications for CFLAGS, there's local SysV includes
  1285. XX--- 8,18 ----
  1286. XX  #
  1287. XX  osrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE)
  1288. XX  
  1289. XX! # The following are required sources
  1290. XX! OSDSRC := runargv.c
  1291. XX! SRC    += $(OSDSRC)
  1292. XX! .SETDIR=$(osrdir) : $(OSDSRC)
  1293. XX  
  1294. XX  .SOURCE.h : $(osrdir)
  1295. XX  
  1296. XX  # Local configuration modifications for CFLAGS, there's local SysV includes
  1297. XX*** /u2/dvadura/src/generic/dmake/src.dist/unix/sysvr3/config.h    Mon Jul 30 11:50:40 1990
  1298. XX--- unix/sysvr3/config.h    Tue Jul 31 10:51:27 1990
  1299. XX***************
  1300. XX*** 1,4 ****
  1301. XX! /* RCS      -- $Header$
  1302. XX  -- SYNOPSIS -- Configurarion include file.
  1303. XX  -- 
  1304. XX  -- DESCRIPTION
  1305. XX--- 1,4 ----
  1306. XX! /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/sysvr3/RCS/config.h,v 1.1 90/07/31 10:51:25 dvadura Exp $
  1307. XX  -- SYNOPSIS -- Configurarion include file.
  1308. XX  -- 
  1309. XX  -- DESCRIPTION
  1310. XX***************
  1311. XX*** 28,34 ****
  1312. XX  --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1313. XX  --
  1314. XX  -- LOG
  1315. XX! --     $Log$
  1316. XX  */
  1317. XX  
  1318. XX  /* define this for configurations that don't have the coreleft function
  1319. XX--- 28,37 ----
  1320. XX  --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1321. XX  --
  1322. XX  -- LOG
  1323. XX! --     $Log:    config.h,v $
  1324. XX!  * Revision 1.1  90/07/31  10:51:25  dvadura
  1325. XX!  * Initial Revision Dmake 3.5
  1326. XX!  * 
  1327. XX  */
  1328. XX  
  1329. XX  /* define this for configurations that don't have the coreleft function
  1330. SHAR_EOF
  1331. echo "End of part 2, continue with part 3"
  1332. echo "3" > s2_seq_.tmp
  1333. exit 0
  1334.  
  1335.