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