linamh/net-misc/nxproxy/files/nxproxy-3.2.0-read_from_stdin.patch
2010-06-14 21:51:50 +00:00

71 lines
1.5 KiB
Diff

Index: nxproxy/Main.c
===================================================================
--- nxproxy.orig/Main.c 2007-01-19 14:34:34.000000000 -0200
+++ nxproxy/Main.c 2010-03-27 12:47:28.872040679 -0300
@@ -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.