when have time, test there Alan ________________________________ De: Alan C. Assis <acas...@gmail.com> Enviado: quinta-feira, 12 de outubro de 2023 18:48 Para: dev@nuttx.apache.org <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, Alan On 10/12/23, MIGUEL ALEXANDRE WISINTAINER <tcpipc...@hotmail.com> wrote: > Now compiles π > > in theory should show the files got from ls on terminal ? > > Builtin Apps: > i2c sh hello nsh > nsh> hello > nsh> > > ============= > > #include <nuttx/config.h> > #include <stdio.h> > #include <stdlib.h> > #include <unistd.h> > > > #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] = > ββββββ{ > ββββββββββββ"ls", > ββββββββββββNULL > ββββββ}; > > ββββββexecv(args[0], args); > } > De: Xiang Xiao <xiaoxiang781...@gmail.com> > Enviado: quinta-feira, 12 de outubro de 2023 18:08 > Para: dev@nuttx.apache.org <dev@nuttx.apache.org> > Assunto: Re: execv obsolet ? > > 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 <nuttx/config.h> >> #include <stdio.h> >> #include <stdlib.h> >> #include <unistd.h> >> >> #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); >> } >> >> else >> { >> int i; >> >> for (i = 1; i < argc; i++) >> { >> static char * const args[3] = >> { >> "/bin/ls", >> NULL, >> NULL >> }; >> args[1] = argv[i]; >> execv(args[0], args); >> } >> } >> return EXIT_SUCCESS; >> } >> >> hello_main.c:(.text.hello_main+0xe): undefined reference to `execv' >> xtensa-esp32-elf-ld: hello_main.c:(.text.hello_main+0x20): undefined >> reference to `execv' >> make[1]: *** [Makefile:173: nuttx] Error 1 >> make: *** [tools/Unix.mk:537: nuttx] Error 2 >> >