makeMessCat 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #! /bin/ksh
  2. typeset USE_LANG_DIR="."
  3. typeset VERSION=""
  4. typeset REMOVE=${REMOVE:-removeVmsg}
  5. while [ $# -gt 0 ]; do
  6. case "$1" in
  7. -v) # version string comes on command line
  8. shift;
  9. [ -n "$1" ] && VERSION="@(#)$1"
  10. ;;
  11. -d) # use old vue2.0 method accessing vueversion.h
  12. USE_LANG_DIR="../$2"
  13. [ -r ../../../../X11/vueversion.h ] && {
  14. VERSION=`grep static ../../../../X11/vueversion.h | \
  15. sed s/static.*\=\ \"// | \
  16. sed s/\".*// ` ;
  17. }
  18. ;;
  19. -r) # prevent removal of temp ".vmsg" files
  20. REMOVE=""
  21. ;;
  22. -m) #
  23. GENCAT_OPTIONS=-m
  24. ;;
  25. *) # done with options
  26. break;
  27. ;;
  28. esac
  29. shift
  30. done
  31. #
  32. # Added while logic below to parse multiple .msg files form the arguments,
  33. # this logic assumes the first .msg file passed in will be the name of the
  34. # .cat file, thus remaining compatible with the old makeMesgcat.
  35. #
  36. base_file=${1%.*}
  37. while [ $# -gt 1 ]; do
  38. base=${1%.*} # strip any extension
  39. [ -n "$VERSION" ] && VERSION="\\\n$VERSION"
  40. sed "s/@(#)version_goes_here/$VERSION/" <$USE_LANG_DIR/$base.msg >$USE_LANG_DIR/$base.vmsg
  41. set -A msg_files "$msg_files $USE_LANG_DIR/$base.vmsg"
  42. shift
  43. done
  44. echo "Running gencat on $msg_files with LANG set to $1 "
  45. rm -f $USE_LANG_DIR/$base.cat
  46. LANG=$1 gencat $GENCAT_OPTIONS $USE_LANG_DIR/$base_file.cat $msg_files
  47. LANG=C
  48. chmod -w $USE_LANG_DIR/$base_file.cat
  49. if [ "$REMOVE" = removeVmsg ]
  50. then
  51. echo " Removing $msg_files "
  52. rm -f $msg_files
  53. else
  54. echo " Not removing $msg_files "
  55. fi