shortcutWindows moved to w_global
[wmaker-crm.git] / src / main.c
blob58623891e1393c522b4a818439cf9ce5a002fa45
1 /*
2 * Window Maker window manager
4 * Copyright (c) 1997-2003 Alfredo K. Kojima
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "wconfig.h"
23 #ifdef HAVE_INOTIFY
24 #include <sys/inotify.h>
25 #endif
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <unistd.h>
30 #include <string.h>
31 #include <sys/stat.h>
32 #include <sys/types.h>
33 #include <fcntl.h>
35 #include <X11/Xlib.h>
36 #include <X11/Xutil.h>
38 /* Xlocale.h and locale.h are the same if X_LOCALE is undefind in wconfig.h,
39 * and if X_LOCALE is defined, X's locale emulating functions will be used.
40 * See Xlocale.h for more information.
42 #include <X11/Xlocale.h>
44 #define MAINFILE
46 #include "WindowMaker.h"
47 #include "window.h"
48 #include "defaults.h"
49 #include "event.h"
50 #include "startup.h"
51 #include "menu.h"
52 #include "keybind.h"
53 #include "xmodifier.h"
54 #include "session.h"
55 #include "shutdown.h"
56 #include "dialog.h"
57 #include "main.h"
58 #include "monitor.h"
60 #include <WINGs/WUtil.h>
62 #ifndef GLOBAL_DEFAULTS_SUBDIR
63 #define GLOBAL_DEFAULTS_SUBDIR "WindowMaker"
64 #endif
66 /****** Global Variables ******/
67 struct wmaker_global_variables w_global;
69 /* general info */
71 Display *dpy;
73 char *ProgName;
75 unsigned int ValidModMask = 0xff;
77 #ifdef HAVE_INOTIFY
78 int inotifyFD;
79 int inotifyWD;
80 #endif
82 int wScreenCount = 0;
84 struct WPreferences wPreferences;
86 WShortKey wKeyBindings[WKBD_LAST];
88 /* defaults domains */
89 WDDomain *WDWindowMaker = NULL;
90 WDDomain *WDWindowAttributes = NULL;
91 WDDomain *WDRootMenu = NULL;
93 #ifdef SHAPE
94 Bool wShapeSupported;
95 int wShapeEventBase;
96 #endif
98 #ifdef KEEP_XKB_LOCK_STATUS
99 Bool wXkbSupported;
100 int wXkbEventBase;
101 #endif
103 /* special flags */
104 char WDelayedActionSet = 0;
106 /* notifications */
107 const char WMNManaged[] = "WMNManaged";
108 const char WMNUnmanaged[] = "WMNUnmanaged";
109 const char WMNChangedWorkspace[] = "WMNChangedWorkspace";
110 const char WMNChangedState[] = "WMNChangedState";
111 const char WMNChangedFocus[] = "WMNChangedFocus";
112 const char WMNChangedStacking[] = "WMNChangedStacking";
113 const char WMNChangedName[] = "WMNChangedName";
115 const char WMNWorkspaceCreated[] = "WMNWorkspaceCreated";
116 const char WMNWorkspaceDestroyed[] = "WMNWorkspaceDestroyed";
117 const char WMNWorkspaceChanged[] = "WMNWorkspaceChanged";
118 const char WMNWorkspaceNameChanged[] = "WMNWorkspaceNameChanged";
120 const char WMNResetStacking[] = "WMNResetStacking";
122 /******** End Global Variables *****/
124 static char *DisplayName = NULL;
126 static char **Arguments;
128 static int ArgCount;
130 static Bool multiHead = True;
132 static int *wVisualID = NULL;
133 static int wVisualID_len = 0;
135 static int real_main(int argc, char **argv);
137 int getWVisualID(int screen)
139 if (wVisualID == NULL)
140 return -1;
141 if (screen < 0 || screen >= wVisualID_len)
142 return -1;
144 return wVisualID[screen];
147 static void setWVisualID(int screen, int val)
149 int i;
151 if (screen < 0)
152 return;
154 if (wVisualID == NULL) {
155 /* no array at all, alloc space for screen + 1 entries
156 * and init with default value */
157 wVisualID_len = screen + 1;
158 wVisualID = (int *)malloc(wVisualID_len * sizeof(int));
159 for (i = 0; i < wVisualID_len; i++) {
160 wVisualID[i] = -1;
162 } else if (screen >= wVisualID_len) {
163 /* larger screen number than previously allocated
164 so enlarge array */
165 int oldlen = wVisualID_len;
167 wVisualID_len = screen + 1;
168 wVisualID = (int *)realloc(wVisualID, wVisualID_len * sizeof(int));
169 for (i = oldlen; i < wVisualID_len; i++) {
170 wVisualID[i] = -1;
174 wVisualID[screen] = val;
178 * this function splits a given string at the comma into tokens
179 * and set the wVisualID variable to each parsed number
181 static int initWVisualID(const char *user_str)
183 char *mystr = strdup(user_str);
184 int cur_in_pos = 0;
185 int cur_out_pos = 0;
186 int cur_screen = 0;
187 int error_found = 0;
189 for (;;) {
190 /* check for delimiter */
191 if (user_str[cur_in_pos] == '\0' || user_str[cur_in_pos] == ',') {
192 int v;
194 mystr[cur_out_pos] = '\0';
196 if (sscanf(mystr, "%i", &v) != 1) {
197 error_found = 1;
198 break;
201 setWVisualID(cur_screen, v);
203 cur_screen++;
204 cur_out_pos = 0;
207 /* break in case last char has been consumed */
208 if (user_str[cur_in_pos] == '\0')
209 break;
211 /* if the current char is no delimiter put it into mystr */
212 if (user_str[cur_in_pos] != ',') {
213 mystr[cur_out_pos++] = user_str[cur_in_pos];
215 cur_in_pos++;
218 free(mystr);
220 if (cur_screen == 0||error_found != 0)
221 return 1;
223 return 0;
226 noreturn void Exit(int status)
228 if (dpy)
229 XCloseDisplay(dpy);
231 exit(status);
234 void Restart(char *manager, Bool abortOnFailure)
236 char *prog = NULL;
237 char *argv[MAX_RESTART_ARGS];
238 int i;
240 if (manager && manager[0] != 0) {
241 prog = argv[0] = strtok(manager, " ");
242 for (i = 1; i < MAX_RESTART_ARGS; i++) {
243 argv[i] = strtok(NULL, " ");
244 if (argv[i] == NULL) {
245 break;
249 if (dpy) {
250 XCloseDisplay(dpy);
251 dpy = NULL;
253 if (!prog) {
254 execvp(Arguments[0], Arguments);
255 wfatal(_("failed to restart Window Maker."));
256 } else {
257 execvp(prog, argv);
258 werror(_("could not exec %s"), prog);
260 if (abortOnFailure)
261 exit(7);
264 void SetupEnvironment(WScreen * scr)
266 char *tmp, *ptr;
267 char buf[16];
269 if (multiHead) {
270 int len = strlen(DisplayName) + 64;
271 tmp = wmalloc(len);
272 snprintf(tmp, len, "DISPLAY=%s", XDisplayName(DisplayName));
273 ptr = strchr(strchr(tmp, ':'), '.');
274 if (ptr)
275 *ptr = 0;
276 snprintf(buf, sizeof(buf), ".%i", scr->screen);
277 strcat(tmp, buf);
278 putenv(tmp);
280 tmp = wmalloc(60);
281 snprintf(tmp, 60, "WRASTER_COLOR_RESOLUTION%i=%i", scr->screen,
282 scr->rcontext->attribs->colors_per_channel);
283 putenv(tmp);
286 typedef struct {
287 WScreen *scr;
288 char *command;
289 } _tuple;
291 static void shellCommandHandler(pid_t pid, unsigned char status, _tuple * data)
293 if (status == 127) {
294 char *buffer;
296 buffer = wstrconcat(_("Could not execute command: "), data->command);
298 wMessageDialog(data->scr, _("Error"), buffer, _("OK"), NULL, NULL);
299 wfree(buffer);
300 } else if (status != 127) {
302 printf("%s: %i\n", data->command, status);
306 wfree(data->command);
307 wfree(data);
310 void ExecuteShellCommand(WScreen *scr, const char *command)
312 static char *shell = NULL;
313 pid_t pid;
316 * This have a problem: if the shell is tcsh (not sure about others)
317 * and ~/.tcshrc have /bin/stty erase ^H somewhere on it, the shell
318 * will block and the command will not be executed.
319 if (!shell) {
320 shell = getenv("SHELL");
321 if (!shell)
322 shell = "/bin/sh";
325 shell = "/bin/sh";
327 pid = fork();
329 if (pid == 0) {
331 SetupEnvironment(scr);
333 #ifdef HAVE_SETSID
334 setsid();
335 #endif
336 execl(shell, shell, "-c", command, NULL);
337 werror("could not execute %s -c %s", shell, command);
338 Exit(-1);
339 } else if (pid < 0) {
340 werror("cannot fork a new process");
341 } else {
342 _tuple *data = wmalloc(sizeof(_tuple));
344 data->scr = scr;
345 data->command = wstrdup(command);
347 wAddDeathHandler(pid, (WDeathHandler *) shellCommandHandler, data);
352 *---------------------------------------------------------------------
353 * RelaunchWindow--
354 * Launch a new instance of the active window
356 *----------------------------------------------------------------------
358 Bool RelaunchWindow(WWindow *wwin)
360 if (! wwin || ! wwin->client_win) {
361 werror("no window to relaunch");
362 return False;
365 char **argv;
366 int argc;
368 if (! XGetCommand(dpy, wwin->client_win, &argv, &argc) || argc == 0 || argv == NULL) {
369 werror("cannot relaunch the application because no WM_COMMAND property is set");
370 return False;
373 pid_t pid = fork();
375 if (pid == 0) {
376 SetupEnvironment(wwin->screen_ptr);
377 #ifdef HAVE_SETSID
378 setsid();
379 #endif
380 /* argv is not null-terminated */
381 char **a = (char **) malloc(argc + 1);
382 if (! a) {
383 werror("out of memory trying to relaunch the application");
384 Exit(-1);
387 int i;
388 for (i = 0; i < argc; i++)
389 a[i] = argv[i];
390 a[i] = NULL;
392 execvp(a[0], a);
393 Exit(-1);
394 } else if (pid < 0) {
395 werror("cannot fork a new process");
397 XFreeStringList(argv);
398 return False;
399 } else {
400 _tuple *data = wmalloc(sizeof(_tuple));
402 data->scr = wwin->screen_ptr;
403 data->command = wtokenjoin(argv, argc);
405 /* not actually a shell command */
406 wAddDeathHandler(pid, (WDeathHandler *) shellCommandHandler, data);
408 XFreeStringList(argv);
411 return True;
415 *---------------------------------------------------------------------
416 * wAbort--
417 * Do a major cleanup and exit the program
419 *----------------------------------------------------------------------
421 noreturn void wAbort(Bool dumpCore)
423 int i;
424 WScreen *scr;
426 for (i = 0; i < wScreenCount; i++) {
427 scr = wScreenWithNumber(i);
428 if (scr)
429 RestoreDesktop(scr);
431 printf(_("%s aborted.\n"), ProgName);
432 if (dumpCore)
433 abort();
434 else
435 exit(1);
438 static void print_help(void)
440 printf(_("Usage: %s [options]\n"), ProgName);
441 puts(_("The Window Maker window manager for the X window system"));
442 puts("");
443 puts(_(" -display host:dpy display to use"));
444 puts(_(" --no-dock do not open the application Dock"));
445 puts(_(" --no-clip do not open the workspace Clip"));
446 puts(_(" --no-autolaunch do not autolaunch applications"));
447 puts(_(" --dont-restore do not restore saved session"));
449 puts(_(" --locale locale locale to use"));
451 puts(_(" --visual-id visualid visual id of visual to use"));
452 puts(_(" --static do not update or save configurations"));
453 #ifndef HAVE_INOTIFY
454 puts(_(" --no-polling do not periodically check for configuration updates"));
455 #endif
456 puts(_(" --version print version and exit"));
457 puts(_(" --help show this message"));
460 static void check_defaults(void)
462 char *path;
464 path = wdefaultspathfordomain("WindowMaker");
466 if (access(path, R_OK) != 0) {
467 wwarning(_("could not find user GNUstep directory (%s)."), path);
469 if (system("wmaker.inst --batch") != 0) {
470 wwarning(_("There was an error while creating GNUstep directory, please "
471 "make sure you have installed Window Maker correctly and run wmaker.inst"));
472 } else {
473 wwarning(_("%s directory created with default configuration."), path);
477 wfree(path);
480 #ifdef HAVE_INOTIFY
482 * Add watch here, used to notify if configuration
483 * files have changed, using linux kernel inotify mechanism
486 static void inotifyWatchConfig(void)
488 char *watchPath = NULL;
489 inotifyFD = inotify_init(); /* Initialise an inotify instance */
490 if (inotifyFD < 0) {
491 wwarning(_("could not initialise an inotify instance."
492 " Changes to the defaults database will require"
493 " a restart to take effect. Check your kernel!"));
494 } else {
495 watchPath = wstrconcat(wusergnusteppath(), "/Defaults");
496 /* Add the watch; really we are only looking for modify events
497 * but we might want more in the future so check all events for now.
498 * The individual events are checked for in event.c.
500 inotifyWD = inotify_add_watch(inotifyFD, watchPath, IN_ALL_EVENTS);
501 if (inotifyWD < 0) {
502 wwarning(_("could not add an inotify watch on path %s."
503 "Changes to the defaults database will require"
504 " a restart to take effect."), watchPath);
505 close(inotifyFD);
508 wfree(watchPath);
510 #endif /* HAVE_INOTIFY */
512 static void execInitScript(void)
514 char *file, *paths;
516 paths = wstrconcat(wusergnusteppath(), "/Library/WindowMaker");
517 paths = wstrappend(paths, ":" DEF_CONFIG_PATHS);
519 file = wfindfile(paths, DEF_INIT_SCRIPT);
520 wfree(paths);
522 if (file) {
523 if (system(file) != 0)
524 werror(_("%s:could not execute initialization script"), file);
526 wfree(file);
530 void ExecExitScript(void)
532 char *file, *paths;
534 paths = wstrconcat(wusergnusteppath(), "/Library/WindowMaker");
535 paths = wstrappend(paths, ":" DEF_CONFIG_PATHS);
537 file = wfindfile(paths, DEF_EXIT_SCRIPT);
538 wfree(paths);
540 if (file) {
541 if (system(file) != 0)
542 werror(_("%s:could not execute exit script"), file);
544 wfree(file);
548 int main(int argc, char **argv)
550 int i_am_the_monitor, i, len;
551 char *str, *alt;
553 memset(&w_global, 0, sizeof(w_global));
554 w_global.program.state = WSTATE_NORMAL;
555 w_global.program.signal_state = WSTATE_NORMAL;
556 w_global.timestamp.last_event = CurrentTime;
557 w_global.timestamp.focus_change = CurrentTime;
559 /* setup common stuff for the monitor and wmaker itself */
560 WMInitializeApplication("WindowMaker", &argc, argv);
562 memset(&wPreferences, 0, sizeof(wPreferences));
564 wPreferences.fallbackWMs = WMCreateArray(8);
565 alt = getenv("WINDOWMAKER_ALT_WM");
566 if (alt != NULL)
567 WMAddToArray(wPreferences.fallbackWMs, wstrdup(alt));
569 WMAddToArray(wPreferences.fallbackWMs, wstrdup("blackbox"));
570 WMAddToArray(wPreferences.fallbackWMs, wstrdup("metacity"));
571 WMAddToArray(wPreferences.fallbackWMs, wstrdup("fvwm"));
572 WMAddToArray(wPreferences.fallbackWMs, wstrdup("twm"));
573 WMAddToArray(wPreferences.fallbackWMs, NULL);
574 WMAddToArray(wPreferences.fallbackWMs, wstrdup("rxvt"));
575 WMAddToArray(wPreferences.fallbackWMs, wstrdup("xterm"));
577 i_am_the_monitor = 1;
579 for (i = 1; i < argc; i++) {
580 if (strncmp(argv[i], "--for-real", strlen("--for-real")) == 0) {
581 i_am_the_monitor = 0;
582 break;
583 } else if (strcmp(argv[i], "-display") == 0 || strcmp(argv[i], "--display") == 0) {
584 i++;
585 if (i >= argc) {
586 wwarning(_("too few arguments for %s"), argv[i - 1]);
587 exit(0);
589 DisplayName = argv[i];
593 DisplayName = XDisplayName(DisplayName);
594 len = strlen(DisplayName) + 64;
595 str = wmalloc(len);
596 snprintf(str, len, "DISPLAY=%s", DisplayName);
597 putenv(str);
599 if (i_am_the_monitor)
600 return MonitorLoop(argc, argv);
601 else
602 return real_main(argc, argv);
605 static int real_main(int argc, char **argv)
607 int i;
608 char *pos;
609 int d, s;
611 setlocale(LC_ALL, "");
612 wsetabort(wAbort);
614 /* for telling WPrefs what's the name of the wmaker binary being ran */
615 setenv("WMAKER_BIN_NAME", argv[0], 1);
617 ArgCount = argc;
618 Arguments = wmalloc(sizeof(char *) * (ArgCount + 1));
619 for (i = 0; i < argc; i++) {
620 Arguments[i] = argv[i];
622 /* add the extra option to signal that we're just restarting wmaker */
623 Arguments[argc - 1] = "--for-real=";
624 Arguments[argc] = NULL;
626 ProgName = strrchr(argv[0], '/');
627 if (!ProgName)
628 ProgName = argv[0];
629 else
630 ProgName++;
632 if (argc > 1) {
633 for (i = 1; i < argc; i++) {
634 if (strcmp(argv[i], "-nocpp") == 0 || strcmp(argv[i], "--no-cpp") == 0) {
635 wwarning(_("option \"%s\" is deprecated, please remove it from your script"), argv[i]);
636 } else if (strcmp(argv[i], "--for-real") == 0) {
637 wPreferences.flags.restarting = 0;
638 } else if (strcmp(argv[i], "--for-real=") == 0) {
639 wPreferences.flags.restarting = 1;
640 } else if (strcmp(argv[i], "--for-real-") == 0) {
641 wPreferences.flags.restarting = 2;
642 } else if (strcmp(argv[i], "-no-autolaunch") == 0
643 || strcmp(argv[i], "--no-autolaunch") == 0) {
644 wPreferences.flags.noautolaunch = 1;
645 } else if (strcmp(argv[i], "-dont-restore") == 0 || strcmp(argv[i], "--dont-restore") == 0) {
646 wPreferences.flags.norestore = 1;
647 } else if (strcmp(argv[i], "-nodock") == 0 || strcmp(argv[i], "--no-dock") == 0) {
648 wPreferences.flags.nodock = 1;
649 wPreferences.flags.nodrawer = 1;
650 } else if (strcmp(argv[i], "-noclip") == 0 || strcmp(argv[i], "--no-clip") == 0) {
651 wPreferences.flags.noclip = 1;
652 } else if (strcmp(argv[i], "-nodrawer") == 0 || strcmp(argv[i], "--no-drawer") == 0) {
653 wPreferences.flags.nodrawer = 1;
654 } else if (strcmp(argv[i], "-version") == 0 || strcmp(argv[i], "--version") == 0) {
655 printf("Window Maker %s\n", VERSION);
656 exit(0);
657 } else if (strcmp(argv[i], "--global_defaults_path") == 0) {
658 printf("%s/%s\n", SYSCONFDIR, GLOBAL_DEFAULTS_SUBDIR);
659 exit(0);
660 } else if (strcmp(argv[i], "-locale") == 0 || strcmp(argv[i], "--locale") == 0) {
661 i++;
662 if (i >= argc) {
663 wwarning(_("too few arguments for %s"), argv[i - 1]);
664 exit(0);
666 w_global.locale = argv[i];
667 } else if (strcmp(argv[i], "-display") == 0 || strcmp(argv[i], "--display") == 0) {
668 i++;
669 if (i >= argc) {
670 wwarning(_("too few arguments for %s"), argv[i - 1]);
671 exit(0);
673 DisplayName = argv[i];
674 } else if (strcmp(argv[i], "-visualid") == 0 || strcmp(argv[i], "--visual-id") == 0) {
675 i++;
676 if (i >= argc) {
677 wwarning(_("too few arguments for %s"), argv[i - 1]);
678 exit(0);
680 if (initWVisualID(argv[i]) != 0) {
681 wwarning(_("bad value for visualid: \"%s\""), argv[i]);
682 exit(0);
684 } else if (strcmp(argv[i], "-static") == 0 || strcmp(argv[i], "--static") == 0
685 #ifndef HAVE_INOTIFY
686 || strcmp(argv[i], "--no-polling") == 0
687 #endif
689 wPreferences.flags.noupdates = 1;
690 } else if (strcmp(argv[i], "--help") == 0) {
691 print_help();
692 exit(0);
693 } else {
694 printf(_("%s: invalid argument '%s'\n"), argv[0], argv[i]);
695 printf(_("Try '%s --help' for more information\n"), argv[0]);
696 exit(1);
701 if (!wPreferences.flags.noupdates) {
702 /* check existence of Defaults DB directory */
703 check_defaults();
706 if (w_global.locale) {
707 setenv("LANG", w_global.locale, 1);
708 } else {
709 w_global.locale = getenv("LC_ALL");
710 if (!w_global.locale) {
711 w_global.locale = getenv("LANG");
715 setlocale(LC_ALL, "");
717 if (!w_global.locale || strcmp(w_global.locale, "C") == 0 || strcmp(w_global.locale, "POSIX") == 0)
718 w_global.locale = NULL;
719 #ifdef I18N
720 if (getenv("NLSPATH")) {
721 bindtextdomain("WindowMaker", getenv("NLSPATH"));
722 #if defined(MENU_TEXTDOMAIN)
723 bindtextdomain(MENU_TEXTDOMAIN, getenv("NLSPATH"));
724 #endif
725 } else {
726 bindtextdomain("WindowMaker", LOCALEDIR);
727 #if defined(MENU_TEXTDOMAIN)
728 bindtextdomain(MENU_TEXTDOMAIN, LOCALEDIR);
729 #endif
731 bind_textdomain_codeset("WindowMaker", "UTF-8");
732 #if defined(MENU_TEXTDOMAIN)
733 bind_textdomain_codeset(MENU_TEXTDOMAIN, "UTF-8");
734 #endif
735 textdomain("WindowMaker");
737 if (!XSupportsLocale()) {
738 wwarning(_("X server does not support locale"));
741 if (XSetLocaleModifiers("") == NULL) {
742 wwarning(_("cannot set locale modifiers"));
744 #endif
746 if (w_global.locale) {
747 char *ptr;
749 w_global.locale = wstrdup(w_global.locale);
750 ptr = strchr(w_global.locale, '.');
751 if (ptr)
752 *ptr = 0;
755 /* open display */
756 dpy = XOpenDisplay(DisplayName);
757 if (dpy == NULL) {
758 wfatal(_("could not open display \"%s\""), XDisplayName(DisplayName));
759 exit(1);
762 if (fcntl(ConnectionNumber(dpy), F_SETFD, FD_CLOEXEC) < 0) {
763 werror("error setting close-on-exec flag for X connection");
764 exit(1);
768 if (getWVisualID(0) < 0) {
770 * If unspecified, use default visual instead of waiting
771 * for wrlib/context.c:bestContext() that may end up choosing
772 * the "fake" 24 bits added by the Composite extension.
773 * This is required to avoid all sort of corruptions when
774 * composite is enabled, and at a depth other than 24.
776 setWVisualID(0, (int)DefaultVisual(dpy, DefaultScreen(dpy))->visualid);
779 /* check if the user specified a complete display name (with screen).
780 * If so, only manage the specified screen */
781 if (DisplayName)
782 pos = strchr(DisplayName, ':');
783 else
784 pos = NULL;
786 if (pos && sscanf(pos, ":%i.%i", &d, &s) == 2)
787 multiHead = False;
789 DisplayName = XDisplayName(DisplayName);
790 setenv("DISPLAY", DisplayName, 1);
792 wXModifierInitialize();
793 StartUp(!multiHead);
795 if (wScreenCount == 1)
796 multiHead = False;
798 execInitScript();
799 #ifdef HAVE_INOTIFY
800 inotifyWatchConfig();
801 #endif
802 EventLoop();
803 return -1;