#!/usr/local/bin/ksh93
# ####################################################################
# ##  File:              0020.dtims
# ##
# ##  Default Location:  /usr/local/dt/config/Xsession.d/
# ##
# ##  Purpose:           Start desktop input method server if required
# ##
# ##  Description:
# ##                     This script is invoked by means of the Xsession file
# ##                     at user login. It starts an input method server as
# ##                     required for selected locales.
# ##
# ##  Invoked by:        /usr/local/dt/bin/Xsession
# ##
# ##  Product:           @(#)Common Desktop Environment 1.0
# ##
# ##  Note:
# ##
# ##    The /usr/local/dt/config/Xsession.d/0020.dtims file is a
# ##    factory-default file and will be unconditionally overwritten upon
# ##    subsequent installation. To customize input method server startup
# ##    behavior, copy this file to the configuration directory,
# ##    /etc/dt/config/Xsession.d and customize that version
# ##    of the file.
# ##
# ##    The value of DTSTARTIMS determines whether this file,
# ##    /usr/local/dt/config/Xsession.d/0020.dtims, will start
# ##    the specified input method server. Should an input method server
# ##    be started from /etc/dt/config/Xsession.d/0020.dtims
# ##    or should an input method server not be desired, unset DTSTARTIMS
# ##    to prevent this file from starting one.
# ##
# ##    The general logic of this file is:
# ##
# ##    if [ "$DTSTARTIMS" = "True" ]
# ##    then
# ##      <start input method server>
# ##      unset DTSTARTIMS
# ##    fi
# ##
# ##  Revision:          $XConsortium: 0020.dtims /main/2 1996/07/18 14:23:41 drk $
# ##
# ##  (c) Copyright 1993, 1994 Hewlett-Packard Company
# ##  (c) Copyright 1993, 1994 International Business Machines Corp.
# ##  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
# ##  (c) Copyright 1993, 1994 Novell, Inc.
# ##
# ####################################################################
if [ "$DTSTARTIMS" = "True" ]
then
#
# Start HP platform IM (Input Method) server for Asian locales.
#
  if [[ -z "${CDE_IMS_PID:-}" ]]
  then
    case "$LANG" in
      ja_JP*    | japanese*     |       ko_KR*    | korean*       |       zh_TW*    | chinese-t*    |       zh_CN*    | chinese-s*    )
        DTIMS_SCRIPT=0020.dtims
        DTIMS_CMD="/usr/local/dt/bin/dtimsstart -env -shell ksh"
        if [[ -x "${DTIMS_CMD%% *}" ]]; then
          # execute DTIMS_CMD and 'eval' its output
          Log "$DTIMS_SCRIPT: \"${DTIMS_CMD%% *}\" started."
          eval ` $DTIMS_CMD `
          #  set CDE_IMS_PID to 0 (IMS started, but its pid is unknown.)
          CDE_IMS_PID=0
        else
          Log "$DTIMS_SCRIPT: \"${DTIMS_CMD%% *}\" not found."
        fi
        unset DTIMS_CMD DTIMS_SCRIPT
        ;;
    esac
    unset DTSTARTIMS
  fi
fi
# #########################         eof       #####################
