10 * Starts the given application by passing it through a shell. We use double fork
11 * to avoid zombie processes. As the started application’s parent exits (immediately),
12 * the application is reparented to init (process-id 1), which correctly handles
13 * childs, so we don’t have to do it :-).
15 * The shell is determined by looking for the SHELL environment variable. If it
16 * does not exist, /bin/sh is used.
19 void start_application(const char *command) {
23 /* Stores the path of the shell */
24 static const char *shell = NULL;
27 if ((shell = getenv("SHELL")) == NULL)
30 /* This is the child */
31 execl(shell, shell, "-c", command, NULL);
40 * Checks a generic cookie for errors and quits with the given message if there
44 void check_error(xcb_connection_t *connection, xcb_void_cookie_t cookie, char *err_message) {
45 xcb_generic_error_t *error = xcb_request_check(connection, cookie);
47 fprintf(stderr, "ERROR: %s : %d\n", err_message , error->error_code);
48 xcb_disconnect(connection);