use $DISPLAY
This commit is contained in:
parent
1722520a2a
commit
e0a72e79ac
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue