Man page for xcopy

NAME

xcopy - read and write text to/from an X selection from the command line

SYNOPSIS

xcopy [ -r ] [ -u | -c ] [ -C ]

DESCRIPTION

xcopy is a command-line utility for manipulating the X selection.

It has two basic modes. In read mode (xcopy -r), it connects to your X server, retrieves the contents of the selection as plain text, and writes it on standard output. You would then typically redirect its output into a file, or pipe it into some other program.

In write mode (just xcopy, if -r is not specified), it will read data from standard input, then connect to your X server and place that data in the selection as plain text. So you can pipe data into xcopy, move to another application, and press Paste.

The X selection model requires the selection-owning client to remain connected to the server and hand out its data on request. Therefore, xcopy in write mode forks off a background process which does this. The background process terminates once it is no longer the selection owner (i.e. as soon as you select data in another application), or if your X session finishes. Normally you can ignore its presence, although it might become important to be aware of it if (for example) the xcopy background process were to be the last X client still connected through an SSH tunnel.

xcopy currently only handles text data. However, it is capable of handling it in the form of plain text, UTF-8, or compound (multiple-character-set) text. Use the -u, -c and -C options to control this aspect of its behaviour.

OPTIONS

By default (if -r is not supplied), xcopy operates in write mode.

-r
Places xcopy into read mode.

By default (if neither -c nor -u is supplied), xcopy reads and writes the selection using the type STRING, which means that the input or output data is expected to be encoded in ISO-8859-1.

-u
In read mode, causes xcopy to request the selection using the type UTF8_STRING, which typically means that the returned data will be encoded as UTF-8. In write mode, causes xcopy to give out the selection as type UTF8_STRING, meaning that the data piped in to it is expected to be encoded as UTF-8.
-c
Similar to -u, but uses the type COMPOUND_TEXT rather than UTF8_STRING. COMPOUND_TEXT is a complex multi-character-set encoding similar to ISO 2022, and is unlikely to be a very useful form in which to pass data to or from non-X programs. However, it might occasionally be useful to retrieve a compound text selection using xcopy -r -c, and later on return it to the X selection using xcopy -c so it can be pasted back into a different application.

In write mode, if xcopy is operating in STRING mode and a pasting application requests the selection as COMPOUND_TEXT, xcopy will convert the data automatically. This is normally what you want.

-C
Suppresses conversion to compound text in write mode. This is occasionally useful if you are pasting control characters, since the compound text specification forbids any control characters and the Xlib conversion functions honour this. If you are (for example) trying to paste a sequence of editor commands into a terminal window, you might well want to paste a string full of escape sequences and control characters, in which case you may need to use -C to disable conversion to compound text.

BUGS

Occasionally xcopy -r completely fails to notice selection data owned by another process. I have not yet reproduced this reliably; if anyone can, some work with xmon(1) would be much appreciated...

Automatic conversion between compound text and UTF-8 is not currently supported. There are Xlib functions to do it, although they don't appear to work very well (missing out many characters which they could have converted).

LICENCE

xcopy is free software, distributed under the MIT licence. Type xcopy --licence to see the full licence text.


[$Id: xcopy.but 4860 2004-11-21 10:44:14Z simon $]