135c4bbdfSmrg/*
235c4bbdfSmrg *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
335c4bbdfSmrg *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
435c4bbdfSmrg *Copyright (C) Colin Harrison 2005-2008
535c4bbdfSmrg *
635c4bbdfSmrg *Permission is hereby granted, free of charge, to any person obtaining
735c4bbdfSmrg * a copy of this software and associated documentation files (the
835c4bbdfSmrg *"Software"), to deal in the Software without restriction, including
935c4bbdfSmrg *without limitation the rights to use, copy, modify, merge, publish,
1035c4bbdfSmrg *distribute, sublicense, and/or sell copies of the Software, and to
1135c4bbdfSmrg *permit persons to whom the Software is furnished to do so, subject to
1235c4bbdfSmrg *the following conditions:
1335c4bbdfSmrg *
1435c4bbdfSmrg *The above copyright notice and this permission notice shall be
1535c4bbdfSmrg *included in all copies or substantial portions of the Software.
1635c4bbdfSmrg *
1735c4bbdfSmrg *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1835c4bbdfSmrg *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1935c4bbdfSmrg *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
2035c4bbdfSmrg *NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
2135c4bbdfSmrg *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
2235c4bbdfSmrg *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2335c4bbdfSmrg *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2435c4bbdfSmrg *
2535c4bbdfSmrg *Except as contained in this notice, the name of the copyright holder(s)
2635c4bbdfSmrg *and author(s) shall not be used in advertising or otherwise to promote
2735c4bbdfSmrg *the sale, use or other dealings in this Software without prior written
2835c4bbdfSmrg *authorization from the copyright holder(s) and author(s).
2935c4bbdfSmrg *
3035c4bbdfSmrg * Authors:	Harold L Hunt II
3135c4bbdfSmrg *              Colin Harrison
3235c4bbdfSmrg */
3335c4bbdfSmrg
3435c4bbdfSmrg#ifdef HAVE_XWIN_CONFIG_H
3535c4bbdfSmrg#include <xwin-config.h>
3635c4bbdfSmrg#endif
3735c4bbdfSmrg
3835c4bbdfSmrg#include <stdio.h>
3935c4bbdfSmrg#include <stdlib.h>
4035c4bbdfSmrg#include <string.h>
4135c4bbdfSmrg
4235c4bbdfSmrg#include "winclipboard.h"
4335c4bbdfSmrg
4435c4bbdfSmrg/*
4535c4bbdfSmrg * Main function
4635c4bbdfSmrg */
4735c4bbdfSmrg
4835c4bbdfSmrgint
4935c4bbdfSmrgmain (int argc, char *argv[])
5035c4bbdfSmrg{
5135c4bbdfSmrg  int			i;
5235c4bbdfSmrg  char			*pszDisplay = NULL;
5335c4bbdfSmrg
5435c4bbdfSmrg  /* Parse command-line parameters */
5535c4bbdfSmrg  for (i = 1; i < argc; ++i)
5635c4bbdfSmrg    {
5735c4bbdfSmrg      /* Look for -display "display_name" or --display "display_name" */
5835c4bbdfSmrg      if (i < argc - 1
5935c4bbdfSmrg	  && (!strcmp (argv[i], "-display")
6035c4bbdfSmrg	      || !strcmp (argv[i], "--display")))
6135c4bbdfSmrg	{
6235c4bbdfSmrg	  /* Grab a pointer to the display parameter */
6335c4bbdfSmrg	  pszDisplay = argv[i + 1];
6435c4bbdfSmrg
6535c4bbdfSmrg	  /* Skip the display argument */
6635c4bbdfSmrg	  i++;
6735c4bbdfSmrg	  continue;
6835c4bbdfSmrg	}
6935c4bbdfSmrg
7035c4bbdfSmrg      /* Look for -noprimary */
7135c4bbdfSmrg      if (!strcmp (argv[i], "-noprimary"))
7235c4bbdfSmrg	{
73ed6184dfSmrg	  fPrimarySelection = 0;
7435c4bbdfSmrg	  continue;
7535c4bbdfSmrg	}
7635c4bbdfSmrg
7735c4bbdfSmrg      /* Yack when we find a parameter that we don't know about */
7835c4bbdfSmrg      printf ("Unknown parameter: %s\nExiting.\n", argv[i]);
7935c4bbdfSmrg      exit (1);
8035c4bbdfSmrg    }
8135c4bbdfSmrg
82ed6184dfSmrg  winClipboardProc(pszDisplay, NULL /* Use XAUTHORITY for auth data */);
8335c4bbdfSmrg
8435c4bbdfSmrg  return 0;
8535c4bbdfSmrg}
86