-display patch for xwinclip

Harold L Hunt II huntharo@msu.edu
Wed Jan 8 16:56:00 GMT 2003


Jeremy,

Excellent work!

We need more people like you that just dive in and write a feature when 
they want it, even if they have some hurdles to jump, such as learning 
how to program in C and use diff.  I think you did a spectacular job.

I will commit the patch and release a new version of xwinclip when I get 
a chance.

Harold

Jeremy Wilkins wrote:
> Hi,
> 
> Attached is a patch which adds support for the -display and --display 
> command line parameters to xwinclip.
> 
> Its my first attempt at C coding so I've got no idea if its good coding 
> practice, it runs fine on my machine. It emits a warning when compiling 
> about how I've declared a character array, not sure how to fix this, any 
> suggestions??
> 
> Its diffed against xwinclip-20021229-2344.tar.bz2, not sure if its the 
> correct diff format - never used that before either.
> 
> comments?
> 
> jeremy
> 
> 
> ------------------------------------------------------------------------
> 
> --- xwinclip.c	2002-12-30 04:39:36.000000000 +0000
> +++ xwinclip.new.c	2003-01-08 16:22:44.000000000 +0000
> @@ -159,6 +159,23 @@
>    Bool			fReturn;
>    int			iRetries;
>    Bool			fUnicodeSupport;
> +  char			*displayAddress;
> +  int			iLoop = 1;
> +
> +  /* Sets X server if -display or --display is present */
> +  displayAddress = NULL;
> +  while (iLoop < (argc - 1))
> +    {
> +      if ((!strcmp(argv[iLoop], "-display")) || (!strcmp(argv[iLoop],"--display")))
> +        {
> +          displayAddress = argv[iLoop + 1] ;
> +          iLoop = argc ;
> +        }
> +      else
> +        {
> +          iLoop++ ;
> +        }
> +    }
>  
>    /* Set jump point for IO Error exits */
>    iReturn = setjmp (g_jmpEntry);
> @@ -208,7 +225,7 @@
>    /* Open the X display */
>    do
>      {
> -      pDisplay = XOpenDisplay (NULL);
> +      pDisplay = XOpenDisplay(displayAddress);
>        if (pDisplay == NULL)
>  	{
>  	  printf ("Could not open display, try: %d, sleeping: %d\n",



More information about the Cygwin-xfree mailing list