Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!wuarchive!psuvax1!psuvm!cunyvm!ndsuvm1.bitnet!nu013809 From: NU013809@NDSUVM1.BITNET (Greg Wettstein) Newsgroups: comp.sys.ibm.pc Subject: Re: Searching failure of COMMAND.COM Message-ID: <2882NU013809@NDSUVM1> Date: 5 Oct 89 13:36:28 GMT References: <12957@pur-ee.UUCP> Distribution: usa Organization: North Dakota Higher Education Computer Network, Fargo, ND Lines: 64 DISCLAIMER: Author bears full responsibility for contents of this article. I experienced a similar problem just recently when I was porting GNU Make to MS-DOS. The symptoms were very similar to what the previous poster noticed, make would attempt to spawn a copy of command.com to run a command. I was using the spawnve command to execute command.com with the /c switch which tells command.com to execute its arguement and return to DOS. The format of the spawnve function call is MSC 5.1 is: spawnve(mode, program, argv, envp) Where: mode = Mode to use when spawning, P_WAIT is the only option available in MS-DOS. program = Ghe name of the program to be spawned. argv = An array of character pointerw which point to the command line arguements. envp = An array of character pointers which point to the environment strings to be used by the child process. The format of the argv strings were as follows: argv[0] = "c::command.com" <---- The name of the program to execute. argv[1] = "-c" <---- The execute and return switch. argv[2] = "dir" <---- Command to execute. argv[3] = "" <---- Null to terminate arguement list. When command.com was spawned with this arguement list an error was issued repeatedly which said that an invalid search path was found. Control then returned to the daughter copy of command.com. Typing an exit command would return control back to MAKE. Checking the environment revealed that the only environment strings present were: PATH= and COMSPEC=:command.com. I scratched my head a couple of times, checked that the arguements were all correct before the spawnve call and then started to look for problems. Those readers who have been observant have already spotted the problem. I used a -c instead of a /c as an arguement string. Evidently command.com could not cope with this and exits leaving an essentially empty operating shell. I don't know for certain if this is happening with the poster's program but the symptoms are notoriously similar. Obvious solutions are to: 1:=> Check the source code if it is available for a spawn or exec command. 2:=> If source is not available check to see if the user can provide any type of configuration for how commands are to be spawned, arguements etc. 3:=> Use one of the programs floating around the net that uses the undocumented DOS function to change the current switch character setting. I have heard conflicting reports on whether or not command.com checks the current switch character setting before parsing command lines passed to it. Hopefully this information will cast some light on the problem. I apologize if people should find this excessively verbose. This problem cost me some time and I would like others to avoid it if possible. As always, Dr. G.W. Wettstein NU013809@NDSUVM1