home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume16 / dist2 / part03 < prev    next >
Text File  |  1988-10-13  |  50KB  |  1,792 lines

  1. Subject:  v16i036:  Larry Wall's Configure generator, etc., Part03/07
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: lwall@jpl-devvax.jpl.nasa.gov (Larry Wall)
  7. Posting-number: Volume 16, Issue 36
  8. Archive-name: dist/part03
  9.  
  10. #! /bin/sh
  11.  
  12. # Make a new directory for the dist sources, cd to it, and run kits 1
  13. # thru 7 through sh.  When all 7 kits have been run, read README.
  14.  
  15. echo "This is dist 2.0 kit 3 (of 7).  If kit 3 is complete, the line"
  16. echo '"'"End of kit 3 (of 7)"'" will echo at the end.'
  17. echo ""
  18. export PATH || (echo "You didn't use sh, you clunch." ; kill $$)
  19. mkdir kit mcon mcon/U pat 2>/dev/null
  20. echo Extracting kit/makedist.SH
  21. sed >kit/makedist.SH <<'!STUFFY!FUNK!' -e 's/X//'
  22. Xcase $CONFIG in
  23. X'')
  24. X    if test ! -f config.sh; then
  25. X    ln ../config.sh . || \
  26. X    ln ../../config.sh . || \
  27. X    ln ../../../config.sh . || \
  28. X    (echo "Can't find config.sh."; exit 1)
  29. X    echo "Using config.sh from above..."
  30. X    fi
  31. X    . ./config.sh
  32. X    ;;
  33. Xesac
  34. Xecho "Extracting makedist (with variable substitutions)"
  35. X: This section of the file will have variable substitutions done on it.
  36. X: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
  37. X: Protect any dollar signs and backticks that you do not want interpreted
  38. X: by putting a backslash in front.
  39. Xcat >makedist <<!GROK!THIS!
  40. X#!/usr/bin/perl
  41. X    eval "exec /usr/bin/perl -S \$0 \$*"
  42. X        if \$running_under_some_shell;
  43. X
  44. X# $Header: makedist.SH,v 2.0 88/06/28 23:12:17 lwall Locked $
  45. X#
  46. X# $Log:    makedist.SH,v $
  47. X# Revision 2.0  88/06/28  23:12:17  lwall
  48. X# Baseline.
  49. X# 
  50. X
  51. X\$DIST='`pwd`';
  52. X\$ENV{'DIST'} = \$DIST;
  53. X!GROK!THIS!
  54. X
  55. X: In the following dollars and backticks do not need the extra backslash.
  56. X$spitshell >>makedist <<'!NO!SUBS!'
  57. X
  58. Xdo 'getopt.pl';
  59. Xdo Getopt("s");
  60. X
  61. X$MAXKITSIZE = 50000 unless $MAXKITSIZE = $opt_s;
  62. X$KITOVERHEAD = 1700;
  63. X$FILEOVERHEAD = 90;
  64. X$NEWMANI = 'MANIFEST.new';
  65. X$MANI = 'MANIFEST';
  66. X
  67. Xdo readpackage();
  68. X
  69. X$ENV{'package'} = $package;
  70. X$ENV{'baserev'} = $baserev;
  71. X
  72. Xunlink <$package.kit? $package.kit??>;
  73. X
  74. Xdo manifake();
  75. X
  76. Xsub manifake {
  77. X    # make MANIFEST and MANIFEST.new say the same thing
  78. X    if (! -f $NEWMANI) {
  79. X    if (-f $MANI) {
  80. X        open(IN,$MANI) || die "Can't open $MANI";
  81. X        open(OUT,">$NEWMANI") || die "Can't create $NEWMANI";
  82. X        while (<IN>) {
  83. X        next if 1 .. /---/;
  84. X        s/(\s+)[0-9]*\s*/$1/;
  85. X        }
  86. X        close IN; close OUT;
  87. X    }
  88. X    else {
  89. Xdie "You need to make a MANIFEST.new file, with names and descriptions.\n";
  90. X    }
  91. X    }
  92. X}
  93. X
  94. Xdo kitlists();
  95. X
  96. Xsub kitlists {
  97. X    open(IN,$NEWMANI) || die "Can't open $NEWMANI";
  98. X    @files = <IN>;
  99. X    close IN;
  100. X    for (@files) {
  101. X    s/\s.*\n//;
  102. X    ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
  103. X       $blksize,$blocks) = stat($_);
  104. X    $size += 1000000 if /README/;
  105. X    $size{$_} = $size;
  106. X    }
  107. X
  108. X    sub revnum { $size{$a} < $size{$b} ? 1 : $size{$a} > $size{$b} ? -1 : 0; }
  109. X    @files = sort revnum @files;
  110. X
  111. X    for (@files) {
  112. X    $size = $size{$_};
  113. X    $size -= 1000000 if /README/;
  114. X    $i=1;
  115. X    while (($newtot = int($tot[$i] + $size + $size/40 + $FILEOVERHEAD)) >
  116. X        $MAXKITSIZE-$KITOVERHEAD && $tot[$i]) {
  117. X          $i++;
  118. X    }
  119. X    $tot[$i] = $newtot;
  120. X    print "Adding $_ to kit $i giving $newtot bytes\n" if $opt_v;
  121. X    $kit{$_} = $i;
  122. X    $list[$i] .= " $_";
  123. X    }
  124. X}
  125. X
  126. Xdo manimake();
  127. X
  128. X# make MANIFEST and MANIFEST.new say the same thing
  129. Xsub manimake {
  130. X    die "You don't have a $NEWMANI file.  Run manifake.\n"
  131. X    unless -f "$NEWMANI";
  132. X    open(NEWMANI,$NEWMANI) || die "Can't read $NEWMANI";
  133. X    while (<NEWMANI>) {
  134. X    ($key,$val) = ($_,'') unless ($key,$val) = /^(\S+)\s+(.*)/;
  135. X    $comment{$key} = $val;
  136. X    }
  137. X    close NEWMANI;
  138. X
  139. X    open(MANI,">$MANI") || die "Can't create $MANI.\n";
  140. X    print MANI
  141. X"After all the $package kits are run you should have the following files:
  142. X
  143. XFilename        Kit Description
  144. X--------        --- -----------
  145. X";
  146. X    for (sort keys(comment)) {
  147. X    printf MANI "%-24s%2s %s\n",$_,$kit{$_},$comment{$_};
  148. X    }
  149. X    close MANI;
  150. X}
  151. X
  152. X$numkits = $#list;
  153. Xif ($numkits > 9) {
  154. X    $sp = '%02d';
  155. X}
  156. Xelse {
  157. X    $sp = '%d';
  158. X}
  159. X
  160. Xfor ($kitnum = 1; $kitnum <= $numkits; $kitnum++) {
  161. X    $list = $list[$kitnum];
  162. X    $kit = sprintf("$package.kit" . $sp,$kitnum);
  163. X    print "*** Making $kit ***\n" if $opt_v;
  164. X    open(KIT,">$kit") || die "Can't create $kit.\n";
  165. X
  166. X    do kitleader();
  167. X
  168. X    @files = split(' ',$list);
  169. X    reset 'X';
  170. X    for $file (@files) {
  171. X    $_ = $file;
  172. X    while (s|^(.*)/.*$|$1|) {
  173. X        push(@Xdirs,$_) unless $Xseen{$_}++;
  174. X    }
  175. X    }
  176. X    print KIT "mkdir ",join(' ', sort @Xdirs)," 2>/dev/null\n";
  177. X
  178. X    foreach $file (@files) {
  179. X    print "\t",$file,"\n" if $opt_v;
  180. X    print KIT "echo Extracting $file\n";
  181. X    print KIT "sed >$file <<'!STUFFY!FUNK!' -e 's/X//'\n";
  182. X    open file;
  183. X    while (<file>) {
  184. X        print KIT 'X',$_;
  185. X    }
  186. X    close file;
  187. X    print KIT "!STUFFY!FUNK!\n";
  188. X    }
  189. X    do kittrailer();
  190. X    chmod 0755, $kit;
  191. X}
  192. X
  193. Xsub kitleader {
  194. X    print KIT
  195. X"#! /bin/sh
  196. X
  197. X# Make a new directory for the $package sources, cd to it, and run kits 1
  198. X# thru $numkits through sh.  When all $numkits kits have been run, read README.
  199. X
  200. Xecho \"This is $package $baserev kit $kitnum (of $numkits).  If kit $kitnum is complete, the line\"
  201. Xecho '\"'\"End of kit $kitnum (of $numkits)\"'\" will echo at the end.'
  202. Xecho \"\"
  203. Xexport PATH || (echo \"You didn't use sh, you clunch.\" ; kill \$\$)
  204. X";
  205. X}
  206. X
  207. Xsub kittrailer {
  208. X    $rangelist = '';
  209. X    for ($i = 1; $i <= $numkits; $i++) {
  210. X    $rangelist .= ' ' . $i;
  211. X    }
  212. X    print KIT
  213. X"echo \"\"
  214. Xecho \"End of kit $kitnum (of $numkits)\"
  215. Xcat /dev/null >kit${kitnum}isdone
  216. Xrun=''
  217. Xconfig=''
  218. Xfor iskit in$rangelist; do
  219. X    if test -f kit\${iskit}isdone; then
  220. X    run=\"\$run \$iskit\"
  221. X    else
  222. X    todo=\"\$todo \$iskit\"
  223. X    fi
  224. Xdone
  225. Xcase \$todo in
  226. X    '')
  227. X    echo \"You have run all your kits.  Please read README and then type Configure.\"
  228. X    chmod 755 Configure
  229. X    ;;
  230. X    *)  echo \"You have run\$run.\"
  231. X    echo \"You still need to run\$todo.\"
  232. X    ;;
  233. Xesac
  234. X: Someone might mail this, so...
  235. Xexit
  236. X";
  237. X}
  238. X!NO!SUBS!
  239. Xcat ../pl/package.pl >>makedist
  240. Xchmod +x makedist
  241. X$eunicefix makedist
  242. !STUFFY!FUNK!
  243. echo Extracting mcon/U/locdist.U
  244. sed >mcon/U/locdist.U <<'!STUFFY!FUNK!' -e 's/X//'
  245. X?RCS:$Header: locdist.U,v 2.0 88/06/28 23:16:59 lwall Locked $
  246. X?RCS: $Log:    locdist.U,v $
  247. X?RCS: Revision 2.0  88/06/28  23:16:59  lwall
  248. X?RCS: Baseline.
  249. X?RCS: 
  250. X?MAKE:locdist orgdist citydist statedist cntrydist contdist: test newslibexp sed hostname cat echo n c rm Myread Oldconfig
  251. X?MAKE:    -pick add $@ %*
  252. X?S:locdist:
  253. X?S:    This variable contains the eventual value of the LOCDIST symbol,
  254. X?S:    which is the local organization's distribution name for news.
  255. X?S:.
  256. X?S:orgdist:
  257. X?S:    This variable contains the eventual value of the ORGDIST symbol,
  258. X?S:    which is the organization's distribution name for news.
  259. X?S:.
  260. X?S:citydist:
  261. X?S:    This variable contains the eventual value of the CITYDIST symbol,
  262. X?S:    which is the city's distribution name for news.
  263. X?S:.
  264. X?S:statedist:
  265. X?S:    This variable contains the eventual value of the STATEDIST symbol,
  266. X?S:    which is the state's or province's distribution name for news.
  267. X?S:.
  268. X?S:cntrydist:
  269. X?S:    This variable contains the eventual value of the CNTRYDIST symbol,
  270. X?S:    which is the country's distribution name for news.
  271. X?S:.
  272. X?S:contdist:
  273. X?S:    This variable contains the eventual value of the CONTDIST symbol,
  274. X?S:    which is the continent's distribution name for news.
  275. X?S:.
  276. X?C:LOCDIST:
  277. X?C:    This symbol contains the distribution name for the news system that
  278. X?C:    restricts article distribution to the local organization.
  279. X?C:.
  280. X?C:ORGDIST:
  281. X?C:    This symbol contains the distribution name for the news system that
  282. X?C:    restricts article distribution to the organization.
  283. X?C:.
  284. X?C:CITYDIST:
  285. X?C:    This symbol contains the distribution name for the news system that
  286. X?C:    restricts article distribution to the city.
  287. X?C:.
  288. X?C:STATEDIST:
  289. X?C:    This symbol contains the distribution name for the news system that
  290. X?C:    restricts article distribution to the state or province.
  291. X?C:.
  292. X?C:CNTRYDIST:
  293. X?C:    This symbol contains the distribution name for the news system that
  294. X?C:    restricts article distribution to the country.
  295. X?C:.
  296. X?C:CONTDIST:
  297. X?C:    This symbol contains the distribution name for the news system that
  298. X?C:    restricts article distribution to the continent.
  299. X?C:.
  300. X?H:?%1:#define LOCDIST "$locdist"        /**/
  301. X?H:?%1:#define ORGDIST "$orgdist"        /**/
  302. X?H:?%1:#define CITYDIST "$citydist"        /**/
  303. X?H:?%1:#define STATEDIST "$statedist"        /**/
  304. X?H:?%1:#define CNTRYDIST "$cntrydist"        /**/
  305. X?H:?%1:#define CONTDIST "$contdist"        /**/
  306. X?H:?%1:
  307. X: get the local distributions
  308. Xif $test -f $newslibexp/sys ; then
  309. X    $sed -n -e "s/^$hostname://p" <$newslibexp/sys | \
  310. X    $sed -e "s/:.*//" -e "s/,/ /g" | tr ' ' '\012' | \
  311. X    $sed -e "/^to./d" -e "/^net$/d" -e "/^fa$/d" -e "/^mod$/d" -e "/^world$/d" \
  312. X       -e "/^comp$/d" -e "/^news$/d" -e "/^misc$/d" -e "/^soc$/d" \
  313. X       -e "/^talk$/d" -e "/^sci$/d" -e "/^rec$/d" > .distlist
  314. Xfi
  315. X
  316. X$cat <<'EOH'
  317. XDistribution groups are the things you use on the Distribution line to limit
  318. Xwhere an article will go to.  You are likely to be a member of several
  319. Xdistribution groups, such as organization, city, state, province, country,
  320. Xcontinent, etc.  For example, Los Angeles has the distribution code "la",
  321. XNew Jersey has the code "nj", and Europe has the code "eunet".
  322. X
  323. XThe categories you will be asked are: 
  324. X
  325. Xlocal organization    (Could be just one machine or a cluster or an office)
  326. Xorganization        att, dec, kgb, ...
  327. Xcity            la, ny, mosc, ...
  328. Xstate/province        ca, nj, bc, ...
  329. Xcountry            usa, can, rok, whatever
  330. Xcontinent        na (North America, not "Not Applicable"), asia, etc.
  331. X
  332. X(If you don't have a distribution code in any of these categories then
  333. Xjust hit return.)
  334. X
  335. XEOH
  336. Xif $test -f .distlist; then
  337. X    distlist=`tr '\012' ' ' <.distlist`
  338. X    if $test "$distlist" ; then
  339. X    echo "(These are the distributions in your sys file: $distlist)"
  340. X    echo " "
  341. X    fi
  342. Xfi
  343. Xrp="[Hit return to continue]"
  344. X$echo $n "$rp $c"
  345. X. myread
  346. Xif test -f $newslibexp/distributions; then
  347. X    echo "Here is your distributions file:"
  348. X    echo " "
  349. X    cat $newslibexp/distributions
  350. X    echo " "
  351. Xfi
  352. Xcase "$locdist" in
  353. X'') dflt="none";;
  354. X*)  dflt="$locdist";;
  355. Xesac
  356. Xrp="What is the distribution code for your local organization? [$dflt]"
  357. X$echo $n "$rp $c"
  358. X. myread
  359. Xlocdist="$ans"
  360. Xcase "$orgdist" in
  361. X'') dflt="none";;
  362. X*)  dflt="$orgdist";;
  363. Xesac
  364. Xrp="What is the distribution code for your organization? [$dflt]"
  365. X$echo $n "$rp $c"
  366. X. myread
  367. Xorgdist="$ans"
  368. Xcase "$citydist" in
  369. X'') dflt="none";;
  370. X*)  dflt="$citydist";;
  371. Xesac
  372. Xrp="What is the distribution code for your city? [$dflt]"
  373. X$echo $n "$rp $c"
  374. X. myread
  375. Xcitydist="$ans"
  376. Xcase "$statedist" in
  377. X'') dflt="none";;
  378. X*)  dflt="$statedist";;
  379. Xesac
  380. Xrp="What is the distribution code for your state/province? [$dflt]"
  381. X$echo $n "$rp $c"
  382. X. myread
  383. Xstatedist="$ans"
  384. Xcase "$cntrydist" in
  385. X'') dflt="none";;
  386. X*)  dflt="$cntrydist";;
  387. Xesac
  388. Xrp="What is the distribution code for your country? [$dflt]"
  389. X$echo $n "$rp $c"
  390. X. myread
  391. Xcntrydist="$ans"
  392. Xcase "$contdist" in
  393. X'') dflt="none";;
  394. X*)  dflt="$contdist";;
  395. Xesac
  396. Xrp="What is the distribution code for your continent? [$dflt]"
  397. X$echo $n "$rp $c"
  398. X. myread
  399. Xcontdist="$ans"
  400. X
  401. X$cat <'EOM'
  402. X  
  403. XIf you have any other distribution groups you will need to edit Pnews
  404. Xand newsetup to add them.
  405. XEOM
  406. X$rm -f .distlist
  407. X
  408. !STUFFY!FUNK!
  409. echo Extracting pat/patmake.SH
  410. sed >pat/patmake.SH <<'!STUFFY!FUNK!' -e 's/X//'
  411. Xcase $CONFIG in
  412. X'')
  413. X    if test ! -f config.sh; then
  414. X    ln ../config.sh . || \
  415. X    ln ../../config.sh . || \
  416. X    ln ../../../config.sh . || \
  417. X    (echo "Can't find config.sh."; exit 1)
  418. X    echo "Using config.sh from above..."
  419. X    fi
  420. X    . ./config.sh
  421. X    ;;
  422. Xesac
  423. X: This forces SH files to create target in same directory as SH file.
  424. X: This is so that make depend always knows where to find SH derivatives.
  425. Xcase "$0" in
  426. X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
  427. Xesac
  428. Xecho "Extracting patmake (with variable substitutions)"
  429. Xcat >patmake <<!GROK!THIS!
  430. X#!/usr/bin/perl
  431. X        eval "exec /usr/bin/perl -S \$0 \$*"
  432. X                if \$running_under_some_shell;
  433. X
  434. X# $Header: patmake.SH,v 2.0 88/06/28 23:19:46 lwall Locked $
  435. X#
  436. X# $Log:    patmake.SH,v $
  437. X# Revision 2.0  88/06/28  23:19:46  lwall
  438. X# Baseline.
  439. X# 
  440. X# 
  441. X
  442. X\$defeditor='$defeditor';
  443. X!GROK!THIS!
  444. X
  445. X: In the following dollars and backticks do not need the extra backslash.
  446. Xcat >>patmake <<'!NO!SUBS!'
  447. X
  448. Xdo readpackage();
  449. X
  450. Xif (-f 'patchlevel.h') {
  451. X    open(PL,"patchlevel.h") || die "Can't open patchlevel.h\n";
  452. X    while (<PL>) {
  453. X        $last = $1 if /^#define\s+PATCHLEVEL\s+(\d+)/;
  454. X    }
  455. X    die "Malformed patchlevel.h file.\n" if $last eq '';
  456. X    $bnum = $last + 1;
  457. X}
  458. Xelse {
  459. X    $bnum = 1;
  460. X    $last = '';
  461. X}
  462. X
  463. X$mf = `grep '^[a-z]*:' [Mm]akefile* 2>&1`;
  464. X$* = 1;
  465. X$after = '';
  466. X$after .= "\t\tConfigure -d\n" if -f 'Configure';
  467. X$after .= "\t\tmake depend\n" if $mf =~ /^depend:/;
  468. X$after .= "\t\tmake\n" if $mf;
  469. X$after .= "\t\tmake test\n" if $mf =~ /^test:/;
  470. X$after .= "\t\tmake install\n" if $mf =~ /^install:/;
  471. X$* = 0;
  472. X
  473. Xchdir 'bugs' if -d 'bugs';
  474. X
  475. Xdie "Patch #$bnum already exists.\n" if -f "patch$bnum";
  476. X
  477. X@patlist=<*.$bnum>;
  478. Xdie "No diff files for patch #$bnum.\n" if $patlist[0] =~ /^\*/;
  479. X
  480. Xif (-s ".logs$bnum") {
  481. X    $logs = '';
  482. X    open(LOGS,".logs$bnum");
  483. X    while (<LOGS>) {
  484. X    $logs .= $_ unless $logseen{$_};
  485. X    $logseen{$_} = 1;
  486. X    }
  487. X    close LOGS;
  488. X    $subs = $logs;
  489. X    $* = 1;
  490. X    $logs =~ s/^patch\d+:\s*/\t/g;
  491. X    $logs =~ s/\n/\n\n/g;
  492. X    $subs =~ s/^patch\d+:\s*/Subject: /g;
  493. X    $* = 0;
  494. X}
  495. Xelse {
  496. X    $subs = "Subject: \n";
  497. X}
  498. X
  499. X$hah = " (hah!)" if $bnum == 1;
  500. X
  501. Xopen(PATCH,">patch$bnum") || die "Can't create patch";
  502. Xprint PATCH
  503. X"System: $package version $baserev
  504. XPatch #: $bnum
  505. XPriority: 
  506. X${subs}From:
  507. X
  508. XDescription:
  509. X$logs
  510. XRepeat-By:
  511. X
  512. XFix:    From rn, say \"| patch -p -N -d DIR\", where DIR is your $package source
  513. X    directory.  Outside of rn, say \"cd DIR; patch -p -N <thisarticle\".
  514. X    If you don't have the patch program, apply the following by hand,
  515. X    or get patch (version 2.0, latest patchlevel).
  516. X
  517. X    After patching:
  518. X$after
  519. X    If patch indicates that patchlevel is the wrong version, you may need
  520. X    to apply one or more previous patches, or the patch may already
  521. X    have been applied.  See the patchlevel.h file to find out what has or
  522. X    has not been applied.  In any event, don't continue with the patch.
  523. X
  524. X    If you are missing previous patches$hah they can be obtained from me:
  525. X
  526. X    $maintname
  527. X    $maintloc
  528. X
  529. X    If you send a mail message of the following form it will greatly speed
  530. X    processing:
  531. X
  532. X    Subject: Command
  533. X    @SH mailpatch PATH $package $baserev LIST
  534. X           ^ note the c
  535. X
  536. X    where PATH is a return path FROM ME TO YOU either in Internet notation,
  537. X    or in bang notation from some well-known host, and LIST is the number
  538. X    of one or more patches you need, separated by spaces, commas, and/or
  539. X    hyphens.  Saying 35- says everything from 35 to the end.
  540. X
  541. X";
  542. Xif ($ftpsite) {
  543. X    print PATCH "
  544. X    You can also get the patches via anonymous FTP from
  545. X    $ftpsite.
  546. X";
  547. X}
  548. Xprint PATCH "
  549. XIndex: patchlevel.h
  550. X";
  551. X
  552. Xif ($last eq '') {
  553. X    `echo "#define PATCHLEVEL 1" >patchlevel.h`;
  554. X    `cp /dev/null patchlevel.h.null`;
  555. X    print PATCH `diff -c patchlevel.h.null patchlevel.h`;
  556. X    unlink 'patchlevel.h', 'patchlevel.h.null';
  557. X}
  558. Xelse {
  559. X    print PATCH
  560. X"Prereq: $last
  561. X1c1
  562. X< #define PATCHLEVEL $last
  563. X---
  564. X> #define PATCHLEVEL $bnum
  565. X";
  566. X}
  567. X
  568. X@ARGV = @patlist;
  569. Xwhile (<>) { print PATCH; }
  570. Xclose PATCH;
  571. X
  572. X$editor = $ENV{'VISUAL'};
  573. X$editor = $ENV{'EDITOR'} unless $editor;
  574. X$editor = $defeditor unless $editor;
  575. X$editor = 'vi' unless $editor;
  576. Xsystem $editor, "patch$bnum";
  577. Xif (-s "patch$bnum") {
  578. X    `echo "#define PATCHLEVEL $bnum" >../patchlevel.h`;
  579. X    open(PL,"patchlevel.h") || die "Can't open patchlevel.h\n";
  580. X    while (<PL>) {
  581. X    $bnum = $1 if /^#define\s+PATCHLEVEL\s+(\d+)/;
  582. X    }
  583. X    die "Malformed patchlevel.h file.\n" if $bnum eq '';
  584. X    
  585. X    if ($newsgroups) {
  586. X    print "\nDo you wish to post patch #$bnum to $newsgroups? [y] ";
  587. X    $ans = <stdin>;
  588. X    system 'patpost', $bnum unless $ans =~ /^n/i;
  589. X    }
  590. X    if ($recipients) {
  591. X    print "\nDo you wish to send patch #$bnum to $recipients? [y] ";
  592. X    $ans = <stdin>;
  593. X    system 'patsend', $bnum, $recipients unless $ans =~ /^n/i;
  594. X    }
  595. X    if ($ftpdir) {
  596. X    print "\nDo you wish to copy patch #$bnum to $ftpdir? [y] ";
  597. X    $ans = <stdin>;
  598. X    system 'patftp', $bnum unless $ans =~ /^n/i;
  599. X    }
  600. X    utime time, time, 'patchlevel.h';
  601. X}
  602. Xelse {
  603. X    unlink "patch$bnum";
  604. X    die "Aborted.\n";
  605. X}
  606. X
  607. X!NO!SUBS!
  608. Xcat ../pl/package.pl >>patmake
  609. Xchmod +x patmake
  610. X$eunicefix patmake
  611. !STUFFY!FUNK!
  612. echo Extracting mcon/U/hostname.U
  613. sed >mcon/U/hostname.U <<'!STUFFY!FUNK!' -e 's/X//'
  614. X?RCS:$Header: hostname.U,v 2.0 88/06/28 23:16:46 lwall Locked $
  615. X?RCS: $Log:    hostname.U,v $
  616. X?RCS: Revision 2.0  88/06/28  23:16:46  lwall
  617. X?RCS: Baseline.
  618. X?RCS: 
  619. X?MAKE:hostname phostname mydomain: echo contains sed test n c Myread Oldconfig Guess
  620. X?MAKE:    -pick add $@ %*
  621. X?S:hostname:
  622. X?S:    This variable contains the eventual value of the HOSTNAME symbol,
  623. X?S:    which is the name of the host the program is going to run on.
  624. X?S:    The domain is not kept with hostname, but must be gotten from mydomain.
  625. X?S:    The dot comes with mydomain, and need not be supplied by the program.
  626. X?S:.
  627. X?S:mydomain:
  628. X?S:    This variable contains the eventual value of the MYDOMAIN symbol,
  629. X?S:    which is the domain of the host the program is going to run on.
  630. X?S:    The domain must be appended to hostname to form a complete host name.
  631. X?S:    The dot comes with mydomain, and need not be supplied by the program.
  632. X?S:.
  633. X?S:phostname:
  634. X?S:    This variable contains the eventual value of the PHOSTNAME symbol,
  635. X?S:    which is a command that can be fed to popen() to get the host name.
  636. X?S:    The program should probably not presume that the domain is or isn't
  637. X?S:    there already.
  638. X?S:.
  639. X?C:HOSTNAME:
  640. X?C:    This symbol contains name of the host the program is going to run on.
  641. X?C:    The domain is not kept with hostname, but must be gotten from MYDOMAIN.
  642. X?C:    The dot comes with MYDOMAIN, and need not be supplied by the program.
  643. X?C:    If gethostname() or uname() exist, HOSTNAME may be ignored.
  644. X?C:.
  645. X?C:MYDOMAIN:
  646. X?C:    This symbol contains the domain of the host the program is going to
  647. X?C:    run on.  The domain must be appended to HOSTNAME to form a complete
  648. X?C:    host name.  The dot comes with MYDOMAIN, and need not be supplied by
  649. X?C:    the program.  If the host name is derived from PHOSTNAME, the domain
  650. X?C:    may or may not already be there, and the program should check.
  651. X?C:.
  652. X?H:?%1:#define HOSTNAME "$hostname"        /**/
  653. X?H:?%1:#define MYDOMAIN "$mydomain"        /**/
  654. X?H:?%1:
  655. X: now get the host name
  656. Xecho " "
  657. Xecho "Figuring out host name..."
  658. Xecho 'Maybe "hostname" will work...'
  659. Xif ans=`sh -c hostname 2>&1` ; then
  660. X    hostname=$ans
  661. X    phostname=hostname
  662. Xelse
  663. X    echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
  664. X    if ans=`cat /etc/systemid 2>&1` ; then
  665. X    hostname=$ans
  666. X    phostname='cat /etc/systemid'
  667. X    if xenix; then
  668. X        echo "Whadyaknow.  Xenix always was a bit strange..."
  669. X    else
  670. X        echo "What is a non-Xenix system doing with /etc/systemid?"
  671. X    fi
  672. X    else
  673. X    echo 'No, maybe "uuname -l" will work...'
  674. X    if ans=`sh -c 'uuname -l' 2>&1` ; then
  675. X        hostname=$ans
  676. X        phostname='uuname -l'
  677. X    else
  678. X        echo 'Strange.  Maybe "uname -n" will work...'
  679. X        if ans=`sh -c 'uname -n' 2>&1` ; then
  680. X        hostname=$ans
  681. X        phostname='uname -n'
  682. X        else
  683. X        echo 'Oh well, maybe I can mine it out of whoami.h...'
  684. X        if ans=`sh -c $contains' sysname /usr/include/whoami.h' 2>&1` ; then
  685. X            hostname=`echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
  686. X            phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' </usr/include/whoami.h"
  687. X        else
  688. X            case "$hostname" in
  689. X            '') echo "Does this machine have an identity crisis or something?"
  690. X            phostname=''
  691. X            ;;
  692. X            *)  echo "Well, you said $hostname before...";;
  693. X            esac
  694. X        fi
  695. X        fi
  696. X    fi
  697. X    fi
  698. Xfi
  699. X: you do not want to know about this
  700. Xset $hostname
  701. Xhostname=$1
  702. X
  703. X: translate upper to lower if necessary
  704. Xcase "$hostname" in
  705. X    *[A-Z]*)
  706. X    hostname=`echo $hostname | tr '[A-Z]' '[a-z]'`
  707. X    echo "(Normalizing case in your host name)"
  708. X    ;;
  709. Xesac
  710. X
  711. X: verify guess
  712. Xif $test "$hostname" ; then
  713. X    dflt=y
  714. X    echo 'Your host name appears to be "'$hostname'".'
  715. X    $echo $n "Is this correct? [$dflt] $c"
  716. X    rp="Sitename is $hostname? [$dflt]"
  717. X    . myread
  718. X    case "$ans" in
  719. X      y*)  ;;
  720. X      *)      hostname='' ;;
  721. X    esac
  722. Xfi
  723. X
  724. X: bad guess or no guess
  725. Xwhile $test "X$hostname" = X ; do
  726. X    dflt=''
  727. X    rp="Please type the (one word) name of your host:"
  728. X    $echo $n "$rp $c"
  729. X    . myread
  730. X    hostname="$ans"
  731. Xdone
  732. X
  733. Xecho " "
  734. Xcase "$hostname" in
  735. X*.*)
  736. X    dflt=`expr "X$hostname" : "X[^.]*\(\..*\)"`
  737. X    hostname=`expr "X$hostname" : "X\([^.]*\)\."`
  738. X    echo "(Trimming domain name from host name--host name is now $hostname)"
  739. X    ;;
  740. X*)
  741. X    dflt='.uucp'
  742. X    ;;
  743. Xesac
  744. Xrp="What is your domain name? [$dflt]"
  745. X$echo $n "$rp $c"
  746. X. myread
  747. Xcase "$ans" in
  748. X'') ;;
  749. X.*) ;;
  750. X*) ans=".$ans";;
  751. Xesac
  752. Xmydomain="$ans"
  753. X
  754. X: a little sanity check here
  755. Xcase "$phostname" in
  756. X'') ;;
  757. X*)  case `$phostname` in
  758. X    $hostname$mydomain|$hostname) ;;
  759. X    *)
  760. X    case "$phostname" in
  761. X    sed*)
  762. X        echo "(That doesn't agree with your whoami.h file, by the way.)"
  763. X        ;;
  764. X    *)
  765. X        echo "(That doesn't agree with your $phostname command, by the way.)"
  766. X        ;;
  767. X    esac
  768. X    phostname=''
  769. X    ;;
  770. X    esac
  771. X    ;;
  772. Xesac
  773. X
  774. !STUFFY!FUNK!
  775. echo Extracting pat/patdiff.SH
  776. sed >pat/patdiff.SH <<'!STUFFY!FUNK!' -e 's/X//'
  777. Xcase $CONFIG in
  778. X'')
  779. X    if test ! -f config.sh; then
  780. X    ln ../config.sh . || \
  781. X    ln ../../config.sh . || \
  782. X    ln ../../../config.sh . || \
  783. X    (echo "Can't find config.sh."; exit 1)
  784. X    fi
  785. X    . ./config.sh
  786. X    ;;
  787. Xesac
  788. X: This forces SH files to create target in same directory as SH file.
  789. X: This is so that make depend always knows where to find SH derivatives.
  790. Xcase "$0" in
  791. X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
  792. Xesac
  793. Xecho "Extracting patdiff (with variable substitutions)"
  794. Xcat >patdiff <<!GROK!THIS!
  795. X#!/usr/bin/perl
  796. X        eval "exec /usr/bin/perl -S \$0 \$*"
  797. X                if \$running_under_some_shell;
  798. X
  799. X# $Header: patdiff.SH,v 2.0 88/06/28 23:19:39 lwall Locked $
  800. X#
  801. X# $Log:    patdiff.SH,v $
  802. X# Revision 2.0  88/06/28  23:19:39  lwall
  803. X# Baseline.
  804. X# 
  805. X# 
  806. X
  807. X!GROK!THIS!
  808. X
  809. X: In the following dollars and backticks do not need the extra backslash.
  810. Xcat >>patdiff <<'!NO!SUBS!'
  811. X
  812. X$RCSEXT = ',v' unless $RCSEXT;
  813. X
  814. Xdie "patdiff [files]\n" unless $#ARGV >= 0;
  815. X
  816. Xdo readpackage();
  817. X
  818. Xsystem 'mkdir', 'bugs' unless -d 'bugs';
  819. X
  820. Xif (-f 'patchlevel.h') {
  821. X    open(PL,"patchlevel.h") || die "Can't open patchlevel.h\n";
  822. X    while (<PL>) {
  823. X        $bnum = $1 if /^#define\s+PATCHLEVEL\s+(\d+)/;
  824. X    }
  825. X    die "Malformed patchlevel.h file.\n" if $bnum eq '';
  826. X    ++$bnum;
  827. X}
  828. Xelse {
  829. X    $bnum=1;
  830. X}
  831. X
  832. X$update = 1;
  833. Xwhile ($ARGV[0] =~ /^-/) {
  834. X    $_ = shift;
  835. X    last if /--/;
  836. X    if ($_ eq '-n') {
  837. X        $update = 0;
  838. X    }
  839. X    elsif ($_ eq '-a') {
  840. X        $all++;
  841. X    }
  842. X    else {
  843. X        die "Unrecognized switch: $_\n";
  844. X    }
  845. X}
  846. X
  847. Xif ($all) {
  848. X    open(MANI,"MANIFEST.new") || die "No MANIFEST.new found.\n";
  849. X    @ARGV = ();
  850. X    while (<MANI>) {
  851. X        chop;
  852. X    ($_) = split(' ');
  853. X        push(@ARGV,$_);
  854. X    }
  855. X    close MANI;
  856. X}
  857. X
  858. Xforeach $file (@ARGV) {
  859. X    if (! -f $file) {
  860. X    print "$file not found.\n";
  861. X    }
  862. X    else {
  863. X    $files = do rcsargs($file);
  864. X    @files = split(' ',$files);
  865. X    $new='';
  866. X    $revs=0;
  867. X    $rlog = `rlog -rlastpat- $files 2>&1`;
  868. X    ($lastpat) = ($rlog =~ /lastpat: ([\d.]+)/);
  869. X    ($revs) = ($rlog =~ /selected revisions: (\d+)/);
  870. X    if (!$revs) {
  871. X        print "No cil has been done on $file.\n" ;;
  872. X    }
  873. X    elsif ($revs == 1) {
  874. X        ($base) = ($rlog =~ /.*\nrevision\s+(\S+)/);
  875. X        ($a,$b,$c,$d) = split(/\./,$base);
  876. X        if ($d ne '') {
  877. X        if ($update) {
  878. X            print "No changes in $file since last patch.  (Did you cil it?)\n";
  879. X        }
  880. X        else {
  881. X            $new='foo';
  882. X        }
  883. X        }
  884. X        else {
  885. X        $revs=0;
  886. X        $rlog = `rlog -r$revbranch- $files 2>&1`;
  887. X        ($revs) = ($rlog =~ /selected revisions: (\d+)/);
  888. X        if (!$revs) {
  889. X            print "No changes in $file since base version.  (Did you cil it?)\n";
  890. X        }
  891. X        else {
  892. X            ($new) = ($rlog =~ /\nrevision\s*(\d+\.\d+\.\d+\.\d+)/);
  893. X        }
  894. X        }
  895. X    }
  896. X    else {
  897. X        ($new) = ($rlog =~ /\nrevision\s*(\d+\.\d+\.\d+\.\d+)/);
  898. X    }
  899. X    if ($new ne '') {
  900. X        ($fname = $file) =~ s|.*/||;
  901. X        open(PATCH,">>bugs/$fname.$bnum") || die "Can't make patch";
  902. X        print PATCH "\nIndex: $file\n";
  903. X        open(CO,"co -p -rlastpat $files 2>/dev/null |");
  904. X        while (<CO>) {
  905. X        if (/\$Header/) {
  906. X            print PATCH "Prereq: $lastpat\n";
  907. X            last;
  908. X        }
  909. X        }
  910. X        close CO;
  911. X        if ($update) {
  912. X        if ($mydiff eq '') {
  913. X            open(DIFF,"rcsdiff -c -rlastpat -r$new $files |") ||
  914. X            die "Can't run rcsdiff";
  915. X            while (<DIFF>) {
  916. X            if ($. == 1) {s|\*\*\* \S+    |*** $file.old    |;}
  917. X            if ($. == 2) {s|--- \S+    |--- $file    |;}
  918. X            print PATCH;
  919. X            }
  920. X            close DIFF;
  921. X            system 'rcs', "-Nlastpat:$new", @files;
  922. X        }
  923. X        else {
  924. X            system "co -p -rlastpat $files >/tmp/pdo$$";
  925. X            system "co -p -r$new $files >/tmp/pdn$$";
  926. X            open(DIFF, "$mydiff /tmp/pdo$$ /tmp/pdn$$ |") ||
  927. X            die "Can't run $mydiff";
  928. X            while (<DIFF>) {
  929. X            if ($. == 1) {s|\*\*\* \S+    |*** $file.old    |;}
  930. X            if ($. == 2) {s|--- \S+    |--- $file    |;}
  931. X            print PATCH;
  932. X            }
  933. X            close DIFF;
  934. X            system 'rcs', "-Nlastpat:$new", @files;
  935. X            unlink "/tmp/pdn$$", "/tmp/pdo$$";
  936. X        }
  937. X        }
  938. X        else {
  939. X        if ($mydiff eq '') {
  940. X            open(DIFF,"rcsdiff -c -rlastpat $files |") ||
  941. X            die "Can't run rcsdiff";
  942. X            while (<DIFF>) {
  943. X            if ($. == 1) {s|\*\*\* \S+    |*** $file.old    |;}
  944. X            if ($. == 2) {s|--- \S+    |--- $file    |;}
  945. X            print PATCH;
  946. X            }
  947. X            close DIFF;
  948. X        }
  949. X        else {
  950. X            system "co -p -rlastpat $files >/tmp/pdo$$";
  951. X            system "cp $file /tmp/pdn$$";
  952. X            open(DIFF, "$mydiff /tmp/pdo$$ /tmp/pdn$$ |") ||
  953. X            die "Can't run $mydiff";
  954. X            while (<DIFF>) {
  955. X            if ($. == 1) {s|\*\*\* \S+    |*** $file.old    |;}
  956. X            if ($. == 2) {s|--- \S+    |--- $file    |;}
  957. X            print PATCH;
  958. X            }
  959. X            close DIFF;
  960. X            unlink "/tmp/pdn$$", "/tmp/pdo$$";
  961. X        }
  962. X        }
  963. X    }
  964. X    }
  965. X}
  966. Xunlink ".rlog$$";
  967. X
  968. X!NO!SUBS!
  969. Xcat ../pl/package.pl >>patdiff
  970. Xcat ../pl/rcsargs.pl >>patdiff
  971. Xchmod +x patdiff
  972. X$eunicefix patdiff
  973. !STUFFY!FUNK!
  974. echo Extracting mcon/U/d_gethname.U
  975. sed >mcon/U/d_gethname.U <<'!STUFFY!FUNK!' -e 's/X//'
  976. X?RCS:$Header: d_gethname.U,v 2.0 88/06/28 23:14:41 lwall Locked $
  977. X?RCS: $Log:    d_gethname.U,v $
  978. X?RCS: Revision 2.0  88/06/28  23:14:41  lwall
  979. X?RCS: Baseline.
  980. X?RCS: 
  981. X?MAKE:d_gethname d_douname d_phostname: contains echo phostname cat hostname package d_portable n c d_whoami Myread libc
  982. X?MAKE:    -pick add $@ %*
  983. X?S:d_gethname:
  984. X?S:    This variable conditionally defines the GETHOSTNAME symbol, which
  985. X?S:    indicates to the C program that the gethostname() routine may be
  986. X?S:    used to derive the host name.
  987. X?S:.
  988. X?S:d_douname:
  989. X?S:    This variable conditionally defines the DOUNAME symbol, which
  990. X?S:    indicates to the C program that the uname() routine may be
  991. X?S:    used to derive the host name.
  992. X?S:.
  993. X?S:d_phostname:
  994. X?S:    This variable conditionally defines the PHOSTNAME symbol, which
  995. X?S:    contains the shell command which, when fed to popen(), may be
  996. X?S:    used to derive the host name.
  997. X?S:.
  998. X?C:GETHOSTNAME:
  999. X?C:    This symbol, if defined, indicates that the C program may use the
  1000. X?C:    gethostname() routine to derive the host name.  See also DOUNAME
  1001. X?C:    and PHOSTNAME.
  1002. X?C:.
  1003. X?C:DOUNAME:
  1004. X?C:    This symbol, if defined, indicates that the C program may use the
  1005. X?C:    uname() routine to derive the host name.  See also GETHOSTNAME and
  1006. X?C:    PHOSTNAME.
  1007. X?C:.
  1008. X?C:PHOSTNAME:
  1009. X?C:    This symbol, if defined, indicates that the C program may use the
  1010. X?C:    contents of PHOSTNAME as a command to feed to the popen() routine
  1011. X?C:    to derive the host name.  See also GETHOSTNAME and DOUNAME.
  1012. X?C:.
  1013. X?H:?%1:#$d_gethname    GETHOSTNAME    /**/
  1014. X?H:?%1:#$d_douname    DOUNAME        /**/
  1015. X?H:?%1:#$d_phostname    PHOSTNAME "$phostname"    /**/
  1016. X?H:?%1:
  1017. X: see how we will look up host name
  1018. Xecho " "
  1019. Xd_douname="$undef"
  1020. Xd_gethname="$undef"
  1021. Xd_phostname="$undef"
  1022. X
  1023. Xif xenix; then
  1024. X    echo " "
  1025. X    echo "(Assuming Xenix uname() is broken.)"
  1026. Xelif $contains '^gethostname$' libc.list >/dev/null 2>&1 ; then
  1027. X    echo "gethostname() found."
  1028. X    d_gethname="$define"
  1029. X    ans=gethostname
  1030. Xelif $contains '^uname$' libc.list >/dev/null 2>&1 ; then
  1031. X    echo "uname() found."
  1032. X    d_douname="$define"
  1033. X    ans=uname
  1034. Xfi
  1035. X
  1036. Xcase "$d_douname$d_gethname" in
  1037. X*define*)
  1038. X    dflt=n
  1039. X    cat <<EOM
  1040. XEvery now and then someone has a $ans() that lies about the hostname
  1041. Xbut can't be fixed for political or economic reasons.  Would you like to
  1042. XEOM
  1043. X    rp="pretend $ans() isn't there and maybe compile in the hostname? [$dflt]"
  1044. X    $echo $n "$rp $c"
  1045. X    . myread
  1046. X    case "$ans" in
  1047. X    y*) d_douname="$undef" d_gethname="$undef"
  1048. X    $echo $n "Okay... $c"
  1049. X    ;;
  1050. X    esac
  1051. X    ;;
  1052. Xesac
  1053. X
  1054. Xcase "$d_douname$d_gethname" in
  1055. X*define*) ;;
  1056. X*)
  1057. X    case "$phostname" in
  1058. X      '') ;;
  1059. X      *)
  1060. X    $cat <<EOT
  1061. XThere is no gethostname() or uname() on this system.  You have two
  1062. Xpossibilities at this point:
  1063. X
  1064. X1)  You can have your host name ($hostname) compiled into $package, which
  1065. X    lets $package start up faster, but makes your binaries non-portable, or
  1066. X2)  you can have $package use a
  1067. X    
  1068. X    popen("$phostname","r")
  1069. X
  1070. X    which will start slower but be more portable.
  1071. X
  1072. XOption 1 will give you the option of using whoami.h if you have one.  If you
  1073. Xwant option 2 but with a different command, you can edit config.sh at the
  1074. Xend of this shell script.
  1075. X
  1076. XEOT
  1077. X    case "$d_phostname" in
  1078. X    "$define") dflt=n;;
  1079. X    "$undef")  dflt=y;;
  1080. X    '')
  1081. X        case "$d_portable" in
  1082. X        "$define") dflt=n ;;
  1083. X        *)      dflt=y ;;
  1084. X        esac
  1085. X        ;;
  1086. X    esac
  1087. X    rp="Do you want your host name compiled in? [$dflt]"
  1088. X    $echo $n "$rp $c"
  1089. X    . myread
  1090. X    case "$ans" in
  1091. X      n*) d_phostname="$define" ;;
  1092. X      *)  phostname=''
  1093. X          d_phostname="$undef"
  1094. X          ;;
  1095. X    esac
  1096. X    ;;
  1097. X    esac
  1098. X    case "$phostname" in
  1099. X      '')
  1100. X    case "$d_whoami" in
  1101. X      "$define")
  1102. X        dflt=y
  1103. X        $cat <<EOM
  1104. XNo hostname function--you can either use the whoami.h file, which has this line:
  1105. X
  1106. X    `grep sysname /usr/include/whoami.h`
  1107. X
  1108. Xor you can have the name we came up with earlier ($hostname) hardwired in.
  1109. XEOM
  1110. X        rp="Use whoami.h to get hostname? [$dflt]"
  1111. X        $echo $n "$rp $c"
  1112. X        . myread
  1113. X        case "$ans" in
  1114. X        n*) d_whoami="$undef";;
  1115. X        esac
  1116. X        ;;
  1117. X      "$undef")
  1118. X        echo 'No hostname function and no whoami.h--hardwiring "'$hostname'".'
  1119. X        ;;
  1120. X    esac
  1121. X    ;;
  1122. X    esac
  1123. X    ;;
  1124. Xesac
  1125. X
  1126. !STUFFY!FUNK!
  1127. echo Extracting mcon/U/nametype.U
  1128. sed >mcon/U/nametype.U <<'!STUFFY!FUNK!' -e 's/X//'
  1129. X?RCS:$Header: nametype.U,v 2.0 88/06/28 23:17:33 lwall Locked $
  1130. X?RCS: $Log:    nametype.U,v $
  1131. X?RCS: Revision 2.0  88/06/28  23:17:33  lwall
  1132. X?RCS: Baseline.
  1133. X?RCS: 
  1134. X?MAKE:nametype d_passnames d_berknames d_usgnames passcat: echo n c Myread Guess Oldconfig test contains
  1135. X?MAKE:    -pick add $@ %*
  1136. X?S:nametype:
  1137. X?S:    This variable indicates how full names are stored on this system.
  1138. X?S:    Values are bsd, usg, and other.
  1139. X?S:.
  1140. X?S:d_passnames:
  1141. X?S:    This variable conditionally defines the PASSNAMES symbol,
  1142. X?S:    which indicates to the C program that full names are stored in
  1143. X?S:    the /etc/passwd file.
  1144. X?S:.
  1145. X?S:d_berknames:
  1146. X?S:    This variable conditionally defines the PASSNAMES symbol,
  1147. X?S:    which indicates to the C program that full names are stored in
  1148. X?S:    the /etc/passwd file in Berkeley format.
  1149. X?S:.
  1150. X?S:d_usgnames:
  1151. X?S:    This variable conditionally defines the PASSNAMES symbol,
  1152. X?S:    which indicates to the C program that full names are stored in
  1153. X?S:    the /etc/passwd file in USG format.
  1154. X?S:.
  1155. X?S:passcat:
  1156. X?S:    This variable contains a command that produces the text of the
  1157. X?S:    /etc/passwd file.  This is normally "cat passwd", but can be
  1158. X?S:    "ypcat passwd" on suns.
  1159. X?S:.
  1160. X?C:PASSNAMES:
  1161. X?C:    This symbol, if defined, indicates that full names are stored in
  1162. X?C:    the /etc/passwd file.
  1163. X?C:.
  1164. X?C:BERKNAMES:
  1165. X?C:    This symbol, if defined, indicates that full names are stored in
  1166. X?C:    the /etc/passwd file in Berkeley format (name first thing, everything
  1167. X?C:    up to first comma, with & replaced by capitalized login id, yuck).
  1168. X?C:.
  1169. X?C:USGNAMES:
  1170. X?C:    This symbol, if defined, indicates that full names are stored in
  1171. X?C:    the /etc/passwd file in USG format (everything after - and before ( is
  1172. X?C:    the name).
  1173. X?C:.
  1174. X?H:?%1:#$d_passnames    PASSNAMES /*  (undef to take name from ~/.fullname) */
  1175. X?H:?%1:#$d_berknames    BERKNAMES /* (that is, ":name,stuff:") */
  1176. X?H:?%1:#$d_usgnames    USGNAMES  /* (that is, ":stuff-name(stuff):") */
  1177. X?H:?%1:
  1178. X: find out how to find out full name
  1179. Xecho " "
  1180. Xcase "$d_berknames" in
  1181. X"$define")
  1182. X    dflt=y;;
  1183. X"$undef")
  1184. X    dflt=n;;
  1185. X*)
  1186. X    if bsd; then
  1187. X    dflt=y
  1188. X    else
  1189. X    dflt=n
  1190. X    fi
  1191. X    ;;
  1192. Xesac
  1193. Xecho "Does your /etc/passwd file keep full names in Berkeley/V7 format (name first"
  1194. X$echo $n "thing after ':' in GCOS field)? [$dflt] $c"
  1195. Xrp="Berkeley/V7 format full name? [$dflt]"
  1196. X. myread
  1197. Xcase "$ans" in
  1198. X  y*)
  1199. X    d_passnames="$define"
  1200. X    d_berknames="$define"
  1201. X    d_usgnames="$undef"
  1202. X    nametype=bsd
  1203. X    ;;
  1204. X  *)
  1205. X    echo " "
  1206. X    case "$d_usgnames" in
  1207. X    "$define")
  1208. X    dflt=y;;
  1209. X    "$undef")
  1210. X    dflt=n;;
  1211. X    *)
  1212. X    if usg; then
  1213. X        dflt=y
  1214. X    else
  1215. X        dflt=n
  1216. X    fi
  1217. X    ;;
  1218. X    esac
  1219. X    echo "Does your passwd file keep full names in USG format (name sandwiched"
  1220. X    $echo $n "between a '-' and a '(')? [$dflt] $c"
  1221. X    rp="USG format full name? [$dflt]"
  1222. X    . myread
  1223. X    case "$ans" in
  1224. X      n*)
  1225. X    echo "Full name will be taken from ~/.fullname"
  1226. X    d_passnames="$undef"
  1227. X    d_berknames="$undef"
  1228. X    d_usgnames="$undef"
  1229. X    nametype=other
  1230. X    ;;
  1231. X      *)
  1232. X    d_passnames="$define"
  1233. X    d_berknames="$undef"
  1234. X    d_usgnames="$define"
  1235. X    nametype=usg
  1236. X    ;;
  1237. X    esac
  1238. X    ;;
  1239. Xesac
  1240. X
  1241. X: see if we have to deal with yellow pages
  1242. Xif $test -d /usr/etc/yp; then
  1243. X    if $contains '^\+:' /etc/passwd; then
  1244. X    dflt=y
  1245. X    else
  1246. X    dflt=n
  1247. X    fi
  1248. X    rp="Are you getting the passwd file via yellow pages? [$dflt]"
  1249. X    $echo $n "$rp $c"
  1250. X    . myread
  1251. X    case "$ans" in
  1252. X    y*) passcat='ypcat passwd';;
  1253. X    *) passcat='cat /etc/passwd';;
  1254. X    esac
  1255. Xelse
  1256. X    passcat='cat /etc/passwd'
  1257. Xfi
  1258. X
  1259. !STUFFY!FUNK!
  1260. echo Extracting config.h.SH
  1261. sed >config.h.SH <<'!STUFFY!FUNK!' -e 's/X//'
  1262. Xcase $CONFIG in
  1263. X'')
  1264. X    if test ! -f config.sh; then
  1265. X    ln ../config.sh . || \
  1266. X    ln ../../config.sh . || \
  1267. X    ln ../../../config.sh . || \
  1268. X    (echo "Can't find config.sh."; exit 1)
  1269. X    echo "Using config.sh from above..."
  1270. X    fi
  1271. X    . ./config.sh
  1272. X    ;;
  1273. Xesac
  1274. Xecho "Extracting config.h (with variable substitutions)"
  1275. Xsed <<!GROK!THIS! >config.h -e 's!^#undef!/\*#undef!'
  1276. X/* config.h
  1277. X * This file was produced by running the config.h.SH script, which
  1278. X * gets its values from config.sh, which is generally produced by
  1279. X * running Configure.
  1280. X *
  1281. X * Feel free to modify any of this as the need arises.  Note, however,
  1282. X * that running config.h.SH again will wipe out any changes you've made.
  1283. X * For a more permanent change edit config.sh and rerun config.h.SH.
  1284. X */
  1285. X
  1286. X
  1287. X/* EUNICE:
  1288. X *    This symbol, if defined, indicates that the program is being compiled
  1289. X *    under the EUNICE package under VMS.  The program will need to handle
  1290. X *    things like files that don't go away the first time you unlink them,
  1291. X *    due to version numbering.  It will also need to compensate for lack
  1292. X *    of a respectable link() command.
  1293. X */
  1294. X/* VMS:
  1295. X *    This symbol, if defined, indicates that the program is running under
  1296. X *    VMS.  It is currently only set in conjunction with the EUNICE symbol.
  1297. X */
  1298. X#$d_eunice    EUNICE        /**/
  1299. X#$d_eunice    VMS        /**/
  1300. X
  1301. X/* DEFEDITOR:
  1302. X *    This symbol contains the name of the default editor.
  1303. X */
  1304. X#define DEFEDITOR "$defeditor"        /**/
  1305. X
  1306. X/* HOSTNAME:
  1307. X *    This symbol contains name of the host the program is going to run on.
  1308. X *    The domain is not kept with hostname, but must be gotten from MYDOMAIN.
  1309. X *    The dot comes with MYDOMAIN, and need not be supplied by the program.
  1310. X *    If gethostname() or uname() exist, HOSTNAME may be ignored.
  1311. X */
  1312. X/* MYDOMAIN:
  1313. X *    This symbol contains the domain of the host the program is going to
  1314. X *    run on.  The domain must be appended to HOSTNAME to form a complete
  1315. X *    host name.  The dot comes with MYDOMAIN, and need not be supplied by
  1316. X *    the program.  If the host name is derived from PHOSTNAME, the domain
  1317. X *    may or may not already be there, and the program should check.
  1318. X */
  1319. X#define HOSTNAME "$hostname"        /**/
  1320. X#define MYDOMAIN "$mydomain"        /**/
  1321. X
  1322. X/* PASSNAMES:
  1323. X *    This symbol, if defined, indicates that full names are stored in
  1324. X *    the /etc/passwd file.
  1325. X */
  1326. X/* BERKNAMES:
  1327. X *    This symbol, if defined, indicates that full names are stored in
  1328. X *    the /etc/passwd file in Berkeley format (name first thing, everything
  1329. X *    up to first comma, with & replaced by capitalized login id, yuck).
  1330. X */
  1331. X/* USGNAMES:
  1332. X *    This symbol, if defined, indicates that full names are stored in
  1333. X *    the /etc/passwd file in USG format (everything after - and before ( is
  1334. X *    the name).
  1335. X */
  1336. X#$d_passnames    PASSNAMES /*  (undef to take name from ~/.fullname) */
  1337. X#$d_berknames    BERKNAMES /* (that is, ":name,stuff:") */
  1338. X#$d_usgnames    USGNAMES  /* (that is, ":stuff-name(stuff):") */
  1339. X
  1340. X/* ORGNAME:
  1341. X *    This symbol contains either the organizaton name or the full pathname
  1342. X *    of a file containing the organization name, which the program must
  1343. X *    be prepared to open and substitute the contents of.
  1344. X */
  1345. X#define ORGNAME "$orgname"        /**/
  1346. X
  1347. X!GROK!THIS!
  1348. !STUFFY!FUNK!
  1349. echo Extracting mcon/U/Guess.U
  1350. sed >mcon/U/Guess.U <<'!STUFFY!FUNK!' -e 's/X//'
  1351. X?RCS:$Header: Guess.U,v 2.0 88/06/28 23:13:08 lwall Locked $
  1352. X?X: 
  1353. X?X: This unit hazards some guesses as to what the general nature of the system
  1354. X?X: is.  The information it collects here is used primarily to establish default
  1355. X?X: answers to other questions.
  1356. X?X: 
  1357. X?RCS: $Log:    Guess.U,v $
  1358. X?RCS: Revision 2.0  88/06/28  23:13:08  lwall
  1359. X?RCS: Baseline.
  1360. X?RCS: 
  1361. X?MAKE:Guess d_eunice eunicefix: n c contains libc
  1362. X?MAKE:    -pick add $@ %*
  1363. X?S:d_eunice:
  1364. X?S:    This variable conditionally defines the symbols EUNICE and VAX, which
  1365. X?S:    alerts the C program that it must deal with ideosyncracies of VMS.
  1366. X?S:.
  1367. X?S:eunicefix:
  1368. X?S:    When running under Eunice this variable contains a command which will
  1369. X?S:    convert a shell script to the proper form of text file for it to be
  1370. X?S:    executable by the shell.  On other systems it is a no-op.
  1371. X?S:.
  1372. X?C:EUNICE:
  1373. X?C:    This symbol, if defined, indicates that the program is being compiled
  1374. X?C:    under the EUNICE package under VMS.  The program will need to handle
  1375. X?C:    things like files that don't go away the first time you unlink them,
  1376. X?C:    due to version numbering.  It will also need to compensate for lack
  1377. X?C:    of a respectable link() command.
  1378. X?C:.
  1379. X?C:VMS:
  1380. X?C:    This symbol, if defined, indicates that the program is running under
  1381. X?C:    VMS.  It is currently only set in conjunction with the EUNICE symbol.
  1382. X?C:.
  1383. X?H:?%1:#$d_eunice    EUNICE        /**/
  1384. X?H:?%1:#$d_eunice    VMS        /**/
  1385. X?H:?%1:
  1386. X: make some quick guesses about what we are up against
  1387. Xecho " "
  1388. X$echo $n "Hmm...  $c"
  1389. Xif $contains SIGTSTP /usr/include/signal.h >/dev/null 2>&1 ; then
  1390. X    echo "Looks kind of like a BSD system, but we'll see..."
  1391. X    echo exit 0 >bsd
  1392. X    echo exit 1 >usg
  1393. X    echo exit 1 >v7
  1394. Xelif $contains '^fcntl$' libc.list >/dev/null 2>&1 ; then
  1395. X    echo "Looks kind of like a USG system, but we'll see..."
  1396. X    echo exit 1 >bsd
  1397. X    echo exit 0 >usg
  1398. X    echo exit 1 >v7
  1399. Xelse
  1400. X    echo "Looks kind of like a version 7 system, but we'll see..."
  1401. X    echo exit 1 >bsd
  1402. X    echo exit 1 >usg
  1403. X    echo exit 0 >v7
  1404. Xfi
  1405. Xif $contains '^vmssystem$' libc.list >/dev/null 2>&1 ; then
  1406. X    cat <<'EOI'
  1407. XThere is, however, a strange, musty smell in the air that reminds me of
  1408. Xsomething...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
  1409. XEOI
  1410. X    echo "exit 0" >eunice
  1411. X    eunicefix=unixtovms
  1412. X    d_eunice="$define"
  1413. X: it so happens the Eunice I know will not run shell scripts in Unix format
  1414. Xelse
  1415. X    echo " "
  1416. X    echo "Congratulations.  You aren't running Eunice."
  1417. X    eunicefix=':'
  1418. X    d_eunice="$undef"
  1419. X    echo "exit 1" >eunice
  1420. Xfi
  1421. Xif test -f /xenix; then
  1422. X    echo "Actually, this looks more like a XENIX system..."
  1423. X    echo "exit 0" >xenix
  1424. Xelse
  1425. X    echo " "
  1426. X    echo "It's not Xenix..."
  1427. X    echo "exit 1" >xenix
  1428. Xfi
  1429. Xchmod +x xenix
  1430. X$eunicefix xenix
  1431. Xif test -f /venix; then
  1432. X    echo "Actually, this looks more like a VENIX system..."
  1433. X    echo "exit 0" >venix
  1434. Xelse
  1435. X    echo " "
  1436. X    if xenix; then
  1437. X    : null
  1438. X    else
  1439. X    echo "Nor is it Venix..."
  1440. X    fi
  1441. X    echo "exit 1" >venix
  1442. Xfi
  1443. Xchmod +x bsd usg v7 eunice venix
  1444. X$eunicefix bsd usg v7 eunice venix
  1445. Xrmlist="$rmlist bsd usg v7 eunice venix xenix"
  1446. X
  1447. !STUFFY!FUNK!
  1448. echo Extracting mcon/U/voidflags.U
  1449. sed >mcon/U/voidflags.U <<'!STUFFY!FUNK!' -e 's/X//'
  1450. X?RCS:$Header: voidflags.U,v 2.0 88/06/28 23:18:38 lwall Locked $
  1451. X?RCS: $Log:    voidflags.U,v $
  1452. X?RCS: Revision 2.0  88/06/28  23:18:38  lwall
  1453. X?RCS: Baseline.
  1454. X?RCS: 
  1455. X?MAKE:voidflags defvoidused: echo n c cat rm contains
  1456. X?MAKE:    -pick add $@ %*
  1457. X?S:voidflags:
  1458. X?S:    This variable contains the eventual value of the VOIDFLAGS symbol,
  1459. X?S:    which indicates how much support of the void type is given by this
  1460. X?S:    compiler.  See VOIDFLAGS for more info.
  1461. X?S:.
  1462. X?C:VOIDFLAGS:
  1463. X?C:    This symbol indicates how much support of the void type is given by this
  1464. X?C:    compiler.  What various bits mean:
  1465. X?C:
  1466. X?C:        1 = supports declaration of void
  1467. X?C:        2 = supports arrays of pointers to functions returning void
  1468. X?C:        4 = supports comparisons between pointers to void functions and
  1469. X?C:            addresses of void functions
  1470. X?C:
  1471. X?C:    The package designer should define VOIDUSED to indicate the requirements
  1472. X?C:    of the package.  This can be done either by #defining VOIDUSED before
  1473. X?C:    including config.h, or by defining defvoidused in Myinit.U.  If the
  1474. X?C:    level of void support necessary is not present, defines void to int.
  1475. X?C:.
  1476. X?H:?%1:#ifndef VOIDUSED
  1477. X?H:?%1:#define VOIDUSED $defvoidused
  1478. X?H:?%1:#endif
  1479. X?H:?%1:#define VOIDFLAGS $voidflags
  1480. X?H:?%1:#if (VOIDFLAGS & VOIDUSED) != VOIDUSED
  1481. X?H:?%1:#$define void int        /* is void to be avoided? */
  1482. X?H:?%1:#$define M_VOID        /* Xenix strikes again */
  1483. X?H:?%1:#endif
  1484. X?H:?%1:
  1485. X?INIT:defvoidused=7
  1486. X: check for void type
  1487. Xecho " "
  1488. X$cat <<EOM
  1489. XChecking to see how well your C compiler groks the void type...
  1490. X
  1491. X  Support flag bits are:
  1492. X    1: basic void declarations.
  1493. X    2: arrays of pointers to functions returning void.
  1494. X    4: operations between pointers to and addresses of void functions.
  1495. X
  1496. XEOM
  1497. Xcase "$voidflags" in
  1498. X'')
  1499. X    $cat >try.c <<'EOCP'
  1500. X#if TRY & 1
  1501. Xvoid main() {
  1502. X#else
  1503. Xmain() {
  1504. X#endif
  1505. X    extern void *moo();
  1506. X    void *(*goo)();
  1507. X#if TRY & 2
  1508. X    void (*foo[10])();
  1509. X#endif
  1510. X
  1511. X#if TRY & 4
  1512. X    if(*goo == moo) {
  1513. X        exit(0);
  1514. X    }
  1515. X#endif
  1516. X    exit(0);
  1517. X}
  1518. XEOCP
  1519. X    if cc -S -DTRY=7 try.c >.out 2>&1 ; then
  1520. X    voidflags=7
  1521. X    echo "It appears to support void fully."
  1522. X    if $contains warning .out >/dev/null 2>&1; then
  1523. X        echo "However, you might get some warnings that look like this:"
  1524. X        $cat .out
  1525. X    fi
  1526. X    else
  1527. X    echo "Hmm, you compiler has some difficulty with void.  Checking further..."
  1528. X    if cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
  1529. X        echo "It supports 1..."
  1530. X        if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
  1531. X        voidflags=3
  1532. X        echo "And it supports 2 but not 4."
  1533. X        else
  1534. X        echo "It doesn't support 2..."
  1535. X        if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
  1536. X            voidflags=5
  1537. X            echo "But it supports 4."
  1538. X        else
  1539. X            voidflags=1
  1540. X            echo "And it doesn't support 4."
  1541. X        fi
  1542. X        fi
  1543. X    else
  1544. X        echo "There is no support at all for void."
  1545. X        voidflags=0
  1546. X    fi
  1547. X    fi
  1548. Xesac
  1549. Xdflt="$voidflags";
  1550. Xrp="Your void support flags add up to what? [$dflt]"
  1551. X$echo $n "$rp $c"
  1552. X. myread
  1553. Xvoidflags="$ans"
  1554. X$rm -f try.* .out
  1555. X
  1556. !STUFFY!FUNK!
  1557. echo Extracting pat/patpost.SH
  1558. sed >pat/patpost.SH <<'!STUFFY!FUNK!' -e 's/X//'
  1559. Xcase $CONFIG in
  1560. X'')
  1561. X    if test ! -f config.sh; then
  1562. X    ln ../config.sh . || \
  1563. X    ln ../../config.sh . || \
  1564. X    ln ../../../config.sh . || \
  1565. X    (echo "Can't find config.sh."; exit 1)
  1566. X    echo "Using config.sh from above..."
  1567. X    fi
  1568. X    . ./config.sh
  1569. X    ;;
  1570. Xesac
  1571. X: This forces SH files to create target in same directory as SH file.
  1572. X: This is so that make depend always knows where to find SH derivatives.
  1573. Xcase "$0" in
  1574. X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
  1575. Xesac
  1576. Xecho "Extracting patpost (with variable substitutions)"
  1577. Xcat >patpost <<!GROK!THIS!
  1578. X#!/usr/bin/perl
  1579. X    eval "exec /usr/bin/perl -S \$0 \$*"
  1580. X        if \$running_under_some_shell;
  1581. X
  1582. X# $Header: patpost.SH,v 2.0 88/06/28 23:19:50 lwall Locked $
  1583. X#
  1584. X# $Log:    patpost.SH,v $
  1585. X# Revision 2.0  88/06/28  23:19:50  lwall
  1586. X# Baseline.
  1587. X# 
  1588. X
  1589. X\$inews='${inews-/usr/lib/news/inews}';
  1590. X\$orgname='$orgname';
  1591. X!GROK!THIS!
  1592. X
  1593. X: In the following dollars and backticks do not need the extra backslash.
  1594. Xcat >>patpost <<'!NO!SUBS!'
  1595. Xif ($inews eq 'inews') {
  1596. X    $inews = '/usr/lib/news/inews' if -f '/usr/lib/news/inews';
  1597. X}
  1598. X
  1599. Xchdir '..' if -f '../.package';
  1600. X
  1601. Xdo readpackage();
  1602. X
  1603. Xchop($orgname = `cat $orgname`) if $orgname =~ m|^/|;
  1604. X
  1605. Xif ($ARGV[0] eq '-r') {
  1606. X    shift; $repost = ' (REPOST)';
  1607. X}
  1608. X
  1609. Xwhile ($_ = shift) {
  1610. X    if (/^(patch)?[1-9][\d\-]*$/) {
  1611. X    s/^patch//;
  1612. X    push(@argv,$_);
  1613. X    }
  1614. X    else {
  1615. X    push(@newsgroups,$_);
  1616. X    }
  1617. X}
  1618. X$newsgroups = join(',',@newsgroups) unless $#newsgroups < 0;
  1619. Xdie "patpost newsgroups [patches]\n" unless $newsgroups;
  1620. X
  1621. X@ARGV = @argv;
  1622. Xopen(PL,"patchlevel.h") || die "Can't open patchlevel.h\n";
  1623. Xwhile (<PL>) {
  1624. X    $maxnum = $1 if /^#define\s+PATCHLEVEL\s+(\d+)/;
  1625. X}
  1626. Xclose PL;
  1627. Xdie "Malformed patchlevel.h file.\n" if $maxnum eq '';
  1628. X
  1629. Xif ($#ARGV < 0) {
  1630. X    $argv = $maxnum;
  1631. X    @ARGV = $argv;
  1632. X}
  1633. Xelse {
  1634. X    $argv = do rangeargs(@ARGV);
  1635. X    @ARGV = split(' ',$argv);
  1636. X}
  1637. X
  1638. X$argv =~ s/ $//;
  1639. X
  1640. Xif ($#ARGV < 0) {
  1641. X    die "No patches specified.\n";
  1642. X}
  1643. Xelsif ($#ARGV) {
  1644. X    print "Posting $package $baserev patches $argv to $newsgroups...\n";
  1645. X}
  1646. Xelse {
  1647. X    print "Posting $package $baserev patch $argv to $newsgroups...\n";
  1648. X}
  1649. X
  1650. Xchdir 'bugs' || die "Can't cd to bugs\n";
  1651. X
  1652. Xfork && exit;
  1653. X
  1654. Xuntil ($#ARGV < 0) {
  1655. X    $patnum = shift;
  1656. X    open(XHEAD,">.xhead$$") || die "Can't create temp file.\n";
  1657. X    print XHEAD
  1658. X"Newsgroups: $newsgroups
  1659. XSubject: $package $baserev patch #$patnum$repost
  1660. XSummary: This is an official patch for $package $baserev.  Please apply it.
  1661. XExpires: 
  1662. XReferences: 
  1663. XSender: 
  1664. XDistribution: 
  1665. XOrganization: $orgname
  1666. XKeywords: 
  1667. X
  1668. X";
  1669. X    open(PATCH,"patch$patnum") || die "Can't open patch$_\n";
  1670. X    while (<PATCH>) {
  1671. X    print XHEAD;
  1672. X    }
  1673. X    close XHEAD;
  1674. X    system "$inews -h <.xhead$$";
  1675. X}
  1676. Xunlink ".xhead$$";
  1677. X
  1678. X!NO!SUBS!
  1679. Xcat ../pl/package.pl >>patpost
  1680. Xcat ../pl/rangeargs.pl >>patpost
  1681. Xchmod +x patpost
  1682. X$eunicefix patpost
  1683. !STUFFY!FUNK!
  1684. echo Extracting mcon/makegloss
  1685. sed >mcon/makegloss <<'!STUFFY!FUNK!' -e 's/X//'
  1686. X#!/usr/bin/perl
  1687. Xopen(G,">Glossary") || die "Can't create Glossary.\n";
  1688. Xprint G
  1689. X'[This Glossary is automatically generated from the Unit files.  Do not edit
  1690. Xthis file or your changes will be lost.  Edit the appropriate Unit instead.]
  1691. X
  1692. XThis file contains a listing of all the C preprocessor symbols and shell
  1693. Xvariables whose value can be determined by a Configure script.  For the
  1694. Xmost part, any symbol in UPPERCASE is a C preprocessor symbol, and
  1695. Xwill be defined in config.h.  Symbols in lowercase are shell variables,
  1696. Xand are defined in config.sh.
  1697. X
  1698. XIf you write your shell scripts and C programs in terms of these symbols,
  1699. Xmetaconfig can automatically build you a Configure script that will determine
  1700. Xthe value of those symbols.  See the README file for a description of how
  1701. Xto use metaconfig.
  1702. X
  1703. XIn the following listing, the Unit: line indicates the name of the unit
  1704. Xwhere this symbol is defined, and the Wants: line indicates what other
  1705. Xsymbols must be determined in order to figure out the value of this one.
  1706. XIf there is an "(Also defines ...)" entry, it indicates what other symbols
  1707. Xare defined by the Unit other than the one corresponding to the unit name.
  1708. X
  1709. XVariable of the form d_* either have the value "define" or "/*undef", and
  1710. Xcontrol whether some C preprocessor symbol gets defined or not.
  1711. X
  1712. X';
  1713. X
  1714. X@ARGV = <U/*.U>;
  1715. Xwhile (<>) {
  1716. X    if (/^\?MAKE:.*:/) {
  1717. X    ($unit,$also,$wants) = /^\?MAKE:\s*(\w+)\s*(.*):\s*(.*)/;
  1718. X    $head = '';
  1719. X    $_ = "Unit: $unit";
  1720. X    $_ .= " (Also defines $also)" if $also;
  1721. X    while (length($_) > 70) {
  1722. X        $tmp = substr($_,0,70);
  1723. X        $tmp =~ s/^(.*) .*/$1/;
  1724. X        $head .= "\t$tmp\n";
  1725. X        $_ = ' ' . substr($_,length($tmp),9999);
  1726. X    }
  1727. X    $head .= "\t$_\n";
  1728. X    $_ = "Wants: $wants";
  1729. X    while (length($_) > 70) {
  1730. X        $tmp = substr($_,0,70);
  1731. X        $tmp =~ s/^(.*) .*/$1/;
  1732. X        $head .= "\t$tmp\n";
  1733. X        $_ = ' ' . substr($_,length($tmp),9999);
  1734. X    }
  1735. X    $head .= "\t$_\n\n";
  1736. X    }
  1737. X    if (s/^\?[CS]:(\w+):*[     ]*$/$1:/) {
  1738. X    $sym = $1;
  1739. X    push(@syms,$sym);
  1740. X    $def{$sym} .= $_ . $head;
  1741. X    }
  1742. X    elsif (s/^\?[CS]://) {
  1743. X    if (/^\.$/) {
  1744. X        $def{$sym} .= "\n";
  1745. X        $sym = '';
  1746. X    }
  1747. X    else {
  1748. X        s/^(\t|  ? ? ? ? ? ? ?)//;
  1749. X        $def{$sym} .= "\t" . $_;
  1750. X    }
  1751. X    }
  1752. X}
  1753. X
  1754. Xforeach $sym (sort @syms) {
  1755. X    print G $def{$sym};
  1756. X}
  1757. Xclose G;
  1758. !STUFFY!FUNK!
  1759. echo Extracting patchlevel.h
  1760. sed >patchlevel.h <<'!STUFFY!FUNK!' -e 's/X//'
  1761. X#define PATCHLEVEL 0
  1762. !STUFFY!FUNK!
  1763. echo ""
  1764. echo "End of kit 3 (of 7)"
  1765. cat /dev/null >kit3isdone
  1766. run=''
  1767. config=''
  1768. for iskit in 1 2 3 4 5 6 7; do
  1769.     if test -f kit${iskit}isdone; then
  1770.     run="$run $iskit"
  1771.     else
  1772.     todo="$todo $iskit"
  1773.     fi
  1774. done
  1775. case $todo in
  1776.     '')
  1777.     echo "You have run all your kits.  Please read README and then type Configure."
  1778.     chmod 755 Configure
  1779.     ;;
  1780.     *)  echo "You have run$run."
  1781.     echo "You still need to run$todo."
  1782.     ;;
  1783. esac
  1784. : Someone might mail this, so...
  1785. exit
  1786.  
  1787.