Skip to content

Instantly share code, notes, and snippets.

@hsbt
Forked from dealforest/screen-mac-pbcopy.patch
Created October 10, 2010 23:43
Show Gist options
  • Save hsbt/619709 to your computer and use it in GitHub Desktop.
Save hsbt/619709 to your computer and use it in GitHub Desktop.
--- a/mark.c 2009-06-25 02:03:01.000000000 +0900
+++ b/mark.c 2009-06-25 02:03:50.000000000 +0900
@@ -59,6 +59,8 @@
static void MarkRedisplayLine __P((int, int, int, int));
static int MarkRewrite __P((int, int, int, struct mchar *, int));
+void pbcopy(const char *strings);
+
extern struct layer *flayer;
extern struct display *display, *displays;
extern struct win *fore;
@@ -484,6 +486,18 @@
/**********************************************************************/
+void pbcopy(const char *strings)
+{
+ FILE *pipe;
+ pipe = popen("/usr/bin/pbcopy", "w");
+ if (pipe == NULL) {
+ LMsg(0, "pbcopy failed: %s", strerror(errno));
+ return;
+ }
+ fprintf(pipe, "%s", strings);
+ pclose(pipe);
+}
+
void
MarkRoutine()
@@ -1045,6 +1059,7 @@
newcopylen);
else
LMsg(0, "Copied %d characters into buffer", md_user->u_plop.len);
+ pbcopy(md_user->u_plop.buf);
if (write_buffer)
WriteFile(md_user, (char *)0, DUMP_EXCHANGE);
in_mark = 0;
--- a/pty.c 2009-06-25 02:03:01.000000000 +0900
+++ b/pty.c 2009-06-25 02:03:57.000000000 +0900
@@ -35,7 +35,7 @@
/* for solaris 2.1, Unixware (SVR4.2) and possibly others */
#if defined(HAVE_SVR4_PTYS) && !defined(__APPLE__)
-# include <sys/stropts.h>
+//# include <sys/stropts.h>
#endif
#if defined(sun) && defined(LOCKPTY) && !defined(TIOCEXCL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment