X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Fri, 21 Jan 2005 18:39:28 +0200
From: "Eli Zaretskii" <eliz AT gnu DOT org>
Sender: halo1 AT zahav DOT net DOT il
To: djgpp AT delorie DOT com
Message-ID: <01c4ffd7$Blat.v2.4$eb8797c0@zahav.net.il>
Content-Transfer-Encoding: 7BIT
Content-Type: text/plain; charset=ISO-8859-1
X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 2.4
In-reply-to: <d46153c40501210642184b3371@mail.gmail.com> (message from Andrew
	Paulsen on Fri, 21 Jan 2005 08:42:52 -0600)
Subject: Re: ls.exe in execv
References:  <d46153c40501210642184b3371 AT mail DOT gmail DOT com>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com
Precedence: bulk

> Date: Fri, 21 Jan 2005 08:42:52 -0600
> From: Andrew Paulsen <andrew DOT paulsen AT gmail DOT com>
> 
>  Second, why are you passing the path to ls in the argv[] parameter? 
> The following worked for me:
> 
> #include <unistd.h>
> #include <stdio.h>
> #include <stdlib.h>
> int main() {
> 	int retval;
> 
> 	char *myArgv[] = {"C:\\", NULL};
> 	retval = execv("C:\\djgpp\\bin\\ls.exe",  myArgv);

This is wrong: myArgv[0] should be the program's name, i.e. "ls" or
some such.  myArgv[1] is passed to ls as its 1st command-line
argument.