X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org X-YMail-OSG: IflqTRkVM1n7NyL2pIv3FfXyGQ3WzG3JfUfC_qw8xsh9THZeLJPvxU0Uh4_UWTqbEqM_.x50Mjb.taxmFIfa_WfymxakDazWR1K6fk2d6_ZEQXG69C164w-- X-Yahoo-Newman-Property: ymail-3 Message-ID: <47AB3B0B.9060902@sbcglobal.net> Date: Thu, 07 Feb 2008 17:08:27 +0000 From: Greg Chicares User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Incomplete environ when running MinGW apps? References: <5E25AF06EFB9EA4A87C19BC98F5C87531641A1 AT core-email DOT int DOT ascribe DOT com> <47AB31C7 DOT 3040909 AT cyconix DOT com> In-Reply-To: <47AB31C7.3040909@cyconix.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On 2008-02-07 16:28Z, Paul Leder wrote: > > [...] I've written an app which runs on Linux and > "Windows". Most of the time on "Windows", it's probably going to be > running on Cygwin/bash. However, there's always going to be someone who > runs it in a DOS box. > > So, my problem is, how do I find out if they've got a sane shell or not? > I can't ask them to export SHELL; I might as well just ask them to > provide a command-line arg to tell me what their shell is anyway. I need > some automatic way to do it. cat >what_shell.c <<\EOF #include #include int main() { int z; z = system("uname"); printf("%d\n", z); return z; } EOF gcc -mno-cygwin -o what_shell.exe -W -Wall -pedantic -ansi what_shell.c Cygwin bash output: $ ./what_shell CYGWIN_NT-5.1 0 CMD.EXE output: C:\cygwin\tmp>what_shell 'uname' is not recognized as an internal or external command, operable program or batch file. 1 Of course, that'll report a sane shell even in CMD.EXE if Cygwin's /bin is on $PATH, but IIRC that might be what you want: for example, it'll tell you whether you can run 'ls' or have to fall back on 'dir'. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/