Improve main func

This commit is contained in:
Alex Kotov 2021-11-13 21:47:29 +05:00
parent 2a2f92fae7
commit 03e0b756a5
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
1 changed files with 20 additions and 5 deletions

25
dwm.c
View File

@ -2607,33 +2607,48 @@ zoom(const Arg *arg)
int
main(int argc, char *argv[])
{
if (argc == 2 && !strcmp("-v", argv[1]))
if (argc == 2 && !strcmp("-v", argv[1])) {
die("dwm-"VERSION);
else if (argc != 1)
}
if (argc != 1) {
die("usage: dwm [-v]");
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
}
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale()) {
fputs("warning: no locale support\n", stderr);
if (!(dpy = XOpenDisplay(NULL)))
}
if (!(dpy = XOpenDisplay(NULL))) {
die("dwm: cannot open display");
}
checkotherwm();
if (!status_start()) {
status_stop();
die("dwm: cannot start status service");
}
if (!datetime_start()) {
datetime_stop();
die("dwm: cannot start datetime service");
}
setup();
#ifdef __OpenBSD__
if (pledge("stdio rpath proc exec", NULL) == -1)
if (pledge("stdio rpath proc exec", NULL) == -1) {
die("pledge");
}
#endif /* __OpenBSD__ */
scan();
run();
cleanup();
datetime_stop();
status_stop();
XCloseDisplay(dpy);
return EXIT_SUCCESS;
}