OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.1 KiB

  1. . $SDEROOT/lib/libsde.in
  2. # Determine the command to be used
  3. sdecommand=${0##*/}
  4. # Check if the command is implemented
  5. if [ ! -d $SDEROOT/lib/$sdecommand ]; then
  6. echo_abort 1 "Command $sdecommand not yet implemented"
  7. fi
  8. # Check descriminator itself.
  9. if [ -f "$SDEROOT/lib/$sdecommand/$1.in" ]; then
  10. discriminator="$1"; shift
  11. # Check if discriminator alias was used.
  12. elif grep -q "^#Alias: $1$" $SDEROOT/lib/$sdecommand/* 2> /dev/null; then
  13. # Use the alias by determining what descriptor the alias
  14. # belongs to.
  15. discriminator="$( grep -l "^#Alias: $1$" $SDEROOT/lib/$sdecommand/* 2> /dev/null |
  16. head -n 1 | sed -e 's,.*/,,' | sed -e 's,\.in,,' )"
  17. shift
  18. elif [ -f "$SDEROOT/lib/$sdecommand/default.in" ]; then
  19. # Command has a default handler, so use it.
  20. discriminator=default
  21. else
  22. # unknown command
  23. echo_error "Discriminator '$COLOR_INFO$1$COLOR_NORMAL' not understood."
  24. # revert back to help on the current command
  25. discriminator=
  26. fi
  27. echo "Discriminator is: $discriminator"
  28. . $SDEROOT/lib/$sdecommand/${discriminator}.in $@