Re: execv obsolet ?

2023-10-12 Thread MIGUEL ALEXANDRE WISINTAINER
I will test too soon, well, gustavo can do it :) Enviado do meu iPhone > Em 12 de out. de 2023, à(s) 19:22, Alan C. Assis escreveu: > > Did you try popen() ? > > https://stackoverflow.com/questions/43116/how-can-i-run-an-external-program-from-c-and-parse-its-output > > Look the example at

Re: execv obsolet ?

2023-10-12 Thread MIGUEL ALEXANDRE WISINTAINER
Wow! Maybe sprintf, right ? Enviado do meu iPhone > Em 12 de out. de 2023, à(s) 18:31, Gregory Nutt > escreveu: > >  >> On 10/12/2023 3:26 PM, MIGUEL ALEXANDRE WISINTAINER wrote: >> Some idea how to capture the data returned by exec ? > > exec does really return any data other than an int

Re: execv obsolet ?

2023-10-12 Thread Alan C. Assis
Did you try popen() ? https://stackoverflow.com/questions/43116/how-can-i-run-an-external-program-from-c-and-parse-its-output Look the example at apps/examples/popen BR, Alan On 10/12/23, MIGUEL ALEXANDRE WISINTAINER wrote: > Some idea how to capture the data returned by exec ? > > Enviado

Re: execv obsolet ?

2023-10-12 Thread Gregory Nutt
Here is some history and justification for the naming. Uros Platise created the built-in tasks in 2012 and provided the naming.  I would have preferred another name to avoid the conflicts. The meaning of external only makes sense with respect what is internal.  If you are think from the

Re: execv obsolet ?

2023-10-12 Thread Gregory Nutt
On 10/12/2023 3:26 PM, MIGUEL ALEXANDRE WISINTAINER wrote: Some idea how to capture the data returned by exec ? exec does really return any data other than an int status code which only indicates if the task was correctly started. If you want some text output, you would have to add

Re: execv obsolet ?

2023-10-12 Thread MIGUEL ALEXANDRE WISINTAINER
Some idea how to capture the data returned by exec ? Enviado do meu iPhone > Em 12 de out. de 2023, à(s) 18:16, Alan C. Assis escreveu: > > Hi Greg, > >> On 10/12/23, Gregory Nutt wrote: >> >>> On 10/12/2023 2:18 PM, Alan C. Assis wrote: >>> The execv on Linux also fails when we can an

Re: execv obsolet ?

2023-10-12 Thread Alan C. Assis
Hi Greg, On 10/12/23, Gregory Nutt wrote: > > On 10/12/2023 2:18 PM, Alan C. Assis wrote: >> The execv on Linux also fails when we can an builtin program, try it: > > You are right, but the semantics are really confusing. In Bash, > commands that are included inside of Bash are called built-in

RE: execv obsolet ?

2023-10-12 Thread MIGUEL ALEXANDRE WISINTAINER
thank you Gregory De: Gregory Nutt Enviado: quinta-feira, 12 de outubro de 2023 21:06 Para: dev@nuttx.apache.org Assunto: Re: execv obsolet ? On 10/12/2023 2:18 PM, Alan C. Assis wrote: > The execv on Linux also fails when we can an builtin program,

Re: execv obsolet ?

2023-10-12 Thread Gregory Nutt
On 10/12/2023 2:18 PM, Alan C. Assis wrote: The execv on Linux also fails when we can an builtin program, try it: You are right, but the semantics are really confusing.  In Bash, commands that are included inside of Bash are called built-in commands and you cannot execute them.  We ignore

Re: execv obsolet ?

2023-10-12 Thread Gregory Nutt
On 10/12/2023 2:05 PM, Alan C. Assis wrote: Ah ok, I tested using the original code with "ls" instead "/bin/ls" and the result as similar to NuttX: didn't print anything. That is a different problem; it did not find ls.  On linux, use /execvp/ instead of /execv //or //execve/.  With execve,

RE: execv obsolet ?

2023-10-12 Thread MIGUEL ALEXANDRE WISINTAINER
i just compiled i2c tools first... De: Gregory Nutt Enviado: quinta-feira, 12 de outubro de 2023 20:51 Para: dev@nuttx.apache.org Assunto: Re: execv obsolet ? On 10/12/2023 2:31 PM, MIGUEL ALEXANDRE WISINTAINER wrote: > I can run (execv) i2c from he

RE: execv obsolet ?

2023-10-12 Thread MIGUEL ALEXANDRE WISINTAINER
ecified, that address will be re-used until it is changed. WARNING: o The I2C dev command may have bad side effects on your I2C devices. Use only at your own risk. nsh> De: Gregory Nutt Enviado: quinta-feira, 12 de outubro de 2023 20:51 Para: dev@nuttx.apa

Re: execv obsolet ?

2023-10-12 Thread Gregory Nutt
On 10/12/2023 2:31 PM, MIGUEL ALEXANDRE WISINTAINER wrote: I can run (execv) i2c from hello  works! Now Gustavo can you this TIP to make work the PCA/PCF GPIO extender  Thanks! nsh> hello Executing 1 /bin/i2c Usage: i2c [arguments] Where is one of: There are

RE: execv obsolet ?

2023-10-12 Thread MIGUEL ALEXANDRE WISINTAINER
Assis Enviado: quinta-feira, 12 de outubro de 2023 20:05 Para: dev@nuttx.apache.org Assunto: Re: execv obsolet ? Ah ok, I tested using the original code with "ls" instead "/bin/ls" and the result as similar to NuttX: didn't print anything. I discovered the issue: ls is not a b

Re: execv obsolet ?

2023-10-12 Thread Alan C. Assis
cause it is easy! But because we thought it was easy! > nsh> > > Just used the DEBUG to find-out the issue, the debug binary loader > said exactly what was the issue. > > BR, > > Alan > > On 10/12/23, MIGUEL ALEXANDRE WISINTAINER wrote: >> 1 hour ago, not

Re: execv obsolet ?

2023-10-12 Thread Alan C. Assis
y loader said exactly what was the issue. BR, Alan On 10/12/23, MIGUEL ALEXANDRE WISINTAINER wrote: > 1 hour ago, not 1 year ago > > De: MIGUEL ALEXANDRE WISINTAINER > Enviado: quinta-feira, 12 de outubro de 2023 19:07 > Para: dev@nuttx.apache

RE: execv obsolet ?

2023-10-12 Thread MIGUEL ALEXANDRE WISINTAINER
when have time, test there Alan De: Alan C. Assis Enviado: quinta-feira, 12 de outubro de 2023 18:48 Para: dev@nuttx.apache.org Assunto: Re: execv obsolet ? Hi Miguel, I suggest you to try first in the Linux. NuttX should give you the same result ;-) BR

RE: execv obsolet ?

2023-10-12 Thread MIGUEL ALEXANDRE WISINTAINER
1 hour ago, not 1 year ago De: MIGUEL ALEXANDRE WISINTAINER Enviado: quinta-feira, 12 de outubro de 2023 19:07 Para: dev@nuttx.apache.org Assunto: RE: execv obsolet ? yes, i already had done that 1 year ago ubuntu@DESKTOP-GRCNLV8:~$ nano hello_main.c ubuntu

RE: execv obsolet ?

2023-10-12 Thread MIGUEL ALEXANDRE WISINTAINER
intf("Executing 1 %s \n", args[0]); execv(args[0], args); } De: Alan C. Assis Enviado: quinta-feira, 12 de outubro de 2023 18:48 Para: dev@nuttx.apache.org Assunto: Re: execv obsolet ? Hi Miguel, I suggest you to try first in the Linux. Nutt

Re: execv obsolet ?

2023-10-12 Thread Alan C. Assis
> #endif > { > > if (argc < 2) > { >   static char * const args[2] = >   { > "ls", > NULL >   }; > >   execv(args[0], args); > } > De: Xiang Xiao > Enviado: quinta-feira, 12 de outubro de 2023 18:08 > Para: dev@nuttx.apache

RE: execv obsolet ?

2023-10-12 Thread MIGUEL ALEXANDRE WISINTAINER
, char *argv[]) #endif { if (argc < 2) {   static char * const args[2] =   { "ls", NULL   };   execv(args[0], args); } De: Xiang Xiao Enviado: quinta-feira, 12 de outubro de 2023 18:08 Para: dev@nuttx.apache.org Assunto: Re: execv obsolet

Re: execv obsolet ?

2023-10-12 Thread Xiang Xiao
you need enable CONFIG_LIBC_EXECFUNCS: https://github.com/apache/nuttx/blob/master/libs/libc/unistd/lib_execv.c#L29 On Fri, Oct 13, 2023 at 1:59 AM MIGUEL ALEXANDRE WISINTAINER < tcpipc...@hotmail.com> wrote: > #include > #include > #include > #include > > #ifdef CONFIG_BUILD_KERNEL > int

execv obsolet ?

2023-10-12 Thread MIGUEL ALEXANDRE WISINTAINER
#include #include #include #include #ifdef CONFIG_BUILD_KERNEL int main(int argc, FAR char *argv[]) #else int hello_main(int argc, char *argv[]) #endif { if (argc < 2) {   static char * const args[2] =   { "/bin/ls", NULL   };   execv(args[0], args);