Improve main func
This commit is contained in:
parent
2a2f92fae7
commit
03e0b756a5
1 changed files with 20 additions and 5 deletions
25
dwm.c
25
dwm.c
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue