From: Radical NetSurfer Newsgroups: comp.os.msdos.djgpp Subject: Re: cprinf REdirected Date: Tue, 18 Jul 2000 17:18:27 -0400 Message-ID: References: <9bf6nsseur50auc08a2u1pb61in2oum79j AT 4ax DOT com> <8kvfom$n6l$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> X-Newsreader: Forte Agent 1.8/32.548 X-No-Archive: yes MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 216.202.134.143 X-Original-NNTP-Posting-Host: 216.202.134.143 X-Trace: 18 Jul 2000 17:21:06 -0400, 216.202.134.143 Lines: 51 X-Original-NNTP-Posting-Host: 64.31.79.51 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com |> First of all, (trust me here): |> cprintf CAN BE re-directed; _IF_ properly implemented! | Says who? Who defines 'proper' implementation of cprintf()? As one small example, VBDOS 1.0 allows cprintf to be redirected: colored text if no re-dir; normal ASCII chars to wherever re-dired. |> DOES ANYONE understand what the DJGPP DOC's are trying to say about |> this issue? | The ones I looked at say nothing about that cprintf() might ever | produce redirectable output. Could you please tell us what docs you're | talking about? Or quote a the relevant bits? What I did was search the GCC and LIBC docs for ANY/ALL references to "redirection", "cprintf", and related such topics. I definately received the impression that what I'd like to see happen CAN BE implemented if one knew enough about the internal workings of DJGPP. | AFAICS, the only way to get redirectable output is by not using | cprintf(), if stdout is not pointing to the screen. I.e. instead of | calling cprintf(), you'ld have to call a routine dprintf() that | roughly does this: | | i (! isatty(fileno(stdin))) | printf(...); | else | cprintf(...); | I shall try this approach. One thing we know will be essential is to have a single function call; its okay if we define it ourselves (got that impression from the DOCs mentions above anyhways). What I think the DOCs were gettting at, might of been in "internal" system (DJGPP) reference to isatty perhaps.... /* stdout == console -> cprintf else -> printf */ int smartcprintf(fg, bg, char*); | -- | Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) | Even if all the snow were burnt, ashes would remain. PS:(At the risk of being off topic) If anyone should happen to know how to write a little MS-Windows 3.1 'C' style Code... you're help is also needed. Thanks.