Improved xgetrootname

This commit is contained in:
Ashish Kumar Yadav 2020-12-05 03:24:41 +05:30
parent 37557a90bd
commit 28f57528b1

View file

@ -4,8 +4,8 @@
int int
main() main()
{ {
Display *dpy;
char *name; char *name;
Display *dpy;
if (!(dpy = XOpenDisplay(NULL))) { if (!(dpy = XOpenDisplay(NULL))) {
fputs("Error: could not open display.\n", stderr); fputs("Error: could not open display.\n", stderr);
@ -14,7 +14,7 @@ main()
if (XFetchName(dpy, DefaultRootWindow(dpy), &name) && name[0]) if (XFetchName(dpy, DefaultRootWindow(dpy), &name) && name[0])
printf("%s\n", name); printf("%s\n", name);
else else
puts("No name has been set for the root window."); fputs("No name has been set for the root window.\n", stderr);
XFree(name); XFree(name);
XCloseDisplay(dpy); XCloseDisplay(dpy);
return 0; return 0;