updated on Wed Jan 25 20:08:56 UTC 2012
[aur-mirror.git] / vncrec_twibright_amigo / patchfile.patch
bloba703870cebcddf80049bbbe136f24f8fc2214a14
1 --- vncrec/argsresources.c.orig 2008-04-08 11:06:23.000000000 -0500
2 +++ vncrec/argsresources.c 2008-03-20 10:58:00.000000000 -0500
3 @@ -363,7 +363,11 @@
4 const char * infile = appData.play ? appData.play : appData.movie;
5 char buf[64];
6 size_t size;
7 - vncLog = fopen (infile, "r");
8 + if (!strcmp("-", infile)) {
9 + vncLog = stdin;
10 + } else {
11 + vncLog = fopen (infile, "r");
12 + }
13 if (vncLog == NULL)
15 fprintf (stderr, "%s: failed to open %s\n",
16 @@ -387,7 +391,11 @@
18 else if (appData.record)
20 - vncLog = fopen (appData.record, "w");
21 + if (!strcmp("-", appData.record)) {
22 + vncLog = stdout;
23 + } else {
24 + vncLog = fopen (appData.record, "w");
25 + }
26 if (vncLog == NULL)
28 fprintf (stderr, "%s -record: failed to open %s\n",
29 --- vncrec/rfbproto.c.orig 2008-04-08 11:06:13.000000000 -0500
30 +++ vncrec/rfbproto.c 2008-03-20 06:40:37.000000000 -0500
31 @@ -27,6 +27,7 @@
32 #include <pwd.h>
33 #include <vncviewer.h>
34 #include <vncauth.h>
35 +#include <fcntl.h>
37 static Bool HandleRRE8(int rx, int ry, int rw, int rh);
38 static Bool HandleRRE16(int rx, int ry, int rw, int rh);
39 @@ -164,7 +165,7 @@
40 } else if (appData.passwordDialog) {
41 passwd = DoPasswordDialog();
42 } else {
43 - passwd = getpass("Password: ");
44 + passwd = ReadPasswdFile(".vncrecpasswd");
47 if ((!passwd) || (strlen(passwd) == 0)) {
48 @@ -719,3 +720,37 @@
53 +/*
54 + * ReadPasswdFile.
55 + * When connecting to a remote vnc server, don't prompt the user for a
56 + * password. Instead, read it from a file
57 + */
58 +char *ReadPasswdFile(char *fname) {
59 + char *passwd;
60 + int fd, plen, x;
61 + int maxpwlen = 50;
62 + passwd = malloc(sizeof(char) * (maxpwlen+1));
63 + fd = open(fname, O_RDONLY);
64 + if(fd == -1) {
65 + fprintf(stderr, "Failed to open %s\n", fname);
66 + return(NULL);
67 + } else {
68 + plen = (int) read(fd, passwd, maxpwlen);
69 + close(fd);
70 + fprintf(stderr, "Read in %d bytes from %s\n", plen, fname);
71 + if(plen < 1) {
72 + fprintf(stderr, "error: %d\n", errno);
73 + return(NULL);
74 + } else {
75 + passwd[plen] = 0;
76 + for(x=0; x<plen; x++) {
77 + if(passwd[x] == 10) {
78 + passwd[x] = 0;
79 + x=plen;
80 + }
81 + }
82 + return passwd;
83 + }
84 + }
86 --- vncrec/vncviewer.h.orig 2008-04-08 11:05:36.000000000 -0500
87 +++ vncrec/vncviewer.h 2008-03-20 06:05:21.000000000 -0500
88 @@ -198,6 +198,7 @@
89 extern Bool HandleRFBServerMessage();
91 extern void PrintPixelFormat(rfbPixelFormat *format);
92 +extern char *ReadPasswdFile(char *fname);
94 /* selection.c */
96 --- README.orig 2008-04-08 13:25:18.000000000 -0500
97 +++ README 2008-04-08 13:25:07.000000000 -0500
98 @@ -6,6 +6,40 @@
99 QUICK for -movie below)
100 START
103 +Amigo's patched vncrec
104 +~~~~~~~~~~~~~~~~~~~~~~
105 +Starting with the Twibright patches to vncrec (see below in this readme), I
106 +made a couple minor modifications:
107 + - allow reading from stdin and writing to stdout. Use - as a filename.
108 + - read password from .vncrecpasswd instead of prompting for a password.
110 +The purpose of both of these changes is to facilitate using vncrec in a script.
111 +Writing to stdout allows the output to be piped to gzip.
113 +One use scenario is this:
114 + # Xvfb :1 &
115 + # export DISPLAY=:1
116 + # vncrec -record - ip.ad.dre.ss:0 -shared -viewonly -encodings raw | gzip -c9 > logfile.vnc.gz
118 +Because vncrec needs an X display to run, use Xvfb to create a virtual one.
119 +When logging a long session, vncrec isn't helpful as a review tool... there's
120 +no pause, rew, ff, etc. Instead, we want to use pyvnc2swf to convert the
121 +session to flash format with a progress bar for seeking through the recording.
123 +However, pyvnc2swf doesn't recognize CopyRect (a standard VNC encoding), we
124 +instead use "raw". But since the raw encoding would generate a huge file,
125 +it's piped to gzip.
127 +Using pyvnc2swf to simply record files into a flash format would be nice, but
128 +it uses about 100 times more CPU power than gzip. Bzip2 is another contender,
129 +but even bzip2 -1 uses more CPU time than gzip -9 and produces a larger file.
131 +I have found no other feasible way of recording several multi-hour VNC sessions
132 +on a single server.
136 Twibright vncrec
137 ================