diff -rub nas-1.4.2/server/dia/main.c nas-1.4.2.mod/server/dia/main.c
--- nas-1.4.2/server/dia/main.c	Mon Dec 11 04:13:50 2000
+++ nas-1.4.2.mod/server/dia/main.c	Mon Apr 23 10:36:40 2001
@@ -71,6 +71,8 @@
 extern void 	AuInitProcVectors();
 extern Bool     InitClientResources();
 
+static char *AuServerName(void);
+
 extern char *display;
 
 static int restart = 0;
@@ -126,12 +128,14 @@
      * can't be passed argc, argv as parameters */
     argcGlobal = argc;
     argvGlobal = argv;
-    display = "0";
+
+    display = NULL;
     ProcessCommandLine(argc, argv);
 
-				/* JET - we don't actually become a
-				   daemon, so what's the point?
-				   REVISIT */
+				/* if display wasn't spec'd on the command
+				   line, find a suitable default */
+    if (display == NULL)
+      display = AuServerName();
 
     /* We're running as a daemon, so close stdin, stdout and stderr
        before we start the main loop */
@@ -184,4 +188,41 @@
 	}
     }
     exit(0);
+}
+
+
+/* JET - get the server port to listen on here... uses AUDIOSERVER, then
+ *  DISPLAY if set.
+ */
+
+static char *AuServerName (void)
+{
+  char *name = NULL;
+  char *ch;
+
+    name = (char *) getenv ("AUDIOSERVER");
+    if (name)
+      {
+	if ((ch = strchr(name, ':')) != NULL)
+	  {
+	    ch++;
+	    return(ch);
+	  }
+	else
+	  return name;
+      }
+
+    name = (char *) getenv ("DISPLAY");
+    if (name)
+      {
+	if ((ch = strchr(name, ':')) != NULL)
+	  {
+	    ch++;
+	    return(ch);
+	  }
+	else
+	  return name;
+      }
+
+    return "0";
 }
