This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: xterm is a console program?


Howbout making a lib that has the entry points that the console apps are
calling, like printf, that redirects the output to an X term window if there
is one present?

Apps would need to be relinked against this lib, but then at least you could
redirect output wherever you want.


-----Original Message-----
From: cygwin-xfree-owner@cygwin.com [mailto:cygwin-xfree-owner@cygwin.com]On
Behalf Of Harold L Hunt II
Sent: Thursday, May 15, 2003 12:22 PM
To: cygwin-xfree@cygwin.com
Subject: Re: xterm is a console program?

> Harold,
>
> Note that nothing prevents non-console programs from calling
> AllocateConsole which would use a console if one is available, or create a
> new one.  However, AFAIU, *all* Cygwin apps are non-console apps!  They
> will call AllocateConsole if necessary, but they would rather use the pty
> if available.
>       Igor

Igor,

Ah, but if you link with -mwindows you don't get connected to the
current console.  When you call AllocConsole you create a new console,
which pops up a new command prompt window, which is precisely what we
are trying to avoid.  I remember reading somewhere (didn't look for it
again) that there is no way for a Windows app to attach to the console
that it was launched from.  I spent quite a bit of time researching
AllocConsole and other functions when I began using -mwindows for
XWin.exe.  Every option I explored turned up not to be quite what we
wanted and I read several articles (some might have been on MSDN, some
were other places) that said it simply wasn't possible to do something
like you are suggesting.  Have you demonstration code that implements
what you are suggesting?  I wrote some demo code at the time that
convinced me that what I was reading was correct.  However, if you have
demo code that proves otherwise, I will certainly believe you :)

Additionally, we would have to modify the source code for each of the
console apps in the XFree86 tree, adding Cygwin-specific code that would
create a new console for them.  The goal here is to achieve this with
Imakefile settings, rather than having to maintain code in each of the
console apps.

Harold


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]