Hello community,

here is the log from the commit of package xclip for openSUSE:Factory checked 
in at 2017-05-27 13:13:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/xclip (Old)
 and      /work/SRC/openSUSE:Factory/.xclip.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "xclip"

Sat May 27 13:13:45 2017 rev:15 rq:489958 version:0.13

Changes:
--------
--- /work/SRC/openSUSE:Factory/xclip/xclip.changes      2015-09-13 
09:45:13.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.xclip.new/xclip.changes 2017-05-27 
13:13:56.329050830 +0200
@@ -1,0 +2,28 @@
+Sat Apr 22 19:31:26 UTC 2017 - [email protected]
+
+- change homepage and download url to github 
+
+-------------------------------------------------------------------
+Thu Apr 13 15:26:46 UTC 2017 - [email protected]
+
+- Update to 0.13:
+  * Add the remove-last-newline option
+  * Fix the compile warning & build steps, and add .gitignore
+  * An new option "-rmlastnl" is added to remove the last newline
+    character if present.
+  * Before running ./configure, autoreconf is required to generate
+    configuration files.
+  * Add .gitignore
+  * Changing Sourceforge URLs to GitHub.
+  * don't treat TARGETS request as contents request
+  * Document the -noutf8 option.
+  * Minor lang corrections.
+  * Avoid warnings about unused variable; only define html if
+    HAVE_ICONV.
+  * Applied 2924602 - 0005-Added-a-target-command-line-option.patch
+  * Applied 2924602 - 0004-Improved-xclip-s-error-handling.patch
+  * Applied 2924602 - 0003-Added-support-for-printing-more-data-types.patch
+  * Applied 2924602 - 
0002-Added-support-in-xcout-for-receiving-16-and-32-bit-d.patch
+  * Applied 2924602 - 
0001-Added-a-parameter-to-xcout-which-receives-the-type-o.patch
+
+-------------------------------------------------------------------

Old:
----
  xclip-0.12.tar.gz

New:
----
  xclip-0.13.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ xclip.spec ++++++
--- /var/tmp/diff_new_pack.QG3W3K/_old  2017-05-27 13:13:56.880972799 +0200
+++ /var/tmp/diff_new_pack.QG3W3K/_new  2017-05-27 13:13:56.884972234 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package xclip
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,14 +17,18 @@
 
 
 Name:           xclip
-Version:        0.12
+Version:        0.13
 Release:        0
 Summary:        Command Line Interface to the X11 Clipboard
 License:        GPL-2.0+
 Group:          System/X11/Utilities
-Url:            http://sourceforge.net/projects/xclip
-Source:         
http://prdownloads.sourceforge.net/xclip/xclip-%{version}.tar.gz
+Url:            https://github.com/astrand/xclip
+Source:         
https://github.com/astrand/%{name}/archive/%{version}.tar.gz#./%{name}-%{version}.tar.gz
+BuildRequires:  autoconf
+BuildRequires:  automake
+BuildRequires:  xorg-x11-libICE-devel
 BuildRequires:  xorg-x11-libX11-devel
+BuildRequires:  xorg-x11-libXext-devel
 BuildRequires:  xorg-x11-libXmu-devel
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 
@@ -37,6 +41,7 @@
 %setup -q
 
 %build
+bash ./bootstrap
 %configure \
         --x-includes="%{_usr}/include" \
         --x-libraries="%{_usr}/%{_lib}" \
@@ -44,7 +49,7 @@
 make %{?_smp_mflags}
 
 %install
-make DESTDIR=%{buildroot} install %{?_smp_mflags}
+%make_install
 
 %files
 %defattr(-,root,root)
@@ -54,6 +59,6 @@
 %{_bindir}/xclip-cutfile
 %{_bindir}/xclip-pastefile
 %{_mandir}/man1/xclip.1*
-%{_mandir}/man1/xclip-copyfile.1.*
+%{_mandir}/man1/xclip-copyfile.1%{ext_man}
 
 %changelog

++++++ xclip-0.12.tar.gz -> xclip-0.13.tar.gz ++++++
++++ 7410 lines of diff (skipped)
++++    retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xclip-0.12/.gitignore new/xclip-0.13/.gitignore
--- old/xclip-0.12/.gitignore   1970-01-01 01:00:00.000000000 +0100
+++ new/xclip-0.13/.gitignore   2016-09-13 09:09:12.000000000 +0200
@@ -0,0 +1,23 @@
+# autotools generated
+.deps/
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache/
+compile
+config.h
+config.h.in
+config.log
+config.status
+configure
+depcomp
+install-sh
+missing
+stamp-h1
+
+# compiling output
+*.o
+xclip
+
+# temporary files
+*.swp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xclip-0.12/ChangeLog new/xclip-0.13/ChangeLog
--- old/xclip-0.12/ChangeLog    2009-09-27 12:50:24.000000000 +0200
+++ new/xclip-0.13/ChangeLog    2016-09-13 09:09:12.000000000 +0200
@@ -1,3 +1,128 @@
+commit 0a1bbcc10d1a17969587d5995e4d47ca543a129c
+Merge: 1175740 aae47c9
+Author: astrand <[email protected]>
+Date:   Mon Mar 14 10:42:31 2016 +0100
+
+    Merge pull request #23 from hwangcc23/remove_last_newline
+    
+    Add the remove-last-newline option
+
+commit 1175740013bbc4f22c55b894a2367c07c8cf499a
+Merge: e2dd115 e0828ad
+Author: astrand <[email protected]>
+Date:   Mon Mar 14 10:40:14 2016 +0100
+
+    Merge pull request #22 from hwangcc23/fix-warning
+    
+    Fix the compile warning & build steps, and add .gitignore
+
+commit aae47c927a969d48009a7e372331ed17ecc7c80c
+Author: hwangcc23 <[email protected]>
+Date:   Thu Mar 10 09:57:54 2016 +0800
+
+    Add the remove-last-newline option
+    
+    This is an option proposed by Philipp Spitzer.
+    See https://github.com/astrand/xclip/issues/7
+    
+    Use his patch (but only keep code related to the rmlastnl option).
+    An new option "-rmlastnl" is added to remove the last newline character if 
present.
+
+commit e0828ad502287394f1a9ea40f52b5deb013204ad
+Author: hwangcc23 <[email protected]>
+Date:   Wed Mar 9 21:44:41 2016 +0800
+
+    Fix building steps in INSTALL
+    
+    Before running ./configure, autoreconf is required to generate 
configuration files.
+
+commit cde9c46b29216b9aae014dc4ef5b57c8426831b3
+Author: hwangcc23 <[email protected]>
+Date:   Wed Mar 9 21:41:33 2016 +0800
+
+    Fix one compile warning
+    
+    Fix this compile warning:
+    xclip.c: In function 'doIn':
+    xclip.c:302:5: warning: ignoring return value of 'chdir', declared with 
attribute warn_unused_result [-Wunused-result]
+         chdir("/");
+         ^
+
+commit 650dc6278c7f5d1bb79ed284c6883ae2302fbbc5
+Author: hwangcc23 <[email protected]>
+Date:   Wed Mar 9 21:41:13 2016 +0800
+
+    Add .gitignore
+
+commit e2dd115d66ecf5c772fd5359362990c17ee0defd
+Author: Peter Åstrand (astrand) <[email protected]>
+Date:   Tue Feb 2 09:03:12 2016 +0100
+
+    Changing Sourceforge URLs to GitHub.
+
+commit d1f416958743a2c121ea4fa7554b9b19646911fd
+Author: astrand <[email protected]>
+Date:   Sun Feb 9 14:36:26 2014 +0000
+
+    Applied patch from Marcin Szewczyk <[email protected]>:
+    
+     don't treat TARGETS request as contents request
+
+commit 23c15101a77a584b1ae6c996de8aac254135ae16
+Author: astrand <[email protected]>
+Date:   Sun Oct 17 16:53:38 2010 +0000
+
+    Applied patch from Alexia:
+    
+    * Document the -noutf8 option.
+    
+    * Minor lang corrections.
+
+commit c31ad0ac9bef4e4861f2af5cce6079213c787815
+Author: astrand <[email protected]>
+Date:   Mon May 3 18:39:33 2010 +0000
+
+    Avoid warnings about unused variable; only define html if HAVE_ICONV.
+
+commit b8adfb971b99ce8723059aaedd9ecd032561d151
+Author: astrand <[email protected]>
+Date:   Mon May 3 18:38:50 2010 +0000
+
+    Indented
+
+commit d7e6f233c24346b8a1a8a8ccde72fa0bc1cf2a68
+Author: astrand <[email protected]>
+Date:   Fri Apr 30 20:12:25 2010 +0000
+
+    Applied 2924602 - 0005-Added-a-target-command-line-option.patch
+
+commit 743b9d2181f08c9fbc5901e3c15c154ddd9d874e
+Author: astrand <[email protected]>
+Date:   Fri Apr 30 20:11:34 2010 +0000
+
+    Applied 2924602 - 0004-Improved-xclip-s-error-handling.patch
+
+commit 92eac7137a04da6673c92504a7ce75b50522b3a2
+Author: astrand <[email protected]>
+Date:   Fri Apr 30 20:10:29 2010 +0000
+
+    Applied 2924602 - 0003-Added-support-for-printing-more-data-types.patch
+
+commit 5eb998ddaf5f4454d6119466a0e41ded4011912e
+Author: astrand <[email protected]>
+Date:   Fri Apr 30 20:09:50 2010 +0000
+
+    Applied 2924602 - 
0002-Added-support-in-xcout-for-receiving-16-and-32-bit-d.patch
+
+commit be7e3580bfca59f7c78140a80098ec2002538a12
+Author: astrand <[email protected]>
+Date:   Fri Apr 30 20:09:08 2010 +0000
+
+    Applied 2924602 - 
0001-Added-a-parameter-to-xcout-which-receives-the-type-o.patch
+
+
+=== Old ChangeLog ===
+
 Version 0.12 (Peter Åstrand)
        Build fixes: Check for Xmu and Xt
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xclip-0.12/INSTALL new/xclip-0.13/INSTALL
--- old/xclip-0.12/INSTALL      1970-01-01 01:00:00.000000000 +0100
+++ new/xclip-0.13/INSTALL      2016-09-13 09:09:12.000000000 +0200
@@ -0,0 +1,54 @@
+
+
+BUILDING
+========
+
+You should be able to build and install xclip by running the following commands
+in the xclip source directory:
+
+autoreconf             # create configuration files
+./configure            # create the Makefile
+make                   # build the binary
+su                     # su to root to install
+make install           # install xclip
+make install.man       # install man page
+
+This should make and install xclip using the configuration (in terms of install
+directories, libraries, etc) used to build everything else in your X11
+distribution.
+
+REQUIREMENTS
+============
+
+xclip should compile on pretty much any unix-like system. The requirements to
+compile xclip are pretty minimal, if you can compile any X apps at all, you'll
+be able to compile xclip.
+
+This means you will need a C compiler, C development environment, xlib
+development environment, make, etc. All of these should be available as
+packages for most useful distributions.
+
+PLATFORMS
+=========
+
+xclip should compile and work on any unix-like platform, I have taken great
+effort to avoid using anything that isn't absolutely standard.
+
+I have decided that it's not practical to compile a list of specific platforms
+that xclip works on, but it has been known to work on GNU/Linux, Solaris,
+Cygwin and Irix. If you are able to get xclip working on a different platform,
+or have any problems getting it to work on a platform you feel it should work
+on, please drop me an email - I'd be interested to know.
+
+TESTING
+=======
+
+The xctest shell script tests xclip by creating a file, and transferring it
+with xclip -i and xclip -o to put it trough xclip, then making sure that
+xclip -o returns exactly what we put in with xclip -i with diff. It was written
+primarily for my own benefit so that I can quickly test that all xclip features
+are working correctly after I make a change. However, I have included it to
+help out anyone who may be modifying the xclip code themselves.
+
+Basically, when you run xctest, you shouln't see any extra output from diff
+inbetween each test (because the input and output should be identical).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xclip-0.12/README new/xclip-0.13/README
--- old/xclip-0.12/README       2009-08-10 21:04:28.000000000 +0200
+++ new/xclip-0.13/README       2016-09-13 09:09:12.000000000 +0200
@@ -123,7 +123,7 @@
 =======
 
 Web:
-http://xclip.sourceforge.net
+https://github.com/astrand/xclip
 
 Email:
 [email protected]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xclip-0.12/configure.ac new/xclip-0.13/configure.ac
--- old/xclip-0.12/configure.ac 2009-09-27 12:53:08.000000000 +0200
+++ new/xclip-0.13/configure.ac 2016-09-13 09:09:12.000000000 +0200
@@ -1,4 +1,4 @@
-AC_INIT(xclip, 0.12)
+AC_INIT(xclip, 0.13)
 
 AC_CONFIG_SRCDIR([xclip.c])
 
@@ -14,6 +14,9 @@
 AC_CHECK_TOOL(STRIP, strip, :)
 AC_CHECK_HEADER([X11/Xmu/Atoms.h], [], AC_MSG_ERROR([*** X11/Xmu/Atoms.h is 
missing ***]))
 AC_CHECK_HEADER([X11/Intrinsic.h], [], AC_MSG_ERROR([*** X11/Intrinsic.h is 
missing ***]))
+AC_CHECK_HEADER([iconv.h],
+    AC_SEARCH_LIBS([iconv], [iconv],
+        AC_DEFINE([HAVE_ICONV]), []), [])
 AC_CHECK_LIB(Xmu, XmuClientWindow, [], AC_MSG_ERROR([*** libXmu not found 
***]))
 
 AC_OUTPUT(Makefile)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xclip-0.12/indent-all new/xclip-0.13/indent-all
--- old/xclip-0.12/indent-all   1970-01-01 01:00:00.000000000 +0100
+++ new/xclip-0.13/indent-all   2016-09-13 09:09:12.000000000 +0200
@@ -0,0 +1,2 @@
+#!/bin/bash
+indent -i4 -br -l100 -npcs *.c
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xclip-0.12/xclib.c new/xclip-0.13/xclib.c
--- old/xclip-0.12/xclib.c      2009-08-10 21:04:28.000000000 +0200
+++ new/xclip-0.13/xclib.c      2016-09-13 09:09:12.000000000 +0200
@@ -75,6 +75,20 @@
     return (mem);
 }
 
+/* Returns the machine-specific number of bytes per data element
+ * returned by XGetWindowProperty */
+static size_t
+mach_itemsize(int format)
+{
+    if (format == 8)
+       return sizeof(char);
+    if (format == 16)
+       return sizeof(short);
+    if (format == 32)
+       return sizeof(long);
+    return 0;
+}
+
 /* Retrieves the contents of a selections. Arguments are:
  *
  * A display that has been opened.
@@ -87,6 +101,8 @@
  * 
  * The target(UTF8_STRING or XA_STRING) to return 
  *
+ * A pointer to an atom that receives the type of the data
+ *
  * A pointer to a char array to put the selection into.
  * 
  * A pointer to a long to record the length of the char array
@@ -99,19 +115,17 @@
 int
 xcout(Display * dpy,
       Window win,
-      XEvent evt, Atom sel, Atom target, unsigned char **txt, unsigned long 
*len,
+      XEvent evt, Atom sel, Atom target, Atom * type, unsigned char **txt, 
unsigned long *len,
       unsigned int *context)
 {
     /* a property for other windows to put their selection into */
     static Atom pty;
     static Atom inc;
-    Atom pty_type;
-    Atom atomUTF8String;
     int pty_format;
 
     /* buffer for XGetWindowProperty to dump data into */
     unsigned char *buffer;
-    unsigned long pty_size, pty_items;
+    unsigned long pty_size, pty_items, pty_machsize;
 
     /* local buffer of text to return */
     unsigned char *ltxt = *txt;
@@ -139,13 +153,12 @@
        return (0);
 
     case XCLIB_XCOUT_SENTCONVSEL:
-       atomUTF8String = XInternAtom(dpy, "UTF8_STRING", False);
        if (evt.type != SelectionNotify)
            return (0);
 
-       /* fallback to XA_STRING when UTF8_STRING failed */
-       if (target == atomUTF8String && evt.xselection.property == None) {
-           *context = XCLIB_XCOUT_FALLBACK;
+       /* return failure when the current target failed */
+       if (evt.xselection.property == None) {
+           *context = XCLIB_XCOUT_BAD_TARGET;
            return (0);
        }
 
@@ -156,10 +169,10 @@
                           0,
                           0,
                           False,
-                          AnyPropertyType, &pty_type, &pty_format, &pty_items, 
&pty_size, &buffer);
+                          AnyPropertyType, type, &pty_format, &pty_items, 
&pty_size, &buffer);
        XFree(buffer);
 
-       if (pty_type == inc) {
+       if (*type == inc) {
            /* start INCR mechanism by deleting property */
            XDeleteProperty(dpy, win, pty);
            XFlush(dpy);
@@ -167,15 +180,6 @@
            return (0);
        }
 
-       /* if it's not incr, and not format == 8, then there's
-        * nothing in the selection (that xclip understands,
-        * anyway)
-        */
-       if (pty_format != 8) {
-           *context = XCLIB_XCOUT_NONE;
-           return (0);
-       }
-
        /* not using INCR mechanism, just read the property */
        XGetWindowProperty(dpy,
                           win,
@@ -183,17 +187,20 @@
                           0,
                           (long) pty_size,
                           False,
-                          AnyPropertyType, &pty_type, &pty_format, &pty_items, 
&pty_size, &buffer);
+                          AnyPropertyType, type, &pty_format, &pty_items, 
&pty_size, &buffer);
 
        /* finished with property, delete it */
        XDeleteProperty(dpy, win, pty);
 
+       /* compute the size of the data buffer we received */
+       pty_machsize = pty_items * mach_itemsize(pty_format);
+
        /* copy the buffer to the pointer for returned data */
-       ltxt = (unsigned char *) xcmalloc(pty_items);
-       memcpy(ltxt, buffer, pty_items);
+       ltxt = (unsigned char *) xcmalloc(pty_machsize);
+       memcpy(ltxt, buffer, pty_machsize);
 
        /* set the length of the returned data */
-       *len = pty_items;
+       *len = pty_machsize;
        *txt = ltxt;
 
        /* free the buffer */
@@ -227,18 +234,7 @@
                           0,
                           False,
                           AnyPropertyType,
-                          &pty_type,
-                          &pty_format, &pty_items, &pty_size, (unsigned char 
**) &buffer);
-
-       if (pty_format != 8) {
-           /* property does not contain text, delete it
-            * to tell the other X client that we have read
-            * it and to send the next property
-            */
-           XFree(buffer);
-           XDeleteProperty(dpy, win, pty);
-           return (0);
-       }
+                          type, &pty_format, &pty_items, &pty_size, (unsigned 
char **) &buffer);
 
        if (pty_size == 0) {
            /* no more data, exit from loop */
@@ -264,21 +260,23 @@
                           (long) pty_size,
                           False,
                           AnyPropertyType,
-                          &pty_type,
-                          &pty_format, &pty_items, &pty_size, (unsigned char 
**) &buffer);
+                          type, &pty_format, &pty_items, &pty_size, (unsigned 
char **) &buffer);
+
+       /* compute the size of the data buffer we received */
+       pty_machsize = pty_items * mach_itemsize(pty_format);
 
        /* allocate memory to accommodate data in *txt */
        if (*len == 0) {
-           *len = pty_items;
+           *len = pty_machsize;
            ltxt = (unsigned char *) xcmalloc(*len);
        }
        else {
-           *len += pty_items;
+           *len += pty_machsize;
            ltxt = (unsigned char *) xcrealloc(ltxt, *len);
        }
 
        /* add data to ltxt */
-       memcpy(&ltxt[*len - pty_items], buffer, pty_items);
+       memcpy(&ltxt[*len - pty_machsize], buffer, pty_machsize);
 
        *txt = ltxt;
        XFree(buffer);
@@ -413,6 +411,10 @@
        XSendEvent(dpy, evt.xselectionrequest.requestor, 0, 0, &res);
        XFlush(dpy);
 
+       /* don't treat TARGETS request as contents request */
+       if (evt.xselectionrequest.target == targets)
+           return 0;
+
        /* if len < chunk_size, then the data was sent all at
         * once and the transfer is now complete, return 1
         */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xclip-0.12/xclib.h new/xclip-0.13/xclib.h
--- old/xclip-0.12/xclib.h      2009-08-10 21:04:28.000000000 +0200
+++ new/xclip-0.13/xclib.h      2016-09-13 09:09:12.000000000 +0200
@@ -25,7 +25,7 @@
 #define XCLIB_XCOUT_NONE       0       /* no context */
 #define XCLIB_XCOUT_SENTCONVSEL        1       /* sent a request */
 #define XCLIB_XCOUT_INCR       2       /* in an incr loop */
-#define XCLIB_XCOUT_FALLBACK   3       /* UTF8_STRING failed, need fallback to 
XA_STRING */
+#define XCLIB_XCOUT_BAD_TARGET 3       /* given target failed */
 
 /* xcin() contexts */
 #define XCLIB_XCIN_NONE                0
@@ -39,6 +39,7 @@
        XEvent,
        Atom,
        Atom,
+       Atom*,
        unsigned char**,
        unsigned long*,
        unsigned int*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xclip-0.12/xclip.1 new/xclip-0.13/xclip.1
--- old/xclip-0.12/xclip.1      2009-08-10 21:15:26.000000000 +0200
+++ new/xclip-0.13/xclip.1      2016-09-13 09:09:12.000000000 +0200
@@ -30,14 +30,20 @@
 read text into X selection from standard input or files (default)
 .TP
 \fB\-o\fR, \fB\-out\fR
-prints the selection to standard out (generally for piping to a file or 
program)
+print the selection to standard out (generally for piping to a file or program)
 .TP
 \fB\-f\fR, \fB\-filter\fR
 when xclip is invoked in the in mode with output level set to silent (the 
defaults), the filter option will cause xclip to print the text piped to 
standard in back to standard out unmodified
 .TP
+\fB\-r\fR, \fB\-rmlastnl\fR
+when the last character of the selection is a newline character, remove it. 
Newline characters that are not the last character in the selection are not 
affected. If the selection does not end with a newline character, this option 
has no effect. This option is useful for copying one-line output of programs 
like \fBpwd\fR to the clipboard to paste it again into the command prompt 
without executing the line immideately due to the newline character \fBpwd\fR 
appends.
+.TP
 \fB\-l\fR, \fB\-loops\fR
 number of X selection requests (pastes into X applications) to wait for before 
exiting, with a value of 0 (default) causing xclip to wait for an unlimited 
number of requests until another application (possibly another invocation of 
xclip) takes ownership of the selection
 .TP
+\fB\-t\fR, \fB\-target\fR
+specify a particular data format using the given target atom.  With \fB\-o\fR 
the special target atom name "TARGETS" can be used to get a list of valid 
target atoms for this selection.  For more information about target atoms refer 
to ICCCM section 2.6.2
+.TP
 \fB\-d\fR, \fB\-display\fR
 X display to use (e.g. "localhost:0"), xclip defaults to the value in 
$\fBDISPLAY\fR if this option is omitted
 .TP
@@ -51,13 +57,17 @@
 show version information
 .TP
 \fB\-silent\fR
-forks into the background to wait for requests, no informational output, 
errors only (default)
+fork into the background to wait for requests, no informational output, errors 
only (default)
 .TP
 \fB\-quiet\fR
 show informational messages on the terminal and run in the foreground
 .TP
 \fB\-verbose\fR
 provide a running commentary of what xclip is doing
+.TP
+\fB\-noutf8\fR
+operate in legacy (i.e. non UTF-8) mode for backwards compatibility
+(Use this option only when really necessary, as the old behavior was broken)
 
 .PP
 xclip reads text from standard in or files and makes it available to other X 
applications for pasting as an X selection (traditionally with the middle mouse 
button). It reads from all files specified, or from standard in if no files are 
specified. xclip can also print the contents of a selection to standard out 
with the
@@ -88,6 +98,10 @@
 .PP
 Put the contents of the selection into a file.
 
+.B xclip -t text/html index.html
+.PP
+Middle click in an X application supporting HTML to paste the contents of the 
given file as HTML.
+
 .SH ENVIRONMENT
 .TP
 .SM
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xclip-0.12/xclip.c new/xclip-0.13/xclip.c
--- old/xclip-0.12/xclip.c      2009-09-27 12:43:25.000000000 +0200
+++ new/xclip-0.13/xclip.c      2016-09-13 09:09:12.000000000 +0200
@@ -23,6 +23,10 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <ctype.h>
+#ifdef HAVE_ICONV
+#include <errno.h>
+#include <iconv.h>
+#endif
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
 #include <X11/Xmu/Atoms.h>
@@ -31,7 +35,7 @@
 #include "xclib.h"
 
 /* command line option table for XrmParseCommand() */
-XrmOptionDescRec opt_tab[12];
+XrmOptionDescRec opt_tab[14];
 
 /* Options that get set on the command line */
 int sloop = 0;                 /* number of loops */
@@ -43,6 +47,7 @@
 static int fverb = OSILENT;    /* output level */
 static int fdiri = T;          /* direction is in */
 static int ffilt = F;          /* filter mode */
+static int frmnl = F;          /* remove (single) newline character at the 
very end if present */
 
 Display *dpy;                  /* connection to X11 display */
 XrmDatabase opt_db = NULL;     /* database for options */
@@ -96,6 +101,12 @@
            ffilt = T;
     }
 
+    /* set "remove last newline character if present" mode */
+    if (XrmGetResource(opt_db, "xclip.rmlastnl", "Xclip.RmLastNl", &rec_typ, 
&rec_val)
+       ) {
+       frmnl = T;
+    }
+
     /* check for -help and -version */
     if (XrmGetResource(opt_db, "xclip.print", "Xclip.Print", &rec_typ, 
&rec_val)
        ) {
@@ -174,9 +185,9 @@
     }
 }
 
-/* process noutf8 command line option */
+/* process noutf8 and target command line options */
 static void
-doOptNoUtf8(void)
+doOptTarget(void)
 {
     /* check for -noutf8 */
     if (XrmGetResource(opt_db, "xclip.noutf8", "Xclip.noutf8", &rec_typ, 
&rec_val)
@@ -184,6 +195,12 @@
        if (fverb == OVERBOSE)  /* print in verbose mode only */
            fprintf(stderr, "Using old UNICODE instead of UTF8.\n");
     }
+    else if (XrmGetResource(opt_db, "xclip.target", "Xclip.Target", &rec_typ, 
&rec_val)
+       ) {
+       target = XInternAtom(dpy, rec_val.addr, False);
+       if (fverb == OVERBOSE)  /* print in verbose mode only */
+           fprintf(stderr, "Using %s.\n", rec_val.addr);
+    }
     else {
        target = XA_UTF8_STRING(dpy);
        if (fverb == OVERBOSE)  /* print in verbose mode only */
@@ -191,7 +208,7 @@
     }
 }
 
-static void
+static int
 doIn(Window win, const char *progname)
 {
     unsigned char *sel_buf;    /* buffer for selection data */
@@ -214,7 +231,7 @@
            if ((fil_handle = fopen(fil_names[fil_current], "r")) == NULL) {
                errperror(3, progname, ": ", fil_names[fil_current]
                    );
-               exit(EXIT_FAILURE);
+               return EXIT_FAILURE;
            }
            else {
                /* file opened successfully. Print
@@ -243,6 +260,11 @@
        }
     } while (fil_current < fil_number);
 
+    /* remove the last newline character if necessary */
+    if (frmnl && sel_len && sel_buf[sel_len - 1] == '\n') {
+       sel_len--;
+    }
+
     /* if there are no files being read from (i.e., input
      * is from stdin not files, and we are in filter mode,
      * spit all the input back out to stdout
@@ -255,7 +277,7 @@
     /* Handle cut buffer if needed */
     if (sseln == XA_STRING) {
        XStoreBuffer(dpy, (char *) sel_buf, (int) sel_len, 0);
-       return;
+       return EXIT_SUCCESS;
     }
 
     /* take control of the selection so that we receive
@@ -289,7 +311,10 @@
     }
 
     /* Avoid making the current directory in use, in case it will need to be 
umounted */
-    chdir("/");
+    if (chdir("/") == -1) {
+       errperror(3, progname, ": ", "chdir to \"/\"");
+       return EXIT_FAILURE;
+    }
 
     /* loop and wait for the expected number of
      * SelectionRequest events
@@ -326,7 +351,7 @@
                clear = 1;
 
            if ((context == XCLIB_XCIN_NONE) && clear)
-               exit(EXIT_SUCCESS);
+               return EXIT_SUCCESS;
 
            if (finished)
                break;
@@ -334,11 +359,86 @@
 
        dloop++;                /* increment loop counter */
     }
+
+    return EXIT_SUCCESS;
 }
 
 static void
+printSelBuf(FILE * fout, Atom sel_type, unsigned char *sel_buf, size_t sel_len)
+{
+#ifdef HAVE_ICONV
+    Atom html = XInternAtom(dpy, "text/html", True);
+#endif
+
+    if (fverb == OVERBOSE) {   /* print in verbose mode only */
+       char *atom_name = XGetAtomName(dpy, sel_type);
+       fprintf(stderr, "Type is %s.\n", atom_name);
+       XFree(atom_name);
+    }
+
+    if (sel_type == XA_INTEGER) {
+       /* if the buffer contains integers, print them */
+       long *long_buf = (long *) sel_buf;
+       size_t long_len = sel_len / sizeof(long);
+       while (long_len--)
+           fprintf(fout, "%ld\n", *long_buf++);
+       return;
+    }
+
+    if (sel_type == XA_ATOM) {
+       /* if the buffer contains atoms, print their names */
+       Atom *atom_buf = (Atom *) sel_buf;
+       size_t atom_len = sel_len / sizeof(Atom);
+       while (atom_len--) {
+           char *atom_name = XGetAtomName(dpy, *atom_buf++);
+           fprintf(fout, "%s\n", atom_name);
+           XFree(atom_name);
+       }
+       return;
+    }
+
+#ifdef HAVE_ICONV
+    if (html != None && sel_type == html) {
+       /* if the buffer contains UCS-2 (UTF-16), convert to
+        * UTF-8.  Mozilla-based browsers do this for the
+        * text/html target.
+        */
+       iconv_t cd;
+       char *sel_charset = NULL;
+       if (sel_buf[0] == 0xFF && sel_buf[1] == 0xFE)
+           sel_charset = "UTF-16LE";
+       else if (sel_buf[0] == 0xFE && sel_buf[1] == 0xFF)
+           sel_charset = "UTF-16BE";
+
+       if (sel_charset != NULL && (cd = iconv_open("UTF-8", sel_charset)) != 
(iconv_t) - 1) {
+           char *out_buf_start = malloc(sel_len), *in_buf = (char *) sel_buf + 
2,
+               *out_buf = out_buf_start;
+           size_t in_bytesleft = sel_len - 2, out_bytesleft = sel_len;
+
+           while (iconv(cd, &in_buf, &in_bytesleft, &out_buf, &out_bytesleft) 
== -1
+                  && errno == E2BIG) {
+               fwrite(out_buf_start, sizeof(char), sel_len - out_bytesleft, 
fout);
+               out_buf = out_buf_start;
+               out_bytesleft = sel_len;
+           }
+           if (out_buf != out_buf_start)
+               fwrite(out_buf_start, sizeof(char), sel_len - out_bytesleft, 
fout);
+
+           free(out_buf_start);
+           iconv_close(cd);
+           return;
+       }
+    }
+#endif
+
+    /* otherwise, print the raw buffer out */
+    fwrite(sel_buf, sizeof(char), sel_len, fout);
+}
+
+static int
 doOut(Window win)
 {
+    Atom sel_type = None;
     unsigned char *sel_buf;    /* buffer for selection data */
     unsigned long sel_len = 0; /* length of sel_buf */
     XEvent evt;                        /* X Event Structures */
@@ -353,13 +453,22 @@
                XNextEvent(dpy, &evt);
 
            /* fetch the selection, or part of it */
-           xcout(dpy, win, evt, sseln, target, &sel_buf, &sel_len, &context);
+           xcout(dpy, win, evt, sseln, target, &sel_type, &sel_buf, &sel_len, 
&context);
 
-           /* fallback is needed. set XA_STRING to target and restart the 
loop. */
-           if (context == XCLIB_XCOUT_FALLBACK) {
-               context = XCLIB_XCOUT_NONE;
-               target = XA_STRING;
-               continue;
+           if (context == XCLIB_XCOUT_BAD_TARGET) {
+               if (target == XA_UTF8_STRING(dpy)) {
+                   /* fallback is needed. set XA_STRING to target and restart 
the loop. */
+                   context = XCLIB_XCOUT_NONE;
+                   target = XA_STRING;
+                   continue;
+               }
+               else {
+                   /* no fallback available, exit with failure */
+                   char *atom_name = XGetAtomName(dpy, target);
+                   fprintf(stderr, "Error: target %s not available\n", 
atom_name);
+                   XFree(atom_name);
+                   return EXIT_FAILURE;
+               }
            }
 
            /* only continue if xcout() is doing something */
@@ -368,16 +477,23 @@
        }
     }
 
+    /* remove the last newline character if necessary */
+    if (frmnl && sel_len && sel_buf[sel_len - 1] == '\n') {
+       sel_len--;
+    }
+
     if (sel_len) {
        /* only print the buffer out, and free it, if it's not
         * empty
         */
-       fwrite(sel_buf, sizeof(char), sel_len, stdout);
+       printSelBuf(stdout, sel_type, sel_buf, sel_len);
        if (sseln == XA_STRING)
            XFree(sel_buf);
        else
            free(sel_buf);
     }
+
+    return EXIT_SUCCESS;
 }
 
 int
@@ -385,12 +501,13 @@
 {
     /* Declare variables */
     Window win;                        /* Window */
+    int exit_code;
 
     /* set up option table. I can't figure out a better way than this to
      * do it while sticking to pure ANSI C. The option and specifier
      * members have a type of volatile char *, so they need to be allocated
      * by strdup or malloc, you can't set them to a string constant at
-     * declare time, this is note pure ANSI C apparently, although it does
+     * declare time, this is not pure ANSI C apparently, although it does
      * work with gcc
      */
 
@@ -466,6 +583,18 @@
     opt_tab[11].argKind = XrmoptionNoArg;
     opt_tab[11].value = (XPointer) xcstrdup("N");
 
+    /* target option entry */
+    opt_tab[12].option = xcstrdup("-target");
+    opt_tab[12].specifier = xcstrdup(".target");
+    opt_tab[12].argKind = XrmoptionSepArg;
+    opt_tab[12].value = (XPointer) NULL;
+
+    /* "remove newline if it is the last character" entry */
+    opt_tab[13].option = xcstrdup("-rmlastnl");
+    opt_tab[13].specifier = xcstrdup(".rmlastnl");
+    opt_tab[13].argKind = XrmoptionNoArg;
+    opt_tab[13].value = (XPointer) xcstrdup(ST);
+
     /* parse command line options */
     doOptMain(argc, argv);
 
@@ -483,8 +612,8 @@
     /* parse selection command line option */
     doOptSel();
 
-    /* parse noutf8 command line option */
-    doOptNoUtf8();
+    /* parse noutf8 and target command line options */
+    doOptTarget();
 
     /* Create a window to trap events */
     win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 1, 1, 0, 0, 
0);
@@ -493,13 +622,13 @@
     XSelectInput(dpy, win, PropertyChangeMask);
 
     if (fdiri)
-       doIn(win, argv[0]);
+       exit_code = doIn(win, argv[0]);
     else
-       doOut(win);
+       exit_code = doOut(win);
 
     /* Disconnect from the X server */
     XCloseDisplay(dpy);
 
     /* exit */
-    return (EXIT_SUCCESS);
+    return exit_code;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xclip-0.12/xclip.spec new/xclip-0.13/xclip.spec
--- old/xclip-0.12/xclip.spec   2009-09-27 12:53:24.000000000 +0200
+++ new/xclip-0.13/xclip.spec   2016-09-13 09:09:12.000000000 +0200
@@ -1,11 +1,11 @@
 Name:          xclip
-Version:       0.12
+Version:       0.13
 Release:       1%{?dist}
 License:       GPLv2+
 Group:         Applications/System
 Summary:       Command line clipboard grabber
-URL:           http://sourceforge.net/projects/xclip
-Source0:       http://downloads.sourceforge.net/xclip/%{name}-%{version}.tar.gz
+URL:           https://github.com/astrand/xclip
+Source0:       https://github.com/astrand/xclip/archive/%{version}.tar.gz
 BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:  libXmu-devel, libICE-devel, libX11-devel, libXext-devel
 Packager: Peter Åstrand <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xclip-0.12/xcprint.c new/xclip-0.13/xcprint.c
--- old/xclip-0.12/xcprint.c    2009-08-10 21:04:28.000000000 +0200
+++ new/xclip-0.13/xcprint.c    2016-09-13 09:09:12.000000000 +0200
@@ -47,6 +47,8 @@
            "      -selection   selection to access (\"primary\", "
            "\"secondary\", \"clipboard\" or \"buffer-cut\")\n"
            "      -noutf8      don't treat text as utf-8, use old unicode\n"
+           "      -target      use the given target atom\n"
+           "      -rmlastnl    remove the last newline charater if present\n"
            "      -version     version information\n"
            "      -silent      errors only, run in background (default)\n"
            "      -quiet       run in foreground, show what's happening\n"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xclip-0.12/xctest new/xclip-0.13/xctest
--- old/xclip-0.12/xctest       1970-01-01 01:00:00.000000000 +0100
+++ new/xclip-0.13/xctest       2016-09-13 09:09:12.000000000 +0200
@@ -0,0 +1,96 @@
+#!/bin/sh
+#
+#  
+# 
+#  xctest - shell script to test xclip
+#  Copyright (C) 2001 Kim Saunders
+# 
+#  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 this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+delay=1 # seconds to wait before running xclip -o
+
+# test to make sure ./xclip exists
+if [ ! -f xclip ];
+then
+       echo "Error: xclip doesn't exist in the current directory."
+       exit
+fi
+
+checker=""
+
+for param in $@;
+do
+       case $param in
+               --valgrind) checker="valgrind --num-callers=8";;
+       esac
+done
+
+# test xclip on different amounts of data to bring out any errors
+for lines in 2 16 128 1024 8192
+do
+       # temp file names (in and out)
+       tempi=`mktemp` || exit 1
+       tempo=`mktemp` || exit 1
+
+       linec=0 # current line of file in while loop
+
+       # append lines two at a time to input temp file
+       while [ $linec -lt `expr $lines / 2` ]
+       do
+               echo -n -e "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\n" >> $tempi
+               echo -n -e "abcdefghijklmnopqrstuvwzyz!@#$%^&*()\n" >> $tempi
+               linec=$(($linec+1))
+       done
+
+       # test piping the file to xclip, using all selections
+       echo Piping a $lines line file to xclip
+       for sel in primary secondary clipboard buffer
+       do
+               echo "  Using the $sel selection"
+               cat $tempi | $checker ./xclip -sel $sel -i
+               sleep $delay
+               $checker ./xclip -sel $sel -o > $tempo
+               diff $tempi $tempo
+       done
+       echo
+
+       # test xclip reading the file
+       echo Reading a $lines line file with xclip
+       for sel in primary secondary clipboard buffer
+       do
+               echo "  Using the $sel selection"
+               $checker ./xclip -sel $sel -i $tempi
+               sleep $delay
+               $checker ./xclip -sel $sel -o > $tempo
+               diff $tempi $tempo
+       done
+       echo
+       
+       # test xclip filtering a file
+       echo Filtering a $lines line file through xclip
+       for sel in primary secondary clipboard buffer
+       do
+               echo "  Using the $sel selection"
+               $checker ./xclip -sel $sel -f < $tempi > $tempo
+               sleep $delay
+               diff $tempi $tempo
+       done
+       echo
+
+       # quietly remove temp files
+       rm $tempi $tempo 2> /dev/null
+done
+
+# Kill any remain xclip processes
+killall xclip


Reply via email to