:: Re: [DNG] gcc error: "error: unkno…
Pàgina inicial
Delete this message
Reply to this message
Autor: aitor_czr
Data:  
A: Edward Bartolo, dng
Assumpte: Re: [DNG] gcc error: "error: unknown type name,,,,‘GtkObject’"
Thanks Edward, now i understand:

$./backend 2 Euskaltel-58AY
     wpa-ssid Euskaltel-58YA
     wpa-psk "_the_saved_password_"


$./backend 6
     ESSID:"_EUSKALTELWIFI_KALEAN"
     ESSID:"Euskaltel-jzhA"
     ESSID:"TP-LINK_8F0F96"
     ESSID:"vodafoneE4A5"
     ESSID:"_EUSKALTELWIFI_KALEAN"
     ESSID:"_EUSKALTELWIFI_KALEAN"
     ESSID:"nellca"
     ESSID:"f56031"
     ESSID:"eusklatel_koldomendi"
     ESSID:"RUIZ"
     ESSID:"Euskaltel-58YA"
     ESSID:"Euskaltel-KMRD"
     ESSID:"_EUSKALTELWIFI_KALEAN"
     ESSID:"Euskaltel158i"
     ESSID:"440ff7"
     ESSID:"Vodafone9128"


The button tagged as <"More information"> in the GUI of Netman shows the
textual output of:

$ sudo iwlist wlan0 scan
[sudo] password for aitor:
wlan0     Scan completed :
           Cell 01 - Address: 5A:23:8C:7F:C5:51
                     Channel:1
                     Frequency:2.412 GHz (Channel 1)
                     Quality=24/70  Signal level=-86 dBm
                     Encryption key:on
                     ESSID:"_EUSKALTELWIFI_KALEAN"
                     Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
                               24 Mb/s; 36 Mb/s; 54 Mb/s
                     Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 48 Mb/s
                     Mode:Master
                     Extra:tsf=000000140b9c8d71
                     Extra: Last beacon: 32ms ago
          [...etc...]


Isn't it?

Aitor.

On 12/06/2015 08:48 AM, Edward Bartolo <edbarx@???> wrote:
> Hi Aitor,
>
> As you can see, popen runs the command opening a pipe to trap its
> textual output. shell_reader is a pointer to the actual output reader.
> fgets reads the shell_reader line by line until it returns false. It
> places lines in buffer using 1024 as a size limit in the quoted code
> snippet. The read string in buffer is null terminated.
>
> This should set you going.
>
> Edward
>
> On 06/12/2015, Edward Bartolo<edbarx@???> wrote:
>> >Hi Aitor,
>> >
>> >The best way for you is to use the backend's code for reference. What
>> >you want is already implemented there. TProcesss was used to trap the
>> >background cli commands output although there are instances where that
>> >output is discarded.
>> >
>> >What you need is this from the CLI backend's code (core_functions.c):
>> >[ code snippet from getDefaultDevices() ]
>> >
>> >FILE * shell_reader;
>> >char scan_buffer[1024];
>> >
>> >[...]
>> >
>> >shell_reader = popen(command, "r");
>> >    if(!shell_reader) {
>> >        fprintf(
>> >            stderr,
>> >            "ERROR: getDefaultDevices(): "
>> >            "popen() failed (Error: %s)\n",
>> >            strerror(errno)
>> >        );

>> >                
>> >        return -1;
>> >    }

>> >            
>> >    char* ptr;
>> >    while((fgets(scan_buffer, 1024, shell_reader))) {
>> >      ptr = (char*) scan_buffer;
>> >        if (strstr((char *) scan_buffer, "lo") == ptr)
>> >            continue;
>> >        else if (strstr((char *) scan_buffer, "wl") == ptr) {
>> >            snprintf(
>> >                _wl,
>> >                1024,
>> >                "%s",
>> >                (char*) scan_buffer
>> >            );
>> >        } else if (
>> >            strstr((char *) scan_buffer, "eth") == ptr ||
>> >            strstr((char *) scan_buffer, "en") == ptr    
>> >        ) {
>> >            snprintf(
>> >                _eth,
>> >                1024,
>> >                "%s",
>> >                (char*) scan_buffer
>> >            );
>> >        }
>> >    }

>> >    
>> >    pclose(shell_reader);

>> >    
>> >
>> >Ask again if you in the event you may need more help.
>> >
>> >
>> >Edward
>> >
>> >
>> >On 05/12/2015, aitor_czr<aitor_czr@???> wrote:
>>> >>Hi Edward,
>>> >>
>>> >>I'm trying to scan the existing connections. As i can see in the
>>> >>TForm1.btnLoadExistingClick(Sender: TObject) method, you used 'TProcess'
>>> >>for running external applications. In C this must be replaced by the
>>> >>'system' command.
>>> >>
>>> >>Now i'm looking at the TProcess options. For example:
>>> >>
>>> >> Proc.Executable := 'cat';
>>> >> Proc.Parameters.Add('/etc/network/interfaces');
>>> >> Proc.Options := [poUsePipes, poWaitOnExit];
>>> >> Proc.Execute;
>>> >>
>>> >>Here are the definitions:
>>> >>
>>> >>http://olympiad.cs.uct.ac.za/docs/fpc-2.4.4/fcl/process/tprocess.options.html
>>> >>
>>> >>Cheers,
>>> >>
>>> >>     Aitor.

>>> >>
>>> >>On 12/04/2015 01:00 PM, Edward Bartolo<edbarx@???> wrote:
>>>> >>>Hi Aitor,
>>>> >>>
>>>> >>>I succeeded to run my trial gtk3 application with events without
>>>> >>>errors. I always wanted to learn coding GUI applications for Linux in
>>>> >>>C/C++. This can be a good exercise.
>>>> >>>
>>>> >>>Edward
>>>> >>>
>>>> >>>
>>>> >>>On 02/12/2015, aitor_czr<aitor_czr@???> wrote:
>>>>>> >>>> >Woow !!
>>>>>> >>>> >
>>>>>> >>>> >On 02/12/15 12:08, Edward Bartolo wrote:
>>>>>>>> >>>>> >>priv = (Private*) g_malloc (sizeof (struct _Private));