1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
Patch taken from the debian unstable package
original posted by Fabian Franz on the freenx mailinglist
Index: nxproxy/Main.c
--- nxproxy/Main.c.old 2007-07-18 17:39:13.000000000 +0200
+++ nxproxy/Main.c 2008-03-12 04:40:30.000000000 +0100
@@ -36,28 +36,48 @@
int result = -1;
char *options = NULL;
-
+
+ char *nx_commfd_str = NULL;
+
options = getenv("NX_DISPLAY");
-
- if (NXTransParseCommandLine(argc, argv) < 0)
+
+ if ((nx_commfd_str = getenv("NX_COMMFD")) != NULL)
{
- NXTransCleanup();
- }
+ int nx_commfd = atoi(nx_commfd_str);
- if (NXTransParseEnvironment(options, 0) < 0)
- {
- NXTransCleanup();
+ if (result)
+ result = NXTransCreate(nx_commfd, NX_MODE_SERVER, options);
+
+ // go into endless loop
+
+ if (result)
+ {
+ while (NXTransRunning(NX_FD_ANY))
+ result = NXTransContinue(NULL);
+ }
}
+ else
+ {
+ if (NXTransParseCommandLine(argc, argv) < 0)
+ {
+ NXTransCleanup();
+ }
+
+ if (NXTransParseEnvironment(options, 0) < 0)
+ {
+ NXTransCleanup();
+ }
+
+ /*
+ * This should not return...
+ */
+
+ #ifdef TEST
+ fprintf(stderr, "Main: Yielding control to NX entry point.\n");
+ #endif
- /*
- * This should not return...
- */
-
- #ifdef TEST
- fprintf(stderr, "Main: Yielding control to NX entry point.\n");
- #endif
-
- result = NXTransProxy(NX_FD_ANY, NX_MODE_ANY, NX_DISPLAY_ANY);
+ result = NXTransProxy(NX_FD_ANY, NX_MODE_ANY, NX_DISPLAY_ANY);
+ }
/*
* ...So these should not be called.
|