On Sun, 3 Jun 2012, Allin Cottrell wrote:

> On Sun, 3 Jun 2012, Marcin Błażejowski wrote:
>
>> Is there any way of decide (within a script) if we run gretl_x11 or 
>> gretlcli mode? Any accesor, function or sth...?
>
> Not really. On Linux you could probably do something clever with gretl's 
> getenv() function and/or the $(...) mechanism [...]

Such as

<hansl>
function scalar in_gui_mode (void)
   string p = $(echo $PPID)
   p = $(cat /proc/@p/cmdline)
   return strlen(strstr(p, "gretl_x11")) > 0
end function

printf "gui mode? %d\n", in_gui_mode()
</hansl>

Allin

Reply via email to