Re: Programming in standard c



Eric Sosman wrote:

I repeat the question you snipped and have not yet even
begun to answer:

>> What is the appropriate action for "file locked," and how
>> does it differ from that for "privileges problem?"

For file locked it could be a temporary problem. The program waits
for a certain period and retries.

For a privileges problem you change the file name so that it doesn't
use the name of a file already owned by someone else and retry.

For instance. There are thousands of variations.

Portable
>> actions only, please: you keep talking about portable error
>> analysis, which is mere mockery without portable error response.


Wait for a certain time is impossible in standard C. (As I said,
you can't do much in standard C). But that could be a portable
action if the interface level of C wouldn't be so low.

If you like, we can now rephrase it in terms of your list:
For each error code, please explain what "appropriate action"
(your phrase) should be taken, how its action differs from the
actions taken for other codes, and how to take action portably.


You do not understand. The appropriate action depends of the program
OF COURSE. A program may react to ENOENT with changing the mode
from read into write since it was testing if the file exists.
Another it would mean

DialogBox("Configuration file doesn't exist. Create it? (YN)");

Also, do you imagine that the list you exhibit here is an
exhaustive list of failure modes for fopen()?

There is no point in discussing if I address your complaint, and then
you bring it again. I answer it AGAIN and you bring it AGAIN.

I said that there is NO EXHAUSTIVE list. BUt a list with the most
common failures! I have told you this already THREE times.

PLEASE TAKE NOTICE ok?


What code should
an implementation use if fopen() fails for lack of memory?

ENOMEM or the defined portable error code for memory
exhaustion.

What
code reports an incompatibility between the file organization and
C's sequential "stream of bytes" model (c.f. OpenVMS)?

An error code specific to OpenVMS.

What code
is appropriate for a security violation (e.g., low-privilege
program attempting to read a high-privilege file -- note that your
description of EPERM does not cover this case)?

Another, system specific code. AS I TOLD YOU BEFORE
it is NOT exhaustive!

What code should
be used if the file name references an environment variable that
has no definition? What code should be used -- ah, the hell with
it. You have not even begun to think about these problems, much
less solve them.


I said in my message: <fl0lca$jnb$1@xxxxxxxx>
<quote>
An implementation would be allowed to extend this errors but we could
portably test for a certain kind of error.
<end quote>

but you just ignore that and go on.

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
.