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.

81 lines
2.4 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: lib/output/parse-config
  5. # Copyright (C) 2006 - 2008 The OpenSDE Project
  6. # Copyright (C) 2004 - 2006 The T2 SDE Project
  7. # Copyright (C) 1998 - 2003 Clifford Wolf
  8. #
  9. # More information can be found in the files COPYING and README.
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; version 2 of the License. A copy of the
  14. # GNU General Public License can be found in the file COPYING.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. . lib/output/terminal
  17. output_proc() {
  18. columns=$1
  19. plugins=
  20. for x in $( ls lib/output ); do
  21. if [ -f lib/output/$x/functions.sh ]; then
  22. eval "y=\$SDECFG_OUTPUT_$( echo $x | tr a-z A-Z )"
  23. if [ "$y" = 1 ]; then
  24. . lib/output/$x/functions.sh
  25. plugins="$plugins $x"
  26. fi
  27. fi
  28. done
  29. while read -r type data; do
  30. # always output to the terminal
  31. for plugin in terminal $plugins; do
  32. eval "echo_${type}_${plugin} $data"
  33. done
  34. done
  35. exit 0
  36. }
  37. if [ -z "$SDE_OUPUT_PLUGIN_PROC_ACTIVE" ]; then
  38. export SDE_OUPUT_PLUGIN_PROC_ACTIVE=1
  39. # since the output plugin's stdin is the pipe, we help it out
  40. # with the columns for pretty printing output
  41. [ "${columns:=$COLUMNS}" ] || columns="$( stty size 2> /dev/null | cut -d' ' -f2 )"
  42. [ "$columns" ] || columns=80
  43. exec 199> >( output_proc $columns )
  44. fi
  45. echo_sched() {
  46. local request="$1" tag ; shift
  47. local nl=$'\n' tc="'"
  48. # only for Build-Target, we want to duplication
  49. # the terminal output, on the log file at fd/201
  50. [ ! -e /proc/self/fd/201 ] ||
  51. echo_${request}_terminal "$@" >&201
  52. # add each argument, seperated in quotes, after newlines and
  53. # tick quotes got escaped
  54. for tag; do
  55. tag=${tag//\\\\/\\\\}
  56. tag=${tag//$tc/\\$tc}
  57. tag=${tag//$nl/\\n}
  58. request="$request \$'$tag'"
  59. done
  60. echo "$request" >&199
  61. }
  62. echo_header() { echo_sched header "$@" ; }
  63. echo_status() { echo_sched status "$@" ; }
  64. echo_warning() { echo_sched warning "$@" ; }
  65. echo_error() { echo_sched error "$@" ; }
  66. echo_pkg_deny() { echo_sched pkg_deny "$@" ; }
  67. echo_pkg_start() { echo_sched pkg_start "$@" ; }
  68. echo_pkg_finish() { echo_sched pkg_finish "$@" ; }
  69. echo_pkg_abort() { echo_sched pkg_abort "$@" ; }
  70. echo_errorquote() { echo_sched errorquote "$@" ; }