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

  1. Newsgroups: comp.sources.misc
  2. subject: v14i046: dmake version 3.5 patch 1 part 01/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 46
  7. Submitted-by: dvadura@watdragon.waterloo.edu (Dennis Vadura)
  8. Archive-name: dmake/patch01
  9.  
  10. #!/bin/sh
  11. # shar:    Shell Archiver  (v1.22)
  12. #
  13. # This is a patch for dmake version 3.5 patchlevel 1.
  14. # No further patches are forthcomming at this time.
  15. #
  16. # See below for a description of the patch, and what it fixes.  The four files
  17. # that make up the patch distribution are really another shell archive that
  18. # applies the patch when unpacked. 
  19. #
  20. # To apply the patch, unpack the four files that make up the patch to get the
  21. # file dmake-3.5-patch1, and run that through the shell in the root directory
  22. # of the dmake source distribution to apply the patch.
  23. #
  24. # This patch file is also available on watmsg.uwaterloo.ca (129.97.129.9)
  25. # via anonymous ftp from pub/src/dmake-3.5-patch1.
  26. #
  27. # Many thanks to all those out in net-land who have mailed me code and diffs
  28. # to fix the problems they encountered installing dmake.  This patch is a
  29. # result of your efforts.
  30. #
  31. # -dennis
  32. # ---------------------------------------------------------------------------
  33. # This is part 1 of a multipart archive                                    
  34. # do not concatenate these parts, unpack them in order with /bin/sh        
  35. #
  36. #    Run the following text with /bin/sh to create:
  37. #      dmake-3.5-patch1
  38. #
  39. if test -r s2_seq_.tmp
  40. then echo "Must unpack archives in sequence!"
  41.      next=`cat s2_seq_.tmp`; echo "Please unpack part $next next"
  42.      exit 1; fi
  43. sed 's/^X//' << 'SHAR_EOF' > dmake-3.5-patch1 &&
  44. X#!/bin/sh
  45. X# dodiff:  Directory tree maintainer (v1.1)
  46. X#
  47. X# dmake version 3.5, patch #1
  48. X# ---------------------------
  49. X# 
  50. X# Severity: Medium
  51. X# 
  52. X# Nature:   Minor teething problems with Sequent Dynix, and MSC 6.0,
  53. X#           Fix for BSD 4.3 version of putenv.c, numerous other file
  54. X#           reorganization changes to better compile on a wider variety of
  55. X#           architectures.
  56. X#           
  57. X# Format:   Shar containing new versions of affected files.  With appropriate
  58. X#           patches.  (run through sh, and it will do the rest)
  59. X# 
  60. X#           Also available as pub/src/dmake-3.5-patch1 on watmsg.uwaterloo.edu
  61. X#           (129.97.129.9)
  62. X# 
  63. X# Prerequisites:  dmake version 3.5, patchlevel 1 source distribution
  64. X# 
  65. X# Description of Fixes:
  66. X# ---------------------
  67. X#         - modified _readme.dos
  68. X#         - added sysvr1 initial target (SysV 5.0 Relese 1)
  69. X#         - renamed macros.h stdmacs.h  (some compilers had trouble with this)
  70. X#         - renamed dynix subtree to vf subtree and added a bunch of new
  71. X#           targets to bootstrap makefile.
  72. X# 
  73. X# UNIX:
  74. X# -----
  75. X#         - Fix to improve compiles on sequent machines.  Added source for
  76. X#           memcpy.c and vfprinft.c which are missing from the dynix C
  77. X#           libraries.  This also comes with a new make.sh and config.mk file
  78. X#           in the appropriate directories.
  79. X# 
  80. X#         - Fix to bsd43 version of putenv.c, If you had an environment macro
  81. X#           defined (say ENV=fred), and you exported a macro whose name began
  82. X#           with ENV, say ENVTEST then it would replace the value of ENV,
  83. X#           defined previously.
  84. X# 
  85. X# 
  86. X# MSDOS:
  87. X# ------
  88. X# MSC 6.0:  - A couple of nasty quirks with MSC compiles have been fixed up.
  89. X#           - size_t redefinition is taken care of, by now defining _TYPES_ in
  90. X#             msdos/mscdos/config.h
  91. X#           - SIGQUIT is not defined in MSDOS, redefined it to some other signal
  92. X#             SIGFPE (which wont ever happen since no floating point is used for
  93. X#             dmake).
  94. X#           - Provide a new response file msdods/mscdos/mscovl.rsp which defines
  95. X#             the link modules as two overlays.  This reduces the overall
  96. X#             memory requirements of dmake at runtime by about 14k.
  97. X#             (looking into exeswapping code for dos, have some but not
  98. X#             implemented yet)
  99. X# 
  100. X# TCC 2.0:  - duplicate definition of -I$(osrdir) in CFLAGS macro if uncommented
  101. X#             line in msdos/tccdos/config.mk
  102. X#           - wrong definition for LDOBJS in msdos/config.mk
  103. X#             (my fault, didn't test after small change to source organization)
  104. X#
  105. X# Remove Obsolete files from distribution
  106. Xrm -f unix/runargv.c
  107. Xrm -f unix/bsd43/dynix/startup.mk
  108. Xrm -f unix/bsd43/dynix/make.sh
  109. Xrm -f unix/bsd43/dynix/ctype.h
  110. Xrm -f unix/bsd43/dynix/config.mk
  111. Xrm -f msdos/tccdos/tcc.rsp
  112. Xrm -f common/macros.h
  113. Xrm -fr unix/bsd43/dynix
  114. X
  115. X# Now use a shar archive to add any new files to the distribution
  116. X# shar:    Shell Archiver  (v1.22)
  117. X#
  118. X#    Run the following text with /bin/sh to create:
  119. X#      _readme.p1
  120. X#      common/stdmacs.h
  121. X#      msdos/mscdos/mscovl.rsp
  122. X#      unix/386ix/runargv.c
  123. X#      unix/bsd43/runargv.c
  124. X#      unix/bsd43/vf
  125. X#      unix/bsd43/vf/config.mk
  126. X#      unix/bsd43/vf/ctype.h
  127. X#      unix/bsd43/vf/make.sh
  128. X#      unix/bsd43/vf/memcpy.c
  129. X#      unix/bsd43/vf/startup.mk
  130. X#      unix/bsd43/vf/vfprintf.c
  131. X#      unix/sysvr1
  132. X#      unix/sysvr1/config.h
  133. X#      unix/sysvr1/config.mk
  134. X#      unix/sysvr1/make.sh
  135. X#      unix/sysvr1/putenv.c
  136. X#      unix/sysvr1/runargv.c
  137. X#      unix/sysvr1/startup.mk
  138. X#      unix/sysvr1/stdarg.h
  139. X#      unix/sysvr1/stdlib.h
  140. X#      unix/sysvr1/time.h
  141. X#      unix/sysvr1/vfprintf.c
  142. X#      unix/sysvr3/runargv.c
  143. X#
  144. Xsed 's/^X//' << 'SHAR_EOF' > _readme.p1 &&
  145. XXdmake version 3.5, patch #1
  146. XX---------------------------
  147. XX
  148. XXSeverity: Medium
  149. XX
  150. XXNature:   Minor teething problems with Sequent Dynix, and MSC 6.0,
  151. XX          Fix for BSD 4.3 version of putenv.c, numerous other file
  152. XX          reorganization changes to better compile on a wider variety of
  153. XX          architectures.
  154. XX          
  155. XXFormat:   Shar containing new versions of affected files.  With appropriate
  156. XX          patches.  (run through sh, and it will do the rest)
  157. XX
  158. XX          Also available as pub/src/dmake-3.5-patch1 on watmsg.uwaterloo.edu
  159. XX          (129.97.129.9)
  160. XX
  161. XXPrerequisites:  dmake version 3.5, patchlevel 1 source distribution
  162. XX
  163. XXDescription of Fixes:
  164. XX---------------------
  165. XX        - modified _readme.dos
  166. XX        - added sysvr1 initial target (SysV 5.0 Relese 1)
  167. XX        - renamed macros.h stdmacs.h  (some compilers had trouble with this)
  168. XX        - renamed dynix subtree to vf subtree and added a bunch of new
  169. XX          targets to bootstrap makefile.
  170. XX
  171. XXUNIX:
  172. XX-----
  173. XX        - Fix to improve compiles on sequent machines.  Added source for
  174. XX          memcpy.c and vfprinft.c which are missing from the dynix C
  175. XX          libraries.  This also comes with a new make.sh and config.mk file
  176. XX          in the appropriate directories.
  177. XX
  178. XX        - Fix to bsd43 version of putenv.c, If you had an environment macro
  179. XX          defined (say ENV=fred), and you exported a macro whose name began
  180. XX          with ENV, say ENVTEST then it would replace the value of ENV,
  181. XX          defined previously.
  182. XX
  183. XX
  184. XXMSDOS:
  185. XX------
  186. XXMSC 6.0:  - A couple of nasty quirks with MSC compiles have been fixed up.
  187. XX          - size_t redefinition is taken care of, by now defining _TYPES_ in
  188. XX            msdos/mscdos/config.h
  189. XX          - SIGQUIT is not defined in MSDOS, redefined it to some other signal
  190. XX            SIGFPE (which wont ever happen since no floating point is used for
  191. XX            dmake).
  192. XX          - Provide a new response file msdods/mscdos/mscovl.rsp which defines
  193. XX            the link modules as two overlays.  This reduces the overall
  194. XX            memory requirements of dmake at runtime by about 14k.
  195. XX            (looking into exeswapping code for dos, have some but not
  196. XX            implemented yet)
  197. XX
  198. XXTCC 2.0:  - duplicate definition of -I$(osrdir) in CFLAGS macro if uncommented
  199. XX            line in msdos/tccdos/config.mk
  200. XX          - wrong definition for LDOBJS in msdos/config.mk
  201. XX            (my fault, didn't test after small change to source organization)
  202. XSHAR_EOF
  203. Xchmod 0640 _readme.p1 || echo "restore of _readme.p1 fails"
  204. Xset `wc -c _readme.p1`;Sum=$1
  205. Xif test "$Sum" != "2435"
  206. Xthen echo original size 2435, current size $Sum;fi
  207. Xsed 's/^X//' << 'SHAR_EOF' > common/stdmacs.h &&
  208. XX/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/common/RCS/stdmacs.h,v 1.1 90/07/31 11:09:19 dvadura Exp $
  209. XX-- SYNOPSIS -- general use macros.
  210. XX-- 
  211. XX-- DESCRIPTION
  212. XX--     ANSI macro relies on the fact that it can be replaced by (), or by
  213. XX--    its value, where the value is one value due to the preprocessors
  214. XX--    handling of arguments that are surrounded by ()'s as a single
  215. XX--    argument.
  216. XX--
  217. XX-- AUTHOR
  218. XX--      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  219. XX--      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  220. XX--
  221. XX-- COPYRIGHT
  222. XX--      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  223. XX-- 
  224. XX--      This program is free software; you can redistribute it and/or
  225. XX--      modify it under the terms of the GNU General Public License
  226. XX--      (version 1), as published by the Free Software Foundation, and
  227. XX--      found in the file 'LICENSE' included with this distribution.
  228. XX-- 
  229. XX--      This program is distributed in the hope that it will be useful,
  230. XX--      but WITHOUT ANY WARRANTY; without even the implied warrant of
  231. XX--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  232. XX--      GNU General Public License for more details.
  233. XX-- 
  234. XX--      You should have received a copy of the GNU General Public License
  235. XX--      along with this program;  if not, write to the Free Software
  236. XX--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  237. XX--
  238. XX-- LOG
  239. XX--     $Log:    stdmacs.h,v $
  240. XX * Revision 1.1  90/07/31  11:09:19  dvadura
  241. XX * Initial Revison Dmake 3.5
  242. XX * 
  243. XX*/
  244. XX
  245. XX#ifndef    MACROS_h
  246. XX#define    MACROS_h
  247. XX
  248. XX#if defined(__STDC__) || defined(__TURBOC__)
  249. XX#define    ANSI(x)    x
  250. XX#else
  251. XX#define    ANSI(x)    ()
  252. XX#endif
  253. XX
  254. XX#define    NIL(p)    ((p*)NULL)
  255. XX#define    offsetof(type,id) ((size_t)&((type*)NULL)->id)
  256. XX
  257. XX#define    FALSE    0
  258. XX#define    TRUE    1
  259. XX
  260. XX#endif
  261. XX
  262. XSHAR_EOF
  263. Xchmod 0440 common/stdmacs.h || echo "restore of common/stdmacs.h fails"
  264. Xset `wc -c common/stdmacs.h`;Sum=$1
  265. Xif test "$Sum" != "1738"
  266. Xthen echo original size 1738, current size $Sum;fi
  267. Xsed 's/^X//' << 'SHAR_EOF' > msdos/mscdos/mscovl.rsp &&
  268. XX( objects\infer.obj+ objects\make.obj+ objects\stat.obj+ objects\path.obj+
  269. XX  objects\basename.obj+ objects\runargv.obj+ objects\arlib.obj+
  270. XX  objects\rmprq.obj+ objects\tempnam.obj )+
  271. XX( objects\imacs.obj+ objects\parse.obj+ objects\dump.obj+ objects\macparse.obj+
  272. XX  objects\rulparse.obj+ objects\ruletab.obj+ objects\switchar.obj )+
  273. XXobjects\expand.obj+
  274. XXobjects\string.obj+
  275. XXobjects\hash.obj+
  276. XXobjects\dag.obj+
  277. XXobjects\dmake.obj+
  278. XXobjects\sysintf.obj+
  279. XXobjects\getinp.obj+
  280. XXobjects\quit.obj+
  281. XXobjects\percent.obj+
  282. XXobjects\dirbrk.obj+
  283. XXobjects\_chdir.obj
  284. XSHAR_EOF
  285. Xchmod 0640 msdos/mscdos/mscovl.rsp || echo "restore of msdos/mscdos/mscovl.rsp fails"
  286. Xset `wc -c msdos/mscdos/mscovl.rsp`;Sum=$1
  287. Xif test "$Sum" != "545"
  288. Xthen echo original size 545, current size $Sum;fi
  289. Xsed 's/^X//' << 'SHAR_EOF' > unix/386ix/runargv.c &&
  290. XX/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/386ix/RCS/runargv.c,v 1.1 90/07/31 10:49:16 dvadura Exp $
  291. XX-- SYNOPSIS -- invoke a sub process.
  292. XX-- 
  293. XX-- DESCRIPTION
  294. XX--     Use the standard methods of executing a sub process.
  295. XX--
  296. XX-- AUTHOR
  297. XX--      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  298. XX--      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  299. XX--
  300. XX-- COPYRIGHT
  301. XX--      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  302. XX-- 
  303. XX--      This program is free software; you can redistribute it and/or
  304. XX--      modify it under the terms of the GNU General Public License
  305. XX--      (version 1), as published by the Free Software Foundation, and
  306. XX--      found in the file 'LICENSE' included with this distribution.
  307. XX-- 
  308. XX--      This program is distributed in the hope that it will be useful,
  309. XX--      but WITHOUT ANY WARRANTY; without even the implied warrant of
  310. XX--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  311. XX--      GNU General Public License for more details.
  312. XX-- 
  313. XX--      You should have received a copy of the GNU General Public License
  314. XX--      along with this program;  if not, write to the Free Software
  315. XX--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  316. XX--
  317. XX-- LOG
  318. XX--     $Log:    runargv.c,v $
  319. XX * Revision 1.1  90/07/31  10:49:16  dvadura
  320. XX * Initial Revision Dmake 3.5
  321. XX * 
  322. XX * Revision 1.1  90/07/20  16:54:53  dvadura
  323. XX * Initial Revision of Version 3.5
  324. XX * 
  325. XX*/
  326. XX
  327. XX#include <signal.h>
  328. XX#include "extern.h"
  329. XX#include "sysintf.h"
  330. XX#include "alloc.h"
  331. XX
  332. XXtypedef struct prp {
  333. XX   char *prp_cmd;
  334. XX   int   prp_group;
  335. XX   int   prp_ignore;
  336. XX   int   prp_last;
  337. XX   struct prp *prp_next;
  338. XX   char  *prp_dir;
  339. XX} RCP, *RCPPTR;
  340. XX
  341. XXtypedef struct pr {
  342. XX   int        pr_valid;
  343. XX   int        pr_pid;
  344. XX   CELLPTR    pr_target;
  345. XX   HOWPTR    pr_how;
  346. XX   int        pr_ignore;
  347. XX   int        pr_last;
  348. XX   RCPPTR      pr_recipe;
  349. XX   RCPPTR      pr_recipe_end;
  350. XX} PR;
  351. XX
  352. XXstatic PR  *_procs    = NIL(PR);
  353. XXstatic int  _proc_cnt = 0;
  354. XXstatic int  _abort_flg= FALSE;
  355. XXstatic int  _use_i    = -1;
  356. XXstatic int  _do_upd   = 0;
  357. XX
  358. XXstatic  void    _add_child ANSI((int, CELLPTR, HOWPTR, int, int));
  359. XXstatic  void    _attach_cmd ANSI((char *, int, int, CELLPTR, HOWPTR, int));
  360. XXstatic  void    _finished_child ANSI((int, int));
  361. XXstatic  int     _running ANSI((CELLPTR, HOWPTR));
  362. XX
  363. XXint
  364. XXrunargv(target, how, ignore, group, last, cmd)
  365. XXCELLPTR target;
  366. XXHOWPTR  how;
  367. XXint     ignore;
  368. XXint    group;
  369. XXint    last;
  370. XXchar    *cmd;
  371. XX{
  372. XX   extern  int  errno;
  373. XX   extern  char *sys_errlist[];
  374. XX   int          pid;
  375. XX   char         *argv[MAXARGV];
  376. XX
  377. XX   if( _running(target, how) /*&& Max_proc != 1*/ ) {
  378. XX      /* The command will be executed when the previous recipe
  379. XX       * line completes. */
  380. XX      _attach_cmd( cmd, group, ignore, target, how, last );
  381. XX      return(1);
  382. XX   }
  383. XX
  384. XX   Pack_argv( argv, MAXARGV, group, cmd );
  385. XX
  386. XX   while( _proc_cnt == Max_proc )
  387. XX      if( Wait_for_child(FALSE, -1) == -1 )  Fatal( "Lost a child" );
  388. XX
  389. XX   switch( pid=fork() ){
  390. XX      int   wid;
  391. XX      int   status;
  392. XX
  393. XX   case -1: /* fork failed */
  394. XX      Error("%s: %s", argv[0], sys_errlist[errno]);
  395. XX      Handle_result(-1, ignore, _abort_flg, target);
  396. XX      return(-1);
  397. XX
  398. XX   case 0:  /* child */
  399. XX      execvp(argv[0], argv);
  400. XX      Continue = TRUE;   /* survive error message */
  401. XX      Error("%s: %s", argv[0], sys_errlist[errno]);
  402. XX      kill(getpid(), SIGTERM);
  403. XX      /*NOTREACHED*/
  404. XX
  405. XX   default: /* parent */
  406. XX      _add_child(pid, target, how, ignore, last);
  407. XX   }
  408. XX
  409. XX   return(1);
  410. XX}
  411. XX
  412. XX
  413. XXint
  414. XXWait_for_child( abort_flg, pid )
  415. XXint abort_flg;
  416. XXint pid;
  417. XX{
  418. XX   int wid;
  419. XX   int status;
  420. XX   int waitchild;
  421. XX
  422. XX   waitchild = (pid == -1)? FALSE : Wait_for_completion;
  423. XX
  424. XX   do {
  425. XX      if( (wid = wait(&status)) == -1 ) return(-1);
  426. XX
  427. XX      _abort_flg = abort_flg;
  428. XX      _finished_child(wid, status);
  429. XX      _abort_flg = FALSE;
  430. XX   }
  431. XX   while( waitchild && pid != wid );
  432. XX
  433. XX   return(0);
  434. XX}
  435. XX
  436. XX
  437. XXvoid
  438. XXClean_up_processes()
  439. XX{
  440. XX   register int i;
  441. XX
  442. XX   if( _procs != NIL(PR) ) {
  443. XX      for( i=0; i<Max_proc; i++ )
  444. XX     if( _procs[i].pr_valid )
  445. XX        kill(_procs[i].pr_pid, SIGTERM);
  446. XX
  447. XX      while( Wait_for_child(TRUE, -1) != -1 );
  448. XX   }
  449. XX}
  450. XX
  451. XX
  452. XXstatic void
  453. XX_add_child( pid, target, how, ignore, last )
  454. XXint    pid;
  455. XXCELLPTR target;
  456. XXHOWPTR  how;
  457. XXint    ignore;
  458. XXint     last;
  459. XX{
  460. XX   register int i;
  461. XX   register PR *pp;
  462. XX
  463. XX   if( _procs == NIL(PR) ) {
  464. XX      TALLOC( _procs, Max_proc, PR );
  465. XX   }
  466. XX
  467. XX   if( (i = _use_i) == -1 )
  468. XX      for( i=0; i<Max_proc; i++ )
  469. XX     if( !_procs[i].pr_valid )
  470. XX        break;
  471. XX
  472. XX   pp = _procs+i;
  473. XX
  474. XX   pp->pr_valid  = 1;
  475. XX   pp->pr_pid    = pid;
  476. XX   pp->pr_target = target;
  477. XX   pp->pr_how    = how;
  478. XX   pp->pr_ignore = ignore;
  479. XX   pp->pr_last   = last;
  480. XX
  481. XX   Current_target = NIL(HOW);
  482. XX
  483. XX   _proc_cnt++;
  484. XX
  485. XX   if( Wait_for_completion ) Wait_for_child( FALSE, pid );
  486. XX}
  487. XX
  488. XX
  489. XXstatic void
  490. XX_finished_child(pid, status)
  491. XXint    pid;
  492. XXint    status;
  493. XX{
  494. XX   register int i;
  495. XX   register PR *pp;
  496. XX
  497. XX   for( i=0; i<Max_proc; i++ )
  498. XX      if( _procs[i].pr_valid && _procs[i].pr_pid == pid )
  499. XX     break;
  500. XX
  501. XX   _procs[i].pr_valid = 0;
  502. XX   _proc_cnt--;
  503. XX
  504. XX   if( _procs[i].pr_recipe != NIL(RCP) && !_abort_flg ) {
  505. XX      RCPPTR rp = _procs[i].pr_recipe;
  506. XX      char   *dir;
  507. XX
  508. XX      Current_target = _procs[i].pr_how;
  509. XX      Handle_result( status, _procs[i].pr_ignore, FALSE, _procs[i].pr_target );
  510. XX      Current_target = NIL(HOW);
  511. XX
  512. XX      _procs[i].pr_recipe = rp->prp_next;
  513. XX
  514. XX      _use_i = i;
  515. XX      dir = _strdup(Get_current_dir());
  516. XX      Set_dir( rp->prp_dir );
  517. XX      runargv( _procs[i].pr_target, _procs[i].pr_how, rp->prp_ignore,
  518. XX                 rp->prp_group, rp->prp_last, rp->prp_cmd );
  519. XX      Set_dir(dir);
  520. XX      FREE(dir);
  521. XX      FREE(rp->prp_dir);
  522. XX      _use_i = -1;
  523. XX
  524. XX      FREE( rp->prp_cmd );
  525. XX      FREE( rp );
  526. XX
  527. XX      if( _proc_cnt == Max_proc ) Wait_for_child( FALSE, -1 );
  528. XX   }
  529. XX   else {
  530. XX      Unlink_temp_files( _procs[i].pr_how );
  531. XX      Handle_result(status,_procs[i].pr_ignore,_abort_flg,_procs[i].pr_target);
  532. XX
  533. XX      if( _procs[i].pr_last && !Doing_bang )
  534. XX     Update_time_stamp( _procs[i].pr_target, _procs[i].pr_how );
  535. XX   }
  536. XX}
  537. XX
  538. XX
  539. XXstatic int
  540. XX_running( cp, how )
  541. XXCELLPTR cp;
  542. XXHOWPTR  how;
  543. XX{
  544. XX   register int i;
  545. XX
  546. XX   if( !_procs ) return(FALSE);
  547. XX
  548. XX   for( i=0; i<Max_proc; i++ )
  549. XX      if( _procs[i].pr_valid &&
  550. XX      _procs[i].pr_how == how &&
  551. XX      _procs[i].pr_target == cp  )
  552. XX     break;
  553. XX     
  554. XX   return( i != Max_proc );
  555. XX}
  556. XX
  557. XX
  558. XXstatic void
  559. XX_attach_cmd( cmd, group, ignore, cp, how, last )
  560. XXchar    *cmd;
  561. XXint    group;
  562. XXint     ignore;
  563. XXCELLPTR cp;
  564. XXHOWPTR  how;
  565. XXint     last;
  566. XX{
  567. XX   register int i;
  568. XX   RCPPTR rp;
  569. XX
  570. XX   for( i=0; i<Max_proc; i++ )
  571. XX      if( _procs[i].pr_valid &&
  572. XX      _procs[i].pr_how == how &&
  573. XX      _procs[i].pr_target == cp  )
  574. XX     break;
  575. XX
  576. XX   TALLOC( rp, 1, RCP );
  577. XX   rp->prp_cmd   = _strdup(cmd);
  578. XX   rp->prp_group = group;
  579. XX   rp->prp_ignore= ignore;
  580. XX   rp->prp_last  = last;
  581. XX   rp->prp_dir   = _strdup(Get_current_dir());
  582. XX
  583. XX   if( _procs[i].pr_recipe == NIL(RCP) )
  584. XX      _procs[i].pr_recipe = _procs[i].pr_recipe_end = rp;
  585. XX   else {
  586. XX      _procs[i].pr_recipe_end->prp_next = rp;
  587. XX      _procs[i].pr_recipe_end = rp;
  588. XX   }
  589. XX}
  590. XSHAR_EOF
  591. Xchmod 0440 unix/386ix/runargv.c || echo "restore of unix/386ix/runargv.c fails"
  592. Xset `wc -c unix/386ix/runargv.c`;Sum=$1
  593. Xif test "$Sum" != "6805"
  594. Xthen echo original size 6805, current size $Sum;fi
  595. Xsed 's/^X//' << 'SHAR_EOF' > unix/bsd43/runargv.c &&
  596. XX/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/bsd43/RCS/runargv.c,v 1.1 90/07/31 10:48:36 dvadura Exp $
  597. XX-- SYNOPSIS -- invoke a sub process.
  598. XX-- 
  599. XX-- DESCRIPTION
  600. XX--     Use the standard methods of executing a sub process.
  601. XX--
  602. XX-- AUTHOR
  603. XX--      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  604. XX--      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  605. XX--
  606. XX-- COPYRIGHT
  607. XX--      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  608. XX-- 
  609. XX--      This program is free software; you can redistribute it and/or
  610. XX--      modify it under the terms of the GNU General Public License
  611. XX--      (version 1), as published by the Free Software Foundation, and
  612. XX--      found in the file 'LICENSE' included with this distribution.
  613. XX-- 
  614. XX--      This program is distributed in the hope that it will be useful,
  615. XX--      but WITHOUT ANY WARRANTY; without even the implied warrant of
  616. XX--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  617. XX--      GNU General Public License for more details.
  618. XX-- 
  619. XX--      You should have received a copy of the GNU General Public License
  620. XX--      along with this program;  if not, write to the Free Software
  621. XX--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  622. XX--
  623. XX-- LOG
  624. XX--     $Log:    runargv.c,v $
  625. XX * Revision 1.1  90/07/31  10:48:36  dvadura
  626. XX * Initial Revision Dmake 3.5
  627. XX * 
  628. XX*/
  629. XX
  630. XX#include <signal.h>
  631. XX#include "extern.h"
  632. XX#include "sysintf.h"
  633. XX#include "alloc.h"
  634. XX
  635. XXtypedef struct prp {
  636. XX   char *prp_cmd;
  637. XX   int   prp_group;
  638. XX   int   prp_ignore;
  639. XX   int   prp_last;
  640. XX   struct prp *prp_next;
  641. XX   char  *prp_dir;
  642. XX} RCP, *RCPPTR;
  643. XX
  644. XXtypedef struct pr {
  645. XX   int        pr_valid;
  646. XX   int        pr_pid;
  647. XX   CELLPTR    pr_target;
  648. XX   HOWPTR    pr_how;
  649. XX   int        pr_ignore;
  650. XX   int        pr_last;
  651. XX   RCPPTR      pr_recipe;
  652. XX   RCPPTR      pr_recipe_end;
  653. XX} PR;
  654. XX
  655. XXstatic PR  *_procs    = NIL(PR);
  656. XXstatic int  _proc_cnt = 0;
  657. XXstatic int  _abort_flg= FALSE;
  658. XXstatic int  _use_i    = -1;
  659. XXstatic int  _do_upd   = 0;
  660. XX
  661. XXstatic  void    _add_child ANSI((int, CELLPTR, HOWPTR, int, int));
  662. XXstatic  void    _attach_cmd ANSI((char *, int, int, CELLPTR, HOWPTR, int));
  663. XXstatic  void    _finished_child ANSI((int, int));
  664. XXstatic  int     _running ANSI((CELLPTR, HOWPTR));
  665. XX
  666. XXint
  667. XXrunargv(target, how, ignore, group, last, cmd)
  668. XXCELLPTR target;
  669. XXHOWPTR  how;
  670. XXint     ignore;
  671. XXint    group;
  672. XXint    last;
  673. XXchar    *cmd;
  674. XX{
  675. XX   extern  int  errno;
  676. XX   extern  char *sys_errlist[];
  677. XX   int          pid;
  678. XX   char         *argv[MAXARGV];
  679. XX
  680. XX   if( _running(target, how) /*&& Max_proc != 1*/ ) {
  681. XX      /* The command will be executed when the previous recipe
  682. XX       * line completes. */
  683. XX      _attach_cmd( cmd, group, ignore, target, how, last );
  684. XX      return(1);
  685. XX   }
  686. XX
  687. XX   Pack_argv( argv, MAXARGV, group, cmd );
  688. XX
  689. XX   while( _proc_cnt == Max_proc )
  690. XX      if( Wait_for_child(FALSE, -1) == -1 )  Fatal( "Lost a child" );
  691. XX
  692. XX   switch( pid=fork() ){
  693. XX      int   wid;
  694. XX      int   status;
  695. XX
  696. XX   case -1: /* fork failed */
  697. XX      Error("%s: %s", argv[0], sys_errlist[errno]);
  698. XX      Handle_result(-1, ignore, _abort_flg, target);
  699. XX      return(-1);
  700. XX
  701. XX   case 0:  /* child */
  702. XX      execvp(argv[0], argv);
  703. XX      Continue = TRUE;   /* survive error message */
  704. XX      Error("%s: %s", argv[0], sys_errlist[errno]);
  705. XX      kill(getpid(), SIGTERM);
  706. XX      /*NOTREACHED*/
  707. XX
  708. XX   default: /* parent */
  709. XX      _add_child(pid, target, how, ignore, last);
  710. XX   }
  711. XX
  712. XX   return(1);
  713. XX}
  714. XX
  715. XX
  716. XXint
  717. XXWait_for_child( abort_flg, pid )
  718. XXint abort_flg;
  719. XXint pid;
  720. XX{
  721. XX   int wid;
  722. XX   int status;
  723. XX   int waitchild;
  724. XX
  725. XX   waitchild = (pid == -1)? FALSE : Wait_for_completion;
  726. XX
  727. XX   do {
  728. XX      if( (wid = wait(&status)) == -1 ) return(-1);
  729. XX
  730. XX      _abort_flg = abort_flg;
  731. XX      _finished_child(wid, status);
  732. XX      _abort_flg = FALSE;
  733. XX   }
  734. XX   while( waitchild && pid != wid );
  735. XX
  736. XX   return(0);
  737. XX}
  738. XX
  739. XX
  740. XXvoid
  741. XXClean_up_processes()
  742. XX{
  743. XX   register int i;
  744. XX
  745. XX   if( _procs != NIL(PR) ) {
  746. XX      for( i=0; i<Max_proc; i++ )
  747. XX     if( _procs[i].pr_valid )
  748. XX        kill(_procs[i].pr_pid, SIGTERM);
  749. XX
  750. XX      while( Wait_for_child(TRUE, -1) != -1 );
  751. XX   }
  752. XX}
  753. XX
  754. XX
  755. XXstatic void
  756. XX_add_child( pid, target, how, ignore, last )
  757. XXint    pid;
  758. XXCELLPTR target;
  759. XXHOWPTR  how;
  760. XXint    ignore;
  761. XXint     last;
  762. XX{
  763. XX   register int i;
  764. XX   register PR *pp;
  765. XX
  766. XX   if( _procs == NIL(PR) ) {
  767. XX      TALLOC( _procs, Max_proc, PR );
  768. XX   }
  769. XX
  770. XX   if( (i = _use_i) == -1 )
  771. XX      for( i=0; i<Max_proc; i++ )
  772. XX     if( !_procs[i].pr_valid )
  773. XX        break;
  774. XX
  775. XX   pp = _procs+i;
  776. XX
  777. XX   pp->pr_valid  = 1;
  778. XX   pp->pr_pid    = pid;
  779. XX   pp->pr_target = target;
  780. XX   pp->pr_how    = how;
  781. XX   pp->pr_ignore = ignore;
  782. XX   pp->pr_last   = last;
  783. XX
  784. XX   Current_target = NIL(HOW);
  785. XX
  786. XX   _proc_cnt++;
  787. XX
  788. XX   if( Wait_for_completion ) Wait_for_child( FALSE, pid );
  789. XX}
  790. XX
  791. XX
  792. XXstatic void
  793. XX_finished_child(pid, status)
  794. XXint    pid;
  795. XXint    status;
  796. XX{
  797. XX   register int i;
  798. XX   register PR *pp;
  799. XX
  800. XX   for( i=0; i<Max_proc; i++ )
  801. XX      if( _procs[i].pr_valid && _procs[i].pr_pid == pid )
  802. XX     break;
  803. XX
  804. XX   _procs[i].pr_valid = 0;
  805. XX   _proc_cnt--;
  806. XX
  807. XX   if( _procs[i].pr_recipe != NIL(RCP) && !_abort_flg ) {
  808. XX      RCPPTR rp = _procs[i].pr_recipe;
  809. XX      char   *dir;
  810. XX
  811. XX      Current_target = _procs[i].pr_how;
  812. XX      Handle_result( status, _procs[i].pr_ignore, FALSE, _procs[i].pr_target );
  813. XX      Current_target = NIL(HOW);
  814. XX
  815. XX      _procs[i].pr_recipe = rp->prp_next;
  816. XX
  817. XX      _use_i = i;
  818. XX      dir = _strdup(Get_current_dir());
  819. XX      Set_dir( rp->prp_dir );
  820. XX      runargv( _procs[i].pr_target, _procs[i].pr_how, rp->prp_ignore,
  821. XX                 rp->prp_group, rp->prp_last, rp->prp_cmd );
  822. XX      Set_dir(dir);
  823. XX      FREE(dir);
  824. XX      FREE(rp->prp_dir);
  825. XX      _use_i = -1;
  826. XX
  827. XX      FREE( rp->prp_cmd );
  828. XX      FREE( rp );
  829. XX
  830. XX      if( _proc_cnt == Max_proc ) Wait_for_child( FALSE, -1 );
  831. XX   }
  832. XX   else {
  833. XX      Unlink_temp_files( _procs[i].pr_how );
  834. XX      Handle_result(status,_procs[i].pr_ignore,_abort_flg,_procs[i].pr_target);
  835. XX
  836. XX      if( _procs[i].pr_last && !Doing_bang )
  837. XX     Update_time_stamp( _procs[i].pr_target, _procs[i].pr_how );
  838. XX   }
  839. XX}
  840. XX
  841. XX
  842. XXstatic int
  843. XX_running( cp, how )
  844. XXCELLPTR cp;
  845. XXHOWPTR  how;
  846. XX{
  847. XX   register int i;
  848. XX
  849. XX   if( !_procs ) return(FALSE);
  850. XX
  851. XX   for( i=0; i<Max_proc; i++ )
  852. XX      if( _procs[i].pr_valid &&
  853. XX      _procs[i].pr_how == how &&
  854. XX      _procs[i].pr_target == cp  )
  855. XX     break;
  856. XX     
  857. XX   return( i != Max_proc );
  858. XX}
  859. XX
  860. XX
  861. XXstatic void
  862. XX_attach_cmd( cmd, group, ignore, cp, how, last )
  863. XXchar    *cmd;
  864. XXint    group;
  865. XXint     ignore;
  866. XXCELLPTR cp;
  867. XXHOWPTR  how;
  868. XXint     last;
  869. XX{
  870. XX   register int i;
  871. XX   RCPPTR rp;
  872. XX
  873. XX   for( i=0; i<Max_proc; i++ )
  874. XX      if( _procs[i].pr_valid &&
  875. XX      _procs[i].pr_how == how &&
  876. XX      _procs[i].pr_target == cp  )
  877. XX     break;
  878. XX
  879. XX   TALLOC( rp, 1, RCP );
  880. XX   rp->prp_cmd   = _strdup(cmd);
  881. XX   rp->prp_group = group;
  882. XX   rp->prp_ignore= ignore;
  883. XX   rp->prp_last  = last;
  884. XX   rp->prp_dir   = _strdup(Get_current_dir());
  885. XX
  886. XX   if( _procs[i].pr_recipe == NIL(RCP) )
  887. XX      _procs[i].pr_recipe = _procs[i].pr_recipe_end = rp;
  888. XX   else {
  889. XX      _procs[i].pr_recipe_end->prp_next = rp;
  890. XX      _procs[i].pr_recipe_end = rp;
  891. XX   }
  892. XX}
  893. XSHAR_EOF
  894. Xchmod 0440 unix/bsd43/runargv.c || echo "restore of unix/bsd43/runargv.c fails"
  895. Xset `wc -c unix/bsd43/runargv.c`;Sum=$1
  896. Xif test "$Sum" != "6721"
  897. Xthen echo original size 6721, current size $Sum;fi
  898. Xecho mkdir - unix/bsd43/vf
  899. Xmkdir unix/bsd43/vf
  900. Xsed 's/^X//' << 'SHAR_EOF' > unix/bsd43/vf/config.mk &&
  901. XX# This config file adds vfprintf.c and memcpy.c for those systems that
  902. XX# do not have it.
  903. XX#
  904. XX
  905. XXosredir := $(OS)$(DIRSEPSTR)$(OSRELEASE)$(DIRSEPSTR)$(OSENVIRONMENT)
  906. XX
  907. XX# The following sources are required for BSD4.3
  908. XXOSDESRC := memcpy.c vfprintf.c
  909. XXSRC    += $(OSDESRC)
  910. XX.SETDIR=$(osredir) : $(OSDESRC)
  911. XX
  912. XXCFLAGS += -I$(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT)
  913. XSHAR_EOF
  914. Xchmod 0640 unix/bsd43/vf/config.mk || echo "restore of unix/bsd43/vf/config.mk fails"
  915. Xset `wc -c unix/bsd43/vf/config.mk`;Sum=$1
  916. Xif test "$Sum" != "345"
  917. Xthen echo original size 345, current size $Sum;fi
  918. Xsed 's/^X//' << 'SHAR_EOF' > unix/bsd43/vf/ctype.h &&
  919. XX/*    ctype.h    4.2    85/09/04    */
  920. XX
  921. XX#define    _U    01
  922. XX#define    _L    02
  923. XX#define    _N    04
  924. XX#define    _S    010
  925. XX#define _P    020
  926. XX#define _C    040
  927. XX#define _X    0100
  928. XX#define    _B    0200
  929. XX
  930. XXextern    char    _ctype_[];
  931. XX
  932. XX#define    isalpha(c)    ((_ctype_+1)[c]&(_U|_L))
  933. XX#define    isupper(c)    ((_ctype_+1)[c]&_U)
  934. XX#define    islower(c)    ((_ctype_+1)[c]&_L)
  935. XX#define    isdigit(c)    ((_ctype_+1)[c]&_N)
  936. XX#define    isxdigit(c)    ((_ctype_+1)[c]&(_N|_X))
  937. XX#define    isspace(c)    ((_ctype_+1)[c]&_S)
  938. XX#define ispunct(c)    ((_ctype_+1)[c]&_P)
  939. XX#define isalnum(c)    ((_ctype_+1)[c]&(_U|_L|_N))
  940. XX#define isprint(c)    ((_ctype_+1)[c]&(_P|_U|_L|_N|_B))
  941. XX#define isgraph(c)    ((_ctype_+1)[c]&(_P|_U|_L|_N))
  942. XX#define iscntrl(c)    ((_ctype_+1)[c]&_C)
  943. XX#define isascii(c)    ((unsigned)(c)<=0177)
  944. XX#define toupper(c)    ((c)-'a'+'A')
  945. XX#define tolower(c)    ((c)-'A'+'a')
  946. XX#define toascii(c)    ((c)&0177)
  947. XSHAR_EOF
  948. Xchmod 0440 unix/bsd43/vf/ctype.h || echo "restore of unix/bsd43/vf/ctype.h fails"
  949. Xset `wc -c unix/bsd43/vf/ctype.h`;Sum=$1
  950. Xif test "$Sum" != "782"
  951. Xthen echo original size 782, current size $Sum;fi
  952. Xsed 's/^X//' << 'SHAR_EOF' > unix/bsd43/vf/make.sh &&
  953. XXmkdir objects
  954. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O infer.c
  955. XXmv infer.o objects 
  956. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O make.c
  957. XXmv make.o objects 
  958. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O stat.c
  959. XXmv stat.o objects 
  960. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O expand.c
  961. XXmv expand.o objects 
  962. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O string.c
  963. XXmv string.o objects 
  964. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O hash.c
  965. XXmv hash.o objects 
  966. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O dag.c
  967. XXmv dag.o objects 
  968. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O dmake.c
  969. XXmv dmake.o objects 
  970. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O path.c
  971. XXmv path.o objects 
  972. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O imacs.c
  973. XXmv imacs.o objects 
  974. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O sysintf.c
  975. XXmv sysintf.o objects 
  976. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O parse.c
  977. XXmv parse.o objects 
  978. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O getinp.c
  979. XXmv getinp.o objects 
  980. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O quit.c
  981. XXmv quit.o objects 
  982. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O basename.c
  983. XXmv basename.o objects 
  984. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O dump.c
  985. XXmv dump.o objects 
  986. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O macparse.c
  987. XXmv macparse.o objects 
  988. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O rulparse.c
  989. XXmv rulparse.o objects 
  990. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O percent.c
  991. XXmv percent.o objects 
  992. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/arlib.c
  993. XXmv arlib.o objects 
  994. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/dirbrk.c
  995. XXmv dirbrk.o objects 
  996. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/explode.c
  997. XXmv explode.o objects 
  998. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/rmprq.c
  999. XXmv rmprq.o objects 
  1000. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/ruletab.c
  1001. XXmv ruletab.o objects 
  1002. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/bsd43/putenv.c
  1003. XXmv putenv.o objects 
  1004. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/bsd43/tempnam.c
  1005. XXmv tempnam.o objects 
  1006. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/bsd43/utime.c
  1007. XXmv utime.o objects 
  1008. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/bsd43/setvbuf.c
  1009. XXmv setvbuf.o objects 
  1010. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/bsd43/runargv.c
  1011. XXmv runargv.o objects 
  1012. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/bsd43/vf/memcpy.c
  1013. XXmv memcpy.o objects 
  1014. XXcc -c -DHELP -I. -Icommon -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/bsd43/vf/vfprintf.c
  1015. XXmv vfprintf.o objects 
  1016. 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/putenv.o objects/tempnam.o objects/utime.o objects/setvbuf.o objects/runargv.o objects/memcpy.o objects/vfprintf.o 
  1017. XSHAR_EOF
  1018. Xchmod 0640 unix/bsd43/vf/make.sh || echo "restore of unix/bsd43/vf/make.sh fails"
  1019. Xset `wc -c unix/bsd43/vf/make.sh`;Sum=$1
  1020. Xif test "$Sum" != "3588"
  1021. Xthen echo original size 3588, current size $Sum;fi
  1022. Xsed 's/^X//' << 'SHAR_EOF' > unix/bsd43/vf/memcpy.c &&
  1023. XXchar *
  1024. XXmemcpy(t, f, n)
  1025. XXregister char *t, *f;
  1026. XXregister n;
  1027. XX{
  1028. XX   register char *p = t;
  1029. XX
  1030. XX   while( --n >= 0 ) *t++ = *f++;
  1031. XX
  1032. XX   return (p);
  1033. XX}
  1034. XSHAR_EOF
  1035. Xchmod 0440 unix/bsd43/vf/memcpy.c || echo "restore of unix/bsd43/vf/memcpy.c fails"
  1036. Xset `wc -c unix/bsd43/vf/memcpy.c`;Sum=$1
  1037. Xif test "$Sum" != "137"
  1038. Xthen echo original size 137, current size $Sum;fi
  1039. Xsed 's/^X//' << 'SHAR_EOF' > unix/bsd43/vf/startup.mk &&
  1040. XX# Generic UNIX DMAKE startup file.  Customize to suit your needs.
  1041. XX# Should work for both SYSV, and BSD 4.3
  1042. XX# See the documentation for a description of internally defined macros.
  1043. XX#
  1044. XX# Disable warnings for macros redefined here that were given
  1045. XX# on the command line.
  1046. XX__.SILENT := $(.SILENT)
  1047. XX.SILENT   := yes
  1048. XX
  1049. XX# Configuration parameters for DMAKE startup.mk file
  1050. XX# Set these to NON-NULL if you wish to turn the parameter on.
  1051. XX_HAVE_RCS    := yes        # yes => RCS  is installed.
  1052. XX_HAVE_SCCS    := yes        # yes => SCCS is installed.
  1053. XX
  1054. XX# Applicable suffix definitions
  1055. XXA := .a        # Libraries
  1056. XXE :=        # Executables
  1057. XXF := .f        # Fortran
  1058. XXO := .o        # Objects
  1059. XXP := .p        # Pascal
  1060. XXS := .s        # Assembler sources
  1061. XXV := ,v        # RCS suffix
  1062. XX
  1063. XX# Recipe execution configurations
  1064. XXSHELL        := /bin/sh
  1065. XXSHELLFLAGS    := -ce
  1066. XXGROUPSHELL    := $(SHELL)
  1067. XXGROUPFLAGS    := 
  1068. XXSHELLMETAS    := |();&<>?*][$$:\\#`'"
  1069. XXGROUPSUFFIX    :=
  1070. XX
  1071. XX# Standard C-language command names and flags
  1072. XX   CPP       := /lib/cpp        # C-preprocessor
  1073. XX   CC      := cc        # C-compiler and flags
  1074. XX   CFLAGS   =
  1075. XX
  1076. XX   AS      := as        # Assembler and flags
  1077. XX   ASFLAGS  = 
  1078. XX
  1079. XX   LD       = $(CC)        # Loader and flags
  1080. XX   LDFLAGS  =
  1081. XX   LDLIBS   =
  1082. XX
  1083. XX# Definition of $(MAKE) macro for recursive makes.
  1084. XX   MAKE = $(MAKECMD) $(MFLAGS)
  1085. XX
  1086. XX# Definition of Print command for this system.
  1087. XX   PRINT = lpr
  1088. XX
  1089. XX# Language and Parser generation Tools and their flags
  1090. XX   YACC      := yacc        # standard yacc
  1091. XX   YFLAGS  =
  1092. XX   YTAB      := y.tab        # yacc output files name stem.
  1093. XX
  1094. XX   LEX      := lex        # standard lex
  1095. XX   LFLAGS  =
  1096. XX   LEXYY  := lex.yy        # lex output file
  1097. XX
  1098. XX# Other Compilers, Tools and their flags
  1099. XX   PC    := pc            # pascal compiler
  1100. XX   RC    := f77            # ratfor compiler
  1101. XX   FC    := f77            # fortran compiler
  1102. XX
  1103. XX   CO       := co        # check out for RCS
  1104. XX   COFLAGS := -q
  1105. XX
  1106. XX   AR     := ar            # archiver
  1107. XX   ARFLAGS = ruv
  1108. XX
  1109. XX   RM       := /bin/rm        # remove a file command
  1110. XX   RMFLAGS  =
  1111. XX
  1112. XX# Implicit generation rules for making inferences.
  1113. XX# We don't provide .yr or .ye rules here.  They're obsolete.
  1114. XX# Rules for making *$O
  1115. XX   %$O : %.c ; $(CC) $(CFLAGS) -c $<
  1116. XX   %$O : %$P ; $(PC) $(PFLAGS) -c $<
  1117. XX   %$O : %$S ; $(AS) $<
  1118. XX   %$O : %.cl ; class -c $<
  1119. XX   %$O : %.e %.r %.F %$F
  1120. XX    $(FC) $(RFLAGS) $(EFLAGS) $(FFLAGS) -c $<
  1121. XX
  1122. XX# Executables
  1123. XX   %$E : %$O ; $(LD) $(LDFLAGS) -o $@ $< $(LDLIBES)
  1124. XX
  1125. XX# lex and yacc rules
  1126. XX   %.c : %.y ; $(YACC)  $(YFLAGS) $<; mv $(YTAB).c $@
  1127. XX   %.c : %.l ; $(LEX)   $(LFLAGS) $<; mv $(LEXYY).c $@
  1128. XX
  1129. XX# This rule tells how to make *.out from it's immediate list of prerequisites
  1130. XX# UNIX only.
  1131. XX   %.out :; $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
  1132. XX
  1133. XX# RCS support
  1134. XX.IF $(_HAVE_RCS)
  1135. XX   % : %$V $$(@:d)RCS/$$(@:f)$V;- $(CO) $(COFLAGS) $@
  1136. XX   .NOINFER : %$V $$(@:d)RCS/$$(@:f)$V
  1137. XX.END
  1138. XX
  1139. XX# SCCS support
  1140. XX.IF $(_HAVE_SCCS)
  1141. XX   % : s.% ; get $@
  1142. XX   .NOINFER : s.%
  1143. XX.END
  1144. XX
  1145. XX# Recipe to make archive files.
  1146. XX%$A :
  1147. XX[
  1148. XX   $(AR) $(ARFLAGS) $@ $?
  1149. XX   $(RM) $(RMFLAGS) $?
  1150. XX   ranlib $@
  1151. XX]
  1152. XX
  1153. XX# DMAKE uses this recipe to remove intermediate targets
  1154. XX.REMOVE :; $(RM) -f $<
  1155. XX
  1156. XX# AUGMAKE extensions for SYSV compatibility
  1157. XX@B = $(@:b)
  1158. XX@D = $(@:d)
  1159. XX@F = $(@:f)
  1160. XX*B = $(*:b)
  1161. XX*D = $(*:d)
  1162. XX*F = $(*:f)
  1163. XX<B = $(<:b)
  1164. XX<D = $(<:d)
  1165. XX<F = $(<:f)
  1166. XX?B = $(?:b)
  1167. XX?F = $(?:f)
  1168. XX?D = $(?:d)
  1169. XX
  1170. XX# Turn warnings back to previous setting.
  1171. XX.SILENT := $(__.SILENT)
  1172. XX
  1173. XX# Local startup file if any
  1174. XX.INCLUDE .IGNORE: "_startup.mk"
  1175. XSHAR_EOF
  1176. Xchmod 0640 unix/bsd43/vf/startup.mk || echo "restore of unix/bsd43/vf/startup.mk fails"
  1177. Xset `wc -c unix/bsd43/vf/startup.mk`;Sum=$1
  1178. Xif test "$Sum" != "3187"
  1179. Xthen echo original size 3187, current size $Sum;fi
  1180. Xsed 's/^X//' << 'SHAR_EOF' > unix/bsd43/vf/vfprintf.c &&
  1181. XX/*
  1182. XX * Copyright (c) 1988 Regents of the University of California.
  1183. XX * All rights reserved.
  1184. XX *
  1185. XX * Redistribution and use in source and binary forms are permitted
  1186. XX * provided that the above copyright notice and this paragraph are
  1187. XX * duplicated in all such forms and that any documentation,
  1188. XX * advertising materials, and other materials related to such
  1189. XX * distribution and use acknowledge that the software was developed
  1190. XX * by the University of California, Berkeley.  The name of the
  1191. XX * University may not be used to endorse or promote products derived
  1192. XX * from this software without specific prior written permission.
  1193. XX * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  1194. XX * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  1195. XX * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1196. XX */
  1197. XX
  1198. XX#if defined(LIBC_SCCS) && !defined(lint)
  1199. XXstatic char sccsid[] = "@(#)vfprintf.c    5.2 (Berkeley) 6/27/88";
  1200. XX#endif /* LIBC_SCCS and not lint */
  1201. XX
  1202. XX#include <stdio.h>
  1203. XX#include <varargs.h>
  1204. XX
  1205. XXint
  1206. XXvfprintf(iop, fmt, ap)
  1207. XX    FILE *iop;
  1208. XX    char *fmt;
  1209. XX    va_list ap;
  1210. XX{
  1211. XX    int len;
  1212. XX    char localbuf[BUFSIZ];
  1213. XX
  1214. XX    if (iop->_flag & _IONBF) {
  1215. XX        iop->_flag &= ~_IONBF;
  1216. XX        iop->_ptr = iop->_base = localbuf;
  1217. XX        len = _doprnt(fmt, ap, iop);
  1218. XX        (void) fflush(iop);
  1219. XX        iop->_flag |= _IONBF;
  1220. XX        iop->_base = NULL;
  1221. XX        iop->_bufsiz = 0;
  1222. XX        iop->_cnt = 0;
  1223. XX    } else
  1224. XX        len = _doprnt(fmt, ap, iop);
  1225. XX
  1226. XX    return (ferror(iop) ? EOF : len);
  1227. XX}
  1228. XX
  1229. XSHAR_EOF
  1230. Xchmod 0440 unix/bsd43/vf/vfprintf.c || echo "restore of unix/bsd43/vf/vfprintf.c fails"
  1231. Xset `wc -c unix/bsd43/vf/vfprintf.c`;Sum=$1
  1232. Xif test "$Sum" != "1409"
  1233. Xthen echo original size 1409, current size $Sum;fi
  1234. Xecho mkdir - unix/sysvr1
  1235. Xmkdir unix/sysvr1
  1236. Xsed 's/^X//' << 'SHAR_EOF' > unix/sysvr1/config.h &&
  1237. XX/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/sysvr1/RCS/config.h,v 1.1 90/07/31 11:00:15 dvadura Exp $
  1238. XX-- SYNOPSIS -- Configurarion include file.
  1239. XX-- 
  1240. XX-- DESCRIPTION
  1241. XX--     There is one of these for each specific machine configuration.
  1242. XX--    It can be used to further tweek the machine specific sources
  1243. XX--    so that they compile.
  1244. XX--
  1245. XX-- AUTHOR
  1246. XX--      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  1247. XX--      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  1248. XX--
  1249. XX-- COPYRIGHT
  1250. XX--      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  1251. XX-- 
  1252. XX--      This program is free software; you can redistribute it and/or
  1253. XX--      modify it under the terms of the GNU General Public License
  1254. XX--      (version 1), as published by the Free Software Foundation, and
  1255. XX--      found in the file 'LICENSE' included with this distribution.
  1256. XX-- 
  1257. XX--      This program is distributed in the hope that it will be useful,
  1258. XX--      but WITHOUT ANY WARRANTY; without even the implied warrant of
  1259. XX--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1260. XX--      GNU General Public License for more details.
  1261. XX-- 
  1262. XX--      You should have received a copy of the GNU General Public License
  1263. XX--      along with this program;  if not, write to the Free Software
  1264. XX--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1265. XX--
  1266. XX-- LOG
  1267. XX--     $Log:    config.h,v $
  1268. XX * Revision 1.1  90/07/31  11:00:15  dvadura
  1269. XX * Initial Revision Dmake 3.5
  1270. XX * 
  1271. XX*/
  1272. XX
  1273. XX/* define this for configurations that don't have the coreleft function
  1274. XX * so that the code compiles.  To my knowledge coreleft exists only on
  1275. XX * Turbo C, but it is needed here since the function is used in many debug
  1276. XX * macros. */
  1277. XX#define coreleft() 0L
  1278. SHAR_EOF
  1279. echo "End of part 1, continue with part 2"
  1280. echo "2" > s2_seq_.tmp
  1281. exit 0
  1282.  
  1283.