No Subject

Sun Feb 28 18:15:00 GMT 1999

However, taking a guess at how to make a cpplib based cpp, I tried making
cppmain (which appears to use cpplib) and my previous test results stand.

	nextstep3.3% echo 'FOO' | ./cppmain -DFOO=BAR
	# 1 ""

Zack continues:
> The only way I can see for this to happen is if S_IFREG is zero, in
> which case a socket will be erroneously detected as a file.  Since
> st_size would be zero, that should send the reader into an
> infinite loop.
> What is the actual value of S_IFREG?

On NEXTSTEP, S_IFREG is 0100000 (octal).
I investigated further, adding the line:

	  fprintf(stderr, "DEBUG: st.st_mode = %o\n", st.st_mode);

to finclude in cppfiles.c, and found, to my surprise, that st.mode for
the pipe was '0010666', and S_IFIFO is defined in sys/stat.h and is set
0010000, so my NEXTSTEP machine *is* setting the mode as you would expect
on a machine with FIFOs. (NEXTSTEP 3.x has some rather broken POSIX
support, including FIFO support for designated POSIX applications, so
perhaps I shouldn't have been all that surprised).

Of course, this discovery means that the man page for fstat is wrong,
but we shouldn't be surprised about that...

In his earlier message, Zack had also asked:
>>> My documentation is inconsistent - what does shutdown do when asked
>>> to disallow sends and sending is already shutdown?

... and I had replied:
>> On my NEXTSTEP machine, using AF_INET sockets, the second call succeeds
>> and appears to be harmlessly redundant.

... leading Zack to wonder:
> Was the socket in question connected to anything?

Yes.  It was connected to a TCP echo server.  (In fact, the code was
heavily based on example in Richard Steven's _Unix Network Programming,
volume 1, 2nd edition_, page 162, duplicating the call to shutdown.)

Best Regards,


More information about the Gcc-patches mailing list