Blame tests/testsocket_child.c

Packit 98cdb6
/* testsocket_child.c
Packit 98cdb6
 * Copyright (C) 2001 Red Hat, Inc
Packit 98cdb6
 * Author: Owen Taylor
Packit 98cdb6
 *
Packit 98cdb6
 * This library is free software; you can redistribute it and/or
Packit 98cdb6
 * modify it under the terms of the GNU Library General Public
Packit 98cdb6
 * License as published by the Free Software Foundation; either
Packit 98cdb6
 * version 2 of the License, or (at your option) any later version.
Packit 98cdb6
 *
Packit 98cdb6
 * This library is distributed in the hope that it will be useful,
Packit 98cdb6
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 98cdb6
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 98cdb6
 * Library General Public License for more details.
Packit 98cdb6
 *
Packit 98cdb6
 * You should have received a copy of the GNU Library General Public
Packit 98cdb6
 * License along with this library; if not, write to the
Packit 98cdb6
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Packit 98cdb6
 * Boston, MA 02111-1307, USA.
Packit 98cdb6
 */
Packit 98cdb6
Packit 98cdb6
#include "config.h"
Packit 98cdb6
#include <stdio.h>
Packit 98cdb6
#include <stdlib.h>
Packit 98cdb6
Packit 98cdb6
#include <gtk/gtk.h>
Packit 98cdb6
Packit 98cdb6
extern guint32 create_child_plug (guint32  xid,
Packit 98cdb6
				  gboolean local);
Packit 98cdb6
Packit 98cdb6
int
Packit 98cdb6
main (int argc, char *argv[])
Packit 98cdb6
{
Packit 98cdb6
  guint32 xid;
Packit 98cdb6
  guint32 plug_xid;
Packit 98cdb6
Packit 98cdb6
  gtk_init (&argc, &argv);
Packit 98cdb6
Packit 98cdb6
  if (argc != 1 && argc != 2)
Packit 98cdb6
    {
Packit 98cdb6
      fprintf (stderr, "Usage: testsocket_child [WINDOW_ID]\n");
Packit 98cdb6
      exit (1);
Packit 98cdb6
    }
Packit 98cdb6
Packit 98cdb6
  if (argc == 2)
Packit 98cdb6
    {
Packit 98cdb6
      xid = strtol (argv[1], NULL, 0);
Packit 98cdb6
      if (xid == 0)
Packit 98cdb6
	{
Packit 98cdb6
	  fprintf (stderr, "Invalid window id '%s'\n", argv[1]);
Packit 98cdb6
	  exit (1);
Packit 98cdb6
	}
Packit 98cdb6
      
Packit 98cdb6
      create_child_plug (xid, FALSE);
Packit 98cdb6
    }
Packit 98cdb6
  else
Packit 98cdb6
    {
Packit 98cdb6
      plug_xid = create_child_plug (0, FALSE);
Packit 98cdb6
      printf ("%d\n", plug_xid);
Packit 98cdb6
      fflush (stdout);
Packit 98cdb6
    }
Packit 98cdb6
Packit 98cdb6
  gtk_main ();
Packit 98cdb6
Packit 98cdb6
  return 0;
Packit 98cdb6
}
Packit 98cdb6
Packit 98cdb6