From: "Peter S Tillier" Newsgroups: comp.os.msdos.djgpp Subject: Re: gawk 3.1.1 DJGPP v2.04 on Windows 2000 Pro problem using system() function and LFNs Date: Wed, 29 Jan 2003 13:24:32 -0000 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <3e360683 DOT sandmann AT clio DOT rice DOT edu> <3e37507d DOT sandmann AT clio DOT rice DOT edu> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Complaints-To: abuse AT supernews DOT com Lines: 69 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Charles Sandmann" wrote in message news:3e37507d DOT sandmann AT clio DOT rice DOT edu... > > I tried using your suggestion in various ways, but in each > > case it seems that, although cmd.exe is called at some point > > and displays its version, etc., it never exits, so that each > > time it is called another shell instance is opened. In the > > end I have had to type "exit" several times to exit the DOS > > window. This is Windows 2000 Pro, SP2. > > Try > SET SHELL=%COMSPEC% /C > which seems to work better. > > It did something useful in my test case, instead of just ignoring > the command and spawning CMD I did try this but as Eli says in his posting, I don't think that SHELL= should take parameters such as /C. In MSDOS config.sys files the only parameters that SHELL usually takes are /e or /p but it does depend on what the shell is. The /e and /p are correct for command.com in MSDOS. A further experiment, prompted by a posting in comp.lang.awk (where this all started out) by Andrew Graham gives this odd looking result: c:\>ver Microsoft Windows 2000 [Version 5.00.2195] c:\>echo %COMSPEC% C:\WINNT\system32\cmd.exe c:\>gawk "BEGIN{print ENVIRON[\"COMSPEC\"]}" C:\WINNT\SYSTEM32\COMMAND.COM c:\> i.e., despite ver and echo %COMSPEC% saying that we're using cmd.exe, DJGPP gawk's ENVIRON array thinks that we're using COMMAND.COM Is it possible that there's a bug in DJGPP libc's system() call? I've d/l'd a copy of Andrew's latest version as per his post: it has a date of 24/01/02 and the test shown above gives the same result. It looks as if Eli's comment that there is a bug somewhere is correct. It could be in the way that gawk obtains the information for its ENVIRON array, but as I don't have the sources for the DJGPP v2.04 gawk-3.1.1 I am not able to check this. BTW I know that SP3 for W2K has a revised COMMAND.COM according to the M$ site, but I don't think that this is causing the discrepancy between echo %COMSPEC% and gawk's ENVIRON array that we are seeing here. Thanks to Eli, Charles and Andrew for the help and advice. Regards, Peter -- Peter S Tillier "Who needs perl when you can write dc and sokoban in sed?"