home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume27 / dmake / part38 < prev    next >
Encoding:
Text File  |  1992-01-29  |  40.0 KB  |  1,279 lines

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