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

  1. Newsgroups: comp.sources.misc
  2. From: Dennis Vadura <dvadura@watdragon.waterloo.edu>
  3. Subject:  v19i054:  dmake - dmake version 3.7, Part33/37
  4. Message-ID: <1991May13.145355.9748@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 33503e966b8fdf28d41f06e9ca3a7780
  6. Date: Mon, 13 May 1991 14:53:55 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Dennis Vadura <dvadura@watdragon.waterloo.edu>
  10. Posting-number: Volume 19, Issue 54
  11. Archive-name: dmake/part33
  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.33 (part 33 of a multipart archive)
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file dmake/unix/arlib.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" != 33; 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/unix/arlib.c' &&
  34. X
  35. X   fseek(f, arhdroffset + (unsigned long)(((struct ar_hdr *)0)->ar_date), 0);
  36. X
  37. #if ASCARCH
  38. X   fprintf(f, "%lu", now);
  39. #else
  40. X   fwrite((char *)now, sizeof(now), 1, f);
  41. #endif
  42. X
  43. X   return( ferror(f) ? 0 : 1 );
  44. }
  45. X
  46. X
  47. #if LC
  48. typedef struct mem {
  49. X   time_t    m_time;        /* modify time of member*/
  50. X   struct mem    *m_next;    /* next member in lib    */
  51. X   char        m_valid;    /* valid cache entry    */
  52. X   char     m_name[1];    /* lib member name    */
  53. } MEM, *MEMPTR;
  54. X
  55. typedef struct lib {
  56. X   struct lib    *lb_next;    /* next library in list */
  57. X   struct mem    *lb_members;    /* list of lib members    */
  58. X   char        lb_valid;    /* valid cache entry    */
  59. X   char     *lb_name;    /* library name        */
  60. } LIB, *LIBPTR;
  61. X
  62. static LIBPTR _cache = NIL(LIB);
  63. static MEMPTR _find_member ANSI(( LIBPTR, char * ));
  64. X
  65. static int
  66. _check_cache( name, lib, pmtime, touch )/*
  67. ==========================================
  68. X   Check to see if we have cached member in lib, if so return time in pmtime
  69. X   and return TRUE, otherwise return FALSE, if touch is TRUE then touch
  70. X   the archive member instead. */
  71. char   *name;
  72. char   *lib;
  73. time_t *pmtime;
  74. int    touch;
  75. {
  76. X   register MEMPTR mp;
  77. X   register LIBPTR lp;
  78. X
  79. X   for( lp=_cache; lp != NIL(LIB) && lp->lb_name != lib; lp=lp->lb_next );
  80. X   if( lp == NIL(LIB) ) return( FALSE );
  81. X
  82. X   mp = _find_member( lp, name );
  83. X   if( mp == NIL(MEM) || !mp->m_valid ) return( FALSE );
  84. X
  85. X   if( touch == TRUE )
  86. X   {
  87. X      mp->m_time = *pmtime;
  88. X      mp->m_valid = 1;
  89. X   }
  90. X   else
  91. X      *pmtime = mp->m_time;
  92. X
  93. X   lp->lb_valid   = 1;
  94. X   lp->lb_members = mp;
  95. X
  96. X   return( TRUE );
  97. }
  98. X
  99. X
  100. X
  101. static int
  102. _cache_member( name, lib, mtime )/*
  103. ===================================
  104. X   Cache name in lib along with it's time */
  105. char   *name;
  106. char   *lib;
  107. time_t mtime;
  108. {
  109. X   register MEMPTR mp;
  110. X   register LIBPTR lp;
  111. X
  112. X   for( lp=_cache;
  113. X    lp != NIL(LIB) && lp->lb_name != NIL(char) && lp->lb_name != lib;
  114. X    lp=lp->lb_next);
  115. X
  116. X   if( lp == NIL(LIB) )
  117. X   {
  118. X      lp = (LIBPTR) malloc(sizeof(LIB));
  119. X      if( lp == NIL(LIB) ) No_ram();
  120. X
  121. X      lp->lb_name    = lib;
  122. X      lp->lb_members = NIL(MEM);
  123. X      lp->lb_next    = _cache;
  124. X      lp->lb_valid   = 0;
  125. X      _cache = lp;
  126. X   }
  127. X
  128. X   /* On UNIX ar does not allow multiple copies of the same .o file to live
  129. X    * in the same AR file.  If this is not TRUE then use the commented out
  130. X    * version to set the value of mp. */
  131. X
  132. X   /*mp = _find_member(lp, name);*/
  133. X   mp = NIL(MEM);
  134. X
  135. X   if( mp == NIL(MEM) )
  136. X   {
  137. X      mp = (MEMPTR) malloc(sizeof(char)*offsetof(MEM,m_name[strlen(name)+1]));
  138. X      if( mp == NIL(MEM) ) No_ram();
  139. X
  140. X      strcpy( mp->m_name, name );
  141. X      mp->m_time     = mtime;
  142. X
  143. X      if( lp->lb_members == NIL(MEM) ) {
  144. X     mp->m_next     = mp;
  145. X     lp->lb_members = mp;
  146. X      }
  147. X      else {
  148. X     mp->m_next = lp->lb_members->m_next;
  149. X     lp->lb_members->m_next = mp;
  150. X     lp->lb_members = mp;
  151. X      }
  152. X   }
  153. X   else
  154. X      mp->m_time = mtime;
  155. X
  156. X   mp->m_valid = 1;
  157. X
  158. X   return( lp->lb_valid );
  159. }
  160. X
  161. X
  162. static MEMPTR
  163. _find_member( lp, name )
  164. LIBPTR lp;
  165. char   *name;
  166. {
  167. X   register MEMPTR mp = lp->lb_members;
  168. X
  169. X   if( mp == NIL(MEM) ) return(mp);
  170. X
  171. X   do {
  172. X      if( !strcmp(mp->m_name, name ) ) return( mp );
  173. X      mp = mp->m_next;
  174. X   }
  175. X   while( mp != lp->lb_members );
  176. X
  177. X   return( NIL(MEM) );
  178. }
  179. #endif
  180. X
  181. X
  182. X
  183. void
  184. void_lcache( lib, member )/*
  185. ============================
  186. X   Void the library cache for lib.  If member is NIL(char) then nuke all
  187. X   of the members, if member is NOT NIL(char) then invalidate only that
  188. X   member. */
  189. char *lib;
  190. char *member;
  191. {
  192. #if LC
  193. X   register LIBPTR lp;
  194. X   register MEMPTR mp;
  195. X   register MEMPTR tmp;
  196. X
  197. X   for( lp=_cache; lp != NIL(LIB) && lp->lb_name != lib; lp=lp->lb_next );
  198. X   if( lp == NIL(LIB) ) return;
  199. X
  200. X   if( member == NIL(char) ) {
  201. X      mp = lp->lb_members;
  202. X      do {
  203. X     tmp = mp->m_next;
  204. X     (void) free( mp );
  205. X     mp = tmp;
  206. X      } while( mp != lp->lb_members );
  207. X
  208. X      lp->lb_valid   = 0;
  209. X      lp->lb_members = NIL(MEM);
  210. X      lp->lb_name    = NIL(char);
  211. X   }
  212. X   else {
  213. X      mp=lp->lb_members;
  214. X      do {
  215. X     if( strcmp( member, mp->m_name) == 0 ) {
  216. X        lp->lb_members = mp->m_next;
  217. X        mp->m_valid = 0;
  218. X     }
  219. X       
  220. X     mp=mp->m_next;
  221. X      } while( mp != lp->lb_members );
  222. X   }
  223. #endif
  224. }
  225. SHAR_EOF
  226. chmod 0640 dmake/unix/arlib.c ||
  227. echo 'restore of dmake/unix/arlib.c failed'
  228. Wc_c="`wc -c < 'dmake/unix/arlib.c'`"
  229. test 14467 -eq "$Wc_c" ||
  230.     echo 'dmake/unix/arlib.c: original size 14467, current size' "$Wc_c"
  231. rm -f _shar_wnt_.tmp
  232. fi
  233. # ============= dmake/unix/bsd43/config.h ==============
  234. if test ! -d 'dmake/unix/bsd43'; then
  235.     mkdir 'dmake/unix/bsd43'
  236. fi
  237. if test -f 'dmake/unix/bsd43/config.h' -a X"$1" != X"-c"; then
  238.     echo 'x - skipping dmake/unix/bsd43/config.h (File already exists)'
  239.     rm -f _shar_wnt_.tmp
  240. else
  241. > _shar_wnt_.tmp
  242. sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/bsd43/config.h' &&
  243. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/bsd43/RCS/config.h,v 1.1 91/05/06 15:28:56 dvadura Exp $
  244. -- SYNOPSIS -- Configurarion include file.
  245. -- 
  246. -- DESCRIPTION
  247. --     There is one of these for each specific machine configuration.
  248. --    It can be used to further tweek the machine specific sources
  249. --    so that they compile.
  250. --
  251. -- AUTHOR
  252. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  253. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  254. --
  255. -- COPYRIGHT
  256. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  257. -- 
  258. --      This program is free software; you can redistribute it and/or
  259. --      modify it under the terms of the GNU General Public License
  260. --      (version 1), as published by the Free Software Foundation, and
  261. --      found in the file 'LICENSE' included with this distribution.
  262. -- 
  263. --      This program is distributed in the hope that it will be useful,
  264. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  265. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  266. --      GNU General Public License for more details.
  267. -- 
  268. --      You should have received a copy of the GNU General Public License
  269. --      along with this program;  if not, write to the Free Software
  270. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  271. --
  272. -- LOG
  273. --     $Log:    config.h,v $
  274. X * Revision 1.1  91/05/06  15:28:56  dvadura
  275. X * dmake Release Version 3.7
  276. X * 
  277. */
  278. X
  279. /* define this for configurations that don't have the coreleft function
  280. X * so that the code compiles.  To my knowledge coreleft exists only on
  281. X * Turbo C, but it is needed here since the function is used in many debug
  282. X * macros. */
  283. #define coreleft() 0L
  284. X
  285. /* Define the getcwd function that is used in the code, since BSD does
  286. X * not have getcwd, but call it getwd instead. */
  287. extern    char*    getwd ANSI((char*));
  288. #define    getcwd(buf,siz)    getwd(buf)
  289. X
  290. /* Sun unix on 386i's has a broken ar.h that does not assume PORTAR format
  291. X * by default, so we fix it here. */
  292. #ifdef i386
  293. #define PORTAR 1
  294. #endif
  295. X
  296. /* We don't care about CONST */
  297. #define CONST
  298. SHAR_EOF
  299. chmod 0640 dmake/unix/bsd43/config.h ||
  300. echo 'restore of dmake/unix/bsd43/config.h failed'
  301. Wc_c="`wc -c < 'dmake/unix/bsd43/config.h'`"
  302. test 2075 -eq "$Wc_c" ||
  303.     echo 'dmake/unix/bsd43/config.h: original size 2075, current size' "$Wc_c"
  304. rm -f _shar_wnt_.tmp
  305. fi
  306. # ============= dmake/unix/bsd43/config.mk ==============
  307. if test -f 'dmake/unix/bsd43/config.mk' -a X"$1" != X"-c"; then
  308.     echo 'x - skipping dmake/unix/bsd43/config.mk (File already exists)'
  309.     rm -f _shar_wnt_.tmp
  310. else
  311. > _shar_wnt_.tmp
  312. sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/bsd43/config.mk' &&
  313. # This is the BSD 4.3 UNIX configuration file for DMAKE
  314. #    It simply modifies the values of SRC, and checks to see if
  315. #    OSENVIRONMENT is defined.  If so it includes the appropriate
  316. #    config.mk file.
  317. #
  318. # It also sets the values of .SOURCE.c and .SOURCE.h to include the local
  319. # directory.
  320. #
  321. osrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE)
  322. X
  323. # The following sources are required for BSD4.3
  324. OSDSRC := putenv.c tempnam.c utime.c setvbuf.c
  325. .IF $(OSDSRC)
  326. X   SRC    += $(OSDSRC)
  327. X   .SETDIR=$(osrdir) : $(OSDSRC)
  328. .END
  329. X
  330. .SOURCE.h : $(osrdir)
  331. X
  332. # Local configuration modifications for CFLAGS, there's local BSD includes
  333. # too.
  334. CFLAGS += -I$(osrdir)
  335. X
  336. # See if we modify anything in the lower levels.
  337. .IF $(OSENVIRONMENT) != $(NULL)
  338. X   .INCLUDE .IGNORE : $(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT)$(DIRSEPSTR)config.mk
  339. .END
  340. SHAR_EOF
  341. chmod 0640 dmake/unix/bsd43/config.mk ||
  342. echo 'restore of dmake/unix/bsd43/config.mk failed'
  343. Wc_c="`wc -c < 'dmake/unix/bsd43/config.mk'`"
  344. test 796 -eq "$Wc_c" ||
  345.     echo 'dmake/unix/bsd43/config.mk: original size 796, current size' "$Wc_c"
  346. rm -f _shar_wnt_.tmp
  347. fi
  348. # ============= dmake/unix/bsd43/make.sh ==============
  349. if test -f 'dmake/unix/bsd43/make.sh' -a X"$1" != X"-c"; then
  350.     echo 'x - skipping dmake/unix/bsd43/make.sh (File already exists)'
  351.     rm -f _shar_wnt_.tmp
  352. else
  353. > _shar_wnt_.tmp
  354. sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/bsd43/make.sh' &&
  355. mkdir objects
  356. cc -c -I. -Iunix -Iunix/bsd43 -O infer.c
  357. mv infer.o objects
  358. cc -c -I. -Iunix -Iunix/bsd43 -O make.c
  359. mv make.o objects
  360. cc -c -I. -Iunix -Iunix/bsd43 -O stat.c
  361. mv stat.o objects
  362. cc -c -I. -Iunix -Iunix/bsd43 -O expand.c
  363. mv expand.o objects
  364. cc -c -I. -Iunix -Iunix/bsd43 -O dmstring.c
  365. mv dmstring.o objects
  366. cc -c -I. -Iunix -Iunix/bsd43 -O hash.c
  367. mv hash.o objects
  368. cc -c -I. -Iunix -Iunix/bsd43 -O dag.c
  369. mv dag.o objects
  370. cc -c -I. -Iunix -Iunix/bsd43 -O dmake.c
  371. mv dmake.o objects
  372. cc -c -I. -Iunix -Iunix/bsd43 -O path.c
  373. mv path.o objects
  374. cc -c -I. -Iunix -Iunix/bsd43 -O imacs.c
  375. mv imacs.o objects
  376. cc -c -I. -Iunix -Iunix/bsd43 -O sysintf.c
  377. mv sysintf.o objects
  378. cc -c -I. -Iunix -Iunix/bsd43 -O parse.c
  379. mv parse.o objects
  380. cc -c -I. -Iunix -Iunix/bsd43 -O getinp.c
  381. mv getinp.o objects
  382. cc -c -I. -Iunix -Iunix/bsd43 -O quit.c
  383. mv quit.o objects
  384. cc -c -I. -Iunix -Iunix/bsd43 -O state.c
  385. mv state.o objects
  386. cc -c -I. -Iunix -Iunix/bsd43 -O basename.c
  387. mv basename.o objects
  388. cc -c -I. -Iunix -Iunix/bsd43 -O dmdump.c
  389. mv dmdump.o objects
  390. cc -c -I. -Iunix -Iunix/bsd43 -O macparse.c
  391. mv macparse.o objects
  392. cc -c -I. -Iunix -Iunix/bsd43 -O rulparse.c
  393. mv rulparse.o objects
  394. cc -c -I. -Iunix -Iunix/bsd43 -O percent.c
  395. mv percent.o objects
  396. cc -c -I. -Iunix -Iunix/bsd43 -O function.c
  397. mv function.o objects
  398. cc -c -I. -Iunix -Iunix/bsd43 -O unix/arlib.c
  399. mv arlib.o objects
  400. cc -c -I. -Iunix -Iunix/bsd43 -O unix/dirbrk.c
  401. mv dirbrk.o objects
  402. cc -c -I. -Iunix -Iunix/bsd43 -O unix/rmprq.c
  403. mv rmprq.o objects
  404. cc -c -I. -Iunix -Iunix/bsd43 -O unix/ruletab.c
  405. mv ruletab.o objects
  406. cc -c -I. -Iunix -Iunix/bsd43 -O unix/runargv.c
  407. mv runargv.o objects
  408. cc -c -I. -Iunix -Iunix/bsd43 -O unix/bsd43/putenv.c
  409. mv putenv.o objects
  410. cc -c -I. -Iunix -Iunix/bsd43 -O unix/bsd43/tempnam.c
  411. mv tempnam.o objects
  412. cc -c -I. -Iunix -Iunix/bsd43 -O unix/bsd43/utime.c
  413. mv utime.o objects
  414. cc -c -I. -Iunix -Iunix/bsd43 -O unix/bsd43/setvbuf.c
  415. mv setvbuf.o objects
  416. cc  -o dmake  objects/infer.o objects/make.o objects/stat.o objects/expand.o objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o objects/quit.o objects/state.o objects/basename.o objects/dmdump.o objects/macparse.o objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o objects/putenv.o objects/tempnam.o objects/utime.o objects/setvbuf.o 
  417. cp unix/bsd43/startup.mk startup.mk
  418. SHAR_EOF
  419. chmod 0640 dmake/unix/bsd43/make.sh ||
  420. echo 'restore of dmake/unix/bsd43/make.sh failed'
  421. Wc_c="`wc -c < 'dmake/unix/bsd43/make.sh'`"
  422. test 2489 -eq "$Wc_c" ||
  423.     echo 'dmake/unix/bsd43/make.sh: original size 2489, current size' "$Wc_c"
  424. rm -f _shar_wnt_.tmp
  425. fi
  426. # ============= dmake/unix/bsd43/public.h ==============
  427. if test -f 'dmake/unix/bsd43/public.h' -a X"$1" != X"-c"; then
  428.     echo 'x - skipping dmake/unix/bsd43/public.h (File already exists)'
  429.     rm -f _shar_wnt_.tmp
  430. else
  431. > _shar_wnt_.tmp
  432. sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/bsd43/public.h' &&
  433. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/bsd43/RCS/public.h,v 1.1 91/05/06 15:28:57 dvadura Exp Locker: dvadura $
  434. -- WARNING  -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT
  435. --
  436. -- SYNOPSIS -- Local functions exported to be visible by others.
  437. --
  438. -- DESCRIPTION
  439. --      This file is generated by 'genpub'.  Function declarations
  440. --      that appear in this file are extracted by 'genpub' from
  441. --      source files.  Any function in the source file whose definition
  442. --      appears like:
  443. --
  444. --          PUBLIC return_type
  445. --          function( arg_list );
  446. --          type_expr1 arg1;
  447. --          ...
  448. --
  449. --      has its definition extracted and a line of the form:
  450. --
  451. --          return_type function ANSI((type_expr1,type_expr2,...));
  452. --
  453. --      entered into the output file.
  454. --
  455. -- AUTHOR
  456. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  457. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  458. --
  459. -- COPYRIGHT
  460. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  461. -- 
  462. --      This program is free software; you can redistribute it and/or
  463. --      modify it under the terms of the GNU General Public License
  464. --      (version 1), as published by the Free Software Foundation, and
  465. --      found in the file 'LICENSE' included with this distribution.
  466. -- 
  467. --      This program is distributed in the hope that it will be useful,
  468. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  469. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  470. --      GNU General Public License for more details.
  471. -- 
  472. --      You should have received a copy of the GNU General Public License
  473. --      along with this program;  if not, write to the Free Software
  474. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  475. --
  476. -- LOG
  477. --     $Log:    public.h,v $
  478. X * Revision 1.1  91/05/06  15:28:57  dvadura
  479. X * dmake Release Version 3.7
  480. X * 
  481. */
  482. X
  483. #ifndef _DMAKE_PUBLIC_h
  484. #define _DMAKE_PUBLIC_h
  485. X
  486. void Infer_recipe ANSI((CELLPTR, CELLPTR));
  487. int Make_targets ANSI(());
  488. int Exec_commands ANSI((CELLPTR));
  489. void Pop_dir ANSI((int));
  490. void Append_line ANSI((char *, int, FILE *, char *, int, int));
  491. void Stat_target ANSI((CELLPTR, int));
  492. char * Expand ANSI((char *));
  493. char * Apply_edit ANSI((char *, char *, char *, int, int));
  494. void Map_esc ANSI((char *));
  495. char* Apply_modifiers ANSI((int, char *));
  496. char* Tokenize ANSI((char *, char *));
  497. char * _strjoin ANSI((char *, char *, int, int));
  498. char * _stradd ANSI((char *, char *, int));
  499. char * _strapp ANSI((char *, char *));
  500. char * _strdup ANSI((char *));
  501. char * _strpbrk ANSI((char *, char *));
  502. char * _strspn ANSI((char *, char *));
  503. char * _strstr ANSI((char *, char *));
  504. char * _substr ANSI((char *, char *));
  505. uint16 Hash ANSI((char *, uint32 *));
  506. HASHPTR Get_name ANSI((char *, HASHPTR *, int));
  507. HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *));
  508. HASHPTR Def_macro ANSI((char *, char *, int));
  509. CELLPTR Def_cell ANSI((char *));
  510. LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int));
  511. void Clear_prerequisites ANSI((CELLPTR));
  512. int Test_circle ANSI((CELLPTR, int));
  513. STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int));
  514. t_attr Rcp_attribute ANSI((char *));
  515. int main ANSI((int, char **));
  516. FILE * Openfile ANSI((char *, int, int));
  517. FILE * Closefile ANSI(());
  518. FILE * Search_file ANSI((char *, char **));
  519. char * Filename ANSI(());
  520. void No_ram ANSI(());
  521. int Usage ANSI((int));
  522. int Version ANSI(());
  523. char * Get_suffix ANSI((char *));
  524. char * Build_path ANSI((char *, char *));
  525. void Make_rules ANSI(());
  526. void Create_macro_vars ANSI(());
  527. time_t Do_stat ANSI((char *, char *, char **));
  528. int Do_touch ANSI((char *, char *, char **));
  529. void Void_lib_cache ANSI((char *, char *));
  530. time_t Do_time ANSI(());
  531. int Do_cmnd ANSI((char *, int, int, CELLPTR, int, int, int));
  532. char ** Pack_argv ANSI((int, int, char *));
  533. char * Read_env_string ANSI((char *));
  534. int Write_env_string ANSI((char *, char *));
  535. void ReadEnvironment ANSI(());
  536. void Catch_signals ANSI((void (*)()));
  537. void Clear_signals ANSI(());
  538. void Prolog ANSI((int, char* []));
  539. void Epilog ANSI((int));
  540. char * Get_current_dir ANSI(());
  541. int Set_dir ANSI((char*));
  542. char Get_switch_char ANSI(());
  543. FILE* Get_temp ANSI((char **, char *, int));
  544. FILE * Start_temp ANSI((char *, CELLPTR, char **));
  545. void Open_temp_error ANSI((char *, char *));
  546. void Link_temp ANSI((CELLPTR, FILE *, char *));
  547. void Close_temp ANSI((CELLPTR, FILE *));
  548. void Unlink_temp_files ANSI((CELLPTR));
  549. void Handle_result ANSI((int, int, int, CELLPTR));
  550. void Update_time_stamp ANSI((CELLPTR));
  551. void Parse ANSI((FILE *));
  552. int Get_line ANSI((char *, FILE *));
  553. char * Do_comment ANSI((char *, char **, int));
  554. char * Get_token ANSI((TKSTRPTR, char *, int));
  555. void Quit ANSI(());
  556. void Read_state ANSI(());
  557. void Write_state ANSI(());
  558. int Check_state ANSI((CELLPTR, STRINGPTR *, int));
  559. char* basename ANSI((char *));
  560. void Dump ANSI(());
  561. void Dump_recipe ANSI((STRINGPTR));
  562. int Parse_macro ANSI((char *, int));
  563. int Macro_op ANSI((char *));
  564. int Parse_rule_def ANSI((int *));
  565. int Rule_op ANSI((char *));
  566. void Add_recipe_to_list ANSI((char *, int, int));
  567. void Bind_rules_to_targets ANSI((int));
  568. int Set_group_attributes ANSI((char *));
  569. DFALINKPTR Match_dfa ANSI((char *));
  570. void Check_circle_dfa ANSI(());
  571. void Add_nfa ANSI((char *));
  572. char * Exec_function ANSI((char *));
  573. time_t seek_arch ANSI((char *, char *));
  574. int If_root_path ANSI((char *));
  575. void Remove_prq ANSI((CELLPTR));
  576. int runargv ANSI((CELLPTR, int, int, int, int, char *));
  577. int Wait_for_child ANSI((int, int));
  578. void Clean_up_processes ANSI(());
  579. X
  580. #endif
  581. SHAR_EOF
  582. chmod 0640 dmake/unix/bsd43/public.h ||
  583. echo 'restore of dmake/unix/bsd43/public.h failed'
  584. Wc_c="`wc -c < 'dmake/unix/bsd43/public.h'`"
  585. test 5521 -eq "$Wc_c" ||
  586.     echo 'dmake/unix/bsd43/public.h: original size 5521, current size' "$Wc_c"
  587. rm -f _shar_wnt_.tmp
  588. fi
  589. # ============= dmake/unix/bsd43/putenv.c ==============
  590. if test -f 'dmake/unix/bsd43/putenv.c' -a X"$1" != X"-c"; then
  591.     echo 'x - skipping dmake/unix/bsd43/putenv.c (File already exists)'
  592.     rm -f _shar_wnt_.tmp
  593. else
  594. > _shar_wnt_.tmp
  595. sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/bsd43/putenv.c' &&
  596. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/bsd43/RCS/putenv.c,v 1.1 91/05/06 15:28:58 dvadura Exp $
  597. -- SYNOPSIS -- my own putenv for BSD like systems.
  598. -- 
  599. -- DESCRIPTION
  600. --     This originally came from MKS, but I rewrote it to fix a bug with
  601. --    replacing existing strings, probably never happened but the code
  602. --    was wrong nonetheless.
  603. --
  604. -- AUTHOR
  605. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  606. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  607. --
  608. -- COPYRIGHT
  609. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  610. -- 
  611. --      This program is free software; you can redistribute it and/or
  612. --      modify it under the terms of the GNU General Public License
  613. --      (version 1), as published by the Free Software Foundation, and
  614. --      found in the file 'LICENSE' included with this distribution.
  615. -- 
  616. --      This program is distributed in the hope that it will be useful,
  617. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  618. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  619. --      GNU General Public License for more details.
  620. -- 
  621. --      You should have received a copy of the GNU General Public License
  622. --      along with this program;  if not, write to the Free Software
  623. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  624. --
  625. -- LOG
  626. --     $Log:    putenv.c,v $
  627. X * Revision 1.1  91/05/06  15:28:58  dvadura
  628. X * dmake Release Version 3.7
  629. X * 
  630. */
  631. X
  632. #include <stdio.h>
  633. #include <string.h>
  634. X
  635. int
  636. putenv( str )/*
  637. ===============
  638. X   Take a string of the form NAME=value and stick it into the environment.
  639. X   We do this by allocating a new set of pointers if we have to add a new
  640. X   string and by replacing an existing pointer if the value replaces the value
  641. X   of an existing string. */
  642. char *str;
  643. {
  644. X   extern char **environ;        /* The current environment. */
  645. X   static char **ourenv = NULL;        /* A new environment        */
  646. X   register char **p;
  647. X   register char *q;
  648. X   int      size;
  649. X
  650. X   /* First search the current environment and see if we can replace a
  651. X    * string. */
  652. X   for( p=environ; *p; p++ ) {
  653. X      register char *s = str;
  654. X
  655. X      for( q = *p; *q && *s && *s == *q; q++, s++ )
  656. X     if( *s == '=' ) {
  657. X        *p = str;
  658. X        return(0);            /* replaced it so go away */
  659. X     }
  660. X   }
  661. X
  662. X   /* Ok, can't replace a string so need to grow the environment. */
  663. X   size = p - environ + 2;    /* size of new environment */
  664. X                /* size of old is size-1   */
  665. X
  666. X   /* It's the first time, so allocate a new environment since we don't know
  667. X    * where the old one is comming from. */
  668. X   if( ourenv == NULL ) {
  669. X      if( (ourenv = (char **) malloc( sizeof(char *)*size )) == NULL )
  670. X     return(1);
  671. X
  672. X      memcpy( (char *)ourenv, (char *)environ, (size-2)*sizeof(char *) );
  673. X   }
  674. X   else if( (ourenv = (char **)realloc( ourenv, size*sizeof(char *))) == NULL )
  675. X      return(1);
  676. X
  677. X   ourenv[--size] = NULL;
  678. X   ourenv[--size] = str;
  679. X
  680. X   environ = ourenv;
  681. X   return(0);
  682. }
  683. SHAR_EOF
  684. chmod 0640 dmake/unix/bsd43/putenv.c ||
  685. echo 'restore of dmake/unix/bsd43/putenv.c failed'
  686. Wc_c="`wc -c < 'dmake/unix/bsd43/putenv.c'`"
  687. test 2930 -eq "$Wc_c" ||
  688.     echo 'dmake/unix/bsd43/putenv.c: original size 2930, current size' "$Wc_c"
  689. rm -f _shar_wnt_.tmp
  690. fi
  691. # ============= dmake/unix/bsd43/setvbuf.c ==============
  692. if test -f 'dmake/unix/bsd43/setvbuf.c' -a X"$1" != X"-c"; then
  693.     echo 'x - skipping dmake/unix/bsd43/setvbuf.c (File already exists)'
  694.     rm -f _shar_wnt_.tmp
  695. else
  696. > _shar_wnt_.tmp
  697. sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/bsd43/setvbuf.c' &&
  698. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/bsd43/RCS/setvbuf.c,v 1.1 91/05/06 15:28:59 dvadura Exp $
  699. -- SYNOPSIS -- setvbuf for BSD
  700. -- 
  701. -- DESCRIPTION
  702. --     A sysv call, standard BSD doesn't have this.
  703. --
  704. -- AUTHOR
  705. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  706. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  707. --
  708. -- COPYRIGHT
  709. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  710. -- 
  711. --      This program is free software; you can redistribute it and/or
  712. --      modify it under the terms of the GNU General Public License
  713. --      (version 1), as published by the Free Software Foundation, and
  714. --      found in the file 'LICENSE' included with this distribution.
  715. -- 
  716. --      This program is distributed in the hope that it will be useful,
  717. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  718. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  719. --      GNU General Public License for more details.
  720. -- 
  721. --      You should have received a copy of the GNU General Public License
  722. --      along with this program;  if not, write to the Free Software
  723. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  724. --
  725. -- LOG
  726. --     $Log:    setvbuf.c,v $
  727. X * Revision 1.1  91/05/06  15:28:59  dvadura
  728. X * dmake Release Version 3.7
  729. X * 
  730. */
  731. X
  732. #include <stdio.h>
  733. X
  734. setvbuf(fp, bp, type, len_unused)
  735. FILE*    fp;
  736. char*    bp;
  737. int    type;
  738. int    len_unused;
  739. {
  740. X   switch (type) {
  741. X      case _IOLBF: setlinebuf(fp);   return;
  742. X      case _IONBF: setbuf(fp, NULL); return;
  743. X      default:     setbuf(fp, bp);   return;
  744. X   }
  745. }
  746. X
  747. SHAR_EOF
  748. chmod 0640 dmake/unix/bsd43/setvbuf.c ||
  749. echo 'restore of dmake/unix/bsd43/setvbuf.c failed'
  750. Wc_c="`wc -c < 'dmake/unix/bsd43/setvbuf.c'`"
  751. test 1581 -eq "$Wc_c" ||
  752.     echo 'dmake/unix/bsd43/setvbuf.c: original size 1581, current size' "$Wc_c"
  753. rm -f _shar_wnt_.tmp
  754. fi
  755. # ============= dmake/unix/bsd43/startup.mk ==============
  756. if test -f 'dmake/unix/bsd43/startup.mk' -a X"$1" != X"-c"; then
  757.     echo 'x - skipping dmake/unix/bsd43/startup.mk (File already exists)'
  758.     rm -f _shar_wnt_.tmp
  759. else
  760. > _shar_wnt_.tmp
  761. sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/bsd43/startup.mk' &&
  762. # Generic UNIX DMAKE startup file.  Customize to suit your needs.
  763. # Should work for both SYSV, and BSD 4.3
  764. # See the documentation for a description of internally defined macros.
  765. #
  766. # Disable warnings for macros redefined here that were given
  767. # on the command line.
  768. __.SILENT := $(.SILENT)
  769. .SILENT   := yes
  770. X
  771. # Configuration parameters for DMAKE startup.mk file
  772. # Set these to NON-NULL if you wish to turn the parameter on.
  773. _HAVE_RCS    := yes        # yes => RCS  is installed.
  774. _HAVE_SCCS    := yes        # yes => SCCS is installed.
  775. X
  776. # Applicable suffix definitions
  777. A := .a        # Libraries
  778. E :=        # Executables
  779. F := .f        # Fortran
  780. O := .o        # Objects
  781. P := .p        # Pascal
  782. S := .s        # Assembler sources
  783. V := ,v        # RCS suffix
  784. X
  785. # Recipe execution configurations
  786. SHELL        := /bin/sh
  787. SHELLFLAGS    := -ce
  788. GROUPSHELL    := $(SHELL)
  789. GROUPFLAGS    := 
  790. SHELLMETAS    := |();&<>?*][$$:\\#`'"
  791. GROUPSUFFIX    :=
  792. DIVFILE         = $(TMPFILE)
  793. X
  794. # Standard C-language command names and flags
  795. X   CPP       := /lib/cpp        # C-preprocessor
  796. X   CC      := cc        # C-compiler and flags
  797. X   CFLAGS  +=
  798. X
  799. X   AS      := as        # Assembler and flags
  800. X   ASFLAGS += 
  801. X
  802. X   LD       = $(CC)        # Loader and flags
  803. X   LDFLAGS +=
  804. X   LDLIBS   =
  805. X
  806. # Definition of $(MAKE) macro for recursive makes.
  807. X   MAKE = $(MAKECMD) $(MFLAGS)
  808. X
  809. # Definition of Print command for this system.
  810. X   PRINT = lpr
  811. X
  812. # Language and Parser generation Tools and their flags
  813. X   YACC      := yacc        # standard yacc
  814. X   YFLAGS +=
  815. X   YTAB      := y.tab        # yacc output files name stem.
  816. X
  817. X   LEX      := lex        # standard lex
  818. X   LFLAGS +=
  819. X   LEXYY  := lex.yy        # lex output file
  820. X
  821. # Other Compilers, Tools and their flags
  822. X   PC    := pc            # pascal compiler
  823. X   RC    := f77            # ratfor compiler
  824. X   FC    := f77            # fortran compiler
  825. X
  826. X   CO       := co        # check out for RCS
  827. X   COFLAGS += -q
  828. X
  829. X   AR     := ar            # archiver
  830. X   ARFLAGS+= ruv
  831. X
  832. X   RM       := /bin/rm        # remove a file command
  833. X   RMFLAGS +=
  834. X
  835. # Implicit generation rules for making inferences.
  836. # We don't provide .yr or .ye rules here.  They're obsolete.
  837. # Rules for making *$O
  838. X   %$O : %.c ; $(CC) $(CFLAGS) -c $<
  839. X   %$O : %$P ; $(PC) $(PFLAGS) -c $<
  840. X   %$O : %$S ; $(AS) $(ASFLAGS) $<
  841. X   %$O : %.cl ; class -c $<
  842. X   %$O : %.e %.r %.F %$F
  843. X    $(FC) $(RFLAGS) $(EFLAGS) $(FFLAGS) -c $<
  844. X
  845. # Executables
  846. X   %$E : %$O ; $(LD) $(LDFLAGS) -o $@ $< $(LDLIBES)
  847. X
  848. # lex and yacc rules
  849. X   %.c : %.y ; $(YACC)  $(YFLAGS) $<; mv $(YTAB).c $@
  850. X   %.c : %.l ; $(LEX)   $(LFLAGS) $<; mv $(LEXYY).c $@
  851. X
  852. # This rule tells how to make *.out from it's immediate list of prerequisites
  853. # UNIX only.
  854. X   %.out :; $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
  855. X
  856. # RCS support
  857. .IF $(_HAVE_RCS)
  858. X   % : %$V $$(@:d)RCS/$$(@:f)$V;- $(CO) $(COFLAGS) $@
  859. X   .NOINFER : %$V $$(@:d)RCS/$$(@:f)$V
  860. .END
  861. X
  862. # SCCS support
  863. .IF $(_HAVE_SCCS)
  864. X   % : s.% ; get $@
  865. X   .NOINFER : s.%
  866. .END
  867. X
  868. # Recipe to make archive files.
  869. %$A :
  870. [
  871. X   $(AR) $(ARFLAGS) $@ $?
  872. X   $(RM) $(RMFLAGS) $?
  873. X   ranlib $@
  874. ]
  875. X
  876. # DMAKE uses this recipe to remove intermediate targets
  877. .REMOVE :; $(RM) -f $<
  878. X
  879. # AUGMAKE extensions for SYSV compatibility
  880. @B = $(@:b)
  881. @D = $(@:d)
  882. @F = $(@:f)
  883. *B = $(*:b)
  884. *D = $(*:d)
  885. *F = $(*:f)
  886. <B = $(<:b)
  887. <D = $(<:d)
  888. <F = $(<:f)
  889. ?B = $(?:b)
  890. ?F = $(?:f)
  891. ?D = $(?:d)
  892. X
  893. # Turn warnings back to previous setting.
  894. .SILENT := $(__.SILENT)
  895. X
  896. # Local startup file if any
  897. .INCLUDE .IGNORE: "_startup.mk"
  898. SHAR_EOF
  899. chmod 0640 dmake/unix/bsd43/startup.mk ||
  900. echo 'restore of dmake/unix/bsd43/startup.mk failed'
  901. Wc_c="`wc -c < 'dmake/unix/bsd43/startup.mk'`"
  902. test 3221 -eq "$Wc_c" ||
  903.     echo 'dmake/unix/bsd43/startup.mk: original size 3221, current size' "$Wc_c"
  904. rm -f _shar_wnt_.tmp
  905. fi
  906. # ============= dmake/unix/bsd43/stdarg.h ==============
  907. if test -f 'dmake/unix/bsd43/stdarg.h' -a X"$1" != X"-c"; then
  908.     echo 'x - skipping dmake/unix/bsd43/stdarg.h (File already exists)'
  909.     rm -f _shar_wnt_.tmp
  910. else
  911. > _shar_wnt_.tmp
  912. sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/bsd43/stdarg.h' &&
  913. /*
  914. X * stdarg.h
  915. X *
  916. X * defines ANSI style macros for accessing arguments of a function which takes
  917. X * a variable number of arguments
  918. X *
  919. X */
  920. X
  921. typedef char *va_list;
  922. X
  923. #if defined(sparc)
  924. # define va_alist __builtin_va_alist
  925. #endif
  926. # define va_dcl int va_alist
  927. # define va_start(list,v) list = (char *)&va_alist
  928. # define va_end(list)     list = NULL
  929. # define va_arg(list,mode) ((mode *)(list += sizeof(mode)))[-1]
  930. X
  931. SHAR_EOF
  932. chmod 0640 dmake/unix/bsd43/stdarg.h ||
  933. echo 'restore of dmake/unix/bsd43/stdarg.h failed'
  934. Wc_c="`wc -c < 'dmake/unix/bsd43/stdarg.h'`"
  935. test 409 -eq "$Wc_c" ||
  936.     echo 'dmake/unix/bsd43/stdarg.h: original size 409, current size' "$Wc_c"
  937. rm -f _shar_wnt_.tmp
  938. fi
  939. # ============= dmake/unix/bsd43/stdlib.h ==============
  940. if test -f 'dmake/unix/bsd43/stdlib.h' -a X"$1" != X"-c"; then
  941.     echo 'x - skipping dmake/unix/bsd43/stdlib.h (File already exists)'
  942.     rm -f _shar_wnt_.tmp
  943. else
  944. > _shar_wnt_.tmp
  945. sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/bsd43/stdlib.h' &&
  946. #ifndef _STDLIB_INCLUDED_
  947. #define _STDLIB_INCLUDED_
  948. X
  949. extern /*GOTO*/ _exit();
  950. extern /*GOTO*/ exit();
  951. extern /*GOTO*/ abort();
  952. extern int system();
  953. extern char *getenv();
  954. extern char *calloc();
  955. extern char *malloc();
  956. extern char *realloc();
  957. extern free();
  958. extern int errno;
  959. X
  960. #ifndef EIO
  961. #    include <errno.h>
  962. #endif
  963. X
  964. #endif /* _STDLIB_INCLUDED_ */
  965. SHAR_EOF
  966. chmod 0640 dmake/unix/bsd43/stdlib.h ||
  967. echo 'restore of dmake/unix/bsd43/stdlib.h failed'
  968. Wc_c="`wc -c < 'dmake/unix/bsd43/stdlib.h'`"
  969. test 346 -eq "$Wc_c" ||
  970.     echo 'dmake/unix/bsd43/stdlib.h: original size 346, current size' "$Wc_c"
  971. rm -f _shar_wnt_.tmp
  972. fi
  973. # ============= dmake/unix/bsd43/string.h ==============
  974. if test -f 'dmake/unix/bsd43/string.h' -a X"$1" != X"-c"; then
  975.     echo 'x - skipping dmake/unix/bsd43/string.h (File already exists)'
  976.     rm -f _shar_wnt_.tmp
  977. else
  978. > _shar_wnt_.tmp
  979. sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/bsd43/string.h' &&
  980. /*
  981. ** BSD does this wrong
  982. */
  983. #include <strings.h>
  984. X
  985. #include "stdmacs.h"
  986. extern    char*    strpbrk ANSI((char* src, char* any));
  987. X
  988. #ifndef DBUG
  989. #define    strchr(str,c)    index(str,c)
  990. #define    strrchr(str,c)    rindex(str,c)
  991. #else
  992. char *strchr ANSI((char*, char));
  993. char *strrchr ANSI((char*, char));
  994. #endif
  995. X
  996. SHAR_EOF
  997. chmod 0640 dmake/unix/bsd43/string.h ||
  998. echo 'restore of dmake/unix/bsd43/string.h failed'
  999. Wc_c="`wc -c < 'dmake/unix/bsd43/string.h'`"
  1000. test 292 -eq "$Wc_c" ||
  1001.     echo 'dmake/unix/bsd43/string.h: original size 292, current size' "$Wc_c"
  1002. rm -f _shar_wnt_.tmp
  1003. fi
  1004. # ============= dmake/unix/bsd43/tempnam.c ==============
  1005. if test -f 'dmake/unix/bsd43/tempnam.c' -a X"$1" != X"-c"; then
  1006.     echo 'x - skipping dmake/unix/bsd43/tempnam.c (File already exists)'
  1007.     rm -f _shar_wnt_.tmp
  1008. else
  1009. > _shar_wnt_.tmp
  1010. sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/bsd43/tempnam.c' &&
  1011. /*LINTLIBRARY*/
  1012. #include <stdio.h>
  1013. #include <string.h>
  1014. #include <stdlib.h>
  1015. X
  1016. #define max(A,B) (((A)<(B))?(B):(A))
  1017. X
  1018. extern char *mktemp();
  1019. extern int access();
  1020. X
  1021. static char *cpdir();
  1022. static char  *seed="AAA";
  1023. X
  1024. /* BSD stdio.h doesn't define P_tmpdir, so let's do it here */
  1025. #ifndef P_tmpdir
  1026. static char *P_tmpdir = "/tmp";
  1027. #endif
  1028. X
  1029. char *
  1030. tempnam(dir, prefix)
  1031. char *dir;        /* use this directory please (if non-NULL) */
  1032. char *prefix;        /* use this (if non-NULL) as filename prefix */
  1033. {
  1034. X   register char *p, *q, *tmpdir;
  1035. X   int            tl=0, dl=0, pl;
  1036. X
  1037. X   pl = strlen(P_tmpdir);
  1038. X
  1039. X   if( (tmpdir = getenv("TMPDIR")) != NULL ) tl = strlen(tmpdir);
  1040. X   if( dir != NULL ) dl = strlen(dir);
  1041. X
  1042. X   if( (p = malloc((unsigned)(max(max(dl,tl),pl)+16))) == NULL )
  1043. X     return(NULL);
  1044. X
  1045. X   *p = '\0';
  1046. X
  1047. X   if( (tl == 0) || (access( cpdir(p, tmpdir), 3) != 0) )
  1048. X     if( (dl == 0) || (access( cpdir(p, dir), 3) != 0) )
  1049. X    if( access( cpdir(p, P_tmpdir),   3) != 0 )
  1050. X       if( access( cpdir(p, "/tmp"),  3) != 0 )
  1051. X          return(NULL);
  1052. X
  1053. X   (void) strcat(p, "/");
  1054. X   if(prefix)
  1055. X   {
  1056. X      *(p+strlen(p)+5) = '\0';
  1057. X      (void)strncat(p, prefix, 5);
  1058. X   }
  1059. X
  1060. X   (void)strcat(p, seed);
  1061. X   (void)strcat(p, "XXXXXX");
  1062. X
  1063. X   q = seed;
  1064. X   while(*q == 'Z') *q++ = 'A';
  1065. X   ++*q;
  1066. X
  1067. X   if(*mktemp(p) == '\0') return(NULL);
  1068. X   return(p);
  1069. }
  1070. X
  1071. X
  1072. X
  1073. static char *
  1074. cpdir(buf, str)
  1075. char *buf;
  1076. char *str;
  1077. {
  1078. X   char *p;
  1079. X
  1080. X   if(str != NULL)
  1081. X   {
  1082. X      (void) strcpy(buf, str);
  1083. X      p = buf - 1 + strlen(buf);
  1084. X      if(*p == '/') *p = '\0';
  1085. X   }
  1086. X
  1087. X   return(buf);
  1088. }
  1089. SHAR_EOF
  1090. chmod 0640 dmake/unix/bsd43/tempnam.c ||
  1091. echo 'restore of dmake/unix/bsd43/tempnam.c failed'
  1092. Wc_c="`wc -c < 'dmake/unix/bsd43/tempnam.c'`"
  1093. test 1506 -eq "$Wc_c" ||
  1094.     echo 'dmake/unix/bsd43/tempnam.c: original size 1506, current size' "$Wc_c"
  1095. rm -f _shar_wnt_.tmp
  1096. fi
  1097. # ============= dmake/unix/bsd43/utime.c ==============
  1098. if test -f 'dmake/unix/bsd43/utime.c' -a X"$1" != X"-c"; then
  1099.     echo 'x - skipping dmake/unix/bsd43/utime.c (File already exists)'
  1100.     rm -f _shar_wnt_.tmp
  1101. else
  1102. > _shar_wnt_.tmp
  1103. sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/bsd43/utime.c' &&
  1104. /*
  1105. ** change access and modify times of file
  1106. */
  1107. #include <sys/types.h>
  1108. #include <sys/time.h>
  1109. #include <sys/stat.h>
  1110. #include <sys/file.h>
  1111. X
  1112. int
  1113. utime(name, timep)
  1114. char*    name;
  1115. time_t    timep[2];
  1116. {
  1117. X    struct timeval tv[2], *tvp;
  1118. X    struct stat buf;
  1119. X    int    fil;
  1120. X    char    data;
  1121. X
  1122. X    if (timep!=0)
  1123. X    {
  1124. X        tvp = tv, tv[0].tv_sec = timep[0], tv[1].tv_sec = timep[1];
  1125. X        if (utimes(name, tvp)==0)
  1126. X            return (0);
  1127. X    }
  1128. X
  1129. X    if (stat(name, &buf) != 0)
  1130. X        return (-1);
  1131. X    if (buf.st_size != 0)  {
  1132. X        if ((fil = open(name, O_RDWR, 0666)) < 0)
  1133. X            return (-1);
  1134. X        if (read(fil, &data, 1) < 1) {
  1135. X            close(fil);
  1136. X            return (-1);
  1137. X        }
  1138. X        lseek(fil, 0L, 0);
  1139. X        if (write(fil, &data, 1) < 1) {
  1140. X            close(fil);
  1141. X            return (-1);
  1142. X        }
  1143. X        close(fil);
  1144. X        return (0);
  1145. X    } else     if ((fil = creat(name, 0666)) < 0) {
  1146. X        return (-1);
  1147. X    } else {
  1148. X        close(fil);
  1149. X        return (0);
  1150. X    }
  1151. }
  1152. SHAR_EOF
  1153. chmod 0640 dmake/unix/bsd43/utime.c ||
  1154. echo 'restore of dmake/unix/bsd43/utime.c failed'
  1155. Wc_c="`wc -c < 'dmake/unix/bsd43/utime.c'`"
  1156. test 808 -eq "$Wc_c" ||
  1157.     echo 'dmake/unix/bsd43/utime.c: original size 808, current size' "$Wc_c"
  1158. rm -f _shar_wnt_.tmp
  1159. fi
  1160. # ============= dmake/unix/bsd43/uw/config.mk ==============
  1161. if test ! -d 'dmake/unix/bsd43/uw'; then
  1162.     mkdir 'dmake/unix/bsd43/uw'
  1163. fi
  1164. if test -f 'dmake/unix/bsd43/uw/config.mk' -a X"$1" != X"-c"; then
  1165.     echo 'x - skipping dmake/unix/bsd43/uw/config.mk (File already exists)'
  1166.     rm -f _shar_wnt_.tmp
  1167. else
  1168. > _shar_wnt_.tmp
  1169. sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/bsd43/uw/config.mk' &&
  1170. # This is the BSD 4.3 University of Waterloo (uw) UNIX configuration file
  1171. # for DMAKE
  1172. #    It simply modifies the values of LDLIBS to include libuw.a
  1173. #    so that vfprintf can be found.
  1174. #
  1175. X
  1176. LDLIBS += -luw
  1177. osredir := $(OS)$(DIRSEPSTR)$(OSRELEASE)$(DIRSEPSTR)$(OSENVIRONMENT)
  1178. CFLAGS += -I$(osredir)
  1179. X
  1180. # install script for UW's /usr/software hierarchy...
  1181. install:
  1182. X    mkdir ../bin; strip ./dmake; mv ./dmake ../bin
  1183. X    chmod a+rx ../bin/dmake ../bin
  1184. X    mkdir ../lib; chmod a+rx ../lib
  1185. X    cp $(STARTUPFILE) ../lib
  1186. X    chmod a+r ../lib/startup.mk
  1187. SHAR_EOF
  1188. chmod 0640 dmake/unix/bsd43/uw/config.mk ||
  1189. echo 'restore of dmake/unix/bsd43/uw/config.mk failed'
  1190. Wc_c="`wc -c < 'dmake/unix/bsd43/uw/config.mk'`"
  1191. test 521 -eq "$Wc_c" ||
  1192.     echo 'dmake/unix/bsd43/uw/config.mk: original size 521, current size' "$Wc_c"
  1193. rm -f _shar_wnt_.tmp
  1194. fi
  1195. # ============= dmake/unix/bsd43/uw/make.sh ==============
  1196. if test -f 'dmake/unix/bsd43/uw/make.sh' -a X"$1" != X"-c"; then
  1197.     echo 'x - skipping dmake/unix/bsd43/uw/make.sh (File already exists)'
  1198.     rm -f _shar_wnt_.tmp
  1199. else
  1200. > _shar_wnt_.tmp
  1201. sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/bsd43/uw/make.sh' &&
  1202. mkdir objects
  1203. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O infer.c
  1204. mv infer.o objects
  1205. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O make.c
  1206. mv make.o objects
  1207. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O stat.c
  1208. mv stat.o objects
  1209. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O expand.c
  1210. mv expand.o objects
  1211. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O dmstring.c
  1212. mv dmstring.o objects
  1213. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O hash.c
  1214. mv hash.o objects
  1215. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O dag.c
  1216. mv dag.o objects
  1217. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O dmake.c
  1218. mv dmake.o objects
  1219. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O path.c
  1220. mv path.o objects
  1221. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O imacs.c
  1222. mv imacs.o objects
  1223. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O sysintf.c
  1224. mv sysintf.o objects
  1225. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O parse.c
  1226. mv parse.o objects
  1227. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O getinp.c
  1228. mv getinp.o objects
  1229. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O quit.c
  1230. mv quit.o objects
  1231. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O state.c
  1232. mv state.o objects
  1233. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O basename.c
  1234. mv basename.o objects
  1235. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O dmdump.c
  1236. mv dmdump.o objects
  1237. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O macparse.c
  1238. mv macparse.o objects
  1239. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O rulparse.c
  1240. mv rulparse.o objects
  1241. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O percent.c
  1242. mv percent.o objects
  1243. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O function.c
  1244. mv function.o objects
  1245. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/arlib.c
  1246. mv arlib.o objects
  1247. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/dirbrk.c
  1248. mv dirbrk.o objects
  1249. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/rmprq.c
  1250. mv rmprq.o objects
  1251. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/ruletab.c
  1252. mv ruletab.o objects
  1253. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/runargv.c
  1254. mv runargv.o objects
  1255. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/bsd43/putenv.c
  1256. mv putenv.o objects
  1257. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/bsd43/tempnam.c
  1258. mv tempnam.o objects
  1259. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/bsd43/utime.c
  1260. mv utime.o objects
  1261. cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/bsd43/setvbuf.c
  1262. mv setvbuf.o objects
  1263. cc  -o dmake  objects/infer.o objects/make.o objects/stat.o objects/expand.o objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o objects/quit.o objects/state.o objects/basename.o objects/dmdump.o objects/macparse.o objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o objects/putenv.o objects/tempnam.o objects/utime.o objects/setvbuf.o -luw 
  1264. cp unix/bsd43/uw/startup.mk startup.mk
  1265. SHAR_EOF
  1266. chmod 0640 dmake/unix/bsd43/uw/make.sh ||
  1267. echo 'restore of dmake/unix/bsd43/uw/make.sh failed'
  1268. Wc_c="`wc -c < 'dmake/unix/bsd43/uw/make.sh'`"
  1269. test 2977 -eq "$Wc_c" ||
  1270.     echo 'dmake/unix/bsd43/uw/make.sh: original size 2977, current size' "$Wc_c"
  1271. rm -f _shar_wnt_.tmp
  1272. fi
  1273. # ============= dmake/unix/bsd43/uw/public.h ==============
  1274. if test -f 'dmake/unix/bsd43/uw/public.h' -a X"$1" != X"-c"; then
  1275.     echo 'x - skipping dmake/unix/bsd43/uw/public.h (File already exists)'
  1276.     rm -f _shar_wnt_.tmp
  1277. else
  1278. > _shar_wnt_.tmp
  1279. sed 's/^X//' << 'SHAR_EOF' > 'dmake/unix/bsd43/uw/public.h' &&
  1280. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/bsd43/uw/RCS/public.h,v 1.1 91/05/06 15:29:14 dvadura Exp Locker: dvadura $
  1281. -- WARNING  -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT
  1282. --
  1283. -- SYNOPSIS -- Local functions exported to be visible by others.
  1284. --
  1285. -- DESCRIPTION
  1286. --      This file is generated by 'genpub'.  Function declarations
  1287. --      that appear in this file are extracted by 'genpub' from
  1288. --      source files.  Any function in the source file whose definition
  1289. --      appears like:
  1290. --
  1291. --          PUBLIC return_type
  1292. --          function( arg_list );
  1293. --          type_expr1 arg1;
  1294. --          ...
  1295. --
  1296. --      has its definition extracted and a line of the form:
  1297. --
  1298. --          return_type function ANSI((type_expr1,type_expr2,...));
  1299. --
  1300. --      entered into the output file.
  1301. --
  1302. -- AUTHOR
  1303. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  1304. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  1305. --
  1306. -- COPYRIGHT
  1307. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  1308. -- 
  1309. --      This program is free software; you can redistribute it and/or
  1310. --      modify it under the terms of the GNU General Public License
  1311. SHAR_EOF
  1312. true || echo 'restore of dmake/unix/bsd43/uw/public.h failed'
  1313. fi
  1314. echo 'End of part 33, continue with part 34'
  1315. echo 34 > _shar_seq_.tmp
  1316. exit 0
  1317.  
  1318. exit 0 # Just in case...
  1319. -- 
  1320. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1321. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1322. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1323. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1324.