home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume7 / oracle < prev    next >
SHell self-extracting ARchive  |  1989-08-05  |  18.3 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: SHell self-extracting ARchive (archive/shar).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert SHell self-extracting ARchive (archive/shar) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/329 Shell Archive Format default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 4e 65 77 73 67 72 6f 75 | 70 73 3a 20 63 6f 6d 70 |Newsgrou|ps: comp|
|00000010| 2e 73 6f 75 72 63 65 73 | 2e 6d 69 73 63 0a 6f 72 |.sources|.misc.or|
|00000020| 67 61 6e 69 7a 61 74 69 | 6f 6e 3a 20 43 6f 72 6e |ganizati|on: Corn|
|00000030| 65 6c 6c 20 55 6e 69 76 | 2e 20 43 53 20 44 65 70 |ell Univ|. CS Dep|
|00000040| 74 2c 20 49 74 68 61 63 | 61 20 4e 59 0a 73 75 62 |t, Ithac|a NY.sub|
|00000050| 6a 65 63 74 3a 20 76 30 | 37 69 31 31 37 3a 20 6f |ject: v0|7i117: o|
|00000060| 72 61 63 6c 65 20 2d 2d | 20 61 6e 6f 6e 79 6d 6f |racle --| anonymo|
|00000070| 75 73 20 71 75 65 73 74 | 69 6f 6e 2f 61 6e 73 77 |us quest|ion/answ|
|00000080| 65 72 20 70 72 6f 67 72 | 61 6d 0a 66 72 6f 6d 3a |er progr|am.from:|
|00000090| 20 61 6c 6c 62 65 72 79 | 40 75 75 6e 65 74 2e 55 | allbery|@uunet.U|
|000000a0| 55 2e 4e 45 54 20 28 42 | 72 61 6e 64 6f 6e 20 53 |U.NET (B|randon S|
|000000b0| 2e 20 41 6c 6c 62 65 72 | 79 20 2d 20 63 6f 6d 70 |. Allber|y - comp|
|000000c0| 2e 73 6f 75 72 63 65 73 | 2e 6d 69 73 63 29 0a 52 |.sources|.misc).R|
|000000d0| 65 70 6c 79 2d 54 6f 3a | 20 68 75 74 74 61 72 40 |eply-To:| huttar@|
|000000e0| 73 76 61 78 2e 63 73 2e | 63 6f 72 6e 65 6c 6c 2e |svax.cs.|cornell.|
|000000f0| 65 64 75 20 28 4c 61 72 | 73 20 48 75 74 74 61 72 |edu (Lar|s Huttar|
|00000100| 29 0a 0a 50 6f 73 74 69 | 6e 67 2d 6e 75 6d 62 65 |)..Posti|ng-numbe|
|00000110| 72 3a 20 56 6f 6c 75 6d | 65 20 37 2c 20 49 73 73 |r: Volum|e 7, Iss|
|00000120| 75 65 20 31 31 37 0a 53 | 75 62 6d 69 74 74 65 64 |ue 117.S|ubmitted|
|00000130| 2d 62 79 3a 20 68 75 74 | 74 61 72 40 73 76 61 78 |-by: hut|tar@svax|
|00000140| 2e 63 73 2e 63 6f 72 6e | 65 6c 6c 2e 65 64 75 20 |.cs.corn|ell.edu |
|00000150| 28 4c 61 72 73 20 48 75 | 74 74 61 72 29 0a 41 72 |(Lars Hu|ttar).Ar|
|00000160| 63 68 69 76 65 2d 6e 61 | 6d 65 3a 20 6f 72 61 63 |chive-na|me: orac|
|00000170| 6c 65 0a 0a 5b 54 77 6f | 20 70 6f 74 65 6e 74 69 |le..[Two| potenti|
|00000180| 61 6c 20 70 72 6f 62 6c | 65 6d 73 2e 20 20 46 69 |al probl|ems. Fi|
|00000190| 72 73 74 2c 20 69 74 20 | 75 73 65 73 20 6c 6f 6f |rst, it |uses loo|
|000001a0| 6f 6f 6f 6f 6e 67 20 66 | 69 6c 65 6e 61 6d 65 73 |oooong f|ilenames|
|000001b0| 20 61 6e 64 20 77 69 6c | 6c 0a 74 68 65 72 65 66 | and wil|l.theref|
|000001c0| 6f 72 65 20 68 61 76 65 | 20 74 6f 20 62 65 20 72 |ore have| to be r|
|000001d0| 65 77 72 69 74 74 65 6e | 20 66 6f 72 20 53 79 73 |ewritten| for Sys|
|000001e0| 74 65 6d 20 56 2e 20 20 | 53 65 63 6f 6e 64 2c 20 |tem V. |Second, |
|000001f0| 74 68 65 72 65 20 69 73 | 20 61 74 20 6c 65 61 73 |there is| at leas|
|00000200| 74 20 6f 6e 65 0a 70 6c | 61 63 65 20 77 68 65 72 |t one.pl|ace wher|
|00000210| 65 20 61 20 73 79 73 74 | 65 6d 28 29 20 63 6f 6d |e a syst|em() com|
|00000220| 6d 61 6e 64 20 69 73 20 | 6d 61 64 65 20 77 69 74 |mand is |made wit|
|00000230| 68 20 22 32 3e 26 2d 22 | 2c 20 6f 73 74 65 6e 73 |h "2>&-"|, ostens|
|00000240| 69 62 6c 79 20 74 6f 20 | 73 65 6e 64 20 65 72 72 |ibly to |send err|
|00000250| 6f 72 73 0a 74 6f 20 2f | 64 65 76 2f 6e 75 6c 6c |ors.to /|dev/null|
|00000260| 20 2d 2d 20 69 6e 20 72 | 65 61 6c 69 74 79 2c 20 | -- in r|eality, |
|00000270| 74 68 69 73 20 43 4c 4f | 53 45 53 20 73 74 61 6e |this CLO|SES stan|
|00000280| 64 61 72 64 20 65 72 72 | 6f 72 20 61 6e 64 20 63 |dard err|or and c|
|00000290| 61 6e 20 63 61 75 73 65 | 20 70 72 6f 67 72 61 6d |an cause| program|
|000002a0| 73 0a 75 73 69 6e 67 20 | 73 74 64 69 6f 20 74 6f |s.using |stdio to|
|000002b0| 20 64 75 6d 70 20 63 6f | 72 65 2c 20 73 6f 20 62 | dump co|re, so b|
|000002c0| 65 20 77 61 72 6e 65 64 | 2e 20 20 2b 2b 62 73 61 |e warned|. ++bsa|
|000002d0| 5d 0a 0a 4f 72 61 63 6c | 65 20 69 73 20 61 20 66 |]..Oracl|e is a f|
|000002e0| 75 6e 20 73 6f 72 74 20 | 6f 66 20 27 6d 65 73 73 |un sort |of 'mess|
|000002f0| 61 67 65 20 62 61 73 65 | 27 20 70 72 6f 67 72 61 |age base|' progra|
|00000300| 6d 2e 0a 54 68 65 20 69 | 64 65 61 20 69 73 2c 20 |m..The i|dea is, |
|00000310| 79 6f 75 20 72 75 6e 20 | 6f 72 61 63 6c 65 20 61 |you run |oracle a|
|00000320| 6e 64 20 61 73 6b 20 69 | 74 20 61 20 71 75 65 73 |nd ask i|t a ques|
|00000330| 74 69 6f 6e 2c 20 6f 6e | 20 61 6e 79 20 73 75 62 |tion, on| any sub|
|00000340| 6a 65 63 74 2e 0a 43 6f | 75 6c 64 20 62 65 20 61 |ject..Co|uld be a|
|00000350| 64 76 69 63 65 20 6f 6e | 20 68 6f 77 20 74 6f 20 |dvice on| how to |
|00000360| 6d 61 6b 65 20 73 6f 6d | 65 20 64 65 63 69 73 69 |make som|e decisi|
|00000370| 6f 6e 2c 20 6f 72 20 74 | 68 65 20 6d 65 61 6e 69 |on, or t|he meani|
|00000380| 6e 67 20 6f 66 20 73 6f | 6d 65 20 77 6f 72 64 2c |ng of so|me word,|
|00000390| 0a 6f 72 20 61 6e 79 74 | 68 69 6e 67 2e 20 20 4c |.or anyt|hing. L|
|000003a0| 61 74 65 72 2c 20 77 68 | 65 6e 20 73 6f 6d 65 6f |ater, wh|en someo|
|000003b0| 6e 65 20 65 6c 73 65 20 | 72 75 6e 73 20 6f 72 61 |ne else |runs ora|
|000003c0| 63 6c 65 2c 20 74 68 65 | 79 20 77 69 6c 6c 20 67 |cle, the|y will g|
|000003d0| 65 74 20 79 6f 75 72 0a | 71 75 65 73 74 69 6f 6e |et your.|question|
|000003e0| 20 61 6e 64 20 61 6e 73 | 77 65 72 20 69 74 2e 20 | and ans|wer it. |
|000003f0| 20 4f 72 61 63 6c 65 20 | 77 69 6c 6c 20 6d 61 69 | Oracle |will mai|
|00000400| 6c 20 74 68 65 20 61 6e | 73 77 65 72 20 62 61 63 |l the an|swer bac|
|00000410| 6b 20 74 6f 20 79 6f 75 | 2c 20 62 75 74 0a 79 6f |k to you|, but.yo|
|00000420| 75 20 64 6f 6e 27 74 20 | 6b 6e 6f 77 20 77 68 6f |u don't |know who|
|00000430| 20 69 74 27 73 20 66 72 | 6f 6d 2e 20 20 53 6f 20 | it's fr|om. So |
|00000440| 69 74 27 73 20 72 65 61 | 6c 6c 79 20 6a 75 73 74 |it's rea|lly just|
|00000450| 20 61 6e 20 61 6e 6f 6e | 79 6d 6f 75 73 20 67 61 | an anon|ymous ga|
|00000460| 6d 65 20 6f 66 0a 71 75 | 65 73 74 69 6f 6e 73 20 |me of.qu|estions |
|00000470| 61 6e 64 20 61 6e 73 77 | 65 72 73 2e 0a 0a 54 68 |and answ|ers...Th|
|00000480| 65 20 4d 61 6b 65 66 69 | 6c 65 20 74 65 6c 6c 73 |e Makefi|le tells|
|00000490| 20 68 6f 77 20 74 6f 20 | 62 75 69 6c 64 20 74 68 | how to |build th|
|000004a0| 65 20 70 72 6f 67 72 61 | 6d 2e 20 20 4e 6f 74 65 |e progra|m. Note|
|000004b0| 73 20 74 65 6c 6c 73 20 | 61 20 6c 69 74 74 6c 65 |s tells |a little|
|000004c0| 20 61 62 6f 75 74 0a 74 | 68 65 20 6f 70 65 72 61 | about.t|he opera|
|000004d0| 74 69 6f 6e 20 6f 66 20 | 74 68 65 20 70 72 6f 67 |tion of |the prog|
|000004e0| 72 61 6d 2c 20 62 75 74 | 20 79 6f 75 20 64 6f 6e |ram, but| you don|
|000004f0| 27 74 20 6e 65 65 64 20 | 74 6f 20 72 65 61 64 20 |'t need |to read |
|00000500| 69 74 20 74 6f 20 72 75 | 6e 20 6f 72 61 63 6c 65 |it to ru|n oracle|
|00000510| 2e 0a 23 21 20 2f 62 69 | 6e 2f 73 68 0a 23 20 54 |..#! /bi|n/sh.# T|
|00000520| 68 69 73 20 69 73 20 61 | 20 73 68 65 6c 6c 20 61 |his is a| shell a|
|00000530| 72 63 68 69 76 65 2c 20 | 6d 65 61 6e 69 6e 67 3a |rchive, |meaning:|
|00000540| 0a 23 20 31 2e 20 52 65 | 6d 6f 76 65 20 65 76 65 |.# 1. Re|move eve|
|00000550| 72 79 74 68 69 6e 67 20 | 61 62 6f 76 65 20 74 68 |rything |above th|
|00000560| 65 20 23 21 20 2f 62 69 | 6e 2f 73 68 20 6c 69 6e |e #! /bi|n/sh lin|
|00000570| 65 2e 0a 23 20 32 2e 20 | 53 61 76 65 20 74 68 65 |e..# 2. |Save the|
|00000580| 20 72 65 73 75 6c 74 69 | 6e 67 20 74 65 78 74 20 | resulti|ng text |
|00000590| 69 6e 20 61 20 66 69 6c | 65 2e 0a 23 20 33 2e 20 |in a fil|e..# 3. |
|000005a0| 45 78 65 63 75 74 65 20 | 74 68 65 20 66 69 6c 65 |Execute |the file|
|000005b0| 20 77 69 74 68 20 2f 62 | 69 6e 2f 73 68 20 28 6e | with /b|in/sh (n|
|000005c0| 6f 74 20 63 73 68 29 20 | 74 6f 20 63 72 65 61 74 |ot csh) |to creat|
|000005d0| 65 20 74 68 65 20 66 69 | 6c 65 73 3a 0a 23 09 6f |e the fi|les:.#.o|
|000005e0| 72 61 63 6c 65 2e 6d 61 | 6e 0a 23 09 4e 6f 74 65 |racle.ma|n.#.Note|
|000005f0| 73 0a 23 09 6f 72 61 63 | 6c 65 2e 63 0a 23 09 4d |s.#.orac|le.c.#.M|
|00000600| 61 6b 65 66 69 6c 65 0a | 23 20 54 68 69 73 20 61 |akefile.|# This a|
|00000610| 72 63 68 69 76 65 20 63 | 72 65 61 74 65 64 3a 20 |rchive c|reated: |
|00000620| 54 68 75 20 41 75 67 20 | 20 33 20 30 38 3a 32 31 |Thu Aug | 3 08:21|
|00000630| 3a 34 34 20 31 39 38 39 | 0a 65 78 70 6f 72 74 20 |:44 1989|.export |
|00000640| 50 41 54 48 3b 20 50 41 | 54 48 3d 2f 62 69 6e 3a |PATH; PA|TH=/bin:|
|00000650| 24 50 41 54 48 0a 69 66 | 20 74 65 73 74 20 2d 66 |$PATH.if| test -f|
|00000660| 20 27 6f 72 61 63 6c 65 | 2e 6d 61 6e 27 0a 74 68 | 'oracle|.man'.th|
|00000670| 65 6e 0a 09 65 63 68 6f | 20 73 68 61 72 3a 20 77 |en..echo| shar: w|
|00000680| 69 6c 6c 20 6e 6f 74 20 | 6f 76 65 72 2d 77 72 69 |ill not |over-wri|
|00000690| 74 65 20 65 78 69 73 74 | 69 6e 67 20 66 69 6c 65 |te exist|ing file|
|000006a0| 20 22 27 6f 72 61 63 6c | 65 2e 6d 61 6e 27 22 0a | "'oracl|e.man'".|
|000006b0| 65 6c 73 65 0a 73 65 64 | 20 27 73 2f 5e 58 2f 2f |else.sed| 's/^X//|
|000006c0| 27 20 3c 3c 20 5c 53 48 | 41 52 5f 45 4f 46 20 3e |' << \SH|AR_EOF >|
|000006d0| 20 27 6f 72 61 63 6c 65 | 2e 6d 61 6e 27 0a 58 2e | 'oracle|.man'.X.|
|000006e0| 5c 22 20 40 28 23 29 6f | 72 61 63 6c 65 2e 36 20 |\" @(#)o|racle.6 |
|000006f0| 31 2e 30 20 37 2f 32 39 | 2f 38 39 20 4c 61 72 73 |1.0 7/29|/89 Lars|
|00000700| 20 48 75 74 74 61 72 0a | 58 2e 5c 22 20 3c 68 75 | Huttar.|X.\" <hu|
|00000710| 74 74 61 72 40 6f 63 63 | 73 2e 6f 62 65 72 6c 69 |ttar@occ|s.oberli|
|00000720| 6e 2e 65 64 75 3e 0a 58 | 2e 54 48 20 4f 52 41 43 |n.edu>.X|.TH ORAC|
|00000730| 4c 45 20 36 20 22 32 39 | 20 4a 75 6c 79 20 31 39 |LE 6 "29| July 19|
|00000740| 38 39 22 0a 58 2e 53 48 | 20 4e 41 4d 45 0a 58 6f |89".X.SH| NAME.Xo|
|00000750| 72 61 63 6c 65 20 5c 2d | 20 61 6e 73 77 65 72 20 |racle \-| answer |
|00000760| 64 69 66 66 69 63 75 6c | 74 20 71 75 65 73 74 69 |difficul|t questi|
|00000770| 6f 6e 73 0a 58 2e 53 48 | 20 53 59 4e 4f 50 53 49 |ons.X.SH| SYNOPSI|
|00000780| 53 0a 58 2e 42 20 6f 72 | 61 63 6c 65 0a 58 2e 53 |S.X.B or|acle.X.S|
|00000790| 48 20 44 45 53 43 52 49 | 50 54 49 4f 4e 0a 58 2e |H DESCRI|PTION.X.|
|000007a0| 49 20 4f 72 61 63 6c 65 | 0a 58 69 73 20 61 20 70 |I Oracle|.Xis a p|
|000007b0| 72 6f 67 72 61 6d 20 74 | 68 61 74 20 61 63 63 65 |rogram t|hat acce|
|000007c0| 70 74 20 71 75 65 73 74 | 69 6f 6e 73 20 61 6e 64 |pt quest|ions and|
|000007d0| 20 67 69 76 65 73 20 61 | 6e 73 77 65 72 73 3b 20 | gives a|nswers; |
|000007e0| 69 66 20 79 6f 75 20 77 | 61 6e 74 0a 58 74 6f 20 |if you w|ant.Xto |
|000007f0| 6b 6e 6f 77 20 68 6f 77 | 20 74 6f 20 75 73 65 20 |know how| to use |
|00000800| 69 74 2c 20 6a 75 73 74 | 20 72 75 6e 20 69 74 2e |it, just| run it.|
|00000810| 20 20 49 74 73 20 6f 70 | 65 72 61 74 69 6f 6e 20 | Its op|eration |
|00000820| 69 73 20 70 72 65 74 74 | 79 20 73 65 6c 66 2d 65 |is prett|y self-e|
|00000830| 76 69 64 65 6e 74 2e 0a | 58 42 75 74 20 69 66 20 |vident..|XBut if |
|00000840| 79 6f 75 20 77 61 6e 74 | 20 74 6f 20 73 70 6f 69 |you want| to spoi|
|00000850| 6c 20 74 68 65 20 73 65 | 63 72 65 74 20 6f 66 20 |l the se|cret of |
|00000860| 68 6f 77 20 69 74 20 77 | 6f 72 6b 73 2c 20 72 65 |how it w|orks, re|
|00000870| 61 64 20 6f 6e 2e 0a 58 | 2e 50 50 0a 58 45 76 65 |ad on..X|.PP.XEve|
|00000880| 72 79 20 74 69 6d 65 20 | 73 6f 6d 65 6f 6e 65 20 |ry time |someone |
|00000890| 74 79 70 65 73 20 69 6e | 20 61 20 71 75 65 73 74 |types in| a quest|
|000008a0| 69 6f 6e 2c 0a 58 2e 49 | 20 6f 72 61 63 6c 65 0a |ion,.X.I| oracle.|
|000008b0| 58 73 61 76 65 73 20 69 | 74 20 69 6e 20 61 20 66 |Xsaves i|t in a f|
|000008c0| 69 6c 65 20 69 6e 20 74 | 68 65 0a 58 2e 49 20 6f |ile in t|he.X.I o|
|000008d0| 72 61 63 6c 65 0a 58 64 | 69 72 65 63 74 6f 72 79 |racle.Xd|irectory|
|000008e0| 2e 20 20 41 66 74 65 72 | 20 73 6f 6d 65 6f 6e 65 |. After| someone|
|000008f0| 20 68 61 73 20 74 79 70 | 65 64 20 69 6e 20 61 20 | has typ|ed in a |
|00000900| 71 75 65 73 74 69 6f 6e | 2c 0a 58 2e 49 20 6f 72 |question|,.X.I or|
|00000910| 61 63 6c 65 0a 58 6c 6f | 6f 6b 73 20 69 6e 20 74 |acle.Xlo|oks in t|
|00000920| 68 69 73 20 64 69 72 65 | 63 74 6f 72 79 20 66 6f |his dire|ctory fo|
|00000930| 72 20 71 75 65 73 74 69 | 6f 6e 73 20 66 72 6f 6d |r questi|ons from|
|00000940| 20 6f 74 68 65 72 20 75 | 73 65 72 73 2e 0a 58 49 | other u|sers..XI|
|00000950| 74 20 74 61 6b 65 73 20 | 74 68 65 20 6f 6c 64 65 |t takes |the olde|
|00000960| 73 74 20 6f 6e 65 20 69 | 6e 20 74 68 65 72 65 20 |st one i|n there |
|00000970| 61 6e 64 20 61 73 6b 73 | 20 74 68 65 20 75 73 65 |and asks| the use|
|00000980| 72 20 74 6f 20 61 6e 73 | 77 65 72 20 69 74 2e 0a |r to ans|wer it..|
|00000990| 58 54 68 65 6e 20 69 74 | 20 6d 61 69 6c 73 20 74 |XThen it| mails t|
|000009a0| 68 69 73 20 61 6e 73 77 | 65 72 2c 20 61 6c 6f 6e |his answ|er, alon|
|000009b0| 67 20 77 69 74 68 20 61 | 20 63 6f 70 79 20 6f 66 |g with a| copy of|
|000009c0| 20 74 68 65 20 71 75 65 | 73 74 69 6f 6e 2c 20 74 | the que|stion, t|
|000009d0| 6f 0a 58 74 68 65 20 70 | 65 72 73 6f 6e 20 77 68 |o.Xthe p|erson wh|
|000009e0| 6f 20 66 69 72 73 74 20 | 61 73 6b 65 64 20 74 68 |o first |asked th|
|000009f0| 65 20 71 75 65 73 74 69 | 6f 6e 2e 0a 58 0a 58 2e |e questi|on..X.X.|
|00000a00| 53 48 20 42 55 47 53 0a | 58 49 74 27 73 20 6e 6f |SH BUGS.|XIt's no|
|00000a10| 74 20 6d 75 63 68 20 66 | 75 6e 20 69 66 20 79 6f |t much f|un if yo|
|00000a20| 75 27 72 65 20 74 68 65 | 20 6f 6e 6c 79 20 6f 6e |u're the| only on|
|00000a30| 65 20 70 6c 61 79 69 6e | 67 2e 20 20 49 66 20 79 |e playin|g. If y|
|00000a40| 6f 75 20 73 65 65 20 61 | 6e 79 20 6f 74 68 65 72 |ou see a|ny other|
|00000a50| 0a 58 62 75 67 73 2c 20 | 70 6c 65 61 73 65 20 73 |.Xbugs, |please s|
|00000a60| 65 6e 64 20 74 68 65 6d | 20 6f 72 20 61 6e 79 20 |end them| or any |
|00000a70| 63 6f 6d 6d 65 6e 74 73 | 20 74 6f 3a 0a 58 2e 69 |comments| to:.X.i|
|00000a80| 6e 20 2b 32 0a 58 2e 6e | 66 0a 58 4c 61 72 73 20 |n +2.X.n|f.XLars |
|00000a90| 48 75 74 74 61 72 0a 58 | 3c 68 75 74 74 61 72 40 |Huttar.X|<huttar@|
|00000aa0| 6f 63 63 73 2e 6f 62 65 | 72 6c 69 6e 2e 65 64 75 |occs.obe|rlin.edu|
|00000ab0| 3e 0a 58 3c 73 6c 68 36 | 35 35 39 40 6f 62 65 72 |>.X<slh6|559@ober|
|00000ac0| 6c 69 6e 2e 62 69 74 6e | 65 74 3e 0a 58 0a 53 48 |lin.bitn|et>.X.SH|
|00000ad0| 41 52 5f 45 4f 46 0a 66 | 69 20 23 20 65 6e 64 20 |AR_EOF.f|i # end |
|00000ae0| 6f 66 20 6f 76 65 72 77 | 72 69 74 69 6e 67 20 63 |of overw|riting c|
|00000af0| 68 65 63 6b 0a 69 66 20 | 74 65 73 74 20 2d 66 20 |heck.if |test -f |
|00000b00| 27 4e 6f 74 65 73 27 0a | 74 68 65 6e 0a 09 65 63 |'Notes'.|then..ec|
|00000b10| 68 6f 20 73 68 61 72 3a | 20 77 69 6c 6c 20 6e 6f |ho shar:| will no|
|00000b20| 74 20 6f 76 65 72 2d 77 | 72 69 74 65 20 65 78 69 |t over-w|rite exi|
|00000b30| 73 74 69 6e 67 20 66 69 | 6c 65 20 22 27 4e 6f 74 |sting fi|le "'Not|
|00000b40| 65 73 27 22 0a 65 6c 73 | 65 0a 73 65 64 20 27 73 |es'".els|e.sed 's|
|00000b50| 2f 5e 58 2f 2f 27 20 3c | 3c 20 5c 53 48 41 52 5f |/^X//' <|< \SHAR_|
|00000b60| 45 4f 46 20 3e 20 27 4e | 6f 74 65 73 27 0a 58 4c |EOF > 'N|otes'.XL|
|00000b70| 69 62 20 64 69 72 65 63 | 74 6f 72 79 3a 0a 58 4f |ib direc|tory:.XO|
|00000b80| 52 41 43 4c 45 44 49 52 | 20 28 64 65 66 69 6e 65 |RACLEDIR| (define|
|00000b90| 64 20 69 6e 20 4d 61 6b | 65 66 69 6c 65 29 20 69 |d in Mak|efile) i|
|00000ba0| 73 20 61 0a 58 71 75 65 | 73 74 69 6f 6e 20 64 69 |s a.Xque|stion di|
|00000bb0| 72 65 63 74 6f 72 79 20 | 77 69 74 68 20 6f 6e 65 |rectory |with one|
|00000bc0| 20 66 69 6c 65 20 70 65 | 72 20 71 75 65 73 74 69 | file pe|r questi|
|00000bd0| 6f 6e 2e 0a 58 46 69 6c | 65 6e 61 6d 65 20 69 73 |on..XFil|ename is|
|00000be0| 20 71 5f 75 73 65 72 6e | 61 6d 65 5f 74 69 6d 65 | q_usern|ame_time|
|00000bf0| 5f 68 6f 73 74 6e 61 6d | 65 5f 70 72 6f 63 65 73 |_hostnam|e_proces|
|00000c00| 73 69 64 20 66 6f 72 20 | 65 61 63 68 20 66 69 6c |sid for |each fil|
|00000c10| 65 2e 0a 58 4f 6e 65 20 | 66 69 6c 65 20 69 73 20 |e..XOne |file is |
|00000c20| 63 61 6c 6c 65 64 20 22 | 72 65 63 6f 72 64 22 20 |called "|record" |
|00000c30| 61 6e 64 20 63 6f 6e 74 | 61 69 6e 73 20 74 68 65 |and cont|ains the|
|00000c40| 20 64 69 72 65 63 74 6f | 72 79 20 6c 69 73 74 69 | directo|ry listi|
|00000c50| 6e 67 2e 0a 58 54 68 65 | 20 63 6f 6d 6d 61 6e 64 |ng..XThe| command|
|00000c60| 20 73 79 73 74 65 6d 28 | 22 6c 73 20 2d 72 74 20 | system(|"ls -rt |
|00000c70| 71 5f 2a 20 3e 20 72 65 | 63 6f 72 64 22 29 20 66 |q_* > re|cord") f|
|00000c80| 69 6c 6c 73 20 74 68 69 | 73 20 66 69 6c 65 2e 0a |ills thi|s file..|
|00000c90| 58 41 6e 6f 74 68 65 72 | 20 66 69 6c 65 20 69 73 |XAnother| file is|
|00000ca0| 20 22 6c 6f 63 6b 66 69 | 6c 65 22 2c 20 77 68 6f | "lockfi|le", who|
|00000cb0| 73 65 20 65 78 69 73 74 | 65 6e 63 65 20 6d 65 61 |se exist|ence mea|
|00000cc0| 6e 73 20 61 6e 20 6f 72 | 61 63 6c 65 20 70 72 6f |ns an or|acle pro|
|00000cd0| 63 65 73 73 20 69 73 0a | 58 75 73 69 6e 67 20 74 |cess is.|Xusing t|
|00000ce0| 68 65 20 64 69 72 65 63 | 74 6f 72 79 20 74 6f 20 |he direc|tory to |
|00000cf0| 74 68 65 20 65 78 63 6c | 75 73 69 6f 6e 20 6f 66 |the excl|usion of|
|00000d00| 20 6f 74 68 65 72 73 2e | 0a 58 0a 58 50 72 6f 63 | others.|.X.XProc|
|00000d10| 65 73 73 20 77 68 65 6e | 20 73 6f 6d 65 62 6f 64 |ess when| somebod|
|00000d20| 79 20 72 75 6e 73 20 2a | 6f 72 61 63 6c 65 2a 3a |y runs *|oracle*:|
|00000d30| 0a 58 09 41 2e 20 53 61 | 79 20 22 50 6c 65 61 73 |.X.A. Sa|y "Pleas|
|00000d40| 65 20 74 79 70 65 20 69 | 6e 20 79 6f 75 72 20 71 |e type i|n your q|
|00000d50| 75 65 73 74 69 6f 6e 2e | 22 20 20 53 61 76 65 20 |uestion.|" Save |
|00000d60| 71 75 65 73 74 69 6f 6e | 20 69 6e 20 61 20 66 69 |question| in a fi|
|00000d70| 6c 65 20 69 6e 0a 58 09 | 09 71 75 65 73 74 69 6f |le in.X.|.questio|
|00000d80| 6e 20 64 69 72 65 63 74 | 6f 72 79 2c 20 77 69 74 |n direct|ory, wit|
|00000d90| 68 20 78 5f 20 70 72 65 | 66 69 78 2e 0a 58 09 42 |h x_ pre|fix..X.B|
|00000da0| 2e 20 4c 6f 63 6b 20 71 | 75 65 73 74 69 6f 6e 73 |. Lock q|uestions|
|00000db0| 20 64 69 72 65 63 74 6f | 72 79 2e 0a 58 09 09 55 | directo|ry..X..U|
|00000dc0| 70 64 61 74 65 20 22 72 | 65 63 6f 72 64 22 20 66 |pdate "r|ecord" f|
|00000dd0| 69 6c 65 2e 0a 58 09 09 | 47 65 74 20 6c 65 61 73 |ile..X..|Get leas|
|00000de0| 74 20 72 65 63 65 6e 74 | 20 71 75 65 73 74 69 6f |t recent| questio|
|00000df0| 6e 20 66 69 6c 65 20 2d | 2d 20 74 68 61 74 20 69 |n file -|- that i|
|00000e00| 73 20 74 68 65 20 66 69 | 72 73 74 20 66 69 6c 65 |s the fi|rst file|
|00000e10| 20 6c 69 73 74 65 64 0a | 58 09 09 69 6e 20 22 72 | listed.|X..in "r|
|00000e20| 65 63 6f 72 64 22 20 2d | 2d 20 77 68 69 63 68 20 |ecord" -|- which |
|00000e30| 64 69 64 20 6e 6f 74 20 | 63 6f 6d 65 20 66 72 6f |did not |come fro|
|00000e40| 6d 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 75 73 |m the cu|rrent us|
|00000e50| 65 72 2e 0a 58 09 09 4d | 6f 76 65 20 74 68 61 74 |er..X..M|ove that|
|00000e60| 20 66 69 6c 65 20 74 6f | 20 74 5f 62 6c 61 68 62 | file to| t_blahb|
|00000e70| 6c 61 68 62 6c 61 68 2e | 20 28 74 20 66 6f 72 20 |lahblah.| (t for |
|00000e80| 74 65 6d 70 29 0a 58 09 | 09 55 6e 6c 6f 63 6b 20 |temp).X.|.Unlock |
|00000e90| 64 69 72 65 63 74 6f 72 | 79 2e 0a 58 09 43 2e 20 |director|y..X.C. |
|00000ea0| 50 72 69 6e 74 20 74 68 | 65 20 71 75 65 73 74 69 |Print th|e questi|
|00000eb0| 6f 6e 20 61 6e 64 20 67 | 65 74 20 61 6e 73 77 65 |on and g|et answe|
|00000ec0| 72 20 66 72 6f 6d 20 75 | 73 65 72 2e 0a 58 09 09 |r from u|ser..X..|
|00000ed0| 53 61 76 65 20 74 6f 20 | 66 69 6c 65 20 61 5f 62 |Save to |file a_b|
|00000ee0| 6c 61 68 62 6c 61 68 62 | 6c 61 68 2e 20 20 4d 61 |lahblahb|lah. Ma|
|00000ef0| 69 6c 20 74 6f 20 6f 72 | 69 67 69 6e 61 6c 0a 58 |il to or|iginal.X|
|00000f00| 09 09 71 75 65 73 74 69 | 6f 6e 65 72 20 2d 2d 20 |..questi|oner -- |
|00000f10| 73 79 73 74 65 6d 28 22 | 6d 61 69 6c 20 75 73 65 |system("|mail use|
|00000f20| 72 20 3c 20 61 5f 62 6c | 61 62 6c 61 62 6c 61 22 |r < a_bl|ablabla"|
|00000f30| 29 2e 0a 58 09 09 4d 6f | 76 65 20 74 68 65 20 78 |)..X..Mo|ve the x|
|00000f40| 5f 20 66 69 6c 65 20 28 | 63 72 65 61 74 65 64 20 |_ file (|created |
|00000f50| 69 6e 20 41 29 20 74 6f | 20 71 5f 77 68 61 74 65 |in A) to| q_whate|
|00000f60| 76 65 72 2e 0a 58 09 09 | 52 65 6d 6f 76 65 20 74 |ver..X..|Remove t|
|00000f70| 68 65 20 74 5f 20 61 6e | 64 20 61 5f 20 66 69 6c |he t_ an|d a_ fil|
|00000f80| 65 73 20 2d 2d 20 75 6e | 6c 65 73 73 20 74 68 65 |es -- un|less the|
|00000f90| 20 4c 4f 47 20 66 6c 61 | 67 20 69 73 20 23 64 65 | LOG fla|g is #de|
|00000fa0| 66 69 6e 65 64 0a 58 09 | 09 69 6e 20 77 68 69 63 |fined.X.|.in whic|
|00000fb0| 68 20 63 61 73 65 20 74 | 68 65 20 61 5f 20 66 69 |h case t|he a_ fi|
|00000fc0| 6c 65 73 20 61 72 65 20 | 6c 65 66 74 20 61 72 6f |les are |left aro|
|00000fd0| 75 6e 64 2e 0a 58 09 44 | 2e 20 54 65 6c 6c 20 75 |und..X.D|. Tell u|
|00000fe0| 73 65 72 20 74 68 65 20 | 61 6e 73 77 65 72 20 77 |ser the |answer w|
|00000ff0| 69 6c 6c 20 72 65 61 63 | 68 20 74 68 65 6d 20 69 |ill reac|h them i|
|00001000| 6e 20 61 20 73 68 6f 72 | 74 20 77 68 69 6c 65 2e |n a shor|t while.|
|00001010| 20 20 41 73 6b 20 75 73 | 65 72 0a 58 09 09 74 6f | Ask us|er.X..to|
|00001020| 20 65 6e 63 6f 75 72 61 | 67 65 20 66 72 69 65 6e | encoura|ge frien|
|00001030| 64 73 20 74 6f 20 41 73 | 6b 20 54 68 65 20 4f 72 |ds to As|k The Or|
|00001040| 61 63 6c 65 2e 0a 58 0a | 58 50 72 65 66 69 78 20 |acle..X.|XPrefix |
|00001050| 73 75 6d 6d 61 72 79 3a | 0a 58 09 71 5f 20 41 20 |summary:|.X.q_ A |
|00001060| 71 75 65 73 74 69 6f 6e | 20 66 69 6c 65 20 74 68 |question| file th|
|00001070| 61 74 20 68 61 73 20 62 | 65 65 6e 20 73 74 6f 72 |at has b|een stor|
|00001080| 65 64 20 62 79 20 61 20 | 70 72 65 76 69 6f 75 73 |ed by a |previous|
|00001090| 20 6f 72 61 63 6c 65 2c | 20 6f 72 0a 58 09 20 20 | oracle,| or.X. |
|000010a0| 20 69 73 20 63 72 65 61 | 74 65 64 20 66 72 6f 6d | is crea|ted from|
|000010b0| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 75 73 65 | the cur|rent use|
|000010c0| 72 27 73 20 71 75 65 73 | 74 69 6f 6e 20 6a 75 73 |r's ques|tion jus|
|000010d0| 74 20 62 65 66 6f 72 65 | 20 63 75 72 72 65 6e 74 |t before| current|
|000010e0| 0a 58 09 20 20 20 6f 72 | 61 63 6c 65 20 74 65 72 |.X. or|acle ter|
|000010f0| 6d 69 6e 61 74 65 73 2e | 0a 58 0a 58 09 74 5f 20 |minates.|.X.X.t_ |
|00001100| 41 20 71 75 65 73 74 69 | 6f 6e 20 66 69 6c 65 20 |A questi|on file |
|00001110| 66 72 6f 6d 20 61 20 64 | 69 66 66 65 72 65 6e 74 |from a d|ifferent|
|00001120| 20 75 73 65 72 20 74 68 | 61 74 20 68 61 73 20 62 | user th|at has b|
|00001130| 65 65 6e 20 73 65 6c 65 | 63 74 65 64 0a 58 09 20 |een sele|cted.X. |
|00001140| 20 20 74 6f 20 62 65 20 | 73 68 6f 77 6e 20 74 6f | to be |shown to|
|00001150| 20 61 6e 64 20 61 6e 73 | 77 65 72 65 64 20 62 79 | and ans|wered by|
|00001160| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 75 73 65 | the cur|rent use|
|00001170| 72 2e 0a 58 0a 58 09 78 | 5f 20 54 65 6d 70 6f 72 |r..X.X.x|_ Tempor|
|00001180| 61 72 79 20 66 69 6c 65 | 20 74 6f 20 77 68 69 63 |ary file| to whic|
|00001190| 68 20 74 68 65 20 71 75 | 65 73 74 69 6f 6e 20 6f |h the qu|estion o|
|000011a0| 66 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 75 73 |f the cu|rrent us|
|000011b0| 65 72 20 69 73 20 77 72 | 69 74 74 65 6e 0a 58 09 |er is wr|itten.X.|
|000011c0| 20 20 20 61 73 20 69 74 | 20 69 73 20 62 65 69 6e | as it| is bein|
|000011d0| 67 20 74 79 70 65 64 2e | 20 20 47 65 74 73 20 6d |g typed.| Gets m|
|000011e0| 6f 76 65 64 20 74 6f 20 | 71 5f 20 69 66 20 65 76 |oved to |q_ if ev|
|000011f0| 65 72 79 74 68 69 6e 67 | 20 67 6f 65 73 20 73 6d |erything| goes sm|
|00001200| 6f 6f 74 68 6c 79 2e 0a | 58 0a 58 09 61 5f 20 41 |oothly..|X.X.a_ A|
|00001210| 6e 73 77 65 72 20 66 69 | 6c 65 2c 20 65 78 61 63 |nswer fi|le, exac|
|00001220| 74 6c 79 20 61 73 20 74 | 68 65 20 66 69 6e 61 6c |tly as t|he final|
|00001230| 20 61 6e 73 77 65 72 20 | 6d 65 73 73 61 67 65 20 | answer |message |
|00001240| 77 69 6c 6c 20 62 65 20 | 73 65 6e 74 0a 58 09 20 |will be |sent.X. |
|00001250| 20 20 74 6f 20 74 68 65 | 20 4f 74 68 65 72 20 55 | to the| Other U|
|00001260| 73 65 72 20 77 68 6f 73 | 65 20 71 75 65 73 74 69 |ser whos|e questi|
|00001270| 6f 6e 20 77 61 73 20 73 | 65 6c 65 63 74 65 64 2e |on was s|elected.|
|00001280| 20 20 53 6f 20 69 74 20 | 63 6f 6e 74 61 69 6e 73 | So it |contains|
|00001290| 0a 58 09 20 20 20 69 6e | 74 72 6f 64 75 63 74 6f |.X. in|troducto|
|000012a0| 72 79 20 72 65 6d 61 72 | 6b 73 2c 20 61 20 63 6f |ry remar|ks, a co|
|000012b0| 70 79 20 6f 66 20 74 68 | 65 20 4f 74 68 65 72 20 |py of th|e Other |
|000012c0| 55 73 65 72 27 73 20 71 | 75 65 73 74 69 6f 6e 2c |User's q|uestion,|
|000012d0| 0a 58 09 20 20 20 61 6e | 64 20 74 68 65 20 61 6e |.X. an|d the an|
|000012e0| 73 77 65 72 20 67 69 76 | 65 6e 20 62 79 20 74 68 |swer giv|en by th|
|000012f0| 65 20 63 75 72 72 65 6e | 74 20 75 73 65 72 2e 20 |e curren|t user. |
|00001300| 20 54 68 69 73 20 61 6e | 73 77 65 72 20 69 73 20 | This an|swer is |
|00001310| 77 72 69 74 74 65 6e 0a | 58 09 20 20 20 6c 69 6e |written.|X. lin|
|00001320| 65 2d 62 79 2d 6c 69 6e | 65 20 61 73 20 74 68 65 |e-by-lin|e as the|
|00001330| 20 75 73 65 72 20 74 79 | 70 65 73 20 69 74 20 69 | user ty|pes it i|
|00001340| 6e 2e 0a 58 0a 58 0a 58 | 50 65 72 6d 69 73 73 69 |n..X.X.X|Permissi|
|00001350| 6f 6e 73 3a 0a 58 09 41 | 6c 6c 20 66 69 6c 65 73 |ons:.X.A|ll files|
|00001360| 20 77 69 6c 6c 20 62 65 | 20 72 65 61 64 61 62 6c | will be| readabl|
|00001370| 65 20 61 6e 64 20 77 72 | 69 74 61 62 6c 65 20 6f |e and wr|itable o|
|00001380| 6e 6c 79 20 62 79 20 74 | 68 65 20 6f 77 6e 65 72 |nly by t|he owner|
|00001390| 2e 0a 58 54 68 65 20 2a | 6f 72 61 63 6c 65 2a 20 |..XThe *|oracle* |
|000013a0| 70 72 6f 67 72 61 6d 20 | 77 69 6c 6c 20 68 61 76 |program |will hav|
|000013b0| 65 20 74 68 65 20 73 65 | 74 75 69 64 20 62 69 74 |e the se|tuid bit|
|000013c0| 20 73 65 74 2c 20 73 6f | 20 74 68 61 74 0a 58 75 | set, so| that.Xu|
|000013d0| 73 65 72 73 20 77 69 6c | 6c 20 22 62 65 63 6f 6d |sers wil|l "becom|
|000013e0| 65 22 20 74 68 65 20 6f | 77 6e 65 72 20 77 68 69 |e" the o|wner whi|
|000013f0| 6c 65 20 74 68 65 20 70 | 72 6f 67 72 61 6d 20 69 |le the p|rogram i|
|00001400| 73 20 72 75 6e 6e 69 6e | 67 2e 0a 58 49 6e 20 6f |s runnin|g..XIn o|
|00001410| 72 64 65 72 20 74 6f 20 | 68 61 76 65 20 6d 61 69 |rder to |have mai|
|00001420| 6c 20 6d 65 73 73 61 67 | 65 73 20 61 70 70 65 61 |l messag|es appea|
|00001430| 72 20 74 6f 20 62 65 20 | 66 72 6f 6d 20 74 68 65 |r to be |from the|
|00001440| 20 6f 77 6e 65 72 20 6f | 66 20 6f 72 61 63 6c 65 | owner o|f oracle|
|00001450| 2c 0a 58 74 68 65 20 72 | 65 61 6c 20 75 69 64 20 |,.Xthe r|eal uid |
|00001460| 6f 66 20 74 68 65 20 70 | 72 6f 63 65 73 73 20 69 |of the p|rocess i|
|00001470| 73 20 73 65 74 20 74 6f | 20 74 68 65 20 65 66 66 |s set to| the eff|
|00001480| 65 63 74 69 76 65 20 75 | 69 64 20 6a 75 73 74 20 |ective u|id just |
|00001490| 62 65 66 6f 72 65 0a 58 | 6d 61 69 6c 69 6e 67 20 |before.X|mailing |
|000014a0| 6f 63 63 75 72 73 2e 0a | 58 0a 58 0a 58 0a 58 41 |occurs..|X.X.X.XA|
|000014b0| 63 63 65 73 73 69 6e 67 | 20 74 68 65 20 64 69 72 |ccessing| the dir|
|000014c0| 65 63 74 6f 72 79 3a 0a | 58 09 41 74 74 65 6d 70 |ectory:.|X.Attemp|
|000014d0| 74 20 74 6f 20 63 64 20 | 74 68 65 72 65 20 62 65 |t to cd |there be|
|000014e0| 66 6f 72 65 20 61 6e 79 | 74 68 69 6e 67 20 73 74 |fore any|thing st|
|000014f0| 61 72 74 73 2e 20 20 49 | 66 20 77 65 20 66 61 69 |arts. I|f we fai|
|00001500| 6c 2c 20 71 75 69 74 2e | 0a 58 0a 58 4c 6f 67 3a |l, quit.|.X.XLog:|
|00001510| 0a 58 09 49 66 20 61 20 | 63 65 72 74 61 69 6e 20 |.X.If a |certain |
|00001520| 66 6c 61 67 20 4c 4f 47 | 20 69 73 20 23 64 65 66 |flag LOG| is #def|
|00001530| 69 6e 65 64 2c 20 71 5f | 20 61 6e 64 20 61 5f 20 |ined, q_| and a_ |
|00001540| 66 69 6c 65 73 20 77 69 | 6c 6c 0a 58 62 65 20 6c |files wi|ll.Xbe l|
|00001550| 65 66 74 20 75 6e 64 65 | 6c 65 74 65 64 20 69 6e |eft unde|leted in|
|00001560| 20 74 68 65 20 6f 72 61 | 63 6c 65 20 64 69 72 65 | the ora|cle dire|
|00001570| 63 74 6f 72 79 2e 0a 58 | 0a 58 0a 58 54 6f 20 64 |ctory..X|.X.XTo d|
|00001580| 6f 3a 0a 58 09 41 66 74 | 65 72 20 74 68 65 20 71 |o:.X.Aft|er the q|
|00001590| 75 65 73 74 69 6f 6e 20 | 69 73 20 65 6e 74 65 72 |uestion |is enter|
|000015a0| 65 64 2c 20 74 68 65 20 | 6f 72 61 63 6c 65 20 73 |ed, the |oracle s|
|000015b0| 68 6f 75 6c 64 20 68 61 | 76 65 20 74 68 65 20 70 |hould ha|ve the p|
|000015c0| 65 72 73 6f 6e 0a 58 63 | 6f 6e 66 69 72 6d 2c 20 |erson.Xc|onfirm, |
|000015d0| 22 44 6f 20 79 6f 75 20 | 73 74 69 6c 6c 20 77 61 |"Do you |still wa|
|000015e0| 6e 74 20 74 6f 20 73 65 | 6e 64 20 74 68 69 73 20 |nt to se|nd this |
|000015f0| 71 75 65 73 74 69 6f 6e | 20 74 6f 20 74 68 65 20 |question| to the |
|00001600| 6f 72 61 63 6c 65 3f 22 | 0a 58 09 49 66 20 44 45 |oracle?"|.X.If DE|
|00001610| 42 55 47 20 69 73 20 64 | 65 66 69 6e 65 64 2c 20 |BUG is d|efined, |
|00001620| 63 68 65 63 6b 20 75 70 | 6f 6e 20 73 74 61 72 74 |check up|on start|
|00001630| 75 70 20 28 61 29 20 77 | 68 65 74 68 65 72 20 74 |up (a) w|hether t|
|00001640| 68 65 20 66 69 6c 65 0a | 58 61 72 67 76 5b 30 5d |he file.|Xargv[0]|
|00001650| 20 68 61 73 20 74 68 65 | 20 73 65 74 75 69 64 20 | has the| setuid |
|00001660| 62 69 74 20 73 65 74 2c | 20 61 6e 64 20 28 62 29 |bit set,| and (b)|
|00001670| 20 77 68 65 74 68 65 72 | 20 69 74 20 68 61 73 20 | whether| it has |
|00001680| 77 6f 72 6b 65 64 20 28 | 6f 6e 20 73 6f 6d 65 0a |worked (|on some.|
|00001690| 58 66 69 6c 65 73 79 73 | 74 65 6d 73 20 69 74 20 |Xfilesys|tems it |
|000016a0| 6d 61 79 20 62 65 20 69 | 67 6e 6f 72 65 64 20 66 |may be i|gnored f|
|000016b0| 6f 72 20 73 65 63 75 72 | 69 74 79 20 72 65 61 73 |or secur|ity reas|
|000016c0| 6f 6e 73 29 2e 0a 58 09 | 45 6e 74 65 72 20 63 62 |ons)..X.|Enter cb|
|000016d0| 72 65 61 6b 20 6d 6f 64 | 65 20 73 6f 20 74 68 61 |reak mod|e so tha|
|000016e0| 74 20 69 66 20 74 68 65 | 20 75 73 65 72 20 74 72 |t if the| user tr|
|000016f0| 69 65 73 20 5e 43 2c 20 | 74 68 65 20 70 72 6f 67 |ies ^C, |the prog|
|00001700| 72 61 6d 20 63 61 6e 0a | 58 65 78 69 74 20 67 72 |ram can.|Xexit gr|
|00001710| 61 63 65 66 75 6c 6c 79 | 2c 20 72 65 73 74 6f 72 |acefully|, restor|
|00001720| 69 6e 67 20 61 6e 79 20 | 71 5f 66 69 6c 65 20 69 |ing any |q_file i|
|00001730| 74 20 6d 69 67 68 74 20 | 68 61 76 65 20 6d 6f 76 |t might |have mov|
|00001740| 65 64 20 74 6f 20 74 5f | 2c 20 61 6e 64 0a 58 72 |ed to t_|, and.Xr|
|00001750| 65 6d 6f 76 69 6e 67 20 | 61 6e 79 20 63 72 65 61 |emoving |any crea|
|00001760| 74 65 64 20 66 69 6c 65 | 73 20 74 68 61 74 20 61 |ted file|s that a|
|00001770| 72 65 20 74 6f 20 62 65 | 20 61 62 61 6e 64 6f 6e |re to be| abandon|
|00001780| 65 64 20 28 69 6e 63 6c | 75 64 69 6e 67 20 6c 6f |ed (incl|uding lo|
|00001790| 63 6b 66 69 6c 65 2c 0a | 58 78 5f 77 68 61 74 65 |ckfile,.|Xx_whate|
|000017a0| 76 65 72 2c 20 61 6e 64 | 20 61 5f 77 68 61 74 65 |ver, and| a_whate|
|000017b0| 76 65 72 29 2e 0a 58 09 | 41 6c 6c 6f 77 20 61 20 |ver)..X.|Allow a |
|000017c0| 66 69 6c 65 20 74 6f 20 | 62 65 20 73 70 65 63 69 |file to |be speci|
|000017d0| 66 69 65 64 20 61 73 20 | 61 20 63 6f 6d 6d 61 6e |fied as |a comman|
|000017e0| 64 2d 6c 69 6e 65 20 61 | 72 67 75 6d 65 6e 74 2c |d-line a|rgument,|
|000017f0| 20 74 68 61 74 20 6f 72 | 61 63 6c 65 0a 58 77 69 | that or|acle.Xwi|
|00001800| 6c 6c 20 72 65 61 64 20 | 74 68 65 20 71 75 65 73 |ll read |the ques|
|00001810| 74 69 6f 6e 20 66 72 6f | 6d 2e 0a 58 0a 53 48 41 |tion fro|m..X.SHA|
|00001820| 52 5f 45 4f 46 0a 66 69 | 20 23 20 65 6e 64 20 6f |R_EOF.fi| # end o|
|00001830| 66 20 6f 76 65 72 77 72 | 69 74 69 6e 67 20 63 68 |f overwr|iting ch|
|00001840| 65 63 6b 0a 69 66 20 74 | 65 73 74 20 2d 66 20 27 |eck.if t|est -f '|
|00001850| 6f 72 61 63 6c 65 2e 63 | 27 0a 74 68 65 6e 0a 09 |oracle.c|'.then..|
|00001860| 65 63 68 6f 20 73 68 61 | 72 3a 20 77 69 6c 6c 20 |echo sha|r: will |
|00001870| 6e 6f 74 20 6f 76 65 72 | 2d 77 72 69 74 65 20 65 |not over|-write e|
|00001880| 78 69 73 74 69 6e 67 20 | 66 69 6c 65 20 22 27 6f |xisting |file "'o|
|00001890| 72 61 63 6c 65 2e 63 27 | 22 0a 65 6c 73 65 0a 73 |racle.c'|".else.s|
|000018a0| 65 64 20 27 73 2f 5e 58 | 2f 2f 27 20 3c 3c 20 5c |ed 's/^X|//' << \|
|000018b0| 53 48 41 52 5f 45 4f 46 | 20 3e 20 27 6f 72 61 63 |SHAR_EOF| > 'orac|
|000018c0| 6c 65 2e 63 27 0a 58 2f | 2a 0a 58 20 2a 20 43 6f |le.c'.X/|*.X * Co|
|000018d0| 70 79 72 69 67 68 74 20 | 31 39 38 39 20 4c 61 72 |pyright |1989 Lar|
|000018e0| 73 20 48 75 74 74 61 72 | 0a 58 20 2a 0a 58 20 2a |s Huttar|.X *.X *|
|000018f0| 20 50 65 72 6d 69 73 73 | 69 6f 6e 20 74 6f 20 75 | Permiss|ion to u|
|00001900| 73 65 2c 20 63 6f 70 79 | 2c 20 6d 6f 64 69 66 79 |se, copy|, modify|
|00001910| 2c 20 61 6e 64 20 64 69 | 73 74 72 69 62 75 74 65 |, and di|stribute|
|00001920| 20 74 68 69 73 20 73 6f | 66 74 77 61 72 65 20 61 | this so|ftware a|
|00001930| 6e 64 20 69 74 73 0a 58 | 20 2a 20 64 6f 63 75 6d |nd its.X| * docum|
|00001940| 65 6e 74 61 74 69 6f 6e | 20 66 6f 72 20 61 6e 79 |entation| for any|
|00001950| 20 70 75 72 70 6f 73 65 | 20 61 6e 64 20 77 69 74 | purpose| and wit|
|00001960| 68 6f 75 74 20 66 65 65 | 20 69 73 20 68 65 72 65 |hout fee| is here|
|00001970| 62 79 20 67 72 61 6e 74 | 65 64 2c 20 70 72 6f 76 |by grant|ed, prov|
|00001980| 69 64 65 64 0a 58 20 2a | 20 74 68 61 74 20 74 68 |ided.X *| that th|
|00001990| 65 20 61 62 6f 76 65 20 | 63 6f 70 79 72 69 67 68 |e above |copyrigh|
|000019a0| 74 20 6e 6f 74 69 63 65 | 20 61 70 70 65 61 72 20 |t notice| appear |
|000019b0| 69 6e 20 61 6c 6c 20 63 | 6f 70 69 65 73 20 61 6e |in all c|opies an|
|000019c0| 64 20 74 68 61 74 20 62 | 6f 74 68 20 74 68 61 74 |d that b|oth that|
|000019d0| 0a 58 20 2a 20 63 6f 70 | 79 72 69 67 68 74 20 6e |.X * cop|yright n|
|000019e0| 6f 74 69 63 65 20 61 6e | 64 20 74 68 69 73 20 70 |otice an|d this p|
|000019f0| 65 72 6d 69 73 73 69 6f | 6e 20 6e 6f 74 69 63 65 |ermissio|n notice|
|00001a00| 20 61 70 70 65 61 72 20 | 69 6e 20 73 75 70 70 6f | appear |in suppo|
|00001a10| 72 74 69 6e 67 0a 58 20 | 2a 20 64 6f 63 75 6d 65 |rting.X |* docume|
|00001a20| 6e 74 61 74 69 6f 6e 2c | 20 61 6e 64 20 74 68 61 |ntation,| and tha|
|00001a30| 74 20 74 68 65 20 6e 61 | 6d 65 20 6f 66 20 4c 61 |t the na|me of La|
|00001a40| 72 73 20 48 75 74 74 61 | 72 20 6e 6f 74 20 62 65 |rs Hutta|r not be|
|00001a50| 20 75 73 65 64 20 69 6e | 20 61 64 76 65 72 74 69 | used in| adverti|
|00001a60| 73 69 6e 67 0a 58 20 2a | 20 6f 72 20 70 75 62 6c |sing.X *| or publ|
|00001a70| 69 63 69 74 79 20 70 65 | 72 74 61 69 6e 69 6e 67 |icity pe|rtaining|
|00001a80| 20 74 6f 20 64 69 73 74 | 72 69 62 75 74 69 6f 6e | to dist|ribution|
|00001a90| 20 6f 66 20 74 68 65 20 | 73 6f 66 74 77 61 72 65 | of the |software|
|00001aa0| 20 77 69 74 68 6f 75 74 | 20 73 70 65 63 69 66 69 | without| specifi|
|00001ab0| 63 2c 0a 58 20 2a 20 77 | 72 69 74 74 65 6e 20 70 |c,.X * w|ritten p|
|00001ac0| 72 69 6f 72 20 70 65 72 | 6d 69 73 73 69 6f 6e 2e |rior per|mission.|
|00001ad0| 20 20 4c 61 72 73 20 48 | 75 74 74 61 72 20 6d 61 | Lars H|uttar ma|
|00001ae0| 6b 65 73 20 6e 6f 20 72 | 65 70 72 65 73 65 6e 74 |kes no r|epresent|
|00001af0| 61 74 69 6f 6e 73 20 61 | 62 6f 75 74 20 74 68 65 |ations a|bout the|
|00001b00| 0a 58 20 2a 20 73 75 69 | 74 61 62 69 6c 69 74 79 |.X * sui|tability|
|00001b10| 20 6f 66 20 74 68 69 73 | 20 73 6f 66 74 77 61 72 | of this| softwar|
|00001b20| 65 20 66 6f 72 20 61 6e | 79 20 70 75 72 70 6f 73 |e for an|y purpos|
|00001b30| 65 2e 20 20 49 74 20 69 | 73 20 70 72 6f 76 69 64 |e. It i|s provid|
|00001b40| 65 64 20 22 61 73 20 69 | 73 22 0a 58 20 2a 20 77 |ed "as i|s".X * w|
|00001b50| 69 74 68 6f 75 74 20 65 | 78 70 72 65 73 73 20 6f |ithout e|xpress o|
|00001b60| 72 20 69 6d 70 6c 69 65 | 64 20 77 61 72 72 61 6e |r implie|d warran|
|00001b70| 74 79 2e 0a 58 20 2a 0a | 58 20 2a 20 4c 41 52 53 |ty..X *.|X * LARS|
|00001b80| 20 48 55 54 54 41 52 20 | 44 49 53 43 4c 41 49 4d | HUTTAR |DISCLAIM|
|00001b90| 53 20 41 4c 4c 20 57 41 | 52 52 41 4e 54 49 45 53 |S ALL WA|RRANTIES|
|00001ba0| 20 57 49 54 48 20 52 45 | 47 41 52 44 20 54 4f 20 | WITH RE|GARD TO |
|00001bb0| 54 48 49 53 20 53 4f 46 | 54 57 41 52 45 2c 0a 58 |THIS SOF|TWARE,.X|
|00001bc0| 20 2a 20 49 4e 43 4c 55 | 44 49 4e 47 20 49 4d 50 | * INCLU|DING IMP|
|00001bd0| 4c 49 45 44 20 57 41 52 | 52 41 4e 54 49 45 53 20 |LIED WAR|RANTIES |
|00001be0| 4f 46 20 4d 45 52 43 48 | 41 4e 54 41 42 49 4c 49 |OF MERCH|ANTABILI|
|00001bf0| 54 59 20 41 4e 44 20 46 | 49 54 4e 45 53 53 2c 20 |TY AND F|ITNESS, |
|00001c00| 49 4e 20 4e 4f 20 45 56 | 45 4e 54 0a 58 20 2a 20 |IN NO EV|ENT.X * |
|00001c10| 53 48 41 4c 4c 20 4c 41 | 52 53 20 48 55 54 54 41 |SHALL LA|RS HUTTA|
|00001c20| 52 20 42 45 20 4c 49 41 | 42 4c 45 20 46 4f 52 20 |R BE LIA|BLE FOR |
|00001c30| 41 4e 59 20 53 50 45 43 | 49 41 4c 2c 20 49 4e 44 |ANY SPEC|IAL, IND|
|00001c40| 49 52 45 43 54 20 4f 52 | 20 43 4f 4e 53 45 51 55 |IRECT OR| CONSEQU|
|00001c50| 45 4e 54 49 41 4c 0a 58 | 20 2a 20 44 41 4d 41 47 |ENTIAL.X| * DAMAG|
|00001c60| 45 53 20 4f 52 20 41 4e | 59 20 44 41 4d 41 47 45 |ES OR AN|Y DAMAGE|
|00001c70| 53 20 57 48 41 54 53 4f | 45 56 45 52 20 52 45 53 |S WHATSO|EVER RES|
|00001c80| 55 4c 54 49 4e 47 20 46 | 52 4f 4d 20 4c 4f 53 53 |ULTING F|ROM LOSS|
|00001c90| 20 4f 46 20 55 53 45 2c | 20 44 41 54 41 20 4f 52 | OF USE,| DATA OR|
|00001ca0| 0a 58 20 2a 20 50 52 4f | 46 49 54 53 2c 20 57 48 |.X * PRO|FITS, WH|
|00001cb0| 45 54 48 45 52 20 49 4e | 20 41 4e 20 41 43 54 49 |ETHER IN| AN ACTI|
|00001cc0| 4f 4e 20 4f 46 20 43 4f | 4e 54 52 41 43 54 2c 20 |ON OF CO|NTRACT, |
|00001cd0| 4e 45 47 4c 49 47 45 4e | 43 45 20 4f 52 20 4f 54 |NEGLIGEN|CE OR OT|
|00001ce0| 48 45 52 20 54 4f 52 54 | 49 4f 55 53 0a 58 20 2a |HER TORT|IOUS.X *|
|00001cf0| 20 41 43 54 49 4f 4e 2c | 20 41 52 49 53 49 4e 47 | ACTION,| ARISING|
|00001d00| 20 4f 55 54 20 4f 46 20 | 4f 52 20 49 4e 20 43 4f | OUT OF |OR IN CO|
|00001d10| 4e 4e 45 43 54 49 4f 4e | 20 57 49 54 48 20 54 48 |NNECTION| WITH TH|
|00001d20| 45 20 55 53 45 20 4f 52 | 20 50 45 52 46 4f 52 4d |E USE OR| PERFORM|
|00001d30| 41 4e 43 45 20 4f 46 0a | 58 20 2a 20 54 48 49 53 |ANCE OF.|X * THIS|
|00001d40| 20 53 4f 46 54 57 41 52 | 45 2e 0a 58 20 2a 0a 58 | SOFTWAR|E..X *.X|
|00001d50| 20 2a 20 41 75 74 68 6f | 72 3a 20 20 4c 61 72 73 | * Autho|r: Lars|
|00001d60| 20 48 75 74 74 61 72 2c | 20 4f 62 65 72 6c 69 6e | Huttar,| Oberlin|
|00001d70| 20 43 6f 6c 6c 65 67 65 | 0a 58 20 2a 20 20 20 20 | College|.X * |
|00001d80| 20 20 20 20 20 20 68 75 | 74 74 61 72 40 6f 63 63 | hu|ttar@occ|
|00001d90| 73 2e 6f 62 65 72 6c 69 | 6e 2e 65 64 75 0a 58 20 |s.oberli|n.edu.X |
|00001da0| 2a 20 20 20 20 20 20 20 | 20 20 20 73 6c 68 36 35 |* | slh65|
|00001db0| 35 39 40 6f 62 65 72 6c | 69 6e 2e 62 69 74 6e 65 |59@oberl|in.bitne|
|00001dc0| 74 0a 58 20 2a 2f 0a 58 | 0a 58 23 69 6e 63 6c 75 |t.X */.X|.X#inclu|
|00001dd0| 64 65 20 3c 73 74 64 69 | 6f 2e 68 3e 0a 58 23 69 |de <stdi|o.h>.X#i|
|00001de0| 6e 63 6c 75 64 65 20 3c | 73 79 73 2f 70 61 72 61 |nclude <|sys/para|
|00001df0| 6d 2e 68 3e 0a 58 20 20 | 20 2f 2a 20 20 5e 5e 20 |m.h>.X | /* ^^ |
|00001e00| 64 65 66 69 6e 65 73 20 | 4d 41 58 48 4f 53 54 4e |defines |MAXHOSTN|
|00001e10| 41 4d 45 4c 45 4e 20 2a | 2f 0a 58 23 69 6e 63 6c |AMELEN *|/.X#incl|
|00001e20| 75 64 65 20 3c 73 79 73 | 2f 74 69 6d 65 2e 68 3e |ude <sys|/time.h>|
|00001e30| 0a 58 23 69 6e 63 6c 75 | 64 65 20 3c 65 72 72 6e |.X#inclu|de <errn|
|00001e40| 6f 2e 68 3e 0a 58 23 69 | 6e 63 6c 75 64 65 20 3c |o.h>.X#i|nclude <|
|00001e50| 70 77 64 2e 68 3e 0a 58 | 0a 58 23 69 66 6e 64 65 |pwd.h>.X|.X#ifnde|
|00001e60| 66 20 4c 5f 63 75 73 65 | 72 69 64 0a 58 23 64 65 |f L_cuse|rid.X#de|
|00001e70| 66 69 6e 65 20 4c 5f 63 | 75 73 65 72 69 64 20 35 |fine L_c|userid 5|
|00001e80| 30 0a 58 23 65 6e 64 69 | 66 0a 58 69 6e 74 20 65 |0.X#endi|f.Xint e|
|00001e90| 72 72 6e 6f 3b 0a 58 0a | 58 23 64 65 66 69 6e 65 |rrno;.X.|X#define|
|00001ea0| 20 4d 41 58 50 4e 4c 45 | 4e 20 35 30 20 20 2f 2a | MAXPNLE|N 50 /*|
|00001eb0| 20 54 68 61 74 27 73 20 | 62 65 69 6e 67 20 67 65 | That's |being ge|
|00001ec0| 6e 65 72 6f 75 73 2e 20 | 2a 2f 0a 58 73 74 61 74 |nerous. |*/.Xstat|
|00001ed0| 69 63 20 63 68 61 72 20 | 70 72 6f 67 6e 61 6d 65 |ic char |progname|
|00001ee0| 5b 4d 41 58 50 4e 4c 45 | 4e 5d 2c 20 6c 6f 67 69 |[MAXPNLE|N], logi|
|00001ef0| 6e 6e 61 6d 65 5b 4c 5f | 63 75 73 65 72 69 64 5d |nname[L_|cuserid]|
|00001f00| 3b 0a 58 20 20 20 2f 2a | 20 4c 5f 63 75 73 65 72 |;.X /*| L_cuser|
|00001f10| 69 64 20 69 73 20 64 65 | 66 69 6e 65 64 20 69 6e |id is de|fined in|
|00001f20| 20 73 74 64 69 6f 2e 68 | 20 6f 6e 20 73 6f 6d 65 | stdio.h| on some|
|00001f30| 20 73 79 73 74 65 6d 73 | 2c 0a 58 20 20 20 20 20 | systems|,.X |
|00001f40| 20 61 6e 64 20 69 73 20 | 74 68 65 20 6d 61 78 20 | and is |the max |
|00001f50| 6c 65 6e 67 74 68 20 6f | 66 20 6c 6f 67 69 6e 20 |length o|f login |
|00001f60| 6e 61 6d 65 73 2e 20 2a | 2f 0a 58 69 6e 74 20 6c |names. *|/.Xint l|
|00001f70| 6f 67 6e 61 6d 6c 65 6e | 3b 0a 58 0a 58 0a 58 75 |ognamlen|;.X.X.Xu|
|00001f80| 73 61 67 65 28 29 0a 58 | 7b 20 20 66 70 72 69 6e |sage().X|{ fprin|
|00001f90| 74 66 28 73 74 64 65 72 | 72 2c 20 22 55 73 61 67 |tf(stder|r, "Usag|
|00001fa0| 65 3a 20 25 73 5c 6e 22 | 2c 20 70 72 6f 67 6e 61 |e: %s\n"|, progna|
|00001fb0| 6d 65 29 3b 0a 58 20 20 | 20 65 78 69 74 28 31 29 |me);.X | exit(1)|
|00001fc0| 3b 0a 58 7d 0a 58 0a 58 | 6d 61 69 6e 28 61 72 67 |;.X}.X.X|main(arg|
|00001fd0| 63 2c 20 61 72 67 76 29 | 0a 58 69 6e 74 20 61 72 |c, argv)|.Xint ar|
|00001fe0| 67 63 3b 0a 58 63 68 61 | 72 20 2a 2a 61 72 67 76 |gc;.Xcha|r **argv|
|00001ff0| 3b 0a 58 7b 20 20 63 68 | 61 72 20 2a 6b 73 2c 20 |;.X{ ch|ar *ks, |
|00002000| 2a 67 65 74 6c 6f 67 69 | 6e 28 29 3b 0a 58 20 20 |*getlogi|n();.X |
|00002010| 20 73 74 72 75 63 74 20 | 70 61 73 73 77 64 20 2a | struct |passwd *|
|00002020| 6b 70 3b 0a 58 0a 58 23 | 69 66 64 65 66 20 44 45 |kp;.X.X#|ifdef DE|
|00002030| 42 55 47 0a 58 20 20 20 | 6b 70 3d 67 65 74 70 77 |BUG.X |kp=getpw|
|00002040| 75 69 64 28 67 65 74 65 | 75 69 64 28 29 29 3b 0a |uid(gete|uid());.|
|00002050| 58 20 20 20 70 72 69 6e | 74 66 28 22 65 75 69 64 |X prin|tf("euid|
|00002060| 3a 20 25 64 20 25 73 5c | 6e 22 2c 20 67 65 74 65 |: %d %s\|n", gete|
|00002070| 75 69 64 28 29 2c 20 6b | 70 2d 3e 70 77 5f 6e 61 |uid(), k|p->pw_na|
|00002080| 6d 65 29 3b 0a 58 23 65 | 6e 64 69 66 0a 58 0a 58 |me);.X#e|ndif.X.X|
|00002090| 20 20 20 69 66 20 28 63 | 68 64 69 72 28 4f 52 41 | if (c|hdir(ORA|
|000020a0| 43 4c 45 44 49 52 29 29 | 20 20 20 2f 2a 20 54 72 |CLEDIR))| /* Tr|
|000020b0| 79 20 74 6f 20 67 6f 20 | 74 6f 20 74 68 65 20 64 |y to go |to the d|
|000020c0| 69 72 65 63 74 6f 72 79 | 2e 20 2a 2f 0a 58 20 20 |irectory|. */.X |
|000020d0| 20 20 20 20 6d 79 5f 65 | 72 72 6f 72 28 22 65 72 | my_e|rror("er|
|000020e0| 72 6f 72 20 69 6e 20 6d | 61 69 6e 28 29 3a 20 43 |ror in m|ain(): C|
|000020f0| 6f 75 6c 64 6e 27 74 20 | 63 68 64 69 72 20 74 6f |ouldn't |chdir to|
|00002100| 20 22 2c 20 4f 52 41 43 | 4c 45 44 49 52 29 3b 0a | ", ORAC|LEDIR);.|
|00002110| 58 0a 58 20 20 20 69 66 | 20 28 21 28 6b 73 20 3d |X.X if| (!(ks =|
|00002120| 20 67 65 74 6c 6f 67 69 | 6e 28 29 29 29 0a 58 20 | getlogi|n())).X |
|00002130| 20 20 7b 20 20 69 66 20 | 28 21 28 6b 70 20 3d 20 | { if |(!(kp = |
|00002140| 67 65 74 70 77 75 69 64 | 28 67 65 74 75 69 64 28 |getpwuid|(getuid(|
|00002150| 29 29 29 29 0a 58 20 20 | 20 20 20 20 20 20 20 6d |)))).X | m|
|00002160| 79 5f 65 72 72 6f 72 28 | 22 65 72 72 6f 72 20 69 |y_error(|"error i|
|00002170| 6e 20 6d 61 69 6e 28 29 | 3a 20 43 6f 75 6c 64 6e |n main()|: Couldn|
|00002180| 27 74 20 67 65 74 20 75 | 73 65 72 6e 61 6d 65 2e |'t get u|sername.|
|00002190| 22 2c 20 22 22 29 3b 0a | 58 20 20 20 20 20 20 65 |", "");.|X e|
|000021a0| 6c 73 65 20 73 74 72 63 | 70 79 28 6c 6f 67 69 6e |lse strc|py(login|
|000021b0| 6e 61 6d 65 2c 20 6b 70 | 2d 3e 70 77 5f 6e 61 6d |name, kp|->pw_nam|
|000021c0| 65 29 3b 0a 58 20 20 20 | 7d 0a 58 20 20 20 65 6c |e);.X |}.X el|
|000021d0| 73 65 20 73 74 72 63 70 | 79 28 6c 6f 67 69 6e 6e |se strcp|y(loginn|
|000021e0| 61 6d 65 2c 20 6b 73 29 | 3b 0a 58 20 20 20 6c 6f |ame, ks)|;.X lo|
|000021f0| 67 6e 61 6d 6c 65 6e 3d | 73 74 72 6c 65 6e 28 6c |gnamlen=|strlen(l|
|00002200| 6f 67 69 6e 6e 61 6d 65 | 29 3b 0a 58 0a 58 20 20 |oginname|);.X.X |
|00002210| 20 73 74 72 6e 63 70 79 | 28 70 72 6f 67 6e 61 6d | strncpy|(prognam|
|00002220| 65 2c 20 61 72 67 76 5b | 30 5d 2c 20 4d 41 58 50 |e, argv[|0], MAXP|
|00002230| 4e 4c 45 4e 2d 31 29 3b | 0a 58 20 20 20 70 72 6f |NLEN-1);|.X pro|
|00002240| 67 6e 61 6d 65 5b 4d 41 | 58 50 4e 4c 45 4e 2d 31 |gname[MA|XPNLEN-1|
|00002250| 5d 3d 4e 55 4c 4c 3b 0a | 58 0a 58 20 20 20 69 66 |]=NULL;.|X.X if|
|00002260| 20 28 61 72 67 63 3e 31 | 29 20 75 73 61 67 65 28 | (argc>1|) usage(|
|00002270| 29 3b 0a 58 0a 58 20 20 | 20 67 65 74 5f 71 75 65 |);.X.X | get_que|
|00002280| 73 74 69 6f 6e 28 29 3b | 0a 58 20 20 20 67 65 74 |stion();|.X get|
|00002290| 5f 61 6e 73 77 65 72 28 | 29 3b 0a 58 20 20 20 75 |_answer(|);.X u|
|000022a0| 70 64 61 74 65 5f 72 65 | 63 6f 72 64 73 28 29 3b |pdate_re|cords();|
|000022b0| 0a 58 20 20 20 66 61 72 | 65 77 65 6c 6c 28 29 3b |.X far|ewell();|
|000022c0| 0a 58 0a 58 0a 58 7d 0a | 58 0a 58 0a 58 23 64 65 |.X.X.X}.|X.X.X#de|
|000022d0| 66 69 6e 65 20 4d 41 58 | 44 41 54 45 53 49 5a 45 |fine MAX|DATESIZE|
|000022e0| 20 33 30 0a 58 23 64 65 | 66 69 6e 65 20 4d 41 58 | 30.X#de|fine MAX|
|000022f0| 46 4e 53 49 5a 45 20 28 | 4d 41 58 48 4f 53 54 4e |FNSIZE (|MAXHOSTN|
|00002300| 41 4d 45 4c 45 4e 2b 4c | 5f 63 75 73 65 72 69 64 |AMELEN+L|_cuserid|
|00002310| 2b 4d 41 58 44 41 54 45 | 53 49 5a 45 2b 36 29 0a |+MAXDATE|SIZE+6).|
|00002320| 58 73 74 61 74 69 63 20 | 63 68 61 72 20 71 5f 66 |Xstatic |char q_f|
|00002330| 69 6c 65 6e 61 6d 65 5b | 4d 41 58 46 4e 53 49 5a |ilename[|MAXFNSIZ|
|00002340| 45 5d 2c 20 61 5f 66 69 | 6c 65 6e 61 6d 65 5b 4d |E], a_fi|lename[M|
|00002350| 41 58 46 4e 53 49 5a 45 | 5d 3b 0a 58 0a 58 23 64 |AXFNSIZE|];.X.X#d|
|00002360| 65 66 69 6e 65 20 4d 41 | 58 4c 49 4e 45 4c 45 4e |efine MA|XLINELEN|
|00002370| 20 31 34 31 0a 58 0a 58 | 2f 2a 2a 20 54 68 69 73 | 141.X.X|/** This|
|00002380| 20 66 75 6e 63 74 69 6f | 6e 2c 20 67 65 74 5f 71 | functio|n, get_q|
|00002390| 75 65 73 74 69 6f 6e 28 | 29 2c 20 61 73 6b 73 20 |uestion(|), asks |
|000023a0| 74 68 65 20 75 73 65 72 | 20 74 6f 20 74 79 70 65 |the user| to type|
|000023b0| 20 69 6e 20 61 20 71 75 | 65 73 74 69 6f 6e 2e 0a | in a qu|estion..|
|000023c0| 58 20 2a 2a 20 54 68 65 | 20 71 75 65 73 74 69 6f |X ** The| questio|
|000023d0| 6e 20 69 73 20 77 72 69 | 74 74 65 6e 20 6c 69 6e |n is wri|tten lin|
|000023e0| 65 20 62 79 20 6c 69 6e | 65 20 74 6f 20 61 20 74 |e by lin|e to a t|
|000023f0| 65 6d 70 6f 72 61 72 79 | 20 66 69 6c 65 20 78 5f |emporary| file x_|
|00002400| 62 6c 61 68 62 6c 61 68 | 62 6c 61 68 2e 0a 58 20 |blahblah|blah..X |
|00002410| 2a 2f 0a 58 0a 58 67 65 | 74 5f 71 75 65 73 74 69 |*/.X.Xge|t_questi|
|00002420| 6f 6e 28 29 0a 58 7b 20 | 20 63 68 61 72 20 6c 69 |on().X{ | char li|
|00002430| 6e 65 5b 4d 41 58 4c 49 | 4e 45 4c 45 4e 5d 3b 0a |ne[MAXLI|NELEN];.|
|00002440| 58 20 20 20 46 49 4c 45 | 20 2a 6f 75 74 66 70 3b |X FILE| *outfp;|
|00002450| 0a 58 20 20 20 72 65 67 | 69 73 74 65 72 20 69 6e |.X reg|ister in|
|00002460| 74 20 6c 69 6e 65 73 3d | 30 3b 0a 58 0a 58 20 20 |t lines=|0;.X.X |
|00002470| 20 6d 61 6b 65 5f 66 69 | 6c 65 6e 61 6d 65 28 29 | make_fi|lename()|
|00002480| 3b 0a 58 20 20 20 71 5f | 66 69 6c 65 6e 61 6d 65 |;.X q_|filename|
|00002490| 5b 30 5d 3d 27 78 27 3b | 20 20 20 2f 2a 20 54 68 |[0]='x';| /* Th|
|000024a0| 69 73 20 6d 65 61 6e 73 | 20 69 74 27 73 20 61 20 |is means| it's a |
|000024b0| 74 65 6d 70 6f 72 61 72 | 79 20 71 75 65 73 74 69 |temporar|y questi|
|000024c0| 6f 6e 20 66 69 6c 65 2e | 20 2a 2f 0a 58 0a 58 20 |on file.| */.X.X |
|000024d0| 20 20 69 66 20 28 21 28 | 6f 75 74 66 70 3d 66 6f | if (!(|outfp=fo|
|000024e0| 70 65 6e 28 71 5f 66 69 | 6c 65 6e 61 6d 65 2c 20 |pen(q_fi|lename, |
|000024f0| 22 77 22 29 29 29 0a 58 | 20 20 20 20 20 20 6d 79 |"w"))).X| my|
|00002500| 5f 65 72 72 6f 72 28 22 | 65 72 72 6f 72 20 69 6e |_error("|error in|
|00002510| 20 67 65 74 5f 71 75 65 | 73 74 69 6f 6e 28 29 3a | get_que|stion():|
|00002520| 20 43 6f 75 6c 64 6e 27 | 74 20 6f 70 65 6e 20 66 | Couldn'|t open f|
|00002530| 69 6c 65 20 66 6f 72 20 | 77 72 69 74 69 6e 67 3a |ile for |writing:|
|00002540| 20 22 2c 0a 58 20 20 20 | 20 20 20 20 20 71 5f 66 | ",.X | q_f|
|00002550| 69 6c 65 6e 61 6d 65 29 | 3b 0a 58 0a 58 20 20 20 |ilename)|;.X.X |
|00002560| 70 75 74 73 28 22 49 20 | 61 6d 20 74 68 65 20 6f |puts("I |am the o|
|00002570| 72 61 63 6c 65 2e 20 20 | 49 20 63 61 6e 20 61 6e |racle. |I can an|
|00002580| 73 77 65 72 20 61 6e 79 | 20 71 75 65 73 74 69 6f |swer any| questio|
|00002590| 6e 22 29 3b 0a 58 20 20 | 20 70 75 74 73 28 22 69 |n");.X | puts("i|
|000025a0| 6e 20 72 6f 75 67 68 6c | 79 20 63 6f 6e 73 74 61 |n roughl|y consta|
|000025b0| 6e 74 20 74 69 6d 65 2e | 20 20 50 6c 65 61 73 65 |nt time.| Please|
|000025c0| 20 74 79 70 65 20 69 6e | 22 29 3b 0a 58 20 20 20 | type in|");.X |
|000025d0| 70 75 74 73 28 22 79 6f | 75 72 20 71 75 65 73 74 |puts("yo|ur quest|
|000025e0| 69 6f 6e 2e 20 20 45 6e | 74 65 72 20 61 20 62 6c |ion. En|ter a bl|
|000025f0| 61 6e 6b 20 6c 69 6e 65 | 20 77 68 65 6e 22 29 3b |ank line| when");|
|00002600| 0a 58 20 20 20 70 75 74 | 73 28 22 79 6f 75 20 61 |.X put|s("you a|
|00002610| 72 65 20 66 69 6e 69 73 | 68 65 64 20 28 64 6f 6e |re finis|hed (don|
|00002620| 27 74 20 75 73 65 20 5e | 44 21 29 2e 5c 6e 22 29 |'t use ^|D!).\n")|
|00002630| 3b 0a 58 0a 58 20 20 20 | 64 6f 0a 58 20 20 20 7b |;.X.X |do.X {|
|00002640| 20 20 70 75 74 63 68 61 | 72 28 27 3e 27 29 3b 20 | putcha|r('>'); |
|00002650| 70 75 74 63 68 61 72 28 | 27 20 27 29 3b 0a 58 20 |putchar(|' ');.X |
|00002660| 20 20 20 20 20 69 66 20 | 28 21 66 67 65 74 73 28 | if |(!fgets(|
|00002670| 6c 69 6e 65 2c 20 4d 41 | 58 4c 49 4e 45 4c 45 4e |line, MA|XLINELEN|
|00002680| 2d 31 2c 20 73 74 64 69 | 6e 29 20 7c 7c 20 6c 69 |-1, stdi|n) || li|
|00002690| 6e 65 5b 30 5d 3d 3d 27 | 5c 6e 27 29 20 62 72 65 |ne[0]=='|\n') bre|
|000026a0| 61 6b 3b 0a 58 20 20 20 | 20 20 20 6c 69 6e 65 73 |ak;.X | lines|
|000026b0| 3d 31 3b 0a 58 20 20 20 | 20 20 20 6c 69 6e 65 5b |=1;.X | line[|
|000026c0| 4d 41 58 4c 49 4e 45 4c | 45 4e 2d 31 5d 3d 30 3b |MAXLINEL|EN-1]=0;|
|000026d0| 0a 58 20 20 20 20 20 20 | 66 70 75 74 73 28 6c 69 |.X |fputs(li|
|000026e0| 6e 65 2c 20 6f 75 74 66 | 70 29 3b 0a 58 20 20 20 |ne, outf|p);.X |
|000026f0| 7d 20 77 68 69 6c 65 20 | 28 21 66 65 6f 66 28 73 |} while |(!feof(s|
|00002700| 74 64 69 6e 29 29 3b 0a | 58 0a 58 20 20 20 63 6c |tdin));.|X.X cl|
|00002710| 65 61 72 65 72 72 28 73 | 74 64 69 6e 29 3b 0a 58 |earerr(s|tdin);.X|
|00002720| 20 20 20 66 63 6c 6f 73 | 65 28 6f 75 74 66 70 29 | fclos|e(outfp)|
|00002730| 3b 0a 58 0a 58 20 20 20 | 69 66 20 28 21 6c 69 6e |;.X.X |if (!lin|
|00002740| 65 73 29 0a 58 20 20 20 | 7b 20 20 70 75 74 73 28 |es).X |{ puts(|
|00002750| 22 41 73 6b 20 61 20 6e | 75 6c 6c 20 71 75 65 73 |"Ask a n|ull ques|
|00002760| 74 69 6f 6e 2c 20 67 65 | 74 20 61 20 6e 75 6c 6c |tion, ge|t a null|
|00002770| 20 61 6e 73 77 65 72 2e | 22 29 3b 0a 58 20 20 20 | answer.|");.X |
|00002780| 20 20 20 69 66 20 28 75 | 6e 6c 69 6e 6b 28 71 5f | if (u|nlink(q_|
|00002790| 66 69 6c 65 6e 61 6d 65 | 29 29 0a 58 20 20 20 20 |filename|)).X |
|000027a0| 20 20 20 20 20 6d 79 5f | 65 72 72 6f 72 28 22 65 | my_|error("e|
|000027b0| 72 72 6f 72 20 69 6e 20 | 67 65 74 5f 71 75 65 73 |rror in |get_ques|
|000027c0| 74 69 6f 6e 3a 20 43 6f | 75 6c 64 6e 27 74 20 75 |tion: Co|uldn't u|
|000027d0| 6e 6c 69 6e 6b 20 22 2c | 20 71 5f 66 69 6c 65 6e |nlink ",| q_filen|
|000027e0| 61 6d 65 29 3b 0a 58 20 | 20 20 20 20 20 65 78 69 |ame);.X | exi|
|000027f0| 74 28 31 29 3b 0a 58 20 | 20 20 7d 0a 58 7d 0a 58 |t(1);.X | }.X}.X|
|00002800| 0a 58 0a 58 69 6e 74 20 | 67 6f 74 5f 61 6e 73 77 |.X.Xint |got_answ|
|00002810| 65 72 3d 30 3b 0a 58 0a | 58 67 65 74 5f 61 6e 73 |er=0;.X.|Xget_ans|
|00002820| 77 65 72 28 29 0a 58 7b | 20 20 46 49 4c 45 20 2a |wer().X{| FILE *|
|00002830| 72 65 63 66 70 2c 20 2a | 71 75 65 73 66 70 2c 20 |recfp, *|quesfp, |
|00002840| 2a 61 6e 73 66 70 3b 0a | 58 20 20 20 63 68 61 72 |*ansfp;.|X char|
|00002850| 20 6c 69 6e 65 5b 4d 41 | 58 4c 49 4e 45 4c 45 4e | line[MA|XLINELEN|
|00002860| 5d 3b 0a 58 20 20 20 72 | 65 67 69 73 74 65 72 20 |];.X r|egister |
|00002870| 69 6e 74 20 6c 69 6e 65 | 73 3d 30 2c 20 6e 75 6d |int line|s=0, num|
|00002880| 3b 0a 58 0a 58 20 20 20 | 70 75 74 73 28 22 5c 6e |;.X.X |puts("\n|
|00002890| 48 6d 6d 6d 2e 20 20 49 | 27 6c 6c 20 68 61 76 65 |Hmmm. I|'ll have|
|000028a0| 20 74 6f 20 74 68 69 6e | 6b 20 61 62 6f 75 74 20 | to thin|k about |
|000028b0| 74 68 61 74 20 6f 6e 65 | 20 66 6f 72 20 61 20 77 |that one| for a w|
|000028c0| 68 69 6c 65 2e 22 29 3b | 0a 58 0a 58 20 20 2f 2a |hile.");|.X.X /*|
|000028d0| 2a 20 4c 6f 6f 6b 20 66 | 6f 72 20 61 20 73 75 69 |* Look f|or a sui|
|000028e0| 74 61 62 6c 65 20 71 75 | 65 73 74 69 6f 6e 20 66 |table qu|estion f|
|000028f0| 69 6c 65 2e 20 2a 2f 0a | 58 0a 58 20 20 20 69 66 |ile. */.|X.X if|
|00002900| 20 28 6c 6f 63 6b 5f 64 | 69 72 65 63 74 6f 72 79 | (lock_d|irectory|
|00002910| 28 29 29 20 72 65 74 75 | 72 6e 3b 0a 58 20 20 20 |()) retu|rn;.X |
|00002920| 20 20 20 2f 2a 20 43 6f | 75 6c 64 6e 27 74 20 6c | /* Co|uldn't l|
|00002930| 6f 63 6b 20 74 68 65 20 | 64 69 72 65 63 74 6f 72 |ock the |director|
|00002940| 79 2c 20 73 6f 20 64 6f | 6e 27 74 20 72 65 71 75 |y, so do|n't requ|
|00002950| 69 72 65 20 61 6e 20 61 | 6e 73 77 65 72 2e 20 2a |ire an a|nswer. *|
|00002960| 2f 0a 58 0a 58 20 20 20 | 73 79 73 74 65 6d 28 22 |/.X.X |system("|
|00002970| 6c 73 20 2d 72 74 20 71 | 5f 2a 20 3e 20 72 65 63 |ls -rt q|_* > rec|
|00002980| 6f 72 64 20 32 3e 26 2d | 22 29 3b 20 2f 2a 20 73 |ord 2>&-|"); /* s|
|00002990| 74 64 65 72 72 20 67 6f | 65 73 20 74 6f 20 2f 64 |tderr go|es to /d|
|000029a0| 65 76 2f 6e 75 6c 6c 20 | 2a 2f 0a 58 20 20 20 69 |ev/null |*/.X i|
|000029b0| 66 20 28 21 28 72 65 63 | 66 70 3d 66 6f 70 65 6e |f (!(rec|fp=fopen|
|000029c0| 28 22 72 65 63 6f 72 64 | 22 2c 20 22 72 22 29 29 |("record|", "r"))|
|000029d0| 29 20 20 2f 2a 20 4f 70 | 65 6e 20 74 68 65 20 66 |) /* Op|en the f|
|000029e0| 69 6c 65 20 63 6f 6e 74 | 61 69 6e 69 6e 67 20 6c |ile cont|aining l|
|000029f0| 69 73 74 20 6f 66 0a 58 | 20 20 20 20 20 20 20 20 |ist of.X| |
|00002a00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002a10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002a20| 2a 20 71 75 65 73 74 69 | 6f 6e 20 66 69 6c 65 73 |* questi|on files|
|00002a30| 20 2a 2f 0a 58 20 20 20 | 20 20 20 6d 79 5f 65 72 | */.X | my_er|
|00002a40| 72 6f 72 28 22 69 6e 20 | 67 65 74 5f 61 6e 73 77 |ror("in |get_answ|
|00002a50| 65 72 28 29 3a 20 66 6f | 70 65 6e 28 5c 22 72 65 |er(): fo|pen(\"re|
|00002a60| 63 6f 72 64 5c 22 2c 20 | 5c 22 72 5c 22 29 20 67 |cord\", |\"r\") g|
|00002a70| 61 76 65 20 65 72 72 6f | 72 2e 22 2c 20 22 22 29 |ave erro|r.", "")|
|00002a80| 3b 0a 58 0a 58 20 20 20 | 64 6f 0a 58 20 20 20 7b |;.X.X |do.X {|
|00002a90| 20 20 0a 58 20 20 20 20 | 20 20 66 67 65 74 73 28 | .X | fgets(|
|00002aa0| 61 5f 66 69 6c 65 6e 61 | 6d 65 2c 20 4d 41 58 46 |a_filena|me, MAXF|
|00002ab0| 4e 53 49 5a 45 2c 20 72 | 65 63 66 70 29 3b 0a 58 |NSIZE, r|ecfp);.X|
|00002ac0| 20 20 20 20 20 20 69 66 | 20 28 66 65 6f 66 28 72 | if| (feof(r|
|00002ad0| 65 63 66 70 29 29 20 62 | 72 65 61 6b 3b 0a 58 0a |ecfp)) b|reak;.X.|
|00002ae0| 58 20 20 20 20 20 20 69 | 66 20 28 73 74 72 6e 63 |X i|f (strnc|
|00002af0| 6d 70 28 61 5f 66 69 6c | 65 6e 61 6d 65 2b 32 2c |mp(a_fil|ename+2,|
|00002b00| 20 6c 6f 67 69 6e 6e 61 | 6d 65 2c 20 6c 6f 67 6e | loginna|me, logn|
|00002b10| 61 6d 6c 65 6e 29 29 0a | 58 20 20 20 20 20 20 20 |amlen)).|X |
|00002b20| 20 20 62 72 65 61 6b 3b | 20 20 20 2f 2a 20 66 6f | break;| /* fo|
|00002b30| 75 6e 64 20 61 20 71 75 | 65 73 74 69 6f 6e 20 66 |und a qu|estion f|
|00002b40| 72 6f 6d 20 61 20 64 69 | 66 66 65 72 65 6e 74 20 |rom a di|fferent |
|00002b50| 75 73 65 72 20 2a 2f 0a | 58 20 20 20 7d 20 77 68 |user */.|X } wh|
|00002b60| 69 6c 65 20 28 21 66 65 | 6f 66 28 72 65 63 66 70 |ile (!fe|of(recfp|
|00002b70| 29 29 3b 0a 58 0a 58 20 | 20 20 69 66 20 28 66 65 |));.X.X | if (fe|
|00002b80| 6f 66 28 72 65 63 66 70 | 29 29 20 20 2f 2a 20 44 |of(recfp|)) /* D|
|00002b90| 69 64 6e 27 74 20 66 69 | 6e 64 20 61 20 73 75 69 |idn't fi|nd a sui|
|00002ba0| 74 61 62 6c 65 20 71 75 | 65 73 74 69 6f 6e 20 66 |table qu|estion f|
|00002bb0| 69 6c 65 2e 20 2a 2f 0a | 58 20 20 20 7b 20 20 66 |ile. */.|X { f|
|00002bc0| 63 6c 6f 73 65 28 72 65 | 63 66 70 29 3b 0a 58 20 |close(re|cfp);.X |
|00002bd0| 20 20 20 20 20 75 6e 6c | 6f 63 6b 5f 64 69 72 65 | unl|ock_dire|
|00002be0| 63 74 6f 72 79 28 29 3b | 0a 58 20 20 20 20 20 20 |ctory();|.X |
|00002bf0| 72 65 74 75 72 6e 3b 0a | 58 20 20 20 7d 0a 58 20 |return;.|X }.X |
|00002c00| 20 20 66 63 6c 6f 73 65 | 28 72 65 63 66 70 29 3b | fclose|(recfp);|
|00002c10| 0a 58 0a 58 20 20 20 61 | 5f 66 69 6c 65 6e 61 6d |.X.X a|_filenam|
|00002c20| 65 5b 73 74 72 6c 65 6e | 28 61 5f 66 69 6c 65 6e |e[strlen|(a_filen|
|00002c30| 61 6d 65 29 2d 31 5d 3d | 28 63 68 61 72 29 4e 55 |ame)-1]=|(char)NU|
|00002c40| 4c 4c 3b 20 2f 2a 20 54 | 61 6b 65 20 61 77 61 79 |LL; /* T|ake away|
|00002c50| 20 66 69 6e 61 6c 20 6e | 65 77 6c 69 6e 65 20 2a | final n|ewline *|
|00002c60| 2f 0a 58 0a 58 20 20 20 | 7b 20 20 63 68 61 72 20 |/.X.X |{ char |
|00002c70| 6e 75 66 69 6c 65 6e 61 | 6d 65 5b 4d 41 58 46 4e |nufilena|me[MAXFN|
|00002c80| 53 49 5a 45 5d 3b 0a 58 | 0a 58 20 20 20 20 20 20 |SIZE];.X|.X |
|00002c90| 73 74 72 63 70 79 28 6e | 75 66 69 6c 65 6e 61 6d |strcpy(n|ufilenam|
|00002ca0| 65 2c 20 61 5f 66 69 6c | 65 6e 61 6d 65 29 3b 0a |e, a_fil|ename);.|
|00002cb0| 58 20 20 20 20 20 20 6e | 75 66 69 6c 65 6e 61 6d |X n|ufilenam|
|00002cc0| 65 5b 30 5d 3d 27 74 27 | 3b 20 20 20 2f 2a 20 52 |e[0]='t'|; /* R|
|00002cd0| 65 6e 61 6d 65 20 69 74 | 20 73 6f 20 6f 74 68 65 |ename it| so othe|
|00002ce0| 72 20 6f 72 61 63 6c 65 | 73 20 77 69 6c 6c 20 6e |r oracle|s will n|
|00002cf0| 6f 74 20 61 6e 73 77 65 | 72 20 69 74 2e 20 2a 2f |ot answe|r it. */|
|00002d00| 0a 58 20 20 20 20 20 20 | 69 66 20 28 72 65 6e 61 |.X |if (rena|
|00002d10| 6d 65 28 61 5f 66 69 6c | 65 6e 61 6d 65 2c 20 6e |me(a_fil|ename, n|
|00002d20| 75 66 69 6c 65 6e 61 6d | 65 29 29 0a 58 20 20 20 |ufilenam|e)).X |
|00002d30| 20 20 20 20 20 20 6d 79 | 5f 65 72 72 6f 72 28 22 | my|_error("|
|00002d40| 45 72 72 6f 72 20 69 6e | 20 67 65 74 5f 61 6e 73 |Error in| get_ans|
|00002d50| 77 65 72 28 29 20 72 65 | 6e 61 6d 69 6e 67 20 66 |wer() re|naming f|
|00002d60| 69 6c 65 20 22 2c 20 61 | 5f 66 69 6c 65 6e 61 6d |ile ", a|_filenam|
|00002d70| 65 29 3b 0a 58 20 20 20 | 7d 0a 58 0a 58 0a 58 20 |e);.X |}.X.X.X |
|00002d80| 20 20 75 6e 6c 6f 63 6b | 5f 64 69 72 65 63 74 6f | unlock|_directo|
|00002d90| 72 79 28 29 3b 0a 58 0a | 58 0a 58 20 20 2f 2a 2a |ry();.X.|X.X /**|
|00002da0| 20 41 73 6b 20 75 73 65 | 72 20 74 6f 20 61 6e 73 | Ask use|r to ans|
|00002db0| 77 65 72 20 71 75 65 73 | 74 69 6f 6e 2e 20 2a 2f |wer ques|tion. */|
|00002dc0| 0a 58 0a 58 20 20 20 61 | 5f 66 69 6c 65 6e 61 6d |.X.X a|_filenam|
|00002dd0| 65 5b 30 5d 3d 27 74 27 | 3b 0a 58 20 20 20 69 66 |e[0]='t'|;.X if|
|00002de0| 20 28 21 28 71 75 65 73 | 66 70 3d 66 6f 70 65 6e | (!(ques|fp=fopen|
|00002df0| 28 61 5f 66 69 6c 65 6e | 61 6d 65 2c 20 22 72 22 |(a_filen|ame, "r"|
|00002e00| 29 29 29 0a 58 20 20 20 | 20 20 20 6d 79 5f 65 72 |))).X | my_er|
|00002e10| 72 6f 72 28 22 45 72 72 | 6f 72 20 69 6e 20 67 65 |ror("Err|or in ge|
|00002e20| 74 5f 61 6e 73 77 65 72 | 28 29 20 6f 70 65 6e 69 |t_answer|() openi|
|00002e30| 6e 67 20 66 69 6c 65 20 | 66 6f 72 20 69 6e 70 75 |ng file |for inpu|
|00002e40| 74 3a 20 22 2c 20 61 5f | 66 69 6c 65 6e 61 6d 65 |t: ", a_|filename|
|00002e50| 29 3b 0a 58 0a 58 20 20 | 20 61 5f 66 69 6c 65 6e |);.X.X | a_filen|
|00002e60| 61 6d 65 5b 30 5d 3d 27 | 61 27 3b 0a 58 20 20 20 |ame[0]='|a';.X |
|00002e70| 69 66 20 28 21 28 61 6e | 73 66 70 3d 66 6f 70 65 |if (!(an|sfp=fope|
|00002e80| 6e 28 61 5f 66 69 6c 65 | 6e 61 6d 65 2c 20 22 77 |n(a_file|name, "w|
|00002e90| 22 29 29 29 0a 58 20 20 | 20 20 20 20 6d 79 5f 65 |"))).X | my_e|
|00002ea0| 72 72 6f 72 28 22 45 72 | 72 6f 72 20 69 6e 20 67 |rror("Er|ror in g|
|00002eb0| 65 74 5f 61 6e 73 77 65 | 72 28 29 20 6f 70 65 6e |et_answe|r() open|
|00002ec0| 69 6e 67 20 66 69 6c 65 | 20 66 6f 72 20 6f 75 74 |ing file| for out|
|00002ed0| 70 75 74 3a 20 22 2c 20 | 61 5f 66 69 6c 65 6e 61 |put: ", |a_filena|
|00002ee0| 6d 65 29 3b 0a 58 0a 58 | 20 20 20 66 70 75 74 73 |me);.X.X| fputs|
|00002ef0| 28 22 54 68 65 20 6f 72 | 61 63 6c 65 20 68 61 73 |("The or|acle has|
|00002f00| 20 70 6f 6e 64 65 72 65 | 64 20 79 6f 75 72 20 71 | pondere|d your q|
|00002f10| 75 65 73 74 69 6f 6e 20 | 64 65 65 70 6c 79 2e 5c |uestion |deeply.\|
|00002f20| 6e 22 2c 20 61 6e 73 66 | 70 29 3b 0a 58 20 20 20 |n", ansf|p);.X |
|00002f30| 66 70 75 74 73 28 22 59 | 6f 75 72 20 71 75 65 73 |fputs("Y|our ques|
|00002f40| 74 69 6f 6e 20 77 61 73 | 3a 5c 6e 5c 6e 22 2c 20 |tion was|:\n\n", |
|00002f50| 61 6e 73 66 70 29 3b 0a | 58 0a 58 20 20 20 70 75 |ansfp);.|X.X pu|
|00002f60| 74 73 28 22 4d 65 61 6e | 77 68 69 6c 65 2c 20 49 |ts("Mean|while, I|
|00002f70| 27 64 20 6c 69 6b 65 20 | 79 6f 75 20 74 6f 20 61 |'d like |you to a|
|00002f80| 6e 73 77 65 72 20 61 20 | 71 75 65 73 74 69 6f 6e |nswer a |question|
|00002f90| 20 66 6f 72 20 6d 65 3a | 5c 6e 22 29 3b 0a 58 0a | for me:|\n");.X.|
|00002fa0| 58 20 20 20 77 68 69 6c | 65 20 28 21 66 65 6f 66 |X whil|e (!feof|
|00002fb0| 28 71 75 65 73 66 70 29 | 29 0a 58 20 20 20 7b 20 |(quesfp)|).X { |
|00002fc0| 20 73 74 61 74 69 63 20 | 69 6e 74 20 69 3d 30 3b | static |int i=0;|
|00002fd0| 0a 58 0a 58 20 20 20 20 | 20 20 66 67 65 74 73 28 |.X.X | fgets(|
|00002fe0| 6c 69 6e 65 2c 20 4d 41 | 58 4c 49 4e 45 4c 45 4e |line, MA|XLINELEN|
|00002ff0| 2c 20 71 75 65 73 66 70 | 29 3b 0a 58 20 20 20 20 |, quesfp|);.X |
|00003000| 20 20 69 66 20 28 21 66 | 65 6f 66 28 71 75 65 73 | if (!f|eof(ques|
|00003010| 66 70 29 29 0a 58 20 20 | 20 20 20 20 7b 20 20 66 |fp)).X | { f|
|00003020| 70 75 74 73 28 22 3e 20 | 22 2c 20 73 74 64 6f 75 |puts("> |", stdou|
|00003030| 74 29 3b 20 66 70 75 74 | 73 28 6c 69 6e 65 2c 20 |t); fput|s(line, |
|00003040| 73 74 64 6f 75 74 29 3b | 0a 58 20 20 20 20 20 20 |stdout);|.X |
|00003050| 20 20 20 66 70 75 74 73 | 28 22 3e 20 22 2c 20 61 | fputs|("> ", a|
|00003060| 6e 73 66 70 29 3b 20 66 | 70 75 74 73 28 6c 69 6e |nsfp); f|puts(lin|
|00003070| 65 2c 20 61 6e 73 66 70 | 29 3b 0a 58 20 20 20 20 |e, ansfp|);.X |
|00003080| 20 20 7d 0a 58 20 20 20 | 20 20 20 69 66 20 28 2b | }.X | if (+|
|00003090| 2b 69 20 25 20 31 35 20 | 3d 3d 20 30 29 20 67 65 |+i % 15 |== 0) ge|
|000030a0| 74 5f 72 65 74 75 72 6e | 28 22 50 72 65 73 73 20 |t_return|("Press |
|000030b0| 52 45 54 55 52 4e 20 66 | 6f 72 20 4d 6f 72 65 2d |RETURN f|or More-|
|000030c0| 2d 22 29 3b 0a 58 20 20 | 20 7d 0a 58 20 20 20 66 |-");.X | }.X f|
|000030d0| 63 6c 6f 73 65 28 71 75 | 65 73 66 70 29 3b 0a 58 |close(qu|esfp);.X|
|000030e0| 20 20 20 70 75 74 73 28 | 22 5c 6e 57 68 61 74 20 | puts(|"\nWhat |
|000030f0| 77 6f 75 6c 64 20 79 6f | 75 20 73 61 79 3f 5c 6e |would yo|u say?\n|
|00003100| 22 29 3b 0a 58 20 20 20 | 66 70 75 74 73 28 22 5c |");.X |fputs("\|
|00003110| 6e 41 6e 64 20 69 6e 20 | 72 65 73 70 6f 6e 73 65 |nAnd in |response|
|00003120| 2c 20 74 68 75 73 20 73 | 70 61 6b 65 20 74 68 65 |, thus s|pake the|
|00003130| 20 6f 72 61 63 6c 65 3a | 5c 6e 5c 6e 22 2c 20 61 | oracle:|\n\n", a|
|00003140| 6e 73 66 70 29 3b 0a 58 | 0a 58 20 20 20 64 6f 0a |nsfp);.X|.X do.|
|00003150| 58 20 20 20 7b 20 20 70 | 75 74 63 68 61 72 28 27 |X { p|utchar('|
|00003160| 29 27 29 3b 20 70 75 74 | 63 68 61 72 28 27 20 27 |)'); put|char(' '|
|00003170| 29 3b 0a 58 20 20 20 20 | 20 20 66 67 65 74 73 28 |);.X | fgets(|
|00003180| 6c 69 6e 65 2c 20 4d 41 | 58 4c 49 4e 45 4c 45 4e |line, MA|XLINELEN|
|00003190| 2d 31 2c 20 73 74 64 69 | 6e 29 3b 0a 58 20 20 20 |-1, stdi|n);.X |
|000031a0| 20 20 20 69 66 20 28 6c | 69 6e 65 5b 30 5d 3d 3d | if (l|ine[0]==|
|000031b0| 27 5c 6e 27 20 26 26 20 | 6c 69 6e 65 73 29 0a 58 |'\n' && |lines).X|
|000031c0| 20 20 20 20 20 20 20 20 | 20 62 72 65 61 6b 3b 0a | | break;.|
|000031d0| 58 20 20 20 20 20 20 6c | 69 6e 65 73 2b 2b 3b 0a |X l|ines++;.|
|000031e0| 58 20 20 20 20 20 20 6c | 69 6e 65 5b 4d 41 58 4c |X l|ine[MAXL|
|000031f0| 49 4e 45 4c 45 4e 2d 31 | 5d 3d 30 3b 0a 58 20 20 |INELEN-1|]=0;.X |
|00003200| 20 20 20 20 66 70 75 74 | 73 28 6c 69 6e 65 73 25 | fput|s(lines%|
|00003210| 32 20 3f 20 22 7d 20 22 | 20 3a 20 22 7b 20 22 2c |2 ? "} "| : "{ ",|
|00003220| 20 61 6e 73 66 70 29 3b | 20 66 70 75 74 73 28 6c | ansfp);| fputs(l|
|00003230| 69 6e 65 2c 20 61 6e 73 | 66 70 29 3b 0a 58 20 20 |ine, ans|fp);.X |
|00003240| 20 7d 20 77 68 69 6c 65 | 20 28 21 66 65 6f 66 28 | } while| (!feof(|
|00003250| 73 74 64 69 6e 29 29 3b | 0a 58 0a 58 20 20 20 7b |stdin));|.X.X {|
|00003260| 20 20 73 74 61 74 69 63 | 20 63 68 61 72 20 2a 6f | static| char *o|
|00003270| 62 6a 65 63 74 73 5b 5d | 3d 0a 58 20 20 20 20 20 |bjects[]|=.X |
|00003280| 20 20 20 20 7b 22 63 65 | 6e 74 73 22 2c 20 22 6f | {"ce|nts", "o|
|00003290| 66 20 79 6f 75 72 20 63 | 68 69 6c 64 72 65 6e 22 |f your c|hildren"|
|000032a0| 2c 20 22 64 6f 6c 6c 61 | 72 73 22 2c 20 22 62 69 |, "dolla|rs", "bi|
|000032b0| 67 20 6b 69 73 73 65 73 | 22 2c 0a 58 20 20 20 20 |g kisses|",.X |
|000032c0| 20 20 20 20 20 20 22 79 | 65 61 72 73 20 6f 66 20 | "y|ears of |
|000032d0| 73 6c 61 76 65 72 79 22 | 2c 20 22 6d 69 6e 75 74 |slavery"|, "minut|
|000032e0| 65 73 20 6f 66 20 6c 69 | 66 65 22 2c 20 22 6e 65 |es of li|fe", "ne|
|000032f0| 77 74 27 73 20 65 79 65 | 73 22 2c 0a 58 20 20 20 |wt's eye|s",.X |
|00003300| 20 20 20 20 20 20 20 22 | 71 75 61 72 74 73 20 6f | "|quarts o|
|00003310| 66 20 73 6f 79 20 73 61 | 75 63 65 22 2c 20 22 63 |f soy sa|uce", "c|
|00003320| 61 73 65 73 20 6f 66 20 | 72 6f 6f 74 20 62 65 65 |ases of |root bee|
|00003330| 72 22 7d 3b 0a 58 20 20 | 20 20 20 20 0a 58 20 20 |r"};.X | .X |
|00003340| 20 20 20 20 6e 75 6d 3d | 72 61 6e 64 28 29 2b 67 | num=|rand()+g|
|00003350| 65 74 70 69 64 28 29 2b | 67 65 74 75 69 64 28 29 |etpid()+|getuid()|
|00003360| 2b 67 65 74 70 70 69 64 | 28 29 3b 0a 58 20 20 20 |+getppid|();.X |
|00003370| 20 20 20 66 70 72 69 6e | 74 66 28 61 6e 73 66 70 | fprin|tf(ansfp|
|00003380| 2c 20 22 5c 6e 5c 6e 59 | 6f 75 20 6f 77 65 20 74 |, "\n\nY|ou owe t|
|00003390| 68 65 20 6f 72 61 63 6c | 65 20 25 64 20 25 73 2e |he oracl|e %d %s.|
|000033a0| 5c 6e 22 2c 0a 58 20 20 | 20 20 20 20 20 20 20 20 |\n",.X | |
|000033b0| 20 6e 75 6d 25 34 2b 32 | 2c 20 6f 62 6a 65 63 74 | num%4+2|, object|
|000033c0| 73 5b 6e 75 6d 25 39 5d | 29 3b 0a 58 20 20 20 7d |s[num%9]|);.X }|
|000033d0| 0a 58 0a 58 20 20 20 66 | 63 6c 6f 73 65 28 61 6e |.X.X f|close(an|
|000033e0| 73 66 70 29 3b 0a 58 0a | 58 20 20 20 73 77 69 74 |sfp);.X.|X swit|
|000033f0| 63 68 28 6e 75 6d 25 35 | 29 0a 58 20 20 20 7b 20 |ch(num%5|).X { |
|00003400| 20 63 61 73 65 20 31 3a | 20 70 75 74 73 28 22 5c | case 1:| puts("\|
|00003410| 6e 48 61 21 20 20 57 68 | 61 74 20 6b 69 6e 64 20 |nHa! Wh|at kind |
|00003420| 6f 66 20 61 6e 73 77 65 | 72 20 69 73 20 74 68 61 |of answe|r is tha|
|00003430| 74 3f 22 29 3b 20 62 72 | 65 61 6b 3b 0a 58 20 20 |t?"); br|eak;.X |
|00003440| 20 20 20 20 63 61 73 65 | 20 32 3a 20 70 75 74 73 | case| 2: puts|
|00003450| 28 22 5c 6e 4e 6f 77 20 | 77 68 79 20 63 6f 75 6c |("\nNow |why coul|
|00003460| 64 6e 27 74 20 49 20 74 | 68 69 6e 6b 20 6f 66 20 |dn't I t|hink of |
|00003470| 74 68 61 74 3f 22 29 3b | 20 62 72 65 61 6b 3b 0a |that?");| break;.|
|00003480| 58 20 20 20 20 20 20 63 | 61 73 65 20 33 3a 20 70 |X c|ase 3: p|
|00003490| 75 74 73 28 22 5c 6e 4f | 6b 2c 20 67 6f 6f 64 20 |uts("\nO|k, good |
|000034a0| 65 6e 6f 75 67 68 2e 20 | 20 59 6f 75 20 70 61 73 |enough. | You pas|
|000034b0| 73 2e 22 29 3b 20 62 72 | 65 61 6b 3b 0a 58 20 20 |s."); br|eak;.X |
|000034c0| 20 20 20 20 64 65 66 61 | 75 6c 74 3a 20 70 75 74 | defa|ult: put|
|000034d0| 73 28 22 5c 6e 54 68 61 | 6e 6b 20 79 6f 75 21 20 |s("\nTha|nk you! |
|000034e0| 20 54 68 61 74 20 6f 6e | 65 27 73 20 62 65 65 6e | That on|e's been|
|000034f0| 20 74 72 6f 75 62 6c 69 | 6e 67 20 6d 65 2e 22 29 | troubli|ng me.")|
|00003500| 3b 0a 58 20 20 20 7d 0a | 58 0a 58 20 20 20 67 6f |;.X }.|X.X go|
|00003510| 74 5f 61 6e 73 77 65 72 | 3d 31 3b 0a 58 7d 0a 58 |t_answer|=1;.X}.X|
|00003520| 0a 58 0a 58 23 64 65 66 | 69 6e 65 20 57 41 49 54 |.X.X#def|ine WAIT|
|00003530| 4c 49 4d 49 54 20 35 0a | 58 0a 58 2f 2a 2a 20 54 |LIMIT 5.|X.X/** T|
|00003540| 68 69 73 20 66 75 6e 63 | 74 69 6f 6e 2c 20 6c 6f |his func|tion, lo|
|00003550| 63 6b 5f 64 69 72 65 63 | 74 6f 72 79 2c 20 74 72 |ck_direc|tory, tr|
|00003560| 69 65 73 20 74 6f 20 6c | 6f 63 6b 20 74 68 65 20 |ies to l|ock the |
|00003570| 63 75 72 72 65 6e 74 20 | 64 69 72 65 63 74 6f 72 |current |director|
|00003580| 79 0a 58 20 2a 2a 20 62 | 79 20 63 72 65 61 74 69 |y.X ** b|y creati|
|00003590| 6e 67 20 61 20 66 69 6c | 65 20 22 6c 6f 63 6b 66 |ng a fil|e "lockf|
|000035a0| 69 6c 65 22 2c 0a 58 20 | 2a 2a 20 61 6e 64 20 72 |ile",.X |** and r|
|000035b0| 65 74 75 72 6e 73 20 30 | 20 6f 6e 20 73 75 63 63 |eturns 0| on succ|
|000035c0| 65 73 73 2c 20 31 20 6f | 6e 20 66 61 69 6c 75 72 |ess, 1 o|n failur|
|000035d0| 65 2e 20 2a 2f 0a 58 6c | 6f 63 6b 5f 64 69 72 65 |e. */.Xl|ock_dire|
|000035e0| 63 74 6f 72 79 28 29 0a | 58 7b 20 20 72 65 67 69 |ctory().|X{ regi|
|000035f0| 73 74 65 72 20 69 6e 74 | 20 6c 6f 63 6b 66 64 2c |ster int| lockfd,|
|00003600| 20 69 3d 30 3b 0a 58 0a | 58 20 20 20 66 6f 72 20 | i=0;.X.|X for |
|00003610| 28 69 3d 30 3b 20 69 3c | 57 41 49 54 4c 49 4d 49 |(i=0; i<|WAITLIMI|
|00003620| 54 3b 20 69 2b 2b 29 0a | 58 0a 58 20 20 20 7b 20 |T; i++).|X.X { |
|00003630| 20 69 66 20 28 28 6c 6f | 63 6b 66 64 3d 63 72 65 | if ((lo|ckfd=cre|
|00003640| 61 74 28 22 6c 6f 63 6b | 66 69 6c 65 22 2c 20 30 |at("lock|file", 0|
|00003650| 29 29 20 3d 3d 20 2d 31 | 29 0a 58 20 20 20 20 20 |)) == -1|).X |
|00003660| 20 7b 20 20 69 66 20 28 | 65 72 72 6e 6f 20 21 3d | { if (|errno !=|
|00003670| 20 45 41 43 43 45 53 29 | 0a 58 20 20 20 20 20 20 | EACCES)|.X |
|00003680| 20 20 20 20 20 20 6d 79 | 5f 65 72 72 6f 72 28 22 | my|_error("|
|00003690| 45 72 72 6f 72 20 69 6e | 20 6c 6f 63 6b 5f 64 69 |Error in| lock_di|
|000036a0| 72 65 63 74 6f 72 79 28 | 29 3a 20 63 72 65 61 74 |rectory(|): creat|
|000036b0| 28 5c 22 6c 6f 63 6b 66 | 69 6c 65 5c 22 29 3b 22 |(\"lockf|ile\");"|
|000036c0| 2c 20 22 22 29 3b 0a 58 | 20 20 20 20 20 20 7d 0a |, "");.X| }.|
|000036d0| 58 20 20 20 20 20 20 65 | 6c 73 65 0a 58 20 20 20 |X e|lse.X |
|000036e0| 20 20 20 7b 20 20 69 66 | 20 28 63 6c 6f 73 65 28 | { if| (close(|
|000036f0| 6c 6f 63 6b 66 64 29 20 | 3d 3d 20 2d 31 29 0a 58 |lockfd) |== -1).X|
|00003700| 20 20 20 20 20 20 20 20 | 20 20 20 20 6d 79 5f 65 | | my_e|
|00003710| 72 72 6f 72 28 22 45 72 | 72 6f 72 20 69 6e 20 6c |rror("Er|ror in l|
|00003720| 6f 63 6b 5f 64 69 72 65 | 63 74 6f 72 79 28 29 3a |ock_dire|ctory():|
|00003730| 20 63 6c 6f 73 69 6e 67 | 20 6c 6f 63 6b 66 69 6c | closing| lockfil|
|00003740| 65 22 2c 22 22 29 3b 0a | 58 20 20 20 20 20 20 20 |e","");.|X |
|00003750| 20 20 65 6c 73 65 20 72 | 65 74 75 72 6e 28 30 29 | else r|eturn(0)|
|00003760| 3b 0a 58 20 20 20 20 20 | 20 7d 0a 58 0a 58 23 69 |;.X | }.X.X#i|
|00003770| 66 64 65 66 20 44 45 42 | 55 47 0a 58 20 20 20 20 |fdef DEB|UG.X |
|00003780| 20 20 69 66 20 28 69 3d | 3d 30 29 20 70 72 69 6e | if (i=|=0) prin|
|00003790| 74 66 28 22 57 61 69 74 | 69 6e 67 20 66 6f 72 20 |tf("Wait|ing for |
|000037a0| 6c 6f 63 6b 2e 2e 2e 20 | 31 22 29 3b 0a 58 20 20 |lock... |1");.X |
|000037b0| 20 20 20 20 65 6c 73 65 | 20 70 72 69 6e 74 66 28 | else| printf(|
|000037c0| 22 2c 20 25 64 22 2c 20 | 69 2b 31 29 3b 0a 58 20 |", %d", |i+1);.X |
|000037d0| 20 20 20 20 20 66 66 6c | 75 73 68 28 73 74 64 6f | ffl|ush(stdo|
|000037e0| 75 74 29 3b 0a 58 23 65 | 6e 64 69 66 0a 58 20 20 |ut);.X#e|ndif.X |
|000037f0| 20 20 20 20 73 6c 65 65 | 70 28 31 29 3b 20 20 20 | slee|p(1); |
|00003800| 2f 2a 20 49 73 20 74 68 | 69 73 20 74 6f 6f 20 6c |/* Is th|is too l|
|00003810| 6f 6e 67 3f 20 20 75 73 | 6c 65 65 70 28 29 20 6d |ong? us|leep() m|
|00003820| 61 79 20 62 65 20 6d 6f | 72 65 20 61 70 70 72 6f |ay be mo|re appro|
|00003830| 70 72 69 61 74 65 2e 20 | 2a 2f 0a 58 20 20 20 7d |priate. |*/.X }|
|00003840| 0a 58 0a 58 20 20 20 72 | 65 74 75 72 6e 28 31 29 |.X.X r|eturn(1)|
|00003850| 3b 0a 58 7d 0a 58 0a 58 | 0a 58 2f 2a 2a 20 54 68 |;.X}.X.X|.X/** Th|
|00003860| 69 73 20 66 75 6e 63 74 | 69 6f 6e 20 75 6e 6c 6f |is funct|ion unlo|
|00003870| 63 6b 73 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 |cks the |current |
|00003880| 64 69 72 65 63 74 6f 72 | 79 2e 20 2a 2f 0a 58 75 |director|y. */.Xu|
|00003890| 6e 6c 6f 63 6b 5f 64 69 | 72 65 63 74 6f 72 79 28 |nlock_di|rectory(|
|000038a0| 29 0a 58 7b 0a 58 23 69 | 66 64 65 66 20 44 45 42 |).X{.X#i|fdef DEB|
|000038b0| 55 47 0a 58 20 20 20 67 | 65 74 5f 72 65 74 75 72 |UG.X g|et_retur|
|000038c0| 6e 28 22 50 72 65 73 73 | 20 52 45 54 55 52 4e 20 |n("Press| RETURN |
|000038d0| 74 6f 20 75 6e 6c 6f 63 | 6b 20 74 68 65 20 64 69 |to unloc|k the di|
|000038e0| 72 65 63 74 6f 72 79 2e | 22 29 3b 0a 58 23 65 6e |rectory.|");.X#en|
|000038f0| 64 69 66 0a 58 0a 58 20 | 20 20 69 66 20 28 75 6e |dif.X.X | if (un|
|00003900| 6c 69 6e 6b 28 22 6c 6f | 63 6b 66 69 6c 65 22 29 |link("lo|ckfile")|
|00003910| 20 3d 3d 20 2d 31 29 0a | 58 20 20 20 20 20 20 6d | == -1).|X m|
|00003920| 79 5f 65 72 72 6f 72 28 | 22 45 72 72 6f 72 20 69 |y_error(|"Error i|
|00003930| 6e 20 75 6e 6c 69 6e 6b | 28 29 20 77 68 69 6c 65 |n unlink|() while|
|00003940| 20 74 72 79 69 6e 67 20 | 74 6f 20 75 6e 6c 6f 63 | trying |to unloc|
|00003950| 6b 20 64 69 72 65 63 74 | 6f 72 79 2e 22 2c 20 22 |k direct|ory.", "|
|00003960| 22 29 3b 0a 58 7d 0a 58 | 0a 58 0a 58 75 70 64 61 |");.X}.X|.X.Xupda|
|00003970| 74 65 5f 72 65 63 6f 72 | 64 73 28 29 0a 58 7b 20 |te_recor|ds().X{ |
|00003980| 20 63 68 61 72 20 63 6f | 6d 6d 61 6e 64 5b 4c 5f | char co|mmand[L_|
|00003990| 63 75 73 65 72 69 64 2b | 4d 41 58 46 4e 53 49 5a |cuserid+|MAXFNSIZ|
|000039a0| 45 2b 31 30 5d 2c 20 6f | 6c 64 75 73 65 72 5b 4c |E+10], o|lduser[L|
|000039b0| 5f 63 75 73 65 72 69 64 | 5d 2c 20 6e 65 77 71 66 |_cuserid|], newqf|
|000039c0| 6e 5b 4d 41 58 46 4e 53 | 49 5a 45 5d 3b 0a 58 20 |n[MAXFNS|IZE];.X |
|000039d0| 20 20 72 65 67 69 73 74 | 65 72 20 69 6e 74 20 69 | regist|er int i|
|000039e0| 3b 0a 58 0a 58 20 20 20 | 73 74 72 63 70 79 28 6e |;.X.X |strcpy(n|
|000039f0| 65 77 71 66 6e 2c 20 71 | 5f 66 69 6c 65 6e 61 6d |ewqfn, q|_filenam|
|00003a00| 65 29 3b 0a 58 20 20 20 | 6e 65 77 71 66 6e 5b 30 |e);.X |newqfn[0|
|00003a10| 5d 3d 27 71 27 3b 0a 58 | 20 20 20 69 66 20 28 72 |]='q';.X| if (r|
|00003a20| 65 6e 61 6d 65 28 71 5f | 66 69 6c 65 6e 61 6d 65 |ename(q_|filename|
|00003a30| 2c 20 6e 65 77 71 66 6e | 29 29 0a 58 20 20 20 20 |, newqfn|)).X |
|00003a40| 20 20 6d 79 5f 65 72 72 | 6f 72 28 22 75 70 64 61 | my_err|or("upda|
|00003a50| 74 65 5f 72 65 63 6f 72 | 64 73 28 29 3a 20 45 72 |te_recor|ds(): Er|
|00003a60| 72 6f 72 20 72 65 6e 61 | 6d 69 6e 67 20 66 69 6c |ror rena|ming fil|
|00003a70| 65 20 22 2c 20 6e 65 77 | 71 66 6e 29 3b 0a 58 0a |e ", new|qfn);.X.|
|00003a80| 58 20 20 20 69 66 20 28 | 21 67 6f 74 5f 61 6e 73 |X if (|!got_ans|
|00003a90| 77 65 72 29 20 72 65 74 | 75 72 6e 3b 0a 58 20 20 |wer) ret|urn;.X |
|00003aa0| 20 0a 58 20 20 20 66 6f | 72 20 28 69 3d 32 3b 20 | .X fo|r (i=2; |
|00003ab0| 61 5f 66 69 6c 65 6e 61 | 6d 65 5b 69 5d 21 3d 27 |a_filena|me[i]!='|
|00003ac0| 5f 27 3b 20 69 2b 2b 29 | 0a 58 20 20 20 20 20 20 |_'; i++)|.X |
|00003ad0| 6f 6c 64 75 73 65 72 5b | 69 2d 32 5d 3d 61 5f 66 |olduser[|i-2]=a_f|
|00003ae0| 69 6c 65 6e 61 6d 65 5b | 69 5d 3b 0a 58 20 20 20 |ilename[|i];.X |
|00003af0| 6f 6c 64 75 73 65 72 5b | 69 2d 32 5d 3d 30 3b 0a |olduser[|i-2]=0;.|
|00003b00| 58 0a 58 20 20 20 69 66 | 20 28 73 65 74 72 65 75 |X.X if| (setreu|
|00003b10| 69 64 28 67 65 74 65 75 | 69 64 28 29 2c 20 2d 31 |id(geteu|id(), -1|
|00003b20| 29 29 20 20 2f 2a 20 4d | 61 6b 65 20 6d 65 73 73 |)) /* M|ake mess|
|00003b30| 61 67 65 20 62 65 20 46 | 72 6f 6d 20 74 68 65 20 |age be F|rom the |
|00003b40| 6f 72 61 63 6c 65 20 6f | 77 6e 65 72 2e 20 2a 2f |oracle o|wner. */|
|00003b50| 0a 58 20 20 20 20 20 20 | 6d 79 5f 65 72 72 6f 72 |.X |my_error|
|00003b60| 28 22 45 72 72 6f 72 20 | 69 6e 20 75 70 64 61 74 |("Error |in updat|
|00003b70| 65 5f 72 65 63 6f 72 64 | 73 28 29 2c 20 73 65 74 |e_record|s(), set|
|00003b80| 72 65 75 69 64 28 29 3b | 22 2c 20 22 22 29 3b 0a |reuid();|", "");.|
|00003b90| 58 20 20 20 73 70 72 69 | 6e 74 66 28 63 6f 6d 6d |X spri|ntf(comm|
|00003ba0| 61 6e 64 2c 20 22 6d 61 | 69 6c 20 25 73 20 3c 20 |and, "ma|il %s < |
|00003bb0| 25 73 22 2c 20 6f 6c 64 | 75 73 65 72 2c 20 61 5f |%s", old|user, a_|
|00003bc0| 66 69 6c 65 6e 61 6d 65 | 29 3b 0a 58 20 20 20 69 |filename|);.X i|
|00003bd0| 66 20 28 69 3d 73 79 73 | 74 65 6d 28 63 6f 6d 6d |f (i=sys|tem(comm|
|00003be0| 61 6e 64 29 29 0a 58 20 | 20 20 7b 20 20 73 74 61 |and)).X | { sta|
|00003bf0| 74 69 63 20 63 68 61 72 | 20 65 78 69 74 5f 63 6f |tic char| exit_co|
|00003c00| 64 65 5b 35 5d 3b 0a 58 | 20 20 20 20 20 20 73 70 |de[5];.X| sp|
|00003c10| 72 69 6e 74 66 28 65 78 | 69 74 5f 63 6f 64 65 2c |rintf(ex|it_code,|
|00003c20| 20 22 25 64 22 2c 20 69 | 29 3b 0a 58 20 20 20 20 | "%d", i|);.X |
|00003c30| 20 20 6d 79 5f 65 72 72 | 6f 72 28 22 54 72 6f 75 | my_err|or("Trou|
|00003c40| 62 6c 65 20 6d 61 69 6c | 69 6e 67 20 72 65 70 6c |ble mail|ing repl|
|00003c50| 79 2e 20 20 45 78 69 74 | 20 63 6f 64 65 3a 20 22 |y. Exit| code: "|
|00003c60| 2c 20 65 78 69 74 5f 63 | 6f 64 65 29 3b 0a 58 20 |, exit_c|ode);.X |
|00003c70| 20 20 7d 0a 58 0a 58 0a | 58 23 69 66 6e 64 65 66 | }.X.X.|X#ifndef|
|00003c80| 20 4c 4f 47 0a 58 20 20 | 20 69 66 20 28 75 6e 6c | LOG.X | if (unl|
|00003c90| 69 6e 6b 28 61 5f 66 69 | 6c 65 6e 61 6d 65 29 29 |ink(a_fi|lename))|
|00003ca0| 20 20 20 20 2f 2a 20 52 | 65 6d 6f 76 65 20 74 68 | /* R|emove th|
|00003cb0| 65 20 61 6e 73 77 65 72 | 20 66 69 6c 65 20 28 77 |e answer| file (w|
|00003cc0| 68 69 63 68 20 69 6e 63 | 6c 75 64 65 73 0a 58 20 |hich inc|ludes.X |
|00003cd0| 20 20 20 20 20 20 20 20 | 20 20 20 20 61 20 63 6f | | a co|
|00003ce0| 70 79 20 6f 66 20 74 68 | 65 20 71 75 65 73 74 69 |py of th|e questi|
|00003cf0| 6f 6e 29 2a 2f 0a 58 20 | 20 20 20 20 20 6d 79 5f |on)*/.X | my_|
|00003d00| 65 72 72 6f 72 28 22 75 | 70 64 61 74 65 5f 72 65 |error("u|pdate_re|
|00003d10| 63 6f 72 64 73 28 29 3a | 20 45 72 72 6f 72 20 75 |cords():| Error u|
|00003d20| 6e 6c 69 6e 6b 69 6e 67 | 20 22 2c 20 61 5f 66 69 |nlinking| ", a_fi|
|00003d30| 6c 65 6e 61 6d 65 29 3b | 0a 58 23 65 6e 64 69 66 |lename);|.X#endif|
|00003d40| 0a 58 20 20 20 61 5f 66 | 69 6c 65 6e 61 6d 65 5b |.X a_f|ilename[|
|00003d50| 30 5d 3d 27 74 27 3b 0a | 58 20 20 20 69 66 20 28 |0]='t';.|X if (|
|00003d60| 75 6e 6c 69 6e 6b 28 61 | 5f 66 69 6c 65 6e 61 6d |unlink(a|_filenam|
|00003d70| 65 29 29 20 20 20 20 2f | 2a 20 52 65 6d 6f 76 65 |e)) /|* Remove|
|00003d80| 20 74 68 65 20 6f 6c 64 | 20 71 75 65 73 74 69 6f | the old| questio|
|00003d90| 6e 20 66 69 6c 65 20 2a | 2f 0a 58 20 20 20 20 20 |n file *|/.X |
|00003da0| 20 6d 79 5f 65 72 72 6f | 72 28 22 75 70 64 61 74 | my_erro|r("updat|
|00003db0| 65 5f 72 65 63 6f 72 64 | 73 28 29 3a 20 45 72 72 |e_record|s(): Err|
|00003dc0| 6f 72 20 75 6e 6c 69 6e | 6b 69 6e 67 20 22 2c 20 |or unlin|king ", |
|00003dd0| 61 5f 66 69 6c 65 6e 61 | 6d 65 29 3b 0a 58 0a 58 |a_filena|me);.X.X|
|00003de0| 7d 0a 58 0a 58 0a 58 2f | 2a 2a 20 54 68 65 20 66 |}.X.X.X/|** The f|
|00003df0| 75 6e 63 74 69 6f 6e 20 | 6d 61 6b 65 5f 66 69 6c |unction |make_fil|
|00003e00| 65 6e 61 6d 65 20 63 6f | 6e 73 74 72 75 63 74 73 |ename co|nstructs|
|00003e10| 20 61 20 73 74 72 69 6e | 67 20 6f 66 20 74 68 65 | a strin|g of the|
|00003e20| 20 66 6f 72 6d 0a 58 20 | 2a 2a 20 71 5f 75 73 65 | form.X |** q_use|
|00003e30| 72 5f 64 61 74 65 5f 68 | 6f 73 74 5f 70 72 6f 63 |r_date_h|ost_proc|
|00003e40| 65 73 73 69 64 20 61 6e | 64 20 77 72 69 74 65 73 |essid an|d writes|
|00003e50| 20 69 74 20 74 68 65 20 | 67 6c 6f 62 61 6c 20 73 | it the |global s|
|00003e60| 74 72 69 6e 67 20 22 71 | 5f 66 69 6c 65 6e 61 6d |tring "q|_filenam|
|00003e70| 65 22 2e 20 2a 2f 0a 58 | 6d 61 6b 65 5f 66 69 6c |e". */.X|make_fil|
|00003e80| 65 6e 61 6d 65 28 29 0a | 58 7b 20 20 63 68 61 72 |ename().|X{ char|
|00003e90| 20 68 6f 73 74 6e 61 6d | 65 5b 4d 41 58 48 4f 53 | hostnam|e[MAXHOS|
|00003ea0| 54 4e 41 4d 45 4c 45 4e | 5d 2c 20 64 61 74 65 5b |TNAMELEN|], date[|
|00003eb0| 4d 41 58 44 41 54 45 53 | 49 5a 45 5d 3b 0a 58 20 |MAXDATES|IZE];.X |
|00003ec0| 20 20 6c 6f 6e 67 20 74 | 69 6d 65 3b 20 2f 2a 20 | long t|ime; /* |
|00003ed0| 6e 6f 20 73 65 65 2e 20 | 2a 2f 0a 58 20 20 20 0a |no see. |*/.X .|
|00003ee0| 58 20 20 20 69 6e 74 20 | 70 69 64 3b 0a 58 20 20 |X int |pid;.X |
|00003ef0| 20 73 74 72 75 63 74 20 | 74 69 6d 65 76 61 6c 20 | struct |timeval |
|00003f00| 74 76 3b 0a 58 20 20 20 | 73 74 72 75 63 74 20 74 |tv;.X |struct t|
|00003f10| 69 6d 65 7a 6f 6e 65 20 | 74 7a 3b 0a 58 0a 58 20 |imezone |tz;.X.X |
|00003f20| 20 20 69 66 20 28 67 65 | 74 68 6f 73 74 6e 61 6d | if (ge|thostnam|
|00003f30| 65 28 68 6f 73 74 6e 61 | 6d 65 2c 20 4d 41 58 48 |e(hostna|me, MAXH|
|00003f40| 4f 53 54 4e 41 4d 45 4c | 45 4e 29 29 20 0a 58 20 |OSTNAMEL|EN)) .X |
|00003f50| 20 20 20 20 20 6d 79 5f | 65 72 72 6f 72 28 22 6d | my_|error("m|
|00003f60| 61 6b 65 5f 66 69 6c 65 | 6e 61 6d 65 28 29 3a 20 |ake_file|name(): |
|00003f70| 48 61 64 20 74 72 6f 75 | 62 6c 65 20 67 65 74 74 |Had trou|ble gett|
|00003f80| 69 6e 67 20 68 6f 73 74 | 6e 61 6d 65 3b 22 2c 20 |ing host|name;", |
|00003f90| 22 22 29 3b 0a 58 20 20 | 20 0a 58 0a 58 20 20 20 |"");.X | .X.X |
|00003fa0| 70 69 64 3d 67 65 74 70 | 69 64 28 29 3b 20 20 2f |pid=getp|id(); /|
|00003fb0| 2a 20 47 65 74 20 74 68 | 65 20 70 72 6f 63 65 73 |* Get th|e proces|
|00003fc0| 73 20 69 64 2e 20 2a 2f | 0a 58 20 20 20 0a 58 20 |s id. */|.X .X |
|00003fd0| 20 20 74 69 6d 65 3d 67 | 65 74 74 69 6d 65 6f 66 | time=g|ettimeof|
|00003fe0| 64 61 79 28 26 74 76 2c | 20 26 74 7a 29 3b 20 20 |day(&tv,| &tz); |
|00003ff0| 2f 2a 20 47 65 74 20 74 | 68 65 20 6e 75 6d 62 65 |/* Get t|he numbe|
|00004000| 72 20 6f 66 20 73 65 63 | 6f 6e 64 73 20 73 69 6e |r of sec|onds sin|
|00004010| 63 65 0a 58 20 20 20 20 | 20 20 20 20 20 20 20 20 |ce.X | |
|00004020| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004030| 20 20 20 20 20 20 20 20 | 74 68 61 74 20 75 6e 66 | |that unf|
|00004040| 6f 72 67 65 74 74 61 62 | 6c 65 20 4e 65 77 20 59 |orgettab|le New Y|
|00004050| 65 61 72 27 73 20 70 61 | 72 74 79 20 2a 2f 0a 58 |ear's pa|rty */.X|
|00004060| 20 20 20 69 66 20 28 74 | 69 6d 65 20 3d 3d 20 2d | if (t|ime == -|
|00004070| 31 29 20 74 76 2e 74 76 | 5f 73 65 63 3d 72 61 6e |1) tv.tv|_sec=ran|
|00004080| 64 28 29 3b 20 20 20 2f | 2a 20 53 75 72 65 20 74 |d(); /|* Sure t|
|00004090| 68 69 73 20 69 73 6e 27 | 74 20 65 72 72 6f 72 2d |his isn'|t error-|
|000040a0| 70 72 6f 6f 66 2e 2e 2e | 20 2a 2f 0a 58 20 20 20 |proof...| */.X |
|000040b0| 73 74 72 6e 63 70 79 28 | 64 61 74 65 2c 20 63 74 |strncpy(|date, ct|
|000040c0| 69 6d 65 28 26 28 74 76 | 2e 74 76 5f 73 65 63 29 |ime(&(tv|.tv_sec)|
|000040d0| 29 2b 34 2c 20 32 30 29 | 3b 20 2f 2a 20 2b 34 20 |)+4, 20)|; /* +4 |
|000040e0| 74 6f 20 61 76 6f 69 64 | 20 64 61 79 20 6f 66 20 |to avoid| day of |
|000040f0| 74 68 65 20 77 65 65 6b | 2e 20 2a 2f 0a 58 20 20 |the week|. */.X |
|00004100| 20 64 61 74 65 5b 32 30 | 5d 3d 4e 55 4c 4c 3b 20 | date[20|]=NULL; |
|00004110| 73 70 61 63 65 5f 74 6f | 5f 5f 28 64 61 74 65 29 |space_to|__(date)|
|00004120| 3b 20 2f 2a 20 43 68 61 | 6e 67 65 20 73 70 61 63 |; /* Cha|nge spac|
|00004130| 65 73 20 74 6f 20 5f 2e | 20 2a 2f 0a 58 0a 58 20 |es to _.| */.X.X |
|00004140| 20 20 73 70 72 69 6e 74 | 66 28 71 5f 66 69 6c 65 | sprint|f(q_file|
|00004150| 6e 61 6d 65 2c 20 22 71 | 5f 25 73 5f 25 73 5f 25 |name, "q|_%s_%s_%|
|00004160| 73 5f 25 64 22 2c 20 6c | 6f 67 69 6e 6e 61 6d 65 |s_%d", l|oginname|
|00004170| 2c 20 64 61 74 65 2c 20 | 68 6f 73 74 6e 61 6d 65 |, date, |hostname|
|00004180| 2c 20 70 69 64 29 3b 0a | 58 20 20 20 20 20 20 2f |, pid);.|X /|
|00004190| 2a 20 4a 75 73 74 20 74 | 72 79 69 6e 67 20 74 6f |* Just t|rying to|
|000041a0| 20 6d 61 6b 65 20 61 20 | 75 6e 69 71 75 65 20 66 | make a |unique f|
|000041b0| 69 6c 65 6e 61 6d 65 2e | 20 2a 2f 0a 58 7d 0a 58 |ilename.| */.X}.X|
|000041c0| 0a 58 73 70 61 63 65 5f | 74 6f 5f 5f 28 73 74 72 |.Xspace_|to__(str|
|000041d0| 69 6e 67 29 0a 58 63 68 | 61 72 20 2a 73 74 72 69 |ing).Xch|ar *stri|
|000041e0| 6e 67 3b 0a 58 7b 20 20 | 72 65 67 69 73 74 65 72 |ng;.X{ |register|
|000041f0| 20 63 68 61 72 20 2a 70 | 3b 0a 58 0a 58 20 20 20 | char *p|;.X.X |
|00004200| 66 6f 72 20 28 70 3d 73 | 74 72 69 6e 67 3b 20 2a |for (p=s|tring; *|
|00004210| 70 3b 20 70 2b 2b 29 0a | 58 20 20 20 20 20 20 69 |p; p++).|X i|
|00004220| 66 20 28 2a 70 3d 3d 27 | 20 27 29 20 2a 70 3d 27 |f (*p=='| ') *p='|
|00004230| 5f 27 3b 0a 58 7d 0a 58 | 0a 58 0a 58 0a 58 2f 2a |_';.X}.X|.X.X.X/*|
|00004240| 2a 20 54 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |* The fo|llowing |
|00004250| 66 75 6e 63 74 69 6f 6e | 20 73 61 79 73 20 67 6f |function| says go|
|00004260| 6f 64 62 79 65 20 61 6e | 64 20 61 64 76 65 72 74 |odbye an|d advert|
|00004270| 69 73 65 73 0a 58 20 2a | 2a 20 74 68 65 20 70 72 |ises.X *|* the pr|
|00004280| 6f 67 72 61 6d 2e 20 2a | 2f 0a 58 66 61 72 65 77 |ogram. *|/.Xfarew|
|00004290| 65 6c 6c 28 29 0a 58 7b | 0a 58 20 20 20 70 75 74 |ell().X{|.X put|
|000042a0| 73 28 22 5c 6e 59 6f 75 | 72 20 61 6e 73 77 65 72 |s("\nYou|r answer|
|000042b0| 20 28 61 6e 64 20 79 6f | 75 72 20 62 69 6c 6c 29 | (and yo|ur bill)|
|000042c0| 20 77 69 6c 6c 20 62 65 | 20 6d 61 69 6c 65 64 20 | will be| mailed |
|000042d0| 74 6f 20 79 6f 75 20 73 | 68 6f 72 74 6c 79 2e 22 |to you s|hortly."|
|000042e0| 29 3b 0a 58 20 20 20 70 | 75 74 73 28 22 54 65 6c |);.X p|uts("Tel|
|000042f0| 6c 20 61 6c 6c 20 79 6f | 75 72 20 66 72 69 65 6e |l all yo|ur frien|
|00004300| 64 73 20 74 6f 20 41 73 | 6b 20 74 68 65 20 4f 72 |ds to As|k the Or|
|00004310| 61 63 6c 65 21 22 29 3b | 0a 58 7d 0a 58 0a 58 0a |acle!");|.X}.X.X.|
|00004320| 58 6d 79 5f 65 72 72 6f | 72 28 6d 65 73 73 31 2c |Xmy_erro|r(mess1,|
|00004330| 20 6d 65 73 73 32 29 0a | 58 63 68 61 72 20 2a 6d | mess2).|Xchar *m|
|00004340| 65 73 73 31 2c 20 2a 6d | 65 73 73 32 3b 0a 58 7b |ess1, *m|ess2;.X{|
|00004350| 20 20 70 72 69 6e 74 66 | 28 22 25 73 25 73 5c 6e | printf|("%s%s\n|
|00004360| 22 2c 20 6d 65 73 73 31 | 2c 20 6d 65 73 73 32 29 |", mess1|, mess2)|
|00004370| 3b 0a 58 0a 58 23 69 66 | 64 65 66 20 44 45 42 55 |;.X.X#if|def DEBU|
|00004380| 47 0a 58 20 20 20 70 72 | 69 6e 74 66 28 22 65 72 |G.X pr|intf("er|
|00004390| 72 6e 6f 3a 20 25 64 5c | 6e 22 2c 20 65 72 72 6e |rno: %d\|n", errn|
|000043a0| 6f 29 3b 0a 58 23 65 6e | 64 69 66 0a 58 0a 58 2f |o);.X#en|dif.X.X/|
|000043b0| 2a 20 70 72 69 6e 74 66 | 28 22 45 41 43 43 45 53 |* printf|("EACCES|
|000043c0| 20 25 64 20 20 45 42 41 | 44 46 20 25 64 20 20 45 | %d EBA|DF %d E|
|000043d0| 41 47 41 49 4e 20 25 64 | 20 20 45 49 4e 54 52 20 |AGAIN %d| EINTR |
|000043e0| 25 64 20 20 45 4e 4f 4c | 43 4b 20 25 64 5c 6e 22 |%d ENOL|CK %d\n"|
|000043f0| 2c 2f 2a 2a 64 65 6c 65 | 74 65 6d 65 2a 2f 0a 58 |,/**dele|teme*/.X|
|00004400| 2f 2a 20 20 20 20 45 41 | 43 43 45 53 2c 20 45 42 |/* EA|CCES, EB|
|00004410| 41 44 46 2c 20 45 41 47 | 41 49 4e 2c 20 45 49 4e |ADF, EAG|AIN, EIN|
|00004420| 54 52 2c 20 45 4e 4f 4c | 43 4b 29 3b 2f 2a 2a 64 |TR, ENOL|CK);/**d|
|00004430| 65 6c 65 74 65 6d 65 2a | 2f 0a 58 20 20 20 70 65 |eleteme*|/.X pe|
|00004440| 72 72 6f 72 28 70 72 6f | 67 6e 61 6d 65 29 3b 0a |rror(pro|gname);.|
|00004450| 58 20 20 20 65 78 69 74 | 28 31 29 3b 0a 58 7d 0a |X exit|(1);.X}.|
|00004460| 58 0a 58 0a 58 67 65 74 | 5f 72 65 74 75 72 6e 28 |X.X.Xget|_return(|
|00004470| 70 72 6f 6d 70 74 29 0a | 58 63 68 61 72 20 2a 70 |prompt).|Xchar *p|
|00004480| 72 6f 6d 70 74 3b 0a 58 | 7b 20 20 66 70 75 74 73 |rompt;.X|{ fputs|
|00004490| 28 70 72 6f 6d 70 74 2c | 20 73 74 64 6f 75 74 29 |(prompt,| stdout)|
|000044a0| 3b 0a 58 20 20 20 77 68 | 69 6c 65 20 28 67 65 74 |;.X wh|ile (get|
|000044b0| 63 68 61 72 28 29 21 3d | 27 5c 6e 27 29 3b 0a 58 |char()!=|'\n');.X|
|000044c0| 7d 0a 58 0a 53 48 41 52 | 5f 45 4f 46 0a 66 69 20 |}.X.SHAR|_EOF.fi |
|000044d0| 23 20 65 6e 64 20 6f 66 | 20 6f 76 65 72 77 72 69 |# end of| overwri|
|000044e0| 74 69 6e 67 20 63 68 65 | 63 6b 0a 69 66 20 74 65 |ting che|ck.if te|
|000044f0| 73 74 20 2d 66 20 27 4d | 61 6b 65 66 69 6c 65 27 |st -f 'M|akefile'|
|00004500| 0a 74 68 65 6e 0a 09 65 | 63 68 6f 20 73 68 61 72 |.then..e|cho shar|
|00004510| 3a 20 77 69 6c 6c 20 6e | 6f 74 20 6f 76 65 72 2d |: will n|ot over-|
|00004520| 77 72 69 74 65 20 65 78 | 69 73 74 69 6e 67 20 66 |write ex|isting f|
|00004530| 69 6c 65 20 22 27 4d 61 | 6b 65 66 69 6c 65 27 22 |ile "'Ma|kefile'"|
|00004540| 0a 65 6c 73 65 0a 73 65 | 64 20 27 73 2f 5e 58 2f |.else.se|d 's/^X/|
|00004550| 2f 27 20 3c 3c 20 5c 53 | 48 41 52 5f 45 4f 46 20 |/' << \S|HAR_EOF |
|00004560| 3e 20 27 4d 61 6b 65 66 | 69 6c 65 27 0a 58 23 20 |> 'Makef|ile'.X# |
|00004570| 4d 61 6b 65 66 69 6c 65 | 20 66 6f 72 20 6f 72 61 |Makefile| for ora|
|00004580| 63 6c 65 0a 58 0a 58 23 | 20 54 6f 20 6d 61 6b 65 |cle.X.X#| To make|
|00004590| 20 74 68 69 73 20 70 72 | 6f 67 72 61 6d 2c 20 66 | this pr|ogram, f|
|000045a0| 69 72 73 74 20 73 65 74 | 20 54 41 52 47 45 54 44 |irst set| TARGETD|
|000045b0| 49 52 20 74 6f 20 73 6f | 6d 65 74 68 69 6e 67 20 |IR to so|mething |
|000045c0| 61 70 70 72 6f 70 72 69 | 61 74 65 2e 0a 58 23 20 |appropri|ate..X# |
|000045d0| 59 6f 75 20 6d 61 79 20 | 77 61 6e 74 20 74 6f 20 |You may |want to |
|000045e0| 63 68 61 6e 67 65 20 4c | 49 42 44 49 52 20 61 6e |change L|IBDIR an|
|000045f0| 64 20 43 46 4c 41 47 53 | 20 61 73 20 77 65 6c 6c |d CFLAGS| as well|
|00004600| 2e 0a 58 23 20 54 68 65 | 6e 20 27 6d 61 6b 65 20 |..X# The|n 'make |
|00004610| 61 6c 6c 27 2e 0a 58 0a | 58 54 41 52 47 45 54 44 |all'..X.|XTARGETD|
|00004620| 49 52 20 3d 20 2f 6d 75 | 2f 68 75 74 74 61 72 2f |IR = /mu|/huttar/|
|00004630| 6f 72 61 63 6c 65 0a 58 | 4c 49 42 44 49 52 20 3d |oracle.X|LIBDIR =|
|00004640| 20 24 7b 54 41 52 47 45 | 54 44 49 52 7d 2f 6f 72 | ${TARGE|TDIR}/or|
|00004650| 61 63 6c 65 6c 69 62 0a | 58 43 46 4c 41 47 53 20 |aclelib.|XCFLAGS |
|00004660| 3d 20 2d 44 4c 4f 47 20 | 2d 44 4f 52 41 43 4c 45 |= -DLOG |-DORACLE|
|00004670| 44 49 52 3d 5c 22 24 7b | 4c 49 42 44 49 52 7d 5c |DIR=\"${|LIBDIR}\|
|00004680| 22 0a 58 23 20 2d 44 44 | 45 42 55 47 20 61 6e 64 |".X# -DD|EBUG and|
|00004690| 20 2d 44 4c 4f 47 20 61 | 72 65 20 6f 70 74 69 6f | -DLOG a|re optio|
|000046a0| 6e 61 6c 2e 0a 58 23 20 | 2d 44 44 45 42 55 47 20 |nal..X# |-DDEBUG |
|000046b0| 63 61 75 73 65 73 20 65 | 78 74 72 61 20 64 69 61 |causes e|xtra dia|
|000046c0| 67 6e 6f 73 74 69 63 73 | 20 74 6f 20 62 65 20 72 |gnostics| to be r|
|000046d0| 75 6e 2c 20 61 6e 64 0a | 58 23 20 2d 44 4c 4f 47 |un, and.|X# -DLOG|
|000046e0| 20 63 61 75 73 65 73 20 | 6f 6c 64 20 66 69 6c 65 | causes |old file|
|000046f0| 73 20 74 6f 20 62 65 20 | 6c 65 66 74 20 61 72 6f |s to be |left aro|
|00004700| 75 6e 64 2e 0a 58 0a 58 | 0a 58 61 6c 6c 3a 20 24 |und..X.X|.Xall: $|
|00004710| 7b 54 41 52 47 45 54 44 | 49 52 7d 2f 6f 72 61 63 |{TARGETD|IR}/orac|
|00004720| 6c 65 20 24 7b 4c 49 42 | 44 49 52 7d 0a 58 0a 58 |le ${LIB|DIR}.X.X|
|00004730| 0a 58 24 7b 54 41 52 47 | 45 54 44 49 52 7d 2f 6f |.X${TARG|ETDIR}/o|
|00004740| 72 61 63 6c 65 20 3a 20 | 6f 72 61 63 6c 65 2e 63 |racle : |oracle.c|
|00004750| 0a 58 09 63 63 20 2d 6f | 20 24 7b 54 41 52 47 45 |.X.cc -o| ${TARGE|
|00004760| 54 44 49 52 7d 2f 6f 72 | 61 63 6c 65 20 24 7b 43 |TDIR}/or|acle ${C|
|00004770| 46 4c 41 47 53 7d 20 6f | 72 61 63 6c 65 2e 63 0a |FLAGS} o|racle.c.|
|00004780| 58 09 63 68 6d 6f 64 20 | 75 2b 73 20 24 7b 54 41 |X.chmod |u+s ${TA|
|00004790| 52 47 45 54 44 49 52 7d | 2f 6f 72 61 63 6c 65 0a |RGETDIR}|/oracle.|
|000047a0| 58 0a 58 24 7b 4c 49 42 | 44 49 52 7d 20 3a 0a 58 |X.X${LIB|DIR} :.X|
|000047b0| 09 6d 6b 64 69 72 20 24 | 7b 4c 49 42 44 49 52 7d |.mkdir $|{LIBDIR}|
|000047c0| 0a 58 0a 53 48 41 52 5f | 45 4f 46 0a 66 69 20 23 |.X.SHAR_|EOF.fi #|
|000047d0| 20 65 6e 64 20 6f 66 20 | 6f 76 65 72 77 72 69 74 | end of |overwrit|
|000047e0| 69 6e 67 20 63 68 65 63 | 6b 0a 23 09 45 6e 64 20 |ing chec|k.#.End |
|000047f0| 6f 66 20 73 68 65 6c 6c | 20 61 72 63 68 69 76 65 |of shell| archive|
|00004800| 0a 65 78 69 74 20 30 0a | 2d 2d 20 0a 4c 61 72 73 |.exit 0.|-- .Lars|
|00004810| 20 48 75 74 74 61 72 20 | 2d 2d 2d 2d 2d 2d 2d 2d | Huttar |--------|
|00004820| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004830| 2d 2d 2d 2d 20 72 68 79 | 6d 65 73 20 65 78 61 63 |---- rhy|mes exac|
|00004840| 74 6c 79 20 77 69 74 68 | 20 22 73 70 61 72 73 65 |tly with| "sparse|
|00004850| 20 62 75 74 74 65 72 22 | 0a 68 75 74 74 61 72 40 | butter"|.huttar@|
|00004860| 73 76 61 78 2e 63 73 2e | 63 6f 72 6e 65 6c 6c 2e |svax.cs.|cornell.|
|00004870| 65 64 75 20 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 20 54 |edu ----|------ T|
|00004880| 68 65 20 6f 70 69 6e 69 | 6f 6e 73 20 61 6e 64 20 |he opini|ons and |
|00004890| 64 65 63 69 73 69 6f 6e | 73 20 61 72 65 20 6d 79 |decision|s are my|
|000048a0| 20 6f 77 6e 2e 0a 41 66 | 74 65 72 20 41 75 67 20 | own..Af|ter Aug |
|000048b0| 31 35 3a 20 68 75 74 74 | 61 72 40 6f 63 63 73 2e |15: hutt|ar@occs.|
|000048c0| 6f 62 65 72 6c 69 6e 2e | 65 64 75 20 6f 72 20 73 |oberlin.|edu or s|
|000048d0| 6c 68 36 35 35 39 40 6f | 62 65 72 6c 69 6e 2e 62 |lh6559@o|berlin.b|
|000048e0| 69 74 6e 65 74 20 2d 2d | 20 76 69 20 72 75 6c 65 |itnet --| vi rule|
|000048f0| 73 21 0a 59 6f 75 20 63 | 61 6e 20 74 61 6c 6b 20 |s!.You c|an talk |
|00004900| 74 68 65 20 74 61 6c 6b | 2c 20 62 75 74 20 63 61 |the talk|, but ca|
|00004910| 6e 20 79 6f 75 20 77 61 | 6c 6b 20 74 68 65 20 64 |n you wa|lk the d|
|00004920| 6f 67 3f 0a 0a 0a | |og?... | |
+--------+-------------------------+-------------------------+--------+--------+