You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Michael Jung <mi...@gmx.net> on 2022/03/01 18:13:35 UTC

Setting TERM environment variable before starting the application

Hello,

I am playing around with ncurses on NuttX and would like to set a TERM
environment variable to xterm-256color via setenv() before the application
is started (I would like to run unmodified ncurses example applications),
but am not quite sure where this would best fit in.  It seems that
CONFIG_BOARD_EARLY_INITIALIZE and board_early_initialize() would do the
trick, but there is not a single board defconfig that is using this
feature.  Any suggestions?

Thanks!
Michael

Re: Setting TERM environment variable before starting the application

Posted by Alan Carvalho de Assis <ac...@gmail.com>.
I don't know if it was modified recently but it was optional to run as
separated thread.

Very nice Michael, it is really good when porting programs and libraries
from Linux are easy to do.

So, currently we have litesql, pdcurses, ncurses, etc as examples of
porting from Linux. Maybe it could be possible to port nginx too, at least
an old version and for some board with enough memory.

BR,

Alan


On Tuesday, March 1, 2022, Michael Jung <mi...@gmx.net> wrote:

> Hi Alan,
>
> thanks for your feedback.  According to the documentation
> board_late_initialize() is running in a separate thread (But probably not
> in its own task group?!).  So would the environment variable still be
> copied to the application?
>
> I am running the default ncurses from Linux.  There really was not much
> porting to do (some test programs call system() and popen()/pclose(), which
> I had to comment out).
>
> Bye,
> Michael
>
>
>
>
> Am Di., 1. März 2022 um 19:27 Uhr schrieb Alan Carvalho de Assis <
> acassis@gmail.com>:
>
> > Hi Michael,
> >
> > I think you could do it using the board late initialize, because it is
> > just after the board's drivers initialization and before the
> > application initialization.
> >
> > So it will run before any ncurses initialization.
> >
> > Did you mean you ported the default ncurses used on Linux or are you
> > using the pdcurses that Mr. Greg ported to NuttX some years ago?
> >
> > BR,
> >
> > Alan
> >
> > On 3/1/22, Michael Jung <mi...@gmx.net> wrote:
> > > Hello,
> > >
> > > I am playing around with ncurses on NuttX and would like to set a TERM
> > > environment variable to xterm-256color via setenv() before the
> > application
> > > is started (I would like to run unmodified ncurses example
> applications),
> > > but am not quite sure where this would best fit in.  It seems that
> > > CONFIG_BOARD_EARLY_INITIALIZE and board_early_initialize() would do the
> > > trick, but there is not a single board defconfig that is using this
> > > feature.  Any suggestions?
> > >
> > > Thanks!
> > > Michael
> > >
> >
>

Re: Setting TERM environment variable before starting the application

Posted by Michael Jung <mi...@gmx.net>.
Hi Alan,

thanks for your feedback.  According to the documentation
board_late_initialize() is running in a separate thread (But probably not
in its own task group?!).  So would the environment variable still be
copied to the application?

I am running the default ncurses from Linux.  There really was not much
porting to do (some test programs call system() and popen()/pclose(), which
I had to comment out).

Bye,
Michael




Am Di., 1. März 2022 um 19:27 Uhr schrieb Alan Carvalho de Assis <
acassis@gmail.com>:

> Hi Michael,
>
> I think you could do it using the board late initialize, because it is
> just after the board's drivers initialization and before the
> application initialization.
>
> So it will run before any ncurses initialization.
>
> Did you mean you ported the default ncurses used on Linux or are you
> using the pdcurses that Mr. Greg ported to NuttX some years ago?
>
> BR,
>
> Alan
>
> On 3/1/22, Michael Jung <mi...@gmx.net> wrote:
> > Hello,
> >
> > I am playing around with ncurses on NuttX and would like to set a TERM
> > environment variable to xterm-256color via setenv() before the
> application
> > is started (I would like to run unmodified ncurses example applications),
> > but am not quite sure where this would best fit in.  It seems that
> > CONFIG_BOARD_EARLY_INITIALIZE and board_early_initialize() would do the
> > trick, but there is not a single board defconfig that is using this
> > feature.  Any suggestions?
> >
> > Thanks!
> > Michael
> >
>

Re: Setting TERM environment variable before starting the application

Posted by Alan Carvalho de Assis <ac...@gmail.com>.
Hi Michael,

I think you could do it using the board late initialize, because it is
just after the board's drivers initialization and before the
application initialization.

So it will run before any ncurses initialization.

Did you mean you ported the default ncurses used on Linux or are you
using the pdcurses that Mr. Greg ported to NuttX some years ago?

BR,

Alan

On 3/1/22, Michael Jung <mi...@gmx.net> wrote:
> Hello,
>
> I am playing around with ncurses on NuttX and would like to set a TERM
> environment variable to xterm-256color via setenv() before the application
> is started (I would like to run unmodified ncurses example applications),
> but am not quite sure where this would best fit in.  It seems that
> CONFIG_BOARD_EARLY_INITIALIZE and board_early_initialize() would do the
> trick, but there is not a single board defconfig that is using this
> feature.  Any suggestions?
>
> Thanks!
> Michael
>