home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / new / util / edit / jade / src / x11_misc.c < prev    next >
C/C++ Source or Header  |  1994-06-29  |  2KB  |  65 lines

  1. /* x11_misc.c -- Miscellaneous functions for X11
  2.    Copyright (C) 1993, 1994 John Harper <jsh@ukc.ac.uk>
  3.  
  4.    This file is part of Jade.
  5.  
  6.    Jade is free software; you can redistribute it and/or modify it
  7.    under the terms of the GNU General Public License as published by
  8.    the Free Software Foundation; either version 2, or (at your option)
  9.    any later version.
  10.  
  11.    Jade is distributed in the hope that it will be useful, but
  12.    WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.    GNU General Public License for more details.
  15.  
  16.    You should have received a copy of the GNU General Public License
  17.    along with Jade; see the file COPYING.  If not, write to
  18.    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #include "jade.h"
  21. #include "jade_protos.h"
  22.  
  23. #include <string.h>
  24. #include <errno.h>
  25. #include <sys/stat.h>
  26.  
  27. _PR int write_clip(int, char *, int);
  28. _PR VALUE read_clip(int);
  29. _PR void beep(VW *);
  30.  
  31. int
  32. write_clip(int buffer, char *str, int len)
  33. {
  34.     int rc = TRUE;
  35.     if((buffer >= 0) && (buffer <= 7))
  36.     XStoreBuffer(x11_display, str, len, buffer);
  37.     else
  38.     {
  39.     cmd_signal(sym_error, list_2(MKSTR("No cut buffer"), make_number(buffer)));
  40.     rc = FALSE;
  41.     }
  42.     return(rc);
  43. }
  44.  
  45. VALUE
  46. read_clip(int buffer)
  47. {
  48.     if((buffer >= 0) && (buffer <= 7))
  49.     {
  50.     int len;
  51.     u_char *mem = XFetchBuffer(x11_display, &len, buffer);
  52.     if(mem)
  53.         return(string_dupn(mem, len));
  54.     return(NULL);
  55.     }
  56.     cmd_signal(sym_error, list_2(MKSTR("Not cut-buffer"), make_number(buffer)));
  57.     return(NULL);
  58. }
  59.  
  60. void
  61. beep(VW *vw)
  62. {
  63.     XBell(x11_display, 0);
  64. }
  65.