Setup patch: List command line options on stdout

Reini Urban rurban@x-ray.at
Wed Nov 17 19:53:00 GMT 2004


Christopher Faylor schrieb:
> On Wed, Nov 17, 2004 at 10:10:58AM +0100, Reini Urban wrote:
> 
>>Dave schrieb:
>>
>>>Here's a simple and useful patch for setup. Might reduce queries about
>>>unattended installs, and save people having to resort to source.
>>>
>>>Patch is against CVS (as of yesterday).
>>>Modify the leader text as you see fit :)
>>>
>>>------------------------------------------------------------------------
>>>
>>>--- main.cc~	2004-10-25 19:34:32.000000000 +0100
>>>+++ main.cc	2004-11-16 19:21:14.000000000 +0000
>>>@@ -471,7 +471,11 @@
>>>
>>>    if (HelpOption)
>>>    {
>>>-      GetOption::GetInstance().ParameterUsage(log(LOG_PLAIN)<<"\nCommand 
>>>Line Options:\n");
>>>+      log(LOG_PLAIN)<<"\nOutput command line options\n";
>>>+      std::cout << "setup [options]\n\n"
>>>+		<< "Cygwin setup installs and maintains cygwin packages\n\n"
>>>+		<< "Command Line options:\n";
>>>+      GetOption::GetInstance().ParameterUsage(std::cout);
>>>      theLog->exit(0);
>>>    }
>>
>>you should really check if the parent isatty.
>>nevertheless I consider this hack useful.
> 
> 
> Actually, there was a thread about this on the cygwin list not too long ago.

Yep. This suggested a complicated trick. I found an easier one.
I just detect if the console title ends with "setup.exe" 
(case-insensitive). If so it's new and can be hidden.

> Applications linked with -mwindows (i.e., GUI apps) can't print to
> stdout.  How does this actually work, in that case?  Is this expecting
> to display something on the console?

I added a patch to switch to the console subsystem and hide this concole 
if it was a fresh new console. Otherwise, if called from a console or if 
called with -h leave the console.

Patch see http://sourceware.org/bugzilla/show_bug.cgi?id=556
-- 
Force without wisdom falls of its own weight. (Horace, Odes)



More information about the Cygwin-apps mailing list