home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / TEDdesk / reloc.8 / $TED_DIR / bin / dtsession_res < prev    next >
Text File  |  1998-08-19  |  4KB  |  163 lines

  1. #!/bin/ksh
  2. # *                                                                      *
  3. # * (c) Copyright 1994, 1995 TriTeal Corporation                         *
  4. # * (c) Copyright 1993, 1994 Hewlett-Packard Company                     *
  5. # * (c) Copyright 1993, 1994 International Business Machines Corp.       *
  6. # * (c) Copyright 1993, 1994 Sun Microsystems, Inc.                      *
  7. # * (c) Copyright 1993, 1994 Novell, Inc.                                *
  8. # *
  9. #############################################################################
  10. ###
  11. ###  File:              dtsession_res
  12. ###
  13. ###  Default Location:  /usr/dt/bin/dtsession_res
  14. ###
  15. ###  Purpose:           Load the RESOURCE_MANAGER with desktop resources
  16. ###
  17. ###  Description:       This script is invoked to load or reload the 
  18. ###                     RESOURCE_MANAGER from the desktop resource files.
  19. ###
  20. ###  Invoked by:        The desktop Session Manager at session startup, 
  21. ###                     or user by means of 'dtaction LoadResources'.
  22. ###                     This script should not be invoked directly.
  23. ###
  24. ###  Product:           @(#)TED 4.2 Alpha 99-4200-00, dtsession_res 1.00
  25. ###
  26. ###                     (c) Copyright 1994, 1995 TriTeal Corporation
  27. ###                     (c) Copyright 1993, 1994 Hewlett-Packard Company
  28. ###                     (c) Copyright 1993, 1994 International Business
  29. ###                         Machines Corp.
  30. ###                     (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  31. ###                     (c) Copyright 1993, 1994 Unix System Labs, Inc., 
  32. ###                         a subsidiary of Novell, Inc.
  33. ###
  34. ###  Note:              Please do not modify this file.
  35. ###                     Later product updates will overwrite this file.
  36. ###
  37. ###  Revision:          $XConsortium: dtloadresources.src /main/cde1_maint/3 1995/10/03 17:03:58 gtsang $
  38. ###
  39. #############################################################################
  40.  
  41. Msg()
  42. {
  43. #
  44. # $1 - message catalog number
  45. # $2 - fallback message text
  46. #
  47.   echo "$2"
  48. #dspmsg dtsession_res.cat -s 1 $1 "$2"
  49. }
  50.  
  51. Usage()
  52. {
  53. #
  54. # $1 - message catalog number 
  55. #
  56.   Msg 1 "dtsession_res -load|-merge [-system] [-xdefaults] [-file <name>]"
  57.   case $1 in
  58.     needArgs) Msg 2 "Option -load or -merge must be specified";;
  59.     xrdbOptDone) Msg 3 "Option -load or -merge already specified";;
  60.     needFile) Msg 4 "Missing <filename> after -file option";;
  61.     unknownArg) Msg 5 "Unknown option specified";;
  62. #needOption);;    #this is the Usage statement above
  63.   esac
  64.   exit 1
  65. }
  66.  
  67.  
  68. #
  69. # Parse options
  70. #
  71. if [ $# -eq 0 ]; then
  72.   Usage needArgs
  73. fi
  74.  
  75.  
  76.  
  77. rFactory=/usr/dt/config/$LANG/sys.resources
  78. rFactoryC=/usr/dt/config/C/sys.resources
  79.  
  80. rCustom=/etc/dt/config/$LANG/sys.resources
  81.  
  82. rXdefaults=$HOME/.Xdefaults
  83.  
  84. xrdbOption=""
  85. resourceFiles=""
  86.  
  87. while [ $# -gt 0 ]; do
  88.   case $1 in 
  89.     -load|-merge)
  90. #
  91. # xrdb option specified
  92. #
  93.       if [ ! -z "$xrdbOption" ]; then
  94.         Usage xrdbOptDone
  95.       fi
  96.       xrdbOption=$1
  97.       ;;
  98.     -system)
  99. #
  100. # locate system resources
  101. #
  102.  
  103.       if [ -r "$rFactory" ]; then
  104.         resourceFiles="$resourceFiles $rFactory"
  105.       elif [ -r "$rFactoryC" ]; then
  106.         resourceFiles="$resourceFiles $rFactoryC"
  107.       fi
  108. #
  109. # Locate customized system resources
  110. #
  111.       if [ -r "$rCustom" ]; then
  112.         resourceFiles="$resourceFiles $rCustom"
  113.       fi
  114.       ;;
  115.     -xdefaults)
  116. #
  117. # Locate .Xdefaults
  118. #
  119.       if [ -r "$rXdefaults" ]; then
  120.         resourceFiles="$resourceFiles $rXdefaults"
  121.       fi
  122.  
  123.       ;;
  124.     -file)
  125. #
  126. # Locate specified file
  127. #
  128.       shift
  129.       if [ -z "$1" ]; then
  130.         Usage needFile
  131.       fi
  132.       if [ -r "$1" ]; then
  133.         resourceFiles="$resourceFiles $1"
  134.       fi
  135.       ;;
  136.     *) Usage unknownArg;;
  137.   esac
  138.   shift
  139. done
  140.  
  141. if [ -z "$xrdbOption" ]; then
  142.   Usage needOption
  143. fi
  144.  
  145. #converts ":0" to "0", but leaves "pablo:0" as is
  146. display=${DISPLAY##:}
  147.  
  148. #converts "blanco.flexicat.com:0.0" to "blanco_flexicat_com_0"
  149. display=$(echo ${display%.*} | /usr/bin/tr ".:" "__") 
  150.  
  151.  
  152.  
  153. (
  154.   echo "dtsession_res*files: $resourceFiles"
  155.   if [ ! -z "$resourceFiles" ]; then
  156.     cat $resourceFiles
  157.   fi
  158. ) | /usr/bin/X11/xrdb -quiet $xrdbOption -DDISPLAY_$display
  159.  
  160.  
  161.  
  162.  
  163.