re: More on nm-OpenSwan

I'm trying to implement the ipsec connection startup command

I'm using the function g_spawn_async_with_pipes to call the ipsec binary with the appropriate args.
The process will terminate when successful.

I want to pipe the output of the process (stdout) to a Status window (pop-up widget??) in real-time.

I'm thinking I need to use a GIOChannel to capture the output this way. Can anyone clarify?


GFILE *output = g_fopen("//dev//stdout", "r");
GIOChannel *connOutput = NULL;
gchar * stdout_buffer;
connOutput = g_io_channel_unix_new(&output);

while (g_io_channel_read_line(&connOutput, &stdout_buffer, NULL, NULL, &error) != (G_IO_STATUS_EOF || G_IO_STATUS_ERROR))
   nm_status_update("%s", &stdout_buffer); //pseudo function for now
   if (stdout_buffer == "\n\n")
         return 0:

Does that make any sense or am I going about this the wrong way?

Thanks for any help.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]