#include <stdlib.h>
#include <unistd.h>
#include <glib.h>
#include <glib/gprintf.h>

/* EXO 1.4 */

int main(int argc, char* argv[]){
  g_printf(" === EXO 1.4  === \n");

  GIOChannel *channel = g_io_channel_unix_new (STDIN_FILENO);
  gchar *str_return;
  gsize length;
  gsize terminator_pos;
  GError *error = NULL;

  
  if (g_io_channel_read_line (channel, &str_return, &length, &terminator_pos, &error) == G_IO_STATUS_ERROR) {
        g_warning ("Erreur lors de la lecture");
  }
  if (error != NULL){
        g_printf (error->message);
        exit(1);
  }
  
  g_printf ("%s", str_return);
  
  return EXIT_SUCCESS;
}
