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