+ /* Note that we leave the hostname in the display most of the
+ * time. The idea is that we want to be per-(machine,display,user)
+ * triplet to be extra-sure we get a bus we can connect to. Ideally
+ * we'd recognize when the hostname matches the machine we're on in
+ * all cases; we do try to drop localhost and localhost.localdomain
+ * as a special common case so that alternate spellings of DISPLAY
+ * don't result in extra bus instances.
+ *
+ * We also kill the ":" if there's nothing in front of it. This
+ * avoids an ugly double underscore in the filename.
+ */
+ remove_prefix (display, "localhost.localdomain:");
+ remove_prefix (display, "localhost:");
+ remove_prefix (display, ":");
+
+ /* replace the : in the display with _ if the : is still there.
+ * use _ instead of - since it can't be in hostnames.
+ */