<commit_before>/*
 * Copyright (C) 1999, 2000 Red Hat, Inc.
 * All rights reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with the Gnome Library; see the file COPYING.  If not,
 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
/*
  @NOTATION@
 */

#include <libgnome/libgnome.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>

static char *display = NULL, *languages = NULL;
static int ior_fd = -1;

struct poptOption options[] = {
  {"display", '\0', POPT_ARG_STRING, &display, 0},
  {"ior-fd", '\0', POPT_ARG_INT, &ior_fd, 0},
  {"languages", '\0', POPT_ARG_STRING, &languages, 0},
  {NULL}
};

typedef struct {
  FILE *pipe_fh;
  GMainLoop *ml;
  int pipe_fd, pipe_tag;
} proginfo;

static gboolean handle_commands(GIOChannel *ioc, GIOCondition cond, gpointer data);
static gboolean relay_output   (GIOChannel *ioc, GIOCondition cond, gpointer data);

int main(int argc, char **argv)
{
  proginfo myprog;

  gnome_program_init("gnome-remote-bootstrap", VERSION, argc, argv, GNOME_PARAM_POPT_TABLE, options, NULL);

  if(!display
     || (ior_fd < 0))
    {
      g_printerr("This is program is used internally to bootstrap the network connections for the desktop.\n");
      return 1;
    }

  setenv("DISPLAY", display, TRUE);
  if(strcmp(languages, "C"))
    setenv("LANG", languages, TRUE);

  memset(&myprog, 0, sizeof(myprog));
  myprog.pipe_fd = -1;

  myprog.ml = g_main_new(FALSE);

  {
    GIOChannel *glib_bites = g_io_channel_unix_new(0); /* stdin */

    g_io_add_watch(glib_bites, G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL, handle_commands, &myprog);
    g_io_channel_unref(glib_bites);
  }
  
  fprintf(stdout, "GNOME BOOTSTRAP READY\n");<commit_msg>Reflect lastest GnomeProgram API changes.<commit_after>/*
 * Copyright (C) 1999, 2000 Red Hat, Inc.
 * All rights reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with the Gnome Library; see the file COPYING.  If not,
 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
/*
  @NOTATION@
 */

#include <libgnome/libgnome.h>
#include <libgnomeui/gnome-init.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>

static char *display = NULL, *languages = NULL;
static int ior_fd = -1;

struct poptOption options[] = {
  {"display", '\0', POPT_ARG_STRING, &display, 0},
  {"ior-fd", '\0', POPT_ARG_INT, &ior_fd, 0},
  {"languages", '\0', POPT_ARG_STRING, &languages, 0},
  {NULL}
};

typedef struct {
  FILE *pipe_fh;
  GMainLoop *ml;
  int pipe_fd, pipe_tag;
} proginfo;

static gboolean handle_commands(GIOChannel *ioc, GIOCondition cond, gpointer data);
static gboolean relay_output   (GIOChannel *ioc, GIOCondition cond, gpointer data);

int main(int argc, char **argv)
{
  proginfo myprog;

  gnome_program_init("gnome-remote-bootstrap", VERSION, &libgnomeui_module_info,
		     argc, argv, GNOME_PARAM_POPT_TABLE, options, NULL);

  if(!display
     || (ior_fd < 0))
    {
      g_printerr("This is program is used internally to bootstrap the network connections for the desktop.\n");
      return 1;
    }

  setenv("DISPLAY", display, TRUE);
  if(strcmp(languages, "C"))
    setenv("LANG", languages, TRUE);

  memset(&myprog, 0, sizeof(myprog));
  myprog.pipe_fd = -1;

  myprog.ml = g_main_new(FALSE);

  {
    GIOChannel *glib_bites = g_io_channel_unix_new(0); /* stdin */

    g_io_add_watch(glib_bites, G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL, handle_commands, &myprog);
    g_io_channel_unref(glib_bites);
  }
  
  fprintf(stdout, "GNOME BOOTSTRAP READY\n");
{'fraction_non_alphanumeric': 0.1147052564375399, 'fraction_numerical': 0.014896786550329857, 'mean_word_length': 4.10314875135722, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4805277', 'n_tokens_mistral': 1684, 'n_tokens_neox': 1580, 'n_words': 520}