manipulate fd underlying stream

N

Nick Keighley

On Fri, 30 Jul 2010 21:20:03 -0400, Eric Sosman


I think of a dominant implementation as a virtual interface.

dup, dup2

These POSIX functions are deprecated beginning in Visual C++ 2005.
 
N

Nobody

So, they concocoted this "What's in the standard and only what's in the
standard" nonsense and made a pact to stand by it. Part of that pact
was that they had to pretend not to understand or know anything about
the Unix-y stuff (or any other so-called "system specific" stuff). That
was the price paid to ward off the evils of "lpParm".

OTOH, you have to draw the line somewhere. Otherwise, people would
consider any and every library which is callable from C to be on-topic.
Given that most libraries are callable from C (or C++, which many people
think is a version of C), CLC would turn into comp.programming.

And to make matters worse, kids these days expect instant gratification.
If their question isn't covered in the first three pages of "Learn
<whatever> in Five Minutes", they'll post here. And then a stream of
follow-ups when their question isn't answered within 30 seconds.
 
J

John Kelly

dup, dup2
These POSIX functions are deprecated beginning in Visual C++ 2005.

I meant linux as a dominant implementation. I don't need MS Visual C++.
MS provides SFU/SUA POSIX on Windows to lure away UNIX users, but it's a
two way street.
 
J

John Kelly

OTOH, you have to draw the line somewhere. Otherwise, people would
consider any and every library which is callable from C to be on-topic.

If it's written in C why not.
 
K

Kenny McCormack

If it's written in C why not.

(In case it isn't clear, I totally agree with you)

(But) It boils down to what (at least my perception of) what Geodel showed.

A newsgroup can be either complete or it can be interesting. It can't
be both. The regs here have opted for the former (at the cost of the later).

(To amplify: They have opted for a system where every question can be
answered [because if the question isn't answered by the C Standard
document, then it is, by definition, off-topic]. The result is that the
set of allowable questions is uniformly dull. But the system is
complete, and that's what counts [to them])
 
E

Eric Sosman

I'm not sure to what extent Mr. Sosman seeks to edify and
to what extent he seeks to amuse, but I don't think I'm alone
in saying that programming for a non-Unix system has no
conceivable purpose in the ivory tower. Non-Unix programmers have
some other purpose: avarice for filthy lucre, writing viruses,
etc.

In a newsgroup on restaurants we wouldn't be condemned if we
assumed OP is not some villain serving rat poison to customers.
Why then, in a C programming forum, do we ask why OP isn't some
sado-masochist programming a system without open() and close()?

Well, the O.P. took issue with the C language FAQ, exhibiting
a counter-example to the FAQ's "There isn't a good way." Since
it's a FAQ about the C language, not about implementations of C
in Unix/Windows/VMS/MVS/automobiles/toasters, I think it entirely
reasonable to read "good" as subsuming "portable."

Besides, the FAQ *already* describes the O.P.'s counter-exemplary
technique, prefacing it with "It may be possible, in a nonportable
way, ..." *and* giving source code. So the O.P. is not only parochial
but also an inattentive reader, and (IMHO) deserving of a ration of
mild mockery.
 
J

John Kelly

Besides, the FAQ *already* describes the O.P.'s counter-exemplary
technique, prefacing it with "It may be possible, in a nonportable
way, ..." *and* giving source code. So the O.P. is not only parochial
but also an inattentive reader, and (IMHO) deserving of a ration of
mild mockery.

You're right I missed that. Thanks for pointing it out.
 
S

Seebs

If it's written in C why not.

Because if everything can be on every possible topic, topics become
meaningless and we can't find discussions that interest us anymore.

-s
 
N

Nick Keighley

On Sat, 31 Jul 2010 08:51:26 -0700 (PDT), Nick Keighle

that was a direct quote from MSDN, which I didn't make clear
I meant linux as a dominant implementation.

perhaps I didn't make my point clearly enough. *Is* Linux a dominant
implementation? I think this is far from indiputable.
 
N

Nobody

If it's written in C why not.

There's a reason that usenet is split into multiple groups with
distinct topics. If you just have one big group, no-one will bother
to follow the group, as 99% of questions will be about topics which don't
interest them and about which they have no knowledge.

Given that you need to divide usenet into groups, a question about using
library X from language Y has more to do with the library than the
language (e.g. a question about OpenGL will have roughly the same answer
whether you're using it from C or Python). In which case, it makes more
sense to differentiate based upon the library than on the language (that,
and the fact that libraries are more numerous than languages).

Having said that, I don't take the view that using anything outside of the
standard library makes a question off-topic, so long as the question has
some non-trivial connection to C. E.g. how you structure data and code is
heavily influenced by the language you're using, so I don't consider it
unreasonable to ask "design" questions here if you're writing in C.
 
K

Kenny McCormack

Nobody said:
Having said that, I don't take the view that using anything outside of the
standard library makes a question off-topic, ...

The regs do.
E.g. how you structure data and code is heavily influenced by the
language you're using, so I don't consider it unreasonable to ask
"design" questions here if you're writing in C.

The regs do.

Note that allowing "design" (or, equivalently, "algorithm") questions in
would break the "completeness" property.

--
(This discussion group is about C, ...)

Wrong. It is only OCCASIONALLY a discussion group
about C; mostly, like most "discussion" groups, it is
off-topic Rorsharch [sic] revelations of the childhood
traumas of the participants...
 
J

John Kelly

For Windows XP:

However, ignore their advice about compiling gmake 3.81. It flops.
Just use the gmake package installed by the next step.

c) add complete toolset from sua community site
http://www.suacommunity.com/SUA.aspx
ftp://ftp.interopsystems.com/pkgs/bundles/pkg-current-bundlecomplete35.exe

Looks POSIXy to me ...

I've been using it for a couple of days now. It has gcc 3.3 and 4.2,
perl, etc.; good enough for some "UNIX" testing and development on a
Windows host. It also includes midnight commander, a tool I'm helpless
without.

With some minor source code changes, I got the daemon helper running on
it.

Of course if you have Windows 7 you get more recent tools with SUA, as
opposed to the outdated SFU for XP. So if you're on Windows 7, do not
follow these instructions. Instead, start at the community site and go
from there:

http://www.suacommunity.com/SUA.aspx
 
K

Kenny McCormack

However, ignore their advice about compiling gmake 3.81. It flops.
Just use the gmake package installed by the next step.

I have to ask: Why bother with this?

Note: Any day now, one of the regs is going to notice this thread and
make the usual snarky notes about:

Off topic. Not portable. Cant discuss it here. Blah, blah, blah.

And then it will all be over.

But, that aside, I have to ask: Why bother with this? And by that I
mean:
1) If you want to run Linux on a PC, then, gee, get Linux and install
it on your PC and - bang! - you're running Linux on your PC.
2) If your goal is to compile Unix-y tools from source into Windows
executables, then get Cygwin. It works (very well, in fact) and
I'm sure it beats the pants off all these other "Linux on
Windows" products. I mean, seriously, does anyone really expect
Microsoft to get this right???

--
(This discussion group is about C, ...)

Wrong. It is only OCCASIONALLY a discussion group
about C; mostly, like most "discussion" groups, it is
off-topic Rorsharch [sic] revelations of the childhood
traumas of the participants...
 
J

John Kelly

I have to ask: Why bother with this?

Note: Any day now, one of the regs is going to notice this thread and
make the usual snarky notes about:

Off topic. Not portable. Cant discuss it here. Blah, blah, blah.

And then it will all be over.

But, that aside, I have to ask: Why bother with this? And by that I
mean:
1) If you want to run Linux on a PC, then, gee, get Linux and install
it on your PC and - bang! - you're running Linux on your PC.
2) If your goal is to compile Unix-y tools from source into Windows
executables, then get Cygwin. It works (very well, in fact) and
I'm sure it beats the pants off all these other "Linux on
Windows" products.


ATM, I don't want to compile Unix-y source into Windows executables. I
want a subsystem that emulates POSIX on my Windows workstation so I can
compile Linux source without rebooting or running VMWare.

And, it provides a command line environment where you can access your
Windows filesystem, using all the Unix-y tools like sed, awk, perl, etc.
The community bundle includes OpenSSH, so I connect to localhost with
PuTTY. The Midnight Commander xterm terminal emulation works well that
way, through the PuTTY xterm.

I mean, seriously, does anyone really expect Microsoft to get this right???

It's not perfect, but it emulates Linux/POSIX well enough to compile the
daemon helper and run it. That's not bad.
 
K

Kenny McCormack

John Kelly said:
ATM, I don't want to compile Unix-y source into Windows executables. I
want a subsystem that emulates POSIX on my Windows workstation so I can
compile Linux source without rebooting or running VMWare.

I still have to ask then: Why not Cygwin? Isn't that a lot easier to
setup and use than all this stuff?

Note: I could be wrong - it could be either better or easier than Cygwin
(or both) - but I have used Cygwin a lot over the years and have found
it to be pretty damn complete.
 
J

John Kelly

I still have to ask then: Why not Cygwin? Isn't that a lot easier to
setup and use than all this stuff?

Note: I could be wrong - it could be either better or easier than Cygwin
(or both) - but I have used Cygwin a lot over the years and have found
it to be pretty damn complete.


It's a question of apples and oranges.

http://www.cygwin.com/ says:
Cygwin is not a way to magically make native Windows apps aware of UNIX
® functionality, like signals, ptys, etc.


Cygwin emulates UNIX compatibility with Win32 calls, because Cygwin runs
atop the Win32 subsystem.

SFU/SUA is an independent subsystem, running directly on the Windows
kernel, concurrently with the Win32 subsystem.

The independent SFU/SUA subsystem provides a native UNIX infrastructure
of signals, ptys, pids, etc., which Cygwin does not.

That's why I could easily port the daemon helper to SFU/SUA.

So you see, one tool or the other may be preferable, depending on your
objective.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top