How to redirect the output of lbb_main function to variable on c program

Tiago Araujo da costa tiagoarcosta at yahoo.com.br
Fri May 22 14:31:13 UTC 2020


I build libbusybox.so.1.31.1 and put on /usr/local/lib. In addition, I created a symbolic link /usr/local/lib/libbusybox.soI have a file, the content of which is:
$ cat ogt.cextern int lbb_main(char **argv);

int main()
{
    char* strarray[] = {"ifconfig",0};
    lbb_main(strarray);

    return 1;
}
I compile the above file with the following command:
$ gcc -o ogt ogt.c -lbusybox
And run:
$ ./ogteth0      Link encap:Ethernet  HWaddr 07:1F:EA:C9:3B:4C
          inet addr:172.16.51.62  Bcast:172.16.51.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7989695 errors:0 dropped:258 overruns:0 frame:0
          TX packets:4696710 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2659885363 (2.4 GiB)  TX bytes:7111442553 (6.6 GiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:2654 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2654 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:225192 (219.9 KiB)  TX bytes:225192 (219.9 KiB)
How do I redirect the output of command "lbb_main (strarray);" for a variable, inside the ogt.c program?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20200522/dba30648/attachment.html>


More information about the busybox mailing list