Blob


1 .TH GETSNARF 3
2 .SH NAME
3 getsnarf, putsnarf \- window system snarf (cut and paste) buffer
4 .SH SYNOPSIS
5 .B #include <draw.h>
6 .PP
7 .B
8 char *getsnarf(void)
9 .PP
10 .B
11 void putsnarf(char *text)
12 .SH DESCRIPTION
13 .I Getsnarf
14 and
15 .I putsnarf
16 access the window system's snarf (cut and paste) buffer.
17 .PP
18 .I Getsnarf
19 returns a copy of the current buffer;
20 the returned pointer should be freed with
21 .I free
22 (see
23 .IR malloc (3))
24 when no longer needed.
25 .PP
26 .I Putsnarf
27 sets the buffer to the text string
28 .IR text .
29 .PP
30 Callers should assume that the snarf buffer is UTF.
31 If the window system does not keep the buffer in UTF,
32 .I getsnarf
33 and
34 .I putsnarf
35 will convert as necessary.
36 .SH SOURCE
37 .B \*9/src/libdraw/x11-itrans.c
38 .SH SEE ALSO
39 .IR snarfer (1)
40 .SH BUGS
41 On OS X, there are two snarf buffers: the Carbon snarf buffer
42 used by native OS X applications, and the X11 snarf buffer,
43 used by X11 applications.
44 Whenever new text is written to the Carbon snarf buffer, the OS X X11
45 implementation automatically copies that text to the X11 snarf buffer.
46 The reverse is not done automatically, arguably a bug in the X11 server.
47 To work around this,
48 .I putsnarf
49 writes to both the Carbon snarf buffer and the X11 snarf buffer.
50 To work around this bug in remote or non-Plan 9 X11 clients, run
51 .IR snarfer (1).