home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume7
/
oracle
/
Notes
< prev
next >
Wrap
Text File
|
1989-08-05
|
3KB
|
77 lines
Lib directory:
ORACLEDIR (defined in Makefile) is a
question directory with one file per question.
Filename is q_username_time_hostname_processid for each file.
One file is called "record" and contains the directory listing.
The command system("ls -rt q_* > record") fills this file.
Another file is "lockfile", whose existence means an oracle process is
using the directory to the exclusion of others.
Process when somebody runs *oracle*:
A. Say "Please type in your question." Save question in a file in
question directory, with x_ prefix.
B. Lock questions directory.
Update "record" file.
Get least recent question file -- that is the first file listed
in "record" -- which did not come from the current user.
Move that file to t_blahblahblah. (t for temp)
Unlock directory.
C. Print the question and get answer from user.
Save to file a_blahblahblah. Mail to original
questioner -- system("mail user < a_blablabla").
Move the x_ file (created in A) to q_whatever.
Remove the t_ and a_ files -- unless the LOG flag is #defined
in which case the a_ files are left around.
D. Tell user the answer will reach them in a short while. Ask user
to encourage friends to Ask The Oracle.
Prefix summary:
q_ A question file that has been stored by a previous oracle, or
is created from the current user's question just before current
oracle terminates.
t_ A question file from a different user that has been selected
to be shown to and answered by the current user.
x_ Temporary file to which the question of the current user is written
as it is being typed. Gets moved to q_ if everything goes smoothly.
a_ Answer file, exactly as the final answer message will be sent
to the Other User whose question was selected. So it contains
introductory remarks, a copy of the Other User's question,
and the answer given by the current user. This answer is written
line-by-line as the user types it in.
Permissions:
All files will be readable and writable only by the owner.
The *oracle* program will have the setuid bit set, so that
users will "become" the owner while the program is running.
In order to have mail messages appear to be from the owner of oracle,
the real uid of the process is set to the effective uid just before
mailing occurs.
Accessing the directory:
Attempt to cd there before anything starts. If we fail, quit.
Log:
If a certain flag LOG is #defined, q_ and a_ files will
be left undeleted in the oracle directory.
To do:
After the question is entered, the oracle should have the person
confirm, "Do you still want to send this question to the oracle?"
If DEBUG is defined, check upon startup (a) whether the file
argv[0] has the setuid bit set, and (b) whether it has worked (on some
filesystems it may be ignored for security reasons).
Enter cbreak mode so that if the user tries ^C, the program can
exit gracefully, restoring any q_file it might have moved to t_, and
removing any created files that are to be abandoned (including lockfile,
x_whatever, and a_whatever).
Allow a file to be specified as a command-line argument, that oracle
will read the question from.