home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume19 / dmake / part31 < prev    next >
Encoding:
Text File  |  1991-05-13  |  40.2 KB  |  1,321 lines

  1. Newsgroups: comp.sources.misc
  2. From: Dennis Vadura <dvadura@watdragon.waterloo.edu>
  3. Subject:  v19i052:  dmake - dmake version 3.7, Part31/37
  4. Message-ID: <1991May13.145317.9613@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: c4c1a8543cde5d2ed0862da6cf65f86e
  6. Date: Mon, 13 May 1991 14:53:17 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Dennis Vadura <dvadura@watdragon.waterloo.edu>
  10. Posting-number: Volume 19, Issue 52
  11. Archive-name: dmake/part31
  12. Supersedes: dmake-3.6: Volume 15, Issue 52-77
  13.  
  14. ---- Cut Here and feed the following to sh ----
  15. #!/bin/sh
  16. # this is dmake.shar.31 (part 31 of a multipart archive)
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file dmake/sysintf.c continued
  19. #
  20. if test ! -r _shar_seq_.tmp; then
  21.     echo 'Please unpack part 1 first!'
  22.     exit 1
  23. fi
  24. (read Scheck
  25.  if test "$Scheck" != 31; then
  26.     echo Please unpack part "$Scheck" next!
  27.     exit 1
  28.  else
  29.     exit 0
  30.  fi
  31. ) < _shar_seq_.tmp || exit 1
  32. if test -f _shar_wnt_.tmp; then
  33. sed 's/^X//' << 'SHAR_EOF' >> 'dmake/sysintf.c' &&
  34. X     rem  = (prq->ce_flag & F_REMOVE) &&
  35. X        (prq->ce_flag & F_MADE  ) &&
  36. X        !(prq->ce_attr & A_PHONY) &&
  37. X        !(attr & A_PRECIOUS) &&
  38. X        !Force;
  39. X
  40. X     if( rem ) {
  41. X        CELLPTR tmp = prq;
  42. X        do {
  43. X           (Add_prerequisite(tcp,prq,FALSE,FALSE))->cl_flag |= F_TARGET;
  44. X           prq->ce_flag &= ~F_REMOVE;
  45. X           prq = prq->ce_all;
  46. X        }
  47. X        while( prq != NIL(CELL) && prq != tmp );
  48. X        flag = TRUE;
  49. X     }
  50. X      }
  51. X
  52. X      if( flag ) {
  53. X     Remove_prq( tcp );
  54. X
  55. X     for( dp=tcp->ce_prq; dp != NIL(LINK); dp=dp->cl_next ) {
  56. X        register CELLPTR prq = dp->cl_prq;
  57. X
  58. X        prq->ce_flag &= ~(F_MADE|F_VISITED|F_STAT);
  59. X        prq->ce_flag |= F_REMOVE;
  60. X        prq->ce_time  = (time_t)0L;
  61. X     }
  62. X      }
  63. X   }
  64. }
  65. SHAR_EOF
  66. chmod 0640 dmake/sysintf.c ||
  67. echo 'restore of dmake/sysintf.c failed'
  68. Wc_c="`wc -c < 'dmake/sysintf.c'`"
  69. test 14629 -eq "$Wc_c" ||
  70.     echo 'dmake/sysintf.c: original size 14629, current size' "$Wc_c"
  71. rm -f _shar_wnt_.tmp
  72. fi
  73. # ============= dmake/tos/arlib.c ==============
  74. if test ! -d 'dmake/tos'; then
  75.     mkdir 'dmake/tos'
  76. fi
  77. if test -f 'dmake/tos/arlib.c' -a X"$1" != X"-c"; then
  78.     echo 'x - skipping dmake/tos/arlib.c (File already exists)'
  79.     rm -f _shar_wnt_.tmp
  80. else
  81. > _shar_wnt_.tmp
  82. sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/arlib.c' &&
  83. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/tos/RCS/arlib.c,v 1.1 91/05/06 15:32:14 dvadura Exp $
  84. -- SYNOPSIS -- Unix archive manipulation code.
  85. -- 
  86. -- DESCRIPTION
  87. --     Originally this code was provided by Eric Gisin of MKS.  I took
  88. --    his code and completely rewrote it adding cacheing of lib members
  89. --    and other various optimizations.  I kept the overal functional
  90. --    idea of the library routines as they are similar to those in GNU
  91. --    make and felt it advantageous to maintain a similar interface.
  92. --
  93. -- AUTHOR
  94. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  95. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  96. --
  97. -- COPYRIGHT
  98. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  99. -- 
  100. --      This program is free software; you can redistribute it and/or
  101. --      modify it under the terms of the GNU General Public License
  102. --      (version 1), as published by the Free Software Foundation, and
  103. --      found in the file 'LICENSE' included with this distribution.
  104. -- 
  105. --      This program is distributed in the hope that it will be useful,
  106. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  107. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  108. --      GNU General Public License for more details.
  109. -- 
  110. --      You should have received a copy of the GNU General Public License
  111. --      along with this program;  if not, write to the Free Software
  112. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  113. --
  114. -- LOG
  115. --     $Log:    arlib.c,v $
  116. X * Revision 1.1  91/05/06  15:32:14  dvadura
  117. X * dmake Release Version 3.7
  118. X * 
  119. */
  120. X
  121. #include <ar.h>
  122. #include "extern.h"
  123. #include "sysintf.h"
  124. X
  125. /* By defining the defines below it is possible to configure the library
  126. X * code for library cacheing/non-cacheing, ASCII archive headers, and a full
  127. X * decode of the ar_hdr fields in the scan_ar function. */
  128. X
  129. #define ASCARCH            1    /* ASCII time stored in archive    */
  130. #define LC            1    /* Turn on library cacheing    */
  131. #define DECODE_ALL_AR_FIELDS    0    /* decode only fields make needs*/
  132. X
  133. #if LC
  134. #  define FOUND_MEMBER    FALSE
  135. #else
  136. #  define FOUND_MEMBER    TRUE
  137. #  define _cache_member(a, b, c)
  138. #  define _check_cache(a, b, c, d)    FALSE
  139. #endif
  140. X
  141. #define    MAXFNAME    32    /* Longest file name in archive    */
  142. #define    MAXMNAME    8    /* Max module name < MAXFNAME    */
  143. X
  144. X
  145. /* This struct is used to pass the library and member information about the
  146. X * routines that perform the library seeking/cacheing */
  147. struct ar_args {
  148. X   char   *lib;
  149. X   char   *member;
  150. X   time_t time;
  151. };
  152. X
  153. X
  154. typedef struct AR {
  155. X   char    ar_name[MAXFNAME+1];      /* File name */
  156. X   long    ar_size;                  /* Size in bytes */
  157. X   time_t  ar_time;                  /* Modification time */
  158. X
  159. #ifdef DOS
  160. X   char    ar_modname[MAXMNAME+1];   /* DOS module name */
  161. #endif
  162. X
  163. #if DECODE_ALL_AR_FIELDS
  164. X   uint16  ar_mode;                  /* File mode */
  165. X   uint16  ar_uid;                     /* File owner */
  166. X   uint16  ar_gid;                   /* File group owner */
  167. #endif
  168. } AR, *ARPTR;
  169. X
  170. X
  171. static int ar_scan  ANSI((FILE *,
  172. X              int (*) ANSI((FILE *, struct AR *, struct ar_args *)),
  173. X              struct ar_args *));
  174. static int ar_touch ANSI(( FILE *, time_t ));
  175. static int time_function  ANSI(( FILE *, struct AR *, struct ar_args * ));
  176. static int touch_function ANSI(( FILE *, struct AR *, struct ar_args * ));
  177. X
  178. #if LC
  179. static int _cache_member ANSI((char *, char *, time_t));
  180. static int _check_cache  ANSI((char *, char *, time_t *, int));
  181. #endif
  182. X
  183. /* decoded archive header */
  184. static AR _ar;
  185. X
  186. X
  187. PUBLIC time_t
  188. seek_arch(name, lib)/*
  189. ======================
  190. X   Look for module 'name' inside 'lib'.  If compiled with cacheing then first
  191. X   check to see if the specified lib is cached.  If so then return that time
  192. X   stamp instead of looking into the library. */
  193. char    *name;
  194. char     *lib;
  195. {
  196. X   FILE   *f;
  197. X   int    rv;
  198. X   time_t mtime;
  199. X   struct ar_args args;
  200. X
  201. X   /* Check the cache first (if there is a cache) */
  202. X   if( _check_cache(name, lib, &mtime, FALSE) )  return( mtime );
  203. X
  204. X   /* Open the lib file and perform the scan of the members, looking
  205. X    * for our particular member.  If cacheing is enabled it will be
  206. X    * taken care of automatically during the scan. */
  207. X
  208. X   args.lib    = lib;
  209. X   args.member = name;
  210. X   args.time   = (time_t)0L;
  211. X
  212. X   if( (f = fopen(lib, "rb")) == NIL(FILE) ) return( (time_t)0L );
  213. X   rv = ar_scan(f, time_function, &args );
  214. X   fclose( f );
  215. X
  216. X   if( rv < 0 ) Fatal("(%s): Invalid library format", lib);
  217. X
  218. X   return( args.time );
  219. }
  220. X
  221. X
  222. PUBLIC int
  223. touch_arch(name, lib)/*
  224. =======================
  225. X   Look for module 'name' inside 'lib'.  If compiled with cacheing then first
  226. X   check to see if the specified lib is cached.  If so then set that time
  227. X   stamp and write it into the library.  Returns 0 on success, non-zero
  228. X   on failure. */
  229. char   *name;
  230. char   *lib;
  231. {
  232. X   FILE   *f;
  233. X   int    rv;
  234. X   struct ar_args args;
  235. X
  236. X   /* Open the lib file and perform the scan of the members, looking
  237. X    * for our particular member.  If cacheing is enabled it will be
  238. X    * taken care of automatically during the scan. */
  239. X
  240. X   args.lib    = lib;
  241. X   args.member = name;
  242. X   args.time   = (time_t)0L;
  243. X
  244. X   if( (f = fopen(lib, "rb+")) == NIL(FILE) ) return( (time_t)1L );
  245. X   rv = ar_scan(f, touch_function, &args );
  246. X   fclose( f );
  247. X
  248. X   if( rv < 0 ) Fatal("(%s): Invalid library format", lib);
  249. X
  250. X   return( 0 );
  251. }
  252. X
  253. X
  254. X
  255. static int
  256. time_function(f, arp, argp)/*
  257. =============================
  258. X   get library member's time, if it matches than return it in argp, if
  259. X   cacheing is enabled than cache the library members also. */
  260. FILE           *f;      /* library file          */
  261. struct AR      *arp;    /* library member header */
  262. struct ar_args *argp;
  263. {
  264. X   int rv = _cache_member( arp->ar_name, argp->lib, arp->ar_time );
  265. X
  266. X   if( strcmp(argp->member, arp->ar_name) == 0 ) {
  267. X      argp->time = arp->ar_time;
  268. X
  269. X      if( arp->ar_time == 0 && !(Glob_attr & A_SILENT) )
  270. X         Warning( "(%s): Can't extract library member timestamp; using EPOCH",
  271. X              argp->member);
  272. X
  273. X      return( rv );  /* 1 => no cacheing, 0 => cacheing */
  274. X   }
  275. X
  276. X   return( FALSE ); /* continue scan */
  277. }
  278. X
  279. X
  280. X
  281. static int
  282. touch_function(f, arp, argp)/*
  283. ==============================
  284. X   Update library member's time stamp, and write new time value into cache
  285. X   if required. */
  286. FILE           *f;      /* library file */
  287. struct AR      *arp;    /* library member header */
  288. struct ar_args *argp;
  289. {
  290. X   extern time_t time ANSI(( time_t * ));
  291. X   time_t now = time((time_t*) NULL);  /* Current time.          */
  292. X
  293. X   if( strcmp(argp->member, arp->ar_name) == 0 ) {
  294. X      _check_cache( argp->member, argp->lib, &now, TRUE );
  295. X      ar_touch(f, now );
  296. X
  297. X      return( TRUE );
  298. X   }
  299. X
  300. X   return( FALSE ); /* continue scan */
  301. }
  302. X
  303. X
  304. X
  305. X
  306. static int
  307. ar_scan(f, function, arg)/*
  308. ===========================
  309. X   Scan the opened archive, and call the given function for each member found.
  310. X   The function will be called with the file positioned at the beginning of
  311. X   the member and it can read up to arp->ar_size bytes of the archive member.
  312. X   If the function returns 1, we stop and return 1.  We return 0 at the end
  313. X   of the archive, or -1 if the archive has invalid format.  This interface
  314. X   is more general than required by "make", but it can be used by other
  315. X   utilities.  */
  316. register FILE *f;
  317. int      (*function) ANSI((FILE *, struct AR *, struct ar_args *));
  318. struct ar_args *arg;
  319. {
  320. X   extern long atol ANSI((char *));
  321. X   register char *p;
  322. X   struct ar_hdr arhdr;   /* external archive header */
  323. X   off_t         offset;  /* member seek offset      */
  324. X
  325. #if ASCARCH
  326. X   char magic[SARMAG];
  327. #else
  328. X   unsigned short word;
  329. #endif
  330. X
  331. X   fseek( f, 0L, 0 );    /* Start at the beginning of the archive file */
  332. X
  333. #if ASCARCH
  334. X   fread( magic, sizeof(magic), 1, f );
  335. X   if( strncmp(magic, ARMAG, SARMAG) != 0 ) return( -1 );
  336. #else
  337. X   fread( (char*)&word, sizeof(word), 1, f );
  338. X   if( word != ARMAG ) return( -1 );
  339. #endif
  340. X
  341. X   /* scan the library, calling `function' for each member
  342. X    */
  343. X   while( 1 ) {
  344. X      if( fread((char*) &arhdr, sizeof(arhdr), 1, f) != 1 ) break;
  345. X      offset = ftell(f);
  346. X      strncpy(_ar.ar_name, arhdr.ar_name, sizeof(arhdr.ar_name));
  347. X
  348. X      for( p = &_ar.ar_name[sizeof(arhdr.ar_name)];
  349. X           --p >= _ar.ar_name && *p == ' ';);
  350. X
  351. X      p[1] = '\0';
  352. X      if( *p == '/' ) *p = 0;     /* Only SysV has trailing '/' */
  353. X
  354. #if ASCARCH
  355. X      if( strncmp(arhdr.ar_fmag, ARFMAG, sizeof(arhdr.ar_fmag)) != 0 )
  356. X         return( -1 );
  357. X      _ar.ar_time = atol(arhdr.ar_date);
  358. X      _ar.ar_size = atol(arhdr.ar_size);
  359. #else
  360. X      _ar.ar_time = arhdr.ar_date;
  361. X      _ar.ar_size = arhdr.ar_size;
  362. #endif
  363. X
  364. X
  365. #if DECODE_ALL_AR_FIELDS
  366. #if ASCARCH
  367. X      _ar.ar_mode = atoi(arhdr.ar_mode);
  368. X      _ar.ar_uid  = atoi(arhdr.ar_uid);
  369. X      _ar.ar_gid  = atoi(arhdr.ar_gid);
  370. #else
  371. X      _ar.ar_mode = arhdr.ar_mode;
  372. X      _ar.ar_size = arhdr.ar_size;
  373. X      _ar.ar_uid = arhdr.ar_uid;
  374. X      _ar.ar_gid = arhdr.ar_gid;
  375. #endif
  376. #endif
  377. X
  378. X      if( (*function)(f, &_ar, arg) ) return( 1 );
  379. X      fseek( f, offset + (_ar.ar_size+1 & ~1L), 0 );
  380. X   }
  381. X
  382. X   if( !feof(f) ) return( -1 );
  383. X   return 0;
  384. }
  385. X
  386. X
  387. X
  388. static int
  389. ar_touch( f, now )/*
  390. ====================
  391. X   touch module header timestamp. */
  392. FILE   *f;
  393. time_t now;
  394. {
  395. X   struct ar_hdr arhdr;                /* external archive header */
  396. X
  397. X   fseek(f, - (off_t) (sizeof(arhdr) - sizeof(arhdr.ar_name)), 1);
  398. X
  399. #if ASCARCH
  400. X   fprintf(f, "%lu", now);
  401. #else
  402. X   fwrite((char *)now, sizeof(now), 1, f);
  403. #endif
  404. X
  405. X   return( ferror(f) ? 0 : 1 );
  406. }
  407. X
  408. X
  409. #if LC
  410. typedef struct mem {
  411. X   time_t    m_time;        /* modify time of member*/
  412. X   struct mem    *m_next;    /* next member in lib    */
  413. X   char        m_valid;    /* valid cache entry    */
  414. X   char     m_name[1];    /* lib member name    */
  415. } MEM, *MEMPTR;
  416. X
  417. typedef struct lib {
  418. X   struct lib    *lb_next;    /* next library in list */
  419. X   struct mem    *lb_members;    /* list of lib members    */
  420. X   char        lb_valid;    /* valid cache entry    */
  421. X   char     *lb_name;    /* library name        */
  422. } LIB, *LIBPTR;
  423. X
  424. static LIBPTR _cache = NIL(LIB);
  425. static MEMPTR _find_member ANSI(( LIBPTR, char * ));
  426. X
  427. static int
  428. _check_cache( name, lib, pmtime, touch )/*
  429. ==========================================
  430. X   Check to see if we have cached member in lib, if so return time in pmtime
  431. X   and return TRUE, otherwise return FALSE, if touch is TRUE then touch
  432. X   the archive member instead. */
  433. char   *name;
  434. char   *lib;
  435. time_t *pmtime;
  436. int    touch;
  437. {
  438. X   register MEMPTR mp;
  439. X   register LIBPTR lp;
  440. X
  441. X   for( lp=_cache; lp != NIL(LIB) && lp->lb_name != lib; lp=lp->lb_next );
  442. X   if( lp == NIL(LIB) ) return( FALSE );
  443. X
  444. X   mp = _find_member( lp, name );
  445. X   if( mp == NIL(MEM) || !mp->m_valid ) return( FALSE );
  446. X
  447. X   if( touch == TRUE )
  448. X   {
  449. X      mp->m_time = *pmtime;
  450. X      mp->m_valid = 1;
  451. X   }
  452. X   else
  453. X      *pmtime = mp->m_time;
  454. X
  455. X   lp->lb_valid   = 1;
  456. X   lp->lb_members = mp;
  457. X
  458. X   return( TRUE );
  459. }
  460. X
  461. X
  462. X
  463. static int
  464. _cache_member( name, lib, mtime )/*
  465. ===================================
  466. X   Cache name in lib along with it's time */
  467. char   *name;
  468. char   *lib;
  469. time_t mtime;
  470. {
  471. X   register MEMPTR mp;
  472. X   register LIBPTR lp;
  473. X
  474. X   for( lp=_cache;
  475. X    lp != NIL(LIB) && lp->lb_name != NIL(char) && lp->lb_name != lib;
  476. X    lp=lp->lb_next);
  477. X
  478. X   if( lp == NIL(LIB) )
  479. X   {
  480. X      lp = (LIBPTR) malloc(sizeof(LIB));
  481. X      if( lp == NIL(LIB) ) No_ram();
  482. X
  483. X      lp->lb_name    = lib;
  484. X      lp->lb_members = NIL(MEM);
  485. X      lp->lb_next    = _cache;
  486. X      lp->lb_valid   = 0;
  487. X      _cache = lp;
  488. X   }
  489. X
  490. X   /* On UNIX ar does not allow multiple copies of the same .o file to live
  491. X    * in the same AR file.  If this is not TRUE then use the commented out
  492. X    * version to set the value of mp. */
  493. X
  494. X   /*mp = _find_member(lp, name);*/
  495. X   mp = NIL(MEM);
  496. X
  497. X   if( mp == NIL(MEM) )
  498. X   {
  499. X      mp = (MEMPTR) malloc(sizeof(char)*offsetof(MEM,m_name[strlen(name)+1]));
  500. X      if( mp == NIL(MEM) ) No_ram();
  501. X
  502. X      strcpy( mp->m_name, name );
  503. X      mp->m_time     = mtime;
  504. X
  505. X      if( lp->lb_members == NIL(MEM) ) {
  506. X     mp->m_next     = mp;
  507. X     lp->lb_members = mp;
  508. X      }
  509. X      else {
  510. X     mp->m_next = lp->lb_members->m_next;
  511. X     lp->lb_members->m_next = mp;
  512. X     lp->lb_members = mp;
  513. X      }
  514. X   }
  515. X   else
  516. X      mp->m_time = mtime;
  517. X
  518. X   mp->m_valid = 1;
  519. X
  520. X   return( lp->lb_valid );
  521. }
  522. X
  523. X
  524. static MEMPTR
  525. _find_member( lp, name )
  526. LIBPTR lp;
  527. char   *name;
  528. {
  529. X   register MEMPTR mp = lp->lb_members;
  530. X
  531. X   if( mp == NIL(MEM) ) return(mp);
  532. X
  533. X   do {
  534. X      if( !strcmp(mp->m_name, name ) ) return( mp );
  535. X      mp = mp->m_next;
  536. X   }
  537. X   while( mp != lp->lb_members );
  538. X
  539. X   return( NIL(MEM) );
  540. }
  541. #endif
  542. X
  543. X
  544. X
  545. void
  546. void_lcache( lib, member )/*
  547. ============================
  548. X   Void the library cache for lib.  If member is NIL(char) then nuke all
  549. X   of the members, if member is NOT NIL(char) then invalidate only that
  550. X   member. */
  551. char *lib;
  552. char *member;
  553. {
  554. #if LC
  555. X   register LIBPTR lp;
  556. X   register MEMPTR mp;
  557. X   register MEMPTR tmp;
  558. X
  559. X   for( lp=_cache; lp != NIL(LIB) && lp->lb_name != lib; lp=lp->lb_next );
  560. X   if( lp == NIL(LIB) ) return;
  561. X
  562. X   if( member == NIL(char) ) {
  563. X      mp = lp->lb_members;
  564. X      do {
  565. X     tmp = mp->m_next;
  566. X     (void) free( mp );
  567. X     mp = tmp;
  568. X      } while( mp != lp->lb_members );
  569. X
  570. X      lp->lb_valid   = 0;
  571. X      lp->lb_members = NIL(MEM);
  572. X      lp->lb_name    = NIL(char);
  573. X   }
  574. X   else {
  575. X      mp=lp->lb_members;
  576. X      do {
  577. X     if( strcmp( member, mp->m_name) == 0 ) {
  578. X        lp->lb_members = mp->m_next;
  579. X        mp->m_valid = 0;
  580. X     }
  581. X       
  582. X     mp=mp->m_next;
  583. X      } while( mp != lp->lb_members );
  584. X   }
  585. #endif
  586. }
  587. SHAR_EOF
  588. chmod 0640 dmake/tos/arlib.c ||
  589. echo 'restore of dmake/tos/arlib.c failed'
  590. Wc_c="`wc -c < 'dmake/tos/arlib.c'`"
  591. test 13294 -eq "$Wc_c" ||
  592.     echo 'dmake/tos/arlib.c: original size 13294, current size' "$Wc_c"
  593. rm -f _shar_wnt_.tmp
  594. fi
  595. # ============= dmake/tos/config.h ==============
  596. if test -f 'dmake/tos/config.h' -a X"$1" != X"-c"; then
  597.     echo 'x - skipping dmake/tos/config.h (File already exists)'
  598.     rm -f _shar_wnt_.tmp
  599. else
  600. > _shar_wnt_.tmp
  601. sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/config.h' &&
  602. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/tos/RCS/config.h,v 1.1 91/05/06 15:32:16 dvadura Exp $
  603. -- SYNOPSIS -- Configurarion include file.
  604. -- 
  605. -- DESCRIPTION
  606. --     There is one of these for each specific machine configuration.
  607. --    It can be used to further tweek the machine specific sources
  608. --    so that they compile.
  609. --
  610. -- AUTHOR
  611. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  612. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  613. --
  614. -- COPYRIGHT
  615. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  616. -- 
  617. --      This program is free software; you can redistribute it and/or
  618. --      modify it under the terms of the GNU General Public License
  619. --      (version 1), as published by the Free Software Foundation, and
  620. --      found in the file 'LICENSE' included with this distribution.
  621. -- 
  622. --      This program is distributed in the hope that it will be useful,
  623. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  624. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  625. --      GNU General Public License for more details.
  626. -- 
  627. --      You should have received a copy of the GNU General Public License
  628. --      along with this program;  if not, write to the Free Software
  629. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  630. --
  631. -- LOG
  632. --     $Log:    config.h,v $
  633. X * Revision 1.1  91/05/06  15:32:16  dvadura
  634. X * dmake Release Version 3.7
  635. X * 
  636. */
  637. X
  638. #include <osbind.h>
  639. X
  640. /* define this for configurations that don't have the coreleft function
  641. X * so that the code compiles.  To my knowledge coreleft exists only on
  642. X * Turbo C, but it is needed here since the function is used in many debug
  643. X * macros. */
  644. #define coreleft() Malloc(-1L)
  645. X
  646. /* Define the getcwd function that is used in the code, since BSD does
  647. X * not have getcwd, but call it getwd instead. */
  648. extern char *getcwd ANSI((char *, int));
  649. SHAR_EOF
  650. chmod 0640 dmake/tos/config.h ||
  651. echo 'restore of dmake/tos/config.h failed'
  652. Wc_c="`wc -c < 'dmake/tos/config.h'`"
  653. test 1874 -eq "$Wc_c" ||
  654.     echo 'dmake/tos/config.h: original size 1874, current size' "$Wc_c"
  655. rm -f _shar_wnt_.tmp
  656. fi
  657. # ============= dmake/tos/config.mk ==============
  658. if test -f 'dmake/tos/config.mk' -a X"$1" != X"-c"; then
  659.     echo 'x - skipping dmake/tos/config.mk (File already exists)'
  660.     rm -f _shar_wnt_.tmp
  661. else
  662. > _shar_wnt_.tmp
  663. sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/config.mk' &&
  664. # This is an OS specific configuration file
  665. #    It assumes that OBJDIR, TARGET and DEBUG are previously defined.
  666. #    It defines    CFLAGS, LDARGS, CPPFLAGS, STARTUPFILE, LDOBJS
  667. #            PRINTER, PRINTFLAGS
  668. #    It augments    SRC, OBJDIR, TARGET, CFLAGS, LDLIBS
  669. #
  670. PRINTER        = hw
  671. PRINTFLAGS    = -P$(PRINTER)
  672. STARTUPFILE    = $(OS)/startup.mk
  673. CPPFLAGS     = $(CFLAGS)
  674. LDOBJS        = $(CSTARTUP) $(OBJDIR)/{$(<:f)}
  675. LDARGS        = $(LDFLAGS) -o $@ $(OBJDIR)/*$O
  676. LDFLAGS           += -s
  677. LD        = $(CC)
  678. X
  679. # Debug flags
  680. DB_CFLAGS    = -g -DDBUG
  681. DB_LDFLAGS    = -g
  682. DB_LDLIBS    =
  683. X
  684. # NO Debug flags
  685. NDB_CFLAGS    = -O
  686. NDB_LDFLAGS    =
  687. NDB_LDLIBS    =
  688. X
  689. # Local configuration modifications for CFLAGS.
  690. CFLAGS         += -I$(OS)
  691. X
  692. # Sources that must be defined for each different version
  693. OS_SRC  += arlib.c ruletab.c runargv.c
  694. DOS_SRC  = rmprq.c runargv.c dirbrk.c rmprq.c
  695. UNIX_SRC = arlib.c
  696. BSD_SRC  = putenv.c tempnam.c
  697. X
  698. .SETDIR=$(OS) : $(OS_SRC)
  699. .SETDIR=msdos : $(DOS_SRC)
  700. .SETDIR=unix  : $(UNIX_SRC)
  701. .SETDIR=unix/bsd43 : $(BSD_SRC)
  702. X
  703. SRC += $(OS_SRC) $(DOS_SRC) $(UNIX_SRC) $(BSD_SRC)
  704. X
  705. # Set source dirs so that we can find files named in this
  706. # config file.
  707. .SOURCE.h : $(OS)
  708. X
  709. # See if we modify anything in the lower levels.
  710. .IF $(OSRELEASE) != $(NULL)
  711. X   .INCLUDE .IGNORE : $(OS)$(DIRSEPSTR)$(OSRELEASE)$(DIRSEPSTR)config.mk
  712. .END
  713. SHAR_EOF
  714. chmod 0640 dmake/tos/config.mk ||
  715. echo 'restore of dmake/tos/config.mk failed'
  716. Wc_c="`wc -c < 'dmake/tos/config.mk'`"
  717. test 1262 -eq "$Wc_c" ||
  718.     echo 'dmake/tos/config.mk: original size 1262, current size' "$Wc_c"
  719. rm -f _shar_wnt_.tmp
  720. fi
  721. # ============= dmake/tos/dirbrk.c ==============
  722. if test -f 'dmake/tos/dirbrk.c' -a X"$1" != X"-c"; then
  723.     echo 'x - skipping dmake/tos/dirbrk.c (File already exists)'
  724.     rm -f _shar_wnt_.tmp
  725. else
  726. > _shar_wnt_.tmp
  727. sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/dirbrk.c' &&
  728. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/tos/RCS/dirbrk.c,v 1.1 91/05/06 15:32:18 dvadura Exp $
  729. -- SYNOPSIS -- define the directory separator string.
  730. -- 
  731. -- DESCRIPTION
  732. --     Define this string for any character that may appear in a path name
  733. --    and can be used as a directory separator.  Also provide a function
  734. --    to indicate if a given path begins at the root of the file system.
  735. --
  736. -- AUTHOR
  737. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  738. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  739. --
  740. -- COPYRIGHT
  741. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  742. -- 
  743. --      This program is free software; you can redistribute it and/or
  744. --      modify it under the terms of the GNU General Public License
  745. --      (version 1), as published by the Free Software Foundation, and
  746. --      found in the file 'LICENSE' included with this distribution.
  747. -- 
  748. --      This program is distributed in the hope that it will be useful,
  749. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  750. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  751. --      GNU General Public License for more details.
  752. -- 
  753. --      You should have received a copy of the GNU General Public License
  754. --      along with this program;  if not, write to the Free Software
  755. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  756. --
  757. -- LOG
  758. --     $Log:    dirbrk.c,v $
  759. X * Revision 1.1  91/05/06  15:32:18  dvadura
  760. X * dmake Release Version 3.7
  761. X * 
  762. */
  763. X
  764. #include "extern.h"
  765. #include <ctype.h>
  766. X
  767. /* tos uses /, \, and : */
  768. char*    DirBrkStr = "/\\:";
  769. X
  770. /*
  771. ** Return TRUE if the name is the full specification of a path name to a file
  772. ** starting at the root of the file system, otherwise return FALSE
  773. */
  774. int
  775. If_root_path(name)
  776. char *name;
  777. {
  778. X   return( (strchr(DirBrkStr, *name) != NIL(char)) ||
  779. X           (isalpha(*name) && name[1] == ':') );
  780. }
  781. SHAR_EOF
  782. chmod 0640 dmake/tos/dirbrk.c ||
  783. echo 'restore of dmake/tos/dirbrk.c failed'
  784. Wc_c="`wc -c < 'dmake/tos/dirbrk.c'`"
  785. test 1881 -eq "$Wc_c" ||
  786.     echo 'dmake/tos/dirbrk.c: original size 1881, current size' "$Wc_c"
  787. rm -f _shar_wnt_.tmp
  788. fi
  789. # ============= dmake/tos/make.sh ==============
  790. if test -f 'dmake/tos/make.sh' -a X"$1" != X"-c"; then
  791.     echo 'x - skipping dmake/tos/make.sh (File already exists)'
  792.     rm -f _shar_wnt_.tmp
  793. else
  794. > _shar_wnt_.tmp
  795. sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/make.sh' &&
  796. mkdir objects
  797. gcc -c -I. -Itos -O infer.c
  798. mv infer.o objects
  799. gcc -c -I. -Itos -O make.c
  800. mv make.o objects
  801. gcc -c -I. -Itos -O stat.c
  802. mv stat.o objects
  803. gcc -c -I. -Itos -O expand.c
  804. mv expand.o objects
  805. gcc -c -I. -Itos -O dmstring.c
  806. mv dmstring.o objects
  807. gcc -c -I. -Itos -O hash.c
  808. mv hash.o objects
  809. gcc -c -I. -Itos -O dag.c
  810. mv dag.o objects
  811. gcc -c -I. -Itos -O dmake.c
  812. mv dmake.o objects
  813. gcc -c -I. -Itos -O path.c
  814. mv path.o objects
  815. gcc -c -I. -Itos -O imacs.c
  816. mv imacs.o objects
  817. gcc -c -I. -Itos -O sysintf.c
  818. mv sysintf.o objects
  819. gcc -c -I. -Itos -O parse.c
  820. mv parse.o objects
  821. gcc -c -I. -Itos -O getinp.c
  822. mv getinp.o objects
  823. gcc -c -I. -Itos -O quit.c
  824. mv quit.o objects
  825. gcc -c -I. -Itos -O state.c
  826. mv state.o objects
  827. gcc -c -I. -Itos -O basename.c
  828. mv basename.o objects
  829. gcc -c -I. -Itos -O dmdump.c
  830. mv dmdump.o objects
  831. gcc -c -I. -Itos -O macparse.c
  832. mv macparse.o objects
  833. gcc -c -I. -Itos -O rulparse.c
  834. mv rulparse.o objects
  835. gcc -c -I. -Itos -O percent.c
  836. mv percent.o objects
  837. gcc -c -I. -Itos -O function.c
  838. mv function.o objects
  839. gcc -c -I. -Itos -O tos/arlib.c
  840. mv arlib.o objects
  841. gcc -c -I. -Itos -O tos/ruletab.c
  842. mv ruletab.o objects
  843. gcc -c -I. -Itos -O tos/runargv.c
  844. mv runargv.o objects
  845. gcc -c -I. -Itos -O msdos/rmprq.c
  846. mv rmprq.o objects
  847. gcc -c -I. -Itos -O msdos/dirbrk.c
  848. mv dirbrk.o objects
  849. gcc -c -I. -Itos -O unix/bsd43/putenv.c
  850. mv putenv.o objects
  851. gcc -c -I. -Itos -O unix/bsd43/tempnam.c
  852. mv tempnam.o objects
  853. gcc -s  -o dmake objects/*.o
  854. cp tos/startup.mk startup.mk
  855. SHAR_EOF
  856. chmod 0640 dmake/tos/make.sh ||
  857. echo 'restore of dmake/tos/make.sh failed'
  858. Wc_c="`wc -c < 'dmake/tos/make.sh'`"
  859. test 1480 -eq "$Wc_c" ||
  860.     echo 'dmake/tos/make.sh: original size 1480, current size' "$Wc_c"
  861. rm -f _shar_wnt_.tmp
  862. fi
  863. # ============= dmake/tos/public.h ==============
  864. if test -f 'dmake/tos/public.h' -a X"$1" != X"-c"; then
  865.     echo 'x - skipping dmake/tos/public.h (File already exists)'
  866.     rm -f _shar_wnt_.tmp
  867. else
  868. > _shar_wnt_.tmp
  869. sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/public.h' &&
  870. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/tos/RCS/public.h,v 1.1 91/05/06 15:32:18 dvadura Exp Locker: dvadura $
  871. -- WARNING  -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT
  872. --
  873. -- SYNOPSIS -- Local functions exported to be visible by others.
  874. --
  875. -- DESCRIPTION
  876. --      This file is generated by 'genpub'.  Function declarations
  877. --      that appear in this file are extracted by 'genpub' from
  878. --      source files.  Any function in the source file whose definition
  879. --      appears like:
  880. --
  881. --          PUBLIC return_type
  882. --          function( arg_list );
  883. --          type_expr1 arg1;
  884. --          ...
  885. --
  886. --      has its definition extracted and a line of the form:
  887. --
  888. --          return_type function ANSI((type_expr1,type_expr2,...));
  889. --
  890. --      entered into the output file.
  891. --
  892. -- AUTHOR
  893. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  894. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  895. --
  896. -- COPYRIGHT
  897. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  898. -- 
  899. --      This program is free software; you can redistribute it and/or
  900. --      modify it under the terms of the GNU General Public License
  901. --      (version 1), as published by the Free Software Foundation, and
  902. --      found in the file 'LICENSE' included with this distribution.
  903. -- 
  904. --      This program is distributed in the hope that it will be useful,
  905. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  906. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  907. --      GNU General Public License for more details.
  908. -- 
  909. --      You should have received a copy of the GNU General Public License
  910. --      along with this program;  if not, write to the Free Software
  911. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  912. --
  913. -- LOG
  914. --     $Log:    public.h,v $
  915. X * Revision 1.1  91/05/06  15:32:18  dvadura
  916. X * dmake Release Version 3.7
  917. X * 
  918. */
  919. X
  920. #ifndef _DMAKE_PUBLIC_h
  921. #define _DMAKE_PUBLIC_h
  922. X
  923. void Infer_recipe ANSI((CELLPTR, CELLPTR));
  924. int Make_targets ANSI(());
  925. int Exec_commands ANSI((CELLPTR));
  926. void Pop_dir ANSI((int));
  927. void Append_line ANSI((char *, int, FILE *, char *, int, int));
  928. void Stat_target ANSI((CELLPTR, int));
  929. char * Expand ANSI((char *));
  930. char * Apply_edit ANSI((char *, char *, char *, int, int));
  931. void Map_esc ANSI((char *));
  932. char* Apply_modifiers ANSI((int, char *));
  933. char* Tokenize ANSI((char *, char *));
  934. char * _strjoin ANSI((char *, char *, int, int));
  935. char * _stradd ANSI((char *, char *, int));
  936. char * _strapp ANSI((char *, char *));
  937. char * _strdup ANSI((char *));
  938. char * _strpbrk ANSI((char *, char *));
  939. char * _strspn ANSI((char *, char *));
  940. char * _strstr ANSI((char *, char *));
  941. char * _substr ANSI((char *, char *));
  942. uint16 Hash ANSI((char *, uint32 *));
  943. HASHPTR Get_name ANSI((char *, HASHPTR *, int));
  944. HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *));
  945. HASHPTR Def_macro ANSI((char *, char *, int));
  946. CELLPTR Def_cell ANSI((char *));
  947. LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int));
  948. void Clear_prerequisites ANSI((CELLPTR));
  949. int Test_circle ANSI((CELLPTR, int));
  950. STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int));
  951. t_attr Rcp_attribute ANSI((char *));
  952. int main ANSI((int, char **));
  953. FILE * Openfile ANSI((char *, int, int));
  954. FILE * Closefile ANSI(());
  955. FILE * Search_file ANSI((char *, char **));
  956. char * Filename ANSI(());
  957. void No_ram ANSI(());
  958. int Usage ANSI((int));
  959. int Version ANSI(());
  960. char * Get_suffix ANSI((char *));
  961. char * Build_path ANSI((char *, char *));
  962. void Make_rules ANSI(());
  963. void Create_macro_vars ANSI(());
  964. time_t Do_stat ANSI((char *, char *, char **));
  965. int Do_touch ANSI((char *, char *, char **));
  966. void Void_lib_cache ANSI((char *, char *));
  967. time_t Do_time ANSI(());
  968. int Do_cmnd ANSI((char *, int, int, CELLPTR, int, int, int));
  969. char ** Pack_argv ANSI((int, int, char *));
  970. char * Read_env_string ANSI((char *));
  971. int Write_env_string ANSI((char *, char *));
  972. void ReadEnvironment ANSI(());
  973. void Catch_signals ANSI((void (*)()));
  974. void Clear_signals ANSI(());
  975. void Prolog ANSI((int, char* []));
  976. void Epilog ANSI((int));
  977. char * Get_current_dir ANSI(());
  978. int Set_dir ANSI((char*));
  979. char Get_switch_char ANSI(());
  980. FILE* Get_temp ANSI((char **, char *, int));
  981. FILE * Start_temp ANSI((char *, CELLPTR, char **));
  982. void Open_temp_error ANSI((char *, char *));
  983. void Link_temp ANSI((CELLPTR, FILE *, char *));
  984. void Close_temp ANSI((CELLPTR, FILE *));
  985. void Unlink_temp_files ANSI((CELLPTR));
  986. void Handle_result ANSI((int, int, int, CELLPTR));
  987. void Update_time_stamp ANSI((CELLPTR));
  988. void Parse ANSI((FILE *));
  989. int Get_line ANSI((char *, FILE *));
  990. char * Do_comment ANSI((char *, char **, int));
  991. char * Get_token ANSI((TKSTRPTR, char *, int));
  992. void Quit ANSI(());
  993. void Read_state ANSI(());
  994. void Write_state ANSI(());
  995. int Check_state ANSI((CELLPTR, STRINGPTR *, int));
  996. char* basename ANSI((char *));
  997. void Dump ANSI(());
  998. void Dump_recipe ANSI((STRINGPTR));
  999. int Parse_macro ANSI((char *, int));
  1000. int Macro_op ANSI((char *));
  1001. int Parse_rule_def ANSI((int *));
  1002. int Rule_op ANSI((char *));
  1003. void Add_recipe_to_list ANSI((char *, int, int));
  1004. void Bind_rules_to_targets ANSI((int));
  1005. int Set_group_attributes ANSI((char *));
  1006. DFALINKPTR Match_dfa ANSI((char *));
  1007. void Check_circle_dfa ANSI(());
  1008. void Add_nfa ANSI((char *));
  1009. char * Exec_function ANSI((char *));
  1010. time_t seek_arch ANSI((char *, char *));
  1011. int touch_arch ANSI((char *, char *));
  1012. int runargv ANSI((CELLPTR, int, int, int, int, char *));
  1013. void Clean_up_processes ANSI(());
  1014. int Wait_for_child ANSI((int, int));
  1015. void Remove_prq ANSI((CELLPTR));
  1016. int If_root_path ANSI((char *));
  1017. X
  1018. #endif
  1019. SHAR_EOF
  1020. chmod 0640 dmake/tos/public.h ||
  1021. echo 'restore of dmake/tos/public.h failed'
  1022. Wc_c="`wc -c < 'dmake/tos/public.h'`"
  1023. test 5553 -eq "$Wc_c" ||
  1024.     echo 'dmake/tos/public.h: original size 5553, current size' "$Wc_c"
  1025. rm -f _shar_wnt_.tmp
  1026. fi
  1027. # ============= dmake/tos/putenv.c ==============
  1028. if test -f 'dmake/tos/putenv.c' -a X"$1" != X"-c"; then
  1029.     echo 'x - skipping dmake/tos/putenv.c (File already exists)'
  1030.     rm -f _shar_wnt_.tmp
  1031. else
  1032. > _shar_wnt_.tmp
  1033. sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/putenv.c' &&
  1034. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/tos/RCS/putenv.c,v 1.1 91/05/06 15:32:19 dvadura Exp $
  1035. -- SYNOPSIS -- my own putenv for BSD like systems.
  1036. -- 
  1037. -- DESCRIPTION
  1038. --     This originally came from MKS, but I rewrote it to fix a bug with
  1039. --    replacing existing strings, probably never happened but the code
  1040. --    was wrong nonetheless.
  1041. --
  1042. -- AUTHOR
  1043. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  1044. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  1045. --
  1046. -- COPYRIGHT
  1047. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  1048. -- 
  1049. --      This program is free software; you can redistribute it and/or
  1050. --      modify it under the terms of the GNU General Public License
  1051. --      (version 1), as published by the Free Software Foundation, and
  1052. --      found in the file 'LICENSE' included with this distribution.
  1053. -- 
  1054. --      This program is distributed in the hope that it will be useful,
  1055. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  1056. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1057. --      GNU General Public License for more details.
  1058. -- 
  1059. --      You should have received a copy of the GNU General Public License
  1060. --      along with this program;  if not, write to the Free Software
  1061. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1062. --
  1063. -- LOG
  1064. --     $Log:    putenv.c,v $
  1065. X * Revision 1.1  91/05/06  15:32:19  dvadura
  1066. X * dmake Release Version 3.7
  1067. X * 
  1068. */
  1069. X
  1070. #include <stdio.h>
  1071. #include <string.h>
  1072. X
  1073. int
  1074. putenv( str )/*
  1075. ===============
  1076. X   Take a string of the form NAME=value and stick it into the environment.
  1077. X   We do this by allocating a new set of pointers if we have to add a new
  1078. X   string and by replacing an existing pointer if the value replaces the value
  1079. X   of an existing string. */
  1080. char *str;
  1081. {
  1082. X   extern char **environ;        /* The current environment. */
  1083. X   static char **ourenv = NULL;        /* A new environment        */
  1084. X   register char **p;
  1085. X   register char *q;
  1086. X   int      size;
  1087. X
  1088. X   /* First search the current environment and see if we can replace a
  1089. X    * string. */
  1090. X   for( p=environ; *p; p++ ) {
  1091. X      register char *s = str;
  1092. X
  1093. X      for( q = *p; *q && *s && *s == *q; q++, s++ )
  1094. X     if( *s == '=' ) {
  1095. X        *p = str;
  1096. X        return(0);            /* replaced it so go away */
  1097. X     }
  1098. X   }
  1099. X
  1100. X   /* Ok, can't replace a string so need to grow the environment. */
  1101. X   size = p - environ + 2;    /* size of new environment */
  1102. X                /* size of old is size-1   */
  1103. X
  1104. X   /* It's the first time, so allocate a new environment since we don't know
  1105. X    * where the old one is comming from. */
  1106. X   if( ourenv == NULL ) {
  1107. X      if( (ourenv = (char **) malloc( sizeof(char *)*size )) == NULL )
  1108. X     return(1);
  1109. X
  1110. X      memcpy( (char *)ourenv, (char *)environ, (size-2)*sizeof(char *) );
  1111. X   }
  1112. X   else if( (ourenv = (char **)realloc( ourenv, size*sizeof(char *))) == NULL )
  1113. X      return(1);
  1114. X
  1115. X   ourenv[--size] = NULL;
  1116. X   ourenv[--size] = str;
  1117. X
  1118. X   environ = ourenv;
  1119. X   return(0);
  1120. }
  1121. SHAR_EOF
  1122. chmod 0640 dmake/tos/putenv.c ||
  1123. echo 'restore of dmake/tos/putenv.c failed'
  1124. Wc_c="`wc -c < 'dmake/tos/putenv.c'`"
  1125. test 2923 -eq "$Wc_c" ||
  1126.     echo 'dmake/tos/putenv.c: original size 2923, current size' "$Wc_c"
  1127. rm -f _shar_wnt_.tmp
  1128. fi
  1129. # ============= dmake/tos/rmprq.c ==============
  1130. if test -f 'dmake/tos/rmprq.c' -a X"$1" != X"-c"; then
  1131.     echo 'x - skipping dmake/tos/rmprq.c (File already exists)'
  1132.     rm -f _shar_wnt_.tmp
  1133. else
  1134. > _shar_wnt_.tmp
  1135. sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/rmprq.c' &&
  1136. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/tos/RCS/rmprq.c,v 1.1 91/05/06 15:32:20 dvadura Exp $
  1137. -- SYNOPSIS -- remove prerequisites code.
  1138. -- 
  1139. -- DESCRIPTION
  1140. --    This code is different for DOS and for UNIX and parallel make
  1141. --    architectures since the parallel case requires the rm's to be
  1142. --    run in parallel, whereas DOS guarantees to run them sequentially.
  1143. -- 
  1144. -- AUTHOR
  1145. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  1146. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  1147. --
  1148. -- COPYRIGHT
  1149. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  1150. -- 
  1151. --      This program is free software; you can redistribute it and/or
  1152. --      modify it under the terms of the GNU General Public License
  1153. --      (version 1), as published by the Free Software Foundation, and
  1154. --      found in the file 'LICENSE' included with this distribution.
  1155. -- 
  1156. --      This program is distributed in the hope that it will be useful,
  1157. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  1158. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1159. --      GNU General Public License for more details.
  1160. -- 
  1161. --      You should have received a copy of the GNU General Public License
  1162. --      along with this program;  if not, write to the Free Software
  1163. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1164. --
  1165. -- LOG
  1166. --     $Log:    rmprq.c,v $
  1167. X * Revision 1.1  91/05/06  15:32:20  dvadura
  1168. X * dmake Release Version 3.7
  1169. X * 
  1170. */
  1171. X
  1172. #include "extern.h"
  1173. #include "alloc.h"
  1174. X
  1175. void
  1176. Remove_prq( tcp )
  1177. CELLPTR tcp;
  1178. {
  1179. X   tcp->ce_flag         &= ~(F_MADE|F_VISITED);
  1180. X   tcp->CE_HOW->hw_flag &= ~(F_MADE|F_VISITED);
  1181. X   tcp->ce_time          = 0L;
  1182. X
  1183. X   Make( tcp, tcp->CE_HOW, NIL(CELL) );
  1184. }
  1185. SHAR_EOF
  1186. chmod 0640 dmake/tos/rmprq.c ||
  1187. echo 'restore of dmake/tos/rmprq.c failed'
  1188. Wc_c="`wc -c < 'dmake/tos/rmprq.c'`"
  1189. test 1716 -eq "$Wc_c" ||
  1190.     echo 'dmake/tos/rmprq.c: original size 1716, current size' "$Wc_c"
  1191. rm -f _shar_wnt_.tmp
  1192. fi
  1193. # ============= dmake/tos/ruletab.c ==============
  1194. if test -f 'dmake/tos/ruletab.c' -a X"$1" != X"-c"; then
  1195.     echo 'x - skipping dmake/tos/ruletab.c (File already exists)'
  1196.     rm -f _shar_wnt_.tmp
  1197. else
  1198. > _shar_wnt_.tmp
  1199. sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/ruletab.c' &&
  1200. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/tos/RCS/ruletab.c,v 1.1 91/05/06 15:32:21 dvadura Exp $
  1201. -- SYNOPSIS -- Default initial configuration of dmake.
  1202. -- 
  1203. -- DESCRIPTION
  1204. --     Define here the initial set of rules that are defined before
  1205. --    dmake performs any processing.
  1206. --
  1207. -- AUTHOR
  1208. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  1209. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  1210. --
  1211. -- COPYRIGHT
  1212. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  1213. -- 
  1214. --      This program is free software; you can redistribute it and/or
  1215. --      modify it under the terms of the GNU General Public License
  1216. --      (version 1), as published by the Free Software Foundation, and
  1217. --      found in the file 'LICENSE' included with this distribution.
  1218. -- 
  1219. --      This program is distributed in the hope that it will be useful,
  1220. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  1221. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1222. --      GNU General Public License for more details.
  1223. -- 
  1224. --      You should have received a copy of the GNU General Public License
  1225. --      along with this program;  if not, write to the Free Software
  1226. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1227. --
  1228. -- LOG
  1229. --     $Log:    ruletab.c,v $
  1230. X * Revision 1.1  91/05/06  15:32:21  dvadura
  1231. X * dmake Release Version 3.7
  1232. X * 
  1233. */
  1234. X
  1235. /* These are control macros for dmake that MUST be defined at some point
  1236. X * if they are NOT dmake will not work!  These are default definitions.  They
  1237. X * may be overridden inside the .STARTUP makefile, they are here
  1238. X * strictly so that dmake can parse the STARTUP makefile */
  1239. X
  1240. static char *_rules[] = {
  1241. X    "MAXPROCESSLIMIT := 1",
  1242. X    "MAXPROCESS := 1",
  1243. X    "MAXLINELENGTH := 8190",
  1244. X    ".IMPORT .IGNORE: ROOTDIR",
  1245. X    ".MAKEFILES : makefile.mk Makefile makefile",
  1246. X    ".SOURCE    : .NULL",
  1247. #include "startup.h"
  1248. X    0 };
  1249. X
  1250. char **Rule_tab = _rules; /* for sundry reasons in Get_environment() */
  1251. SHAR_EOF
  1252. chmod 0640 dmake/tos/ruletab.c ||
  1253. echo 'restore of dmake/tos/ruletab.c failed'
  1254. Wc_c="`wc -c < 'dmake/tos/ruletab.c'`"
  1255. test 1957 -eq "$Wc_c" ||
  1256.     echo 'dmake/tos/ruletab.c: original size 1957, current size' "$Wc_c"
  1257. rm -f _shar_wnt_.tmp
  1258. fi
  1259. # ============= dmake/tos/runargv.c ==============
  1260. if test -f 'dmake/tos/runargv.c' -a X"$1" != X"-c"; then
  1261.     echo 'x - skipping dmake/tos/runargv.c (File already exists)'
  1262.     rm -f _shar_wnt_.tmp
  1263. else
  1264. > _shar_wnt_.tmp
  1265. sed 's/^X//' << 'SHAR_EOF' > 'dmake/tos/runargv.c' &&
  1266. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/tos/RCS/runargv.c,v 1.1 91/05/06 15:32:22 dvadura Exp $
  1267. -- SYNOPSIS -- run a sub process.
  1268. -- 
  1269. -- DESCRIPTION
  1270. --    Use spawn to run a subprocess.
  1271. --
  1272. -- AUTHOR
  1273. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  1274. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  1275. --
  1276. -- COPYRIGHT
  1277. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  1278. -- 
  1279. --      This program is free software; you can redistribute it and/or
  1280. --      modify it under the terms of the GNU General Public License
  1281. --      (version 1), as published by the Free Software Foundation, and
  1282. --      found in the file 'LICENSE' included with this distribution.
  1283. -- 
  1284. --      This program is distributed in the hope that it will be useful,
  1285. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  1286. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1287. --      GNU General Public License for more details.
  1288. -- 
  1289. --      You should have received a copy of the GNU General Public License
  1290. --      along with this program;  if not, write to the Free Software
  1291. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1292. --
  1293. -- LOG
  1294. --     $Log:    runargv.c,v $
  1295. X * Revision 1.1  91/05/06  15:32:22  dvadura
  1296. X * dmake Release Version 3.7
  1297. X * 
  1298. */
  1299. X
  1300. #include <process.h>
  1301. #include <errno.h>
  1302. #include "extern.h"
  1303. #include "sysintf.h"
  1304. X
  1305. static int  _abort_flg = FALSE;
  1306. static void _add_child ANSI((CELLPTR, int));
  1307. static void _finished_child ANSI((int));
  1308. SHAR_EOF
  1309. true || echo 'restore of dmake/tos/runargv.c failed'
  1310. fi
  1311. echo 'End of part 31, continue with part 32'
  1312. echo 32 > _shar_seq_.tmp
  1313. exit 0
  1314.  
  1315. exit 0 # Just in case...
  1316. -- 
  1317. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1318. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1319. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1320. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1321.