use $DISPLAY

This commit is contained in:
Julien Danjou 2007-11-26 09:53:07 +01:00
parent 1722520a2a
commit e0a72e79ac
1 changed files with 7 additions and 6 deletions

View File

@ -35,17 +35,17 @@
#endif #endif
int int
main(int argc, char **argv) main(void)
{ {
struct sockaddr_un *addr; struct sockaddr_un *addr;
char buf[1024]; char buf[1024], *display, *tmp;
int csfd, ret_value = EXIT_SUCCESS; int csfd, ret_value = EXIT_SUCCESS;
csfd = get_client_socket(); csfd = get_client_socket();
if(argc > 1) display = a_strdup(getenv("DISPLAY"));
addr = get_client_addr(argv[1]); if(display && (tmp = strrchr(display, '.')))
else *tmp = '\0';
addr = get_client_addr(":0"); addr = get_client_addr(display);
if(!addr || csfd < 0) if(!addr || csfd < 0)
return EXIT_FAILURE; return EXIT_FAILURE;
@ -67,6 +67,7 @@ main(int argc, char **argv)
} }
p_delete(&addr); p_delete(&addr);
p_delete(&display);
return ret_value; return ret_value;
} }