So I decided that if I could output that window to a RequestChoice (RC) window it would have been fine. There were two problems, though: RC's output capabilities are quite limited and, unluckily, I simply could not use a command like
RequestChoice "IP Address" "`ifconfig -a`" "OK"
because the way ifconfig shows its output is not compatible with RC's exprectations. For instance, something like:
lo0: flags=9<UP,LOOPBACK> mtu 1536
inet 127.0.0.1 netmask 0xff000000
net0: flags=822<BROADCAST,NOTRAILERS,SIMPLEX>
inet 0.0.0.0 netmask 0xffffff00 broadcast 0.0.0.255
would need to be cleaned of special tab characters (the ones before "inet" words) and all line feeds replaced by the *N code, so it would appear like this:
"lo0: flags=9<UP,LOOPBACK> mtu 1536*Ninet 127.0.0.1 netmask 0xff000000*Nnet0: flags=822<BROADCAST,NOTRAILERS,SIMPLEX>*Ninet 0.0.0.0 netmask 0xffffff00 broadcast 0.0.0.255"
But how to get this done? The answer is, once more, an old cli utility called gsar, which I built for AROS many months ago. Gsar can search for control characters and replace them as I like, so in a nutshell I could write these lines of code
ifconfig -a >t:currIP
gsar -i -o -s:x09 -r:x20:x20 t:currIP >NIL:
gsar -i -o -s:x0a -r*N t:currIP >NIL:
and place them in a new script. These lines basically transform the output of 'ifconfig -a' into a text line which requestcoice can understand. In fact, the following line is:
RequestChoice "IP Address" "${t:currIP}" "Close" >nil:
Which is exactly what I needed to get this:
the actual script on Icaros Desktop also includes a 'Change' button to open Prefs/Network |
So, why did I got some "advice"? Because I discovered this on Aminet, a RequestChioce clone for AmigaOS 2+ which can use a text file as value for the BODY parameter. The archive on Aminet includes also the source in C but, due to my very very very limited skills, I could not even get it to build. With advice, the above script would have looked like:
ifconfig -a >t:currIP
Advice TITLE "IP Address" BODY t:currIP BUTTONTEXT "Close"
I posted this help request on AROS-EXEC, and
Advice for AROS, and modified source, will be posted on the Archives as soon as possible.