# do not concatenate these parts, unpack them in order with /bin/sh
# file plan9.ps continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 5; then
echo Please unpack part "$Scheck" next!
exit 1
else
exit 0
fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping plan9.ps'
else
echo 'x - continuing file plan9.ps'
sed 's/^X//' << 'SHAR_EOF' >> 'plan9.ps' &&
(program to pick a random line from)6 1479 1 3561 6182 t
( prints the location, and if it guessed Holmdel, prints a message and exits.)13 2942( It)1 111(the location list.)2 642 3 720 6302 t
( the)1 149(Then it uses)2 485 2 720 6458 t
10 CW f
(read)1381 6458 w
10 R f
(function to get lines from standard input and validity-check them until it gets a legal)14 3392 1 1648 6458 t
( that the condition part of a)6 1118(name. Note)1 491 2 720 6578 t
10 CW f
(while)2360 6578 w
10 R f
( the exit status of the)5 855( Only)1 255( compound command.)2 901(can be a)2 338 4 2691 6578 t
(last command in the sequence is checked.)6 1666 1 720 6698 t
( it goes back to the top of the loop.)9 1388( Otherwise)1 460(Again, if the result is Holmdel, it prints a message and exits.)11 2415 3 720 6854 t
cleartomark
showpage
saveobj restore
%%EndPage: 11 11
%%Page: 12 12
/saveobj save def
mark
12 pagesetup
10 R f
(- 12 -)2 216 1 2772 480 t
9 CW f
(t=/tmp/holmdel$pid)1008 890 w
(fn read{)1 432 1 1008 1000 t
($1=`{awk '{print;exit}'})1 1296 1 1440 1110 t
(})1008 1220 w
(ifs=')1008 1330 w
( just a newline)3 810(' #)1 486 2 1008 1440 t
(fn sigexit sigint sigquit sighup{)4 1782 1 1008 1550 t
(rm -f $t)2 432 1 1440 1660 t
(exit)1440 1770 w
(})1008 1880 w
(cat <<'!' >$t)2 702 1 1008 1990 t
(Allentown)1008 2100 w
(Atlanta)1008 2210 w
(Cedar Crest)1 594 1 1008 2320 t
(Chester)1008 2430 w
(Columbus)1008 2540 w
(Elmhurst)1008 2650 w
(Fullerton)1008 2760 w
(Holmdel)1008 2870 w
(Indian Hill)1 594 1 1008 2980 t
(Merrimack Valley)1 864 1 1008 3090 t
(Morristown)1008 3200 w
(Piscataway)1008 3310 w
(Reading)1008 3420 w
(Short Hills)1 594 1 1008 3530 t
(South Plainfield)1 864 1 1008 3640 t
(Summit)1008 3750 w
(Whippany)1008 3860 w
(West Long Branch)2 864 1 1008 3970 t
(!)1008 4080 w
(while\(true\){)1008 4190 w
(lab=`{/usr/games/fortune $t})1 1512 1 1170 4300 t
(echo $lab)1 486 1 1170 4410 t
(if\(\304 $lab Holmdel\){)2 1026 1 1170 4520 t
(echo You lose.)2 756 1 1332 4630 t
(exit)1332 4740 w
(})1170 4850 w
(while\(read lab; ! grep -i -s $lab $t\) echo No such location.)11 3240 1 1170 4960 t
(if\(\304 $lab [hH]olmdel\){)2 1188 1 1170 5070 t
(echo You win.)2 702 1 1332 5180 t
(exit)1332 5290 w
(})1170 5400 w
(})1008 5510 w
10 B f
(27. Discussion)1 626 1 720 5690 t
10 R f
(Steve Bourne's)1 622 1 720 5846 t
10 CW f
(/bin/sh)1376 5846 w
10 R f
( I)1 93( comparison.)1 526(is extremely well-designed; any successor is bound to suffer in)9 2591 3 1830 5846 t
( things wherever possible, usually by)5 1512(have tried to fix its best-acknowledged shortcomings and to simplify)9 2808 2 720 5966 t
( I)1 67( Obviously)1 475( when irresistibly tempted have I introduced novel ideas.)8 2330( Only)1 258(omitting unessential features.)2 1190 5 720 6086 t
(have tinkered extensively with Bourne's syntax, that being where his work was most open to criticism.)15 4109 1 720 6206 t
(The most important principle in)4 1284 1 720 6362 t
10 I f
(rc)2032 6362 w
10 R f
( is never scanned more)4 930( Input)1 265('s design is that it's not a macro processor.)8 1730 3 2115 6362 t
( by the lexical and syntactic analysis code \(except, of course, by the)12 2885(than once)1 401 2 720 6482 t
10 CW f
(eval)4046 6482 w
10 R f
(command, whose)1 714 1 4326 6482 t
10 I f
(raison d'etre)1 519 1 720 6602 t
10 R f
(is to break the rule\).)4 801 1 1264 6602 t
( These)1 298( arguments containing spaces.)3 1228(Bourne shell scripts can often be made to run wild by passing them)12 2794 3 720 6758 t
(will be split into multiple arguments using)6 1780 1 720 6878 t
10 CW f
(IFS)2539 6878 w
10 R f
( In)1 146( inopportune times.)2 801(, often as)2 391 3 2719 6878 t
10 I f
(rc)4095 6878 w
10 R f
(, values of variables,)3 862 1 4178 6878 t
( have)1 227( Arguments)1 508( when substituted into a command.)5 1464(including command line arguments, are not re-read)6 2121 4 720 6998 t
(presumably been scanned in the parent process, and ought not to be re-read.)12 3026 1 720 7118 t
( store lists of)3 571( needs to be able to)5 858( He)1 184(Why does Bourne re-scan commands after variable substitution?)7 2707 4 720 7274 t
cleartomark
showpage
saveobj restore
%%EndPage: 12 12
%%Page: 13 13
/saveobj save def
mark
13 pagesetup
10 R f
(- 13 -)2 216 1 2772 480 t
( we eliminate re-scanning, we must change the)7 1875( If)1 117( character strings.)2 708(arguments in variables whose values are)5 1620 4 720 840 t
(type of variables, so that they can explicitly carry lists of strings.)11 2583 1 720 960 t
( are two dif-)3 505( There)1 287( for lists of words.)4 750( need a notation)3 647( We)1 192(This introduces some conceptual complications.)4 1939 6 720 1116 t
(ferent kinds of concatenation, for strings \320)6 1798 1 720 1236 t
10 CW f
($a\303$b)2552 1236 w
10 R f
(, and lists \320)3 533 1 2852 1236 t
10 CW f
(\($a $b\))1 429 1 3419 1236 t
10 R f
( difference between)2 801(. The)1 238 2 3848 1236 t
10 CW f
(\(\))4920 1236 w
10 R f
(and)720 1356 w
10 CW f
('')895 1356 w
10 R f
( not the)2 314(is confusing to novices, although the distinction is arguably sensible \320 a null argument is)14 3680 2 1046 1356 t
(same as no argument.)3 865 1 720 1476 t
( the text enclosed in back-)5 1100( is because)2 452( This)1 238(Bourne also rescans input when doing command substitution.)7 2530 4 720 1632 t
( it ought to be parsed when the enclosing com-)9 1939( Properly,)1 427(quotes is not properly a string, but a command.)8 1954 3 720 1752 t
(mand is, but this makes it difficult to handle nested command substitutions, like this:)13 3393 1 720 1872 t
9 CW f
(size=`wc -l \\`ls -t|sed 1q\\``)4 1566 1 1008 2042 t
10 R f
( can get much worse)4 832( This)1 231( escaped to avoid terminating the outer command.)7 2018(The inner back-quotes must be)4 1239 4 720 2222 t
(than the above example; the number of)6 1612 1 720 2342 t
10 CW f
(\\)2366 2342 w
10 R f
('s required is exponential in the nesting depth.)7 1911 1 2426 2342 t
10 I f
(Rc)4396 2342 w
10 R f
(fixes this by)2 505 1 4535 2342 t
(making the backquote a unary operator whose argument is a command, like this:)12 3220 1 720 2462 t
9 CW f
(size=`{wc -l `{ls -t|sed 1q}})4 1566 1 1008 2632 t
10 R f
(No escapes are ever required, and the whole thing is parsed in one pass.)13 2862 1 720 2812 t
(For similar reasons)2 772 1 720 2968 t
10 I f
(rc)1520 2968 w
10 R f
( associating a string)3 803(defines signal handlers as though they were functions, instead of)9 2606 2 1631 2968 t
(with each signal, as Bourne does, with the attendant possibility of getting a syntax error message in)16 4320 1 720 3088 t
( Since)1 285(response to typing the interrupt character.)5 1723 2 720 3208 t
10 I f
(rc)2766 3208 w
10 R f
(parses input when typed, it reports errors when you)8 2153 1 2887 3208 t
(make them.)1 466 1 720 3328 t
( need for the distinction)4 1029( is no)2 255( There)1 301(For all this trouble, we gain substantial semantic simplifications.)8 2735 4 720 3484 t
(between)720 3604 w
10 CW f
($*)1080 3604 w
10 R f
(and)1228 3604 w
10 CW f
($@)1400 3604 w
10 R f
( rules that)2 398( is no need for four types of quotation, nor the extremely complicated)12 2812(. There)1 310 3 1520 3604 t
( In)1 133(govern them.)1 527 2 720 3724 t
10 I f
(rc)1405 3724 w
10 R f
( to appear in an argu-)5 855(you use quotation marks exactly when you want a syntax character)10 2672 2 1513 3724 t
(ment.)720 3844 w
10 CW f
(IFS)999 3844 w
10 R f
(is no longer used, except in the one case where it was indispensable: converting command out-)15 3833 1 1207 3844 t
(put into argument lists during command substitution.)6 2121 1 720 3964 t
( security hole [Ree88].)3 933(This also avoids an important)4 1211 2 720 4120 t
10 I f
(System)2922 4120 w
10 R f
(\(3\) and)1 293 1 3199 4120 t
10 I f
(popen)3525 4120 w
10 R f
(\(3\) call)1 293 1 3769 4120 t
10 CW f
(/bin/sh)4095 4120 w
10 R f
(to execute a)2 492 1 4548 4120 t
( to use either of these routines with any assurance that the specified command)13 3212( is impossible)2 569(command. It)1 539 3 720 4240 t
(will be executed, even if the caller of)7 1479 1 720 4360 t
10 I f
(system)2224 4360 w
10 R f
(or)2515 4360 w
10 I f
(popen)2623 4360 w
10 R f
( can)1 164( This)1 229( for the command.)3 735(specifies a full path name)4 1020 4 2892 4360 t
( problem is that)3 643( The)1 211( a set-userid program.)3 888(be devastating if it occurs in)5 1164 4 720 4480 t
10 CW f
(IFS)3657 4480 w
10 R f
(is used to split the command)5 1172 1 3868 4480 t
(into words, so an attacker can just set)7 1534 1 720 4600 t
10 CW f
(IFS=/)2285 4600 w
10 R f
( Trojan horse named)3 844(in his environment and leave a)5 1253 2 2616 4600 t
10 CW f
(usr)4745 4600 w
10 R f
(or)4957 4600 w
10 CW f
(bin)720 4720 w
10 R f
(in the current working directory before running the privileged program.)9 2891 1 929 4720 t
10 I f
(Rc)3874 4720 w
10 R f
(fixes this by not ever res-)5 1032 1 4008 4720 t
(canning input for any reason.)4 1167 1 720 4840 t
(Most of the other differences between)5 1565 1 720 4996 t
10 I f
(rc)2320 4996 w
10 R f
( eliminated Bourne's)2 860( I)1 94(and the Bourne shell are not so serious.)7 1647 3 2439 4996 t
(peculiar forms of variable substitution, like)5 1726 1 720 5116 t
9 CW f
(echo ${a=b} ${c-d} ${e?error})3 1566 1 1008 5286 t
10 R f
( deleted the builtins)3 822( I)1 95(because they are little used, redundant and easily expressed in less abstruse terms.)12 3403 3 720 5466 t
10 CW f
(export)720 5586 w
10 R f
(,)1080 5586 w
10 CW f
(readonly)1131 5586 w
10 R f
(,)1611 5586 w
10 CW f
(break)1662 5586 w
10 R f
(,)1962 5586 w
10 CW f
(continue)2013 5586 w
10 R f
(,)2493 5586 w
10 CW f
(read)2544 5586 w
10 R f
(,)2784 5586 w
10 CW f
(return)2835 5586 w
10 R f
(,)3195 5586 w
10 CW f
(set)3246 5586 w
10 R f
(,)3426 5586 w
10 CW f
(times)3477 5586 w
10 R f
(and)3803 5586 w
10 CW f
(unset)3973 5586 w
10 R f
(because they seem)2 742 1 4298 5586 t
(redundant or only marginally useful.)4 1462 1 720 5706 t
(Where Bourne's syntax draws from Algol 68,)6 1917 1 720 5862 t
10 I f
(rc)2677 5862 w
10 R f
( I)1 99( is harder to defend.)4 859( This)1 244( C or Awk.)3 492('s is based on)3 586 5 2760 5862 t
(believe that, for example)3 992 1 720 5982 t
9 CW f
(if\(test -f junk\) rm junk)4 1296 1 1008 6152 t
10 R f
(is better syntax than)3 802 1 720 6332 t
9 CW f
(if test -f junk; then rm junk; fi)7 1782 1 1008 6502 t
10 R f
( is less cluttered with keywords, it avoids the semicolons that Bourne requires in odd places, and)16 3921(because it)1 399 2 720 6682 t
(the syntax characters better set off the active parts of the command.)11 2693 1 720 6802 t
(The one bit of large-scale syntax that Bourne unquestionably does better than)11 3169 1 720 6958 t
10 I f
(rc)3922 6958 w
10 R f
(is the)1 222 1 4038 6958 t
10 CW f
(if)4293 6958 w
10 R f
(statement with)1 594 1 4446 6958 t
10 CW f
(else)720 7078 w
10 R f
(clause.)986 7078 w
10 I f
(Rc)1310 7078 w
10 R f
('s)1415 7078 w
10 CW f
(if)1512 7078 w
10 R f
(has no terminating)2 744 1 1657 7078 t
10 CW f
(fi)2426 7078 w
10 R f
( a result, the parser cannot tell whether or not)9 1807( As)1 161(-like bracket.)1 526 3 2546 7078 t
(to expect an)2 482 1 720 7198 t
10 CW f
(else)1227 7198 w
10 R f
( problem is that after reading, for example)7 1685( The)1 205(clause without looking ahead in its input.)6 1647 3 1492 7198 t
(resolves the ``dangling else'' ambiguity in opposition to most people's expectations.)10 3378 1 1172 2446 t
( the UNIX system programmer's manual the Bourne)7 2120(It is remarkable that in the four most recent editions of)10 2200 2 720 2602 t
( not admit the command)4 976(shell grammar described in the manual page does)7 1985 2 720 2722 t
10 CW f
(who|wc)3707 2722 w
10 R f
( is surely an over-)4 719(. This)1 254 2 4067 2722 t
( Even)1 266( something darker: nobody really knows what the Bourne shell's grammar is.)11 3206(sight, but it suggests)3 848 3 720 2842 t
( the rou-)2 346( parser is implemented by recursive descent, but)7 1959( The)1 210(examination of the source code is little help.)7 1805 4 720 2962 t
( categories all have a flag argument that subtly changes their operation)11 2885(tines corresponding to the syntactic)4 1435 2 720 3082 t
(depending on the context.)3 1041 1 720 3202 t
10 I f
(Rc)1814 3202 w
10 R f
('s parser is implemented using)4 1233 1 1919 3202 t
10 I f
(yacc)3180 3202 w
10 R f
(, so I can say precisely what the grammar)8 1678 1 3362 3202 t
(is.)720 3322 w
( is a)2 165( There)1 284( it considerably except for two things.)6 1524( would simplify)2 636( I)1 84(Its lexical structure is harder to describe.)6 1627 6 720 3478 t
( distinguish between parentheses that immediately follow a word with no intervening)11 3614(lexical kludge to)2 706 2 720 3598 t
( use for)2 319(spaces and those that don't that I would eliminate if there were a reasonable pair of characters to)17 4001 2 720 3718 t
( could also eliminate the insertion of free carets if users were not adamant about it.)15 3299( I)1 83(subscript brackets.)1 743 3 720 3838 t
10 B f
(28. Acknowledgements)1 1002 1 720 4078 t
10 R f
( Plan 9 users have been insistent, incessant sources of good ideas and)12 2825(Rob Pike, Howard Trickey and other)5 1495 2 720 4234 t
( examples in this document are plagiarized from [Bou78], as are most of)12 2892(criticism. Some)1 653 2 720 4354 t
10 I f
(rc)4290 4354 w
10 R f
('s good features.)2 662 1 4373 4354 t
10 B f
(29. References)1 639 1 720 4594 t
10 R f
( R. Bourne, ``U)3 678(Bou78. S.)1 423 2 720 4822 t
8 R f
(NIX)1821 4822 w
10 R f
(Time-Sharing System: The U)3 1234 1 2006 4822 t
8 R f
(NIX)3240 4822 w
10 R f
(Shell,'')3425 4822 w
10 I f
(Bell System Technical Journal)3 1275 1 3765 4822 t
10 B f
(57)970 4942 w
10 R f
(\(6\), pp. 1971-1990 \(July-August 1978\).)4 1579 1 1070 4942 t
( Reeds, ``)2 409(Ree88. J.)1 394 2 720 5098 t
10 CW f
(/bin/sh)1523 5098 w
10 R f
( Bell)1 205( AT&T)1 334(: the biggest UNIX security loophole,'' 11217-840302-04TM,)6 2558 3 1943 5098 t
(Laboratories \(1988\).)1 820 1 970 5218 t
cleartomark
showpage
saveobj restore
%%EndPage: 14 14
%%Trailer
done
%%Pages: 14
%%DocumentFonts: Courier Times-Bold Times-Italic Times-Roman Symbol
SHAR_EOF
echo 'File plan9.ps is complete' &&
chmod 0644 plan9.ps ||
echo 'restore of plan9.ps failed'
Wc_c="`wc -c < 'plan9.ps'`"
test 67056 -eq "$Wc_c" ||
echo 'plan9.ps: original size 67056, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= rc.1 ==============
if test -f 'rc.1' -a X"$1" != X"-c"; then
echo 'x - skipping rc.1 (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting rc.1 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rc.1' &&
.\" rc.1
.\"-------
.\" Dd distance to space vertically before a "display"
.\" These are what n/troff use for interparagraph distance
.\"-------
.if t .nr Dd .4v
.if n .nr Dd 1v
.\"-------
.\" Ds begin a display
.\"-------
.de Ds
.RS \\$1
.sp \\n(Ddu
.nf
..
.\"-------
.\" De end a display (no trailing vertical spacing)
.\"-------
.de De
.fi
.RE
..
.\"-------
.\" I stole the Xf macro from the -man macros on my machine (originally
.\" "}S", I renamed it so that it won't conflict).
.\"-------
.\" Set Cf to the name of the constant width font.
.\" It will be "C" or "(CW", typically.
.\" NOTEZ BIEN the lines defining Cf must have no trailing white space: