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",


Reply via email to