home *** CD-ROM | disk | FTP | other *** search
- /* x11_misc.c -- Miscellaneous functions for X11
- Copyright (C) 1993, 1994 John Harper <jsh@ukc.ac.uk>
-
- This file is part of Jade.
-
- Jade 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, or (at your option)
- any later version.
-
- Jade 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 Jade; see the file COPYING. If not, write to
- the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
- #include "jade.h"
- #include "jade_protos.h"
-
- #include <string.h>
- #include <errno.h>
- #include <sys/stat.h>
-
- _PR int writeclip(int, char *, int);
- _PR VALUE readclip(int);
- _PR void beep(VW *);
-
- int
- writeclip(int buffer, char *str, int len)
- {
- int rc = TRUE;
- if((buffer >= 0) && (buffer <= 7))
- XStoreBuffer(XDisplay, str, len, buffer);
- else
- {
- cmd_signal(sym_error, list_2(MKSTR("No cut buffer"), newnumber(buffer)));
- rc = FALSE;
- }
- return(rc);
- }
-
- VALUE
- readclip(int buffer)
- {
- if((buffer >= 0) && (buffer <= 7))
- {
- int len;
- u_char *mem = XFetchBuffer(XDisplay, &len, buffer);
- if(mem)
- return(valstrdupn(mem, len));
- return(NULL);
- }
- cmd_signal(sym_error, list_2(MKSTR("Not cut-buffer"), newnumber(buffer)));
- return(NULL);
- }
-
- void
- beep(VW *vw)
- {
- XBell(XDisplay, 0);
- }
-