The gotoken-init is based on the standard openwin-init file, with the addition of the following section:
if [ "$OW_WINDOW_MANAGER" = ':' ]; then toolwait= else toolwait=toolwait if unset OW_WINDOW_MANAGER case "$GG_TOKEN" in xterm) $toolwait $OPENWINHOME/bin/xterm ;; *) echo >&2 "$OPENWINHOME/lib/gotoken-init: error: \'$GG_TOKEN\': case not found."] echo >&2 " Using defaults." . $OPENWINHOME/lib/openwin-init ;; esac
This section parses the $GG_TOKEN (with any session or window manager controls removed) and starts the appropriate client or clients. In the example, only one startup control, xterm, is defined. Any other token returns an error and use the default OpenWindows startup.
If nowm is specified, the $toolwait variable sets the $OW_WINDOW_MANAGER variable (in conformance with the standard OpenWindows method of specifying an alternate window manager) to the colon. This results in no window manager being executed when the shell interprets the colon as a null command.
By modifying the $toolwait variable, we know that if there is a window manager running, the $toolwait program is invoked to start xterm (which runs in the background). When no window manager is running, the last client started by gotoken-init must not run in the background, or the GlobalInit program thinks that the session is over and shuts down the X server. Conditionally running the toolwait program solves this problem.