public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Clipboard from Cygwin?
@ 2000-05-29 18:21 Alexander Anderson
  2000-05-30  6:53 ` Chris Faylor
  0 siblings, 1 reply; 17+ messages in thread
From: Alexander Anderson @ 2000-05-29 18:21 UTC (permalink / raw)
  To: cygwin

Dear All,


    I use NT4 (ServicePack 3) for texty, webby design stuff.


    I   got  Cygwin  B20  to  work  on  my  system,  primarily  to  help
intelligently batch-process all the html documents I've got to deal with
and amend.


    Now  that I've got Cygwin configured properly, I think Cygwin's Unix
user tools are absolutely fantastic.  Infinitely more useful than NT DOS
at any rate.


    The question I have is:


    If  I  have some text (this letter say) in the clipboard and want to
run a shellscript that takes input from the clipboard  (and  formats  it
left-right justified with nroff say), how is that done?


    Presumably  _one_  way  would be to have a Cygwin "clipboard" device
that you redirect from and to.  I guess  that  other  people  must  have
asked  this question before, but I can't find "clipboard" (or "clip") in
the FAQ:


        http://sourceware.cygnus.com/cygwin/faq/faq.html


With kind regards,


Sandy
-- 
Alexander Anderson

mailto :     lists  at  almide period demon period co dot uk
bud-nav:     http://www.explosive-alma-services-bolts.co.uk/
pgp-sig:  1B5A DF3D A3D9 B932 39EB  3F1B 981F 4110 27E1 64A4


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Clipboard from Cygwin?
  2000-05-29 18:21 Clipboard from Cygwin? Alexander Anderson
@ 2000-05-30  6:53 ` Chris Faylor
  0 siblings, 0 replies; 17+ messages in thread
From: Chris Faylor @ 2000-05-30  6:53 UTC (permalink / raw)
  To: cygwin

On Tue, May 30, 2000 at 02:21:04AM +0100, Alexander Anderson wrote:
>    If  I  have some text (this letter say) in the clipboard and want to
>run a shellscript that takes input from the clipboard  (and  formats  it
>left-right justified with nroff say), how is that done?

There is no way to do this with Cygwin.  It really doesn't fall into the
category of a "UNIX emulation".

cgf

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Clipboard from Cygwin?
  2000-08-02 11:59         ` Charles Wilson
@ 2000-08-02 17:28           ` Charles Wilson
  0 siblings, 0 replies; 17+ messages in thread
From: Charles Wilson @ 2000-08-02 17:28 UTC (permalink / raw)
  To: cygwin

I dug around in my old code archives, and found the following (after a
little cleanup). It may help someone add write capability to the
/dev/clipboard.

--Chuck

#include <windows.h>
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#define CLIPCHUNK 1024
int main()
{
   HANDLE hData;  /* handle to clip data */
   LPSTR lpData;  /* pointer to clip data */
   LPSTR lpszText;
   char chunk[CLIPCHUNK+1];
   char *buf = NULL;
   char *buf_old = NULL;
   char *ptr;
   int len = 0;
   int numread;

   /* Since we have to copy to the clipboard all in one step,
      read entire stream into memory. However, let's try to 
      do this using the minimum amount of memory, but keep 
      allocating more if needed.
   */
   do
   {
      numread = fread(chunk,sizeof(char),CLIPCHUNK,stdin);
      if(numread > 0)
      {
	 if (buf)
	 {
	    if ((buf_old = malloc (len * sizeof(char))) == NULL)
	    {
	       fprintf(stderr,"internal error - out of memory");
	       return(FALSE);
	    }
	    memcpy(buf_old, buf, len);
	    free(buf);
	 }
         if ((buf = malloc ((len+numread) * sizeof(char))) == NULL)
	 {
	    fprintf(stderr,"internal error - out of memory");
	    return(FALSE);
	 }
	 if (buf_old)
	 {
	    memcpy(buf,buf_old,len);
	    free(buf_old);
	 }
	 ptr = &(buf[len]);
	 memcpy(ptr,chunk,numread);
	 len += numread;
      }
   }
   while(!feof(stdin) && !ferror(stdin));

   /* Allocate memory and copy the string to it */
   if (!(hData 
	 = GlobalAlloc(GHND, len+1))) {
      return (TRUE);
   }
   if (!(lpData = GlobalLock(hData))) {
      return (TRUE);
   }

   strcpy((char *)lpData, buf);
   GlobalUnlock(hData);
    
   /* Clear the current contents of the clipboard, and set
    * the data handle to the new string.
    */
   
   if (OpenClipboard(0)) {
      EmptyClipboard();
      SetClipboardData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`@OED_LJ*G0.O^^4[J%VFUD%BE<
M!-IVO:%CK8'[HT0U:"**_36$PZ*T3YVJG?HQVE;*^8O!V=UD^',2PSH<("2Z
8PM?^CN9YX+==SZ_(7/7^`&.H&'3=!@``
`
end

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Clipboard from Cygwin?
  2000-08-01 19:26       ` DJ Delorie
  2000-08-02  0:21         ` Corinna Vinschen
@ 2000-08-02 11:59         ` Charles Wilson
  2000-08-02 17:28           ` Charles Wilson
  1 sibling, 1 reply; 17+ messages in thread
From: Charles Wilson @ 2000-08-02 11:59 UTC (permalink / raw)
  To: cygwin

Okay, here's the most recent version of my experimental /dev/clipboard
stuff. I'm gonna have to leave off for a while, but I wanted to post it
here so it'd be available if anybody wants to play with it. It compiles
(*) but be warned: the compiled kernel hangs -- this may or may not be
related to the clipboard patch itself.

(*) There are a few build problems with the CVS version of winsup --
that's why there haven't been any snapshots since June 25. DJ & Chris
are working on fixing that. I was able to --build-- by playing a few
games with stuff unrelated to /dev/clipboard. Those 'games' are not
included in the patch below.

Anyway, I'd wait a day or so until the regular CVS version of cygwin is
buildable, and the snapshots show up again, and then start playing with
this stuff.

So, FWIW, here ya go:

contains both a patch and a new file, fhandler_clipboard.cc, that should
be copied into winsup/cygwin. Both are pasted in plaintext below the uue
file.

--Chuck


begin 664 clipboard-patch.tar.gz
M'XL("-ENB#D``V-L:7!B;V%R9"UP871C:"YT87(`[1C];]I8LK_&?\6(;B4H
M!&P^$W*]:TIHDUL2HD`W=Z=*R)AGL&)L[[,=FNWV?]^9L0TVX&VCNTUU4IX$
MSWYOOM[,>#Z>85O>U-7EK.KI@;%X\5<,357;[2:\`-`Z+95G5=5HIJ'5FVH;
MH*,UZPC64ENTU&FT7H#ZETBS-4(_T"7`"V-EV;[KY,)=N8YX"GF>>/P#C(?Y
MRG)JYD)W9K:0$V/M$8:A7#@S\;F;P%SJ=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ginning of patch-------------------------
? cygwin/fhandler_clipboard.cc
Index: cygwin/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/Makefile.in,v
retrieving revision 1.26
diff -u -r1.26 Makefile.in
--- Makefile.in	2000/08/02 16:28:17	1.26
+++ Makefile.in	2000/08/02 18:45:15
@@ -114,18 +114,19 @@
 
 EXTRA_OFILES=$(bupdir1)/libiberty/random.o
$(bupdir1)/libiberty/strsignal.o
 
-DLL_IMPORTS:=$(w32api_lib)/libkernel32.a
+DLL_IMPORTS:=$(w32api_lib)/libkernel32.a $(w32api_lib)/libuser32.a
 
 DLL_OFILES:=assert.o dcrt0.o debug.o delqueue.o dir.o dlfcn.o
dll_init.o \
 	environ.o  errno.o exceptions.o exec.o external.o fcntl.o fhandler.o \
 	fhandler_console.o fhandler_floppy.o fhandler_random.o fhandler_raw.o
\
 	fhandler_serial.o fhandler_tape.o fhandler_termios.o fhandler_tty.o \
-	fhandler_windows.o fhandler_zero.o fork.o glob.o grp.o heap.o hinfo.o
\
-	init.o ioctl.o localtime.o malloc.o mmap.o net.o ntea.o passwd.o \
-	path.o pinfo.o pipe.o poll.o regexp.o regerror.o regsub.o registry.o \
-	resource.o scandir.o security.o select.o shared.o signal.o sigproc.o \
-	smallprint.o spawn.o strace.o strsep.o sync.o syscalls.o sysconf.o \
-	syslog.o termios.o times.o tty.o uinfo.o uname.o wait.o window.o \
+	fhandler_windows.o fhandler_zero.o fhandler_clipboard.o fork.o glob.o
\
+	grp.o heap.o hinfo.o init.o ioctl.o localtime.o malloc.o mmap.o net.o
\
+	ntea.o passwd.o path.o pinfo.o pipe.o poll.o regexp.o regerror.o \
+	regsub.o registry.o resource.o scandir.o security.o select.o shared.o
\
+	signal.o sigproc.o smallprint.o spawn.o strace.o strsep.o sync.o \
+	syscalls.o sysconf.o syslog.o termios.o times.o tty.o uinfo.o uname.o
\
+	wait.o window.o \
 	$(EXTRA_DLL_OFILES) $(EXTRA_OFILES) $(MT_SAFE_OBJECTS)
 
 GMON_OFILES:= gmon.o mcount.o profil.o
@@ -307,6 +308,7 @@
 fhandler_floppy.o: $(WINSUP_H)
 fhandler_tape.o: $(WINSUP_H)
 fhandler_zero.o: $(WINSUP_H)
+fhandler_clipboard.o: $(WINSUP_H)
 fhandler_random.o: $(WINSUP_H)
 fork.o: $(WINSUP_H) dll_init.h
 glob.o: include/glob.h
Index: cygwin/fhandler.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fhandler.h,v
retrieving revision 1.16
diff -u -r1.16 fhandler.h
--- fhandler.h	2000/07/29 04:19:24	1.16
+++ fhandler.h	2000/08/02 18:45:16
@@ -27,6 +27,7 @@
      fhandler_dev_raw     (fhandler_raw.cc)
      fhandler_dev_floppy  (fhandler_floppy.cc)
      fhandler_dev_tape    (fhandler_tape.cc)
+     fhandler_dev_clipboard	(fhandler_clip.cc)
 
      fhandler_pipe
      fhandler_socket      (net.cc)
@@ -94,8 +95,9 @@
   FH_NULL    = 0x00000013,	/* is the null device */
   FH_ZERO    = 0x00000014,	/* is the zero device */
   FH_RANDOM  = 0x00000015,	/* is a random device */
+  FH_CLIPBOARD = 0x00000016,  /* is the windows clipboard */
 
-  FH_NDEV    = 0x00000016,	/* Maximum number of devices */
+  FH_NDEV    = 0x00000017,	/* Maximum number of devices */
   FH_DEVMASK = 0x00000fff,	/* devices live here */
   FH_BAD     = 0xffffffff
 };
@@ -761,6 +763,21 @@
   int dup (fhandler_base *child);
 
   void dump ();
+};
+
+class fhandler_dev_clipboard: public fhandler_base
+{
+public:
+  fhandler_dev_clipboard (const char *name);
+
+  void dump ();
+
+  int is_windows (void) { return 1; }
+  int open (const char *path, int flags, mode_t mode = 0);
+  int write (const void *ptr, size_t len);
+  int read (void *ptr, size_t len);
+  off_t lseek (off_t, int);
+  int close (void);
 };
 
 class fhandler_windows: public fhandler_base
Index: cygwin/hinfo.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/hinfo.cc,v
retrieving revision 1.12
diff -u -r1.12 hinfo.cc
--- hinfo.cc	2000/08/02 16:28:17	1.12
+++ hinfo.cc	2000/08/02 18:45:17
@@ -282,6 +282,9 @@
       case FH_ZERO:
 	fh = new (buf) fhandler_dev_zero (name);
 	break;
+      case FH_CLIPBOARD:
+	fh = new (buf) fhandler_dev_clipboard (name);
+	break;
       case FH_RANDOM:
 	fh = new (buf) fhandler_dev_random (name, unit);
 	break;
Index: cygwin/path.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/path.cc,v
retrieving revision 1.41
diff -u -r1.41 path.cc
--- path.cc	2000/08/02 16:28:17	1.41
+++ path.cc	2000/08/02 18:45:21
@@ -437,6 +437,7 @@
   "\\dev\\st%d",
   "nul",
   "\\dev\\zero",
+  "\\dev\\clipboard",
   "\\dev\\%srandom",
 };
 
@@ -502,6 +503,8 @@
 	devn = FH_NULL;
       else if (deveq ("zero"))
 	devn = FH_ZERO;
+      else if (deveq ("clipboard"))
+	devn = FH_CLIPBOARD;
       else if (deveq ("random") || deveq ("urandom"))
         {
 	  devn = FH_RANDOM;
Index: cygwin/winsup.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/winsup.h,v
retrieving revision 1.25
diff -u -r1.25 winsup.h
--- winsup.h	2000/08/02 16:28:18	1.25
+++ winsup.h	2000/08/02 18:45:24
@@ -72,8 +72,12 @@
 #undef _WINNETWK_H
 #undef _WINSVC_H
 
-/* The one function we use from winuser.h most of the time */
+/* The few functions we use from winuser.h most of the time */
 extern "C" DWORD WINAPI GetLastError (void);
+#define CF_TEXT 1
+extern "C" BOOL WINAPI OpenClipboard(HWND);
+extern "C" HANDLE WINAPI GetClipboardData(UINT);
+extern "C" BOOL WINAPI CloseClipboard(void);
 
 /* Used for runtime OS check/decisions. */
 enum os_type {winNT = 1, win95, win98, win32s, unknown};
-----------------------------end of patch------------------------


----------------------------fhandler_clipboard.cc----------------
/* fhandler_dev_clipboard: code to access /dev/clipboard

   Copyright 2000 Red Hat

   Written by Charles Wilson (cwilson@ece.gatech.edu)

This file is part of Cygwin.

This software is a copyrighted work licensed under the terms of the
Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
details. */

#include <errno.h>
#include "winsup.h"
#include <windows.h>

fhandler_dev_clipboard::fhandler_dev_clipboard (const char *name)
  : fhandler_base (FH_CLIPBOARD, name)
{
  set_cb (sizeof *this);
}

int
fhandler_dev_clipboard::open (const char *, int flags, mode_t)
{
  set_flags (flags);
  return 1;
}

int
fhandler_dev_clipboard::write (const void *, size_t len)
{
  return len;
}

int
fhandler_dev_clipboard::read (void *ptr, size_t len)
{
  HGLOBAL hglb;
  LPSTR lpstr;

  OpenClipboard(0);
  hglb = GetClipboardData(CF_TEXT);
  lpstr = (LPSTR) GlobalLock(hglb);

  len = snprintf((char *) ptr, len, "%s", lpstr);
  GlobalUnlock(hglb);
  CloseClipboard();
  return len;
}

off_t
fhandler_dev_clipboard::lseek (off_t, int)
{
  return 0;
}

int
fhandler_dev_clipboard::close (void)
{
  return 0;
}

void
fhandler_dev_clipboard::dump ()
{
  paranoid_printf("here, fhandler_dev_clipboard");
}
-------------------end of fhandler_clipboard.cc---------

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Clipboard from Cygwin?
  2000-08-02  7:00               ` DJ Delorie
@ 2000-08-02  9:07                 ` Charles Wilson
  0 siblings, 0 replies; 17+ messages in thread
From: Charles Wilson @ 2000-08-02  9:07 UTC (permalink / raw)
  To: DJ Delorie; +Cc: cygwin

DJ Delorie wrote:
> 
> > (Don't let it throw you, that's a different config.h file). The problem
> > is, winsup.h defines __INSIDE_CYGWIN__, but most of the .cc files in
> > winsup include stuff like <errno.h> and <stdlib.h> *before* winsup.h.
> > These <include files> get resolved to the newlib/libc/include directory,
> > and poof: libc/include/sys/config.h gets included but __INSIDE_CYGWIN__
> > hasn't been defined yet.
> 
> Sounds like I need to edit some Makefiles.  Thanks for noticing; I
> only checked that in yesterday!
> 

I should've known better though -- it appears the autobuild hasn't been
able to make a snapshot since July 25, so what was I thinking? I could
just download from CVS and build??!!

Anyway, there must've been something else broken prior to your changes
yesterday; possibly the configure.in thing that Chris mentioned.
However, the patch to fix that was approved & accepted on Jul 30, so I
dunno why it was still necessary for me to remove '-nostdinc' by hand on
Aug 1.

--Chuck

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Clipboard from Cygwin?
  2000-08-01 22:57             ` Charles Wilson
@ 2000-08-02  7:00               ` DJ Delorie
  2000-08-02  9:07                 ` Charles Wilson
  0 siblings, 1 reply; 17+ messages in thread
From: DJ Delorie @ 2000-08-02  7:00 UTC (permalink / raw)
  To: cwilson; +Cc: cygwin

> (Don't let it throw you, that's a different config.h file). The problem
> is, winsup.h defines __INSIDE_CYGWIN__, but most of the .cc files in
> winsup include stuff like <errno.h> and <stdlib.h> *before* winsup.h.
> These <include files> get resolved to the newlib/libc/include directory,
> and poof: libc/include/sys/config.h gets included but __INSIDE_CYGWIN__
> hasn't been defined yet.

Sounds like I need to edit some Makefiles.  Thanks for noticing; I
only checked that in yesterday!

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Clipboard from Cygwin?
  2000-08-01 19:26       ` DJ Delorie
@ 2000-08-02  0:21         ` Corinna Vinschen
  2000-08-02 11:59         ` Charles Wilson
  1 sibling, 0 replies; 17+ messages in thread
From: Corinna Vinschen @ 2000-08-02  0:21 UTC (permalink / raw)
  To: DJ Delorie; +Cc: cygwin

DJ Delorie wrote:
> >    Copyright 2000 Cygnus Solutions.

This is still in the header of each source file. Shouldn't that
be changed throughout, at least for the year 2000?

Corinna

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Clipboard from Cygwin?
  2000-08-01 19:33           ` Chris Faylor
@ 2000-08-01 22:57             ` Charles Wilson
  2000-08-02  7:00               ` DJ Delorie
  0 siblings, 1 reply; 17+ messages in thread
From: Charles Wilson @ 2000-08-01 22:57 UTC (permalink / raw)
  To: cygwin

Chris Faylor wrote:
> 
> On Tue, Aug 01, 2000 at 10:28:12PM -0400, Charles Wilson wrote:
> >I did a cvs checkout of the whole schmeal. Here's my tree:
> 
> Ah.  You've been subjected to recent sourceware breakage.  I should have
> remembered this.  I just "yelled" at someone in gcc-patches about this.
> 
> The patch for this is here:
> 
> http://gcc.gnu.org/ml/gcc-patches/2000-07/msg01217.html
> 
> It should propagate into sourceware soon, I hope.
> 
> You can also get the same effect by removing the -nostdinc from the
> FLAGS_FOR_TARGET that get set in configure.in for cygwin.
> 

Doesn't seem to help. Now I get a bunch of _imp___ctype not found errors
when trying to link cygwin1.dll. I think the problem is related to this:

/src/newlib/libc/include/sys/config.h has this little snippet:

#if defined(__CYGWIN32__) || defined(__CYGWIN__)
#if defined(__INSIDE_CYGWIN__) || defined(_COMPILING_NEWLIB)
#define __IMPORT
#else
#define __IMPORT __declspec(dllimport)
#endif
#endif

/src/newlib/libc/include/ctype.h defines ctype:

extern  __IMPORT _CONST char    _ctype_[];

So it's important that __IMPORT get defined correctly -- that is, that
__INSIDE_CYGWIN__ is defined before anything in newlib/libc/include gets
included. 

winsup.h has the following:

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#define __INSIDE_CYGWIN__

(Don't let it throw you, that's a different config.h file). The problem
is, winsup.h defines __INSIDE_CYGWIN__, but most of the .cc files in
winsup include stuff like <errno.h> and <stdlib.h> *before* winsup.h.
These <include files> get resolved to the newlib/libc/include directory,
and poof: libc/include/sys/config.h gets included but __INSIDE_CYGWIN__
hasn't been defined yet.

I don't know what the right way to fix this is. Help?

--Chuck

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Clipboard from Cygwin?
  2000-08-01 19:25         ` Charles Wilson
@ 2000-08-01 19:33           ` Chris Faylor
  2000-08-01 22:57             ` Charles Wilson
  0 siblings, 1 reply; 17+ messages in thread
From: Chris Faylor @ 2000-08-01 19:33 UTC (permalink / raw)
  To: cygwin

On Tue, Aug 01, 2000 at 10:28:12PM -0400, Charles Wilson wrote:
>I did a cvs checkout of the whole schmeal. Here's my tree:

Ah.  You've been subjected to recent sourceware breakage.  I should have
remembered this.  I just "yelled" at someone in gcc-patches about this.

The patch for this is here:

http://gcc.gnu.org/ml/gcc-patches/2000-07/msg01217.html

It should propagate into sourceware soon, I hope.

You can also get the same effect by removing the -nostdinc from the
FLAGS_FOR_TARGET that get set in configure.in for cygwin.

cgf

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Clipboard from Cygwin?
  2000-08-01 19:10     ` Charles Wilson
  2000-08-01 19:17       ` Chris Faylor
@ 2000-08-01 19:26       ` DJ Delorie
  2000-08-02  0:21         ` Corinna Vinschen
  2000-08-02 11:59         ` Charles Wilson
  1 sibling, 2 replies; 17+ messages in thread
From: DJ Delorie @ 2000-08-01 19:26 UTC (permalink / raw)
  To: cwilson; +Cc: cygwin

> getting errors in the code affected by this patch, but elsewhere:
> missing stdarg.h & stddef.h files...). 

gcc normally provides those.

> Anyway, below there's a patch (that affects pre-existing files in CVS)
> and a new file: fhandler_clipboard.cc. It should do read-only clipboard
> access right now. gzip+uuencode versions pasted below.

What, no write mode?  ;-)

> /* fhandler_dev_handler.cc: code to access /dev/zero

You should change that comment, at least.

>    Copyright 2000 Cygnus Solutions.

We're Red Hat now.

>    Written by DJ Delorie (dj@cygnus.com)

You should substitute your own name and email, of course!

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Clipboard from Cygwin?
  2000-08-01 19:17       ` Chris Faylor
@ 2000-08-01 19:25         ` Charles Wilson
  2000-08-01 19:33           ` Chris Faylor
  0 siblings, 1 reply; 17+ messages in thread
From: Charles Wilson @ 2000-08-01 19:25 UTC (permalink / raw)
  To: cygwin

Chris Faylor wrote:
> 
> >
> >Cool. Here's a first attempt -- but I can't get it to build. (Errors
> >building cygwin, but apparently because I don't know how -- I'm not
> >getting errors in the code affected by this patch, but elsewhere:
> >missing stdarg.h & stddef.h files...).
> >
> >Anyway, below there's a patch (that affects pre-existing files in CVS)
> >and a new file: fhandler_clipboard.cc. It 

> should

> do read-only clipboard
> >access right now. gzip+uuencode versions pasted below.
> 
> How do you know what it can do if you can't compile it?
> 

I didn't claim that. I only said "should".

> You did extract the whole directory tree, right?  You need newlib
> (obviously), libiberty, include, and all of the supporting files in the
> top-level 'sourceware' directory.  You need to build everything in
> a separate directory from source.  You also need to build newlib first
> before you build cygwin or you need to be in the top level directory
> to build everything.

I did a cvs checkout of the whole schmeal. Here's my tree:

/usr/src/cygwin/src/

COPYING         config          include         mkinstalldirs  
setup.com
COPYING.LIB     config-ml.in    install-sh      move-if-change 
symlink-tree
CVS             config.guess    libiberty       mpw-README      winsup
ChangeLog       config.if       ltconfig        mpw-build.in    ylwrap
MAINTAINERS     config.sub      ltmain.sh       mpw-config.in
Makefile        configure       makefile.vms    mpw-configure
Makefile.in     configure.in    missing         mpw-install
README          etc             mkdep           newlib

From within /usr/src/cygwin/obj/ I typed:
 
/usr/src/cygwin/src/configure --prefix=/usr/src/cygwin/install -v >
configure.log 2>&1
make > make.log 2>&1

just like it says in the faq. So, I "was in a separate directory from
source" and I was "in the top level directory" (I guess??)  I'll try it
again building newlib first.

The tail end of my make.log says:

....
make[3]: Entering directory
`/usr/src/cygwin/obj/i686-pc-cygwin/newlib/libc/stdlib'
gcc -L/usr/src/cygwin/obj/i686-pc-cygwin/winsup
-L/usr/src/cygwin/obj/i686-pc-cygwin/winsup/cygwin
-L/usr/src/cygwin/obj/i686-pc-cygwin/winsup/w32api/lib -
isystem /usr/src/cygwin/src/winsup/include -isystem
/usr/src/cygwin/src/winsup/cygwin/include -isystem
/usr/src/cygwin/src/winsup/w32api/include -isystem /
usr/src/cygwin/src/newlib/libc/sys/cygwin -isystem
/usr/src/cygwin/src/newlib/libc/sys/cygwin32 -nostdinc
-B/usr/src/cygwin/obj/i686-pc-cygwin/newlib/ -isy
stem /usr/src/cygwin/obj/i686-pc-cygwin/newlib/targ-include -isystem
/usr/src/cygwin/src/newlib/libc/include -DPACKAGE=\"newlib\"
-DVERSION=\"1.8.2\"  -I. 
-I/usr/src/cygwin/src/newlib/libc/stdlib  -O2 -DHAVE_OPENDIR
-DHAVE_RENAME -DSIGNAL_PROVIDED -DWANT_PRINTF_LONG_LONG
-D_COMPILING_NEWLIB -I../../targ-inclu
de -I/usr/src/cygwin/src/newlib/libc/../libc/include
-I/usr/src/cygwin/src/newlib/libc/../../winsup/cygwin/include 
-I/usr/src/cygwin/src/newlib/libc/../..
/winsup/w32api/include -fno-builtin      -g -O2 -c
/usr/src/cygwin/src/newlib/libc/stdlib/__adjust.c
In file included from
/usr/src/cygwin/src/newlib/libc/../libc/include/sys/reent.h:14,
                 from
/usr/src/cygwin/src/newlib/libc/../libc/include/reent.h:48,
                 from
/usr/src/cygwin/src/newlib/libc/stdlib/__adjust.c:6:
/usr/src/cygwin/src/newlib/libc/../libc/include/time.h:30: stddef.h: No
such file or directory
In file included from
/usr/src/cygwin/src/newlib/libc/stdlib/__adjust.c:6:
/usr/src/cygwin/src/newlib/libc/../libc/include/reent.h:53: stddef.h: No
such file or directory
In file included from /usr/src/cygwin/src/newlib/libc/stdlib/std.h:1,
                 from
/usr/src/cygwin/src/newlib/libc/stdlib/__adjust.c:7:
/usr/src/cygwin/src/newlib/libc/../libc/include/stdlib.h:17: stddef.h:
No such file or directory
In file included from /usr/src/cygwin/src/newlib/libc/stdlib/std.h:2,
                 from
/usr/src/cygwin/src/newlib/libc/stdlib/__adjust.c:7:
/usr/src/cygwin/src/newlib/libc/../libc/include/stdio.h:37: stddef.h: No
such file or directory
/usr/src/cygwin/src/newlib/libc/../libc/include/stdio.h:40: stdarg.h: No
such file or directory
gcc: file path prefix `/usr/src/cygwin/obj/i686-pc-cygwin/newlib/' never
used
make[3]: *** [__adjust.o] Error 1
make[3]: Leaving directory
`/usr/src/cygwin/obj/i686-pc-cygwin/newlib/libc/stdlib'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory
`/usr/src/cygwin/obj/i686-pc-cygwin/newlib/libc'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/cygwin/obj/i686-pc-cygwin/newlib'
make: *** [all-target-newlib] Error 2

--Chuck

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Clipboard from Cygwin?
  2000-08-01 19:10     ` Charles Wilson
@ 2000-08-01 19:17       ` Chris Faylor
  2000-08-01 19:25         ` Charles Wilson
  2000-08-01 19:26       ` DJ Delorie
  1 sibling, 1 reply; 17+ messages in thread
From: Chris Faylor @ 2000-08-01 19:17 UTC (permalink / raw)
  To: cygwin

On Tue, Aug 01, 2000 at 10:13:45PM -0400, Charles Wilson wrote:
>DJ Delorie wrote:
>> > Or better yet, how about implementing a /dev/clipboard like uwin has?
>> 
>> cygwin includes a tutorial on adding device handlers to cygwin1.dll.
>> Why not give it a try?  I'd hate to think I'd wasted all that effort
>> writing a tutorial that nobody uses...
>> 
>> http://sources.redhat.com/cygwin/snapshots/winsup-src-20000725.tar.bz2/winsup/doc/fhandler-tut.txt
>
>Cool. Here's a first attempt -- but I can't get it to build. (Errors
>building cygwin, but apparently because I don't know how -- I'm not
>getting errors in the code affected by this patch, but elsewhere:
>missing stdarg.h & stddef.h files...). 
>
>Anyway, below there's a patch (that affects pre-existing files in CVS)
>and a new file: fhandler_clipboard.cc. It should do read-only clipboard
>access right now. gzip+uuencode versions pasted below.

How do you know what it can do if you can't compile it?

You did extract the whole directory tree, right?  You need newlib
(obviously), libiberty, include, and all of the supporting files in the
top-level 'sourceware' directory.  You need to build everything in
a separate directory from source.  You also need to build newlib first
before you build cygwin or you need to be in the top level directory
to build everything.

cgf

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Clipboard from Cygwin?
  2000-08-01 16:27   ` DJ Delorie
  2000-08-01 17:11     ` Matthew Smith
@ 2000-08-01 19:10     ` Charles Wilson
  2000-08-01 19:17       ` Chris Faylor
  2000-08-01 19:26       ` DJ Delorie
  1 sibling, 2 replies; 17+ messages in thread
From: Charles Wilson @ 2000-08-01 19:10 UTC (permalink / raw)
  To: cygwin

DJ Delorie wrote:
> 
> > Or better yet, how about implementing a /dev/clipboard like uwin has?
> 
> cygwin includes a tutorial on adding device handlers to cygwin1.dll.
> Why not give it a try?  I'd hate to think I'd wasted all that effort
> writing a tutorial that nobody uses...
> 
> http://sources.redhat.com/cygwin/snapshots/winsup-src-20000725.tar.bz2/winsup/doc/fhandler-tut.txt

Cool. Here's a first attempt -- but I can't get it to build. (Errors
building cygwin, but apparently because I don't know how -- I'm not
getting errors in the code affected by this patch, but elsewhere:
missing stdarg.h & stddef.h files...). 

Anyway, below there's a patch (that affects pre-existing files in CVS)
and a new file: fhandler_clipboard.cc. It should do read-only clipboard
access right now. gzip+uuencode versions pasted below.

--Chuck


----------------------snip-----------------------------
/* fhandler_dev_handler.cc: code to access /dev/zero

   Copyright 2000 Cygnus Solutions.

   Written by DJ Delorie (dj@cygnus.com)

This file is part of Cygwin.

This software is a copyrighted work licensed under the terms of the
Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
details. */

#include <errno.h>
#include "winsup.h"
#include <windows.h>

fhandler_dev_clipboard::fhandler_dev_clipboard (const char *name)
  : fhandler_base (FH_CLIPBOARD, name)
{
  set_cb (sizeof *this);
}

int
fhandler_dev_clipboard::open (const char *, int flags, mode_t)
{
  set_flags (flags);
  return 1;
}

int
fhandler_dev_clipboard::write (const void *, size_t len)
{
  return len;
}

int
fhandler_dev_clipboard::read (void *ptr, size_t len)
{
  HGLOBAL hglb;
  LPSTR lpstr;

  OpenClipboard(0);
  hglb = GetClipboardData(CF_TEXT);
  lpstr = (LPSTR) GlobalLock(hglb);

  len = snprintf((char *) ptr, len, "%s", lpstr);
  GlobalUnlock(hglb);
  CloseClipboard();
  return len;
}

off_t
fhandler_dev_clipboard::lseek (off_t, int)
{
  return 0;
}

int
fhandler_dev_clipboard::close (void)
{
  return 0;
}

void
fhandler_dev_clipboard::dump ()
{
  paranoid_printf("here, fhandler_dev_clipboard");
}
-------------------------snip-----------------------

---------------------clip.patch--------------------------
Index: winsup/cygwin/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/Makefile.in,v
retrieving revision 1.25
diff -u -r1.25 Makefile.in
--- Makefile.in 2000/07/10 15:30:04     1.25
+++ Makefile.in 2000/08/02 01:18:22
@@ -122,12 +122,13 @@
        environ.o  errno.o exceptions.o exec.o external.o fcntl.o
fhandler.o \
        fhandler_console.o fhandler_floppy.o fhandler_random.o
fhandler_raw.o
\
        fhandler_serial.o fhandler_tape.o fhandler_termios.o
fhandler_tty.o \
-       fhandler_windows.o fhandler_zero.o fork.o glob.o grp.o heap.o
hinfo.o
\
-       init.o ioctl.o localtime.o malloc.o mmap.o net.o ntea.o passwd.o
\
-       path.o pinfo.o pipe.o poll.o regexp.o regerror.o regsub.o
registry.o \
-       resource.o scandir.o security.o select.o shared.o signal.o
sigproc.o \
-       smallprint.o spawn.o strace.o strsep.o sync.o syscalls.o
sysconf.o \
-       syslog.o termios.o times.o tty.o uinfo.o uname.o wait.o window.o
\
+       fhandler_windows.o fhandler_zero.o fhandler_clipboard.o fork.o
glob.o
\
+       grp.o heap.o hinfo.o init.o ioctl.o localtime.o malloc.o mmap.o
net.o
\
+       ntea.o passwd.o path.o pinfo.o pipe.o poll.o regexp.o regerror.o
\
+       regsub.o registry.o resource.o scandir.o security.o select.o
shared.o
\
+       signal.o sigproc.o smallprint.o spawn.o strace.o strsep.o sync.o
\
+       syscalls.o sysconf.o syslog.o termios.o times.o tty.o uinfo.o
uname.o
\
+       wait.o window.o \
        $(EXTRA_DLL_OFILES) $(EXTRA_OFILES) $(MT_SAFE_OBJECTS)
 
 GMON_OFILES:= gmon.o mcount.o profil.o
@@ -309,6 +310,7 @@
 fhandler_floppy.o: $(WINSUP_H)
 fhandler_tape.o: $(WINSUP_H)
 fhandler_zero.o: $(WINSUP_H)
+fhandler_clipboard.o: $(WINSUP_H)
 fhandler_random.o: $(WINSUP_H)
 fork.o: $(WINSUP_H) dll_init.h
 glob.o: include/glob.h
Index: winsup/cygwin/fhandler.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fhandler.h,v
retrieving revision 1.16
diff -u -r1.16 fhandler.h
--- fhandler.h  2000/07/29 04:19:24     1.16
+++ fhandler.h  2000/08/02 01:18:23
@@ -27,6 +27,7 @@
      fhandler_dev_raw     (fhandler_raw.cc)
      fhandler_dev_floppy  (fhandler_floppy.cc)
      fhandler_dev_tape    (fhandler_tape.cc)
+     fhandler_dev_clipboard    (fhandler_clip.cc)
 
      fhandler_pipe
      fhandler_socket      (net.cc)
@@ -94,8 +95,9 @@
   FH_NULL    = 0x00000013,     /* is the null device */
   FH_ZERO    = 0x00000014,     /* is the zero device */
   FH_RANDOM  = 0x00000015,     /* is a random device */
+  FH_CLIPBOARD = 0x00000016,  /* is the windows clipboard */
 
-  FH_NDEV    = 0x00000016,     /* Maximum number of devices */
+  FH_NDEV    = 0x00000017,     /* Maximum number of devices */
   FH_DEVMASK = 0x00000fff,     /* devices live here */
   FH_BAD     = 0xffffffff
 };
@@ -761,6 +763,29 @@
   int dup (fhandler_base *child);
 
   void dump ();
+};
+
+class fhandler_dev_clipboard: public fhandler_base
+{
+public:
+  fhandler_dev_clipboard (const char *name);
+
+  void dump ();
+
+  int is_windows (void) { return 1; }
+  int open (const char *path, int flags, mode_t mode = 0);
+  int write (const void *ptr, size_t len);
+  int read (void *ptr, size_t len);
+  int ioctl (unsigned int cmd, void *);
+  off_t lseek (off_t, int);
+  int close (void);
+
+  void set_close_on_exec (int val);
+  void fixup_after_fork (HANDLE parent);
+  select_record *select_read (select_record *s);
+  select_record *select_write (select_record *s);
+  select_record *select_except (select_record *s);
+  int ready_for_read (int fd, DWORD howlong, int ignra);
 };
 
 class fhandler_windows: public fhandler_base
Index: winsup/cygwin/hinfo.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/hinfo.cc,v
retrieving revision 1.11
diff -u -r1.11 hinfo.cc
--- hinfo.cc    2000/07/29 16:01:23     1.11
+++ hinfo.cc    2000/08/02 01:18:24
@@ -282,6 +282,9 @@
       case FH_ZERO:
        fh = new (buf) fhandler_dev_zero (name);
        break;
+      case FH_CLIPBOARD:
+       fh = new (buf) fhandler_dev_clipboard (name);
+       break;
       case FH_RANDOM:
        fh = new (buf) fhandler_dev_random (name, unit);
        break;
Index: winsup/cygwin/path.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/path.cc,v
retrieving revision 1.40
diff -u -r1.40 path.cc
--- path.cc     2000/07/29 17:36:05     1.40
+++ path.cc     2000/08/02 01:18:27
@@ -437,6 +437,7 @@
   "\\dev\\st%d",
   "nul",
   "\\dev\\zero",
+  "\\dev\\clipboard",
   "\\dev\\%srandom",
 };
 
@@ -502,6 +503,8 @@
        devn = FH_NULL;
       else if (deveq ("zero"))
        devn = FH_ZERO;
+      else if (deveq ("clipboard"))
+       devn = FH_CLIPBOARD;
       else if (deveq ("random") || deveq ("urandom"))
         {
          devn = FH_RANDOM;
Index: winsup/cygwin/winsup.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/winsup.h,v
retrieving revision 1.23
diff -u -r1.23 winsup.h
--- winsup.h    2000/07/29 16:24:42     1.23
+++ winsup.h    2000/08/02 01:18:31
@@ -66,8 +66,12 @@
 #undef _WINNETWK_H
 #undef _WINSVC_H
 
-/* The one function we use from winuser.h most of the time */
+/* The few functions we use from winuser.h most of the time */
 extern "C" DWORD WINAPI GetLastError (void);
+#define CF_TEXT 1
+extern "C" BOOL WINAPI OpenClipboard(HWND);
+extern "C" HANDLE WINAPI GetClipboardData(UINT);
+extern "C" BOOL WINAPI CloseClipboard(void);
 
 /* Used for runtime OS check/decisions. */
 enum os_type {winNT = 1, win95, win98, win32s, unknown};
--------------------------snip-------------------------


begin 775 clip.patch.gz
M'XL("'J"ASD``V-L:7`N<&%T8V@`O5A]3^-&$_\[^10CVDK))2&V$P+X=-)Q
MD"NT@9R`ZSVJD"SCK!,+Q^ONV@1ZO>_>F;$=VR%IBQ[I(L'NCN=M=WX[,_9%
M-!-/-JR"2*=QWWN>XZQ_Z3X(/PC%?A`UW_W_O^;UZ0V0/AOZWJ/N:^7QWTZC
MW<>F$HD*Q&,0S4'AH`,9@;EO'31G@>]#+X6>HB547>WU>M5UPS(,HV\<]DT#
MS`-[8-C&L,$Z.IW.%L:COF&!8=KFD6U9S??OH6=:5M>TH,/C`-Z_;T)#1(^!
MDM&^!!!*11(GXLD3<8(>:EX(CX=$J,@-<>I[4<+CPHUFH5`XO4-%Q=+Q4%"B
M(R6'XX<RCI^K%(6C7-8IJTU-6JC`K9IR$C>N*4:GEH'4-5+RS'IZI1X,QTRN
M:EQ_"D5;]:5ZP&$>RGL:5(S_%\+E(8A\F6L*HB#!:2`]WGDH/3=,@B6YLG1#
M7-)DR6*1(,XH$2X.L:OU:I8KB=UD0;1<;QSP5F(9DDHEYN(ISB=*295-=7J?
M30*=J&)?2FB9*H^DM8?["8A9"R]5`>]=BU!XY(5>N$J0>1W,L]CA)%;L+BG2
MY'RL@HB98W=%,$!#;J8[45J02_HY\GA`:V&H\ZF,_$+-LP[E'!=E-.AP>&2'
MTGS+:>3RF:U</LXL+*RD\Y^"M498&,3WTE6S%Q$D35NC^.H(DJ;-*+XZ@J1D
M6Q1?'T'2M"6*KXL@*]D6Q5='D#2]C"(T?FR-_W=[?>*<32;.]./%9'S3AH)6
MKB]OG9N3CV-G^N&7\>GM3;L)3?C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*2`K6C6ZM+M.!K$HYVY0(1
M79*.;`?+`&X5<H=$I%VK?"R(`M+\Y_3AZKJ87>7GU_?G*53&)B5Z+I7+H#],
MDG=2"]62,Y_06FVR^LL^E%(3US99G;Z`4:PT:Q>`R8'70LEF8;@MQ^/C<6!!
MGP=1<PM]S5?8(U?'^Q=;A!G8Q661SZYNSVY.[R8#Z&"_">C0%V(!S,EG)!_Z
MGHSLG21_DD1J_ZH4T]"#'30>`.&A4GSI!K"BI2C\OD$,`XL'D0-8]*W5\.'-
M1FM:#MQU>C*R#)V"UL*#0MVUV++1_4T^BYP<ZX@:;__GNIS.;LY.9U`OU2(H
MG=W>S^]`-<[;D["N-S1YON-CHSA-P,)GF*+_EYEPSUE^4<S/?\PC)C(0B$7"
M'DR567`U,^*1A?)>)"<5!'&ZL31#Q5AG;0^B4DH.('WOTD%'%FD[FN]:O2"B
M_TX9AWN5+RW?F62JJGC=)N40'X%%4'S9`Z-';]HL@H#.YR.5(?QJ:=FN&F!=
<%?WF7!.XV!J2UFAQ`,=+T[BV?P$J<KBIK`0``-HL
`
end

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Clipboard from Cygwin?
  2000-08-01 16:27   ` DJ Delorie
@ 2000-08-01 17:11     ` Matthew Smith
  2000-08-01 19:10     ` Charles Wilson
  1 sibling, 0 replies; 17+ messages in thread
From: Matthew Smith @ 2000-08-01 17:11 UTC (permalink / raw)
  To: DJ Delorie; +Cc: cygwin, lists

Thanks for the link DJ, I'll take a look at what this entails this weekend.

cheers,
-Matt Smith


>
> > Or better yet, how about implementing a /dev/clipboard like uwin has?
>
> cygwin includes a tutorial on adding device handlers to cygwin1.dll.
> Why not give it a try?  I'd hate to think I'd wasted all that effort
> writing a tutorial that nobody uses...
>
>
http://sources.redhat.com/cygwin/snapshots/winsup-src-20000725.tar.bz2/winsu
p/doc/fhandler-tut.txt
>


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Clipboard from Cygwin?
  2000-08-01 15:47 ` Matthew Smith
@ 2000-08-01 16:27   ` DJ Delorie
  2000-08-01 17:11     ` Matthew Smith
  2000-08-01 19:10     ` Charles Wilson
  0 siblings, 2 replies; 17+ messages in thread
From: DJ Delorie @ 2000-08-01 16:27 UTC (permalink / raw)
  To: matts; +Cc: cygwin, lists

> Or better yet, how about implementing a /dev/clipboard like uwin has?

cygwin includes a tutorial on adding device handlers to cygwin1.dll.
Why not give it a try?  I'd hate to think I'd wasted all that effort
writing a tutorial that nobody uses...

http://sources.redhat.com/cygwin/snapshots/winsup-src-20000725.tar.bz2/winsup/doc/fhandler-tut.txt

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Clipboard from Cygwin?
  2000-08-01 15:35 Alexander Anderson
@ 2000-08-01 15:47 ` Matthew Smith
  2000-08-01 16:27   ` DJ Delorie
  0 siblings, 1 reply; 17+ messages in thread
From: Matthew Smith @ 2000-08-01 15:47 UTC (permalink / raw)
  To: cygwin, Alexander Anderson

Or better yet, how about implementing a /dev/clipboard like uwin has?

cheers,
-Matt Smith


> Dear Cygwin list,
> 
> 
>     A while back Oliver Nittka sent me the C sourcecode of a Cygwin unix
> command to grab the Windows clipboard.  He suggested I  compile  it  and
> try  it out.  I would very much prefer not get involved in the headaches
> of setting up the ability to actually _compile_ stuff  under  Cygwin  (I
> just  want  the  power  of  the Unix tools on Windows, as a command line
> user).  I have not been able to get a reply from Nittka recently, he may
> be on holiday.
> 
> 
>     Could  someone  instead  suggest  where  I  can  download this (or a
> similar)  command,  pre-compiled?   Also,  how  does  one  use  Nittka's
> 'probe'?  Would it be for example,
> 



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Clipboard from Cygwin?
@ 2000-08-01 15:35 Alexander Anderson
  2000-08-01 15:47 ` Matthew Smith
  0 siblings, 1 reply; 17+ messages in thread
From: Alexander Anderson @ 2000-08-01 15:35 UTC (permalink / raw)
  To: cygwin

Dear Cygwin list,


    A while back Oliver Nittka sent me the C sourcecode of a Cygwin unix
command to grab the Windows clipboard.  He suggested I  compile  it  and
try  it out.  I would very much prefer not get involved in the headaches
of setting up the ability to actually _compile_ stuff  under  Cygwin  (I
just  want  the  power  of  the Unix tools on Windows, as a command line
user).  I have not been able to get a reply from Nittka recently, he may
be on holiday.


    Could  someone  instead  suggest  where  I  can  download this (or a
similar)  command,  pre-compiled?   Also,  how  does  one  use  Nittka's
'probe'?  Would it be for example,


        $ probe > clipboard.txt ?


With kind regards,


Sandy


P.S.  The source he originally sent:

------------------------------------------------------------- probe.c --
#include <stdio.h>
#include <windows.h>

int main() {
    HGLOBAL hglb; 
    LPSTR lpstr; 

    OpenClipboard(0);
    hglb = GetClipboardData(CF_TEXT); 
    lpstr = GlobalLock(hglb); 
 
    printf("%s",lpstr);
    GlobalUnlock(hglb); 
    CloseClipboard();
    return(0);
}
-- eof ------------------------------------------------------ probe.c --

-- 
Alexander Anderson

mailto :     lists  at  almide period demon period co dot uk
bud-nav:     http://www.explosive-alma-services-bolts.co.uk/
pgp-sig:  1B5A DF3D A3D9 B932 39EB  3F1B 981F 4110 27E1 64A4


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2000-08-02 17:28 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-29 18:21 Clipboard from Cygwin? Alexander Anderson
2000-05-30  6:53 ` Chris Faylor
2000-08-01 15:35 Alexander Anderson
2000-08-01 15:47 ` Matthew Smith
2000-08-01 16:27   ` DJ Delorie
2000-08-01 17:11     ` Matthew Smith
2000-08-01 19:10     ` Charles Wilson
2000-08-01 19:17       ` Chris Faylor
2000-08-01 19:25         ` Charles Wilson
2000-08-01 19:33           ` Chris Faylor
2000-08-01 22:57             ` Charles Wilson
2000-08-02  7:00               ` DJ Delorie
2000-08-02  9:07                 ` Charles Wilson
2000-08-01 19:26       ` DJ Delorie
2000-08-02  0:21         ` Corinna Vinschen
2000-08-02 11:59         ` Charles Wilson
2000-08-02 17:28           ` Charles Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).